@@ -161,6 +161,15 @@ function fetch_vector_ghost_values!(vector_partition,cache)
161161 assemble! ((a,b)-> b, vector_partition, cache)
162162end
163163
164+ """
165+ generate_gids(cell_gids::PRange, cell_to_lids, nlids) -> PRange
166+
167+ Given a set of cell global ids, a distributed array of local tables mapping cells to local dof ids,
168+ and a distributed array with the number of local dofs in each partition, this function
169+ generates the global dof ids and returns them as a `PRange` of `LocalIndices`.
170+
171+ Ignores negative local dof ids (usually used for Dirichlet dofs).
172+ """
164173function generate_gids (
165174 cell_range:: PRange ,
166175 cell_to_ldofs:: AbstractArray{<:AbstractArray} ,
@@ -248,6 +257,13 @@ function generate_gids(
248257 return PRange (local_indices)
249258end
250259
260+ """
261+ generate_posneg_gids(cell_gids::PRange, cell_to_lposneg, nlpos, nlneg) -> (PRange,PRange)
262+
263+ Similar to `generate_gids`, but also handles negative local dof ids. Returns two sets of
264+ global ids: one for positive local ids and another for negative local ids.
265+ This can be used to generate simultaneously free and dirichlet dof global ids.
266+ """
251267function generate_posneg_gids (
252268 cell_range:: PRange ,
253269 cell_to_lposneg:: AbstractArray{<:AbstractArray} ,
@@ -360,6 +376,16 @@ function generate_posneg_gids(
360376 return PRange (local_indices_pos), PRange (local_indices_neg)
361377end
362378
379+ """
380+ generate_gids_by_color(cell_gids::PRange, cell_to_lids, lid_to_color, ncolors)
381+
382+ Similar to `generate_gids`, but uses a global partition given by `lid_to_color` to generate
383+ a different set of global ids per color. Returns:
384+
385+ - a tuple with a `PRange` of `LocalIndices` per color.
386+ - a mapping `lid_to_clid` that maps local ids to local color ids
387+ - a mapping `color_to_clid_to_lid` that maps, for each color, local color ids to local ids.
388+ """
363389function generate_gids_by_color (
364390 cell_range:: PRange ,
365391 cell_to_lids:: AbstractArray{<:AbstractArray} ,
@@ -490,6 +516,13 @@ function generate_gids_by_color(
490516 return map (PRange,color_to_indices), lid_to_clid, color_to_clid_to_lid
491517end
492518
519+ """
520+ split_gids_by_color(gids::PRange, lid_to_color::AbstractArray, ncolors) -> NTuple{ncolors,PRange}
521+
522+ Given a set of global ids and a mapping from local ids to colors, this function splits
523+ the global ids into different sets of global ids per color. Returns a tuple with a `PRange`
524+ of `LocalIndices` per color.
525+ """
493526function split_gids_by_color (
494527 gids:: PRange , lid_to_color:: AbstractArray ,
495528 ncolors = getany (reduction (max,map (maximum,lid_to_color);destination= :all ))
0 commit comments