edge.C
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 // Local includes
21 #include "libmesh/edge.h"
22 #include "libmesh/node_elem.h"
23 
24 namespace libMesh
25 {
26 
27 
28 AutoPtr<Elem> Edge::side (const unsigned int i) const
29 {
30  libmesh_assert_less (i, 2);
31  const Elem* the_parent = this;
32  Elem *nodeelem = new NodeElem(const_cast<Elem*>(the_parent));
33  nodeelem->set_node(0) = this->get_node(i);
34  return AutoPtr<Elem>(nodeelem);
35 }
36 
37 
38 AutoPtr<Elem> Edge::build_side (const unsigned int i, bool) const
39 {
40  libmesh_assert_less (i, 2);
41  const Elem* the_parent = this;
42  Elem *nodeelem = new NodeElem(const_cast<Elem*>(the_parent));
43  nodeelem->set_node(0) = this->get_node(i);
44  return AutoPtr<Elem>(nodeelem);
45 }
46 
47 
48 bool Edge::is_child_on_side(const unsigned int c,
49  const unsigned int s) const
50 {
51  libmesh_assert_less (c, this->n_children());
52  libmesh_assert_less (s, this->n_sides());
53 
54  return (c == s);
55 }
56 
57 
58 
59 unsigned int Edge::opposite_side(const unsigned int side_in) const
60 {
61  libmesh_assert_less (side_in, 2);
62  return 1 - side_in;
63 }
64 
65 
66 
67 unsigned int Edge::opposite_node(const unsigned int node_in,
68  const unsigned int libmesh_dbg_var(side_in)) const
69 {
70  libmesh_assert_less (node_in, 2);
71  libmesh_assert_less (side_in, this->n_sides());
72  libmesh_assert(this->is_node_on_side(node_in, side_in));
73 
74  return 1 - node_in;
75 }
76 
77 
78 
79 } // namespace libMesh

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

Hosted By:
SourceForge.net Logo