38 #include <boost/core/ignore_unused.hpp>
50 ModuleKey ProcessFieldFromString::className =
53 ProcessFieldFromString::create,
54 "Modify an existing or create a new field from the existing fields as "
55 "specified by a string using a required argument of the form "
56 "fieldstr=\"x + y + u\" ");
62 false,
"NotSet",
"Analytic expression");
66 "name for modified new field, default is \"newfield\" (optional)");
81 int nfields =
m_f->m_variables.size();
84 string fieldName =
m_config[
"fieldname"].as<
string>();
91 if (it !=
m_f->m_variables.end())
94 fieldID = std::distance(
m_f->m_variables.begin(), it);
101 m_f->m_variables.push_back(fieldName);
105 if (
m_f->m_exp[0]->GetNumElmts() == 0)
112 m_f->m_session->LoadParameter(
"Strip_Z", nstrips, 1);
114 "Routine is currently only setup for non-strip files");
118 m_f->m_exp.resize(nfields + 1);
119 m_f->m_exp[nfields] =
m_f->AppendExpList(
m_f->m_numHomogeneousDir);
124 vector<Array<OneD, const NekDouble> > interpfields;
128 int npoints =
m_f->m_exp[0]->GetTotPoints();
132 m_f->m_exp[0]->GetCoords(x, y, z);
133 interpfields.push_back(x);
134 interpfields.push_back(y);
135 interpfields.push_back(z);
138 for (
int i = 0; i < nfields; ++i)
140 varstr +=
" " +
m_f->m_variables[i];
141 interpfields.push_back(
m_f->m_exp[i]->GetPhys());
147 string fieldstr =
m_config[
"fieldstr"].as<
string>();
151 strEval.
Evaluate(exprId, interpfields,
m_f->m_exp[fieldID]->UpdatePhys());
154 m_f->m_exp[fieldID]->FwdTrans_IterPerExp(
155 m_f->m_exp[fieldID]->GetPhys(),
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 ~ProcessFieldFromString()
virtual void Process(po::variables_map &vm)
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.