--- /dev/null
+Changed: The return type of the method Mapping::get_vertices() has been changed
+from std::array to boost::container::small_vector.
+<br>
+(Peter Munch, 2020/10/16)
* information stored by the triangulation, i.e.,
* <code>cell-@>vertex(v)</code>.
*/
- virtual std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
+ virtual boost::container::small_vector<Point<spacedim>,
+ GeometryInfo<dim>::vertices_per_cell>
get_vertices(
const typename Triangulation<dim, spacedim>::cell_iterator &cell) const;
* and constructs the position of the vertices according to the @p euler_vector
* that was passed at construction time.
*/
- virtual std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
+ virtual boost::container::small_vector<Point<spacedim>,
+ GeometryInfo<dim>::vertices_per_cell>
get_vertices(const typename Triangulation<dim, spacedim>::cell_iterator &cell)
const override;
* cell but instead evaluates an externally given displacement field in
* addition to the geometry of the cell.
*/
- virtual std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
+ virtual boost::container::small_vector<Point<spacedim>,
+ GeometryInfo<dim>::vertices_per_cell>
get_vertices(const typename Triangulation<dim, spacedim>::cell_iterator &cell)
const override;
* cell but instead evaluates an externally given displacement field in
* addition to the geometry of the cell.
*/
- virtual std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
+ virtual boost::container::small_vector<Point<spacedim>,
+ GeometryInfo<dim>::vertices_per_cell>
get_vertices(const typename Triangulation<dim, spacedim>::cell_iterator &cell)
const override;
* current cell but instead evaluates an externally given displacement
* field in addition to the geometry of the cell.
*/
- virtual std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
+ virtual boost::container::small_vector<Point<spacedim>,
+ GeometryInfo<dim>::vertices_per_cell>
get_vertices(const typename Triangulation<dim, spacedim>::cell_iterator
&cell) const override;
template <int dim, int spacedim>
-std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
+boost::container::small_vector<Point<spacedim>,
+ GeometryInfo<dim>::vertices_per_cell>
Mapping<dim, spacedim>::get_vertices(
const typename Triangulation<dim, spacedim>::cell_iterator &cell) const
{
- std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell> vertices;
- for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
- {
- vertices[i] = cell->vertex(i);
- }
+ boost::container::small_vector<Point<spacedim>,
+ GeometryInfo<dim>::vertices_per_cell>
+ vertices;
+ for (const unsigned int i : cell->vertex_indices())
+ vertices.push_back(cell->vertex(i));
+
return vertices;
}
template <int dim, int spacedim, typename VectorType, typename DoFHandlerType>
-std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
+boost::container::small_vector<Point<spacedim>,
+ GeometryInfo<dim>::vertices_per_cell>
MappingFEField<dim, spacedim, VectorType, DoFHandlerType>::get_vertices(
const typename Triangulation<dim, spacedim>::cell_iterator &cell) const
{
const VectorType &vector =
uses_level_dofs ? *euler_vector[cell->level()] : *euler_vector[0];
- std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell> vertices;
+ boost::container::small_vector<Point<spacedim>,
+ GeometryInfo<dim>::vertices_per_cell>
+ vertices(GeometryInfo<dim>::vertices_per_cell);
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
const unsigned int comp = fe_to_real
template <int dim, class VectorType, int spacedim>
-std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
+boost::container::small_vector<Point<spacedim>,
+ GeometryInfo<dim>::vertices_per_cell>
MappingQ1Eulerian<dim, VectorType, spacedim>::get_vertices(
const typename Triangulation<dim, spacedim>::cell_iterator &cell) const
{
- std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell> vertices;
+ boost::container::small_vector<Point<spacedim>,
+ GeometryInfo<dim>::vertices_per_cell>
+ vertices(GeometryInfo<dim>::vertices_per_cell);
// The assertions can not be in the constructor, since this would
// require to call dof_handler.distribute_dofs(fe) *before* the mapping
// object is constructed, which is not necessarily what we want.
MappingQ1Eulerian<dim, VectorType, spacedim>::compute_mapping_support_points(
const typename Triangulation<dim, spacedim>::cell_iterator &cell) const
{
- const std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
- vertices = this->get_vertices(cell);
+ const auto vertices = this->get_vertices(cell);
std::vector<Point<spacedim>> a(GeometryInfo<dim>::vertices_per_cell);
for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
// .... COMPUTE MAPPING SUPPORT POINTS
template <int dim, class VectorType, int spacedim>
-std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
+boost::container::small_vector<Point<spacedim>,
+ GeometryInfo<dim>::vertices_per_cell>
MappingQEulerian<dim, VectorType, spacedim>::get_vertices(
const typename Triangulation<dim, spacedim>::cell_iterator &cell) const
{
dynamic_cast<const MappingQEulerianGeneric &>(*this->qp_mapping)
.compute_mapping_support_points(cell);
- std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
- vertex_locations;
- std::copy(a.begin(),
- a.begin() + GeometryInfo<dim>::vertices_per_cell,
- vertex_locations.begin());
+ boost::container::small_vector<Point<spacedim>,
+ GeometryInfo<dim>::vertices_per_cell>
+ vertex_locations(a.begin(),
+ a.begin() + GeometryInfo<dim>::vertices_per_cell);
return vertex_locations;
}
template <int dim, class VectorType, int spacedim>
-std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
+boost::container::small_vector<Point<spacedim>,
+ GeometryInfo<dim>::vertices_per_cell>
MappingQEulerian<dim, VectorType, spacedim>::MappingQEulerianGeneric::
get_vertices(
const typename Triangulation<dim, spacedim>::cell_iterator &cell) const
// cell and that value is returned.
// * In 3D there is no (known to the authors) exact formula, so the Newton
// algorithm is used.
- const std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
- vertices = this->get_vertices(cell);
+ const auto vertices_ = this->get_vertices(cell);
+
+ std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
+ vertices;
+ for (unsigned int i = 0; i < vertices.size(); ++i)
+ vertices[i] = vertices_[i];
+
try
{
switch (dim)
diameter(const typename Triangulation<dim, spacedim>::cell_iterator &cell,
const Mapping<dim, spacedim> &mapping)
{
+ // see also TriaAccessor::diameter()
+
const auto vertices = mapping.get_vertices(cell);
- switch (dim)
+ switch (cell->reference_cell_type())
{
- case 1:
+ case ReferenceCell::Type::Line:
return (vertices[1] - vertices[0]).norm();
- case 2:
+ case ReferenceCell::Type::Tri:
+ return std::max(std::max((vertices[1] - vertices[0]).norm(),
+ (vertices[2] - vertices[1]).norm()),
+ (vertices[2] - vertices[0]).norm());
+ case ReferenceCell::Type::Quad:
return std::max((vertices[3] - vertices[0]).norm(),
(vertices[2] - vertices[1]).norm());
- case 3:
+ case ReferenceCell::Type::Tet:
+ return std::max(
+ std::max(std::max((vertices[1] - vertices[0]).norm(),
+ (vertices[2] - vertices[0]).norm()),
+ std::max((vertices[2] - vertices[1]).norm(),
+ (vertices[3] - vertices[0]).norm())),
+ std::max((vertices[3] - vertices[1]).norm(),
+ (vertices[3] - vertices[2]).norm()));
+ case ReferenceCell::Type::Hex:
return std::max(std::max((vertices[7] - vertices[0]).norm(),
(vertices[6] - vertices[1]).norm()),
std::max((vertices[2] - vertices[5]).norm(),
visited_faces[face_index] = false;
// extract mapped vertex locations
- std::array<Point<spacedim>, GeometryInfo<2>::vertices_per_cell>
- verts = mapping.get_vertices(cell);
+ const auto verts = mapping.get_vertices(cell);
vert_to_point[v0] = verts[GeometryInfo<2>::face_to_cell_vertices(
f, 0, true, false, false)];
vert_to_point[v1] = verts[GeometryInfo<2>::face_to_cell_vertices(
// Test TriaAccessor::measure() and TriaAccessor::diameter().
+#include <deal.II/fe/mapping_fe.h>
+
+#include <deal.II/grid/grid_tools.h>
#include <deal.II/grid/tria.h>
+#include <deal.II/simplex/fe_lib.h>
+
#include "../tests.h"
template <int dim, int spacedim>
deallog << "measure: " << cell->measure() << std::endl;
deallog << "diameter: " << cell->diameter() << std::endl;
}
+
+ const MappingFE<dim> mapping(Simplex::FE_P<dim>(1));
+
+ deallog << "diameter_min: " << GridTools::minimal_cell_diameter(tria, mapping)
+ << std::endl;
+ deallog << "diameter_max: " << GridTools::maximal_cell_diameter(tria, mapping)
+ << std::endl;
deallog << std::endl;
}
DEAL::dim=2 spacedim=2:
DEAL::measure: 0.500000
DEAL::diameter: 1.41421
+DEAL::diameter_min: 1.41421
+DEAL::diameter_max: 1.41421
DEAL::
DEAL::dim=3 spacedim=3:
DEAL::measure: 0.166667
DEAL::diameter: 1.41421
+DEAL::diameter_min: 1.41421
+DEAL::diameter_max: 1.41421
DEAL::