DoFTools::extract_locally_relevant_dofs (dof_handler,locally_relevant_dofs);
PETScWrappers::MPI::Vector force;
- force.reinit (mpi_communicator, locally_owned_dofs, locally_relevant_dofs);
+ force.reinit (mpi_communicator, locally_owned_dofs);
+ std::cout << force.has_ghost_elements() << std::endl;
+
ConstraintMatrix constraints (locally_relevant_dofs);
constraints.clear();
}
constraints.close();
- force=0.;
- force.compress();
constraints.condense(force);
}
DoFTools::extract_locally_relevant_dofs (dh,locally_relevant_dofs);
- PETScWrappers::MPI::Vector solution(MPI_COMM_WORLD,locally_owned_dofs,locally_relevant_dofs);
+ PETScWrappers::MPI::Vector x(MPI_COMM_WORLD,locally_owned_dofs);
+ PETScWrappers::MPI::Vector solution(MPI_COMM_WORLD,locally_owned_dofs, locally_relevant_dofs);
parallel::distributed::SolutionTransfer<dim,PETScWrappers::MPI::Vector> soltrans(dh);
for (unsigned int i=0;i<locally_owned_dofs.n_elements();++i)
{
unsigned int idx = locally_owned_dofs.nth_index_in_set(i);
- solution(idx)=idx;
+ x(idx)=idx;
// std::cout << '[' << idx << ']' << ' ' << solution(idx) << std::endl;
}
- solution.compress();
- solution.update_ghost_values();
+ x.compress(VectorOperation::insert);
+ solution=x;
soltrans.prepare_serialization (solution);
DoFTools::extract_locally_relevant_dofs (dh, locally_relevant_dofs);
+ PETScWrappers::MPI::Vector x (MPI_COMM_WORLD, locally_owned_dofs);
+ PETScWrappers::MPI::Vector x2 (MPI_COMM_WORLD, locally_owned_dofs);
PETScWrappers::MPI::Vector solution (MPI_COMM_WORLD, locally_owned_dofs, locally_relevant_dofs);
PETScWrappers::MPI::Vector solution2 (MPI_COMM_WORLD, locally_owned_dofs, locally_relevant_dofs);
for (unsigned int i = 0;i < locally_owned_dofs.n_elements();++i)
{
unsigned int idx = locally_owned_dofs.nth_index_in_set (i);
- solution (idx) = idx;
- solution2 (idx) = 2 * idx;
+ x (idx) = idx;
+ x2 (idx) = 2 * idx;
// std::cout << '[' << idx << ']' << ' ' << solution(idx) << std::endl;
}
- solution.compress();
- solution.update_ghost_values();
- solution2.compress();
- solution2.update_ghost_values();
+ x.compress(VectorOperation::insert);
+ solution=x;
+ x*=2.0;
+ solution2 = x;
+
soltrans.prepare_serialization (solution);
soltrans2.prepare_serialization (solution2);
DoFTools::extract_locally_relevant_dofs (dh,locally_relevant_dofs);
PETScWrappers::MPI::Vector solution(MPI_COMM_WORLD,locally_owned_dofs,locally_relevant_dofs);
- solution = 0;
- solution.update_ghost_values();
parallel::distributed::SolutionTransfer<2,PETScWrappers::MPI::Vector> soltrans(dh);
solution.reinit(MPI_COMM_WORLD,locally_owned_dofs,locally_relevant_dofs);
solution = tmp;
- solution.update_ghost_values();
// make sure no processor is
// hanging
locally_relevant_solution.reinit (mpi_communicator,
locally_owned_dofs,
locally_relevant_dofs);
- locally_relevant_solution = 0;
system_rhs.reinit (mpi_communicator,
dof_handler.n_dofs(),
dof_handler.n_locally_owned_dofs());
constraints.distribute (completely_distributed_solution);
locally_relevant_solution = completely_distributed_solution;
- locally_relevant_solution.update_ghost_values();
}
locally_relevant_solution.reinit (mpi_communicator,
locally_owned_dofs,
locally_relevant_dofs);
- locally_relevant_solution = 0;
system_rhs.reinit (mpi_communicator,
dof_handler.n_dofs(),
dof_handler.n_locally_owned_dofs());
constraints.distribute (completely_distributed_solution);
locally_relevant_solution = completely_distributed_solution;
- locally_relevant_solution.update_ghost_values();
}