side.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 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 // C++ includes
28 #include <cstddef>
29 
30 namespace libMesh
31 {
32 
33 // Forward declarations
34 class Point;
35 class Node;
36 
37 
50 // ------------------------------------------------------------
51 //Side class definition
52 template <class SideType, class ParentType>
53 class Side : public SideType
54 {
55  public:
56 
60  Side (const Elem* parent_in,
61  const unsigned int side_in) :
62  SideType(const_cast<Elem*>(parent_in)),
63  _side_number(side_in)
64  {
65  libmesh_assert(parent_in);
66  // may not be true when building infinite element sides
67  // libmesh_assert_less (_side_number, this->parent()->n_sides());
68  libmesh_assert_equal_to ((this->dim()+1), this->parent()->dim());
69  }
70 
74  virtual const Point & point (const unsigned int i) const
75  {
76  libmesh_assert_less (i, this->n_nodes());
77  return this->parent()->point (ParentType::side_nodes_map[_side_number][i]);
78  }
79 
84  virtual Point & point (const unsigned int i)
85  {
86  libmesh_assert_less (i, this->n_nodes());
87  return this->parent()->point (ParentType::side_nodes_map[_side_number][i]);
88  }
89 
93  virtual dof_id_type node (const unsigned int i) const
94  {
95  libmesh_assert_less (i, this->n_nodes());
96  return this->parent()->node (ParentType::side_nodes_map[_side_number][i]);
97  }
98 
102  virtual Node* get_node (const unsigned int i) const
103  {
104  libmesh_assert_less (i, this->n_nodes());
105  return this->parent()->get_node (ParentType::side_nodes_map[_side_number][i]);
106  }
107 
111  virtual Node* & set_node (const unsigned int i)
112  {
113  libmesh_assert_less (i, this->n_nodes());
114  return this->parent()->set_node (ParentType::side_nodes_map[_side_number][i]);
115  }
116 
120  virtual unsigned int n_sides () const
121  { return 0; }
122 
123  virtual bool is_child_on_side(const unsigned int,
124  const unsigned int) const
125  { libmesh_error(); return false; }
126 
127 
128  private:
129 
130 
134  const unsigned int _side_number;
135 };
136 
137 
138 
150 // ------------------------------------------------------------
151 //SideEdge class definition
152 template <class EdgeType, class ParentType>
153 class SideEdge : public EdgeType
154 {
155  public:
156 
160  SideEdge (const Elem* my_parent,
161  const unsigned int my_edge) :
162  EdgeType(const_cast<Elem*>(my_parent)),
163  _edge_number(my_edge)
164  {
165  libmesh_assert(my_parent);
166  libmesh_assert_less (_edge_number, this->parent()->n_edges());
167  libmesh_assert_equal_to (this->dim(), 1);
168  }
169 
173  virtual const Point & point (const unsigned int i) const
174  {
175  libmesh_assert_less (i, this->n_nodes());
176  return this->parent()->point (ParentType::edge_nodes_map[_edge_number][i]);
177  }
178 
183  virtual Point & point (const unsigned int i)
184  {
185  libmesh_assert_less (i, this->n_nodes());
186  return this->parent()->point (ParentType::edge_nodes_map[_edge_number][i]);
187  }
188 
192  virtual dof_id_type node (const unsigned int i) const
193  {
194  libmesh_assert_less (i, this->n_nodes());
195  return this->parent()->node (ParentType::edge_nodes_map[_edge_number][i]);
196  }
197 
201  virtual Node* get_node (const unsigned int i) const
202  {
203  libmesh_assert_less (i, this->n_nodes());
204  return this->parent()->get_node (ParentType::edge_nodes_map[_edge_number][i]);
205  }
206 
210  virtual Node* & set_node (const unsigned int i)
211  {
212  libmesh_assert_less (i, this->n_nodes());
213  return this->parent()->set_node (ParentType::edge_nodes_map[_edge_number][i]);
214  }
215 
220  virtual unsigned int n_sides () const { return 0; }
221 
222 
223  private:
224 
225 
229  const unsigned int _edge_number;
230 };
231 
232 
233 } // namespace libMesh
234 
235 #endif // LIBMESH_SIDE_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:07 UTC

Hosted By:
SourceForge.net Logo