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\}}\)
vector_space_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_vector_space_vector_h
17 #define dealii_vector_space_vector_h
18 
19 #include <deal.II/base/config.h>
20 
21 #include <deal.II/base/numbers.h>
22 
24 
25 #include <memory>
26 
27 
29 
30 // Forward declarations
31 #ifndef DOXYGEN
32 class IndexSet;
33 namespace LinearAlgebra
34 {
35  class CommunicationPatternBase;
36  template <typename Number>
37  class ReadWriteVector;
38 } // namespace LinearAlgebra
39 #endif
40 
41 namespace LinearAlgebra
42 {
56  template <typename Number>
58  {
59  public:
60  using value_type = Number;
63 
68  virtual void
70  const bool omit_zeroing_entries = false) = 0;
71 
77  operator=(const Number s) = 0;
78 
83  operator*=(const Number factor) = 0;
84 
89  operator/=(const Number factor) = 0;
90 
96 
100  virtual VectorSpaceVector<Number> &
102 
111  virtual void
112  import(
113  const ReadWriteVector<Number> & V,
114  VectorOperation::values operation,
115  std::shared_ptr<const CommunicationPatternBase> communication_pattern =
116  std::shared_ptr<const CommunicationPatternBase>()) = 0;
117 
121  virtual Number operator*(const VectorSpaceVector<Number> &V) const = 0;
122 
126  virtual void
127  add(const Number a) = 0;
128 
132  virtual void
133  add(const Number a, const VectorSpaceVector<Number> &V) = 0;
134 
138  virtual void
139  add(const Number a,
141  const Number b,
142  const VectorSpaceVector<Number> &W) = 0;
143 
148  virtual void
149  sadd(const Number s,
150  const Number a,
151  const VectorSpaceVector<Number> &V) = 0;
152 
158  virtual void
159  scale(const VectorSpaceVector<Number> &scaling_factors) = 0;
160 
164  virtual void
165  equ(const Number a, const VectorSpaceVector<Number> &V) = 0;
166 
170  virtual bool
171  all_zero() const = 0;
172 
176  virtual value_type
177  mean_value() const = 0;
178 
183  virtual real_type
184  l1_norm() const = 0;
185 
190  virtual real_type
191  l2_norm() const = 0;
192 
197  virtual real_type
198  linfty_norm() const = 0;
199 
220  virtual Number
221  add_and_dot(const Number a,
223  const VectorSpaceVector<Number> &W) = 0;
224 
229  {}
230 
235  virtual size_type
236  size() const = 0;
237 
249  virtual ::IndexSet
250  locally_owned_elements() const = 0;
251 
255  virtual void
256  print(std::ostream & out,
257  const unsigned int precision = 3,
258  const bool scientific = true,
259  const bool across = true) const = 0;
260 
264  virtual std::size_t
265  memory_consumption() const = 0;
266 
271  virtual ~VectorSpaceVector() = default;
272  };
274 } // namespace LinearAlgebra
275 
276 // ---------------------------- Free functions --------------------------
277 
278 namespace LinearAlgebra
279 {
284  template <typename Number>
285  void
287  {
288  vector.add(-vector.mean_value());
289  }
290 } // namespace LinearAlgebra
291 
293 
294 #endif
LinearAlgebra::VectorSpaceVector::locally_owned_elements
virtual ::IndexSet locally_owned_elements() const =0
IndexSet
Definition: index_set.h:74
LinearAlgebra::VectorSpaceVector::size_type
types::global_dof_index size_type
Definition: vector_space_vector.h:61
LinearAlgebra
Definition: communication_pattern_base.h:30
LinearAlgebra::VectorSpaceVector::equ
virtual void equ(const Number a, const VectorSpaceVector< Number > &V)=0
LinearAlgebra::VectorSpaceVector::operator+=
virtual VectorSpaceVector< Number > & operator+=(const VectorSpaceVector< Number > &V)=0
LinearAlgebra::VectorSpaceVector::~VectorSpaceVector
virtual ~VectorSpaceVector()=default
LAPACKSupport::V
static const char V
Definition: lapack_support.h:175
LinearAlgebra::VectorSpaceVector::l2_norm
virtual real_type l2_norm() const =0
LinearAlgebra::VectorSpaceVector< float >::real_type
typename numbers::NumberTraits< float >::real_type real_type
Definition: vector_space_vector.h:62
LinearAlgebra::VectorSpaceVector::size
virtual size_type size() const =0
LinearAlgebra::VectorSpaceVector::compress
virtual void compress(VectorOperation::values)
Definition: vector_space_vector.h:228
LinearAlgebra::VectorSpaceVector< float >::value_type
float value_type
Definition: vector_space_vector.h:60
LinearAlgebra::VectorSpaceVector::operator-=
virtual VectorSpaceVector< Number > & operator-=(const VectorSpaceVector< Number > &V)=0
LinearAlgebra::VectorSpaceVector::operator*
virtual Number operator*(const VectorSpaceVector< Number > &V) const =0
LinearAlgebra::VectorSpaceVector::l1_norm
virtual real_type l1_norm() const =0
vector_operation.h
types::global_dof_index
unsigned int global_dof_index
Definition: types.h:76
LinearAlgebra::VectorSpaceVector::operator/=
virtual VectorSpaceVector< Number > & operator/=(const Number factor)=0
LinearAlgebra::VectorSpaceVector::scale
virtual void scale(const VectorSpaceVector< Number > &scaling_factors)=0
LinearAlgebra::VectorSpaceVector::reinit
virtual void reinit(const VectorSpaceVector< Number > &V, const bool omit_zeroing_entries=false)=0
LinearAlgebra::VectorSpaceVector::linfty_norm
virtual real_type linfty_norm() const =0
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
Physics::Elasticity::Kinematics::b
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
VectorOperation::values
values
Definition: vector_operation.h:40
numbers::NumberTraits::real_type
number real_type
Definition: numbers.h:437
LinearAlgebra::set_zero_mean_value
void set_zero_mean_value(VectorSpaceVector< Number > &vector)
Definition: vector_space_vector.h:286
LinearAlgebra::ReadWriteVector
Definition: read_write_vector.h:131
unsigned int
LinearAlgebra::VectorSpaceVector::add_and_dot
virtual Number add_and_dot(const Number a, const VectorSpaceVector< Number > &V, const VectorSpaceVector< Number > &W)=0
LinearAlgebra::VectorSpaceVector::all_zero
virtual bool all_zero() const =0
LinearAlgebra::VectorSpaceVector::memory_consumption
virtual std::size_t memory_consumption() const =0
LinearAlgebra::VectorSpaceVector
Definition: vector_space_vector.h:57
LinearAlgebra::VectorSpaceVector::print
virtual void print(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const =0
LinearAlgebra::VectorSpaceVector::add
virtual void add(const Number a)=0
config.h
LinearAlgebra::VectorSpaceVector::operator*=
virtual VectorSpaceVector< Number > & operator*=(const Number factor)=0
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
LinearAlgebra::VectorSpaceVector::sadd
virtual void sadd(const Number s, const Number a, const VectorSpaceVector< Number > &V)=0
LinearAlgebra::VectorSpaceVector::operator=
virtual VectorSpaceVector< Number > & operator=(const Number s)=0
numbers.h
LinearAlgebra::VectorSpaceVector::mean_value
virtual value_type mean_value() const =0