virtual bool
preserves_vertex_locations() const = 0;
+ /**
+ * Returns is this instance of Mapping is compatible with the type of cell
+ * in @p cell_type.
+ *
+ */
+ virtual bool
+ is_compatible_with(const ReferenceCell::Type &cell_type) const = 0;
+
/**
* @name Mapping points between reference and real cells
* @{
virtual bool
preserves_vertex_locations() const override;
+ virtual bool
+ is_compatible_with(const ReferenceCell::Type &cell_type) const override;
+
/**
* @name Mapping points between reference and real cells
* @{
&cell) const override;
+ virtual bool
+ is_compatible_with(const ReferenceCell::Type &cell_type) const override;
+
/**
* Always returns @p true because the default implementation of functions in
* this class preserves vertex locations.
return true;
}
+
+template <int dim, int spacedim>
+bool
+MappingFE<dim, spacedim>::is_compatible_with(
+ const ReferenceCell::Type &cell_type) const
+{
+ if (cell_type.get_dimension() != dim)
+ return false; // TODO: or is this an error?
+
+ return true;
+}
+
#endif // DOXYGEN
/* -------------- declaration of explicit specializations ------------- */
virtual bool
preserves_vertex_locations() const override;
+ virtual bool
+ is_compatible_with(const ReferenceCell::Type &cell_type) const override;
+
/**
* Return the mapped vertices of a cell.
*
virtual bool
preserves_vertex_locations() const override;
+ virtual bool
+ is_compatible_with(const ReferenceCell::Type &cell_type) const override;
+
/**
* @name Mapping points between reference and real cells
* @{
return true;
}
+
+template <int dim, int spacedim>
+bool
+MappingManifold<dim, spacedim>::is_compatible_with(
+ const ReferenceCell::Type &cell_type) const
+{
+ if (cell_type.get_dimension() != dim)
+ return false; // TODO: or is this an error?
+
+ if (cell_type.is_hyper_cube())
+ return true;
+
+ return false;
+}
+
+
+
#endif // DOXYGEN
/* -------------- declaration of explicit specializations ------------- */
get_bounding_box(const typename Triangulation<dim, spacedim>::cell_iterator
&cell) const override;
+ virtual bool
+ is_compatible_with(const ReferenceCell::Type &cell_type) const override;
+
/**
* Transform the point @p p on the unit cell to the point @p p_real on the
* real cell @p cell and returns @p p_real.
get_bounding_box(const typename Triangulation<dim, spacedim>::cell_iterator
&cell) const override;
+ virtual bool
+ is_compatible_with(const ReferenceCell::Type &cell_type) const override;
+
/**
* @name Mapping points between reference and real cells
* @{
FEValues<dim, spacedim>::reinit(
const typename Triangulation<dim, spacedim>::cell_iterator &cell)
{
+ // Check that mapping and reference cell type are compatible:
+ Assert(this->get_mapping().is_compatible_with(cell->reference_cell_type()),
+ ExcMessage(
+ "You are trying to call FEValues::reinit() with a cell of type " +
+ cell->reference_cell_type().to_string() +
+ " with a Mapping that is not compatible with it."));
+
// no FE in this cell, so no assertion
// necessary here
this->maybe_invalidate_previous_present_cell(cell);
static_cast<const FiniteElementData<dim> &>(cell->get_fe()),
(typename FEValuesBase<dim, spacedim>::ExcFEDontMatch()));
+ // Check that mapping and reference cell type are compatible:
+ Assert(this->get_mapping().is_compatible_with(cell->reference_cell_type()),
+ ExcMessage(
+ "You are trying to call FEValues::reinit() with a cell of type " +
+ cell->reference_cell_type().to_string() +
+ " with a Mapping that is not compatible with it."));
+
this->maybe_invalidate_previous_present_cell(cell);
this->check_cell_similarity(cell);
+template <int dim, int spacedim>
+bool
+MappingCartesian<dim, spacedim>::is_compatible_with(
+ const ReferenceCell::Type &cell_type) const
+{
+ if (cell_type.get_dimension() != dim)
+ return false; // TODO: or is this an error?
+
+ if (cell_type.is_hyper_cube())
+ return true;
+
+ return false;
+}
+
+
+
template <int dim, int spacedim>
UpdateFlags
MappingCartesian<dim, spacedim>::requires_update_flags(
+template <int dim, int spacedim, typename VectorType>
+bool
+MappingFEField<dim, spacedim, VectorType, void>::is_compatible_with(
+ const ReferenceCell::Type &cell_type) const
+{
+ if (cell_type.get_dimension() != dim)
+ return false; // TODO: or is this an error?
+
+ return true;
+}
+
+
+
template <int dim, int spacedim, typename VectorType>
boost::container::small_vector<Point<spacedim>,
GeometryInfo<dim>::vertices_per_cell>
}
+
template <int dim, int spacedim, typename VectorType>
ComponentMask
MappingFEField<dim, spacedim, VectorType, void>::get_component_mask() const
+template <int dim, int spacedim>
+bool
+MappingQ<dim, spacedim>::is_compatible_with(
+ const ReferenceCell::Type &cell_type) const
+{
+ if (cell_type.get_dimension() != dim)
+ return false; // TODO: or is this an error?
+
+ if (cell_type.is_hyper_cube())
+ return true;
+
+ return false;
+}
+
+
+
// explicit instantiations
#include "mapping_q.inst"
+template <int dim, int spacedim>
+bool
+MappingQGeneric<dim, spacedim>::is_compatible_with(
+ const ReferenceCell::Type &cell_type) const
+{
+ if (cell_type.get_dimension() != dim)
+ return false; // TODO: or is this an error?
+
+ if (cell_type.is_hyper_cube())
+ return true;
+
+ return false;
+}
+
+
+
//--------------------------- Explicit instantiations -----------------------
#include "mapping_q_generic.inst"