70 int nfields =
m_f->m_variables.size();
71 m_f->m_variables.push_back(
"qualitymetric");
73 if (
m_f->m_exp[0]->GetNumElmts() == 0)
78 int NumHomogeneousDir =
m_f->m_numHomogeneousDir;
83 m_f->m_exp.resize(nfields + 1);
84 exp =
m_f->AppendExpList(NumHomogeneousDir);
86 m_f->m_exp[nfields] = exp;
96 for (
int i = 0; i < exp->GetExpSize(); ++i)
100 int offset = exp->GetPhys_Offset(i);
104 ASSERTL0(
q.size() == Elmt->GetTotPoints(),
"number of points mismatch");
108 exp->FwdTransLocalElmt(phys, coeffs);
118 vector<Array<OneD, NekDouble>> xy;
119 for (
int i = 0; i < geom->GetNumVerts(); i++)
131 for (
int j = 0; j < b[1]->GetNumPoints(); j++)
133 for (
int i = 0; i < b[0]->GetNumPoints(); i++)
135 NekDouble a1 = 0.5 * (1.0 - u[i]), a2 = 0.5 * (1.0 + u[i]);
136 NekDouble b1 = 0.5 * (1.0 - v[j]), b2 = 0.5 * (1.0 + v[j]);
139 dxdz(0, 0) = 0.5 * (-b1 * xy[0][0] + b1 * xy[1][0] +
140 b2 * xy[2][0] - b2 * xy[3][0]);
141 dxdz(1, 0) = 0.5 * (-b1 * xy[0][1] + b1 * xy[1][1] +
142 b2 * xy[2][1] - b2 * xy[3][1]);
144 dxdz(0, 1) = 0.5 * (-a1 * xy[0][0] - a2 * xy[1][0] +
145 a2 * xy[2][0] + a1 * xy[3][0]);
146 dxdz(1, 1) = 0.5 * (-a1 * xy[0][1] - a2 * xy[1][1] +
147 a2 * xy[2][1] + a1 * xy[3][1]);
156 vector<Array<OneD, NekDouble>> xy;
157 for (
int i = 0; i < geom->GetNumVerts(); i++)
169 for (
int i = 0; i < b[0]->GetNumPoints(); i++)
171 for (
int j = 0; j < b[1]->GetNumPoints(); j++)
174 dxdz(0, 0) = -xy[0][0] / 2.0 + xy[1][0] / 2.0;
176 dxdz(0, 1) = -xy[0][0] / 2.0 + xy[2][0] / 2.0;
178 dxdz(1, 0) = -xy[0][1] / 2.0 + xy[1][1] / 2.0;
180 dxdz(1, 1) = -xy[0][1] / 2.0 + xy[2][1] / 2.0;
189 vector<Array<OneD, NekDouble>> xyz;
190 for (
int i = 0; i < geom->GetNumVerts(); i++)
203 for (
int i = 0; i < b[0]->GetNumPoints(); i++)
205 for (
int j = 0; j < b[1]->GetNumPoints(); j++)
207 for (
int k = 0; k < b[2]->GetNumPoints(); k++)
210 dxdz(0, 0) = -xyz[0][0] / 2.0 + xyz[1][0] / 2.0;
212 dxdz(0, 1) = -xyz[0][0] / 2.0 + xyz[2][0] / 2.0;
214 dxdz(0, 2) = -xyz[0][0] / 2.0 + xyz[3][0] / 2.0;
216 dxdz(1, 0) = -xyz[0][1] / 2.0 + xyz[1][1] / 2.0;
218 dxdz(1, 1) = -xyz[0][1] / 2.0 + xyz[2][1] / 2.0;
220 dxdz(1, 2) = -xyz[0][1] / 2.0 + xyz[3][1] / 2.0;
222 dxdz(2, 0) = -xyz[0][2] / 2.0 + xyz[1][2] / 2.0;
224 dxdz(2, 1) = -xyz[0][2] / 2.0 + xyz[2][2] / 2.0;
226 dxdz(2, 2) = -xyz[0][2] / 2.0 + xyz[3][2] / 2.0;
236 vector<Array<OneD, NekDouble>> xyz;
237 for (
int i = 0; i < geom->GetNumVerts(); i++)
250 for (
int k = 0; k < b[2]->GetNumPoints(); k++)
252 for (
int j = 0; j < b[1]->GetNumPoints(); j++)
254 for (
int i = 0; i < b[0]->GetNumPoints(); i++)
256 NekDouble xi1 = 0.5 * (1 + eta1[i]) * (1 - eta3[k]) - 1.0;
259 b2 = 0.5 * (1 + eta2[j]);
261 c2 = 0.5 * (1 + eta3[k]);
265 dxdz(0, 0) = 0.5 * (-b1 * xyz[0][0] + b1 * xyz[1][0] +
266 b2 * xyz[2][0] - b2 * xyz[3][0]);
267 dxdz(1, 0) = 0.5 * (-b1 * xyz[0][1] + b1 * xyz[1][1] +
268 b2 * xyz[2][1] - b2 * xyz[3][1]);
269 dxdz(2, 0) = 0.5 * (-b1 * xyz[0][2] + b1 * xyz[1][2] +
270 b2 * xyz[2][2] - b2 * xyz[3][2]);
272 dxdz(0, 1) = 0.5 * ((a2 - c1) * xyz[0][0] - a2 * xyz[1][0] +
273 a2 * xyz[2][0] + (c1 - a2) * xyz[3][0] -
274 c2 * xyz[4][0] + c2 * xyz[5][0]);
275 dxdz(1, 1) = 0.5 * ((a2 - c1) * xyz[0][1] - a2 * xyz[1][1] +
276 a2 * xyz[2][1] + (c1 - a2) * xyz[3][1] -
277 c2 * xyz[4][1] + c2 * xyz[5][1]);
278 dxdz(2, 1) = 0.5 * ((a2 - c1) * xyz[0][2] - a2 * xyz[1][2] +
279 a2 * xyz[2][2] + (c1 - a2) * xyz[3][2] -
280 c2 * xyz[4][2] + c2 * xyz[5][2]);
282 dxdz(0, 2) = 0.5 * (-b1 * xyz[0][0] - b2 * xyz[3][0] +
283 b1 * xyz[4][0] + b2 * xyz[5][0]);
284 dxdz(1, 2) = 0.5 * (-b1 * xyz[0][1] - b2 * xyz[3][1] +
285 b1 * xyz[4][1] + b2 * xyz[5][1]);
286 dxdz(2, 2) = 0.5 * (-b1 * xyz[0][2] - b2 * xyz[3][2] +
287 b1 * xyz[4][2] + b2 * xyz[5][2]);
297 vector<Array<OneD, NekDouble>> xyz;
298 for (
int i = 0; i < geom->GetNumVerts(); i++)
311 for (
int k = 0; k < b[2]->GetNumPoints(); k++)
313 for (
int j = 0; j < b[1]->GetNumPoints(); j++)
315 for (
int i = 0; i < b[0]->GetNumPoints(); i++)
320 b2 = 0.5 * (1 + eta2[j]);
322 c2 = 0.5 * (1 + eta3[k]);
327 -0.5 * b1 * c1 * xyz[0][0] + 0.5 * b1 * c1 * xyz[1][0] +
328 0.5 * b2 * c1 * xyz[2][0] - 0.5 * b2 * c1 * xyz[3][0] -
329 0.5 * b1 * c2 * xyz[5][0] + 0.5 * b1 * c2 * xyz[5][0] +
330 0.5 * b2 * c2 * xyz[6][0] - 0.5 * b2 * c2 * xyz[7][0];
332 -0.5 * b1 * c1 * xyz[0][1] + 0.5 * b1 * c1 * xyz[1][1] +
333 0.5 * b2 * c1 * xyz[2][1] - 0.5 * b2 * c1 * xyz[3][1] -
334 0.5 * b1 * c2 * xyz[5][1] + 0.5 * b1 * c2 * xyz[5][1] +
335 0.5 * b2 * c2 * xyz[6][1] - 0.5 * b2 * c2 * xyz[7][1];
337 -0.5 * b1 * c1 * xyz[0][2] + 0.5 * b1 * c1 * xyz[1][2] +
338 0.5 * b2 * c1 * xyz[2][2] - 0.5 * b2 * c1 * xyz[3][2] -
339 0.5 * b1 * c2 * xyz[5][2] + 0.5 * b1 * c2 * xyz[5][2] +
340 0.5 * b2 * c2 * xyz[6][2] - 0.5 * b2 * c2 * xyz[7][2];
343 -0.5 * a1 * c1 * xyz[0][0] - 0.5 * a2 * c1 * xyz[1][0] +
344 0.5 * a2 * c1 * xyz[2][0] + 0.5 * a1 * c1 * xyz[3][0] -
345 0.5 * a1 * c2 * xyz[5][0] - 0.5 * a2 * c2 * xyz[5][0] +
346 0.5 * a2 * c2 * xyz[6][0] + 0.5 * a1 * c2 * xyz[7][0];
348 -0.5 * a1 * c1 * xyz[0][1] - 0.5 * a2 * c1 * xyz[1][1] +
349 0.5 * a2 * c1 * xyz[2][1] + 0.5 * a1 * c1 * xyz[3][1] -
350 0.5 * a1 * c2 * xyz[5][1] - 0.5 * a2 * c2 * xyz[5][1] +
351 0.5 * a2 * c2 * xyz[6][1] + 0.5 * a1 * c2 * xyz[7][1];
353 -0.5 * a1 * c1 * xyz[0][2] - 0.5 * a2 * c1 * xyz[1][2] +
354 0.5 * a2 * c1 * xyz[2][2] + 0.5 * a1 * c1 * xyz[3][2] -
355 0.5 * a1 * c2 * xyz[5][2] - 0.5 * a2 * c2 * xyz[5][2] +
356 0.5 * a2 * c2 * xyz[6][2] + 0.5 * a1 * c2 * xyz[7][2];
359 -0.5 * b1 * a1 * xyz[0][0] - 0.5 * b1 * a2 * xyz[1][0] -
360 0.5 * b2 * a2 * xyz[2][0] - 0.5 * b2 * a1 * xyz[3][0] +
361 0.5 * b1 * a1 * xyz[5][0] + 0.5 * b1 * a2 * xyz[5][0] +
362 0.5 * b2 * a2 * xyz[6][0] + 0.5 * b2 * a1 * xyz[7][0];
364 -0.5 * b1 * a1 * xyz[0][1] - 0.5 * b1 * a2 * xyz[1][1] -
365 0.5 * b2 * a2 * xyz[2][1] - 0.5 * b2 * a1 * xyz[3][1] +
366 0.5 * b1 * a1 * xyz[5][1] + 0.5 * b1 * a2 * xyz[5][1] +
367 0.5 * b2 * a2 * xyz[6][1] + 0.5 * b2 * a1 * xyz[7][1];
369 -0.5 * b1 * a1 * xyz[0][2] - 0.5 * b1 * a2 * xyz[1][2] -
370 0.5 * b2 * a2 * xyz[2][2] - 0.5 * b2 * a1 * xyz[3][2] +
371 0.5 * b1 * a1 * xyz[5][2] + 0.5 * b1 * a2 * xyz[5][2] +
372 0.5 * b2 * a2 * xyz[6][2] + 0.5 * b2 * a1 * xyz[7][2];
396 const int expDim = chi->GetNumBases();
399 vector<LibUtilities::BasisKey> basisKeys;
400 bool needsInterp =
false;
402 for (
int i = 0; i < expDim; ++i)
404 nElemPts *= pElem[i].GetNumPoints();
406 needsInterp || pElem[i].GetNumPoints() <
p[i].GetNumPoints() - 1;
412 err <<
"Interpolating from higher order geometry to lower order in "
413 <<
"element " << geom->GetGlobalID();
417 for (
int i = 0; i < expDim; ++i)
421 ? chi->GetBasis(i)->GetBasisKey()
423 chi->GetBasisNumModes(i), pElem[i]));
427 switch (chi->DetShapeType())
431 basisKeys[0], basisKeys[1]);
435 basisKeys[0], basisKeys[1]);
439 basisKeys[0], basisKeys[1], basisKeys[2]);
443 basisKeys[0], basisKeys[1], basisKeys[2]);
447 basisKeys[0], basisKeys[1], basisKeys[2]);
455 const int pts = deriv[0][0].size();
456 const int nq = chiMod->GetTotPoints();
463 for (
int k = 0; k < pts; ++k)
468 for (
int i = 0; i < expDim; ++i)
470 for (
int j = 0; j < expDim; ++j)
472 jac(j, i) = deriv[i][j][k];
476 jacIdeal = jac * i2rm[k];
481 jacDet = jacIdeal(0, 0) * jacIdeal(1, 1) -
482 jacIdeal(0, 1) * jacIdeal(1, 0);
484 else if (expDim == 3)
486 jacDet = jacIdeal(0, 0) * (jacIdeal(1, 1) * jacIdeal(2, 2) -
487 jacIdeal(2, 1) * jacIdeal(1, 2)) -
488 jacIdeal(0, 1) * (jacIdeal(1, 0) * jacIdeal(2, 2) -
489 jacIdeal(2, 0) * jacIdeal(1, 2)) +
490 jacIdeal(0, 2) * (jacIdeal(1, 0) * jacIdeal(2, 1) -
491 jacIdeal(2, 0) * jacIdeal(1, 1));
506 for (
int i = 0; i < expDim; ++i)
508 for (
int j = 0; j < expDim; ++j)
510 frob += jacIdeal(i, j) * jacIdeal(i, j);
515 eta[k] = expDim * pow(sigma, 2.0 / expDim) / frob;
521 NekDouble mx = -1.0 * numeric_limits<double>::max();
522 NekDouble mn = numeric_limits<double>::max();
523 for (
int k = 0; k < pts; k++)
525 mx = max(mx, eta[k]);
526 mn = min(mn, eta[k]);
528 for (
int k = 0; k < pts; k++)
535 if (needsInterp && pts != 1)
543 else if (expDim == 3)
550 ASSERTL0(
false,
"mesh dim makes no sense");
#define ASSERTL0(condition, msg)
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
FieldSharedPtr m_f
Field object.
std::map< std::string, ConfigOption > m_config
List of configuration values.
Abstract base class for processing modules.
Array< OneD, NekDouble > GetQ(LocalRegions::ExpansionSharedPtr e, bool s)
ProcessQualityMetric(FieldSharedPtr f)
~ProcessQualityMetric() override
void v_Process(po::variables_map &vm) override
Write mesh to output file.
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
static ModuleKey className
Describes the specification for a Basis.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
vector< DNekMat > MappingIdealToRef(SpatialDomains::GeometrySharedPtr geom, StdRegions::StdExpansionSharedPtr chi)
ModuleFactory & GetModuleFactory()
void Interp3D(const BasisKey &fbasis0, const BasisKey &fbasis1, const BasisKey &fbasis2, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, const BasisKey &tbasis1, const BasisKey &tbasis2, Array< OneD, NekDouble > &to)
this function interpolates a 3D function evaluated at the quadrature points of the 3D basis,...
void Interp2D(const BasisKey &fbasis0, const BasisKey &fbasis1, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, const BasisKey &tbasis1, Array< OneD, NekDouble > &to)
this function interpolates a 2D function evaluated at the quadrature points of the 2D basis,...
std::vector< PointsKey > PointsKeyVector
std::shared_ptr< Expansion > ExpansionSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
std::shared_ptr< PointGeom > PointGeomSharedPtr
std::shared_ptr< Geometry > GeometrySharedPtr
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
std::vector< double > z(NPUPPER)
std::vector< double > q(NPUPPER *NPUPPER)
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
scalarT< T > sqrt(scalarT< T > in)
Represents a command-line configuration option.