41 const std::vector<unsigned int> &multiplicities)
44 std::vector<std::string> all_components;
45 for (
unsigned int i = 0; i < components.size(); ++i)
47 for (
unsigned int j = 0; j < multiplicities[i]; ++j)
48 all_components.push_back(components[i]);
55 std::pair<std::vector<std::string>, std::vector<unsigned int>>
59 auto blocks = components;
60 auto last = std::unique(blocks.begin(), blocks.end());
61 blocks.erase(last, blocks.end());
62 std::vector<unsigned int> multiplicities;
63 for (
const auto &c : blocks)
64 multiplicities.push_back(
65 std::count(components.begin(), components.end(), c));
68 return std::make_pair(blocks, multiplicities);
73 const std::string &selected_component)
76 std::string name = selected_component;
82 if (c[1] ==
"n" || c[1] ==
"t" || c[1] ==
"N" || c[1] ==
"T")
87 ExcMessage(
"You asked for " + selected_component +
88 ", but I don' know how to interpret " +
94 if (std::find(components.begin(), components.end(), name) !=
100 if (selected_component ==
"all" || selected_component ==
"ALL")
103 return components[0];
113 "You asked for component " + selected_component +
114 ", but there are only " +
117 return components[c];
123 ExcMessage(
"You asked for " + selected_component +
124 ", but I don' know how to interpret it " +
125 "with names " + component_names));
133 std::vector<unsigned int>
135 const std::string &selected_components)
139 std::vector<unsigned int> indices;
140 for (
const auto &c : comps)
143 const auto index = std::find(
b.begin(),
b.end(), name);
146 ", but I don' know how to interpret it " +
147 "with names " + component_names));
148 indices.push_back(std::distance(
b.begin(), index));
155 std::vector<unsigned int>
157 const std::string &selected_components)
160 const auto bi =
block_indices(component_names, selected_components);
161 std::vector<unsigned int> indices;
162 for (
const auto &i : bi)
163 indices.push_back(std::accumulate(m.begin(), m.begin() + i, 0));
169 std::pair<unsigned int, unsigned int>
171 const std::string &selected_component)
174 const auto i2 =
block_indices(component_names, selected_component);
177 ExcMessage(
"You asked for " + selected_component +
178 " components, but only one component at a time "
179 "should be passed to this function."));
180 return std::make_pair(i1[0], i2[0]);
186 type(
const std::string &component_names,
187 const std::string &selected_component)
190 if (selected_component ==
"all" || selected_component ==
"ALL")
199 if (c[1] ==
"n" || c[1] ==
"N")
201 else if (c[1] ==
"t" || c[1] ==
"T")
202 return Type::tangential;
206 const auto &[ci, bi] =
226 mask(
const std::string &component_names,
const std::string &comp)
229 std::vector<bool> _mask(n,
false);
235 for (
const auto &c : comps)
240 ", but there are only " +
250 if (comp ==
"ALL" || comp ==
"all")
252 for (
unsigned int j = 0; j < n; ++j)
261 for (
unsigned int i = 0; i < ids.size(); ++i)
263 _mask[ids[i]] =
true;
264 for (
unsigned int j = 0; j < m[bids[i]]; ++j)
265 _mask[ids[i] + j] =
true;
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
std::vector< std::string > split_string_list(const std::string &s, const std::string &delimiter=",")
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
int string_to_int(const std::string &s)