Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef TSFOPERATORBUILDER_HPP
00031 #define TSFOPERATORBUILDER_HPP
00032
00033 #include "TSFLinearOperatorDecl.hpp"
00034 #include "TSFLinearCombinationDecl.hpp"
00035 #include "TSFVectorType.hpp"
00036 #include "TSFVectorSpaceDecl.hpp"
00037 #include "Teuchos_Array.hpp"
00038 #include "Teuchos_GlobalMPISession.hpp"
00039
00040
00041 using namespace TSFExtended;
00042 using namespace Teuchos;
00043
00044
00045 namespace TSFExtended
00046 {
00047
00048 template <class Scalar>
00049 class OperatorBuilder
00050 {
00051 public:
00052
00053 OperatorBuilder(int nLocal, const VectorType<Scalar>& vecType);
00054
00055 OperatorBuilder(int nLocalDomain, int nLocalRange,
00056 const VectorType<Scalar>& vecType);
00057
00058 OperatorBuilder(const VectorSpace<Scalar>& domain,
00059 const VectorSpace<Scalar>& range,
00060 const VectorType<Scalar>& vecType);
00061
00062 virtual ~OperatorBuilder(){;}
00063
00064
00065 const VectorType<Scalar>& vecType() const {return vecType_;}
00066
00067
00068 const VectorSpace<Scalar>& domain() const {return domain_;}
00069
00070
00071 const VectorSpace<Scalar>& range() const {return range_;}
00072
00073
00074 virtual LinearOperator<Scalar> getOp() const = 0 ;
00075
00076 protected:
00077
00078 private:
00079 VectorType<Scalar> vecType_;
00080
00081 VectorSpace<Scalar> domain_;
00082
00083 VectorSpace<Scalar> range_;
00084 };
00085
00086 template <class Scalar>
00087 inline OperatorBuilder<Scalar>
00088 ::OperatorBuilder(int nLocalRows, const VectorType<Scalar>& vecType)
00089 : vecType_(vecType), domain_(), range_()
00090 {
00091 range_ = vecType_.createEvenlyPartitionedSpace(MPIComm::world(), nLocalRows);
00092 domain_ = range_;
00093 }
00094
00095 template <class Scalar>
00096 inline OperatorBuilder<Scalar>
00097 ::OperatorBuilder(int nLocalDomain, int nLocalRange,
00098 const VectorType<Scalar>& vecType)
00099 : vecType_(vecType), domain_(), range_()
00100 {
00101 range_ = vecType_.createEvenlyPartitionedSpace(MPIComm::world(), nLocalRange);
00102 domain_ = vecType_.createEvenlyPartitionedSpace(MPIComm::world(), nLocalDomain);
00103 }
00104
00105
00106
00107 template <class Scalar>
00108 inline OperatorBuilder<Scalar>
00109 ::OperatorBuilder(const VectorSpace<Scalar>& domain,
00110 const VectorSpace<Scalar>& range,
00111 const VectorType<Scalar>& vecType)
00112 : vecType_(vecType), domain_(domain), range_(range)
00113 {}
00114
00115 }
00116
00117 #endif