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\}}\)
trilinos_epetra_vector.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2015 - 2020 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_trilinos_epetra_vector_h
17 #define dealii_trilinos_epetra_vector_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #if defined(DEAL_II_WITH_TRILINOS) && defined(DEAL_II_WITH_MPI)
23 
24 # include <deal.II/base/index_set.h>
26 
31 
32 # include <Epetra_FEVector.h>
33 # include <mpi.h>
34 
35 # include <memory>
36 
38 
39 namespace LinearAlgebra
40 {
41  // Forward declaration
42  template <typename Number>
43  class ReadWriteVector;
44 
52  namespace EpetraWrappers
53  {
65  class Vector : public VectorSpaceVector<double>, public Subscriptor
66  {
67  public:
71  Vector();
72 
77  Vector(const Vector &V);
78 
85  explicit Vector(const IndexSet &parallel_partitioner,
86  const MPI_Comm &communicator);
87 
94  void
95  reinit(const IndexSet &parallel_partitioner,
96  const MPI_Comm &communicator,
97  const bool omit_zeroing_entries = false);
98 
103  virtual void
105  const bool omit_zeroing_entries = false) override;
106 
112  Vector &
113  operator=(const Vector &V);
114 
119  virtual Vector &
120  operator=(const double s) override;
121 
130  virtual void
131  import(
132  const ReadWriteVector<double> & V,
133  VectorOperation::values operation,
134  std::shared_ptr<const CommunicationPatternBase> communication_pattern =
135  std::shared_ptr<const CommunicationPatternBase>()) override;
136 
140  virtual Vector &
141  operator*=(const double factor) override;
142 
146  virtual Vector &
147  operator/=(const double factor) override;
148 
152  virtual Vector &
153  operator+=(const VectorSpaceVector<double> &V) override;
154 
158  virtual Vector &
159  operator-=(const VectorSpaceVector<double> &V) override;
160 
165  virtual double
166  operator*(const VectorSpaceVector<double> &V) const override;
167 
171  virtual void
172  add(const double a) override;
173 
178  virtual void
179  add(const double a, const VectorSpaceVector<double> &V) override;
180 
185  virtual void
186  add(const double a,
188  const double b,
189  const VectorSpaceVector<double> &W) override;
190 
195  virtual void
196  sadd(const double s,
197  const double a,
198  const VectorSpaceVector<double> &V) override;
199 
206  virtual void
207  scale(const VectorSpaceVector<double> &scaling_factors) override;
208 
212  virtual void
213  equ(const double a, const VectorSpaceVector<double> &V) override;
214 
218  virtual bool
219  all_zero() const override;
220 
224  virtual double
225  mean_value() const override;
226 
231  virtual double
232  l1_norm() const override;
233 
238  virtual double
239  l2_norm() const override;
240 
245  virtual double
246  linfty_norm() const override;
247 
270  virtual double
271  add_and_dot(const double a,
273  const VectorSpaceVector<double> &W) override;
278  bool
279  has_ghost_elements() const;
280 
285  virtual size_type
286  size() const override;
287 
291  MPI_Comm
292  get_mpi_communicator() const;
293 
305  virtual ::IndexSet
306  locally_owned_elements() const override;
307 
312  const Epetra_FEVector &
313  trilinos_vector() const;
314 
319  Epetra_FEVector &
320  trilinos_vector();
321 
325  virtual void
326  print(std::ostream & out,
327  const unsigned int precision = 3,
328  const bool scientific = true,
329  const bool across = true) const override;
330 
334  virtual std::size_t
335  memory_consumption() const override;
336 
342 
349 
356  int,
357  << "An error with error number " << arg1
358  << " occurred while calling a Trilinos function");
359 
360  private:
366  void
367  create_epetra_comm_pattern(const IndexSet &source_index_set,
368  const MPI_Comm &mpi_comm);
369 
373  std::unique_ptr<Epetra_FEVector> vector;
374 
379 
384  std::shared_ptr<const CommunicationPattern> epetra_comm_pattern;
385  };
386 
387 
388  inline bool
390  {
391  return false;
392  }
393  } // namespace EpetraWrappers
394 } // namespace LinearAlgebra
395 
396 
400 template <>
402 {};
403 
405 
406 #endif
407 
408 #endif
LinearAlgebra::EpetraWrappers::Vector::trilinos_vector
const Epetra_FEVector & trilinos_vector() const
Definition: trilinos_epetra_vector.cc:592
LinearAlgebra::EpetraWrappers::Vector::get_mpi_communicator
MPI_Comm get_mpi_communicator() const
Definition: trilinos_epetra_vector.cc:547
IndexSet
Definition: index_set.h:74
LinearAlgebraDealII::Vector
Vector< double > Vector
Definition: generic_linear_algebra.h:43
LinearAlgebra::EpetraWrappers::Vector::ExcDifferentParallelPartitioning
static ::ExceptionBase & ExcDifferentParallelPartitioning()
LinearAlgebra
Definition: communication_pattern_base.h:30
LinearAlgebra::EpetraWrappers::Vector::vector
std::unique_ptr< Epetra_FEVector > vector
Definition: trilinos_epetra_vector.h:373
LinearAlgebra::EpetraWrappers::Vector::add_and_dot
virtual double add_and_dot(const double a, const VectorSpaceVector< double > &V, const VectorSpaceVector< double > &W) override
Definition: trilinos_epetra_vector.cc:523
LinearAlgebra::EpetraWrappers::Vector::l1_norm
virtual double l1_norm() const override
Definition: trilinos_epetra_vector.cc:484
LAPACKSupport::V
static const char V
Definition: lapack_support.h:175
MPI_Comm
LinearAlgebra::EpetraWrappers::Vector::operator*=
virtual Vector & operator*=(const double factor) override
Definition: trilinos_epetra_vector.cc:205
vector_space_vector.h
Subscriptor
Definition: subscriptor.h:62
LinearAlgebra::EpetraWrappers::Vector::ExcTrilinosError
static ::ExceptionBase & ExcTrilinosError(int arg1)
LinearAlgebra::EpetraWrappers::Vector::l2_norm
virtual double l2_norm() const override
Definition: trilinos_epetra_vector.cc:497
is_serial_vector
Definition: vector_type_traits.h:49
vector_operation.h
mpi.h
LinearAlgebra::EpetraWrappers::Vector::operator/=
virtual Vector & operator/=(const double factor) override
Definition: trilinos_epetra_vector.cc:216
index_set.h
subscriptor.h
LinearAlgebra::EpetraWrappers::Vector
Definition: trilinos_epetra_vector.h:65
vector_type_traits.h
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
LinearAlgebra::EpetraWrappers::Vector::operator-=
virtual Vector & operator-=(const VectorSpaceVector< double > &V) override
Definition: trilinos_epetra_vector.cc:280
Physics::Elasticity::Kinematics::b
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
LinearAlgebra::EpetraWrappers::Vector::has_ghost_elements
bool has_ghost_elements() const
Definition: trilinos_epetra_vector.h:389
LinearAlgebra::EpetraWrappers::Vector::memory_consumption
virtual std::size_t memory_consumption() const override
Definition: trilinos_epetra_vector.cc:646
LinearAlgebra::EpetraWrappers::Vector::equ
virtual void equ(const double a, const VectorSpaceVector< double > &V) override
Definition: trilinos_epetra_vector.cc:418
DeclException1
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:518
LinearAlgebra::EpetraWrappers::Vector::print
virtual void print(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const override
Definition: trilinos_epetra_vector.cc:608
VectorOperation::values
values
Definition: vector_operation.h:40
LinearAlgebra::EpetraWrappers::Vector::mean_value
virtual double mean_value() const override
Definition: trilinos_epetra_vector.cc:470
LinearAlgebra::ReadWriteVector
Definition: read_write_vector.h:131
LinearAlgebra::EpetraWrappers::Vector::operator*
virtual double operator*(const VectorSpaceVector< double > &V) const override
Definition: trilinos_epetra_vector.cc:289
LinearAlgebra::EpetraWrappers::Vector::add
virtual void add(const double a) override
Definition: trilinos_epetra_vector.cc:313
unsigned int
LinearAlgebra::VectorSpaceVector
Definition: vector_space_vector.h:57
DeclException0
#define DeclException0(Exception0)
Definition: exceptions.h:473
LinearAlgebra::EpetraWrappers::Vector::create_epetra_comm_pattern
void create_epetra_comm_pattern(const IndexSet &source_index_set, const MPI_Comm &mpi_comm)
Definition: trilinos_epetra_vector.cc:656
LinearAlgebra::EpetraWrappers::Vector::ExcVectorTypeNotCompatible
static ::ExceptionBase & ExcVectorTypeNotCompatible()
trilinos_epetra_communication_pattern.h
LinearAlgebra::EpetraWrappers::Vector::linfty_norm
virtual double linfty_norm() const override
Definition: trilinos_epetra_vector.cc:510
config.h
LinearAlgebra::EpetraWrappers::Vector::operator+=
virtual Vector & operator+=(const VectorSpaceVector< double > &V) override
Definition: trilinos_epetra_vector.cc:228
LinearAlgebra::EpetraWrappers::Vector::source_stored_elements
::IndexSet source_stored_elements
Definition: trilinos_epetra_vector.h:378
LinearAlgebra::EpetraWrappers::Vector::operator=
Vector & operator=(const Vector &V)
Definition: trilinos_epetra_vector.cc:105
LinearAlgebra::EpetraWrappers::Vector::all_zero
virtual bool all_zero() const override
Definition: trilinos_epetra_vector.cc:441
LinearAlgebra::EpetraWrappers::Vector::reinit
void reinit(const IndexSet &parallel_partitioner, const MPI_Comm &communicator, const bool omit_zeroing_entries=false)
Definition: trilinos_epetra_vector.cc:68
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
LinearAlgebra::EpetraWrappers::Vector::epetra_comm_pattern
std::shared_ptr< const CommunicationPattern > epetra_comm_pattern
Definition: trilinos_epetra_vector.h:384
LinearAlgebra::EpetraWrappers::Vector::sadd
virtual void sadd(const double s, const double a, const VectorSpaceVector< double > &V) override
Definition: trilinos_epetra_vector.cc:376
LinearAlgebra::EpetraWrappers::Vector::locally_owned_elements
virtual ::IndexSet locally_owned_elements() const override
Definition: trilinos_epetra_vector.cc:558
LinearAlgebra::EpetraWrappers::Vector::size
virtual size_type size() const override
Definition: trilinos_epetra_vector.cc:535
LinearAlgebra::EpetraWrappers::Vector::Vector
Vector()
Definition: trilinos_epetra_vector.cc:43
LinearAlgebra::EpetraWrappers::Vector::scale
virtual void scale(const VectorSpaceVector< double > &scaling_factors) override
Definition: trilinos_epetra_vector.cc:395