From 32c5d7c9fcc755eb394b2615f56fbb221d215536 Mon Sep 17 00:00:00 2001 From: landinjm Date: Fri, 20 Dec 2024 13:57:39 -0500 Subject: [PATCH] removing ifdef for old deal.II versions --- README.md | 4 ++-- include/core/matrixFreePDE.h | 18 ++++++++---------- .../boundary_conditions/boundaryConditions.cc | 6 +----- src/core/init.cc | 15 +-------------- .../initial_conditions/initialConditions.cc | 16 ---------------- src/core/inputFileReader.cc | 4 ---- src/core/invM.cc | 10 ---------- src/core/outputResults.cc | 8 -------- src/core/reinit.cc | 8 +------- src/core/solvers/solveIncrement.cc | 12 ------------ 10 files changed, 13 insertions(+), 88 deletions(-) diff --git a/README.md b/README.md index 22e3053a2..1300ba152 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ For detailed instructions on how to download and use PRISMS-PF, please consult t ### Install: -Install CMake, p4est, and deal.II (version 9.6 recommended). +Install CMake, p4est, and deal.II (version 9.6.0 or above required). Clone the PRISMS-PF GitHub repository and navigate its folder. ```bash @@ -98,7 +98,7 @@ following open source applications: ## Version information: -This version of the code, v2.4, contains moderate changes from v2.3. It was released in November 2024. See [version_changes.md](version_changes.md) for details. +This version of the code, v3.0, is still under development. See [version_changes.md](version_changes.md) for details of previous releases. ## License: diff --git a/include/core/matrixFreePDE.h b/include/core/matrixFreePDE.h index d683b1f6a..4b640c0c5 100644 --- a/include/core/matrixFreePDE.h +++ b/include/core/matrixFreePDE.h @@ -3,28 +3,26 @@ #define MATRIXFREEPDE_H // dealii headers -#include -#include -#include -#include -#include -#include -#include -#if (DEAL_II_VERSION_MAJOR == 9 && DEAL_II_VERSION_MINOR > 3) -# include -#endif #include #include +#include +#include #include #include #include #include +#include +#include +#include +#include #include #include #include #include #include +#include #include +#include #include #include #include diff --git a/src/core/boundary_conditions/boundaryConditions.cc b/src/core/boundary_conditions/boundaryConditions.cc index c34acdd1f..348a9a54e 100644 --- a/src/core/boundary_conditions/boundaryConditions.cc +++ b/src/core/boundary_conditions/boundaryConditions.cc @@ -273,12 +273,8 @@ MatrixFreePDE::setPeriodicityConstraints( periodicity_vector); } } -#if (DEAL_II_VERSION_MAJOR == 9 && DEAL_II_VERSION_MINOR >= 4) + DoFTools::make_periodicity_constraints(periodicity_vector, *constraints); -#else - DoFTools::make_periodicity_constraints>(periodicity_vector, - *constraints); -#endif } template diff --git a/src/core/init.cc b/src/core/init.cc index 9e3e6473e..82fc1e07c 100644 --- a/src/core/init.cc +++ b/src/core/init.cc @@ -231,31 +231,18 @@ MatrixFreePDE::init() // Setup the matrix free object typename MatrixFree::AdditionalData additional_data; -// The member "mpi_communicator" was removed in deal.II version 8.5 but is -// required before it -#if (DEAL_II_VERSION_MAJOR < 9 && DEAL_II_VERSION_MINOR < 5) - additional_data.mpi_communicator = MPI_COMM_WORLD; -#endif additional_data.tasks_parallel_scheme = MatrixFree::AdditionalData::partition_partition; - // additional_data.tasks_parallel_scheme = - // MatrixFree::AdditionalData::none; additional_data.mapping_update_flags = (update_values | update_gradients | update_JxW_values | update_quadrature_points); QGaussLobatto<1> quadrature(degree + 1); matrixFreeObject.clear(); -#if (DEAL_II_VERSION_MAJOR == 9 && DEAL_II_VERSION_MINOR < 4) - matrixFreeObject.reinit(dofHandlersSet, - constraintsOtherSet, - quadrature, - additional_data); -#else matrixFreeObject.reinit(MappingFE(FE_Q(QGaussLobatto<1>(degree + 1))), dofHandlersSet, constraintsOtherSet, quadrature, additional_data); -#endif + bool dU_scalar_init = false; bool dU_vector_init = false; diff --git a/src/core/initial_conditions/initialConditions.cc b/src/core/initial_conditions/initialConditions.cc index 335494732..b2236b769 100644 --- a/src/core/initial_conditions/initialConditions.cc +++ b/src/core/initial_conditions/initialConditions.cc @@ -260,19 +260,11 @@ MatrixFreePDE::applyInitialConditions() computeLaplaceRHS(fieldIndex); if (fields[fieldIndex].type == SCALAR) { -#if (DEAL_II_VERSION_MAJOR == 9 && DEAL_II_VERSION_MINOR < 4) - unsigned int invM_size = invMscalar.local_size(); - for (unsigned int dof = 0; - dof < solutionSet[fieldIndex]->local_size(); - ++dof) - { -#else unsigned int invM_size = invMscalar.locally_owned_size(); for (unsigned int dof = 0; dof < solutionSet[fieldIndex]->locally_owned_size(); ++dof) { -#endif solutionSet[fieldIndex]->local_element(dof) = solutionSet[fieldIndex]->local_element(dof) - invMscalar.local_element(dof % invM_size) * @@ -282,19 +274,11 @@ MatrixFreePDE::applyInitialConditions() } else if (fields[fieldIndex].type == VECTOR) { -#if (DEAL_II_VERSION_MAJOR == 9 && DEAL_II_VERSION_MINOR < 4) - unsigned int invM_size = invMvector.local_size(); - for (unsigned int dof = 0; - dof < solutionSet[fieldIndex]->local_size(); - ++dof) - { -#else unsigned int invM_size = invMvector.locally_owned_size(); for (unsigned int dof = 0; dof < solutionSet[fieldIndex]->locally_owned_size(); ++dof) { -#endif solutionSet[fieldIndex]->local_element(dof) = solutionSet[fieldIndex]->local_element(dof) - invMvector.local_element(dof % invM_size) * diff --git a/src/core/inputFileReader.cc b/src/core/inputFileReader.cc index 7b62d6cd7..72de4073c 100644 --- a/src/core/inputFileReader.cc +++ b/src/core/inputFileReader.cc @@ -25,11 +25,7 @@ inputFileReader::inputFileReader(const std::string &input_file_name, // Read in all of the parameters now declare_parameters(parameter_handler, num_constants); -#if (DEAL_II_VERSION_MAJOR < 9 && DEAL_II_VERSION_MINOR < 5) - parameter_handler.read_input(input_file_name); -#else parameter_handler.parse_input(input_file_name); -#endif number_of_dimensions = parameter_handler.get_integer("Number of dimensions"); } diff --git a/src/core/invM.cc b/src/core/invM.cc index b92065b4c..e5a499d0a 100644 --- a/src/core/invM.cc +++ b/src/core/invM.cc @@ -128,13 +128,8 @@ MatrixFreePDE::computeInvM() std::multiplies<>()); // Invert scalar mass matrix diagonal elements -#if (DEAL_II_VERSION_MAJOR == 9 && DEAL_II_VERSION_MINOR < 4) - for (unsigned int k = 0; k < invMscalar.local_size(); ++k) - { -#else for (unsigned int k = 0; k < invMscalar.locally_owned_size(); ++k) { -#endif if (std::abs(invMscalar.local_element(k)) > 1.0e-15 * min_cell_volume) { invMscalar.local_element(k) = 1. / invMscalar.local_element(k); @@ -148,13 +143,8 @@ MatrixFreePDE::computeInvM() << parabolicScalarFieldIndex << ")\n"; // Invert vector mass matrix diagonal elements -#if (DEAL_II_VERSION_MAJOR == 9 && DEAL_II_VERSION_MINOR < 4) - for (unsigned int k = 0; k < invMvector.local_size(); ++k) - { -#else for (unsigned int k = 0; k < invMvector.locally_owned_size(); ++k) { -#endif if (std::abs(invMvector.local_element(k)) > 1.0e-15 * min_cell_volume) { invMvector.local_element(k) = 1. / invMvector.local_element(k); diff --git a/src/core/outputResults.cc b/src/core/outputResults.cc index 00bc13d3a..dc91561a9 100644 --- a/src/core/outputResults.cc +++ b/src/core/outputResults.cc @@ -45,19 +45,11 @@ MatrixFreePDE::outputResults() { std::vector postProcessedSet; computePostProcessedFields(postProcessedSet); -#if (DEAL_II_VERSION_MAJOR == 9 && DEAL_II_VERSION_MINOR < 4) - unsigned int invM_size = invMscalar.local_size(); - for (auto &field : postProcessedSet) - { - for (unsigned int dof = 0; dof < field->local_size(); ++dof) - { -#else unsigned int invM_size = invMscalar.locally_owned_size(); for (auto &field : postProcessedSet) { for (unsigned int dof = 0; dof < field->locally_owned_size(); ++dof) { -#endif field->local_element(dof) = invMscalar.local_element(dof % invM_size) * field->local_element(dof); } diff --git a/src/core/reinit.cc b/src/core/reinit.cc index 71171dc60..6cdc7076b 100644 --- a/src/core/reinit.cc +++ b/src/core/reinit.cc @@ -107,18 +107,12 @@ MatrixFreePDE::reinit() (update_values | update_gradients | update_JxW_values | update_quadrature_points); QGaussLobatto<1> quadrature(degree + 1); matrixFreeObject.clear(); -#if (DEAL_II_VERSION_MAJOR == 9 && DEAL_II_VERSION_MINOR < 4) - matrixFreeObject.reinit(dofHandlersSet, - constraintsOtherSet, - quadrature, - additional_data); -#else matrixFreeObject.reinit(MappingFE(FE_Q(QGaussLobatto<1>(degree + 1))), dofHandlersSet, constraintsOtherSet, quadrature, additional_data); -#endif + bool dU_scalar_init = false; bool dU_vector_init = false; diff --git a/src/core/solvers/solveIncrement.cc b/src/core/solvers/solveIncrement.cc index b7334f1ef..2053429e9 100644 --- a/src/core/solvers/solveIncrement.cc +++ b/src/core/solvers/solveIncrement.cc @@ -261,16 +261,10 @@ MatrixFreePDE::updateExplicitSolution(unsigned int fieldIndex) // is an integer multiple of the length of invM for vector variables if (fields[fieldIndex].type == SCALAR) { -#if (DEAL_II_VERSION_MAJOR == 9 && DEAL_II_VERSION_MINOR < 4) - unsigned int invM_size = invMscalar.local_size(); - for (unsigned int dof = 0; dof < solutionSet[fieldIndex]->local_size(); ++dof) - { -#else unsigned int invM_size = invMscalar.locally_owned_size(); for (unsigned int dof = 0; dof < solutionSet[fieldIndex]->locally_owned_size(); ++dof) { -#endif solutionSet[fieldIndex]->local_element(dof) = invMscalar.local_element(dof % invM_size) * residualSet[fieldIndex]->local_element(dof); @@ -278,16 +272,10 @@ MatrixFreePDE::updateExplicitSolution(unsigned int fieldIndex) } else if (fields[fieldIndex].type == VECTOR) { -#if (DEAL_II_VERSION_MAJOR == 9 && DEAL_II_VERSION_MINOR < 4) - unsigned int invM_size = invMvector.local_size(); - for (unsigned int dof = 0; dof < solutionSet[fieldIndex]->local_size(); ++dof) - { -#else unsigned int invM_size = invMvector.locally_owned_size(); for (unsigned int dof = 0; dof < solutionSet[fieldIndex]->locally_owned_size(); ++dof) { -#endif solutionSet[fieldIndex]->local_element(dof) = invMvector.local_element(dof % invM_size) * residualSet[fieldIndex]->local_element(dof);