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

Remove unnessesary top level curly braces in the world builder file. #38

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
9 changes: 8 additions & 1 deletion source/parameters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <fstream>
#include <sstream>
#include <vector>
#include <tuple>

Expand Down Expand Up @@ -46,7 +47,13 @@ namespace WorldBuilder
// Now read in the world builder file into a file stream and
// put it into a boost property tree.
std::ifstream json_input_stream(filename.c_str());
boost::property_tree::json_parser::read_json (json_input_stream, tree);
std::stringstream json_fixed_input_stream;

WBAssert(json_input_stream, "Could not read the world builder file.");
json_fixed_input_stream << "{" << json_input_stream.rdbuf() << "}";
json_input_stream.close();

boost::property_tree::json_parser::read_json (json_fixed_input_stream, tree);
local_tree = &tree;
}

Expand Down
16 changes: 7 additions & 9 deletions tests/app/app_spherical.wb
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"Cross section": [[100e3,100e3],[400e3,500e3]],
"Coordinate system":{"spherical":{"depth method":"starting point"}},
"Surface rotation point": ["0","0"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Cross section": [[100e3,100e3],[400e3,500e3]],
"Coordinate system":{"spherical":{"depth method":"starting point"}},
"Surface rotation point": ["0","0"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Continental plate":{"name":"Carribean","coordinates":[[-125,50],[-60,50],[-60,25],[-125,25]],
"temperature submodule":{"name":"constant", "depth":250e3, "temperature":10},
"composition submodule":{"name":"constant", "depth":250e3, "composition":1}},
Expand All @@ -30,5 +29,4 @@
"Continental plate":{"name":"Equator","coordinates":[[-90,-7.5],[-90,7.5],[360,7.5],[360,-7.5]],
"temperature submodule":{"name":"constant", "depth":250e3, "temperature":60},
"composition submodule":{"name":"constant", "depth":250e3, "composition":6}}
}
}
17 changes: 7 additions & 10 deletions tests/app/app_wb1.wb
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"Cross section": [[100e3,100e3],[400e3,500e3]],
"Coordinate system":{"Cartesian":{}},
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Cross section": [[100e3,100e3],[400e3,500e3]],
"Coordinate system":{"Cartesian":{}},
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Continental plate":{"name":"Carribean","coordinates":[[-1e3,500e3],[500e3,500e3],[500e3,1000e3],[-1e3,1000e3]],
"temperature submodule":{"name":"constant", "depth":250e3, "temperature":150},
"composition submodule":{"name":"none"}},
Expand All @@ -18,6 +17,4 @@
"Continental plate":{"name":"Carribean2","coordinates":[[-1e3,500e3],[500e3,500e3],[500e3,1000e3],[-1e3,1000e3]],
"temperature submodule":{"name":"none", "depth":250e3, "temperature":150},
"composition submodule":{"name":"constant", "depth":250e3, "composition":3}}

}
}
13 changes: 5 additions & 8 deletions tests/app/app_wb2.wb
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Continental plate":{"name":"Carribean","coordinates":[[-1e3,500e3],[500e3,500e3],[500e3,1000e3],[-1e3,1000e3]],
"temperature submodule":{"name":"constant", "depth":250e3, "temperature":150},
"composition submodule":{"name":"none"}},
Expand All @@ -16,6 +15,4 @@
"Continental Plate":{"name":"Carribean2","coordinates":[[-1e3,500e3],[500e3,500e3],[500e3,1000e3],[-1e3,1000e3]],
"temperature submodule":{"name":"none", "depth":250e3, "temperature":150},
"composition submodule":{"name":"constant", "depth":250e3, "composition":3}}

}
}
13 changes: 5 additions & 8 deletions tests/app/app_wb3.wb
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Continental plate":{"name":"Carribean","coordinates":[[-1e3,500e3],[500e3,500e3],[500e3,1000e3],[-1e3,1000e3]],
"temperature submodule":{"name":"constant", "depth":250e3, "temperature":150},
"composition submodule":{"name":"none"}},
Expand All @@ -16,6 +15,4 @@
"Continental Plate":{"name":"Carribean2","coordinates":[[-1e3,500e3],[500e3,500e3],[500e3,1000e3],[-1e3,1000e3]],
"temperature submodule":{"name":"none", "depth":250e3, "temperature":150},
"composition submodule":{"name":"constant", "depth":250e3, "composition":3}}

}
}
52 changes: 25 additions & 27 deletions tests/data/continental_plate.wb
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
"Cross section": [[100e3,100e3],[400e3,500e3]],
"Coordinate system":{"cartesian":{}},
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Cross section": [[100e3,100e3],[400e3,500e3]],
"Coordinate system":{"cartesian":{}},
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Continental plate":{"name":"First continental plate","coordinates":[[-1e3,500e3],[500e3,500e3],[500e3,1000e3],[-1e3,1000e3]],
"temperature submodule":{"name":"constant", "depth":250e3, "temperature":150},
"composition submodule":{"name":"none"}},
"Continental plate":{"name":"First continental plate","coordinates":[[-1e3,500e3],[500e3,500e3],[500e3,1000e3],[-1e3,1000e3]],
"temperature submodule":{"name":"constant", "depth":250e3, "temperature":150},
"composition submodule":{"name":"none"}},

