1 #ifndef __ELMER_AGENT_H__
2 #define __ELMER_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 newDataItem(interfaceName+
".coords");
58 COM_new_dataitem(newDataItem.c_str(),
'n',COM_DOUBLE,3,
"m");
61 COM_window_init_done(interfaceName);
63 if(SolverUtils::PopulateSolverAgentFromWindow(interfaceName,*
this))
68 WriteOut(
"Elmer Initialization done!\n");
71 int virtual Run(
double time){
83 WriteOut(
"Calling Elmer finalize.\n");
87 WriteErr(
"Elmer failed to finalize!\n");
std::vector< int > componentFunctionHandles
std::vector< double > faceCoordinates
virtual std::vector< double > returnNodeCoords()
virtual int Initialize(const std::string &interfaceName, int verblevel=1)
virtual std::vector< double > returnFaceCoords()
const std::vector< double > & Coordinates() const
std::vector< double > nodeCoordinates
virtual int Run(double time)
virtual void WriteErr(const std::string &output)
virtual void WriteOut(const std::string &output)