};
-// some security tests
+ // some security tests
unsigned int boundary_nodes = 0;
for (unsigned int i=0; i<lines_at_vertex.size(); ++i)
switch (lines_at_vertex[i].size())
AssertThrow (boundary_nodes == 2, ExcInternalError());
-// update neighborship info
+ // update neighborship info
active_line_iterator line = begin_active_line ();
// for all lines
for (; line!=end(); ++line)
};
-// re-compute numbers of lines, etc
+ // re-compute numbers of lines, etc
update_number_cache ();
};
vector<CellData<2> > cells(c);
-// make up a list of the needed lines
+ // make up a list of the needed lines
// each line is a pair of vertices. The list
// is kept sorted and it is guaranteed
// that each line is inserted only once.
};
-for (unsigned int line=0; line<4; ++line)
+ for (unsigned int line=0; line<4; ++line)
{
// assert that the line was not
// already inserted in reverse
};
-// check the every vertex has
+ // check the every vertex has
// at least two adjacent lines
if (true)
{
};
-// store for each line index
+ // store for each line index
// the adjacent cells
map<int,vector<cell_iterator> > adjacent_cells;
};
-for (line_iterator line=begin_line(); line!=end_line(); ++line)
+ for (line_iterator line=begin_line(); line!=end_line(); ++line)
{
const unsigned int n_adj_cells = adjacent_cells[line->index()].size();
// assert that every line has one or
};
-// finally update neighborship info
+ // finally update neighborship info
for (cell_iterator cell=begin(); cell!=end(); ++cell)
for (unsigned int side=0; side<4; ++side)
if (adjacent_cells[cell->line(side)->index()][0] == cell)
adjacent_cells[cell->line(side)->index()][0]);
-// re-compute numbers of lines, etc
+ // re-compute numbers of lines, etc
update_number_cache ();
};
};
-/////////////////////////////////
+ /////////////////////////////////
// now for some sanity-checks:
//
// check the every vertex has
};
-///////////////////////////////////
+ ///////////////////////////////////
// actually set up data structures
// for the lines
// reserve enough space
};
-///////////////////////////////////////////
+ ///////////////////////////////////////////
// make up the quads of this triangulation
//
// same thing: the iterators are set
};
-/////////////////////////////////
+ /////////////////////////////////
// enter the resulting quads into
// the arrays of the Triangulation
//
};
-/////////////////////////////////////////
+ /////////////////////////////////////////
// find those quads which are at the
// boundary and mark them appropriately
for (quad_iterator quad=begin_quad(); quad!=end_quad(); ++quad)
quad->line(l)->set_boundary_indicator (0);
-///////////////////////////////////////
+ ///////////////////////////////////////
// now set boundary indicators
// where given
//
ExcInternalError());
-/////////////////////////////////////////
+ /////////////////////////////////////////
// finally update neighborship info
for (cell_iterator cell=begin(); cell!=end(); ++cell)
for (unsigned int face=0; face<6; ++face)
adjacent_cells[cell->quad(face)->index()][0]);
-// re-compute numbers of lines, etc
+ // re-compute numbers of lines, etc
update_number_cache ();
};
};
-const unsigned int n_vertices = vertices.size();
+ const unsigned int n_vertices = vertices.size();
Point<dim> shift_vector;
for (unsigned int vertex=0; vertex<n_vertices; ++vertex)
};
-// finally correct hanging nodes
+ // finally correct hanging nodes
// again. The following is not
// necessary for 1D
active_cell_iterator cell = begin_active(),
};
-// check how much space is needed
+ // check how much space is needed
// on every level
// we need not check the highest
// level since either
};
-// Do REFINEMENT
+ // Do REFINEMENT
// on every level; exclude highest level as
// above
};
-// re-compute number of lines
+ // re-compute number of lines
update_number_cache ();
#ifdef DEBUG
};
-// check how much space is needed
+ // check how much space is needed
// on every level
// we need not check the highest
// level since either
bind2nd (equal_to<bool>(), true));
-// reserve space for the used_cells
+ // reserve space for the used_cells
// cells already existing on the next
// higher level as well as for the
// 4*flagged_cells that will be created
};
-// Do REFINEMENT
+ // Do REFINEMENT
// on every level; exclude highest level as
// above
new_lines[11]->set_boundary_indicator (255);
-// finally add the four new cells!
+ // finally add the four new cells!
// search for next unused cell
// the four children have to be put
};
-cell->set_children (subcells[0]->index());
+ cell->set_children (subcells[0]->index());
subcells[0]->set (Quad(new_lines[0]->index(), new_lines[8]->index(),
new_lines[10]->index(), new_lines[7]->index()));
subcells[1]->clear_user_pointer ();
-subcells[2]->set (Quad(new_lines[11]->index(), new_lines[3]->index(),
+ subcells[2]->set (Quad(new_lines[11]->index(), new_lines[3]->index(),
new_lines[4]->index(), new_lines[9]->index()));
subcells[2]->set_used_flag();
subcells[2]->clear_children();
subcells[2]->clear_user_pointer ();
-subcells[3]->set (Quad(new_lines[10]->index(), new_lines[9]->index(),
+ subcells[3]->set (Quad(new_lines[10]->index(), new_lines[9]->index(),
new_lines[5]->index(), new_lines[6]->index()));
subcells[3]->set_used_flag();
subcells[3]->clear_children();
};
-// first clear user flags for
+ // first clear user flags for
// quads and lines; we're gonna
// use them to flag which lines
// and quads need refinement
quad->clear_user_flag();
-// check how much space is needed
+ // check how much space is needed
// on every level
// we need not check the highest
// level since either
};
-// count number of used cells on
+ // count number of used cells on
// the next higher level
const unsigned int used_cells
= count_if (levels[level+1]->quads.used.begin(),
bind2nd (equal_to<bool>(), true));
-// reserve space for the used_cells
+ // reserve space for the used_cells
// cells already existing on the next
// higher level as well as for the
// 8*flagged_cells that will be created
};
-///////////////////////////////////////////
+ ///////////////////////////////////////////
// Before we start with the actual
// refinement, we do some sanity checks if
// in debug mode. especially, we try to
};
-///////////////////////////////////////
+ ///////////////////////////////////////
// now refine marked quads
///////////////////////////////////////
for (unsigned int level=0; level!=levels.size()-1; ++level)
};
-// now for the quads. again, first
+ // now for the quads. again, first
// collect some data about the
// indices of the lines, with
// the following numbering:
vertices[next_unused_vertex] /= 26;
-// now that we created the right
+ // now that we created the right
// point, make up the six
// lines interior to the quad
// (++ takes care of the end of
};
-// now for the quads. again, first
+ // now for the quads. again, first
// collect some data about the
// indices of the lines, with
// the following numbering:
};
-/////////////////////////////////
+ /////////////////////////////////
// create the eight new hexes
//
// again first collect some data.
};
-// find some space for the eight
+ // find some space for the eight
// newly to be created hexes.
// note that there should
// always be eight consecutive
quad_indices[34]));
-for (unsigned int i=0; i<8; ++i)
+ for (unsigned int i=0; i<8; ++i)
{
new_hexes[i]->set_used_flag();
new_hexes[i]->clear_user_flag();
};
-/////////////////////////////////
+ /////////////////////////////////
// now the only thing still to be
// done is setting neighborship
// information.
new_hexes[7]->set_neighbor (5, neighbor_cells[5][2]);
-// now we need to set the neighbors
+ // now we need to set the neighbors
// neighborship information; this
// is only necessary if the
// neighboring cell is refined,
};
-// note that the refinement
+ // note that the refinement
// flag was already cleared at
// the beginning of this loop
};
};
-// now do the actual coarsening step. Since
+ // now do the actual coarsening step. Since
// the loop goes over used cells only we need
// not worry about deleting some cells since
// the ++operator will then just hop over
cell->line(line)->set_user_flag();
-// now check whether there are cells with
+ // now check whether there are cells with
// lines that are more than once refined
// or that will be more than once
// refined. The first thing should never
save_refine_flags (flags_before[1]);
-// do nothing in 1d, except setting the
+ // do nothing in 1d, except setting the
// coarsening flags correctly
if (dim == 1)
{
}
-if ((neighbor->active() &&
+ if ((neighbor->active() &&
neighbor->refine_flag_set()) ||
!not_active_neighbor_will_be_coarsened)
++count;
} // if (smooth_grid & ...)
-//////////////////////////////////////
+ //////////////////////////////////////
// STEP 1:
// eliminate refined islands in the
// interior and at the boundary. since
};
-// delete the vertex which will not be
+ // delete the vertex which will not be
// needed anymore. This vertex is the
// second of the second line of the
// first child
};
-// delete pointer to children
+ // delete pointer to children
cell->set_children (-1);
cell->clear_user_flag();
};
};
-// delete pointer to children
+ // delete pointer to children
cell->set_children (-1);
cell->clear_user_flag();
};
};
-// delete pointer to children
+ // delete pointer to children
cell->clear_children ();
cell->clear_user_flag();
};
-// now, if the lines are not marked as
+ // now, if the lines are not marked as
// needed, we may delete their children
// and the midpoint
map<line_iterator,bool>::iterator line_and_flag;