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 TSF_SERIAL_VECTORTYPE_HPP 00028 #define TSF_SERIAL_VECTORTYPE_HPP 00029 00030 #include "TSFSerialVectorSpace.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 * 00044 */ 00045 00046 00047 class SerialVectorType : public VectorTypeExtensions<double>, 00048 public Sundance::Handleable<VectorTypeExtensions<double> >, 00049 public Printable, 00050 public Describable 00051 { 00052 public: 00053 /** Construct a vector type */ 00054 SerialVectorType(); 00055 00056 /** virtual dtor */ 00057 virtual ~SerialVectorType() {;} 00058 00059 /** create a distributed vector space. 00060 * @param dimension the dimension of the space 00061 * @param nLocal number of indices owned by the local processor 00062 * @param locallyOwnedIndices array of indices owned by this processor 00063 */ 00064 RCP<const Thyra::VectorSpaceBase<double> > 00065 createSpace(int dimension, 00066 int nLocal, 00067 const int* locallyOwnedIndices, 00068 const MPIComm& comm) const ; 00069 00070 00071 /** Default implementation creates a vector space having 00072 * nLocal elements on each processor. Serial types should override this 00073 * to produce a replicated space. */ 00074 virtual VectorSpace<double> 00075 createEvenlyPartitionedSpace(const MPIComm& comm, 00076 int nLocal) const ; 00077 00078 00079 /** 00080 * Create an importer for accessing ghost elements. 00081 * @param space the distributed vector space on which ghost elements 00082 * are to be shared 00083 * @param nGhost number of ghost elements needed by this processor 00084 * @param ghostIndices read-only C array of off-processor indices needed 00085 * by this processor. 00086 * @return A RCP to a GhostImporter object. 00087 */ 00088 RCP<GhostImporter<double> > 00089 createGhostImporter(const VectorSpace<double>& space, 00090 int nGhost, 00091 const int* ghostIndices) const ; 00092 00093 00094 /** 00095 * Create a matrix factory of type compatible with this vector type, 00096 * sized according to the given domain and range spaces. 00097 */ 00098 RCP<MatrixFactory<double> > 00099 createMatrixFactory(const VectorSpace<double>& domain, 00100 const VectorSpace<double>& range) const ; 00101 00102 00103 00104 /** \name Printable interface */ 00105 //@{ 00106 /** Print to stream */ 00107 void print(std::ostream& os) const {os << description();} 00108 //@} 00109 00110 GET_RCP(VectorTypeExtensions<double>); 00111 }; 00112 00113 } 00114 00115 #endif