"Continental Plate":{"name":"Second continental plate", "coordinates":[[2000e3,2000e3],[1000e3,2000e3],[1000e3,1000e3],[2000e3,1000e3]],
"temperature submodule":{"name":"constant", "depth":250e3, "temperature":20},
"composition submodule":{"name":"constant", "depth":250e3, "composition":2}},
"Continental Plate":{"name":"Second continental plate", "coordinates":[[2000e3,2000e3],[1000e3,2000e3],[1000e3,1000e3],[2000e3,1000e3]],
"temperature submodule":{"name":"constant", "depth":250e3, "temperature":20},
"composition submodule":{"name":"constant", "depth":250e3, "composition":2}},

"Continental plate":{"name":"Third continental plate","coordinates":[[-1e3,500e3],[500e3,500e3],[500e3,1000e3],[-1e3,1000e3]],
"temperature submodule":{"name":"none", "depth":250e3, "temperature":150},
"composition submodule":{"name":"constant", "depth":250e3, "composition":3}},
"Continental plate":{"name":"Third continental plate","coordinates":[[-1e3,500e3],[500e3,500e3],[500e3,1000e3],[-1e3,1000e3]],
"temperature submodule":{"name":"none", "depth":250e3, "temperature":150},
"composition submodule":{"name":"constant", "depth":250e3, "composition":3}},

"Continental plate":{"name":"Fourth continental plate","coordinates":[[-1e3,1500e3],[500e3,1500e3],[500e3,2000e3],[-1e3,2000e3]],
"temperature submodule":{"name":"linear", "depth":250e3},
"composition submodule":{"name":"constant", "depth":250e3, "composition":4}},
"Continental plate":{"name":"Fourth continental plate","coordinates":[[-1e3,1500e3],[500e3,1500e3],[500e3,2000e3],[-1e3,2000e3]],
"temperature submodule":{"name":"linear", "depth":250e3},
"composition submodule":{"name":"constant", "depth":250e3, "composition":4}},

"Continental plate":{"name":"Fifth continental plate","coordinates":[[500e3,-1e3],[500e3,500e3],[1000e3,500e3],[1000e3,-1e3]],
"temperature submodule":{"name":"linear", "depth":250e3, "top temperature":10, "bottom temperature":50},
"composition submodule":{"name":"constant", "depth":250e3, "composition":5}},
"Continental plate":{"name":"Fifth continental plate","coordinates":[[500e3,-1e3],[500e3,500e3],[1000e3,500e3],[1000e3,-1e3]],
"temperature submodule":{"name":"linear", "depth":250e3, "top temperature":10, "bottom temperature":50},
"composition submodule":{"name":"constant", "depth":250e3, "composition":5}},

"Continental plate":{"name":"Sixth continental plate","coordinates":[[1250e3,-1e3],[1250e3,500e3],[1750e3,500e3],[1750e3,-1e3]],
"temperature submodule":{"name":"linear", "depth":250e3, "top temperature":10, "bottom temperature":50},
"composition submodule":{"name":"constant layers", "depth":250e3, "layers":[{"composition":6, "thickness":75e3},{"composition":7, "thickness":75e3},{"composition":8, "thickness":75e3}]}}
"Continental plate":{"name":"Sixth continental plate","coordinates":[[1250e3,-1e3],[1250e3,500e3],[1750e3,500e3],[1750e3,-1e3]],
"temperature submodule":{"name":"linear", "depth":250e3, "top temperature":10, "bottom temperature":50},
"composition submodule":{"name":"constant layers", "depth":250e3, "layers":[{"composition":6, "thickness":75e3},{"composition":7, "thickness":75e3},{"composition":8, "thickness":75e3}]}}

}
}
59 changes: 28 additions & 31 deletions tests/data/oceanic_plate_cartesian.wb
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
"Cross section": [[100e3,100e3],[400e3,500e3]],
"Coordinate system":{"cartesian":{}},
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Cross section": [[100e3,100e3],[400e3,500e3]],
"Coordinate system":{"cartesian":{}},
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Oceanic plate":{"name":"First oceanic plate","coordinates":[[-1e3,500e3],[500e3,500e3],[500e3,1000e3],[-1e3,1000e3]],
"temperature submodule":{"name":"constant", "depth":250e3, "temperature":150},
"composition submodule":{"name":"none"}},
"Oceanic plate":{"name":"First oceanic plate","coordinates":[[-1e3,500e3],[500e3,500e3],[500e3,1000e3],[-1e3,1000e3]],
"temperature submodule":{"name":"constant", "depth":250e3, "temperature":150},
"composition submodule":{"name":"none"}},

