55 #ifndef AMESOS2_MULTIVEC_ADAPTER_DECL_HPP
56 #define AMESOS2_MULTIVEC_ADAPTER_DECL_HPP
58 #include <Teuchos_RCP.hpp>
59 #include <Teuchos_Ptr.hpp>
60 #include <Teuchos_ArrayView.hpp>
61 #include <Tpetra_Map.hpp>
64 #include "Amesos2_VectorTraits.hpp"
186 Teuchos::RCP<MultiVecAdapter<MV> >
190 if(mv.is_null())
return Teuchos::null;
195 Teuchos::RCP<const MultiVecAdapter<MV> >
196 createConstMultiVecAdapter(Teuchos::RCP<const MV> mv){
198 using Teuchos::rcp_const_cast;
200 if(mv.is_null())
return Teuchos::null;
201 return( rcp(
new MultiVecAdapter<MV>(Teuchos::rcp_const_cast<MV,const MV>(mv))).getConst() );
217 template <
typename MV,
typename V>
220 typedef typename VectorTraits<V>::ptr_scalar_type ptr_return_type ;
222 static ptr_return_type * get_pointer_to_vector (
const Teuchos::Ptr< MV> &mv ) ;
224 static ptr_return_type * get_pointer_to_vector ( Teuchos::Ptr< MV> &mv ) ;
226 static ptr_return_type * get_pointer_to_vector (
const Teuchos::Ptr< const MV > &mv ) ;
228 static ptr_return_type * get_pointer_to_vector ( Teuchos::Ptr< const MV > &mv ) ;
235 template <
typename MV>
236 struct same_type_get_copy {
237 static void apply(
const Teuchos::Ptr<const MV>& mv,
238 const Teuchos::ArrayView<typename MV::scalar_t>& v,
240 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
250 template <
typename MV,
typename S>
251 struct diff_type_get_copy {
252 static void apply(
const Teuchos::Ptr<const MV>& mv,
253 const Teuchos::ArrayView<S>& v,
255 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
265 template <
class MV,
typename S>
268 do_get (
const Teuchos::Ptr<const MV>& mv,
269 const Teuchos::ArrayView<S>& vals,
271 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
275 do_get (
const Teuchos::Ptr<const MV>& mv,
276 const Teuchos::ArrayView<S>& vals,
279 typename MV::global_ordinal_t indexBase = 0);
282 do_get (
const Teuchos::Ptr<const MV>& mv,
283 const Teuchos::ArrayView<S>& vals,
291 template <
typename MV>
292 struct same_type_data_put {
293 static void apply(
const Teuchos::Ptr<MV>& mv,
294 const Teuchos::ArrayView<typename MV::scalar_t>& data,
296 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
306 template <
typename MV,
typename S>
307 struct diff_type_data_put {
308 static void apply(
const Teuchos::Ptr<MV>& mv,
309 const Teuchos::ArrayView<S>& data,
311 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
321 template <
class MV,
typename S>
323 static void do_put(
const Teuchos::Ptr<MV>& mv,
324 const Teuchos::ArrayView<S>& data,
326 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
329 static void do_put(
const Teuchos::Ptr<MV>& mv,
330 const Teuchos::ArrayView<S>& data,
332 EDistribution distribution,
typename MV::global_ordinal_t indexBase = 0);
334 static void do_put(
const Teuchos::Ptr<MV>& mv,
335 const Teuchos::ArrayView<S>& data,
342 #ifdef HAVE_AMESOS2_EPETRA
346 #endif // AMESOS2_MULTIVEC_ADAPTER_DECL_HPP
Teuchos::RCP< MultiVecAdapter< MV > > createMultiVecAdapter(Teuchos::RCP< MV > mv)
Factory creation method for MultiVecAdapters.
Definition: Amesos2_MultiVecAdapter_decl.hpp:187
Helper class for getting 1-D copies of multivectors.
Definition: Amesos2_MultiVecAdapter_decl.hpp:266
Helper struct for getting pointers to the MV data - only used when number of vectors = 1 and single M...
Definition: Amesos2_MultiVecAdapter_decl.hpp:218
static void do_get(const Teuchos::Ptr< const MV > &mv, const Teuchos::ArrayView< S > &vals, const size_t ldx, Teuchos::Ptr< const Tpetra::Map< typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t > > distribution_map, EDistribution distribution=ROOTED)
Helper class for getting 1-D copies of multivectors.
Definition: Amesos2_MultiVecAdapter_def.hpp:145
Amesos2::MultiVecAdapter specialization for the Tpetra::MultiVector class.
Amesos2::MultiVecAdapter specialization for the Epetra_MultiVector class.
Enum and other types declarations for Amesos2.
static void do_put(const Teuchos::Ptr< MV > &mv, const Teuchos::ArrayView< S > &data, const size_t ldx, Teuchos::Ptr< const Tpetra::Map< typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t > > distribution_map, EDistribution distribution=ROOTED)
Helper class for putting 1-D data arrays into multivectors.
Definition: Amesos2_MultiVecAdapter_def.hpp:258
EDistribution
Definition: Amesos2_TypeDecl.hpp:123
Helper class for putting 1-D data arrays into multivectors.
Definition: Amesos2_MultiVecAdapter_decl.hpp:322
A templated MultiVector class adapter for Amesos2.
Definition: Amesos2_MultiVecAdapter_decl.hpp:176