From 10229b5a4217dc0517a3279f1313ce30e31f71c7 Mon Sep 17 00:00:00 2001
From: Patrick Jaap <patrick.jaap@tu-dresden.de>
Date: Thu, 1 Sep 2022 15:50:13 +0200
Subject: [PATCH] Include codespell package to check spelling errors in CI

All existing errors are now fixed.
---
 .gitlab-ci.yml                                         | 10 ++++++++++
 doc/LOWRANKBRANCH-BACKPORT-CHANGES                     |  2 +-
 dune/solvers/common/genericvectortools.hh              |  6 +++---
 dune/solvers/common/numproc.hh                         |  2 +-
 dune/solvers/common/permutationmanager.hh              |  8 ++++----
 dune/solvers/iterationsteps/linegsstep.cc              |  2 +-
 .../minimalpolynomialextrapolationstep.hh              |  2 +-
 dune/solvers/iterationsteps/obstacletnnmgstep.hh       |  4 ++--
 dune/solvers/iterationsteps/projectedlinegsstep.cc     |  2 +-
 dune/solvers/solvers/linearipopt.hh                    |  4 ++--
 dune/solvers/solvers/quadraticipopt.hh                 |  2 +-
 dune/solvers/solvers/trustregionsolver.hh              |  4 ++--
 dune/solvers/test/common.hh                            |  4 ++--
 dune/solvers/test/obstacletnnmgtest.cc                 |  2 +-
 14 files changed, 32 insertions(+), 22 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4575e8d..da3e8be 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -14,3 +14,13 @@ dune:git  gcc-9  C++20:
 dune:git  gcc-8  C++17:
   image: registry.dune-project.org/docker/ci/dune:git-debian-10-gcc-8-17
   script: duneci-standard-test
+
+
+# Check for spelling mistakes in text
+code-spelling-check:
+  stage: .pre
+  # Avoid the global 'before_script'
+  before_script: ""
+  image: registry.dune-project.org/docker/ci/debian:11
+  script:
+  - codespell
diff --git a/doc/LOWRANKBRANCH-BACKPORT-CHANGES b/doc/LOWRANKBRANCH-BACKPORT-CHANGES
index 6f00242..7f1f6a3 100644
--- a/doc/LOWRANKBRANCH-BACKPORT-CHANGES
+++ b/doc/LOWRANKBRANCH-BACKPORT-CHANGES
@@ -21,7 +21,7 @@ CHANGES REQUIRING CODE ADAPTATION
 ---------------------------------------------------------------------------------------
 
 
-CHANGES POSSIBLY AFFECTING PERFOMANCE (INCLUDING BUGFIXES)
+CHANGES POSSIBLY AFFECTING PERFORMANCE (INCLUDING BUGFIXES)
 ----------------------------------------------------------
 ----------------------------------------------------------
 
diff --git a/dune/solvers/common/genericvectortools.hh b/dune/solvers/common/genericvectortools.hh
index 18ce4af..f62d7a3 100644
--- a/dune/solvers/common/genericvectortools.hh
+++ b/dune/solvers/common/genericvectortools.hh
@@ -48,7 +48,7 @@ struct GenericVector
         Dune::MatrixVector::Generic::readBinary(s, v);
     }
 
-    //! Resize vector recursivly to size of given vector/matrix
+    //! Resize vector recursively to size of given vector/matrix
     template <class VectorTypeA, class VectorTypeB>
     [[deprecated("Please use Dune::MatrixVector::resize instead.")]]
     static void resize(VectorTypeA& a, const VectorTypeB& b)
@@ -56,7 +56,7 @@ struct GenericVector
         Dune::MatrixVector::resize(a, b);
     }
 
-    //! Set vector to zero at indices that are true in bitvector recursivly
+    //! Set vector to zero at indices that are true in bitvector recursively
     template <class VectorType, class BitVectorType>
     [[deprecated("Please use Dune::MatrixVector::Generic::truncate instead.")]]
     static void truncate(VectorType& v, const BitVectorType& tr)
