51 : m_couplingName(
""), m_evalField(field), m_nSendVars(0), m_sendSteps(0),
52 m_nRecvVars(0), m_recvSteps(0)
65 TiXmlElement *vCoupling = session->GetElement(
"Nektar/Coupling");
66 ASSERTL0(vCoupling,
"Invalid Coupling config");
71 TiXmlElement *element = vCoupling->FirstChildElement(
"I");
74 std::stringstream tagcontent;
75 tagcontent << *element;
77 ASSERTL0(element->Attribute(
"PROPERTY"),
78 "Missing PROPERTY attribute in Coupling section " 79 "XML element: \n\t'" +
80 tagcontent.str() +
"'");
81 std::string
property = element->Attribute(
"PROPERTY");
83 "PROPERTY attribute must be non-empty in XML " 85 tagcontent.str() +
"'");
88 std::string propertyUpper = boost::to_upper_copy(property);
90 CouplingConfigMap::const_iterator x =
m_config.find(propertyUpper);
92 "Invalid PROPERTY attribute in Coupling section " 93 "XML element: \n\t'" +
94 tagcontent.str() +
"'");
97 ASSERTL0(element->Attribute(
"VALUE"),
98 "Missing VALUE attribute in Coupling section " 99 "XML element: \n\t'" +
100 tagcontent.str() +
"'");
101 std::string value = element->Attribute(
"VALUE");
103 "VALUE attribute must be non-empty in XML " 105 tagcontent.str() +
"'");
110 element = element->NextSiblingElement(
"I");
123 if (session->GetComm()->GetRank() == 0 &&
124 session->DefinesCmdLineArgument(
"verbose") &&
m_config.size() > 0)
126 cout <<
"Coupling Config:" << endl;
127 CouplingConfigMap::iterator x;
130 cout <<
"\t" << x->first <<
" = '" << x->second <<
"'" << endl;
136 vector<string> &transVars)
138 vector<int> transToVars;
140 for (
int i = 0; i < transVars.size(); ++i)
142 auto it2 =
find(vars.begin(), vars.end(), transVars[i]);
144 "send variable " + transVars[i] +
" not found");
145 int id = distance(vars.begin(), it2);
147 transToVars.push_back(
id);
#define ASSERTL0(condition, msg)
CouplingConfigMap m_config
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::vector< std::string > m_recvFieldNames
SOLVER_UTILS_EXPORT typedef LibUtilities::NekFactory< std::string, Coupling, MultiRegions::ExpListSharedPtr > CouplingFactory
Declaration of the Coupling factory.
SOLVER_UTILS_EXPORT Coupling(MultiRegions::ExpListSharedPtr field)
virtual SOLVER_UTILS_EXPORT void v_Init()
SOLVER_UTILS_EXPORT std::vector< int > GenerateVariableMapping(std::vector< std::string > &vars, std::vector< std::string > &transVars)
std::vector< std::string > m_sendFieldNames
std::string m_couplingName
static bool GenerateVector(const std::string &str, std::vector< T > &out)
Takes a comma-separated string and converts it to entries in a vector.
MultiRegions::ExpListSharedPtr m_evalField
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
CouplingFactory & GetCouplingFactory()
Declaration of the Coupling factory singleton.
std::shared_ptr< SessionReader > SessionReaderSharedPtr