SundanceDOFMapBuilder.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 // ************************************************************************
00003 // 
00004 //                             Sundance
00005 //                 Copyright 2011 Sandia Corporation
00006 // 
00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00008 // the U.S. Government retains certain rights in this software.
00009 //
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Kevin Long (kevin.long@ttu.edu)
00038 // 
00039 
00040 /* @HEADER@ */
00041 
00042 #ifndef SUNDANCE_DOFMAPBUILDER_H
00043 #define SUNDANCE_DOFMAPBUILDER_H
00044 
00045 #include "SundanceDefs.hpp"
00046 #include "SundanceDOFMapBase.hpp"
00047 #include "SundanceFunctionSupportResolver.hpp"
00048 #include "SundanceBasisFamily.hpp"
00049 #include "SundanceCellFilter.hpp"
00050 #include "SundanceCFMeshPair.hpp"
00051 #include "SundanceMap.hpp"
00052 #include "SundanceObjectWithVerbosity.hpp"
00053 
00054 namespace Sundance
00055 {
00056 
00057 
00058 /** 
00059  * 
00060  */
00061 class DOFMapBuilder 
00062 {
00063 public:
00064   /** */
00065   DOFMapBuilder(int setupVerb);
00066   /** */
00067   DOFMapBuilder(const Mesh& mesh, const RCP<FunctionSupportResolver>& fsr, 
00068     bool findBCCols, int setupVerb);
00069 
00070   /** */
00071   const Array<RCP<DOFMapBase> >& rowMap() const {return rowMap_;}
00072 
00073   /** */
00074   const Array<RCP<DOFMapBase> >& colMap() const {return colMap_;}
00075 
00076   /** */
00077   const Array<RCP<Array<int> > >& isBCRow() const {return isBCRow_;}
00078 
00079   /** */
00080   const Array<RCP<Array<int> > >& isBCCol() const {return isBCCol_;}
00081 
00082 
00083   /** */
00084   const Array<RCP<std::set<int> > >& remoteBCCols() const 
00085     {return remoteBCCols_;}
00086 
00087   Array<Array<RCP<BasisDOFTopologyBase> > > testBasisTopologyArray() const ;
00088 
00089   Array<Array<RCP<BasisDOFTopologyBase> > > unkBasisTopologyArray() const ;
00090 
00091   Array<Array<Set<CellFilter> > > testCellFilters() const ;
00092 
00093   Array<Array<Set<CellFilter> > > unkCellFilters() const ;
00094 
00095   const Mesh& mesh() const {return mesh_;}
00096 
00097 
00098 
00099   RCP<DOFMapBase> makeMap(const Mesh& mesh,
00100     const Array<RCP<BasisDOFTopologyBase> >& basis,
00101     const Array<Set<CellFilter> >& filters) ;
00102 
00103   bool hasOmnipresentNodalMap(const Array<RCP<BasisDOFTopologyBase> >& basis,
00104     const Mesh& mesh,
00105     const Array<Set<CellFilter> >& filters) const ;
00106 
00107   bool hasCommonDomain(const Array<Set<CellFilter> >& filters) const ;
00108 
00109   bool hasNodalBasis(const Array<RCP<BasisDOFTopologyBase> >& basis) const ;
00110   
00111   bool hasEdgeLocalizedBasis(const Array<RCP<BasisDOFTopologyBase> >& basis) const ;
00112 
00113   bool hasCellBasis(const Array<RCP<BasisDOFTopologyBase> >& basis) const ;
00114 
00115   bool filtersAreZeroDimensional(const Mesh& mesh,
00116     const Array<Set<CellFilter> >& filters) const ;
00117 
00118   bool allFuncsAreOmnipresent(const Mesh& mesh,
00119     const Array<Set<CellFilter> >& filters) const ;
00120 
00121   bool isWholeDomain(const Mesh& mesh,
00122     int maxFilterDim,
00123     const Set<CellFilter>& filters) const ;
00124 
00125   CellFilter getMaxCellFilter(const Array<Set<CellFilter> >& filters) const ;
00126 
00127   static bool& allowNodalMap() {static bool rtn=true; return rtn;}
00128 
00129   /** */
00130   void extractUnkSetsFromFSR(const FunctionSupportResolver& fsr,
00131     Array<Set<int> >& funcSets,
00132     Array<CellFilter>& regions) const ;
00133 
00134   /** */
00135   void extractVarSetsFromFSR(const FunctionSupportResolver& fsr,
00136     Array<Set<int> >& funcSets,
00137     Array<CellFilter>& regions) const ;
00138 
00139   /** */
00140   const RCP<FunctionSupportResolver>& fsr() const {return fsr_;}
00141 
00142   /** */
00143   Sundance::Map<Set<int>, Set<CellFilter> > 
00144   buildFuncSetToCFSetMap(const Array<Set<int> >& funcSets,
00145     const Array<CellFilter>& regions,
00146     const Mesh& mesh) const ;
00147         
00148   void getSubdomainUnkFuncMatches(const FunctionSupportResolver& fsr,
00149     Array<Sundance::Map<CellFilter, Set<int> > >& fmap) const ;
00150         
00151   void getSubdomainVarFuncMatches(const FunctionSupportResolver& fsr,
00152     Array<Sundance::Map<CellFilter, Set<int> > >& fmap) const ;
00153 
00154   Array<Sundance::Map<Set<int>, CellFilter> > 
00155   funcDomains(const Mesh& mesh,
00156     const Sundance::Map<CellFilter, Set<int> >& fmap,
00157     Sundance::Map<CellFilter, Sundance::Map<Set<int>, CellSet> >& inputToChildrenMap) const ;
00158 
00159   Sundance::Map<CellFilter, Set<int> > domainToFuncSetMap(const Array<Set<CellFilter> >& filters) const ;
00160 
00161 private:
00162 
00163   Set<CellFilter> reduceCellFilters(const Mesh& mesh,
00164     const Set<CellFilter>& inputSet) const ;
00165 
00166   bool hasUnks() const ;
00167 
00168   bool unksAreOmnipresent() const ;
00169 
00170   bool testsAreOmnipresent() const ;
00171 
00172   bool regionIsMaximal(int r) const ;
00173 
00174   bool isSymmetric(int block) const ;
00175 
00176   void markBCRows(int block) ;
00177 
00178   void markBCCols(int block) ;
00179 
00180   const MPIComm& comm() const {return mesh().comm();}
00181 
00182   void init(bool findBCCols);
00183 
00184   int verb_;
00185 
00186   Mesh mesh_;
00187 
00188   RCP<FunctionSupportResolver> fsr_;
00189 
00190   Array<RCP<DOFMapBase> > rowMap_;
00191 
00192   Array<RCP<DOFMapBase> > colMap_;
00193 
00194   Array<RCP<Array<int> > > isBCRow_;
00195 
00196   Array<RCP<Array<int> > > isBCCol_;
00197 
00198   Array<RCP<std::set<int> > > remoteBCCols_;
00199 
00200 };
00201 
00202 /** \relates DOFMapBuilder */
00203 Array<Array<BasisFamily> > testBasisArray(const RCP<FunctionSupportResolver>& fsr) ;
00204 
00205 /** \relates DOFMapBuilder */
00206 Array<Array<BasisFamily> > unkBasisArray(const RCP<FunctionSupportResolver>& fsr) ;
00207 
00208 }
00209 
00210 
00211 #endif

Site Contact