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)
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, outfield, 1);
120 Vmath::Vmul(npoints, outfield, 1, outfield, 1, omega, 1);
124 grad[0 * spacedim + 0], 1, S, 1);
127 grad[1 * spacedim + 1], 1, S, 1, S, 1);
131 grad[0 * spacedim + 1], 1, outfield, 1);
132 Vmath::Vmul(npoints, outfield, 1, outfield, 1, outfield, 1);
135 Vmath::Svtvm(npoints, fac, omega, 1, S, 1, outfield, 1);
136 Vmath::Smul(npoints, fac, outfield, 1, outfield, 1);
138 Exp =
m_f->AppendExpList(
m_f->m_numHomogeneousDir);
139 Vmath::Vcopy(npoints, outfield, 1, Exp->UpdatePhys(), 1);
140 Exp->FwdTransLocalElmt(outfield, Exp->UpdateCoeffs());
142 auto it =
m_f->m_exp.begin() + s * (nfields + 1) + nfields;
143 m_f->m_exp.insert(it, Exp);
146 else if (spacedim == 3)
151 for (s = 0; s < nstrips; ++s)
153 for (i = 0; i < spacedim; ++i)
155 m_f->m_exp[s * nfields + i]->PhysDeriv(
156 m_f->m_exp[s * nfields + i]->GetPhys(), grad[i * spacedim],
157 grad[i * spacedim + 1], grad[i * spacedim + 2]);
162 grad[1 * spacedim + 2], 1, outfield1, 1);
164 Vmath::Vmul(npoints, outfield1, 1, outfield1, 1, outfield1, 1);
168 grad[2 * spacedim + 0], 1, outfield2, 1);
170 Vmath::Vmul(npoints, outfield2, 1, outfield2, 1, outfield2, 1);
174 grad[0 * spacedim + 1], 1, outfield3, 1);
176 Vmath::Vmul(npoints, outfield3, 1, outfield3, 1, outfield3, 1);
179 Vmath::Vadd(npoints, outfield1, 1, outfield2, 1, omega, 1);
180 Vmath::Vadd(npoints, omega, 1, outfield3, 1, omega, 1);
185 grad[0 * spacedim + 0], 1, outfield1, 1);
188 grad[1 * spacedim + 1], 1, outfield2, 1);
191 grad[2 * spacedim + 2], 1, outfield3, 1);
194 Vmath::Vadd(npoints, outfield1, 1, outfield2, 1, S, 1);
199 grad[1 * spacedim + 2], 1, outfield1, 1);
200 Vmath::Vmul(npoints, outfield1, 1, outfield1, 1, outfield1, 1);
204 grad[2 * spacedim + 0], 1, outfield2, 1);
205 Vmath::Vmul(npoints, outfield2, 1, outfield2, 1, outfield2, 1);
209 grad[0 * spacedim + 1], 1, outfield3, 1);
210 Vmath::Vmul(npoints, outfield3, 1, outfield3, 1, outfield3, 1);
212 Vmath::Vadd(npoints, outfield1, 1, outfield2, 1, outfield2, 1);
213 Vmath::Vadd(npoints, outfield2, 1, outfield3, 1, outfield3, 1);
215 Vmath::Smul(npoints, fac, outfield3, 1, outfield3, 1);
220 Vmath::Smul(npoints, fac, outfield, 1, outfield, 1);
222 Exp =
m_f->AppendExpList(
m_f->m_numHomogeneousDir);
223 Vmath::Vcopy(npoints, outfield, 1, Exp->UpdatePhys(), 1);
224 Exp->FwdTransLocalElmt(outfield, Exp->UpdateCoeffs());
226 auto it =
m_f->m_exp.begin() + s * (nfields + 1) + nfields;
227 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.