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 128 template <
typename Number>
197 template <
typename Number2>
200 const bool omit_zeroing_entries =
false);
213 const bool omit_zeroing_entries =
false);
216 #ifdef DEAL_II_WITH_TRILINOS 217 # ifdef DEAL_II_WITH_MPI 247 template <
typename Functor>
249 apply(
const Functor &func);
275 template <
typename Number2>
284 operator=(
const Number s);
294 template <
typename MemorySpace>
298 const std::shared_ptr<const CommunicationPatternBase>
299 &communication_pattern =
300 std::shared_ptr<const CommunicationPatternBase>());
302 #ifdef DEAL_II_WITH_PETSC 314 const std::shared_ptr<const CommunicationPatternBase>
315 &communication_pattern =
316 std::shared_ptr<const CommunicationPatternBase>());
319 #ifdef DEAL_II_WITH_TRILINOS 333 const std::shared_ptr<const CommunicationPatternBase>
334 &communication_pattern =
335 std::shared_ptr<const CommunicationPatternBase>());
337 # ifdef DEAL_II_WITH_MPI 338 # ifdef DEAL_II_TRILINOS_WITH_TPETRA 350 const std::shared_ptr<const CommunicationPatternBase>
351 &communication_pattern =
352 std::shared_ptr<const CommunicationPatternBase>());
366 const std::shared_ptr<const CommunicationPatternBase>
367 &communication_pattern =
368 std::shared_ptr<const CommunicationPatternBase>());
372 #ifdef DEAL_II_WITH_CUDA 382 const std::shared_ptr<const CommunicationPatternBase>
383 &communication_pattern =
384 std::shared_ptr<const CommunicationPatternBase>());
410 get_stored_elements()
const;
497 template <
typename Number2>
499 extract_subvector_to(
const std::vector<size_type> &indices,
500 std::vector<Number2> &
values)
const;
529 template <
typename ForwardIterator,
typename OutputIterator>
531 extract_subvector_to(ForwardIterator indices_begin,
532 const ForwardIterator indices_end,
533 OutputIterator values_begin)
const;
546 local_element(
const size_type local_index)
const;
559 local_element(
const size_type local_index);
572 template <
typename Number2>
574 add(
const std::vector<size_type> &indices,
575 const std::vector<Number2> &
values);
581 template <
typename Number2>
583 add(
const std::vector<size_type> & indices,
591 template <
typename Number2>
601 print(std::ostream & out,
602 const unsigned int precision = 3,
603 const bool scientific =
true)
const;
613 #ifdef DEAL_II_WITH_TRILINOS 614 # ifdef DEAL_II_TRILINOS_WITH_TPETRA 622 const Tpetra::Vector<Number, int, types::global_dof_index> &tpetra_vector,
623 const IndexSet & locally_owned_elements,
626 const std::shared_ptr<const CommunicationPatternBase>
627 &communication_pattern);
636 import(
const Epetra_MultiVector &multivector,
637 const IndexSet & locally_owned_elements,
640 const std::shared_ptr<const CommunicationPatternBase>
641 &communication_pattern);
652 return static_cast<unsigned int>(
653 stored_elements.index_within_set(global_index));
660 resize_val(
const size_type new_allocated_size);
662 #if defined(DEAL_II_WITH_TRILINOS) && defined(DEAL_II_WITH_MPI) 663 # ifdef DEAL_II_TRILINOS_WITH_TPETRA 669 create_tpetra_comm_pattern(
const IndexSet &source_index_set,
678 create_epetra_comm_pattern(
const IndexSet &source_index_set,
701 std::unique_ptr<Number[], decltype(std::free) *>
values;
707 mutable std::shared_ptr<::parallel::internal::TBBPartitioner>
711 template <
typename Number2>
720 template <
typename Functor>
755 template <
typename Number>
758 , values(nullptr,
free)
768 template <
typename Number>
779 template <
typename Number>
792 template <
typename Number>
794 const IndexSet &locally_stored_indices)
806 template <
typename Number>
810 return stored_elements.
size();
815 template <
typename Number>
824 template <
typename Number>
833 template <
typename Number>
842 template <
typename Number>
851 template <
typename Number>
860 template <
typename Number>
869 template <
typename Number>
878 template <
typename Number>
887 template <
typename Number>
896 template <
typename Number>
905 template <
typename Number>
906 template <
typename Number2>
909 const std::vector<size_type> &indices,
910 std::vector<Number2> & extracted_values)
const 912 for (
size_type i = 0; i < indices.size(); ++i)
913 extracted_values[i] =
operator()(indices[i]);
918 template <
typename Number>
919 template <
typename ForwardIterator,
typename OutputIterator>
922 ForwardIterator indices_begin,
923 const ForwardIterator indices_end,
924 OutputIterator values_begin)
const 926 while (indices_begin != indices_end)
936 template <
typename Number>
942 return values[local_index];
947 template <
typename Number>
953 return values[local_index];
958 template <
typename Number>
959 template <
typename Number2>
962 const std::vector<Number2> & values)
965 add(indices.size(), indices.data(), values.data());
970 template <
typename Number>
971 template <
typename Number2>
982 "The given value is not finite but either infinite or Not A Number (NaN)"));
983 this->
operator()(indices[i]) += values[indices[i]];
989 template <
typename Number>
990 template <
typename Number2>
994 const Number2 * values_to_add)
996 for (
size_type i = 0; i < n_indices; ++i)
1001 "The given value is not finite but either infinite or Not A Number (NaN)"));
1002 this->
operator()(indices[i]) += values_to_add[i];
1008 template <
typename Number>
1009 template <
typename Functor>
1019 template <
typename Number>
1020 template <
typename Functor>
1029 #endif // ifndef DOXYGEN 1042 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)
auto apply(F &&fn, Tuple &&t) -> decltype(apply_impl(std::forward< F >(fn), std::forward< Tuple >(t), std::make_index_sequence< std::tuple_size< typename std::remove_reference< Tuple >::type >::value >()))
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
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