39 #include <boost/core/ignore_unused.hpp>
51 ModuleKey ProcessFieldFromString::className =
54 ProcessFieldFromString::create,
55 "Modify an existing or create a new field from the existing fields as "
56 "specified by a string using a required argument of the form "
57 "fieldstr=\"x + y + u\" ");
65 "name for modified new field, default is \"newfield\" (optional)");
80 int nfields =
m_f->m_variables.size();
83 string fieldName =
m_config[
"fieldname"].as<
string>();
90 if (it !=
m_f->m_variables.end())
93 fieldID = std::distance(
m_f->m_variables.begin(), it);
100 m_f->m_variables.push_back(fieldName);
104 if (
m_f->m_exp[0]->GetNumElmts() == 0)
111 m_f->m_session->LoadParameter(
"Strip_Z", nstrips, 1);
113 "Routine is currently only setup for non-strip files");
117 m_f->m_exp.resize(nfields + 1);
118 m_f->m_exp[nfields] =
m_f->AppendExpList(
m_f->m_numHomogeneousDir);
123 vector<Array<OneD, const NekDouble>> interpfields;
127 int npoints =
m_f->m_exp[0]->GetTotPoints();
131 m_f->m_exp[0]->GetCoords(x, y, z);
132 interpfields.push_back(x);
133 interpfields.push_back(y);
134 interpfields.push_back(z);
137 for (
int i = 0; i < nfields; ++i)
139 varstr +=
" " +
m_f->m_variables[i];
140 interpfields.push_back(
m_f->m_exp[i]->GetPhys());
146 string fieldstr =
m_config[
"fieldstr"].as<
string>();
150 strEval.
Evaluate(exprId, interpfields,
m_f->m_exp[fieldID]->UpdatePhys());
152 m_f->m_exp[fieldID]->FwdTransLocalElmt(
m_f->m_exp[fieldID]->GetPhys(),
153 m_f->m_exp[fieldID]->UpdateCoeffs());
#define ASSERTL0(condition, msg)
FieldSharedPtr m_f
Field object.
std::map< std::string, ConfigOption > m_config
List of configuration values.
virtual void v_Process(po::variables_map &vm) override
virtual ~ProcessFieldFromString()
Abstract base class for processing modules.
Interpreter class for the evaluation of mathematical expressions.
int DefineFunction(const std::string &vlist, const std::string &expr)
Defines a function for the purposes of evaluation.
NekDouble Evaluate(const int id)
Evaluate a function which depends only on constants and/or parameters.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
ModuleFactory & GetModuleFactory()
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
The above copyright notice and this permission notice shall be included.
Represents a command-line configuration option.