From c92c908ac5c19cc28850df8da6672b5418d5a986 Mon Sep 17 00:00:00 2001 From: hartmann Date: Wed, 5 Feb 2003 08:36:45 +0000 Subject: [PATCH] Avoid 'if (a=b)' warning. Cleaning up the functions. git-svn-id: https://svn.dealii.org/trunk@7025 0785d39b-7218-0410-832d-ea1e28bc413d --- .../source/numerics/solution_transfer.cc | 88 ++++++++++--------- 1 file changed, 47 insertions(+), 41 deletions(-) diff --git a/deal.II/deal.II/source/numerics/solution_transfer.cc b/deal.II/deal.II/source/numerics/solution_transfer.cc index 64201dc5f1..96fa0927c8 100644 --- a/deal.II/deal.II/source/numerics/solution_transfer.cc +++ b/deal.II/deal.II/source/numerics/solution_transfer.cc @@ -200,15 +200,16 @@ prepare_for_coarsening_and_refinement(const std::vector > &all_in GeometryInfo::children_per_cell; // allocate the needed memory - indices_on_cell = std::vector > (n_cells_to_stay_or_refine, - std::vector (dofs_per_cell)); - dof_values_on_cell - = std::vector > > (n_coarsen_fathers, - std::vector > (in_size, - Vector (dofs_per_cell))); + indices_on_cell=std::vector > ( + n_cells_to_stay_or_refine, + std::vector (dofs_per_cell)); + + dof_values_on_cell=std::vector > > ( + n_coarsen_fathers, + std::vector > (in_size, Vector (dofs_per_cell))); - all_pointerstructs = std::vector (n_cells_to_stay_or_refine + - n_coarsen_fathers); + all_pointerstructs=std::vector ( + n_cells_to_stay_or_refine+n_coarsen_fathers); // we need counters for @@ -288,50 +289,54 @@ interpolate (const std::vector > &all_in, ExcWrongVectorSize(all_in[i].size(), n_dofs_old)); - unsigned int out_size=all_out.size(); + const unsigned int out_size=all_out.size(); + const unsigned int in_size=all_in.size(); // resize the output vector - if (all_out.size() != all_in.size()) - all_out = std::vector >(all_in.size(), - Vector(dof_handler->n_dofs())); + if (out_size != in_size) + all_out=std::vector >( + in_size, Vector(dof_handler->n_dofs())); else - { - for (unsigned int i=0; in_dofs()) - all_out[i].reinit (dof_handler->n_dofs()); - }; + for (unsigned int i=0; in_dofs()) + all_out[i].reinit (dof_handler->n_dofs()); - for (unsigned int i=0; iget_fe().dofs_per_cell; Vector local_values(dofs_per_cell); - - std::vector *indexptr; - Pointerstruct *structptr; - std::vector > *valuesptr; - std::vector dofs(dofs_per_cell); + std::vector dofs(dofs_per_cell); typename DoFHandler::cell_iterator cell = dof_handler->begin(), endc = dof_handler->end(); - for (; cell!=endc; ++cell) { if (cell->user_pointer()) { - structptr=static_cast(cell->user_pointer()); - // cell stayed or is refined - if (indexptr=structptr->indices_ptr) + const Pointerstruct * const structptr + =static_cast(cell->user_pointer()); + + const std::vector * const indexptr + =structptr->indices_ptr; + + const std::vector > * const valuesptr + =structptr->dof_values_ptr; + + // cell stayed or is + // refined + if (indexptr) { Assert (structptr->dof_values_ptr == 0, ExcInternalError()); - - // get the values of each of - // the input data vectors on - // this cell and prolong it + + // get the values of + // each of the input + // data vectors on this + // cell and prolong it // to its children for (unsigned int j=0; j > &all_in, all_out[j]); } } - // children of cell were deleted - else if (valuesptr=structptr->dof_values_ptr) + // children of cell were + // deleted + else if (valuesptr) { Assert (!cell->has_children(), ExcInternalError()); Assert (structptr->indices_ptr == 0, ExcInternalError()); - // get the local indices + // get the local + // indices cell->get_dof_indices(dofs); - // distribute the stored data - // to the new vectors + // distribute the + // stored data to the + // new vectors for (unsigned int j=0; joperator[](j)(i); - } + for (unsigned int i=0; ioperator[](j)(i); } // undefined status else -- 2.39.5