19#include "libmesh/edge_edge2.h"
20#include "libmesh/face_quad4.h"
21#include "libmesh/enum_io_package.h"
22#include "libmesh/enum_order.h"
43#ifdef LIBMESH_ENABLE_AMR
110 const unsigned int s)
const
112 libmesh_assert_less (s,
n_sides());
121 libmesh_assert_less(s,
n_sides());
179 std::array<Real, 4> vertex_vals;
180 unsigned int ctr = 0;
181 for (
unsigned int i=0; i<2; ++i)
182 for (
unsigned int j=0; j<2; ++j)
183 vertex_vals[ctr++] = n * (v1 +
Real(i)*v2 +
Real(j)*v3);
191 auto result = std::minmax_element(vertex_vals.begin(), vertex_vals.end());
192 Real min_vertex = *(result.first);
193 Real max_vertex = *(result.second);
200 return ((max_vertex > 0 && min_vertex > 0) || (max_vertex < 0 && min_vertex < 0));
214 return this->simple_build_side_ptr<Edge2, Quad4>(i);
220 const unsigned int i)
222 this->simple_build_side_ptr<Quad4>(side, i,
EDGE2);
229 std::vector<dof_id_type> & conn)
const
258 libmesh_error_msg(
"Unsupported IO package " << iop);
279 a1 = x0 - x1 + x2 - x3,
280 b1 = -x0 + x1 + x2 - x3,
282 b2 = -x0 - x1 + x2 + x3;
288 const Real q[2] = {-std::sqrt(
Real(3))/3, std::sqrt(
Real(3))/3.};
293 for (
const auto & xi : q)
294 for (
const auto & eta : q)
298 A0 += jxw * (1-xi) * (1-eta);
299 A1 += jxw * (1+xi) * (1-eta);
300 A2 += jxw * (1+xi) * (1+eta);
301 A3 += jxw * (1-xi) * (1+eta);
306 x0(1)*
A0 + x1(1)*
A1 + x2(1)*
A2 + x3(1)*
A3,
331 a1 = x0/4 - x1/4 + x2/4 - x3/4,
332 b1 = -x0/4 + x1/4 + x2/4 - x3/4,
334 b2 = -x0/4 - x1/4 + x2/4 + x3/4;
338 return 4. * b1.
cross(b2).norm();
344 const Real q[2] = {-std::sqrt(
Real(3))/3, std::sqrt(
Real(3))/3.};
347 for (
unsigned int i=0; i<2; ++i)
348 for (
unsigned int j=0; j<2; ++j)
364 libmesh_assert_less (perm_num, 4);
366 for (
unsigned int i = 0; i != perm_num; ++i)
388 libmesh_assert_less (s, 4);
396 libmesh_assert_less (s, 4);
406 const int incr = (i == 0) ? -1 : 1;
407 const unsigned int other_side = (s + incr) % 4;
410 const auto sign = (incr < 0) ? -1 : 1;
411 const Point normal_at_vertex = sign * side_t.
cross(other_side_t);
412 normal += normal_at_vertex;
The BoundaryInfo class contains information relevant to boundary conditions including storing faces,...
Defines a Cartesian bounding box by the two corner extremum.
void swap4nodes(unsigned int n1, unsigned int n2, unsigned int n3, unsigned int n4)
Swaps four node_ptrs, "rotating" them.
virtual BoundingBox loose_bounding_box() const
static constexpr Real affine_tol
Default tolerance to use in has_affine_map().
const Point & point(const unsigned int i) const
void swap2nodes(unsigned int n1, unsigned int n2)
Swaps two node_ptrs.
void swap2neighbors(unsigned int n1, unsigned int n2)
Swaps two neighbor_ptrs.
void swap2boundarysides(unsigned short s1, unsigned short s2, BoundaryInfo *boundary_info) const
Swaps two sides in boundary_info, if it is non-null.
ElemMappingType mapping_type() const
virtual Real volume() const
void swap2boundaryedges(unsigned short e1, unsigned short e2, BoundaryInfo *boundary_info) const
Swaps two edges in boundary_info, if it is non-null.
dof_id_type node_id(const unsigned int i) const
void swap4neighbors(unsigned int n1, unsigned int n2, unsigned int n3, unsigned int n4)
Swaps four neighbor_ptrs, "rotating" them.
A Point defines a location in LIBMESH_DIM dimensional Real space.
virtual Point side_vertex_average_normal(const unsigned int s) const override final
virtual BoundingBox loose_bounding_box() const override
Builds a bounding box out of the nodal positions.
virtual Order default_order() const override
virtual bool is_edge(const unsigned int i) const override
virtual std::unique_ptr< Elem > build_side_ptr(const unsigned int i) override
virtual std::vector< unsigned int > nodes_on_side(const unsigned int s) const override
static const Real _embedding_matrix[num_children][num_nodes][num_nodes]
Matrix that computes new nodal locations/solution values from current nodes/solution.
virtual unsigned int n_sub_elem() const override
virtual bool has_invertible_map(Real tol) const override
virtual void flip(BoundaryInfo *) override final
Flips the element (by swapping node and neighbor pointers) to have a mapping Jacobian of opposite sig...
static const int num_nodes
Geometric constants for Quad4.
virtual bool is_vertex(const unsigned int i) const override
ElemType side_type(const unsigned int s) const override final
static const unsigned int side_nodes_map[num_sides][nodes_per_side]
This maps the node of the side to element node numbers.
virtual bool is_face(const unsigned int i) const override
virtual std::vector< unsigned int > nodes_on_edge(const unsigned int e) const override
virtual void connectivity(const unsigned int sf, const IOPackage iop, std::vector< dof_id_type > &conn) const override
static const int nodes_per_side
virtual void permute(unsigned int perm_num) override final
Permutes the element (by swapping node and neighbor pointers) according to the specified index.
virtual bool has_affine_map() const override
virtual bool is_node_on_side(const unsigned int n, const unsigned int s) const override
virtual Point true_centroid() const override
An optimized method for computing the centroid of a 4-node quad with straight sides.
virtual Real volume() const override
An optimized method for computing the area of a 4-node quad with straight sides, but not necessarily ...
static const int num_children
static const int num_sides
Geometric constants for Quad4.
virtual unsigned int n_sides() const override final
TypeVector< typename CompareTypes< T, T2 >::supertype > cross(const TypeVector< T2 > &v) const
bool relative_fuzzy_equals(const TypeVector< T > &rhs, Real tol=TOLERANCE) const
TypeVector< T > unit() const
The libMesh namespace provides an interface to certain functionality in the library.
IOPackage
libMesh interfaces with several different software packages for the purposes of creating,...
ElemType
Defines an enum for geometric element types.
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
T cross_norm(const TypeVector< T > &b, const TypeVector< T > &c)
Calls cross_norm_sq() and takes the square root of the result.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...