side.h
Go to the documentation of this file.00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2012 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 00003 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 00009 // This library is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // Lesser General Public License for more details. 00013 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this library; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 00019 00020 #ifndef LIBMESH_SIDE_H 00021 #define LIBMESH_SIDE_H 00022 00023 // Local includes 00024 #include "libmesh/libmesh_common.h" 00025 #include "libmesh/elem.h" 00026 00027 // C++ includes 00028 #include <cstddef> 00029 00030 namespace libMesh 00031 { 00032 00033 // Forward declarations 00034 class Point; 00035 class Node; 00036 00037 00050 // ------------------------------------------------------------ 00051 //Side class definition 00052 template <class SideType, class ParentType> 00053 class Side : public SideType 00054 { 00055 public: 00056 00060 Side (const Elem* parent_in, 00061 const unsigned int side_in) : 00062 SideType(const_cast<Elem*>(parent_in)), 00063 _side_number(side_in) 00064 { 00065 libmesh_assert(parent_in); 00066 // may not be true when building infinite element sides 00067 // libmesh_assert_less (_side_number, this->parent()->n_sides()); 00068 libmesh_assert_equal_to ((this->dim()+1), this->parent()->dim()); 00069 } 00070 00074 virtual const Point & point (const unsigned int i) const 00075 { 00076 libmesh_assert_less (i, this->n_nodes()); 00077 return this->parent()->point (ParentType::side_nodes_map[_side_number][i]); 00078 } 00079 00084 virtual Point & point (const unsigned int i) 00085 { 00086 libmesh_assert_less (i, this->n_nodes()); 00087 return this->parent()->point (ParentType::side_nodes_map[_side_number][i]); 00088 } 00089 00093 virtual dof_id_type node (const unsigned int i) const 00094 { 00095 libmesh_assert_less (i, this->n_nodes()); 00096 return this->parent()->node (ParentType::side_nodes_map[_side_number][i]); 00097 } 00098 00102 virtual Node* get_node (const unsigned int i) const 00103 { 00104 libmesh_assert_less (i, this->n_nodes()); 00105 return this->parent()->get_node (ParentType::side_nodes_map[_side_number][i]); 00106 } 00107 00111 virtual Node* & set_node (const unsigned int i) 00112 { 00113 libmesh_assert_less (i, this->n_nodes()); 00114 return this->parent()->set_node (ParentType::side_nodes_map[_side_number][i]); 00115 } 00116 00120 virtual unsigned int n_sides () const 00121 { return 0; } 00122 00123 virtual bool is_child_on_side(const unsigned int, 00124 const unsigned int) const 00125 { libmesh_error(); return false; } 00126 00127 00128 private: 00129 00130 00134 const unsigned int _side_number; 00135 }; 00136 00137 00138 00150 // ------------------------------------------------------------ 00151 //SideEdge class definition 00152 template <class EdgeType, class ParentType> 00153 class SideEdge : public EdgeType 00154 { 00155 public: 00156 00160 SideEdge (const Elem* my_parent, 00161 const unsigned int my_edge) : 00162 EdgeType(const_cast<Elem*>(my_parent)), 00163 _edge_number(my_edge) 00164 { 00165 libmesh_assert(my_parent); 00166 libmesh_assert_less (_edge_number, this->parent()->n_edges()); 00167 libmesh_assert_equal_to (this->dim(), 1); 00168 } 00169 00173 virtual const Point & point (const unsigned int i) const 00174 { 00175 libmesh_assert_less (i, this->n_nodes()); 00176 return this->parent()->point (ParentType::edge_nodes_map[_edge_number][i]); 00177 } 00178 00183 virtual Point & point (const unsigned int i) 00184 { 00185 libmesh_assert_less (i, this->n_nodes()); 00186 return this->parent()->point (ParentType::edge_nodes_map[_edge_number][i]); 00187 } 00188 00192 virtual dof_id_type node (const unsigned int i) const 00193 { 00194 libmesh_assert_less (i, this->n_nodes()); 00195 return this->parent()->node (ParentType::edge_nodes_map[_edge_number][i]); 00196 } 00197 00201 virtual Node* get_node (const unsigned int i) const 00202 { 00203 libmesh_assert_less (i, this->n_nodes()); 00204 return this->parent()->get_node (ParentType::edge_nodes_map[_edge_number][i]); 00205 } 00206 00210 virtual Node* & set_node (const unsigned int i) 00211 { 00212 libmesh_assert_less (i, this->n_nodes()); 00213 return this->parent()->set_node (ParentType::edge_nodes_map[_edge_number][i]); 00214 } 00215 00220 virtual unsigned int n_sides () const { return 0; } 00221 00222 00223 private: 00224 00225 00229 const unsigned int _edge_number; 00230 }; 00231 00232 00233 } // namespace libMesh 00234 00235 #endif // LIBMESH_SIDE_H
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:48 UTC
Hosted By: