39 #include <boost/core/ignore_unused.hpp>
53 ProcessQCriterion::create,
54 "Computes Q-Criterion.");
68 int nfields =
m_f->m_variables.size();
69 m_f->m_variables.push_back(
"Q");
71 if (
m_f->m_exp[0]->GetNumElmts() == 0)
77 int expdim =
m_f->m_graph->GetMeshDimension();
78 int spacedim = expdim + (
m_f->m_numHomogeneousDir);
80 ASSERTL0(spacedim == 3 || spacedim == 2,
81 "ProcessQCriterion must be computed for a 2D, quasi-3D, or 3D case.");
83 int npoints =
m_f->m_exp[0]->GetNpoints();
95 m_f->m_session->LoadParameter(
"Strip_Z", nstrips, 1);
97 for (i = 0; i < spacedim * spacedim; ++i)
107 for (s = 0; s < nstrips; ++s)
109 for (i = 0; i < spacedim; ++i)
111 m_f->m_exp[s * nfields + i]->PhysDeriv(
112 m_f->m_exp[s * nfields + i]->GetPhys(), grad[i * spacedim],
113 grad[i * spacedim + 1]);
118 grad[0 * spacedim + 1], 1,
121 Vmath::Vmul(npoints, outfield, 1, outfield, 1, omega, 1);
125 grad[0 * spacedim + 0], 1,
129 grad[1 * spacedim + 1], 1,
134 grad[0 * spacedim + 1], 1,
136 Vmath::Vmul(npoints, outfield, 1, outfield, 1, outfield, 1);
139 Vmath::Svtvm(npoints, fac, omega, 1, S, 1, outfield, 1);
140 Vmath::Smul(npoints, fac, outfield, 1, outfield, 1);
142 Exp =
m_f->AppendExpList(
m_f->m_numHomogeneousDir);
143 Vmath::Vcopy(npoints, outfield, 1, Exp->UpdatePhys(), 1);
144 Exp->FwdTrans_IterPerExp(outfield, Exp->UpdateCoeffs());
146 auto it =
m_f->m_exp.begin() + s * (nfields + 1) + nfields;
147 m_f->m_exp.insert(it, Exp);
150 else if (spacedim == 3)
155 for (s = 0; s < nstrips; ++s)
157 for (i = 0; i < spacedim; ++i)
159 m_f->m_exp[s * nfields + i]->PhysDeriv(
160 m_f->m_exp[s * nfields + i]->GetPhys(), grad[i * spacedim],
161 grad[i * spacedim + 1], grad[i * spacedim + 2]);
166 grad[1 * spacedim + 2], 1,
169 Vmath::Vmul(npoints, outfield1, 1, outfield1, 1, outfield1, 1);
173 grad[2 * spacedim + 0], 1,
176 Vmath::Vmul(npoints, outfield2, 1, outfield2, 1, outfield2, 1);
180 grad[0 * spacedim + 1], 1,
183 Vmath::Vmul(npoints, outfield3, 1, outfield3, 1, outfield3, 1);
186 Vmath::Vadd(npoints, outfield1, 1, outfield2, 1, omega, 1);
187 Vmath::Vadd(npoints, omega, 1, outfield3, 1, omega, 1);
192 grad[0 * spacedim + 0], 1,
196 grad[1 * spacedim + 1], 1,
200 grad[2 * spacedim + 2], 1,
204 Vmath::Vadd(npoints, outfield1, 1, outfield2, 1, S, 1);
209 grad[1 * spacedim + 2], 1,
211 Vmath::Vmul(npoints, outfield1, 1, outfield1, 1, outfield1, 1);
215 grad[2 * spacedim + 0], 1,
217 Vmath::Vmul(npoints, outfield2, 1, outfield2, 1, outfield2, 1);
221 grad[0 * spacedim + 1], 1,
223 Vmath::Vmul(npoints, outfield3, 1, outfield3, 1, outfield3, 1);
225 Vmath::Vadd(npoints, outfield1, 1, outfield2, 1, outfield2, 1);
226 Vmath::Vadd(npoints, outfield2, 1, outfield3, 1, outfield3, 1);
228 Vmath::Smul(npoints, fac, outfield3, 1, outfield3, 1);
233 Vmath::Smul(npoints, fac, outfield, 1, outfield, 1);
235 Exp =
m_f->AppendExpList(
m_f->m_numHomogeneousDir);
236 Vmath::Vcopy(npoints, outfield, 1, Exp->UpdatePhys(), 1);
237 Exp->FwdTrans_IterPerExp(outfield, Exp->UpdateCoeffs());
239 auto it =
m_f->m_exp.begin() + s * (nfields + 1) + nfields;
240 m_f->m_exp.insert(it, Exp);
#define ASSERTL0(condition, msg)
FieldSharedPtr m_f
Field object.
Abstract base class for processing modules.
virtual void Process(po::variables_map &vm)
Write mesh to output file.
virtual ~ProcessQCriterion()
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()
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
The above copyright notice and this permission notice shall be included.
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
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 Svtvm(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 Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.