Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mptest.C File Reference

Testing marker-particle method in parallel. More...

#include "roccom.h"
#include "../Rocsurf/test/IM_Reader.h"
#include <iostream>
Include dependency graph for mptest.C:

Go to the source code of this file.

Functions

 COM_EXTERN_MODULE (Rocout)
 
 COM_EXTERN_MODULE (Rocblas)
 
 COM_EXTERN_MODULE (Rocprop)
 
int main (int argc, char *argv[])
 

Detailed Description

Testing marker-particle method in parallel.

Definition in file mptest.C.

Function Documentation

COM_EXTERN_MODULE ( Rocout  )
COM_EXTERN_MODULE ( Rocblas  )
COM_EXTERN_MODULE ( Rocprop  )
int main ( int  argc,
char *  argv[] 
)

Definition at line 37 of file mptest.C.

References COM_assertion, COM_assertion_msg, COM_call_function(), COM_DOUBLE, COM_finalize(), COM_get_attribute_handle(), COM_get_function_handle(), COM_init(), COM_LOAD_MODULE_STATIC_DYNAMIC, COM_new_attribute(), COM_resize_array(), COM_window_init_done(), ni, and IM_Reader::read_winmesh().

37  {
38  COM_init( &argc, &argv);
39 
40  if ( argc < 3) {
41  std::cout << "Usage:\n\tTo run in serial: " << argv[0]
42  << " <surffile> <hdffile> " << endl;
43  std::cout << "\n\tTo run in parallel: <mpirun-command> " << argv[0]
44  << " -com-mpi <Rocin control file> <hdfoutput-prefix> " << endl;
45  exit(-1);
46  }
47 
48  std::cout << "Reading surface mesh file \"" << argv[1] << '"' << endl;
49 
50  std::string fname(argv[1]), wname;
51  string::size_type n0 = fname.find_last_of( "/");
52 
53  if ( n0 != std::string::npos)
54  fname = fname.substr( n0+1, fname.size());
55 
56  string::size_type ni;
57  ni = fname.find_first_of( ".:-*[]?\\\"\'0123456789");
58  COM_assertion_msg(ni, "File name must start with a letter");
59 
60  if ( ni == std::string::npos) {
61  wname = fname;
62  }
63  else {
64  while (fname[ni-1]=='_') --ni; // Remove the '_' at the end.
65  wname = fname.substr( 0, ni);
66  }
67 
68  std::cout << "Creating window \"" << wname << '"' << endl;
69 
70  // Read in IM/HDF format
71  int err = IM_Reader().read_winmesh( argv[1], wname);
72  COM_assertion( err>=0);
73 
74  // Allocate memory for normals
75  const string rb = wname+".rb";
76  COM_new_attribute(rb.c_str(), 'e', COM_DOUBLE, 1, "");
77  COM_resize_array( rb.c_str());
78 
79  // Allocate an element and a nodal attribute for testing elements_to_nodes
80  const string disps = wname+".disps";
81  COM_new_attribute(disps.c_str(), 'e', COM_DOUBLE, 3, "m");
82  COM_resize_array( disps.c_str());
83 
84  COM_window_init_done( wname.c_str());
85 
89 
90  int PROP_init = COM_get_function_handle( "PROP.initialize");
91  int mesh_hdl = COM_get_attribute_handle( (wname+".mesh").c_str());
92 
93  COM_call_function( PROP_init, &mesh_hdl);
94 
95  int PROP_prop = COM_get_function_handle( "PROP.propagate");
96 
97  int rb_hdl = COM_get_attribute_handle( rb.c_str());
98  int disps_hdl = COM_get_attribute_handle( disps.c_str());
99 
100  double spd = 1.e-1;
101  int BLAS_copy_scalar = COM_get_function_handle( "BLAS.copy_scalar");
102  COM_call_function( BLAS_copy_scalar, &spd, &rb_hdl);
103 
104  double dt = 1.e-6;
105  COM_call_function( PROP_prop, &mesh_hdl, &rb_hdl, &dt, &disps_hdl);
106 
107  std::cout << "Output window into file..." << endl;
108 
109  // Output normals
110  int OUT_set = COM_get_function_handle( "OUT.set_option");
111  int OUT_write = COM_get_function_handle( "OUT.write_attribute");
112 
113  COM_call_function( OUT_set, "mode", "w");
114  int all_hdl = COM_get_attribute_handle( (wname+".all").c_str());
115  COM_call_function( OUT_write, argv[2], &all_hdl,
116  (char*)wname.c_str(), "000");
117 
118  COM_finalize();
119 }
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
#define COM_assertion_msg(EX, msg)
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
void COM_finalize()
Definition: roccom_c++.h:59
Definition: Rocout.h:81
void COM_window_init_done(const char *w_str, int pane_changed=true)
Definition: roccom_c++.h:102
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
void COM_init(int *argc, char ***argv)
Definition: roccom_c++.h:57
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
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
int read_winmesh(const char *fname, const std::string &wname, bool del=true)
Definition: IM_Reader.h:58
#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

Here is the call graph for this function: