Skip to content

Commit 68cd264

Browse files
authored
Fixing a ceding vs super region cell mesh allocation bug caused by the removal of fast parameters (#690)
* Removing undefined and outdated variable f. Fixing also the if-else structure to the original. * Changelog items added. * Renaming the changelog items.
1 parent e23e6ed commit 68cd264

3 files changed

Lines changed: 9 additions & 10 deletions

File tree

changelog.d/690.attribution.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Tuomo Salmi

changelog.d/690.fixed.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed a ceding vs super region cell mesh allocation bug caused by the removal of fast parameters in commit #7e6d6ad.

xpsi/cellmesh/mesh_tools.pyx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ def allocate_cells(size_t num_cells,
915915
double cede_numCell, cede_sqrt_numCell, cede_cellArea, cede_area
916916
double cede_boundary_phi
917917
double cede_colat_lims[2]
918-
double f, y
918+
double y
919919
cdef gsl_cq_work *w = gsl_integration_cquad_workspace_alloc(100)
920920

921921
superColatitude_cpy = superColatitude
@@ -1060,17 +1060,14 @@ def allocate_cells(size_t num_cells,
10601060
if are_equal(cede_area, 0.0): # Gausian integral did not resolve
10611061
cede_area = cede_cellArea / 1000.0
10621062

1063-
y = ((1.0 - f)/f)*(cede_area/super_area) - 1.0
1063+
y = (cede_area/super_area) - 1.0
10641064

1065-
if are_equal(y, 0.0):
1066-
super_numCell = 0.5 * <double>num_cells
1067-
cede_numCell = 0.5 * <double>num_cells
1068-
else:
1069-
super_numCell = <double>num_cells * ((sqrt(1.0 + y) - 1.0)/y)
1070-
cede_numCell = <double>num_cells - super_numCell
1065+
if are_equal(y, 0.0):
1066+
super_numCell = 0.5 * <double>num_cells
1067+
cede_numCell = 0.5 * <double>num_cells
10711068
else:
1072-
super_numCell = 0.0
1073-
cede_numCell = <double>num_cells
1069+
super_numCell = <double>num_cells * ((sqrt(1.0 + y) - 1.0)/y)
1070+
cede_numCell = <double>num_cells - super_numCell
10741071

10751072
#print(super_numCell, super_cellArea, super_area)
10761073
super_sqrt_numCell = ceil(sqrt(super_numCell * super_cellArea / super_area))

0 commit comments

Comments
 (0)