39#include <boost/core/ignore_unused.hpp>
55 "Computes gradient of fields.");
68 std::set<int> &directions)
70 if (
m_config[
"vars"].as<string>().compare(
"NotSet"))
73 m_f->m_variables, variables);
77 for (
int v = 0; v <
m_f->m_variables.size(); ++v)
82 vector<string> coords = {
"x",
"y",
"z"};
83 int spacedim =
m_f->m_numHomogeneousDir +
m_f->m_graph->GetMeshDimension();
84 coords.resize(spacedim);
85 if (
m_config[
"dirs"].as<string>().compare(
"NotSet"))
92 for (
int d = 0;
d < spacedim; ++
d)
108 m_f->m_exp[i]->GetPhys(), grad[n]);
116 int expdim =
m_f->m_graph->GetMeshDimension();
117 int spacedim =
m_f->m_numHomogeneousDir + expdim;
118 int nfields =
m_f->m_variables.size();
121 int npoints =
m_f->m_exp[0]->GetNpoints();
124 for (
int i = 0; i < spacedim; i++)
135 if (hasvel &&
m_f->m_fieldMetaDataMap.count(
"MappingCartesianVel"))
137 if (
m_f->m_fieldMetaDataMap[
"MappingCartesianVel"] ==
"False")
140 for (
int i = 0; i < spacedim; ++i)
143 if (
m_f->m_exp[0]->GetWaveSpace())
145 m_f->m_exp[0]->HomogeneousBwdTrans(
146 npoints,
m_f->m_exp[i]->GetPhys(), vel[i]);
155 mapping->ContravarToCartesian(vel, vel);
157 if (
m_f->m_exp[0]->GetWaveSpace())
159 for (
int i = 0; i < spacedim; ++i)
161 m_f->m_exp[0]->HomogeneousFwdTrans(npoints, vel[i], vel[i]);
167 for (
int i = 0; i < spacedim; ++i)
176 for (
int i = 0; i < spacedim && i < nfields; ++i)
187 for (
int j = 0; j < spacedim; ++j)
197 m_f->m_exp[i]->GetPhys(), tmp[j]);
200 mapping->CovarToCartesian(tmp, tmp);
214 int nfields =
m_f->m_variables.size();
216 m_f->m_exp.resize(nfields + addfields);
218 vector<string> coords = {
"x",
"y",
"z"};
223 m_f->m_variables.push_back(
m_f->m_variables[i] +
"_" + coords[j]);
228 if (
m_f->m_exp[0]->GetNumElmts() == 0)
233 int npoints =
m_f->m_exp[0]->GetNpoints();
235 for (
int i = 0; i < addfields; ++i)
240 if (
m_f->m_fieldMetaDataMap.count(
"MappingType"))
249 for (
int i = 0; i < addfields; ++i)
251 m_f->m_exp[nfields + i] =
m_f->AppendExpList(
m_f->m_numHomogeneousDir);
253 Vmath::Vcopy(npoints, grad[i], 1,
m_f->m_exp[nfields + i]->UpdatePhys(),
255 m_f->m_exp[nfields + i]->FwdTransLocalElmt(
256 grad[i],
m_f->m_exp[nfields + i]->UpdateCoeffs());
FieldSharedPtr m_f
Field object.
std::map< std::string, ConfigOption > m_config
List of configuration values.
void ProcessMappingFld(Array< OneD, Array< OneD, NekDouble > > &grad)
static ModuleKey className
ProcessGrad(FieldSharedPtr f)
std::set< int > m_selectedVars
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
std::set< int > m_directions
void ParserOptions(std::set< int > &variables, std::set< int > &directions)
void ProcessCartesianFld(Array< OneD, Array< OneD, NekDouble > > &grad)
virtual void v_Process(po::variables_map &vm) override
Write mesh to output file.
static GlobalMapping::MappingSharedPtr GetMapping(FieldSharedPtr f)
Abstract base class for processing modules.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static bool GenerateVariableSet(const std::string &str, const std::vector< std::string > &variables, std::set< int > &out)
Generate a set of variable locations.
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
ModuleFactory & GetModuleFactory()
GLOBAL_MAPPING_EXPORT typedef std::shared_ptr< Mapping > MappingSharedPtr
A shared pointer to a Mapping object.
MultiRegions::Direction const DirCartesianMap[]
std::vector< double > d(NPUPPER *NPUPPER)
The above copyright notice and this permission notice shall be included.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Represents a command-line configuration option.