template < int dim > void step<dim>::move_mesh(const TrilinosWrappers::MPI::Vector &state_change) const { pcout<<"moving the mesh ..." <<std::endl; std::vector<bool> vertex_touched(triangulation.n_vertices(), false);
for (typename DoFHandler<dim>::active_cell_iterator cell =dof_handler.begin_active();cell != dof_handler.end(); ++cell) if (cell->is_locally_owned()) for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v) { if(vertex_touched[cell->vertex_index(v)] == false) { vertex_touched[cell->vertex_index(v)] = true;
Point<dim> vertex_displacement; for (unsigned int d = 0; d < dim; ++d) vertex_displacement[d] = state_change(cell->vertex_dof_index(v, d)); cell->vertex(v) += vertex_displacement; } } }

--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/4b28379f-5d5f-4295-ace1-165b02d67947%40googlegroups.com.

template < int dim > void step<dim>::move_mesh(const TrilinosWrappers::MPI::Vector &state_change) { pcout<<"moving the mesh ..." <<std::endl; std::vector<bool> vertex_touched(triangulation.n_vertices(), false); parallel::distributed::Triangulation< dim > *distributed_triangulation = &triangulation;
const std::vector<bool> locally_owned_vertices = GridTools::get_locally_owned_vertices(triangulation);
for (typename DoFHandler<dim>::active_cell_iterator cell =dof_handler.begin_active();cell != dof_handler.end(); ++cell) if (cell->is_locally_owned()) for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v) { if(vertex_touched[cell->vertex_index(v)] == false) { vertex_touched[cell->vertex_index(v)] = true;
Point<dim> vertex_displacement; for (unsigned int d = 0; d < dim; ++d) vertex_displacement[d] = state_change(cell->vertex_dof_index(v, d)); cell->vertex(v) += vertex_displacement; } } distributed_triangulation->communicate_locally_moved_vertices(locally_owned_vertices);
typename Triangulation<dim>::active_cell_iterator cell = triangulation.begin_active(), endc = triangulation.end(); for (; cell!=endc; ++cell) if (!cell->is_artificial()) for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face) if (cell->face(face)->has_children() && !cell->face(face)->at_boundary()) { // this face has hanging nodes if (dim==2) cell->face(face)->child(0)->vertex(1) = (cell->face(face)->vertex(0) + cell->face(face)->vertex(1)) / 2; else if (dim==3) { cell->face(face)->child(0)->vertex(1) = .5*(cell->face(face)->vertex(0) +cell->face(face)->vertex(1)); cell->face(face)->child(0)->vertex(2) = .5*(cell->face(face)->vertex(0) +cell->face(face)->vertex(2)); cell->face(face)->child(1)->vertex(3) = .5*(cell->face(face)->vertex(1) +cell->face(face)->vertex(3)); cell->face(face)->child(2)->vertex(3) = .5*(cell->face(face)->vertex(2) +cell->face(face)->vertex(3)); // center of the face cell->face(face)->child(0)->vertex(3) = .25*(cell->face(face)->vertex(0) +cell->face(face)->vertex(1) +cell->face(face)->vertex(2) +cell->face(face)->vertex(3)); } } }To unsubscribe from this group and stop receiving emails from it, send an email to dea...@googlegroups.com.
I try to use the communicate_locally_moved_vertices, it fixes the departure of mesh belongs to different mesh . but there still remains some problem
[...]
you can see that the mesh is consistent on the boundry, but not smooth in the inner mesh ,there are some shallow hole on the surface
my code is as follows
[...]