@@ -183,7 +183,7 @@ struct GenericVector
 struct GenericMatrix
 {
 
-    //! Set matrix to zero at indices that are true in bitvector recursivly
+    //! Set matrix to zero at indices that are true in bitvector recursively
     template <class MatrixType, class BitVectorTypeR, class BitVectorTypeC>
     static void truncate(MatrixType& mat, const BitVectorTypeR& trows, const BitVectorTypeC& tcols, bool setTruncatedDiagonalOne)
     {
diff --git a/dune/solvers/common/numproc.hh b/dune/solvers/common/numproc.hh
index 94ea58b..11385d7 100644
--- a/dune/solvers/common/numproc.hh
+++ b/dune/solvers/common/numproc.hh
@@ -16,7 +16,7 @@ public:
   /** \brief Different levels of verbosity */
   enum VerbosityMode {QUIET, REDUCED, FULL};
 
-  /** \brief Constructor, per defaut uses FULL. */
+  /** \brief Constructor, per default uses FULL. */
   NumProc(VerbosityMode verbosity = FULL)
     : verbosity_(verbosity)
   {}
diff --git a/dune/solvers/common/permutationmanager.hh b/dune/solvers/common/permutationmanager.hh
index df4d92d..624fb12 100644
--- a/dune/solvers/common/permutationmanager.hh
+++ b/dune/solvers/common/permutationmanager.hh
@@ -15,7 +15,7 @@
 //! Idea of implementation: define an ordering for the nodes (with respect to the axis of anisotropy)
 //! and then use a merge sort algorithm to renumerate the nodes along the lines which are parallel to this axis.
 //! to do so, we introduce a 'NodeList' class.
-//! everything is handeled by the PermutationManager
+//! everything is handled by the PermutationManager
 
 
 // type of nodes:
@@ -151,7 +151,7 @@ public:
 
 
 
-// the information about the axis of anisotropy is in NodeList, since this list contains a methode "less_equal", which describes the ordering of the nodes.
+// the information about the axis of anisotropy is in NodeList, since this list contains a method "less_equal", which describes the ordering of the nodes.
 // this ordering depends on the axis of anisotropy
 template< class GridViewImp >
 class PermutationManager{
@@ -430,9 +430,9 @@ public:
 
       for( int i = 0; i < node_list_.size(); ++i )
        {
-	 std::cout << "Original node[" << get_inverse_permuted_index( i ) << "] = (" << node_list_[i].get_global_coordinate() << ") recieved permuted index " << i << std::endl;
+	 std::cout << "Original node[" << get_inverse_permuted_index( i ) << "] = (" << node_list_[i].get_global_coordinate() << ") received permuted index " << i << std::endl;
          // alternative:
-	 //std::cout << "Original node[" << get_inverse_permuted_index( i ) << "] = (" << original_node_list_[get_inverse_permuted_index( i )].get_global_coordinate() << ") recieved permuted index " << i << std::endl;
+	 //std::cout << "Original node[" << get_inverse_permuted_index( i ) << "] = (" << original_node_list_[get_inverse_permuted_index( i )].get_global_coordinate() << ") received permuted index " << i << std::endl;
        }
 
 #if 0
diff --git a/dune/solvers/iterationsteps/linegsstep.cc b/dune/solvers/iterationsteps/linegsstep.cc
index 3beca0d..226818a 100755
--- a/dune/solvers/iterationsteps/linegsstep.cc
+++ b/dune/solvers/iterationsteps/linegsstep.cc
@@ -23,7 +23,7 @@ void LineGSStep<MatrixType, DiscFuncType, BitVectorType >::iterate()
 
         const int current_block_size = blockStructure_[b_num].size();
 
-        //! compute and save the residuals for the curent block:
+        //! compute and save the residuals for the current block:
         // determine the (permuted) residuals r[p(i)],..., r[p(i+current_block_size-1)]
         // this means that we determine the residuals for the current block
         DiscFuncType permuted_r_i(current_block_size);
diff --git a/dune/solvers/iterationsteps/minimalpolynomialextrapolationstep.hh b/dune/solvers/iterationsteps/minimalpolynomialextrapolationstep.hh
index c1b7ffd..ab79c6c 100644
--- a/dune/solvers/iterationsteps/minimalpolynomialextrapolationstep.hh
+++ b/dune/solvers/iterationsteps/minimalpolynomialextrapolationstep.hh
@@ -44,7 +44,7 @@ public:
     virtual void iterate();
 
     /** \brief To be called before starting to iterate
-       \note This calls the preprocess method for the dependant iteration step class, too!
+       \note This calls the preprocess method for the dependent iteration step class, too!
      */
     virtual void preprocess();
 
diff --git a/dune/solvers/iterationsteps/obstacletnnmgstep.hh b/dune/solvers/iterationsteps/obstacletnnmgstep.hh
index 27b31ae..e15b6a6 100644
--- a/dune/solvers/iterationsteps/obstacletnnmgstep.hh
+++ b/dune/solvers/iterationsteps/obstacletnnmgstep.hh
@@ -241,7 +241,7 @@ class ObstacleTNNMGStep
                         truncatedResidual_[i][ii] = 0;
             }
 
-            // apply linear multigrid to approximatively solve the truncated linear system
+            // apply linear multigrid to approximately solve the truncated linear system
             linearMGStep_.setProblem(truncatedMat, coarseCorrection_, truncatedResidual_);
             linearMGStep_.ignoreNodes_ = ignoreNodes_;
             linearMGStep_.preprocess();
@@ -351,7 +351,7 @@ class ObstacleTNNMGStep
          * It does not change the ObstacleTNNMGStep state despite
          * updating the solution vector.
          *
-         * \param coarseIterationSteps Number of v-cycle performed on the corse levels.
+         * \param coarseIterationSteps Number of v-cycle performed on the course levels.
          */
         void nestedIteration(int coarseIterationSteps=2)
         {
diff --git a/dune/solvers/iterationsteps/projectedlinegsstep.cc b/dune/solvers/iterationsteps/projectedlinegsstep.cc
index dab1236..d5807a6 100755
--- a/dune/solvers/iterationsteps/projectedlinegsstep.cc
+++ b/dune/solvers/iterationsteps/projectedlinegsstep.cc
@@ -178,7 +178,7 @@ void ProjectedLineGSStep<MatrixType, VectorType, BitVectorType>::iterate()
 
         const int current_block_size = this->blockStructure_[b_num].size();
 
-        //! compute and save the residuals for the curent block:
+        //! compute and save the residuals for the current block:
         // determine the (permuted) residuals r[p(i)],..., r[p(i+current_block_size-1)]
         // this means that we determine the residuals for the current block
         VectorType permuted_r_i(current_block_size);
diff --git a/dune/solvers/solvers/linearipopt.hh b/dune/solvers/solvers/linearipopt.hh
index cba3607..d66a987 100644
--- a/dune/solvers/solvers/linearipopt.hh
+++ b/dune/solvers/solvers/linearipopt.hh
@@ -584,7 +584,7 @@ void LinearIPOptSolver<VectorType,JacobianType>::solve()
       app->Options()->SetIntegerValue("print_level", 12);
   }
 
-  // Intialize the IpoptApplication and process the options
+  // Initialize the IpoptApplication and process the options
   Ipopt::ApplicationReturnStatus status;
   status = app->Initialize();
   if (status != Ipopt::Solve_Succeeded)
@@ -598,7 +598,7 @@ void LinearIPOptSolver<VectorType,JacobianType>::solve()
     DUNE_THROW(Dune::Exception, "IPOpt returned 'Invalid_Option' error!");
 
   if (status == Ipopt::Solved_To_Acceptable_Level)
-      std::cout<<"WARNING: Desired tolerance could not be reached, but still accetable tolerance is reached.\n";
+      std::cout<<"WARNING: Desired tolerance could not be reached, but still acceptable tolerance is reached.\n";
   else if (status != Ipopt::Solve_Succeeded)
       DUNE_THROW(Dune::Exception, "IPOpt: Error during optimization!");
 }
diff --git a/dune/solvers/solvers/quadraticipopt.hh b/dune/solvers/solvers/quadraticipopt.hh
index df5ad0b..65b695c 100644
--- a/dune/solvers/solvers/quadraticipopt.hh
+++ b/dune/solvers/solvers/quadraticipopt.hh
@@ -797,7 +797,7 @@ void QuadraticIPOptSolver<MatrixType,VectorType,JacobianType>::solve()
       app->Options()->SetIntegerValue("print_level", 12);
   }
 
