Reference documentation for deal.II version 9.5.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\}}\)
Loading...
Searching...
No Matches
trilinos_epetra_vector.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2015 - 2023 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#ifdef DEAL_II_WITH_TRILINOS
23
27
32
33# include <Epetra_FEVector.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
132 VectorOperation::values operation,
133 std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
134 communication_pattern = {}) override;
135
139 DEAL_II_DEPRECATED_EARLY
140 virtual void
141 import(const ReadWriteVector<double> &V,
142 VectorOperation::values operation,
143 std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
144 communication_pattern = {}) override
145 {
146 import_elements(V, operation, communication_pattern);
147 }
148
152 virtual Vector &
153 operator*=(const double factor) override;
154
158 virtual Vector &
159 operator/=(const double factor) override;
160
164 virtual Vector &
165 operator+=(const VectorSpaceVector<double> &V) override;
166
170 virtual Vector &
171 operator-=(const VectorSpaceVector<double> &V) override;
172
177 virtual double
178 operator*(const VectorSpaceVector<double> &V) const override;
179
183 virtual void
184 add(const double a) override;
185
190 virtual void
191 add(const double a, const VectorSpaceVector<double> &V) override;
192
197 virtual void
198 add(const double a,
200 const double b,
201 const VectorSpaceVector<double> &W) override;
202
207 virtual void
208 sadd(const double s,
209 const double a,
210 const VectorSpaceVector<double> &V) override;
211
218 virtual void
219 scale(const VectorSpaceVector<double> &scaling_factors) override;
220
224 virtual void
225 equ(const double a, const VectorSpaceVector<double> &V) override;
226
230 virtual bool
231 all_zero() const override;
232
236 virtual double
237 mean_value() const override;
238
243 virtual double
244 l1_norm() const override;
245
250 virtual double
251 l2_norm() const override;
252
257 virtual double
258 linfty_norm() const override;
259
282 virtual double
283 add_and_dot(const double a,
285 const VectorSpaceVector<double> &W) override;
290 bool
291 has_ghost_elements() const;
292
297 virtual size_type
298 size() const override;
299
305 locally_owned_size() const;
306
311 get_mpi_communicator() const;
312
324 virtual ::IndexSet
325 locally_owned_elements() const override;
326
331 const Epetra_FEVector &
332 trilinos_vector() const;
333
338 Epetra_FEVector &
340
344 virtual void
345 print(std::ostream & out,
346 const unsigned int precision = 3,
347 const bool scientific = true,
348 const bool across = true) const override;
349
353 virtual std::size_t
354 memory_consumption() const override;
355
361
368
375 int,
376 << "An error with error number " << arg1
377 << " occurred while calling a Trilinos function");
378
379 private:
385 void
386 create_epetra_comm_pattern(const IndexSet &source_index_set,
387 const MPI_Comm mpi_comm);
388
392 std::unique_ptr<Epetra_FEVector> vector;
393
398
403 std::shared_ptr<const CommunicationPattern> epetra_comm_pattern;
404 };
405
406
407 inline bool
409 {
410 return false;
411 }
412 } // namespace EpetraWrappers
413} // namespace LinearAlgebra
414
415
419template <>
420struct is_serial_vector<LinearAlgebra::EpetraWrappers::Vector> : std::false_type
421{};
422
424
425#endif
426
427#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
virtual double operator*(const VectorSpaceVector< double > &V) const override
virtual void import_elements(const ReadWriteVector< double > &V, VectorOperation::values operation, std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > communication_pattern={}) override
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
void create_epetra_comm_pattern(const IndexSet &source_index_set, const MPI_Comm mpi_comm)
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
void reinit(const IndexSet &parallel_partitioner, const MPI_Comm communicator, const bool omit_zeroing_entries=false)
virtual void sadd(const double s, const double a, const VectorSpaceVector< double > &V) override
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:472
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:473
static ::ExceptionBase & ExcVectorTypeNotCompatible()
#define DeclException0(Exception0)
Definition exceptions.h:465
static ::ExceptionBase & ExcTrilinosError(int arg1)
static ::ExceptionBase & ExcDifferentParallelPartitioning()
#define DeclException1(Exception1, type1, outsequence)
Definition exceptions.h:510