|
Reference documentation for deal.II version 9.2.0
|
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\)
\(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\)
\(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\)
\(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Go to the documentation of this file.
20 #ifdef DEAL_II_WITH_TRILINOS
22 # ifdef DEAL_II_WITH_MPI
28 # include <boost/io/ios_state.hpp>
30 # include <Epetra_Import.h>
31 # include <Epetra_Map.h>
32 # include <Epetra_MpiComm.h>
41 namespace EpetraWrappers
45 , vector(new Epetra_FEVector(
53 , vector(new Epetra_FEVector(
V.trilinos_vector()))
61 , vector(new Epetra_FEVector(
62 parallel_partitioner.make_trilinos_map(communicator, false)))
70 const bool omit_zeroing_entries)
72 Epetra_Map input_map =
74 if (
vector->Map().SameAs(input_map) ==
false)
75 vector = std_cxx14::make_unique<Epetra_FEVector>(input_map);
76 else if (omit_zeroing_entries ==
false)
78 const int ierr =
vector->PutScalar(0.);
88 const bool omit_zeroing_entries)
99 omit_zeroing_entries);
111 if (
vector->Map().SameAs(
V.trilinos_vector().Map()))
115 if (
size() ==
V.size())
117 Epetra_Import data_exchange(
vector->Map(),
118 V.trilinos_vector().Map());
121 vector->Import(
V.trilinos_vector(), data_exchange, Insert);
127 std_cxx14::make_unique<Epetra_FEVector>(
V.trilinos_vector());
140 const int ierr =
vector->PutScalar(s);
153 std::shared_ptr<const CommunicationPatternBase> communication_pattern)
157 if (communication_pattern ==
nullptr)
163 V.get_stored_elements().size()) ||
167 V.get_stored_elements(),
168 dynamic_cast<const Epetra_MpiComm &
>(
vector->Comm()).Comm());
174 std::dynamic_pointer_cast<const CommunicationPattern>(
175 communication_pattern);
179 std::string(
"The communication pattern is not of type ") +
180 "LinearAlgebra::EpetraWrappers::CommunicationPattern."));
186 Epetra_FEVector source_vector(
import.TargetMap());
187 double * values = source_vector.Values();
191 vector->Export(source_vector,
import, Insert);
193 vector->Export(source_vector,
import, Add);
195 vector->Export(source_vector,
import, Epetra_Max);
197 vector->Export(source_vector,
import, Epetra_Min);
220 *
this *= 1. / factor;
248 # if DEAL_II_TRILINOS_VERSION_GTE(11, 11, 0)
249 Epetra_Import data_exchange(
vector->Map(),
253 Epetra_AddLocalAlso);
261 Epetra_Import data_exchange(
dummy.Map(),
316 const unsigned local_size(
vector->MyLength());
317 for (
unsigned int i = 0; i < local_size; ++i)
367 const int ierr =
vector->Update(
398 Assert(
dynamic_cast<const Vector *
>(&scaling_factors) !=
nullptr,
402 const Vector &down_scaling_factors =
403 dynamic_cast<const Vector &
>(scaling_factors);
407 const int ierr =
vector->Multiply(1.0,
428 this->
sadd(0., a,
V);
445 double * start_ptr = (*vector)[0];
446 const double *ptr = start_ptr, *eptr = start_ptr +
vector->MyLength();
447 unsigned int flag = 0;
459 const Epetra_MpiComm *mpi_comm =
460 dynamic_cast<const Epetra_MpiComm *
>(&
vector->Map().Comm());
464 return num_nonzero == 0;
537 # ifndef DEAL_II_WITH_64BIT_INDICES
538 return vector->GlobalLength();
540 return vector->GlobalLength64();
549 const Epetra_MpiComm *epetra_comm =
550 dynamic_cast<const Epetra_MpiComm *
>(&(
vector->Comm()));
552 return epetra_comm->GetMpiComm();
563 if (
vector->Map().LinearMap())
565 # ifndef DEAL_II_WITH_64BIT_INDICES
569 vector->Map().MaxMyGID64() + 1);
572 else if (
vector->Map().NumMyElements() > 0)
575 # ifndef DEAL_II_WITH_64BIT_INDICES
576 unsigned int *vector_indices =
577 reinterpret_cast<unsigned int *
>(
vector->Map().MyGlobalElements());
582 is.
add_indices(vector_indices, vector_indices + n_indices);
591 const Epetra_FEVector &
609 const unsigned int precision,
610 const bool scientific,
611 const bool across)
const
614 boost::io::ios_flags_saver restore_flags(out);
619 int leading_dimension;
620 int ierr =
vector->ExtractView(&val, &leading_dimension);
624 out.precision(precision);
626 out.setf(std::ios::scientific, std::ios::floatfield);
628 out.setf(std::ios::fixed, std::ios::floatfield);
631 for (
int i = 0; i <
vector->MyLength(); ++i)
632 out << val[i] <<
' ';
634 for (
int i = 0; i <
vector->MyLength(); ++i)
635 out << val[i] << std::endl;
648 return sizeof(*this) +
const Epetra_FEVector & trilinos_vector() const
MPI_Comm get_mpi_communicator() const
static ::ExceptionBase & ExcIO()
static ::ExceptionBase & ExcDifferentParallelPartitioning()
std::unique_ptr< Epetra_FEVector > vector
static ::ExceptionBase & ExcNotImplemented()
virtual double add_and_dot(const double a, const VectorSpaceVector< double > &V, const VectorSpaceVector< double > &W) override
virtual double l1_norm() const override
Epetra_Map make_trilinos_map(const MPI_Comm &communicator=MPI_COMM_WORLD, const bool overlapping=false) const
virtual Vector & operator*=(const double factor) override
static ::ExceptionBase & ExcTrilinosError(int arg1)
virtual double l2_norm() const override
#define AssertIsFinite(number)
static ::ExceptionBase & ExcMessage(std::string arg1)
virtual Vector & operator/=(const double factor) override
double norm(const FEValuesBase< dim > &fe, const ArrayView< const std::vector< Tensor< 1, dim >>> &Du)
#define DEAL_II_NAMESPACE_OPEN
virtual Vector & operator-=(const VectorSpaceVector< double > &V) override
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
virtual std::size_t memory_consumption() const override
virtual void equ(const double a, const VectorSpaceVector< double > &V) override
virtual void print(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const override
T sum(const T &t, const MPI_Comm &mpi_communicator)
virtual double mean_value() const override
const Epetra_Comm & comm_self()
virtual double operator*(const VectorSpaceVector< double > &V) const override
virtual void add(const double a) override
const types::global_dof_index * dummy()
static ::ExceptionBase & ExcInternalError()
virtual void import(const ReadWriteVector< double > &V, VectorOperation::values operation, std::shared_ptr< const CommunicationPatternBase > communication_pattern=std::shared_ptr< const CommunicationPatternBase >()) override
#define Assert(cond, exc)
void create_epetra_comm_pattern(const IndexSet &source_index_set, const MPI_Comm &mpi_comm)
static ::ExceptionBase & ExcVectorTypeNotCompatible()
static ::ExceptionBase & ExcZero()
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
virtual double linfty_norm() const override
virtual Vector & operator+=(const VectorSpaceVector< double > &V) override
::IndexSet source_stored_elements
Vector & operator=(const Vector &V)
virtual bool all_zero() const override
void reinit(const IndexSet ¶llel_partitioner, const MPI_Comm &communicator, const bool omit_zeroing_entries=false)
#define DEAL_II_NAMESPACE_CLOSE
std::shared_ptr< const CommunicationPattern > epetra_comm_pattern
void add_indices(const ForwardIterator &begin, const ForwardIterator &end)
virtual void sadd(const double s, const double a, const VectorSpaceVector< double > &V) override
virtual ::IndexSet locally_owned_elements() const override
#define AssertThrow(cond, exc)
void add_range(const size_type begin, const size_type end)
void copy(const T *begin, const T *end, U *dest)
virtual size_type size() const override
virtual void scale(const VectorSpaceVector< double > &scaling_factors) override