You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having some trouble implementing a restart feature for use with block vectors. The way I see it is I have to write the files using the Visit format with something like the following:
VisItDataCollection checkpoint_file(MPI_COMM_WORLD, problem_name+"visit");
checkpoint_file.SetMesh(mesh);
for (int i = 0; i < n_ops; ++i)
checkpoint_file.RegisterField("eta"+to_string(i), &ind_var_gf_vec[i]);
checkpoint_file.SetFormat(DataCollection::PARALLEL_FORMAT);
checkpoint_file.SetPrecision(16);
checkpoint_file.Save();
in the above ind_var_gf_vec is a vector of ParGridFunction's refering to the BlockVector that stores the solution variables.vector<ParGridFunction> ind_var_gf_vec(n_ops);for (int i = 0; i < n_ops; ++i) { ind_var_gf_vec.push_back(ParGridFunction(_spaces[i])); ind_var_gf_vec[i].MakeTRef(_spaces[i], xp.GetBlock(i), 0);}Then on restart I do something like the following:if (is_restart) { // overwrite the mesh pointer if we are restarting checkpoint_file.Load(restart_cycle); mesh = dynamic_cast<ParMesh*>(checkpoint_file.GetMesh());}to load the mesh. This is where I am having trouble. Now I need to set the BlockVector with the solution from the restart file. I have tried the following but am lost:if (is_restart==true){ // read from checkpoint file std::vector<GridFunction *> saved_ops(n_ops); for (int i = 0; i < n_ops; ++i){ saved_ops[i] = checkpoint_file.GetParField("eta"+to_string(i)); ind_var_gf_vec[dof_map_ac[i]].ProjectGridFunction(*saved_ops[i]); ind_var_gf_vec[dof_map_ac[i]].SetTrueVector(); }}
What is the correct way to reinitialize the BlockVector xp?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am having some trouble implementing a restart feature for use with block vectors. The way I see it is I have to write the files using the Visit format with something like the following:
What is the correct way to reinitialize the BlockVector xp?
Beta Was this translation helpful? Give feedback.
All reactions