46 namespace SpatialDomains
49 const unsigned int PrismGeom::VertexEdgeConnectivity[6][3] = {
50 {0, 3, 4}, {0, 1, 5}, {1, 2, 6}, {2, 3, 7}, {4, 5, 8}, {6, 7, 8}};
51 const unsigned int PrismGeom::VertexFaceConnectivity[6][3] = {
52 {0, 1, 4}, {0, 1, 2}, {0, 2, 3}, {0, 3, 4}, {1, 2, 4}, {2, 3, 4}};
53 const unsigned int PrismGeom::EdgeFaceConnectivity[9][2] = {
54 {0, 1}, {0, 2}, {0, 3}, {0, 4}, {1, 4}, {1, 2}, {2, 3}, {3, 4}, {2, 4}};
56 PrismGeom::PrismGeom()
62 :
Geometry3D(faces[0]->GetEdge(0)->GetVertex(0)->GetCoordim())
91 else if (faceidx == 1 || faceidx == 3)
119 if (locCoord[0] >= -(1 + tol) && locCoord[1] >= -(1 + tol) &&
120 locCoord[2] >= -(1 + tol) && locCoord[1] <= (1 + tol) &&
121 locCoord[0] + locCoord[2] <= tol)
149 if (
m_xmap->GetBasisNumModes(0) != 2 ||
150 m_xmap->GetBasisNumModes(1) != 2 ||
151 m_xmap->GetBasisNumModes(2) != 2)
161 const unsigned int faceVerts[3][4] = {
162 {0, 1, 2, 3}, {1, 2, 5, 4}, {0, 3, 5, 4}};
164 for (f = 0; f < 3; f++)
169 if (fabs((*
m_verts[faceVerts[f][0]])(i) -
170 (*
m_verts[faceVerts[f][1]])(i) +
171 (*
m_verts[faceVerts[f][2]])(i) -
172 (*
m_verts[faceVerts[f][3]])(i)) >
213 cp1030.
Mult(e10, e30);
214 cp3040.
Mult(e30, e40);
215 cp4010.
Mult(e40, e10);
220 er0.
dot(cp3040) / (2.0 * V);
222 er0.
dot(cp4010) / (3.0 * V);
224 er0.
dot(cp1030) / (2.0 * V);
227 Lcoords[0] = 2.0 * beta - 1.0;
228 Lcoords[1] = 2.0 * gamma - 1.0;
229 Lcoords[2] = 2.0 * delta - 1.0;
232 for (
int i = 0; i < 6; ++i)
242 int npts =
m_xmap->GetTotPoints();
265 ptdist = sqrt(tmp1[min_i]);
268 int qa = za.num_elements(), qb = zb.num_elements();
269 Lcoords[2] = zc[min_i / (qa * qb)];
270 min_i = min_i % (qa * qb);
271 Lcoords[1] = zb[min_i / qa];
272 Lcoords[0] = za[min_i % qa];
275 Lcoords[0] = (1.0 + Lcoords[0]) * (1.0 - Lcoords[2]) / 2 - 1.0;
309 for (f = 1; f < 5; f++)
311 int nEdges =
m_faces[f]->GetNumEdges();
313 for (i = 0; i < 4; i++)
315 for (j = 0; j < nEdges; j++)
319 edge = dynamic_pointer_cast<
SegGeom>(
329 std::ostringstream errstrm;
330 errstrm <<
"Connected faces do not share an edge. Faces ";
337 std::ostringstream errstrm;
338 errstrm <<
"Connected faces share more than one edge. Faces ";
347 for (i = 0; i < 3; i++)
349 for (j = 0; j < 4; j++)
353 edge = dynamic_pointer_cast<
SegGeom>(
362 std::ostringstream errstrm;
363 errstrm <<
"Connected faces do not share an edge. Faces ";
370 std::ostringstream errstrm;
371 errstrm <<
"Connected faces share more than one edge. Faces ";
377 for (f = 1; f < 4; f++)
380 for (i = 0; i <
m_faces[f]->GetNumEdges(); i++)
382 for (j = 0; j <
m_faces[f + 1]->GetNumEdges(); j++)
386 edge = dynamic_pointer_cast<
SegGeom>(
396 std::ostringstream errstrm;
397 errstrm <<
"Connected faces do not share an edge. Faces ";
404 std::ostringstream errstrm;
405 errstrm <<
"Connected faces share more than one edge. Faces ";
414 for (i = 0; i < 4; i++)
416 for (j = 0; j < 4; j++)
420 edge = dynamic_pointer_cast<
SegGeom>(
430 std::ostringstream errstrm;
431 errstrm <<
"Connected faces do not share an edge. Faces ";
438 std::ostringstream errstrm;
439 errstrm <<
"Connected faces share more than one edge. Faces ";
464 std::ostringstream errstrm;
465 errstrm <<
"Connected edges do not share a vertex. Edges ";
466 errstrm <<
m_edges[0]->GetGlobalID() <<
", " 472 for (
int i = 1; i < 3; i++)
484 std::ostringstream errstrm;
485 errstrm <<
"Connected edges do not share a vertex. Edges ";
486 errstrm <<
m_edges[i]->GetGlobalID() <<
", " 487 <<
m_edges[i - 1]->GetGlobalID();
508 std::ostringstream errstrm;
509 errstrm <<
"Connected edges do not share a vertex. Edges ";
510 errstrm <<
m_edges[8]->GetGlobalID();
521 const unsigned int edgeVerts[
kNedges][2] = {
522 {0, 1}, {1, 2}, {3, 2}, {0, 3}, {0, 4}, {1, 4}, {2, 5}, {3, 5}, {4, 5}};
537 ASSERTL0(
false,
"Could not find matching vertex for the edge");
565 unsigned int baseVertex;
588 unsigned int orientation;
594 elementAaxis_length = 0.0;
595 elementBaxis_length = 0.0;
596 faceAaxis_length = 0.0;
597 faceBaxis_length = 0.0;
602 baseVertex =
m_faces[f]->GetVid(0);
616 if (f == 1 || f == 3)
622 elementAaxis[i] = (*
m_verts[faceVerts[f][1]])[i] -
623 (*
m_verts[faceVerts[f][0]])[i];
624 elementBaxis[i] = (*
m_verts[faceVerts[f][2]])[i] -
625 (*
m_verts[faceVerts[f][0]])[i];
632 elementAaxis[i] = (*
m_verts[faceVerts[f][1]])[i] -
633 (*
m_verts[faceVerts[f][0]])[i];
634 elementBaxis[i] = (*
m_verts[faceVerts[f][2]])[i] -
635 (*
m_verts[faceVerts[f][1]])[i];
642 elementAaxis[i] = (*
m_verts[faceVerts[f][1]])[i] -
643 (*
m_verts[faceVerts[f][2]])[i];
644 elementBaxis[i] = (*
m_verts[faceVerts[f][2]])[i] -
645 (*
m_verts[faceVerts[f][0]])[i];
650 ASSERTL0(
false,
"Could not find matching vertex for the face");
659 elementAaxis[i] = (*
m_verts[faceVerts[f][1]])[i] -
660 (*
m_verts[faceVerts[f][0]])[i];
661 elementBaxis[i] = (*
m_verts[faceVerts[f][3]])[i] -
662 (*
m_verts[faceVerts[f][0]])[i];
669 elementAaxis[i] = (*
m_verts[faceVerts[f][1]])[i] -
670 (*
m_verts[faceVerts[f][0]])[i];
671 elementBaxis[i] = (*
m_verts[faceVerts[f][2]])[i] -
672 (*
m_verts[faceVerts[f][1]])[i];
679 elementAaxis[i] = (*
m_verts[faceVerts[f][2]])[i] -
680 (*
m_verts[faceVerts[f][3]])[i];
681 elementBaxis[i] = (*
m_verts[faceVerts[f][2]])[i] -
682 (*
m_verts[faceVerts[f][1]])[i];
689 elementAaxis[i] = (*
m_verts[faceVerts[f][2]])[i] -
690 (*
m_verts[faceVerts[f][3]])[i];
691 elementBaxis[i] = (*
m_verts[faceVerts[f][3]])[i] -
692 (*
m_verts[faceVerts[f][0]])[i];
697 ASSERTL0(
false,
"Could not find matching vertex for the face");
704 int v =
m_faces[f]->GetNumVerts() - 1;
710 elementAaxis_length += pow(elementAaxis[i], 2);
711 elementBaxis_length += pow(elementBaxis[i], 2);
712 faceAaxis_length += pow(faceAaxis[i], 2);
713 faceBaxis_length += pow(faceBaxis[i], 2);
716 elementAaxis_length = sqrt(elementAaxis_length);
717 elementBaxis_length = sqrt(elementBaxis_length);
718 faceAaxis_length = sqrt(faceAaxis_length);
719 faceBaxis_length = sqrt(faceBaxis_length);
725 dotproduct1 += elementAaxis[i] * faceAaxis[i];
733 if (fabs(elementAaxis_length * faceAaxis_length - fabs(dotproduct1)) <
738 if (dotproduct1 < 0.0)
746 dotproduct2 += elementBaxis[i] * faceBaxis[i];
750 fabs(fabs(dotproduct2 / elementBaxis_length / faceBaxis_length)
752 "These vectors should be parallel");
756 if (dotproduct2 < 0.0)
771 dotproduct1 += elementAaxis[i] * faceBaxis[i];
776 fabs(fabs(dotproduct1) / elementAaxis_length / faceBaxis_length
778 "These vectors should be parallel");
782 if (dotproduct1 < 0.0)
791 dotproduct2 += elementBaxis[i] * faceAaxis[i];
795 fabs(fabs(dotproduct2) / elementBaxis_length / faceAaxis_length
797 "These vectors should be parallel");
799 if (dotproduct2 < 0.0)
805 orientation = orientation + 5;
815 for (
int i = 0; i < 5; ++i)
817 m_faces[i]->Reset(curvedEdges, curvedFaces);
825 for (
int i = 0; i < 5; ++i)
848 order0 = *max_element(tmp.begin(), tmp.end());
854 order0 = *max_element(tmp.begin(), tmp.end());
863 order1 = *max_element(tmp.begin(), tmp.end());
871 order1 = *max_element(tmp.begin(), tmp.end());
875 tmp.push_back(order0);
876 tmp.push_back(order1);
881 int order2 = *max_element(tmp.begin(), tmp.end());
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
#define ASSERTL0(condition, msg)
std::vector< StdRegions::Orientation > m_eorient
int GetEid(int i) const
Get the ID of edge i of this object.
std::shared_ptr< Geometry2D > Geometry2DSharedPtr
GeomFactorsSharedPtr m_geomFactors
Geometric factors.
StdRegions::StdExpansionSharedPtr GetXmap() const
Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standar...
void SetUpFaceOrientation()
std::unordered_map< int, CurveSharedPtr > CurveMap
bool MinMaxCheck(const Array< OneD, const NekDouble > &gloCoord)
Check if given global coord is within twice the min/max distance of the element.
NekDouble dot(PointGeom &a)
retun the dot product between this and input a
virtual bool v_ContainsPoint(const Array< OneD, const NekDouble > &gloCoord, Array< OneD, NekDouble > &locCoord, NekDouble tol, NekDouble &resid)
void SetUpLocalVertices()
int Imin(int n, const T *x, const int incx)
Return the index of the minimum element in x.
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
Principle Modified Functions .
void Sub(PointGeom &a, PointGeom &b)
virtual void v_Reset(CurveMap &curvedEdges, CurveMap &curvedFaces)
Reset this geometry object: unset the current state, zero Geometry::m_coeffs and remove allocated Geo...
void SetUpXmap()
Set up the m_xmap object by determining the order of each direction from derived faces.
void ClampLocCoords(Array< OneD, NekDouble > &locCoord, NekDouble tol)
Clamp local coords to be within standard regions [-1, 1]^dim.
virtual NekDouble v_GetLocCoords(const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords)
Determine the local collapsed coordinates that correspond to a given Cartesian coordinate for this ge...
GeomState m_geomFactorsState
State of the geometric factors.
static const unsigned int VertexFaceConnectivity[6][3]
int GetGlobalID(void) const
Get the ID of this object.
std::vector< StdRegions::Orientation > m_forient
Gauss Radau pinned at x=-1, .
virtual int v_GetDir(const int faceidx, const int facedir) const
void NewtonIterationForLocCoord(const Array< OneD, const NekDouble > &coords, const Array< OneD, const NekDouble > &ptsx, const Array< OneD, const NekDouble > &ptsy, const Array< OneD, const NekDouble > &ptsz, Array< OneD, NekDouble > &Lcoords, NekDouble &resid)
static const NekDouble kNekZeroTol
static const int kNqfaces
Principle Modified Functions .
virtual void v_Reset(CurveMap &curvedEdges, CurveMap &curvedFaces)
Reset this geometry object: unset the current state, zero Geometry::m_coeffs and remove allocated Geo...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
void SetUpEdgeOrientation()
Defines a specification for a set of points.
static const unsigned int EdgeFaceConnectivity[9][2]
virtual void v_GenGeomFactors()
bool m_setupState
Wether or not the setup routines have been run.
virtual int v_GetVertexFaceMap(const int i, const int j) const
Returns the standard element face IDs that are connected to a given vertex.
int GetVid(int i) const
Get the ID of vertex i of this object.
void Sadd(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add vector y = alpha + x.
virtual int v_GetVertexEdgeMap(const int i, const int j) const
Returns the standard element edge IDs that are connected to a given vertex.
virtual void v_FillGeom()
Put all quadrature information into face/edge structure and backward transform.
void Mult(PointGeom &a, PointGeom &b)
_this = a x b
Array< OneD, Array< OneD, NekDouble > > m_coeffs
Array containing expansion coefficients of m_xmap.
Geometry is straight-sided with constant geometric factors.
NekDouble GetLocCoords(const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords)
Determine the local collapsed coordinates that correspond to a given Cartesian coordinate for this ge...
Geometry1DSharedPtr GetEdge(int i) const
Returns edge i of this object.
static const unsigned int VertexEdgeConnectivity[6][3]
LibUtilities::ShapeType m_shapeType
Type of shape.
NekDouble dist(PointGeom &a)
return distance between this and input a
Geometric information has been generated.
void SetUpCoeffs(const int nCoeffs)
Initialise the Geometry::m_coeffs array.
GeomFactorsSharedPtr GetMetricInfo()
Get the geometric factors for this object.
GeomType
Indicates the type of element geometry.
virtual int v_GetEdgeFaceMap(const int i, const int j) const
Returns the standard element edge IDs that are connected to a given face.
static const int kNtfaces
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
std::shared_ptr< SegGeom > SegGeomSharedPtr
Geometry is curved or has non-constant factors.
PointGeomSharedPtr GetVertex(int i) const
Returns vertex i of this object.
int m_coordim
Coordinate dimension of this geometry object.
Describes the specification for a Basis.
1D Gauss-Lobatto-Legendre quadrature points
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.