On 7/26/23 02:59, 'maurice rohracker' via deal.II User Group wrote:

In a parallel distributed code, similar to step-42, we use a/dealii::Vector/ of /n_active_cells()/ to compute the error indicators of the locally owned cells. (This can easily be used in e.g. /dealii::parallel::distributed::GridRefinement::
refine_and_coarsen_fixed_number()/)
As we want to add an additional criterion based on the minimum and maximum error indicator to mark cells, we need the global minimum and maximum value. Is there a smart way to get the global minimum based on the minimum of all processes of all locally owned cells? Using /std::min_element/ does not care about locally owned cells and so the results are wrong.

You can get the local min/max via a loop of the form

  double min=std::numeric_limits<double>::max(),
         max=std::numeric_limits<double>::smallest(),
  for (auto &cell : triangulation.active_cell_iterators())
    if (cell->is_locally_owned())
      min = std::min (min, vec(cell->active_cell_index()));
      ...same for max...

and then compute the global min and max via Utilities::min()/max().

Best
 W.

--
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 bange...@colostate.edu
                           www: http://www.math.colostate.edu/~bangerth/


--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/493444fe-6760-5026-daf6-d079daa81995%40colostate.edu.

Reply via email to