1 #ifndef __ELMER_PAR_AGENT_H__
2 #define __ELMER_PAR_AGENT_H__
10 virtual int Initialize(
const std::string &interfaceName,
int verblevel=1){
11 int structuresInitHandle = COM_get_function_handle(std::string(interfaceName+
".Initialize").c_str());
12 if(structuresInitHandle < 0){
13 WriteErr(
"Failed to get Elmer initialization handle.\n");
18 int structuresRunHandle = COM_get_function_handle(std::string(interfaceName+
".Run").c_str());
19 if(structuresRunHandle < 0){
20 WriteErr(
"Failed to get Elmer run handle.\n");
25 int structuresFinalizeHandle = COM_get_function_handle(std::string(interfaceName+
".Finalize").c_str());
26 if(structuresFinalizeHandle < 0){
27 WriteErr(
"Failed to get structures finalize handle.\n");
33 int verbIn = verblevel;
36 WriteErr(
"Elmer failed to initialize!\n");
40 std::vector<int> paneIDs;
41 COM_get_panes(interfaceName.c_str(),paneIDs);
45 double *nodalCoordinates;
48 std::string coordinateName(interfaceName+
".nc");
49 COM_get_array(coordinateName.c_str(),
paneID,&nodalCoordinates,&stride,&cap);
50 int arraySize = (stride*cap);
51 std::cout <<
"Stride = " << stride <<
" Cap = " << cap << std::endl;
53 for(
int i = 0;i < arraySize;i++)
57 std::string newDataItemName(interfaceName+
".coords");
58 COM_new_dataitem(newDataItemName.c_str(),
'n',COM_DOUBLE,3,
"m");
62 newDataItemName = interfaceName+
".setsProb";
63 COM_new_dataitem(newDataItemName.c_str(),
'w',COM_INT,1,
"");
64 newDataItemName = interfaceName+
".probProcId";
65 COM_new_dataitem(newDataItemName.c_str(),
'w',COM_INT,1,
"");
66 newDataItemName = interfaceName+
".probNdeId";
67 COM_new_dataitem(newDataItemName.c_str(),
'w',COM_INT,1,
"");
69 COM_window_init_done(interfaceName);
72 if(SolverUtils::PopulateSolverAgentFromWindow(interfaceName,*
this))
76 WriteOut(
"Elmer Initialization done!\n");
79 int virtual Run(
double time){
91 WriteOut(
"Calling Elmer finalize.\n");
95 WriteErr(
"Elmer failed to finalize!\n");
const std::vector< double > & Coordinates() const
virtual std::vector< double > returnFaceCoords()
std::vector< int > componentFunctionHandles
virtual std::vector< double > returnNodeCoords()
virtual int Initialize(const std::string &interfaceName, int verblevel=1)
std::vector< double > faceCoordinates
virtual int Run(double time)
std::vector< double > nodeCoordinates
virtual void WriteErr(const std::string &output)
virtual void WriteOut(const std::string &output)