#include <cmath>
#include <fe/mapping.h>
+
/**
* Mapping of general quadrilateral/hexahedra by d-linear shape
* functions.
class MappingQ1 : public Mapping<dim>
{
public:
-//TODO: why make the following functions public? they are only helpful for fevalues and maybe the finite elements?
- /**
- * Implementation of the interface in
- * @ref{Mapping}.
- */
- virtual Mapping<dim>::InternalDataBase*
- get_data (const UpdateFlags,
- const Quadrature<dim>& quadrature) const;
-
/**
- * Implementation of the interface in
- * @ref{Mapping}.
- */
- virtual Mapping<dim>::InternalDataBase*
- get_face_data (const UpdateFlags flags,
- const Quadrature<dim-1>& quadrature) const;
-
- /**
- * Implementation of the interface in
- * @ref{Mapping}.
- */
- virtual Mapping<dim>::InternalDataBase*
- get_subface_data (const UpdateFlags flags,
- const Quadrature<dim-1>& quadrature) const;
-
- /**
- * Implementation of the interface in
- * @ref{Mapping}.
- */
- virtual void
- fill_fe_values (const DoFHandler<dim>::cell_iterator &cell,
- const Quadrature<dim>& quadrature,
- Mapping<dim>::InternalDataBase &mapping_data,
- std::vector<Point<dim> > &quadrature_points,
- std::vector<double> &JxW_values) const ;
-
- /**
- * Implementation of the interface in
- * @ref{Mapping}.
+ * Transforms 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}.
*/
- virtual void
- fill_fe_face_values (const typename DoFHandler<dim>::cell_iterator &cell,
- const unsigned int face_no,
- const Quadrature<dim-1>& quadrature,
- typename Mapping<dim>::InternalDataBase &mapping_data,
- std::vector<Point<dim> > &quadrature_points,
- std::vector<double> &JxW_values,
- std::vector<Tensor<1,dim> > &boundary_form,
- std::vector<Point<dim> > &normal_vectors) const ;
-
+ virtual Point<dim> transform_unit_to_real_cell (
+ const typename Triangulation<dim>::cell_iterator cell,
+ const Point<dim> &p) const;
+
/**
- * Implementation of the interface in
- * @ref{Mapping}.
+ * Transforms the point @p{p} on
+ * the real cell to the point
+ * @p{p_unit} on the unit cell
+ * @p{cell} and returns @p{p_unit}.
+ *
+ * Uses Newton iteration and the
+ * @p{transform_unit_to_real_cell}
+ * function.
*/
- virtual void
- fill_fe_subface_values (const typename DoFHandler<dim>::cell_iterator &cell,
- const unsigned int face_no,
- const unsigned int sub_no,
- const Quadrature<dim-1>& quadrature,
- typename Mapping<dim>::InternalDataBase &mapping_data,
- std::vector<Point<dim> > &quadrature_points,
- std::vector<double> &JxW_values,
- std::vector<Tensor<1,dim> > &boundary_form,
- std::vector<Point<dim> > &normal_vectors) const ;
-
-
+ virtual Point<dim> transform_real_to_unit_cell (
+ const typename Triangulation<dim>::cell_iterator cell,
+ const Point<dim> &p) const;
+
/**
* Implementation of the interface in
* @ref{Mapping}.
const Mapping<dim>::InternalDataBase &mapping_data,
const unsigned int src_offset) const;
- /**
- * Transforms 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}.
- */
-//TODO: document meaning of mdata argument
- virtual Point<dim> transform_unit_to_real_cell (
- const typename Triangulation<dim>::cell_iterator cell,
- const Point<dim> &p,
- const typename Mapping<dim>::InternalDataBase *const mdata=0) const;
-
- /**
- * Transforms the point @p{p} on
- * the real cell to the point
- * @p{p_unit} on the unit cell
- * @p{cell} and returns @p{p_unit}.
- *
- * Uses Newton iteration and the
- * @p{transform_unit_to_real_cell}
- * function.
- */
- virtual Point<dim> transform_real_to_unit_cell (
- const typename Triangulation<dim>::cell_iterator cell,
- const Point<dim> &p) const;
/**
* Implementation of the interface in
* @ref{Mapping}.
*/
virtual UpdateFlags update_each (const UpdateFlags) const;
+
+ protected:
/**
- * Exception
+ * Implementation of the interface in
+ * @ref{Mapping}.
*/
- DeclException0 (ExcInvalidData);
+ virtual void
+ fill_fe_values (const DoFHandler<dim>::cell_iterator &cell,
+ const Quadrature<dim>& quadrature,
+ Mapping<dim>::InternalDataBase &mapping_data,
+ std::vector<Point<dim> > &quadrature_points,
+ std::vector<double> &JxW_values) const ;
- protected:
+ /**
+ * Implementation of the interface in
+ * @ref{Mapping}.
+ */
+ virtual void
+ fill_fe_face_values (const typename DoFHandler<dim>::cell_iterator &cell,
+ const unsigned int face_no,
+ const Quadrature<dim-1>& quadrature,
+ typename Mapping<dim>::InternalDataBase &mapping_data,
+ std::vector<Point<dim> > &quadrature_points,
+ std::vector<double> &JxW_values,
+ std::vector<Tensor<1,dim> > &boundary_form,
+ std::vector<Point<dim> > &normal_vectors) const ;
+
+ /**
+ * Implementation of the interface in
+ * @ref{Mapping}.
+ */
+ virtual void
+ fill_fe_subface_values (const typename DoFHandler<dim>::cell_iterator &cell,
+ const unsigned int face_no,
+ const unsigned int sub_no,
+ const Quadrature<dim-1>& quadrature,
+ typename Mapping<dim>::InternalDataBase &mapping_data,
+ std::vector<Point<dim> > &quadrature_points,
+ std::vector<double> &JxW_values,
+ std::vector<Tensor<1,dim> > &boundary_form,
+ std::vector<Point<dim> > &normal_vectors) const ;
+
/**
* Implementation of the
* covariant transformation.
unsigned int n_shape_functions;
};
- /**
- * Do the computations for the
- * @p{get_face_data}
- * functions. Here, the data
- * vectors of @p{InternalData}
- * are reinitialized to proper
- * size and shape values and
- * derivatives are
- * computed. Furthermore
- * @p{unit_tangential} vectors of
- * the face are computed.
- */
- void compute_face_data (const UpdateFlags flags,
- const Quadrature<dim> &quadrature,
- const unsigned int n_orig_q_points,
- InternalData &data) const;
-
- /**
- * Mapping between tensor product
- * ordering and real ordering of
- * the vertices.
- */
- static const unsigned int vertex_mapping[1<<dim];
-
/**
* Compute shape values and/or
* derivatives.
*/
void compute_shapes (const std::vector<Point<dim> > &unit_points,
InternalData &data) const;
-
+
/**
- * Do the computations for the @p{get_data}
- * functions. Here, the data
- * vectors of @p{InternalData} are
- * reinitialized to proper size and
- * shape values are computed.
+ * Do the computations for the
+ * @p{get_data} functions. Here,
+ * the data vectors of
+ * @p{InternalData} are
+ * reinitialized to proper size
+ * and shape values are computed.
*/
void compute_data (const UpdateFlags flags,
const Quadrature<dim>& quadrature,
const unsigned int n_orig_q_points,
InternalData& data) const;
+
+ /**
+ * Do the computations for the
+ * @p{get_face_data}
+ * functions. Here, the data
+ * vectors of @p{InternalData}
+ * are reinitialized to proper
+ * size and shape values and
+ * derivatives are
+ * computed. Furthermore
+ * @p{unit_tangential} vectors of
+ * the face are computed.
+ */
+ void compute_face_data (const UpdateFlags flags,
+ const Quadrature<dim> &quadrature,
+ const unsigned int n_orig_q_points,
+ InternalData &data) const;
/**
* Do the computation for the
std::vector<double> &JxW_values,
std::vector<Tensor<1,dim> > &boundary_form,
std::vector<Point<dim> > &normal_vectors) const;
-
+
/**
* Compute shape values and/or
* derivatives.
*/
virtual void compute_shapes_virtual (const std::vector<Point<dim> > &unit_points,
InternalData &data) const;
+
+ /**
+ * Mapping between tensor product
+ * ordering and real ordering of
+ * the vertices.
+ */
+ static const unsigned int vertex_mapping[1<<dim];
+
+
private:
+ /**
+ * Transforms 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}.
+ *
+ * This function is called by
+ * @p{transform_unit_to_real_cell}
+ * and multiply (through the
+ * Newton iteration) by
+ * @p{transform_real_to_unit_cell}.
+ *
+ * Takes a reference to an
+ * @p{InternalData} that must
+ * already include the shape
+ * values at point @p{p} and the
+ * mapping support points of the
+ * cell.
+ *
+ * This additional
+ * @p{InternalData} argument
+ * avoids multiple computations
+ * of the shape values at point
+ * @p{p} and especially multiple
+ * computations of the mapping
+ * support points.
+ */
+ virtual Point<dim> transform_unit_to_real_cell_internal (
+ const typename Triangulation<dim>::cell_iterator cell,
+ const Point<dim> &p,
+ const InternalData &m_data) const;
+
+ /**
+ * Returns an @p{InternalData}
+ * whose data vectors are resized
+ * corresponding to the
+ * @p{update_flags} and a
+ * one-point
+ * quadrature. Furthermore the
+ * @p{InternalData} stores the
+ * mapping support points of the
+ * given @p{cell}.
+ *
+ * This function is called by
+ * @p{transform_unit_to_real_cell}
+ * and by
+ * @p{transform_real_to_unit_cell}.
+ * The resulting @p{InternalData}
+ * is given to the
+ * @p{transform_unit_to_real_internal}
+ * function.
+ */
+ InternalData* get_cell_data(const typename Triangulation<dim>::cell_iterator cell,
+ const UpdateFlags update_flags) const;
+
+ /**
+ * Implementation of the interface in
+ * @ref{Mapping}.
+ */
+ virtual Mapping<dim>::InternalDataBase*
+ get_data (const UpdateFlags,
+ const Quadrature<dim>& quadrature) const;
+
+ /**
+ * Implementation of the interface in
+ * @ref{Mapping}.
+ */
+ virtual Mapping<dim>::InternalDataBase*
+ get_face_data (const UpdateFlags flags,
+ const Quadrature<dim-1>& quadrature) const;
+
+ /**
+ * Implementation of the interface in
+ * @ref{Mapping}.
+ */
+ virtual Mapping<dim>::InternalDataBase*
+ get_subface_data (const UpdateFlags flags,
+ const Quadrature<dim-1>& quadrature) const;
/**
* Computes the support points of