SundanceMixedDOFMap.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 SUNDANCE_MIXEDDOFMAP_H
00032 #define SUNDANCE_MIXEDDOFMAP_H
00033 
00034 
00035 #include "SundanceDefs.hpp"
00036 #include "SundanceMesh.hpp"
00037 #include "SundanceCellSet.hpp"
00038 #include "SundanceCellFilter.hpp"
00039 #include "SundanceSpatiallyHomogeneousDOFMapBase.hpp"
00040 
00041 namespace Sundance
00042 {
00043 using namespace Teuchos;
00044 
00045 class BasisDOFTopologyBase;
00046 
00047 /** 
00048  * A MixedDOFMap is a DOF map for the case where 
00049  * every function is defined
00050  * on every cell in the mesh, but where functions may have different bases. 
00051  */
00052 class MixedDOFMap : public SpatiallyHomogeneousDOFMapBase
00053 {
00054 public:
00055   /** */
00056   MixedDOFMap(const Mesh& mesh, 
00057     const Array<RCP<BasisDOFTopologyBase> >& basis,
00058     const CellFilter& maxCells, 
00059     int setupVerb);
00060                         
00061   /** */
00062   virtual ~MixedDOFMap(){;}
00063 
00064   /** */
00065   RCP<const MapStructure> 
00066   getDOFsForCellBatch(int cellDim,
00067     const Array<int>& cellLID,
00068     const Set<int>& requestedFuncSet,
00069     Array<Array<int> >& dofs,
00070     Array<int>& nNodes,
00071     int verbosity) const ;
00072 
00073   /** */
00074   RCP<const MapStructure> mapStruct() const 
00075     {return structure_;}
00076 
00077   /** */
00078   int chunkForFuncID(int funcID) const
00079     {return structure_->chunkForFuncID(funcID);}
00080 
00081   /** */
00082   int indexForFuncID(int funcID) const 
00083     {return structure_->indexForFuncID(funcID);}
00084       
00085   /** */
00086   int nFuncs(int basisChunk) const
00087     {return nFuncs_[basisChunk];}
00088 
00089   /** */
00090   int nBasisChunks() const 
00091     {return nFuncs_.size();}
00092 
00093   /** */
00094   const RCP<BasisDOFTopologyBase>& basis(int basisChunk) const
00095     {return structure_->basis(basisChunk);}
00096 
00097   /** */
00098   const Array<int>& funcID(int basisChunk) const 
00099     {return structure_->funcs(basisChunk);}
00100 
00101 
00102 private:
00103 
00104   /** */
00105   void checkTable() const ;
00106 
00107   /** */
00108   inline int getInitialDOFForCell(int cellDim, int cellLID, int basisChunk) const
00109     {
00110       return dofs_[cellDim][basisChunk][cellLID*nDofsPerCell_[basisChunk][cellDim]];
00111     }
00112 
00113   inline int* getInitialDOFPtrForCell(int cellDim, int cellLID, int basisChunk)
00114     {
00115       return &(dofs_[cellDim][basisChunk][cellLID*nDofsPerCell_[basisChunk][cellDim]]);
00116     }
00117 
00118   inline const int* getInitialDOFPtrForCell(int cellDim, int cellLID, 
00119     int basisChunk) const 
00120     {
00121       return &(dofs_[cellDim][basisChunk][cellLID*nDofsPerCell_[basisChunk][cellDim]]);
00122     }
00123 
00124   /** */
00125   void allocate(const Mesh& mesh);
00126       
00127   /** */
00128   void buildMaximalDofTable() const ;
00129 
00130   bool hasBeenAssigned(int cellDim, int cellLID) const 
00131     {return hasBeenAssigned_[cellDim][cellLID];}
00132 
00133   void markAsAssigned(int cellDim, int cellLID)
00134     {hasBeenAssigned_[cellDim][cellLID] = true;}
00135 
00136   /** */
00137   void initMap();
00138 
00139   /** */
00140   void setDOFs(int basisChunk, int cellDim, int cellLID, 
00141     int& nextDOF, bool isRemote=false);
00142 
00143   /** */
00144   void shareDOFs(int cellDim,
00145     const Array<Array<int> >& outgoingCellRequests);
00146 
00147   /** */
00148   void computeOffsets(int dim, int localCount);
00149 
00150   /** */
00151   static int uninitializedVal() {return -1;}
00152 
00153   /** */
00154   CellFilter maxCells_;
00155 
00156   /** spatial dimension */
00157   int dim_;
00158 
00159   /** Tables of DOFs, indexed by dimension and chunk number.
00160    *
00161    * dof(cellDim, cellLID, chunk, func, node) 
00162    * = dofs_[cellDim][chunk][(cellLID*nFunc + func)*nNode + node]
00163    */
00164   Array<Array<Array<int> > > dofs_;
00165 
00166   /** DOFs for maximal cells, indexed by basis chunk number 
00167    *
00168    * dof(cellLID, chunk, func, node) 
00169    * = maximalDofs_[chunk][(cellLID*nFunc + func)*nNode + node];
00170    */
00171   mutable Array<Array<int> > maximalDofs_;
00172 
00173   /** whether maximal DOFs have been tabulated */
00174   mutable bool haveMaximalDofs_;
00175 
00176   /** 
00177    * localNodePtrs_[basisChunk][cellDim][facetDim][facetNumber][nodeNumber]
00178    */
00179   Array<Array<Array<Array<Array<int> > > > > localNodePtrs_;
00180 
00181   /** The number of nodes per cell, for each basis function type, 
00182    * <i>not</i> including the nodes of the facets of the cell. Indexed as 
00183    * nNodesPerCell_[basis][dimension] */
00184   Array<Array<int> > nNodesPerCell_;
00185 
00186   /** The number of DOFs per cell, for each basis function type, 
00187    * <i>not</i> including the DOFs of the facets of the cell. Indexed as 
00188    * nDofsPerCell_[basis][dimension] */
00189   Array<Array<int> > nDofsPerCell_;
00190 
00191   /** The number of nodes per cell, for each basis function type, including
00192    * the nodes of the facets of the cell. Indexed as 
00193    * nNodesPerCell_[basis][dimension] */
00194   Array<Array<int> > totalNNodesPerCell_;
00195 
00196   /** The number of DOFs per cell, for each basis function type, including
00197    * the DOFs of the facets of the cell. Indexed as 
00198    * nDofsPerCell_[basis][dimension] */
00199   Array<Array<int> > totalNDofsPerCell_;
00200 
00201   /** Indicates whether the cells of each dimension have any DOFs in this
00202    * map, for any chunk. */
00203   Array<int> cellHasAnyDOFs_;
00204 
00205   /** number of facets of dimension facetDim for cells of dimension cellDim.
00206    * Indexed as numFacets_[cellDim][facetDim]
00207    */
00208   Array<Array<int> > numFacets_;
00209 
00210   /** Orientation of each edge or face as seen by the maximal cell
00211    * from which its DOFs were originally assigned. */
00212   Array<Array<int> > originalFacetOrientation_;
00213 
00214   /** */
00215   Array<Array<int> > hasBeenAssigned_;
00216 
00217   /** */
00218   RCP<const MapStructure> structure_;
00219 
00220   /** */
00221   Array<int> nFuncs_;
00222 };
00223 }
00224 
00225                   
00226 #endif

Site Contact