44 namespace SpatialDomains
47 {0,3,4},{0,1,5},{1,2,6},{2,3,7},
48 {4,8,11},{5,8,9},{6,9,10},{7,10,11}};
50 {0,1,4},{0,1,2},{0,2,3},{0,3,4},
51 {1,4,5},{1,2,5},{2,3,5},{3,4,5}};
53 {0,1},{0,2},{0,3},{0,4},{1,4},{1,2},{2,3},{3,4},
54 {1,5},{2,5},{3,5},{4,5}};
80 vector<int> tmp1, tmp2;
84 tmp1.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs (0));
85 tmp1.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs (2));
86 tmp2.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(0));
87 tmp2.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(2));
91 tmp1.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs (1));
92 tmp1.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs (3));
93 tmp2.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(1));
94 tmp2.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(3));
99 tmp1.push_back(faces[5]->
GetXmap()->GetEdgeNcoeffs (0));
100 tmp1.push_back(faces[5]->
GetXmap()->GetEdgeNcoeffs (2));
101 tmp2.push_back(faces[5]->
GetXmap()->GetEdgeNumPoints(0));
102 tmp2.push_back(faces[5]->
GetXmap()->GetEdgeNumPoints(2));
106 tmp1.push_back(faces[5]->
GetXmap()->GetEdgeNcoeffs (1));
107 tmp1.push_back(faces[5]->
GetXmap()->GetEdgeNcoeffs (3));
108 tmp2.push_back(faces[5]->
GetXmap()->GetEdgeNumPoints(1));
109 tmp2.push_back(faces[5]->
GetXmap()->GetEdgeNumPoints(3));
112 int order0 = *max_element(tmp1.begin(), tmp1.end());
113 int points0 = *max_element(tmp2.begin(), tmp2.end());
120 tmp1.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs (1));
121 tmp1.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs (3));
122 tmp2.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(1));
123 tmp2.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(3));
127 tmp1.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs (0));
128 tmp1.push_back(faces[0]->
GetXmap()->GetEdgeNcoeffs (2));
129 tmp2.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(0));
130 tmp2.push_back(faces[0]->
GetXmap()->GetEdgeNumPoints(2));
135 tmp1.push_back(faces[5]->
GetXmap()->GetEdgeNcoeffs (1));
136 tmp1.push_back(faces[5]->
GetXmap()->GetEdgeNcoeffs (3));
137 tmp2.push_back(faces[5]->
GetXmap()->GetEdgeNumPoints(1));
138 tmp2.push_back(faces[5]->
GetXmap()->GetEdgeNumPoints(3));
142 tmp1.push_back(faces[5]->
GetXmap()->GetEdgeNcoeffs (0));
143 tmp1.push_back(faces[5]->
GetXmap()->GetEdgeNcoeffs (2));
144 tmp2.push_back(faces[5]->
GetXmap()->GetEdgeNumPoints(0));
145 tmp2.push_back(faces[5]->
GetXmap()->GetEdgeNumPoints(2));
148 int order1 = *max_element(tmp1.begin(), tmp1.end());
149 int points1 = *max_element(tmp2.begin(), tmp2.end());
156 tmp1.push_back(faces[1]->
GetXmap()->GetEdgeNcoeffs (1));
157 tmp1.push_back(faces[1]->
GetXmap()->GetEdgeNcoeffs (3));
158 tmp2.push_back(faces[1]->
GetXmap()->GetEdgeNumPoints(1));
159 tmp2.push_back(faces[1]->
GetXmap()->GetEdgeNumPoints(3));
163 tmp1.push_back(faces[1]->
GetXmap()->GetEdgeNcoeffs (0));
164 tmp1.push_back(faces[1]->
GetXmap()->GetEdgeNcoeffs (2));
165 tmp2.push_back(faces[1]->
GetXmap()->GetEdgeNumPoints(0));
166 tmp2.push_back(faces[1]->
GetXmap()->GetEdgeNumPoints(2));
171 tmp1.push_back(faces[3]->
GetXmap()->GetEdgeNcoeffs (1));
172 tmp1.push_back(faces[3]->
GetXmap()->GetEdgeNcoeffs (3));
173 tmp2.push_back(faces[3]->
GetXmap()->GetEdgeNumPoints(1));
174 tmp2.push_back(faces[3]->
GetXmap()->GetEdgeNumPoints(3));
178 tmp1.push_back(faces[3]->
GetXmap()->GetEdgeNcoeffs (0));
179 tmp1.push_back(faces[3]->
GetXmap()->GetEdgeNcoeffs (2));
180 tmp2.push_back(faces[3]->
GetXmap()->GetEdgeNumPoints(0));
181 tmp2.push_back(faces[3]->
GetXmap()->GetEdgeNumPoints(2));
184 int order2 = *max_element(tmp1.begin(), tmp1.end());
185 int points2 = *max_element(tmp2.begin(), tmp2.end());
218 if (
m_xmap->GetBasisNumModes(0) != 2 ||
219 m_xmap->GetBasisNumModes(1) != 2 ||
220 m_xmap->GetBasisNumModes(2) != 2 )
242 if( fabs( (*
m_verts[ faceVerts[f][0] ])(i) -
243 (*
m_verts[ faceVerts[f][1] ])(i) +
244 (*
m_verts[ faceVerts[f][2] ])(i) -
245 (*
m_verts[ faceVerts[f][3] ])(i) )
267 const Array<OneD, const NekDouble> &coords,
268 Array<OneD, NekDouble> &Lcoords)
284 Array<OneD, NekDouble> pts(
m_xmap->GetTotPoints());
291 nq0 =
m_xmap->GetNumPoints(0);
292 nq1 =
m_xmap->GetNumPoints(1);
293 nq2 =
m_xmap->GetNumPoints(2);
298 len0 += (pts[nq0-1]-pts[0])*(pts[nq0-1]-pts[0]);
299 xi0 += (coords[i] -pts[0])*(pts[nq0-1]-pts[0]);
302 len1 += (pts[nq0*(nq1-1)]-pts[0])*(pts[nq0*(nq1-1)]-pts[0]);
303 xi1 += (coords[i] -pts[0])*(pts[nq0*(nq1-1)]-pts[0]);
306 len2 += (pts[nq0*nq1*(nq2-1)]-pts[0])*(pts[nq0*nq1*(nq2-1)]-pts[0]);
307 xi2 += (coords[i] -pts[0])*(pts[nq0*nq1*(nq2-1)]-pts[0]);
310 Lcoords[0] = 2*xi0/len0-1.0;
311 Lcoords[1] = 2*xi1/len1-1.0;
312 Lcoords[2] = 2*xi2/len2-1.0;
318 Array<OneD, NekDouble> ptsx(npts), ptsy(npts), ptsz(npts);
319 Array<OneD, NekDouble> tmp1(npts), tmp2(npts);
325 const Array<OneD, const NekDouble> za =
m_xmap->GetPoints(0);
326 const Array<OneD, const NekDouble> zb =
m_xmap->GetPoints(1);
327 const Array<OneD, const NekDouble> zc =
m_xmap->GetPoints(2);
340 int qa = za.num_elements(), qb = zb.num_elements();
341 Lcoords[2] = zc[min_i/(qa*qb)];
342 min_i = min_i%(qa*qb);
343 Lcoords[1] = zb[min_i/qa];
344 Lcoords[0] = za[min_i%qa];
358 const Array<OneD, const NekDouble> &gloCoord,
NekDouble tol)
360 Array<OneD,NekDouble> locCoord(
GetCoordim(),0.0);
366 const Array<OneD, const NekDouble> &gloCoord,
367 Array<OneD, NekDouble> &locCoord,
375 const Array<OneD, const NekDouble> &gloCoord,
376 Array<OneD, NekDouble> &locCoord,
380 ASSERTL1(gloCoord.num_elements() == 3,
381 "Three dimensional geometry expects three coordinates.");
389 Array<OneD, NekDouble> mincoord(3), maxcoord(3);
395 Array<OneD, NekDouble> pts(npts);
397 for(i = 0; i < 3; ++i)
401 mincoord[i] =
Vmath::Vmin(pts.num_elements(),pts,1);
402 maxcoord[i] =
Vmath::Vmax(pts.num_elements(),pts,1);
404 diff = max(maxcoord[i] - mincoord[i],diff);
407 for(i = 0; i < 3; ++i)
409 if((gloCoord[i] < mincoord[i] - 0.2*diff)||
410 (gloCoord[i] > maxcoord[i] + 0.2*diff))
419 if (locCoord[0] >= -(1+tol) && locCoord[0] <= 1+tol
420 && locCoord[1] >= -(1+tol) && locCoord[1] <= 1+tol
421 && locCoord[2] >= -(1+tol) && locCoord[2] <= 1+tol)
460 if (faceidx == 0 || faceidx == 1)
464 else if (faceidx == 1 || faceidx == 3)
484 for(f = 1; f < 5 ; f++)
487 for(i = 0; i < 4; i++)
489 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 ";
518 for(i = 0; i < 4; i++)
520 for(j = 0; j < 4; j++)
532 std::ostringstream errstrm;
533 errstrm <<
"Connected faces do not share an edge. Faces ";
539 std::ostringstream errstrm;
540 errstrm <<
"Connected faces share more than one edge. Faces ";
544 for(f = 1; f < 4 ; f++)
547 for(i = 0; i < 4; i++)
549 for(j = 0; j < 4; j++)
562 std::ostringstream errstrm;
563 errstrm <<
"Connected faces do not share an edge. Faces ";
569 std::ostringstream errstrm;
570 errstrm <<
"Connected faces share more than one edge. Faces ";
577 for(f = 1; f < 5 ; f++)
580 for(i = 0; i < 4; i++)
582 for(j = 0; j < 4; j++)
595 std::ostringstream errstrm;
596 errstrm <<
"Connected faces do not share an edge. Faces ";
602 std::ostringstream errstrm;
603 errstrm <<
"Connected faces share more than one edge. Faces ";
627 std::ostringstream errstrm;
628 errstrm <<
"Connected edges do not share a vertex. Edges ";
635 for(i = 1; i < 3; i++)
647 std::ostringstream errstrm;
648 errstrm <<
"Connected edges do not share a vertex. Edges ";
649 errstrm <<
m_edges[i]->GetEid() <<
", " <<
m_edges[i-1]->GetEid();
670 std::ostringstream errstrm;
671 errstrm <<
"Connected edges do not share a vertex. Edges ";
677 for(i = 9; i < 11; i++)
689 std::ostringstream errstrm;
690 errstrm <<
"Connected edges do not share a vertex. Edges ";
691 errstrm <<
m_edges[i]->GetEid() <<
", " <<
m_edges[i-1]->GetEid();
707 Array<OneD,NekDouble> elementAaxis(
m_coordim);
708 Array<OneD,NekDouble> elementBaxis(
m_coordim);
714 Array<OneD,NekDouble> faceAaxis(
m_coordim);
715 Array<OneD,NekDouble> faceBaxis(
m_coordim);
720 unsigned int baseVertex;
743 unsigned int orientation;
749 elementAaxis_length = 0.0;
750 elementBaxis_length = 0.0;
751 faceAaxis_length = 0.0;
752 faceBaxis_length = 0.0;
757 baseVertex =
m_faces[f]->GetVid(0);
769 elementAaxis[i] = (*
m_verts[ faceVerts[f][1] ])[i] - (*
m_verts[ faceVerts[f][0] ])[i];
770 elementBaxis[i] = (*
m_verts[ faceVerts[f][3] ])[i] - (*
m_verts[ faceVerts[f][0] ])[i];
773 else if( baseVertex ==
m_verts[ faceVerts[f][1] ]->
GetVid() )
777 elementAaxis[i] = (*
m_verts[ faceVerts[f][1] ])[i] - (*
m_verts[ faceVerts[f][0] ])[i];
778 elementBaxis[i] = (*
m_verts[ faceVerts[f][2] ])[i] - (*
m_verts[ faceVerts[f][1] ])[i];
781 else if( baseVertex ==
m_verts[ faceVerts[f][2] ]->
GetVid() )
785 elementAaxis[i] = (*
m_verts[ faceVerts[f][2] ])[i] - (*
m_verts[ faceVerts[f][3] ])[i];
786 elementBaxis[i] = (*
m_verts[ faceVerts[f][2] ])[i] - (*
m_verts[ faceVerts[f][1] ])[i];
789 else if( baseVertex ==
m_verts[ faceVerts[f][3] ]->
GetVid() )
793 elementAaxis[i] = (*
m_verts[ faceVerts[f][2] ])[i] - (*
m_verts[ faceVerts[f][3] ])[i];
794 elementBaxis[i] = (*
m_verts[ faceVerts[f][3] ])[i] - (*
m_verts[ faceVerts[f][0] ])[i];
799 ASSERTL0(
false,
"Could not find matching vertex for the face");
809 elementAaxis_length += pow(elementAaxis[i],2);
810 elementBaxis_length += pow(elementBaxis[i],2);
811 faceAaxis_length += pow(faceAaxis[i],2);
812 faceBaxis_length += pow(faceBaxis[i],2);
815 elementAaxis_length = sqrt(elementAaxis_length);
816 elementBaxis_length = sqrt(elementBaxis_length);
817 faceAaxis_length = sqrt(faceAaxis_length);
818 faceBaxis_length = sqrt(faceBaxis_length);
824 dotproduct1 += elementAaxis[i]*faceAaxis[i];
834 if(dotproduct1 < 0.0)
842 dotproduct2 += elementBaxis[i]*faceBaxis[i];
846 ASSERTL1(fabs(elementBaxis_length*faceBaxis_length - fabs(dotproduct2)) <
848 "These vectors should be parallel");
852 if( dotproduct2 < 0.0 )
867 dotproduct1 += elementAaxis[i]*faceBaxis[i];
871 ASSERTL1(fabs(elementAaxis_length*faceBaxis_length - fabs(dotproduct1)) <
873 "These vectors should be parallel");
877 if(dotproduct1 < 0.0)
886 dotproduct2 += elementBaxis[i]*faceAaxis[i];
890 ASSERTL1(fabs(elementBaxis_length*faceAaxis_length - fabs(dotproduct2)) <
892 "These vectors should be parallel");
894 if( dotproduct2 < 0.0 )
900 orientation = orientation + 5;
912 const unsigned int edgeVerts[
kNedges][2] =
939 ASSERTL0(
false,
"Could not find matching vertex for the edge");