39#include <boost/core/ignore_unused.hpp>
53 "Computes Q-Criterion.");
67 int nfields =
m_f->m_variables.size();
68 m_f->m_variables.push_back(
"Q");
70 if (
m_f->m_exp[0]->GetNumElmts() == 0)
76 int expdim =
m_f->m_graph->GetMeshDimension();
77 int spacedim = expdim + (
m_f->m_numHomogeneousDir);
80 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)
104 for (s = 0; s < nstrips; ++s)
106 Exp =
m_f->AppendExpList(
m_f->m_numHomogeneousDir);
107 auto it =
m_f->m_exp.begin() + s * (nfields + 1) + nfields;
108 m_f->m_exp.insert(it, Exp);
114 for (s = 0; s < nstrips; ++s)
116 for (i = 0; i < spacedim; ++i)
118 m_f->m_exp[s * nfields + i]->PhysDeriv(
119 m_f->m_exp[s * nfields + i]->GetPhys(), grad[i * spacedim],
120 grad[i * spacedim + 1]);
125 grad[0 * spacedim + 1], 1, outfield, 1);
127 Vmath::Vmul(npoints, outfield, 1, outfield, 1, omega, 1);
131 grad[0 * spacedim + 0], 1, S, 1);
134 grad[1 * spacedim + 1], 1, S, 1, S, 1);
138 grad[0 * spacedim + 1], 1, outfield, 1);
139 Vmath::Vmul(npoints, outfield, 1, outfield, 1, outfield, 1);
142 Vmath::Svtvm(npoints, fac, omega, 1, S, 1, outfield, 1);
143 Vmath::Smul(npoints, fac, outfield, 1, outfield, 1);
145 int fid = s * (nfields + 1) + nfields;
148 Exp->FwdTransLocalElmt(outfield,
m_f->m_exp[fid]->UpdateCoeffs());
151 else if (spacedim == 3)
156 for (s = 0; s < nstrips; ++s)
158 for (i = 0; i < spacedim; ++i)
160 m_f->m_exp[s * nfields + i]->PhysDeriv(
161 m_f->m_exp[s * nfields + i]->GetPhys(), grad[i * spacedim],
162 grad[i * spacedim + 1], grad[i * spacedim + 2]);
167 grad[1 * spacedim + 2], 1, outfield1, 1);
169 Vmath::Vmul(npoints, outfield1, 1, outfield1, 1, outfield1, 1);
173 grad[2 * spacedim + 0], 1, outfield2, 1);
175 Vmath::Vmul(npoints, outfield2, 1, outfield2, 1, outfield2, 1);
179 grad[0 * spacedim + 1], 1, outfield3, 1);
181 Vmath::Vmul(npoints, outfield3, 1, outfield3, 1, outfield3, 1);
184 Vmath::Vadd(npoints, outfield1, 1, outfield2, 1, omega, 1);
185 Vmath::Vadd(npoints, omega, 1, outfield3, 1, omega, 1);
190 grad[0 * spacedim + 0], 1, outfield1, 1);
193 grad[1 * spacedim + 1], 1, outfield2, 1);
196 grad[2 * spacedim + 2], 1, outfield3, 1);
199 Vmath::Vadd(npoints, outfield1, 1, outfield2, 1, S, 1);
204 grad[1 * spacedim + 2], 1, outfield1, 1);
205 Vmath::Vmul(npoints, outfield1, 1, outfield1, 1, outfield1, 1);
209 grad[2 * spacedim + 0], 1, outfield2, 1);
210 Vmath::Vmul(npoints, outfield2, 1, outfield2, 1, outfield2, 1);
214 grad[0 * spacedim + 1], 1, outfield3, 1);
215 Vmath::Vmul(npoints, outfield3, 1, outfield3, 1, outfield3, 1);
217 Vmath::Vadd(npoints, outfield1, 1, outfield2, 1, outfield2, 1);
218 Vmath::Vadd(npoints, outfield2, 1, outfield3, 1, outfield3, 1);
220 Vmath::Smul(npoints, fac, outfield3, 1, outfield3, 1);
225 Vmath::Smul(npoints, fac, outfield, 1, outfield, 1);
227 int fid = s * (nfields + 1) + nfields;
230 Exp->FwdTransLocalElmt(outfield,
m_f->m_exp[fid]->UpdateCoeffs());
#define ASSERTL0(condition, msg)
FieldSharedPtr m_f
Field object.
Abstract base class for processing modules.
ProcessQCriterion(FieldSharedPtr f)
static ModuleKey className
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
virtual void v_Process(po::variables_map &vm) override
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)
svtvm (scalar times vector minus 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.