18 {
"Point",
"Segment",
"Triangle",
"Square",
"Tetrahedron",
"Cube" };
21 { 1.0, 1.0, 0.5, 1.0, 1./6, 1.0 };
114 GeomCenter[
POINT].
x = 0.0;
115 GeomCenter[
POINT].
y = 0.0;
116 GeomCenter[
POINT].
z = 0.0;
134 GeomCenter[
CUBE].
x = 0.5;
135 GeomCenter[
CUBE].
y = 0.5;
136 GeomCenter[
CUBE].
z = 0.5;
138 PerfGeomToGeomJac[
POINT] = NULL;
139 PerfGeomToGeomJac[
SEGMENT] = NULL;
141 PerfGeomToGeomJac[
SQUARE] = NULL;
143 PerfGeomToGeomJac[
CUBE] = NULL;
165 for (
int i = 0; i <
NumGeom; i++)
167 delete PerfGeomToGeomJac[i];
204 pm(0,0) = 0.0; pm(1,0) = 0.0;
205 pm(0,1) = 1.0; pm(1,1) = 0.0;
206 pm(0,2) = 0.5; pm(1,2) = 0.86602540378443864676;
213 pm(0,0) = 0.0; pm(1,0) = 0.0;
214 pm(0,1) = 1.0; pm(1,1) = 0.0;
215 pm(0,2) = 1.0; pm(1,2) = 1.0;
216 pm(0,3) = 0.0; pm(1,3) = 1.0;
223 pm(0,0) = 0.0; pm(1,0) = 0.0; pm(2,0) = 0.0;
224 pm(0,1) = 1.0; pm(1,1) = 0.0; pm(2,1) = 0.0;
225 pm(0,2) = 0.5; pm(1,2) = 0.86602540378443864676; pm(2,2) = 0.0;
226 pm(0,3) = 0.5; pm(1,3) = 0.28867513459481288225;
227 pm(2,3) = 0.81649658092772603273;
234 pm(0,0) = 0.0; pm(1,0) = 0.0; pm(2,0) = 0.0;
235 pm(0,1) = 1.0; pm(1,1) = 0.0; pm(2,1) = 0.0;
236 pm(0,2) = 1.0; pm(1,2) = 1.0; pm(2,2) = 0.0;
237 pm(0,3) = 0.0; pm(1,3) = 1.0; pm(2,3) = 0.0;
238 pm(0,4) = 0.0; pm(1,4) = 0.0; pm(2,4) = 1.0;
239 pm(0,5) = 1.0; pm(1,5) = 0.0; pm(2,5) = 1.0;
240 pm(0,6) = 1.0; pm(1,6) = 1.0; pm(2,6) = 1.0;
241 pm(0,7) = 0.0; pm(1,7) = 1.0; pm(2,7) = 1.0;
246 mfem_error (
"Geometry::GetPerfPointMat (...)");
253 if (PerfGeomToGeomJac[GeomType])
255 Mult(J, *PerfGeomToGeomJac[GeomType], PJ);
293 const double *cp = NULL;
302 if (RGeom[g] != NULL && RGeom[g]->Times == Times)
306 RGeom[g]->
Times = Times;
308 for (i = 0; i <= Times; i++)
311 ip.
x = (type == 0) ?
double(i) / Times : cp[i];
314 for (i = 0; i < Times; i++)
325 if (RGeom[2] != NULL && RGeom[2]->Times == Times &&
326 RGeom[2]->ETimes == ETimes)
329 if (RGeom[2] != NULL)
333 RGeom[2]->
Times = Times;
334 RGeom[2]->
ETimes = ETimes;
335 for (k = j = 0; j <= Times; j++)
336 for (i = 0; i <= Times-j; i++, k++)
341 ip.
x = double(i) / Times;
342 ip.
y = double(j) / Times;
346 ip.
x = cp[i]/(cp[i] + cp[j] + cp[Times-i-j]);
347 ip.
y = cp[j]/(cp[i] + cp[j] + cp[Times-i-j]);
351 for (l = k = j = 0; j < Times; j++, k++)
352 for (i = 0; i < Times-j; i++, k++)
356 G[l++] = k+Times-j+1;
360 G[l++] = k+Times-j+2;
361 G[l++] = k+Times-j+1;
366 for (l = k = 0; k < Times; k += Times/ETimes)
368 j = k*(Times+1)-((k-1)*k)/2;
369 for (i = 0; i < Times-k; i++)
376 for (k = Times; k > 0; k -= Times/ETimes)
379 for (i = 0; i < k; i++)
381 E[l++] = j; j += Times-i;
386 for (k = 0; k < Times; k += Times/ETimes)
389 for (i = 0; i < Times-k; i++)
391 E[l++] = j; j += Times-i+1;
401 if (RGeom[3] != NULL && RGeom[3]->Times == Times &&
402 RGeom[3]->ETimes == ETimes)
405 if (RGeom[3] != NULL)
409 RGeom[3]->
Times = Times;
410 RGeom[3]->
ETimes = ETimes;
411 for (k = j = 0; j <= Times; j++)
412 for (i = 0; i <= Times; i++, k++)
417 ip.
x = double(i) / Times;
418 ip.
y = double(j) / Times;
427 for (l = k = j = 0; j < Times; j++, k++)
428 for (i = 0; i < Times; i++, k++)
437 for (l = k = 0; k <= Times; k += Times/ETimes)
439 for (i = 0, j = k*(Times+1); i < Times; i++)
446 for (k = Times; k >= 0; k -= Times/ETimes)
448 for (i = 0, j = k; i < Times; i++)
450 E[l++] = j; j += Times+1;
461 if (RGeom[g] != NULL && RGeom[g]->Times == Times &&
462 RGeom[g]->ETimes == ETimes)
465 if (RGeom[g] != NULL)
468 8*Times*Times*Times, 0);
469 RGeom[g]->
Times = Times;
470 RGeom[g]->
ETimes = ETimes;
471 for (l = k = 0; k <= Times; k++)
472 for (j = 0; j <= Times; j++)
473 for (i = 0; i <= Times; i++, l++)
478 ip.
x = double(i) / Times;
479 ip.
y = double(j) / Times;
480 ip.
z = double(k) / Times;
490 for (l = k = 0; k < Times; k++)
491 for (j = 0; j < Times; j++)
492 for (i = 0; i < Times; i++)
494 G[l++] = i+0 + (j+0 + (k+0) * (Times+1)) * (Times+1);
495 G[l++] = i+1 + (j+0 + (k+0) * (Times+1)) * (Times+1);
496 G[l++] = i+1 + (j+1 + (k+0) * (Times+1)) * (Times+1);
497 G[l++] = i+0 + (j+1 + (k+0) * (Times+1)) * (Times+1);
498 G[l++] = i+0 + (j+0 + (k+1) * (Times+1)) * (Times+1);
499 G[l++] = i+1 + (j+0 + (k+1) * (Times+1)) * (Times+1);
500 G[l++] = i+1 + (j+1 + (k+1) * (Times+1)) * (Times+1);
501 G[l++] = i+0 + (j+1 + (k+1) * (Times+1)) * (Times+1);
510 if (RGeom[g] != NULL && RGeom[g]->Times == Times &&
511 RGeom[g]->ETimes == ETimes)
514 if (RGeom[g] != NULL)
536 for (k = 0; k <= n; k++)
537 for (j = 0; j <= k; j++)
538 for (i = 0; i <= j; i++)
548 ip.
x = double(k - j) / n;
549 ip.
y = double(i) / n;
550 ip.
z = double(j - i) / n;
554 double w = cp[k-j] + cp[i] + cp[j-i] + cp[Times-k];
559 l = i + (j + k * (n+1)) * (n+1);
563 if (m != (n+3)*(n+2)*(n+1)/6)
564 mfem_error(
"GeometryRefiner::Refine() for TETRAHEDRON #1");
568 for (k = 0; k < n; k++)
569 for (j = 0; j <= k; j++)
570 for (i = 0; i <= j; i++)
580 G[m++] = vi[i+0 + (j+0 + (k+0) * (n+1)) * (n+1)];
581 G[m++] = vi[i+0 + (j+0 + (k+1) * (n+1)) * (n+1)];
582 G[m++] = vi[i+1 + (j+1 + (k+1) * (n+1)) * (n+1)];
583 G[m++] = vi[i+0 + (j+1 + (k+1) * (n+1)) * (n+1)];
587 G[m++] = vi[i+0 + (j+0 + (k+0) * (n+1)) * (n+1)];
588 G[m++] = vi[i+1 + (j+1 + (k+1) * (n+1)) * (n+1)];
589 G[m++] = vi[i+0 + (j+1 + (k+0) * (n+1)) * (n+1)];
590 G[m++] = vi[i+0 + (j+1 + (k+1) * (n+1)) * (n+1)];
592 G[m++] = vi[i+0 + (j+0 + (k+0) * (n+1)) * (n+1)];
593 G[m++] = vi[i+0 + (j+1 + (k+0) * (n+1)) * (n+1)];
594 G[m++] = vi[i+1 + (j+1 + (k+1) * (n+1)) * (n+1)];
595 G[m++] = vi[i+1 + (j+1 + (k+0) * (n+1)) * (n+1)];
600 G[m++] = vi[i+0 + (j+0 + (k+0) * (n+1)) * (n+1)];
601 G[m++] = vi[i+1 + (j+0 + (k+0) * (n+1)) * (n+1)];
602 G[m++] = vi[i+1 + (j+1 + (k+1) * (n+1)) * (n+1)];
603 G[m++] = vi[i+1 + (j+0 + (k+1) * (n+1)) * (n+1)];
607 G[m++] = vi[i+0 + (j+0 + (k+0) * (n+1)) * (n+1)];
608 G[m++] = vi[i+1 + (j+1 + (k+1) * (n+1)) * (n+1)];
609 G[m++] = vi[i+1 + (j+0 + (k+0) * (n+1)) * (n+1)];
610 G[m++] = vi[i+1 + (j+1 + (k+0) * (n+1)) * (n+1)];
613 G[m++] = vi[i+0 + (j+0 + (k+0) * (n+1)) * (n+1)];
614 G[m++] = vi[i+1 + (j+1 + (k+1) * (n+1)) * (n+1)];
615 G[m++] = vi[i+0 + (j+0 + (k+1) * (n+1)) * (n+1)];
616 G[m++] = vi[i+1 + (j+0 + (k+1) * (n+1)) * (n+1)];
620 mfem_error(
"GeometryRefiner::Refine() for TETRAHEDRON #2");
621 for (i = 0; i < m; i++)
623 mfem_error(
"GeometryRefiner::Refine() for TETRAHEDRON #3");
644 if (IntPts[g] == NULL || IntPts[g]->GetNPoints() != Times-1)
648 for (
int i = 1; i < Times; i++)
651 ip.
x = double(i) / Times;
662 if (IntPts[g] == NULL ||
663 IntPts[g]->GetNPoints() != ((Times-1)*(Times-2))/2)
667 for (
int k = 0, j = 1; j < Times-1; j++)
668 for (
int i = 1; i < Times-j; i++, k++)
671 ip.
x = double(i) / Times;
672 ip.
y = double(j) / Times;
683 if (IntPts[g] == NULL || IntPts[g]->GetNPoints() != (Times-1)*(Times-1))
687 for (
int k = 0, j = 1; j < Times; j++)
688 for (
int i = 1; i < Times; i++, k++)
691 ip.
x = double(i) / Times;
692 ip.
y = double(j) / Times;
700 mfem_error(
"GeometryRefiner::RefineInterior(...)");
Class for integration rule.
void JacToPerfJac(int GeomType, const DenseMatrix &J, DenseMatrix &PJ) const
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
RefinedGeometry * Refine(int Geom, int Times, int ETimes=1)
static const double Volume[NumGeom]
const double * ClosedPoints(const int p)
static const int NumBdrArray[]
const IntegrationRule * GetVertices(int GeomType)
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
const IntegrationRule * RefineInterior(int Geom, int Times)
GeometryRefiner GlobGeometryRefiner
Class for linear FE on tetrahedron.
Class for linear FE on triangle.
static const char * Name[NumGeom]
void CalcInverse(const DenseMatrix &a, DenseMatrix &inva)
void GetPerfPointMat(int GeomType, DenseMatrix &pm)
void mfem_error(const char *msg)
Class for integration point with weight.
void SetSize(int s)
If the matrix is not a square matrix of size s then recreate it.