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 00040 /** \defgroup Sundance_CellType_grp Cell Type Description 00041 */ 00042 00043 /** \brief Enumeration of specific 1D, 2D, and 3D cell types. 00044 * 00045 * See the implementation of the nonmember functions <tt>dimension()</tt>, 00046 * <tt>numFacets()</tt>, and <tt>facetType()</tt> a full description of what 00047 * these cell types are. 00048 * 00049 * ToDo: Consider making CellType an abstract base class so that any type of 00050 * cell can be implemented? 00051 * 00052 * \ingroup Sundance_CellType_grp 00053 */ 00054 enum CellType { 00055 NullCell ///< No cell specified 00056 ,PointCell ///< 0D vertex cell 00057 ,LineCell ///< 1D line, or edge, cell 00058 ,TriangleCell ///< 2D triangle 00059 ,TetCell ///< 3D tetrahedral cell 00060 ,QuadCell ///< 2D quadrilateral cell 00061 ,BrickCell ///< 3D "brick" cell 00062 ,PrismCell ///< 3D prism cell 00063 }; 00064 00065 /** \brief Return a std::string representation of the cell type. 00066 * 00067 * \ingroup Sundance_CellType_grp 00068 */ 00069 std::string toString(const CellType& c) ; 00070 00071 /** \brief Return the dimension of the cell type. 00072 * 00073 * \ingroup Sundance_CellType_grp 00074 */ 00075 int dimension(const CellType& c) ; 00076 00077 /** \brief Return the number of faces of a given facet dimension for a cell type. 00078 * 00079 * <b>Preconditions:</b><ul> 00080 * <li><tt>facetDim <= dimension(c)</tt> 00081 * </ul> 00082 * 00083 * \returns -1 for null cells and point cells 00084 * 00085 * \ingroup Sundance_CellType_grp 00086 */ 00087 int numFacets(const CellType& c, int facetDim); 00088 00089 /** \return Return the type of facet of a given facet dimension and a 00090 * particualar facet. 00091 * 00092 * \param c 00093 * [in] Cell type 00094 * \param facetDim 00095 * [in] The dimension of the facet type requested 00096 * \param facetIndex 00097 * [in] The particualar index of the facet as defined 00098 * by the convension of the cell type (which is actually 00099 * partially defined in this function). 00100 * 00101 * <b>Preconditions:</b><ul> 00102 * <li><tt>facetDim <= dimension(c)</tt> 00103 * <li><tt>0 <= facetIndex < numFacets(c,facetDim)</tt> 00104 * </ul> 00105 * 00106 * \ingroup Sundance_CellType_grp 00107 */ 00108 CellType facetType(const CellType& c, int facetDim, int facetIndex); 00109 00110 /** \brief output stream operator for <tt>CellType</tt>. 00111 * 00112 * \ingroup Sundance_CellType_grp 00113 */ 00114 inline std::ostream& operator<<(std::ostream& os, const CellType& c) 00115 { 00116 os << toString(c); 00117 return os; 00118 } 00119 00120 } // namespace Sundance 00121 00122 00123 #endif 00124 00125