Reference documentation for deal.II version 9.3.3
\(\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 - 2021 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
26
31
32# include <Epetra_FEVector.h>
33# include <mpi.h>
34
35# include <memory>
36
38
39namespace 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(const ReadWriteVector<double> &V,
131 VectorOperation::values operation,
132 std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
133 communication_pattern = {}) override;
134
138 virtual Vector &
139 operator*=(const double factor) override;
140
144 virtual Vector &
145 operator/=(const double factor) override;
146
150 virtual Vector &
151 operator+=(const VectorSpaceVector<double> &V) override;
152
156 virtual Vector &
157 operator-=(const VectorSpaceVector<double> &V) override;
158
163 virtual double
164 operator*(const VectorSpaceVector<double> &V) const override;
165
169 virtual void
170 add(const double a) override;
171
176 virtual void
177 add(const double a, const VectorSpaceVector<double> &V) override;
178
183 virtual void
184 add(const double a,
186 const double b,
187 const VectorSpaceVector<double> &W) override;
188
193 virtual void
194 sadd(const double s,
195 const double a,
196 const VectorSpaceVector<double> &V) override;
197
204 virtual void
205 scale(const VectorSpaceVector<double> &scaling_factors) override;
206
210 virtual void
211 equ(const double a, const VectorSpaceVector<double> &V) override;
212
216 virtual bool
217 all_zero() const override;
218
222 virtual double
223 mean_value() const override;
224
229 virtual double
230 l1_norm() const override;
231
236 virtual double
237 l2_norm() const override;
238
243 virtual double
244 linfty_norm() const override;
245
268 virtual double
269 add_and_dot(const double a,
271 const VectorSpaceVector<double> &W) override;
276 bool
277 has_ghost_elements() const;
278
283 virtual size_type
284 size() const override;
285
291 locally_owned_size() const;
292
297 get_mpi_communicator() const;
298
310 virtual ::IndexSet
311 locally_owned_elements() const override;
312
317 const Epetra_FEVector &
318 trilinos_vector() const;
319
324 Epetra_FEVector &
326
330 virtual void
331 print(std::ostream & out,
332 const unsigned int precision = 3,
333 const bool scientific = true,
334 const bool across = true) const override;
335
339 virtual std::size_t
340 memory_consumption() const override;
341
347
354
361 int,
362 << "An error with error number " << arg1
363 << " occurred while calling a Trilinos function");
364
365 private:
371 void
372 create_epetra_comm_pattern(const IndexSet &source_index_set,
373 const MPI_Comm &mpi_comm);
374
378 std::unique_ptr<Epetra_FEVector> vector;
379
384
389 std::shared_ptr<const CommunicationPattern> epetra_comm_pattern;
390 };
391
392
393 inline bool
395 {
396 return false;
397 }
398 } // namespace EpetraWrappers
399} // namespace LinearAlgebra
400
401
405template <>
407{};
408
410
411#endif
412
413#endif
virtual double mean_value() const override
virtual Vector & operator/=(const double factor) override
virtual double l2_norm() const override
std::unique_ptr< Epetra_FEVector > vector
const Epetra_FEVector & trilinos_vector() const
virtual double l1_norm() const override
virtual ::IndexSet locally_owned_elements() const override
virtual double add_and_dot(const double a, const VectorSpaceVector< double > &V, const VectorSpaceVector< double > &W) override
virtual void scale(const VectorSpaceVector< double > &scaling_factors) override
void create_epetra_comm_pattern(const IndexSet &source_index_set, const MPI_Comm &mpi_comm)
virtual double operator*(const VectorSpaceVector< double > &V) const override
void reinit(const IndexSet &parallel_partitioner, const MPI_Comm &communicator, const bool omit_zeroing_entries=false)
virtual size_type size() const override
virtual void print(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const override
virtual Vector & operator-=(const VectorSpaceVector< double > &V) override
virtual double linfty_norm() const override
virtual void add(const double a) override
virtual void equ(const double a, const VectorSpaceVector< double > &V) override
virtual std::size_t memory_consumption() const override
std::shared_ptr< const CommunicationPattern > epetra_comm_pattern
virtual Vector & operator*=(const double factor) override
virtual Vector & operator+=(const VectorSpaceVector< double > &V) override
virtual void sadd(const double s, const double a, const VectorSpaceVector< double > &V) override
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:402
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:403
static ::ExceptionBase & ExcVectorTypeNotCompatible()
#define DeclException0(Exception0)
Definition: exceptions.h:470
static ::ExceptionBase & ExcTrilinosError(int arg1)
static ::ExceptionBase & ExcDifferentParallelPartitioning()
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:515
static const char V
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)