Reference documentation for deal.II version GIT 2896a7e638 2023-05-31 13:10: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
112  const ReadWriteVector<Number> &V,
113  VectorOperation::values operation,
114  std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
115  communication_pattern = {}) = 0;
116 
120  DEAL_II_DEPRECATED_EARLY
121  virtual void
122  import(const ReadWriteVector<Number> &V,
123  VectorOperation::values operation,
124  std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
125  communication_pattern = {}) = 0;
126 
130  virtual Number
132 
136  virtual void
137  add(const Number a) = 0;
138 
142  virtual void
143  add(const Number a, const VectorSpaceVector<Number> &V) = 0;
144 
148  virtual void
149  add(const Number a,
151  const Number b,
152  const VectorSpaceVector<Number> &W) = 0;
153 
158  virtual void
159  sadd(const Number s,
160  const Number a,
161  const VectorSpaceVector<Number> &V) = 0;
162 
168  virtual void
169  scale(const VectorSpaceVector<Number> &scaling_factors) = 0;
170 
174  virtual void
175  equ(const Number a, const VectorSpaceVector<Number> &V) = 0;
176 
180  virtual bool
181  all_zero() const = 0;
182 
186  virtual value_type
187  mean_value() const = 0;
188 
193  virtual real_type
194  l1_norm() const = 0;
195 
200  virtual real_type
201  l2_norm() const = 0;
202 
207  virtual real_type
208  linfty_norm() const = 0;
209 
230  virtual Number
231  add_and_dot(const Number a,
233  const VectorSpaceVector<Number> &W) = 0;
234 
239  {}
240 
245  virtual size_type
246  size() const = 0;
247 
259  virtual ::IndexSet
261 
265  virtual void
266  print(std::ostream & out,
267  const unsigned int precision = 3,
268  const bool scientific = true,
269  const bool across = true) const = 0;
270 
274  virtual std::size_t
275  memory_consumption() const = 0;
276 
281  virtual ~VectorSpaceVector() = default;
282  };
284 } // namespace LinearAlgebra
285 
286 // ---------------------------- Free functions --------------------------
287 
288 namespace LinearAlgebra
289 {
294  template <typename Number>
295  void
297  {
298  vector.add(-vector.mean_value());
299  }
300 } // namespace LinearAlgebra
301 
303 
304 #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 void import_elements(const ReadWriteVector< Number > &V, VectorOperation::values operation, std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > communication_pattern={})=0
virtual VectorSpaceVector< Number > & operator=(const Number s)=0
virtual real_type linfty_norm() const =0
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:474
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:475
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:82