// adjacent to these vertices
lines_at_vertex[cells[cell].vertices[0]].push_back (cell);
lines_at_vertex[cells[cell].vertices[1]].push_back (cell);
- };
+ }
// some security tests
clear_despite_subscriptions ();
AssertThrow (false, ExcInternalError());
- };
+ }
// assert there are no more than
// two boundary nodes
clear_despite_subscriptions();
AssertThrow (false, ExcInternalError());
- };
+ }
0, // level
lines_at_vertex[line->vertex_index(vertex)][0]);
line->set_neighbor (vertex, neighbor);
- };
+ }
// re-compute numbers of lines, etc
AssertThrow (false,
ExcGridHasInvalidCell(cell));
- };
+ }
// insert line, with
// invalid iterator if line
return true;
else
return false;
- };
+ }
};
{
at_boundary[line->vertex_index(0)] = true;
at_boundary[line->vertex_index(1)] = true;
- };
+ }
minimal_length[line->vertex_index(0)]
= std::min(line->diameter(),
minimal_length[line->vertex_index(1)]
= std::min(line->diameter(),
minimal_length[line->vertex_index(1)]);
- };
+ }
const unsigned int n_vertices = vertices.size();
// finally move the vertex
vertices[vertex] += shift_vector;
- };
+ }
}
#endif
{
at_boundary[line->vertex_index(0)] = true;
at_boundary[line->vertex_index(1)] = true;
- };
+ }
minimal_length[line->vertex_index(0)]
= std::min(line->diameter(),
minimal_length[line->vertex_index(1)]
= std::min(line->diameter(),
minimal_length[line->vertex_index(1)]);
- };
+ }
const unsigned int n_vertices = vertices.size();
// finally move the vertex
vertices[vertex] += shift_vector;
- };
+ }
// finally correct hanging nodes
{
cell->clear_coarsen_flag();
cell->set_refine_flag ();
- };
+ }
}
{
set_all_refine_flags();
execute_coarsening_and_refinement ();
- };
+ }
}
{
save_user_flags_quad (tmp);
v.insert (v.end(), tmp.begin(), tmp.end());
- };
+ }
if (dim >= 3)
{
save_user_flags_hex (tmp);
v.insert (v.end(), tmp.begin(), tmp.end());
- };
+ }
if (dim >= 4)
Assert (false, ExcNotImplemented());
tmp.insert (tmp.end(),
v.begin()+n_lines(), v.begin()+n_lines()+n_quads());
load_user_flags_quad (tmp);
- };
+ }
if (dim >= 3)
{
tmp.insert (tmp.end(),
v.begin()+n_lines()+n_quads(), v.begin()+n_lines()+n_quads()+n_hexs());
load_user_flags_hex (tmp);
- };
+ }
if (dim >= 4)
Assert (false, ExcNotImplemented());
{
save_user_pointers_quad (tmp);
v.insert (v.end(), tmp.begin(), tmp.end());
- };
+ }
if (dim >= 3)
{
save_user_pointers_hex (tmp);
v.insert (v.end(), tmp.begin(), tmp.end());
- };
+ }
if (dim >= 4)
Assert (false, ExcNotImplemented());
tmp.insert (tmp.end(),
v.begin()+n_lines(), v.begin()+n_lines()+n_quads());
load_user_pointers_quad (tmp);
- };
+ }
if (dim >= 3)
{
tmp.insert (tmp.end(),
v.begin()+n_lines()+n_quads(), v.begin()+n_lines()+n_quads()+n_hexs());
load_user_pointers_hex (tmp);
- };
+ }
if (dim >= 4)
Assert (false, ExcNotImplemented());
{
levels.push_back (new TriangulationLevel<dim>);
break;
- };
- };
+ }
+ }
// check how much space is needed
TriangulationLevel<1>::reserve_space (GeometryInfo<1>::children_per_cell*flagged_cells);
needed_vertices += flagged_cells;
- };
+ }
// add to needed vertices how many
// vertices are already in use
{
vertices.resize (needed_vertices, Point<1>());
vertices_used.resize (needed_vertices, false);
- };
+ }
// Do REFINEMENT
{
left_neighbor = left_neighbor->child(1);
left_neighbor->set_neighbor (1, first_child);
- };
- };
+ }
+ }
// insert second child
second_child->clear_children ();
{
right_neighbor = right_neighbor->child(0);
right_neighbor->set_neighbor (0, second_child);
- };
- };
- };
- };
+ }
+ }
+ }
+ }
// re-compute number of lines
{
levels.push_back (new TriangulationLevel<dim>);
break;
- };
- };
+ }
+ }
// first clear user flags for
Assert (line->has_children() == false, ExcInternalError());
needed_lines += 2;
needed_vertices += 1;
- };
+ }
// count number of used cells
// level
levels[level+1]->
TriangulationLevel<2>::reserve_space (4*flagged_cells);
- };
+ }
// add to needed vertices how many
// vertices are already in use
{
vertices.resize (needed_vertices, Point<dim>());
vertices_used.resize (needed_vertices, false);
- };
+ }
// Do REFINEMENT
// indicating the need
// for refinement
line->clear_user_flag ();
- };
- };
+ }
+ }
// Now set up the new cells
for (int level=0; level<static_cast<int>(levels.size())-1; ++level)
Assert (new_lines[l]->used() == false,
ExcCellShouldBeUnused());
- };
+ }
new_lines[8] ->set (Line(new_vertices[1], new_vertices[8]));
new_lines[9] ->set (Line(new_vertices[8], new_vertices[5]));
new_lines[l]->clear_children();
// interior line
new_lines[l]->set_boundary_indicator(255);
- };
+ }
// Now add the four new
// cells!
ExcCellShouldBeUnused());
subcells[i] = next_unused_cell;
++next_unused_cell;
- };
+ }
cell->set_children (subcells[0]->index());
{
levels.push_back (new TriangulationLevel<dim>);
break;
- };
- };
+ }
+ }
// first clear user flags for quads
for (unsigned int line=0; line<4; ++line)
if (aface->line(line)->has_children() == false)
aface->line(line)->set_user_flag ();
- };
- };
- };
+ }
+ }
+ }
// now count the quads and
// lines which were flagged for
needed_quads += 4;
needed_lines += 4;
needed_vertices += 1;
- };
+ }
for (line_iterator line=begin_line(level); line!=end_line(level); ++line)
if (line->user_flag_set())
Assert (line->has_children() == false, ExcInternalError());
needed_lines += 2;
needed_vertices += 1;
- };
+ }
// count number of used cells on
// level
levels[level+1]->
TriangulationLevel<3>::reserve_space (8*flagged_cells);
- };
+ }
// add to needed vertices how many
// vertices are already in use
{
vertices.resize (needed_vertices, Point<dim>());
vertices_used.resize (needed_vertices, false);
- };
+ }
///////////////////////////////////////////
// indicating the need
// for refinement
line->clear_user_flag ();
- };
- };
+ }
+ }
///////////////////////////////////////
Assert (new_lines[i]->used() == false,
ExcCellShouldBeUnused());
- };
+ }
// set the data of the
// four lines.
new_lines[i]->clear_user_pointer();
new_lines[i]->clear_children();
new_lines[i]->set_boundary_indicator(quad->boundary_indicator());
- };
+ }
// now for the
new_quads[i]->clear_user_pointer();
new_quads[i]->clear_children();
new_quads[i]->set_boundary_indicator (quad->boundary_indicator());
- };
+ }
// finally clear flag
// indicating the need
// for refinement
quad->clear_user_flag ();
- };
- };
+ }
+ }
///////////////////////////////////
// Now, finally, set up the new
Assert (new_lines[i]->used() == false,
ExcCellShouldBeUnused());
- };
+ }
// set the data of the
// six lines. first
new_lines[i]->clear_children();
// interior line
new_lines[i]->set_boundary_indicator(255);
- };
+ }
// now for the
Assert (new_quads[i]->used() == false,
ExcCellShouldBeUnused());
- };
+ }
// set up the 12 quads,
// numbered as follows
new_quads[i]->clear_children();
// interior quad
new_quads[i]->set_boundary_indicator (255);
- };
+ }
/////////////////////////////////
Assert (new_hexes[i]->used() == false,
ExcCellShouldBeUnused());
++next_unused_hex;
- };
+ }
// note these hexes as
// children to the
ExcInternalError());
Assert (!neighbor_cells[face][c]->has_children(),
ExcInternalError());
- };
- };
- };
- };
+ }
+ }
+ }
+ }
// now we've got all
// neighbors, so set them
found:
;
- };
+ }
// note that the
// refinement flag was
// already cleared at the
// beginning of this loop
- };
- };
+ }
+ }
// re-compute number of lines and
// quads
Assert (cell->child(child)->coarsen_flag_set(),
ExcInternalError());
cell->child(child)->clear_coarsen_flag();
- };
- };
+ }
+ }
// now do the actual coarsening
cell->line(line)->set_user_flag();
break;
- };
- };
+ }
+ }
if (offending_line_found)
{
mesh_changed = true;
break;
- };
- };
+ }
+ }
// there is another thing
// here: if any of the
mesh_changed = true;
break;
- };
- };
+ }
+ }
}
while (mesh_changed == true);
}
if (cell->level() == 0)
cell->clear_coarsen_flag();
continue;
- };
+ }
flagged_children = 0;
for (unsigned int child=0; child<GeometryInfo<dim>::children_per_cell; ++child)
// clear flag since we
// don't need it anymore
cell->child(child)->clear_coarsen_flag();
- };
+ }
// flag this cell for
// coarsening if all children
// were flagged
if (flagged_children == GeometryInfo<dim>::children_per_cell)
cell->set_user_flag();
- };
+ }
// in principle no coarsen flags
// should be set any more at this
// some time
child_neighbor->refine_flag_set())
coarsening_allowed = false;
- };
+ }
// if allowed: tag the
// children for coarsening
ExcInternalError());
cell->child(c)->set_coarsen_flag();
- };
- };
+ }
+ }
}
return ((flags_before[0] != flags_after[0]) ||
(flags_before[1] != flags_after[1]));
- };
+ }
// for all other dimensions
{
all_children_active = false;
break;
- };
+ }
if (all_children_active)
{
if (tagged_children ==
GeometryInfo<dim>::children_per_cell)
++unrefined_neighbors;
- };
- };
+ }
+ }
// if all
// neighbors
}
else
cell->clear_refine_flag();
- };
- };
- };
+ }
+ }
+ }
//////////////////////////////////////
// STEP 2:
// this inner
// loop.
break;
- };
- };
+ }
+ }
/////////////////////////////////////
// STEP 3:
++refined_neighbors;
else
++unrefined_neighbors;
- };
+ }
if (unrefined_neighbors < refined_neighbors)
{
if (cell->coarsen_flag_set())
cell->clear_coarsen_flag();
cell->set_refine_flag ();
- };
- };
- };
+ }
+ }
+ }
/////////////////////////////////
// namely our present
// neighbor
cell->neighbor(i)->clear_coarsen_flag ();
- };
- };
+ }
+ }
//////////////////////////////////////
// STEP 6:
neighbor = neighbor->child(1);
else
break;
- };
- };
+ }
+ }
// now do it for the cells to the
// left
neighbor = neighbor->child(0);
else
break;
- };
- };
+ }
+ }
// delete the vertex which will not
cell->child(child)->clear_user_pointer();
cell->child(child)->clear_user_flag();
cell->child(child)->clear_used_flag();
- };
+ }
// delete pointer to children
++neighbor_neighbor)
if (neighbor->neighbor(neighbor_neighbor) == cell->child(child))
neighbor->set_neighbor(neighbor_neighbor, cell);
- };
+ }
// delete the vertex which will not
// be needed anymore. This vertex
cell->face(face)->child(subface)->clear_user_pointer ();
cell->face(face)->child(subface)->clear_user_flag ();
cell->face(face)->child(subface)->clear_used_flag ();
- };
+ }
cell->face(face)->clear_children();
- };
+ }
// invalidate children
for (unsigned int child=0; child<GeometryInfo<dim>::children_per_cell; ++child)
cell->child(child)->clear_user_pointer();
cell->child(child)->clear_user_flag();
cell->child(child)->clear_used_flag();
- };
+ }
// delete pointer to children
++neighbor_neighbor)
if (neighbor->neighbor(neighbor_neighbor) == cell->child(child))
neighbor->set_neighbor(neighbor_neighbor, cell);
- };
+ }
// delete the vertex which will not
// be needed anymore. This vertex
interior_quads[q]->clear_user_pointer();
interior_quads[q]->clear_user_flag();
interior_quads[q]->clear_used_flag();
- };
+ }
for (unsigned int l=0; l<6; ++l)
{
interior_lines[l]->clear_user_pointer();
interior_lines[l]->clear_user_flag();
interior_lines[l]->clear_used_flag();
- };
+ }
// for the six faces: if the
// neighbor does not itself need
interior_lines[l]->clear_user_pointer ();
interior_lines[l]->clear_user_flag ();
interior_lines[l]->clear_used_flag ();
- };
+ }
// delete the four subfaces
for (unsigned int subface=0;
quad->child(subface)->clear_user_pointer ();
quad->child(subface)->clear_user_flag ();
quad->child(subface)->clear_used_flag ();
- };
+ }
quad->clear_children();
- };
+ }
// invalidate children
for (unsigned int child=0; child<GeometryInfo<dim>::children_per_cell; ++child)
cell->child(child)->set_face_orientation (f, false);
cell->child(child)->clear_used_flag();
- };
+ }
// delete pointer to children
ExcInternalError());
line_is_needed[cell->face(nb)->line(i)] = true;
- };
+ }
// ok for this neighbor
continue;
- };
+ }
// if the neighbor is not
// refined, then it may still
Assert (!neighbor_neighbor->has_children(),
ExcInternalError());
continue;
- };
+ }
// neighbor's neighbor is
// on same level. if it has
if (line_is_needed.find(line) != line_is_needed.end())
line_is_needed[line] = true;
- };
- };
- };
+ }
+ }
+ }
// now, if the lines are not marked
line->child(child)->clear_user_pointer();
line->child(child)->clear_user_flag();
line->child(child)->clear_used_flag();
- };
+ }
line->clear_children();
- };
+ }
}
#endif
{
in >> tmp;
flags[i] = tmp;
- };
+ }
for (unsigned int position=0; position!=N; ++position)
v[position] = (flags[position/8] & (1<<(position%8)));
begin_line (level+1));
for (; line!=endc; ++line)
++number_cache.n_lines_level[level];
- };
+ }
// update total number of lines
number_cache.n_lines += number_cache.n_lines_level[level];
- };
+ }
// do the update for the number of
// active lines as well
endc = end_active_line (level);
for (; line!=endc; ++line)
++number_cache.n_active_lines_level[level];
- };
+ }
// update total number of lines
number_cache.n_active_lines += number_cache.n_active_lines_level[level];
- };
+ }
}
begin_quad (level+1));
for (; quad!=endc; ++quad)
++number_cache.n_quads_level[level];
- };
+ }
// update total number of quads
number_cache.n_quads += number_cache.n_quads_level[level];
- };
+ }
// do the update for the number
// of active quads as well
endc = end_active_quad (level);
for (; quad!=endc; ++quad)
++number_cache.n_active_quads_level[level];
- };
+ }
// update total number of quads
number_cache.n_active_quads += number_cache.n_active_quads_level[level];
- };
+ }
}
#endif
begin_hex (level+1));
for (; hex!=endc; ++hex)
++number_cache.n_hexes_level[level];
- };
+ }
// update total number of hexes
number_cache.n_hexes += number_cache.n_hexes_level[level];
- };
+ }
// do the update for the number
// of active hexes as well
endc = end_active_hex (level);
for (; hex!=endc; ++hex)
++number_cache.n_active_hexes_level[level];
- };
+ }
// update total number of hexes
number_cache.n_active_hexes += number_cache.n_active_hexes_level[level];
- };
+ }
}
#endif
default:
Assert (false, ExcInternalError());
- };
+ }
}