TSFVectorType.hpp
Go to the documentation of this file.
00001 /* ***********************************************************************
00002 // 
00003 //           TSFExtended: Trilinos Solver Framework Extended
00004 //                 Copyright (2004) Sandia Corporation
00005 // 
00006 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00007 // license for use of this work by or on behalf of the U.S. Government.
00008 // 
00009 // This library is free software; you can redistribute it and/or modify
00010 // it under the terms of the GNU Lesser General Public License as
00011 // published by the Free Software Foundation; either version 2.1 of the
00012 // License, or (at your option) any later version.
00013 //  
00014 // This library is distributed in the hope that it will be useful, but
00015 // WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 // Lesser General Public License for more details.
00018 //  
00019 // You should have received a copy of the GNU Lesser General Public
00020 // License along with this library; if not, write to the Free Software
00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00022 // USA
00023 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00024 // 
00025 // **********************************************************************/
00026 
00027 #ifndef TSFVECTORTYPE_HPP
00028 #define TSFVECTORTYPE_HPP
00029 
00030 #include "SundanceHandle.hpp"
00031 #include "TSFVectorTypeExtensions.hpp"
00032 #include "TSFVectorSpaceDecl.hpp"
00033 #include "TSFGhostImporter.hpp"
00034 
00035 namespace TSFExtended
00036 {
00037   using namespace Teuchos;
00038   /**
00039    * Vector type objects are used by the application code to create
00040    * vector spaces and operators of a given type.
00041    */
00042   template <class Scalar>
00043   class VectorType : public Sundance::Handle<VectorTypeExtensions<Scalar> >
00044   {
00045   public:
00046     HANDLE_CTORS(VectorType<Scalar>, VectorTypeExtensions<Scalar>);
00047    
00048 
00049     /** create a vector space having nLocal elements on each processor */
00050     VectorSpace<Scalar> createEvenlyPartitionedSpace(const MPIComm& comm,
00051                                                      int nLocal) const ;
00052 
00053     /** create a distributed vector space.
00054      * @param dimension the dimension of the space
00055      * @param nLocal number of indices owned by the local processor
00056      * @param locallyOwnedIndices array of indices owned by this processor  
00057      */
00058     VectorSpace<Scalar> createSpace(int dimension, 
00059       int nLocal,
00060       const int* locallyOwnedIndices,
00061       const MPIComm& comm) const ;
00062 
00063 
00064     /** 
00065      * Create an importer for ghost elements
00066      **/
00067     RCP<GhostImporter<Scalar> > 
00068     createGhostImporter(const VectorSpace<Scalar>& space,
00069                         int nGhost,
00070                         const int* ghostIndices) const ;
00071 
00072      /**
00073      * Create a matrix factory of type compatible with this vector type,
00074      * sized according to the given domain and range spaces.
00075      */
00076     virtual RCP<MatrixFactory<Scalar> >
00077     createMatrixFactory(const VectorSpace<Scalar>& domain,
00078                         const VectorSpace<Scalar>& range) const ;
00079                                                       
00080     
00081   };
00082 
00083 
00084 
00085 
00086   template <class Scalar> inline 
00087   VectorSpace<Scalar> VectorType<Scalar>::createSpace(int dimension,
00088                                                       int nLocal,
00089     const int* locallyOwnedIndices, const MPIComm& comm) const
00090   {
00091     return this->ptr()->createSpace(dimension, nLocal, locallyOwnedIndices, comm);
00092   }
00093 
00094   template <class Scalar> inline 
00095   VectorSpace<Scalar> VectorType<Scalar>
00096   ::createEvenlyPartitionedSpace(const MPIComm& comm,
00097                                  int nLocal) const
00098   {
00099     return this->ptr()->createEvenlyPartitionedSpace(comm, nLocal);
00100   }
00101 
00102   template <class Scalar> inline 
00103   RCP<GhostImporter<Scalar> > 
00104   VectorType<Scalar>::createGhostImporter(const VectorSpace<Scalar>& space,
00105                                          int nGhost,
00106                                          const int* ghostIndices) const
00107   {
00108     return this->ptr()->createGhostImporter(space, nGhost, ghostIndices);
00109   }
00110 
00111   template <class Scalar> inline
00112   RCP<MatrixFactory<Scalar> >
00113   VectorType<Scalar>::createMatrixFactory(const VectorSpace<Scalar>& domain,
00114                                           const VectorSpace<Scalar>& range) const
00115   {
00116     return this->ptr()->createMatrixFactory(domain, range);
00117   }
00118 
00119   
00120 }
00121 
00122 #endif

Site Contact