From: Wolfgang Bangerth Date: Wed, 24 May 2023 20:56:10 +0000 (-0600) Subject: Document requirements on PETSc TS and SNES template arguments. X-Git-Tag: v9.5.0-rc1~184^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F15267%2Fhead;p=dealii.git Document requirements on PETSc TS and SNES template arguments. --- diff --git a/include/deal.II/lac/petsc_snes.h b/include/deal.II/lac/petsc_snes.h index 1ef8c9cb77..f1931da1a8 100644 --- a/include/deal.II/lac/petsc_snes.h +++ b/include/deal.II/lac/petsc_snes.h @@ -233,6 +233,13 @@ namespace PETScWrappers * model reductions using the energy functional. In such cases, users can * set an optional NonlinearSolver::energy callback. * + * @dealiiConceptRequires{(concepts::is_dealii_petsc_vector_type + * || std::constructible_from) && + * (concepts::is_dealii_petsc_matrix_type || + * std::constructible_from) && + * (concepts::is_dealii_petsc_matrix_type || + * std::constructible_from)} + * * @ingroup PETScWrappers */ template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) NonlinearSolver::NonlinearSolver( const NonlinearSolverData &data, const MPI_Comm mpi_comm) @@ -65,8 +72,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) NonlinearSolver::operator SNES() const { return snes; @@ -75,8 +89,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) SNES NonlinearSolver::petsc_snes() { return snes; @@ -85,8 +106,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) MPI_Comm NonlinearSolver:: get_mpi_communicator() const { @@ -96,8 +124,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) NonlinearSolver::~NonlinearSolver() { AssertPETSc(SNESDestroy(&snes)); @@ -106,8 +141,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) void NonlinearSolver::reinit() { AssertPETSc(SNESReset(snes)); @@ -116,8 +158,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) void NonlinearSolver::reinit( const NonlinearSolverData &data) { @@ -164,8 +213,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) void NonlinearSolver::set_matrix( PMatrixType &P) { @@ -176,8 +232,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) void NonlinearSolver::set_matrices( AMatrixType &A, PMatrixType &P) @@ -189,8 +252,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) unsigned int NonlinearSolver::solve( VectorType &x) { @@ -407,8 +477,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) unsigned int NonlinearSolver::solve( VectorType & x, PMatrixType &P) @@ -420,8 +497,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) unsigned int NonlinearSolver::solve( VectorType & x, AMatrixType &A, diff --git a/include/deal.II/lac/petsc_ts.h b/include/deal.II/lac/petsc_ts.h index 60641ba51b..45435e0d99 100644 --- a/include/deal.II/lac/petsc_ts.h +++ b/include/deal.II/lac/petsc_ts.h @@ -290,6 +290,13 @@ namespace PETScWrappers * See TimeStepper::set_matrix and TimeStepper::set_matrices for * additional details. * + * @dealiiConceptRequires{(concepts::is_dealii_petsc_vector_type + * || std::constructible_from) && + * (concepts::is_dealii_petsc_matrix_type || + * std::constructible_from) && + * (concepts::is_dealii_petsc_matrix_type || + * std::constructible_from)} + * * @ingroup PETScWrappers */ template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) TimeStepper::TimeStepper( const TimeStepperData &data, const MPI_Comm mpi_comm) @@ -65,8 +72,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) TimeStepper::~TimeStepper() { AssertPETSc(TSDestroy(&ts)); @@ -75,8 +89,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) TimeStepper::operator TS() const { return ts; @@ -85,8 +106,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) TS TimeStepper::petsc_ts() { return ts; @@ -95,8 +123,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) inline MPI_Comm TimeStepper::get_mpi_communicator() const @@ -107,8 +142,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) typename TimeStepper::real_type TimeStepper::get_time() { @@ -121,8 +163,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) typename TimeStepper::real_type TimeStepper::get_time_step() { @@ -135,8 +184,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) void TimeStepper::reinit() { AssertPETSc(TSReset(ts)); @@ -145,8 +201,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) void TimeStepper::reinit( const TimeStepperData &data) { @@ -214,8 +277,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) void TimeStepper::set_matrix( PMatrixType &P) { @@ -226,8 +296,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) void TimeStepper::set_matrices( AMatrixType &A, PMatrixType &P) @@ -239,8 +316,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) unsigned int TimeStepper::solve( VectorType &y) { @@ -549,8 +633,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) unsigned int TimeStepper::solve( VectorType & y, PMatrixType &P) @@ -562,8 +653,15 @@ namespace PETScWrappers template - DEAL_II_CXX20_REQUIRES((concepts::is_dealii_petsc_vector_type || - std::constructible_from)) + DEAL_II_CXX20_REQUIRES( + (concepts::is_dealii_petsc_vector_type || + std::constructible_from< + VectorType, + Vec>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from< + PMatrixType, + Mat>)&&(concepts::is_dealii_petsc_matrix_type || + std::constructible_from)) unsigned int TimeStepper::solve( VectorType & y, AMatrixType &A,