SundanceCellType.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 // ************************************************************************
00003 // 
00004 //                              Sundance
00005 //                 Copyright (2005) Sandia Corporation
00006 // 
00007 // Copyright (year first published) Sandia Corporation.  Under the terms 
00008 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 
00009 // retains certain rights in this software.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //  
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //                                                                                 
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA                                                                                
00025 // Questions? Contact Kevin Long (krlong@sandia.gov), 
00026 // Sandia National Laboratories, Livermore, California, USA
00027 // 
00028 // ************************************************************************
00029 /* @HEADER@ */
00030 
00031 #ifndef CELLTOPOLOGYCODE_H
00032 #define CELLTOPOLOGYCODE_H
00033 
00034 
00035 #include "SundanceDefs.hpp"
00036 
00037 namespace Sundance 
00038 {
00039 /** \defgroup Sundance_CellType_grp Cell Type Description
00040  */
00041 
00042 /** \brief Enumeration of specific 1D, 2D, and 3D cell types.
00043  *
00044  * See the implementation of the nonmember functions <tt>dimension()</tt>,
00045  * <tt>numFacets()</tt>, and <tt>facetType()</tt> a full description of what
00046  * these cell types are.
00047  *
00048  * ToDo: Consider making CellType an abstract base class so that any type of
00049  * cell can be implemented?
00050  *
00051  * \ingroup Sundance_CellType_grp
00052  */
00053 enum CellType {
00054   NullCell        ///< No cell specified
00055   ,PointCell      ///< 0D vertex cell
00056   ,LineCell       ///< 1D line, or edge, cell
00057   ,TriangleCell   ///< 2D triangle
00058   ,TetCell        ///< 3D tetrahedral cell
00059   ,QuadCell       ///< 2D quadrilateral cell
00060   ,BrickCell      ///< 3D "brick" cell
00061   ,PrismCell      ///< 3D prism cell
00062 };
00063 
00064 /** \brief Return a std::string representation of the cell type.
00065  *
00066  * \ingroup Sundance_CellType_grp
00067  */
00068 std::string toString(const CellType& c) ;
00069 
00070 /** \brief Return the dimension of the cell type.
00071  *
00072  * \ingroup Sundance_CellType_grp
00073  */
00074 int dimension(const CellType& c) ;
00075 
00076 /** \brief Return the number of faces of a given facet dimension for a cell type.
00077  *
00078  * <b>Preconditions:</b><ul>
00079  * <li><tt>facetDim <= dimension(c)</tt>
00080  * </ul>
00081  *
00082  * \returns -1 for null cells and point cells
00083  *
00084  * \ingroup Sundance_CellType_grp
00085  */
00086 int numFacets(const CellType& c, int facetDim);
00087 
00088 /** \return Return the type of facet of a given facet dimension and a
00089  * particualar facet.
00090  *
00091  * \param  c
00092  *           [in] Cell type
00093  * \param  facetDim
00094  *           [in] The dimension of the facet type requested
00095  * \param  facetIndex
00096  *           [in] The particualar index of the facet as defined
00097  *           by the convension of the cell type (which is actually
00098  *           partially defined in this function).
00099  *
00100  * <b>Preconditions:</b><ul>
00101  * <li><tt>facetDim <= dimension(c)</tt>
00102  * <li><tt>0 <= facetIndex < numFacets(c,facetDim)</tt>
00103  * </ul>
00104  *
00105  * \ingroup Sundance_CellType_grp
00106  */
00107 CellType facetType(const CellType& c, int facetDim, int facetIndex);
00108 
00109 
00110 
00111 /** \brief output stream operator for <tt>CellType</tt>.
00112  *
00113  * \ingroup Sundance_CellType_grp
00114  */
00115 inline std::ostream& operator<<(std::ostream& os, const CellType& c)
00116 {
00117   os << toString(c);
00118   return os;
00119 }
00120   
00121 } // namespace Sundance
00122 
00123 
00124 #endif
00125 
00126 

Site Contact