47 : m_couplingName(
""), m_evalField(
field), m_nSendVars(0), m_sendSteps(0),
48 m_nRecvVars(0), m_recvSteps(0)
61 TiXmlElement *vCoupling = session->GetElement(
"Nektar/Coupling");
62 ASSERTL0(vCoupling,
"Invalid Coupling config");
67 TiXmlElement *element = vCoupling->FirstChildElement(
"I");
70 std::stringstream tagcontent;
71 tagcontent << *element;
73 ASSERTL0(element->Attribute(
"PROPERTY"),
74 "Missing PROPERTY attribute in Coupling section "
75 "XML element: \n\t'" +
76 tagcontent.str() +
"'");
77 std::string
property = element->Attribute(
"PROPERTY");
79 "PROPERTY attribute must be non-empty in XML "
81 tagcontent.str() +
"'");
84 std::string propertyUpper = boost::to_upper_copy(property);
86 CouplingConfigMap::const_iterator x =
m_config.find(propertyUpper);
88 "Invalid PROPERTY attribute in Coupling section "
89 "XML element: \n\t'" +
90 tagcontent.str() +
"'");
93 ASSERTL0(element->Attribute(
"VALUE"),
94 "Missing VALUE attribute in Coupling section "
95 "XML element: \n\t'" +
96 tagcontent.str() +
"'");
97 std::string value = element->Attribute(
"VALUE");
98 ASSERTL0(!value.empty(),
"VALUE attribute must be non-empty in XML "
100 tagcontent.str() +
"'");
105 element = element->NextSiblingElement(
"I");
118 if (session->GetComm()->GetRank() == 0 &&
119 session->DefinesCmdLineArgument(
"verbose") &&
m_config.size() > 0)
121 std::cout <<
"Coupling Config:" << std::endl;
122 CouplingConfigMap::iterator x;
125 std::cout <<
"\t" << x->first <<
" = '" << x->second <<
"'"
132 std::vector<std::string> &vars, std::vector<std::string> &transVars)
134 std::vector<int> transToVars;
136 for (
int i = 0; i < transVars.size(); ++i)
138 auto it2 =
find(vars.begin(), vars.end(), transVars[i]);
140 "send variable " + transVars[i] +
" not found");
141 int id = distance(vars.begin(), it2);
143 transToVars.push_back(
id);
#define ASSERTL0(condition, msg)
static bool GenerateVector(const std::string &str, std::vector< T > &out)
Takes a comma-separated string and converts it to entries in a vector.
virtual SOLVER_UTILS_EXPORT void v_Init()
MultiRegions::ExpListSharedPtr m_evalField
std::string m_couplingName
std::vector< std::string > m_sendFieldNames
CouplingConfigMap m_config
std::vector< std::string > m_recvFieldNames
SOLVER_UTILS_EXPORT Coupling(MultiRegions::ExpListSharedPtr field)
SOLVER_UTILS_EXPORT std::vector< int > GenerateVariableMapping(std::vector< std::string > &vars, std::vector< std::string > &transVars)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
SOLVER_UTILS_EXPORT typedef LibUtilities::NekFactory< std::string, Coupling, MultiRegions::ExpListSharedPtr > CouplingFactory
Declaration of the Coupling factory.
CouplingFactory & GetCouplingFactory()
Declaration of the Coupling factory singleton.
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)