* denotes the indices of the vertices that bound it. And so on.
*/
void
- set_bounding_object_indices(const std::initializer_list<int> &o) const;
+ set_bounding_object_indices(
+ const std::initializer_list<int> &new_indices) const;
/**
* The same as above but for `unsigned int`.
*/
void
set_bounding_object_indices(
- const std::initializer_list<unsigned int> &o) const;
+ const std::initializer_list<unsigned int> &new_indices) const;
/**
* Set the flag indicating, what <code>line_orientation()</code> will
line_index(const TriaAccessor<2, dim, spacedim> &accessor,
const unsigned int i)
{
- return accessor.objects().get_object(accessor.present_index).face(i);
+ return accessor.objects().get_bounding_object_indices(
+ accessor.present_index)[i];
}
const unsigned int i)
{
return accessor.tria->levels[accessor.present_level]
- ->cells.get_object(accessor.present_index)
- .face(i);
+ ->cells.get_bounding_object_indices(accessor.present_index)[i];
}
vertex_index(const TriaAccessor<1, dim, spacedim> &accessor,
const unsigned int corner)
{
- return accessor.objects()
- .get_object(accessor.present_index)
- .face(corner);
+ return accessor.objects().get_bounding_object_indices(
+ accessor.present_index)[corner];
}
#include <deal.II/base/config.h>
-#include <deal.II/grid/tria_object.h>
#include <deal.II/grid/tria_objects.h>
#include <deal.II/base/point.h>
-#include <deal.II/grid/tria_object.h>
#include <deal.II/grid/tria_objects.h>
#include <boost/serialization/utility.hpp>
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 1998 - 2020 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-// ---------------------------------------------------------------------
-
-#ifndef dealii_tria_object_h
-#define dealii_tria_object_h
-
-
-#include <deal.II/base/config.h>
-
-#include <deal.II/base/array_view.h>
-#include <deal.II/base/exceptions.h>
-#include <deal.II/base/geometry_info.h>
-
-DEAL_II_NAMESPACE_OPEN
-
-namespace internal
-{
- namespace TriangulationImplementation
- {
- /**
- * View onto the current geometric object and its faces.
- *
- * @note The geometric objects are not saved as separate instances of
- * TriaObject but in a single vector in TriaObjects.
- */
- class TriaObject
- {
- public:
- /**
- * Constructor.
- *
- * @param faces ArrayView inside of the vector in TriaObjects.
- */
- TriaObject(const ArrayView<int> &faces)
- : faces(faces)
- {}
-
- /**
- * Store the content of @p other in the vector of TriaObjects.
- */
- TriaObject &
- operator=(const std::initializer_list<int> &other)
- {
- AssertDimension(faces.size(), other.size());
-
- const std::vector<int> other_v = other;
-
- for (unsigned int i = 0; i < faces.size(); ++i)
- faces[i] = other_v[i];
-
- return *this;
- }
-
- /**
- * The same as above but for `unsigned int`.
- */
- TriaObject &
- operator=(const std::initializer_list<unsigned int> &other)
- {
- AssertDimension(faces.size(), other.size());
-
- const std::vector<unsigned int> other_v = other;
-
- for (unsigned int i = 0; i < faces.size(); ++i)
- faces[i] = other_v[i];
-
- return *this;
- }
-
- /**
- * Return index of the @p i-th face.
- */
- int
- face(const unsigned int i) const
- {
- return faces[i];
- }
-
- /**
- * Set index of the @p i-th face.
- */
- void
- set_face(const unsigned int i, const int index)
- {
- faces[i] = index;
- }
-
- private:
- /**
- * List of face this object is made up.
- */
- const ArrayView<int> faces;
- };
- } // namespace TriangulationImplementation
-} // namespace internal
-
-
-DEAL_II_NAMESPACE_CLOSE
-
-#endif
#include <deal.II/base/exceptions.h>
#include <deal.II/base/geometry_info.h>
-#include <deal.II/grid/tria_object.h>
-
#include <vector>
DEAL_II_NAMESPACE_OPEN
n_objects() const;
/**
- * Return a view on the @p index-th geometric object.
+ * Return a view on the indices of the objects that bound the @p
+ * index-th object stored by the current object. For example, if
+ * the current object stores cells, then this function returns
+ * the equivalent of an array containing the indices of the
+ * faces that bound the @p index-th cell.
*/
- TriaObject
- get_object(const unsigned int index);
+ ArrayView<int>
+ get_bounding_object_indices(const unsigned int index);
/**
* Index of the even children of an object. Since when objects are
- inline TriaObject
- TriaObjects::get_object(const unsigned int index)
+ inline ArrayView<int>
+ TriaObjects::get_bounding_object_indices(const unsigned int index)
{
// assume that each cell has the same number of faces
else
AssertThrow(false, ExcNotImplemented());
- return {
- ArrayView<int>(cells.data() + index * faces_per_cell, faces_per_cell)};
+ return ArrayView<int>(cells.data() + index * faces_per_cell,
+ faces_per_cell);
}
for (const unsigned int q :
GeometryInfo<dim>::face_indices())
{
- const int index = triangulation.levels[l]
- ->cells.get_object(h)
- .face(q);
+ const int index =
+ triangulation.levels[l]
+ ->cells.get_bounding_object_indices(
+ h)[q];
if (index == switch_1_index)
triangulation.levels[l]
- ->cells.get_object(h)
- .set_face(q, switch_2_index);
+ ->cells.get_bounding_object_indices(
+ h)[q] = switch_2_index;
else if (index == switch_2_index)
triangulation.levels[l]
- ->cells.get_object(h)
- .set_face(q, switch_1_index);
+ ->cells.get_bounding_object_indices(
+ h)[q] = switch_1_index;
}
// now we have to copy
// all information of the
++l)
{
const int this_index =
- triangulation.faces->quads.get_object(q)
- .face(l);
+ triangulation.faces->quads
+ .get_bounding_object_indices(q)[l];
if (this_index == old_index_0)
- triangulation.faces->quads.get_object(q)
- .set_face(l, new_index_0);
+ triangulation.faces->quads
+ .get_bounding_object_indices(q)[l] =
+ new_index_0;
else if (this_index == old_index_1)
- triangulation.faces->quads.get_object(q)
- .set_face(l, new_index_1);
+ triangulation.faces->quads
+ .get_bounding_object_indices(q)[l] =
+ new_index_1;
}
// now we have to copy all information of
// the two lines
{
const int face_index =
triangulation.levels[l]
- ->cells.get_object(h)
- .face(q);
+ ->cells.get_bounding_object_indices(
+ h)[q];
if (face_index == switch_1_index)
triangulation.levels[l]
- ->cells.get_object(h)
- .set_face(q, switch_2_index);
+ ->cells.get_bounding_object_indices(
+ h)[q] = switch_2_index;
else if (face_index == switch_2_index)
triangulation.levels[l]
- ->cells.get_object(h)
- .set_face(q, switch_1_index);
+ ->cells.get_bounding_object_indices(
+ h)[q] = switch_1_index;
}
// now we have to copy all information of
// the two quads
template <int structdim, int dim, int spacedim>
void
TriaAccessor<structdim, dim, spacedim>::set_bounding_object_indices(
- const std::initializer_list<int> &object) const
+ const std::initializer_list<int> &new_indices) const
{
- this->objects().get_object(this->present_index) = object;
+ const ArrayView<int> bounding_object_index_ref =
+ this->objects().get_bounding_object_indices(this->present_index);
+
+ AssertDimension(bounding_object_index_ref.size(), new_indices.size());
+
+ unsigned int i = 0;
+ for (const auto &new_index : new_indices)
+ {
+ bounding_object_index_ref[i] = new_index;
+ ++i;
+ }
}
template <int structdim, int dim, int spacedim>
void
TriaAccessor<structdim, dim, spacedim>::set_bounding_object_indices(
- const std::initializer_list<unsigned int> &object) const
+ const std::initializer_list<unsigned int> &new_indices) const
{
- this->objects().get_object(this->present_index) = object;
+ const ArrayView<int> bounding_object_index_ref =
+ this->objects().get_bounding_object_indices(this->present_index);
+
+ AssertDimension(bounding_object_index_ref.size(), new_indices.size());
+
+ unsigned int i = 0;
+ for (const auto &new_index : new_indices)
+ {
+ bounding_object_index_ref[i] = new_index;
+ ++i;
+ }
}