Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rotate.C File Reference
#include "roccom.h"
#include <cstdio>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <sstream>
#include "roccom_assertion.h"
#include "../Rocsurf/test/IM_Reader.h"
Include dependency graph for rotate.C:

Go to the source code of this file.

Classes

struct  Control_parameter
 

Functions

 COM_EXTERN_MODULE (Rocblas)
 
 COM_EXTERN_MODULE (Rocmap)
 
 COM_EXTERN_MODULE (Rocprop)
 
 COM_EXTERN_MODULE (Rocsurf)
 
 COM_EXTERN_MODULE (Rocout)
 
void load_modules ()
 
void print_usage (int argc, char *argv[])
 
void read_control_file (const char *fname, Control_parameter &cp)
 
void init_parameters (const Control_parameter &cntr_param)
 
std::string read_in_mesh (const char *fname)
 
void init_constraints_acmfrac (const string &wname)
 
void init_constraints_acmflu (const string &wname)
 
void init_constraints_starslice (const string &wname)
 
void init_attributes (const string &wname, const Control_parameter &cntr_param)
 
double square (double x)
 
void init_speed_arrays (const double *coors, double *velocities, int n)
 
void init_speed (const string &wname)
 
void output_solution (const string &wname, const char *timelevel)
 
int main (int argc, char *argv[])
 

Variables

static int rank = 0
 

Function Documentation

COM_EXTERN_MODULE ( Rocblas  )
COM_EXTERN_MODULE ( Rocmap  )
COM_EXTERN_MODULE ( Rocprop  )
COM_EXTERN_MODULE ( Rocsurf  )
COM_EXTERN_MODULE ( Rocout  )
void init_attributes ( const string &  wname,
const Control_parameter cntr_param 
)

Definition at line 332 of file rotate.C.

References COM_CHAR, COM_DOUBLE, COM_INT, COM_new_attribute(), COM_resize_array(), COM_set_size(), and COM_window_init_done().

333  {
334  COM_new_attribute((wname+".flag").c_str(), 'p', COM_DOUBLE, 1, "");
335  COM_set_size( (wname+".flag").c_str(), 0, 1);
336 
337  COM_new_attribute((wname+".disps_total").c_str(), 'n', COM_DOUBLE, 3, "");
338  COM_new_attribute((wname+".cnstr_types").c_str(), 'n', COM_INT, 1, "");
339 
340  COM_new_attribute((wname+".spds").c_str(), 'n', COM_DOUBLE, 3, "m/s");
341  COM_new_attribute((wname+".disps").c_str(), 'n', COM_DOUBLE, 3, "m");
342 
343  COM_new_attribute((wname+".disps_novis").c_str(), 'n', COM_DOUBLE, 3, "");
344  COM_new_attribute((wname+".facenormals").c_str(), 'e', COM_DOUBLE, 3, "");
345  COM_new_attribute((wname+".faceheights").c_str(), 'e', COM_DOUBLE, 1, "");
346 
347  // Attribute for storing the number of eigenvalues for each node.
348  COM_new_attribute((wname+".lambdas").c_str(), 'n', COM_DOUBLE, 3, "");
349  COM_new_attribute((wname+".eigvecs").c_str(), 'n', COM_DOUBLE, 9, "");
350  COM_new_attribute((wname+".tangranks").c_str(), 'n', COM_CHAR, 1, "");
351  COM_new_attribute((wname+".scales").c_str(), 'n', COM_DOUBLE, 1, "");
352 
353  COM_resize_array( (wname+".atts").c_str());
354  COM_window_init_done( wname.c_str());
355 }
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
C/C++ Data types.
Definition: roccom_basic.h:129
void COM_window_init_done(const char *w_str, int pane_changed=true)
Definition: roccom_c++.h:102
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_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

Here is the call graph for this function:

void init_constraints_acmflu ( const string &  wname)

Definition at line 260 of file rotate.C.

References COM_call_function(), COM_get_array(), COM_get_attribute_handle(), COM_get_function_handle(), COM_get_size(), j, and x.

