Reference documentation for deal.II version Git 662679e6de 2020-10-27 13:02:35 -0600
\(\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 {
54  template <typename Number>
56  {
57  public:
58  using value_type = Number;
61 
66  virtual void
68  const bool omit_zeroing_entries = false) = 0;
69 
75  operator=(const Number s) = 0;
76 
81  operator*=(const Number factor) = 0;
82 
87  operator/=(const Number factor) = 0;
88 
94 
100 
109  virtual void
110  import(
111  const ReadWriteVector<Number> & V,
112  VectorOperation::values operation,
113  std::shared_ptr<const CommunicationPatternBase> communication_pattern =
114  std::shared_ptr<const CommunicationPatternBase>()) = 0;
115 
119  virtual Number operator*(const VectorSpaceVector<Number> &V) const = 0;
120 
124  virtual void
125  add(const Number a) = 0;
126 
130  virtual void
131  add(const Number a, const VectorSpaceVector<Number> &V) = 0;
132 
136  virtual void
137  add(const Number a,
139  const Number b,
140  const VectorSpaceVector<Number> &W) = 0;
141 
146  virtual void
147  sadd(const Number s,
148  const Number a,
149  const VectorSpaceVector<Number> &V) = 0;
150 
156  virtual void
157  scale(const VectorSpaceVector<Number> &scaling_factors) = 0;
158 
162  virtual void
163  equ(const Number a, const VectorSpaceVector<Number> &V) = 0;
164 
168  virtual bool
169  all_zero() const = 0;
170 
174  virtual value_type
175  mean_value() const = 0;
176 
181  virtual real_type
182  l1_norm() const = 0;
183 
188  virtual real_type
189  l2_norm() const = 0;
190 
195  virtual real_type
196  linfty_norm() const = 0;
197 
218  virtual Number
219  add_and_dot(const Number a,
221  const VectorSpaceVector<Number> &W) = 0;
222 
227  {}
228 
233  virtual size_type
234  size() const = 0;
235 
247  virtual ::IndexSet
248  locally_owned_elements() const = 0;
249 
253  virtual void
254  print(std::ostream & out,
255  const unsigned int precision = 3,
256  const bool scientific = true,
257  const bool across = true) const = 0;
258 
262  virtual std::size_t
263  memory_consumption() const = 0;
264 
269  virtual ~VectorSpaceVector() = default;
270  };
272 } // namespace LinearAlgebra
273 
274 // ---------------------------- Free functions --------------------------
275 
276 namespace LinearAlgebra
277 {
282  template <typename Number>
283  void
285  {
286  vector.add(-vector.mean_value());
287  }
288 } // namespace LinearAlgebra
289 
291 
292 #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:369
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< double >::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:368
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