21#ifndef AMESOS2_MULTIVEC_ADAPTER_DECL_HPP
22#define AMESOS2_MULTIVEC_ADAPTER_DECL_HPP
24#include <Teuchos_RCP.hpp>
25#include <Teuchos_Ptr.hpp>
26#include <Teuchos_ArrayView.hpp>
27#include <Tpetra_Map.hpp>
30#include "Amesos2_VectorTraits.hpp"
153 Teuchos::RCP<MultiVecAdapter<MV> >
157 if(mv.is_null())
return Teuchos::null;
162 Teuchos::RCP<const MultiVecAdapter<MV> >
163 createConstMultiVecAdapter(Teuchos::RCP<const MV> mv){
165 using Teuchos::rcp_const_cast;
167 if(mv.is_null())
return Teuchos::null;
168 return( rcp(
new MultiVecAdapter<MV>(Teuchos::rcp_const_cast<MV,const MV>(mv))).getConst() );
184 template <
typename MV,
typename V>
187 typedef typename VectorTraits<V>::ptr_scalar_type ptr_return_type ;
189 static ptr_return_type * get_pointer_to_vector (
const Teuchos::Ptr< MV> &mv ) ;
191 static ptr_return_type * get_pointer_to_vector ( Teuchos::Ptr< MV> &mv ) ;
193 static ptr_return_type * get_pointer_to_vector (
const Teuchos::Ptr< const MV > &mv ) ;
195 static ptr_return_type * get_pointer_to_vector ( Teuchos::Ptr< const MV > &mv ) ;
202 template <
typename MV>
203 struct same_type_get_copy {
204 static void apply(
const Teuchos::Ptr<const MV> mv,
205 const Teuchos::ArrayView<typename MV::scalar_t>& v,
207 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
211 template <
typename MV,
typename KV>
212 struct same_type_get_view {
213 static bool apply (
bool bInitialize,
214 const Teuchos::Ptr<const MV>& mv,
217 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
227 template <
typename MV,
typename S>
228 struct diff_type_get_copy {
229 static void apply(
const Teuchos::Ptr<const MV> mv,
230 const Teuchos::ArrayView<S>& v,
232 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
233 EDistribution distribution );
236 template <
typename MV,
typename KV>
237 struct diff_type_get_view {
238 static bool apply (
bool bInitialize,
239 const Teuchos::Ptr<const MV>& mv,
242 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
243 EDistribution distribution);
252 template <
class MV,
typename S>
255 do_get (
const Teuchos::Ptr<const MV>& mv,
256 const Teuchos::ArrayView<S>& vals,
258 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
262 do_get (
const Teuchos::Ptr<const MV>& mv,
263 const Teuchos::ArrayView<S>& vals,
266 typename MV::global_ordinal_t indexBase = 0);
269 do_get (
const Teuchos::Ptr<const MV>& mv,
270 const Teuchos::ArrayView<S>& vals,
299 template <
class MV,
typename KV>
300 struct get_1d_copy_helper_kokkos_view {
302 do_get (
bool bInitialize,
303 const Teuchos::Ptr<const MV>& mv,
306 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
310 do_get (
bool bInitialize,
311 const Teuchos::Ptr<const MV>& mv,
315 typename MV::global_ordinal_t indexBase = 0);
318 do_get (
bool bInitialize,
319 const Teuchos::Ptr<const MV>& mv,
328 template <
typename MV>
329 struct same_type_data_put {
330 static void apply(
const Teuchos::Ptr<MV>& mv,
331 const Teuchos::ArrayView<typename MV::scalar_t>& data,
333 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
337 template <
typename MV,
typename KV>
338 struct same_type_put_view {
339 static void apply(
const Teuchos::Ptr<MV>& mv,
342 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
343 EDistribution distribution );
352 template <
typename MV,
typename S>
353 struct diff_type_data_put {
354 static void apply(
const Teuchos::Ptr<MV>& mv,
355 const Teuchos::ArrayView<S>& data,
357 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
358 EDistribution distribution );
361 template <
typename MV,
typename KV>
362 struct diff_type_put_view {
363 static void apply(
const Teuchos::Ptr<MV>& mv,
366 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
367 EDistribution distribution );
376 template <
class MV,
typename S>
378 static void do_put(
const Teuchos::Ptr<MV>& mv,
379 const Teuchos::ArrayView<S>& data,
381 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
384 static void do_put(
const Teuchos::Ptr<MV>& mv,
385 const Teuchos::ArrayView<S>& data,
387 EDistribution distribution,
typename MV::global_ordinal_t indexBase = 0);
389 static void do_put(
const Teuchos::Ptr<MV>& mv,
390 const Teuchos::ArrayView<S>& data,
394 template <
class MV,
typename KV>
395 struct put_1d_data_helper_kokkos_view {
396 static void do_put(
const Teuchos::Ptr<MV>& mv,
399 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
402 static void do_put(
const Teuchos::Ptr<MV>& mv,
405 EDistribution distribution,
typename MV::global_ordinal_t indexBase = 0);
407 static void do_put(
const Teuchos::Ptr<MV>& mv,
Amesos2::MultiVecAdapter specialization for the Kokkos::View class.
Amesos2::MultiVecAdapter specialization for the Tpetra::MultiVector class.
Enum and other types declarations for Amesos2.
EDistribution
Definition Amesos2_TypeDecl.hpp:89
@ ROOTED
Definition Amesos2_TypeDecl.hpp:93
A templated MultiVector class adapter for Amesos2.
Definition Amesos2_MultiVecAdapter_decl.hpp:142
Teuchos::RCP< MultiVecAdapter< MV > > createMultiVecAdapter(Teuchos::RCP< MV > mv)
Factory creation method for MultiVecAdapters.
Definition Amesos2_MultiVecAdapter_decl.hpp:154
Helper class for getting 1-D copies of multivectors.
Definition Amesos2_MultiVecAdapter_decl.hpp:253
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:111
Helper class for putting 1-D data arrays into multivectors.
Definition Amesos2_MultiVecAdapter_decl.hpp:377
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:350
Helper struct for getting pointers to the MV data - only used when number of vectors = 1 and single M...
Definition Amesos2_MultiVecAdapter_decl.hpp:185