deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20:01+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
named_selection.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2015 - 2025 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_named_selection_h
14#define dealii_named_selection_h
15
16#include <deal.II/base/config.h>
17
19
21
22#include <string>
23
25
33{
34public:
40 void
41 add(const std::string &name);
42
43
47 void
48 initialize(const AnyData &data);
49
50
55 unsigned int
56 size() const;
57
58
65 unsigned int
66 operator()(unsigned int i) const;
67
68
69private:
73 std::vector<std::string> names;
74
78 std::vector<unsigned int> indices;
79};
80
81
82inline unsigned int
84{
85 return names.size();
86}
87
88
89inline void
90NamedSelection::add(const std::string &s)
91{
92 names.push_back(s);
93}
94
95
96inline unsigned int
97NamedSelection::operator()(unsigned int i) const
98{
99 Assert(indices.size() == names.size(), ExcNotInitialized());
100
102
103 return indices[i];
104}
105
107
108#endif
void initialize(const AnyData &data)
std::vector< std::string > names
std::vector< unsigned int > indices
void add(const std::string &name)
unsigned int size() const
unsigned int operator()(unsigned int i) const
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
#define Assert(cond, exc)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcNotInitialized()
std::vector< index_type > data
Definition mpi.cc:734