Skip to content

Commit

Permalink
removing ifdef for old deal.II versions
Browse files Browse the repository at this point in the history
  • Loading branch information
landinjm committed Dec 20, 2024
1 parent ae221a9 commit 32c5d7c
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 88 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:

Expand Down
18 changes: 8 additions & 10 deletions include/core/matrixFreePDE.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,26 @@
#define MATRIXFREEPDE_H

// dealii headers
#include <deal.II/base/quadrature.h>
#include <deal.II/base/timer.h>
#include <deal.II/fe/fe_q.h>
#include <deal.II/fe/fe_system.h>
#include <deal.II/fe/fe_values.h>
#include <deal.II/lac/affine_constraints.h>
#include <deal.II/lac/vector.h>
#if (DEAL_II_VERSION_MAJOR == 9 && DEAL_II_VERSION_MINOR > 3)
# include <deal.II/fe/mapping_fe.h>
#endif
#include <deal.II/base/config.h>
#include <deal.II/base/exceptions.h>
#include <deal.II/base/quadrature.h>
#include <deal.II/base/timer.h>
#include <deal.II/distributed/solution_transfer.h>
#include <deal.II/distributed/tria.h>
#include <deal.II/dofs/dof_handler.h>
#include <deal.II/dofs/dof_tools.h>
#include <deal.II/fe/fe_q.h>
#include <deal.II/fe/fe_system.h>
#include <deal.II/fe/fe_values.h>
#include <deal.II/fe/mapping_fe.h>
#include <deal.II/grid/grid_tools.h>
#include <deal.II/grid/manifold_lib.h>
#include <deal.II/grid/tria.h>
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/lac/affine_constraints.h>
#include <deal.II/lac/la_parallel_vector.h>
#include <deal.II/lac/vector.h>
#include <deal.II/matrix_free/fe_evaluation.h>
#include <deal.II/matrix_free/matrix_free.h>
#include <deal.II/numerics/vector_tools.h>
Expand Down
6 changes: 1 addition & 5 deletions src/core/boundary_conditions/boundaryConditions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,8 @@ MatrixFreePDE<dim, degree>::setPeriodicityConstraints(
periodicity_vector);
}
}
#if (DEAL_II_VERSION_MAJOR == 9 && DEAL_II_VERSION_MINOR >= 4)

DoFTools::make_periodicity_constraints<dim, dim>(periodicity_vector, *constraints);
#else
DoFTools::make_periodicity_constraints<DoFHandler<dim>>(periodicity_vector,
*constraints);
#endif
}

template <int dim, int degree>
Expand Down
15 changes: 1 addition & 14 deletions src/core/init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,31 +231,18 @@ MatrixFreePDE<dim, degree>::init()

// Setup the matrix free object
typename MatrixFree<dim, double>::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<dim, double>::AdditionalData::partition_partition;
// additional_data.tasks_parallel_scheme =
// MatrixFree<dim,double>::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<dim, dim>(FE_Q<dim>(QGaussLobatto<1>(degree + 1))),
dofHandlersSet,
constraintsOtherSet,
quadrature,
additional_data);
#endif

bool dU_scalar_init = false;
bool dU_vector_init = false;

Expand Down
16 changes: 0 additions & 16 deletions src/core/initial_conditions/initialConditions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -260,19 +260,11 @@ MatrixFreePDE<dim, degree>::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) *
Expand All @@ -282,19 +274,11 @@ MatrixFreePDE<dim, degree>::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) *
Expand Down
4 changes: 0 additions & 4 deletions src/core/inputFileReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
10 changes: 0 additions & 10 deletions src/core/invM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,8 @@ MatrixFreePDE<dim, degree>::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);
Expand All @@ -148,13 +143,8 @@ MatrixFreePDE<dim, degree>::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);
Expand Down
8 changes: 0 additions & 8 deletions src/core/outputResults.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,11 @@ MatrixFreePDE<dim, degree>::outputResults()
{
std::vector<vectorType *> 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);
}
Expand Down
8 changes: 1 addition & 7 deletions src/core/reinit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,12 @@ MatrixFreePDE<dim, degree>::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<dim, dim>(FE_Q<dim>(QGaussLobatto<1>(degree + 1))),
dofHandlersSet,
constraintsOtherSet,
quadrature,
additional_data);
#endif

bool dU_scalar_init = false;
bool dU_vector_init = false;

Expand Down
12 changes: 0 additions & 12 deletions src/core/solvers/solveIncrement.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,33 +261,21 @@ MatrixFreePDE<dim, degree>::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);
}
}
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);
Expand Down

0 comments on commit 32c5d7c

Please sign in to comment.