53 ProcessGrad::create,
"Computes gradient of fields.");
67 cout <<
"ProcessGrad: Calculating gradients..." << endl;
71 int expdim =
m_f->m_graph->GetMeshDimension();
72 int spacedim =
m_f->m_fielddef[0]->m_numHomogeneousDir + expdim;
73 int nfields =
m_f->m_fielddef[0]->m_fields.size();
74 int addfields = nfields*spacedim;
76 int npoints =
m_f->m_exp[0]->GetNpoints();
78 m_f->m_exp.resize(nfields+addfields);
80 for (i = 0; i < addfields; ++i)
86 for (i = 0; i < nfields; ++i)
88 for (j = 0; j < spacedim; ++j)
91 m_f->m_exp[i]->GetPhys(),
96 for (i = 0; i < addfields; ++i)
98 m_f->m_exp[nfields + i] =
m_f->AppendExpList(
m_f->m_fielddef[0]->m_numHomogeneousDir);
99 m_f->m_exp[nfields + i]->UpdatePhys() = grad[i];
100 m_f->m_exp[nfields + i]->FwdTrans_IterPerExp(grad[i],
101 m_f->m_exp[nfields + i]->UpdateCoeffs());
104 vector<string > outname;
105 for (i = 0; i<nfields; ++i)
109 outname.push_back(
m_f->m_fielddef[0]->m_fields[i]+
"_x");
111 else if (spacedim == 2)
113 outname.push_back(
m_f->m_fielddef[0]->m_fields[i]+
"_x");
114 outname.push_back(
m_f->m_fielddef[0]->m_fields[i]+
"_y");
116 else if (spacedim == 3)
118 outname.push_back(
m_f->m_fielddef[0]->m_fields[i]+
"_x");
119 outname.push_back(
m_f->m_fielddef[0]->m_fields[i]+
"_y");
120 outname.push_back(
m_f->m_fielddef[0]->m_fields[i]+
"_z");
124 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
125 =
m_f->m_exp[0]->GetFieldDefinitions();
126 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
128 for (j = 0; j < nfields + addfields; ++j)
130 for (i = 0; i < FieldDef.size(); ++i)
134 FieldDef[i]->m_fields.push_back(outname[j-nfields]);
138 FieldDef[i]->m_fields.push_back(
m_f->m_fielddef[0]->m_fields[j]);
140 m_f->m_exp[j]->AppendFieldData(FieldDef[i], FieldData[i]);
144 m_f->m_fielddef = FieldDef;
145 m_f->m_data = FieldData;
pair< ModuleType, string > ModuleKey
FieldSharedPtr m_f
Field object.
boost::shared_ptr< Field > FieldSharedPtr
MultiRegions::Direction const DirCartesianMap[]
ModuleFactory & GetModuleFactory()
Abstract base class for processing modules.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.