This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Gathering a vector in parallel in C++

+1 vote

The current stable Docker image still does not have the fix stated in this issue.

The bug is that one needs to initialize a PETSCVector like

v = PETScVector(mpi_comm_self())

to make sure that a gather call collects the components from different processors correctly.

I am now trying to implement this in C++. Simply running

auto v = std::make_shared<PETScVector>(mesh->mpi_comm());
other_vector->gather(*v, indices);

does not seem to work. Note that I am giving mesh->mpi_comm() as an argument because I could not find anything like mpi_comm_self() in C++ demos.

How should I initialize the vector so that it is gathered correctly?

asked Mar 30, 2017 by hosolmaz FEniCS User (1,510 points)
...