$extrastylesheet
00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2014 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 00049 template <class SideType, class ParentType> 00050 class Side : public SideType 00051 { 00052 public: 00053 00057 Side (const Elem* parent_in, 00058 const unsigned int side_in) : 00059 SideType(const_cast<Elem*>(parent_in)), 00060 _side_number(side_in) 00061 { 00062 libmesh_assert(parent_in); 00063 // may not be true when building infinite element sides 00064 // libmesh_assert_less (_side_number, this->parent()->n_sides()); 00065 libmesh_assert_equal_to ((this->dim()+1), this->parent()->dim()); 00066 00067 for (unsigned int n=0; n != this->n_nodes(); ++n) 00068 this->_nodes[n] = this->parent()->get_node 00069 (ParentType::side_nodes_map[_side_number][n]); 00070 } 00071 00075 virtual Node* & set_node (const unsigned int i) 00076 { 00077 libmesh_assert_less (i, this->n_nodes()); 00078 return this->parent()->set_node (ParentType::side_nodes_map[_side_number][i]); 00079 } 00080 00084 virtual unsigned int n_sides () const 00085 { return 0; } 00086 00087 virtual bool is_child_on_side(const unsigned int, 00088 const unsigned int) const 00089 { libmesh_not_implemented(); return false; } 00090 00091 00092 private: 00093 00094 00098 const unsigned int _side_number; 00099 }; 00100 00101 00102 00114 // ------------------------------------------------------------ 00115 //SideEdge class definition 00116 template <class EdgeType, class ParentType> 00117 class SideEdge : public EdgeType 00118 { 00119 public: 00120 00124 SideEdge (const Elem* my_parent, 00125 const unsigned int my_edge) : 00126 EdgeType(const_cast<Elem*>(my_parent)), 00127 _edge_number(my_edge) 00128 { 00129 libmesh_assert(my_parent); 00130 libmesh_assert_less (_edge_number, this->parent()->n_edges()); 00131 libmesh_assert_equal_to (this->dim(), 1); 00132 00133 for (unsigned int n=0; n != this->n_nodes(); ++n) 00134 this->_nodes[n] = this->parent()->get_node 00135 (ParentType::edge_nodes_map[_edge_number][n]); 00136 } 00137 00141 virtual Node* & set_node (const unsigned int i) 00142 { 00143 libmesh_assert_less (i, this->n_nodes()); 00144 return this->parent()->set_node (ParentType::edge_nodes_map[_edge_number][i]); 00145 } 00146 00151 virtual unsigned int n_sides () const { return 0; } 00152 00153 00154 private: 00155 00156 00160 const unsigned int _edge_number; 00161 }; 00162 00163 00164 } // namespace libMesh 00165 00166 #endif // LIBMESH_SIDE_H