260  {
261  static int BLAS_copy_scalar=0, cnstr_handle, MAP_maxabs;
262 
263  if ( BLAS_copy_scalar==0) {
264  COM_get_function_handle( "BLAS.copy_scalar");
265  cnstr_handle = COM_get_attribute_handle( (wname+".cnstr_types").c_str());
266  MAP_maxabs = COM_get_function_handle( "MAP.reduce_maxabs_on_shared_nodes");
267  }
268 
269  int zero = 0;
270  COM_call_function( BLAS_copy_scalar, &zero, &cnstr_handle);
271 
272  // Set for pane 3 separately
273  int *cnstr_types;
274  COM_get_array( (wname+".cnstr_types").c_str(), 3, (void**)&cnstr_types);
275 
276  MAP::Vector_3<double> *coors;
277  COM_get_array( (wname+".nc").c_str(), 3, (void**)&coors);
278 
279  int nnodes;
280  COM_get_size( (wname+".nc").c_str(), 3, &nnodes);
281 
282  // Loop through all the points
283  for ( int j=0; j<nnodes; ++j) {
284  if ( coors[j].x() <= 1.e-10 || coors[j].x() > 0.047624)
285  cnstr_types[j] = 2; // Fix the nodes at two ends.
286  else
287  cnstr_types[j] = 'x'; // Allow the nodes to move only along x dir.
288  }
289 
290  COM_call_function( MAP_maxabs, &cnstr_handle);
291 
292  int PROP_set_cnstr = COM_get_function_handle( "PROP.set_constraints");
293  COM_call_function( PROP_set_cnstr, &cnstr_handle);
294 }
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.
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
void int int REAL * x
Definition: read.cpp:74
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 COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
j indices j
Definition: Indexing.h:6
int COM_get_function_handle(const char *wfname)
Definition: roccom_c++.h:428

Here is the call graph for this function:

void init_constraints_acmfrac ( const string &  wname)

Definition at line 226 of file rotate.C.

References COM_call_function(), COM_get_array(), COM_get_attribute_handle(), COM_get_function_handle(), COM_get_size(), and j.

226  {
227  static int BLAS_copy_scalar=0, cnstr_handle, MAP_maxabs;
228 
229  if ( BLAS_copy_scalar==0) {
230  COM_get_function_handle( "BLAS.copy_scalar");
231  cnstr_handle = COM_get_attribute_handle( (wname+".cnstr_types").c_str());
232  MAP_maxabs = COM_get_function_handle( "MAP.reduce_maxabs_on_shared_nodes");
233  }
234 
235  int zero = 0;
236  COM_call_function( BLAS_copy_scalar, &zero, &cnstr_handle);
237 
238  // Set for pane 2 separately
239  int *cnstr_types;
240  COM_get_array( (wname+".cnstr_types").c_str(), 2, (void**)&cnstr_types);
241 
242  MAP::Vector_3<double> *coors;
243  COM_get_array( (wname+".nc").c_str(), 2, (void**)&coors);
244 
245  int nnodes;
246  COM_get_size( (wname+".nc").c_str(), 2, &nnodes);
247 
248  // Loop through all the points
249  for ( int j=0; j<nnodes; ++j) {
250  cnstr_types[j] = 'x'; // Allow the nodes to move only along x dir.
251  }
252 
253  COM_call_function( MAP_maxabs, &cnstr_handle);
254 
255  int PROP_set_cnstr = COM_get_function_handle( "PROP.set_constraints");
256  COM_call_function( PROP_set_cnstr, &cnstr_handle);
257 }
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.
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
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 COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
j indices j
Definition: Indexing.h:6
int COM_get_function_handle(const char *wfname)
Definition: roccom_c++.h:428

Here is the call graph for this function:

void init_constraints_starslice ( const string &  wname)

Definition at line 297 of file rotate.C.

References COM_call_function(), COM_get_array(), COM_get_attribute_handle(), COM_get_function_handle(), COM_get_size(), j, x, and y.

