* as the MappingQ1 class. Consequently, it inherits from
* MappingQ1::InternalData, rather than from Mapping::InternalDataBase.
*/
- class InternalData : public MappingQ1<dim,spacedim>::InternalData
+ class InternalData : public MappingQGeneric<dim,spacedim>::InternalData
{
public:
/**
* A pointer to a structure to store the information for the pure
* $Q_1$ mapping that is, by default, used on all interior cells.
*/
- std_cxx11::unique_ptr<typename MappingQ1<dim,spacedim>::InternalData> mapping_q1_data;
+ std_cxx11::unique_ptr<typename MappingQGeneric<dim,spacedim>::InternalData> mapping_q1_data;
};
protected:
* our own Q1 mapping here, rather than simply resorting to
* StaticMappingQ1::mapping.
*/
- std_cxx11::unique_ptr<const MappingQ1<dim,spacedim> > q1_mapping;
+ std_cxx11::unique_ptr<const MappingQGeneric<dim,spacedim> > q1_mapping;
/**
* Declare other MappingQ classes friends.
template <int dim, int spacedim=dim>
struct StaticMappingQ1
{
- static MappingQ1<dim, spacedim> mapping;
+ static MappingQGeneric<dim, spacedim> mapping;
};
/*@{*/
/**
- * Eulerian mapping of general unit cells by d-linear shape functions. Each
+ * Eulerian mapping of general unit cells by $d$-linear shape functions. Each
* cell is thus shifted in space by values given to the mapping through a
* finite element field.
*
* @author Michael Stadler, 2001
*/
template <int dim, class VECTOR = Vector<double>, int spacedim=dim >
-class MappingQ1Eulerian : public MappingQ1<dim,spacedim>
+class MappingQ1Eulerian : public MappingQGeneric<dim,spacedim>
{
public:
*/
MappingQGeneric (const MappingQGeneric<dim,spacedim> &mapping);
+ // for documentation, see the Mapping base class
+ virtual
+ Mapping<dim,spacedim> *clone () const;
+
/**
* Return the degree of the mapping, i.e. the value which was passed to the
* constructor.
const AdditionalData additional_data = AdditionalData());
/**
- * Initializes the data structures. Same as above, but with mapping @p
- * MappingQ1.
+ * Initializes the data structures. Same as above, but using a $Q_1$ mapping.
*/
template <typename DH, typename Quadrature>
void reinit (const DH &dof_handler,
const AdditionalData additional_data = AdditionalData());
/**
- * Initializes the data structures. Same as above, but with mapping @p
- * MappingQ1.
+ * Initializes the data structures. Same as above, but using a $Q_1$ mapping.
*/
template <typename DH, typename Quadrature>
void reinit (const std::vector<const DH *> &dof_handler,
const AdditionalData additional_data = AdditionalData());
/**
- * Initializes the data structures. Same as above, but with mapping @p
- * MappingQ1.
+ * Initializes the data structures. Same as above, but using a $Q_1$ mapping.
*/
template <typename DH, typename Quadrature>
void reinit (const std::vector<const DH *> &dof_handler,
const Quad &quad,
const typename MatrixFree<dim,Number>::AdditionalData additional_data)
{
- MappingQ1<dim> mapping;
std::vector<const DH *> dof_handlers;
std::vector<const ConstraintMatrix *> constraints;
std::vector<Quad> quads;
std::vector<IndexSet> locally_owned_sets =
internal::MatrixFree::extract_locally_owned_index_sets
(dof_handlers, additional_data.level_mg_handler);
- reinit(mapping, dof_handlers,constraints, locally_owned_sets, quads,
+ reinit(StaticMappingQ1<dim>::mapping, dof_handlers,constraints, locally_owned_sets, quads,
additional_data);
}
const std::vector<Quad> &quad,
const typename MatrixFree<dim,Number>::AdditionalData additional_data)
{
- MappingQ1<dim> mapping;
std::vector<IndexSet> locally_owned_set =
internal::MatrixFree::extract_locally_owned_index_sets
(dof_handler, additional_data.level_mg_handler);
- reinit(mapping, dof_handler,constraint,locally_owned_set,
+ reinit(StaticMappingQ1<dim>::mapping, dof_handler,constraint,locally_owned_set,
static_cast<const std::vector<Quadrature<1> >&>(quad),
additional_data);
}
const Quad &quad,
const typename MatrixFree<dim,Number>::AdditionalData additional_data)
{
- MappingQ1<dim> mapping;
std::vector<Quad> quads;
quads.push_back(quad);
std::vector<IndexSet> locally_owned_set =
internal::MatrixFree::extract_locally_owned_index_sets
(dof_handler, additional_data.level_mg_handler);
- reinit(mapping, dof_handler,constraint,locally_owned_set, quads,
+ reinit(StaticMappingQ1<dim>::mapping, dof_handler,constraint,locally_owned_set, quads,
additional_data);
}
/**
* Calls the @p interpolate function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <int dim, template <int, int> class DH, class InputVector, int spacedim>
void
/**
* Calls the @p interpolate function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <int dim, template <int, int> class DH, class InputVector, int spacedim>
void
const unsigned int component = 0);
/**
- * Same as above, with <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * Same as above, with <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <class DH, int dim, int spacedim, class InputVector, int order>
void
/**
* Calls the @p estimate function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <typename InputVector, class DH>
static void estimate (const DH &dof,
/**
* Calls the @p estimate function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <typename InputVector, class DH>
static void estimate (const DH &dof,
/**
* Calls the @p estimate function, see above, with
- * <tt>mapping=MappingQ1<1>()</tt>.
+ * <tt>mapping=MappingQGeneric1<1>()</tt>.
*/
template <typename InputVector, class DH>
static void estimate (const DH &dof,
/**
* Calls the @p estimate function, see above, with
- * <tt>mapping=MappingQ1<1>()</tt>.
+ * <tt>mapping=MappingQGeneric1<1>()</tt>.
*/
template <typename InputVector, class DH>
static void estimate (const DH &dof,
/**
* Calls the create_mass_matrix() function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <int dim, typename number, int spacedim>
void create_mass_matrix (const DoFHandler<dim,spacedim> &dof,
/**
* Calls the create_mass_matrix() function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <int dim, typename number, int spacedim>
void create_mass_matrix (const DoFHandler<dim,spacedim> &dof,
/**
* Calls the create_boundary_mass_matrix() function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <int dim, int spacedim>
void create_boundary_mass_matrix (const DoFHandler<dim,spacedim> &dof,
/**
* Calls the create_laplace_matrix() function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <int dim, int spacedim>
void create_laplace_matrix (const DoFHandler<dim,spacedim> &dof,
/**
* Calls the create_laplace_matrix() function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <int dim, int spacedim>
void create_laplace_matrix (const DoFHandler<dim,spacedim> &dof,
/**
* Calls the @p interpolate() function above with
- * <tt>mapping=MappingQ1@<dim>@()</tt>.
+ * <tt>mapping=MappingQGeneric1@<dim>@()</tt>.
*/
template <class VECTOR, class DH>
void interpolate (const DH &dof,
/**
* Calls the project() function above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <int dim, class VECTOR, int spacedim>
void project (const DoFHandler<dim,spacedim> &dof,
/**
* Calls the other interpolate_boundary_values() function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>. The same comments apply as for the
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>. The same comments apply as for the
* previous function, in particular about the use of the component mask and
* the requires size of the function object.
*
/**
* Calls the other interpolate_boundary_values() function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>. The same comments apply as for the
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>. The same comments apply as for the
* previous function, in particular about the use of the component mask and
* the requires size of the function object.
*/
/**
* Calls the other interpolate_boundary_values() function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>. The same comments apply as for the
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>. The same comments apply as for the
* previous function, in particular about the use of the component mask and
* the requires size of the function object.
*
/**
* Calls the other interpolate_boundary_values() function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>. The same comments apply as for the
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>. The same comments apply as for the
* previous function, in particular about the use of the component mask and
* the requires size of the function object.
*
/**
* Calls the project_boundary_values() function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <int dim, int spacedim>
void project_boundary_values (const DoFHandler<dim,spacedim> &dof,
/**
* Calls the project_boundary_values() function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <int dim, int spacedim>
void project_boundary_values (const hp::DoFHandler<dim,spacedim> &dof,
/**
* Calls the project_boundary_values() function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*
* @ingroup constraints
*/
/**
* Calls the create_right_hand_side() function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <int dim, int spacedim>
void create_right_hand_side (const DoFHandler<dim,spacedim> &dof,
/**
* Calls the create_point_source_vector() function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <int dim, int spacedim>
void create_point_source_vector(const DoFHandler<dim,spacedim> &dof,
/**
* Calls the create_point_source_vector() function for vector-valued finite
- * elements, see above, with <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * elements, see above, with <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <int dim, int spacedim>
void create_point_source_vector(const DoFHandler<dim,spacedim> &dof,
/**
* Calls the create_boundary_right_hand_side() function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*
* @see
* @ref GlossBoundaryIndicator "Glossary entry on boundary indicators"
/**
* Calls the integrate_difference() function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <int dim, class InVector, class OutVector, int spacedim>
void integrate_difference (const DoFHandler<dim,spacedim> &dof,
/**
* Calls the integrate_difference() function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <int dim, class InVector, class OutVector, int spacedim>
void integrate_difference (const hp::DoFHandler<dim,spacedim> &dof,
/**
* Calls the other compute_mean_value() function, see above, with
- * <tt>mapping=MappingQ1@<dim@>()</tt>.
+ * <tt>mapping=MappingQGeneric@<dim@>(1)</tt>.
*/
template <int dim, class InVector, int spacedim>
double compute_mean_value (const DoFHandler<dim,spacedim> &dof,
// ---------------------------------------------------------------------
// $Id$
//
-// Copyright (C) 2012 - 2013 by the deal.II authors
+// Copyright (C) 2012 - 2013, 2015 by the deal.II authors
//
// This file is part of the deal.II library.
//
const unsigned int degree = fe.degree;
// Initialize quadrature formula on fine cells
- MappingQ1<dim, spacedim> mapping;
-
std_cxx11::unique_ptr<Quadrature<dim> > q_fine;
Quadrature<1> q_dummy(std::vector<Point<1> >(1), std::vector<double> (1,1.));
switch (dim)
DoFHandler<dim, spacedim> dh(tr);
dh.distribute_dofs(fe);
- FEValues<dim, spacedim> fine (mapping, fe, *q_fine,
+ FEValues<dim, spacedim> fine (StaticMappingQ1<dim,spacedim>::mapping, fe, *q_fine,
update_quadrature_points
| update_JxW_values | update_values);
tria.begin_active()->set_refine_flag (RefinementCase<dim>(ref_case));
tria.execute_coarsening_and_refinement ();
- MappingQ1<dim,spacedim> mapping;
const unsigned int degree = fe.degree;
QGauss<dim> q_fine (degree+1);
const unsigned int nq = q_fine.size();
- FEValues<dim,spacedim> fine (mapping, fe, q_fine,
+ FEValues<dim,spacedim> fine (fe, q_fine,
update_quadrature_points |
update_JxW_values |
update_values);
q_points_coarse[i](j) = q_points_fine[i](j);
const Quadrature<dim> q_coarse (q_points_coarse,
fine.get_JxW_values ());
- FEValues<dim,spacedim> coarse (mapping, fe, q_coarse, update_values);
+ FEValues<dim,spacedim> coarse (fe, q_coarse, update_values);
coarse.reinit (tria.begin (0));
// prepare FEValues, quadrature etc on
// coarse cell
- MappingQ1<dim,spacedim> mapping;
QGauss<dim> q_fine(degree+1);
const unsigned int nq = q_fine.size();
Triangulation<dim,spacedim> tr;
GridGenerator::hyper_cube (tr, 0, 1);
- FEValues<dim,spacedim> coarse (mapping, fe, q_fine,
+ FEValues<dim,spacedim> coarse (fe, q_fine,
update_JxW_values | update_values);
typename Triangulation<dim,spacedim>::cell_iterator coarse_cell
tr.begin_active()->set_refine_flag(RefinementCase<dim>(ref_case));
tr.execute_coarsening_and_refinement();
- FEValues<dim,spacedim> fine (mapping, fe, q_fine,
+ FEValues<dim,spacedim> fine (StaticMappingQ1<dim,spacedim>::mapping, fe, q_fine,
update_quadrature_points | update_JxW_values |
update_values);
q_points_coarse[q](j) = q_points_fine[q](j);
Quadrature<dim> q_coarse (q_points_coarse,
fine.get_JxW_values());
- FEValues<dim,spacedim> coarse (mapping, fe, q_coarse, update_values);
+ FEValues<dim,spacedim> coarse (StaticMappingQ1<dim,spacedim>::mapping, fe, q_coarse, update_values);
coarse.reinit(coarse_cell);
// Build RHS
(dim != spacedim)),
// create a Q1 mapping for use on interior cells (if necessary)
// or to create a good initial guess in transform_real_to_unit_cell()
- q1_mapping (new MappingQ1<dim,spacedim>())
+ q1_mapping (new MappingQGeneric<dim,spacedim>(1))
{}
use_mapping_q_on_all_cells (mapping.use_mapping_q_on_all_cells),
// clone the Q1 mapping for use on interior cells (if necessary)
// or to create a good initial guess in transform_real_to_unit_cell()
- q1_mapping (mapping.q1_mapping->clone())
+ q1_mapping (dynamic_cast<MappingQGeneric<dim,spacedim>*>(mapping.q1_mapping->clone()))
{}
template<int dim, int spacedim>
-MappingQ1<dim,spacedim> StaticMappingQ1<dim,spacedim>::mapping;
+MappingQGeneric<dim,spacedim>
+StaticMappingQ1<dim,spacedim>::mapping = MappingQGeneric<dim,spacedim>(1);
MappingQ1Eulerian (const EulerVectorType &euler_transform_vectors,
const DoFHandler<dim,spacedim> &shiftmap_dof_handler)
:
+ MappingQGeneric<dim,spacedim>(1),
euler_transform_vectors(&euler_transform_vectors),
shiftmap_dof_handler(&shiftmap_dof_handler)
{}
// call the function of the base class, but ignoring
// any potentially detected cell similarity between
// the current and the previous cell
- MappingQ1<dim,spacedim>::fill_fe_values (cell,
- CellSimilarity::invalid_next_cell,
- quadrature,
- internal_data,
- output_data);
+ MappingQGeneric<dim,spacedim>::fill_fe_values (cell,
+ CellSimilarity::invalid_next_cell,
+ quadrature,
+ internal_data,
+ output_data);
// also return the updated flag since any detected
// similarity wasn't based on the mapped field, but
// the original vertices which are meaningless
+
+template<int dim, int spacedim>
+Mapping<dim,spacedim> *
+MappingQGeneric<dim,spacedim>::clone () const
+{
+ return new MappingQGeneric<dim,spacedim>(*this);
+}
+
+
+
+
template<int dim, int spacedim>
unsigned int
MappingQGeneric<dim,spacedim>::get_degree() const
Triangulation<dim> &triangulation,
const Function<dim> *coefficient)
{
- // first provide everything that is
- // needed for solving a Laplace
+ // first provide everything that is needed for solving a Laplace
// equation.
- MappingQ1<dim> mapping_q1;
FE_Q<dim> q1(1);
DoFHandler<dim> dof_handler(triangulation);
QGauss<dim> quadrature(4);
- MatrixCreator::create_laplace_matrix(mapping_q1, dof_handler, quadrature, S,coefficient);
+ MatrixCreator::create_laplace_matrix(StaticMappingQ1<dim>::mapping, dof_handler, quadrature, S, coefficient);
// set up the boundary values for
// the laplace problem
best_cell = std::make_pair(*cell, p_cell);
}
}
- catch (typename MappingQ1<dim,spacedim>::ExcTransformationFailed &)
+ catch (typename MappingQGeneric<dim,spacedim>::ExcTransformationFailed &)
{
// ok, the transformation
// failed presumably
best_cell = std::make_pair(*cell, p_cell);
}
}
- catch (typename MappingQ1<dim,spacedim>::ExcTransformationFailed &)
+ catch (typename MappingQGeneric<dim,spacedim>::ExcTransformationFailed &)
{
// ok, the transformation
// failed presumably
// ---------------------------------------------------------------------
//
-// Copyright (C) 2003 - 2014 by the deal.II authors
+// Copyright (C) 2003 - 2015 by the deal.II authors
//
// This file is part of the deal.II library.
//
* this function is called.
*/
template<int dim, int spacedim>
- MappingQ1<dim,spacedim> &
+ MappingQGeneric<dim,spacedim> &
get_static_mapping_q1()
{
static MappingQ1<dim,spacedim> mapping;
else
n_postprocessor_outputs[dataset] = 0;
- const MappingQ1<dimension, space_dimension> mapping;
internal::DataOutRotation::ParallelData<dimension, space_dimension>
thread_data (n_datasets,
n_subdivisions, n_patches_per_circle,
- n_postprocessor_outputs, mapping, this->get_finite_elements(),
+ n_postprocessor_outputs,
+ StaticMappingQ1<dimension,space_dimension>::mapping,
+ this->get_finite_elements(),
update_flags);
std::vector<DataOutBase::Patch<dimension+1,space_dimension+1> >
new_patches (n_patches_per_circle);
// we now have a point to query,
// need to know what cell it is in
Point <dim> requested_location = point->requested_location;
- typename DoFHandler<dim>::active_cell_iterator cell = GridTools::find_active_cell_around_point (MappingQ1<dim>(), *dof_handler, requested_location).first;
+ typename DoFHandler<dim>::active_cell_iterator cell = GridTools::find_active_cell_around_point (StaticMappingQ1<dim>::mapping, *dof_handler, requested_location).first;
fe_values.reinit (cell);
// we now have a point to query,
// need to know what cell it is in
Point <dim> requested_location = point->requested_location;
- typename DoFHandler<dim>::active_cell_iterator cell = GridTools::find_active_cell_around_point (MappingQ1<dim>(), *dof_handler, requested_location).first;
+ typename DoFHandler<dim>::active_cell_iterator cell = GridTools::find_active_cell_around_point (StaticMappingQ1<dim>::mapping, *dof_handler, requested_location).first;
fe_values.reinit (cell);
evaluation_points = fe_values.get_quadrature_points();
ePos(1) = 1125.59175030825804242340382189;
MappingQ<2> mapping(1);
- MappingQ1<2> &mapping2 = StaticMappingQ1< 2 >::mapping;
+ MappingQGeneric<2> &mapping2 = StaticMappingQ1< 2 >::mapping;
deallog << "1:" << std::endl;
GridTools::find_active_cell_around_point (mapping, triangulation, ePos);
deallog << "2:" << std::endl;
ePos(1) = 1125.59175030825804242340382189;
MappingQ<2> mapping(1);
- MappingQ1<2> &mapping2 = StaticMappingQ1< 2 >::mapping;
+ MappingQGeneric<2> &mapping2 = StaticMappingQ1< 2 >::mapping;
Triangulation<2> triangulation;
create_coarse_grid(triangulation); // first Tria with just one cell