"Oceanic Plate":{"name":"Second oceanic plate", "coordinates":[[2000e3,2000e3],[1000e3,2000e3],[1000e3,1000e3],[2000e3,1000e3]],
"temperature submodule":{"name":"constant", "depth":250e3, "temperature":20},
"composition submodule":{"name":"constant", "depth":250e3, "composition":2}},
"Oceanic Plate":{"name":"Second oceanic plate", "coordinates":[[2000e3,2000e3],[1000e3,2000e3],[1000e3,1000e3],[2000e3,1000e3]],
"temperature submodule":{"name":"constant", "depth":250e3, "temperature":20},
"composition submodule":{"name":"constant", "depth":250e3, "composition":2}},

"Oceanic plate":{"name":"Third oceanic plate","coordinates":[[-1e3,500e3],[500e3,500e3],[500e3,1000e3],[-1e3,1000e3]],
"temperature submodule":{"name":"none", "depth":250e3, "temperature":150},
"composition submodule":{"name":"constant", "depth":250e3, "composition":3}},
"Oceanic plate":{"name":"Third oceanic plate","coordinates":[[-1e3,500e3],[500e3,500e3],[500e3,1000e3],[-1e3,1000e3]],
"temperature submodule":{"name":"none", "depth":250e3, "temperature":150},
"composition submodule":{"name":"constant", "depth":250e3, "composition":3}},

"Oceanic plate":{"name":"Fourth oceanic plate","coordinates":[[-1e3,1500e3],[500e3,1500e3],[500e3,2000e3],[-1e3,2000e3]],
"temperature submodule":{"name":"linear", "depth":250e3},
"composition submodule":{"name":"constant", "depth":250e3, "composition":4}},
"Oceanic plate":{"name":"Fourth oceanic plate","coordinates":[[-1e3,1500e3],[500e3,1500e3],[500e3,2000e3],[-1e3,2000e3]],
"temperature submodule":{"name":"linear", "depth":250e3},
"composition submodule":{"name":"constant", "depth":250e3, "composition":4}},

"Oceanic plate":{"name":"Fifth oceanic plate","coordinates":[[500e3,-1e3],[500e3,500e3],[1000e3,500e3],[1000e3,-1e3]],
"temperature submodule":{"name":"linear", "depth":250e3, "top temperature":10, "bottom temperature":50},
"composition submodule":{"name":"constant", "depth":250e3, "composition":5}},
"Oceanic plate":{"name":"Fifth oceanic plate","coordinates":[[500e3,-1e3],[500e3,500e3],[1000e3,500e3],[1000e3,-1e3]],
"temperature submodule":{"name":"linear", "depth":250e3, "top temperature":10, "bottom temperature":50},
"composition submodule":{"name":"constant", "depth":250e3, "composition":5}},

"Oceanic plate":{"name":"Sixth oceanic plate","coordinates":[[1100e3,-1e3],[1100e3,750e3],[2500e3,750e3],[2500e3,-1e3]],
"temperature submodule":{"name":"plate model", "depth":250e3, "spreading velocity":0.01, "ridge points":[[1500e3,-1e3],[1500e3,750e3]]},
"composition submodule":{"name":"none"}},

"Oceanic plate":{"name":"Seventh oceanic plate","coordinates":[[50e3,-1e3],[400e3,-1e3],[400e3,400e3],[50e3,400e3]],
"temperature submodule":{"name":"plate model", "depth":250e3, "spreading velocity":0.01, "ridge points":[[1500e3,-1e3],[1500e3,750e3]]},
"composition submodule":{"name":"constant layers", "depth":250e3, "layers":[{"composition":6, "thickness":75e3},{"composition":7, "thickness":75e3},{"composition":8, "thickness":75e3}]}}
"Oceanic plate":{"name":"Sixth oceanic plate","coordinates":[[1100e3,-1e3],[1100e3,750e3],[2500e3,750e3],[2500e3,-1e3]],
"temperature submodule":{"name":"plate model", "depth":250e3, "spreading velocity":0.01, "ridge points":[[1500e3,-1e3],[1500e3,750e3]]},
"composition submodule":{"name":"none"}},

