SundanceDOFMapBuilder.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_DOFMAPBUILDER_H
00032 #define SUNDANCE_DOFMAPBUILDER_H
00033 
00034 #include "SundanceDefs.hpp"
00035 #include "SundanceDOFMapBase.hpp"
00036 #include "SundanceFunctionSupportResolver.hpp"
00037 #include "SundanceBasisFamily.hpp"
00038 #include "SundanceCellFilter.hpp"
00039 #include "SundanceCFMeshPair.hpp"
00040 #include "SundanceMap.hpp"
00041 #include "SundanceObjectWithVerbosity.hpp"
00042 
00043 namespace Sundance
00044 {
00045 
00046 
00047 /** 
00048  * 
00049  */
00050 class DOFMapBuilder 
00051 {
00052 public:
00053   /** */
00054   DOFMapBuilder(int setupVerb);
00055   /** */
00056   DOFMapBuilder(const Mesh& mesh, const RCP<FunctionSupportResolver>& fsr, 
00057     bool findBCCols, int setupVerb);
00058 
00059   /** */
00060   const Array<RCP<DOFMapBase> >& rowMap() const {return rowMap_;}
00061 
00062   /** */
00063   const Array<RCP<DOFMapBase> >& colMap() const {return colMap_;}
00064 
00065   /** */
00066   const Array<RCP<Array<int> > >& isBCRow() const {return isBCRow_;}
00067 
00068   /** */
00069   const Array<RCP<Array<int> > >& isBCCol() const {return isBCCol_;}
00070 
00071 
00072   /** */
00073   const Array<RCP<std::set<int> > >& remoteBCCols() const 
00074     {return remoteBCCols_;}
00075 
00076   Array<Array<RCP<BasisDOFTopologyBase> > > testBasisTopologyArray() const ;
00077 
00078   Array<Array<RCP<BasisDOFTopologyBase> > > unkBasisTopologyArray() const ;
00079 
00080   Array<Array<Set<CellFilter> > > testCellFilters() const ;
00081 
00082   Array<Array<Set<CellFilter> > > unkCellFilters() const ;
00083 
00084   const Mesh& mesh() const {return mesh_;}
00085 
00086 
00087 
00088   RCP<DOFMapBase> makeMap(const Mesh& mesh,
00089     const Array<RCP<BasisDOFTopologyBase> >& basis,
00090     const Array<Set<CellFilter> >& filters) ;
00091 
00092   bool hasOmnipresentNodalMap(const Array<RCP<BasisDOFTopologyBase> >& basis,
00093     const Mesh& mesh,
00094     const Array<Set<CellFilter> >& filters) const ;
00095 
00096   bool hasCommonDomain(const Array<Set<CellFilter> >& filters) const ;
00097 
00098   bool hasNodalBasis(const Array<RCP<BasisDOFTopologyBase> >& basis) const ;
00099   
00100   bool hasEdgeLocalizedBasis(const Array<RCP<BasisDOFTopologyBase> >& basis) const ;
00101 
00102   bool hasCellBasis(const Array<RCP<BasisDOFTopologyBase> >& basis) const ;
00103 
00104   bool filtersAreZeroDimensional(const Mesh& mesh,
00105     const Array<Set<CellFilter> >& filters) const ;
00106 
00107   bool allFuncsAreOmnipresent(const Mesh& mesh,
00108     const Array<Set<CellFilter> >& filters) const ;
00109 
00110   bool isWholeDomain(const Mesh& mesh,
00111     int maxFilterDim,
00112     const Set<CellFilter>& filters) const ;
00113 
00114   CellFilter getMaxCellFilter(const Array<Set<CellFilter> >& filters) const ;
00115 
00116   static bool& allowNodalMap() {static bool rtn=true; return rtn;}
00117 
00118   /** */
00119   void extractUnkSetsFromFSR(const FunctionSupportResolver& fsr,
00120     Array<Set<int> >& funcSets,
00121     Array<CellFilter>& regions) const ;
00122 
00123   /** */
00124   void extractVarSetsFromFSR(const FunctionSupportResolver& fsr,
00125     Array<Set<int> >& funcSets,
00126     Array<CellFilter>& regions) const ;
00127 
00128   /** */
00129   const RCP<FunctionSupportResolver>& fsr() const {return fsr_;}
00130 
00131   /** */
00132   Sundance::Map<Set<int>, Set<CellFilter> > 
00133   buildFuncSetToCFSetMap(const Array<Set<int> >& funcSets,
00134     const Array<CellFilter>& regions,
00135     const Mesh& mesh) const ;
00136         
00137   void getSubdomainUnkFuncMatches(const FunctionSupportResolver& fsr,
00138     Array<Sundance::Map<CellFilter, Set<int> > >& fmap) const ;
00139         
00140   void getSubdomainVarFuncMatches(const FunctionSupportResolver& fsr,
00141     Array<Sundance::Map<CellFilter, Set<int> > >& fmap) const ;
00142 
00143   Array<Sundance::Map<Set<int>, CellFilter> > 
00144   funcDomains(const Mesh& mesh,
00145     const Sundance::Map<CellFilter, Set<int> >& fmap,
00146     Sundance::Map<CellFilter, Sundance::Map<Set<int>, CellSet> >& inputToChildrenMap) const ;
00147 
00148   Sundance::Map<CellFilter, Set<int> > domainToFuncSetMap(const Array<Set<CellFilter> >& filters) const ;
00149 
00150 private:
00151 
00152   Set<CellFilter> reduceCellFilters(const Mesh& mesh,
00153     const Set<CellFilter>& inputSet) const ;
00154 
00155   bool hasUnks() const ;
00156 
00157   bool unksAreOmnipresent() const ;
00158 
00159   bool testsAreOmnipresent() const ;
00160 
00161   bool regionIsMaximal(int r) const ;
00162 
00163   bool isSymmetric(int block) const ;
00164 
00165   void markBCRows(int block) ;
00166 
00167   void markBCCols(int block) ;
00168 
00169   const MPIComm& comm() const {return mesh().comm();}
00170 
00171   void init(bool findBCCols);
00172 
00173   int verb_;
00174 
00175   Mesh mesh_;
00176 
00177   RCP<FunctionSupportResolver> fsr_;
00178 
00179   Array<RCP<DOFMapBase> > rowMap_;
00180 
00181   Array<RCP<DOFMapBase> > colMap_;
00182 
00183   Array<RCP<Array<int> > > isBCRow_;
00184 
00185   Array<RCP<Array<int> > > isBCCol_;
00186 
00187   Array<RCP<std::set<int> > > remoteBCCols_;
00188 
00189 };
00190 
00191 /** \relates DOFMapBuilder */
00192 Array<Array<BasisFamily> > testBasisArray(const RCP<FunctionSupportResolver>& fsr) ;
00193 
00194 /** \relates DOFMapBuilder */
00195 Array<Array<BasisFamily> > unkBasisArray(const RCP<FunctionSupportResolver>& fsr) ;
00196 
00197 }
00198 
00199 
00200 #endif

Site Contact