Skip to content

Commit

Permalink
some clang-tidy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
landinjm committed Feb 4, 2025
1 parent 3c4a89b commit cabbcf7
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 17 deletions.
4 changes: 4 additions & 0 deletions include/core/boundary_conditions/nonuniform_dirichlet.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ class nonuniformDirichlet : public dealii::Function<dim, double>
*/
nonuniformDirichlet(const uint &_index, const uint &_boundary_id);

// NOLINTBEGIN(readability-avoid-const-params-in-decls)

/**
* \brief Scalar value.
*/
double
value(const dealii::Point<dim> &p, const unsigned int component = 0) const override;

// NOLINTEND(readability-avoid-const-params-in-decls)

/**
* \brief Vector value.
*/
Expand Down
3 changes: 0 additions & 3 deletions include/core/timer.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#ifndef timer_h
#define timer_h

#include <deal.II/base/mpi.h>
#include <deal.II/base/timer.h>

#include <core/conditional_ostreams.h>

/**
* \brief Timer class for PRISMS-PF
*/
Expand Down
9 changes: 5 additions & 4 deletions include/core/triangulation_handler.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef triangulation_handler_h
#define triangulation_handler_h

#include <deal.II/distributed/tria.h>
#include <deal.II/grid/grid_generator.h>
#include <deal.II/grid/grid_out.h>
#include <deal.II/grid/grid_tools.h>
Expand All @@ -20,9 +21,9 @@ class triangulationHandler
{
public:
using Triangulation =
typename std::conditional<dim == 1,
dealii::Triangulation<dim>,
dealii::parallel::distributed::Triangulation<dim>>::type;
std::conditional_t<dim == 1,
dealii::Triangulation<dim>,
dealii::parallel::distributed::Triangulation<dim>>;

/**
* \brief Constructor.
Expand Down Expand Up @@ -162,7 +163,7 @@ triangulationHandler<dim>::mark_boundaries() const
++face_number)
{
// Direction for quad and hex cells
uint direction = std::floor(face_number / 2);
uint direction = static_cast<uint>(std::floor(face_number / 2));

// Mark the boundary id for x=0, y=0, z=0
if (std::fabs(cell->face(face_number)->center()(direction) - 0) < tolerance)
Expand Down
2 changes: 1 addition & 1 deletion include/core/user_inputs/output_parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ outputParameters::compute_output_list(
for (uint iteration = 2; iteration <= temporal_discretization.total_increments;
iteration++)
{
const uint decade = std::ceil(std::log10(iteration));
const auto decade = static_cast<uint>(std::ceil(std::log10(iteration)));
const auto step_size = static_cast<uint>(std::pow(10, decade) / n_outputs);
if (iteration % step_size == 0)
{
Expand Down
4 changes: 2 additions & 2 deletions src/core/conditional_ostreams.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
std::ofstream conditionalOStreams::summary_log_file("summary.log",
std::ios::out | std::ios::trunc);

// NOLINTEND

dealii::ConditionalOStream &
conditionalOStreams::pout_summary()
{
Expand Down Expand Up @@ -50,5 +52,3 @@ conditionalOStreams::~conditionalOStreams()
summary_log_file.close();
}
}

// NOLINTEND
2 changes: 2 additions & 0 deletions src/core/timer.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include <core/conditional_ostreams.h>
#include <core/timer.h>
#include <mpi.h>

dealii::TimerOutput &
timer::serial_timer()
Expand Down
20 changes: 13 additions & 7 deletions src/core/variable_attributes.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <deal.II/matrix_free/evaluation_flags.h>

#include <boost/range/algorithm/find.hpp>

#include <core/conditional_ostreams.h>
Expand Down Expand Up @@ -46,7 +48,7 @@ variableAttributes::parse_dependencies(AttributesList &other_var_attributes)
const std::map<std::string, std::pair<dependencyType, EvalFlags>> relevant_flag = []()
{
// Modifiers for the dependency types
std::vector<std::pair<std::string, dependencyType>> dependency_types = {
const std::vector<std::pair<std::string, dependencyType>> dependency_types = {
{"", dependencyType::NORMAL},
{"_change", dependencyType::CHANGE},
{"_old_1", dependencyType::OLD_1 },
Expand All @@ -56,7 +58,7 @@ variableAttributes::parse_dependencies(AttributesList &other_var_attributes)
};

// Dependency evaluation types & their corresponding evaluation flag
std::vector<std::pair<std::string, EvalFlags>> eval_flags = {
const std::vector<std::pair<std::string, EvalFlags>> eval_flags = {
{"value", dealii::EvaluationFlags::values },
{"gradient", dealii::EvaluationFlags::gradients},
{"hessian", dealii::EvaluationFlags::hessians },
Expand All @@ -83,7 +85,7 @@ variableAttributes::parse_dependencies(AttributesList &other_var_attributes)
{
// Delimiters for the dependency types. Note that there are
// various overloads for the delimiters.
std::vector<std::pair<std::string, std::pair<std::string, std::string>>>
const std::vector<std::pair<std::string, std::pair<std::string, std::string>>>
dependency_types_delimiters = {
{"", {"", ""} },
{"_change", {"change(", ")"}},
Expand All @@ -94,7 +96,7 @@ variableAttributes::parse_dependencies(AttributesList &other_var_attributes)
};

// Dependency evaluation types & their corresponding delimiter.
std::vector<std::pair<std::string, std::pair<std::string, std::string>>>
const std::vector<std::pair<std::string, std::pair<std::string, std::string>>>
base_delimiters = {
{"value", {"", ""} },
{"gradient", {"grad(", ")"} },
Expand Down Expand Up @@ -141,12 +143,12 @@ variableAttributes::parse_dependencies(AttributesList &other_var_attributes)
// Populate the dependencies
if (dependencies.find(possible_dependency) != dependencies.end())
{
dependencyType dep_type = relevant_flag.at(variation).first;
EvalFlags flags = relevant_flag.at(variation).second;
const dependencyType dep_type = relevant_flag.at(variation).first;
const EvalFlags flags = relevant_flag.at(variation).second;

validate_dependency(variation, dep_type, other_index, context);

std::pair<uint, dependencyType> key = {other_index, dep_type};
const std::pair<uint, dependencyType> key = {other_index, dep_type};

if (eval_flag_set.find(key) != eval_flag_set.end())
{
Expand Down Expand Up @@ -349,6 +351,8 @@ variableAttributes::find_circular_dependencies(const AttributesList &other_var_a
recursive_DFS(other_var_attributes, visited, current_stack, field_index);
}

// NOLINTBEGIN(misc-no-recursion)

void
variableAttributes::recursive_DFS(const AttributesList &other_var_attributes,
std::set<uint> &visited,
Expand Down Expand Up @@ -378,3 +382,5 @@ variableAttributes::recursive_DFS(const AttributesList &other_var_attributes,
// Remove the node from the current recursion stack
current_stack.erase(vertex);
}

// NOLINTEND(misc-no-recursion)

0 comments on commit cabbcf7

Please sign in to comment.