*/
std::vector<MappingType> mapping_type;
+ /**
+ * Returns a boolean that is true when the finite element uses a single
+ * mapping and false when the finite element uses multiple mappings.
+ */
+ bool
+ single_mapping() const;
+
+ /**
+ * Returns MappingType @p i for the finite element.
+ */
+ MappingType
+ get_mapping_type(unsigned int i) const;
/* NOTE: The following function has its definition inlined into the class
declaration because we otherwise run into a compiler error with MS Visual
// allocate memory
const bool update_transformed_shape_values =
- (std::find_if(this->mapping_type.begin(),
- this->mapping_type.end(),
- [](const MappingType t) { return t != mapping_none; }) !=
- this->mapping_type.end());
+ std::any_of(this->mapping_type.begin(),
+ this->mapping_type.end(),
+ [](const MappingType t) { return t != mapping_none; });
const bool update_transformed_shape_grads =
- (std::find_if(this->mapping_type.begin(),
- this->mapping_type.end(),
- [](const MappingType t) {
- return (t == mapping_raviart_thomas ||
- t == mapping_piola || t == mapping_nedelec ||
- t == mapping_contravariant);
- }) != this->mapping_type.end());
+ std::any_of(this->mapping_type.begin(),
+ this->mapping_type.end(),
+ [](const MappingType t) {
+ return (t == mapping_raviart_thomas || t == mapping_piola ||
+ t == mapping_nedelec || t == mapping_contravariant);
+ });
const bool update_transformed_shape_hessian_tensors =
update_transformed_shape_values;
// TODO: This is probably only going to work for those elements for
// which all dofs are face dofs
for (unsigned int l = 0; l < GeometryInfo<dim>::lines_per_cell; ++l)
- if (!(cell->line_orientation(l)) & mapping_type[0] == mapping_nedelec)
+ if (!(cell->line_orientation(l)) &&
+ mapping_type[0] == mapping_nedelec)
face_sign[l] = -1.0;
}
} // namespace
+template <class PolynomialType, int dim, int spacedim>
+bool
+FE_PolyTensor<PolynomialType, dim, spacedim>::single_mapping() const
+{
+ return mapping_type.size() == 1;
+}
+
+
+
+template <class PolynomialType, int dim, int spacedim>
+MappingType
+FE_PolyTensor<PolynomialType, dim, spacedim>::get_mapping_type(
+ unsigned int i) const
+{
+ if (single_mapping())
+ return mapping_type[0];
+ Assert(i < mapping_type.size(), ExcIndexRange(i, 0, mapping_type.size()));
+ return mapping_type[i];
+}
+
+
+
template <class PolynomialType, int dim, int spacedim>
double
FE_PolyTensor<PolynomialType, dim, spacedim>::shape_value(
for (unsigned int i = 0; i < this->dofs_per_cell; ++i)
{
- MappingType mapping_type =
- (this->mapping_type.size() > 1 ? this->mapping_type[i] :
- this->mapping_type[0]);
+ const MappingType mapping_type = get_mapping_type(i);
const unsigned int first =
output_data.shape_function_to_row_table[i * this->n_components() +
for (unsigned int i = 0; i < this->dofs_per_cell; ++i)
{
- const MappingType mapping_type =
- (this->mapping_type.size() > 1 ? this->mapping_type[i] :
- this->mapping_type[0]);
+ const MappingType mapping_type = get_mapping_type(i);
const unsigned int first =
output_data.shape_function_to_row_table[i * this->n_components() +
for (unsigned int i = 0; i < this->dofs_per_cell; ++i)
{
- MappingType mapping_type =
- (this->mapping_type.size() > 1 ? this->mapping_type[i] :
- this->mapping_type[0]);
+ const MappingType mapping_type = get_mapping_type(i);
const unsigned int first =
output_data.shape_function_to_row_table[i * this->n_components() +
for (unsigned int i = 0; i < this->dofs_per_cell; ++i)
{
- MappingType mapping_type =
- (this->mapping_type.size() > 1 ? this->mapping_type[i] :
- this->mapping_type[0]);
+ const MappingType mapping_type = get_mapping_type(i);
switch (mapping_type)
{