SundanceDiscreteSpace.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_DISCRETESPACE_H
00032 #define SUNDANCE_DISCRETESPACE_H
00033 
00034 #include "SundanceDefs.hpp"
00035 #include "SundanceMesh.hpp"
00036 #include "SundanceBasisFamily.hpp"
00037 #include "SundanceSpectralBasis.hpp"
00038 #include "SundanceDOFMapBase.hpp"
00039 #include "PlayaVectorType.hpp"
00040 #include "PlayaVectorSpaceDecl.hpp"
00041 #include "SundanceObjectWithVerbosity.hpp"
00042 #include "SundanceDiscreteSpaceTransfBuilder.hpp"
00043 
00044 
00045 namespace Sundance
00046 {
00047 class FunctionSupportResolver;
00048 }
00049 
00050 namespace Sundance
00051 {
00052   using namespace Teuchos;
00053   using namespace Playa;
00054 
00055   /** 
00056    * DiscreteSpace represents a discrete finite-element space (i.e., 
00057    * a mesh and a basis).
00058    */
00059   class DiscreteSpace
00060   {
00061   public:
00062     /** */
00063     DiscreteSpace(){;}
00064     /** */
00065     DiscreteSpace(const Mesh& mesh, const BasisFamily& basis,
00066       const VectorType<double>& vecType,
00067       int setupVerb = 0);
00068     /** */
00069     DiscreteSpace(const Mesh& mesh, const BasisArray& basis,
00070                   const VectorType<double>& vecType,
00071       int setupVerb = 0);
00072 
00073     /** */
00074     DiscreteSpace(const Mesh& mesh, const BasisArray& basis,
00075                   const Array<CellFilter>& regions,
00076                   const VectorType<double>& vecType,
00077       int setupVerb = 0);
00078 
00079 
00080     /** */
00081     DiscreteSpace(const Mesh& mesh, const BasisFamily& basis,
00082                   const CellFilter& regions,
00083                   const VectorType<double>& vecType,
00084       int setupVerb = 0);
00085 
00086 
00087     /** */
00088     DiscreteSpace(const Mesh& mesh, const BasisArray& basis,
00089                   const CellFilter& regions,
00090                   const VectorType<double>& vecType,
00091       int setupVerb = 0);
00092 
00093     /** */
00094     DiscreteSpace(const Mesh& mesh, const BasisArray& basis,
00095                   const RCP<DOFMapBase>& map,
00096                   const VectorType<double>& vecType,
00097       int setupVerb = 0);
00098 
00099     /** */
00100     DiscreteSpace(const Mesh& mesh, const BasisArray& basis,
00101       const RCP<DOFMapBase>& map,
00102       const RCP<Array<int> >& bcIndices,
00103       const VectorType<double>& vecType,
00104       int setupVerb = 0);
00105 
00106     /** */
00107     DiscreteSpace(const Mesh& mesh, const BasisFamily& basis,
00108                   const SpectralBasis& spBasis,
00109                   const VectorType<double>& vecType,
00110       int setupVerb = 0);
00111     /** */
00112     DiscreteSpace(const Mesh& mesh, const BasisArray& basis,
00113                   const SpectralBasis& spBasis,
00114                   const VectorType<double>& vecType,
00115       int setupVerb = 0);
00116 
00117     /** */
00118     DiscreteSpace(const Mesh& mesh, const BasisArray& basis,
00119       const RCP<FunctionSupportResolver>& fsr,
00120       const VectorType<double>& vecType,
00121       int setupVerb = 0);
00122 
00123     /** */
00124     const RCP<DOFMapBase>& map() const {return map_;}
00125 
00126     /** return the number of functions */
00127     int nFunc() const {return basis_.size();}
00128 
00129     /** */
00130     const BasisArray& basis() const {return basis_;}
00131 
00132     /** */
00133     Array<std::pair<int,int> > dimStructure() const {return vectorDimStructure(basis());}
00134 
00135     /** */
00136     Vector<double> createVector() const {return vecSpace_.createMember();}
00137 
00138     /** */
00139     VectorSpace<double> vecSpace() const {return vecSpace_;}
00140 
00141     /** */
00142     const Mesh& mesh() const {return mesh_;}
00143 
00144     /** */
00145     const VectorType<double>& vecType() const {return vecType_;}
00146 
00147     /** */
00148     void importGhosts(const Vector<double>& x,
00149                       RCP<GhostView<double> >& ghostView) const ;
00150 
00151     /** */
00152     void getAllowedFuncs(const CellFilter& cf, Set<int>& funcs) const ;
00153 
00154     /** */
00155     const CellFilter& cellFilters(int i) const {return subdomains_[i];}
00156 
00157     /** Return the transformation builder */
00158     const RCP<DiscreteSpaceTransfBuilder>& getTransformation() const
00159         { return transformationBuilder_; }
00160 
00161   private:
00162 
00163     /** */
00164     void init(const Array<CellFilter>& regions,
00165               const BasisArray& basis);
00166 
00167     /** */
00168     void init(const Array<CellFilter>& regions,
00169       const BasisArray& basis,
00170       const RCP<Array<int> >& isBCIndex, 
00171       bool partitionBCs);
00172 
00173     /** */
00174     Array<CellFilter> maximalRegions(int n) const ;
00175 
00176     /** */
00177     void initVectorSpace(
00178       const RCP<Array<int> >& isBCIndex, 
00179       bool partitionBCs);
00180     
00181     /** */
00182     void initImporter();
00183 
00184     /** */
00185     int setupVerb_;
00186 
00187     /** */
00188     RCP<DOFMapBase> map_;
00189 
00190     /** */
00191     Mesh mesh_;
00192 
00193     /** */
00194     Array<CellFilter> subdomains_;
00195 
00196     /** */
00197     BasisArray basis_;
00198 
00199     /** */
00200     VectorSpace<double> vecSpace_;
00201 
00202     /** */
00203     VectorType<double> vecType_;
00204 
00205     /** */
00206     RCP<GhostImporter<double> > ghostImporter_;
00207 
00208     /** Transformation builder in case when it is needed*/
00209     RCP<DiscreteSpaceTransfBuilder> transformationBuilder_;
00210 
00211   };
00212 
00213 }
00214 
00215 
00216 
00217 #endif

Site Contact