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;
147 case 1: fv[0] = tv[1]; fv[1] = tv[2]; fv[2] = tv[3];
break;
148 case 4: fv[0] = tv[3]; fv[1] = tv[1]; fv[2] = tv[2];
break;
149 case 5: fv[0] = tv[2]; fv[1] = tv[3]; fv[2] = tv[1];
break;
155 case 2: fv[0] = tv[2]; fv[1] = tv[0]; fv[2] = tv[3];
break;
156 case 3: fv[0] = tv[0]; fv[1] = tv[3]; fv[2] = tv[2];
break;
157 case 5: fv[0] = tv[3]; fv[1] = tv[2]; fv[2] = tv[0];
break;
161 fv[0] = tv[0]; fv[1] = tv[1]; fv[2] = tv[3];
164 fv[0] = tv[1]; fv[1] = tv[0]; fv[2] = tv[2];
182 for (
int i = 0; i < 4; i++)
190 int ind[4], i, j, l, L, type;
194 if ((l = length[v_to_v(
indices[1],
indices[2])]) > L) { L = l; j = 1; }
195 if ((l = length[v_to_v(
indices[2],
indices[0])]) > L) { L = l; j = 2; }
196 if ((l = length[v_to_v(
indices[0],
indices[3])]) > L) { L = l; j = 3; }
197 if ((l = length[v_to_v(
indices[1],
indices[3])]) > L) { L = l; j = 4; }
200 for (i = 0; i < 4; i++)
231 ind[0] = 2; ind[1] = 1;
233 if ((l = length[v_to_v(
indices[0],
indices[3])]) > L) { L = l; ind[0] = 3; }
234 if ((l = length[v_to_v(
indices[2],
indices[3])]) > L) { ind[0] = 5; }
237 if ((l = length[v_to_v(
indices[1],
indices[3])]) > L) { L = l; ind[1] = 4; }
238 if ((l = length[v_to_v(
indices[2],
indices[3])]) > L) { ind[1] = 5; }
257 j = 1; ind[0] = 2; ind[1] = 1;
break;
260 j = 1; ind[0] = 5; ind[1] = 1;
269 j = 1; ind[0] = 2; ind[1] = 5;
break;
287 real_t *
a = &pm(0,0), *
b = &pm(0,1), *c = &pm(0,2), *d = &pm(0,3);
290 a[0] = 0.0,
a[1] = 0.0,
a[2] = 0.0;
291 b[0] = 1.0,
b[1] = 0.0,
b[2] = 0.0;
292 c[0] = 0.0, c[1] = 1.0, c[2] = 0.0;
293 d[0] = 0.0, d[1] = 0.0, d[2] = 1.0;
295 int chain[12], n = 0;
306#define ASGN(a, b) (a[0] = b[0], a[1] = b[1], a[2] = b[2])
307#define SWAP(a, b) for (int i = 0; i < 3; i++) { std::swap(a[i], b[i]); }
308#define AVG(a, b, c) for (int i = 0; i < 3; i++) { a[i] = (b[i]+c[i])*0.5; }
314 case 0: ASGN(
b, c); ASGN(c, d);
break;
315 case 1: ASGN(
a, c); ASGN(c, d);
break;
316 case 2: ASGN(
b,
a); ASGN(
a, d);
break;
317 case 3: ASGN(
a,
b); ASGN(
b, d);
break;
318 case 4: SWAP(
a, c); ASGN(
b, d);
break;
319 case 5: SWAP(
b, c); ASGN(
a, d);
break;
321 MFEM_ABORT(
"Invalid transform.");
335 MFEM_ASSERT(v.
Size() == 4,
"!");
341#ifdef MFEM_USE_MEMALLOC
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
T * end()
STL-like end. Returns pointer after the last element of the array.
T * begin()
STL-like begin. Returns pointer to the first element of the array.
Data type dense matrix using column-major storage.
Abstract data type element.
int attribute
Element's attribute (specifying material property, etc).
void SetAttribute(const int attr)
Set element's attribute.
int FindId(int p1, int p2) const
Find id of item whose parents are p1, p2... Return -1 if it doesn't exist.
MemAlloc< Tetrahedron, 1024 > TetMemory
Data type tetrahedron element.
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.
int NeedRefinement(HashTable< Hashed2 > &v_to_v) const override
Return 1 if the element needs refinement in order to get conforming mesh.
void ParseRefinementFlag(int refinement_edges[2], int &type, int &flag) const
int * GetVertices() override
Element * Duplicate(Mesh *m) const override
void SetRefinementFlag(int rf)
void SetVertices(const Array< int > &v) override
Set the indices defining the vertices.
static void GetPointMatrix(unsigned transform, DenseMatrix &pm)
Calculate point matrix corresponding to a chain of transformations.
void MarkEdge(const DSTable &v_to_v, const int *length) override
void GetMarkedFace(const int face, int *fv) const
void CreateRefinementFlag(int refinement_edges[2], int type, int flag=0)
void Swap(Array< T > &, Array< T > &)
void mfem_error(const char *msg)
std::function< real_t(const Vector &)> f(real_t mass_coeff)