deal.II version GIT relicensing-2167-g9622207b8f 2024-11-21 12:40:00+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\}}\)
Loading...
Searching...
No Matches
n_vector.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2021 - 2022 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
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
30namespace SUNDIALS
31{
32 namespace internal
33 {
34 template <typename VectorType>
35 class NVectorView;
36 }
37} // namespace SUNDIALS
38# endif
39
40namespace SUNDIALS
41{
42 namespace internal
43 {
44# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
69 template <typename VectorType>
71 make_nvector_view(VectorType &vector, SUNContext nvector_context);
72# else
98 template <typename VectorType>
100 make_nvector_view(VectorType &vector);
101# endif
102
115 template <typename VectorType>
116 VectorType *
117 unwrap_nvector(N_Vector v);
118
130 template <typename VectorType>
131 const VectorType *
133
153 template <typename VectorType>
155 {
156 public:
163 NVectorView() = default;
164
165# if DEAL_II_SUNDIALS_VERSION_GTE(6, 0, 0)
172 NVectorView(VectorType &vector, SUNContext nvector_context);
173# else
180 NVectorView(VectorType &vector);
181# endif
182
186 NVectorView(NVectorView &&) noexcept = default;
187
192 operator=(NVectorView &&) noexcept = default;
193
197 NVectorView(const NVectorView &) = delete;
198
203 operator=(const NVectorView &) = delete;
204
210 ~NVectorView() = default;
211
217 operator N_Vector() const;
218
222 N_Vector
223 operator->() const;
224
225 private:
229 std::unique_ptr<_generic_N_Vector, std::function<void(N_Vector)>>
231 };
232 } // namespace internal
233} // namespace SUNDIALS
234
236
237#endif
238#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:230
NVectorView< VectorType > make_nvector_view(VectorType &vector, SUNContext nvector_context)
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
VectorType * unwrap_nvector(N_Vector v)
const VectorType * unwrap_nvector_const(N_Vector v)
STL namespace.