44 namespace SpatialDomains
47 {0,2,3},{0,1,4},{1,2,5},{3,4,5}};
49 {0,1,3},{0,1,2},{0,2,3},{1,2,3}};
51 {0,1},{0,2},{0,3},{1,3},{1,2},{2,3}};
77 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs(0));
78 int order0 = *max_element(tmp.begin(), tmp.end());
81 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(0));
82 int points0 = *max_element(tmp.begin(), tmp.end());
85 tmp.push_back(order0);
86 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs(1));
87 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs(2));
88 int order1 = *max_element(tmp.begin(), tmp.end());
91 tmp.push_back(points0);
92 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(1));
93 tmp.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(2));
94 int points1 = *max_element(tmp.begin(), tmp.end());
97 tmp.push_back(order0);
98 tmp.push_back(order1);
99 tmp.push_back(faces[1]->
GetXmap()->GetEdgeNcoeffs(1));
100 tmp.push_back(faces[1]->
GetXmap()->GetEdgeNcoeffs(2));
101 tmp.push_back(faces[3]->
GetXmap()->GetEdgeNcoeffs(1));
102 int order2 = *max_element(tmp.begin(), tmp.end());
105 tmp.push_back(points0);
106 tmp.push_back(points1);
107 tmp.push_back(faces[1]->
GetXmap()->GetEdgeNumPoints(1));
108 tmp.push_back(faces[1]->
GetXmap()->GetEdgeNumPoints(2));
109 tmp.push_back(faces[3]->
GetXmap()->GetEdgeNumPoints(1));
110 int points2 = *max_element(tmp.begin(), tmp.end());
136 const Array<OneD, const NekDouble> &gloCoord,
NekDouble tol)
138 Array<OneD,NekDouble> locCoord(
GetCoordim(),0.0);
143 Array<OneD, NekDouble> &locCoord,
155 Array<OneD, NekDouble> &locCoord,
160 ASSERTL1(gloCoord.num_elements() == 3,
161 "Three dimensional geometry expects three coordinates.");
169 Array<OneD, NekDouble> mincoord(3), maxcoord(3);
175 Array<OneD, NekDouble> pts(npts);
177 for(i = 0; i < 3; ++i)
181 mincoord[i] =
Vmath::Vmin(pts.num_elements(),pts,1);
182 maxcoord[i] =
Vmath::Vmax(pts.num_elements(),pts,1);
184 diff = max(maxcoord[i] - mincoord[i],diff);
187 for(i = 0; i < 3; ++i)
189 if((gloCoord[i] < mincoord[i] - 0.2*diff)||
190 (gloCoord[i] > maxcoord[i] + 0.2*diff))
201 if (locCoord[0] >= -(1+tol) && locCoord[1] >= -(1+tol) &&
202 locCoord[2] >= -(1+tol) &&
203 locCoord[0] + locCoord[1] + locCoord[2] <= -1+tol)
214 const Array<OneD, const NekDouble>& coords,
215 Array<OneD, NekDouble>& Lcoords)
235 cp1020.
Mult(e10,e20);
236 cp2030.
Mult(e20,e30);
237 cp3010.
Mult(e30,e10);
247 Lcoords[0] = 2.0*beta - 1.0;
248 Lcoords[1] = 2.0*gamma - 1.0;
249 Lcoords[2] = 2.0*delta - 1.0;
257 Array<OneD, NekDouble> ptsx(npts), ptsy(npts), ptsz(npts);
258 Array<OneD, NekDouble> tmp1(npts), tmp2(npts);
264 const Array<OneD, const NekDouble> za =
m_xmap->GetPoints(0);
265 const Array<OneD, const NekDouble> zb =
m_xmap->GetPoints(1);
266 const Array<OneD, const NekDouble> zc =
m_xmap->GetPoints(2);
279 int qa = za.num_elements(), qb = zb.num_elements();
280 Lcoords[2] = zc[min_i/(qa*qb)];
281 min_i = min_i%(qa*qb);
282 Lcoords[1] = zb[min_i/qa];
283 Lcoords[0] = za[min_i%qa];
286 Lcoords[1] = (1.0+Lcoords[0])*(1.0-Lcoords[2])/2 -1.0;
287 Lcoords[0] = (1.0+Lcoords[0])*(-Lcoords[1]-Lcoords[2])/2 -1.0;
316 else if (faceidx == 1)
354 std::ostringstream errstrm;
355 errstrm <<
"Local edge 0 (eid=" <<
m_faces[0]->GetEid(0);
356 errstrm <<
") on face " <<
m_faces[0]->GetFid();
357 errstrm <<
" must be the same as local edge 0 (eid="<<
m_faces[1]->GetEid(0);
358 errstrm <<
") on face " <<
m_faces[1]->GetFid();
363 for(faceConnected = 1; faceConnected < 4 ; faceConnected++)
366 for(i = 0; i < 3; i++)
378 std::ostringstream errstrm;
379 errstrm <<
"Face 0 does not share an edge with first edge of adjacent face. Faces ";
385 std::ostringstream errstrm;
386 errstrm <<
"Connected faces share more than one edge. Faces ";
395 for(i = 0; i < 3; i++)
397 for(j = 0; j < 3; j++)
409 std::ostringstream errstrm;
410 errstrm <<
"Connected faces do not share an edge. Faces ";
416 std::ostringstream errstrm;
417 errstrm <<
"Connected faces share more than one edge. Faces ";
422 for(faceConnected = 1; faceConnected < 3 ; faceConnected++)
425 for(i = 0; i < 3; i++)
427 for(j = 0; j < 3; j++)
440 std::ostringstream errstrm;
441 errstrm <<
"Connected faces do not share an edge. Faces ";
447 std::ostringstream errstrm;
448 errstrm <<
"Connected faces share more than one edge. Faces ";
472 std::ostringstream errstrm;
473 errstrm <<
"Connected edges do not share a vertex. Edges ";
479 for(
int i = 1; i < 2; i++)
491 std::ostringstream errstrm;
492 errstrm <<
"Connected edges do not share a vertex. Edges ";
493 errstrm <<
m_edges[i]->GetEid() <<
", " <<
m_edges[i-1]->GetEid();
509 for (
int i = 4; i < 6; ++i)
520 std::ostringstream errstrm;
521 errstrm <<
"Connected edges do not share a vertex. Edges ";
532 const unsigned int edgeVerts[
kNedges][2] =
553 ASSERTL0(
false,
"Could not find matching vertex for the edge");
569 Array<OneD,NekDouble> elementAaxis(
m_coordim);
570 Array<OneD,NekDouble> elementBaxis(
m_coordim);
576 Array<OneD,NekDouble> faceAaxis(
m_coordim);
577 Array<OneD,NekDouble> faceBaxis(
m_coordim);
582 unsigned int baseVertex;
603 unsigned int orientation;
609 elementAaxis_length = 0.0;
610 elementBaxis_length = 0.0;
611 faceAaxis_length = 0.0;
612 faceBaxis_length = 0.0;
617 baseVertex =
m_faces[f]->GetVid(0);
631 elementAaxis[i] = (*
m_verts[ faceVerts[f][1] ])[i] - (*
m_verts[ faceVerts[f][0] ])[i];
632 elementBaxis[i] = (*
m_verts[ faceVerts[f][2] ])[i] - (*
m_verts[ faceVerts[f][0] ])[i];
635 else if( baseVertex ==
m_verts[ faceVerts[f][1] ]->
GetVid() )
639 elementAaxis[i] = (*
m_verts[ faceVerts[f][1] ])[i] - (*
m_verts[ faceVerts[f][0] ])[i];
640 elementBaxis[i] = (*
m_verts[ faceVerts[f][2] ])[i] - (*
m_verts[ faceVerts[f][1] ])[i];
643 else if( baseVertex ==
m_verts[ faceVerts[f][2] ]->
GetVid() )
647 elementAaxis[i] = (*
m_verts[ faceVerts[f][1] ])[i] - (*
m_verts[ faceVerts[f][2] ])[i];
648 elementBaxis[i] = (*
m_verts[ faceVerts[f][2] ])[i] - (*
m_verts[ faceVerts[f][0] ])[i];
653 ASSERTL0(
false,
"Could not find matching vertex for the face");
663 elementAaxis_length += pow(elementAaxis[i],2);
664 elementBaxis_length += pow(elementBaxis[i],2);
665 faceAaxis_length += pow(faceAaxis[i],2);
666 faceBaxis_length += pow(faceBaxis[i],2);
669 elementAaxis_length = sqrt(elementAaxis_length);
670 elementBaxis_length = sqrt(elementBaxis_length);
671 faceAaxis_length = sqrt(faceAaxis_length);
672 faceBaxis_length = sqrt(faceBaxis_length);
678 dotproduct1 += elementAaxis[i]*faceAaxis[i];
688 if(dotproduct1 < 0.0)
696 dotproduct2 += elementBaxis[i]*faceBaxis[i];
700 ASSERTL1(fabs(elementBaxis_length*faceBaxis_length - fabs(dotproduct2)) <
702 "These vectors should be parallel");
706 if( dotproduct2 < 0.0 )
721 dotproduct1 += elementAaxis[i]*faceBaxis[i];
725 ASSERTL1(fabs(elementAaxis_length*faceBaxis_length - fabs(dotproduct1)) <
727 "These vectors should be parallel");
731 if(dotproduct1 < 0.0)
740 dotproduct2 += elementBaxis[i]*faceAaxis[i];
744 ASSERTL1(fabs(elementBaxis_length*faceAaxis_length - fabs(dotproduct2)) <
746 "These vectors should be parallel");
748 if( dotproduct2 < 0.0 )
754 orientation = orientation + 5;