vector<ConstraintLine>::const_iterator next_constraint = lines.begin();
unsigned int shift = 0;
- unsigned int n_rows = (unsigned int)uncondensed.n_rows();
+ unsigned int n_rows = uncondensed.n_rows();
if (next_constraint == lines.end())
// if no constraint is to be handled
// only evaluated so often as there are
// entries in new_line[*] which tells us
// which constraints exist
- for (int row=0; row<uncondensed.n_rows(); ++row)
+ for (unsigned int row=0; row<uncondensed.n_rows(); ++row)
if (new_line[row] != -1)
// line not constrained
// copy entries if column will not
// be condensed away, distribute
// otherwise
- for (int j=uncondensed.get_rowstart_indices()[row];
+ for (unsigned int j=uncondensed.get_rowstart_indices()[row];
j<uncondensed.get_rowstart_indices()[row+1]; ++j)
if (new_line[uncondensed.get_column_numbers()[j]] != -1)
condensed.add (new_line[row], new_line[uncondensed.get_column_numbers()[j]]);
else
// line must be distributed
{
- for (int j=uncondensed.get_rowstart_indices()[row];
+ for (unsigned int j=uncondensed.get_rowstart_indices()[row];
j<uncondensed.get_rowstart_indices()[row+1]; ++j)
// for each entry: distribute
if (new_line[uncondensed.get_column_numbers()[j]] != -1)
// for gcc2.9: replace this by
// distribute(sparsity.n_rows(), -1)
vector<int> distribute;
- distribute.reserve (sparsity.n_rows());
- // replace the following line, since
- // gcc2.8 chokes over it.
-// distribute.insert (distribute.end(), sparsity.n_rows(), -1);
- for (unsigned int i=0; i<(unsigned int)sparsity.n_rows(); ++i)
- distribute.push_back (-1);
+ distribute.resize (sparsity.n_rows(), -1);
- for (int c=0; c<(signed int)lines.size(); ++c)
- distribute[lines[c].line] = c;
+ for (unsigned int c=0; c<lines.size(); ++c)
+ distribute[lines[c].line] = (signed int)c;
int n_rows = sparsity.n_rows();
for (int row=0; row<n_rows; ++row)
if (distribute[row] == -1)
// regular line. loop over cols
- for (int j=sparsity.get_rowstart_indices()[row];
+ for (unsigned int j=sparsity.get_rowstart_indices()[row];
j<sparsity.get_rowstart_indices()[row+1]; ++j)
// end of row reached?
if (sparsity.get_column_numbers()[j] == -1)
}
else
// row must be distributed
- for (int j=sparsity.get_rowstart_indices()[row];
+ for (unsigned int j=sparsity.get_rowstart_indices()[row];
j<sparsity.get_rowstart_indices()[row+1]; ++j)
// end of row reached?
if (sparsity.get_column_numbers()[j] == -1)
ExcMatrixNotSquare());
Assert (condensed.n() == condensed.m(),
ExcMatrixNotSquare());
- Assert ((unsigned int)condensed.n()+n_constraints() == (unsigned int)uncondensed.n(),
+ Assert (condensed.n()+n_constraints() == uncondensed.n(),
ExcWrongDimension());
// store for each line of the matrix
vector<ConstraintLine>::const_iterator next_constraint = lines.begin();
unsigned int shift = 0;
- unsigned int n_rows = (unsigned int)uncondensed_struct.n_rows();
+ unsigned int n_rows = uncondensed_struct.n_rows();
if (next_constraint == lines.end())
// if no constraint is to be handled
// only evaluated so often as there are
// entries in new_line[*] which tells us
// which constraints exist
- for (int row=0; row<uncondensed_struct.n_rows(); ++row)
+ for (unsigned int row=0; row<uncondensed_struct.n_rows(); ++row)
if (new_line[row] != -1)
// line not constrained
// copy entries if column will not
// be condensed away, distribute
// otherwise
- for (int j=uncondensed_struct.get_rowstart_indices()[row];
+ for (unsigned int j=uncondensed_struct.get_rowstart_indices()[row];
j<uncondensed_struct.get_rowstart_indices()[row+1]; ++j)
if (new_line[uncondensed_struct.get_column_numbers()[j]] != -1)
condensed.add (new_line[row], new_line[uncondensed_struct.get_column_numbers()[j]],
else
// line must be distributed
{
- for (int j=uncondensed_struct.get_rowstart_indices()[row];
+ for (unsigned int j=uncondensed_struct.get_rowstart_indices()[row];
j<uncondensed_struct.get_rowstart_indices()[row+1]; ++j)
// for each column: distribute
if (new_line[uncondensed_struct.get_column_numbers()[j]] != -1)
// for gcc2.9: replace this by
// distribute(sparsity.n_rows(), -1)
vector<int> distribute;
- distribute.reserve (sparsity.n_rows());
- // replace the following line, since
- // gcc2.8 chokes over it.
-// distribute.insert (distribute.end(), sparsity.n_rows(), -1);
- for (unsigned int i=0; i<(unsigned int)sparsity.n_rows(); ++i)
- distribute.push_back (-1);
-
+ distribute.resize (sparsity.n_rows(), -1);
- for (int c=0; c<(signed int)lines.size(); ++c)
- distribute[lines[c].line] = c;
+ for (unsigned int c=0; c<lines.size(); ++c)
+ distribute[lines[c].line] = (signed int)c;
int n_rows = sparsity.n_rows();
for (int row=0; row<n_rows; ++row)
if (distribute[row] == -1)
// regular line. loop over cols
- for (int j=sparsity.get_rowstart_indices()[row];
+ for (unsigned int j=sparsity.get_rowstart_indices()[row];
j<sparsity.get_rowstart_indices()[row+1]; ++j)
// end of row reached?
if (sparsity.get_column_numbers()[j] == -1)
}
else
// row must be distributed
- for (int j=sparsity.get_rowstart_indices()[row];
+ for (unsigned int j=sparsity.get_rowstart_indices()[row];
j<sparsity.get_rowstart_indices()[row+1]; ++j)
// end of row reached?
if (sparsity.get_column_numbers()[j] == -1)
void ConstraintMatrix::condense (const dVector &uncondensed,
dVector &condensed) const {
Assert (sorted == true, ExcMatrixNotClosed());
- Assert ((unsigned int)condensed.n()+n_constraints() == (unsigned int)uncondensed.n(),
+ Assert (condensed.n()+n_constraints() == uncondensed.n(),
ExcWrongDimension());
// store for each line of the vector
vector<ConstraintLine>::const_iterator next_constraint = lines.begin();
unsigned int shift = 0;
- unsigned int n_rows = (unsigned int)uncondensed.n();
+ unsigned int n_rows = uncondensed.n();
if (next_constraint == lines.end())
// if no constraint is to be handled
// only evaluated so often as there are
// entries in new_line[*] which tells us
// which constraints exist
- for (int row=0; row<uncondensed.n(); ++row)
+ for (unsigned int row=0; row<uncondensed.n(); ++row)
if (new_line[row] != -1)
// line not constrained
// copy entry
return;
vector<ConstraintLine>::const_iterator next_constraint = lines.begin();
- for (unsigned int row=0; row<(unsigned int)vec.n(); ++row)
+ for (unsigned int row=0; row<vec.n(); ++row)
if (row == (*next_constraint).line)
// line must be distributed
{
void ConstraintMatrix::distribute (const dVector &condensed,
dVector &uncondensed) const {
Assert (sorted == true, ExcMatrixNotClosed());
- Assert ((unsigned int)condensed.n()+n_constraints() == (unsigned int)uncondensed.n(),
+ Assert (condensed.n()+n_constraints() == uncondensed.n(),
ExcWrongDimension());
// store for each line of the new vector
vector<ConstraintLine>::const_iterator next_constraint = lines.begin();
unsigned int shift = 0;
- unsigned int n_rows = (unsigned int)uncondensed.n();
+ unsigned int n_rows = uncondensed.n();
if (next_constraint == lines.end())
// if no constraint is to be handled
// only evaluated so often as there are
// entries in new_line[*] which tells us
// which constraints exist
- for (unsigned int line=0; line<(unsigned int)uncondensed.n(); ++line)
+ for (unsigned int line=0; line<uncondensed.n(); ++line)
if (old_line[line] != -1)
// line was not condensed away
uncondensed(line) = condensed(old_line[line]);
// workaround
// vector<int> new_number(sparsity.n_rows(), -1);
vector<int> new_number;
- new_number.reserve (sparsity.n_rows());
- for (unsigned int i=0; i<(unsigned int)sparsity.n_rows(); ++i)
- new_number.push_back (-1);
+ new_number.resize (sparsity.n_rows(), -1);
// store the indices of the dofs renumbered
// in the last round. Default to starting
unsigned int min_coordination = n_dofs;
for (int row=0; row<n_dofs; ++row)
{
- int j;
+ unsigned int j;
for (j=sparsity.get_rowstart_indices()[row];
j<sparsity.get_rowstart_indices()[row+1]; ++j)
if (sparsity.get_column_numbers()[j] == -1)
break;
- // post: coordination is now
+ // post-condition after loop:
+ // coordination is now
// j-rowstart[row]
- if (j-sparsity.get_rowstart_indices()[row] < (signed int)min_coordination)
+ if (j-sparsity.get_rowstart_indices()[row] < min_coordination)
{
min_coordination = j-sparsity.get_rowstart_indices()[row];
starting_point = row;
// dofs numbered in the last
// round
for (unsigned int i=0; i<last_round_dofs.size(); ++i)
- for (int j=sparsity.get_rowstart_indices()[last_round_dofs[i]];
+ for (unsigned int j=sparsity.get_rowstart_indices()[last_round_dofs[i]];
j<sparsity.get_rowstart_indices()[last_round_dofs[i]+1]; ++j)
if (sparsity.get_column_numbers()[j] == -1)
break;
s!=next_round_dofs.end(); ++s)
{
unsigned int coordination = 0;
- for (int j=sparsity.get_rowstart_indices()[*s];
+ for (unsigned int j=sparsity.get_rowstart_indices()[*s];
j<sparsity.get_rowstart_indices()[*s+1]; ++j)
if (sparsity.get_column_numbers()[j] == -1)
break;
2*selected_fe->dofs_per_line);
Assert(2*selected_fe->dofs_per_vertex+selected_fe->dofs_per_line ==
- (unsigned int)selected_fe->constraints().n(),
+ selected_fe->constraints().n(),
ExcDifferentDimensions(2*selected_fe->dofs_per_vertex+
selected_fe->dofs_per_line,
selected_fe->constraints().n()));
Assert(selected_fe->dofs_per_vertex+2*selected_fe->dofs_per_line ==
- (unsigned int)selected_fe->constraints().m(),
+ selected_fe->constraints().m(),
ExcDifferentDimensions(3*selected_fe->dofs_per_vertex+
2*selected_fe->dofs_per_line,
selected_fe->constraints().m()));
#ifdef DEBUG
for (unsigned int c=0; c<(1<<dim); ++c)
{
- Assert ((unsigned int)selected_fe->prolongate(c).m() ==
- selected_fe->total_dofs,
+ Assert (selected_fe->prolongate(c).m() == selected_fe->total_dofs,
ExcMatrixHasWrongSize(selected_fe->prolongate(c).m()));
- Assert ((unsigned int)selected_fe->prolongate(c).n() ==
- selected_fe->total_dofs,
+ Assert (selected_fe->prolongate(c).n() == selected_fe->total_dofs,
ExcMatrixHasWrongSize(selected_fe->prolongate(c).n()));
- Assert ((unsigned int)selected_fe->restrict(c).m() ==
- selected_fe->total_dofs,
+ Assert (selected_fe->restrict(c).m() == selected_fe->total_dofs,
ExcMatrixHasWrongSize(selected_fe->restrict(c).m()));
- Assert ((unsigned int)selected_fe->restrict(c).n() ==
- selected_fe->total_dofs,
+ Assert (selected_fe->restrict(c).n() == selected_fe->total_dofs,
ExcMatrixHasWrongSize(selected_fe->restrict(c).n()));
};
#endif
// their size
for (unsigned int i=0; i<levels.size(); ++i)
delete levels[i];
- levels.erase (levels.begin(), levels.end());
+ levels.resize (0);
vertex_dofs.erase (vertex_dofs.begin(), vertex_dofs.end());
- vertex_dofs.reserve (tria->vertices.size());
- vertex_dofs.insert (vertex_dofs.end(),
- tria->vertices.size(),
- -1);
+ vertex_dofs.resize (tria->vertices.size(), -1);
for (unsigned int i=0; i<tria->n_levels(); ++i)
{
levels.push_back (new DoFLevel<1>);
- levels.back()->line_dofs.reserve (tria->levels[i]->lines.lines.size() *
- fe.dofs_per_line);
- levels.back()->line_dofs.insert (levels.back()->line_dofs.end(),
- (tria->levels[i]->lines.lines.size() *
- fe.dofs_per_line),
+ levels.back()->line_dofs.resize (tria->levels[i]->lines.lines.size() *
+ fe.dofs_per_line,
-1);
};
};
// their size
for (unsigned int i=0; i<levels.size(); ++i)
delete levels[i];
- levels.erase (levels.begin(), levels.end());
+ levels.resize (0);
vertex_dofs.erase (vertex_dofs.begin(), vertex_dofs.end());
- vertex_dofs.reserve (tria->vertices.size());
- vertex_dofs.insert (vertex_dofs.end(),
- tria->vertices.size(),
+ vertex_dofs.resize (tria->vertices.size(),
-1);
for (unsigned int i=0; i<tria->n_levels(); ++i)
{
levels.push_back (new DoFLevel<2>);
- levels.back()->line_dofs.reserve (tria->levels[i]->lines.lines.size() *
- fe.dofs_per_line);
- levels.back()->line_dofs.insert (levels.back()->line_dofs.end(),
- (tria->levels[i]->lines.lines.size() *
- fe.dofs_per_line),
+ levels.back()->line_dofs.resize (tria->levels[i]->lines.lines.size() *
+ fe.dofs_per_line,
-1);
-
- levels.back()->quad_dofs.reserve (tria->levels[i]->quads.quads.size() *
- fe.dofs_per_quad);
- levels.back()->quad_dofs.insert (levels.back()->quad_dofs.end(),
- (tria->levels[i]->quads.quads.size() *
- fe.dofs_per_quad),
+ levels.back()->quad_dofs.resize (tria->levels[i]->quads.quads.size() *
+ fe.dofs_per_quad,
-1);
};
};
for (unsigned int i=0; i<levels.size(); ++i)
delete levels[i];
- levels.erase (levels.begin(), levels.end());
+ levels.resize (0);
};
template <int dim>
unsigned int Triangulation<dim>::max_adjacent_cells () const {
cell_iterator cell = begin(0),
- endc = (levels.size() != 0 ? begin(1) : cell_iterator(end()));
+ endc = (levels.size() > 1 ? begin(1) : cell_iterator(end()));
// store the largest index of the vertices
// used on level 0
unsigned int max_vertex_index = 0;
bind2nd (equal_to<bool>(), true),
needed_vertices);
- vertices.reserve (needed_vertices);
- vertices_used.reserve (needed_vertices);
- vertices.insert (vertices.end(),
- needed_vertices-vertices.size(),
- Point<1>());
- vertices_used.insert (vertices_used.end(),
- needed_vertices-vertices_used.size(),
- false);
-
-
+ vertices.resize (needed_vertices, Point<1>());
+ vertices_used.resize (needed_vertices, false);
// Do REFINEMENT
needed_vertices);
// reserve enough space for all vertices
- vertices.reserve (needed_vertices);
- vertices_used.reserve (needed_vertices);
- vertices.insert (vertices.end(),
- needed_vertices-vertices.size(),
- Point<2>());
- vertices_used.insert (vertices_used.end(),
- needed_vertices-vertices_used.size(),
- false);
-
+ vertices.resize (needed_vertices, Point<2>());
+ vertices_used.resize (needed_vertices, false);