1 #ifndef __OPEN_FOAM_AGENT_H__
2 #define __OPEN_FOAM_AGENT_H__
5 #include "InterfaceLayer.H"
9 virtual int Initialize(
const std::string interfaceName,
int verblevel = 1){
13 if(fluidsInitHandle < 0){
14 WriteErr(
"Failed to get fluids initialization handle.\n");
18 int fluidsStepHandle = COM_get_function_handle(std::string(interfaceName+
".StepFluid").c_str());
19 if(fluidsStepHandle < 0){
20 WriteErr(
"Failed to get fluids step handle.\n");
26 WriteOut(
"Calling OpenFOAM Initialization.\n");
30 argv[0] =
const_cast<char *
>(
"test");
32 int verbIn = verblevel;
35 std::vector<int> paneIDs;
36 COM_get_panes(interfaceName.c_str(),paneIDs);
40 double *nodalCoordinates;
43 std::string coordinateName(interfaceName+
".nc");
44 COM_get_array(coordinateName.c_str(),
paneID,&nodalCoordinates,&stride,&cap);
45 int arraySize = (stride*cap);
47 for(
int i = 0;i < arraySize;i++)
51 std::string newDataItem(interfaceName+
".coords");
52 COM_new_dataitem(newDataItem.c_str(),
'n',COM_DOUBLE,3,
"m");
55 COM_window_init_done(interfaceName);
57 if(SolverUtils::PopulateSolverAgentFromWindow(interfaceName,*
this))
60 WriteOut(
"OpenFOAM Initialization done!\n");
65 virtual int Run(
double endTime){
std::vector< double > nodeCoordinates
virtual std::vector< double > returnNodeCoords()
std::vector< int > componentFunctionHandles
virtual int Run(double endTime)
std::vector< double > faceCoordinates
std::vector< std::string > componentInterfaceNames
virtual std::vector< double > returnFaceCoords()
const std::vector< double > & Coordinates() const
virtual void WriteErr(const std::string &output)
virtual int Initialize(const std::string interfaceName, int verblevel=1)
virtual void WriteOut(const std::string &output)