Reference documentation for deal.II version GIT 13632c9f70 2022-09-25 13:40:02+00:00
\(\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 - 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_vector_space_vector_h
17 #define dealii_vector_space_vector_h
18 
19 #include <deal.II/base/config.h>
20 
22 #include <deal.II/base/numbers.h>
23 
25 
26 #include <memory>
27 
28 
30 
31 // Forward declarations
32 #ifndef DOXYGEN
33 class IndexSet;
34 namespace LinearAlgebra
35 {
36  template <typename Number>
37  class ReadWriteVector;
38 } // namespace LinearAlgebra
39 #endif
40 
41 namespace LinearAlgebra
42 {
55  template <typename Number>
57  {
58  public:
59  using value_type = Number;
62 
67  virtual void
69  const bool omit_zeroing_entries = false) = 0;
70 
76  operator=(const Number s) = 0;
77 
82  operator*=(const Number factor) = 0;
83 
88  operator/=(const Number factor) = 0;
89 
95 
101 
110  virtual void
111  import(const ReadWriteVector<Number> &V,
112  VectorOperation::values operation,
113  std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
114  communication_pattern = {}) = 0;
115 
119  virtual Number
121 
125  virtual void
126  add(const Number a) = 0;
127 
131  virtual void
132  add(const Number a, const VectorSpaceVector<Number> &V) = 0;
133 
137  virtual void
138  add(const Number a,
140  const Number b,
141  const VectorSpaceVector<Number> &W) = 0;
142 
147  virtual void
148  sadd(const Number s,
149  const Number a,
150  const VectorSpaceVector<Number> &V) = 0;
151 
157  virtual void
158  scale(const VectorSpaceVector<Number> &scaling_factors) = 0;
159 
163  virtual void
164  equ(const Number a, const VectorSpaceVector<Number> &V) = 0;
165 
169  virtual bool
170  all_zero() const = 0;
171 
175  virtual value_type
176  mean_value() const = 0;
177 
182  virtual real_type
183  l1_norm() const = 0;
184 
189  virtual real_type
190  l2_norm() const = 0;
191 
196  virtual real_type
197  linfty_norm() const = 0;
198 
219  virtual Number
220  add_and_dot(const Number a,
222  const VectorSpaceVector<Number> &W) = 0;
223 
228  {}
229 
234  virtual size_type
235  size() const = 0;
236 
248  virtual ::IndexSet
250 
254  virtual void
255  print(std::ostream & out,
256  const unsigned int precision = 3,
257  const bool scientific = true,
258  const bool across = true) const = 0;
259 
263  virtual std::size_t
264  memory_consumption() const = 0;
265 
270  virtual ~VectorSpaceVector() = default;
271  };
273 } // namespace LinearAlgebra
274 
275 // ---------------------------- Free functions --------------------------
276 
277 namespace LinearAlgebra
278 {
283  template <typename Number>
284  void
286  {
287  vector.add(-vector.mean_value());
288  }
289 } // namespace LinearAlgebra
290 
292 
293 #endif
virtual VectorSpaceVector< Number > & operator*=(const Number factor)=0
virtual VectorSpaceVector< Number > & operator/=(const Number factor)=0
virtual void print(std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const =0
virtual void scale(const VectorSpaceVector< Number > &scaling_factors)=0
virtual ~VectorSpaceVector()=default
virtual real_type l2_norm() const =0
virtual void equ(const Number a, const VectorSpaceVector< Number > &V)=0
virtual void add(const Number a)=0
types::global_dof_index size_type
virtual std::size_t memory_consumption() const =0
virtual ::IndexSet locally_owned_elements() const =0
virtual void add(const Number a, const VectorSpaceVector< Number > &V)=0
virtual VectorSpaceVector< Number > & operator-=(const VectorSpaceVector< Number > &V)=0
virtual void compress(VectorOperation::values)
virtual real_type l1_norm() const =0
typename numbers::NumberTraits< Number >::real_type real_type
virtual void reinit(const VectorSpaceVector< Number > &V, const bool omit_zeroing_entries=false)=0
virtual size_type size() const =0
virtual Number add_and_dot(const Number a, const VectorSpaceVector< Number > &V, const VectorSpaceVector< Number > &W)=0
virtual VectorSpaceVector< Number > & operator+=(const VectorSpaceVector< Number > &V)=0
virtual bool all_zero() const =0
virtual void sadd(const Number s, const Number a, const VectorSpaceVector< Number > &V)=0
virtual value_type mean_value() const =0
virtual void add(const Number a, const VectorSpaceVector< Number > &V, const Number b, const VectorSpaceVector< Number > &W)=0
virtual Number operator*(const VectorSpaceVector< Number > &V) const =0
virtual VectorSpaceVector< Number > & operator=(const Number s)=0
virtual real_type linfty_norm() const =0
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:457
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:458
static const char V
void set_zero_mean_value(VectorSpaceVector< Number > &vector)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
unsigned int global_dof_index
Definition: types.h:81