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"
35#ifdef LIBMESH_ENABLE_AMR
102 const unsigned int s)
const
104 libmesh_assert_less (s,
n_sides());
113 libmesh_assert_less(s,
n_sides());
171 std::array<Real, 4> vertex_vals;
172 unsigned int ctr = 0;
173 for (
unsigned int i=0; i<2; ++i)
174 for (
unsigned int j=0; j<2; ++j)
175 vertex_vals[ctr++] = n * (v1 +
Real(i)*v2 +
Real(j)*v3);
183 auto result = std::minmax_element(vertex_vals.begin(), vertex_vals.end());
184 Real min_vertex = *(result.first);
185 Real max_vertex = *(result.second);
192 return ((max_vertex > 0 && min_vertex > 0) || (max_vertex < 0 && min_vertex < 0));
206 return this->simple_build_side_ptr<Edge2, Quad4>(i);
212 const unsigned int i)
214 this->simple_build_side_ptr<Quad4>(side, i,
EDGE2);
221 std::vector<dof_id_type> & conn)
const
250 libmesh_error_msg(
"Unsupported IO package " << iop);
271 a1 = x0 - x1 + x2 - x3,
272 b1 = -x0 + x1 + x2 - x3,
274 b2 = -x0 - x1 + x2 + x3;
280 const Real q[2] = {-std::sqrt(
Real(3))/3, std::sqrt(
Real(3))/3.};
285 for (
const auto & xi : q)
286 for (
const auto & eta : q)
290 A0 += jxw * (1-xi) * (1-eta);
291 A1 += jxw * (1+xi) * (1-eta);
292 A2 += jxw * (1+xi) * (1+eta);
293 A3 += jxw * (1-xi) * (1+eta);
298 x0(1)*
A0 + x1(1)*
A1 + x2(1)*
A2 + x3(1)*
A3,
323 a1 = x0/4 - x1/4 + x2/4 - x3/4,
324 b1 = -x0/4 + x1/4 + x2/4 - x3/4,
326 b2 = -x0/4 - x1/4 + x2/4 + x3/4;
330 return 4. * b1.
cross(b2).norm();
336 const Real q[2] = {-std::sqrt(
Real(3))/3, std::sqrt(
Real(3))/3.};
339 for (
unsigned int i=0; i<2; ++i)
340 for (
unsigned int j=0; j<2; ++j)
356 libmesh_assert_less (perm_num, 4);
358 for (
unsigned int i = 0; i != perm_num; ++i)
380 libmesh_assert_less (s, 4);
388 libmesh_assert_less (s, 4);
398 const int incr = (i == 0) ? -1 : 1;
399 const unsigned int other_side = (s + incr) % 4;
402 const auto sign = (incr < 0) ? -1 : 1;
403 const Point normal_at_vertex = sign * side_t.
cross(other_side_t);
404 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.
static constexpr unsigned int side_nodes_map[num_sides][nodes_per_side]
This maps the node of the side to element node numbers.
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
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
virtual unsigned int n_sides() const override final
TypeVector< typename CompareTypes< T, T2 >::supertype > cross(const TypeVector< T2 > &v) const
LIBMESH_DEVICE_INLINE TypeVector< T > unit() const
bool relative_fuzzy_equals(const TypeVector< T > &rhs, Real tol=TOLERANCE) const
The libMesh namespace provides an interface to certain functionality in the library.
LIBMESH_DEVICE_INLINE T cross_norm(const TypeVector< T > &b, const TypeVector< T > &c)
Calls cross_norm_sq() and takes the square root of the result.
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...
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...