Skip to content

Commit

Permalink
Merge pull request #655 from danieldouglas92/remove_unnecessary_code
Browse files Browse the repository at this point in the history
Reduce unnecessary code and fix a typo
  • Loading branch information
MFraters authored Feb 17, 2024
2 parents 6678d19 + d134665 commit 6fc135f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,11 @@ namespace WorldBuilder
ridge_coordinate *= dtr;
}

unsigned int index_x = 0;
unsigned int index_y = 0;
unsigned int ridge_point_index = 0;
for (index_x = 0; index_x < mid_oceanic_ridges.size(); index_x++)
for (unsigned int index_x = 0; index_x < mid_oceanic_ridges.size(); index_x++)
{
std::vector<double> spreading_rates_for_ridge;
for (index_y = 0; index_y < mid_oceanic_ridges[index_x].size(); index_y++)
for (unsigned int index_y = 0; index_y < mid_oceanic_ridges[index_x].size(); index_y++)
{
if (spreading_velocities.second.size() <= 1)
spreading_rates_for_ridge.push_back(spreading_velocities.first[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,11 @@ namespace WorldBuilder
ridge_coordinate *= dtr;
}

unsigned int index_x = 0;
unsigned int index_y = 0;
unsigned int ridge_point_index = 0;
for (index_x = 0; index_x < mid_oceanic_ridges.size(); index_x++)
for (unsigned int index_x = 0; index_x < mid_oceanic_ridges.size(); index_x++)
{
std::vector<double> spreading_rates_for_ridge;
for (index_y = 0; index_y < mid_oceanic_ridges[index_x].size(); index_y++)
for (unsigned int index_y = 0; index_y < mid_oceanic_ridges[index_x].size(); index_y++)
{
if (spreading_velocities.second.size() <= 1)
spreading_rates_for_ridge.push_back(spreading_velocities.first[0]);
Expand Down Expand Up @@ -158,7 +156,7 @@ namespace WorldBuilder
this->world->specific_heat) * depth);
}

const int sommation_number = 100;
const int summation_number = 100;

std::pair<double, double> ridge_parameters = Utilities::calculate_ridge_distance_and_spreading(mid_oceanic_ridges,
spreading_velocities_at_each_ridge_point,
Expand All @@ -171,7 +169,7 @@ namespace WorldBuilder

// This formula addresses the horizontal heat transfer by having the spreading velocity and distance to the ridge in it.
// (Chapter 7 Heat, Fowler M. The solid earth: an introduction to global geophysics[M]. Cambridge University Press, 1990)
for (int i = 1; i<sommation_number+1; ++i)
for (int i = 1; i<summation_number+1; ++i)
{
temperature = temperature + (bottom_temperature_local - top_temperature) *
((2 / (double(i) * Consts::PI)) * std::sin((double(i) * Consts::PI * depth) / max_depth) *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,11 @@ namespace WorldBuilder
ridge_coordinate *= dtr;
}

unsigned int index_x = 0;
unsigned int index_y = 0;
unsigned int ridge_point_index = 0;
for (index_x = 0; index_x < mid_oceanic_ridges.size(); index_x++)
for (unsigned int index_x = 0; index_x < mid_oceanic_ridges.size(); index_x++)
{
std::vector<double> plate_velocities_for_ridge;
for (index_y = 0; index_y < mid_oceanic_ridges[index_x].size(); index_y++)
for (unsigned int index_y = 0; index_y < mid_oceanic_ridges[index_x].size(); index_y++)
{
if (plate_velocities.second.size() <= 1)
plate_velocities_for_ridge.push_back(plate_velocities.first[0]);
Expand Down
4 changes: 2 additions & 2 deletions source/world_builder/utilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,7 @@ namespace WorldBuilder
else
{
Pb1=segment_point0 + (c1 / c) * v;
spreading_velocity_at_ridge = spreading_velocity_point0 + (spreading_velocity_point1 - spreading_velocity_point0) * (c1 / c) * 1;
spreading_velocity_at_ridge = spreading_velocity_point0 + (spreading_velocity_point1 - spreading_velocity_point0) * (c1 / c);
}

Point<2> Pb2(coordinate_system->natural_coordinate_system());
Expand All @@ -1375,7 +1375,7 @@ namespace WorldBuilder
else
{
Pb2=segment_point0 + (c1 / c) * v;
spreading_velocity_at_ridge = spreading_velocity_point0 + (spreading_velocity_point1 - spreading_velocity_point0) * (c1 / c) * 1;
spreading_velocity_at_ridge = spreading_velocity_point0 + (spreading_velocity_point1 - spreading_velocity_point0) * (c1 / c);
}

Point<3> compare_point1(coordinate_system->natural_coordinate_system());
Expand Down

0 comments on commit 6fc135f

Please sign in to comment.