46 namespace SpatialDomains
49 {0,3,4},{0,1,5},{1,2,6},{2,3,7},{4,5,8},{6,7,8}};
51 {0,1,4},{0,1,2},{0,2,3},{0,3,4},{1,2,4},{2,3,4}};
53 {0,1},{0,2},{0,3},{0,4},{1,4},{1,2},{2,3},{3,4},{2,4}};
81 int order0, points0, order1, points1;
85 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs(0));
86 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs(2));
87 order0 = *max_element(tmp.begin(), tmp.end());
90 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(0));
91 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(2));
92 points0 = *max_element(tmp.begin(), tmp.end());
96 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs(1));
97 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs(3));
98 order0 = *max_element(tmp.begin(), tmp.end());
101 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(1));
102 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(3));
103 points0 = *max_element(tmp.begin(), tmp.end());
109 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs(1));
110 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs(3));
111 tmp.push_back(faces[2]->
GetXmap()->GetEdgeNcoeffs(2));
112 order1 = *max_element(tmp.begin(), tmp.end());
115 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(1));
116 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(3));
117 tmp.push_back(faces[2]->
GetXmap()->GetEdgeNumPoints(2));
118 points1 = *max_element(tmp.begin(), tmp.end());
123 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs(0));
124 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs(2));
125 tmp.push_back(faces[2]->
GetXmap()->GetEdgeNcoeffs(2));
126 order1 = *max_element(tmp.begin(), tmp.end());
129 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(0));
130 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(2));
131 tmp.push_back(faces[2]->
GetXmap()->GetEdgeNumPoints(2));
132 points1 = *max_element(tmp.begin(), tmp.end());
136 tmp.push_back(order0);
137 tmp.push_back(order1);
138 tmp.push_back(faces[1]->
GetXmap()->GetEdgeNcoeffs(1));
139 tmp.push_back(faces[1]->
GetXmap()->GetEdgeNcoeffs(2));
140 tmp.push_back(faces[3]->
GetXmap()->GetEdgeNcoeffs(1));
141 tmp.push_back(faces[3]->
GetXmap()->GetEdgeNcoeffs(2));
142 int order2 = *max_element(tmp.begin(), tmp.end());
145 tmp.push_back(points0);
146 tmp.push_back(points1);
147 tmp.push_back(faces[1]->
GetXmap()->GetEdgeNumPoints(1));
148 tmp.push_back(faces[1]->
GetXmap()->GetEdgeNumPoints(2));
149 tmp.push_back(faces[3]->
GetXmap()->GetEdgeNumPoints(1));
150 tmp.push_back(faces[3]->
GetXmap()->GetEdgeNumPoints(2));
155 int points2 = *max_element(tmp.begin(), tmp.end());
196 else if (faceidx == 1 || faceidx == 3)
211 const Array<OneD, const NekDouble> &gloCoord,
NekDouble tol)
213 Array<OneD,NekDouble> locCoord(
GetCoordim(),0.0);
218 const Array<OneD, const NekDouble> &gloCoord,
219 Array<OneD, NekDouble> &locCoord,
231 const Array<OneD, const NekDouble> &gloCoord,
232 Array<OneD, NekDouble> &locCoord,
237 ASSERTL1(gloCoord.num_elements() == 3,
238 "Three dimensional geometry expects three coordinates.");
246 Array<OneD, NekDouble> mincoord(3), maxcoord(3);
252 Array<OneD, NekDouble> pts(npts);
254 for(i = 0; i < 3; ++i)
258 mincoord[i] =
Vmath::Vmin(pts.num_elements(),pts,1);
259 maxcoord[i] =
Vmath::Vmax(pts.num_elements(),pts,1);
261 diff = max(maxcoord[i] - mincoord[i],diff);
264 for(i = 0; i < 3; ++i)
266 if((gloCoord[i] < mincoord[i] - 0.2*diff)||
267 (gloCoord[i] > maxcoord[i] + 0.2*diff))
278 if (locCoord[0] >= -(1+tol) && locCoord[1] >= -(1+tol) &&
279 locCoord[2] >= -(1+tol) && locCoord[1] <= (1+tol) &&
280 locCoord[0] + locCoord[2] <= tol)
300 if (
m_xmap->GetBasisNumModes(0) != 2 ||
301 m_xmap->GetBasisNumModes(1) != 2 ||
302 m_xmap->GetBasisNumModes(2) != 2 )
312 const unsigned int faceVerts[3][4] =
317 for(f = 0; f < 3; f++)
322 if( fabs( (*
m_verts[ faceVerts[f][0] ])(i) -
323 (*
m_verts[ faceVerts[f][1] ])(i) +
324 (*
m_verts[ faceVerts[f][2] ])(i) -
325 (*
m_verts[ faceVerts[f][3] ])(i) )
348 const Array<OneD, const NekDouble> &coords,
349 Array<OneD, NekDouble> &Lcoords)
369 cp1030.
Mult(e10,e30);
370 cp3040.
Mult(e30,e40);
371 cp4010.
Mult(e40,e10);
381 Lcoords[0] = 2.0*beta - 1.0;
382 Lcoords[1] = 2.0*gamma - 1.0;
383 Lcoords[2] = 2.0*delta - 1.0;
391 Array<OneD, NekDouble> ptsx(npts), ptsy(npts), ptsz(npts);
392 Array<OneD, NekDouble> tmp1(npts), tmp2(npts);
398 const Array<OneD, const NekDouble> za =
m_xmap->GetPoints(0);
399 const Array<OneD, const NekDouble> zb =
m_xmap->GetPoints(1);
400 const Array<OneD, const NekDouble> zc =
m_xmap->GetPoints(2);
413 int qa = za.num_elements(), qb = zb.num_elements();
414 Lcoords[2] = zc[min_i/(qa*qb)];
415 min_i = min_i%(qa*qb);
416 Lcoords[1] = zb[min_i/qa];
417 Lcoords[0] = za[min_i%qa];
420 Lcoords[0] = (1.0+Lcoords[0])*(1.0-Lcoords[2])/2 - 1.0;
453 for (f = 1; f < 5 ; f++)
455 int nEdges =
m_faces[f]->GetNumEdges();
457 for (i = 0; i < 4; i++)
459 for (j = 0; j < nEdges; j++)
472 std::ostringstream errstrm;
473 errstrm <<
"Connected faces do not share an edge. Faces ";
479 std::ostringstream errstrm;
480 errstrm <<
"Connected faces share more than one edge. Faces ";
488 for(i = 0; i < 3; i++)
490 for(j = 0; j < 4; j++)
502 std::ostringstream errstrm;
503 errstrm <<
"Connected faces do not share an edge. Faces ";
509 std::ostringstream errstrm;
510 errstrm <<
"Connected faces share more than one edge. Faces ";
515 for(f = 1; f < 4 ; f++)
518 for(i = 0; i <
m_faces[f]->GetNumEdges(); i++)
520 for(j = 0; j <
m_faces[f+1]->GetNumEdges(); j++)
533 std::ostringstream errstrm;
534 errstrm <<
"Connected faces do not share an edge. Faces ";
540 std::ostringstream errstrm;
541 errstrm <<
"Connected faces share more than one edge. Faces ";
549 for(i = 0; i < 4; i++)
551 for(j = 0; j < 4; j++)
564 std::ostringstream errstrm;
565 errstrm <<
"Connected faces do not share an edge. Faces ";
571 std::ostringstream errstrm;
572 errstrm <<
"Connected faces share more than one edge. Faces ";
596 std::ostringstream errstrm;
597 errstrm <<
"Connected edges do not share a vertex. Edges ";
603 for(
int i = 1; i < 3; i++)
615 std::ostringstream errstrm;
616 errstrm <<
"Connected edges do not share a vertex. Edges ";
617 errstrm <<
m_edges[i]->GetEid() <<
", " <<
m_edges[i-1]->GetEid();
638 std::ostringstream errstrm;
639 errstrm <<
"Connected edges do not share a vertex. Edges ";
640 errstrm <<
m_edges[8]->GetEid();
650 const unsigned int edgeVerts[
kNedges][2] =
675 ASSERTL0(
false,
"Could not find matching vertex for the edge");
691 Array<OneD,NekDouble> elementAaxis(
m_coordim);
692 Array<OneD,NekDouble> elementBaxis(
m_coordim);
698 Array<OneD,NekDouble> faceAaxis(
m_coordim);
699 Array<OneD,NekDouble> faceBaxis(
m_coordim);
704 unsigned int baseVertex;
726 unsigned int orientation;
732 elementAaxis_length = 0.0;
733 elementBaxis_length = 0.0;
734 faceAaxis_length = 0.0;
735 faceBaxis_length = 0.0;
740 baseVertex =
m_faces[f]->GetVid(0);
753 elementAaxis[i] = (*
m_verts[ faceVerts[f][1] ])[i] - (*
m_verts[ faceVerts[f][0] ])[i];
754 elementBaxis[i] = (*
m_verts[ faceVerts[f][2] ])[i] - (*
m_verts[ faceVerts[f][0] ])[i];
762 elementAaxis[i] = (*
m_verts[ faceVerts[f][1] ])[i] - (*
m_verts[ faceVerts[f][0] ])[i];
763 elementBaxis[i] = (*
m_verts[ faceVerts[f][3] ])[i] - (*
m_verts[ faceVerts[f][0] ])[i];
766 else if( baseVertex ==
m_verts[ faceVerts[f][1] ]->
GetVid() )
770 elementAaxis[i] = (*
m_verts[ faceVerts[f][1] ])[i] - (*
m_verts[ faceVerts[f][0] ])[i];
771 elementBaxis[i] = (*
m_verts[ faceVerts[f][2] ])[i] - (*
m_verts[ faceVerts[f][1] ])[i];
774 else if( baseVertex ==
m_verts[ faceVerts[f][2] ]->
GetVid() )
778 elementAaxis[i] = (*
m_verts[ faceVerts[f][2] ])[i] - (*
m_verts[ faceVerts[f][3] ])[i];
779 elementBaxis[i] = (*
m_verts[ faceVerts[f][2] ])[i] - (*
m_verts[ faceVerts[f][1] ])[i];
782 else if( baseVertex ==
m_verts[ faceVerts[f][3] ]->
GetVid() )
786 elementAaxis[i] = (*
m_verts[ faceVerts[f][2] ])[i] - (*
m_verts[ faceVerts[f][3] ])[i];
787 elementBaxis[i] = (*
m_verts[ faceVerts[f][3] ])[i] - (*
m_verts[ faceVerts[f][0] ])[i];
792 ASSERTL0(
false,
"Could not find matching vertex for the face");
799 int v =
m_faces[f]->GetNumVerts()-1;
803 elementAaxis_length += pow(elementAaxis[i],2);
804 elementBaxis_length += pow(elementBaxis[i],2);
805 faceAaxis_length += pow(faceAaxis[i],2);
806 faceBaxis_length += pow(faceBaxis[i],2);
809 elementAaxis_length = sqrt(elementAaxis_length);
810 elementBaxis_length = sqrt(elementBaxis_length);
811 faceAaxis_length = sqrt(faceAaxis_length);
812 faceBaxis_length = sqrt(faceBaxis_length);
818 dotproduct1 += elementAaxis[i]*faceAaxis[i];
828 if(dotproduct1 < 0.0)
836 dotproduct2 += elementBaxis[i]*faceBaxis[i];
846 if( dotproduct2 < 0.0 )
861 dotproduct1 += elementAaxis[i]*faceBaxis[i];
865 if (fabs(elementAaxis_length*faceBaxis_length
868 cout <<
"Warning: Prism axes not parallel" << endl;
873 if(dotproduct1 < 0.0)
882 dotproduct2 += elementBaxis[i]*faceAaxis[i];
886 if (fabs(elementBaxis_length*faceAaxis_length
889 cout <<
"Warning: Prism axes not parallel" << endl;
892 if( dotproduct2 < 0.0 )
898 orientation = orientation + 5;