$extrastylesheet
edge_edge2.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_edge2.h"
00022 
00023 namespace libMesh
00024 {
00025 
00026 
00027 #ifdef LIBMESH_ENABLE_AMR
00028 
00029 const float Edge2::_embedding_matrix[2][2][2] =
00030   {
00031     // embedding matrix for child 0
00032     {
00033       // 0    1    2
00034       {1.0, 0.0}, // 0
00035       {0.5, 0.5}  // 1
00036     },
00037 
00038     // embedding matrix for child 1
00039     {
00040       // 0    1    2
00041       {0.5, 0.5}, // 0
00042       {0.0, 1.0}  // 1
00043     }
00044   };
00045 
00046 #endif
00047 
00048 bool Edge2::is_vertex(const unsigned int) const
00049 {
00050   return true;
00051 }
00052 
00053 bool Edge2::is_edge(const unsigned int) const
00054 {
00055   return false;
00056 }
00057 
00058 bool Edge2::is_face(const unsigned int) const
00059 {
00060   return false;
00061 }
00062 
00063 bool Edge2::is_node_on_side(const unsigned int n,
00064                             const unsigned int s) const
00065 {
00066   libmesh_assert_less (s, 2);
00067   return (s == n);
00068 }
00069 
00070 bool Edge2::is_node_on_edge(const unsigned int,
00071                             const unsigned int libmesh_dbg_var(e)) const
00072 {
00073   libmesh_assert_equal_to (e, 0);
00074   return true;
00075 }
00076 
00077 void Edge2::connectivity(const unsigned int libmesh_dbg_var(sc),
00078                          const IOPackage iop,
00079                          std::vector<dof_id_type>& conn) const
00080 {
00081   libmesh_assert_equal_to (sc, 0);
00082   libmesh_assert_less (sc, this->n_sub_elem());
00083   libmesh_assert_not_equal_to (iop, INVALID_IO_PACKAGE);
00084 
00085   // Create storage
00086   conn.resize(2);
00087 
00088   switch (iop)
00089     {
00090     case TECPLOT:
00091       {
00092         conn[0] = this->node(0)+1;
00093         conn[1] = this->node(1)+1;
00094         return;
00095       }
00096 
00097     case VTK:
00098       {
00099         conn[0] = this->node(0);
00100         conn[1] = this->node(1);
00101         return;
00102       }
00103 
00104     default:
00105       libmesh_error_msg("Unsupported IO package " << iop);
00106     }
00107 }
00108 
00109 
00110 Real Edge2::volume () const
00111 {
00112   // OK, so this is probably overkill, since it is equivalent to
00113   // Elem::hmax() for the Edge2, but here it is nonetheless...
00114   return (this->point(1) - this->point(0)).size();
00115 }
00116 
00117 } // namespace libMesh