Reference documentation for deal.II version 9.4.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\}}\)
n_vector.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2020 - 2022 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 
17 #ifndef dealii_sundials_n_vector_h
18 #define dealii_sundials_n_vector_h
19 
20 #include <deal.II/base/config.h>
21 
22 #ifdef DEAL_II_WITH_SUNDIALS
23 # include <sundials/sundials_nvector.h>
24 
25 # include <functional>
26 # include <memory>
27 
29 
30 # ifndef DOXYGEN
31 namespace SUNDIALS
32 {
33  namespace internal
34  {
35  template <typename VectorType>
36  class NVectorView;
37  }
38 } // namespace SUNDIALS
39 # endif
40 
41 namespace SUNDIALS
42 {
43  namespace internal
44  {
45 # if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
70  template <typename VectorType>
71  NVectorView<VectorType>
72  make_nvector_view(VectorType &vector, SUNContext nvector_context);
73 # else
99  template <typename VectorType>
101  make_nvector_view(VectorType &vector);
102 # endif
103 
116  template <typename VectorType>
117  VectorType *
118  unwrap_nvector(N_Vector v);
119 
131  template <typename VectorType>
132  const VectorType *
133  unwrap_nvector_const(N_Vector v);
134 
154  template <typename VectorType>
156  {
157  public:
164  NVectorView() = default;
165 
166 # if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
173  NVectorView(VectorType &vector, SUNContext nvector_context);
174 # else
181  NVectorView(VectorType &vector);
182 # endif
183 
187  NVectorView(NVectorView &&) noexcept = default;
188 
192  NVectorView &
193  operator=(NVectorView &&) noexcept = default;
194 
198  NVectorView(const NVectorView &) = delete;
199 
203  NVectorView &
204  operator=(const NVectorView &) = delete;
205 
211  ~NVectorView() = default;
212 
218  operator N_Vector() const;
219 
223  N_Vector
224  operator->() const;
225 
226  private:
230  std::unique_ptr<_generic_N_Vector, std::function<void(N_Vector)>>
232  };
233  } // namespace internal
234 } // namespace SUNDIALS
235 
237 
238 #endif
239 #endif
NVectorView(VectorType &vector, SUNContext nvector_context)
NVectorView(NVectorView &&) noexcept=default
std::unique_ptr< _generic_N_Vector, std::function< void(N_Vector)> > vector_ptr
Definition: n_vector.h:231
NVectorView< VectorType > make_nvector_view(VectorType &vector, SUNContext nvector_context)
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
VectorType * unwrap_nvector(N_Vector v)
const VectorType * unwrap_nvector_const(N_Vector v)