From: Daniel Arndt Date: Tue, 27 Jul 2021 19:24:31 +0000 (-0400) Subject: Apply clang-format X-Git-Tag: v9.4.0-rc1~1119^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11108%2Fhead;p=dealii.git Apply clang-format --- diff --git a/contrib/python-bindings/include/point_wrapper.h b/contrib/python-bindings/include/point_wrapper.h index 8780bd0bc2..4e2b8bce9e 100644 --- a/contrib/python-bindings/include/point_wrapper.h +++ b/contrib/python-bindings/include/point_wrapper.h @@ -100,7 +100,8 @@ namespace python /** * Return the scalar product of the vectors representing two points. */ - double operator*(const PointWrapper &p) const; + double + operator*(const PointWrapper &p) const; /** * Add an offset to a point. @@ -129,7 +130,8 @@ namespace python /** * Multiply the coordinates of the point by a factor. */ - PointWrapper operator*(const double factor) const; + PointWrapper + operator*(const double factor) const; /** * Add another point. diff --git a/contrib/python-bindings/source/point_wrapper.cc b/contrib/python-bindings/source/point_wrapper.cc index 8d895835dd..feac3415f0 100644 --- a/contrib/python-bindings/source/point_wrapper.cc +++ b/contrib/python-bindings/source/point_wrapper.cc @@ -298,7 +298,8 @@ namespace python - double PointWrapper::operator*(const PointWrapper &p) const + double + PointWrapper::operator*(const PointWrapper &p) const { AssertThrow(p.get_dim() == dim, ExcMessage("The points do not have the same dimension.")); @@ -378,7 +379,8 @@ namespace python } - PointWrapper PointWrapper::operator*(const double factor) const + PointWrapper + PointWrapper::operator*(const double factor) const { if (dim == 2) return PointWrapper( diff --git a/examples/step-13/step-13.cc b/examples/step-13/step-13.cc index fd3f204a85..9b1617ff23 100644 --- a/examples/step-13/step-13.cc +++ b/examples/step-13/step-13.cc @@ -199,9 +199,9 @@ namespace Step13 // Now for the function that is mainly of interest in this class, the // computation of the point value: template - void PointValueEvaluation:: - operator()(const DoFHandler &dof_handler, - const Vector & solution) const + void + PointValueEvaluation::operator()(const DoFHandler &dof_handler, + const Vector & solution) const { // First allocate a variable that will hold the point value. Initialize // it with a value that is clearly bogus, so that if we fail to set it diff --git a/examples/step-14/step-14.cc b/examples/step-14/step-14.cc index f53d7a37b6..c717830bec 100644 --- a/examples/step-14/step-14.cc +++ b/examples/step-14/step-14.cc @@ -123,9 +123,9 @@ namespace Step14 template - void PointValueEvaluation:: - operator()(const DoFHandler &dof_handler, - const Vector & solution) const + void + PointValueEvaluation::operator()(const DoFHandler &dof_handler, + const Vector & solution) const { double point_value = 1e20; @@ -192,9 +192,9 @@ namespace Step14 // The more interesting things happen inside the function doing the actual // evaluation: template - void PointXDerivativeEvaluation:: - operator()(const DoFHandler &dof_handler, - const Vector & solution) const + void PointXDerivativeEvaluation::operator()( + const DoFHandler &dof_handler, + const Vector & solution) const { // This time initialize the return value with something useful, since we // will have to add up a number of contributions and take the mean value diff --git a/examples/step-21/step-21.cc b/examples/step-21/step-21.cc index 7e71c29303..cd96bfdec3 100644 --- a/examples/step-21/step-21.cc +++ b/examples/step-21/step-21.cc @@ -647,7 +647,7 @@ namespace Step21 std::vector> k_inverse_values(n_q_points); std::vector> old_solution_values(n_q_points, - Vector(dim + 2)); + Vector(dim + 2)); std::vector>> old_solution_grads( n_q_points, std::vector>(dim + 2)); diff --git a/examples/step-41/step-41.cc b/examples/step-41/step-41.cc index a63b05727e..b8ee77ee61 100644 --- a/examples/step-41/step-41.cc +++ b/examples/step-41/step-41.cc @@ -82,7 +82,7 @@ namespace Step41 void setup_system(); void assemble_system(); void - assemble_mass_matrix_diagonal(TrilinosWrappers::SparseMatrix &mass_matrix); + assemble_mass_matrix_diagonal(TrilinosWrappers::SparseMatrix &mass_matrix); void update_solution_and_constraints(); void solve(); void output_results(const unsigned int iteration) const; diff --git a/examples/step-42/step-42.cc b/examples/step-42/step-42.cc index a17ed31046..3e9fdeaea0 100644 --- a/examples/step-42/step-42.cc +++ b/examples/step-42/step-42.cc @@ -612,7 +612,7 @@ namespace Step42 void compute_dirichlet_constraints(); void update_solution_and_constraints(); void - assemble_mass_matrix_diagonal(TrilinosWrappers::SparseMatrix &mass_matrix); + assemble_mass_matrix_diagonal(TrilinosWrappers::SparseMatrix &mass_matrix); void assemble_newton_system( const TrilinosWrappers::MPI::Vector &linearization_point); void compute_nonlinear_residual( diff --git a/examples/step-64/step-64.cu b/examples/step-64/step-64.cu index 20e06b3cb2..d163532ba7 100644 --- a/examples/step-64/step-64.cu +++ b/examples/step-64/step-64.cu @@ -149,8 +149,8 @@ namespace Step64 // the two terms on the left-hand side correspond to the two function calls // here: template - __device__ void HelmholtzOperatorQuad:: - operator()(CUDAWrappers::FEEvaluation *fe_eval) const + __device__ void HelmholtzOperatorQuad::operator()( + CUDAWrappers::FEEvaluation *fe_eval) const { fe_eval->submit_value(coef * fe_eval->get_value()); fe_eval->submit_gradient(fe_eval->get_gradient()); @@ -366,7 +366,7 @@ namespace Step64 // In addition, we also keep a solution vector with CPU storage such that we // can view and display the solution as usual. LinearAlgebra::distributed::Vector - ghost_solution_host; + ghost_solution_host; LinearAlgebra::distributed::Vector solution_dev; LinearAlgebra::distributed::Vector system_rhs_dev; diff --git a/examples/step-70/step-70.cc b/examples/step-70/step-70.cc index a91f649269..79212bec0b 100644 --- a/examples/step-70/step-70.cc +++ b/examples/step-70/step-70.cc @@ -282,7 +282,7 @@ namespace Step70 std::string arguments_for_solid_grid = spacedim == 2 ? "-.5, -.1: .5, .1: false" : "-.5, -.1, -.1: .5, .1, .1: false"; - std::string name_of_particle_grid = "hyper_ball"; + std::string name_of_particle_grid = "hyper_ball"; std::string arguments_for_particle_grid = spacedim == 2 ? "0.3, 0.3: 0.1: false" : "0.3, 0.3, 0.3 : 0.1: false"; diff --git a/include/deal.II/algorithms/general_data_storage.h b/include/deal.II/algorithms/general_data_storage.h index 1092020bbd..c6797d4dcb 100644 --- a/include/deal.II/algorithms/general_data_storage.h +++ b/include/deal.II/algorithms/general_data_storage.h @@ -246,7 +246,7 @@ public: Type & get_or_add_object_with_name(const std::string &name, Arg & argument, - Args &... arguments); + Args &...arguments); /** * Return a reference to the object with given name. If the object does @@ -273,7 +273,7 @@ public: Type & get_or_add_object_with_name(const std::string &name, Arg && argument, - Args &&... arguments); + Args &&...arguments); /** * Return a reference to the object with given name. If the object does @@ -492,7 +492,7 @@ template Type & GeneralDataStorage::get_or_add_object_with_name(const std::string &name, Arg & argument, - Args &... arguments) + Args &...arguments) { if (!stores_object_with_name(name)) add_unique_copy(name, Type(argument, arguments...)); @@ -519,7 +519,7 @@ template Type & GeneralDataStorage::get_or_add_object_with_name(const std::string &name, Arg && argument, - Args &&... arguments) + Args &&...arguments) { if (!stores_object_with_name(name)) add_unique_copy(name, diff --git a/include/deal.II/base/aligned_vector.h b/include/deal.II/base/aligned_vector.h index 4260619aa2..de72cb524b 100644 --- a/include/deal.II/base/aligned_vector.h +++ b/include/deal.II/base/aligned_vector.h @@ -377,12 +377,14 @@ public: /** * Read-write access to entry @p index in the vector. */ - reference operator[](const size_type index); + reference + operator[](const size_type index); /** * Read-only access to entry @p index in the vector. */ - const_reference operator[](const size_type index) const; + const_reference + operator[](const size_type index) const; /** * Return a pointer to the underlying data buffer. @@ -1683,8 +1685,8 @@ AlignedVector::capacity() const template -inline typename AlignedVector::reference AlignedVector:: - operator[](const size_type index) +inline typename AlignedVector::reference +AlignedVector::operator[](const size_type index) { AssertIndexRange(index, size()); return elements[index]; @@ -1693,8 +1695,8 @@ inline typename AlignedVector::reference AlignedVector:: template -inline typename AlignedVector::const_reference AlignedVector:: - operator[](const size_type index) const +inline typename AlignedVector::const_reference +AlignedVector::operator[](const size_type index) const { AssertIndexRange(index, size()); return elements[index]; diff --git a/include/deal.II/base/array_view.h b/include/deal.II/base/array_view.h index d370dc6fc3..af39436d06 100644 --- a/include/deal.II/base/array_view.h +++ b/include/deal.II/base/array_view.h @@ -322,7 +322,8 @@ public: * This function is only allowed to be called if the underlying data is indeed * stored in CPU memory. */ - value_type &operator[](const std::size_t i) const; + value_type & + operator[](const std::size_t i) const; private: /** @@ -515,8 +516,8 @@ inline ArrayView::ArrayView( template inline bool -ArrayView:: -operator==(const ArrayView &other_view) const +ArrayView::operator==( + const ArrayView &other_view) const { return (other_view.data() == starting_element) && (other_view.size() == n_elements); @@ -526,9 +527,9 @@ operator==(const ArrayView &other_view) const template inline bool -ArrayView:: -operator==(const ArrayView::type, - MemorySpaceType> &other_view) const +ArrayView::operator==( + const ArrayView::type, MemorySpaceType> + &other_view) const { return (other_view.data() == starting_element) && (other_view.size() == n_elements); @@ -538,8 +539,8 @@ operator==(const ArrayView::type, template inline bool -ArrayView:: -operator!=(const ArrayView &other_view) const +ArrayView::operator!=( + const ArrayView &other_view) const { return !(*this == other_view); } @@ -560,9 +561,9 @@ ArrayView::data() const noexcept template inline bool -ArrayView:: -operator!=(const ArrayView::type, - MemorySpaceType> &other_view) const +ArrayView::operator!=( + const ArrayView::type, MemorySpaceType> + &other_view) const { return !(*this == other_view); } @@ -616,7 +617,7 @@ ArrayView::cend() const template inline typename ArrayView::value_type & - ArrayView::operator[](const std::size_t i) const +ArrayView::operator[](const std::size_t i) const { AssertIndexRange(i, n_elements); Assert( @@ -1072,8 +1073,8 @@ make_array_view(const std::vector &vector, */ template inline ArrayView - make_array_view(Table<2, ElementType> & table, - const typename Table<2, ElementType>::size_type row) +make_array_view(Table<2, ElementType> & table, + const typename Table<2, ElementType>::size_type row) { AssertIndexRange(row, table.size()[0]); return ArrayView(&table[row][0], table.size()[1]); @@ -1098,7 +1099,8 @@ inline ArrayView * @relatesalso ArrayView */ template -inline ArrayView make_array_view(Table<2, ElementType> &table) +inline ArrayView +make_array_view(Table<2, ElementType> &table) { return ArrayView(&table[0][0], table.n_elements()); } @@ -1227,11 +1229,11 @@ make_array_view(const Table<2, ElementType> & table, * @relatesalso ArrayView */ template -inline ArrayView make_array_view( - Table<2, ElementType> & table, - const typename Table<2, ElementType>::size_type row, - const typename Table<2, ElementType>::size_type starting_column, - const std::size_t size_of_view) +inline ArrayView +make_array_view(Table<2, ElementType> & table, + const typename Table<2, ElementType>::size_type row, + const typename Table<2, ElementType>::size_type starting_column, + const std::size_t size_of_view) { AssertIndexRange(row, table.size()[0]); AssertIndexRange(starting_column, table.size()[1]); diff --git a/include/deal.II/base/bounding_box.h b/include/deal.II/base/bounding_box.h index 2964fef076..01dd0c0d50 100644 --- a/include/deal.II/base/bounding_box.h +++ b/include/deal.II/base/bounding_box.h @@ -467,8 +467,8 @@ BoundingBox::get_boundary_points() const template inline bool -BoundingBox:: -operator==(const BoundingBox &box) const +BoundingBox::operator==( + const BoundingBox &box) const { return boundary_points == box.boundary_points; } @@ -477,8 +477,8 @@ operator==(const BoundingBox &box) const template inline bool -BoundingBox:: -operator!=(const BoundingBox &box) const +BoundingBox::operator!=( + const BoundingBox &box) const { return boundary_points != box.boundary_points; } diff --git a/include/deal.II/base/data_out_base.h b/include/deal.II/base/data_out_base.h index dab3f2df5a..5738b918b3 100644 --- a/include/deal.II/base/data_out_base.h +++ b/include/deal.II/base/data_out_base.h @@ -501,7 +501,8 @@ namespace DataOutBase /** * Swap the current object's contents with those of the given argument. */ - void swap(Patch<0, spacedim> &other_patch); + void + swap(Patch<0, spacedim> &other_patch); /** * Value to be used if this patch has no neighbor on one side. diff --git a/include/deal.II/base/derivative_form.h b/include/deal.II/base/derivative_form.h index 8c70216894..ffdb5c49b9 100644 --- a/include/deal.II/base/derivative_form.h +++ b/include/deal.II/base/derivative_form.h @@ -76,12 +76,14 @@ public: /** * Read-Write access operator. */ - Tensor &operator[](const unsigned int i); + Tensor & + operator[](const unsigned int i); /** * Read-only access operator. */ - const Tensor &operator[](const unsigned int i) const; + const Tensor & + operator[](const unsigned int i) const; /** * Assignment operator. @@ -207,8 +209,8 @@ inline DerivativeForm::DerivativeForm( template inline DerivativeForm & -DerivativeForm:: -operator=(const Tensor &ta) +DerivativeForm::operator=( + const Tensor &ta) { Assert((dim == spacedim), ExcMessage("Only allowed when dim==spacedim.")); @@ -222,8 +224,8 @@ operator=(const Tensor &ta) template inline DerivativeForm & -DerivativeForm:: -operator=(const Tensor> &T) +DerivativeForm::operator=( + const Tensor> &T) { for (unsigned int j = 0; j < spacedim; ++j) (*this)[j] = T[j]; @@ -234,8 +236,8 @@ operator=(const Tensor> &T) template inline DerivativeForm & -DerivativeForm:: -operator=(const Tensor<1, dim, Number> &T) +DerivativeForm::operator=( + const Tensor<1, dim, Number> &T) { Assert((1 == spacedim) && (order == 1), ExcMessage("Only allowed for spacedim==1 and order==1.")); @@ -249,7 +251,7 @@ operator=(const Tensor<1, dim, Number> &T) template inline Tensor & - DerivativeForm::operator[](const unsigned int i) +DerivativeForm::operator[](const unsigned int i) { AssertIndexRange(i, spacedim); @@ -260,8 +262,8 @@ inline Tensor & template inline const Tensor & - DerivativeForm:: - operator[](const unsigned int i) const +DerivativeForm::operator[]( + const unsigned int i) const { AssertIndexRange(i, spacedim); diff --git a/include/deal.II/base/exceptions.h b/include/deal.II/base/exceptions.h index 01b6ae86e0..16018caa07 100644 --- a/include/deal.II/base/exceptions.h +++ b/include/deal.II/base/exceptions.h @@ -1355,7 +1355,8 @@ namespace deal_II_exceptions const char * function, const char * cond, const char * exc_name, - ExceptionType e) { + ExceptionType e) + { // Fill the fields of the exception object e.set_fields(file, line, function, cond, exc_name); @@ -1385,7 +1386,8 @@ namespace deal_II_exceptions /** * Internal function that does the work of issue_error_nothrow. */ - void do_issue_error_nothrow(const ExceptionBase &e) noexcept; + void + do_issue_error_nothrow(const ExceptionBase &e) noexcept; /** * Exception generation mechanism in case we must not throw. diff --git a/include/deal.II/base/geometry_info.h b/include/deal.II/base/geometry_info.h index c2fa647ee2..361b60b6e5 100644 --- a/include/deal.II/base/geometry_info.h +++ b/include/deal.II/base/geometry_info.h @@ -832,7 +832,8 @@ public: * Return the intersection of the refinement flags represented by the * current object and the one given as argument. */ - RefinementCase operator&(const RefinementCase &r) const; + RefinementCase + operator&(const RefinementCase &r) const; /** * Return the negation of the refinement flags represented by the current @@ -2826,8 +2827,8 @@ RefinementCase::operator|(const RefinementCase &r) const template -inline RefinementCase RefinementCase:: - operator&(const RefinementCase &r) const +inline RefinementCase +RefinementCase::operator&(const RefinementCase &r) const { return RefinementCase(static_cast(value & r.value)); } diff --git a/include/deal.II/base/index_set.h b/include/deal.II/base/index_set.h index 3d3e1150b2..5d05fe75cd 100644 --- a/include/deal.II/base/index_set.h +++ b/include/deal.II/base/index_set.h @@ -324,7 +324,8 @@ public: * sets must have the same size (though of course they do not have to have * the same number of indices). */ - IndexSet operator&(const IndexSet &is) const; + IndexSet + operator&(const IndexSet &is) const; /** * This command takes an interval [begin, end) and returns the @@ -658,12 +659,14 @@ public: /** * Dereferencing operator, returns an IntervalAccessor. */ - const IntervalAccessor &operator*() const; + const IntervalAccessor & + operator*() const; /** * Dereferencing operator, returns a pointer to an IntervalAccessor. */ - const IntervalAccessor *operator->() const; + const IntervalAccessor * + operator->() const; /** * Comparison. @@ -734,7 +737,8 @@ public: * Dereferencing operator. The returned value is the index of the element * inside the IndexSet. */ - size_type operator*() const; + size_type + operator*() const; /** * Does this iterator point to an existing element? @@ -1116,8 +1120,8 @@ IndexSet::IntervalAccessor::operator=(const IndexSet::IntervalAccessor &other) inline bool -IndexSet::IntervalAccessor:: -operator==(const IndexSet::IntervalAccessor &other) const +IndexSet::IntervalAccessor::operator==( + const IndexSet::IntervalAccessor &other) const { Assert(index_set == other.index_set, ExcMessage( @@ -1128,8 +1132,8 @@ operator==(const IndexSet::IntervalAccessor &other) const inline bool -IndexSet::IntervalAccessor:: -operator<(const IndexSet::IntervalAccessor &other) const +IndexSet::IntervalAccessor::operator<( + const IndexSet::IntervalAccessor &other) const { Assert(index_set == other.index_set, ExcMessage( @@ -1195,16 +1199,16 @@ IndexSet::IntervalIterator::operator++(int) -inline const IndexSet::IntervalAccessor &IndexSet::IntervalIterator:: - operator*() const +inline const IndexSet::IntervalAccessor & +IndexSet::IntervalIterator::operator*() const { return accessor; } -inline const IndexSet::IntervalAccessor *IndexSet::IntervalIterator:: - operator->() const +inline const IndexSet::IntervalAccessor * +IndexSet::IntervalIterator::operator->() const { return &accessor; } @@ -1212,8 +1216,8 @@ inline const IndexSet::IntervalAccessor *IndexSet::IntervalIterator:: inline bool -IndexSet::IntervalIterator:: -operator==(const IndexSet::IntervalIterator &other) const +IndexSet::IntervalIterator::operator==( + const IndexSet::IntervalIterator &other) const { return accessor == other.accessor; } @@ -1221,8 +1225,8 @@ operator==(const IndexSet::IntervalIterator &other) const inline bool -IndexSet::IntervalIterator:: -operator!=(const IndexSet::IntervalIterator &other) const +IndexSet::IntervalIterator::operator!=( + const IndexSet::IntervalIterator &other) const { return !(*this == other); } @@ -1230,8 +1234,8 @@ operator!=(const IndexSet::IntervalIterator &other) const inline bool -IndexSet::IntervalIterator:: -operator<(const IndexSet::IntervalIterator &other) const +IndexSet::IntervalIterator::operator<( + const IndexSet::IntervalIterator &other) const { return accessor < other.accessor; } @@ -1239,8 +1243,8 @@ operator<(const IndexSet::IntervalIterator &other) const inline int -IndexSet::IntervalIterator:: -operator-(const IndexSet::IntervalIterator &other) const +IndexSet::IntervalIterator::operator-( + const IndexSet::IntervalIterator &other) const { Assert(accessor.index_set == other.accessor.index_set, ExcMessage( @@ -1307,7 +1311,8 @@ IndexSet::ElementIterator::is_valid() const -inline IndexSet::size_type IndexSet::ElementIterator::operator*() const +inline IndexSet::size_type +IndexSet::ElementIterator::operator*() const { Assert( is_valid(), @@ -1319,8 +1324,8 @@ inline IndexSet::size_type IndexSet::ElementIterator::operator*() const inline bool -IndexSet::ElementIterator:: -operator==(const IndexSet::ElementIterator &other) const +IndexSet::ElementIterator::operator==( + const IndexSet::ElementIterator &other) const { Assert(index_set == other.index_set, ExcMessage( @@ -1379,8 +1384,8 @@ IndexSet::ElementIterator::operator++(int) inline bool -IndexSet::ElementIterator:: -operator!=(const IndexSet::ElementIterator &other) const +IndexSet::ElementIterator::operator!=( + const IndexSet::ElementIterator &other) const { return !(*this == other); } @@ -1388,8 +1393,8 @@ operator!=(const IndexSet::ElementIterator &other) const inline bool -IndexSet::ElementIterator:: -operator<(const IndexSet::ElementIterator &other) const +IndexSet::ElementIterator::operator<( + const IndexSet::ElementIterator &other) const { Assert(index_set == other.index_set, ExcMessage( @@ -1401,8 +1406,8 @@ operator<(const IndexSet::ElementIterator &other) const inline std::ptrdiff_t -IndexSet::ElementIterator:: -operator-(const IndexSet::ElementIterator &other) const +IndexSet::ElementIterator::operator-( + const IndexSet::ElementIterator &other) const { Assert(index_set == other.index_set, ExcMessage( diff --git a/include/deal.II/base/iterator_range.h b/include/deal.II/base/iterator_range.h index a128394bd6..5d8043308a 100644 --- a/include/deal.II/base/iterator_range.h +++ b/include/deal.II/base/iterator_range.h @@ -217,13 +217,15 @@ public: * Dereferencing operator. * @return The iterator within the collection currently pointed to. */ - const BaseIterator &operator*() const; + const BaseIterator & + operator*() const; /** * Dereferencing operator. * @return The iterator within the collection currently pointed to. */ - const BaseIterator *operator->() const; + const BaseIterator * + operator->() const; /** * Prefix increment operator. Move the current iterator to the next @@ -311,7 +313,7 @@ inline IteratorOverIterators::IteratorOverIterators( template inline const typename IteratorOverIterators::BaseIterator & - IteratorOverIterators::operator*() const +IteratorOverIterators::operator*() const { return element_of_iterator_collection; } @@ -320,7 +322,7 @@ inline const typename IteratorOverIterators::BaseIterator & template inline const typename IteratorOverIterators::BaseIterator * - IteratorOverIterators::operator->() const +IteratorOverIterators::operator->() const { return &element_of_iterator_collection; } @@ -350,8 +352,8 @@ IteratorOverIterators::operator++(int) template inline bool -IteratorOverIterators:: -operator!=(const IteratorOverIterators &i_o_i) const +IteratorOverIterators::operator!=( + const IteratorOverIterators &i_o_i) const { return element_of_iterator_collection != i_o_i.element_of_iterator_collection; } diff --git a/include/deal.II/base/linear_index_iterator.h b/include/deal.II/base/linear_index_iterator.h index ba5505b93b..f50f532688 100644 --- a/include/deal.II/base/linear_index_iterator.h +++ b/include/deal.II/base/linear_index_iterator.h @@ -236,12 +236,14 @@ public: /** * Dereferencing operator. */ - reference operator*() const; + reference + operator*() const; /** * Dereferencing operator. */ - pointer operator->() const; + pointer + operator->() const; /** * Comparison operator. Returns true if both iterators point to @@ -328,8 +330,8 @@ protected: template inline DerivedIterator & -LinearIndexIterator:: -operator=(const DerivedIterator &it) +LinearIndexIterator::operator=( + const DerivedIterator &it) { accessor.container = it.container; accessor.linear_index = it.linear_index; @@ -380,8 +382,8 @@ LinearIndexIterator::operator--(int) template inline DerivedIterator -LinearIndexIterator:: -operator+(const difference_type n) const +LinearIndexIterator::operator+( + const difference_type n) const { DerivedIterator copy(this->accessor); copy += n; @@ -392,8 +394,8 @@ operator+(const difference_type n) const template inline DerivedIterator -LinearIndexIterator:: -operator-(const difference_type n) const +LinearIndexIterator::operator-( + const difference_type n) const { DerivedIterator copy(this->accessor); copy += -n; @@ -404,8 +406,8 @@ operator-(const difference_type n) const template inline DerivedIterator & -LinearIndexIterator:: -operator+=(const difference_type n) +LinearIndexIterator::operator+=( + const difference_type n) { accessor.linear_index += n; return static_cast(*this); @@ -415,8 +417,8 @@ operator+=(const difference_type n) template inline DerivedIterator & -LinearIndexIterator:: -operator-=(const difference_type n) +LinearIndexIterator::operator-=( + const difference_type n) { return operator+=(-n); } @@ -426,8 +428,8 @@ operator-=(const difference_type n) template inline typename LinearIndexIterator::difference_type - LinearIndexIterator:: - operator-(const DerivedIterator &other) const + LinearIndexIterator::operator-( + const DerivedIterator &other) const { Assert(this->accessor.container == other.accessor.container, ExcMessage( @@ -439,7 +441,7 @@ inline template inline typename LinearIndexIterator::reference - LinearIndexIterator::operator*() const +LinearIndexIterator::operator*() const { return accessor; } @@ -448,7 +450,7 @@ inline typename LinearIndexIterator::reference template inline typename LinearIndexIterator::pointer - LinearIndexIterator::operator->() const +LinearIndexIterator::operator->() const { return &accessor; } @@ -457,8 +459,8 @@ inline typename LinearIndexIterator::pointer template inline bool -LinearIndexIterator:: -operator<=(const DerivedIterator &other) const +LinearIndexIterator::operator<=( + const DerivedIterator &other) const { return (*this == other) || (*this < other); } @@ -467,8 +469,8 @@ operator<=(const DerivedIterator &other) const template inline bool -LinearIndexIterator:: -operator>=(const DerivedIterator &other) const +LinearIndexIterator::operator>=( + const DerivedIterator &other) const { return !(*this < other); } @@ -477,8 +479,8 @@ operator>=(const DerivedIterator &other) const template inline bool -LinearIndexIterator:: -operator<(const DerivedIterator &other) const +LinearIndexIterator::operator<( + const DerivedIterator &other) const { Assert(this->accessor.container == other.accessor.container, ExcMessage( @@ -490,8 +492,8 @@ operator<(const DerivedIterator &other) const template inline bool -LinearIndexIterator:: -operator>(const DerivedIterator &other) const +LinearIndexIterator::operator>( + const DerivedIterator &other) const { return other < static_cast(*this); } diff --git a/include/deal.II/base/mg_level_object.h b/include/deal.II/base/mg_level_object.h index f8788fe120..6303e04d2f 100644 --- a/include/deal.II/base/mg_level_object.h +++ b/include/deal.II/base/mg_level_object.h @@ -73,7 +73,7 @@ public: template MGLevelObject(const unsigned int minlevel, const unsigned int maxlevel, - Args &&... args); + Args &&...args); /** * Constructor. Same as above but without arguments to be forwarded to the @@ -85,7 +85,8 @@ public: /** * Access object on level @p level. */ - Object &operator[](const unsigned int level); + Object & + operator[](const unsigned int level); /** * Access object on level @p level. @@ -93,7 +94,8 @@ public: * This function can be called on a @p const object, and * consequently returns a @p const reference. */ - const Object &operator[](const unsigned int level) const; + const Object & + operator[](const unsigned int level) const; /** * Delete all previous contents of this object and reset its size according @@ -112,7 +114,7 @@ public: void resize(const unsigned int new_minlevel, const unsigned int new_maxlevel, - Args &&... args); + Args &&...args); /** * Call operator = (s) on all objects stored by this object. @@ -186,7 +188,7 @@ template template MGLevelObject::MGLevelObject(const unsigned int min, const unsigned int max, - Args &&... args) + Args &&...args) : minlevel(0) { resize(min, max, std::forward(args)...); @@ -203,7 +205,8 @@ MGLevelObject::MGLevelObject(const unsigned int min, template -Object &MGLevelObject::operator[](const unsigned int i) +Object & +MGLevelObject::operator[](const unsigned int i) { Assert((i >= minlevel) && (i < minlevel + objects.size()), ExcIndexRange(i, minlevel, minlevel + objects.size())); @@ -212,7 +215,8 @@ Object &MGLevelObject::operator[](const unsigned int i) template -const Object &MGLevelObject::operator[](const unsigned int i) const +const Object & +MGLevelObject::operator[](const unsigned int i) const { Assert((i >= minlevel) && (i < minlevel + objects.size()), ExcIndexRange(i, minlevel, minlevel + objects.size())); @@ -225,7 +229,7 @@ template void MGLevelObject::resize(const unsigned int new_minlevel, const unsigned int new_maxlevel, - Args &&... args) + Args &&...args) { Assert(new_minlevel <= new_maxlevel, ExcInternalError()); // note that on clear(), the diff --git a/include/deal.II/base/mpi.h b/include/deal.II/base/mpi.h index 978041f762..33eb2c1dfe 100644 --- a/include/deal.II/base/mpi.h +++ b/include/deal.II/base/mpi.h @@ -285,7 +285,8 @@ namespace Utilities /** * Access the stored communicator. */ - const MPI_Comm &operator*() const + const MPI_Comm & + operator*() const { return comm; } diff --git a/include/deal.II/base/mpi_compute_index_owner_internal.h b/include/deal.II/base/mpi_compute_index_owner_internal.h index 71cdc86d21..93008991c0 100644 --- a/include/deal.II/base/mpi_compute_index_owner_internal.h +++ b/include/deal.II/base/mpi_compute_index_owner_internal.h @@ -268,7 +268,7 @@ namespace Utilities // ranks. Here, we process the interval by breaking into // smaller pieces in terms of the dictionary number. std::pair - index_range(*interval->begin(), interval->last() + 1); + index_range(*interval->begin(), interval->last() + 1); const unsigned int owner_last = dof_to_dict_rank(interval->last()); unsigned int owner_first = numbers::invalid_unsigned_int; diff --git a/include/deal.II/base/mutable_bind.h b/include/deal.II/base/mutable_bind.h index 2300c06797..53e40c96af 100644 --- a/include/deal.II/base/mutable_bind.h +++ b/include/deal.II/base/mutable_bind.h @@ -94,7 +94,7 @@ namespace Utilities * each arguments separately. */ template - MutableBind(FunctionType function, FunctionArgs &&... arguments); + MutableBind(FunctionType function, FunctionArgs &&...arguments); /** * Construct a MutableBind object specifying the function, and @@ -129,7 +129,7 @@ namespace Utilities * operator()() is called, using move semantic. */ void - set_arguments(FunctionArgs &&... arguments); + set_arguments(FunctionArgs &&...arguments); /** * Parse the arguments to use in @p function from a string, for next time @@ -186,7 +186,7 @@ namespace Utilities template MutableBind mutable_bind(ReturnType (*function)(FunctionArgs...), - typename identity::type &&... arguments); + typename identity::type &&...arguments); /** * Same as above, using a std::function object. @@ -194,7 +194,7 @@ namespace Utilities template MutableBind mutable_bind(std::function, - typename identity::type &&... arguments); + typename identity::type &&...arguments); /** * Create a MutableBind object from a function pointer, with uninitialized @@ -224,7 +224,7 @@ namespace Utilities template MutableBind::MutableBind( FunctionType function, - FunctionArgs &&... arguments) + FunctionArgs &&...arguments) : function(function) , arguments(std::make_tuple(std::move(arguments)...)) {} @@ -261,7 +261,7 @@ namespace Utilities template void MutableBind::set_arguments( - FunctionArgs &&... args) + FunctionArgs &&...args) { arguments = std::make_tuple(std::move(args)...); } @@ -292,7 +292,7 @@ namespace Utilities template MutableBind mutable_bind(ReturnType (*function)(FunctionArgs...), - typename identity::type &&... arguments) + typename identity::type &&...arguments) { return MutableBind(function, std::move(arguments)...); @@ -312,7 +312,7 @@ namespace Utilities template MutableBind mutable_bind(std::function function, - typename identity::type &&... arguments) + typename identity::type &&...arguments) { return MutableBind(function, std::move(arguments)...); diff --git a/include/deal.II/base/numbers.h b/include/deal.II/base/numbers.h index 32ccde7d29..9e73871ca0 100644 --- a/include/deal.II/base/numbers.h +++ b/include/deal.II/base/numbers.h @@ -571,7 +571,7 @@ namespace numbers template constexpr DEAL_II_CUDA_HOST_DEV const number & - NumberTraits::conjugate(const number &x) + NumberTraits::conjugate(const number &x) { return x; } @@ -700,7 +700,7 @@ namespace internal struct NumberType { static constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV const T & - value(const T &t) + value(const T &t) { return t; } @@ -715,8 +715,8 @@ namespace internal // Type T is constructible from F. template static constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV T - value(const F &f, - typename std::enable_if< + value(const F &f, + typename std::enable_if< !std::is_same::type, typename std::decay::type>::value && std::is_constructible::value>::type * = nullptr) @@ -727,8 +727,8 @@ namespace internal // Type T is explicitly convertible (but not constructible) from F. template static constexpr DEAL_II_ALWAYS_INLINE T - value(const F &f, - typename std::enable_if< + value(const F &f, + typename std::enable_if< !std::is_same::type, typename std::decay::type>::value && !std::is_constructible::value && diff --git a/include/deal.II/base/parallel.h b/include/deal.II/base/parallel.h index 9f039db234..bef3174dd1 100644 --- a/include/deal.II/base/parallel.h +++ b/include/deal.II/base/parallel.h @@ -456,13 +456,13 @@ namespace parallel f(begin, end); #else - internal::parallel_for(begin, - end, - [&f](const tbb::blocked_range &range) { - internal::apply_to_subranges( - range, f); - }, - grainsize); + internal::parallel_for( + begin, + end, + [&f](const tbb::blocked_range &range) { + internal::apply_to_subranges(range, f); + }, + grainsize); #endif } diff --git a/include/deal.II/base/parameter_acceptor.h b/include/deal.II/base/parameter_acceptor.h index c21b30fec9..86ca5b74a7 100644 --- a/include/deal.II/base/parameter_acceptor.h +++ b/include/deal.II/base/parameter_acceptor.h @@ -401,7 +401,7 @@ public: initialize(const std::string &filename = "", const std::string &output_filename = "", const ParameterHandler::OutputStyle - output_style_for_output_filename = ParameterHandler::Short, + output_style_for_output_filename = ParameterHandler::Short, ParameterHandler & prm = ParameterAcceptor::prm, const ParameterHandler::OutputStyle output_style_for_filename = ParameterHandler::DefaultStyle); diff --git a/include/deal.II/base/patterns.h b/include/deal.II/base/patterns.h index 8cc66785b7..8c9547c3d4 100644 --- a/include/deal.II/base/patterns.h +++ b/include/deal.II/base/patterns.h @@ -799,7 +799,7 @@ namespace Patterns * @param patterns The list of patterns to use */ template - Tuple(const std::string &separator, const PatternTypes &... patterns); + Tuple(const std::string &separator, const PatternTypes &...patterns); /** * Constructor. This is needed to allow users to specify @@ -809,7 +809,7 @@ namespace Patterns * specialization, the compiler will fail with cryptic errors. */ template - Tuple(const char *separator, const PatternTypes &... patterns); + Tuple(const char *separator, const PatternTypes &...patterns); /** * Constructor. Same as above, using the default separator. @@ -817,7 +817,7 @@ namespace Patterns * @param patterns The list of patterns to use */ template - Tuple(const Patterns &... patterns); + Tuple(const Patterns &...patterns); /** * Copy constructor. @@ -1413,7 +1413,7 @@ namespace Patterns namespace Patterns { template - Tuple::Tuple(const char *separator, const PatternTypes &... ps) + Tuple::Tuple(const char *separator, const PatternTypes &...ps) : // forward to the version with std::string argument Tuple(std::string(separator), ps...) {} @@ -1421,7 +1421,7 @@ namespace Patterns template - Tuple::Tuple(const std::string &separator, const PatternTypes &... ps) + Tuple::Tuple(const std::string &separator, const PatternTypes &...ps) : separator(separator) { static_assert(is_base_of_all::value, @@ -1437,7 +1437,7 @@ namespace Patterns template - Tuple::Tuple(const PatternTypes &... ps) + Tuple::Tuple(const PatternTypes &...ps) : // forward to the version with the separator argument Tuple(std::string(":"), ps...) {} diff --git a/include/deal.II/base/point.h b/include/deal.II/base/point.h index c261b9ef83..785935bc05 100644 --- a/include/deal.II/base/point.h +++ b/include/deal.II/base/point.h @@ -185,7 +185,7 @@ public: * @note This function can also be used in CUDA device code. */ DEAL_II_CUDA_HOST_DEV Number - operator()(const unsigned int index) const; + operator()(const unsigned int index) const; /** * Read and write access to the indexth coordinate. @@ -288,7 +288,8 @@ public: * * @note This function can also be used in CUDA device code. */ - DEAL_II_CUDA_HOST_DEV Number operator*(const Tensor<1, dim, Number> &p) const; + DEAL_II_CUDA_HOST_DEV Number + operator*(const Tensor<1, dim, Number> &p) const; /** * Return the scalar product of this point vector with itself, i.e. the @@ -548,10 +549,10 @@ Point::operator-() const template template inline DEAL_II_CUDA_HOST_DEV - Point::type>::type> - Point::operator*(const OtherNumber factor) const + Point::operator*(const OtherNumber factor) const { Point::type> tmp; for (unsigned int i = 0; i < dim; ++i) @@ -580,8 +581,8 @@ inline DEAL_II_CUDA_HOST_DEV template -inline DEAL_II_CUDA_HOST_DEV Number Point:: - operator*(const Tensor<1, dim, Number> &p) const +inline DEAL_II_CUDA_HOST_DEV Number +Point::operator*(const Tensor<1, dim, Number> &p) const { Number res = Number(); for (unsigned int i = 0; i < dim; ++i) diff --git a/include/deal.II/base/polynomials_barycentric.h b/include/deal.II/base/polynomials_barycentric.h index 14c8349537..c2736486f5 100644 --- a/include/deal.II/base/polynomials_barycentric.h +++ b/include/deal.II/base/polynomials_barycentric.h @@ -137,7 +137,8 @@ public: * Multiply by a scalar. */ template - BarycentricPolynomial operator*(const Number2 &a) const; + BarycentricPolynomial + operator*(const Number2 &a) const; /** * Divide by a scalar. @@ -234,7 +235,8 @@ public: /** * Access operator. */ - const BarycentricPolynomial &operator[](const std::size_t i) const; + const BarycentricPolynomial & + operator[](const std::size_t i) const; /** * @copydoc ScalarPolynomialsBase::evaluate() @@ -489,8 +491,8 @@ BarycentricPolynomial::operator-(const Number2 &a) const template template -BarycentricPolynomial BarycentricPolynomial:: - operator*(const Number2 &a) const +BarycentricPolynomial +BarycentricPolynomial::operator*(const Number2 &a) const { if (a == Number2()) { @@ -522,8 +524,8 @@ BarycentricPolynomial::operator/(const Number2 &a) const template BarycentricPolynomial -BarycentricPolynomial:: -operator+(const BarycentricPolynomial &augend) const +BarycentricPolynomial::operator+( + const BarycentricPolynomial &augend) const { TableIndices deg; for (unsigned int d = 0; d < dim + 1; ++d) @@ -550,8 +552,8 @@ operator+(const BarycentricPolynomial &augend) const template BarycentricPolynomial -BarycentricPolynomial:: -operator-(const BarycentricPolynomial &augend) const +BarycentricPolynomial::operator-( + const BarycentricPolynomial &augend) const { return *this + (-augend); } @@ -559,8 +561,9 @@ operator-(const BarycentricPolynomial &augend) const template -BarycentricPolynomial BarycentricPolynomial:: - operator*(const BarycentricPolynomial &multiplicand) const +BarycentricPolynomial +BarycentricPolynomial::operator*( + const BarycentricPolynomial &multiplicand) const { TableIndices deg; for (unsigned int d = 0; d < dim + 1; ++d) @@ -697,8 +700,8 @@ BarycentricPolynomial::index_to_indices( } template -const BarycentricPolynomial &BarycentricPolynomials:: - operator[](const std::size_t i) const +const BarycentricPolynomial & +BarycentricPolynomials::operator[](const std::size_t i) const { AssertIndexRange(i, polys.size()); return polys[i]; diff --git a/include/deal.II/base/smartpointer.h b/include/deal.II/base/smartpointer.h index 3739582067..5c8bb95fe1 100644 --- a/include/deal.II/base/smartpointer.h +++ b/include/deal.II/base/smartpointer.h @@ -148,13 +148,15 @@ public: * Dereferencing operator. This operator throws an ExcNotInitialized() if the * pointer is a null pointer. */ - T &operator*() const; + T & + operator*() const; /** * Dereferencing operator. This operator throws an ExcNotInitializedi() if the * pointer is a null pointer. */ - T *operator->() const; + T * + operator->() const; /** * Exchange the pointers of this object and the argument. Since both the @@ -363,7 +365,8 @@ inline SmartPointer::operator T *() const template -inline T &SmartPointer::operator*() const +inline T & +SmartPointer::operator*() const { Assert(t != nullptr, ExcNotInitialized()); Assert(pointed_to_object_is_alive, @@ -374,7 +377,8 @@ inline T &SmartPointer::operator*() const template -inline T *SmartPointer::operator->() const +inline T * +SmartPointer::operator->() const { Assert(t != nullptr, ExcNotInitialized()); Assert(pointed_to_object_is_alive, diff --git a/include/deal.II/base/symmetric_tensor.h b/include/deal.II/base/symmetric_tensor.h index 2c77a22314..02cb46de8b 100644 --- a/include/deal.II/base/symmetric_tensor.h +++ b/include/deal.II/base/symmetric_tensor.h @@ -129,15 +129,15 @@ constexpr DEAL_II_ALWAYS_INLINE SymmetricTensor<4, dim, Number> template constexpr inline DEAL_II_ALWAYS_INLINE Number - trace(const SymmetricTensor<2, dim2, Number> &); +trace(const SymmetricTensor<2, dim2, Number> &); template constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number> - deviator(const SymmetricTensor<2, dim, Number> &); +deviator(const SymmetricTensor<2, dim, Number> &); template constexpr inline DEAL_II_ALWAYS_INLINE Number - determinant(const SymmetricTensor<2, dim, Number> &); +determinant(const SymmetricTensor<2, dim, Number> &); @@ -213,9 +213,9 @@ namespace internal * invalid state. */ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE TableIndices<2> - merge(const TableIndices<2> &previous_indices, - const unsigned int new_index, - const unsigned int position) + merge(const TableIndices<2> &previous_indices, + const unsigned int new_index, + const unsigned int position) { AssertIndexRange(position, 2); @@ -234,9 +234,9 @@ namespace internal * invalid state. */ DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE TableIndices<4> - merge(const TableIndices<4> &previous_indices, - const unsigned int new_index, - const unsigned int position) + merge(const TableIndices<4> &previous_indices, + const unsigned int new_index, + const unsigned int position) { AssertIndexRange(position, 4); @@ -563,12 +563,14 @@ namespace internal /** * Index operator. */ - constexpr reference operator[](const unsigned int); + constexpr reference + operator[](const unsigned int); /** * Index operator. */ - constexpr reference operator[](const unsigned int) const; + constexpr reference + operator[](const unsigned int) const; private: /** @@ -912,14 +914,16 @@ public: * * Exactly the same as operator(). */ - constexpr const Number &operator[](const TableIndices &indices) const; + constexpr const Number & + operator[](const TableIndices &indices) const; /** * Return a read-write reference to the indicated element. * * Exactly the same as operator(). */ - constexpr Number &operator[](const TableIndices &indices); + constexpr Number & + operator[](const TableIndices &indices); /** * Access to an element according to unrolled index. The function @@ -1086,9 +1090,9 @@ namespace internal template constexpr inline DEAL_II_ALWAYS_INLINE - Accessor - Accessor:: - operator[](const unsigned int i) + Accessor + Accessor::operator[]( + const unsigned int i) { return Accessor( tensor, merge(previous_indices, i, rank_ - P)); @@ -1098,9 +1102,9 @@ namespace internal template constexpr DEAL_II_ALWAYS_INLINE - Accessor - Accessor:: - operator[](const unsigned int i) const + Accessor + Accessor::operator[]( + const unsigned int i) const { return Accessor( tensor, merge(previous_indices, i, rank_ - P)); @@ -1122,8 +1126,8 @@ namespace internal template constexpr inline DEAL_II_ALWAYS_INLINE typename Accessor::reference - Accessor:: - operator[](const unsigned int i) + Accessor::operator[]( + const unsigned int i) { return tensor(merge(previous_indices, i, rank_ - 1)); } @@ -1132,8 +1136,8 @@ namespace internal template constexpr DEAL_II_ALWAYS_INLINE typename Accessor::reference - Accessor:: - operator[](const unsigned int i) const + Accessor::operator[]( + const unsigned int i) const { return tensor(merge(previous_indices, i, rank_ - 1)); } @@ -1191,8 +1195,8 @@ SymmetricTensor::SymmetricTensor( template template constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor & - SymmetricTensor:: - operator=(const SymmetricTensor &t) +SymmetricTensor::operator=( + const SymmetricTensor &t) { data = t.data; return *this; @@ -1220,7 +1224,7 @@ namespace internal { template constexpr inline DEAL_II_ALWAYS_INLINE dealii::Tensor<2, dim, Number> - convert_to_tensor(const dealii::SymmetricTensor<2, dim, Number> &s) + convert_to_tensor(const dealii::SymmetricTensor<2, dim, Number> &s) { dealii::Tensor<2, dim, Number> t; @@ -1563,8 +1567,9 @@ namespace internal template -constexpr DEAL_II_ALWAYS_INLINE SymmetricTensor:: - operator Tensor() const +constexpr DEAL_II_ALWAYS_INLINE + SymmetricTensor::operator Tensor() + const { return internal::SymmetricTensorImplementation::convert_to_tensor(*this); } @@ -1573,8 +1578,8 @@ constexpr DEAL_II_ALWAYS_INLINE SymmetricTensor:: template constexpr bool -SymmetricTensor:: -operator==(const SymmetricTensor &t) const +SymmetricTensor::operator==( + const SymmetricTensor &t) const { return data == t.data; } @@ -1583,8 +1588,8 @@ operator==(const SymmetricTensor &t) const template constexpr bool -SymmetricTensor:: -operator!=(const SymmetricTensor &t) const +SymmetricTensor::operator!=( + const SymmetricTensor &t) const { return data != t.data; } @@ -1594,8 +1599,8 @@ operator!=(const SymmetricTensor &t) const template template constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor & - SymmetricTensor:: - operator+=(const SymmetricTensor &t) +SymmetricTensor::operator+=( + const SymmetricTensor &t) { data += t.data; return *this; @@ -1606,8 +1611,8 @@ constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor & template template constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor & - SymmetricTensor:: - operator-=(const SymmetricTensor &t) +SymmetricTensor::operator-=( + const SymmetricTensor &t) { data -= t.data; return *this; @@ -1815,8 +1820,8 @@ template DEAL_II_CONSTEXPR inline DEAL_II_ALWAYS_INLINE typename internal::SymmetricTensorAccessors:: double_contraction_result::type - SymmetricTensor:: - operator*(const SymmetricTensor<2, dim, OtherNumber> &s) const + SymmetricTensor::operator*( + const SymmetricTensor<2, dim, OtherNumber> &s) const { // need to have two different function calls // because a scalar and rank-2 tensor are not @@ -1832,8 +1837,8 @@ template template DEAL_II_CONSTEXPR inline typename internal::SymmetricTensorAccessors:: double_contraction_result::type - SymmetricTensor:: - operator*(const SymmetricTensor<4, dim, OtherNumber> &s) const + SymmetricTensor::operator*( + const SymmetricTensor<4, dim, OtherNumber> &s) const { typename internal::SymmetricTensorAccessors:: double_contraction_result::type tmp; @@ -1872,9 +1877,9 @@ namespace internal template constexpr inline DEAL_II_ALWAYS_INLINE Number & - symmetric_tensor_access(const TableIndices<2> &indices, - typename SymmetricTensorAccessors:: - StorageType<2, dim, Number>::base_tensor_type &data) + symmetric_tensor_access(const TableIndices<2> &indices, + typename SymmetricTensorAccessors:: + StorageType<2, dim, Number>::base_tensor_type &data) { // 1d is very simple and done first if (dim == 1) @@ -1918,9 +1923,9 @@ namespace internal template constexpr inline DEAL_II_ALWAYS_INLINE const Number & - symmetric_tensor_access(const TableIndices<2> &indices, - const typename SymmetricTensorAccessors:: - StorageType<2, dim, Number>::base_tensor_type &data) + symmetric_tensor_access(const TableIndices<2> &indices, + const typename SymmetricTensorAccessors:: + StorageType<2, dim, Number>::base_tensor_type &data) { // 1d is very simple and done first if (dim == 1) @@ -2011,9 +2016,9 @@ namespace internal template constexpr inline DEAL_II_ALWAYS_INLINE const Number & - symmetric_tensor_access(const TableIndices<4> &indices, - const typename SymmetricTensorAccessors:: - StorageType<4, dim, Number>::base_tensor_type &data) + symmetric_tensor_access(const TableIndices<4> &indices, + const typename SymmetricTensorAccessors:: + StorageType<4, dim, Number>::base_tensor_type &data) { switch (dim) { @@ -2061,8 +2066,8 @@ namespace internal template constexpr inline DEAL_II_ALWAYS_INLINE Number & - SymmetricTensor:: - operator()(const TableIndices &indices) +SymmetricTensor::operator()( + const TableIndices &indices) { for (unsigned int r = 0; r < rank; ++r) AssertIndexRange(indices[r], dimension); @@ -2073,8 +2078,8 @@ constexpr inline DEAL_II_ALWAYS_INLINE Number & template constexpr inline DEAL_II_ALWAYS_INLINE const Number & - SymmetricTensor:: - operator()(const TableIndices &indices) const +SymmetricTensor::operator()( + const TableIndices &indices) const { for (unsigned int r = 0; r < rank; ++r) AssertIndexRange(indices[r], dimension); @@ -2113,8 +2118,7 @@ namespace internal template constexpr DEAL_II_ALWAYS_INLINE internal::SymmetricTensorAccessors:: Accessor - SymmetricTensor:: - operator[](const unsigned int row) const + SymmetricTensor::operator[](const unsigned int row) const { return internal::SymmetricTensorAccessors:: Accessor( @@ -2128,7 +2132,7 @@ constexpr DEAL_II_ALWAYS_INLINE internal::SymmetricTensorAccessors:: template constexpr inline DEAL_II_ALWAYS_INLINE internal::SymmetricTensorAccessors:: Accessor - SymmetricTensor::operator[](const unsigned int row) + SymmetricTensor::operator[](const unsigned int row) { return internal::SymmetricTensorAccessors:: Accessor( @@ -2141,8 +2145,8 @@ constexpr inline DEAL_II_ALWAYS_INLINE internal::SymmetricTensorAccessors:: template constexpr DEAL_II_ALWAYS_INLINE const Number & - SymmetricTensor:: - operator[](const TableIndices &indices) const +SymmetricTensor::operator[]( + const TableIndices &indices) const { return operator()(indices); } @@ -2151,8 +2155,8 @@ constexpr DEAL_II_ALWAYS_INLINE const Number & template constexpr inline DEAL_II_ALWAYS_INLINE Number & - SymmetricTensor:: - operator[](const TableIndices &indices) +SymmetricTensor::operator[]( + const TableIndices &indices) { return operator()(indices); } @@ -2452,8 +2456,8 @@ namespace internal // this function is for rank-2 tensors template constexpr inline DEAL_II_ALWAYS_INLINE TableIndices<2> - unrolled_to_component_indices(const unsigned int i, - const std::integral_constant &) + unrolled_to_component_indices(const unsigned int i, + const std::integral_constant &) { Assert( (i < dealii::SymmetricTensor<2, dim, double>::n_independent_components), @@ -2533,7 +2537,7 @@ namespace internal template constexpr DEAL_II_ALWAYS_INLINE TableIndices - SymmetricTensor::unrolled_to_component_indices( +SymmetricTensor::unrolled_to_component_indices( const unsigned int i) { return internal::SymmetricTensorImplementation::unrolled_to_component_indices< @@ -2690,7 +2694,7 @@ constexpr DEAL_II_ALWAYS_INLINE */ template constexpr inline DEAL_II_ALWAYS_INLINE Number - determinant(const SymmetricTensor<2, dim, Number> &t) +determinant(const SymmetricTensor<2, dim, Number> &t) { switch (dim) { @@ -2730,7 +2734,7 @@ constexpr inline DEAL_II_ALWAYS_INLINE Number */ template constexpr DEAL_II_ALWAYS_INLINE Number - third_invariant(const SymmetricTensor<2, dim, Number> &t) +third_invariant(const SymmetricTensor<2, dim, Number> &t) { return determinant(t); } @@ -2748,7 +2752,7 @@ constexpr DEAL_II_ALWAYS_INLINE Number */ template constexpr inline DEAL_II_ALWAYS_INLINE Number - trace(const SymmetricTensor<2, dim, Number> &d) +trace(const SymmetricTensor<2, dim, Number> &d) { Number t = d.data[0]; for (unsigned int i = 1; i < dim; ++i) @@ -2789,7 +2793,7 @@ first_invariant(const SymmetricTensor<2, dim, Number> &t) */ template constexpr DEAL_II_ALWAYS_INLINE Number - second_invariant(const SymmetricTensor<2, 1, Number> &) +second_invariant(const SymmetricTensor<2, 1, Number> &) { return internal::NumberType::value(0.0); } @@ -2816,7 +2820,7 @@ constexpr DEAL_II_ALWAYS_INLINE Number */ template constexpr DEAL_II_ALWAYS_INLINE Number - second_invariant(const SymmetricTensor<2, 2, Number> &t) +second_invariant(const SymmetricTensor<2, 2, Number> &t) { return t[0][0] * t[1][1] - t[0][1] * t[0][1]; } @@ -2833,7 +2837,7 @@ constexpr DEAL_II_ALWAYS_INLINE Number */ template constexpr DEAL_II_ALWAYS_INLINE Number - second_invariant(const SymmetricTensor<2, 3, Number> &t) +second_invariant(const SymmetricTensor<2, 3, Number> &t) { return (t[0][0] * t[1][1] + t[1][1] * t[2][2] + t[2][2] * t[0][0] - t[0][1] * t[0][1] - t[0][2] * t[0][2] - t[1][2] * t[1][2]); @@ -3046,7 +3050,7 @@ namespace internal */ template std::array>, dim> - jacobi(dealii::SymmetricTensor<2, dim, Number> A); + jacobi(dealii::SymmetricTensor<2, dim, Number> A); @@ -3238,7 +3242,7 @@ eigenvectors(const SymmetricTensor<2, dim, Number> &T, */ template constexpr DEAL_II_ALWAYS_INLINE SymmetricTensor - transpose(const SymmetricTensor &t) +transpose(const SymmetricTensor &t) { return t; } @@ -3257,7 +3261,7 @@ constexpr DEAL_II_ALWAYS_INLINE SymmetricTensor */ template constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number> - deviator(const SymmetricTensor<2, dim, Number> &t) +deviator(const SymmetricTensor<2, dim, Number> &t) { SymmetricTensor<2, dim, Number> tmp = t; @@ -3441,7 +3445,7 @@ outer_product(const SymmetricTensor<2, dim, Number> &t1, */ template constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number> - symmetrize(const Tensor<2, dim, Number> &t) +symmetrize(const Tensor<2, dim, Number> &t) { SymmetricTensor<2, dim, Number> result; for (unsigned int d = 0; d < dim; ++d) @@ -3465,7 +3469,7 @@ constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor<2, dim, Number> */ template constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor - operator*(const SymmetricTensor &t, const Number &factor) +operator*(const SymmetricTensor &t, const Number &factor) { SymmetricTensor tt = t; tt *= factor; @@ -3483,7 +3487,7 @@ constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor */ template constexpr DEAL_II_ALWAYS_INLINE SymmetricTensor - operator*(const Number &factor, const SymmetricTensor &t) +operator*(const Number &factor, const SymmetricTensor &t) { // simply forward to the other operator return t * factor; @@ -3591,7 +3595,7 @@ operator/(const SymmetricTensor &t, */ template constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor - operator*(const SymmetricTensor &t, const double factor) +operator*(const SymmetricTensor &t, const double factor) { SymmetricTensor tt(t); tt *= factor; @@ -3608,7 +3612,7 @@ constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor */ template constexpr inline DEAL_II_ALWAYS_INLINE SymmetricTensor - operator*(const double factor, const SymmetricTensor &t) +operator*(const double factor, const SymmetricTensor &t) { SymmetricTensor tt(t); tt *= factor; @@ -3714,7 +3718,8 @@ scalar_product(const Tensor<2, dim, Number> & t1, * @relatesalso SymmetricTensor */ template -constexpr inline DEAL_II_ALWAYS_INLINE void double_contract( +constexpr inline DEAL_II_ALWAYS_INLINE void +double_contract( SymmetricTensor<2, 1, typename ProductType::type> &tmp, const SymmetricTensor<4, 1, Number> & t, const SymmetricTensor<2, 1, OtherNumber> & s) @@ -3739,7 +3744,8 @@ constexpr inline DEAL_II_ALWAYS_INLINE void double_contract( * @relatesalso SymmetricTensor */ template -constexpr inline void double_contract( +constexpr inline void +double_contract( SymmetricTensor<2, 1, typename ProductType::type> &tmp, const SymmetricTensor<2, 1, Number> & s, const SymmetricTensor<4, 1, OtherNumber> & t) @@ -3764,7 +3770,8 @@ constexpr inline void double_contract( * @relatesalso SymmetricTensor */ template -constexpr inline void double_contract( +constexpr inline void +double_contract( SymmetricTensor<2, 2, typename ProductType::type> &tmp, const SymmetricTensor<4, 2, Number> & t, const SymmetricTensor<2, 2, OtherNumber> & s) @@ -3794,7 +3801,8 @@ constexpr inline void double_contract( * @relatesalso SymmetricTensor */ template -constexpr inline void double_contract( +constexpr inline void +double_contract( SymmetricTensor<2, 2, typename ProductType::type> &tmp, const SymmetricTensor<2, 2, Number> & s, const SymmetricTensor<4, 2, OtherNumber> & t) @@ -3824,7 +3832,8 @@ constexpr inline void double_contract( * @relatesalso SymmetricTensor */ template -constexpr inline void double_contract( +constexpr inline void +double_contract( SymmetricTensor<2, 3, typename ProductType::type> &tmp, const SymmetricTensor<4, 3, Number> & t, const SymmetricTensor<2, 3, OtherNumber> & s) @@ -3855,7 +3864,8 @@ constexpr inline void double_contract( * @relatesalso SymmetricTensor */ template -constexpr inline void double_contract( +constexpr inline void +double_contract( SymmetricTensor<2, 3, typename ProductType::type> &tmp, const SymmetricTensor<2, 3, Number> & s, const SymmetricTensor<4, 3, OtherNumber> & t) diff --git a/include/deal.II/base/symmetric_tensor.templates.h b/include/deal.II/base/symmetric_tensor.templates.h index 830e331952..51175264eb 100644 --- a/include/deal.II/base/symmetric_tensor.templates.h +++ b/include/deal.II/base/symmetric_tensor.templates.h @@ -376,7 +376,7 @@ namespace internal template std::array>, dim> - jacobi(dealii::SymmetricTensor<2, dim, Number> A) + jacobi(dealii::SymmetricTensor<2, dim, Number> A) { static_assert(numbers::NumberTraits::is_complex == false, "This implementation of the Jacobi algorithm does " diff --git a/include/deal.II/base/synchronous_iterator.h b/include/deal.II/base/synchronous_iterator.h index c5b70f4441..ef80b4f6fd 100644 --- a/include/deal.II/base/synchronous_iterator.h +++ b/include/deal.II/base/synchronous_iterator.h @@ -58,13 +58,15 @@ struct SynchronousIterators * Dereference const operator. Returns a const reference to the iterators * represented by the current class. */ - const Iterators &operator*() const; + const Iterators & + operator*() const; /** * Dereference operator. Returns a reference to the iterators * represented by the current class. */ - Iterators &operator*(); + Iterators & + operator*(); private: /** @@ -83,7 +85,8 @@ inline SynchronousIterators::SynchronousIterators(const Iterators &i) template -inline const Iterators &SynchronousIterators::operator*() const +inline const Iterators & +SynchronousIterators::operator*() const { return iterators; } @@ -91,7 +94,8 @@ inline const Iterators &SynchronousIterators::operator*() const template -inline Iterators &SynchronousIterators::operator*() +inline Iterators & +SynchronousIterators::operator*() { return iterators; } diff --git a/include/deal.II/base/table.h b/include/deal.II/base/table.h index 0590896869..0ed61dfea2 100644 --- a/include/deal.II/base/table.h +++ b/include/deal.II/base/table.h @@ -189,7 +189,8 @@ namespace internal /** * Index operator. Performs a range check. */ - Accessor operator[](const size_type i) const; + Accessor + operator[](const size_type i) const; /** * Exception for range check. Do not use global exception since this way @@ -285,7 +286,8 @@ namespace internal /** * Index operator. Performs a range check. */ - reference operator[](const size_type) const; + reference + operator[](const size_type) const; /** * Return the length of one row, i.e. the number of elements @@ -893,7 +895,8 @@ public: * Access operator. Since this is a one-dimensional object, this simply * accesses the requested data element. Returns a read-write reference. */ - typename AlignedVector::reference operator[](const size_type i); + typename AlignedVector::reference + operator[](const size_type i); /** * Access operator. Since this is a one-dimensional object, this simply @@ -2208,8 +2211,8 @@ namespace internal template - inline Accessor Accessor:: - operator[](const size_type i) const + inline Accessor + Accessor::operator[](const size_type i) const { AssertIndexRange(i, table.size()[N - P]); @@ -2251,8 +2254,8 @@ namespace internal template - inline typename Accessor::reference Accessor:: - operator[](const size_type i) const + inline typename Accessor::reference + Accessor::operator[](const size_type i) const { AssertIndexRange(i, table.size()[N - 1]); return *(data + i); @@ -2635,8 +2638,8 @@ inline Table<1, T>::Table(const size_type size, template -inline typename AlignedVector::const_reference Table<1, T>:: - operator[](const size_type i) const +inline typename AlignedVector::const_reference +Table<1, T>::operator[](const size_type i) const { AssertIndexRange(i, this->table_size[0]); return this->values[i]; @@ -2645,8 +2648,8 @@ inline typename AlignedVector::const_reference Table<1, T>:: template -inline typename AlignedVector::reference Table<1, T>:: - operator[](const size_type i) +inline typename AlignedVector::reference +Table<1, T>::operator[](const size_type i) { AssertIndexRange(i, this->table_size[0]); return this->values[i]; @@ -2709,7 +2712,7 @@ Table<2, T>::reinit(const size_type size1, template inline dealii::internal::TableBaseAccessors::Accessor<2, T, true, 1> - Table<2, T>::operator[](const size_type i) const +Table<2, T>::operator[](const size_type i) const { AssertIndexRange(i, this->table_size[0]); return dealii::internal::TableBaseAccessors::Accessor<2, T, true, 1>( @@ -2720,7 +2723,7 @@ inline dealii::internal::TableBaseAccessors::Accessor<2, T, true, 1> template inline dealii::internal::TableBaseAccessors::Accessor<2, T, false, 1> - Table<2, T>::operator[](const size_type i) +Table<2, T>::operator[](const size_type i) { AssertIndexRange(i, this->table_size[0]); return dealii::internal::TableBaseAccessors::Accessor<2, T, false, 1>( @@ -3222,7 +3225,7 @@ inline Table<3, T>::Table(const size_type size1, template inline dealii::internal::TableBaseAccessors::Accessor<3, T, true, 2> - Table<3, T>::operator[](const size_type i) const +Table<3, T>::operator[](const size_type i) const { AssertIndexRange(i, this->table_size[0]); const size_type subobject_size = @@ -3235,7 +3238,7 @@ inline dealii::internal::TableBaseAccessors::Accessor<3, T, true, 2> template inline dealii::internal::TableBaseAccessors::Accessor<3, T, false, 2> - Table<3, T>::operator[](const size_type i) +Table<3, T>::operator[](const size_type i) { AssertIndexRange(i, this->table_size[0]); const size_type subobject_size = @@ -3248,8 +3251,9 @@ inline dealii::internal::TableBaseAccessors::Accessor<3, T, false, 2> template inline typename AlignedVector::const_reference -Table<3, T>:: -operator()(const size_type i, const size_type j, const size_type k) const +Table<3, T>::operator()(const size_type i, + const size_type j, + const size_type k) const { AssertIndexRange(i, this->table_size[0]); AssertIndexRange(j, this->table_size[1]); @@ -3287,7 +3291,7 @@ inline Table<4, T>::Table(const size_type size1, template inline dealii::internal::TableBaseAccessors::Accessor<4, T, true, 3> - Table<4, T>::operator[](const size_type i) const +Table<4, T>::operator[](const size_type i) const { AssertIndexRange(i, this->table_size[0]); const size_type subobject_size = @@ -3300,7 +3304,7 @@ inline dealii::internal::TableBaseAccessors::Accessor<4, T, true, 3> template inline dealii::internal::TableBaseAccessors::Accessor<4, T, false, 3> - Table<4, T>::operator[](const size_type i) +Table<4, T>::operator[](const size_type i) { AssertIndexRange(i, this->table_size[0]); const size_type subobject_size = @@ -3364,7 +3368,7 @@ inline Table<5, T>::Table(const size_type size1, template inline dealii::internal::TableBaseAccessors::Accessor<5, T, true, 4> - Table<5, T>::operator[](const size_type i) const +Table<5, T>::operator[](const size_type i) const { AssertIndexRange(i, this->table_size[0]); const size_type subobject_size = size_type(this->table_size[1]) * @@ -3378,7 +3382,7 @@ inline dealii::internal::TableBaseAccessors::Accessor<5, T, true, 4> template inline dealii::internal::TableBaseAccessors::Accessor<5, T, false, 4> - Table<5, T>::operator[](const size_type i) +Table<5, T>::operator[](const size_type i) { AssertIndexRange(i, this->table_size[0]); const size_type subobject_size = size_type(this->table_size[1]) * @@ -3462,7 +3466,7 @@ inline Table<6, T>::Table(const size_type size1, template inline dealii::internal::TableBaseAccessors::Accessor<6, T, true, 5> - Table<6, T>::operator[](const size_type i) const +Table<6, T>::operator[](const size_type i) const { AssertIndexRange(i, this->table_size[0]); const size_type subobject_size = size_type(this->table_size[1]) * @@ -3476,7 +3480,7 @@ inline dealii::internal::TableBaseAccessors::Accessor<6, T, true, 5> template inline dealii::internal::TableBaseAccessors::Accessor<6, T, false, 5> - Table<6, T>::operator[](const size_type i) +Table<6, T>::operator[](const size_type i) { AssertIndexRange(i, this->table_size[0]); const size_type subobject_size = size_type(this->table_size[1]) * @@ -3570,7 +3574,7 @@ inline Table<7, T>::Table(const size_type size1, template inline dealii::internal::TableBaseAccessors::Accessor<7, T, true, 6> - Table<7, T>::operator[](const size_type i) const +Table<7, T>::operator[](const size_type i) const { AssertIndexRange(i, this->table_size[0]); const size_type subobject_size = @@ -3584,7 +3588,7 @@ inline dealii::internal::TableBaseAccessors::Accessor<7, T, true, 6> template inline dealii::internal::TableBaseAccessors::Accessor<7, T, false, 6> - Table<7, T>::operator[](const size_type i) +Table<7, T>::operator[](const size_type i) { AssertIndexRange(i, this->table_size[0]); const size_type subobject_size = diff --git a/include/deal.II/base/table_indices.h b/include/deal.II/base/table_indices.h index f60a3dd4ff..435063080a 100644 --- a/include/deal.II/base/table_indices.h +++ b/include/deal.II/base/table_indices.h @@ -66,12 +66,14 @@ public: /** * Read-only access the value of the ith index. */ - constexpr std::size_t operator[](const unsigned int i) const; + constexpr std::size_t + operator[](const unsigned int i) const; /** * Write access the value of the ith index. */ - constexpr std::size_t &operator[](const unsigned int i); + constexpr std::size_t & + operator[](const unsigned int i); /** * Compare two index fields for equality. @@ -125,8 +127,8 @@ constexpr TableIndices::TableIndices(const T... args) template -constexpr inline std::size_t TableIndices:: - operator[](const unsigned int i) const +constexpr inline std::size_t +TableIndices::operator[](const unsigned int i) const { AssertIndexRange(i, N); return indices[i]; @@ -134,7 +136,8 @@ constexpr inline std::size_t TableIndices:: template -constexpr inline std::size_t &TableIndices::operator[](const unsigned int i) +constexpr inline std::size_t & +TableIndices::operator[](const unsigned int i) { AssertIndexRange(i, N); return indices[i]; diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index 89c4a04df3..a6617dd6a9 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -177,7 +177,7 @@ public: * Move constructor */ constexpr DEAL_II_CUDA_HOST_DEV - Tensor(Tensor<0, dim, Number> &&other) noexcept; + Tensor(Tensor<0, dim, Number> &&other) noexcept; #endif /** @@ -214,7 +214,8 @@ public: * * @note This function can also be used in CUDA device code. */ - constexpr DEAL_II_CUDA_HOST_DEV operator Number &(); + constexpr DEAL_II_CUDA_HOST_DEV + operator Number &(); /** * Return a reference to the encapsulated Number object. Since rank-0 @@ -235,7 +236,7 @@ public: */ template constexpr DEAL_II_CUDA_HOST_DEV Tensor & - operator=(const Tensor<0, dim, OtherNumber> &rhs); + operator=(const Tensor<0, dim, OtherNumber> &rhs); #if defined(__INTEL_COMPILER) || defined(DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG) /** @@ -255,7 +256,7 @@ public: * Move assignment operator */ constexpr DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number> & - operator=(Tensor<0, dim, Number> &&other) noexcept; + operator=(Tensor<0, dim, Number> &&other) noexcept; #endif /** @@ -289,7 +290,7 @@ public: */ template constexpr DEAL_II_CUDA_HOST_DEV Tensor & - operator+=(const Tensor<0, dim, OtherNumber> &rhs); + operator+=(const Tensor<0, dim, OtherNumber> &rhs); /** * Subtract another scalar. @@ -298,7 +299,7 @@ public: */ template constexpr DEAL_II_CUDA_HOST_DEV Tensor & - operator-=(const Tensor<0, dim, OtherNumber> &rhs); + operator-=(const Tensor<0, dim, OtherNumber> &rhs); /** * Multiply the scalar with a factor. @@ -324,7 +325,7 @@ public: * @note This function can also be used in CUDA device code. */ constexpr DEAL_II_CUDA_HOST_DEV Tensor - operator-() const; + operator-() const; /** * Reset all values to zero. @@ -356,7 +357,7 @@ public: * @note This function can also be used in CUDA device code. */ constexpr DEAL_II_CUDA_HOST_DEV real_type - norm_square() const; + norm_square() const; /** * Read or write the data of this object to or from a stream for the purpose @@ -517,7 +518,7 @@ public: * @note This function can also be used in CUDA device code. */ constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV - Tensor(); + Tensor(); /** * A constructor where the data is copied from a C-style array. @@ -586,7 +587,8 @@ public: * * @note This function can also be used in CUDA device code. */ - constexpr DEAL_II_CUDA_HOST_DEV value_type &operator[](const unsigned int i); + constexpr DEAL_II_CUDA_HOST_DEV value_type & + operator[](const unsigned int i); /** * Read-only access operator. @@ -599,12 +601,14 @@ public: /** * Read access using TableIndices indices */ - constexpr const Number &operator[](const TableIndices &indices) const; + constexpr const Number & + operator[](const TableIndices &indices) const; /** * Read and write access using TableIndices indices */ - constexpr Number &operator[](const TableIndices &indices); + constexpr Number & + operator[](const TableIndices &indices); /** * Return a pointer to the first element of the underlying storage. @@ -639,7 +643,7 @@ public: */ template constexpr DEAL_II_CUDA_HOST_DEV Tensor & - operator=(const Tensor &rhs); + operator=(const Tensor &rhs); /** * This operator assigns a scalar to a tensor. To avoid confusion with what @@ -685,7 +689,7 @@ public: */ template constexpr DEAL_II_CUDA_HOST_DEV Tensor & - operator+=(const Tensor &); + operator+=(const Tensor &); /** * Subtract another tensor. @@ -694,7 +698,7 @@ public: */ template constexpr DEAL_II_CUDA_HOST_DEV Tensor & - operator-=(const Tensor &); + operator-=(const Tensor &); /** * Scale the tensor by factor, i.e. multiply all components by @@ -721,7 +725,7 @@ public: * @note This function can also be used in CUDA device code. */ constexpr DEAL_II_CUDA_HOST_DEV Tensor - operator-() const; + operator-() const; /** * Reset all values to zero. @@ -887,7 +891,7 @@ namespace internal struct NumberType> { static constexpr DEAL_II_ALWAYS_INLINE const Tensor & - value(const Tensor &t) + value(const Tensor &t) { return t; } @@ -908,7 +912,7 @@ namespace internal template constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV - Tensor<0, dim, Number>::Tensor() +Tensor<0, dim, Number>::Tensor() // Some auto-differentiable numbers need explicit // zero initialization such as adtl::adouble. : Tensor{0.0} @@ -919,7 +923,7 @@ constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV template template constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV - Tensor<0, dim, Number>::Tensor(const OtherNumber &initializer) +Tensor<0, dim, Number>::Tensor(const OtherNumber &initializer) : value(internal::NumberType::value(initializer)) {} @@ -928,7 +932,7 @@ constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV template template constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV - Tensor<0, dim, Number>::Tensor(const Tensor<0, dim, OtherNumber> &p) +Tensor<0, dim, Number>::Tensor(const Tensor<0, dim, OtherNumber> &p) : Tensor{p.value} {} @@ -936,7 +940,7 @@ constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV # ifdef DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG template constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV - Tensor<0, dim, Number>::Tensor(const Tensor<0, dim, Number> &other) +Tensor<0, dim, Number>::Tensor(const Tensor<0, dim, Number> &other) : value{other.value} {} @@ -944,7 +948,7 @@ constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV template constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV - Tensor<0, dim, Number>::Tensor(Tensor<0, dim, Number> &&other) noexcept +Tensor<0, dim, Number>::Tensor(Tensor<0, dim, Number> &&other) noexcept : value{std::move(other.value)} {} # endif @@ -987,8 +991,8 @@ Tensor<0, dim, Number>::end_raw() const template -constexpr inline DEAL_II_ALWAYS_INLINE - DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number>::operator Number &() +constexpr inline DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV +Tensor<0, dim, Number>::operator Number &() { // We cannot use Assert inside a CUDA kernel # ifndef __CUDA_ARCH__ @@ -1037,7 +1041,7 @@ constexpr inline DEAL_II_ALWAYS_INLINE # ifdef DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG template constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV Tensor<0, dim, Number> & - Tensor<0, dim, Number>::operator=(Tensor<0, dim, Number> &&other) noexcept +Tensor<0, dim, Number>::operator=(Tensor<0, dim, Number> &&other) noexcept { value = std::move(other.value); return *this; @@ -1112,7 +1116,7 @@ namespace internal { template constexpr inline DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV void - multiply_assign_scalar(Number &val, const OtherNumber &s) + multiply_assign_scalar(Number &val, const OtherNumber &s) { val *= s; } @@ -1120,7 +1124,7 @@ namespace internal # ifdef __CUDA_ARCH__ template constexpr inline DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV void - multiply_assign_scalar(std::complex &, const OtherNumber &) + multiply_assign_scalar(std::complex &, const OtherNumber &) { printf("This function is not implemented for std::complex!\n"); assert(false); @@ -1225,7 +1229,7 @@ constexpr unsigned int Tensor<0, dim, Number>::n_independent_components; template template constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV - Tensor::Tensor(const ArrayLike &initializer, +Tensor::Tensor(const ArrayLike &initializer, std::index_sequence) : values{Tensor(initializer[indices])...} { @@ -1237,7 +1241,7 @@ constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV template constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV - Tensor::Tensor() +Tensor::Tensor() // We would like to use =default, but this causes compile errors with some // MSVC versions and internal compiler errors with -O1 in gcc 5.4. : values{} @@ -1247,7 +1251,7 @@ constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV template constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV - Tensor::Tensor(const array_type &initializer) +Tensor::Tensor(const array_type &initializer) : Tensor(initializer, std::make_index_sequence{}) {} @@ -1256,7 +1260,7 @@ constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV template template constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV - Tensor::Tensor( +Tensor::Tensor( const ArrayView &initializer) { AssertDimension(initializer.size(), n_independent_components); @@ -1270,7 +1274,7 @@ constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV template template constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV - Tensor::Tensor( +Tensor::Tensor( const Tensor &initializer) : Tensor(initializer, std::make_index_sequence{}) {} @@ -1290,7 +1294,7 @@ Tensor::Tensor( template template constexpr DEAL_II_ALWAYS_INLINE Tensor:: - operator Tensor<1, dim, Tensor>() const +operator Tensor<1, dim, Tensor>() const { return Tensor<1, dim, Tensor>(values); } @@ -1370,9 +1374,9 @@ namespace internal template -constexpr inline DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV - typename Tensor::value_type &Tensor:: - operator[](const unsigned int i) +constexpr inline DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV + typename Tensor::value_type & + Tensor::operator[](const unsigned int i) { return dealii::internal::TensorSubscriptor::subscript( values, i, std::integral_constant()); @@ -1381,8 +1385,8 @@ constexpr inline DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV template constexpr DEAL_II_ALWAYS_INLINE - DEAL_II_CUDA_HOST_DEV const typename Tensor::value_type & - Tensor::operator[](const unsigned int i) const + DEAL_II_CUDA_HOST_DEV const typename Tensor::value_type & + Tensor::operator[](const unsigned int i) const { # ifndef DEAL_II_COMPILER_CUDA_AWARE AssertIndexRange(i, dim); @@ -1394,8 +1398,7 @@ constexpr DEAL_II_ALWAYS_INLINE template constexpr inline DEAL_II_ALWAYS_INLINE const Number & - Tensor:: - operator[](const TableIndices &indices) const +Tensor::operator[](const TableIndices &indices) const { # ifndef DEAL_II_COMPILER_CUDA_AWARE Assert(dim != 0, @@ -1408,8 +1411,8 @@ constexpr inline DEAL_II_ALWAYS_INLINE const Number & template -constexpr inline DEAL_II_ALWAYS_INLINE Number &Tensor:: - operator[](const TableIndices &indices) +constexpr inline DEAL_II_ALWAYS_INLINE Number & +Tensor::operator[](const TableIndices &indices) { # ifndef DEAL_II_COMPILER_CUDA_AWARE Assert(dim != 0, @@ -1500,8 +1503,8 @@ Tensor::operator=(const Tensor &other) template constexpr DEAL_II_ALWAYS_INLINE Tensor & - Tensor:: - operator=(Tensor &&other) noexcept +Tensor::operator=( + Tensor &&other) noexcept { for (unsigned int i = 0; i < dim; ++i) values[i] = other.values[i]; @@ -1513,8 +1516,8 @@ constexpr DEAL_II_ALWAYS_INLINE Tensor & template template constexpr inline bool -Tensor:: -operator==(const Tensor &p) const +Tensor::operator==( + const Tensor &p) const { for (unsigned int i = 0; i < dim; ++i) if (values[i] != p.values[i]) @@ -1540,8 +1543,8 @@ Tensor<1, 0, double>::operator==(const Tensor<1, 0, double> &) const template template constexpr bool -Tensor:: -operator!=(const Tensor &p) const +Tensor::operator!=( + const Tensor &p) const { return !((*this) == p); } @@ -1551,8 +1554,8 @@ template template constexpr inline DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV Tensor & - Tensor:: - operator+=(const Tensor &p) + Tensor::operator+=( + const Tensor &p) { for (unsigned int i = 0; i < dim; ++i) values[i] += p.values[i]; @@ -1564,8 +1567,8 @@ template template constexpr inline DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV Tensor & - Tensor:: - operator-=(const Tensor &p) + Tensor::operator-=( + const Tensor &p) { for (unsigned int i = 0; i < dim; ++i) values[i] -= p.values[i]; @@ -1945,8 +1948,8 @@ DEAL_II_CUDA_HOST_DEV constexpr DEAL_II_ALWAYS_INLINE */ template constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV - Tensor<0, dim, typename ProductType::type> - operator+(const Tensor<0, dim, Number> & p, + Tensor<0, dim, typename ProductType::type> + operator+(const Tensor<0, dim, Number> & p, const Tensor<0, dim, OtherNumber> &q) { return static_cast(p) + static_cast(q); @@ -1962,8 +1965,8 @@ constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV */ template constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV - Tensor<0, dim, typename ProductType::type> - operator-(const Tensor<0, dim, Number> & p, + Tensor<0, dim, typename ProductType::type> + operator-(const Tensor<0, dim, Number> & p, const Tensor<0, dim, OtherNumber> &q) { return static_cast(p) - static_cast(q); @@ -2466,8 +2469,10 @@ constexpr inline DEAL_II_ALWAYS_INLINE * @relatesalso Tensor */ template