Skip to content

Commit

Permalink
fixed warnings for unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
landinjm committed Sep 10, 2024
1 parent c712104 commit eb5c59d
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 56 deletions.
6 changes: 3 additions & 3 deletions src/EquationDependencyParser/EquationDependencyParser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ EquationDependencyParser::parseDependencyListRHS(
for (const auto &dependency : split_dependency_list)
{
// Flag to make sure we have assigned a dependency entry
bool dependency_entry_assigned = false;
[[maybe_unused]] bool dependency_entry_assigned = false;

// Loop through all known variable names [x, grad(x), and hess(x)] to see which ones
// are on our dependency list. If we have two variables x and y this will loop twice
Expand Down Expand Up @@ -254,7 +254,7 @@ EquationDependencyParser::parseDependencyListLHS(
for (const auto &dependency : split_dependency_list)
{
// Flag to make sure we have assigned a dependency entry
bool dependency_entry_assigned = false;
[[maybe_unused]] bool dependency_entry_assigned = false;

// Loop through all known variable names [x, grad(x), and hess(x)] to see which ones
// are on our dependency list. If we have two variables x and y this will loop twice
Expand Down Expand Up @@ -442,7 +442,7 @@ EquationDependencyParser::parseDependencyListPP(
for (const auto &dependency : split_dependency_list)
{
// Flag to make sure we have assigned a dependency entry
bool dependency_entry_assigned = false;
[[maybe_unused]] bool dependency_entry_assigned = false;

// Loop through all known variable names [x, grad(x), and hess(x)] to see which ones
// are on our dependency list. If we have two variables x and y this will loop twice
Expand Down
1 change: 0 additions & 1 deletion src/FloodFiller/FloodFiller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ FloodFiller<dim, degree>::createGlobalGrainSetList(
std::vector<GrainSet<dim>> &grain_sets) const
{
int numProcs = dealii::Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD);
int thisProc = dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);

unsigned int num_grains_local = grain_sets.size();

Expand Down
5 changes: 0 additions & 5 deletions src/OrderParameterRemapper/OrderParameterRemapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ OrderParameterRemapper<dim>::remap(
{
if (dof->is_locally_owned())
{
unsigned int op_new = grain_representations.at(g).getOrderParameterId();
unsigned int op_old =
grain_representations.at(g).getOldOrderParameterId();

Expand Down Expand Up @@ -126,9 +125,6 @@ OrderParameterRemapper<dim>::remap_from_index_field(
double transfer_buffer =
std::max(0.0, grain_representations.at(g).getDistanceToNeighbor() / 2.0);

typename dealii::DoFHandler<dim>::active_cell_iterator di =
dof_handler.begin_active();

// For now I have two loops, one where I copy the values from the old
// order parameter to the new one and a second where I zero out the old
// order parameter. This separation prevents writing zero-out values to
Expand All @@ -139,7 +135,6 @@ OrderParameterRemapper<dim>::remap_from_index_field(
if (dof->is_locally_owned())
{
unsigned int op_new = grain_representations.at(g).getOrderParameterId();
unsigned int op_old = grain_representations.at(g).getOldOrderParameterId();

// Check if the cell is within the simplified grain representation
bool in_grain = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ SimplifiedGrainManipulator<dim>::reassignGrains(
double buffer_distance,
std::vector<unsigned int> order_parameter_id_list)
{
int thisProc = dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);

for (int cycle = order_parameter_id_list.size(); cycle >= 0; cycle--)
{
for (unsigned int g_base = 0; g_base < grain_representations.size(); g_base++)
Expand Down
16 changes: 9 additions & 7 deletions src/matrixfree/boundaryConditions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,10 @@ MatrixFreePDE<dim, degree>::applyDirichletBCs()
}
}

// VectorTools::interpolate_boundary_values (*dofHandlersSet[currentFieldIndex],\
// direction, NonUniformDirichletBC<dim,degree>(currentFieldIndex,direction,currentTime,this), *(AffineConstraints<double>*) \
// constraintsDirichletSet[currentFieldIndex],mask);
// VectorTools::interpolate_boundary_values
// (*dofHandlersSet[currentFieldIndex],direction,
// NonUniformDirichletBC<dim,degree>(currentFieldIndex,direction,currentTime,this),
// *(AffineConstraints<double>*)constraintsDirichletSet[currentFieldIndex],mask);
VectorTools::interpolate_boundary_values(
*dofHandlersSet[currentFieldIndex],
direction,
Expand Down Expand Up @@ -368,10 +369,11 @@ MatrixFreePDE<dim, degree>::setRigidBodyModeConstraints(
component_num < rigidBodyModeComponents.size();
component_num++)
{
unsigned int nodeID = cell->vertex_dof_index(i, component_num);
// Temporarily disabling the addition of inhomogeneous
// constraints constraints->add_line(nodeID);
// constraints->set_inhomogeneity(nodeID,0.0);
// unsigned int nodeID = cell->vertex_dof_index(i,
// component_num);
// Temporarily disabling the addition of inhomogeneous
// constraints constraints->add_line(nodeID);
// constraints->set_inhomogeneity(nodeID,0.0);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/test_FloodFiller.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class InitialConditionFloodFill : public dealii::Function<dim>
}

double
value(const dealii::Point<dim> &p, const unsigned int component = 0) const
value(const dealii::Point<dim> &p, const unsigned int component = 0) const override
{
double val;
if (p[1] < 0.6 and p[0] > p[1] + 1.0e-10)
Expand Down
28 changes: 1 addition & 27 deletions tests/unit_tests/test_OrderParameterRemapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class InitialConditionOrderParameterRemapper : public dealii::Function<dim>
}

double
value(const dealii::Point<dim> &p, const unsigned int component = 0) const
value(const dealii::Point<dim> &p, const unsigned int component = 0) const override
{
double val;

Expand Down Expand Up @@ -49,8 +49,6 @@ template <int dim, typename T>
bool
unitTest<dim, T>::test_OrderParameterRemapper()
{
int thisProc = dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);

char buffer[100];

std::cout << "\nTesting 'OrderParameterRemapper'... " << std::endl;
Expand Down Expand Up @@ -164,37 +162,13 @@ unitTest<dim, T>::test_OrderParameterRemapper()
order_parameter_id_list);

// ---------- The actual test run of OrderParameterRemapper -----------
/*
for (unsigned int g=0; g<simplified_grain_representations.size(); g++){
std::cout << simplified_grain_representations.at(g).getGrainId() << " " <<
simplified_grain_representations.at(g).getRadius() << std::endl;
}
*/
// std::cout << "Field 0, core" << thisProc << std::endl;
// solution_fields.at(0)->print(std::cout);
// std::cout << "Field 1, core" << thisProc << std::endl;
// solution_fields.at(1)->print(std::cout);

OrderParameterRemapper<dim> order_parameter_remapper;
order_parameter_remapper.remap(simplified_grain_representations,
solution_fields,
dof_handler,
fe.dofs_per_cell,
0.001);

/*
for (unsigned int g=0; g<simplified_grain_representations.size(); g++){
std::cout << simplified_grain_representations.at(g).getGrainId() << " " <<
simplified_grain_representations.at(g).getOrderParameterId() << " " <<
simplified_grain_representations.at(g).getOldOrderParameterId() << std::endl;
}
*/

// std::cout << "Field 0, core" << thisProc << std::endl;
// solution_fields.at(0)->print(std::cout);
// std::cout << "Field 1, core" << thisProc << std::endl;
// solution_fields.at(1)->print(std::cout);

// ---------- Check the result -----------
pass = true;

Expand Down
10 changes: 5 additions & 5 deletions tests/unit_tests/test_invM.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class testInvM : public MatrixFreePDE<dim, degree>
setInitialCondition(const dealii::Point<dim> &p,
const unsigned int index,
double &scalar_IC,
dealii::Vector<double> &vector_IC) {};
dealii::Vector<double> &vector_IC) override {};

// Function to set the non-uniform Dirichlet boundary conditions (in
// ICs_and_BCs.h)
Expand All @@ -50,7 +50,7 @@ class testInvM : public MatrixFreePDE<dim, degree>
const unsigned int direction,
const double time,
double &scalar_BC,
dealii::Vector<double> &vector_BC) {};
dealii::Vector<double> &vector_BC) override {};

private:
// RHS implementation for explicit solve
Expand All @@ -65,20 +65,20 @@ class testInvM : public MatrixFreePDE<dim, degree>
void
explicitEquationRHS(
variableContainer<dim, degree, dealii::VectorizedArray<double>> &variable_list,
dealii::Point<dim, dealii::VectorizedArray<double>> q_point_loc) const {};
dealii::Point<dim, dealii::VectorizedArray<double>> q_point_loc) const override {};

// Function to set the RHS of the governing equations for all other equations
// (in equations.h)
void
nonExplicitEquationRHS(
variableContainer<dim, degree, dealii::VectorizedArray<double>> &variable_list,
dealii::Point<dim, dealii::VectorizedArray<double>> q_point_loc) const {};
dealii::Point<dim, dealii::VectorizedArray<double>> q_point_loc) const override {};

// Function to set the LHS of the governing equations (in equations.h)
void
equationLHS(
variableContainer<dim, degree, dealii::VectorizedArray<double>> &variable_list,
dealii::Point<dim, dealii::VectorizedArray<double>> q_point_loc) const {};
dealii::Point<dim, dealii::VectorizedArray<double>> q_point_loc) const override {};
};

template <int dim, typename T>
Expand Down
10 changes: 5 additions & 5 deletions tests/unit_tests/test_setRigidBodyModeConstraints.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class setRigidBodyModeConstraintsTest : public MatrixFreePDE<dim, degree>
setInitialCondition(const dealii::Point<dim> &p,
const unsigned int index,
double &scalar_IC,
dealii::Vector<double> &vector_IC) {};
dealii::Vector<double> &vector_IC) override {};

// Function to set the non-uniform Dirichlet boundary conditions (in
// ICs_and_BCs.h)
Expand All @@ -47,7 +47,7 @@ class setRigidBodyModeConstraintsTest : public MatrixFreePDE<dim, degree>
const unsigned int direction,
const double time,
double &scalar_BC,
dealii::Vector<double> &vector_BC) {};
dealii::Vector<double> &vector_BC) override {};

private:
// RHS implementation for explicit solve
Expand All @@ -62,20 +62,20 @@ class setRigidBodyModeConstraintsTest : public MatrixFreePDE<dim, degree>
void
explicitEquationRHS(
variableContainer<dim, degree, dealii::VectorizedArray<double>> &variable_list,
dealii::Point<dim, dealii::VectorizedArray<double>> q_point_loc) const {};
dealii::Point<dim, dealii::VectorizedArray<double>> q_point_loc) const override {};

// Function to set the RHS of the governing equations for all other equations
// (in equations.h)
void
nonExplicitEquationRHS(
variableContainer<dim, degree, dealii::VectorizedArray<double>> &variable_list,
dealii::Point<dim, dealii::VectorizedArray<double>> q_point_loc) const {};
dealii::Point<dim, dealii::VectorizedArray<double>> q_point_loc) const override {};

// Function to set the LHS of the governing equations (in equations.h)
void
equationLHS(
variableContainer<dim, degree, dealii::VectorizedArray<double>> &variable_list,
dealii::Point<dim, dealii::VectorizedArray<double>> q_point_loc) const {};
dealii::Point<dim, dealii::VectorizedArray<double>> q_point_loc) const override {};
};

template <int dim, typename T>
Expand Down

0 comments on commit eb5c59d

Please sign in to comment.