297  {
298  static int BLAS_copy_scalar=0, cnstr_handle, MAP_maxabs;
299 
300  if ( BLAS_copy_scalar==0) {
301  COM_get_function_handle( "BLAS.copy_scalar");
302  cnstr_handle = COM_get_attribute_handle( (wname+".cnstr_types").c_str());
303  MAP_maxabs = COM_get_function_handle( "MAP.reduce_maxabs_on_shared_nodes");
304  }
305  int zero = 0;
306  COM_call_function( BLAS_copy_scalar, &zero, &cnstr_handle);
307 
308  // Set for pane 2 separately
309  int *cnstr_types;
310  COM_get_array( (wname+".cnstr_types").c_str(), 2, (void**)&cnstr_types);
311 
312  MAP::Vector_3<double> *coors;
313  COM_get_array( (wname+".nc").c_str(), 2, (void**)&coors);
314 
315  int nnodes;
316  COM_get_size( (wname+".nc").c_str(), 2, &nnodes);
317 
318  // Loop through all the points
319  for ( int j=0; j<nnodes; ++j) {
320  if ( coors[j].y() > -20.054 || coors[j].x() < -20.5538)
321  cnstr_types[j] = -'y'; // Move within xz plane.
322  else
323  cnstr_types[j] = 2; // Fix other points
324  }
325 
326  COM_call_function( MAP_maxabs, &cnstr_handle);
327 
328  int PROP_set_cnstr = COM_get_function_handle( "PROP.set_constraints");
329  COM_call_function( PROP_set_cnstr, &cnstr_handle);
330 }
void int int REAL REAL * y
Definition: read.cpp:74
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.
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
void int int REAL * x
Definition: read.cpp:74
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 COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
j indices j
Definition: Indexing.h:6
int COM_get_function_handle(const char *wfname)
Definition: roccom_c++.h:428

Here is the call graph for this function:

void init_parameters ( const Control_parameter cntr_param)

Definition at line 155 of file rotate.C.

References COM_call_function(), COM_get_function_handle(), Control_parameter::courant, Control_parameter::eigthres, Control_parameter::fangle, Control_parameter::method, Control_parameter::normaldif, rank, Control_parameter::rediter, Control_parameter::smoother, Control_parameter::verbose, and Control_parameter::wavefrontal.

155  {
156  int PROP_set_option = COM_get_function_handle( "PROP.set_option");
157 
158  if ( !cntr_param.method.empty()) {
159  COM_call_function( PROP_set_option, "method", cntr_param.method.c_str());
160 
161  if ( rank==0) std::cout << "Set propagation method to " << cntr_param.method << std::endl;
162  }
163 
164  if ( !cntr_param.wavefrontal.empty()) {
165  COM_call_function( PROP_set_option, "wavefrontal", cntr_param.wavefrontal.c_str());
166  if ( rank==0) std::cout << "Set wavefrontal to " << cntr_param.wavefrontal << std::endl;
167  }
168 
169  if ( !cntr_param.normaldif.empty()) {
170  COM_call_function( PROP_set_option, "normaldif", cntr_param.normaldif.c_str());
171  if ( rank==0) std::cout << "Set normaldif to " << cntr_param.normaldif << std::endl;
172  }
173 
174  if ( !cntr_param.eigthres.empty()) {
175  COM_call_function( PROP_set_option, "eigthres", cntr_param.eigthres.c_str());
176  if ( rank==0) std::cout << "Set eigthres to " << cntr_param.eigthres << std::endl;
177  }
178 
179  if ( !cntr_param.courant.empty()) {
180  COM_call_function( PROP_set_option, "courant", cntr_param.courant.c_str());
181  if ( rank==0) std::cout << "Set courant constant to " << cntr_param.courant << std::endl;
182  }
183 
184  if ( !cntr_param.fangle.empty()) {
185  COM_call_function( PROP_set_option, "fangle", cntr_param.fangle.c_str());
186  if ( rank==0) std::cout << "Set feature angle to " << cntr_param.fangle << std::endl;
187  }
188 
189  if ( !cntr_param.smoother.empty()) {
190  COM_call_function( PROP_set_option, "smoother", cntr_param.smoother.c_str());
191  if ( rank==0) std::cout << "Set smoother to " << cntr_param.smoother << std::endl;
192  }
193 
194  if ( !cntr_param.rediter.empty()) {
195  COM_call_function( PROP_set_option, "rediter", cntr_param.rediter.c_str());
196  if ( rank==0) std::cout << "Set rediter to " << cntr_param.rediter << std::endl;
197  }
198 
199  if ( !cntr_param.verbose.empty()) {
200  COM_call_function( PROP_set_option, "verbose", cntr_param.verbose.c_str());
201 
202  if ( rank==0) std::cout << "Set verbose level to " << cntr_param.verbose << std::endl;
203  }
204 
205 }
string normaldif
Definition: advectest.C:84
string wavefrontal
Definition: advectest.C:83
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
static int rank
Definition: rotate.C:57
int COM_get_function_handle(const char *wfname)
Definition: roccom_c++.h:428

Here is the call graph for this function:

