Skip to content

Conversation

@asartori86
Copy link
Contributor

PR mathLab/deal2lkit#322 is required


y_expl.block_write(out_y_expl);
out_y_expl.close();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not use this mechanism here. See

https://gitlab.com/code_projects/eigen-laplace/blob/master/source/eigen_problem.cc

and copy that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In particular:


    std::vector<const PETScWrappers::MPI::Vector *> vectors;
    for (auto &e : eigenfunctions_ghosted)
      vectors.push_back(&e);

    soltrans = SP(new parallel::distributed::SolutionTransfer<dim, PETScWrappers::MPI::Vector>(*dof_handler));
    soltrans->prepare_serialization (vectors);

    triangulation->save ("restart.mesh");
  }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and at resume time:


  eigenfunctions.resize (n_eigenvalues);
  eigenfunctions_ghosted.resize (n_eigenvalues);

  std::vector<PETScWrappers::MPI::Vector *> all_out(n_eigenvalues);
  for (unsigned int i=0; i<n_eigenvalues; ++i)
    {
      eigenfunctions[i].reinit (owned_index_set, MPI_COMM_WORLD);
      all_out[i] = &eigenfunctions[i];
    }

  // Ghosted functions are used internally by soltrans
  if (cycle > 0 && resume_computation == false)
    soltrans->interpolate(all_out);
  else if (resume_computation == true)
    {
      soltrans = SP(new parallel::distributed::SolutionTransfer<dim, PETScWrappers::MPI::Vector>(*dof_handler));
      soltrans->deserialize(all_out);
      resume_computation = false;
    }


  // Now that we have transfered the old ones, reinitialize ghosted vectors.
  for (unsigned int i=0; i<n_eigenvalues; ++i)
    {
      eigenfunctions_ghosted[i].reinit (owned_index_set,
                                        relevant_index_set,
                                        MPI_COMM_WORLD);
      eigenfunctions_ghosted[i] = eigenfunctions[i];
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants