$extrastylesheet
cell_tet.h
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 #ifndef LIBMESH_CELL_TET_H
00021 #define LIBMESH_CELL_TET_H
00022 
00023 // Local includes
00024 #include "libmesh/cell.h"
00025 
00026 namespace libMesh
00027 {
00028 
00029 
00030 
00031 
00035 class Tet : public Cell
00036 {
00037 public:
00038 
00043   Tet  (const unsigned int nn, Elem* p, Node** nodelinkdata);
00044 
00048   unsigned int n_sides() const { return 4; }
00049 
00053   unsigned int n_vertices() const { return 4; }
00054 
00058   unsigned int n_edges() const { return 6; }
00059 
00063   unsigned int n_faces() const { return 4; }
00064 
00068   unsigned int n_children() const { return 8; }
00069 
00070   /*
00071    * @returns true iff the specified edge is on the specified side
00072    */
00073   virtual bool is_edge_on_side(const unsigned int e,
00074                                const unsigned int s) const;
00075 
00081   dof_id_type key (const unsigned int s) const;
00082 
00087   UniquePtr<Elem> side (const unsigned int i) const;
00088 
00093   Real quality (const ElemQuality q) const;
00094 
00100   std::pair<Real, Real> qual_bounds (const ElemQuality q) const;
00101 
00108   enum Diagonal
00109     {
00110       DIAG_02_13=0,    // diagonal between edges (0,2) and (1,3)
00111       DIAG_03_12=1,    // diagonal between edges (0,3) and (1,2)
00112       DIAG_01_23=2,    // diagonal between edges (0,1) and (2,3)
00113       INVALID_DIAG=99  // diagonal not yet selected
00114     };
00115 
00119   Diagonal diagonal_selection () const { return _diagonal_selection; }
00120 
00125   void select_diagonal (const Diagonal diag) const;
00126 
00127 protected:
00128 
00132   Elem* _elemlinks_data[5+(LIBMESH_DIM>3)];
00133 
00138   bool is_child_on_side_helper(const unsigned int c,
00139                                const unsigned int s,
00140                                const unsigned int checked_nodes[][3] ) const;
00141 
00146   mutable Diagonal _diagonal_selection;
00147 
00153   void choose_diagonal() const;
00154 
00155 };
00156 
00157 
00158 
00159 // ------------------------------------------------------------
00160 // Tet class member functions
00161 inline
00162 Tet::Tet(const unsigned int nn, Elem* p, Node** nodelinkdata) :
00163   Cell(nn, Tet::n_sides(), p, _elemlinks_data, nodelinkdata)
00164   , _diagonal_selection(INVALID_DIAG)
00165 {
00166 }
00167 
00168 } // namespace libMesh
00169 
00170 #endif // LIBMESH_CELL_TET_H