Skip to content

Slight alteration to progress percentage calculation, to avoid integer overflow.

Haakan Wennloef requested to merge hwennlof/allpix-squared:meshConverter into master

Using a large number of divisions with the mesh_converter tool led to a negative progress percentage. This was due to an integer overflow in the percentage calculation.

The output calculation has now been altered so that a division rather than a multiplication with 100 is used, which clears it up a bit! Previously there were issues when a total number of divisions exceeding 21 474 836 were used (e.g. 277x277x277, or 500x500x100), whereas now up to 21 47 483 647 divisions can be output correctly (e.g. 1290x1290x1290). If we want to handle more than this without odd negativisms, we can go to a long int rather than an int for the mesh_points_done and mesh_points_total variables. With this many divisions there are likely other issues however, such as a final field map file size of several tens of GB.

Merge request reports