Reference documentation for deal.II version 9.3.2
\(\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 - 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_sundials_n_vector_h
17 #define dealii_sundials_n_vector_h
18 
19 #include <deal.II/base/config.h>
20 
21 #ifdef DEAL_II_WITH_SUNDIALS
22 # include <sundials/sundials_nvector.h>
23 
24 # include <functional>
25 # include <memory>
26 
28 
29 # ifndef DOXYGEN
30 namespace SUNDIALS
31 {
32  namespace internal
33  {
34  template <typename VectorType>
35  class NVectorView;
36  }
37 } // namespace SUNDIALS
38 # endif
39 
40 namespace SUNDIALS
41 {
42  namespace internal
43  {
63  template <typename VectorType>
64  NVectorView<VectorType>
65  make_nvector_view(VectorType &vector);
66 
79  template <typename VectorType>
80  VectorType *
81  unwrap_nvector(N_Vector v);
82 
94  template <typename VectorType>
95  const VectorType *
96  unwrap_nvector_const(N_Vector v);
97 
117  template <typename VectorType>
119  {
120  public:
127  NVectorView() = default;
128 
132  NVectorView(VectorType &vector);
133 
137  NVectorView(NVectorView &&) noexcept = default;
138 
142  NVectorView &
143  operator=(NVectorView &&) noexcept = default;
144 
148  NVectorView(const NVectorView &) = delete;
149 
153  NVectorView &
154  operator=(const NVectorView &) = delete;
155 
161  ~NVectorView() = default;
162 
168  operator N_Vector() const;
169 
173  N_Vector operator->() const;
174 
175  private:
179  std::unique_ptr<_generic_N_Vector, std::function<void(N_Vector)>>
181  };
182  } // namespace internal
183 } // namespace SUNDIALS
184 
186 
187 #endif
188 #endif
NVectorView(NVectorView &&) noexcept=default
std::unique_ptr< _generic_N_Vector, std::function< void(N_Vector)> > vector_ptr
Definition: n_vector.h:180
NVectorView(VectorType &vector)
NVectorView< VectorType > make_nvector_view(VectorType &vector)
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:396
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:397
VectorType * unwrap_nvector(N_Vector v)
const VectorType * unwrap_nvector_const(N_Vector v)