make ring sorting more determninistic
This commit is contained in:
parent
63bd1d3522
commit
e5e980c539
1 changed files with 10 additions and 2 deletions
|
@ -116,7 +116,9 @@ static int ringpair_compare (const void *xa, const void *xb)
|
|||
{
|
||||
const sharp_ringpair *a=xa, *b=xb;
|
||||
if (a->r1.nph==b->r1.nph)
|
||||
return (a->r1.phi0 < b->r1.phi0) ? -1 : (a->r1.phi0 > b->r1.phi0) ? 1 : 0;
|
||||
return (a->r1.phi0 < b->r1.phi0) ? -1 :
|
||||
((a->r1.phi0 > b->r1.phi0) ? 1 :
|
||||
(a->r1.cth>b->r1.cth ? -1 : 1));
|
||||
return (a->r1.nph<b->r1.nph) ? -1 : 1;
|
||||
}
|
||||
|
||||
|
@ -186,7 +188,13 @@ void sharp_make_geom_info (int nrings, const int *nph, const ptrdiff_t *ofs,
|
|||
info->pair[info->npairs].r1=infos[pos];
|
||||
if ((pos<nrings-1) && FAPPROX(infos[pos].cth,-infos[pos+1].cth,1e-12))
|
||||
{
|
||||
info->pair[info->npairs].r2=infos[pos+1];
|
||||
if (infos[pos].cth>0) // make sure northern ring is in r1
|
||||
info->pair[info->npairs].r2=infos[pos+1];
|
||||
else
|
||||
{
|
||||
info->pair[info->npairs].r1=infos[pos+1];
|
||||
info->pair[info->npairs].r2=infos[pos];
|
||||
}
|
||||
++pos;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue