Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce unnecessary code and fix a typo #655

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading