On 7/7/21 12:08 AM, vachanpo...@gmail.com wrote:

Vector<double> temp_vec(gh_vec); // for data output
for(auto &cell: dof_handler.active_cell_iterators()){
   if(!(cell->is_locally_owned())) continue;
   temp_vec[cell->index()] = gh_vec[cell->global_active_cell_index()];
}
data_out.add_data_vector(temp_vec, "vector");

... then the output looks as expected. So here I have manually set the entries of the temporary vector using cell->index(), rather than letting the constructor do the job. For 1d meshes both seem to produce the same output.

What is the correct procedure? What kind of cell index does DataOut use internally? Any clarification would be greatly appreciated!

You want to use cell->active_cell_index() as the index into the vector. The vector should have
  triangulation.n_active_cells()
as its size. This corresponds to the *local* number of active cells, including ghost and artificial cells (for which vector entries are then just ignored). I think step-47 shows this (whether in parallel or not doesn't matter in this regard).

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/fafa93e0-9da2-cf5b-b0f9-8bbfd4e1e75c%40colostate.edu.

Reply via email to