52 ProcessScalGrad::create,
53 "Computes scalar gradient field.");
69 int spacedim =
m_f->m_graph->GetSpaceDimension();
70 if ((
m_f->m_numHomogeneousDir) == 1 || (
m_f->m_numHomogeneousDir) == 2)
75 int nfields =
m_f->m_variables.size();
78 for (i = 0; i < nfields; i++)
80 var =
m_f->m_variables[i];
81 stringstream filename;
82 filename << var <<
"_scalar_gradient";
84 m_f->m_variables[i] = var;
86 if (
m_f->m_exp[0]->GetNumElmts() == 0)
93 ASSERTL0(
false,
"Error: scalar gradient for a 1D problem cannot "
98 int n, cnt, elmtid, nq, offset, boundary, nfq;
99 int npoints =
m_f->m_exp[0]->GetNpoints();
109 m_f->m_exp[0]->GetBoundaryToElmtMap(BoundarytoElmtID, BoundarytoTraceID);
111 for (i = 0; i < nfields; i++)
113 BndExp[i] =
m_f->m_exp[i]->GetBndCondExpansions();
118 for (cnt = n = 0; n < BndExp[0].size(); ++n)
120 bool doneBnd =
false;
122 for (
int b = 0; b <
m_f->m_bndRegionsToWrite.size(); ++b)
124 if (n ==
m_f->m_bndRegionsToWrite[b])
127 for (i = 0; i < BndExp[0][n]->GetExpSize(); ++i, cnt++)
130 elmtid = BoundarytoElmtID[cnt];
131 elmt =
m_f->m_exp[0]->GetExp(elmtid);
132 nq = elmt->GetTotPoints();
133 offset =
m_f->m_exp[0]->GetPhys_Offset(elmtid);
139 for (j = 0; j < ngrad; ++j)
150 for (j = 0; j < nfields; j++)
152 outfield[j] = BndExp[j][n]->UpdateCoeffs() +
153 BndExp[j][n]->GetCoeff_Offset(i);
157 bc = std::dynamic_pointer_cast<
159 BndExp[0][n]->GetExp(i));
163 boundary = BoundarytoTraceID[cnt];
173 for (j = 0; j < ngrad; ++j)
179 for (k = 0; k < nfields; k++)
183 scalar =
m_f->m_exp[k]->GetPhys() + offset;
184 elmt->PhysDeriv(scalar, grad[0], grad[1], grad[2]);
186 for (j = 0; j < ngrad; ++j)
188 elmt->GetTracePhysVals(boundary, bc, grad[j],
193 if (m_metricinfo->GetGtype() ==
196 for (j = 0; j < ngrad; j++)
199 1, gradnorm, 1, gradnorm, 1);
204 for (j = 0; j < ngrad; j++)
207 1, gradnorm, 1, gradnorm, 1);
210 bc->FwdTrans(gradnorm, outfield[k]);
216 if (doneBnd ==
false)
218 cnt += BndExp[0][n]->GetExpSize();
222 for (j = 0; j < nfields; ++j)
224 for (
int b = 0; b <
m_f->m_bndRegionsToWrite.size(); ++b)
226 m_f->m_exp[j]->UpdateBndCondExpansion(
m_f->m_bndRegionsToWrite[b]) =
227 BndExp[j][
m_f->m_bndRegionsToWrite[b]];
#define ASSERTL0(condition, msg)
FieldSharedPtr m_f
Field object.
virtual ~ProcessScalGrad()
virtual void Process(po::variables_map &vm)
Write mesh to output file.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
const SpatialDomains::GeomFactorsSharedPtr & GetMetricInfo() const
int GetTotPoints() const
This function returns the total number of quadrature points used in the element.
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
ModuleFactory & GetModuleFactory()
std::shared_ptr< Expansion > ExpansionSharedPtr
std::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
@ eDeformed
Geometry is curved or has non-constant factors.
std::shared_ptr< StdExpansion2D > StdExpansion2DSharedPtr
The above copyright notice and this permission notice shall be included.
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
void Zero(int n, T *x, const int incx)
Zero vector.