$extrastylesheet
edge.C
Go to the documentation of this file.
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 // Local includes
00021 #include "libmesh/edge.h"
00022 #include "libmesh/node_elem.h"
00023 
00024 namespace libMesh
00025 {
00026 
00027 
00028 UniquePtr<Elem> Edge::side (const unsigned int i) const
00029 {
00030   libmesh_assert_less (i, 2);
00031   const Elem* the_parent = this;
00032   Elem *nodeelem = new NodeElem(const_cast<Elem*>(the_parent));
00033   nodeelem->set_node(0) = this->get_node(i);
00034   return UniquePtr<Elem>(nodeelem);
00035 }
00036 
00037 
00038 UniquePtr<Elem> Edge::build_side (const unsigned int i, bool) const
00039 {
00040   libmesh_assert_less (i, 2);
00041   const Elem* the_parent = this;
00042   Elem *nodeelem = new NodeElem(const_cast<Elem*>(the_parent));
00043   nodeelem->set_node(0) = this->get_node(i);
00044   return UniquePtr<Elem>(nodeelem);
00045 }
00046 
00047 
00048 bool Edge::is_child_on_side(const unsigned int c,
00049                             const unsigned int s) const
00050 {
00051   libmesh_assert_less (c, this->n_children());
00052   libmesh_assert_less (s, this->n_sides());
00053 
00054   return (c == s);
00055 }
00056 
00057 
00058 
00059 unsigned int Edge::opposite_side(const unsigned int side_in) const
00060 {
00061   libmesh_assert_less (side_in, 2);
00062   return 1 - side_in;
00063 }
00064 
00065 
00066 
00067 unsigned int Edge::opposite_node(const unsigned int node_in,
00068                                  const unsigned int libmesh_dbg_var(side_in)) const
00069 {
00070   libmesh_assert_less (node_in, 2);
00071   libmesh_assert_less (side_in, this->n_sides());
00072   libmesh_assert(this->is_node_on_side(node_in, side_in));
00073 
00074   return 1 - node_in;
00075 }
00076 
00077 
00078 
00079 } // namespace libMesh