ElmerFoamFSI  2.0
ElmerFoamFSI is fluid-solid interaction simulation application built up from OpenFOAM CFD and Elmer CSM coupled through the IMPACT multiphysics software integration infrastructure.
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros Groups Pages
int main ( int  argc,
char *  argv[] 
)

Get the handle for the initialize function and call it

Get the handle for the run function and call it

Get the handle for the run function and call it

Definition at line 33 of file ElmerTest/trunk/src/SolverModuleDriver.C.

References usage().

33  {
34  COM_init( &argc, &argv);
35 
36  std::cout << "After COM_init" << std::endl;
37 
38  std::vector<double> tNext;
39  stringstream ss;
40  double var;
41  bool isNum = false;
42  std::string arg;
43 
44  std::cout << "argc = " << argc << std::endl;
45 
46  if(argc > 1){
47  for(int i=1; i < argc; i++){
48  ss.clear();
49  ss.str("");
50  ss << argv[i];
51  for(int j=0; j < ss.str().size(); j++){
52  if(!isdigit(ss.str()[j]) && ss.str()[j] != 'e'
53  && ss.str()[j] != 'E' && ss.str()[j] != '-'
54  && ss.str()[j] != '.')
55  usage(argv[0]);
56  }
57  ss >> var;
58  tNext.push_back(var);
59  }
60  }
61  else
62  usage(argv[0]);
63 
64  std::cout << "line " << __LINE__ << std::endl;
65 
66  for(int i=0; i < tNext.size(); i++)
67  std::cout << tNext[i] << std::endl;
68 
69  for(int i=1; i < tNext.size(); i++){
70  std::cout << tNext[i] << " " << tNext[i-1] << std::endl;
71  if(tNext[i] <= tNext[i-1])
72  usage(argv[0]);
73  }
74 
75  COM_LOAD_MODULE_STATIC_DYNAMIC( SolverModule, "Window1");
76 
78  int init_handle = COM_get_function_handle("Window1.Initialize");
79  bool init_func = (init_handle > 0);
80  std::cout << "init = " << init_handle << std::endl;
81  if(init_handle){
82  COM_call_function(init_handle);
83  }
84 
86  int run_handle = COM_get_function_handle("Window1.Run");
87  bool run_func = (run_handle > 0);
88  std::cout << "run = " << run_handle << std::endl;
89  if(run_handle){
90  for(int i=0; i < tNext.size(); i++){
91  std::cout << "Calling run function from driver" << std::endl;
92  COM_call_function(run_handle,&tNext[i]);
93  }
94  }
95 
97  int final_handle = COM_get_function_handle("Window1.Finalize");
98  bool final_func = (final_handle > 0);
99  std::cout << "final = " << final_handle << std::endl;
100  if(final_handle){
101  COM_call_function(final_handle);
102  }
103 
104  COM_UNLOAD_MODULE_STATIC_DYNAMIC( SolverModule, "Window1");
105 
106  COM_finalize();
107  std::cout << "After COM_finalize" << std::endl;
108 
109 }
void usage(char *exec)

Here is the call graph for this function: