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,
287 template <
class MV,
typename KV>
288 struct get_1d_copy_helper_kokkos_view {
290 do_get (
const Teuchos::Ptr<const MV>& mv,
293 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
297 do_get (
const Teuchos::Ptr<const MV>& mv,
301 typename MV::global_ordinal_t indexBase = 0);
304 do_get (
const Teuchos::Ptr<const MV>& mv,
313 template <
typename MV>
314 struct same_type_data_put {
315 static void apply(
const Teuchos::Ptr<MV>& mv,
316 const Teuchos::ArrayView<typename MV::scalar_t>& data,
318 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
328 template <
typename MV,
typename S>
329 struct diff_type_data_put {
330 static void apply(
const Teuchos::Ptr<MV>& mv,
331 const Teuchos::ArrayView<S>& data,
333 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
343 template <
class MV,
typename S>
345 static void do_put(
const Teuchos::Ptr<MV>& mv,
346 const Teuchos::ArrayView<S>& data,
348 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
351 static void do_put(
const Teuchos::Ptr<MV>& mv,
352 const Teuchos::ArrayView<S>& data,
354 EDistribution distribution,
typename MV::global_ordinal_t indexBase = 0);
356 static void do_put(
const Teuchos::Ptr<MV>& mv,
357 const Teuchos::ArrayView<S>& data,
361 template <
class MV,
typename KV>
362 struct put_1d_data_helper_kokkos_view {
363 static void do_put(
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,
369 static void do_put(
const Teuchos::Ptr<MV>& mv,
372 EDistribution distribution,
typename MV::global_ordinal_t indexBase = 0);
374 static void do_put(
const Teuchos::Ptr<MV>& mv,
383 #ifdef HAVE_AMESOS2_EPETRA
387 #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
Amesos2::MultiVecAdapter specialization for the Kokkos::View class.
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:146
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:317
EDistribution
Definition: Amesos2_TypeDecl.hpp:123
Helper class for putting 1-D data arrays into multivectors.
Definition: Amesos2_MultiVecAdapter_decl.hpp:344
A templated MultiVector class adapter for Amesos2.
Definition: Amesos2_MultiVecAdapter_decl.hpp:176