libMesh
node_elem.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2025 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_NODE_ELEM_H
21 #define LIBMESH_NODE_ELEM_H
22 
23 // Local includes
24 #include "libmesh/elem.h"
25 
26 namespace libMesh
27 {
28 
37 class NodeElem : public Elem
38 {
39 public:
40 
44  explicit
45  NodeElem (Elem * p=nullptr) :
48  {
49  // Make sure the interior parent isn't undefined
50  if (LIBMESH_DIM > 0)
51  this->set_interior_parent(nullptr);
52  }
53 
54  NodeElem (NodeElem &&) = delete;
55  NodeElem (const NodeElem &) = delete;
56  NodeElem & operator= (const NodeElem &) = delete;
57  NodeElem & operator= (NodeElem &&) = delete;
58  virtual ~NodeElem() = default;
59 
63  static const int num_nodes = 1;
64  static const int num_sides = 0;
65 
70  virtual Point master_point (const unsigned int libmesh_dbg_var(i)) const override
71  {
72  libmesh_assert_equal_to (i, 0);
73  return Point(0,0,0);
74  }
75 
79  virtual unsigned short dim () const override { return 0; }
80 
84  virtual unsigned int n_nodes() const override { return 1; }
85 
89  virtual unsigned int n_sides() const override { return 0; }
90 
94  virtual unsigned int n_vertices() const override { return 1; }
95 
99  virtual unsigned int n_edges() const override { return 0; }
100 
104  virtual unsigned int n_faces() const override { return 0; }
105 
109  virtual unsigned int n_children() const override { return 1; }
110 
114  using Elem::key;
115 
120  virtual dof_id_type key (const unsigned int) const override
121  { libmesh_error_msg("Calling NodeElem::key(side) does not make sense."); return 0; }
122 
127  virtual dof_id_type low_order_key (const unsigned int) const override
128  { libmesh_error_msg("Calling NodeElem::low_order_key(side) does not make sense."); return 0; }
129 
133  virtual unsigned int local_side_node(unsigned int /*side*/,
134  unsigned int /*side_node*/) const override
135  { libmesh_error_msg("Calling NodeElem::local_side_node() does not make sense."); return 0; }
136 
140  virtual unsigned int local_edge_node(unsigned int /*edge*/,
141  unsigned int /*edge_node*/) const override
142  { libmesh_error_msg("Calling NodeElem::local_edge_node() does not make sense."); return 0; }
143 
147  virtual std::unique_ptr<Elem> side_ptr (const unsigned int) override
148  { libmesh_not_implemented(); return std::unique_ptr<Elem>(); }
149 
150  virtual void side_ptr (std::unique_ptr<Elem> &, const unsigned int) override
151  { libmesh_not_implemented(); }
152 
156  virtual std::unique_ptr<Elem> build_side_ptr (const unsigned int) override
157  { libmesh_not_implemented(); return std::unique_ptr<Elem>(); }
158 
159  virtual void build_side_ptr (std::unique_ptr<Elem> &, const unsigned int) override
160  { libmesh_not_implemented(); }
161 
162  // Avoid hiding deprecated version with different signature
163  using Elem::build_side_ptr;
164 
168  virtual std::unique_ptr<Elem> build_edge_ptr (const unsigned int) override
169  { libmesh_not_implemented(); return std::unique_ptr<Elem>(); }
170 
174  virtual void build_edge_ptr (std::unique_ptr<Elem> &, const unsigned int) override
175  { libmesh_not_implemented(); }
176 
180  virtual unsigned int n_sub_elem() const override { return 1; }
181 
185  virtual bool is_vertex(const unsigned int libmesh_dbg_var(n)) const override
186  { libmesh_assert_not_equal_to (n, invalid_uint); return true; }
187 
191  virtual bool is_edge(const unsigned int) const override { return false; }
192  virtual bool is_face(const unsigned int) const override { return false; }
193 
194  virtual bool is_child_on_side(const unsigned int,
195  const unsigned int) const override
196  { libmesh_not_implemented(); return false; }
197 
198  virtual bool is_node_on_side(const unsigned int,
199  const unsigned int) const override
200  { libmesh_not_implemented(); return false; }
201 
202  virtual std::vector<unsigned int> nodes_on_side(const unsigned int) const override
203  {
204  libmesh_not_implemented();
205  return {0};
206  }
207 
208  virtual std::vector<unsigned int> nodes_on_edge(const unsigned int) const override
209  {
210  libmesh_not_implemented();
211  return {0};
212  }
213 
214  virtual std::vector<unsigned int> edges_adjacent_to_node(const unsigned int) const override
215  {
216  return {};
217  }
218 
219  virtual std::vector<unsigned int> sides_on_edge(const unsigned int) const override
220  {
221  libmesh_not_implemented();
222  return {0};
223  }
224 
225  virtual bool is_node_on_edge(const unsigned int,
226  const unsigned int) const override
227  { libmesh_not_implemented(); return false; }
228 
229  virtual bool is_edge_on_side(const unsigned int,
230  const unsigned int) const override
231  { libmesh_not_implemented(); return false; }
232 
239  virtual Point quasicircumcenter () const override
240  { return this->point(0); }
241 
246  virtual bool has_affine_map () const override { return true; }
247 
251  virtual bool has_invertible_map(Real /*tol*/) const override { return true; }
252 
257  virtual bool is_linear () const override { return true; }
258 
262  virtual ElemType type() const override { return NODEELEM; }
263 
267  virtual Order default_order() const override;
268 
272  virtual Order supported_nodal_order() const override;
273 
274  virtual void connectivity(const unsigned int sc,
275  const IOPackage iop,
276  std::vector<dof_id_type> & conn) const override;
277 
278 
279 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
280 
284  virtual bool infinite () const override { return false; }
285 
286 #endif
287 
291  virtual unsigned int n_permutations() const override final { return 0; }
292 
293  virtual void permute(unsigned int) override final { libmesh_error(); }
294 
295  virtual void flip(BoundaryInfo *) override final { return; /* no-op */ }
296  virtual bool is_flipped() const override final { return false; }
297 
298  virtual ElemType side_type (const unsigned int) const override
299  {
300  libmesh_not_implemented();
301  return INVALID_ELEM;
302  }
303 
315  virtual bool contains_point(const Point & p, Real tol) const override;
316 
320  virtual bool close_to_point(const Point & p, Real tol) const override;
321 
322  virtual bool on_reference_element(const Point & p,
323  const Real eps = TOLERANCE) const override final;
324 
325 protected:
326 
330  Elem * _elemlinks_data[1+(LIBMESH_DIM>0)];
331 
336 
337 
338 #ifdef LIBMESH_ENABLE_AMR
339 
343  virtual Real embedding_matrix (const unsigned int i,
344  const unsigned int j,
345  const unsigned int k) const override
346  { return _embedding_matrix[i][j][k]; }
347 
352  static const Real _embedding_matrix[1][1][1];
353 
357  unsigned int side_children_matrix (const unsigned int,
358  const unsigned int) const
359  { libmesh_not_implemented(); return 0; }
360 
362 
363 #endif // LIBMESH_ENABLE_AMR
364 
365 };
366 
367 } // namespace libMesh
368 
369 #endif // LIBMESH_NODE_ELEM_H
static const Real _embedding_matrix[1][1][1]
Matrix that computes new nodal locations/solution values from current nodes/solution.
Definition: node_elem.h:352
virtual unsigned int n_faces() const override
Definition: node_elem.h:104
unsigned int side_children_matrix(const unsigned int, const unsigned int) const
Matrix that allows children to inherit boundary conditions.
Definition: node_elem.h:357
virtual bool close_to_point(const Point &p, Real tol) const override
Definition: node_elem.C:63
ElemType
Defines an enum for geometric element types.
virtual void build_edge_ptr(std::unique_ptr< Elem > &, const unsigned int) override
The Elem::build_edge_ptr() member makes no sense for nodes.
Definition: node_elem.h:174
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
virtual unsigned int n_vertices() const override
Definition: node_elem.h:94
A Node is like a Point, but with more information.
Definition: node.h:52
virtual void side_ptr(std::unique_ptr< Elem > &, const unsigned int) override
Resets the loose element side, which may currently point to a different side than i or even a differe...
Definition: node_elem.h:150
virtual Point master_point(const unsigned int libmesh_dbg_var(i)) const override
Definition: node_elem.h:70
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
Definition: libmesh.h:310
static const int num_sides
Definition: node_elem.h:64
NodeElem & operator=(const NodeElem &)=delete
virtual Order supported_nodal_order() const override
Definition: node_elem.C:44
virtual std::unique_ptr< Elem > build_side_ptr(const unsigned int i)=0
virtual dof_id_type key() const
Definition: elem.C:753
static constexpr Real TOLERANCE
virtual bool is_node_on_edge(const unsigned int, const unsigned int) const override
Definition: node_elem.h:225
virtual bool is_vertex(const unsigned int libmesh_dbg_var(n)) const override
Definition: node_elem.h:185
virtual unsigned int local_edge_node(unsigned int, unsigned int) const override
NodeElems don&#39;t have edges, so they can&#39;t have nodes on edges.
Definition: node_elem.h:140
IOPackage
libMesh interfaces with several different software packages for the purposes of creating, reading, and writing mesh files.
virtual std::vector< unsigned int > edges_adjacent_to_node(const unsigned int) const override
Definition: node_elem.h:214
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
virtual void build_side_ptr(std::unique_ptr< Elem > &, const unsigned int) override
Resets the loose element side, which may currently point to a different side than i or even a differe...
Definition: node_elem.h:159
virtual dof_id_type low_order_key(const unsigned int) const override
Definition: node_elem.h:127
virtual bool contains_point(const Point &p, Real tol) const override
Definition: node_elem.C:58
virtual bool is_child_on_side(const unsigned int, const unsigned int) const override
Definition: node_elem.h:194
virtual bool is_edge_on_side(const unsigned int, const unsigned int) const override
Definition: node_elem.h:229
The libMesh namespace provides an interface to certain functionality in the library.
virtual unsigned int n_children() const override
Definition: node_elem.h:109
virtual unsigned int n_sides() const override
Definition: node_elem.h:89
void set_interior_parent(Elem *p)
Sets the pointer to the element&#39;s interior_parent.
Definition: elem.C:1248
virtual bool is_face(const unsigned int) const override
Definition: node_elem.h:192
NodeElem(Elem *p=nullptr)
Constructor.
Definition: node_elem.h:45
virtual bool infinite() const override
Definition: node_elem.h:284
virtual Order default_order() const override
Definition: node_elem.C:38
virtual std::unique_ptr< Elem > build_side_ptr(const unsigned int) override
The Elem::build_side_ptr() member makes no sense for nodes.
Definition: node_elem.h:156
virtual std::unique_ptr< Elem > side_ptr(const unsigned int) override
The Elem::side_ptr() member makes no sense for nodes.
Definition: node_elem.h:147
virtual bool has_affine_map() const override
Definition: node_elem.h:246
virtual std::vector< unsigned int > nodes_on_edge(const unsigned int) const override
Definition: node_elem.h:208
virtual ElemType side_type(const unsigned int) const override
Definition: node_elem.h:298
virtual std::vector< unsigned int > sides_on_edge(const unsigned int) const override
Definition: node_elem.h:219
virtual bool is_node_on_side(const unsigned int, const unsigned int) const override
Definition: node_elem.h:198
virtual unsigned int n_permutations() const override final
No way to reorient a single node.
Definition: node_elem.h:291
The BoundaryInfo class contains information relevant to boundary conditions including storing faces...
Definition: boundary_info.h:57
virtual bool is_flipped() const override final
Definition: node_elem.h:296
virtual unsigned int local_side_node(unsigned int, unsigned int) const override
NodeElems don&#39;t have sides, so they can&#39;t have nodes on sides.
Definition: node_elem.h:133
Node * _nodelinks_data[1]
Data for links to nodes.
Definition: node_elem.h:335
virtual void connectivity(const unsigned int sc, const IOPackage iop, std::vector< dof_id_type > &conn) const override
Definition: node_elem.C:51
virtual unsigned int n_nodes() const override
Definition: node_elem.h:84
The NodeElem is a point element, generally used as a side of a 1D element.
Definition: node_elem.h:37
virtual Real embedding_matrix(const unsigned int i, const unsigned int j, const unsigned int k) const override
Matrix used to create the elements children.
Definition: node_elem.h:343
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Point quasicircumcenter() const override
Definition: node_elem.h:239
virtual bool is_edge(const unsigned int) const override
NodeElem objects don&#39;t have faces or sides.
Definition: node_elem.h:191
virtual bool on_reference_element(const Point &p, const Real eps=TOLERANCE) const override final
Definition: node_elem.C:69
virtual unsigned int n_edges() const override
Definition: node_elem.h:99
virtual unsigned short dim() const override
Definition: node_elem.h:79
virtual dof_id_type key(const unsigned int) const override
Definition: node_elem.h:120
virtual ElemType type() const override
Definition: node_elem.h:262
static const int num_nodes
Geometric constants for NodeElem;.
Definition: node_elem.h:63
virtual bool is_linear() const override
Definition: node_elem.h:257
virtual ~NodeElem()=default
Elem * _elemlinks_data[1+(LIBMESH_DIM >0)]
Data for links to parent/neighbor/interior_parent elements.
Definition: node_elem.h:330
virtual void permute(unsigned int) override final
Permutes the element (by swapping node and neighbor pointers) according to the specified index...
Definition: node_elem.h:293
virtual void flip(BoundaryInfo *) override final
Flips the element (by swapping node and neighbor pointers) to have a mapping Jacobian of opposite sig...
Definition: node_elem.h:295
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39
const Point & point(const unsigned int i) const
Definition: elem.h:2453
virtual std::vector< unsigned int > nodes_on_side(const unsigned int) const override
Definition: node_elem.h:202
virtual std::unique_ptr< Elem > build_edge_ptr(const unsigned int) override
The Elem::build_edge_ptr() member makes no sense for nodes.
Definition: node_elem.h:168
virtual unsigned int n_sub_elem() const override
Definition: node_elem.h:180
uint8_t dof_id_type
Definition: id_types.h:67
virtual bool has_invertible_map(Real) const override
Definition: node_elem.h:251