From: Martin Kronbichler Date: Mon, 21 Sep 2009 09:22:09 +0000 (+0000) Subject: Removed trailing whitespace. X-Git-Tag: v8.0.0~7089 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb9cdec8799df4f8236ceba344275de688b0eb28;p=dealii.git Removed trailing whitespace. git-svn-id: https://svn.dealii.org/trunk@19486 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/dofs/dof_accessor.templates.h b/deal.II/deal.II/include/dofs/dof_accessor.templates.h index 17ea766c97..3597fc3af9 100644 --- a/deal.II/deal.II/include/dofs/dof_accessor.templates.h +++ b/deal.II/deal.II/include/dofs/dof_accessor.templates.h @@ -153,12 +153,12 @@ DoFAccessor::child (const unsigned int i) const next_level = this->level()+1; else next_level = 0; - + TriaIterator > q (this->tria, next_level, this->child_index (i), this->dof_handler); - + // make sure that we either created // a past-the-end iterator or one // pointing to a used cell @@ -223,7 +223,7 @@ namespace internal local_index, global_index); } - + template static @@ -265,8 +265,8 @@ namespace internal local_index, global_index); } - - + + template static unsigned int @@ -405,7 +405,7 @@ namespace internal get_dof_index (dof_handler, obj_index, fe_index, - local_index); + local_index); } @@ -505,7 +505,7 @@ namespace internal fe_index, local_index, global_index, - obj_level); + obj_level); } @@ -585,7 +585,7 @@ namespace internal fe_index, local_index, global_index, - obj_level); + obj_level); } @@ -665,7 +665,7 @@ namespace internal fe_index, local_index, global_index, - obj_level); + obj_level); } @@ -778,10 +778,10 @@ namespace internal ExcMessage ("This cell is not active and therefore can't be " "queried for its active FE indices")); Assert (n == 0, ExcIndexRange (n, 0, 1)); - + return dealii::DoFHandler::default_fe_index; } - + template static @@ -873,7 +873,7 @@ namespace internal n); } - + template static @@ -1133,7 +1133,7 @@ namespace internal Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); const unsigned int this_fe_index = *pointer; - + Assert (this_fe_index != numbers::invalid_unsigned_int, ExcInternalError()); Assert (this_fe_index < dof_handler.finite_elements->size(), @@ -1148,8 +1148,8 @@ namespace internal pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; } } - - + + /** * Get the @p local_index-th * degree of freedom @@ -1182,7 +1182,7 @@ namespace internal dof_handler.vertex_dofs[vertex_index * dof_handler.selected_fe->dofs_per_vertex + local_index]; - } + } template @@ -1223,7 +1223,7 @@ namespace internal Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); const unsigned int this_fe_index = *pointer; - + Assert (this_fe_index != numbers::invalid_unsigned_int, ExcInternalError()); Assert (this_fe_index < dof_handler.finite_elements->size(), @@ -1265,14 +1265,14 @@ namespace internal Assert (*pointer != numbers::invalid_unsigned_int, ExcInternalError()); - + unsigned int counter = 0; while (true) { Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); const unsigned int this_fe_index = *pointer; - + if (this_fe_index == numbers::invalid_unsigned_int) return counter; else @@ -1317,14 +1317,14 @@ namespace internal Assert (*pointer != numbers::invalid_unsigned_int, ExcInternalError()); - + unsigned int counter = 0; while (true) { Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); const unsigned int this_fe_index = *pointer; - + Assert (this_fe_index < dof_handler.finite_elements->size(), ExcInternalError()); @@ -1333,12 +1333,12 @@ namespace internal Assert (this_fe_index != numbers::invalid_unsigned_int, ExcInternalError()); - + pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; - ++counter; + ++counter; } } - + /** @@ -1377,13 +1377,13 @@ namespace internal Assert (*pointer != numbers::invalid_unsigned_int, ExcInternalError()); - + while (true) { Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); const unsigned int this_fe_index = *pointer; - + Assert (this_fe_index < dof_handler.finite_elements->size(), ExcInternalError()); @@ -1396,7 +1396,7 @@ namespace internal pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; } } - + }; } } @@ -1409,7 +1409,7 @@ unsigned int DoFAccessor::dof_index (const unsigned int i, const unsigned int fe_index) const { - // access the respective DoF + // access the respective DoF return internal::DoFAccessor::Implementation::get_dof_index (*this->dof_handler, this->level(), this->present_index, @@ -1541,7 +1541,7 @@ namespace internal } - + template inline const FiniteElement & @@ -1561,7 +1561,7 @@ DoFAccessor::get_fe (const unsigned int fe_index) const { Assert (fe_index_is_active (fe_index) == true, ExcMessage ("This function can only be called for active fe indices")); - + return internal::DoFAccessor::get_fe (this->dof_handler->get_fe(), fe_index); } @@ -1587,7 +1587,7 @@ namespace internal } - + template void get_dof_indices (const dealii::DoFAccessor<2,DH> &accessor, std::vector &dof_indices, @@ -1621,7 +1621,7 @@ namespace internal *next++ = accessor.dof_index(d,fe_index); } - + template void get_dof_indices (const dealii::DoFAccessor<3,DH> &accessor, @@ -1720,7 +1720,7 @@ DoFAccessor::get_dof_indices (std::vector &dof_indic default: Assert (false, ExcNotImplemented()); } - + // this function really only makes // sense if either a) there are @@ -1756,7 +1756,7 @@ DoFAccessor::line (const unsigned int i) const Assert (structdim > 1, ExcImpossibleInDim(structdim)); // checking of 'i' happens in // line_index(i) - + return typename internal::DoFHandler::Iterators::line_iterator ( this->tria, @@ -1802,7 +1802,7 @@ namespace internal // internal::DoFCellAccessor using dealii::DoFCellAccessor; using dealii::DoFHandler; - + /** * A class with the same purpose as the similarly named class of the * Triangulation class. See there for more information. @@ -1832,11 +1832,11 @@ namespace internal (accessor.get_fe().dofs_per_cell != accessor.get_fe().dofs_per_vertex * GeometryInfo<1>::vertices_per_cell)) return; - + const unsigned int dofs_per_vertex = accessor.get_fe().dofs_per_vertex, dofs_per_line = accessor.get_fe().dofs_per_line, dofs_per_cell = accessor.get_fe().dofs_per_cell; - + // make sure the cache is at least // as big as we need it when // writing to the last element of @@ -1846,11 +1846,11 @@ namespace internal accessor.dof_handler->levels[accessor.present_level] ->cell_dof_indices_cache.size(), ExcInternalError()); - + std::vector::iterator next = (accessor.dof_handler->levels[accessor.present_level] ->cell_dof_indices_cache.begin() + accessor.present_index * dofs_per_cell); - + for (unsigned int vertex=0; vertex<2; ++vertex) for (unsigned int d=0; d::vertices_per_cell)) return; - + const unsigned int dofs_per_vertex = accessor.get_fe().dofs_per_vertex, dofs_per_line = accessor.get_fe().dofs_per_line, dofs_per_quad = accessor.get_fe().dofs_per_quad, @@ -1926,7 +1926,7 @@ namespace internal (accessor.get_fe().dofs_per_cell != accessor.get_fe().dofs_per_vertex * GeometryInfo<3>::vertices_per_cell)) return; - + const unsigned int dofs_per_vertex = accessor.get_fe().dofs_per_vertex, dofs_per_line = accessor.get_fe().dofs_per_line, dofs_per_quad = accessor.get_fe().dofs_per_quad, @@ -2001,7 +2001,7 @@ namespace internal update_cell_dof_indices_cache (const DoFCellAccessor > &) { //TODO[WB]: should implement a dof indices cache for hp as well - + // not implemented, but should also // not be called Assert (false, ExcNotImplemented()); @@ -2037,12 +2037,12 @@ namespace internal (accessor.get_fe().dofs_per_cell == accessor.get_fe().dofs_per_vertex * GeometryInfo::vertices_per_cell), ExcMessage ("Cell must either be active, or all DoFs must be in vertices")); - + unsigned int *cache = &accessor.dof_handler->levels[accessor.level()] - ->cell_dof_indices_cache[accessor.present_index * accessor.get_fe().dofs_per_cell]; + ->cell_dof_indices_cache[accessor.present_index * accessor.get_fe().dofs_per_cell]; for (unsigned int i=0; i > &accessor, std::vector &dof_indices) { - // no caching for hp::DoFHandler implemented + // no caching for hp::DoFHandler implemented accessor.dealii::DoFAccessor >::get_dof_indices (dof_indices, accessor.active_fe_index()); } @@ -2095,12 +2095,12 @@ namespace internal (accessor.get_fe().dofs_per_cell == accessor.get_fe().dofs_per_vertex * GeometryInfo::vertices_per_cell), ExcMessage ("Cell must either be active, or all DoFs must be in vertices")); - + unsigned int *cache = &accessor.dof_handler->levels[accessor.level()] - ->cell_dof_indices_cache[accessor.present_index * accessor.get_fe().dofs_per_cell]; + ->cell_dof_indices_cache[accessor.present_index * accessor.get_fe().dofs_per_cell]; for (unsigned int i=0; i local_dof_indices (dofs_per_cell); get_dof_indices (accessor, local_dof_indices); @@ -2156,12 +2156,12 @@ namespace internal (accessor.get_fe().dofs_per_cell == accessor.get_fe().dofs_per_vertex * GeometryInfo::vertices_per_cell), ExcMessage ("Cell must either be active, or all DoFs must be in vertices")); - + unsigned int *cache = &accessor.dof_handler->levels[accessor.level()] - ->cell_dof_indices_cache[accessor.present_index * accessor.get_fe().dofs_per_cell]; + ->cell_dof_indices_cache[accessor.present_index * accessor.get_fe().dofs_per_cell]; for (unsigned int i=0; i local_dof_indices (dofs_per_cell); get_dof_indices (accessor, local_dof_indices); for (unsigned int i=0; icell_dof_indices_cache[accessor.present_index * n_dofs]; // distribute cell vector - global_destination.add(n_dofs, dofs, + global_destination.add(n_dofs, dofs, &(*const_cast*>(&local_source))(0)); } @@ -2330,11 +2330,11 @@ namespace internal const unsigned int n_dofs = local_source.size(); //TODO[WB/MK]: This function could me made more efficient because it allocates memory, which could be avoided by passing in another argument as a scratch array. This should be fixed eventually - + // get indices of dofs std::vector dofs (n_dofs); accessor.get_dof_indices (dofs); - + // distribute cell vector global_destination.add (dofs, local_source); } @@ -2381,7 +2381,7 @@ namespace internal // distribute cell matrices for (unsigned int i=0; i dofs (n_dofs); accessor.get_dof_indices (dofs); - + // distribute cell vector global_destination.add(dofs,local_source); } @@ -2473,7 +2473,7 @@ DoFCellAccessor::neighbor (const unsigned int i) const this->neighbor_level (i), this->neighbor_index (i), this->dof_handler); - + #ifdef DEBUG if (q.state() != IteratorState::past_the_end) Assert (q->used(), TriaAccessorExceptions::ExcUnusedCellAsNeighbor()); @@ -2492,7 +2492,7 @@ DoFCellAccessor::child (const unsigned int i) const this->level()+1, this->child_index (i), this->dof_handler); - + #ifdef DEBUG if (q.state() != IteratorState::past_the_end) Assert (q->used(), TriaAccessorExceptions::ExcUnusedCellAsChild()); @@ -2510,7 +2510,7 @@ DoFCellAccessor::face (const unsigned int i) const Assert (static_cast(this->level()) < this->dof_handler->levels.size(), ExcMessage ("DoFHandler not initialized")); - const unsigned int dim = DH::dimension; + const unsigned int dim = DH::dimension; Assert (dim > 1, ExcImpossibleInDim(1)); switch (dim) @@ -2521,14 +2521,14 @@ DoFCellAccessor::face (const unsigned int i) const 0, this->line_index (i), this->dof_handler); - + case 3: return typename internal::DoFHandler::Iterators::face_iterator (this->tria, 0, this->quad_index (i), this->dof_handler); - + default: Assert (false, ExcNotImplemented()); return typename internal::DoFHandler::Iterators::face_iterator(); diff --git a/deal.II/examples/step-37/step-37.cc b/deal.II/examples/step-37/step-37.cc index 13903fda7c..0388244299 100644 --- a/deal.II/examples/step-37/step-37.cc +++ b/deal.II/examples/step-37/step-37.cc @@ -785,7 +785,7 @@ std::size_t MatrixFree::memory_consumption () const std::size_t glob_size = derivatives.memory_consumption() + indices_local_to_global.memory_consumption() + constraints.memory_consumption() + - small_matrix.memory_consumption() + + small_matrix.memory_consumption() + diagonal_values.memory_consumption() + sizeof(*this); return glob_size; } @@ -1060,7 +1060,7 @@ void LaplaceProblem::setup_system () system_matrix.get_constraints().close(); std::cout.precision(4); std::cout << "System matrix memory consumption: " - << (double)system_matrix.memory_consumption()*std::pow(2.,-20.) + << (double)system_matrix.memory_consumption()*std::pow(2.,-20.) << " MBytes." << std::endl; @@ -1236,7 +1236,7 @@ void LaplaceProblem::assemble_multigrid () (transpose (fe_values.inverse_jacobian(q)) * fe_values.inverse_jacobian(q)) * - fe_values.JxW(q) * + fe_values.JxW(q) * coefficient_values[q]); ++cell_no[level]; diff --git a/deal.II/examples/step-38/step-38.cc b/deal.II/examples/step-38/step-38.cc index 2e79616d83..753f24868e 100644 --- a/deal.II/examples/step-38/step-38.cc +++ b/deal.II/examples/step-38/step-38.cc @@ -1541,7 +1541,7 @@ void DGMethod::run () { GridGenerator::hyper_cube (triangulation); - triangulation.refine_global (3); + triangulation.refine_global (5); } else refine_grid (); @@ -1599,7 +1599,7 @@ void DGMethod::run () // two solutions for equality. solution1-=solution2; const double difference=solution1.linfty_norm(); - if (difference>1e-13) + if (difference>1e-12) std::cout << "solution1 and solution2 differ!!" << std::endl; else std::cout << "solution1 and solution2 coincide." << std::endl; diff --git a/deal.II/examples/step-5/step-5.cc b/deal.II/examples/step-5/step-5.cc index 965cc2a072..50ab262717 100644 --- a/deal.II/examples/step-5/step-5.cc +++ b/deal.II/examples/step-5/step-5.cc @@ -556,6 +556,9 @@ void LaplaceProblem::assemble_system () } + cell->distribute_local_to_global (cell_rhs, system_rhs); + cell->distribute_local_to_global (cell_matrix, system_matrix); + /* cell->get_dof_indices (local_dof_indices); for (unsigned int i=0; i::assemble_system () system_rhs(local_dof_indices[i]) += cell_rhs(i); } + */ } // With the matrix so built, we use diff --git a/deal.II/lac/include/lac/constraint_matrix.h b/deal.II/lac/include/lac/constraint_matrix.h index fb3fc0ca68..391c9bbf2a 100644 --- a/deal.II/lac/include/lac/constraint_matrix.h +++ b/deal.II/lac/include/lac/constraint_matrix.h @@ -164,7 +164,7 @@ class BlockIndices; * sparsity pattern and the constraints; third, the global matrix is * assembled; and fourth, the matrix is finally condensed. To do these steps, * you have (at least) two possibilities: - * + * *
    *
  • Use two different sparsity patterns and two different matrices: you * may eliminate the lines and rows connected with a constraint and create a @@ -228,10 +228,10 @@ class BlockIndices; * PETSc/Trilinos matrices, you can either copy an already condensed deal.II * matrix, or build the PETSc/Trilinos matrix in the already condensed form, * see the discussion below. - * - * + * + * *
    Condensing vectors
    - * + * * Condensing vectors works exactly as described above for matrices. Note that * condensation is an idempotent operation, i.e. doing it more than once on a * vector or matrix yields the same result as doing it only once: once an @@ -260,14 +260,14 @@ class BlockIndices; * The use of ConstraintMatrix for implementing Dirichlet boundary conditions * is discussed in the @ref step_22 "step-22" tutorial program. * - * + * *

    Avoiding explicit condensation

    * * Sometimes, one wants to avoid explicit condensation of a linear system * after it has been built at all. There are two main reasons for wanting to * do so: * - *
      + *
        *
      • * Condensation is an expensive operation, in particular if there * are many constraints and/or if the matrix has many nonzero entries. Both @@ -305,10 +305,10 @@ class BlockIndices; * matrices and right hand side vectors, whereas the distribute() function * discussed below is applied to the solution vector after solving the linear * system. - * - * + * + * *

        Distributing constraints

        - * + * * After solving the condensed system of equations, the solution vector has * to be redistributed. This is done by the two distribute() functions, one * working with two vectors, one working in-place. The operation of @@ -524,7 +524,7 @@ class ConstraintMatrix : public Subscriptor * again. */ void shift (const unsigned int offset); - + /** * Clear all entries of this * matrix. Reset the flag determining @@ -546,7 +546,7 @@ class ConstraintMatrix : public Subscriptor * @name Querying constraints * @{ */ - + /** * Return number of constraints stored in * this matrix. @@ -589,7 +589,7 @@ class ConstraintMatrix : public Subscriptor * from one. */ bool is_identity_constrained (const unsigned int index) const; - + /** * Return the maximum number of other * dofs that one dof is constrained @@ -671,7 +671,7 @@ class ConstraintMatrix : public Subscriptor /** * @} */ - + /** * @name Eliminating constraints from linear systems after their creation * @{ @@ -810,7 +810,7 @@ class ConstraintMatrix : public Subscriptor * patterns. */ void condense (BlockCompressedSimpleSparsityPattern &sparsity) const; - + /** * Condense a given matrix. The @@ -844,7 +844,7 @@ class ConstraintMatrix : public Subscriptor */ template void condense (BlockSparseMatrix &matrix) const; - + /** * Condense the given vector @p * uncondensed into @p condensed. It is @@ -936,7 +936,7 @@ class ConstraintMatrix : public Subscriptor * @name Eliminating constraints from linear systems during their creation * @{ */ - + /** * This function takes a vector of * local contributions (@p @@ -1217,7 +1217,7 @@ class ConstraintMatrix : public Subscriptor template void set_zero (VectorType &vec) const; - + /** * @} */ @@ -1226,7 +1226,7 @@ class ConstraintMatrix : public Subscriptor * @name Dealing with constraints after solving a linear system * @{ */ - + /** * Re-distribute the elements of the * vector @p condensed to @p @@ -1329,7 +1329,7 @@ class ConstraintMatrix : public Subscriptor << "to another DoF with number " << arg1 << ", which however is constrained by this object. This is not" << " allowed."); - + private: /** @@ -1457,12 +1457,12 @@ class ConstraintMatrix : public Subscriptor * misses. This should also be fixed by * using the O(1) algorithm to access * the fields of this array. - * + * * The field is useful in a number of * other contexts as well, though. */ std::vector constraint_line_exists; - + /** * Store whether the arrays are sorted. * If so, no new entries can be added. @@ -1558,9 +1558,9 @@ class ConstraintMatrix : public Subscriptor */ std::vector::iterator find_constraint (const unsigned int line); - + #ifdef DEAL_II_USE_TRILINOS -//TODO: Make use of the following member thread safe +//TODO: Make use of the following member thread safe /** * This vector is used to import data * within the distribute function. @@ -1601,8 +1601,8 @@ ConstraintMatrix::add_line (const unsigned int line) { Assert (sorted==false, ExcMatrixIsClosed()); - - + + // check whether line already exists; it // may, in which case we can just quit if ((line < constraint_line_exists.size()) @@ -1615,7 +1615,7 @@ ConstraintMatrix::add_line (const unsigned int line) if (line >= constraint_line_exists.size()) constraint_line_exists.resize (line+1, false); constraint_line_exists[line] = true; - + // push a new line to the end of the // list lines.push_back (ConstraintLine()); @@ -1654,7 +1654,7 @@ ConstraintMatrix::add_entry (const unsigned int line, ExcEntryAlreadyExists(line, column, p->second, value)); return; } - + line_ptr->entries.push_back (std::make_pair(column,value)); } @@ -1672,7 +1672,7 @@ ConstraintMatrix::set_inhomogeneity (const unsigned int line, inline bool -ConstraintMatrix::is_constrained (const unsigned int index) const +ConstraintMatrix::is_constrained (const unsigned int index) const { return ((index < constraint_line_exists.size()) && @@ -1683,9 +1683,9 @@ ConstraintMatrix::is_constrained (const unsigned int index) const inline bool -ConstraintMatrix::is_inhomogeneously_constrained (const unsigned int index) const +ConstraintMatrix::is_inhomogeneously_constrained (const unsigned int index) const { - const std::vector::const_iterator position + const std::vector::const_iterator position = find_constraint(index); return position!=lines.end() ? position->inhomogeneity != 0 : false; } @@ -1693,7 +1693,7 @@ ConstraintMatrix::is_inhomogeneously_constrained (const unsigned int index) cons inline -std::vector::const_iterator +std::vector::const_iterator ConstraintMatrix::find_constraint (const unsigned int line) const { if (is_constrained(line) == false) @@ -1720,7 +1720,7 @@ ConstraintMatrix::find_constraint (const unsigned int line) const inline -std::vector::iterator +std::vector::iterator ConstraintMatrix::find_constraint (const unsigned int line) { Assert (sorted==false, ExcMatrixIsClosed()); diff --git a/deal.II/lac/include/lac/petsc_solver.h b/deal.II/lac/include/lac/petsc_solver.h index b552fd6670..85bce7a21c 100644 --- a/deal.II/lac/include/lac/petsc_solver.h +++ b/deal.II/lac/include/lac/petsc_solver.h @@ -163,9 +163,9 @@ namespace PETScWrappers */ static #ifdef PETSC_USE_64BIT_INDICES - PetscErrorCode + PetscErrorCode #else - int + int #endif convergence_test (KSP ksp, #ifdef PETSC_USE_64BIT_INDICES diff --git a/deal.II/lac/include/lac/trilinos_vector.h b/deal.II/lac/include/lac/trilinos_vector.h index 7588fc8691..ba27a9bf4e 100755 --- a/deal.II/lac/include/lac/trilinos_vector.h +++ b/deal.II/lac/include/lac/trilinos_vector.h @@ -50,7 +50,7 @@ namespace TrilinosWrappers namespace MPI { -/** +/** * This class implements a wrapper to use the Trilinos distributed * vector class Epetra_FEVector. This class is derived from the * TrilinosWrappers::VectorBase class and provides all functionality @@ -120,11 +120,11 @@ namespace TrilinosWrappers * writes. If it encounters an operation of the opposite kind, it calls * compress() and flips the state. This can sometimes lead to very * confusing behavior, in code that may for example look like this: - * - * @verbatim + * + * @verbatim * TrilinosWrappers::Vector vector; - * // do some write operations on the vector - * for (unsigned int i=0; isize(); ++i) + * // do some write operations on the vector + * for (unsigned int i=0; isize(); ++i) * vector(i) = i; * * // do some additions to vector elements, but @@ -223,7 +223,7 @@ namespace TrilinosWrappers * Destructor. */ ~Vector (); - + /** * Reinit functionality. This * function destroys the old @@ -330,7 +330,7 @@ namespace TrilinosWrappers * &input_map) function. */ template - Vector & + Vector & operator = (const ::dealii::Vector &v); /** @@ -373,7 +373,7 @@ namespace TrilinosWrappers * for example done during the * solution of linear systems. */ - void import_nonlocal_data_for_fe + void import_nonlocal_data_for_fe (const dealii::TrilinosWrappers::SparseMatrix &matrix, const Vector &vector); @@ -422,7 +422,7 @@ namespace TrilinosWrappers { u.swap (v); } - + #ifndef DOXYGEN @@ -433,7 +433,7 @@ namespace TrilinosWrappers map (InputMap) { vector = std::auto_ptr (new Epetra_FEVector(map)); - + const int min_my_id = map.MinMyGID(); const int size = map.NumMyElements(); @@ -441,7 +441,7 @@ namespace TrilinosWrappers ExcDimensionMismatch(map.MaxLID(), size-1)); // Need to copy out values, since the - // deal.II might not use doubles, so + // deal.II might not use doubles, so // that a direct access is not possible. std::vector indices (size); std::vector values (size); @@ -451,14 +451,14 @@ namespace TrilinosWrappers values[i] = v(i); } - const int ierr = vector->ReplaceGlobalValues (size, &indices[0], + const int ierr = vector->ReplaceGlobalValues (size, &indices[0], &values[0]); AssertThrow (ierr == 0, VectorBase::ExcTrilinosError(ierr)); } - - + + inline Vector & Vector::operator = (const TrilinosScalar s) @@ -470,7 +470,7 @@ namespace TrilinosWrappers template - Vector & + Vector & Vector::operator = (const ::dealii::Vector &v) { if (size() != v.size()) @@ -481,13 +481,13 @@ namespace TrilinosWrappers map = Epetra_Map (v.size(), 0, Epetra_SerialComm()); #endif } - + *this = Vector(map, v); return *this; } - - + + #endif } /* end of namespace MPI */ @@ -626,7 +626,7 @@ namespace TrilinosWrappers * the right hand argument. */ Vector & - operator = (const Vector &V); + operator = (const Vector &V); private: /** @@ -672,8 +672,8 @@ namespace TrilinosWrappers *this = v; } - - + + inline Vector & Vector::operator = (const TrilinosScalar s) @@ -684,7 +684,7 @@ namespace TrilinosWrappers } template - Vector & + Vector & Vector::operator = (const ::dealii::Vector &v) { if (size() != v.size()) @@ -706,7 +706,7 @@ namespace TrilinosWrappers ExcDimensionMismatch(map.MaxLID(), size-1)); // Need to copy out values, since the - // deal.II might not use doubles, so + // deal.II might not use doubles, so // that a direct access is not possible. std::vector indices (size); std::vector values (size); @@ -716,13 +716,13 @@ namespace TrilinosWrappers values[i] = v(i); } - const int ierr = vector->ReplaceGlobalValues (size, &indices[0], + const int ierr = vector->ReplaceGlobalValues (size, &indices[0], &values[0]); AssertThrow (ierr == 0, VectorBase::ExcTrilinosError(ierr)); return *this; } - + #endif diff --git a/deal.II/lac/include/lac/trilinos_vector_base.h b/deal.II/lac/include/lac/trilinos_vector_base.h index 923e32657b..04a35a43ff 100644 --- a/deal.II/lac/include/lac/trilinos_vector_base.h +++ b/deal.II/lac/include/lac/trilinos_vector_base.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2008 by the deal.II authors +// Copyright (C) 2008, 2009 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -58,7 +58,7 @@ namespace TrilinosWrappers /** * A namespace for internal implementation details of the * TrilinosWrapper members. - * + * * @ingroup TrilinosWrappers */ namespace internal @@ -116,14 +116,14 @@ namespace TrilinosWrappers * this allows us to make the * assignment operator const. */ - const VectorReference & + const VectorReference & operator = (const VectorReference &r) const; /** * Set the referenced element of the * vector to s. */ - const VectorReference & + const VectorReference & operator = (const TrilinosScalar &s) const; /** @@ -131,7 +131,7 @@ namespace TrilinosWrappers * referenced element of the * vector-> */ - const VectorReference & + const VectorReference & operator += (const TrilinosScalar &s) const; /** @@ -139,7 +139,7 @@ namespace TrilinosWrappers * referenced element of the * vector-> */ - const VectorReference & + const VectorReference & operator -= (const TrilinosScalar &s) const; /** @@ -147,7 +147,7 @@ namespace TrilinosWrappers * element of the vector by * s. */ - const VectorReference & + const VectorReference & operator *= (const TrilinosScalar &s) const; /** @@ -155,7 +155,7 @@ namespace TrilinosWrappers * element of the vector by * s. */ - const VectorReference & + const VectorReference & operator /= (const TrilinosScalar &s) const; /** @@ -262,7 +262,7 @@ namespace TrilinosWrappers typedef const internal::VectorReference const_reference; /** - * @name 1: Basic Object-handling + * @name 1: Basic Object-handling */ //@{ @@ -365,7 +365,7 @@ namespace TrilinosWrappers * distribution as the calling * vector. */ - VectorBase & + VectorBase & operator = (const VectorBase &v); /** @@ -386,7 +386,7 @@ namespace TrilinosWrappers * &input_map) function. */ template - VectorBase & + VectorBase & operator = (const ::dealii::Vector &v); /** @@ -677,7 +677,7 @@ namespace TrilinosWrappers /** * Simple vector addition, equal * to the operator - * +=. + * +=. * * Though, if the second argument * allow_different_maps @@ -692,7 +692,7 @@ namespace TrilinosWrappers * of a vector, i.e. *this = * a*V. */ - void add (const TrilinosScalar a, + void add (const TrilinosScalar a, const VectorBase &V); /** @@ -700,9 +700,9 @@ namespace TrilinosWrappers * vectors, i.e. *this = a*V * + b*W. */ - void add (const TrilinosScalar a, + void add (const TrilinosScalar a, const VectorBase &V, - const TrilinosScalar b, + const TrilinosScalar b, const VectorBase &W); /** @@ -759,16 +759,16 @@ namespace TrilinosWrappers * Assignment *this = * a*V. */ - void equ (const TrilinosScalar a, + void equ (const TrilinosScalar a, const VectorBase &V); /** * Assignment *this = a*V + * b*W. */ - void equ (const TrilinosScalar a, + void equ (const TrilinosScalar a, const VectorBase &V, - const TrilinosScalar b, + const TrilinosScalar b, const VectorBase &W); /** @@ -1028,8 +1028,8 @@ namespace TrilinosWrappers vector.last_action = Add; } - const int ierr = vector.vector->SumIntoGlobalValues (1, - (const int*)(&index), + const int ierr = vector.vector->SumIntoGlobalValues (1, + (const int*)(&index), &value); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); vector.compressed = false; @@ -1128,7 +1128,7 @@ namespace TrilinosWrappers const int ierr = vector->GlobalAssemble(last_action); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); last_action = Zero; - + compressed = true; } @@ -1196,8 +1196,8 @@ namespace TrilinosWrappers const int local_row = vector->Map().LID(indices[i]); if (local_row == -1) { - const int ierr = vector->ReplaceGlobalValues (1, - (const int*)(&row), + const int ierr = vector->ReplaceGlobalValues (1, + (const int*)(&row), &values[i]); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); compressed = false; @@ -1254,8 +1254,8 @@ namespace TrilinosWrappers const int local_row = vector->Map().LID(row); if (local_row == -1) { - const int ierr = vector->SumIntoGlobalValues (1, - (const int*)(&row), + const int ierr = vector->SumIntoGlobalValues (1, + (const int*)(&row), &values[i]); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); compressed = false; @@ -1383,7 +1383,7 @@ namespace TrilinosWrappers const TrilinosScalar * ptr = start_ptr; - // add up elements + // add up elements // TODO: This // won't work in parallel like // this. Find out a better way to @@ -1771,7 +1771,7 @@ namespace TrilinosWrappers Assert (size() == w.size(), ExcDimensionMismatch (size(), w.size())); - const int ierr = vector->ReciprocalMultiply(1.0, *(w.vector), + const int ierr = vector->ReciprocalMultiply(1.0, *(w.vector), *(v.vector), 0.0); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); diff --git a/deal.II/lac/source/constraint_matrix.cc b/deal.II/lac/source/constraint_matrix.cc index 0acdfcb5cd..7dafcffe43 100644 --- a/deal.II/lac/source/constraint_matrix.cc +++ b/deal.II/lac/source/constraint_matrix.cc @@ -129,7 +129,7 @@ ConstraintMatrix::add_entries (const unsigned int line, { Assert (line != col_val_pair->first, ExcMessage ("Can't constrain a degree of freedom to itself")); - + for (std::vector >::const_iterator p=line_ptr->entries.begin(); p != line_ptr->entries.end(); ++p) @@ -142,7 +142,7 @@ ConstraintMatrix::add_entries (const unsigned int line, p->second, col_val_pair->second)); break; } - + line_ptr->entries.push_back (*col_val_pair); } } @@ -172,7 +172,7 @@ void ConstraintMatrix::close () line->entries.end(), &check_zero_weight), line->entries.end()); - + // replace references to dofs that // are themselves constrained. note // that because we may replace @@ -219,7 +219,7 @@ void ConstraintMatrix::close () // further // constrained: chained_constraint_replaced = true; - + // look up the chain // of constraints for // this entry @@ -228,7 +228,7 @@ void ConstraintMatrix::close () Assert (dof_index != line->line, ExcMessage ("Cycle in constraints detected!")); - + // find the line // corresponding to // this entry. note @@ -280,7 +280,7 @@ void ConstraintMatrix::close () std::make_pair (constrained_line->entries[0].first, constrained_line->entries[0].second * weight); - + for (unsigned int i=1; ientries.size(); ++i) line->entries .push_back (std::make_pair (constrained_line->entries[i].first, @@ -307,7 +307,7 @@ void ConstraintMatrix::close () line->inhomogeneity += constrained_line->inhomogeneity * weight; - + // now that we're here, do // not increase index by // one but rather make @@ -394,7 +394,7 @@ void ConstraintMatrix::close () } else new_entries.push_back (line->entries[j]); - + Assert (new_entries.size() == line->entries.size() - duplicates, ExcInternalError()); @@ -410,7 +410,7 @@ void ConstraintMatrix::close () ExcInternalError()); } - + // replace old list of // constraints for this // dof by the new one and @@ -418,7 +418,7 @@ void ConstraintMatrix::close () line->entries.swap (new_entries); break; } - + // finally do the following // check: if the sum of // weights for the @@ -455,7 +455,7 @@ void ConstraintMatrix::close () line->inhomogeneity /= sum; } } - + #ifdef DEBUG // if in debug mode: check that no // dof is constraint to another dof @@ -480,7 +480,7 @@ void ConstraintMatrix::close () ExcDoFConstrainedToConstrainedDoF(line->line, entry->first)); }; #endif - + sorted = true; } @@ -492,7 +492,7 @@ void ConstraintMatrix::merge (const ConstraintMatrix &other_constraints) // constraints in the two objects // are for different degrees of // freedom -#ifdef DEBUG +#ifdef DEBUG if (true) { // first insert all dofs in @@ -566,7 +566,7 @@ void ConstraintMatrix::merge (const ConstraintMatrix &other_constraints) std::vector > tmp; std::vector::const_iterator> tmp_other_lines; for (std::vector::iterator line=lines.begin(); - line!=lines.end(); ++line) + line!=lines.end(); ++line) { // copy the line of old object // modulo dofs constrained in @@ -586,9 +586,9 @@ void ConstraintMatrix::merge (const ConstraintMatrix &other_constraints) tmp_other_lines.clear (); tmp_other_lines.reserve (line->entries.size()); - + bool entries_to_resolve = false; - + for (unsigned int i=0; ientries.size(); ++i) { if (other_constraints.sorted == true) @@ -624,7 +624,7 @@ void ConstraintMatrix::merge (const ConstraintMatrix &other_constraints) { std::vector::const_iterator it = other_constraints.lines.end (); - + for (std::vector::const_iterator p=other_constraints.lines.begin(); p!=other_constraints.lines.end(); ++p) @@ -636,7 +636,7 @@ void ConstraintMatrix::merge (const ConstraintMatrix &other_constraints) tmp_other_lines.push_back (it); }; - + if (tmp_other_lines.back() != other_constraints.lines.end ()) entries_to_resolve = true; }; @@ -683,7 +683,7 @@ void ConstraintMatrix::merge (const ConstraintMatrix &other_constraints) j!=tmp_other_lines[i]->entries.end(); ++j) tmp.push_back (std::make_pair(j->first, j->second*weight)); - line->inhomogeneity += tmp_other_lines[i]->inhomogeneity * + line->inhomogeneity += tmp_other_lines[i]->inhomogeneity * line->entries[i].second; }; }; @@ -691,9 +691,9 @@ void ConstraintMatrix::merge (const ConstraintMatrix &other_constraints) // newly resolved line line->entries.swap (tmp); }; - - - + + + // next action: append new lines at // the end lines.insert (lines.end(), @@ -715,12 +715,12 @@ void ConstraintMatrix::shift (const unsigned int offset) { constraint_line_exists.insert (constraint_line_exists.begin(), offset, false); - + for (std::vector::iterator i = lines.begin(); i != lines.end(); i++) { i->line += offset; - for (std::vector >::iterator + for (std::vector >::iterator j = i->entries.begin(); j != i->entries.end(); j++) j->first += offset; @@ -735,7 +735,7 @@ void ConstraintMatrix::clear () std::vector tmp; lines.swap (tmp); } - + { std::vector tmp; constraint_line_exists.swap (tmp); @@ -747,7 +747,7 @@ void ConstraintMatrix::clear () vec_distribute.reset(); } #endif - + sorted = false; } @@ -774,17 +774,17 @@ void ConstraintMatrix::condense (const SparsityPattern &uncondensed, unsigned int shift = 0; unsigned int n_rows = uncondensed.n_rows(); - if (next_constraint == lines.end()) + if (next_constraint == lines.end()) // if no constraint is to be handled for (unsigned int row=0; row!=n_rows; ++row) new_line.push_back (row); else - for (unsigned int row=0; row!=n_rows; ++row) + for (unsigned int row=0; row!=n_rows; ++row) if (row == next_constraint->line) { // this line is constrained new_line.push_back (-1); - // note that @p{lines} is ordered + // note that @p{lines} is ordered ++shift; ++next_constraint; if (next_constraint == lines.end()) @@ -817,7 +817,7 @@ void ConstraintMatrix::condense (const SparsityPattern &uncondensed, jline != uncondensed.get_column_numbers()[j]) ++c; - for (unsigned int q=0; q!=c->entries.size(); ++q) + for (unsigned int q=0; q!=c->entries.size(); ++q) condensed.add (new_line[row], new_line[c->entries[q].first]); } else @@ -836,10 +836,10 @@ void ConstraintMatrix::condense (const SparsityPattern &uncondensed, // for each entry: distribute if (new_line[uncondensed.get_column_numbers()[j]] != -1) // column is not constrained - for (unsigned int q=0; q!=next_constraint->entries.size(); ++q) + for (unsigned int q=0; q!=next_constraint->entries.size(); ++q) condensed.add (new_line[next_constraint->entries[q].first], new_line[uncondensed.get_column_numbers()[j]]); - + else // not only this line but // also this col is constrained @@ -848,13 +848,13 @@ void ConstraintMatrix::condense (const SparsityPattern &uncondensed, // of this column std::vector::const_iterator c = lines.begin(); while (c->line != uncondensed.get_column_numbers()[j]) ++c; - + for (unsigned int p=0; p!=c->entries.size(); ++p) for (unsigned int q=0; q!=next_constraint->entries.size(); ++q) condensed.add (new_line[next_constraint->entries[q].first], new_line[c->entries[p].first]); }; - + ++next_constraint; }; @@ -869,7 +869,7 @@ void ConstraintMatrix::condense (SparsityPattern &sparsity) const Assert (sparsity.is_compressed() == false, ExcMatrixIsClosed()); Assert (sparsity.n_rows() == sparsity.n_cols(), ExcNotQuadratic()); - + // store for each index whether it must be // distributed or not. If entry is // numbers::invalid_unsigned_int, @@ -879,7 +879,7 @@ void ConstraintMatrix::condense (SparsityPattern &sparsity) const // index std::vector distribute(sparsity.n_rows(), numbers::invalid_unsigned_int); - + for (unsigned int c=0; c distribute(sparsity.n_rows(), numbers::invalid_unsigned_int); - + for (unsigned int c=0; c distribute(sparsity.n_rows(), numbers::invalid_unsigned_int); - + for (unsigned int c=0; c distribute(sparsity.n_rows(), numbers::invalid_unsigned_int); - + for (unsigned int c=0; c distribute (sparsity.n_rows(), numbers::invalid_unsigned_int); - + for (unsigned int c=0; c block_index = index_mapping.global_to_local(row); const unsigned int block_row = block_index.first; - + if (distribute[row] == numbers::invalid_unsigned_int) // regular line. loop over // all columns and see @@ -1392,7 +1392,7 @@ void ConstraintMatrix::condense (BlockSparsityPattern &sparsity) const { const unsigned int global_col = index_mapping.local_to_global(block_col, entry->column()); - + if (distribute[global_col] != numbers::invalid_unsigned_int) // distribute entry at regular // row @p{row} and irregular column @@ -1417,7 +1417,7 @@ void ConstraintMatrix::condense (BlockSparsityPattern &sparsity) const { const SparsityPattern & block_sparsity = sparsity.block(block_row,block_col); - + for (SparsityPattern::const_iterator entry = block_sparsity.begin(block_index.second); (entry != block_sparsity.end(block_index.second)) && @@ -1426,13 +1426,13 @@ void ConstraintMatrix::condense (BlockSparsityPattern &sparsity) const { const unsigned int global_col = index_mapping.local_to_global (block_col, entry->column()); - + if (distribute[global_col] == numbers::invalid_unsigned_int) // distribute entry at irregular // row @p{row} and regular column // global_col. { - for (unsigned int q=0; q!=lines[distribute[row]].entries.size(); ++q) + for (unsigned int q=0; q!=lines[distribute[row]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[q].first, global_col); } else @@ -1449,7 +1449,7 @@ void ConstraintMatrix::condense (BlockSparsityPattern &sparsity) const } } } - + sparsity.compress(); } @@ -1464,12 +1464,12 @@ void ConstraintMatrix::condense (BlockCompressedSparsityPattern &sparsity) const ExcNotQuadratic()); Assert (sparsity.get_column_indices() == sparsity.get_row_indices(), ExcNotQuadratic()); - + const BlockIndices & index_mapping = sparsity.get_column_indices(); const unsigned int n_blocks = sparsity.n_block_rows(); - + // store for each index whether it must be // distributed or not. If entry is // numbers::invalid_unsigned_int, @@ -1479,7 +1479,7 @@ void ConstraintMatrix::condense (BlockCompressedSparsityPattern &sparsity) const // index std::vector distribute (sparsity.n_rows(), numbers::invalid_unsigned_int); - + for (unsigned int c=0; c(c); @@ -1492,7 +1492,7 @@ void ConstraintMatrix::condense (BlockCompressedSparsityPattern &sparsity) const block_index = index_mapping.global_to_local(row); const unsigned int block_row = block_index.first; const unsigned int local_row = block_index.second; - + if (distribute[row] == numbers::invalid_unsigned_int) // regular line. loop over // all columns and see @@ -1529,7 +1529,7 @@ void ConstraintMatrix::condense (BlockCompressedSparsityPattern &sparsity) const const unsigned int global_col = index_mapping.local_to_global(block_col, block_sparsity.column_number(local_row,j)); - + if (distribute[global_col] != numbers::invalid_unsigned_int) // distribute entry at regular // row @p{row} and irregular column @@ -1555,19 +1555,19 @@ void ConstraintMatrix::condense (BlockCompressedSparsityPattern &sparsity) const { const CompressedSparsityPattern & block_sparsity = sparsity.block(block_row,block_col); - + for (unsigned int j=0; j distribute (sparsity.n_rows(), numbers::invalid_unsigned_int); - + for (unsigned int c=0; c(c); @@ -1626,7 +1626,7 @@ void ConstraintMatrix::condense (BlockCompressedSetSparsityPattern &sparsity) co block_index = index_mapping.global_to_local(row); const unsigned int block_row = block_index.first; const unsigned int local_row = block_index.second; - + if (distribute[row] == numbers::invalid_unsigned_int) // regular line. loop over // all columns and see @@ -1664,7 +1664,7 @@ void ConstraintMatrix::condense (BlockCompressedSetSparsityPattern &sparsity) co { const unsigned int global_col = index_mapping.local_to_global(block_col, *j); - + if (distribute[global_col] != numbers::invalid_unsigned_int) // distribute entry at regular // row @p{row} and irregular column @@ -1690,20 +1690,20 @@ void ConstraintMatrix::condense (BlockCompressedSetSparsityPattern &sparsity) co { const CompressedSetSparsityPattern & block_sparsity = sparsity.block(block_row,block_col); - + for (CompressedSetSparsityPattern::row_iterator j = block_sparsity.row_begin(local_row); j != block_sparsity.row_end(local_row); ++j) { const unsigned int global_col = index_mapping.local_to_global (block_col, *j); - + if (distribute[global_col] == numbers::invalid_unsigned_int) // distribute entry at irregular // row @p{row} and regular column // global_col. { - for (unsigned int q=0; q!=lines[distribute[row]].entries.size(); ++q) + for (unsigned int q=0; q!=lines[distribute[row]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[q].first, global_col); } @@ -1734,12 +1734,12 @@ void ConstraintMatrix::condense (BlockCompressedSimpleSparsityPattern &sparsity) ExcNotQuadratic()); Assert (sparsity.get_column_indices() == sparsity.get_row_indices(), ExcNotQuadratic()); - + const BlockIndices & index_mapping = sparsity.get_column_indices(); const unsigned int n_blocks = sparsity.n_block_rows(); - + // store for each index whether it must be // distributed or not. If entry is // numbers::invalid_unsigned_int, @@ -1749,7 +1749,7 @@ void ConstraintMatrix::condense (BlockCompressedSimpleSparsityPattern &sparsity) // index std::vector distribute (sparsity.n_rows(), numbers::invalid_unsigned_int); - + for (unsigned int c=0; c(c); @@ -1762,7 +1762,7 @@ void ConstraintMatrix::condense (BlockCompressedSimpleSparsityPattern &sparsity) block_index = index_mapping.global_to_local(row); const unsigned int block_row = block_index.first; const unsigned int local_row = block_index.second; - + if (distribute[row] == numbers::invalid_unsigned_int) // regular line. loop over // all columns and see @@ -1799,7 +1799,7 @@ void ConstraintMatrix::condense (BlockCompressedSimpleSparsityPattern &sparsity) const unsigned int global_col = index_mapping.local_to_global(block_col, block_sparsity.column_number(local_row,j)); - + if (distribute[global_col] != numbers::invalid_unsigned_int) // distribute entry at regular // row @p{row} and irregular column @@ -1825,19 +1825,19 @@ void ConstraintMatrix::condense (BlockCompressedSimpleSparsityPattern &sparsity) { const CompressedSimpleSparsityPattern & block_sparsity = sparsity.block(block_row,block_col); - + for (unsigned int j=0; j::const_iterator next_constraint = + std::vector::const_iterator next_constraint = std::lower_bound (lines.begin(),lines.end(),index_comparison); index_comparison.line = vec.local_range().second; - + std::vector::const_iterator end_constraint = std::lower_bound(lines.begin(),lines.end(),index_comparison); @@ -1897,7 +1897,7 @@ ConstraintMatrix::distribute (TrilinosWrappers::MPI::Vector &vec) const { my_indices[index2]=i; } - for (; next_constraint != end_constraint; ++next_constraint) + for (; next_constraint != end_constraint; ++next_constraint) { for (unsigned int i=0; ientries.size(); ++i) my_indices.push_back (next_constraint->entries[i].first); @@ -1924,10 +1924,10 @@ ConstraintMatrix::distribute (TrilinosWrappers::MPI::Vector &vec) const // here we import the data vec_distribute->reinit(vec,false,true); - next_constraint = + next_constraint = std::lower_bound (lines.begin(),lines.end(),index_comparison); - for (; next_constraint != end_constraint; ++next_constraint) + for (; next_constraint != end_constraint; ++next_constraint) { // fill entry in line // next_constraint.line by adding the @@ -1950,11 +1950,11 @@ unsigned int ConstraintMatrix::n_constraints () const -bool ConstraintMatrix::is_identity_constrained (const unsigned int index) const +bool ConstraintMatrix::is_identity_constrained (const unsigned int index) const { if (is_constrained(index) == false) return false; - + if (sorted == true) { ConstraintLine index_comparison; @@ -1992,7 +1992,7 @@ bool ConstraintMatrix::is_identity_constrained (const unsigned int index) const -unsigned int ConstraintMatrix::max_constraint_indirections () const +unsigned int ConstraintMatrix::max_constraint_indirections () const { unsigned int return_value = 0; for (std::vector::const_iterator i=lines.begin(); @@ -2017,7 +2017,7 @@ bool ConstraintMatrix::has_inhomogeneities () const return false; } - + void ConstraintMatrix::print (std::ostream &out) const { @@ -2033,7 +2033,7 @@ void ConstraintMatrix::print (std::ostream &out) const << " " << lines[i].entries[j].first << ": " << lines[i].entries[j].second << "\n"; - // print out inhomogeneity. + // print out inhomogeneity. if (lines[i].inhomogeneity != 0) out << " " << lines[i].line << ": " << lines[i].inhomogeneity << "\n"; @@ -2054,7 +2054,7 @@ void ConstraintMatrix::print (std::ostream &out) const out << " " << lines[i].line << " = 0\n"; } } - + AssertThrow (out, ExcIO()); } @@ -2218,7 +2218,7 @@ distribute_local_to_global (const FullMatrix MATRIX_FUNCTIONS(SparseMatrix, Vector); MATRIX_FUNCTIONS(SparseMatrix, Vector); -template void ConstraintMatrix::distribute_local_to_global,Vector > +template void ConstraintMatrix::distribute_local_to_global,Vector > (const FullMatrix &, const Vector &, const std::vector &, @@ -2227,7 +2227,7 @@ template void ConstraintMatrix::distribute_local_to_global,V MATRIX_FUNCTIONS(BlockSparseMatrix, BlockVector); MATRIX_FUNCTIONS(BlockSparseMatrix, BlockVector); -template void ConstraintMatrix::distribute_local_to_global,BlockVector > +template void ConstraintMatrix::distribute_local_to_global,BlockVector > (const FullMatrix &, const Vector &, const std::vector &, @@ -2253,18 +2253,18 @@ MATRIX_FUNCTIONS(PETScWrappers::MPI::BlockSparseMatrix ,PETScWrappers::MPI::Bloc MATRIX_FUNCTIONS(TrilinosWrappers::SparseMatrix, TrilinosWrappers::Vector); MATRIX_FUNCTIONS(TrilinosWrappers::BlockSparseMatrix, TrilinosWrappers::BlockVector); template void ConstraintMatrix::distribute_local_to_global - - (const FullMatrix &, - const Vector &, - const std::vector &, - TrilinosWrappers::SparseMatrix &, + + (const FullMatrix &, + const Vector &, + const std::vector &, + TrilinosWrappers::SparseMatrix &, TrilinosWrappers::MPI::Vector &) const; template void ConstraintMatrix::distribute_local_to_global - - (const FullMatrix &, - const Vector &, - const std::vector &, - TrilinosWrappers::BlockSparseMatrix &, + + (const FullMatrix &, + const Vector &, + const std::vector &, + TrilinosWrappers::BlockSparseMatrix &, TrilinosWrappers::MPI::BlockVector &) const; #endif diff --git a/deal.II/lac/source/petsc_matrix_base.cc b/deal.II/lac/source/petsc_matrix_base.cc index 9bddf2731c..1589683cd9 100644 --- a/deal.II/lac/source/petsc_matrix_base.cc +++ b/deal.II/lac/source/petsc_matrix_base.cc @@ -213,9 +213,9 @@ namespace PETScWrappers const unsigned int j) const { #ifdef PETSC_USE_64BIT_INDICES - PetscInt + PetscInt #else - int + int #endif petsc_i = i, petsc_j = j; PetscScalar value; diff --git a/deal.II/lac/source/petsc_parallel_sparse_matrix.cc b/deal.II/lac/source/petsc_parallel_sparse_matrix.cc index b3125fac3d..66e0482995 100644 --- a/deal.II/lac/source/petsc_parallel_sparse_matrix.cc +++ b/deal.II/lac/source/petsc_parallel_sparse_matrix.cc @@ -311,9 +311,9 @@ namespace PETScWrappers // then count the elements in- and // out-of-window for the rows we own #ifdef PETSC_USE_64BIT_INDICES - std::vector + std::vector #else - std::vector + std::vector #endif row_lengths_in_window (local_row_end - local_row_start), row_lengths_out_of_window (local_row_end - local_row_start); @@ -376,9 +376,9 @@ namespace PETScWrappers ((PETSC_VERSION_MINOR == 2) && (PETSC_VERSION_SUBMINOR == 0))) #ifdef PETSC_USE_64BIT_INDICES - std::vector + std::vector #else - std::vector + std::vector #endif row_entries; std::vector row_values; @@ -406,9 +406,9 @@ namespace PETScWrappers // sure petsc doesn't read past the // end #ifdef PETSC_USE_64BIT_INDICES - std::vector + std::vector #else - std::vector + std::vector #endif rowstart_in_window (local_row_end - local_row_start + 1, 0), colnums_in_window; @@ -467,9 +467,9 @@ namespace PETScWrappers for (unsigned int i=local_row_start; i void @@ -249,7 +249,7 @@ namespace PETScWrappers row_values.resize (row_lengths[i], 0.0); for (unsigned int j=0; j*>(&values))(0), + do_set_add_operation(indices.size(), &indices[0], + &(*const_cast*>(&values))(0), true); } diff --git a/deal.II/lac/source/slepc_solver.cc b/deal.II/lac/source/slepc_solver.cc index 4fcc155903..abde8c09ce 100644 --- a/deal.II/lac/source/slepc_solver.cc +++ b/deal.II/lac/source/slepc_solver.cc @@ -24,9 +24,9 @@ namespace SLEPcWrappers { // Destroy the solver object. int ierr = EPSDestroy (eps); - AssertThrow (ierr == 0, ExcSLEPcError(ierr)); + AssertThrow (ierr == 0, ExcSLEPcError(ierr)); } - + SolverBase::SolverBase (SolverControl &cn, const MPI_Comm &mpi_communicator) : @@ -38,7 +38,7 @@ namespace SLEPcWrappers transform (NULL) { } - + SolverBase::~SolverBase () { if( solver_data != 0 ) @@ -82,10 +82,10 @@ namespace SLEPcWrappers SolverBase::solve (const unsigned int n_eigenvectors, unsigned int *n_converged) { int ierr; - - AssertThrow (solver_data == 0, ExcSLEPcWrappersUsageError()); + + AssertThrow (solver_data == 0, ExcSLEPcWrappersUsageError()); solver_data.reset (new SolverData()); - + // create eigensolver context and // set operators. ierr = EPSCreate (mpi_communicator, &solver_data->eps); @@ -97,16 +97,16 @@ namespace SLEPcWrappers else ierr = EPSSetOperators (solver_data->eps, *opA, PETSC_NULL); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); - - if (ini_vec && ini_vec->size() != 0) + + if (ini_vec && ini_vec->size() != 0) { ierr = EPSSetInitialVector(solver_data->eps, *ini_vec); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); } - + if (transform) transform->set_context(solver_data->eps); - + // set runtime options. set_solver_type (solver_data->eps); @@ -115,7 +115,7 @@ namespace SLEPcWrappers // set number of eigenvectors to // compute - ierr = EPSSetDimensions (solver_data->eps, n_eigenvectors, + ierr = EPSSetDimensions (solver_data->eps, n_eigenvectors, PETSC_DECIDE, PETSC_DECIDE); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); @@ -128,7 +128,7 @@ namespace SLEPcWrappers // get number of converged // eigenstates - ierr = EPSGetConverged (solver_data->eps, + ierr = EPSGetConverged (solver_data->eps, #ifdef PETSC_USE_64BIT_INDICES reinterpret_cast(n_converged)); #else @@ -138,14 +138,14 @@ namespace SLEPcWrappers } void - SolverBase::get_eigenpair (const unsigned int index, + SolverBase::get_eigenpair (const unsigned int index, double &kr, - PETScWrappers::VectorBase &vr) + PETScWrappers::VectorBase &vr) { - AssertThrow (solver_data != 0, ExcSLEPcWrappersUsageError()); + AssertThrow (solver_data != 0, ExcSLEPcWrappersUsageError()); // get converged eigenpair - int ierr = EPSGetEigenpair(solver_data->eps, index, + int ierr = EPSGetEigenpair(solver_data->eps, index, &kr, PETSC_NULL, vr, PETSC_NULL); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); } @@ -167,7 +167,7 @@ namespace SLEPcWrappers return NULL; return &solver_data->eps; } - + /* ---------------------- SolverControls ----------------------- */ SolverControl & SolverBase::control () const @@ -182,31 +182,31 @@ namespace SLEPcWrappers EPSConvergedReason *reason, void *solver_control_x) { - SolverControl &solver_control + SolverControl &solver_control = *reinterpret_cast(solver_control_x); - + const SolverControl::State state = solver_control.check (iteration, residual_norm); - + switch (state) { case ::dealii::SolverControl::iterate: *reason = EPS_CONVERGED_ITERATING; break; - + case ::dealii::SolverControl::success: *reason = static_cast(1); break; - + case ::dealii::SolverControl::failure: if (solver_control.last_step() > solver_control.max_steps()) *reason = EPS_DIVERGED_ITS; break; - + default: Assert (false, ExcNotImplemented()); } - + // return without failure. return 0; } @@ -219,7 +219,7 @@ namespace SLEPcWrappers SolverBase (cn, mpi_communicator), additional_data (data) {} - + void SolverKrylovSchur::set_solver_type (EPS &eps) const { @@ -236,7 +236,7 @@ namespace SLEPcWrappers this->solver_control.max_steps()); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); } - + /* ---------------------- SolverArnoldi ------------------------ */ SolverArnoldi::SolverArnoldi (SolverControl &cn, const MPI_Comm &mpi_communicator, @@ -245,7 +245,7 @@ namespace SLEPcWrappers SolverBase (cn, mpi_communicator), additional_data (data) {} - + void SolverArnoldi::set_solver_type (EPS &eps) const { @@ -272,7 +272,7 @@ namespace SLEPcWrappers SolverBase (cn, mpi_communicator), additional_data (data) {} - + void SolverLanczos::set_solver_type (EPS &eps) const { diff --git a/deal.II/lac/source/trilinos_vector_base.cc b/deal.II/lac/source/trilinos_vector_base.cc index 064a69e838..57014bb2f2 100644 --- a/deal.II/lac/source/trilinos_vector_base.cc +++ b/deal.II/lac/source/trilinos_vector_base.cc @@ -42,7 +42,7 @@ namespace TrilinosWrappers const int local_index = vector.vector->Map().LID(index); Assert (local_index >= 0, - ExcAccessToNonLocalElement (index, + ExcAccessToNonLocalElement (index, vector.vector->Map().MinMyGID(), vector.vector->Map().MaxMyGID())); @@ -58,27 +58,27 @@ namespace TrilinosWrappers last_action (Zero), compressed (true), #ifdef DEAL_II_COMPILER_SUPPORTS_MPI - vector(std::auto_ptr + vector(std::auto_ptr (new Epetra_FEVector( Epetra_Map(0,0,Epetra_MpiComm(MPI_COMM_SELF))))) #else - vector(std::auto_ptr + vector(std::auto_ptr (new Epetra_FEVector( Epetra_Map(0,0,Epetra_SerialComm())))) #endif {} - - + + VectorBase::VectorBase (const VectorBase &v) : Subscriptor(), last_action (Zero), compressed (true), - vector(std::auto_ptr + vector(std::auto_ptr (new Epetra_FEVector(*v.vector))) {} - + VectorBase::~VectorBase () @@ -145,7 +145,7 @@ namespace TrilinosWrappers { Assert (size() == v.size(), ExcDimensionMismatch(size(), v.size())); - + // this is probably not very efficient // but works. in particular, we could do // better if we know that @@ -249,7 +249,7 @@ namespace TrilinosWrappers return false; unsigned int i; - for (i=0; i