void init_speed ( const string &  wname)

Definition at line 377 of file rotate.C.

References COM_free_buffer(), COM_get_array(), COM_get_panes(), COM_get_size(), i, init_speed_arrays(), and n.

Referenced by main().

377  {
378  // Set speed for different panes.
379  int *pane_ids, npanes;
380  COM_get_panes( wname.c_str(), &npanes, &pane_ids);
381 
382  for ( int i=0; i<npanes; ++i) {
383  double *coor;
384  double *spds;
385  COM_get_array( (wname+".nc").c_str(), pane_ids[i], &coor);
386  COM_get_array( (wname+".spds").c_str(), pane_ids[i], &spds);
387 
388  int n;
389  COM_get_size( (wname+".nc").c_str(), pane_ids[i], &n);
390  init_speed_arrays( coor, spds, n);
391  }
392 
393  COM_free_buffer( &pane_ids);
394 }
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.
blockLoc i
Definition: read.cpp:79
const NT & n
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_speed_arrays(const double *coors, double *velocities, int n)
Definition: rotate.C:361
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

Here is the call graph for this function:

Here is the caller graph for this function:

void init_speed_arrays ( const double *  coors,
double *  velocities,
int  n 
)

Definition at line 361 of file rotate.C.

References i, n, pi, sin, and square().

Referenced by init_speed().

361  {
362  const double pi = 3.14159265358979;
363  for ( int i=0; i<n; ++i) {
364 #if 1
365  velocities[3*i] = pi*(-coors[3*i+1]);
366  velocities[3*i+1] = pi*(coors[3*i]-1.5);
367  velocities[3*i+2] = 0;
368 #else
369  double xs[]={pi*coors[3*i], pi*coors[3*i+1], pi*coors[3*i+2]};
370  velocities[3*i] = 2*square(sin(xs[0]))* sin(2*xs[1])*sin(2*xs[2]);
371  velocities[3*i+1] = -sin(2*xs[0])* square(sin(xs[1]))* sin(2*xs[2]);
372  velocities[3*i+2] = -sin(2*xs[0])* sin(2*xs[1])* square(sin(xs[2]));
373 #endif
374  }
375 }
double square(double x)
NT & sin
blockLoc i
Definition: read.cpp:79
const NT & n
const double pi

Here is the call graph for this function:

Here is the caller graph for this function:

void load_modules ( )

Definition at line 49 of file rotate.C.

References COM_LOAD_MODULE_STATIC_DYNAMIC.

49  {
51  COM_LOAD_MODULE_STATIC_DYNAMIC(Rocmap, "MAP");
55 }
Definition: Rocout.h:81
#define COM_LOAD_MODULE_STATIC_DYNAMIC(moduleName, windowString)
Definition: roccom_basic.h:111
int main ( int  argc,
char *  argv[] 
)

Definition at line 416 of file rotate.C.

References COM_call_function(), COM_finalize(), COM_get_attribute_handle(), COM_get_function_handle(), COM_init(), COM_print_profile(), COM_set_profiling(), COM_set_profiling_barrier(), COMMPI_Comm_rank(), COMMPI_Initialized(), i, init_attributes(), init_constraints_acmflu(), init_constraints_acmfrac(), init_parameters(), init_speed(), Control_parameter::interval, load_modules(), MPI_COMM_WORLD, output_solution(), Control_parameter::perturb, print_usage(), rank, read_control_file(), read_in_mesh(), Control_parameter::steps, and Control_parameter::timestep.

