--- /dev/null
+Deprecated: The CellStatus enumeration has been deprecated in the Triangulation<dim, spacedim> class and moved to the global deal.II namespace. As a consequence, all references to Triangulation<dim, spacedim>, parallel::distributed::Triangulation<dim, spacedim>::CellStatus, and similar should be updated to use CellStatus directly. Also, the enumeration values have been renamed: CELL_PERSIST -> cell_will_persist, CELL_REFINE -> cell_will_be_refined, CELL_COARSEN -> children_will_be_coarsened, CELL_INVALID -> cell_invalid).
+<br>
+(Pasquale Claudio Africa, 2023/07/03)
const unsigned int particle_weight = 10;
// This example does not use adaptive refinement, therefore every cell
- // should have the status `CELL_PERSIST`. However this function can also
- // be used to distribute load during refinement, therefore we consider
- // refined or coarsened cells as well.
+ // should have the status `CellStatus::cell_will_persist`. However this
+ // function can also be used to distribute load during refinement, therefore
+ // we consider refined or coarsened cells as well.
unsigned int n_particles_in_cell = 0;
switch (status)
{
- case CELL_PERSIST:
- case CELL_REFINE:
+ case CellStatus::cell_will_persist:
+ case CellStatus::cell_will_be_refined:
n_particles_in_cell = particle_handler.n_particles_in_cell(cell);
break;
- case CELL_INVALID:
+ case CellStatus::cell_invalid:
break;
- case CELL_COARSEN:
+ case CellStatus::children_will_be_coarsened:
for (const auto &child : cell->child_iterators())
n_particles_in_cell += particle_handler.n_particles_in_cell(child);
break;
const boost::iterator_range<std::vector<char>::const_iterator>
&data_range)
{
- Assert((status != CELL_COARSEN), ExcNotImplemented());
+ Assert((status != CellStatus::children_will_be_coarsened),
+ ExcNotImplemented());
(void)status;
matrix_dofs =
{
switch (status)
{
- case CELL_PERSIST:
- case CELL_REFINE:
+ case CellStatus::cell_will_persist:
+ case CellStatus::cell_will_be_refined:
// Cell either persists, or will be refined, and its children do
// not exist yet in the latter case.
*it_output = (**it_input)[cell->active_cell_index()];
break;
- case CELL_COARSEN:
+ case CellStatus::children_will_be_coarsened:
{
// Cell is parent whose children will get coarsened to.
// Decide data to store on parent by provided strategy.
for (; it_input != cell_data.cend(); ++it_input, ++it_output)
switch (status)
{
- case CELL_PERSIST:
- case CELL_COARSEN:
+ case CellStatus::cell_will_persist:
+ case CellStatus::children_will_be_coarsened:
// Cell either persists, or has been coarsened.
// Thus, cell has no (longer) children.
(**it_output)[cell->active_cell_index()] = *it_input;
break;
- case CELL_REFINE:
+ case CellStatus::cell_will_be_refined:
{
// Cell has been refined, and is now parent of its children.
// Thus, distribute parent's data on its children.
* will change in the private member vector local_cell_relations.
*
* As no adaptive mesh refinement is supported at the moment for this
- * class, all cells will be flagged with the CellStatus CELL_PERSIST.
+ * class, all cells will be flagged with CellStatus::cell_will_persist.
* These relations will currently only be used for serialization.
*
* The stored vector will have a size equal to the number of locally owned
DEAL_II_NAMESPACE_OPEN
/**
- * Used to inform functions in derived classes how the cell with the given
- * cell_iterator is going to change. Note that this may me different than
- * the refine_flag() and coarsen_flag() in the cell_iterator in parallel
- * calculations because of refinement constraints that this machine does not
- * see.
+ * The elements of this `enum` are used to inform functions how a specific cell
+ * is going to change. This is used in the course of transferring data from one
+ * mesh to a refined or coarsened version of the mesh, for example. Note that
+ * this may me different than the refine_flag() and coarsen_flag() set on a
+ * cell, for example in parallel calculations, because of refinement constraints
+ * that an individual machine does not see.
*/
-enum CellStatus
+enum class CellStatus : unsigned int
{
/**
* The cell will not be refined or coarsened and might or might not move
* to a different processor.
*/
- CELL_PERSIST,
+ cell_will_persist,
/**
* The cell will be or was refined.
*/
- CELL_REFINE,
+ cell_will_be_refined,
/**
* The children of this cell will be or were coarsened into this cell.
*/
- CELL_COARSEN,
+ children_will_be_coarsened,
/**
* Invalid status. Will not occur for the user.
*/
- CELL_INVALID
+ cell_invalid
};
DEAL_II_NAMESPACE_CLOSE
//
// ---------------------------------------------------------------------
-#ifndef dealii_tria_data_transfer_h
-#define dealii_tria_data_transfer_h
+#ifndef dealii_tria_data_serializer_h
+#define dealii_tria_data_serializer_h
#include <deal.II/base/config.h>
DEAL_II_NAMESPACE_OPEN
-template <int dim, int spacedim = dim>
-DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
-struct CellAttachedData
+namespace internal
{
- using cell_iterator = TriaIterator<CellAccessor<dim, spacedim>>;
-
- /**
- * Number of functions that get attached to the Triangulation through
- * register_data_attach() for example SolutionTransfer.
- */
- unsigned int n_attached_data_sets;
-
/**
- * Number of functions that need to unpack their data after a call from
- * load().
+ * A structure that binds information about data attached to cells.
*/
- unsigned int n_attached_deserialize;
-
- using pack_callback_t =
- std::function<std::vector<char>(cell_iterator, CellStatus)>;
-
- /**
- * These callback functions will be stored in the order in which they
- * have been registered with the register_data_attach() function.
- */
- std::vector<pack_callback_t> pack_callbacks_fixed;
- std::vector<pack_callback_t> pack_callbacks_variable;
-};
+ template <int dim, int spacedim = dim>
+ DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
+ struct CellAttachedData
+ {
+ using cell_iterator = TriaIterator<CellAccessor<dim, spacedim>>;
+
+ /**
+ * Number of functions that get attached to the Triangulation through
+ * register_data_attach() for example SolutionTransfer.
+ */
+ unsigned int n_attached_data_sets;
+
+ /**
+ * Number of functions that need to unpack their data after a call from
+ * load().
+ */
+ unsigned int n_attached_deserialize;
+
+ using pack_callback_t =
+ std::function<std::vector<char>(cell_iterator, CellStatus)>;
+
+ /**
+ * These callback functions will be stored in the order in which they
+ * have been registered with the register_data_attach() function.
+ */
+ std::vector<pack_callback_t> pack_callbacks_fixed;
+ std::vector<pack_callback_t> pack_callbacks_variable;
+ };
+} // namespace internal
/**
* A structure that stores information about the data that has been, or
* will be, attached to cells via the register_data_attach() function
* and later retrieved via notify_ready_to_unpack().
*
- * This class in the private scope of parallel::DistributedTriangulationBase
- * is dedicated to the data transfer across repartitioned meshes
- * and to/from the file system.
+ * This internalclass is dedicated to the data serialization and transfer across
+ * repartitioned meshes and to/from the file system.
*
- * It is designed to store all data buffers intended for transfer.
+ * It is designed to store all data buffers intended for serialization.
*/
template <int dim, int spacedim = dim>
DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
-class DataTransfer
+class CellAttachedDataSerializer
{
public:
using cell_iterator = TriaIterator<CellAccessor<dim, spacedim>>;
*/
using cell_relation_t = typename std::pair<cell_iterator, CellStatus>;
- DataTransfer(const MPI_Comm &mpi_communicator);
+ CellAttachedDataSerializer();
/**
- * Prepare data transfer by calling the pack callback functions on each
+ * Prepare data serialization by calling the pack callback functions on each
* cell in @p cell_relations.
*
* All registered callback functions in @p pack_callbacks_fixed will write
void
pack_data(
const std::vector<cell_relation_t> &cell_relations,
- const std::vector<typename CellAttachedData<dim, spacedim>::pack_callback_t>
+ const std::vector<
+ typename internal::CellAttachedData<dim, spacedim>::pack_callback_t>
&pack_callbacks_fixed,
- const std::vector<typename CellAttachedData<dim, spacedim>::pack_callback_t>
- &pack_callbacks_variable);
+ const std::vector<
+ typename internal::CellAttachedData<dim, spacedim>::pack_callback_t>
+ & pack_callbacks_variable,
+ const MPI_Comm &mpi_communicator);
/**
* Unpack the CellStatus information on each entry of
* @p cell_relations.
*
* Data has to be previously transferred with execute_transfer()
- * or read from the file system via load().
+ * or deserialized from the file system via load().
*/
void
unpack_cell_status(std::vector<cell_relation_t> &cell_relations) const;
/**
- * Unpack previously transferred data on each cell registered in
+ * Unpack previously serialized data on each cell registered in
* @p cell_relations with the provided @p unpack_callback function.
*
* The parameter @p handle corresponds to the position where the
* function that has been registered previously.
*
* Data has to be previously transferred with execute_transfer()
- * or read from the file system via load().
+ * or deserialized from the file system via load().
*/
void
unpack_data(
&unpack_callback) const;
/**
- * Transfer data to file system.
+ * Serialize data to file system.
*
* The data will be written in a separate file, whose name
* consists of the stem @p filename and an attached identifier
void
save(const unsigned int global_first_cell,
const unsigned int global_num_cells,
- const std::string &filename) const;
+ const std::string &filename,
+ const MPI_Comm & mpi_communicator) const;
/**
- * Transfer data from file system.
+ * Deserialize data from file system.
*
* The data will be read from separate file, whose name
* consists of the stem @p filename and an attached identifier
const unsigned int local_num_cells,
const std::string &filename,
const unsigned int n_attached_deserialize_fixed,
- const unsigned int n_attached_deserialize_variable);
+ const unsigned int n_attached_deserialize_variable,
+ const MPI_Comm & mpi_communicator);
/**
* Clears all containers and associated data, and resets member
std::vector<unsigned int> sizes_fixed_cumulative;
/**
- * Consecutive buffers designed for the fixed size transfer
+ * Consecutive buffers designed for the fixed size serialization
* functions.
*/
std::vector<char> src_data_fixed;
std::vector<char> dest_data_fixed;
/**
- * Consecutive buffers designed for the variable size transfer
+ * Consecutive buffers designed for the variable size serialization
* functions.
*/
std::vector<int> src_sizes_variable;
std::vector<int> dest_sizes_variable;
std::vector<char> src_data_variable;
std::vector<char> dest_data_variable;
-
-private:
- const MPI_Comm &mpi_communicator;
};
DEAL_II_NAMESPACE_CLOSE
#include <deal.II/grid/cell_id.h>
#include <deal.II/grid/cell_status.h>
-#include <deal.II/grid/data_transfer.h>
+#include <deal.II/grid/data_serializer.h>
#include <deal.II/grid/tria_description.h>
#include <deal.II/grid/tria_iterator_selector.h>
#include <deal.II/grid/tria_levels.h>
* @{
*/
- using CellStatus = ::dealii::CellStatus;
+ /**
+ * Alias for backward compatibility.
+ *
+ * @deprecated This enumeration has been moved to the global namespace.
+ * Use ::dealii::CellStatus instead. Also, its values have been renamed
+ * (CELL_PERSIST -> cell_will_persist,
+ * CELL_REFINE -> cell_will_be_refined,
+ * CELL_COARSEN -> children_will_be_coarsened,
+ * CELL_INVALID -> cell_invalid).
+ */
+ enum CellStatus
+ {
+ CELL_PERSIST DEAL_II_DEPRECATED =
+ static_cast<unsigned int>(::dealii::CellStatus::cell_will_persist),
+ CELL_REFINE DEAL_II_DEPRECATED =
+ static_cast<unsigned int>(::dealii::CellStatus::cell_will_be_refined),
+ CELL_COARSEN DEAL_II_DEPRECATED = static_cast<unsigned int>(
+ ::dealii::CellStatus::children_will_be_coarsened),
+ CELL_INVALID DEAL_II_DEPRECATED =
+ static_cast<unsigned int>(::dealii::CellStatus::cell_invalid)
+ };
/**
* A structure used to accumulate the results of the `weight` signal slot
* load of this cell.
*
* In serial and parallel shared applications, partitioning happens after
- * refinement. So all cells will have the `CELL_PERSIST` status.
+ * refinement. So all cells will have the `CellStatus::cell_will_persist`
+ * status.
*
* In parallel distributed applications, partitioning happens during
* refinement. If this cell is going to be coarsened, the signal is called
* parallel::CellWeights class.
*/
boost::signals2::signal<unsigned int(const cell_iterator &,
- const CellStatus),
+ const ::dealii::CellStatus),
CellWeightSum<unsigned int>>
weight;
*
* Specifically, the values for this argument mean the following:
*
- * - `CELL_PERSIST`: The cell won't be refined/coarsened, but might be
- * moved to a different processor. If this is the case, the callback
+ * - `CellStatus::cell_will_persist`: The cell won't be refined/coarsened, but
+ * might be moved to a different processor. If this is the case, the callback
* will want to pack up the data on this cell into an array and store
* it at the provided address for later unpacking wherever this cell
* may land.
- * - `CELL_REFINE`: This cell will be refined into 4 or 8 cells (in 2d
- * and 3d, respectively). However, because these children don't exist
- * yet, you cannot access them at the time when the callback is
- * called. Thus, in local_cell_relations, the corresponding
- * p4est quadrants of the children cells are linked to the deal.II
- * cell which is going to be refined. To be specific, only the very
- * first child is marked with `CELL_REFINE`, whereas the others will be
- * marked with `CELL_INVALID`, which indicates that these cells will be
+ * - `CellStatus::cell_will_be_refined`: This cell will be refined into 4 or 8
+ * cells (in 2d and 3d, respectively). However, because these children don't
+ * exist yet, you cannot access them at the time when the callback is called.
+ * Thus, in local_cell_relations, the corresponding p4est quadrants of the
+ * children cells are linked to the deal.II cell which is going to be refined.
+ * To be specific, only the very first child is marked with
+ * `CellStatus::cell_will_be_refined`, whereas the others will be marked with
+ * `CellStatus::cell_invalid`, which indicates that these cells will be
* ignored by default during the packing or unpacking process. This
* ensures that data is only transferred once onto or from the parent
- * cell. If the callback is called with `CELL_REFINE`, the callback
- * will want to pack up the data on this cell into an array and store
- * it at the provided address for later unpacking in a way so that
- * it can then be transferred to the children of the cell that will
- * then be available. In other words, if the data the callback
- * will want to pack up corresponds to a finite element field, then
- * the prolongation from parent to (new) children will have to happen
- * during unpacking.
- * - `CELL_COARSEN`: The children of this cell will be coarsened into the
- * given cell. These children still exist, so if this is the value
- * given to the callback as second argument, the callback will want
+ * cell. If the callback is called with `CellStatus::cell_will_be_refined`,
+ * the callback will want to pack up the data on this cell into an array and
+ * store it at the provided address for later unpacking in a way so that it
+ * can then be transferred to the children of the cell that will then be
+ * available. In other words, if the data the callback will want to pack up
+ * corresponds to a finite element field, then the prolongation from parent to
+ * (new) children will have to happen during unpacking.
+ * - `CellStatus::children_will_be_coarsened`: The children of this cell will
+ * be coarsened into the given cell. These children still exist, so if this is
+ * the value given to the callback as second argument, the callback will want
* to transfer data from the children to the current parent cell and
* pack it up so that it can later be unpacked again on a cell that
* then no longer has any children (and may also be located on a
* will want to pack up corresponds to a finite element field, then
* it will need to do the restriction from children to parent at
* this point.
- * - `CELL_INVALID`: See `CELL_REFINE`.
+ * - `CellStatus::cell_invalid`: See `CellStatus::cell_will_be_refined`.
*
* @note If this function is used for serialization of data
* using save() and load(), then the cell status argument with which
- * the callback is called will always be `CELL_PERSIST`.
+ * the callback is called will always be `CellStatus::cell_will_persist`.
*
* The callback function is expected to return a memory chunk of the
* format `std::vector<char>`, representing the packed data on a
unsigned int
register_data_attach(
const std::function<std::vector<char>(const cell_iterator &,
- const CellStatus)> &pack_callback,
+ const ::dealii::CellStatus)>
+ & pack_callback,
const bool returns_variable_size_data);
/**
* locally owned cell (if the cell was not refined), or the immediate
* parent if it was refined during execute_coarsening_and_refinement().
* Therefore, contrary to during register_data_attach(), you can now
- * access the children if the status is `CELL_REFINE` but no longer for
- * callbacks with status `CELL_COARSEN`.
+ * access the children if the status is `CellStatus::cell_will_be_refined` but
+ * no longer for callbacks with status
+ * `CellStatus::children_will_be_coarsened`.
*
* The first argument to this function, `handle`, corresponds to
* the return value of register_data_attach(). (The precise
const unsigned int handle,
const std::function<
void(const cell_iterator &,
- const CellStatus,
+ const ::dealii::CellStatus,
const boost::iterator_range<std::vector<char>::const_iterator> &)>
&unpack_callback);
- CellAttachedData<dim, spacedim> cell_attached_data;
+ internal::CellAttachedData<dim, spacedim> cell_attached_data;
protected:
/**
* respective CellStatus. To update its contents, use the
* update_cell_relations() member function.
*/
- std::vector<typename DataTransfer<dim, spacedim>::cell_relation_t>
+ std::vector<
+ typename CellAttachedDataSerializer<dim, spacedim>::cell_relation_t>
local_cell_relations;
- DataTransfer<dim, spacedim> data_transfer;
+ CellAttachedDataSerializer<dim, spacedim> data_serializer;
/**
* @}
*/
unsigned int fe_index = numbers::invalid_unsigned_int;
switch (status)
{
- case CELL_PERSIST:
- case CELL_REFINE:
- case CELL_INVALID:
+ case CellStatus::cell_will_persist:
+ case CellStatus::cell_will_be_refined:
+ case CellStatus::cell_invalid:
fe_index = cell->future_fe_index();
break;
- case CELL_COARSEN:
+ case CellStatus::children_will_be_coarsened:
#ifdef DEBUG
for (const auto &child : cell->child_iterators())
Assert(child->is_active() && child->coarsen_flag_set(),
for (const auto &cell : this->active_cell_iterators())
if (cell->is_locally_owned())
- this->local_cell_relations.emplace_back(cell, CELL_PERSIST);
+ this->local_cell_relations.emplace_back(
+ cell, ::dealii::CellStatus::cell_will_persist);
}
for (const auto &cell :
tria->active_cell_iterators() | IteratorFilters::LocallyOwnedCell())
weights[partitioner->global_to_local(cell->global_active_cell_index())] =
- weighting_function(cell, CELL_PERSIST);
+ weighting_function(cell, CellStatus::cell_will_persist);
// determine weight of all the cells locally owned by this process
std::uint64_t process_local_weight = 0;
{
switch (status)
{
- case CELL_PERSIST:
- case CELL_REFINE:
+ case CellStatus::cell_will_persist:
+ case CellStatus::cell_will_be_refined:
{
fe_index = cell->future_fe_index();
break;
}
- case CELL_COARSEN:
+ case CellStatus::children_will_be_coarsened:
{
// In case of coarsening, we need to find a suitable FE index
// for the parent cell. We choose the 'least dominant fe'
{
switch (status)
{
- case CELL_PERSIST:
- case CELL_COARSEN:
+ case CellStatus::cell_will_persist:
+ case CellStatus::children_will_be_coarsened:
{
fe_index = cell->active_fe_index();
break;
}
- case CELL_REFINE:
+ case CellStatus::cell_will_be_refined:
{
// After refinement, this particular cell is no longer active,
// and its children have inherited its FE index. However, to
// this active cell didn't change
// save pair into corresponding position
add_single_cell_relation<dim, spacedim>(
- cell_rel, tree, idx, dealii_cell, CELL_PERSIST);
+ cell_rel, tree, idx, dealii_cell, CellStatus::cell_will_persist);
}
else if (p4est_has_children) // based on the conditions above, we know that
// dealii_cell has no children
dealii::internal::p4est::functions<dim>::quadrant_childrenv(
&p4est_cell, p4est_child);
- // mark first child with CELL_REFINE and the remaining children with
- // CELL_INVALID, but associate them all with the parent cell unpack
- // algorithm will be called only on CELL_REFINE flagged quadrant
+ // mark first child with CellStatus::cell_will_be_refined and the
+ // remaining children with CellStatus::cell_invalid, but associate them
+ // all with the parent cell unpack algorithm will be called only on
+ // CellStatus::cell_will_be_refined flagged quadrant
int child_idx;
CellStatus cell_status;
for (unsigned int i = 0; i < GeometryInfo<dim>::max_children_per_cell;
&p4est_child[i],
dealii::internal::p4est::functions<dim>::quadrant_compare);
- cell_status = (i == 0) ? CELL_REFINE : CELL_INVALID;
+ cell_status = (i == 0) ? CellStatus::cell_will_be_refined :
+ CellStatus::cell_invalid;
add_single_cell_relation<dim, spacedim>(
cell_rel, tree, child_idx, dealii_cell, cell_status);
// its children got coarsened into this cell in p4est,
// but the dealii_cell still has its children
add_single_cell_relation<dim, spacedim>(
- cell_rel, tree, idx, dealii_cell, CELL_COARSEN);
+ cell_rel,
+ tree,
+ idx,
+ dealii_cell,
+ CellStatus::children_will_be_coarsened);
}
}
} // namespace
const typename dealii::internal::p4est::types<dim>::gloidx
*previous_global_first_quadrant)
{
- Assert(this->data_transfer.sizes_fixed_cumulative.size() > 0,
+ Assert(this->data_serializer.sizes_fixed_cumulative.size() > 0,
ExcMessage("No data has been packed!"));
// Resize memory according to the data that we will receive.
- this->data_transfer.dest_data_fixed.resize(
+ this->data_serializer.dest_data_fixed.resize(
parallel_forest->local_num_quadrants *
- this->data_transfer.sizes_fixed_cumulative.back());
+ this->data_serializer.sizes_fixed_cumulative.back());
// Execute non-blocking fixed size transfer.
typename dealii::internal::p4est::types<dim>::transfer_context
previous_global_first_quadrant,
parallel_forest->mpicomm,
0,
- this->data_transfer.dest_data_fixed.data(),
- this->data_transfer.src_data_fixed.data(),
- this->data_transfer.sizes_fixed_cumulative.back());
+ this->data_serializer.dest_data_fixed.data(),
+ this->data_serializer.src_data_fixed.data(),
+ this->data_serializer.sizes_fixed_cumulative.back());
- if (this->data_transfer.variable_size_data_stored)
+ if (this->data_serializer.variable_size_data_stored)
{
// Resize memory according to the data that we will receive.
- this->data_transfer.dest_sizes_variable.resize(
+ this->data_serializer.dest_sizes_variable.resize(
parallel_forest->local_num_quadrants);
// Execute fixed size transfer of data sizes for variable size
previous_global_first_quadrant,
parallel_forest->mpicomm,
1,
- this->data_transfer.dest_sizes_variable.data(),
- this->data_transfer.src_sizes_variable.data(),
+ this->data_serializer.dest_sizes_variable.data(),
+ this->data_serializer.src_sizes_variable.data(),
sizeof(unsigned int));
}
dealii::internal::p4est::functions<dim>::transfer_fixed_end(tf_context);
// Release memory of previously packed data.
- this->data_transfer.src_data_fixed.clear();
- this->data_transfer.src_data_fixed.shrink_to_fit();
+ this->data_serializer.src_data_fixed.clear();
+ this->data_serializer.src_data_fixed.shrink_to_fit();
- if (this->data_transfer.variable_size_data_stored)
+ if (this->data_serializer.variable_size_data_stored)
{
// Resize memory according to the data that we will receive.
- this->data_transfer.dest_data_variable.resize(
- std::accumulate(this->data_transfer.dest_sizes_variable.begin(),
- this->data_transfer.dest_sizes_variable.end(),
+ this->data_serializer.dest_data_variable.resize(
+ std::accumulate(this->data_serializer.dest_sizes_variable.begin(),
+ this->data_serializer.dest_sizes_variable.end(),
std::vector<int>::size_type(0)));
# if DEAL_II_P4EST_VERSION_GTE(2, 0, 65, 0)
// at all, which is mandatory if one of our processes does not own
// any quadrant. This bypasses the assertion from being triggered.
// - see: https://github.com/cburstedde/p4est/issues/48
- if (this->data_transfer.src_sizes_variable.size() == 0)
- this->data_transfer.src_sizes_variable.resize(1);
- if (this->data_transfer.dest_sizes_variable.size() == 0)
- this->data_transfer.dest_sizes_variable.resize(1);
+ if (this->data_serializer.src_sizes_variable.size() == 0)
+ this->data_serializer.src_sizes_variable.resize(1);
+ if (this->data_serializer.dest_sizes_variable.size() == 0)
+ this->data_serializer.dest_sizes_variable.resize(1);
# endif
// Execute variable size transfer.
previous_global_first_quadrant,
parallel_forest->mpicomm,
1,
- this->data_transfer.dest_data_variable.data(),
- this->data_transfer.dest_sizes_variable.data(),
- this->data_transfer.src_data_variable.data(),
- this->data_transfer.src_sizes_variable.data());
+ this->data_serializer.dest_data_variable.data(),
+ this->data_serializer.dest_sizes_variable.data(),
+ this->data_serializer.src_data_variable.data(),
+ this->data_serializer.src_sizes_variable.data());
// Release memory of previously packed data.
- this->data_transfer.src_sizes_variable.clear();
- this->data_transfer.src_sizes_variable.shrink_to_fit();
- this->data_transfer.src_data_variable.clear();
- this->data_transfer.src_data_variable.shrink_to_fit();
+ this->data_serializer.src_sizes_variable.clear();
+ this->data_serializer.src_sizes_variable.shrink_to_fit();
+ this->data_serializer.src_data_variable.clear();
+ this->data_serializer.src_data_variable.shrink_to_fit();
}
}
<< this->n_cells(0) << std::endl;
}
- // each cell should have been flagged `CELL_PERSIST`
+ // each cell should have been flagged `CellStatus::cell_will_persist`
for (const auto &cell_rel : this->local_cell_relations)
{
(void)cell_rel;
Assert((cell_rel.second == // cell_status
- CELL_PERSIST),
+ CellStatus::cell_will_persist),
ExcInternalError());
}
// pack data before triangulation gets updated
if (this->cell_attached_data.n_attached_data_sets > 0)
{
- this->data_transfer.pack_data(
+ this->data_serializer.pack_data(
this->local_cell_relations,
this->cell_attached_data.pack_callbacks_fixed,
- this->cell_attached_data.pack_callbacks_variable);
+ this->cell_attached_data.pack_callbacks_variable,
+ this->get_communicator());
}
// finally copy back from local part of tree to deal.II
previous_global_first_quadrant.data());
// also update the CellStatus information on the new mesh
- this->data_transfer.unpack_cell_status(this->local_cell_relations);
+ this->data_serializer.unpack_cell_status(this->local_cell_relations);
}
# ifdef DEBUG
// pack data before triangulation gets updated
if (this->cell_attached_data.n_attached_data_sets > 0)
{
- this->data_transfer.pack_data(
+ this->data_serializer.pack_data(
this->local_cell_relations,
this->cell_attached_data.pack_callbacks_fixed,
- this->cell_attached_data.pack_callbacks_variable);
+ this->cell_attached_data.pack_callbacks_variable,
+ this->get_communicator());
}
try
switch (status)
{
- case CELL_PERSIST:
+ case CellStatus::cell_will_persist:
// cell remains unchanged
cell->clear_refine_flag();
cell->clear_coarsen_flag();
break;
- case CELL_REFINE:
+ case CellStatus::cell_will_be_refined:
// cell will be refined
cell->clear_coarsen_flag();
cell->set_refine_flag();
break;
- case CELL_COARSEN:
+ case CellStatus::children_will_be_coarsened:
// children of this cell will be coarsened
for (const auto &child : cell->child_iterators())
{
}
break;
- case CELL_INVALID:
+ case CellStatus::cell_invalid:
// do nothing as cell does not exist yet
break;
set(_unity_include_src
cell_id.cc
- data_transfer.cc
+ data_serializer.cc
grid_refinement.cc
intergrid_map.cc
manifold.cc
set(_inst
cell_id.inst.in
- data_transfer.inst.in
+ data_serializer.inst.in
grid_generator_cgal.inst.in
grid_generator_from_name.inst.in
grid_generator.inst.in
#include <deal.II/base/geometry_info.h>
-#include <deal.II/grid/data_transfer.h>
+#include <deal.II/grid/data_serializer.h>
#include <deal.II/grid/tria_accessor.h>
#include <utility>
template <int dim, int spacedim>
DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
-DataTransfer<dim, spacedim>::DataTransfer(const MPI_Comm &mpi_communicator)
+CellAttachedDataSerializer<dim, spacedim>::CellAttachedDataSerializer()
: variable_size_data_stored(false)
- , mpi_communicator(mpi_communicator)
{}
template <int dim, int spacedim>
DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
-void DataTransfer<dim, spacedim>::pack_data(
+void CellAttachedDataSerializer<dim, spacedim>::pack_data(
const std::vector<cell_relation_t> &cell_relations,
- const std::vector<typename CellAttachedData<dim, spacedim>::pack_callback_t>
+ const std::vector<
+ typename internal::CellAttachedData<dim, spacedim>::pack_callback_t>
&pack_callbacks_fixed,
- const std::vector<typename CellAttachedData<dim, spacedim>::pack_callback_t>
- &pack_callbacks_variable)
+ const std::vector<
+ typename internal::CellAttachedData<dim, spacedim>::pack_callback_t>
+ & pack_callbacks_variable,
+ const MPI_Comm &mpi_communicator)
{
Assert(src_data_fixed.size() == 0,
ExcMessage("Previously packed data has not been released yet!"));
// Assertions about the tree structure.
switch (cell_status)
{
- case CELL_PERSIST:
- case CELL_REFINE:
+ case CellStatus::cell_will_persist:
+ case CellStatus::cell_will_be_refined:
// double check the condition that we will only ever attach
// data to active cells when we get here
Assert(dealii_cell->is_active(), ExcInternalError());
break;
- case CELL_COARSEN:
+ case CellStatus::children_will_be_coarsened:
// double check the condition that we will only ever attach
// data to cells with children when we get here. however, we
// can only tolerate one level of coarsening at a time, so
Assert(dealii_cell->child(c)->is_active(), ExcInternalError());
break;
- case CELL_INVALID:
+ case CellStatus::cell_invalid:
// do nothing on invalid cells
break;
// room for an array that holds information about how many
// bytes each of the variable size callback functions will
// write.
- // On cells flagged with CELL_INVALID, only its CellStatus
+ // On cells flagged with CellStatus::cell_invalid, only its CellStatus
// will be stored.
const unsigned int n_fixed_size_data_sets_on_cell =
- 1 + ((cell_status == CELL_INVALID) ?
+ 1 + ((cell_status == CellStatus::cell_invalid) ?
0 :
((variable_size_data_stored ? 1 : 0) + n_callbacks_fixed));
data_cell_fixed_it->resize(n_fixed_size_data_sets_on_cell);
++data_fixed_it;
// Proceed with all registered callback functions.
- // Skip cells with the CELL_INVALID flag.
- if (cell_status != CELL_INVALID)
+ // Skip cells with the CellStatus::cell_invalid flag.
+ if (cell_status != CellStatus::cell_invalid)
{
// Pack fixed size data.
for (auto callback_it = pack_callbacks_fixed.cbegin();
if (variable_size_data_stored)
{
const unsigned int n_variable_size_data_sets_on_cell =
- ((cell_status == CELL_INVALID) ? 0 : n_callbacks_variable);
+ ((cell_status == CellStatus::cell_invalid) ?
+ 0 :
+ n_callbacks_variable);
data_cell_variable_it->resize(
n_variable_size_data_sets_on_cell);
// Generate a vector which stores the sizes of each callback function,
// including the packed CellStatus transfer.
// Find the very first cell that we wrote to with all callback
- // functions (i.e. a cell that was not flagged with CELL_INVALID)
+ // functions (i.e. a cell that was not flagged with CellStatus::cell_invalid)
// and store the sizes of each buffer.
//
// To deal with the case that at least one of the processors does not
// of all callback functions across all processors, in case one
// of them does not own any cells at all.
std::vector<unsigned int> global_sizes_fixed(local_sizes_fixed.size());
- Utilities::MPI::max(local_sizes_fixed,
- this->mpi_communicator,
- global_sizes_fixed);
+ Utilities::MPI::max(local_sizes_fixed, mpi_communicator, global_sizes_fixed);
// Construct cumulative sizes, since this is the only information
// we need from now on.
std::back_inserter(src_data_fixed));
// If we only packed the CellStatus information
- // (i.e. encountered a cell flagged CELL_INVALID),
+ // (i.e. encountered a cell flagged CellStatus::cell_invalid),
// fill the remaining space with invalid entries.
// We can skip this if there is nothing else to pack.
if ((data_cell_fixed.size() == 1) && (sizes_fixed_cumulative.size() > 1))
template <int dim, int spacedim>
DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
-void DataTransfer<dim, spacedim>::unpack_cell_status(
- std::vector<typename DataTransfer<dim, spacedim>::cell_relation_t>
+void CellAttachedDataSerializer<dim, spacedim>::unpack_cell_status(
+ std::vector<
+ typename CellAttachedDataSerializer<dim, spacedim>::cell_relation_t>
&cell_relations) const
{
Assert(sizes_fixed_cumulative.size() > 0,
template <int dim, int spacedim>
DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
-void DataTransfer<dim, spacedim>::unpack_data(
- const std::vector<typename DataTransfer<dim, spacedim>::cell_relation_t>
+void CellAttachedDataSerializer<dim, spacedim>::unpack_data(
+ const std::vector<
+ typename CellAttachedDataSerializer<dim, spacedim>::cell_relation_t>
& cell_relations,
const unsigned int handle,
const std::function<
// of the current cell.
data_increment = *dest_sizes_it;
- if (cell_status != CELL_INVALID)
+ if (cell_status != CellStatus::cell_invalid)
{
// Extract the corresponding values for offset and size from
// the cumulative sizes array stored in the fixed size
switch (cell_status)
{
- case CELL_PERSIST:
- case CELL_COARSEN:
+ case CellStatus::cell_will_persist:
+ case CellStatus::children_will_be_coarsened:
unpack_callback(dealii_cell,
cell_status,
boost::make_iterator_range(dest_data_it,
dest_data_it + size));
break;
- case CELL_REFINE:
+ case CellStatus::cell_will_be_refined:
unpack_callback(dealii_cell->parent(),
cell_status,
boost::make_iterator_range(dest_data_it,
dest_data_it + size));
break;
- case CELL_INVALID:
+ case CellStatus::cell_invalid:
// Skip this cell.
break;
template <int dim, int spacedim>
DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
-void DataTransfer<dim, spacedim>::save(const unsigned int global_first_cell,
- const unsigned int global_num_cells,
- const std::string &filename) const
+void CellAttachedDataSerializer<dim, spacedim>::save(
+ const unsigned int global_first_cell,
+ const unsigned int global_num_cells,
+ const std::string &filename,
+ const MPI_Comm & mpi_communicator) const
{
Assert(sizes_fixed_cumulative.size() > 0,
ExcMessage("No data has been packed!"));
template <int dim, int spacedim>
DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
-void DataTransfer<dim, spacedim>::load(
+void CellAttachedDataSerializer<dim, spacedim>::load(
const unsigned int global_first_cell,
const unsigned int global_num_cells,
const unsigned int local_num_cells,
const std::string &filename,
const unsigned int n_attached_deserialize_fixed,
- const unsigned int n_attached_deserialize_variable)
+ const unsigned int n_attached_deserialize_variable,
+ const MPI_Comm & mpi_communicator)
{
Assert(dest_data_fixed.size() == 0,
ExcMessage("Previously loaded data has not been released yet!"));
template <int dim, int spacedim>
DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
-void DataTransfer<dim, spacedim>::clear()
+void CellAttachedDataSerializer<dim, spacedim>::clear()
{
variable_size_data_stored = false;
}
// explicit instantiations
-#include "data_transfer.inst"
+#include "data_serializer.inst"
DEAL_II_NAMESPACE_CLOSE
for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS)
{
#if deal_II_dimension <= deal_II_space_dimension
- template class DataTransfer<deal_II_dimension, deal_II_space_dimension>;
+ template class CellAttachedDataSerializer<deal_II_dimension,
+ deal_II_space_dimension>;
#endif
}
for (const auto &cell : triangulation.active_cell_iterators())
if (cell->is_locally_owned())
cell_weights[cell->active_cell_index()] =
- triangulation.signals.weight(cell, CELL_PERSIST);
+ triangulation.signals.weight(cell, CellStatus::cell_will_persist);
// If this is a parallel triangulation, we then need to also
// get the weights for all other cells. We have asserted above
for (const auto &cell : triangulation.active_cell_iterators() |
IteratorFilters::LocallyOwnedCell())
cell_weights[cell->active_cell_index()] =
- triangulation.signals.weight(cell, CELL_PERSIST);
+ triangulation.signals.weight(cell, CellStatus::cell_will_persist);
// If this is a parallel triangulation, we then need to also
// get the weights for all other cells. We have asserted above
const MeshSmoothing smooth_grid,
const bool check_for_distorted_cells)
: cell_attached_data({0, 0, {}, {}})
- , data_transfer(get_communicator())
, smooth_grid(smooth_grid)
, anisotropic_refinement(false)
, check_for_distorted_cells(check_for_distorted_cells)
Triangulation<dim, spacedim>::Triangulation(
Triangulation<dim, spacedim> &&tria) noexcept
: Subscriptor(std::move(tria))
- , data_transfer(get_communicator())
, smooth_grid(tria.smooth_grid)
, reference_cells(std::move(tria.reference_cells))
, periodic_face_pairs_level_0(std::move(tria.periodic_face_pairs_level_0))
reference_cells.clear();
cell_attached_data = {0, 0, {}, {}};
- data_transfer.clear();
+ data_serializer.clear();
}
DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
unsigned int Triangulation<dim, spacedim>::register_data_attach(
const std::function<std::vector<char>(const cell_iterator &,
- const CellStatus)> &pack_callback,
+ const ::dealii::CellStatus)>
+ & pack_callback,
const bool returns_variable_size_data)
{
unsigned int handle = numbers::invalid_unsigned_int;
const unsigned int handle,
const std::function<
void(const cell_iterator &,
- const CellStatus,
+ const ::dealii::CellStatus,
const boost::iterator_range<std::vector<char>::const_iterator> &)>
&unpack_callback)
{
// perform unpacking
- this->data_transfer.unpack_data(this->local_cell_relations,
- handle,
- unpack_callback);
+ this->data_serializer.unpack_data(this->local_cell_relations,
+ handle,
+ unpack_callback);
// decrease counters
--this->cell_attached_data.n_attached_data_sets;
// everybody got their data, time for cleanup!
this->cell_attached_data.pack_callbacks_fixed.clear();
this->cell_attached_data.pack_callbacks_variable.clear();
- this->data_transfer.clear();
+ this->data_serializer.clear();
// reset all cell_status entries after coarsening/refinement
for (auto &cell_rel : this->local_cell_relations)
- cell_rel.second = CELL_PERSIST;
+ cell_rel.second = ::dealii::CellStatus::cell_will_persist;
}
}
if (this->cell_attached_data.n_attached_data_sets > 0)
{
// pack attached data first
- tria->data_transfer.pack_data(
+ tria->data_serializer.pack_data(
tria->local_cell_relations,
tria->cell_attached_data.pack_callbacks_fixed,
- tria->cell_attached_data.pack_callbacks_variable);
+ tria->cell_attached_data.pack_callbacks_variable,
+ this->get_communicator());
// then store buffers in file
- tria->data_transfer.save(global_first_cell, global_num_cells, filename);
+ tria->data_serializer.save(global_first_cell,
+ global_num_cells,
+ filename,
+ this->get_communicator());
// and release the memory afterwards
- tria->data_transfer.clear();
+ tria->data_serializer.clear();
}
// clear all of the callback data, as explained in the documentation of
// load saved data, if any was stored
if (this->cell_attached_data.n_attached_deserialize > 0)
{
- this->data_transfer.load(global_first_cell,
- global_num_cells,
- local_num_cells,
- filename,
- n_attached_deserialize_fixed,
- n_attached_deserialize_variable);
-
- this->data_transfer.unpack_cell_status(this->local_cell_relations);
-
- // the CellStatus of all stored cells should always be CELL_PERSIST.
+ this->data_serializer.load(global_first_cell,
+ global_num_cells,
+ local_num_cells,
+ filename,
+ n_attached_deserialize_fixed,
+ n_attached_deserialize_variable,
+ this->get_communicator());
+
+ this->data_serializer.unpack_cell_status(this->local_cell_relations);
+
+ // the CellStatus of all stored cells should always be
+ // CellStatus::cell_will_persist.
for (const auto &cell_rel : this->local_cell_relations)
{
(void)cell_rel;
Assert((cell_rel.second == // cell_status
- CELL_PERSIST),
+ ::dealii::CellStatus::cell_will_persist),
ExcInternalError());
}
}
switch (status)
{
- case CELL_PERSIST:
- case CELL_REFINE:
+ case CellStatus::cell_will_persist:
+ case CellStatus::cell_will_be_refined:
// If the cell persist or is refined store all particles of the
// current cell.
{
}
break;
- case CELL_COARSEN:
+ case CellStatus::children_will_be_coarsened:
// If this cell is the parent of children that will be coarsened,
// collect the particles of all children.
{
return;
const auto cell_to_store_particles =
- (status != CELL_REFINE) ? cell : cell->child(0);
+ (status != CellStatus::cell_will_be_refined) ? cell : cell->child(0);
// deserialize particles and insert into local storage
if (data_range.begin() != data_range.end())
// now update particle storage location and properties if necessary
switch (status)
{
- case CELL_PERSIST:
+ case CellStatus::cell_will_persist:
{
// all particles are correctly inserted
}
break;
- case CELL_COARSEN:
+ case CellStatus::children_will_be_coarsened:
{
// all particles are in correct cell, but their reference location
// has changed
}
break;
- case CELL_REFINE:
+ case CellStatus::cell_will_be_refined:
{
// we need to find the correct child to store the particles and
// their reference location has changed
static int some_number = 0;
deallog << "packing cell " << cell->id() << " with data=" << some_number
<< " status=";
- if (status == CELL_PERSIST)
+ if (status == CellStatus::cell_will_persist)
deallog << "PERSIST";
- else if (status == CELL_REFINE)
+ else if (status == CellStatus::cell_will_be_refined)
deallog << "REFINE";
- else if (status == CELL_COARSEN)
+ else if (status == CellStatus::children_will_be_coarsened)
deallog << "COARSEN";
deallog << std::endl;
- if (status == CELL_COARSEN)
+ if (status == CellStatus::children_will_be_coarsened)
{
Assert(cell->has_children(), ExcInternalError());
}
deallog << "unpacking cell " << cell->id() << " with data=" << intdata
<< " status=";
- if (status == CELL_PERSIST)
+ if (status == CellStatus::cell_will_persist)
deallog << "PERSIST";
- else if (status == CELL_REFINE)
+ else if (status == CellStatus::cell_will_be_refined)
deallog << "REFINE";
- else if (status == CELL_COARSEN)
+ else if (status == CellStatus::children_will_be_coarsened)
deallog << "COARSEN";
deallog << std::endl;
- if (status == CELL_REFINE)
+ if (status == CellStatus::cell_will_be_refined)
{
Assert(cell->has_children(), ExcInternalError());
}
<< " with data size =" << buffer.size() << " accumulated data="
<< std::accumulate(some_vector.begin(), some_vector.end(), 0)
<< " status=";
- if (status == CELL_PERSIST)
+ if (status == CellStatus::cell_will_persist)
deallog << "PERSIST";
- else if (status == CELL_REFINE)
+ else if (status == CellStatus::cell_will_be_refined)
deallog << "REFINE";
- else if (status == CELL_COARSEN)
+ else if (status == CellStatus::children_will_be_coarsened)
deallog << "COARSEN";
deallog << std::endl;
- if (status == CELL_COARSEN)
+ if (status == CellStatus::children_will_be_coarsened)
{
Assert(cell->has_children(), ExcInternalError());
}
<< " accumulated data="
<< std::accumulate(intdatavector.begin(), intdatavector.end(), 0)
<< " status=";
- if (status == CELL_PERSIST)
+ if (status == CellStatus::cell_will_persist)
deallog << "PERSIST";
- else if (status == CELL_REFINE)
+ else if (status == CellStatus::cell_will_be_refined)
deallog << "REFINE";
- else if (status == CELL_COARSEN)
+ else if (status == CellStatus::children_will_be_coarsened)
deallog << "COARSEN";
deallog << std::endl;
- if (status == CELL_REFINE)
+ if (status == CellStatus::cell_will_be_refined)
{
Assert(cell->has_children(), ExcInternalError());
}
std::vector<unsigned int> integrated_weights(numproc, 0);
for (const auto &cell :
tr.active_cell_iterators() | IteratorFilters::LocallyOwnedCell())
- integrated_weights[myid] += cell_weight<dim>(cell, CELL_PERSIST);
+ integrated_weights[myid] +=
+ cell_weight<dim>(cell, CellStatus::cell_will_persist);
Utilities::MPI::sum(integrated_weights, MPI_COMM_WORLD, integrated_weights);
if (myid == 0)
std::vector<unsigned int> integrated_weights(numproc, 0);
for (const auto &cell :
tr.active_cell_iterators() | IteratorFilters::LocallyOwnedCell())
- integrated_weights[myid] += cell_weight<dim>(cell, CELL_PERSIST);
+ integrated_weights[myid] +=
+ cell_weight<dim>(cell, CellStatus::cell_will_persist);
Utilities::MPI::sum(integrated_weights, MPI_COMM_WORLD, integrated_weights);
if (myid == 0)
std::vector<unsigned int> integrated_weights(numproc, 0);
for (const auto &cell :
tr.active_cell_iterators() | IteratorFilters::LocallyOwnedCell())
- integrated_weights[myid] += cell_weight<dim>(cell, CELL_PERSIST);
+ integrated_weights[myid] +=
+ cell_weight<dim>(cell, CellStatus::cell_will_persist);
Utilities::MPI::sum(integrated_weights, MPI_COMM_WORLD, integrated_weights);
if (myid == 0)
std::vector<unsigned int> integrated_weights(numproc, 0);
for (const auto &cell :
tr.active_cell_iterators() | IteratorFilters::LocallyOwnedCell())
- integrated_weights[myid] += cell_weight<dim>(cell, CELL_PERSIST);
+ integrated_weights[myid] +=
+ cell_weight<dim>(cell, CellStatus::cell_will_persist);
Utilities::MPI::sum(integrated_weights, MPI_COMM_WORLD, integrated_weights);
if (myid == 0)
<< std::accumulate(some_vector.begin(), some_vector.end(), 0)
<< std::endl;
- Assert((status == CELL_PERSIST), ExcInternalError());
+ Assert((status == CellStatus::cell_will_persist), ExcInternalError());
++some_number;
return buffer;
<< std::accumulate(intdatavector.begin(), intdatavector.end(), 0)
<< std::endl;
- Assert((status == CELL_PERSIST), ExcInternalError());
+ Assert((status == CellStatus::cell_will_persist), ExcInternalError());
}
<< std::accumulate(some_vector.begin(), some_vector.end(), 0)
<< std::endl;
- Assert((status == CELL_PERSIST), ExcInternalError());
+ Assert((status == CellStatus::cell_will_persist), ExcInternalError());
++some_number;
return buffer;
<< std::accumulate(intdatavector.begin(), intdatavector.end(), 0)
<< std::endl;
- Assert((status == CELL_PERSIST), ExcInternalError());
+ Assert((status == CellStatus::cell_will_persist), ExcInternalError());
}
static int some_number = cell->index();
deallog << "packing cell " << cell->id() << " with data=" << some_number
<< " status=";
- if (status == CELL_PERSIST)
+ if (status == CellStatus::cell_will_persist)
deallog << "PERSIST";
- else if (status == CELL_REFINE)
+ else if (status == CellStatus::cell_will_be_refined)
deallog << "REFINE";
- else if (status == CELL_COARSEN)
+ else if (status == CellStatus::children_will_be_coarsened)
deallog << "COARSEN";
deallog << std::endl;
- if (status == CELL_COARSEN)
+ if (status == CellStatus::children_will_be_coarsened)
{
Assert(cell->has_children(), ExcInternalError());
}
deallog << "unpacking cell " << cell->id() << " with data=" << number
<< " status=";
- if (status == CELL_PERSIST)
+ if (status == CellStatus::cell_will_persist)
deallog << "PERSIST";
- else if (status == CELL_REFINE)
+ else if (status == CellStatus::cell_will_be_refined)
deallog << "REFINE";
- else if (status == CELL_COARSEN)
+ else if (status == CellStatus::children_will_be_coarsened)
deallog << "COARSEN";
deallog << std::endl;
- if (status == CELL_REFINE)
+ if (status == CellStatus::cell_will_be_refined)
{
Assert(cell->has_children(), ExcInternalError());
}
unsigned int n_particles_in_cell = 0;
switch (status)
{
- case CELL_PERSIST:
- case CELL_REFINE:
+ case CellStatus::cell_will_persist:
+ case CellStatus::cell_will_be_refined:
n_particles_in_cell = particle_handler.n_particles_in_cell(cell);
break;
- case CELL_INVALID:
+ case CellStatus::cell_invalid:
break;
- case CELL_COARSEN:
+ case CellStatus::children_will_be_coarsened:
for (const auto &child : cell->child_iterators())
n_particles_in_cell +=
particle_handler.n_particles_in_cell(child);
const unsigned int particle_weight = 10;
// This example does not use adaptive refinement, therefore every cell
- // should have the status `CELL_PERSIST`. However this function can also
- // be used to distribute load during refinement, therefore we consider
- // refined or coarsened cells as well.
+ // should have the status `CellStatus::cell_will_persist`. However this
+ // function can also be used to distribute load during refinement, therefore
+ // we consider refined or coarsened cells as well.
unsigned int n_particles_in_cell = 0;
switch (status)
{
- case CELL_PERSIST:
- case CELL_REFINE:
+ case CellStatus::cell_will_persist:
+ case CellStatus::cell_will_be_refined:
n_particles_in_cell = particle_handler.n_particles_in_cell(cell);
break;
- case CELL_INVALID:
+ case CellStatus::cell_invalid:
break;
- case CELL_COARSEN:
+ case CellStatus::children_will_be_coarsened:
for (const auto &child : cell->child_iterators())
n_particles_in_cell += particle_handler.n_particles_in_cell(child);
break;