Reference documentation for deal.II version 8.5.1
trilinos_epetra_vector.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2015 - 2016 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 at
12 // the top level of the deal.II distribution.
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 #ifdef DEAL_II_WITH_TRILINOS
23 
24 #ifdef DEAL_II_WITH_MPI
25 
26 #include <deal.II/base/index_set.h>
27 #include <deal.II/base/std_cxx11/shared_ptr.h>
28 #include <deal.II/lac/read_write_vector.h>
29 #include <deal.II/lac/vector_space_vector.h>
30 #include <memory>
31 #include "mpi.h"
32 #include "Epetra_FEVector.h"
33 
34 DEAL_II_NAMESPACE_OPEN
35 
36 namespace LinearAlgebra
37 {
38  // Forward declaration
39  template <typename Number>
40  class ReadWriteVector;
41 
42  namespace EpetraWrappers
43  {
54  class Vector : public VectorSpaceVector<double>
55  {
56  public:
60  Vector();
61 
66  Vector(const Vector &V);
67 
74  explicit Vector(const IndexSet &parallel_partitioner,
75  const MPI_Comm &communicator);
76 
83  void reinit (const IndexSet &parallel_partitioner,
84  const MPI_Comm &communicator,
85  const bool omit_zeroing_entries = false);
86 
92  Vector &operator= (const Vector &V);
93 
102  virtual void import(const ReadWriteVector<double> &V,
103  VectorOperation::values operation,
104  std_cxx11::shared_ptr<const CommunicationPatternBase> communication_pattern =
105  std_cxx11::shared_ptr<const CommunicationPatternBase> ());
106 
110  virtual Vector &operator*= (const double factor);
111 
115  virtual Vector &operator/= (const double factor);
116 
120  virtual Vector &operator+= (const VectorSpaceVector<double> &V);
121 
125  virtual Vector &operator-= (const VectorSpaceVector<double> &V);
126 
131  virtual double operator* (const VectorSpaceVector<double> &V) const;
132 
136  virtual void add(const double a);
137 
142  virtual void add(const double a, const VectorSpaceVector<double> &V);
143 
148  virtual void add(const double a, const VectorSpaceVector<double> &V,
149  const double b, const VectorSpaceVector<double> &W);
150 
155  virtual void sadd(const double s, const double a,
156  const VectorSpaceVector<double> &V);
157 
164  virtual void scale(const VectorSpaceVector<double> &scaling_factors);
165 
169  virtual void equ(const double a, const VectorSpaceVector<double> &V);
170 
174  virtual double mean_value() const;
175 
180  virtual double l1_norm() const;
181 
186  virtual double l2_norm() const;
187 
192  virtual double linfty_norm() const;
193 
212  virtual double add_and_dot(const double a,
213  const VectorSpaceVector<double> &V,
214  const VectorSpaceVector<double> &W);
215 
220  virtual size_type size() const;
221 
225  MPI_Comm get_mpi_communicator() const;
226 
237  virtual ::IndexSet locally_owned_elements() const;
238 
243  const Epetra_FEVector &trilinos_vector() const;
244 
249  Epetra_FEVector &trilinos_vector();
250 
254  virtual void print(std::ostream &out,
255  const unsigned int precision=3,
256  const bool scientific=true,
257  const bool across=true) const;
258 
262  virtual std::size_t memory_consumption() const;
263 
269 
276 
283  int,
284  << "An error with error number " << arg1
285  << " occurred while calling a Trilinos function");
286 
287  private:
293  void create_epetra_comm_pattern(const IndexSet &source_index_set,
294  const MPI_Comm &mpi_comm);
295 
299  std_cxx11::shared_ptr<Epetra_FEVector> vector;
300 
305 
310  std_cxx11::shared_ptr<const CommunicationPattern> epetra_comm_pattern;
311  };
312  }
313 }
314 
315 DEAL_II_NAMESPACE_CLOSE
316 
317 #endif
318 
319 #endif
320 
321 #endif
static ::ExceptionBase & ExcDifferentParallelPartitioning()
virtual Vector & operator+=(const VectorSpaceVector< double > &V)
virtual std::size_t memory_consumption() const
virtual void scale(const VectorSpaceVector< double > &scaling_factors)
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:564
void create_epetra_comm_pattern(const IndexSet &source_index_set, const MPI_Comm &mpi_comm)
virtual void print(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const
#define DeclException0(Exception0)
Definition: exceptions.h:541
const Epetra_FEVector & trilinos_vector() const
virtual double operator*(const VectorSpaceVector< double > &V) 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)
virtual ::IndexSet locally_owned_elements() const
virtual double add_and_dot(const double a, const VectorSpaceVector< double > &V, const VectorSpaceVector< double > &W)
std_cxx11::shared_ptr< Epetra_FEVector > vector
virtual void equ(const double a, const VectorSpaceVector< double > &V)
virtual void sadd(const double s, const double a, const VectorSpaceVector< double > &V)
virtual Vector & operator/=(const double factor)
virtual Vector & operator-=(const VectorSpaceVector< double > &V)
virtual Vector & operator*=(const double factor)
std_cxx11::shared_ptr< const CommunicationPattern > epetra_comm_pattern