416  {
417  COM_init( &argc, &argv);
418  load_modules();
419  print_usage( argc, argv);
420 
422 
423  // Read in mesh file.
424  string wname = read_in_mesh( argv[1]);
425 
426  // Read in control parameters
427  Control_parameter cntr_param;
428  read_control_file( argc>2?argv[2]:"control.txt", cntr_param);
429 
430  // Initialize the attributes and output the initial solution.
431  init_attributes( wname, cntr_param);
432 
433  // Attributes
434  int pmesh = COM_get_attribute_handle( (wname+".pmesh").c_str());
435  int nc = COM_get_attribute_handle( (wname+".nc").c_str());
436  int spds = COM_get_attribute_handle( (wname+".spds").c_str());
437  int disps = COM_get_attribute_handle( (wname+".disps").c_str());
438  int disps_total = COM_get_attribute_handle( (wname+".disps_total").c_str());
439 
440  // Funcitions
441  int PROP_init = COM_get_function_handle( "PROP.initialize");
442  int PROP_perturb = COM_get_function_handle( "PROP.perturb_mesh");
443  int PROP_propagate = COM_get_function_handle( "PROP.propagate");
444  int BLAS_add = COM_get_function_handle( "BLAS.add");
445 
446  if ( rank==0) cout << "Propagating interface..." << endl;
447  // Initialize control parameters
448  COM_call_function( PROP_init, &pmesh);
449  init_parameters( cntr_param);
450 
451  if ( wname.substr(0,6) == "acmflu")
452  init_constraints_acmflu( wname);
453  else if ( wname.substr(0,3) == "acm")
454  init_constraints_acmfrac( wname);
455  else if ( wname.substr(0,4) == "star")
456  ; // init_constraints_starslice( wname);
457 
458  if ( cntr_param.perturb > 0)
459  COM_call_function( PROP_perturb, &pmesh, &cntr_param.perturb);
460 
461  output_solution( wname, "00000");
462 
464  COM_set_profiling_barrier( PROP_propagate, MPI_COMM_WORLD);
465 
466  char fname[40];
467  std::sprintf(fname, "timedata_%03d.txt", rank);
468 
469  for ( int i=1; i<=cntr_param.steps; ++i) {
470  if ( rank==0) cout << "Step " << i << endl;
471 
472  init_speed( wname);
473  COM_call_function( PROP_propagate, &pmesh, &spds,
474  &cntr_param.timestep, &disps);
475 
476  COM_call_function( BLAS_add, &nc, &disps, &nc);
477  COM_call_function( BLAS_add, &disps_total, &disps, &disps_total);
478 
479  if ( i%cntr_param.interval == 0) {
480  char steps[10];
481  std::sprintf( steps, "%05d", i);
482  output_solution( wname, steps);
483 
484  COM_print_profile( fname, "Proptest");
485  }
486  }
487 
488  COM_finalize();
489 }
int COMMPI_Comm_rank(MPI_Comm c)
Definition: commpi.h:162
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
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
std::string read_in_mesh(const char *fname)
Definition: advectest.C:283
void COM_finalize()
Definition: roccom_c++.h:59
void COM_print_profile(const char *fname, const char *header)
Definition: roccom_c++.h:557
blockLoc i
Definition: read.cpp:79
void COM_set_profiling_barrier(int hdl, MPI_Comm comm)
Definition: roccom_c++.h:554
void init_constraints_acmflu(const string &wname)
Definition: proptest.C:334
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
void COM_init(int *argc, char ***argv)
Definition: roccom_c++.h:57
void init_speed(const string &wname)
Definition: rotate.C:377
static int rank
Definition: rotate.C:57
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
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

Here is the call graph for this function:

void output_solution ( const string &  wname,
const char *  timelevel 
)

Definition at line 396 of file rotate.C.

References COM_call_function(), COM_get_attribute_handle(), COM_get_function_handle(), and COMMPI_Initialized().

396  {
397  static int OUT_write = 0, hdl;
398 
399  if ( OUT_write==0) {
400  OUT_write = COM_get_function_handle( "OUT.write_attribute");
401  hdl = COM_get_attribute_handle( (wname+".all").c_str());
402 
403  int OUT_set = COM_get_function_handle( "OUT.set_option");
404  COM_call_function( OUT_set, "format", "HDF");
405  }
406 
407  std::string fname = wname+"_"+timelevel;
408 
409  if ( !COMMPI_Initialized()) fname.append(".hdf");
410  else fname.append("_");
411 
412  COM_call_function( OUT_write, (char*)fname.c_str(),
413  &hdl, (char*)wname.c_str(), timelevel);
414 }
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
int COMMPI_Initialized()
Definition: commpi.h:168
int COM_get_function_handle(const char *wfname)
Definition: roccom_c++.h:428

Here is the call graph for this function:

void print_usage ( int  argc,
char *  argv[] 
)

Definition at line 59 of file rotate.C.

59  {
60  if ( argc <= 2) {
61  cout << "Usage: " << argv[0] << " <surffile> <controlfile>" << std::endl;
62 
63  exit(-1);
64  }
65 }
void read_control_file ( const char *  fname,
Control_parameter cp 
)

Definition at line 89 of file rotate.C.

