Skip to content

Commit

Permalink
Fixes regression introduced by 357c445 (only for USE_SSE3 regime)
Browse files Browse the repository at this point in the history
  • Loading branch information
myurkin committed Jun 13, 2024
1 parent dba061b commit 42ae398
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions src/interaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,28 @@ static inline void InterParams(double qvec[static 3],double qmunu[static 6],doub
OuterSym(qvec,qmunu);
}

//=====================================================================================================================

static inline double InsideCube(const double qvec[static 3],const double rn)
/* Tests if the point is inside the unit cube ([-0.5,0.5] over each axis).
* qvec is normalized vector (point location), rn is its norm before normalization
* returns weight: 1 for points inside, 0 outside, and 1/2, 1/4, or 1/8 on the facet, edge, and vertex, respectively
* The latter is designed for continuous transition of total weight, when the same point is tested versus a grid of
* cubes. However, float equality tests are not expected to be robust.
*/
{
double t,w=1;
int i;

if (rn>SQRT3*0.5) return 0;
else for (i=0;i<3;i++) {
t=rn*fabs(qvec[i]);
if (t>0.5) return 0;
else if (t==0.5) w*=0.5;
}
return w;
}

#ifdef USE_SSE3

//=====================================================================================================================
Expand Down Expand Up @@ -306,27 +328,6 @@ static inline doublecomplex accImExp(const double x)
return imExp(x);
}

//=====================================================================================================================

static inline double InsideCube(const double qvec[static 3],const double rn)
/* Tests if the point is inside the unit cube ([-0.5,0.5] over each axis).
* qvec is normalized vector (point location), rn is its norm before normalization
* returns weight: 1 for points inside, 0 outside, and 1/2, 1/4, or 1/8 on the facet, edge, and vertex, respectively
* The latter is designed for continuous transition of total weight, when the same point is tested versus a grid of
* cubes. However, float equality tests are not expected to be robust.
*/
{
double t,w=1;
int i;

if (rn>SQRT3*0.5) return 0;
else for (i=0;i<3;i++) {
t=rn*fabs(qvec[i]);
if (t>0.5) return 0;
else if (t==0.5) w*=0.5;
}
return w;
}

//=====================================================================================================================

Expand Down

0 comments on commit 42ae398

Please sign in to comment.