libMesh
cell_c0polyhedron.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2026 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_FACE_C0POLYHEDRON_H
21 #define LIBMESH_FACE_C0POLYHEDRON_H
22 
23 // Local includes
24 #include "libmesh/libmesh_common.h"
25 #include "libmesh/cell_polyhedron.h"
26 #include "libmesh/enum_order.h"
27 
28 namespace libMesh
29 {
30 
31 class Node;
32 
47 class C0Polyhedron : public Polyhedron
48 {
49 public:
50 
66  explicit
67  C0Polyhedron (const std::vector<std::shared_ptr<Polygon>> & sides,
68  std::unique_ptr<Node> & mid_elem_node,
69  Elem * p=nullptr);
70 
71  C0Polyhedron (C0Polyhedron &&) = delete;
72  C0Polyhedron (const C0Polyhedron &) = delete;
73  C0Polyhedron & operator= (const C0Polyhedron &) = delete;
74  C0Polyhedron & operator= (C0Polyhedron &&) = delete;
75  virtual ~C0Polyhedron();
76 
87  std::unique_ptr<Elem> disconnected_clone() const override;
88 
92  virtual ElemType type () const override final { return C0POLYHEDRON; }
93 
98  virtual unsigned int n_vertices() const override final;
99 
104  virtual unsigned int n_sub_elem() const override
105  { return this->n_subelements(); }
106 
110  virtual bool is_vertex(const unsigned int i) const override;
111 
115  virtual bool is_edge(const unsigned int i) const override;
116 
120  virtual bool is_face(const unsigned int i) const override;
121 
126  virtual bool is_node_on_side(const unsigned int n,
127  const unsigned int s) const override;
128 
129  virtual std::vector<unsigned int> nodes_on_side(const unsigned int s) const override;
130 
131  virtual std::vector<unsigned int> nodes_on_edge(const unsigned int e) const override;
132 
137  virtual bool is_node_on_edge(const unsigned int n,
138  const unsigned int e) const override;
139 
140  virtual std::vector<unsigned int> edges_adjacent_to_node(const unsigned int n) const override;
141 
147  virtual bool has_affine_map () const override { return false; }
148 
152  virtual Order default_order() const override { return FIRST; }
153 
157  using Elem::key;
158 
159  virtual void connectivity(const unsigned int sf,
160  const IOPackage iop,
161  std::vector<dof_id_type> & conn) const override;
162 
166  virtual std::pair<unsigned short int, unsigned short int>
167  second_order_child_vertex (const unsigned int n) const override;
168 
172  virtual Real volume () const override;
173 
177  virtual Point true_centroid () const override;
178 
179  ElemType side_type (const unsigned int s) const override final;
180 
181  Point side_vertex_average_normal(const unsigned int s) const override final;
182 
193  virtual std::array<int, 4> subelement_sides_to_poly_sides(unsigned int i) const;
194 
199  virtual void retriangulate() override final;
200 
201 protected:
202 
206  void add_tet(int n1, int n2, int n3, int n4);
207 
208 #ifdef LIBMESH_ENABLE_AMR
209 
213  virtual Real embedding_matrix (const unsigned int /*i*/,
214  const unsigned int /*j*/,
215  const unsigned int /*k*/) const override
216  { libmesh_not_implemented(); return 0; }
217 
218 #endif // LIBMESH_ENABLE_AMR
219 
224 };
225 
226 
227 } // namespace libMesh
228 
229 #endif // LIBMESH_FACE_C0POLYHEDRON_H
ElemType
Defines an enum for geometric element types.
virtual bool is_node_on_edge(const unsigned int n, const unsigned int e) const override
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
virtual unsigned int n_vertices() const override final
ElemType side_type(const unsigned int s) const override final
The Polyhedron is an element in 3D with an arbitrary number of polygonal faces.
virtual dof_id_type key() const
Definition: elem.C:738
virtual std::vector< unsigned int > edges_adjacent_to_node(const unsigned int n) const override
IOPackage
libMesh interfaces with several different software packages for the purposes of creating, reading, and writing mesh files.
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
virtual void retriangulate() override final
Create a triangulation (tetrahedralization) based on the current sides&#39; triangulations.
C0Polyhedron(const std::vector< std::shared_ptr< Polygon >> &sides, std::unique_ptr< Node > &mid_elem_node, Elem *p=nullptr)
Constructor.
C0Polyhedron & operator=(const C0Polyhedron &)=delete
The libMesh namespace provides an interface to certain functionality in the library.
virtual Point true_centroid() const override
An optimized method for calculating the centroid of a C0Polyhedron.
Point side_vertex_average_normal(const unsigned int s) const override final
virtual unsigned int n_sub_elem() const override
virtual Real volume() const override
An optimized method for calculating the area of a C0Polyhedron.
virtual bool is_vertex(const unsigned int i) const override
unsigned int n_subelements() const
bool _has_mid_elem_node
Whether we have a mid element node.
virtual bool has_affine_map() const override
virtual Real embedding_matrix(const unsigned int, const unsigned int, const unsigned int) const override
Matrix used to create the elements children.
virtual bool is_node_on_side(const unsigned int n, const unsigned int s) const override
virtual std::vector< unsigned int > nodes_on_side(const unsigned int s) const override
virtual ElemType type() const override final
std::unique_ptr< Elem > disconnected_clone() const override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual bool is_face(const unsigned int i) const override
virtual std::array< int, 4 > subelement_sides_to_poly_sides(unsigned int i) const
void add_tet(int n1, int n2, int n3, int n4)
Add to our triangulation (tetrahedralization).
The C0Polyhedron is an element in 3D with an arbitrary (but fixed) number of polygonal first-order (C...
virtual bool is_edge(const unsigned int i) const override
virtual void connectivity(const unsigned int sf, const IOPackage iop, std::vector< dof_id_type > &conn) const override
virtual Order default_order() const override
virtual std::vector< unsigned int > nodes_on_edge(const unsigned int e) const override
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39
virtual std::pair< unsigned short int, unsigned short int > second_order_child_vertex(const unsigned int n) const override
Element refinement is not implemented for polyhedra.