Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_SpmdVectorDefaultBase_decl.hpp
1 // @HEADER
2 // *****************************************************************************
3 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
4 //
5 // Copyright 2004 NTESS and the Thyra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef THYRA_SPMD_VECTOR_DEFAULT_BASE_DECL_HPP
11 #define THYRA_SPMD_VECTOR_DEFAULT_BASE_DECL_HPP
12 
13 
14 #include "Thyra_VectorDefaultBase.hpp"
15 #include "Thyra_SpmdVectorBase.hpp"
16 #include "Thyra_SpmdVectorSpaceDefaultBase_decl.hpp"
17 
18 
19 //#define THYRA_SPMD_VECTOR_BASE_DUMP
20 
21 
22 namespace Thyra {
23 
24 
57 template<class Scalar>
59  : virtual public SpmdVectorBase<Scalar>,
60  virtual public VectorDefaultBase<Scalar>
61 {
62 public:
63 
66 
69 
71 
77  virtual void applyOpImplWithComm(
78  const Ptr<const Teuchos::Comm<Ordinal> > &comm,
79  const RTOpPack::RTOpT<Scalar> &op,
80  const ArrayView<const Ptr<const VectorBase<Scalar> > > &vecs,
81  const ArrayView<const Ptr<VectorBase<Scalar> > > &targ_vecs,
82  const Ptr<RTOpPack::ReductTarget> &reduct_obj,
83  const Ordinal global_offset
84  ) const;
85 
87 
91  std::string description() const;
93 
96 
99 
101 
102 protected:
103 
106 
108  void applyOpImpl(
109  const RTOpPack::RTOpT<Scalar> &op,
110  const ArrayView<const Ptr<const VectorBase<Scalar> > > &vecs,
111  const ArrayView<const Ptr<VectorBase<Scalar> > > &targ_vecs,
112  const Ptr<RTOpPack::ReductTarget> &reduct_obj,
113  const Ordinal global_offset
114  ) const;
117  const Range1D& rng, RTOpPack::ConstSubVectorView<Scalar>* sub_vec
118  ) const;
122  ) const;
125  const Range1D& rng, RTOpPack::SubVectorView<Scalar>* sub_vec
126  );
130  );
131 
133 
142  const Ptr<ArrayRCP<Scalar> > &localValues, const Ptr<Ordinal> &leadingDim);
145  const Ptr<ArrayRCP<const Scalar> > &localValues, const Ptr<Ordinal> &leadingDim) const;
147 
155 
158 
162  virtual void updateSpmdSpace();
163 
165 
166 private:
167 
168  // ///////////////////////////////////////
169  // Private data members
170 
171  // Cached (only on vector space!)
172  mutable Ordinal globalDim_;
173  mutable Ordinal localOffset_;
174  mutable Ordinal localSubDim_;
175 
176  // /////////////////////////////////////
177  // Private member functions
178 
179  Range1D validateRange( const Range1D& rng_in ) const;
180 
181 #ifdef THYRA_SPMD_VECTOR_BASE_DUMP
182 public:
183  static bool show_dump;
184 #endif // THYRA_SPMD_VECTOR_BASE_DUMP
185 
186 }; // end class SpmdVectorDefaultBase
187 
188 
189 } // end namespace Thyra
190 
191 
192 #endif // THYRA_SPMD_VECTOR_DEFAULT_BASE_DECL_HPP
void applyOpImpl(const RTOpPack::RTOpT< Scalar > &op, const ArrayView< const Ptr< const VectorBase< Scalar > > > &vecs, const ArrayView< const Ptr< VectorBase< Scalar > > > &targ_vecs, const Ptr< RTOpPack::ReductTarget > &reduct_obj, const Ordinal global_offset) const
Calls applyOpImplWithComm(null,op,...).
RTOpPack::SubVectorView< Scalar > getNonconstLocalSubVectorImpl()
Virtual implementation for getNonconstLocalSubVector().
void acquireDetachedVectorViewImpl(const Range1D &rng, RTOpPack::ConstSubVectorView< Scalar > *sub_vec) const
Implemented through this-&gt;getLocalData()
virtual void applyOpImplWithComm(const Ptr< const Teuchos::Comm< Ordinal > > &comm, const RTOpPack::RTOpT< Scalar > &op, const ArrayView< const Ptr< const VectorBase< Scalar > > > &vecs, const ArrayView< const Ptr< VectorBase< Scalar > > > &targ_vecs, const Ptr< RTOpPack::ReductTarget > &reduct_obj, const Ordinal global_offset) const
Implementation of applyOpImpl(...) that uses an input Comm.
Base class for SPMD vectors that can provide views of contiguous elements in a process.
Base class for SPMD vectors that can provide views of contiguous elements in a process.
RTOpPack::SubMultiVectorView< Scalar > getNonconstLocalSubMultiVectorImpl()
virtual void updateSpmdSpace()
Subclasses must call this function whenever the structure of the VectorSpaceBase changes.
Convenient node subclass for concrete VectorBase subclasses that relies on a default MultiVectorBase ...
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
Abstract interface for finite-dimensional dense vectors.
Teuchos::RCP< const VectorSpaceBase< Scalar > > space() const
Returns this-&gt;spmdSpace().
RTOpPack::ConstSubMultiVectorView< Scalar > getLocalSubMultiVectorImpl() const
void commitNonconstDetachedVectorViewImpl(RTOpPack::SubVectorView< Scalar > *sub_vec)
Implemented through this-&gt;commitLocalData()
RTOpPack::ConstSubVectorView< Scalar > getLocalSubVectorImpl() const
Virtual implementation for getLocalSubVector().
void getNonconstLocalMultiVectorDataImpl(const Ptr< ArrayRCP< Scalar > > &localValues, const Ptr< Ordinal > &leadingDim)
void getLocalMultiVectorDataImpl(const Ptr< ArrayRCP< const Scalar > > &localValues, const Ptr< Ordinal > &leadingDim) const
void releaseDetachedVectorViewImpl(RTOpPack::ConstSubVectorView< Scalar > *sub_vec) const
Implemented through this-&gt;freeLocalData()
void acquireNonconstDetachedVectorViewImpl(const Range1D &rng, RTOpPack::SubVectorView< Scalar > *sub_vec)
Implemented through this-&gt;getLocalData()