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

Site Contact