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,
187  const VectorSpaceVector<double> &V,
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,
272  const VectorSpaceVector<double> &V,
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
virtual double l1_norm() const override
static ::ExceptionBase & ExcDifferentParallelPartitioning()
virtual ::IndexSet locally_owned_elements() const override
virtual double l2_norm() const override
static const char V
virtual size_type size() const override
virtual void scale(const VectorSpaceVector< double > &scaling_factors) override
virtual std::size_t memory_consumption() const override
std::unique_ptr< Epetra_FEVector > vector
virtual void equ(const double a, const VectorSpaceVector< double > &V) override
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:518
void create_epetra_comm_pattern(const IndexSet &source_index_set, const MPI_Comm &mpi_comm)
virtual Vector & operator*=(const double factor) override
#define DeclException0(Exception0)
Definition: exceptions.h:473
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
const Epetra_FEVector & trilinos_vector() const
static ::ExceptionBase & ExcTrilinosError(int arg1)
static ::ExceptionBase & ExcVectorTypeNotCompatible()
void reinit(const IndexSet &parallel_partitioner, const MPI_Comm &communicator, const bool omit_zeroing_entries=false)
std::shared_ptr< const CommunicationPattern > epetra_comm_pattern
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
virtual void sadd(const double s, const double a, const VectorSpaceVector< double > &V) override
virtual Vector & operator+=(const VectorSpaceVector< double > &V) override
virtual Vector & operator/=(const double factor) override
virtual void print(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const override
virtual double mean_value() const override
virtual Vector & operator-=(const VectorSpaceVector< double > &V) override
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
virtual double operator*(const VectorSpaceVector< double > &V) const override
virtual void add(const double a) override
virtual double linfty_norm() const override
virtual double add_and_dot(const double a, const VectorSpaceVector< double > &V, const VectorSpaceVector< double > &W) override