20 #include "libmesh/cell_hex8.h" 21 #include "libmesh/edge_edge2.h" 22 #include "libmesh/face_quad4.h" 23 #include "libmesh/enum_io_package.h" 24 #include "libmesh/enum_order.h" 25 #include "libmesh/fe_lagrange_shape_1D.h" 88 const unsigned int s)
const 90 libmesh_assert_less (s,
n_sides());
99 libmesh_assert_less(s,
n_sides());
103 std::vector<unsigned>
106 libmesh_assert_less(e,
n_edges());
111 const unsigned int e)
const 113 libmesh_assert_less (e,
n_edges());
148 return this->simple_build_side_ptr<Quad4, Hex8>(i);
154 const unsigned int i)
156 this->simple_build_side_ptr<Hex8>(side, i,
QUAD4);
163 return this->simple_build_edge_ptr<Edge2,Hex8>(i);
170 this->simple_build_edge_ptr<Hex8>(edge, i,
EDGE2);
177 std::vector<dof_id_type> & conn)
const 208 libmesh_error_msg(
"Unsupported IO package " << iop);
214 #ifdef LIBMESH_ENABLE_AMR 227 { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
228 { 0.5, 0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
229 { .25, .25, .25, .25, 0.0, 0.0, 0.0, 0.0},
230 { 0.5, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0},
231 { 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0},
232 { .25, .25, 0.0, 0.0, .25, .25, 0.0, 0.0},
233 {.125, .125, .125, .125, .125, .125, .125, .125},
234 { .25, 0.0, 0.0, .25, .25, 0.0, 0.0, .25}
240 { 0.5, 0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
241 { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
242 { 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 0.0, 0.0},
243 { .25, .25, .25, .25, 0.0, 0.0, 0.0, 0.0},
244 { .25, .25, 0.0, 0.0, .25, .25, 0.0, 0.0},
245 { 0.0, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0},
246 { 0.0, .25, .25, 0.0, 0.0, .25, .25, 0.0},
247 {.125, .125, .125, .125, .125, .125, .125, .125}
253 { 0.5, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0},
254 { .25, .25, .25, .25, 0.0, 0.0, 0.0, 0.0},
255 { 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 0.0},
256 { 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
257 { .25, 0.0, 0.0, .25, .25, 0.0, 0.0, .25},
258 {.125, .125, .125, .125, .125, .125, .125, .125},
259 { 0.0, 0.0, .25, .25, 0.0, 0.0, .25, .25},
260 { 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5}
266 { .25, .25, .25, .25, 0.0, 0.0, 0.0, 0.0},
267 { 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 0.0, 0.0},
268 { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
269 { 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 0.0},
270 {.125, .125, .125, .125, .125, .125, .125, .125},
271 { 0.0, .25, .25, 0.0, 0.0, .25, .25, 0.0},
272 { 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0},
273 { 0.0, 0.0, .25, .25, 0.0, 0.0, .25, .25}
279 { 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0},
280 { .25, .25, 0.0, 0.0, .25, .25, 0.0, 0.0},
281 {.125, .125, .125, .125, .125, .125, .125, .125},
282 { .25, 0.0, 0.0, .25, .25, 0.0, 0.0, .25},
283 { 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
284 { 0.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0},
285 { 0.0, 0.0, 0.0, 0.0, .25, .25, .25, .25},
286 { 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.5}
292 { .25, .25, 0.0, 0.0, .25, .25, 0.0, 0.0},
293 { 0.0, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0},
294 { 0.0, .25, .25, 0.0, 0.0, .25, .25, 0.0},
295 {.125, .125, .125, .125, .125, .125, .125, .125},
296 { 0.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0},
297 { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
298 { 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.0},
299 { 0.0, 0.0, 0.0, 0.0, .25, .25, .25, .25}
305 { .25, 0.0, 0.0, .25, .25, 0.0, 0.0, .25},
306 {.125, .125, .125, .125, .125, .125, .125, .125},
307 { 0.0, 0.0, .25, .25, 0.0, 0.0, .25, .25},
308 { 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5},
309 { 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.5},
310 { 0.0, 0.0, 0.0, 0.0, .25, .25, .25, .25},
311 { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5},
312 { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0}
318 {.125, .125, .125, .125, .125, .125, .125, .125},
319 { 0.0, .25, .25, 0.0, 0.0, .25, .25, 0.0},
320 { 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0},
321 { 0.0, 0.0, .25, .25, 0.0, 0.0, .25, .25},
322 { 0.0, 0.0, 0.0, 0.0, .25, .25, .25, .25},
323 { 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.0},
324 { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
325 { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5}
351 a1 = -x0 + x1 - x2 + x3 + x4 - x5 + x6 - x7,
356 b1 = x0 - x1 + x2 - x3 + x4 - x5 + x6 - x7,
358 b3 = x0 - x1 - x2 + x3 - x4 + x5 + x6 - x7;
362 c2 = x0 + x1 - x2 - x3 - x4 - x5 + x6 + x7,
366 d1 = -x0 + x1 + x2 - x3 - x4 + x5 + x6 - x7,
367 d2 = -x0 - x1 + x2 + x3 - x4 - x5 + x6 + x7,
368 d3 = -x0 - x1 - x2 - x3 + x4 + x5 + x6 + x7;
374 static const Real q[2] = {-std::sqrt(
Real(3))/3, std::sqrt(
Real(3))/3.};
378 static const unsigned int i0[] = {0, 1, 1, 0, 0, 1, 1, 0};
379 static const unsigned int i1[] = {0, 0, 1, 1, 0, 0, 1, 1};
380 static const unsigned int i2[] = {0, 0, 0, 0, 1, 1, 1, 1};
383 std::array<Real, Hex8::num_nodes> V{};
385 for (
const auto & xi : q)
386 for (
const auto & eta : q)
387 for (
const auto & zeta : q)
390 a2*xi*zeta + b2*xi + c2*zeta + d2,
391 a3*xi*eta + b3*xi + c3*eta + d3);
402 (x0*V[0] + x1*V[1] + x2*V[2] + x3*V[3] + x4*V[4] + x5*V[5] + x6*V[6] + x7*V[7]) /
403 (V[0] + V[1] + V[2] + V[3] + V[4] + V[5] + V[6] + V[7]);
432 x0 - x1 + x2 - x3 + x4 - x5 + x6 - x7,
433 x0 - x1 - x2 + x3 - x4 + x5 + x6 - x7,
434 -x0 + x1 + x2 - x3 - x4 + x5 + x6 - x7,
435 x0 + x1 - x2 - x3 - x4 - x5 + x6 + x7,
436 -x0 - x1 + x2 + x3 - x4 - x5 + x6 + x7,
437 -x0 - x1 - x2 - x3 + x4 + x5 + x6 + x7
459 libmesh_assert_less (perm_num, 24);
460 const unsigned int side = perm_num % 6;
461 const unsigned int rotate = perm_num / 6;
463 for (
unsigned int i = 0; i !=
rotate; ++i)
528 libmesh_assert_less (s, 6);
static const int num_nodes
Geometric constants for Hex8.
virtual std::vector< unsigned int > nodes_on_side(const unsigned int s) const override
virtual std::unique_ptr< Elem > build_edge_ptr(const unsigned int i) override
Builds a EDGE2 built coincident with edge i.
ElemType
Defines an enum for geometric element types.
void swap2boundaryedges(unsigned short e1, unsigned short e2, BoundaryInfo *boundary_info) const
Swaps two edges in boundary_info, if it is non-null.
virtual std::unique_ptr< Elem > build_side_ptr(const unsigned int i) override
Builds a QUAD4 built coincident with face i.
Order
defines an enum for polynomial orders.
Node ** _nodes
Pointers to the nodes we are connected to.
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
virtual void connectivity(const unsigned int sc, const IOPackage iop, std::vector< dof_id_type > &conn) const override
IOPackage
libMesh interfaces with several different software packages for the purposes of creating, reading, and writing mesh files.
virtual BoundingBox loose_bounding_box() const
virtual Real volume() const override
A specialization for computing the area of a hexahedron with flat sides.
virtual std::vector< unsigned int > nodes_on_edge(const unsigned int e) const override
void swap2boundarysides(unsigned short s1, unsigned short s2, BoundaryInfo *boundary_info) const
Swaps two sides in boundary_info, if it is non-null.
The libMesh namespace provides an interface to certain functionality in the library.
virtual unsigned int n_sub_elem() const override
static const unsigned int side_nodes_map[num_sides][nodes_per_side]
This maps the node of the side to element node numbers.
static const Real _embedding_matrix[num_children][num_nodes][num_nodes]
Matrix that computes new nodal locations/solution values from current nodes/solution.
ElemType side_type(const unsigned int s) const override final
virtual Order default_order() const override
T triple_product(const TypeVector< T > &a, const TypeVector< T > &b, const TypeVector< T > &c)
void swap4nodes(unsigned int n1, unsigned int n2, unsigned int n3, unsigned int n4)
Swaps four node_ptrs, "rotating" them.
void swap2nodes(unsigned int n1, unsigned int n2)
Swaps two node_ptrs.
static const int num_edges
static const int num_children
static const unsigned int edge_nodes_map[num_edges][nodes_per_edge]
This maps the node of the edge to element node numbers.
The BoundaryInfo class contains information relevant to boundary conditions including storing faces...
static const int nodes_per_edge
virtual void permute(unsigned int perm_num) override final
Permutes the element (by swapping node and neighbor pointers) according to the specified index...
static constexpr Real affine_tol
Default tolerance to use in has_affine_map().
virtual bool is_node_on_side(const unsigned int n, const unsigned int s) const override
virtual bool has_affine_map() const override
virtual unsigned int n_edges() const override final
virtual bool is_face(const unsigned int i) const override
virtual Point true_centroid() const override
We compute the centroid of the Hex using a customized numerical quadrature approach that avoids unnec...
void swap2neighbors(unsigned int n1, unsigned int n2)
Swaps two neighbor_ptrs.
static const int nodes_per_side
Defines a Cartesian bounding box by the two corner extremum.
virtual void flip(BoundaryInfo *) override final
Flips the element (by swapping node and neighbor pointers) to have a mapping Jacobian of opposite sig...
virtual bool is_edge(const unsigned int i) const override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual bool is_node_on_edge(const unsigned int n, const unsigned int e) const override
virtual unsigned int n_sides() const override final
void swap4neighbors(unsigned int n1, unsigned int n2, unsigned int n3, unsigned int n4)
Swaps four neighbor_ptrs, "rotating" them.
virtual BoundingBox loose_bounding_box() const override
Builds a bounding box out of the nodal positions.
static const int num_sides
Geometric constants for all Hexes.
static Point centroid_from_points(const Point &x0, const Point &x1, const Point &x2, const Point &x3, const Point &x4, const Point &x5, const Point &x6, const Point &x7)
Class static helper function that computes the centroid of a hexahedral region from a set of input po...
virtual bool is_vertex(const unsigned int i) const override
A Point defines a location in LIBMESH_DIM dimensional Real space.
dof_id_type node_id(const unsigned int i) const
const Point & point(const unsigned int i) const
bool relative_fuzzy_equals(const TypeVector< T > &rhs, Real tol=TOLERANCE) const
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Real fe_lagrange_1D_linear_shape(const unsigned int i, const Real xi)