Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Examples  

TemporaryMapper.h

Go to the documentation of this file.
00001 #ifndef TEMPORARYMAPPER_H
00002 #define TEMPORARYMAPPER_H
00003 
00004 #include "SundanceDefs.h"
00005 
00006 #include "TSFArray.h"
00007 #include "Mesh.h"
00008 #include "TSFSmartPtr.h"
00009 
00010 
00011 
00012 namespace Sundance
00013 {
00014 
00015   using namespace TSF;
00016   using std::string;
00017 
00018   using std::ostream;
00019 
00020 
00021 
00022   /** \ingroup LowLevelFE
00023 
00024   This is a temporary data structure used in building the
00025   local-global DOF maps. It distributes the DOFs among all cells,
00026   not just the cells that will be integrated. This data structure
00027   is huge, but it gets deleted before the matrix is built.
00028 
00029   Initially, all cells are tagged with -1, which indicates that
00030   they have not yet had a DOF number assigned. DOF indices are
00031   assigned during calls to the appendDOFs() method; if a cell is
00032   not locally owned, that cell's global index is appended to a
00033   table of requests to be resolved by other processors.  Remotely
00034   owned cells are tagged with -2. That tag is never used in
00035   calculations, but can trap errors if some cell never gets
00036   resolved.
00037 
00038   Once all the local DOFs have been assigned and the remote cells
00039   have been identified, call synchronizeRemoteDOFs() to share DOF
00040   counts across processors and resolve DOF numbers for remotely
00041   owned cells.
00042 
00043   Finally, after the remote DOFs have been resolved, we can make
00044   calls to the getDOFs() methods to get DOF indices for (cell,
00045   funcID) sets.  */
00046 
00047   class TemporaryMapper
00048     {
00049     public:
00050       /** */
00051       TemporaryMapper(const Mesh& mesh, int nFunc);
00052 
00053       /** */
00054       void appendDOFs(const Cell& cell, const TSFArray<int>& funcID);
00055 
00056       /** */
00057       void getDOFs(const Cell& cell,
00058                    const TSFArray<int>& funcID,
00059                    TSFArray<int>& indices) ;
00060 
00061       /** */
00062       int numberOfLocalDOFs() const {return localDOFs_;}
00063       /** */
00064       int numberOfRemoteDOFs() const {return remoteDOFList_->length();}
00065       /** */
00066       int lowestLocalDOF() const {return globalOffsets_[MPIComm::world().getRank()];}
00067       /** */
00068       void synchronizeRemoteDOFs();
00069       /** */
00070       void synchronizeRemoteDOFs(int dimension);
00071       /** */
00072       const TSFSmartPtr<TSFArray<int> >& remoteDOFList() const {return remoteDOFList_;}
00073       /** */
00074       void print() const ;
00075 
00076       /** */
00077       static bool& verboseDOFAssignment() {static bool rtn=false; return rtn;}
00078 
00079       /** */
00080       static bool& verboseComm() {static bool rtn=false; return rtn;}
00081 
00082 
00083     private:
00084       int myProcID_;
00085       Mesh mesh_;
00086       int localDOFs_;
00087       int remoteDOFs_;
00088       int nFunc_;
00089       // map_[cellDim][cellIndex][funcID] --> DOF index
00090       TSFArray<TSFArray<TSFArray<int> > > cellAndFuncToIndexMap_;
00091       TSFArray<TSFArray<TSFArray<bool> > > cellAndFuncTag_;
00092       // dofRequests_[cellDim][procID] {cellIndex1, fid1, cellIndex2, fid2...}
00093       TSFArray<TSFArray<TSFArray<int> > > remoteDOFRequests_;
00094       TSFArray<int> globalOffsets_;
00095       TSFSmartPtr<TSFArray<int> > remoteDOFList_;
00096 
00097     };
00098 
00099 
00100 
00101 
00102 }
00103 #endif
00104 

Contact:
Kevin Long (krlong@ca.sandia.gov)


Documentation generated by