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,
217 template <
typename MV,
typename S>
218 struct diff_type_get_copy {
219 static void apply(
const Teuchos::Ptr<const MV> mv,
220 const Teuchos::ArrayView<S>& v,
222 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
232 template <
class MV,
typename S>
235 do_get (
const Teuchos::Ptr<const MV>& mv,
236 const Teuchos::ArrayView<S>& vals,
238 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
242 do_get (
const Teuchos::Ptr<const MV>& mv,
243 const Teuchos::ArrayView<S>& vals,
246 typename MV::global_ordinal_t indexBase = 0);
249 do_get (
const Teuchos::Ptr<const MV>& mv,
250 const Teuchos::ArrayView<S>& vals,
279 template <
class MV,
typename KV>
280 struct get_1d_copy_helper_kokkos_view {
282 do_get (
bool bInitialize,
283 const Teuchos::Ptr<const MV>& mv,
286 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
290 do_get (
bool bInitialize,
291 const Teuchos::Ptr<const MV>& mv,
295 typename MV::global_ordinal_t indexBase = 0);
298 do_get (
bool bInitialize,
299 const Teuchos::Ptr<const MV>& mv,
308 template <
typename MV>
309 struct same_type_data_put {
310 static void apply(
const Teuchos::Ptr<MV>& mv,
311 const Teuchos::ArrayView<typename MV::scalar_t>& data,
313 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
323 template <
typename MV,
typename S>
324 struct diff_type_data_put {
325 static void apply(
const Teuchos::Ptr<MV>& mv,
326 const Teuchos::ArrayView<S>& data,
328 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
338 template <
class MV,
typename S>
340 static void do_put(
const Teuchos::Ptr<MV>& mv,
341 const Teuchos::ArrayView<S>& data,
343 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
346 static void do_put(
const Teuchos::Ptr<MV>& mv,
347 const Teuchos::ArrayView<S>& data,
349 EDistribution distribution,
typename MV::global_ordinal_t indexBase = 0);
351 static void do_put(
const Teuchos::Ptr<MV>& mv,
352 const Teuchos::ArrayView<S>& data,
356 template <
class MV,
typename KV>
357 struct put_1d_data_helper_kokkos_view {
358 static void do_put(
const Teuchos::Ptr<MV>& mv,
361 Teuchos::Ptr<
const Tpetra::Map<typename MV::local_ordinal_t, typename MV::global_ordinal_t, typename MV::node_t> > distribution_map,
364 static void do_put(
const Teuchos::Ptr<MV>& mv,
367 EDistribution distribution,
typename MV::global_ordinal_t indexBase = 0);
369 static void do_put(
const Teuchos::Ptr<MV>& mv,
378 #ifdef HAVE_AMESOS2_EPETRA
382 #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:154
Amesos2::MultiVecAdapter specialization for the Kokkos::View class.
Helper class for getting 1-D copies of multivectors.
Definition: Amesos2_MultiVecAdapter_decl.hpp:233
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
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:112
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:287
EDistribution
Definition: Amesos2_TypeDecl.hpp:89
Helper class for putting 1-D data arrays into multivectors.
Definition: Amesos2_MultiVecAdapter_decl.hpp:339
A templated MultiVector class adapter for Amesos2.
Definition: Amesos2_MultiVecAdapter_decl.hpp:142