23 for (
int i = 0; i < 4; i++)
60 MFEM_VERIFY(f != 0,
"tetrahedron is not marked");
62 for (i = 0; i < 2; i++)
64 refinement_edges[i] = f & 7;
77 e1 = refinement_edges[0];
78 e2 = refinement_edges[1];
83 if (e1 == 2 && e2 == 1) {
break; }
85 mfem_error(
"Error in Tetrahedron::CreateRefinementFlag(...) #1");
88 if (e1 == 3 && e2 == 1) {
break; }
89 if (e1 == 2 && e2 == 4) {
break; }
94 mfem_error(
"Error in Tetrahedron::CreateRefinementFlag(...) #2");
99 if (e1 == 2 && e2 == 1) {
break; }
102 mfem_error(
"Error in Tetrahedron::CreateRefinementFlag(...) #3");
105 if (flag == 0 && e1 == 5 && e2 == 5)
109 mfem_error(
"Error in Tetrahedron::CreateRefinementFlag(...) #4");
114 if (e1 == 5 && e2 == 1) {
break; }
115 if (e1 == 2 && e2 == 5) {
break; }
117 mfem_error(
"Error in Tetrahedron::CreateRefinementFlag(...) #5");
120 mfem_error(
"Error in Tetrahedron::CreateRefinementFlag(...) #6");
139 int re[2], type, flag, *tv = this->
indices;
146 case 1: fv[0] = tv[1]; fv[1] = tv[2]; fv[2] = tv[3];
break;
147 case 4: fv[0] = tv[3]; fv[1] = tv[1]; fv[2] = tv[2];
break;
148 case 5: fv[0] = tv[2]; fv[1] = tv[3]; fv[2] = tv[1];
break;
154 case 2: fv[0] = tv[2]; fv[1] = tv[0]; fv[2] = tv[3];
break;
155 case 3: fv[0] = tv[0]; fv[1] = tv[3]; fv[2] = tv[2];
break;
156 case 5: fv[0] = tv[3]; fv[1] = tv[2]; fv[2] = tv[0];
break;
160 fv[0] = tv[0]; fv[1] = tv[1]; fv[2] = tv[3];
163 fv[0] = tv[1]; fv[1] = tv[0]; fv[2] = tv[2];
181 for (
int i = 0; i < 4; i++)
189 int ind[4], i, j, l, L, type;
193 if ((l = length[v_to_v(
indices[1],
indices[2])]) > L) { L = l; j = 1; }
194 if ((l = length[v_to_v(
indices[2],
indices[0])]) > L) { L = l; j = 2; }
195 if ((l = length[v_to_v(
indices[0],
indices[3])]) > L) { L = l; j = 3; }
196 if ((l = length[v_to_v(
indices[1],
indices[3])]) > L) { L = l; j = 4; }
199 for (i = 0; i < 4; i++)
230 ind[0] = 2; ind[1] = 1;
232 if ((l = length[v_to_v(
indices[0],
indices[3])]) > L) { L = l; ind[0] = 3; }
233 if ((l = length[v_to_v(
indices[2],
indices[3])]) > L) { ind[0] = 5; }
236 if ((l = length[v_to_v(
indices[1],
indices[3])]) > L) { L = l; ind[1] = 4; }
237 if ((l = length[v_to_v(
indices[2],
indices[3])]) > L) { ind[1] = 5; }
256 j = 1; ind[0] = 2; ind[1] = 1;
break;
259 j = 1; ind[0] = 5; ind[1] = 1;
268 j = 1; ind[0] = 2; ind[1] = 5;
break;
286 double *
a = &pm(0,0), *
b = &pm(0,1), *c = &pm(0,2), *d = &pm(0,3);
289 a[0] = 0.0, a[1] = 0.0, a[2] = 0.0;
290 b[0] = 1.0,
b[1] = 0.0,
b[2] = 0.0;
291 c[0] = 0.0, c[1] = 1.0, c[2] = 0.0;
292 d[0] = 0.0, d[1] = 0.0, d[2] = 1.0;
294 int chain[12], n = 0;
297 chain[n++] = (transform & 7) - 1;
305 #define ASGN(a, b) (a[0] = b[0], a[1] = b[1], a[2] = b[2])
306 #define SWAP(a, b) for (int i = 0; i < 3; i++) { std::swap(a[i], b[i]); }
307 #define AVG(a, b, c) for (int i = 0; i < 3; i++) { a[i] = (b[i]+c[i])*0.5; }
313 case 0: ASGN(
b, c); ASGN(c, d);
break;
314 case 1: ASGN(a, c); ASGN(c, d);
break;
315 case 2: ASGN(
b, a); ASGN(a, d);
break;
316 case 3: ASGN(a,
b); ASGN(
b, d);
break;
317 case 4: SWAP(a, c); ASGN(
b, d);
break;
318 case 5: SWAP(
b, c); ASGN(a, d);
break;
320 MFEM_ABORT(
"Invalid transform.");
329 for (
int i = 0; i < 4; i++)
337 #ifdef MFEM_USE_MEMALLOC
void Init(int ind1, int ind2, int ind3, int ind4, int attr=1, int ref_flag=0)
Initialize the vertex indices and the attribute of a Tetrahedron.
Data type dense matrix using column-major storage.
virtual void SetVertices(const int *ind)
Set the vertices according to the given input.
virtual Element * Duplicate(Mesh *m) const
double f(const Vector &xvec)
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
void CreateRefinementFlag(int refinement_edges[2], int type, int flag=0)
Data type tetrahedron element.
void Swap(Array< T > &, Array< T > &)
int attribute
Element's attribute (specifying material property, etc).
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
virtual int * GetVertices()
virtual int NeedRefinement(HashTable< Hashed2 > &v_to_v) const
Return 1 if the element needs refinement in order to get conforming mesh.
static void GetPointMatrix(unsigned transform, DenseMatrix &pm)
Calculate point matrix corresponding to a chain of transformations.
void SetAttribute(const int attr)
Set element's attribute.
void GetMarkedFace(const int face, int *fv)
MemAlloc< Tetrahedron, 1024 > TetMemory
void SetRefinementFlag(int rf)
void ParseRefinementFlag(int refinement_edges[2], int &type, int &flag)
int FindId(int p1, int p2) const
Find id of item whose parents are p1, p2... Return -1 if it doesn't exist.
virtual void MarkEdge(const DSTable &v_to_v, const int *length)
Abstract data type element.