51 "Computes gradient of fields.");
64 std::set<int> &directions)
66 if (
m_config[
"vars"].as<string>().compare(
"NotSet"))
69 m_f->m_variables, variables);
73 for (
int v = 0; v <
m_f->m_variables.size(); ++v)
78 vector<string> coords = {
"x",
"y",
"z"};
79 int spacedim =
m_f->m_numHomogeneousDir +
m_f->m_graph->GetMeshDimension();
80 coords.resize(spacedim);
81 if (
m_config[
"dirs"].as<string>().compare(
"NotSet"))
88 for (
int d = 0;
d < spacedim; ++
d)
104 m_f->m_exp[i]->GetPhys(), grad[n]);
112 int expdim =
m_f->m_graph->GetMeshDimension();
113 int spacedim =
m_f->m_numHomogeneousDir + expdim;
114 int nfields =
m_f->m_variables.size();
117 int npoints =
m_f->m_exp[0]->GetNpoints();
120 for (
int i = 0; i < spacedim; i++)
131 if (hasvel &&
m_f->m_fieldMetaDataMap.count(
"MappingCartesianVel"))
133 if (
m_f->m_fieldMetaDataMap[
"MappingCartesianVel"] ==
"False")
136 for (
int i = 0; i < spacedim; ++i)
139 if (
m_f->m_exp[0]->GetWaveSpace())
141 m_f->m_exp[0]->HomogeneousBwdTrans(
142 npoints,
m_f->m_exp[i]->GetPhys(), vel[i]);
151 mapping->ContravarToCartesian(vel, vel);
153 if (
m_f->m_exp[0]->GetWaveSpace())
155 for (
int i = 0; i < spacedim; ++i)
157 m_f->m_exp[0]->HomogeneousFwdTrans(npoints, vel[i], vel[i]);
163 for (
int i = 0; i < spacedim; ++i)
172 for (
int i = 0; i < spacedim && i < nfields; ++i)
183 for (
int j = 0; j < spacedim; ++j)
193 m_f->m_exp[i]->GetPhys(), tmp[j]);
196 mapping->CovarToCartesian(tmp, tmp);
210 int nfields =
m_f->m_variables.size();
212 m_f->m_exp.resize(nfields + addfields);
214 vector<string> coords = {
"x",
"y",
"z"};
219 m_f->m_variables.push_back(
m_f->m_variables[i] +
"_" + coords[j]);
224 if (
m_f->m_exp[0]->GetNumElmts() == 0)
229 int npoints =
m_f->m_exp[0]->GetNpoints();
231 for (
int i = 0; i < addfields; ++i)
236 if (
m_f->m_fieldMetaDataMap.count(
"MappingType"))
245 for (
int i = 0; i < addfields; ++i)
247 m_f->m_exp[nfields + i] =
m_f->AppendExpList(
m_f->m_numHomogeneousDir);
249 Vmath::Vcopy(npoints, grad[i], 1,
m_f->m_exp[nfields + i]->UpdatePhys(),
251 m_f->m_exp[nfields + i]->FwdTransLocalElmt(
252 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)
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)
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Represents a command-line configuration option.