39 #include <boost/core/ignore_unused.hpp>
55 "Computes gradient of fields.");
70 int expdim =
m_f->m_graph->GetMeshDimension();
71 int spacedim =
m_f->m_numHomogeneousDir + expdim;
72 int nfields =
m_f->m_variables.size();
73 int addfields = nfields * spacedim;
75 for (i = 0; i < nfields; ++i)
79 m_f->m_variables.push_back(
m_f->m_variables[i] +
"_x");
81 else if (spacedim == 2)
83 m_f->m_variables.push_back(
m_f->m_variables[i] +
"_x");
84 m_f->m_variables.push_back(
m_f->m_variables[i] +
"_y");
86 else if (spacedim == 3)
88 m_f->m_variables.push_back(
m_f->m_variables[i] +
"_x");
89 m_f->m_variables.push_back(
m_f->m_variables[i] +
"_y");
90 m_f->m_variables.push_back(
m_f->m_variables[i] +
"_z");
95 if (
m_f->m_exp[0]->GetNumElmts() == 0)
100 int npoints =
m_f->m_exp[0]->GetNpoints();
102 m_f->m_exp.resize(nfields + addfields);
104 for (i = 0; i < addfields; ++i)
110 for (
int i = 0; i < spacedim; i++)
121 if (
m_f->m_fieldMetaDataMap.count(
"MappingCartesianVel"))
123 if (
m_f->m_fieldMetaDataMap[
"MappingCartesianVel"] ==
"False")
126 for (
int i = 0; i < spacedim; ++i)
129 if (
m_f->m_exp[0]->GetWaveSpace())
131 m_f->m_exp[0]->HomogeneousBwdTrans(
m_f->m_exp[i]->GetPhys(),
141 mapping->ContravarToCartesian(vel, vel);
143 if (
m_f->m_exp[0]->GetWaveSpace())
145 for (
int i = 0; i < spacedim; ++i)
147 m_f->m_exp[0]->HomogeneousFwdTrans(vel[i], vel[i]);
153 for (
int i = 0; i < spacedim; ++i)
162 for (
int i = 0; i < spacedim && i < nfields; ++i)
170 for (i = 0; i < nfields; ++i)
172 for (j = 0; j < spacedim; ++j)
182 m_f->m_exp[i]->GetPhys(), tmp[j]);
185 mapping->CovarToCartesian(tmp, tmp);
186 for (
int j = 0; j < spacedim; j++)
188 Vmath::Vcopy(npoints, tmp[j], 1, grad[i * spacedim + j], 1);
192 for (i = 0; i < addfields; ++i)
194 m_f->m_exp[nfields + i] =
195 m_f->AppendExpList(
m_f->m_numHomogeneousDir);
196 Vmath::Vcopy(npoints, grad[i], 1,
m_f->m_exp[nfields + i]->UpdatePhys(),
198 m_f->m_exp[nfields + i]->FwdTrans_IterPerExp(
199 grad[i],
m_f->m_exp[nfields + i]->UpdateCoeffs());
FieldSharedPtr m_f
Field object.
virtual void Process(po::variables_map &vm)
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.
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[]
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)