31#include <boost/container/small_vector.hpp>
40template <
int dim,
typename VectorType,
int spacedim>
43 const VectorType &euler_transform_vectors)
45 euler_transform_vectors,
51template <
int dim,
typename VectorType,
int spacedim>
54 const VectorType &euler_transform_vectors,
57 , euler_transform_vectors(&euler_transform_vectors)
58 , shiftmap_dof_handler(&shiftmap_dof_handler)
59 , component_mask([&]() {
61 ExcMessage(
"The DoFHandler must have a finite element assigned "
62 "before constructing the mapping."));
63 const unsigned int n_components =
71 for (
unsigned int d = 0; d < spacedim; ++d)
72 selected_components.
set(d,
true);
77 ExcMessage(
"Select exactly spacedim displacement components."));
78 return selected_components;
81 get_vertex_dof_indices();
86template <
int dim,
typename VectorType,
int spacedim>
87std::array<unsigned int, spacedim>
90 const auto &fe = shiftmap_dof_handler->get_fe();
91 const unsigned int n_vertex_dofs = fe.n_dofs_per_vertex();
92 std::array<unsigned int, spacedim> vertex_dof_indices{};
94 for (
unsigned int c = 0; c < fe.n_components(); ++c)
95 if (component_mask[c])
98 for (
unsigned int j = 0; j < n_vertex_dofs; ++j)
99 if (fe.get_nonzero_components(j)[c])
104 "Each selected component must have one primitive vertex DoF."));
110 "Each selected component must have one primitive vertex DoF."));
114 for (
unsigned int j = fe.reference_cell().n_vertices() * n_vertex_dofs;
115 j < fe.n_dofs_per_cell();
117 if (fe.get_nonzero_components(j)[c])
120 fe.shape_value_component(j,
124 "Selected nonvertex shape functions must vanish at vertices."));
125 vertex_dof_indices[d++] = index;
128 return vertex_dof_indices;
133template <
int dim,
typename VectorType,
int spacedim>
134boost::container::small_vector<Point<spacedim>,
136 ReferenceCells::max_n_vertices<dim>()
144 boost::container::small_vector<Point<spacedim>,
146 ReferenceCells::max_n_vertices<dim>()
151 vertices(cell->n_vertices());
152 const auto vertex_dof_indices = get_vertex_dof_indices();
153 const unsigned int n_vertex_dofs =
154 shiftmap_dof_handler->get_fe().n_dofs_per_vertex();
157 euler_transform_vectors->size());
163 *cell, shiftmap_dof_handler);
167 Assert(dof_cell->is_active() ==
true, ExcInactiveCell());
171 shiftmap_dof_handler->get_fe().n_dofs_per_cell());
172 dof_cell->get_dof_values(*euler_transform_vectors, mapping_values);
181 for (
unsigned int j = 0; j < spacedim; ++j)
183 mapping_values(i * n_vertex_dofs + vertex_dof_indices[j]);
187 vertices[i] = cell->vertex(i) + shift_vector;
194template <
int dim,
typename VectorType,
int spacedim>
200 const auto vertices = this->get_vertices(cell);
201 points.assign(vertices.begin(), vertices.end());
206template <
int dim,
typename VectorType,
int spacedim>
207std::unique_ptr<Mapping<dim, spacedim>>
210 return std::make_unique<MappingQ1Eulerian<dim, VectorType, spacedim>>(
211 *shiftmap_dof_handler, *euler_transform_vectors, component_mask);
216template <
int dim,
typename VectorType,
int spacedim>
243#include "fe/mapping_q1_eulerian.inst"
void set(const unsigned int index, const bool value)
bool represents_the_all_selected_mask() const
unsigned int size() const
unsigned int n_selected_components(const unsigned int overall_number_of_components=numbers::invalid_unsigned_int) const
ObserverPointer< const DoFHandler< dim, spacedim >, MappingQ1Eulerian< dim, VectorType, spacedim > > shiftmap_dof_handler
std::array< unsigned int, spacedim > get_vertex_dof_indices() const
const ComponentMask component_mask
virtual std::unique_ptr< Mapping< dim, spacedim > > clone() const override
virtual CellSimilarity::Similarity fill_fe_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const CellSimilarity::Similarity cell_similarity, const Quadrature< dim > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const override
MappingQ1Eulerian(const DoFHandler< dim, spacedim > &euler_dof_handler, const VectorType &euler_vector)
virtual void compute_mapping_support_points(const typename Triangulation< dim, spacedim >::cell_iterator &cell, boost::container::small_vector< Point< spacedim >, 200 > &points) const override
virtual boost::container::small_vector< Point< spacedim >, ReferenceCells::max_n_vertices< dim >() > get_vertices(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const override
virtual CellSimilarity::Similarity fill_fe_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const CellSimilarity::Similarity cell_similarity, const Quadrature< dim > &quadrature, const typename Mapping< dim, spacedim >::InternalDataBase &internal_data, internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &output_data) const override
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
typename ActiveSelector::cell_iterator cell_iterator
constexpr unsigned int invalid_unsigned_int
static std_cxx20::ranges::iota_view< unsigned int, unsigned int > vertex_indices()