-  // Intialize the IpoptApplication and process the options
+  // Initialize the IpoptApplication and process the options
   Ipopt::ApplicationReturnStatus status;
   status = app->Initialize();
   if (status != Ipopt::Solve_Succeeded)
diff --git a/dune/solvers/solvers/trustregionsolver.hh b/dune/solvers/solvers/trustregionsolver.hh
index 79fe87b..7c9e14b 100644
--- a/dune/solvers/solvers/trustregionsolver.hh
+++ b/dune/solvers/solvers/trustregionsolver.hh
@@ -128,10 +128,10 @@ protected:
     /** \brief The maximal trust-region radius in the maximum-norm */
     field_type maxRadius_;
 
-    /** \brief If the iteration is very successfull we enlarge the radius by this factor.*/
+    /** \brief If the iteration is very successful we enlarge the radius by this factor.*/
     field_type enlargeRadius_;
 
-    /** \brief If the iteration is unsuccessfull we shrink the radius by this factor.*/
+    /** \brief If the iteration is unsuccessful we shrink the radius by this factor.*/
     field_type shrinkRadius_;
 
     /** \brief If the ratio between predicted and achieved decrease is above this number, the iteration is very successful.*/
diff --git a/dune/solvers/test/common.hh b/dune/solvers/test/common.hh
index 63073de..ba2bcd9 100644
--- a/dune/solvers/test/common.hh
+++ b/dune/solvers/test/common.hh
@@ -89,7 +89,7 @@ void assemblePQ1Stiffness(const GridView& gridView, Matrix& matrix)
 
         int localSize = fe.size();
 
