00001 /* @HEADER@ */ 00002 // ************************************************************************ 00003 // 00004 // Sundance 00005 // Copyright 2011 Sandia Corporation 00006 // 00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00008 // the U.S. Government retains certain rights in this software. 00009 // 00010 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 // Questions? Contact Kevin Long (kevin.long@ttu.edu) 00038 // 00039 00040 /* @HEADER@ */ 00041 00042 #ifndef SUNDANCE_BASISDOFTOPOLOGYBASE_H 00043 #define SUNDANCE_BASISDOFTOPOLOGYBASE_H 00044 00045 #include "SundanceDefs.hpp" 00046 #include "SundanceCellType.hpp" 00047 #include "Teuchos_Array.hpp" 00048 #include "Teuchos_Describable.hpp" 00049 00050 namespace Sundance { 00051 00052 00053 using Teuchos::Array; 00054 using Sundance::CellType; 00055 00056 /** 00057 * Abstract interface for specification of the topology of degree-of-freedom 00058 * (DOF) assignments on reference cells in any dimension. Currently, 00059 * only an enumerated set of cell types are supported (see <tt>CellType</tt>). 00060 * 00061 * A function \f$g(x)\f$ defined on a cell is represented as: 00062 00063 \f[ 00064 g(x) = \sum_{i=0}^{N-1} \bar{g}_i \psi_i(x) 00065 \f] 00066 00067 * where \f$x\in\Re^{D}\f$ is the spatial spatial coordinate for spatical dim 00068 * \f$D\f$ that lives in the cell's domain, \f$\psi_i(x)\f$ is the \f$i\f$th 00069 * basis function (of order = <tt>order()</tt>), \f$\bar{g}_i\f$ is the 00070 * (constant) coefficient for the \f$i\f$th basis function, and \f$N\f$ is the 00071 * number of basis functions. Therefore, given the coefficients of the basis 00072 * function on the cell \f$\bar{g}_i\f$, one can compute the value of the 00073 * function \f$g(x)\f$ on the cell at any point \f$x\f$ in the domain of the 00074 * cell given the above summation formula. This interface refers to the 00075 * coefficients \f$\bar{g}_i\f$ as degrees of freedom (<b>DOFs</b>). 00076 * 00077 * This interface allows the specification basis functions and basis 00078 * coefficients (i.e. DOFs) to be associated with any of the facets of a cell, 00079 * including the cell itself without restriction. See the function 00080 * <tt>getLocalDOFs()</tt> for how this mapping of DOFs to facets for a single 00081 * function defined on the cell. 00082 * 00083 * It is important to note that each cell type, i.e. the values of the enum 00084 * <tt>CellType</tt>, has a "agreed upon" geometry for the "reference cell" 00085 * and this geometry must be known by the client of the basis family and the 00086 * concrete implementations of the basis family. 00087 * 00088 * This is an interoperability interface and is therefore 00089 * deliberately minimalist. 00090 */ 00091 class BasisDOFTopologyBase : 00092 public Teuchos::Describable 00093 { 00094 public: 00095 00096 /** 00097 * \brief Inform caller as to whether a given combination 00098 * of cell types is supported. 00099 * 00100 * \param maximalCellType 00101 * [in] maximal-dimension cell type to which the cell is connected. 00102 * For example, a triangle in 3D could be connected to a prism 00103 * or to a tetrahedron. 00104 * 00105 * \param cellType 00106 * [in] type of cell for which we want DOF information. 00107 * 00108 */ 00109 virtual bool supportsCellTypePair( 00110 const CellType& maximalCellType, 00111 const CellType& cellType 00112 ) const = 0 ; 00113 00114 00115 00116 /** \brief Get a description of the DOF numbering and distribution scheme 00117 * for this basis function on the given cell type. 00118 * 00119 * \param cellType 00120 * [in] Specification of the cell topology 00121 * \param dofs 00122 * [out] Array of dof numbering information, to be filled in 00123 * during the call. On output, 00124 * <tt>dofs.size()==dimension(cellType)</tt>. See description of 00125 * <tt>dofs</tt> below for more details. 00126 * 00127 * The DOF description is returned in the nested array <tt>dofs</tt>, and is 00128 * to be interpreted as follows: The outer dimension of the description 00129 * array <tt>dofs.size()</tt> is <tt>cellDim</tt>, where <tt>cellDim</tt> is 00130 * the spatial dimension of the cell. The DOFs attached to facets are 00131 * stored in array entries <tt>dofs[s]</tt> where <tt>s=0...cellDim-1</tt>. 00132 * Those associated with the cell body are stored in 00133 * <tt>dofs[cellDim-1]</tt>. For cell dofs attached to facets, the dof 00134 * <tt>facetDofIndex</tt> associated with the facet <tt>facetIndex</tt> of 00135 * facet dimension <tt>facetDim</tt> is given by: 00136 00137 \code 00138 dofs[facetDim][facetIndex][faceDofIndex] 00139 \endcode 00140 00141 * For dofs attached to the cell body, the local DOF within the entire cell 00142 * is given by dof is given by 00143 00144 \code 00145 dofs[cellDim][0][dofIndex] 00146 \endcode 00147 00148 * More specifically:<ul> 00149 * 00150 * <li><tt>dof[facetDim].size()</tt> gives the number of facets of the facet 00151 * dimension <tt>facetDim</tt>, where <tt>0 <= facetDim <= cellDim</tt> 00152 * 00153 * <li><tt>dof[facetDim][facetIndex].size()</tt> gives the number of degrees 00154 * of freedom (DOFs) on the facet <tt>facetIndex</tt> with facet dimension 00155 * <tt>facetDim</tt>, where <tt>0 <= facetDim <= cellDim</tt> and <tt>0 <= 00156 * facetIndex < numFacets(cellType,facetDim)</tt>. 00157 * 00158 * </ul> 00159 * 00160 * For example, the Lagrange basis functions of order 0 through 3 on 2D 00161 * triangles would have the following dof arrays: 00162 00163 \verbatim 00164 00165 Order 0: 00166 00167 { {}, {}, {{0}} } 00168 00169 Order 1: 00170 00171 { { {0}, {1}, {2} }, {}, {} } 00172 00173 Order 2: 00174 00175 { { {0}, {1}, {2} }, { {3}, {4}, {5} }, {} } 00176 00177 Order 3: 00178 00179 { { {0}, {1}, {2} }, { {3,4}, {5,6}, {7,8} }, {9} } 00180 00181 \endverbatim 00182 00183 * Above, we have used the ordering given in Hughes' textbook. 00184 */ 00185 virtual void getReferenceDOFs( 00186 const CellType& maximalCellType, 00187 const CellType& cellType, 00188 Array<Array<Array<int> > >& dofs 00189 ) const = 0 ; 00190 00191 00192 00193 /** \brief Return the total number of degrees of freedom associated with 00194 * this basis on a specified cell type. Note: the count returned 00195 * by this function includes DOFs owned by facets of the specified 00196 * reference cell. 00197 * 00198 * 00199 * \param cellType 00200 * [in] type of cell for which we want DOF information. 00201 * 00202 * \param maximalCellType 00203 * [in] maximal-dimension cell type to which the cell is connected. 00204 * For example, a triangle in 3D could be connected to a prism 00205 * or to a tetrahedron. 00206 * 00207 * \return Number of DOFs associated with the cell type and its facets. 00208 */ 00209 virtual int nReferenceDOFsWithFacets( 00210 const CellType& maximalCellType, 00211 const CellType& cellType 00212 ) const ; 00213 00214 00215 /** \brief Return the total number of degrees of freedom associated with 00216 * this basis on a specified cell type. Note: the count returned 00217 * by this function DOES NOT include DOFs owned by facets of the specified 00218 * reference cell. 00219 * 00220 * 00221 * \param cellType 00222 * [in] type of cell for which we want DOF information. 00223 * 00224 * \param maximalCellType 00225 * [in] maximal-dimension cell type to which the cell is connected. 00226 * For example, a triangle in 3D could be connected to a prism 00227 * or to a tetrahedron. 00228 * 00229 * \return Number of DOFs associated with the cell type. 00230 */ 00231 virtual int nReferenceDOFsWithoutFacets( 00232 const CellType& maximalCellType, 00233 const CellType& cellType 00234 ) const = 0; 00235 00236 00237 00238 /** \brief Comparison function allowing use of 00239 * OrderedHandle<BasisFamilyBase> 00240 * in sorted containers. This is needed by the MixedDOFMap ctor when 00241 * it uses an STL map to group functions having the same bases into chunks. 00242 * 00243 * Note: this method should normally only be called from within the 00244 * comparison operator of OrderedHandle, in which context comparisons 00245 * between different derived types have already been resolved by 00246 * comparisons of typeid. Thus, we can require that the lessThan() 00247 * function be called only with an argument whose typeid is 00248 * equal to that of <tt>*this.</tt> We recommend that all overriding 00249 * implementations check that condition. 00250 * 00251 * \param other 00252 * [in] Pointer to another basis family object. 00253 * Precondition: <tt>typeid(*this)==typeid(*other).</tt> 00254 */ 00255 virtual bool lessThan(const BasisDOFTopologyBase* other) const = 0 ; 00256 }; 00257 00258 00259 } // namespace Sundance 00260 00261 00262 #endif