40 namespace SpatialDomains
94 m_expDim(xmap->GetShapeDimension()),
152 if(!(jac_lhs == jac_rhs))
173 "Dimension of target point distribution does not match " 174 "expansion dimension.");
178 int nqtot_tbasis = 1;
186 map_points[i] =
m_xmap->GetBasis(i)->GetPointsKey();
187 nqtot_map *= map_points[i].GetNumPoints();
188 nqtot_tbasis *= keyTgt[i].GetNumPoints();
206 m_xmap->StdPhysDeriv(j, tmp, d_map[j][i]);
219 same = same && (map_points[j] == keyTgt[j]);
225 deriv[j][i] = d_map[j][i];
232 Interp(map_points, d_map[j][i], keyTgt, deriv[j][i]);
256 "Dimension of target point distribution does not match " 257 "expansion dimension.");
259 int i = 0, j = 0, k = 0, l = 0;
267 ptsTgt *= keyTgt[i].GetNumPoints();
279 for (i = 0, l = 0; i <
m_expDim; ++i)
299 Vmath::Vvtvp(ptsTgt, &tmp[i][0], 1, &gmat[i*m_expDim][0], 1,
300 &jac[0], 1, &jac[0], 1);
336 "Dimension of target point distribution does not match " 337 "expansion dimension.");
339 int i = 0, j = 0, k = 0, l = 0;
347 ptsTgt *= keyTgt[i].GetNumPoints();
359 for (i = 0, l = 0; i <
m_expDim; ++i)
379 Vmath::Vvtvp(ptsTgt, &tmp[i][0], 1, &gmat[i*m_expDim][0], 1,
380 &jac[0], 1, &jac[0], 1);
383 for (i = 0; i < m_expDim*
m_expDim; ++i)
385 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)
445 Vmath::Vvtvp(ptsTgt, &tmp[i][0], 1, &gmat[i*m_expDim][0], 1,
446 &jac[0], 1, &jac[0], 1);
449 for (i = 0; i < m_expDim*
m_expDim; ++i)
451 Vmath::Vdiv(ptsTgt, &gmat[i][0], 1, &jac[0], 1, &gmat[i][0], 1);
465 &gmat[m_expDim*i+j][0], 1,
482 "Dimension of target point distribution does not match " 483 "expansion dimension.");
491 nq *= keyTgt[i].GetNumPoints();
499 ptsTgt *= keyTgt[i].GetNumPoints();
512 for (i = 0; i < MFdim; ++i)
522 for (i = 0; i < MFdim-1; ++i)
551 factors, PrincipleDir);
560 if ( !(MMFdir ==
eLOCAL) )
593 for (i = 0; i < MFdim; ++i)
598 &movingframes[i*m_coordDim+k][0], 1);
622 p[i] =
m_xmap->GetBasis(i)->GetPointsKey();
623 nqtot *= p[i].GetNumPoints();
636 &deriv[1][0][0], 1, &deriv[0][1][0], 1,
645 &deriv[2][1][0], 1, &deriv[1][2][0], 1,
648 &jac[0], 1, &jac[0], 1);
651 &deriv[0][1][0], 1, &deriv[2][2][0], 1,
654 &jac[0], 1, &jac[0], 1);
657 &deriv[1][1][0], 1, &deriv[0][2][0], 1,
660 &jac[0], 1, &jac[0], 1);
685 ASSERTL1(src_points.size() == tgt_points.size(),
686 "Dimension of target point distribution does not match " 687 "expansion dimension.");
697 tgt_points[0], tgt_points[1], tgt);
702 tgt_points[0], tgt_points[1],
720 ASSERTL1(src.num_elements() == tgt.num_elements(),
721 "Source matrix is of different size to destination" 722 "matrix for computing adjoint.");
724 int n = src[0].num_elements();
732 Vmath::Smul (n, -1.0, &src[1][0], 1, &tgt[1][0], 1);
733 Vmath::Smul (n, -1.0, &src[2][0], 1, &tgt[2][0], 1);
738 int a, b, c, d, e, i, j;
745 a = ((i+1)%m_expDim) * m_expDim + ((j+1)%m_expDim);
746 b = ((i+1)%m_expDim) * m_expDim + ((j+2)%m_expDim);
747 c = ((i+2)%m_expDim) * m_expDim + ((j+1)%m_expDim);
748 d = ((i+2)%m_expDim) * m_expDim + ((j+2)%m_expDim);
751 &src[b][0], 1, &src[c][0], 1,
770 int nq = output[0].num_elements();
821 map_points[i] =
m_xmap->GetBasis(i)->GetPointsKey();
822 nqtot_map *= map_points[i].GetNumPoints();
828 Interp(map_points, tmp, keyTgt, x[k]);
832 NekDouble radius, xc=0.0, yc=0.0, xdis, ydis;
835 ASSERTL1(factors.num_elements() >= 4,
836 "factors is too short.");
843 for (
int i = 0; i < nq; i++)
847 radius = sqrt(xdis*xdis/la/la+ydis*ydis/lb/lb);
848 output[0][i] = ydis/radius;
849 output[1][i] = -1.0*xdis/radius;
866 map_points[i] =
m_xmap->GetBasis(i)->GetPointsKey();
867 nqtot_map *= map_points[i].GetNumPoints();
873 Interp(map_points, tmp, keyTgt, x[k]);
878 for (
int i = 0; i < nq; i++)
880 xtan = -1.0*(x[1][i]*x[1][i]*x[1][i] + x[1][i]);
882 mag = sqrt(xtan*xtan + ytan*ytan);
883 output[0][i] = xtan/mag;
884 output[1][i] = ytan/mag;
901 map_points[i] =
m_xmap->GetBasis(i)->GetPointsKey();
902 nqtot_map *= map_points[i].GetNumPoints();
908 Interp(map_points, tmp, keyTgt, x[k]);
913 for (
int i = 0; i < nq; i++)
915 xtan = -2.0*x[1][i]*x[1][i]*x[1][i] + x[1][i];
916 ytan = sqrt(3.0)*x[0][i];
917 mag = sqrt(xtan*xtan + ytan*ytan);
918 output[0][i] = xtan/mag;
919 output[1][i] = ytan/mag;
937 int ndim = array.num_elements();
938 ASSERTL0(ndim > 0,
"Number of components must be > 0.");
939 for (
int i = 1; i < ndim; ++i)
941 ASSERTL0(array[i].num_elements() == array[0].num_elements(),
942 "Array size mismatch in coordinates.");
945 int nq = array[0].num_elements();
949 for (
int i = 0; i < ndim; ++i)
960 for (
int i = 0; i < ndim; ++i)
962 Vmath::Vdiv(nq, array[i], 1, norm, 1, array[i], 1);
982 "Input 1 has dimension not equal to 3.");
984 "Input 2 has dimension not equal to 3.");
986 "Output vector has dimension not equal to 3.");
988 int nq = v1[0].num_elements();
992 Vmath::Vvtvm(nq, v1[1], 1, v2[2], 1, temp, 1, v3[0], 1);
995 Vmath::Vvtvm(nq, v1[2], 1, v2[0], 1, temp, 1, v3[1], 1);
998 Vmath::Vvtvm(nq, v1[0], 1, v2[1], 1, temp, 1, v3[2], 1);
#define ASSERTL0(condition, msg)
std::vector< PointsKey > PointsKeyVector
GeomType m_type
Type of geometry (e.g. eRegular, eDeformed, eMovingRegular).
void ComputePrincipleDirection(const LibUtilities::PointsKeyVector &keyTgt, const SpatialDomains::GeomMMF MMFdir, const Array< OneD, const NekDouble > &CircCentre, Array< OneD, Array< OneD, NekDouble > > &output)
Circular around the centre of domain.
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
friend bool operator==(const GeomFactors &lhs, const GeomFactors &rhs)
Tests if two GeomFactors classes are equal.
T Vmin(int n, const T *x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min.
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Array< TwoD, NekDouble > ComputeDerivFactors(const LibUtilities::PointsKeyVector &keyTgt) const
Return the derivative of the reference coordinates with respect to the mapping, . ...
DerivStorage GetDeriv(const LibUtilities::PointsKeyVector &keyTgt)
Return the derivative of the mapping with respect to the reference coordinates, . ...
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 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 CheckIfValid()
Tests if the element is valid and not self-intersecting.
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.
GeomMMF
Principle direction for MMF.
void VectorNormalise(Array< OneD, Array< OneD, NekDouble > > &array)
int m_coordDim
Dimension of coordinate system.
~GeomFactors()
Destructor.
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::shared_ptr< StdExpansion > StdExpansionSharedPtr
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Circular around the centre of domain.
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > DerivStorage
Storage type for derivative of mapping.
bool m_valid
Validity of element (Jacobian positive)
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.
void Neg(int n, T *x, const int incx)
Negate x = -x.
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):
Array< OneD, NekDouble > ComputeJac(const LibUtilities::PointsKeyVector &keyTgt) const
Return the Jacobian of the mapping and cache the result.
DerivStorage ComputeDeriv(const LibUtilities::PointsKeyVector &keyTgt) const
int m_expDim
Dimension of expansion.
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...
Calculation and storage of geometric factors associated with the mapping from StdRegions reference el...
GeomFactors(const GeomType gtype, const int coordim, const StdRegions::StdExpansionSharedPtr &xmap, const Array< OneD, Array< OneD, NekDouble > > &coords)
Constructor for GeomFactors class.
Geometry is straight-sided with constant geometric factors.
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 plus vector): z = w*x - y
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 ...
Array< TwoD, NekDouble > ComputeGmat(const LibUtilities::PointsKeyVector &keyTgt) const
Computes the Laplacian coefficients .
Array< OneD, Array< OneD, NekDouble > > m_coords
Stores coordinates of the geometry.
void Adjoint(const Array< TwoD, const NekDouble > &src, Array< TwoD, NekDouble > &tgt) const
Compute the transpose of the cofactors matrix.
Circular around the centre of domain.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs
StdRegions::StdExpansionSharedPtr m_xmap
Stores information about the expansion.
GeomType
Indicates the type of element geometry.
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Geometry is curved or has non-constant factors.
void ComputeMovingFrames(const LibUtilities::PointsKeyVector &keyTgt, const SpatialDomains::GeomMMF MMFdir, const Array< OneD, const NekDouble > &CircCentre, Array< OneD, Array< OneD, NekDouble > > &movingframes)
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.