deal.II version GIT relicensing-2289-g1e5549a87a 2024-12-21 21:30: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
named_selection.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2015 - 2020 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_named_selection_h
16#define dealii_named_selection_h
17
18#include <deal.II/base/config.h>
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:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
#define Assert(cond, exc)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcNotInitialized()
std::vector< index_type > data
Definition mpi.cc:735