From: Matthias Maier Date: Tue, 18 May 2021 16:22:52 +0000 (-0500) Subject: reindent code X-Git-Tag: v9.3.0-rc1~37^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12239%2Fhead;p=dealii.git reindent code --- diff --git a/examples/step-66/doc/intro.dox b/examples/step-66/doc/intro.dox index ba79026a23..01718b44d8 100644 --- a/examples/step-66/doc/intro.dox +++ b/examples/step-66/doc/intro.dox @@ -103,12 +103,12 @@ identified with a vector $U\in\mathbb{R}^N$ via the representation formula: $u_h = \sum_{i=1}^N U_i \varphi_i$. So using this we can give an expression for the discrete Jacobian and the residual: @f{align*}{ - A_{i,j} = \bigl( F'(u_h^n) \bigr)_{i,j} + A_{i,j} = \bigl( F'(u_h^n) \bigr)_{i,j} &= \int_\Omega \nabla\varphi_i \cdot \nabla \varphi_j \,\mathrm{d} x - \int_\Omega \varphi_i \, \exp( u_h ) \varphi_j \,\mathrm{d} x,\\ - b_{i} = \bigl( F(u_h^n) \bigr)_{i} + b_{i} = \bigl( F(u_h^n) \bigr)_{i} &= \int_\Omega \nabla\varphi_i \cdot \nabla u_h^n \,\mathrm{d} x - @@ -156,12 +156,12 @@ GelfandProblem::assemble_system() { cell_matrix = 0.0; cell_rhs = 0.0; - + fe_values.reinit(cell); - + fe_values.get_function_values(solution, newton_step_values); fe_values.get_function_gradients(solution, newton_step_gradients); - + for(unsigned int q=0; q::assemble_system() { const double phi_j = fe_values.shape_value(j,q); const Tensor<1,dim> grad_phi_j = fe_values.shape_grad(j,q); - + cell_matrix(i,j) += ( grad_phi_i*grad_phi_j - phi_i*nonlinearity*phi_j ) * dx; } - + cell_rhs(i) += ( -grad_phi_i*newton_step_gradients[q] + phi_i*newton_step_values[q] ) * dx; - + } } - + cell->get_dof_indices(local_dof_indices); - + constraints.distribute_local_to_global(cell_matrix, cell_rhs, local_dof_indices, system_matrix, system_rhs); - + } - + } @endcode @@ -210,22 +210,22 @@ void GelfandProblem::compute_update() { solution.update_ghost_values(); - + system_matrix.evaluate_newton_step(solution); - + MGTransferMatrixFree mg_transfer(mg_constrained_dofs); - + mg_transfer.interpolate_to_mg(dof_handler, mg_solution, solution); - + // Set up options for the multilevel preconditioner for(unsigned int level=0; level::evaluate_newton_step(const LinearAlgebra { const unsigned int n_cells = this->data->n_cell_batches(); FEEvaluation phi(*this->data); - + nonlinear_values.reinit(n_cells, phi.n_q_points); - + for(unsigned int cell=0; cell &newton_step); - virtual void - compute_diagonal() override; + virtual void compute_diagonal() override; private: - virtual void - apply_add( + virtual void apply_add( LinearAlgebra::distributed::Vector & dst, const LinearAlgebra::distributed::Vector &src) const override; @@ -147,8 +143,7 @@ namespace Step66 const LinearAlgebra::distributed::Vector &src, const std::pair &cell_range) const; - void - local_compute_diagonal(FECellIntegrator &integrator) const; + void local_compute_diagonal(FECellIntegrator &integrator) const; Table<2, VectorizedArray> nonlinear_values; }; @@ -170,8 +165,7 @@ namespace Step66 // the nonlinearity and call the clear() function of the base // class. template - void - JacobianOperator::clear() + void JacobianOperator::clear() { nonlinear_values.reinit(0, 0); MatrixFreeOperators::Base>:: @@ -200,8 +194,7 @@ namespace Step66 // This skips all evaluations of the nonlinearity in each call of the // vmult() function. template - void - JacobianOperator::evaluate_newton_step( + void JacobianOperator::evaluate_newton_step( const LinearAlgebra::distributed::Vector &newton_step) { const unsigned int n_cells = this->data->n_cell_batches(); @@ -236,8 +229,7 @@ namespace Step66 // to perform the cell integration and distribute the local contributions into // the global vector dst. template - void - JacobianOperator::local_apply( + void JacobianOperator::local_apply( const MatrixFree & data, LinearAlgebra::distributed::Vector & dst, const LinearAlgebra::distributed::Vector &src, @@ -275,8 +267,7 @@ namespace Step66 // Next we use MatrixFree::cell_loop() to perform the actual loop over all // cells computing the cell contribution to the matrix-vector product. template - void - JacobianOperator::apply_add( + void JacobianOperator::apply_add( LinearAlgebra::distributed::Vector & dst, const LinearAlgebra::distributed::Vector &src) const { @@ -293,8 +284,7 @@ namespace Step66 // values from a input vector or distribute any local results to an output // vector. Instead the only input argument is the used FEEvaluation object. template - void - JacobianOperator::local_compute_diagonal( + void JacobianOperator::local_compute_diagonal( FECellIntegrator &phi) const { AssertDimension(nonlinear_values.size(0), @@ -329,8 +319,7 @@ namespace Step66 // diagonal and invert the elements by hand. Note, that during this loop we // catch the constrained DOFs and set them manually to one. template - void - JacobianOperator::compute_diagonal() + void JacobianOperator::compute_diagonal() { this->inverse_diagonal_entries.reset( new DiagonalMatrix>()); @@ -378,45 +367,34 @@ namespace Step66 public: GelfandProblem(); - void - run(); + void run(); private: - void - make_grid(); + void make_grid(); - void - setup_system(); + void setup_system(); - void - evaluate_residual( + void evaluate_residual( LinearAlgebra::distributed::Vector & dst, const LinearAlgebra::distributed::Vector &src) const; - void - local_evaluate_residual( + void local_evaluate_residual( const MatrixFree & data, LinearAlgebra::distributed::Vector & dst, const LinearAlgebra::distributed::Vector &src, const std::pair & cell_range) const; - void - assemble_rhs(); + void assemble_rhs(); - double - compute_residual(const double alpha); + double compute_residual(const double alpha); - void - compute_update(); + void compute_update(); - void - solve(); + void solve(); - double - compute_solution_norm() const; + double compute_solution_norm() const; - void - output_results(const unsigned int cycle) const; + void output_results(const unsigned int cycle) const; // For the parallel computation we define a @@ -523,8 +501,7 @@ namespace Step66 // class and also assign a SphericalManifold for the boundary. Finally, we // refine the initial mesh 3 - dim times globally. template - void - GelfandProblem::make_grid() + void GelfandProblem::make_grid() { TimerOutput::Scope t(computing_timer, "make grid"); @@ -560,8 +537,7 @@ namespace Step66 // Note how we can use the same MatrixFree object twice, for the // JacobianOperator and the multigrid preconditioner. template - void - GelfandProblem::setup_system() + void GelfandProblem::setup_system() { TimerOutput::Scope t(computing_timer, "setup system"); @@ -678,8 +654,7 @@ namespace Step66 // related data exchange, since all the bookkeeping is done by the // MatrixFree::cell_loop(). template - void - GelfandProblem::evaluate_residual( + void GelfandProblem::evaluate_residual( LinearAlgebra::distributed::Vector & dst, const LinearAlgebra::distributed::Vector &src) const { @@ -703,8 +678,7 @@ namespace Step66 // FEEvaluation::read_dof_values_plain() and FEEvaluation::evaluate(), since // the input vector might have constrained DOFs. template - void - GelfandProblem::local_evaluate_residual( + void GelfandProblem::local_evaluate_residual( const MatrixFree & data, LinearAlgebra::distributed::Vector & dst, const LinearAlgebra::distributed::Vector &src, @@ -744,8 +718,7 @@ namespace Step66 // Experiences show that using the FEEvaluation class is much faster than a // classical implementation with FEValues and co. template - void - GelfandProblem::assemble_rhs() + void GelfandProblem::assemble_rhs() { TimerOutput::Scope t(computing_timer, "assemble right hand side"); @@ -772,8 +745,7 @@ namespace Step66 // use a damped version $\alpha<1$ until the Newton step is good enough and // the full Newton step can be performed. This was also discussed in step-15. template - double - GelfandProblem::compute_residual(const double alpha) + double GelfandProblem::compute_residual(const double alpha) { TimerOutput::Scope t(computing_timer, "compute residual"); @@ -803,8 +775,7 @@ namespace Step66 // preconditioner. For this we first set up the PreconditionMG object with a // Chebyshev smoother like we did in step-37. template - void - GelfandProblem::compute_update() + void GelfandProblem::compute_update() { TimerOutput::Scope t(computing_timer, "compute update"); @@ -917,8 +888,7 @@ namespace Step66 // Now we implement the actual Newton solver for the nonlinear problem. template - void - GelfandProblem::solve() + void GelfandProblem::solve() { TimerOutput::Scope t(computing_timer, "solve"); @@ -1003,8 +973,7 @@ namespace Step66 // VectorTools::integrate_difference(). In the end we gather all computations // from all MPI ranks and return the norm. template - double - GelfandProblem::compute_solution_norm() const + double GelfandProblem::compute_solution_norm() const { solution.update_ghost_values(); @@ -1090,8 +1059,7 @@ namespace Step66 // about the system specifications and the finite element space we use. The // problem is solved several times on a successively refined mesh. template - void - GelfandProblem::run() + void GelfandProblem::run() { { const unsigned int n_ranks = @@ -1194,8 +1162,7 @@ namespace Step66 // create an object of the GelfandProblem class and call the run // function. Exemplarily we solve the problem once in 2D and once in 3D each // with fourth-order Lagrangian finite elements. -int -main(int argc, char *argv[]) +int main(int argc, char *argv[]) { try { diff --git a/include/deal.II/multigrid/mg_transfer_matrix_free.h b/include/deal.II/multigrid/mg_transfer_matrix_free.h index c256067513..5d6324be13 100644 --- a/include/deal.II/multigrid/mg_transfer_matrix_free.h +++ b/include/deal.II/multigrid/mg_transfer_matrix_free.h @@ -166,7 +166,7 @@ public: * * If an inner vector of @p dst is empty or has incorrect locally owned size, * it will be resized to locally relevant degrees of freedom on each level. - * + * * The use of this function is demonstrated in step-66. */ template