From 4e9c61f82bd1eca138c9d33a16c24ff137e3b4b3 Mon Sep 17 00:00:00 2001 From: koecher Date: Fri, 10 Aug 2012 16:44:51 +0000 Subject: [PATCH] convert some unsigned ints to types::global_dof_index git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_3@25889 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/files | 4 +- .../include/deal.II/numerics/matrix_tools.h | 38 +++--- deal.II/source/numerics/matrix_tools.cc | 128 +++++++++--------- 3 files changed, 85 insertions(+), 85 deletions(-) diff --git a/deal.II/files b/deal.II/files index 5b38b2e2c7..d90abcd958 100644 --- a/deal.II/files +++ b/deal.II/files @@ -189,8 +189,8 @@ UWE source/numerics/dof_output_operator.cc UWE source/numerics/error_estimator.cc UWE source/numerics/fe_field_function.cc UWE source/numerics/histogram.cc -Uwe source/numerics/matrix_free.cc -source/numerics/matrix_tools.cc +UWE source/numerics/matrix_free.cc +UWE source/numerics/matrix_tools.cc source/numerics/mesh_worker.cc source/numerics/mesh_worker_info.cc source/numerics/mesh_worker_vector_selector.cc diff --git a/deal.II/include/deal.II/numerics/matrix_tools.h b/deal.II/include/deal.II/numerics/matrix_tools.h index 882c422ad1..0dc698d2d7 100644 --- a/deal.II/include/deal.II/numerics/matrix_tools.h +++ b/deal.II/include/deal.II/numerics/matrix_tools.h @@ -367,7 +367,7 @@ namespace MatrixCreator SparseMatrix &matrix, const typename FunctionMap::type &boundary_functions, Vector &rhs_vector, - std::vector&dof_to_boundary_mapping, + std::vector&dof_to_boundary_mapping, const Function * const weight = 0, std::vector component_mapping = std::vector()); @@ -380,7 +380,7 @@ namespace MatrixCreator // SparseMatrix &matrix, // const FunctionMap<1>::type &boundary_functions, // Vector &rhs_vector, -// std::vector&dof_to_boundary_mapping, +// std::vector&dof_to_boundary_mapping, // const Function<1> * const a = 0); // //codimension 1 // @@ -390,7 +390,7 @@ namespace MatrixCreator // SparseMatrix &matrix, // const FunctionMap<2>::type &boundary_functions, // Vector &rhs_vector, -// std::vector&dof_to_boundary_mapping, +// std::vector&dof_to_boundary_mapping, // const Function<2> * const a = 0); @@ -408,7 +408,7 @@ namespace MatrixCreator SparseMatrix &matrix, const typename FunctionMap::type &boundary_functions, Vector &rhs_vector, - std::vector&dof_to_boundary_mapping, + std::vector&dof_to_boundary_mapping, const Function * const a = 0, std::vector component_mapping = std::vector()); @@ -424,7 +424,7 @@ namespace MatrixCreator SparseMatrix &matrix, const typename FunctionMap::type &boundary_functions, Vector &rhs_vector, - std::vector&dof_to_boundary_mapping, + std::vector&dof_to_boundary_mapping, const Function * const a = 0, std::vector component_mapping = std::vector()); @@ -439,7 +439,7 @@ namespace MatrixCreator // SparseMatrix &matrix, // const FunctionMap<1>::type &boundary_functions, // Vector &rhs_vector, -// std::vector&dof_to_boundary_mapping, +// std::vector&dof_to_boundary_mapping, // const Function<1> * const a = 0); /** @@ -453,7 +453,7 @@ namespace MatrixCreator SparseMatrix &matrix, const typename FunctionMap::type &boundary_functions, Vector &rhs_vector, - std::vector&dof_to_boundary_mapping, + std::vector&dof_to_boundary_mapping, const Function * const a = 0, std::vector component_mapping = std::vector()); @@ -805,7 +805,7 @@ namespace MatrixTools */ template void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, SparseMatrix &matrix, Vector &solution, Vector &right_hand_side, @@ -822,7 +822,7 @@ namespace MatrixTools */ template void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, BlockSparseMatrix &matrix, BlockVector &solution, BlockVector &right_hand_side, @@ -867,7 +867,7 @@ namespace MatrixTools * step-18. */ void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, PETScWrappers::SparseMatrix &matrix, PETScWrappers::Vector &solution, PETScWrappers::Vector &right_hand_side, @@ -878,7 +878,7 @@ namespace MatrixTools * matrices. */ void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, PETScWrappers::MPI::SparseMatrix &matrix, PETScWrappers::MPI::Vector &solution, PETScWrappers::MPI::Vector &right_hand_side, @@ -910,7 +910,7 @@ namespace MatrixTools * to this function is the same. */ void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, PETScWrappers::MPI::SparseMatrix &matrix, PETScWrappers::Vector &solution, PETScWrappers::MPI::Vector &right_hand_side, @@ -920,7 +920,7 @@ namespace MatrixTools * Same as above but for BlockSparseMatrix. */ void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, PETScWrappers::MPI::BlockSparseMatrix &matrix, PETScWrappers::MPI::BlockVector &solution, PETScWrappers::MPI::BlockVector &right_hand_side, @@ -968,7 +968,7 @@ namespace MatrixTools * across an MPI system. */ void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, TrilinosWrappers::SparseMatrix &matrix, TrilinosWrappers::Vector &solution, TrilinosWrappers::Vector &right_hand_side, @@ -980,7 +980,7 @@ namespace MatrixTools * working on block structures. */ void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, TrilinosWrappers::BlockSparseMatrix &matrix, TrilinosWrappers::BlockVector &solution, TrilinosWrappers::BlockVector &right_hand_side, @@ -1023,7 +1023,7 @@ namespace MatrixTools * types. */ void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, TrilinosWrappers::SparseMatrix &matrix, TrilinosWrappers::MPI::Vector &solution, TrilinosWrappers::MPI::Vector &right_hand_side, @@ -1035,7 +1035,7 @@ namespace MatrixTools * on block structures. */ void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, TrilinosWrappers::BlockSparseMatrix &matrix, TrilinosWrappers::MPI::BlockVector &solution, TrilinosWrappers::MPI::BlockVector &right_hand_side, @@ -1079,8 +1079,8 @@ namespace MatrixTools * documentation of this class. */ void - local_apply_boundary_values (const std::map &boundary_values, - const std::vector &local_dof_indices, + local_apply_boundary_values (const std::map &boundary_values, + const std::vector &local_dof_indices, FullMatrix &local_matrix, Vector &local_rhs, const bool eliminate_columns); diff --git a/deal.II/source/numerics/matrix_tools.cc b/deal.II/source/numerics/matrix_tools.cc index 84bf26e84e..e51cabea5c 100644 --- a/deal.II/source/numerics/matrix_tools.cc +++ b/deal.II/source/numerics/matrix_tools.cc @@ -207,7 +207,7 @@ namespace MatrixCreator struct CopyData { - std::vector dof_indices; + std::vector dof_indices; FullMatrix cell_matrix; dealii::Vector cell_rhs; }; @@ -825,7 +825,7 @@ namespace MatrixCreator SparseMatrix &matrix, const typename FunctionMap::type &boundary_functions, Vector &rhs_vector, - std::vector &dof_to_boundary_mapping, + std::vector &dof_to_boundary_mapping, const Function * const coefficient, const std::vector& component_mapping, const MatrixCreator::internal::IteratorRange > range, @@ -870,8 +870,8 @@ namespace MatrixCreator std::vector > rhs_values_system (fe_values.n_quadrature_points, Vector(n_function_components)); - std::vector dofs (dofs_per_cell); - std::vector dofs_on_face_vector (dofs_per_face); + std::vector dofs (dofs_per_cell); + std::vector dofs_on_face_vector (dofs_per_face); // for each dof on the cell, have a // flag whether it is on the face @@ -1093,7 +1093,7 @@ namespace MatrixCreator SparseMatrix &, const FunctionMap<3>::type &, Vector &, - std::vector &, + std::vector &, const Function<3> * const , const std::vector &, const MatrixCreator::internal::IteratorRange > , @@ -1112,7 +1112,7 @@ namespace MatrixCreator SparseMatrix &, const FunctionMap<3>::type &, Vector &, - std::vector &, + std::vector &, const Function<3> * const , const std::vector &, const MatrixCreator::internal::IteratorRange > , @@ -1133,7 +1133,7 @@ namespace MatrixCreator SparseMatrix &matrix, const typename FunctionMap::type &boundary_functions, Vector &rhs_vector, - std::vector &dof_to_boundary_mapping, + std::vector &dof_to_boundary_mapping, const Function * const coefficient, std::vector component_mapping) { @@ -1193,7 +1193,7 @@ namespace MatrixCreator SparseMatrix &matrix, const typename FunctionMap::type &boundary_functions, Vector &rhs_vector, - std::vector &dof_to_boundary_mapping, + std::vector &dof_to_boundary_mapping, const Function * const coefficient, const std::vector& component_mapping, const MatrixCreator::internal::IteratorRange > range, @@ -1225,7 +1225,7 @@ namespace MatrixCreator SparseMatrix &matrix, const typename FunctionMap::type &boundary_functions, Vector &rhs_vector, - std::vector &dof_to_boundary_mapping, + std::vector &dof_to_boundary_mapping, const Function * const coefficient, const std::vector& component_mapping, const MatrixCreator::internal::IteratorRange > range, @@ -1242,7 +1242,7 @@ namespace MatrixCreator if (true) { unsigned int max_element = 0; - for (std::vector::const_iterator i=dof_to_boundary_mapping.begin(); + for (std::vector::const_iterator i=dof_to_boundary_mapping.begin(); i!=dof_to_boundary_mapping.end(); ++i) if ((*i != hp::DoFHandler::invalid_dof_index) && (*i > max_element)) @@ -1272,8 +1272,8 @@ namespace MatrixCreator std::vector rhs_values_scalar; std::vector > rhs_values_system; - std::vector dofs (max_dofs_per_cell); - std::vector dofs_on_face_vector (max_dofs_per_face); + std::vector dofs (max_dofs_per_cell); + std::vector dofs_on_face_vector (max_dofs_per_face); // for each dof on the cell, have a // flag whether it is on the face @@ -1591,7 +1591,7 @@ namespace MatrixCreator SparseMatrix &matrix, const typename FunctionMap::type &rhs, Vector &rhs_vector, - std::vector &dof_to_boundary_mapping, + std::vector &dof_to_boundary_mapping, const Function * const a, std::vector component_mapping) { @@ -1610,7 +1610,7 @@ namespace MatrixCreator SparseMatrix &matrix, const typename FunctionMap::type &boundary_functions, Vector &rhs_vector, - std::vector &dof_to_boundary_mapping, + std::vector &dof_to_boundary_mapping, const Function * const coefficient, std::vector component_mapping) { @@ -1670,7 +1670,7 @@ namespace MatrixCreator SparseMatrix &matrix, const typename FunctionMap::type &boundary_functions, Vector &rhs_vector, - std::vector &dof_to_boundary_mapping, + std::vector &dof_to_boundary_mapping, const Function * const coefficient, const std::vector& component_mapping, const MatrixCreator::internal::IteratorRange > range, @@ -1697,7 +1697,7 @@ namespace MatrixCreator SparseMatrix &matrix, const typename FunctionMap::type &rhs, Vector &rhs_vector, - std::vector &dof_to_boundary_mapping, + std::vector &dof_to_boundary_mapping, const Function * const a, std::vector component_mapping) { @@ -1943,7 +1943,7 @@ namespace MatrixTools //TODO:[WB] I don't think that the optimized storage of diagonals is needed (GK) template void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, SparseMatrix &matrix, Vector &solution, Vector &right_hand_side, @@ -1980,7 +1980,7 @@ namespace MatrixTools } - std::map::const_iterator dof = boundary_values.begin(), + std::map::const_iterator dof = boundary_values.begin(), endd = boundary_values.end(); const SparsityPattern &sparsity = matrix.get_sparsity_pattern(); const std::size_t *sparsity_rowstart = sparsity.get_rowstart_indices(); @@ -1989,7 +1989,7 @@ namespace MatrixTools { Assert (dof->first < n_dofs, ExcInternalError()); - const unsigned int dof_number = dof->first; + const types::global_dof_index dof_number = dof->first; // for each boundary dof: // set entries of this line @@ -2000,8 +2000,8 @@ namespace MatrixTools // we shall not set // matrix.global_entry( // sparsity_rowstart[dof.first]) - const unsigned int last = sparsity_rowstart[dof_number+1]; - for (unsigned int j=sparsity_rowstart[dof_number]+1; j void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, BlockSparseMatrix &matrix, BlockVector &solution, BlockVector &right_hand_side, @@ -2174,7 +2174,7 @@ namespace MatrixTools first_nonzero_diagonal_entry = 1; - std::map::const_iterator dof = boundary_values.begin(), + std::map::const_iterator dof = boundary_values.begin(), endd = boundary_values.end(); const BlockSparsityPattern & sparsity_pattern = matrix.get_sparsity_pattern(); @@ -2195,8 +2195,8 @@ namespace MatrixTools // get global index and index // in the block in which this // dof is located - const unsigned int dof_number = dof->first; - const std::pair + const types::global_dof_index dof_number = dof->first; + const std::pair block_index = index_mapping.global_to_local (dof_number); // for each boundary dof: @@ -2359,7 +2359,7 @@ namespace MatrixTools // cases with // square // sub-matrices - const unsigned int *p = 0; + const types::global_dof_index *p = 0; if (this_sparsity.n_rows() == this_sparsity.n_cols()) { if (this_sparsity.get_column_numbers() @@ -2404,7 +2404,7 @@ namespace MatrixTools [this_sparsity.get_rowstart_indices()[row+1]]), ExcInternalError()); - const unsigned int global_entry + const types::global_dof_index global_entry = (p - &this_sparsity.get_column_numbers() @@ -2436,7 +2436,7 @@ namespace MatrixTools { template void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, PETScMatrix &matrix, PETScVector &solution, PETScVector &right_hand_side, @@ -2483,7 +2483,7 @@ namespace MatrixTools // figure out which rows of the matrix we // have to eliminate on this processor std::vector constrained_rows; - for (std::map::const_iterator + for (std::map::const_iterator dof = boundary_values.begin(); dof != boundary_values.end(); ++dof) @@ -2521,9 +2521,9 @@ namespace MatrixTools right_hand_side.compress (); solution.compress (); - std::vector indices; + std::vector indices; std::vector solution_values; - for (std::map::const_iterator + for (std::map::const_iterator dof = boundary_values.begin(); dof != boundary_values.end(); ++dof) @@ -2553,7 +2553,7 @@ namespace MatrixTools void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, PETScWrappers::SparseMatrix &matrix, PETScWrappers::Vector &solution, PETScWrappers::Vector &right_hand_side, @@ -2568,7 +2568,7 @@ namespace MatrixTools void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, PETScWrappers::MPI::SparseMatrix &matrix, PETScWrappers::MPI::Vector &solution, PETScWrappers::MPI::Vector &right_hand_side, @@ -2585,7 +2585,7 @@ namespace MatrixTools void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, PETScWrappers::MPI::BlockSparseMatrix &matrix, PETScWrappers::MPI::BlockVector &solution, PETScWrappers::MPI::BlockVector &right_hand_side, @@ -2609,7 +2609,7 @@ namespace MatrixTools std::vector > block_boundary_values(n_blocks); { int offset = 0, block=0; - for (std::map::const_iterator + for (std::map::const_iterator dof = boundary_values.begin(); dof != boundary_values.end(); ++dof) @@ -2619,8 +2619,8 @@ namespace MatrixTools offset += matrix.block(block,0).m(); block++; } - const unsigned int index = dof->first - offset; - block_boundary_values[block].insert(std::pair (index,dof->second)); + const types::global_dof_index index = dof->first - offset; + block_boundary_values[block].insert(std::pair (index,dof->second)); } } @@ -2640,11 +2640,11 @@ namespace MatrixTools // the whole row. for (unsigned int block_m=0; block_m local_range + const std::pair local_range = matrix.block(block_m,0).local_range(); std::vector constrained_rows; - for (std::map::const_iterator + for (std::map::const_iterator dof = block_boundary_values[block_m].begin(); dof != block_boundary_values[block_m].end(); ++dof) @@ -2670,7 +2670,7 @@ namespace MatrixTools { template void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, TrilinosMatrix &matrix, TrilinosVector &solution, TrilinosVector &right_hand_side, @@ -2688,7 +2688,7 @@ namespace MatrixTools if (boundary_values.size() == 0) return; - const std::pair local_range + const std::pair local_range = matrix.local_range(); Assert (local_range == right_hand_side.local_range(), ExcInternalError()); @@ -2706,7 +2706,7 @@ namespace MatrixTools // matrix that we can see. if we can't // find such an entry, take one TrilinosScalar average_nonzero_diagonal_entry = 1; - for (unsigned int i=local_range.first; i constrained_rows; - for (std::map::const_iterator + for (std::map::const_iterator dof = boundary_values.begin(); dof != boundary_values.end(); ++dof) @@ -2754,9 +2754,9 @@ namespace MatrixTools right_hand_side.compress (); solution.compress (); - std::vector indices; + std::vector indices; std::vector solution_values; - for (std::map::const_iterator + for (std::map::const_iterator dof = boundary_values.begin(); dof != boundary_values.end(); ++dof) @@ -2785,7 +2785,7 @@ namespace MatrixTools template void - apply_block_boundary_values (const std::map &boundary_values, + apply_block_boundary_values (const std::map &boundary_values, TrilinosMatrix &matrix, TrilinosBlockVector &solution, TrilinosBlockVector &right_hand_side, @@ -2808,10 +2808,10 @@ namespace MatrixTools // into blocks for the boundary values. // To this end, generate a vector of // maps with the respective indices. - std::vector > block_boundary_values(n_blocks); + std::vector > block_boundary_values(n_blocks); { int offset = 0, block=0; - for (std::map::const_iterator + for (std::map::const_iterator dof = boundary_values.begin(); dof != boundary_values.end(); ++dof) @@ -2821,9 +2821,9 @@ namespace MatrixTools offset += matrix.block(block,0).m(); block++; } - const unsigned int index = dof->first - offset; + const types::global_dof_index index = dof->first - offset; block_boundary_values[block].insert( - std::pair (index,dof->second)); + std::pair (index,dof->second)); } } @@ -2843,11 +2843,11 @@ namespace MatrixTools // the whole row. for (unsigned int block_m=0; block_m local_range + const std::pair local_range = matrix.block(block_m,0).local_range(); std::vector constrained_rows; - for (std::map::const_iterator + for (std::map::const_iterator dof = block_boundary_values[block_m].begin(); dof != block_boundary_values[block_m].end(); ++dof) @@ -2867,7 +2867,7 @@ namespace MatrixTools void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, TrilinosWrappers::SparseMatrix &matrix, TrilinosWrappers::Vector &solution, TrilinosWrappers::Vector &right_hand_side, @@ -2882,7 +2882,7 @@ namespace MatrixTools void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, TrilinosWrappers::SparseMatrix &matrix, TrilinosWrappers::MPI::Vector &solution, TrilinosWrappers::MPI::Vector &right_hand_side, @@ -2897,7 +2897,7 @@ namespace MatrixTools void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, TrilinosWrappers::BlockSparseMatrix &matrix, TrilinosWrappers::BlockVector &solution, TrilinosWrappers::BlockVector &right_hand_side, @@ -2911,7 +2911,7 @@ namespace MatrixTools void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, TrilinosWrappers::BlockSparseMatrix &matrix, TrilinosWrappers::MPI::BlockVector &solution, TrilinosWrappers::MPI::BlockVector &right_hand_side, @@ -2927,8 +2927,8 @@ namespace MatrixTools void - local_apply_boundary_values (const std::map &boundary_values, - const std::vector &local_dof_indices, + local_apply_boundary_values (const std::map &boundary_values, + const std::vector &local_dof_indices, FullMatrix &local_matrix, Vector &local_rhs, const bool eliminate_columns) @@ -2975,7 +2975,7 @@ namespace MatrixTools const unsigned int n_local_dofs = local_dof_indices.size(); for (unsigned int i=0; i::const_iterator + const std::map::const_iterator boundary_value = boundary_values.find (local_dof_indices[i]); if (boundary_value != boundary_values.end()) { @@ -3049,14 +3049,14 @@ namespace MatrixTools { template void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, SparseMatrix &matrix, Vector &solution, Vector &right_hand_side, const bool eliminate_columns); template void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, SparseMatrix &matrix, Vector &solution, Vector &right_hand_side, @@ -3064,14 +3064,14 @@ namespace MatrixTools template void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, BlockSparseMatrix &matrix, BlockVector &solution, BlockVector &right_hand_side, const bool eliminate_columns); template void - apply_boundary_values (const std::map &boundary_values, + apply_boundary_values (const std::map &boundary_values, BlockSparseMatrix &matrix, BlockVector &solution, BlockVector &right_hand_side, -- 2.39.5