Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
proptest.C
Go to the documentation of this file.
1 /* *******************************************************************
2  * Rocstar Simulation Suite *
3  * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4  * *
5  * Illinois Rocstar LLC *
6  * Champaign, IL *
7  * www.illinoisrocstar.com *
8  * sales@illinoisrocstar.com *
9  * *
10  * License: See LICENSE file in top level of distribution package or *
11  * http://opensource.org/licenses/NCSA *
12  *********************************************************************/
13 /* *******************************************************************
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17  * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21  * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22  *********************************************************************/
23 // $Id: proptest.C,v 1.33 2008/12/06 08:45:28 mtcampbe Exp $
24 
25 #include "roccom.h"
26 
27 #include <cstdio>
28 #include <iostream>
29 #include <fstream>
30 #include <algorithm>
31 #include <cstring>
32 #include <string>
33 #include <cstdlib>
34 #include <cmath>
35 #include <cassert>
36 #include <sstream>
37 #include "roccom_assertion.h"
38 #include "../Rocblas/include/Rocblas.h"
39 #include "../Rocsurf/include/Rocsurf.h"
40 
41 #include "../Rocsurf/test/IM_Reader.h"
42 
43 #ifdef MESH_ADAPT
44 #include "AdaptCOMWindow.h"
45 #endif
46 
47 
48 using namespace std;
49 
51 COM_EXTERN_MODULE( Rocmap);
53 COM_EXTERN_MODULE( Rocsurf);
55 
56 void load_modules() {
58  COM_LOAD_MODULE_STATIC_DYNAMIC(Rocmap, "MAP");
60  COM_LOAD_MODULE_STATIC_DYNAMIC(Rocsurf, "SURF");
62 }
63 
64 static int rank = 0;
65 
66 void print_usage( int argc, char *argv[]) {
67  if ( argc <= 2) {
68  cout << "Usage: " << argv[0] << " <surffile> <controlfile>" << std::endl;
69 
70  exit(-1);
71  }
72 }
73 
74 struct Control_parameter {
75  Control_parameter() : perturb(0), speed(0), sploc('n'), timestep(0),
76  steps(0), start(0), interval(0), remesh_interval(10),
77  subadapt(0.5), adapt_iter(2), do_redist(1), do_collapse(1),
78  do_flip(1), do_split(1), collapse_ratio(0),
79  split_angle(0), refine(1), edge_len(0) {}
80 
81  string method;
82  string wavefrontal;
83  string normaldif;
84  string eigthres;
85  string courant;
86  string fangle;
87  string sangle;
88  string smoother;
89  string rediter;
90  string feature_layer;
91  string weight;
92  string format;
93 
94  double perturb;
95  double speed;
96  char sploc;
97  double timestep;
98  int steps;
99  int start;
100  int interval;
101  int remesh_interval;
102  string verbose;
103 
104  // The following options are for mesh adaptation
105  double subadapt;
106  int adapt_iter;
107  int do_redist;
108  int do_collapse;
109  int do_flip;
110  int do_split;
111  double collapse_ratio;
112  double split_angle;
113  double refine;
114  double edge_len;
115 };
116 
117 void read_control_file( const char *fname, Control_parameter &cp) {
118  /* Sample control file:
119  * method: fo # method: fo and mp
120  * wavefrontal: 1 # wavefrontal expansion
121  * normaldif: 1 # normal diffusion
122  * eigthres: 1.e-4 # threshold for null space: 0..1 (1.e-4 default)
123  * courant: 0.5 # courant constant
124  * fangle: 25 # feature edge angle: between 0 and 180
125  * sangle: 65 # feature edge angle: between 0 and 180
126  * smoother: angle # type of mesh-smoothing algorithm
127  * rediter: 1 # Number of iterations for vertex redistribution
128  * speed: 0.1 # Speed
129  * sploc: e # location of speed: n or e
130  * timestep: 0.001 # time step
131  * steps: 100 # number of time steps
132  * interval: 10 # output intervals
133  * remesh_interval: 10 # remesh intervals
134  * weight: 3 # angle weighted
135  * verbose: 1 # verbose level
136  *
137  * adapt_iter: 2
138  * do_flip: 1
139  * do_split: 1
140  * do_redist: 1
141  * do_collapse: 1
142  * collapse_ratio: 0.1
143  * split_angle: 2.618 # (150 degrees)
144  */
145  ifstream is(fname); COM_assertion_msg( is, "File does not exist");
146 
147  while ( !is.eof()) {
148  char buf[255];
149  is.get( buf, 255, ':');
150  if ( buf[0] == '\0') { is.getline( buf, 255); continue; }
151 
152  istringstream istr(buf);
153  string keyword; istr >> keyword;
154  is.getline( buf, 255, ':');
155 
156  if ( keyword == "method")
157  is >> cp.method;
158  else if ( keyword == "wavefrontal")
159  is >> cp.wavefrontal;
160  else if ( keyword == "normaldif")
161  is >> cp.normaldif;
162  else if ( keyword == "eigthres")
163  is >> cp.eigthres;
164  else if ( keyword == "courant")
165  is >> cp.courant;
166  else if ( keyword == "fangle")
167  is >> cp.fangle;
168  else if ( keyword == "sangle")
169  is >> cp.sangle;
170  else if ( keyword == "smoother")
171  is >> cp.smoother;
172  else if ( keyword == "rediter")
173  is >> cp.rediter;
174  else if ( keyword == "perturb")
175  is >> cp.perturb;
176  else if ( keyword == "speed")
177  is >> cp.speed;
178  else if ( keyword == "sploc")
179  is >> cp.sploc;
180  else if ( keyword == "timestep")
181  is >> cp.timestep;
182  else if ( keyword == "steps")
183  is >> cp.steps;
184  else if ( keyword == "start")
185  is >> cp.start;
186  else if ( keyword == "interval")
187  is >> cp.interval;
188  else if ( keyword == "remesh_interval")
189  is >> cp.remesh_interval;
190  else if ( keyword == "weight")
191  is >> cp.weight;
192  else if ( keyword == "format")
193  is >> cp.format;
194  else if ( keyword == "verbose")
195  is >> cp.verbose;
196  else if ( keyword == "verbose")
197  is >> cp.verbose;
198  else if ( keyword == "subadapt")
199  is >> cp.subadapt;
200  else if ( keyword == "adapt_iter")
201  is >> cp.adapt_iter;
202  else if ( keyword == "do_redist")
203  is >> cp.do_redist;
204  else if ( keyword == "do_contract" || keyword == "do_collapse")
205  is >> cp.do_collapse;
206  else if ( keyword == "do_flip")
207  is >> cp.do_flip;
208  else if ( keyword == "do_split")
209  is >> cp.do_split;
210  else if ( keyword == "feature_layer")
211  is >> cp.feature_layer;
212  else if ( keyword == "refine")
213  is >> cp.refine;
214  else if ( keyword == "edge_len")
215  is >> cp.edge_len;
216  else if ( keyword == "collapse_ratio")
217  is >> cp.collapse_ratio;
218  else if ( keyword == "split_angle")
219  is >> cp.split_angle;
220  else
221  std::cerr << "Unknow keyword " << keyword << std::endl;
222  is.getline( buf, 255);
223  }
224 
225  if ( rank==0) std::cout << " speed is " << cp.speed << std::endl;
226 }
227 
228 void init_parameters( const Control_parameter &cntr_param) {
229  int PROP_set_option = COM_get_function_handle( "PROP.set_option");
230 
231  if ( !cntr_param.method.empty()) {
232  COM_call_function( PROP_set_option, "method", cntr_param.method.c_str());
233 
234  if ( rank==0) std::cout << "Set propagation method to " << cntr_param.method << std::endl;
235  }
236 
237  if ( !cntr_param.wavefrontal.empty()) {
238  COM_call_function( PROP_set_option, "wavefrontal", cntr_param.wavefrontal.c_str());
239  if ( rank==0) std::cout << "Set wavefrontal to " << cntr_param.wavefrontal << std::endl;
240  }
241 
242  if ( !cntr_param.normaldif.empty()) {
243  COM_call_function( PROP_set_option, "normaldif", cntr_param.normaldif.c_str());
244  if ( rank==0) std::cout << "Set normaldif to " << cntr_param.normaldif << std::endl;
245  }
246 
247  if ( !cntr_param.eigthres.empty()) {
248  COM_call_function( PROP_set_option, "eigthres", cntr_param.eigthres.c_str());
249  if ( rank==0) std::cout << "Set eigthres to " << cntr_param.eigthres << std::endl;
250  }
251 
252  if ( !cntr_param.courant.empty()) {
253  COM_call_function( PROP_set_option, "courant", cntr_param.courant.c_str());
254  if ( rank==0) std::cout << "Set courant constant to " << cntr_param.courant << std::endl;
255  }
256 
257  if ( !cntr_param.fangle.empty()) {
258  COM_call_function( PROP_set_option, "fangle", cntr_param.fangle.c_str());
259  if ( rank==0) std::cout << "Set weak-feature angle to " << cntr_param.fangle << std::endl;
260  }
261  if ( !cntr_param.sangle.empty()) {
262  COM_call_function( PROP_set_option, "sangle", cntr_param.sangle.c_str());
263  if ( rank==0) std::cout << "Set strong-feature angle to " << cntr_param.sangle << std::endl;
264  }
265 
266  if ( !cntr_param.smoother.empty()) {
267  COM_call_function( PROP_set_option, "smoother", cntr_param.smoother.c_str());
268  if ( rank==0) std::cout << "Set smoother to " << cntr_param.smoother << std::endl;
269  }
270 
271  if ( !cntr_param.rediter.empty()) {
272  COM_call_function( PROP_set_option, "rediter", cntr_param.rediter.c_str());
273  if ( rank==0) std::cout << "Set rediter to " << cntr_param.rediter << std::endl;
274  }
275 
276  if ( !cntr_param.feature_layer.empty()) {
277  COM_call_function( PROP_set_option, "feature_layer",
278  cntr_param.feature_layer.c_str());
279  if ( rank==0)
280  std::cout << "Set feature_layer to " << cntr_param.feature_layer << std::endl;
281  }
282 
283  if ( !cntr_param.verbose.empty()) {
284  COM_call_function( PROP_set_option, "verbose", cntr_param.verbose.c_str());
285 
286  if ( rank==0) std::cout << "Set verbose level to " << cntr_param.verbose << std::endl;
287  }
288 
289  if ( !cntr_param.weight.empty()) {
290  COM_call_function( PROP_set_option, "weight", cntr_param.weight.c_str());
291  if ( rank==0) std::cout << "Set weight to " << cntr_param.weight << std::endl;
292  }
293 
294 }
295 
296 // Read in a surface pmesh, and return its window name.
297 std::string read_in_mesh ( const char *fname) {
298  if ( rank==0) cout << "Reading surface mesh file \"" << fname << '"' << endl;
299 
300  std::string fname_str(fname);
301 
302  std::string::size_type pos = fname_str.find_first_of( ".");
303  const string wname = fname_str.substr( 0, pos);
304 
305  if ( rank==0) cout << "Creating window \"" << wname << '"' << endl;
306 
307  IM_Reader im_reader;
308  int npanes = im_reader.read_winmesh( fname, wname, false);
309  COM_assertion_msg( npanes>=0, "Failed to read in mesh file. File empty?");
310 
311  return wname;
312 }
313 
314 void rescale_object( std::string &wname, double alpha,
315  const SURF::Vector_3<double> &origin) {
316  // Rescale and translate the object.
317  COM::Window *win=COM_get_roccom()->get_window_object(wname);
318  COM::Attribute *nc=win->attribute("nc");
319 
320  // Rescale the radius to 0.15
321  Rocblas::mul_scalar( nc, &alpha, nc);
322 
323  // Translate the origin to (0.5,0.75, 0.5);
324  COM::Attribute *x=win->attribute("1-nc");
325  COM::Attribute *y=win->attribute("2-nc");
326  COM::Attribute *z=win->attribute("3-nc");
327 
328  Rocblas::add_scalar( x, &origin[0], x);
329  Rocblas::add_scalar( y, &origin[1], y);
330  Rocblas::add_scalar( z, &origin[2], z);
331 }
332 
333 // Initialize the constraints for ACM Rocflu mesh.
334 void init_constraints_acmflu( const string &wname) {
335 
336  int SURF_centers = COM_get_function_handle( "SURF.interpolate_to_centers");
337  int nc_handle = COM_get_attribute_handle( (wname+".nc").c_str());
338  int centers_handle = COM_get_attribute_handle( (wname+".facecenters").c_str());
339  COM_call_function( SURF_centers, &nc_handle, &centers_handle);
340 
341  // Set speed for different panes.
342  int *pane_ids, npanes;
343  COM_get_panes( wname.c_str(), &npanes, &pane_ids);
344 
345  for ( int i=0; i<npanes; ++i) {
346  bool not_interacting;
347  if ( COM_get_attribute_handle((wname+".bcflag").c_str())>0) {
348  int *bcflag;
349  COM_get_array( (wname+".bcflag").c_str(), pane_ids[i], &bcflag);
350 
351  not_interacting = (*bcflag == 2);
352  }
353  else
354  not_interacting = (pane_ids[i] == 3);
355 
356  if ( !not_interacting) continue;
357 
358  int pid = pane_ids[i], nelems, ngelems;
359  COM_get_size( (wname+".cnstr_types_facial").c_str(), pid, &nelems, &ngelems);
360  int *cnstr_types;
361  COM_get_array( (wname+".cnstr_types_facial").c_str(), pid, (void**)&cnstr_types);
362  double *spds;
363  COM_get_array( (wname+".spds").c_str(), pid, (void**)&spds);
364 
365  MAP::Vector_3<double> *centers;
366  COM_get_array( (wname+".facecenters").c_str(), pid, (void**)&centers);
367 
368  // Loop through all faces
369  for ( int j=0; j<nelems-ngelems; ++j) {
370  spds[j] = 0; // Set speed to zero.
371 
372  if ( centers[j].x() <= 1.e-10 || centers[j].x() > 0.047624)
373  cnstr_types[j] = 2; // Fix the nodes at two ends.
374  else
375  cnstr_types[j] = 'x'; // Allow nodes to move only along x dir.
376  }
377  }
378 
379  COM_free_buffer( &pane_ids);
380 
381  int cnstr_handle = COM_get_attribute_handle((wname+".cnstr_types_facial").c_str());
382  int PROP_set_cnstr = COM_get_function_handle( "PROP.set_constraints");
383  COM_call_function( PROP_set_cnstr, &cnstr_handle);
384 }
385 
386 
387 // Initialize the constraints for ACM Rocfrac mesh.
388 void init_constraints_acmfrac( const string &wname) {
389  // Set constraint for pane 2 so that nodes can move only along x-direction
390  int *cnstr_types;
391  COM_get_array( (wname+".cnstr_types_panel").c_str(), 2, (void**)&cnstr_types);
392  *cnstr_types = 'x';
393 
394  int PROP_set_cnstr = COM_get_function_handle( "PROP.set_constraints");
395  int cnstr_handle = COM_get_attribute_handle( (wname+".cnstr_types_panel").c_str());
396 
397  COM_call_function( PROP_set_cnstr, &cnstr_handle);
398 }
399 
400 template <class T>
401 T square(T t) { return t*t; }
402 
403 // Initialize the constraints for Star slice.
404 void init_constraints_starslice( const string &wname,
405  const Control_parameter &cntr_param) {
406  int BLAS_copy_scalar = COM_get_function_handle( "BLAS.copy_scalar");
407  int cnstr_handle = COM_get_attribute_handle( (wname+".cnstr_types_facial").c_str());
408  int zero = 0;
409  COM_call_function( BLAS_copy_scalar, &zero, &cnstr_handle);
410 
411  int SURF_normals = COM_get_function_handle( "SURF.compute_element_normals");
412  int nrms_handle = COM_get_attribute_handle( (wname+".facenormals").c_str());
413  COM_call_function( SURF_normals, &nrms_handle);
414 
415  int SURF_centers = COM_get_function_handle( "SURF.interpolate_to_centers");
416  int nc_handle = COM_get_attribute_handle( (wname+".nc").c_str());
417  int centers_handle = COM_get_attribute_handle( (wname+".facecenters").c_str());
418  COM_call_function( SURF_centers, &nc_handle, &centers_handle);
419 
420  // Set speed for different panes.
421  int *pane_ids, npanes;
422  COM_get_panes( wname.c_str(), &npanes, &pane_ids);
423 
424  for ( int i=0; i<npanes; ++i) {
425  int pid = pane_ids[i];
426  MAP::Vector_3<double> *nrms, *centers;
427  COM_get_array( (wname+".facenormals").c_str(), pid, (void**)&nrms);
428  COM_get_array( (wname+".facecenters").c_str(), pid, (void**)&centers);
429 
430  // Set for pane 2 separately
431  int *cnstr_types, nelems;
432  COM_get_array( (wname+".cnstr_types_facial").c_str(),
433  pid, (void**)&cnstr_types);
434  COM_get_size( (wname+".facenormals").c_str(), pid, &nelems);
435  double *spds;
436  COM_get_array( (wname+".spds").c_str(), pid, (void**)&spds);
437 
438  double eps = 1.e-5;
439  // Loop through all faces
440  for ( int j=0; j<nelems; ++j) {
441  if ( 1-std::abs(nrms[j][2])<eps &&
442  ( centers[j][2] < eps || (1-centers[j][2]) < eps)) {
443  cnstr_types[j] = 't'; // Move within xy plane.
444  spds[j] = 0;
445  }
446  else if ( std::abs(nrms[j][2]) < 0.5 &&
447  square(centers[j][0])+square(centers[j][1])>=3.999) {
448  cnstr_types[j] = 2;
449  spds[j] = 0;
450  }
451  else
452  spds[j] = cntr_param.speed;
453  }
454  }
455  COM_free_buffer( &pane_ids);
456 
457  int PROP_set_cnstr = COM_get_function_handle( "PROP.set_constraints");
458  COM_call_function( PROP_set_cnstr, &cnstr_handle);
459 }
460 
461 // Initialize the constraints for Star slice.
462 void init_constraints_staraft( const string &wname,
463  const Control_parameter &cntr_param) {
464 
465  int *pane_ids, npanes;
466  COM_get_panes( wname.c_str(), &npanes, &pane_ids);
467  int cnstr_handle = COM_get_attribute_handle( (wname+".cnstr_types_facial").c_str());
468 
469  // Set constraints and speeds
470  if ( cntr_param.start == 0) {
471  int cnstr_handle_pn = COM_get_attribute_handle((wname+".cnstr_type").c_str());
472  if ( cnstr_handle_pn>0) {
473  std::cout << "Obtaining constraints from input file" << std::endl;
474  int BLAS_copy = COM_get_function_handle( "BLAS.copy");
475 
476  COM_call_function( BLAS_copy, &cnstr_handle_pn, &cnstr_handle);
477 
478  int BLAS_copy_scalar = COM_get_function_handle( "BLAS.copy_scalar");
479  double zero = 0;
480  int spd_elms = COM_get_attribute_handle( (wname+".flag_spd").c_str());
481  COM_call_function( BLAS_copy_scalar, &zero, &spd_elms);
482  }
483  else {
484  std::cout << "Did not find constraints from input file. "
485  << "Setting constraints from geometry." << std::endl;
486 
487  // Compute constraints from geometry
488  int BLAS_copy_scalar = COM_get_function_handle( "BLAS.copy_scalar");
489  int zero = 0;
490  COM_call_function( BLAS_copy_scalar, &zero, &cnstr_handle);
491 
492  int SURF_normals = COM_get_function_handle( "SURF.compute_element_normals");
493  int nrms_handle = COM_get_attribute_handle( (wname+".facenormals").c_str());
494  COM_call_function( SURF_normals, &nrms_handle);
495 
496  int SURF_centers = COM_get_function_handle( "SURF.interpolate_to_centers");
497  int nc_handle = COM_get_attribute_handle( (wname+".nc").c_str());
498  int centers_handle = COM_get_attribute_handle( (wname+".facecenters").c_str());
499  COM_call_function( SURF_centers, &nc_handle, &centers_handle);
500 
501  for ( int i=0; i<npanes; ++i) {
502  int pid = pane_ids[i];
503  MAP::Vector_3<double> *nrms, *centers;
504  COM_get_array( (wname+".facenormals").c_str(), pid, (void**)&nrms);
505  COM_get_array( (wname+".facecenters").c_str(), pid, (void**)&centers);
506 
507  int *cnstr_types, nelems, ngelems;
508  COM_get_array( (wname+".cnstr_types_facial").c_str(),
509  pid, (void**)&cnstr_types);
510  COM_get_size( (wname+".facenormals").c_str(), pid, &nelems, &ngelems);
511 
512  double eps = 1.e-6;
513  // Loop through all faces
514  for ( int j=0; j<nelems-ngelems; ++j) {
515  if ( centers[j][0] < eps || centers[j][0]+eps > 1.76314)
516  cnstr_types[j] = 2;
517  else if ( centers[j][0] - 0.004826 < eps)
518  cnstr_types[j] = -'x';
519  else if ( centers[j][0] >= 1.6962 && std::abs(nrms[j][0])<0.1)
520  cnstr_types[j] = 'x';
521  }
522  }
523  }
524  }
525 
526  int PROP_set_cnstr = COM_get_function_handle( "PROP.set_constraints");
527  COM_call_function( PROP_set_cnstr, &cnstr_handle);
528 
529  // Set speeds based on constraints
530  for ( int i=0; i<npanes; ++i) {
531  int pid = pane_ids[i];
532 
533 #if 1
534  double *bnd;
535  // Set bounds
536  COM_set_size( (wname+".cnstr_bound").c_str(), pid, 1);
537  COM_resize_array( (wname+".cnstr_bound").c_str(), pid, (void**)&bnd);
538 
539  bnd[0] = -'x'; bnd[1] = 0; bnd[2] = 0.0635;
540  bnd[3] = bnd[4] = bnd[5] = 0; // Center
541  bnd[6] = 0; bnd[7] = bnd[8] = -0.07; // Lower bound of bounding box
542  bnd[9] = 1.7; bnd[10] = bnd[11] = 0.07; // Upper bound of bounding box
543 #endif
544 
545  // Set speeds
546  int *cnstr_types, nelems, ngelems;
547  double *spds;
548 
549  COM_get_array( (wname+".cnstr_types_facial").c_str(),
550  pid, (void**)&cnstr_types);
551  COM_get_size( (wname+".facenormals").c_str(), pid, &nelems, &ngelems);
552  COM_get_array( (wname+".spds").c_str(), pid, (void**)&spds);
553 
554  double *flags;
555  COM_get_array( (wname+".flag_spd").c_str(), pid, (void**)&flags);
556 
557  // Loop through all faces
558  for ( int j=0; j<nelems-ngelems; ++j) {
559  if ( cnstr_types[j]) {
560  flags[j] = spds[j] = 0;
561  }
562  else {
563  spds[j] = cntr_param.speed;
564  flags[j] = 1.;
565  }
566  }
567  }
568 
569 #if 1
570  int PROP_set_bounds = COM_get_function_handle( "PROP.set_bounds");
571  int bnd_handle = COM_get_attribute_handle( (wname+".cnstr_bound").c_str());
572  COM_call_function( PROP_set_bounds, &bnd_handle);
573 #endif
574 
575  COM_free_buffer( &pane_ids);
576 }
577 
578 // Initialize the constraints for Star slice.
579 void init_constraints_myacm( const string &wname,
580  const Control_parameter &cntr_param) {
581  int cnstr_handle = COM_get_attribute_handle( (wname+".cnstr_types_facial").c_str());
582 
583  int SURF_normals = COM_get_function_handle( "SURF.compute_element_normals");
584  int nrms_handle = COM_get_attribute_handle( (wname+".facenormals").c_str());
585  COM_call_function( SURF_normals, &nrms_handle);
586 
587  int SURF_centers = COM_get_function_handle( "SURF.interpolate_to_centers");
588  int nc_handle = COM_get_attribute_handle( (wname+".nc").c_str());
589  int centers_handle = COM_get_attribute_handle( (wname+".facecenters").c_str());
590  COM_call_function( SURF_centers, &nc_handle, &centers_handle);
591 
592  // Set speed for different panes.
593  int *pane_ids, npanes;
594  COM_get_panes( wname.c_str(), &npanes, &pane_ids);
595 
596  double zero = 0;
597  int spd_elms = COM_get_attribute_handle( (wname+".flag_spd").c_str());
598  int BLAS_copy_scalar = COM_get_function_handle( "BLAS.copy_scalar");
599  COM_call_function( BLAS_copy_scalar, &zero, &spd_elms);
600 
601  for ( int i=0; i<npanes; ++i) {
602  int pid = pane_ids[i];
603  MAP::Vector_3<double> *nrms, *centers;
604  COM_get_array( (wname+".facenormals").c_str(), pid, (void**)&nrms);
605  COM_get_array( (wname+".facecenters").c_str(), pid, (void**)&centers);
606 
607  int *cnstr_types;
608  COM_get_array( (wname+".cnstr_types_facial").c_str(),
609  pid, (void**)&cnstr_types);
610  double *spds;
611  COM_get_array( (wname+".spds").c_str(), pid, (void**)&spds);
612  double *flags;
613  COM_get_array( (wname+".flag_spd").c_str(), pid, (void**)&flags);
614 
615  int nelems, ngelems;
616  COM_get_size( (wname+".facenormals").c_str(), pid, &nelems, &ngelems);
617 
618  double eps = 5.e-2;
619  if ( cntr_param.start == 0) {
620  // Loop through all faces
621  for ( int j=0; j<nelems-ngelems; ++j) {
622  if ( std::abs(nrms[j][2])<eps &&
623  square(centers[j][0])+square(centers[j][1]) >= square(0.0065)) {
624  cnstr_types[j] = 'z';
625  flags[j] = spds[j]= 0;
626  }
627  else {
628  cnstr_types[j] = 0;
629  flags[j] = 1.; spds[j]= cntr_param.speed;
630  }
631  }
632  }
633  else {
634  for ( int j=0; j<nelems-ngelems; ++j) {
635  if ( cnstr_types[j] == 0) {
636  flags[j] = 1.; spds[j]= cntr_param.speed;
637  }
638  else {
639  flags[j] = spds[j]= 0;
640  }
641  }
642  }
643  }
644  COM_free_buffer( &pane_ids);
645 
646  int PROP_set_cnstr = COM_get_function_handle( "PROP.set_constraints");
647  COM_call_function( PROP_set_cnstr, &cnstr_handle);
648 }
649 
650 
651 // Initialize the constraints for Lab scale rocket
652 void init_constraints_labscale( const string &wname,
653  const Control_parameter &cntr_param) {
654  int BLAS_copy_scalar = COM_get_function_handle( "BLAS.copy_scalar");
655  int cnstr_handle = COM_get_attribute_handle( (wname+".cnstr_types_facial").c_str());
656  int zero = 0;
657  COM_call_function( BLAS_copy_scalar, &zero, &cnstr_handle);
658 
659  int SURF_normals = COM_get_function_handle( "SURF.compute_element_normals");
660  int nrms_handle = COM_get_attribute_handle( (wname+".facenormals").c_str());
661  COM_call_function( SURF_normals, &nrms_handle);
662 
663  int SURF_centers = COM_get_function_handle( "SURF.interpolate_to_centers");
664  int nc_handle = COM_get_attribute_handle( (wname+".nc").c_str());
665  int centers_handle = COM_get_attribute_handle( (wname+".facecenters").c_str());
666  COM_call_function( SURF_centers, &nc_handle, &centers_handle);
667 
668  // Set speed for different panes.
669  int *pane_ids, npanes;
670  COM_get_panes( wname.c_str(), &npanes, &pane_ids);
671 
672  for ( int i=0; i<npanes; ++i) {
673  int pid = pane_ids[i];
674  MAP::Vector_3<double> *nrms, *centers;
675  COM_get_array( (wname+".facenormals").c_str(), pid, (void**)&nrms);
676  COM_get_array( (wname+".facecenters").c_str(), pid, (void**)&centers);
677 
678  // Set for pane 2 separately
679  int *cnstr_types;
680  COM_get_array( (wname+".cnstr_types_facial").c_str(),
681  pid, (void**)&cnstr_types);
682 
683  int nelems, ngelems;
684  COM_get_size( (wname+".facenormals").c_str(), pid, &nelems, &ngelems);
685 
686  double eps = 1.e-2;
687  // Loop through all faces
688  for ( int j=0; j<nelems-ngelems; ++j) {
689  if ( std::abs(std::abs(nrms[j][0])-1)<eps && centers[j][0] < 0.153)
690  cnstr_types[j] = 't'; // Move within yz plane.
691  }
692  }
693  COM_free_buffer( &pane_ids);
694 
695  int PROP_set_cnstr = COM_get_function_handle( "PROP.set_constraints");
696  COM_call_function( PROP_set_cnstr, &cnstr_handle);
697 }
698 
699 // Initialize the constraints
700 void init_constraints( const string &wname,
701  const Control_parameter &cntr_param) {
702 
703  if ( wname.substr(0,5) == "acmfl")
704  init_constraints_acmflu( wname);
705  else if ( wname.substr(0,9) == "starslice")
706  init_constraints_starslice( wname, cntr_param);
707  else if ( wname.substr(0,7) == "staraft")
708  init_constraints_staraft( wname, cntr_param);
709  else if ( wname.substr(0,8) == "labscale")
710  init_constraints_labscale( wname, cntr_param);
711  else if ( wname.substr(0,3) == "acm")
712  init_constraints_myacm( wname, cntr_param);
713  else {
714  int cnstr_handle = COM_get_attribute_handle((wname+".cnstr_type").c_str());
715  if ( cnstr_handle>=0) {
716  int PROP_set_cnstr = COM_get_function_handle( "PROP.set_constraints");
717  COM_call_function( PROP_set_cnstr, &cnstr_handle);
718  }
719  }
720 }
721 
722 void init_attributes( const string &wname,
723  const Control_parameter &cntr_param) {
724  COM_new_attribute((wname+".flag").c_str(), 'p', COM_DOUBLE, 1, "");
725  COM_set_size( (wname+".flag").c_str(), 0, 1);
726 
727  COM_new_attribute((wname+".flag_spd").c_str(), 'e', COM_DOUBLE, 1, "");
728 
729  COM_new_attribute((wname+".disps_total").c_str(), 'n', COM_DOUBLE, 3, "");
730  // COM_new_attribute((wname+".lambdas").c_str(), 'n', COM_DOUBLE, 3, "");
731  // COM_new_attribute((wname+".eigvecs").c_str(), 'n', COM_DOUBLE, 9, "");
732  COM_new_attribute((wname+".cnstr_types_nodal").c_str(), 'n', COM_INT, 1, "");
733  COM_new_attribute((wname+".cnstr_types_facial").c_str(), 'e', COM_INT, 1, "");
734  COM_new_attribute((wname+".cnstr_types_panel").c_str(), 'p', COM_INT, 1, "");
735  COM_set_size((wname+".cnstr_types_panel").c_str(), 0, 1);
736 
737 #if 1
738  COM_new_attribute((wname+".cnstr_bound").c_str(), 'p', COM_DOUBLE, 15, "");
739  COM_set_size( (wname+".cnstr_bound").c_str(), 0, 1);
740 #endif
741 
742  COM_new_attribute((wname+".spds").c_str(), cntr_param.sploc,
743  COM_DOUBLE, 1, "m/s");
744  COM_new_attribute((wname+".disps").c_str(), 'n', COM_DOUBLE, 3, "m");
745 
746  COM_new_attribute((wname+".faceareas").c_str(), 'e', COM_DOUBLE, 1, "");
747  COM_new_attribute((wname+".facenormals").c_str(), 'e', COM_DOUBLE, 3, "");
748  COM_new_attribute((wname+".facecenters").c_str(), 'e', COM_DOUBLE, 3, "");
749 
750  // Attribute for storing the number of eigenvalues for each node.
751  COM_new_attribute((wname+".tangranks").c_str(), 'n', COM_INT, 1, "");
752 
753  // Ridges of each pane.
754  COM_new_attribute((wname+".ridges").c_str(), 'p', COM_INT, 2, "");
755  COM_set_size((wname+".ridges").c_str(), 0, 0);
756 
757  COM_resize_array( (wname+".atts").c_str());
758  COM_window_init_done( wname.c_str());
759 
760  // Set speed for different panes.
761  int *pane_ids, npanes;
762  COM_get_panes( wname.c_str(), &npanes, &pane_ids);
763 
764  for ( int i=0; i<npanes; ++i) {
765  double *flag;
766  COM_get_array( (wname+".flag").c_str(), pane_ids[i], &flag);
767  // Set constraints for nonburning panes and speeds for burning panes.
768  if ( wname.substr(0,5) == "acmfl" ) {
769  if ( COM_get_attribute_handle((wname+".bcflag").c_str())>0) {
770  int *bcflag;
771  COM_get_array( (wname+".bcflag").c_str(), pane_ids[i], &bcflag);
772 
773  *flag = ( *bcflag == 1) ? cntr_param.speed : 0.;
774  }
775  else
776  *flag = (pane_ids[i]<=2)?cntr_param.speed:0.;
777  }
778  else if ( wname.substr(0,4) == "star")
779  *flag = (i%2)?0.:cntr_param.speed;
780  else if ( COM_get_attribute_handle((wname+".bcflag").c_str())>0) {
781  int *bcflag;
782  COM_get_array( (wname+".bcflag").c_str(), pane_ids[i], &bcflag);
783 
784  *flag = ( *bcflag == 1) ? cntr_param.speed : 0.;
785  }
786  else
787  *flag = cntr_param.speed;
788 
789  std::cout << "Setting speed for pane " << pane_ids[i]
790  << " to " << *flag << std::endl;
791  }
792 
793  COM_free_buffer( &pane_ids);
794 
795  int spds = COM_get_attribute_handle( (wname+".spds").c_str());
796  int spd_pane = COM_get_attribute_handle( (wname+".flag").c_str());
797 
798  int BLAS_copy = COM_get_function_handle( "BLAS.copy");
799  COM_call_function( BLAS_copy, &spd_pane, &spds);
800 
801  int BLAS_div_scalar = COM_get_function_handle( "BLAS.div_scalar");
802  COM_call_function( BLAS_div_scalar, &spd_pane, &cntr_param.speed, &spd_pane);
803 
804  int spd_elms = COM_get_attribute_handle( (wname+".flag_spd").c_str());
805  COM_call_function( BLAS_copy, &spd_pane, &spd_elms);
806 }
807 
808 void output_solution( const string &wname, const char *timelevel,
809  const string &format) {
810  static int OUT_write = 0, hdl;
811 
812  if ( OUT_write==0) {
813  OUT_write = COM_get_function_handle( "OUT.write_attribute");
814  hdl = COM_get_attribute_handle( (wname+".all").c_str());
815 
816  int OUT_set = COM_get_function_handle( "OUT.set_option");
817 #if USE_CGNS
818  if ( format != "HDF" && format != "hdf")
819  COM_call_function( OUT_set, "format", "CGNS");
820  else
821 #endif
822  COM_call_function( OUT_set, "format", "HDF");
823  }
824 
825  std::string fname = wname+"_"+timelevel;
826 
827  if ( !COMMPI_Initialized()) {
828 #if USE_CGNS
829  if ( format != "HDF" && format != "hdf")
830  fname.append(".cgns");
831  else
832 #endif
833  fname.append(".hdf");
834  }
835  else fname.append("_");
836 
837  COM_call_function( OUT_write, (char*)fname.c_str(),
838  &hdl, (char*)wname.c_str(), timelevel);
839 }
840 
841 double compute_area( const string &wname) {
842  static int SURF_area = 0, BLAS_mul, BLAS_sum_scalar, area_hdl, flag_hdl;
843 
844  if ( SURF_area==0) {
845  SURF_area = COM_get_function_handle( "SURF.compute_element_areas");
846  BLAS_mul = COM_get_function_handle( "BLAS.mul");
847  BLAS_sum_scalar = COM_get_function_handle( "BLAS.sum_scalar_MPI");
848 
849  area_hdl = COM_get_attribute_handle( (wname+".faceareas").c_str());
850  flag_hdl = COM_get_attribute_handle( (wname+".flag_spd").c_str());
851  }
852 
853  COM_call_function( SURF_area, &area_hdl);
854  COM_call_function( BLAS_mul, &area_hdl, &flag_hdl, &area_hdl);
855 
856  double sum;
857  MPI_Comm comm=MPI_COMM_WORLD;
858  COM_call_function( BLAS_sum_scalar, &area_hdl, &sum, &comm);
859  return sum;
860 }
861 
862 double compute_volume( const string &wname) {
863  static int SURF_vol = 0, mesh_hdl;
864 
865  if ( SURF_vol==0) {
866  SURF_vol = COM_get_function_handle( "SURF.compute_signed_volumes");
867 
868  mesh_hdl = COM_get_attribute_handle( (wname+".mesh").c_str());
869  }
870 
871  double vol;
872  COM_call_function( SURF_vol, &mesh_hdl, &vol);
873 
874  return vol;
875 }
876 
877 
878 int main(int argc, char *argv[]) {
879  COM_init( &argc, &argv);
880  load_modules();
881  print_usage( argc, argv);
882 
884 
885  // Read in mesh file.
886  string wname = read_in_mesh( argv[1]);
887 
888  // Read in control parameters
889  Control_parameter cntr_param;
890  read_control_file( argc>2?argv[2]:"control.txt", cntr_param);
891 
892  // Initialize the attributes and output the initial solution.
893  init_attributes( wname, cntr_param);
894 
895  // Attributes
896  int pmesh = COM_get_attribute_handle( (wname+".pmesh").c_str());
897  int nc = COM_get_attribute_handle( (wname+".nc").c_str());
898  int spds = COM_get_attribute_handle( (wname+".spds").c_str());
899  int disps = COM_get_attribute_handle( (wname+".disps").c_str());
900  int disps_total = COM_get_attribute_handle( (wname+".disps_total").c_str());
901 
902  // Funcitions
903  int PROP_init = COM_get_function_handle( "PROP.initialize");
904  int PROP_perturb = COM_get_function_handle( "PROP.perturb_mesh");
905  int PROP_propagate = COM_get_function_handle( "PROP.propagate");
906  int BLAS_add = COM_get_function_handle( "BLAS.add");
907 
908  if ( rank==0) cout << "Propagating interface..." << endl;
909  // Initialize control parameters
910  COM_call_function( PROP_init, &pmesh);
911  init_parameters( cntr_param);
912 
913  init_constraints( wname, cntr_param);
914 
915  if ( cntr_param.perturb > 0)
916  COM_call_function( PROP_perturb, &pmesh, &cntr_param.perturb);
917 
918  if ( cntr_param.start==0) {
919  double zero=0.;
920  // Run one step to detect features.
921  COM_call_function( PROP_propagate, &pmesh, &spds, &zero, &disps, &zero);
922  }
923  output_solution( wname, "00000", cntr_param.format);
924 
926  COM_set_profiling_barrier( PROP_propagate, MPI_COMM_WORLD);
927 
928  std::ofstream areas, vols;
929  if ( rank==0) {
930  areas.open((wname+"_areas.m").c_str());
931  vols.open((wname+"_vols.m").c_str());
932 
933  areas.precision(10); vols.precision(10); cout.precision(10);
934  }
935 
936  double a=compute_area( wname), v=compute_volume(wname);
937 
938  if ( rank==0) {
939  std::cout << "Burning area is " << a
940  << " and total volume is " << v << std::endl;
941  areas << wname << "_as = [0 " << a << ";..." << std::endl;
942  vols << wname << "_vs = [0 " << v << ";..." << std::endl;
943  }
944 
945  char fname[40];
946  std::sprintf(fname, "timedata_%03d.txt", rank);
947 
948 #ifdef MESH_ADAPT
949  AdaptCOMWindow acw( wname.c_str());
950  acw.set_option( "adapt_iter", 1); // cntr_param.adapt_iter);
951  acw.set_option( "redist_iter", 0); // cntr_param.do_redist);
952 
953  acw.set_option( "do_collapse", cntr_param.do_collapse);
954  acw.set_option( "do_flip", cntr_param.do_flip);
955  acw.set_option( "do_split", cntr_param.do_split);
956  acw.set_option( "refine", cntr_param.refine);
957  if ( cntr_param.edge_len>0)
958  acw.set_option( "edge_len", cntr_param.edge_len);
959 
960  if ( !cntr_param.fangle.empty())
961  acw.set_option( "fangle_weak",
962  std::atof(cntr_param.fangle.c_str())/180*M_PI);
963  if ( !cntr_param.sangle.empty())
964  acw.set_option( "fangle_strong",
965  std::atof(cntr_param.sangle.c_str())/180*M_PI);
966  if ( !cntr_param.eigthres.empty())
967  acw.set_option( "eig_thres", std::atof(cntr_param.eigthres.c_str()));
968  if ( cntr_param.collapse_ratio>0)
969  acw.set_option( "collapse_ratio", cntr_param.collapse_ratio);
970  if ( cntr_param.split_angle > 0)
971  acw.set_option( "split_angle", cntr_param.split_angle);
972 
973  acw.set_option( "anisotropic", cntr_param.smoother == "anisotropic");
974  if ( !cntr_param.feature_layer.empty())
975  acw.set_option( "feature_layer", std::atof(cntr_param.feature_layer.c_str()));
976 #endif
977 
978  double t=cntr_param.start*cntr_param.timestep;
979  for ( int i=1+cntr_param.start; i<=cntr_param.steps; ++i, t+=cntr_param.timestep) {
980  cntr_param.start = i; // Save current time step
981  if ( rank==0) cout << "Step " << i << endl;
982 
983  double local_t = 0, t_rem = cntr_param.timestep, t_elapsed = 0;
984  while ( t_rem > 0) {
985  // If speed is 0, then do smoothing only.
986  if ( cntr_param.speed==0) t_rem=0;
987 
988 #ifdef MESH_ADAPT
989  if ( i>1 && cntr_param.adapt_iter>0 &&
990  ( local_t!=0 && t_elapsed < cntr_param.subadapt*cntr_param.timestep ||
991  local_t==0 && (i-1)%cntr_param.remesh_interval==0)) {
992 
993  for (int j=0; j<cntr_param.adapt_iter; ++j) {
994  if ( !acw.adapt()) break;
995 
996  // Reset the constraints
997  init_constraints( wname, cntr_param);
998 
999  // If the window has changed, reinitialize Rocprop.
1000  COM_call_function( PROP_init, &pmesh);
1001 
1002  for ( int k=0; k<std::max(1,cntr_param.do_redist); ++k) {
1003  // Perform mesh smoothing
1004  double zero=0.;
1005  std::cout << "Perform anisotropic smoothing" << std::endl;
1006  COM_call_function( PROP_propagate, &pmesh, &spds,
1007  &zero, &disps, &t_elapsed);
1008  COM_call_function( BLAS_add, &nc, &disps, &nc);
1009  COM_call_function( BLAS_add, &disps_total, &disps, &disps_total);
1010  }
1011  }
1012  }
1013 #endif
1014 
1015  COM_call_function( PROP_propagate, &pmesh, &spds,
1016  &t_rem, &disps, &t_elapsed);
1017 
1018  COM_call_function( BLAS_add, &nc, &disps, &nc);
1019  COM_call_function( BLAS_add, &disps_total, &disps, &disps_total);
1020 
1021  local_t = cntr_param.timestep - (t_rem-t_elapsed);
1022  t_rem = cntr_param.timestep - local_t;
1023 
1024  if ( t_rem>0 && t_elapsed*1.e3<cntr_param.timestep) {
1025  std::cout << "Time step too small. Stopping..." << std::endl;
1026  exit(-1);
1027  }
1028  }
1029 
1030  a=compute_area( wname); v=compute_volume(wname);
1031  if ( rank==0) {
1032  std::cout << "Burning area is " << a
1033  << " and total volume is " << v << std::endl;
1034  double t = i*cntr_param.timestep;
1035  areas << '\t' << t << '\t' << a << ";..." << std::endl;
1036  vols << '\t' << t << '\t' << v << ";..." << std::endl;
1037  }
1038 
1039  if ( i%cntr_param.interval == 0) {
1040  char steps[10];
1041  if ( cntr_param.steps>=1.e6)
1042  std::sprintf( steps, "%07d", i);
1043  else if ( cntr_param.steps>=1.e5)
1044  std::sprintf( steps, "%06d", i);
1045  else
1046  std::sprintf( steps, "%05d", i);
1047 
1048  output_solution( wname, steps, cntr_param.format);
1049 
1050  COM_print_profile( fname, "Proptest");
1051  }
1052  }
1053 
1054  areas << "];" << std::endl;
1055  vols << "];" << std::endl;
1056 
1057  COM_finalize();
1058 }
1059 
1060 
1061 
1062 
1063 
1064 
int COMMPI_Comm_rank(MPI_Comm c)
Definition: commpi.h:162
double square(double x)
here we put it at the!beginning of the common block The point to point and collective!routines know about but MPI_TYPE_STRUCT as yet does not!MPI_STATUS_IGNORE and MPI_STATUSES_IGNORE are similar objects!Until the underlying MPI library implements the C version of these are declared as arrays of MPI_STATUS_SIZE!The types and are OPTIONAL!Their values are zero if they are not available Note that!using these reduces the portability of MPI_IO INTEGER MPI_BOTTOM INTEGER MPI_DOUBLE_PRECISION INTEGER MPI_LOGICAL INTEGER MPI_2REAL INTEGER MPI_2DOUBLE_COMPLEX INTEGER MPI_LB INTEGER MPI_WTIME_IS_GLOBAL INTEGER MPI_COMM_WORLD
void init_constraints_acmfrac(const string &wname)
Definition: proptest.C:388
j indices k indices k
Definition: Indexing.h:6
void int int REAL REAL * y
Definition: read.cpp:74
double compute_volume(const string &wname)
Definition: advectest.C:414
#define COM_assertion_msg(EX, msg)
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
void COM_set_size(const char *wa_str, int pane_id, int size, int ng=0)
Set sizes of for a specific attribute.
Definition: roccom_c++.h:136
This file contains the prototypes for Roccom API.
void COM_get_array(const char *wa_str, int pane_id, void **addr, int *strd, int *cap)
Get the address for an attribute on a specific pane.
void rescale_object(std::string &wname, double alpha, const SURF::Vector_3< double > &origin)
Definition: advectest.C:300
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
void init_parameters(const Control_parameter &cntr_param)
Definition: advectest.C:217
float atof(const char *const str)
Read a float number from a C-string.
Definition: CImg.h:4905
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
std::string read_in_mesh(const char *fname)
Definition: advectest.C:283
double collapse_ratio
Definition: advectest.C:110
void init_constraints_staraft(const string &wname, const Control_parameter &cntr_param)
Definition: proptest.C:462
string normaldif
Definition: advectest.C:84
void COM_finalize()
Definition: roccom_c++.h:59
static void mul_scalar(const Attribute *x, const void *y, Attribute *z, int swap=0)
Operation wrapper for multiplication with y as a scalar pointer.
Definition: op3args.C:347
void int int int REAL REAL REAL * z
Definition: write.cpp:76
double compute_area(const string &wname)
Definition: advectest.C:395
static int rank
Definition: proptest.C:64
void COM_print_profile(const char *fname, const char *header)
Definition: roccom_c++.h:557
Definition: Rocout.h:81
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
void COM_set_profiling_barrier(int hdl, MPI_Comm comm)
Definition: roccom_c++.h:554
void COM_window_init_done(const char *w_str, int pane_changed=true)
Definition: roccom_c++.h:102
This file contains a set of routines for error assertion.
void COM_get_size(const char *wa_str, int pane_id, int *size, int *ng=0)
Get the sizes of an attribute.
Definition: roccom_c++.h:274
void init_constraints_acmflu(const string &wname)
Definition: proptest.C:334
string wavefrontal
Definition: advectest.C:83
void print_usage(int argc, char *argv[])
Definition: advectest.C:68
void COM_set_profiling(int i)
Definition: roccom_c++.h:550
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
void load_modules()
Definition: advectest.C:58
int main(int argc, char *argv[])
Definition: blastest.C:94
void init_constraints_myacm(const string &wname, const Control_parameter &cntr_param)
Definition: proptest.C:579
j indices j
Definition: Indexing.h:6
void COM_init(int *argc, char ***argv)
Definition: roccom_c++.h:57
NT abs(const NT &x)
Definition: number_utils.h:130
void init_constraints_labscale(const string &wname, const Control_parameter &cntr_param)
Definition: proptest.C:652
void COM_new_attribute(const char *wa_str, const char loc, const int type, int ncomp, const char *unit)
Registering an attribute type.
Definition: roccom_c++.h:118
void COM_get_panes(const char *wname, std::vector< int > &pane_ids, int rank=-2)
Definition: roccom_c++.h:350
void COM_free_buffer(int **buf)
Definition: roccom_c++.h:397
COM_END_NAME_SPACE COM::Roccom_base * COM_get_roccom()
Definition: Roccom_base.h:537
double split_angle
Definition: advectest.C:111
void init_constraints_starslice(const string &wname, const Control_parameter &cntr_param)
Definition: proptest.C:404
void init_constraints(const string &wname, const Control_parameter &cntr_param)
Definition: proptest.C:700
string feature_layer
Definition: proptest.C:90
int read_winmesh(const char *fname, const std::string &wname, bool del=true)
Definition: IM_Reader.h:58
int COMMPI_Initialized()
Definition: commpi.h:168
double output_solution(const string &wname, const char *timelevel, double ref=0.)
Definition: advectest.C:357
void init_attributes(const string &wname, const Control_parameter &cntr_param)
Definition: advectest.C:323
#define COM_LOAD_MODULE_STATIC_DYNAMIC(moduleName, windowString)
Definition: roccom_basic.h:111
void COM_resize_array(const char *wa_str, int pane_id=0, void **addr=NULL, int strd=-1, int cap=0)
Resize an attribute on a specific pane and return the address by setting addr.
Definition: roccom_c++.h:200
int COM_get_function_handle(const char *wfname)
Definition: roccom_c++.h:428
void read_control_file(const char *fname, Control_parameter &cp)
Definition: advectest.C:115
static void add_scalar(const Attribute *x, const void *y, Attribute *z, int swap=0)
Operation wrapper for addition with y as a scalar pointer.
Definition: op3args.C:299
#define COM_EXTERN_MODULE(moduleName)
Definition: roccom_basic.h:116