00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 #ifndef SUNDANCE_INHOMOGENOUSDOFMAPHN_H
00032 #define SUNDANCE_INHOMOGENOUSDOFMAPHN_H
00033 
00034 
00035 #include "SundanceDefs.hpp"
00036 #include "SundanceMesh.hpp"
00037 #include "SundanceCellSet.hpp"
00038 #include "SundanceCellFilter.hpp"
00039 #include "SundanceHNDoFMapBase.hpp"
00040 #include "SundanceDOFMapBase.hpp"
00041 #include "SundanceBasisFamilyBase.hpp"
00042 #include "SundanceMatrixStore.hpp"
00043 
00044 namespace Sundance
00045 {
00046 using namespace Teuchos;
00047 
00048 class BasisDOFTopologyBase;
00049 
00050 
00051 
00052 
00053 
00054 
00055 
00056 
00057 class InhomogeneousDOFMapHN : public HNDoFMapBase , public DOFMapBase
00058 {
00059 public:
00060 
00061   InhomogeneousDOFMapHN(const Mesh& mesh,
00062     const Array<RCP<BasisDOFTopologyBase> >& basis,
00063     const Array<Map<Set<int>, CellFilter> >& funcSetToDomainMap,
00064     int setupVerb);
00065                         
00066 
00067   virtual ~InhomogeneousDOFMapHN(){;}
00068 
00069 
00070   RCP<const MapStructure> 
00071   getDOFsForCellBatch(int cellDim,
00072     const Array<int>& cellLID,
00073     const Set<int>& requestedFuncSet,
00074     Array<Array<int> >& dofs,
00075     Array<int>& nNodes,
00076     int verbosity) const ;
00077 
00078 
00079 
00080 
00081 
00082 
00083 
00084   void getTrafoMatrixForCell(
00085       int cellLID,
00086       int funcID,
00087       int& trafoMatrixSize,
00088       bool& doTransform,
00089       Array<double>& transfMatrix ) const;
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099      void getTrafoMatrixForFacet(
00100       int cellDim,
00101       int cellLID,
00102       int facetIndex,
00103       int funcID,
00104       int& trafoMatrixSize,
00105       bool& doTransform,
00106       Array<double>& transfMatrix ) const;
00107 
00108 
00109 
00110    RCP<const Set<int> >
00111    allowedFuncsOnCellBatch(int cellDim,
00112        const Array<int>& cellLID) const ;
00113 
00114 
00115 
00116 
00117   void getDOFsForHNCell(
00118     int cellDim,
00119     int cellLID,
00120       int funcID,
00121       Array<int>& dofs ,
00122       Array<double>& coefs ) const;
00123 
00124 
00125   RCP<const MapStructure> mapStruct() const 
00126     {return structure_;}
00127 
00128 
00129   int chunkForFuncID(int funcID) const
00130     {return structure_->chunkForFuncID(funcID);}
00131 
00132 
00133   int indexForFuncID(int funcID) const 
00134     {return structure_->indexForFuncID(funcID);}
00135       
00136 
00137   int nFuncs(int basisChunk) const
00138     {return nFuncs_[basisChunk];}
00139 
00140 
00141   int nBasisChunks() const 
00142     {return nFuncs_.size();}
00143 
00144 
00145   const RCP<BasisDOFTopologyBase>& basis(int basisChunk) const
00146     {return structure_->basis(basisChunk);}
00147 
00148 
00149   const Array<int>& funcID(int basisChunk) const 
00150     {return structure_->funcs(basisChunk);}
00151 
00152 
00153   int getfuncID(int basisChunk, int funcNr ) const{
00154     return (this->funcID(basisChunk))[funcNr];
00155   }
00156 
00157 
00158   const Array<CellFilter>& funcDomains() const {return funcDomains_;}
00159 
00160 
00161   virtual void print(std::ostream& os) const ;
00162 
00163 private:
00164 
00165 
00166   inline int getInitialDOFForCell(int cellDim, int cellLID, int funcID) const
00167     {
00168       return dofs_[cellDim][cellLID][funcID][0];
00169     }
00170 
00171   inline int* getInitialDOFPtrForCell(int cellDim, int cellLID, int funcID)
00172     {
00173       return &(dofs_[cellDim][cellLID][funcID][0]);
00174     }
00175 
00176   inline const int* getInitialDOFPtrForCell(int cellDim, int cellLID, 
00177     int funcID) const
00178     {
00179       return &(dofs_[cellDim][cellLID][funcID][0]);
00180     }
00181 
00182 
00183   void allocate(const Mesh& mesh);
00184       
00185 
00186   void buildMaximalDofTable();
00187 
00188   bool hasBeenAssigned(int cellDim, int cellLID) const 
00189     {return hasBeenAssigned_[cellDim][cellLID];}
00190 
00191   void markAsAssigned(int cellDim, int cellLID)
00192     {hasBeenAssigned_[cellDim][cellLID] = true;}
00193 
00194 
00195   void initMap();
00196 
00197 
00198   void setDOFs(int basisChunk, int cellDim, int cellLID, 
00199     int& nextDOF, bool isRemote=false);
00200 
00201 
00202   void shareDOFs(int cellDim,
00203     const Array<Array<int> >& outgoingCellRequests);
00204 
00205 
00206   void computeOffsets(int dim, int localCount);
00207 
00208 
00209   static int uninitializedVal() {return -1;}
00210 
00211 
00212   int dim_;
00213 
00214 
00215 
00216 
00217 
00218 
00219   Array< Array<Array<Array<int> > > > dofs_;
00220 
00221 
00222 
00223 
00224   Array< Array<Array<short signed int> > > funcDefined_;
00225 
00226 
00227 
00228 
00229 
00230   mutable Array< Array<Array<int> > > maximalDofs_;
00231 
00232 
00233   mutable bool haveMaximalDofs_;
00234 
00235 
00236 
00237 
00238   Array<Array<Array<Array<Array<int> > > > > localNodePtrs_;
00239 
00240 
00241   Array<CellFilter> maxSubdomains_;
00242 
00243 
00244   Array<CellFilter> funcDomains_;
00245 
00246 
00247   Set<int> allFuncs_;
00248 
00249 
00250 
00251   Array<Set<int> > elemFuncSetsDomain_;
00252 
00253 
00254   Array<Set<int> > elemFuncSets_;
00255 
00256 
00257   Array<int> funcSetCellCount_;
00258 
00259 
00260 
00261   Array<int> maxCellFuncSetsIndex_;
00262 
00263 
00264 
00265 
00266    int nPoints_;
00267 
00268 
00269    int nrAllFuncs_;
00270 
00271 
00272    Array<bool> hasCellHanging_;
00273 
00274 
00275    Array< Array<bool> > isElementHanging_;
00276 
00277 
00278    Sundance::Map< int , Array<int>  > HN_To_globalFacetsLID_;
00279 
00280 
00281    Sundance::Map< int , Array<int>  > HN_To_globalFacetsDim_;
00282 
00283 
00284    Sundance::Map< int , Array<double>  > HN_To_coeffs_;
00285 
00286 
00287 
00288 
00289    Sundance::Map< int , Array < int > > maxCellLIDwithHN_to_TrafoMatrix_;
00290 
00291 
00292    MatrixStore                          matrixStore_;
00293 
00294 
00295    mutable Array<RCP<BasisFamilyBase> > basis_;
00296 
00297 
00298 
00299 
00300 
00301 
00302   Array<Array<int> > nNodesPerCell_;
00303 
00304 
00305 
00306 
00307   Array<Array<int> > nDofsPerCell_;
00308 
00309 
00310 
00311 
00312   Array<Array<int> > totalNNodesPerCell_;
00313 
00314 
00315 
00316   Array<int> cellHasAnyDOFs_;
00317 
00318 
00319 
00320 
00321   Array<Array<int> > numFacets_;
00322 
00323 
00324 
00325   Array<Array<int> > originalFacetOrientation_;
00326 
00327 
00328   Array<Array<int> > hasBeenAssigned_;
00329 
00330 
00331   RCP<const MapStructure> structure_;
00332 
00333 
00334   Array<int> nFuncs_;
00335 };
00336 }
00337 
00338                   
00339 #endif