References COM_assertion_msg, Control_parameter::courant, Control_parameter::eigthres, Control_parameter::fangle, Control_parameter::interval, Control_parameter::method, Control_parameter::normaldif, Control_parameter::perturb, rank, Control_parameter::rediter, Control_parameter::smoother, Control_parameter::speed, Control_parameter::sploc, Control_parameter::steps, Control_parameter::timestep, Control_parameter::verbose, and Control_parameter::wavefrontal.

89  {
90  /* Sample control file:
91  * method: fo # method: fo and mp
92  * wavefrontal: 1 # wavefrontal condition
93  * normaldif: 1 # normal diffusion
94  * eigthres: 1.e-4 # threshold for null space: 0..1 (1.e-4 default)
95  * courant: 0.5 # courant constant
96  * fangle: 35 # feature edge angle: between 0 and 180
97  * smoother: angle # type of mesh-smoothing algorithm
98  * rediter: 1 # Number of iterations for vertex redistribution
99  * speed: 0.1 # Speed
100  * sploc: e # location of speed: n or e
101  * timestep: 0.001 # time step
102  * steps: 100 # number of time steps
103  * interval: 10 # output intervals
104  * verbose: 1 # verbose level
105  */
106  ifstream is(fname); COM_assertion_msg( is, "File does not exist");
107 
108  while ( !is.eof()) {
109  char buf[255];
110  is.get( buf, 255, ':');
111  if ( buf[0] == '\0') { is.getline( buf, 255); continue; }
112 
113  istringstream istr(buf);
114  string keyword; istr >> keyword;
115  is.getline( buf, 255, ':');
116 
117  if ( keyword == "method")
118  is >> cp.method;
119  else if ( keyword == "wavefrontal")
120  is >> cp.wavefrontal;
121  else if ( keyword == "normaldif")
122  is >> cp.normaldif;
123  else if ( keyword == "eigthres")
124  is >> cp.eigthres;
125  else if ( keyword == "courant")
126  is >> cp.courant;
127  else if ( keyword == "fangle")
128  is >> cp.fangle;
129  else if ( keyword == "smoother")
130  is >> cp.smoother;
131  else if ( keyword == "rediter")
132  is >> cp.rediter;
133  else if ( keyword == "perturb")
134  is >> cp.perturb;
135  else if ( keyword == "speed")
136  is >> cp.speed;
137  else if ( keyword == "sploc")
138  is >> cp.sploc;
139  else if ( keyword == "timestep")
140  is >> cp.timestep;
141  else if ( keyword == "steps")
142  is >> cp.steps;
143  else if ( keyword == "interval")
144  is >> cp.interval;
145  else if ( keyword == "verbose")
146  is >> cp.verbose;
147  else
148  std::cerr << "Unknow keyword " << keyword << std::endl;
149  is.getline( buf, 255);
150  }
151 
152  if ( rank==0) std::cout << " speed is " << cp.speed << std::endl;
153 }
#define COM_assertion_msg(EX, msg)
string normaldif
Definition: advectest.C:84
string wavefrontal
Definition: advectest.C:83
static int rank
Definition: rotate.C:57
std::string read_in_mesh ( const char *  fname)

Definition at line 208 of file rotate.C.

References COM_assertion_msg, rank, and IM_Reader::read_winmesh().

208  {
209  if ( rank==0) cout << "Reading surface mesh file \"" << fname << '"' << endl;
210 
211  std::string fname_str(fname);
212 
213  std::string::size_type pos = fname_str.find_first_of( ".");
214  const string wname = fname_str.substr( 0, pos);
215 
216  if ( rank==0) cout << "Creating window \"" << wname << '"' << endl;
217 
218  IM_Reader im_reader;
219  int npanes = im_reader.read_winmesh( fname, wname);
220  COM_assertion_msg( npanes>=0, "Failed to read in mesh file. File empty?");
221 
222  return wname;
223 }
#define COM_assertion_msg(EX, msg)
static int rank
Definition: rotate.C:57
int read_winmesh(const char *fname, const std::string &wname, bool del=true)
Definition: IM_Reader.h:58

Here is the call graph for this function:

double square ( double  x)
inline

Definition at line 357 of file rotate.C.

References x.

357 { return x*x; }
void int int REAL * x
Definition: read.cpp:74

Variable Documentation

int rank = 0
static

Definition at line 57 of file rotate.C.

Referenced by init_parameters(), main(), read_control_file(), and read_in_mesh().