"Oceanic plate":{"name":"Seventh oceanic plate","coordinates":[[50e3,-1e3],[400e3,-1e3],[400e3,400e3],[50e3,400e3]],
"temperature submodule":{"name":"plate model", "depth":250e3, "spreading velocity":0.01, "ridge points":[[1500e3,-1e3],[1500e3,750e3]]},
"composition submodule":{"name":"constant layers", "depth":250e3, "layers":[{"composition":6, "thickness":75e3},{"composition":7, "thickness":75e3},{"composition":8, "thickness":75e3}]}}
}
}
16 changes: 7 additions & 9 deletions tests/data/oceanic_plate_spherical.wb
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"Cross section": [[100e3,100e3],[400e3,500e3]],
"Coordinate system":{"spherical":{"depth method":"starting point"}},
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Cross section": [[100e3,100e3],[400e3,500e3]],
"Coordinate system":{"spherical":{"depth method":"starting point"}},
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Oceanic plate":{"name":"First oceanic plate","coordinates":[[-10,-10],[-1,-10],[-1,-1],[-10,-1]],
"temperature submodule":{"name":"constant", "depth":250e3, "temperature":150},
"composition submodule":{"name":"none"}},
Expand All @@ -31,5 +30,4 @@
"temperature submodule":{"name":"plate model", "depth":250e3, "spreading velocity":0.01, "ridge points":[[15,-20],[15,-15],[10,-10]]},
"composition submodule":{"name":"constant", "depth":250e3, "composition":6}}

}
}
16 changes: 7 additions & 9 deletions tests/data/simple_wb1.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"Cross section": [[100e3,100e3],[400e3,500e3]],
"Coordinate system":{"cartesian":{}},
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Cross section": [[100e3,100e3],[400e3,500e3]],
"Coordinate system":{"cartesian":{}},
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Continental plate":{"name":"Carribean","coordinates":[[-1e3,500e3],[500e3,500e3],[500e3,1000e3],[-1e3,1000e3]],
"temperature submodule":{"name":"constant", "depth":250e3, "temperature":150},
"composition submodule":{"name":"none"}},
Expand All @@ -19,5 +18,4 @@
"temperature submodule":{"name":"none", "depth":250e3, "temperature":150},
"composition submodule":{"name":"constant", "depth":250e3, "composition":3}}

}
}
12 changes: 5 additions & 7 deletions tests/data/simple_wb2.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Continental plate":{"name":"Carribean","coordinates":[[-1e3,500e3],[500e3,500e3],[500e3,1000e3],[-1e3,1000e3]],
"temperature submodule":{"name":"constant", "depth":250e3, "temperature":150},
"composition submodule":{"name":"none"}},
Expand All @@ -17,5 +16,4 @@
"temperature submodule":{"name":"none", "depth":250e3, "temperature":150},
"composition submodule":{"name":"constant", "depth":250e3, "composition":3}}

}
}
12 changes: 5 additions & 7 deletions tests/data/simple_wb3.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Continental plate":{"name":"Carribean","coordinates":[[-1e3,500e3],[500e3,500e3],[500e3,1000e3],[-1e3,1000e3]],
"temperature submodule":{"name":"constant", "depth":250e3, "temperature":150},
"composition submodule":{"name":"none"}},
Expand All @@ -17,5 +16,4 @@
"temperature submodule":{"name":"none", "depth":250e3, "temperature":150},
"composition submodule":{"name":"constant", "depth":250e3, "composition":3}}

}
}
16 changes: 7 additions & 9 deletions tests/data/subducting_plate_constant_angles_cartesian.wb
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"Cross section": [[100e3,100e3],[400e3,500e3]],
"Coordinate system":{"cartesian":{}},
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Cross section": [[100e3,100e3],[400e3,500e3]],
"Coordinate system":{"cartesian":{}},
"Surface rotation point": ["165e3","166e3"],
"Surface rotation angle": "0",
"Minimum parts per distance unit": 5,
"Minimum distance points": 1e-5,
"Surface objects":
{
"Subducting plate":{"name":"First subducting plate", "coordinates":[[0e3,500e3],[500e3,500e3],[1000e3,750e3]], "reference point":[1200e3,1200e3],
"starting depth":0, "max depth":1e10,
"segments":
Expand All @@ -27,5 +26,4 @@
},
"temperature submodule":{"name":"plate model", "density":3300, "plate velocity":0.01 },
"composition submodule":{"name":"constant layers", "layers":[{"composition":0, "thickness":33e3},{"composition":1, "thickness":33e3},{"composition":2, "thickness":33e3}]}}
}
}
Loading