Debian Codegraph @

include/deal.II/lac/read_vector.h

raw
1 // ------------------------------------------------------------------------
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 // Copyright (C) 2023 - 2024 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 #ifndef dealii_lac_read_vector_h
16 #define dealii_lac_read_vector_h
17
18 #include <deal.II/base/config.h>
19
20 #include <deal.II/base/array_view.h>
21 #include <deal.II/base/enable_observer_pointer.h>
22 #include <deal.II/base/types.h>
23
24 DEAL_II_NAMESPACE_OPEN
25
26 /**
27 * @addtogroup Vectors
28 * @{
29 */
30
31 /**
32 * Base class for providing read-only access to vector elements.
33 *
34 * deal.II supports a large number of vector classes, including both its own
35 * serial and parallel vectors as well as vector classes from external
36 * libraries like PETSc and Trilinos. ReadVector is a common base class for
37 * all vector classes and defines a minimal interface for efficiently
38 * accessing vector elements.
39 */
40 template <typename Number>
41 class ReadVector : public EnableObserverPointer
42 {
43 public:
44 /**
45 * Declare some of the standard types used in all containers.
46 */
47 using value_type = Number;
48 using size_type = types::global_dof_index;
49
50 /**
51 * Return the size of the vector.
52 */
53 virtual size_type
54 size() const = 0;
55
56 /**
57 * Extract a subset of the vector specified by @p indices into the output
58 * array @p elements.
59 */
60 virtual void
61 extract_subvector_to(const ArrayView<const types::global_dof_index> &indices,
62 const ArrayView<Number> &elements) const = 0;
63 };
64
65 /** @} */
66
67 DEAL_II_NAMESPACE_CLOSE
68 #endif