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
virtual Number operator*(const VectorSpaceVector< Number > &V) const =0
virtual VectorSpaceVector< Number > & operator=(const Number s)=0
virtual void sadd(const Number s, const Number a, const VectorSpaceVector< Number > &V)=0
virtual VectorSpaceVector< Number > & operator/=(const Number factor)=0
void set_zero_mean_value(VectorSpaceVector< Number > &vector)
static const char V
virtual real_type l2_norm() const =0
virtual void add(const Number a)=0
virtual real_type linfty_norm() const =0
virtual void scale(const VectorSpaceVector< Number > &scaling_factors)=0
virtual void equ(const Number a, const VectorSpaceVector< Number > &V)=0
virtual size_type size() const =0
virtual Number add_and_dot(const Number a, const VectorSpaceVector< Number > &V, const VectorSpaceVector< Number > &W)=0
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
virtual void reinit(const VectorSpaceVector< Number > &V, const bool omit_zeroing_entries=false)=0
virtual void compress(VectorOperation::values)
virtual bool all_zero() const =0
virtual ~VectorSpaceVector()=default
virtual std::size_t memory_consumption() const =0
virtual void print(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const =0
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
typename numbers::NumberTraits< float >::real_type real_type
virtual VectorSpaceVector< Number > & operator+=(const VectorSpaceVector< Number > &V)=0
unsigned int global_dof_index
Definition: types.h:76
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
virtual real_type l1_norm() const =0
virtual VectorSpaceVector< Number > & operator-=(const VectorSpaceVector< Number > &V)=0
virtual VectorSpaceVector< Number > & operator*=(const Number factor)=0
virtual value_type mean_value() const =0
virtual ::IndexSet locally_owned_elements() const =0