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 SUNDANCE_BASISDOFTOPOLOGYBASE_H 00032 #define SUNDANCE_BASISDOFTOPOLOGYBASE_H 00033 00034 #include "SundanceDefs.hpp" 00035 #include "SundanceCellType.hpp" 00036 #include "Teuchos_Array.hpp" 00037 #include "Teuchos_Describable.hpp" 00038 00039 namespace Sundance { 00040 00041 00042 using Teuchos::Array; 00043 using Sundance::CellType; 00044 00045 /** 00046 * Abstract interface for specification of the topology of degree-of-freedom 00047 * (DOF) assignments on reference cells in any dimension. Currently, 00048 * only an enumerated set of cell types are supported (see <tt>CellType</tt>). 00049 * 00050 * A function \f$g(x)\f$ defined on a cell is represented as: 00051 00052 \f[ 00053 g(x) = \sum_{i=0}^{N-1} \bar{g}_i \psi_i(x) 00054 \f] 00055 00056 * where \f$x\in\Re^{D}\f$ is the spatial spatial coordinate for spatical dim 00057 * \f$D\f$ that lives in the cell's domain, \f$\psi_i(x)\f$ is the \f$i\f$th 00058 * basis function (of order = <tt>order()</tt>), \f$\bar{g}_i\f$ is the 00059 * (constant) coefficient for the \f$i\f$th basis function, and \f$N\f$ is the 00060 * number of basis functions. Therefore, given the coefficients of the basis 00061 * function on the cell \f$\bar{g}_i\f$, one can compute the value of the 00062 * function \f$g(x)\f$ on the cell at any point \f$x\f$ in the domain of the 00063 * cell given the above summation formula. This interface refers to the 00064 * coefficients \f$\bar{g}_i\f$ as degrees of freedom (<b>DOFs</b>). 00065 * 00066 * This interface allows the specification basis functions and basis 00067 * coefficients (i.e. DOFs) to be associated with any of the facets of a cell, 00068 * including the cell itself without restriction. See the function 00069 * <tt>getLocalDOFs()</tt> for how this mapping of DOFs to facets for a single 00070 * function defined on the cell. 00071 * 00072 * It is important to note that each cell type, i.e. the values of the enum 00073 * <tt>CellType</tt>, has a "agreed upon" geometry for the "reference cell" 00074 * and this geometry must be known by the client of the basis family and the 00075 * concrete implementations of the basis family. 00076 * 00077 * This is an interoperability interface and is therefore 00078 * deliberately minimalist. 00079 */ 00080 class BasisDOFTopologyBase : 00081 public Teuchos::Describable 00082 { 00083 public: 00084 00085 /** 00086 * \brief Inform caller as to whether a given combination 00087 * of cell types is supported. 00088 * 00089 * \param maximalCellType 00090 * [in] maximal-dimension cell type to which the cell is connected. 00091 * For example, a triangle in 3D could be connected to a prism 00092 * or to a tetrahedron. 00093 * 00094 * \param cellType 00095 * [in] type of cell for which we want DOF information. 00096 * 00097 */ 00098 virtual bool supportsCellTypePair( 00099 const CellType& maximalCellType, 00100 const CellType& cellType 00101 ) const = 0 ; 00102 00103 00104 00105 /** \brief Get a description of the DOF numbering and distribution scheme 00106 * for this basis function on the given cell type. 00107 * 00108 * \param cellType 00109 * [in] Specification of the cell topology 00110 * \param dofs 00111 * [out] Array of dof numbering information, to be filled in 00112 * during the call. On output, 00113 * <tt>dofs.size()==dimension(cellType)</tt>. See description of 00114 * <tt>dofs</tt> below for more details. 00115 * 00116 * The DOF description is returned in the nested array <tt>dofs</tt>, and is 00117 * to be interpreted as follows: The outer dimension of the description 00118 * array <tt>dofs.size()</tt> is <tt>cellDim</tt>, where <tt>cellDim</tt> is 00119 * the spatial dimension of the cell. The DOFs attached to facets are 00120 * stored in array entries <tt>dofs[s]</tt> where <tt>s=0...cellDim-1</tt>. 00121 * Those associated with the cell body are stored in 00122 * <tt>dofs[cellDim-1]</tt>. For cell dofs attached to facets, the dof 00123 * <tt>facetDofIndex</tt> associated with the facet <tt>facetIndex</tt> of 00124 * facet dimension <tt>facetDim</tt> is given by: 00125 00126 \code 00127 dofs[facetDim][facetIndex][faceDofIndex] 00128 \endcode 00129 00130 * For dofs attached to the cell body, the local DOF within the entire cell 00131 * is given by dof is given by 00132 00133 \code 00134 dofs[cellDim][0][dofIndex] 00135 \endcode 00136 00137 * More specifically:<ul> 00138 * 00139 * <li><tt>dof[facetDim].size()</tt> gives the number of facets of the facet 00140 * dimension <tt>facetDim</tt>, where <tt>0 <= facetDim <= cellDim</tt> 00141 * 00142 * <li><tt>dof[facetDim][facetIndex].size()</tt> gives the number of degrees 00143 * of freedom (DOFs) on the facet <tt>facetIndex</tt> with facet dimension 00144 * <tt>facetDim</tt>, where <tt>0 <= facetDim <= cellDim</tt> and <tt>0 <= 00145 * facetIndex < numFacets(cellType,facetDim)</tt>. 00146 * 00147 * </ul> 00148 * 00149 * For example, the Lagrange basis functions of order 0 through 3 on 2D 00150 * triangles would have the following dof arrays: 00151 00152 \verbatim 00153 00154 Order 0: 00155 00156 { {}, {}, {{0}} } 00157 00158 Order 1: 00159 00160 { { {0}, {1}, {2} }, {}, {} } 00161 00162 Order 2: 00163 00164 { { {0}, {1}, {2} }, { {3}, {4}, {5} }, {} } 00165 00166 Order 3: 00167 00168 { { {0}, {1}, {2} }, { {3,4}, {5,6}, {7,8} }, {9} } 00169 00170 \endverbatim 00171 00172 * Above, we have used the ordering given in Hughes' textbook. 00173 */ 00174 virtual void getReferenceDOFs( 00175 const CellType& maximalCellType, 00176 const CellType& cellType, 00177 Array<Array<Array<int> > >& dofs 00178 ) const = 0 ; 00179 00180 00181 00182 /** \brief Return the total number of degrees of freedom associated with 00183 * this basis on a specified cell type. Note: the count returned 00184 * by this function includes DOFs owned by facets of the specified 00185 * reference cell. 00186 * 00187 * 00188 * \param cellType 00189 * [in] type of cell for which we want DOF information. 00190 * 00191 * \param maximalCellType 00192 * [in] maximal-dimension cell type to which the cell is connected. 00193 * For example, a triangle in 3D could be connected to a prism 00194 * or to a tetrahedron. 00195 * 00196 * \return Number of DOFs associated with the cell type and its facets. 00197 */ 00198 virtual int nReferenceDOFsWithFacets( 00199 const CellType& maximalCellType, 00200 const CellType& cellType 00201 ) const ; 00202 00203 00204 /** \brief Return the total number of degrees of freedom associated with 00205 * this basis on a specified cell type. Note: the count returned 00206 * by this function DOES NOT include DOFs owned by facets of the specified 00207 * reference cell. 00208 * 00209 * 00210 * \param cellType 00211 * [in] type of cell for which we want DOF information. 00212 * 00213 * \param maximalCellType 00214 * [in] maximal-dimension cell type to which the cell is connected. 00215 * For example, a triangle in 3D could be connected to a prism 00216 * or to a tetrahedron. 00217 * 00218 * \return Number of DOFs associated with the cell type. 00219 */ 00220 virtual int nReferenceDOFsWithoutFacets( 00221 const CellType& maximalCellType, 00222 const CellType& cellType 00223 ) const = 0; 00224 00225 00226 00227 /** \brief Comparison function allowing use of 00228 * OrderedHandle<BasisFamilyBase> 00229 * in sorted containers. This is needed by the MixedDOFMap ctor when 00230 * it uses an STL map to group functions having the same bases into chunks. 00231 * 00232 * Note: this method should normally only be called from within the 00233 * comparison operator of OrderedHandle, in which context comparisons 00234 * between different derived types have already been resolved by 00235 * comparisons of typeid. Thus, we can require that the lessThan() 00236 * function be called only with an argument whose typeid is 00237 * equal to that of <tt>*this.</tt> We recommend that all overriding 00238 * implementations check that condition. 00239 * 00240 * \param other 00241 * [in] Pointer to another basis family object. 00242 * Precondition: <tt>typeid(*this)==typeid(*other).</tt> 00243 */ 00244 virtual bool lessThan(const BasisDOFTopologyBase* other) const = 0 ; 00245 }; 00246 00247 00248 } // namespace Sundance 00249 00250 00251 #endif