48 namespace SpatialDomains
102 "Cannot call function with dim == 1");
104 int order0 = edges[0]->GetBasis(0)->GetNumModes();
105 int points0 = edges[0]->GetBasis(0)->GetNumPoints();
106 int order1 = max(order0,
107 max(edges[1]->
GetBasis(0)->GetNumModes(),
108 edges[2]->
GetBasis(0)->GetNumModes()));
109 int points1 = max(points0,
110 max(edges[1]->
GetBasis(0)->GetNumPoints(),
111 edges[2]->
GetBasis(0)->GetNumPoints()));
129 Geometry2D(edges[0]->GetVertex(0)->GetCoordim()),
155 m_coordim = edges[0]->GetVertex(0)->GetCoordim();
158 int order0 = edges[0]->GetBasis(0)->GetNumModes();
159 int points0 = edges[0]->GetBasis(0)->GetNumPoints();
160 int order1 = max(order0,
161 max(edges[1]->
GetBasis(0)->GetNumModes(),
162 edges[2]->
GetBasis(0)->GetNumModes()));
163 int points1 = max(points0,
164 max(edges[1]->
GetBasis(0)->GetNumPoints(),
165 edges[2]->
GetBasis(0)->GetNumPoints()));
184 Geometry2D(edges[0]->GetVertex(0)->GetCoordim()),
210 m_coordim = edges[0]->GetVertex(0)->GetCoordim();
213 int order0 = edges[0]->GetBasis(0)->GetNumModes();
214 int points0 = edges[0]->GetBasis(0)->GetNumPoints();
215 int order1 = max(order0,
216 max(edges[1]->
GetBasis(0)->GetNumModes(),
217 edges[2]->
GetBasis(0)->GetNumModes()));
218 int points1 = max(points0,
219 max(edges[1]->
GetBasis(0)->GetNumPoints(),
220 edges[2]->
GetBasis(0)->GetNumPoints()));
239 int N = curve->m_points.size();
240 int nEdgePts = (-1+(int)sqrt(static_cast<NekDouble>(8*N+1)))/2;
242 ASSERTL0(nEdgePts*(nEdgePts+1)/2 == N,
243 "NUMPOINTS must be a triangle number for 2D basis.");
245 for (
int j = 0; j <
kNedges; ++j)
248 "Number of edge points does not correspond "
249 "to number of face points.");
264 T0, T1, curve->m_ptype);
266 Array<OneD, NekDouble> phys(max(t->GetTotPoints(),
268 for (
int j = 0; j < N; ++j)
270 phys[j] = (curve->m_points[j]->GetPtr())[i];
273 Array<OneD, NekDouble> tmp(nEdgePts*nEdgePts);
274 t->BwdTrans(phys, tmp);
286 int npts = curve->m_points.size();
287 int nEdgePts = (int)sqrt(static_cast<NekDouble>(npts));
288 Array<OneD,NekDouble> tmp(npts);
295 "NUMPOINTS should be a square number");
297 for (
int j = 0; j <
kNedges; ++j)
300 "Number of edge points does not correspond "
301 "to number of face points.");
304 for (
int j = 0; j <
npts; ++j)
306 tmp[j] = (curve->m_points[j]->GetPtr())[i];
310 Array<OneD, NekDouble> phys(
m_xmap->GetTotPoints());
320 ASSERTL0(
false,
"Only 1D/2D points distributions supported.");
338 std::list<CompToElmt>::const_iterator def;
347 for (
int i = 0; i <
kNedges; i++)
368 const Array<OneD, const NekDouble> &Lcoord)
371 "Geometry is not in physical space");
373 Array<OneD, NekDouble> tmp(
m_xmap->GetTotPoints());
376 return m_xmap->PhysEvaluate(Lcoord, tmp);
390 int i, j, vmap[3] = {-1,-1,-1};
391 NekDouble x, y, z, x1, y1, z1, cx = 0.0, cy = 0.0, cz = 0.0;
397 for (i = 0; i < 3; ++i)
399 cx += (*face2[i])(0) - (*face1[i])(0);
400 cy += (*face2[i])(1) - (*face1[i])(1);
401 cz += (*face2[i])(2) - (*face1[i])(2);
410 for (i = 0; i < 3; ++i)
415 for (j = 0; j < 3; ++j)
417 x1 = (*face2[j])(0)-cx;
418 y1 = (*face2[j])(1)-cy;
419 z1 = (*face2[j])(2)-cz;
420 if (sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y)+(z1-z)*(z1-z)) < 1e-8)
428 if (vmap[1] == (vmap[0]+1) % 3)
459 ASSERTL0(
false,
"Unable to determine triangle orientation");
488 std::list<CompToElmt>::const_iterator def;
521 return m_xmap->GetBasis(i);
530 ASSERTL1(i <= 2,
"edge is out of range");
534 return m_xmap->GetBasis(0);
538 return m_xmap->GetBasis(1);
566 if(
m_xmap->GetBasisNumModes(0) != 2 ||
567 m_xmap->GetBasisNumModes(1) != 2)
600 int nEdgeCoeffs =
m_xmap->GetEdgeNcoeffs(0);
602 Array<OneD, unsigned int> mapArray (nEdgeCoeffs);
603 Array<OneD, int> signArray(nEdgeCoeffs);
610 nEdgeCoeffs =
m_edges[i]->GetXmap()->GetNcoeffs();
614 for(k = 0; k < nEdgeCoeffs; k++)
617 signArray[k] *
m_edges[i]->GetCoeffs(j)[k];
631 Array<OneD,NekDouble> &Lcoords)
651 orth1.
Mult(norm,dv1);
652 orth2.
Mult(norm,dv2);
659 Lcoords[0] = xin.
dot(orth2)/dv1.
dot(orth2);
660 Lcoords[0] = 2*Lcoords[0]-1;
661 Lcoords[1] = xin.
dot(orth1)/dv2.
dot(orth1);
662 Lcoords[1] = 2*Lcoords[1]-1;
668 Array<OneD, NekDouble> ptsx(npts), ptsy(npts);
669 Array<OneD, NekDouble> tmpx(npts), tmpy(npts);
674 const Array<OneD, const NekDouble> za =
m_xmap->GetPoints(0);
675 const Array<OneD, const NekDouble> zb =
m_xmap->GetPoints(1);
685 Lcoords[0] = za[min_i%za.num_elements()];
686 Lcoords[1] = zb[min_i/za.num_elements()];
689 Lcoords[0] = (1.0+Lcoords[0])*(1.0-Lcoords[1])/2 -1.0;
703 ASSERTL2((i >=0) && (i <= 2),
"Edge id must be between 0 and 2");
713 ASSERTL2((i >=0) && (i <= 2),
"Vertex id must be between 0 and 2");
723 ASSERTL2((i >=0) && (i <= 2),
"Vertex id must be between 0 and 2");
733 ASSERTL2((i >=0) && (i <= 2),
"Edge id must be between 0 and 3");
743 ASSERTL2((i >=0) && (i <= 2),
"Edge id must be between 0 and 2");
753 ASSERTL2((i >=0) && (i <= 3),
"Edge id must be between 0 and 3");
782 for (i=0,edgeIter =
m_edges.begin(); edgeIter !=
m_edges.end(); ++edgeIter,++i)
784 if (*edgeIter == edge)
818 const Array<OneD, const NekDouble> &gloCoord,
NekDouble tol)
820 Array<OneD,NekDouble> locCoord(
GetCoordim(),0.0);
829 Array<OneD, NekDouble> &stdCoord,
837 Array<OneD, NekDouble> &stdCoord,
841 ASSERTL1(gloCoord.num_elements() >= 2,
842 "Two dimensional geometry expects at least two coordinates.");
845 if (stdCoord[0] >= -(1+tol) && stdCoord[1] >= -(1+tol)
846 && stdCoord[0] + stdCoord[1] <= tol)