On 5/26/21 10:20 PM, vachanpo...@gmail.com wrote:

I have a quantity which has a single value in a cell. Let me call this an "average". I want to be able to access the average of neighbouring cells from every cell.

What data structure can I use?

Since don't have mesh refinement, I was thinking of mapping this average to the cell index and using a parallel vector for storage. However, LA::MPI::Vector probably will not work because cell numbering is not continuous within a subdomain. Also, I couldn't find any function that can reorder the cells which may enable use of LA::MPI::Vector.

In the worst case, I can make a regular LA::MPI::Vector (using dofs) and set the average to all dofs in a cell. I hope there is an alternative.

You are looking for cell->global_active_cell_index(), which is documented like 
so:

  /**
   * Return a globally unique cell index for the current cell,
   * assuming it is not artificial. The value is identical to
   * active_cell_index() if the cell is part of a serial
   * triangulation.
   *
   * In the context of parallel triangulations, locally-owned cells
   * are enumerated contiguously within each subdomain of the
   * mesh. This ensures that the index returned by this function can
   * be used as the index into vectors with a total of
   * Triangulation::n_globally_active_cells() entries, and for which
   * every process stores a contiguous part.  If such a cell-data
   * vector has been set up with
   * parallel::TriangulationBase::global_active_cell_index_partitioner(),
   * the index returned by this function can then be used to access
   * the correct vector entry.
   */
  types::global_cell_index
  global_active_cell_index() const;

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/5583acf5-0104-0f2f-022b-2d5cdbb2a708%40colostate.edu.

Reply via email to