SundanceLocalDOFMap.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 
00032 
00033 #ifndef SUNDANCE_LOCALDOFMAP_H
00034 #define SUNDANCE_LOCALDOFMAP_H
00035 
00036 #include "SundanceDefs.hpp"
00037 #include "SundanceDOFMapBase.hpp"
00038 
00039 
00040 namespace Sundance
00041 {
00042 
00043 /** 
00044  * LocalDOFMap bundles several compact tables used for fast lookup of
00045  * local DOFs. 
00046  */
00047 class LocalDOFMap
00048 {
00049 public:
00050   /** */
00051   LocalDOFMap(int numBlocks, int verb);
00052 
00053   /** */
00054   void setCells(int cellDim, int maxCellDim,
00055     const RCP<const Array<int> >& cellLID);
00056 
00057   /** */
00058   int nCells() const ;
00059 
00060   /** */
00061   bool isUsed(int b) const {return isUsed_[b];}
00062 
00063   /** */
00064   bool isUnused(int b) const {return !isUsed(b);}
00065 
00066   /** */
00067   bool isUnused() const ;
00068 
00069   /** */
00070   void markAsUnused() ;
00071 
00072   /** */
00073   bool hasCells() const {return hasCells_;}
00074 
00075   /** */
00076   const RCP<const Array<int> >& cellLIDs() const {return cellLID_;}
00077 
00078   /** */
00079   void markAsUsed(int b) {isUsed_[b] = true;}
00080 
00081   /** */
00082   int numBlocks() const {return mapStruct_->size();}
00083 
00084   /** */
00085   const Array<int>& nLocalNodesPerChunk(int b) const 
00086     {return (*nLocalNodesPerChunk_)[b];}
00087 
00088   /** */
00089   const RCP<const MapStructure>& mapStruct(int b) const 
00090     {return (*mapStruct_)[b];}
00091 
00092   /** */
00093   const Array<Array<int> >& localDOFs(int b) const 
00094     {return (*localDOFs_)[b];}
00095 
00096   /** */
00097   std::ostream& print(std::ostream& os) const ;
00098 
00099   /** */
00100   void fillBlock(int b, const RCP<DOFMapBase>& globalMap,
00101     const Array<Set<int> >& requiredFunc);
00102 
00103   /** */
00104   void setVerb(int v) const {verb_ = v;}
00105 
00106 private:
00107 
00108 
00109   /** */
00110   Array<int>& nLocalNodesPerChunk(int b)
00111     {return (*nLocalNodesPerChunk_)[b];}
00112 
00113   /** */
00114   RCP<const MapStructure>& mapStruct(int b) 
00115     {return (*mapStruct_)[b];}
00116 
00117   /** */
00118   Array<Array<int> >& localDOFs(int b) 
00119     {return (*localDOFs_)[b];}
00120 
00121   /** */
00122   void verifyValidBlock(int b) const ;
00123 
00124 
00125   mutable int verb_;
00126   Array<int> isUsed_;
00127   bool hasCells_;
00128   RCP<Array<Array<int> > > nLocalNodesPerChunk_;
00129   RCP<Array<RCP<const MapStructure> > > mapStruct_;  
00130   RCP<Array<Array<Array<int> > > > localDOFs_;
00131   RCP<const Array<int> > cellLID_;
00132   int activeCellDim_;
00133   int maxCellDim_;
00134 };
00135 
00136 
00137 /** \relates LocalDOFMap */
00138 inline std::ostream& operator<<(std::ostream& os,
00139   const LocalDOFMap& m)
00140 {
00141   return m.print(os);
00142 }
00143 
00144 }
00145 
00146 
00147 
00148 #endif

Site Contact