17#ifdef DEAL_II_WITH_TRILINOS
25# include <boost/io/ios_state.hpp>
27# include <Epetra_Import.h>
28# include <Epetra_Map.h>
29# include <Epetra_MpiComm.h>
38 namespace EpetraWrappers
43 VectorReference::operator value_type()
const
52 vector.vector->Map().LID(
55# ifndef DEAL_II_WITH_64BIT_INDICES
57 ExcAccessToNonLocalElement(index,
58 vector.vector->Map().NumMyElements(),
59 vector.vector->Map().MinMyGID(),
60 vector.vector->Map().MaxMyGID()));
63 ExcAccessToNonLocalElement(index,
64 vector.vector->Map().NumMyElements(),
65 vector.vector->Map().MinMyGID64(),
66 vector.vector->Map().MaxMyGID64()));
69 return (*(vector.vector))[0][local_index];
79# ifdef DEAL_II_HAVE_CXX20
84 : vector(new Epetra_FEVector(
85 Epetra_Map(0, 0, 0,
Utilities::Trilinos::comm_self())))
91 : vector(new Epetra_FEVector(V.trilinos_vector()))
98 : vector(new Epetra_FEVector(
99 parallel_partitioner.make_trilinos_map(communicator, false)))
107 const bool omit_zeroing_entries)
140 const auto &map =
vector.Map();
142 for (
unsigned int i = 0; i < indices.
size(); ++i)
201 const std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
202 &communication_pattern)
217 dynamic_cast<const Epetra_MpiComm &
>(
vector->Comm()).Comm());
223 std::dynamic_pointer_cast<const CommunicationPattern>(
227 ExcMessage(
"The communication pattern is not of type "
228 "LinearAlgebra::EpetraWrappers::CommunicationPattern."));
236 std::copy(V.
begin(), V.
end(), values);
268 *
this *= 1. / factor;
290# if DEAL_II_TRILINOS_VERSION_GTE(11, 11, 0)
301 Epetra_MultiVector dummy(
vector->Map(), 1,
false);
350 const unsigned local_size(
vector->MyLength());
351 for (
unsigned int i = 0; i < local_size; ++i)
422 this->
sadd(0., a, V);
441 unsigned int flag = 0;
453 const Epetra_MpiComm *mpi_comm =
454 dynamic_cast<const Epetra_MpiComm *
>(&
vector->Map().Comm());
529# ifndef DEAL_II_WITH_64BIT_INDICES
530 return vector->GlobalLength();
532 return vector->GlobalLength64();
541 return vector->MyLength();
550 dynamic_cast<const Epetra_MpiComm *
>(&(
vector->Comm()));
563 if (
vector->Map().LinearMap())
565# ifndef DEAL_II_WITH_64BIT_INDICES
566 is.add_range(
vector->Map().MinMyGID(),
vector->Map().MaxMyGID() + 1);
568 is.add_range(
vector->Map().MinMyGID64(),
569 vector->Map().MaxMyGID64() + 1);
572 else if (
vector->Map().NumMyElements() > 0)
575# ifndef DEAL_II_WITH_64BIT_INDICES
577 reinterpret_cast<unsigned int *
>(
vector->Map().MyGlobalElements());
596 const Epetra_FEVector &
614 const unsigned int precision,
615 const bool scientific,
616 const bool across)
const
629 out.precision(precision);
631 out.setf(std::ios::scientific, std::ios::floatfield);
633 out.setf(std::ios::fixed, std::ios::floatfield);
636 for (
int i = 0; i <
vector->MyLength(); ++i)
637 out << val[i] <<
' ';
639 for (
int i = 0; i <
vector->MyLength(); ++i)
640 out << val[i] << std::endl;
653 return sizeof(*this) +
Vector & operator-=(const Vector &V)
void equ(const double a, const Vector &V)
Vector & operator=(const Vector &V)
MPI_Comm get_mpi_communicator() const
void compress(const VectorOperation::values operation)
void print(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const
std::unique_ptr< Epetra_FEVector > vector
const Epetra_FEVector & trilinos_vector() const
void import_elements(const ReadWriteVector< double > &V, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={})
void sadd(const double s, const double a, const Vector &V)
Vector & operator/=(const double factor)
virtual size_type size() const override
size_type locally_owned_size() const
::IndexSet locally_owned_elements() const
Vector & operator+=(const Vector &V)
void scale(const Vector &scaling_factors)
void create_epetra_comm_pattern(const IndexSet &source_index_set, const MPI_Comm mpi_comm)
double mean_value() const
Vector & operator*=(const double factor)
::IndexSet source_stored_elements
double operator*(const Vector &V) const
std::shared_ptr< const CommunicationPattern > epetra_comm_pattern
std::size_t memory_consumption() const
void reinit(const IndexSet ¶llel_partitioner, const MPI_Comm communicator, const bool omit_zeroing_entries=false)
virtual void extract_subvector_to(const ArrayView< const types::global_dof_index > &indices, const ArrayView< double > &elements) const override
double linfty_norm() const
double add_and_dot(const double a, const Vector &V, const Vector &W)
const IndexSet & get_stored_elements() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcIO()
static ::ExceptionBase & ExcZero()
static ::ExceptionBase & ExcTrilinosError(int arg1)
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertIsFinite(number)
static ::ExceptionBase & ExcDifferentParallelPartitioning()
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
T sum(const T &t, const MPI_Comm mpi_communicator)