Reference documentation for deal.II version Git 292c2606a1 2021-03-03 00:48:14 +0100
\(\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 
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 {
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(const ReadWriteVector<Number> &V,
111  VectorOperation::values operation,
112  std::shared_ptr<const Utilities::MPI::CommunicationPatternBase>
113  communication_pattern = {}) = 0;
114 
118  virtual Number operator*(const VectorSpaceVector<Number> &V) const = 0;
119 
123  virtual void
124  add(const Number a) = 0;
125 
129  virtual void
130  add(const Number a, const VectorSpaceVector<Number> &V) = 0;
131 
135  virtual void
136  add(const Number a,
137  const VectorSpaceVector<Number> &V,
138  const Number b,
139  const VectorSpaceVector<Number> &W) = 0;
140 
145  virtual void
146  sadd(const Number s,
147  const Number a,
148  const VectorSpaceVector<Number> &V) = 0;
149 
155  virtual void
156  scale(const VectorSpaceVector<Number> &scaling_factors) = 0;
157 
161  virtual void
162  equ(const Number a, const VectorSpaceVector<Number> &V) = 0;
163 
167  virtual bool
168  all_zero() const = 0;
169 
173  virtual value_type
174  mean_value() const = 0;
175 
180  virtual real_type
181  l1_norm() const = 0;
182 
187  virtual real_type
188  l2_norm() const = 0;
189 
194  virtual real_type
195  linfty_norm() const = 0;
196 
217  virtual Number
218  add_and_dot(const Number a,
219  const VectorSpaceVector<Number> &V,
220  const VectorSpaceVector<Number> &W) = 0;
221 
226  {}
227 
232  virtual size_type
233  size() const = 0;
234 
246  virtual ::IndexSet
247  locally_owned_elements() const = 0;
248 
252  virtual void
253  print(std::ostream & out,
254  const unsigned int precision = 3,
255  const bool scientific = true,
256  const bool across = true) const = 0;
257 
261  virtual std::size_t
262  memory_consumption() const = 0;
263 
268  virtual ~VectorSpaceVector() = default;
269  };
271 } // namespace LinearAlgebra
272 
273 // ---------------------------- Free functions --------------------------
274 
275 namespace LinearAlgebra
276 {
281  template <typename Number>
282  void
284  {
285  vector.add(-vector.mean_value());
286  }
287 } // namespace LinearAlgebra
288 
290 
291 #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:394
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:393
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