Adaptivity

GridapDistributed.redistributeMethod

Redistributes an DistributedDiscreteModel to optimally rebalance the loads between the processors. Returns the rebalanced model and a RedistributeGlue instance.

source
GridapDistributed.redistribute_cartesianMethod
redistribute_cartesian(old_model,new_ranks,new_parts)
redistribute_cartesian(old_model,pdesc::DistributedCartesianDescriptor)

Redistributes a DistributedCartesianDiscreteModel to a new set of ranks and parts. Only redistributes into a superset of the old_model ranks (i.e. towards more processors).

source
GridapDistributed.refine_cell_gidsMethod
refine_cell_gids(
  cmodel::DistributedDiscreteModel{Dc},
  fmodels::AbstractArray{<:DiscreteModel{Dc}}
) where Dc

Given a coarse model and it's local refined models, returns the gids of the fine model. The gids are computed as follows:

  • First, we create a global numbering for the owned cells by adding an owner-based offset to the local cell ids (such that cells belonging to the first processor are numbered first). This is quite standard.
  • The complicated part is making this numeration consistent, i.e communicating gids of the ghost cells. To do so, each processor selects it's ghost fine cells, and requests their global ids by sending two keys:
    1. The global id of the coarse parent
    2. The child id of the fine cell
source
GridapDistributed.refine_local_modelsMethod
refine_local_models(cmodel::DistributedDiscreteModel{Dc},args...;kwargs...) where Dc

Given a coarse model, returns the locally refined models. This is done by

  • refining the local models serially
  • filtering out the extra fine layers of ghosts

We also return the ids of the owned fine cells.

To find the fine cells we want to keep, we have the following criteria:

  • Given a fine cell, it is owned iff A) It's parent cell is owned
  • Given a fine cell, it is a ghost iff not(A) and B) It has at least one neighbor with a non-ghost parent

Instead of checking A and B, we do the following:

  • We mark fine owned cells by checking A
  • If a cell is owned, we set it's fine neighbors as owned or ghost
source
GridapDistributed.RedistributeGlueType

RedistributeGlue

Glue linking two distributions of the same mesh.

  • new_parts: Array with the new part IDs (and comms)
  • old_parts: Array with the old part IDs (and comms)
  • parts_rcv: Array with the part IDs from which each part receives
  • parts_snd: Array with the part IDs to which each part sends
  • lids_rcv : Local IDs of the entries that are received from each part
  • lids_snd : Local IDs of the entries that are sent to each part
  • old2new : Mapping of local IDs from the old to the new mesh
  • new2old : Mapping of local IDs from the new to the old mesh
source
GridapDistributed.redistributeMethod
redistribute(v::PVector,new_indices)
redistribute!(w::PVector,v::PVector,cache)

Redistributes a PVector v to a new partition defined by new_indices.

source
GridapDistributed.redistribute_array_by_cellsMethod
redistribute_array_by_cells(
  old_lid_to_data, 
  old_cell_to_old_lid,
  new_cell_to_new_lid,
  model_new, glue;
  T = Int32, reverse=false,
)

Redistributes an array using the old machinery. This is used to create the new index partitions that the new machinery requires.

Takes in:

  • old_lid_to_data: The data to redistribute, indexed by local IDs in the old communicator.
  • old_cell_to_old_lid: The mapping from cells to local data IDs in the old communicator.
  • new_cell_to_new_lid: The mapping from cells to local data IDs in the new communicator.
  • model_new: The model in the new communicator.
  • glue: The RedistributeGlue glue.

Returns:

  • new_lid_to_old_data: The redistributed data, indexed by local IDs in the new communicator.
source
GridapDistributed.redistribute_indicesMethod
redistribute_indices(
  old_ids,
  old_cell_to_old_lid,
  new_cell_to_new_lid,
  model_new, glue;
  reverse=false,
)

Redistributes an index partition from an old communicator to a new one, ensuring that the global ids coincide in both partitions.

Takes in:

  • old_ids: The old index partition, providing the local-to-global ID map in the old communicator.
  • old_cell_to_old_lid: The mapping from cells to local IDs in the old communicator.
  • new_cell_to_new_lid: The mapping from cells to local IDs in the new communicator.
  • model_new: The model in the new communicator.
  • glue: The RedistributeGlue glue.

Returns:

  • old_ids: The old index partition, but defined in the new communicator. It has empty entries for the parts that are not in the old communicator.
  • red_old_ids: The redistributed index partition, defined in the new communicator.
source
GridapDistributed.redistribution_local_indicesMethod
redistribution_local_indices(indices, indices_red) -> (lids_snd, lids_rcv)

Returns the local indices to be communicated when redistributing from indices to indices_red.

CAREFUL: Unlike for the assembly operation, these snd/rcv indices are NOT symmetric.

source