1 #ifndef __OPEN_FOAM_PAR_AGENT_H__
2 #define __OPEN_FOAM_PAR_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 myArgv[0] =
const_cast<char *
>(
"dummy");
31 myArgv[1] =
const_cast<char *
>(
"-parallel");
32 int verbIn = verblevel;
36 std::vector<int> paneIDs;
37 COM_get_panes(interfaceName.c_str(),paneIDs);
41 double *nodalCoordinates;
44 std::string coordinateName(interfaceName+
".nc");
45 std::string newDataItemName;
46 if (!paneIDs.empty()) {
47 COM_get_array(coordinateName.c_str(),
paneID,&nodalCoordinates,&stride,&cap);
48 int arraySize = (stride*cap);
50 for(
int i = 0;i < arraySize;i++)
52 newDataItemName = interfaceName+
".coords";
53 COM_new_dataitem(newDataItemName.c_str(),
'n',COM_DOUBLE,3,
"m");
58 newDataItemName = interfaceName+
".setsProb";
59 COM_new_dataitem(newDataItemName.c_str(),
'w',COM_INT,1,
"");
60 newDataItemName = interfaceName+
".probProcId";
61 COM_new_dataitem(newDataItemName.c_str(),
'w',COM_INT,1,
"");
62 newDataItemName = interfaceName+
".probNdeId";
63 COM_new_dataitem(newDataItemName.c_str(),
'w',COM_INT,1,
"");
65 COM_window_init_done(interfaceName);
67 if (!paneIDs.empty()) {
68 if(SolverUtils::PopulateSolverAgentFromWindow(interfaceName,*
this))
71 WriteOut(
"OpenFOAM Initialization done!\n");
77 virtual int Run(
double endTime){
std::vector< int > componentFunctionHandles
virtual int Initialize(const std::string interfaceName, int verblevel=1)
std::vector< double > nodeCoordinates
virtual std::vector< double > returnFaceCoords()
virtual int Run(double endTime)
std::vector< std::string > componentInterfaceNames
std::vector< double > faceCoordinates
const std::vector< double > & Coordinates() const
virtual std::vector< double > returnNodeCoords()
virtual void WriteErr(const std::string &output)
virtual void WriteOut(const std::string &output)