#include <base/config.h>
#include <fe/mapping.h>
-#include <fe/mapping_q1.h>
#include <grid/tria.h>
#include <grid/tria_accessor.h>
#include <grid/tria_iterator.h>
}
-template <int dim, typename Container>
-inline
-typename Container::active_cell_iterator
-GridTools::find_active_cell_around_point (const Container &container,
- const Point<dim> &p)
-{
- return find_active_cell_around_point(StaticMappingQ1<dim>::mapping, container, p).first;
-}
-
/*---------------------------- grid_tools.h ---------------------------*/
/* end of #ifndef __deal2__grid_tools_H */
* components as the finite
* element) at this point.
*
- * Since the function uses a
- * simple test for checking
- * whether a point is in a cell,
- * it is only implemented for
- * Q1-mapping at this time.
+ * This is a wrapper function
+ * using a Q1-mapping for cell
+ * boundaries.
*/
template <int dim, class InVector>
static void point_difference (const DoFHandler<dim>& dof,
* components as the finite
* element) at this point.
*
- * This function additionally
- * expects a mapping and uses
- * a different algorithm to
- * determine the cell surrounding
- * the given point.
+ * This function uses an arbitrary
+ * mapping to evaluate the difference.
*/
template <int dim, class InVector>
static void point_difference (const Mapping<dim> &mapping,
* the (vector) value of this
* function through the last
* argument.
+ *
+ * This is a wrapper function using
+ * a Q1-mapping for cells.
*/
template <int dim, class InVector>
static
* vector at the given point, and
* return the value of this
* function.
+ *
+ * This is a wrapper function using
+ * a Q1-mapping for cells.
*/
template <int dim, class InVector>
static
* the given point, and return
* the (vector) value of this
* function through the last
- * argument. This function expects
- * additionally a mapping, and
- * uses a different algorithm to
- * determine the location of the
- * point (see GridTools::find_active_cell_around_point).
+ * argument.
+ *
+ * This function uses an arbitrary
+ * mapping to evaluate the difference.
*/
template <int dim, class InVector>
static
* the given DoFHandler and nodal
* vector at the given point, and
* return the value of this
- * function. This function expects
- * additionally a mapping, and
- * uses a different algorithm to
- * determine the location of the
- * point (see GridTools::find_active_cell_around_point).
+ * function.
+ *
+ * This function uses an arbitrary
+ * mapping to evaluate the difference.
*/
template <int dim, class InVector>
static
Vector<double> &difference,
const Point<dim> &point)
{
- static const MappingQ1<dim> mapping;
- const FiniteElement<dim>& fe = dof.get_fe();
-
- Assert(difference.size() == fe.n_components(),
- ExcDimensionMismatch(difference.size(), fe.n_components()));
-
- // first find the cell in which this point
- // is, initialize a quadrature rule with
- // it, and then a FEValues object
- const typename DoFHandler<dim>::active_cell_iterator
- cell = GridTools::find_active_cell_around_point (dof, point);
-
- const Point<dim> unit_point
- = mapping.transform_real_to_unit_cell(cell, point);
- Assert (GeometryInfo<dim>::is_inside_unit_cell (unit_point),
- ExcInternalError());
-
- const Quadrature<dim> quadrature (unit_point);
- FEValues<dim> fe_values(mapping, fe, quadrature, update_values);
- fe_values.reinit(cell);
-
- // then use this to get at the values of
- // the given fe_function at this point
- std::vector<Vector<double> > u_value(1, Vector<double> (fe.n_components()));
- fe_values.get_function_values(fe_function, u_value);
-
- if (fe.n_components() == 1)
- difference(0) = exact_function.value(point);
- else
- exact_function.vector_value(point, difference);
-
- for (unsigned int i=0; i<difference.size(); ++i)
- difference(i) -= u_value[0](i);
+ point_difference(StaticMappingQ1<dim>::mapping,
+ dof,
+ fe_function,
+ exact_function,
+ difference,
+ point);
}
const Point<dim> &point,
Vector<double> &value)
{
- static const MappingQ1<dim> mapping;
- const FiniteElement<dim>& fe = dof.get_fe();
-
- Assert(value.size() == fe.n_components(),
- ExcDimensionMismatch(value.size(), fe.n_components()));
-
- // first find the cell in which this point
- // is, initialize a quadrature rule with
- // it, and then a FEValues object
- const typename DoFHandler<dim>::active_cell_iterator
- cell = GridTools::find_active_cell_around_point (dof, point);
-
- const Point<dim> unit_point
- = mapping.transform_real_to_unit_cell(cell, point);
- Assert (GeometryInfo<dim>::is_inside_unit_cell (unit_point),
- ExcInternalError());
-
- const Quadrature<dim> quadrature (unit_point);
- FEValues<dim> fe_values(mapping, fe, quadrature, update_values);
- fe_values.reinit(cell);
-
- // then use this to get at the values of
- // the given fe_function at this point
- std::vector<Vector<double> > u_value(1, Vector<double> (fe.n_components()));
- fe_values.get_function_values(fe_function, u_value);
-
- value = u_value[0];
+ point_value(StaticMappingQ1<dim>::mapping,
+ dof,
+ fe_function,
+ point,
+ value);
}
const InVector &fe_function,
const Point<dim> &point)
{
- static const MappingQ1<dim> mapping;
- const FiniteElement<dim>& fe = dof.get_fe();
-
- Assert(fe.n_components() == 1,
- ExcMessage ("Finite element is not scalar as is necessary for this function"));
-
- // first find the cell in which this point
- // is, initialize a quadrature rule with
- // it, and then a FEValues object
- const typename DoFHandler<dim>::active_cell_iterator
- cell = GridTools::find_active_cell_around_point (dof, point);
-
- const Point<dim> unit_point
- = mapping.transform_real_to_unit_cell(cell, point);
- Assert (GeometryInfo<dim>::is_inside_unit_cell (unit_point),
- ExcInternalError());
-
- const Quadrature<dim> quadrature (unit_point);
- FEValues<dim> fe_values(mapping, fe, quadrature, update_values);
- fe_values.reinit(cell);
-
- // then use this to get at the values of
- // the given fe_function at this point
- std::vector<double> u_value(1);
- fe_values.get_function_values(fe_function, u_value);
-
- return u_value[0];
+ return point_value(StaticMappingQ1<dim>::mapping,
+ dof,
+ fe_function,
+ point);
}
template <int dim, class InVector>
#include <dofs/dof_accessor.h>
#include <dofs/dof_tools.h>
#include <fe/fe_dgq.h>
+#include <fe/mapping_q1.h>
#include <multigrid/mg_dof_handler.h>
#include <multigrid/mg_dof_accessor.h>
}
+template <int dim, typename Container>
+typename Container::active_cell_iterator
+GridTools::find_active_cell_around_point (const Container &container,
+ const Point<dim> &p)
+{
+ return find_active_cell_around_point(StaticMappingQ1<dim>::mapping, container, p).first;
+}
+
+
template <int dim, template <int> class Container>
std::pair<typename Container<dim>::active_cell_iterator, Point<dim> >
GridTools::find_active_cell_around_point (const Mapping<dim> &mapping,
<h3>deal.II</h3>
<ol>
+ <li> <p>
+ Changed: Functions <code class="class">VectorTools</code>::<code
+ class="member">point_value</code> and <code class="class">VectorTools</code>::<code
+ class="member">point_difference</code> using the old interface without
+ boundary mapping were replaced by wrapper functions calling the new
+ versions.
+ <br>
+ (Ralf B. Schulz, 2006/05/15)
+ </p>
<li> <p>
Changed: The old version of <code class="class">GridTools</code>::<code
class="member">find_active_cell_around_point</code> has been replaced