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

Fix Issues with Shifting of Insets to Position and String to Decimal Converter #218

Open
wants to merge 46 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
245e901
Shift original insets to position
nihalzp Nov 17, 2024
5b989f0
Calculate bbox on transformed original insets
nihalzp Nov 17, 2024
a3e19b9
Show ERROR output in a single line
nihalzp Nov 17, 2024
e493c85
Calculate inset area on transformed original coordinates
nihalzp Nov 17, 2024
76495a5
Use boost's own cmake.config (Fixes #223)
adisidev Nov 29, 2024
f0536c9
Remove Redundant Negative for Check Unsigned Char
adisidev Nov 29, 2024
d291175
Use "none" as default if no csv is provided
nihalzp Dec 2, 2024
d8d6872
Allow only geojson file for equal area map
nihalzp Dec 2, 2024
08761ee
Avoid potential division by zero when no csv is provided
nihalzp Dec 2, 2024
63dabb7
Add GeoDiv method to update id
nihalzp Dec 2, 2024
073ae2b
Allow update of InsetState GeoDiv ids using id mapping
nihalzp Dec 2, 2024
5e2d047
Use dump() when accesing nlohmann json string object
nihalzp Dec 2, 2024
47a2667
Only output the non simplified geosjon when equal area map is requested
nihalzp Dec 2, 2024
0c5c00c
Do not store csv file name in CartogramInfo
nihalzp Dec 2, 2024
b83a2b9
Parse GeoJSON before the CSV
nihalzp Dec 2, 2024
3f0cd84
Refactor read_geojson to remove dependency of csv
nihalzp Dec 2, 2024
41634e8
Refactor read_csv and handle the given inset position of GeoDivs
nihalzp Dec 2, 2024
5ff5b2b
Allows strip quotes when accessing nlohmann json string object
nihalzp Dec 2, 2024
bb44ca0
Merge branch 'main' into inset-fix
nihalzp Dec 2, 2024
89b589f
Improve and automate `benchmark.sh`
adisidev Dec 3, 2024
0a4a0ac
Merge pull request #224 from mgastner/improve-benchmark-sh
adisidev Dec 3, 2024
6dc2b26
Add instructions to install for WSL users
adisidev Dec 3, 2024
3b1ad37
Add benchmarking instructions
adisidev Dec 3, 2024
ac950c8
Move us_counties data to second column
adisidev Dec 3, 2024
5a240b6
Fix insets appearing too distant from each other
nihalzp Dec 3, 2024
41ce02e
Revamp the logic of parser
nihalzp Dec 3, 2024
c7dd6f3
Integrate new target area parser
nihalzp Dec 3, 2024
3fa6e02
Remove deprecated tests
nihalzp Dec 3, 2024
03507bf
Use visual_variable_file_name
adisidev Dec 8, 2024
527f4c7
Handle empty target area in CSV
nihalzp Dec 9, 2024
409fc33
Write function parameter names in header files
nihalzp Dec 10, 2024
3046fd4
Add vector library
adisidev Dec 17, 2024
f7f9b5a
Calculate densities before quadtree construction
nihalzp Dec 17, 2024
07fc7e6
Merge remote-tracking branch 'origin/inset-fix' into inset-fix
adisidev Dec 18, 2024
7dff687
Add instructions to push changes to production
adisidev Dec 18, 2024
ae2baf5
Change CSV mismatch error to warning
adisidev Dec 18, 2024
64aed88
process_area_strs after checking validity
adisidev Dec 18, 2024
ab67eff
Add functions to scale, move and transform points
adisidev Dec 18, 2024
2009185
Create function to write all insets as an svg
adisidev Dec 18, 2024
6bec777
When creating CSV, base it on GeoJSON name
adisidev Dec 18, 2024
e9de287
Use transform_points function instead of long loop
adisidev Dec 18, 2024
c8920df
long_grid_side_length --> max_n_grid_rows_or_cols
adisidev Dec 23, 2024
118c861
long_grid_side_length --> max_n_grid_rows_or_cols
adisidev Dec 23, 2024
f44f74a
Merge branch 'inset-fix' of https://github.com/mgastner/cartogram-cpp…
adisidev Dec 23, 2024
0166544
Write unblurred density after creating quadtree
adisidev Dec 23, 2024
28b23e4
plot quadtree corners on density image
adisidev Dec 23, 2024
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
2 changes: 1 addition & 1 deletion include/cartogram_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CartogramInfo
std::map<std::string, InsetState> &ref_to_inset_states();
void replace_missing_and_zero_target_areas();
std::string set_map_name(const std::string &);
void shift_insets_to_target_position();
void shift_insets_to_target_position(bool = false);
nihalzp marked this conversation as resolved.
Show resolved Hide resolved
void write_csv(const std::string &csv_file_name);
void write_geojson(const std::string &, const std::string &, bool = false);
};
Expand Down
4 changes: 2 additions & 2 deletions include/inset_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class InsetState
unsigned int n_geo_divs() const;
unsigned long n_points() const;
unsigned int n_rings() const;
void normalize_inset_area(double total_cart_target_area, bool = false);
void normalize_inset_area(double, bool = false, bool = false);
nihalzp marked this conversation as resolved.
Show resolved Hide resolved
void normalize_target_area();
std::string pos() const;
void project();
Expand Down Expand Up @@ -240,7 +240,7 @@ class InsetState
void store_original_geo_divs();
double target_area_at(const std::string &) const;
bool target_area_is_missing(const std::string &) const;
double total_inset_area() const;
double total_inset_area(bool = false) const;
double total_target_area() const;
Polygon transform_to_equal_area_projection_coor(Polygon edge_points);
std::array<Point, 3> transformed_triangle(
Expand Down
12 changes: 6 additions & 6 deletions src/cartogram_info/read_csv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ void CartogramInfo::read_csv(const argparse::ArgumentParser &arguments)
std::set<std::string> inset_pos_set;
for (auto &row : reader) {
if (row.size() < 2) {
std::cerr << "ERROR: CSV with >= 2 columns (IDs, target areas) required"
<< std::endl
<< "Some rows in your CSV may not have values for all columns"
<< std::endl;
std::cerr
<< "ERROR: CSV with >= 2 columns (IDs, target areas) required. Some "
"rows in your CSV may not have values for all columns"
<< std::endl;
_Exit(17);
}

Expand All @@ -79,9 +79,9 @@ void CartogramInfo::read_csv(const argparse::ArgumentParser &arguments)
}

if (!StringToDecimalConverter::is_str_valid_characters(area_as_str)) {
std::cerr << "ERROR: Invalid area string: " << area_as_str << std::endl;
std::cerr
<< "Area string must only contain 0-9, '.', '-' and ',' or 'NA'."
<< "ERROR: Invalid area string: " << area_as_str
<< ". Area string must only contain 0-9, '.', '-' and ',' or 'NA'."
<< std::endl;
_Exit(18);
}
Expand Down
39 changes: 26 additions & 13 deletions src/cartogram_info/read_geojson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ void CartogramInfo::read_geojson(
try {
in_file >> j;
} catch (nlohmann::json::parse_error &e) {
std::cerr << "ERROR: " << e.what() << ".\nexception id: " << e.id
<< "\nbyte position of error: " << e.byte << std::endl;
std::cerr << "ERROR: " << e.what() << ". Exception id: " << e.id
<< ". Byte position of error: " << e.byte << std::endl;
_Exit(3);
}
check_geojson_validity(j);
Expand Down Expand Up @@ -222,7 +222,7 @@ void CartogramInfo::read_geojson(
!properties.contains(id_header_) &&
!id_header_.empty()) { // Visual file not provided
std::cerr << "ERROR: In GeoJSON, there is no property " << id_header_
<< " in feature.\nAvailable properties are: " << properties
<< " in feature. Available properties are: " << properties
<< std::endl;
_Exit(16);
}
Expand Down Expand Up @@ -414,12 +414,18 @@ void CartogramInfo::read_geojson(
std::inserter(ids_not_in_geojson, ids_not_in_geojson.end()));
if (!ids_not_in_geojson.empty()) {
std::cerr << "ERROR: Mismatch between GeoJSON and "
<< visual_variable_file_ << "." << std::endl;
std::cerr << "The following IDs do not appear in the GeoJSON:"
<< std::endl;
for (const auto &id : ids_not_in_geojson) {
std::cerr << " " << id << std::endl;
<< visual_variable_file_
<< ". The following IDs do not appear in the GeoJSON: ";
std::vector<std::string> ids_not_in_geojson_vec(
ids_not_in_geojson.begin(),
ids_not_in_geojson.end());
for (size_t i = 0; i < ids_not_in_geojson_vec.size(); ++i) {
std::cerr << ids_not_in_geojson_vec[i];
if (i < ids_not_in_geojson_vec.size() - 1) {
std::cerr << ", ";
}
}
std::cerr << std::endl;
_Exit(20);
}

Expand All @@ -433,12 +439,19 @@ void CartogramInfo::read_geojson(
std::inserter(ids_not_in_vv, ids_not_in_vv.end()));
if (!ids_not_in_vv.empty()) {
std::cerr << "WARNING: Mismatch between GeoJSON and "
<< visual_variable_file_ << "." << std::endl;
std::cerr << "The following IDs do not appear in " << visual_variable_file_
<< ": " << std::endl;
for (const auto &id : ids_not_in_vv) {
std::cerr << " " << id << std::endl;
<< visual_variable_file_
<< ". The following IDs do not appear in "
<< visual_variable_file_ << ": ";
std::vector<std::string> ids_not_in_vv_vec(
ids_not_in_vv.begin(),
ids_not_in_vv.end());
for (size_t i = 0; i < ids_not_in_vv_vec.size(); ++i) {
std::cerr << ids_not_in_vv_vec[i];
if (i < ids_not_in_vv_vec.size() - 1) {
std::cerr << ", ";
}
}
std::cerr << std::endl;
// _Exit(21);
// TODO: Decide, is this an error, or warning?
}
Expand Down
6 changes: 3 additions & 3 deletions src/cartogram_info/shift_insets_to_position.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "cartogram_info.hpp"
#include "constants.hpp"

void CartogramInfo::shift_insets_to_target_position()
void CartogramInfo::shift_insets_to_target_position(bool output_to_stdout)
{
// For simplicity's sake, let us formally insert bounding boxes for
// all conceivable inset positions
Expand All @@ -13,7 +13,7 @@ void CartogramInfo::shift_insets_to_target_position()

// If the inset actually exists, we get its current bounding box
for (const auto &[inset_pos, inset_state] : inset_states_) {
bboxes.at(inset_pos) = inset_state.bbox();
bboxes.at(inset_pos) = inset_state.bbox(output_to_stdout);
}

// Calculate the width and height of all positioned insets without spacing
Expand Down Expand Up @@ -82,6 +82,6 @@ void CartogramInfo::shift_insets_to_target_position()
CGAL::Vector_2<Scd>(x, y));

// Apply translation to all points
inset_state.transform_points(translate);
inset_state.transform_points(translate, output_to_stdout);
}
}
2 changes: 1 addition & 1 deletion src/cartogram_info/write_geojson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ nlohmann::json CartogramInfo::cgal_to_json(

// Insert divider lines between all insets
for (const auto &[inset_pos, inset_state] : inset_states_) {
const Bbox inset_bb = inset_state.bbox();
const Bbox inset_bb = inset_state.bbox(original_geo_divs_to_geojson);
if (inset_pos == "T") {
divider_container.push_back(divider_points(
min_xmin_tcb,
Expand Down
19 changes: 11 additions & 8 deletions src/inset_state/check_topology.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ void InsetState::holes_inside_polygons() const
// "do_intersect(Polygon, Polygon)" may help.
if (ext_ring.bounded_side(p) == CGAL::ON_UNBOUNDED_SIDE) {
CGAL::set_pretty_mode(std::cerr);
std::cerr << "Hole detected outside polygon!" << std::endl;
std::cerr << "Hole: " << h << std::endl;
std::cerr << "Polygon: " << ext_ring << std::endl;
std::cerr << "GeoDiv: " << gd.id() << std::endl;
std::cerr << "ERROR: Hole detected outside polygon!";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change this to follow the style of the rest of our std::cerr statements.

That is:

std:cerr << "Error: Hole detected outside polygon! "
  << "ABC"
  << "XYZ"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I have added an issue for this.

std::cerr << " Hole: " << h;
std::cerr << ". Polygon: " << ext_ring;
std::cerr << ". GeoDiv: " << gd.id() << std::endl;
_Exit(20);
}
}
Expand All @@ -34,16 +34,19 @@ void InsetState::is_simple(const char *caller_func) const
for (const auto &pwh : gd.polygons_with_holes()) {
if (!pwh.outer_boundary().is_simple()) {
std::cerr << "ERROR: Outer boundary is not simple for GeoDiv "
<< gd.id() << std::endl;
std::cerr << "is_simple() called from " << caller_func << std::endl;
<< gd.id();
std::cerr << ". is_simple() called from " << caller_func << std::endl;
write_cairo_map(
inset_name_ + "_" + std::to_string(n_finished_integrations_) +
"_not_simple_after_" + caller_func,
false);
exit(1);
}
for (const auto &h : pwh.holes()) { if (!h.is_simple()) { std::cerr << gd.id() << std::endl; std::cerr << "ERROR: Hole is not simple for GeoDiv " << gd.id() << std::endl;
std::cerr << "is_simple() called from " << caller_func << std::endl;
for (const auto &h : pwh.holes()) {
if (!h.is_simple()) {
std::cerr << "ERROR: Hole is not simple for GeoDiv " << gd.id();
std::cerr << ". is_simple() called from " << caller_func
<< std::endl;
write_cairo_map(
inset_name_ + "_" + std::to_string(n_finished_integrations_) +
"_not_simple_after_" + caller_func,
Expand Down
2 changes: 1 addition & 1 deletion src/inset_state/fill_with_density_rays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void InsetState::fill_with_density_rays(bool plot_density)
intersections_at_y[i + 1].ray_enters) {

// Highlight where intersection is present
std::cerr << "\nInvalid Geometry!" << std::endl;
std::cerr << "\n ERROR: Invalid Geometry!" << std::endl;
nihalzp marked this conversation as resolved.
Show resolved Hide resolved
std::cerr << "Intersection of Polygons/Holes/Geodivs" << std::endl;
std::cerr << "Y-coordinate: " << y << std::endl;
std::cerr << "Left X-coordinate: " << left_x << std::endl;
Expand Down
7 changes: 4 additions & 3 deletions src/inset_state/inset_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ double InsetState::area_error_at(const std::string &id) const

Bbox InsetState::bbox(bool original_bbox) const
{
auto &geo_divs = original_bbox ? geo_divs_original_ : geo_divs_;
auto &geo_divs = original_bbox ? geo_divs_original_transformed_ : geo_divs_;
nihalzp marked this conversation as resolved.
Show resolved Hide resolved
// Find joint bounding box for all "polygons with holes" in this inset
double inset_xmin = dbl_inf;
double inset_xmax = -dbl_inf;
Expand Down Expand Up @@ -895,10 +895,11 @@ double InsetState::target_area_at(const std::string &id) const
}
}

double InsetState::total_inset_area() const
double InsetState::total_inset_area(bool original_area) const
{
auto &geo_divs = original_area ? geo_divs_original_transformed_ : geo_divs_;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be better to just store this in a variable? Or do you mean the current area of the geo_divs_transformed, in which case probably we would want to change the name somehow.
Maybe "original_unit"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Storing the area in a variable would require us to update that variable each time we update the geo_divs, which would require extra book keeping in many places, and this will increase the possibilities of bugs.

double total_inset_area = 0.0;
for (const auto &gd : geo_divs_) {
for (const auto &gd : geo_divs) {
total_inset_area += gd.area();
}
return total_inset_area;
Expand Down
4 changes: 2 additions & 2 deletions src/inset_state/interpolate_bilinearly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ double interpolate_bilinearly(
{
if (x < 0 || x > lx || y < 0 || y > ly) {
std::cerr << "ERROR: coordinate outside bounding box in " << __func__
<< "().\n"
<< "(). "
<< "x=" << x << ", y=" << y << std::endl;
exit(1);
}
Expand Down Expand Up @@ -114,7 +114,7 @@ double interpolate_bilinearly(
{
if (x < 0 || x > lx || y < 0 || y > ly) {
std::cerr << "ERROR: coordinate outside bounding box in " << __func__
<< "().\n"
<< "(). "
<< "x=" << x << ", y=" << y << std::endl;
exit(1);
}
Expand Down
4 changes: 2 additions & 2 deletions src/inset_state/project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void InsetState::exit_if_not_on_grid_or_edge(const Point p1) const
if (
(p1.x() != 0.0 && p1.x() != lx_ && p1.x() - int(p1.x()) != 0.5) ||
(p1.y() != 0.0 && p1.y() != ly_ && p1.y() - int(p1.y()) != 0.5)) {
std::cerr << "Error: Invalid input coordinate in triangulation\n"
std::cerr << "ERROR: Invalid input coordinate in triangulation. "
<< "\tpt = (" << p1.x() << ", " << p1.y() << ")" << std::endl;
exit(1);
}
Expand Down Expand Up @@ -289,7 +289,7 @@ std::array<Point, 3> InsetState::untransformed_triangle(
if (pt.x() < 0 || pt.x() > lx_ || pt.y() < 0 || pt.y() > ly_) {
CGAL::set_pretty_mode(std::cerr);
std::cerr << "ERROR: coordinate outside bounding box in " << __func__
<< "().\npt = " << pt << std::endl;
<< "(). pt = " << pt << std::endl;
exit(1);
}

Expand Down
9 changes: 5 additions & 4 deletions src/inset_state/rescale_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,17 @@ void InsetState::rescale_map(

void InsetState::normalize_inset_area(
double total_cart_target_area,
bool equal_area)
bool equal_area, bool normalize_original)
{
const auto bb = bbox();
auto &geo_divs = normalize_original ? geo_divs_original_transformed_ : geo_divs_;
const auto bb = bbox(normalize_original);

// Calculate scale_factor that makes inset areas proportional to their
// target areas on the cartogram
const double inset_area_prop =
initial_target_area() / total_cart_target_area;
const double scale_factor =
equal_area ? 1.0 : sqrt(inset_area_prop / total_inset_area());
equal_area ? 1.0 : sqrt(inset_area_prop / total_inset_area(normalize_original));

// Rescale and translate all GeoDiv coordinates
const Transformation translate(
Expand All @@ -102,7 +103,7 @@ void InsetState::normalize_inset_area(
-(bb.xmin() + bb.xmax()) / 2,
-(bb.ymin() + bb.ymax()) / 2));
const Transformation scale(CGAL::SCALING, scale_factor);
for (auto &gd : geo_divs_) {
for (auto &gd : geo_divs) {
for (auto &pwh : gd.ref_to_polygons_with_holes()) {
auto &ext_ring = pwh.outer_boundary();
ext_ring = transform(translate, ext_ring);
Expand Down
12 changes: 6 additions & 6 deletions src/inset_state/scanline_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ std::vector<std::vector<intersection> > InsetState::intersec_with_parallel_to(
unsigned int resolution) const
{
if (axis != 'x' && axis != 'y') {
std::cerr << "Invalid axis in " << __func__ << "()" << std::endl;
std::cerr << "ERROR: Invalid axis in " << __func__ << "()" << std::endl;
exit(984320);
}
const unsigned int grid_length = (axis == 'x' ? ly_ : lx_);
Expand Down Expand Up @@ -94,15 +94,15 @@ std::vector<std::vector<intersection> > InsetState::intersec_with_parallel_to(

// Check whether the number of intersections is odd
if (intersections.size() % 2 != 0) {
std::cerr << "Incorrect Topology.\n"
std::cerr << "ERROR: Incorrect Topology. "
<< "Number of intersections: " << intersections.size()
<< "\n"
<< axis << "-coordinate: " << ray << "\n"
<< "Intersection points: " << std::endl;
<< ". "
<< axis << "-coordinate: " << ray << ". "
<< "Intersection points: ";

for (auto &intersection : intersections) {
std::cerr << (axis == 'x' ? intersection.x() : intersection.y())
<< std::endl;
<< " ";
}
std::cerr << std::endl << std::endl;
_Exit(932875);
Expand Down
17 changes: 13 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ int main(const int argc, const char *argv[])
inset_state.apply_albers_projection();
}
} else if (output_equal_area) {
std::cerr << "ERROR: Input GeoJSON is not a longitude-latitude map."
<< std::endl;
std::cerr
<< "ERROR: Input GeoJSON is not a longitude-latitude map. Therefore, "
"it is not possible to produce an equal-area map."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make this statement lighter. Or actually even remove it? Did you put it so that we can remember where this error came from?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel we should not remove it; this way we know that the --output_equal_area flag did not work for the given map. It is true that the statement contains redundant information because the first statement technically implies the second statement given the context. However, for a new user, it might not be obvious; and we do plan to display error messages to the users on the website.

<< std::endl;
return EXIT_FAILURE;
}

Expand Down Expand Up @@ -410,11 +412,18 @@ int main(const int argc, const char *argv[])

// Rescale insets in correct proportion to each other
inset_state.normalize_inset_area(
cart_info.cart_initial_total_target_area());
cart_info.cart_initial_total_target_area(),
false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should name the bools? @mgastner's opinion on style may be helpful here.

The alternative is we keep it like this and rely on IDE hints.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Let's discuss it more.

false);
inset_state.normalize_inset_area(
cart_info.cart_initial_total_target_area(),
false,
output_to_stdout);
}

// Shift insets so that they do not overlap
cart_info.shift_insets_to_target_position();
cart_info.shift_insets_to_target_position(false);
cart_info.shift_insets_to_target_position(output_to_stdout);
nihalzp marked this conversation as resolved.
Show resolved Hide resolved

// Output to GeoJSON
cart_info.write_geojson(
Expand Down
2 changes: 1 addition & 1 deletion src/misc/ft_real_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void FTReal2d::set_array_size(const unsigned int i, const unsigned int j)
void FTReal2d::allocate(const unsigned int lx, const unsigned int ly)
{
if (lx * ly <= 0) {
std::cerr << "Invalid array dimensions in FTReal2dArray::allocate_ft()"
std::cerr << "ERROR: Invalid array dimensions in FTReal2dArray::allocate_ft()"
<< std::endl;
_Exit(98915);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a side note, I wonder who is naming these exit codes.

}
Expand Down
2 changes: 1 addition & 1 deletion src/misc/intersection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void add_intersections(
const char axis)
{
if (axis != 'x' && axis != 'y') {
std::cerr << "Invalid axis in add_intersections()" << std::endl;
std::cerr << "ERROR: Invalid axis in add_intersections()" << std::endl;
exit(984321);
}
Point prev_point = pgn[pgn.size() - 1];
Expand Down
2 changes: 1 addition & 1 deletion src/misc/parse_arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ argparse::ArgumentParser parsed_arguments(
try {
arguments.parse_args(argc, argv);
} catch (const std::runtime_error &err) {
std::cerr << "ERROR: " << err.what() << std::endl;
std::cerr << "ERROR: " << err.what() << ". ";
std::cerr << arguments;
std::exit(1);
}
Expand Down