Hello,

I have an issue that seems very simple but I cannot figure out. I have a 
piecewise constant parallel vector that I defined using a DG-0 space. I 
have an auxiliary function that calculates the value according to the cell, 
and then in my main file, I would like to assign the value to the vector. 
The values are calculated correctly, but it seems like assigning to the 
vector is not. The values should either be 1.e-8 or 1.e-11, and the vector 
is 0 sometimes. I noticed this because I am printing to a vtu file and 
plotting. A sample code is below. Instead of using the index of the cell, I 
also tried using the dof index, but I am getting similar results. 

Thanks in advance for the help,
Giselle

PETScWrappers::MPI::Vector vec;
//
// Initialize fe space
//
// Initialize vector
dof_handler_dg0.distribute_dofs(fe_dg0);
const std::vector<IndexSet> locally_owned_dofs_per_proc_dg0 =
DoFTools::locally_owned_dofs_per_subdomain(dof_handler_dg0);
locally_owned_dofs_dg0 = locally_owned_dofs_per_proc_dg0[this_mpi_process];
vec.reinit(locally_owned_dofs_dg0, mpi_communicator);

// Calculate values
for (const auto &cell : dof_handler_dg0.active_cell_iterators())
{
double val;
if(cell->subdomain_id() == this_mpi_process)
{
val = compute_value<dim>(cell);
                vec[cell->active_cell_index()] = val;
}
       vec.compress(VectorOperation::insert);
}

-- 
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/2b6cae4d-1479-49f0-ae8a-8833af54c175n%40googlegroups.com.

Reply via email to