libMesh
side.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2024 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_SIDE_H
21 #define LIBMESH_SIDE_H
22 
23 // Local includes
24 #include "libmesh/libmesh_common.h"
25 #include "libmesh/elem.h"
26 
27 namespace libMesh
28 {
29 
30 // Forward declarations
31 class Point;
32 class Node;
33 
34 #ifdef LIBMESH_ENABLE_DEPRECATED
35 
49 template <class SideType, class ParentType>
50 class Side : public SideType
51 {
52 public:
53 
57  Side (const Elem * parent_in,
58  const unsigned int side_in) :
59  SideType(const_cast<Elem *>(parent_in)),
60  _side_number(side_in)
61  {
62  // Our more-optimized non-proxy side code makes this class
63  // obsolete.
64  libmesh_deprecated();
65 
66  libmesh_assert(parent_in);
67  // may not be true when building infinite element sides
68  // libmesh_assert_less (_side_number, this->parent()->n_sides());
69  libmesh_assert_equal_to ((this->dim()+1), this->parent()->dim());
70 
71  for (auto n : this->node_index_range())
72  this->_nodes[n] = this->parent()->node_ptr
73  (ParentType::side_nodes_map[_side_number][n]);
74  }
75 
76  Side (Side &&) = delete;
77  Side (const Side &) = delete;
78  Side & operator= (const Side &) = delete;
79  Side & operator= (Side &&) = delete;
80  virtual ~Side() = default;
81 
85  virtual Node * & set_node (const unsigned int i) override
86  {
87  libmesh_assert_less (i, this->n_nodes());
88  return this->parent()->set_node (ParentType::side_nodes_map[_side_number][i]);
89  }
90 
91 private:
92 
96  const unsigned int _side_number;
97 };
98 
99 
100 
111 template <class EdgeType, class ParentType>
112 class SideEdge : public EdgeType
113 {
114 public:
115 
119  SideEdge (const Elem * my_parent,
120  const unsigned int my_edge) :
121  EdgeType(const_cast<Elem *>(my_parent)),
122  _edge_number(my_edge)
123  {
124  // Our more-optimized non-proxy side code makes this class
125  // obsolete.
126  libmesh_deprecated();
127 
128  libmesh_assert(my_parent);
129  libmesh_assert_less (_edge_number, this->parent()->n_edges());
130  libmesh_assert_equal_to (this->dim(), 1);
131 
132  for (auto n : this->node_index_range())
133  this->_nodes[n] = this->parent()->node_ptr
134  (ParentType::edge_nodes_map[_edge_number][n]);
135  }
136 
140  virtual Node * & set_node (const unsigned int i) override
141  {
142  libmesh_assert_less (i, this->n_nodes());
143  return this->parent()->set_node (ParentType::edge_nodes_map[_edge_number][i]);
144  }
145 
146 private:
147 
151  const unsigned int _edge_number;
152 };
153 
154 #endif // LIBMESH_ENABLE_DEPRECATED
155 
156 } // namespace libMesh
157 
158 #endif // LIBMESH_SIDE_H
A Node is like a Point, but with more information.
Definition: node.h:52
unsigned int dim
This is the base class from which all geometric element types are derived.
Definition: elem.h:94
const unsigned int _edge_number
The side on the parent element.
Definition: side.h:151
The libMesh namespace provides an interface to certain functionality in the library.
virtual ~Side()=default
SideEdge(const Elem *my_parent, const unsigned int my_edge)
Constructor.
Definition: side.h:119
const dof_id_type n_nodes
Definition: tecplot_io.C:67
const unsigned int _side_number
The side on the parent element.
Definition: side.h:96
libmesh_assert(ctx)
virtual Node *& set_node(const unsigned int i) override
Setting an edge node changes the node on the parent.
Definition: side.h:140
This defines the Side class.
Definition: elem.h:61
This defines the SideEdge class.
Definition: side.h:112
Side & operator=(const Side &)=delete
Side(const Elem *parent_in, const unsigned int side_in)
Constructor.
Definition: side.h:57
virtual Node *& set_node(const unsigned int i) override
Setting a side node changes the node on the parent.
Definition: side.h:85