16 #ifndef dealii_read_write_vector_h 17 #define dealii_read_write_vector_h 34 #ifdef DEAL_II_WITH_TRILINOS 39 # include <Epetra_MultiVector.h> 49 class CommunicationPatternBase;
52 template <
typename,
typename>
57 # ifdef DEAL_II_WITH_PETSC 67 # ifdef DEAL_II_WITH_TRILINOS 77 # ifdef DEAL_II_WITH_CUDA 130 template <
typename Number>
199 template <
typename Number2>
202 const bool omit_zeroing_entries =
false);
215 const bool omit_zeroing_entries =
false);
218 #ifdef DEAL_II_WITH_TRILINOS 219 # ifdef DEAL_II_WITH_MPI 249 template <
typename Functor>
251 apply(
const Functor &func);
277 template <
typename Number2>
286 operator=(
const Number s);
296 template <
typename MemorySpace>
300 const std::shared_ptr<const CommunicationPatternBase>
301 &communication_pattern =
302 std::shared_ptr<const CommunicationPatternBase>());
304 #ifdef DEAL_II_WITH_PETSC 316 const std::shared_ptr<const CommunicationPatternBase>
317 &communication_pattern =
318 std::shared_ptr<const CommunicationPatternBase>());
321 #ifdef DEAL_II_WITH_TRILINOS 335 const std::shared_ptr<const CommunicationPatternBase>
336 &communication_pattern =
337 std::shared_ptr<const CommunicationPatternBase>());
339 # ifdef DEAL_II_WITH_MPI 340 # ifdef DEAL_II_TRILINOS_WITH_TPETRA 352 const std::shared_ptr<const CommunicationPatternBase>
353 &communication_pattern =
354 std::shared_ptr<const CommunicationPatternBase>());
368 const std::shared_ptr<const CommunicationPatternBase>
369 &communication_pattern =
370 std::shared_ptr<const CommunicationPatternBase>());
374 #ifdef DEAL_II_WITH_CUDA 384 const std::shared_ptr<const CommunicationPatternBase>
385 &communication_pattern =
386 std::shared_ptr<const CommunicationPatternBase>());
412 get_stored_elements()
const;
499 template <
typename Number2>
501 extract_subvector_to(
const std::vector<size_type> &indices,
502 std::vector<Number2> & values)
const;
531 template <
typename ForwardIterator,
typename OutputIterator>
533 extract_subvector_to(ForwardIterator indices_begin,
534 const ForwardIterator indices_end,
535 OutputIterator values_begin)
const;
548 local_element(
const size_type local_index)
const;
561 local_element(
const size_type local_index);
574 template <
typename Number2>
576 add(
const std::vector<size_type> &indices,
577 const std::vector<Number2> & values);
583 template <
typename Number2>
585 add(
const std::vector<size_type> & indices,
593 template <
typename Number2>
597 const Number2 * values);
603 print(std::ostream & out,
604 const unsigned int precision = 3,
605 const bool scientific =
true)
const;
615 #ifdef DEAL_II_WITH_TRILINOS 616 # ifdef DEAL_II_TRILINOS_WITH_TPETRA 624 const Tpetra::Vector<Number, int, types::global_dof_index> &tpetra_vector,
625 const IndexSet & locally_owned_elements,
627 const MPI_Comm & mpi_comm,
628 const std::shared_ptr<const CommunicationPatternBase>
629 &communication_pattern);
638 import(
const Epetra_MultiVector &multivector,
639 const IndexSet & locally_owned_elements,
641 const MPI_Comm & mpi_comm,
642 const std::shared_ptr<const CommunicationPatternBase>
643 &communication_pattern);
654 return static_cast<unsigned int>(
655 stored_elements.index_within_set(global_index));
662 resize_val(
const size_type new_allocated_size);
664 #if defined(DEAL_II_WITH_TRILINOS) && defined(DEAL_II_WITH_MPI) 665 # ifdef DEAL_II_TRILINOS_WITH_TPETRA 671 create_tpetra_comm_pattern(
const IndexSet &source_index_set,
672 const MPI_Comm &mpi_comm);
680 create_epetra_comm_pattern(
const IndexSet &source_index_set,
681 const MPI_Comm &mpi_comm);
703 std::unique_ptr<Number[], decltype(std::free) *>
values;
709 mutable std::shared_ptr<::parallel::internal::TBBPartitioner>
713 template <
typename Number2>
722 template <
typename Functor>
757 template <
typename Number>
760 , values(nullptr,
free)
770 template <
typename Number>
781 template <
typename Number>
794 template <
typename Number>
796 const IndexSet &locally_stored_indices)
808 template <
typename Number>
812 return stored_elements.
size();
817 template <
typename Number>
826 template <
typename Number>
835 template <
typename Number>
844 template <
typename Number>
853 template <
typename Number>
862 template <
typename Number>
871 template <
typename Number>
880 template <
typename Number>
889 template <
typename Number>
898 template <
typename Number>
907 template <
typename Number>
908 template <
typename Number2>
911 const std::vector<size_type> &indices,
912 std::vector<Number2> & extracted_values)
const 914 for (
size_type i = 0; i < indices.size(); ++i)
915 extracted_values[i] =
operator()(indices[i]);
920 template <
typename Number>
921 template <
typename ForwardIterator,
typename OutputIterator>
924 ForwardIterator indices_begin,
925 const ForwardIterator indices_end,
926 OutputIterator values_begin)
const 928 while (indices_begin != indices_end)
938 template <
typename Number>
944 return values[local_index];
949 template <
typename Number>
955 return values[local_index];
960 template <
typename Number>
961 template <
typename Number2>
964 const std::vector<Number2> & values)
967 add(indices.size(), indices.data(), values.data());
972 template <
typename Number>
973 template <
typename Number2>
984 "The given value is not finite but either infinite or Not A Number (NaN)"));
985 this->
operator()(indices[i]) += values[indices[i]];
991 template <
typename Number>
992 template <
typename Number2>
996 const Number2 * values_to_add)
998 for (
size_type i = 0; i < n_indices; ++i)
1003 "The given value is not finite but either infinite or Not A Number (NaN)"));
1004 this->
operator()(indices[i]) += values_to_add[i];
1010 template <
typename Number>
1011 template <
typename Functor>
1021 template <
typename Number>
1022 template <
typename Functor>
1031 #endif // ifndef DOXYGEN 1044 template <
typename Number>
IndexSet source_stored_elements
void reinit(MatrixBlock< MatrixType > &v, const BlockSparsityPattern &p)
#define AssertDimension(dim1, dim2)
Number operator[](const size_type global_index) const
void swap(ReadWriteVector< Number > &v)
Number local_element(const size_type local_index) const
std::unique_ptr< Number[], decltype(std::free) * > values
#define AssertIndexRange(index, range)
bool is_finite(const double x)
virtual void reinit(const size_type size, const bool omit_zeroing_entries=false)
static ::ExceptionBase & ExcMessage(std::string arg1)
void swap(LinearAlgebra::ReadWriteVector< Number > &u, LinearAlgebra::ReadWriteVector< Number > &v)
#define Assert(cond, exc)
const value_type & const_reference
Number operator()(const size_type global_index) const
ReadWriteVector< Number > & operator=(const ReadWriteVector< Number > &in_vector)
#define DEAL_II_NAMESPACE_CLOSE
auto apply(F &&fn, Tuple &&t) -> decltype(apply_impl(std::forward< F >(fn), std::forward< Tuple >(t), std_cxx14::make_index_sequence< std::tuple_size< typename std::remove_reference< Tuple >::type >::value >()))
VectorType::value_type * end(VectorType &V)
void add(const std::vector< size_type > &indices, const std::vector< Number2 > &values)
const value_type * const_pointer
virtual void operator()(const size_type begin, const size_type end)
std::shared_ptr< CommunicationPatternBase > comm_pattern
const value_type * const_iterator
unsigned int global_dof_index
#define DEAL_II_NAMESPACE_OPEN
VectorType::value_type * begin(VectorType &V)
void extract_subvector_to(const std::vector< size_type > &indices, std::vector< Number2 > &values) const
TrilinosWrappers::types::int_type global_index(const Epetra_BlockMap &map, const ::types::global_dof_index i)
unsigned int global_to_local(const types::global_dof_index global_index) const
size_type n_elements() const
size_type n_elements() const
const IndexSet & get_stored_elements() const
std::shared_ptr<::parallel::internal::TBBPartitioner > thread_loop_partitioner
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
typename numbers::NumberTraits< Number >::real_type real_type