42PoolAllocator<SpatialDomains::GeomFactors>
98 : m_type(gtype), m_expDim(xmap->GetShapeDimension()), m_coordDim(coordim),
99 m_valid(true), m_xmap(xmap), m_coords(coords)
109 : m_type(S.m_type), m_expDim(S.m_expDim), m_coordDim(S.m_coordDim),
110 m_valid(S.m_valid), m_xmap(S.m_xmap), m_coords(S.m_coords)
139 if (!(jac_lhs == jac_rhs))
159 "Dimension of target point distribution does not match "
160 "expansion dimension.");
164 int nqtot_tbasis = 1;
172 map_points[i] =
m_xmap->GetBasis(i)->GetPointsKey();
173 nqtot_map *= map_points[i].GetNumPoints();
174 nqtot_tbasis *= keyTgt[i].GetNumPoints();
197 m_xmap->StdPhysDeriv(tmp, d_map[0][i]);
200 m_xmap->StdPhysDeriv(tmp, d_map[0][i], d_map[1][i]);
203 m_xmap->StdPhysDeriv(tmp, d_map[0][i], d_map[1][i],
218 same = same && (map_points[j] == keyTgt[j]);
224 deriv[j][i] = d_map[j][i];
231 Interp(map_points, d_map[j][i], keyTgt, deriv[j][i]);
254 "Dimension of target point distribution does not match "
255 "expansion dimension.");
263 int i = 0, j = 0, k = 0, l = 0;
271 ptsTgt *= keyTgt[i].GetNumPoints();
283 for (i = 0, l = 0; i <
m_expDim; ++i)
289 Vmath::Vvtvp(ptsTgt, &deriv[i][k][0], 1, &deriv[j][k][0], 1,
290 &tmp[l][0], 1, &tmp[l][0], 1);
337 "Dimension of target point distribution does not match "
338 "expansion dimension.");
340 int i = 0, j = 0, k = 0, l = 0;
348 ptsTgt *= keyTgt[i].GetNumPoints();
360 for (i = 0, l = 0; i <
m_expDim; ++i)
366 Vmath::Vvtvp(ptsTgt, &deriv[i][k][0], 1, &deriv[j][k][0], 1,
367 &tmp[l][0], 1, &tmp[l][0], 1);
384 Vmath::Vdiv(ptsTgt, &gmat[i][0], 1, &jac[0], 1, &gmat[i][0], 1);
401 "Dimension of target point distribution does not match "
402 "expansion dimension.");
404 int i = 0, j = 0, k = 0, l = 0;
412 ptsTgt *= keyTgt[i].GetNumPoints();
425 for (i = 0, l = 0; i <
m_expDim; ++i)
431 Vmath::Vvtvp(ptsTgt, &deriv[i][k][0], 1, &deriv[j][k][0], 1,
432 &tmp[l][0], 1, &tmp[l][0], 1);
449 Vmath::Vdiv(ptsTgt, &gmat[i][0], 1, &jac[0], 1, &gmat[i][0], 1);
463 &gmat[
m_expDim * i + j][0], 1, &factors[l][0], 1,
479 "Dimension of target point distribution does not match "
480 "expansion dimension.");
488 nq *= keyTgt[i].GetNumPoints();
496 ptsTgt *= keyTgt[i].GetNumPoints();
509 for (i = 0; i < MFdim; ++i)
519 for (i = 0; i < MFdim - 1; ++i)
525 Vmath::Vcopy(ptsTgt, &deriv[i][k][0], 1, &MFtmp[i][k][0], 1);
562 Vmath::Vvtvp(nq, MFtmp[2][i], 1, PrincipleDir[i], 1, temp, 1, temp,
570 Vmath::Vvtvp(nq, temp, 1, MFtmp[2][i], 1, PrincipleDir[i], 1,
584 for (i = 0; i < MFdim; ++i)
612 p[i] =
m_xmap->GetBasis(i)->GetPointsKey();
613 nqtot *= p[i].GetNumPoints();
625 &deriv[1][0][0], 1, &deriv[0][1][0], 1, &jac[0], 1);
633 &deriv[2][1][0], 1, &deriv[1][2][0], 1, &tmp[0], 1);
634 Vmath::Vvtvp(pts, &deriv[0][0][0], 1, &tmp[0], 1, &jac[0], 1,
638 &deriv[0][1][0], 1, &deriv[2][2][0], 1, &tmp[0], 1);
639 Vmath::Vvtvp(pts, &deriv[1][0][0], 1, &tmp[0], 1, &jac[0], 1,
643 &deriv[1][1][0], 1, &deriv[0][2][0], 1, &tmp[0], 1);
644 Vmath::Vvtvp(pts, &deriv[2][0][0], 1, &tmp[0], 1, &jac[0], 1,
668 ASSERTL1(src_points.size() == tgt_points.size(),
669 "Dimension of target point distribution does not match "
670 "expansion dimension.");
679 tgt_points[0], tgt_points[1], tgt);
683 src, tgt_points[0], tgt_points[1],
700 "Source matrix is of different size to destination"
701 "matrix for computing adjoint.");
703 int n = src[0].size();
711 Vmath::Smul(n, -1.0, &src[1][0], 1, &tgt[1][0], 1);
712 Vmath::Smul(n, -1.0, &src[2][0], 1, &tgt[2][0], 1);
717 int a, b, c, d, e, i, j;
730 1, &src[c][0], 1, &tgt[e][0], 1);
747 int nq = output[0].size();
798 map_points[i] =
m_xmap->GetBasis(i)->GetPointsKey();
799 nqtot_map *= map_points[i].GetNumPoints();
805 Interp(map_points, tmp, keyTgt, x[k]);
809 NekDouble radius, xc = 0.0, yc = 0.0, xdis, ydis;
812 ASSERTL1(factors.size() >= 4,
"factors is too short.");
819 for (
int i = 0; i < nq; i++)
823 radius =
sqrt(xdis * xdis / la / la + ydis * ydis / lb / lb);
824 output[0][i] = ydis / radius;
825 output[1][i] = -1.0 * xdis / radius;
842 map_points[i] =
m_xmap->GetBasis(i)->GetPointsKey();
843 nqtot_map *= map_points[i].GetNumPoints();
849 Interp(map_points, tmp, keyTgt, x[k]);
854 for (
int i = 0; i < nq; i++)
856 xtan = -1.0 * (x[1][i] * x[1][i] * x[1][i] + x[1][i]);
857 ytan = 2.0 * x[0][i];
858 mag =
sqrt(xtan * xtan + ytan * ytan);
859 output[0][i] = xtan / mag;
860 output[1][i] = ytan / mag;
877 map_points[i] =
m_xmap->GetBasis(i)->GetPointsKey();
878 nqtot_map *= map_points[i].GetNumPoints();
884 Interp(map_points, tmp, keyTgt, x[k]);
889 for (
int i = 0; i < nq; i++)
891 xtan = -2.0 * x[1][i] * x[1][i] * x[1][i] + x[1][i];
892 ytan =
sqrt(3.0) * x[0][i];
893 mag =
sqrt(xtan * xtan + ytan * ytan);
894 output[0][i] = xtan / mag;
895 output[1][i] = ytan / mag;
911 int ndim = array.size();
912 ASSERTL0(ndim > 0,
"Number of components must be > 0.");
913 for (
int i = 1; i < ndim; ++i)
915 ASSERTL0(array[i].size() == array[0].size(),
916 "Array size mismatch in coordinates.");
919 int nq = array[0].size();
923 for (
int i = 0; i < ndim; ++i)
925 Vmath::Vvtvp(nq, array[i], 1, array[i], 1, norm, 1, norm, 1);
931 for (
int i = 0; i < ndim; ++i)
933 Vmath::Vdiv(nq, array[i], 1, norm, 1, array[i], 1);
951 ASSERTL0(v1.size() == 3,
"Input 1 has dimension not equal to 3.");
952 ASSERTL0(v2.size() == 3,
"Input 2 has dimension not equal to 3.");
953 ASSERTL0(v3.size() == 3,
"Output vector has dimension not equal to 3.");
955 int nq = v1[0].size();
959 Vmath::Vvtvm(nq, v1[1], 1, v2[2], 1, temp, 1, v3[0], 1);
962 Vmath::Vvtvm(nq, v1[2], 1, v2[0], 1, temp, 1, v3[1], 1);
965 Vmath::Vvtvm(nq, v1[0], 1, v2[1], 1, temp, 1, v3[2], 1);
#define ASSERTL0(condition, msg)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Generic object pool allocator/deallocator.
Calculation and storage of geometric factors associated with the mapping from StdRegions reference el...
DerivStorage ComputeDeriv(const LibUtilities::PointsKeyVector &keyTgt) const
Array< TwoD, NekDouble > ComputeDerivFactors(const LibUtilities::PointsKeyVector &keyTgt) const
Return the derivative of the reference coordinates with respect to the mapping, .
void Adjoint(const Array< TwoD, const NekDouble > &src, Array< TwoD, NekDouble > &tgt) const
Compute the transpose of the cofactors matrix.
int m_coordDim
Dimension of coordinate system.
void CheckIfValid()
Tests if the element is valid and not self-intersecting.
void Interp(const LibUtilities::PointsKeyVector &src_points, const Array< OneD, const NekDouble > &src, const LibUtilities::PointsKeyVector &tgt_points, Array< OneD, NekDouble > &tgt) const
Perform interpolation of data between two point distributions.
Array< OneD, NekDouble > ComputeJac(const LibUtilities::PointsKeyVector &keyTgt) const
Return the Jacobian of the mapping and cache the result.
int m_expDim
Dimension of expansion.
Array< TwoD, NekDouble > ComputeGmat(const LibUtilities::PointsKeyVector &keyTgt) const
Computes the Laplacian coefficients .
void ComputePrincipleDirection(const LibUtilities::PointsKeyVector &keyTgt, const SpatialDomains::GeomMMF MMFdir, const Array< OneD, const NekDouble > &CircCentre, Array< OneD, Array< OneD, NekDouble > > &output)
bool m_valid
Validity of element (Jacobian positive)
StdRegions::StdExpansionSharedPtr m_xmap
Stores information about the expansion.
GeomFactors(const GeomType gtype, const int coordim, const StdRegions::StdExpansionSharedPtr &xmap, const Array< OneD, Array< OneD, NekDouble > > &coords)
Constructor for GeomFactors class.
DerivStorage GetDeriv(const LibUtilities::PointsKeyVector &keyTgt)
Return the derivative of the mapping with respect to the reference coordinates, .
GeomType m_type
Type of geometry (e.g. eRegular, eDeformed, eMovingRegular).
Array< OneD, Array< OneD, NekDouble > > m_coords
Stores coordinates of the geometry.
void ComputeMovingFrames(const LibUtilities::PointsKeyVector &keyTgt, const SpatialDomains::GeomMMF MMFdir, const Array< OneD, const NekDouble > &CircCentre, Array< OneD, Array< OneD, NekDouble > > &movingframes)
void VectorNormalise(Array< OneD, Array< OneD, NekDouble > > &array)
void VectorCrossProd(const Array< OneD, const Array< OneD, NekDouble > > &v1, const Array< OneD, const Array< OneD, NekDouble > > &v2, Array< OneD, Array< OneD, NekDouble > > &v3)
Computes the vector cross-product in 3D of v1 and v2, storing the result in v3.
void Interp1D(const BasisKey &fbasis0, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, Array< OneD, NekDouble > &to)
this function interpolates a 1D function evaluated at the quadrature points of the basis fbasis0 to ...
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
GeomMMF
Principle direction for MMF.
@ eLOCAL
No Principal direction.
@ eTangentIrregular
Circular around the centre of domain.
@ eTangentX
X coordinate direction.
@ eTangentCircular
Circular around the centre of domain.
@ eTangentNonconvex
Circular around the centre of domain.
@ eTangentXY
XY direction.
@ eTangentZ
Z coordinate direction.
@ eTangentY
Y coordinate direction.
bool operator==(const GeomFactors &lhs, const GeomFactors &rhs)
Equivalence test for GeomFactors objects.
GeomType
Indicates the type of element geometry.
@ eRegular
Geometry is straight-sided with constant geometric factors.
@ eMovingRegular
Currently unused.
@ eDeformed
Geometry is curved or has non-constant factors.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > DerivStorage
Storage type for derivative of mapping.
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
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 Neg(int n, T *x, const int incx)
Negate x = -x.
T Vmin(int n, const T *x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min.
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 Vvtvm(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)
vvtvm (vector times vector minus vector): z = w*x - y
void Vvtvvtm(int n, const T *v, int incv, const T *w, int incw, const T *x, int incx, const T *y, int incy, T *z, int incz)
vvtvvtm (vector times vector minus vector times vector):
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
void Vdiv(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 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)