Skip to content

Commit

Permalink
clang-tidy misc-*,mpi-* and selected readability-*
Browse files Browse the repository at this point in the history
  • Loading branch information
MFraters committed Jun 27, 2021
1 parent 4db3cd1 commit ca0e0d9
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions source/features/continental_plate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ namespace WorldBuilder
Utilities::polygon_contains_point(coordinates, Point<2>(natural_coordinate.get_surface_coordinates(),
world->parameters.coordinate_system->natural_coordinate_system())))
{
for (auto &temperature_model: temperature_models)
for (const auto &temperature_model: temperature_models)
{
temperature = temperature_model->get_temperature(position,
depth,
Expand Down Expand Up @@ -182,7 +182,7 @@ namespace WorldBuilder
Utilities::polygon_contains_point(coordinates, Point<2>(natural_coordinate.get_surface_coordinates(),
world->parameters.coordinate_system->natural_coordinate_system())))
{
for (auto &composition_model: composition_models)
for (const auto &composition_model: composition_models)
{
composition = composition_model->get_composition(position,
depth,
Expand Down Expand Up @@ -215,7 +215,7 @@ namespace WorldBuilder
Utilities::polygon_contains_point(coordinates, Point<2>(natural_coordinate.get_surface_coordinates(),
world->parameters.coordinate_system->natural_coordinate_system())))
{
for (auto &grains_model: grains_models)
for (const auto &grains_model: grains_models)
{
grains = grains_model->get_grains(position,
depth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ namespace WorldBuilder
double r = std::sqrt( z );
double Vx = std::sin( phi ) * r;
double Vy = std::cos( phi ) * r;
double Vz = std::sqrt( 2.f - z );
double Vz = std::sqrt( 2.F - z );

// Compute the row vector S = Transpose(V) * R, where R is a simple
// rotation by theta about the z-axis. No need to compute Sz since
Expand Down
12 changes: 6 additions & 6 deletions source/features/fault.cc
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ namespace WorldBuilder
double temperature_current_section = temperature;
double temperature_next_section = temperature;

for (auto &temperature_model: segment_vector[current_section][current_segment].temperature_systems)
for (const auto &temperature_model: segment_vector[current_section][current_segment].temperature_systems)
{
temperature_current_section = temperature_model->get_temperature(position,
depth,
Expand All @@ -450,7 +450,7 @@ namespace WorldBuilder
<< ", based on a temperature model with the name " << temperature_model->get_name());
}

for (auto &temperature_model: segment_vector[next_section][current_segment].temperature_systems)
for (const auto &temperature_model: segment_vector[next_section][current_segment].temperature_systems)
{
temperature_next_section = temperature_model->get_temperature(position,
depth,
Expand Down Expand Up @@ -566,7 +566,7 @@ namespace WorldBuilder
double composition_current_section = composition;
double composition_next_section = composition;

for (auto &composition_model: segment_vector[current_section][current_segment].composition_systems)
for (const auto &composition_model: segment_vector[current_section][current_segment].composition_systems)
{
composition_current_section = composition_model->get_composition(position,
depth,
Expand All @@ -583,7 +583,7 @@ namespace WorldBuilder

}

for (auto &composition_model: segment_vector[next_section][current_segment].composition_systems)
for (const auto &composition_model: segment_vector[next_section][current_segment].composition_systems)
{
composition_next_section = composition_model->get_composition(position,
depth,
Expand Down Expand Up @@ -700,7 +700,7 @@ namespace WorldBuilder
WorldBuilder::grains grains_current_section = grains;
WorldBuilder::grains grains_next_section = grains;

for (auto &grains_model: segment_vector[current_section][current_segment].grains_systems)
for (const auto &grains_model: segment_vector[current_section][current_segment].grains_systems)
{
grains_current_section = grains_model->get_grains(position,
depth,
Expand All @@ -717,7 +717,7 @@ namespace WorldBuilder

}

for (auto &grains_model: segment_vector[next_section][current_segment].grains_systems)
for (const auto &grains_model: segment_vector[next_section][current_segment].grains_systems)
{
grains_next_section = grains_model->get_grains(position,
depth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ namespace WorldBuilder
double r = std::sqrt( z );
double Vx = std::sin( phi ) * r;
double Vy = std::cos( phi ) * r;
double Vz = std::sqrt( 2.f - z );
double Vz = std::sqrt( 2.F - z );

// Compute the row vector S = Transpose(V) * R, where R is a simple
// rotation by theta about the z-axis. No need to compute Sz since
Expand Down
6 changes: 3 additions & 3 deletions source/features/mantle_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ namespace WorldBuilder
WorldBuilder::Utilities::polygon_contains_point(coordinates, Point<2>(natural_coordinate.get_surface_coordinates(),
world->parameters.coordinate_system->natural_coordinate_system())))
{
for (auto &temperature_model: temperature_models)
for (const auto &temperature_model: temperature_models)
{
temperature = temperature_model->get_temperature(position,
depth,
Expand Down Expand Up @@ -174,7 +174,7 @@ namespace WorldBuilder
WorldBuilder::Utilities::polygon_contains_point(coordinates, Point<2>(natural_coordinate.get_surface_coordinates(),
world->parameters.coordinate_system->natural_coordinate_system())))
{
for (auto &composition_model: composition_models)
for (const auto &composition_model: composition_models)
{
composition = composition_model->get_composition(position,
depth,
Expand Down Expand Up @@ -209,7 +209,7 @@ namespace WorldBuilder
WorldBuilder::Utilities::polygon_contains_point(coordinates, Point<2>(natural_coordinate.get_surface_coordinates(),
world->parameters.coordinate_system->natural_coordinate_system())))
{
for (auto &grains_model: grains_models)
for (const auto &grains_model: grains_models)
{
grains = grains_model->get_grains(position,
depth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ namespace WorldBuilder
double r = std::sqrt( z );
double Vx = std::sin( phi ) * r;
double Vy = std::cos( phi ) * r;
double Vz = std::sqrt( 2.f - z );
double Vz = std::sqrt( 2.F - z );

// Compute the row vector S = Transpose(V) * R, where R is a simple
// rotation by theta about the z-axis. No need to compute Sz since
Expand Down
6 changes: 3 additions & 3 deletions source/features/oceanic_plate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ namespace WorldBuilder
WorldBuilder::Utilities::polygon_contains_point(coordinates, Point<2>(natural_coordinate.get_surface_coordinates(),
world->parameters.coordinate_system->natural_coordinate_system())))
{
for (auto &temperature_model: temperature_models)
for (const auto &temperature_model: temperature_models)
{
temperature = temperature_model->get_temperature(position,
depth,
Expand Down Expand Up @@ -182,7 +182,7 @@ namespace WorldBuilder
WorldBuilder::Utilities::polygon_contains_point(coordinates, Point<2>(natural_coordinate.get_surface_coordinates(),
world->parameters.coordinate_system->natural_coordinate_system())))
{
for (auto &composition_model: composition_models)
for (const auto &composition_model: composition_models)
{
composition = composition_model->get_composition(position,
depth,
Expand Down Expand Up @@ -215,7 +215,7 @@ namespace WorldBuilder
WorldBuilder::Utilities::polygon_contains_point(coordinates, Point<2>(natural_coordinate.get_surface_coordinates(),
world->parameters.coordinate_system->natural_coordinate_system())))
{
for (auto &grains_model: grains_models)
for (const auto &grains_model: grains_models)
{
grains = grains_model->get_grains(position,
depth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ namespace WorldBuilder
double r = std::sqrt( z );
double Vx = std::sin( phi ) * r;
double Vy = std::cos( phi ) * r;
double Vz = std::sqrt( 2.f - z );
double Vz = std::sqrt( 2.F - z );

// Compute the row vector S = Transpose(V) * R, where R is a simple
// rotation by theta about the z-axis. No need to compute Sz since
Expand Down
12 changes: 6 additions & 6 deletions source/features/subducting_plate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ namespace WorldBuilder
double temperature_current_section = temperature;
double temperature_next_section = temperature;

for (auto &temperature_model: segment_vector[current_section][current_segment].temperature_systems)
for (const auto &temperature_model: segment_vector[current_section][current_segment].temperature_systems)
{
temperature_current_section = temperature_model->get_temperature(position,
depth,
Expand All @@ -467,7 +467,7 @@ namespace WorldBuilder

}

for (auto &temperature_model: segment_vector[next_section][current_segment].temperature_systems)
for (const auto &temperature_model: segment_vector[next_section][current_segment].temperature_systems)
{
temperature_next_section = temperature_model->get_temperature(position,
depth,
Expand Down Expand Up @@ -579,7 +579,7 @@ namespace WorldBuilder
double composition_current_section = composition;
double composition_next_section = composition;

for (auto &composition_model: segment_vector[current_section][current_segment].composition_systems)
for (const auto &composition_model: segment_vector[current_section][current_segment].composition_systems)
{
composition_current_section = composition_model->get_composition(position,
depth,
Expand All @@ -596,7 +596,7 @@ namespace WorldBuilder

}

for (auto &composition_model: segment_vector[next_section][current_segment].composition_systems)
for (const auto &composition_model: segment_vector[next_section][current_segment].composition_systems)
{
composition_next_section = composition_model->get_composition(position,
depth,
Expand Down Expand Up @@ -711,7 +711,7 @@ namespace WorldBuilder
WorldBuilder::grains grains_current_section = grains;
WorldBuilder::grains grains_next_section = grains;

for (auto &grains_model: segment_vector[current_section][current_segment].grains_systems)
for (const auto &grains_model: segment_vector[current_section][current_segment].grains_systems)
{
grains_current_section = grains_model->get_grains(position,
depth,
Expand All @@ -728,7 +728,7 @@ namespace WorldBuilder

}

for (auto &grains_model: segment_vector[next_section][current_segment].grains_systems)
for (const auto &grains_model: segment_vector[next_section][current_segment].grains_systems)
{
grains_next_section = grains_model->get_grains(position,
depth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ namespace WorldBuilder
double r = std::sqrt( z );
double Vx = std::sin( phi ) * r;
double Vy = std::cos( phi ) * r;
double Vz = std::sqrt( 2.f - z );
double Vz = std::sqrt( 2.F - z );

// Compute the row vector S = Transpose(V) * R, where R is a simple
// rotation by theta about the z-axis. No need to compute Sz since
Expand Down
2 changes: 1 addition & 1 deletion source/parameters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ namespace WorldBuilder
const std::vector<std::tuple<std::string,const WorldBuilder::Types::Interface &, std::string> > &extra_declarations)
{
unsigned int counter = 0;
for (auto &it : declare_map)
for (const auto &it : declare_map)
{
typedef std::tuple<std::string,const WorldBuilder::Types::Interface &, std::string> DeclareEntry;
// prevent infinite recursion
Expand Down
2 changes: 1 addition & 1 deletion source/utilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ namespace WorldBuilder
const std::vector<double> &y,
bool monotone_spline)
{
WBAssert(x.size() != 0, "Internal error: The x in the set points function is zero.");
WBAssert(!x.empty(), "Internal error: The x in the set points function is zero.");
assert(x.size() == y.size());
m_x = x;
m_y = y;
Expand Down

0 comments on commit ca0e0d9

Please sign in to comment.