Loading [MathJax]/extensions/TeX/newcommand.js
 deal.II version GIT relicensing-2684-gc61376a70f 2025-02-22 15: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\}}
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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
23
24#include <string>
25
27
35{
36public:
42 void
43 add(const std::string &name);
44
45
49 void
50 initialize(const AnyData &data);
51
52
57 unsigned int
58 size() const;
59
60
67 unsigned int
68 operator()(unsigned int i) const;
69
70
71private:
75 std::vector<std::string> names;
76
80 std::vector<unsigned int> indices;
81};
82
83
84inline unsigned int
86{
87 return names.size();
88}
89
90
91inline void
92NamedSelection::add(const std::string &s)
93{
94 names.push_back(s);
95}
96
97
98inline unsigned int
99NamedSelection::operator()(unsigned int i) const
100{
101 Assert(indices.size() == names.size(), ExcNotInitialized());
102
104
105 return indices[i];
106}
107
109
110#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:522
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:523
#define Assert(cond, exc)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcNotInitialized()
std::vector< index_type > data
Definition mpi.cc:740