From 209ecb9789723c74c2f9f7a67aa340d3802eb61f Mon Sep 17 00:00:00 2001 From: Katharina Kormann Date: Tue, 1 May 2018 22:32:51 +0200 Subject: [PATCH] Fix matrix-free commits (comments by Bruno Turcksin). --- include/deal.II/matrix_free/dof_info.h | 3 +++ include/deal.II/matrix_free/fe_evaluation.h | 14 ++++++------- include/deal.II/matrix_free/matrix_free.h | 20 +++++++++---------- .../matrix_free/matrix_free.templates.h | 2 +- source/matrix_free/mapping_info.cc | 1 + 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/include/deal.II/matrix_free/dof_info.h b/include/deal.II/matrix_free/dof_info.h index 850ebc0e0f..4ed76b5444 100644 --- a/include/deal.II/matrix_free/dof_info.h +++ b/include/deal.II/matrix_free/dof_info.h @@ -67,6 +67,9 @@ namespace internal * part of the vector at a time to keep the values that are zeroed in * caches, saving one global vector access for the case where this is * applied rather than `vector = 0.;`. + * + * Size of the chunk is set to 64 kByte which generally fits to current + * caches. */ static const unsigned int chunk_size_zero_vector = 8192; diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index caefb68399..dac475894d 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -752,8 +752,8 @@ protected: * A unified function to read from and write into vectors based on the given * template operation for DG-type schemes where all degrees of freedom on * cells are contiguous. It can perform the operation for read_dof_values(), - * distribute_local_to_global(), and set_dof_values() for for several - * vectors at a time, depending on n_components. + * distribute_local_to_global(), and set_dof_values() for several vectors at + * a time, depending on n_components. */ template void @@ -2056,7 +2056,7 @@ public: typedef FEEvaluationAccess BaseClass; /** - * A underlying number type specified as template argument. + * An underlying number type specified as template argument. */ typedef Number number_type; @@ -2224,7 +2224,7 @@ public: FEEvaluation &operator= (const FEEvaluation &other); /** - * Initializes the operation pointer to the current cell batch index. Unlike + * Initialize the operation pointer to the current cell batch index. Unlike * the reinit functions taking a cell iterator as argument below and the * FEValues::reinit() methods, where the information related to a particular * cell is generated in the reinit call, this function is very cheap since @@ -2261,7 +2261,7 @@ public: void reinit (const typename Triangulation::cell_iterator &cell); /** - * Evaluates the function values, the gradients, and the Hessians of the + * Evaluate the function values, the gradients, and the Hessians of the * polynomial interpolation from the DoF values in the input vector to the * quadrature points on the unit cell. The function arguments specify which * parts shall actually be computed. This function has to be called first so @@ -2274,7 +2274,7 @@ public: const bool evaluate_hessians = false); /** - * Evaluates the function values, the gradients, and the Hessians of the + * Evaluate the function values, the gradients, and the Hessians of the * polynomial interpolation from the DoF values in the input array @p * values_array to the quadrature points on the unit cell. If multiple * components are involved in the current FEEvaluation object, the sorting @@ -2291,7 +2291,7 @@ public: const bool evaluate_hessians = false); /** - * Reads from the input vector and evaluates the function values, the + * Read from the input vector and evaluates the function values, the * gradients, and the Hessians of the polynomial interpolation of the vector * entries from @p input_vector associated with the current cell to the * quadrature points on the unit cell. The function arguments specify which diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index 4648c552e8..dc35f09d7d 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -2729,7 +2729,7 @@ namespace internal if (vector_face_access == dealii::MatrixFree::DataAccessOnFaces::unspecified || vec.size() == 0) - const_cast &>(vec).zero_out_ghosts(); + vec.zero_out_ghosts(); else { #ifdef DEAL_II_WITH_MPI @@ -2738,7 +2738,7 @@ namespace internal const unsigned int mf_component = find_vector_in_mf(vec); const Utilities::MPI::Partitioner &part = get_partitioner(mf_component); if (&part == matrix_free.get_dof_info(mf_component).vector_partitioner.get()) - const_cast &>(vec).zero_out_ghosts(); + vec.zero_out_ghosts(); else if (part.n_ghost_indices() > 0) { for (std::vector >::const_iterator @@ -3375,7 +3375,7 @@ namespace internal {} // Runs the cell work. If no function is given, nothing is done - virtual void cell(const std::pair &cell_range) + virtual void cell(const std::pair &cell_range) override { if (cell_function != nullptr && cell_range.second > cell_range.first) (container.*cell_function)(matrix_free, this->dst, this->src, cell_range); @@ -3383,7 +3383,7 @@ namespace internal // Runs the assembler on interior faces. If no function is given, nothing // is done - virtual void face(const std::pair &face_range) + virtual void face(const std::pair &face_range) override { if (face_function != nullptr && face_range.second > face_range.first) (container.*face_function)(matrix_free, this->dst, this->src, face_range); @@ -3391,7 +3391,7 @@ namespace internal // Runs the assembler on boundary faces. If no function is given, nothing // is done - virtual void boundary(const std::pair &face_range) + virtual void boundary(const std::pair &face_range) override { if (boundary_function != nullptr && face_range.second > face_range.first) (container.*boundary_function)(matrix_free, this->dst, this->src, face_range); @@ -3403,27 +3403,27 @@ namespace internal // the problem that reading from a vector that we also write to is usually // not intended in case there is overlap, but this is up to the // application code to decide and we cannot catch this case here). - virtual void vector_update_ghosts_start() + virtual void vector_update_ghosts_start() override { if (!src_and_dst_are_same) internal::update_ghost_values_start(src, src_data_exchanger); } // Finishes the communication for the update ghost values operation - virtual void vector_update_ghosts_finish() + virtual void vector_update_ghosts_finish() override { if (!src_and_dst_are_same) internal::update_ghost_values_finish(src, src_data_exchanger); } // Starts the communication for the vector compress operation - virtual void vector_compress_start() + virtual void vector_compress_start() override { internal::compress_start(dst, dst_data_exchanger); } // Finishes the communication for the vector compress operation - virtual void vector_compress_finish() + virtual void vector_compress_finish() override { internal::compress_finish(dst, dst_data_exchanger); if (!src_and_dst_are_same) @@ -3431,7 +3431,7 @@ namespace internal } // Zeros the given input vector - virtual void zero_dst_vector_range(const unsigned int range_index) + virtual void zero_dst_vector_range(const unsigned int range_index) override { if (zero_dst_vector_setting) internal::zero_vector_region(range_index, dst, dst_data_exchanger); diff --git a/include/deal.II/matrix_free/matrix_free.templates.h b/include/deal.II/matrix_free/matrix_free.templates.h index 2518d3cd29..dca6f90436 100644 --- a/include/deal.II/matrix_free/matrix_free.templates.h +++ b/include/deal.II/matrix_free/matrix_free.templates.h @@ -130,7 +130,7 @@ MatrixFree::get_dof_handler (const unsigned int dof_index) const } else { - Assert (false, ExcNotImplemented()); + AssertThrow (false, ExcNotImplemented()); // put pseudo return argument to avoid compiler error, but trigger a // segfault in case this is only run in optimized mode return *dof_handlers.dof_handler[numbers::invalid_unsigned_int]; diff --git a/source/matrix_free/mapping_info.cc b/source/matrix_free/mapping_info.cc index c67d7e91b9..19ca7cdf3b 100644 --- a/source/matrix_free/mapping_info.cc +++ b/source/matrix_free/mapping_info.cc @@ -25,5 +25,6 @@ DEAL_II_NAMESPACE_OPEN #include "mapping_info.inst" template struct internal::MatrixFreeFunctions::FPArrayComparator; +template struct internal::MatrixFreeFunctions::FPArrayComparator; DEAL_II_NAMESPACE_CLOSE -- 2.39.5