-        // get quadrature rule of appropiate order (P1/Q1)
+        // get quadrature rule of appropriate order (P1/Q1)
         int order = (element.type().isSimplex())
                     ? 2*(1-1)
                     : 2*(dim-1);
@@ -220,7 +220,7 @@ void assemblePQ1RHS(const GridView& gridView, Vector& r, const Function& f)
 
         int localSize = fe.size();
 
-        // get quadrature rule of appropiate order (P1/Q1)
+        // get quadrature rule of appropriate order (P1/Q1)
         int order = (element.type().isSimplex())
                     ? 2*1
                     : 2*dim;
diff --git a/dune/solvers/test/obstacletnnmgtest.cc b/dune/solvers/test/obstacletnnmgtest.cc
index f6b938b..ecd9599 100644
--- a/dune/solvers/test/obstacletnnmgtest.cc
+++ b/dune/solvers/test/obstacletnnmgtest.cc
@@ -76,7 +76,7 @@ void solveObstacleProblemByTNNMG(const GridType& grid, const MatrixType& mat, Ve
     tnnmgStep.preprocess();
     tnnmgStep.nestedIteration();
 
-    // cretae loop solver
+    // create loop solver
     Solver solver(tnnmgStep, maxIterations, tolerance, norm, Solver::FULL);
 
     // solve problem
-- 
GitLab