Reference documentation for deal.II version Git 8596a7cd07 2020-12-04 07:30:43 +0100
\(\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  {
64  class Vector : public VectorSpaceVector<double>, public Subscriptor
65  {
66  public:
70  Vector();
71 
76  Vector(const Vector &V);
77 
84  explicit Vector(const IndexSet &parallel_partitioner,
85  const MPI_Comm &communicator);
86 
93  void
94  reinit(const IndexSet &parallel_partitioner,
95  const MPI_Comm &communicator,
96  const bool omit_zeroing_entries = false);
97 
102  virtual void
104  const bool omit_zeroing_entries = false) override;
105 
111  Vector &
112  operator=(const Vector &V);
113 
118  virtual Vector &
119  operator=(const double s) override;
120 
129  virtual void
130  import(
131  const ReadWriteVector<double> & V,
132  VectorOperation::values operation,
133  std::shared_ptr<const CommunicationPatternBase> communication_pattern =
134  std::shared_ptr<const CommunicationPatternBase>()) override;
135 
139  virtual Vector &
140  operator*=(const double factor) override;
141 
145  virtual Vector &
146  operator/=(const double factor) override;
147 
151  virtual Vector &
152  operator+=(const VectorSpaceVector<double> &V) override;
153 
157  virtual Vector &
158  operator-=(const VectorSpaceVector<double> &V) override;
159 
164  virtual double
165  operator*(const VectorSpaceVector<double> &V) const override;
166 
170  virtual void
171  add(const double a) override;
172 
177  virtual void
178  add(const double a, const VectorSpaceVector<double> &V) override;
179 
184  virtual void
185  add(const double a,
186  const VectorSpaceVector<double> &V,
187  const double b,
188  const VectorSpaceVector<double> &W) override;
189 
194  virtual void
195  sadd(const double s,
196  const double a,
197  const VectorSpaceVector<double> &V) override;
198 
205  virtual void
206  scale(const VectorSpaceVector<double> &scaling_factors) override;
207 
211  virtual void
212  equ(const double a, const VectorSpaceVector<double> &V) override;
213 
217  virtual bool
218  all_zero() const override;
219 
223  virtual double
224  mean_value() const override;
225 
230  virtual double
231  l1_norm() const override;
232 
237  virtual double
238  l2_norm() const override;
239 
244  virtual double
245  linfty_norm() const override;
246 
269  virtual double
270  add_and_dot(const double a,
271  const VectorSpaceVector<double> &V,
272  const VectorSpaceVector<double> &W) override;
277  bool
278  has_ghost_elements() const;
279 
284  virtual size_type
285  size() const override;
286 
290  MPI_Comm
291  get_mpi_communicator() const;
292 
304  virtual ::IndexSet
305  locally_owned_elements() const override;
306 
311  const Epetra_FEVector &
312  trilinos_vector() const;
313 
318  Epetra_FEVector &
319  trilinos_vector();
320 
324  virtual void
325  print(std::ostream & out,
326  const unsigned int precision = 3,
327  const bool scientific = true,
328  const bool across = true) const override;
329 
333  virtual std::size_t
334  memory_consumption() const override;
335 
341 
348 
355  int,
356  << "An error with error number " << arg1
357  << " occurred while calling a Trilinos function");
358 
359  private:
365  void
366  create_epetra_comm_pattern(const IndexSet &source_index_set,
367  const MPI_Comm &mpi_comm);
368 
372  std::unique_ptr<Epetra_FEVector> vector;
373 
378 
383  std::shared_ptr<const CommunicationPattern> epetra_comm_pattern;
384  };
385 
386 
387  inline bool
389  {
390  return false;
391  }
392  } // namespace EpetraWrappers
393 } // namespace LinearAlgebra
394 
395 
399 template <>
401 {};
402 
404 
405 #endif
406 
407 #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:515
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:470
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:372
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:371
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