TSFEpetraVectorType.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 TSFEPETRAVECTORTYPE_HPP
00028 #define TSFEPETRAVECTORTYPE_HPP
00029 
00030 #include "TSFEpetraVectorSpace.hpp"
00031 #include "SundanceHandleable.hpp"
00032 #include "SundancePrintable.hpp"
00033 #include "Teuchos_Describable.hpp"
00034 #include "TSFVectorTypeExtensions.hpp"
00035  //#include "TSFLinearOperatorDecl.hpp"
00036 
00037 
00038 namespace TSFExtended
00039 {
00040   using namespace Teuchos;
00041   using namespace Thyra;
00042   /**
00043    * TSF extension of Thyra::EpetraVectorSpaceFactory, allowing 
00044    * use in handles and more extensive capability for creating
00045    * distributed spaces.
00046    * This class derives
00047    * from Thyra::EpetraVectorSpaceFactory, so it can be used 
00048    * seamlessly in any 
00049    * Thyra-based code.
00050    */
00051 
00052 
00053   class EpetraVectorType : public VectorTypeExtensions<double>,
00054                            public Sundance::Handleable<VectorTypeExtensions<double> >,
00055                            public Printable,
00056                            public Describable
00057   {
00058   public:
00059     /** Construct a vector type */
00060     EpetraVectorType();
00061       
00062     /** virtual dtor */
00063     virtual ~EpetraVectorType() {;}
00064 
00065     /** create a distributed vector space.
00066      * @param dimension the dimension of the space 
00067      * @param nLocal number of indices owned by the local processor
00068      * @param locallyOwnedIndices array of indices owned by this processor  
00069      */
00070     RCP<const Thyra::VectorSpaceBase<double> > 
00071     createSpace(int dimension, 
00072       int nLocal,
00073       const int* locallyOwnedIndices,
00074       const MPIComm& comm) const ;
00075 
00076     /**  
00077      * Create an importer for accessing ghost elements.
00078      * @param space the distributed vector space on which ghost elements
00079      * are to be shared
00080      * @param nGhost number of ghost elements needed by this processor
00081      * @param ghostIndices read-only C array of off-processor indices needed
00082      * by this processor.
00083      * @return A RCP to a GhostImporter object.
00084      */
00085     RCP<GhostImporter<double> > 
00086     createGhostImporter(const VectorSpace<double>& space,
00087                         int nGhost,
00088                         const int* ghostIndices) const ;
00089 
00090 
00091     /**
00092      * Create a matrix factory of type compatible with this vector type,
00093      * sized according to the given domain and range spaces.
00094      */
00095     RCP<MatrixFactory<double> >
00096     createMatrixFactory(const VectorSpace<double>& domain,
00097                  const VectorSpace<double>& range) const ;
00098 
00099     
00100 
00101     /** \name Printable interface */
00102     //@{
00103     /** Print to stream */
00104     void print(std::ostream& os) const {os << description();}
00105     //@}
00106 
00107     GET_RCP(VectorTypeExtensions<double>);
00108   };
00109   
00110 }
00111 
00112 #endif

Site Contact