Replace PGEN_NEWR flag with PGEN_OLD_R with the opposite meaning.

Former-commit-id: 5fef7e81addc980a7202b55fd52152981abe5cba
This commit is contained in:
Marek Nečada 2019-06-27 12:13:25 +03:00
parent 2560366137
commit 1cbfb982d4
3 changed files with 20 additions and 13 deletions

View File

@ -260,7 +260,7 @@ int ewald3_21_xy_sigma_long (
const complex double phasefac = cexp(I*cart3_dot(K_pq_cart,particle_shift)); // POINT-DEPENDENT (PFC) // !!!CHECKSIGN!!!
const bool new_rbeta_pq = (!pgen_generates_shifted_points) || (pgen_retdata.flags & PGEN_NEWR);
const bool new_rbeta_pq = (!pgen_generates_shifted_points) || (pgen_retdata.flags & !PGEN_OLD_R);
if (!new_rbeta_pq) assert(rbeta_pq == rbeta_pq_prev);
@ -628,7 +628,7 @@ int ewald3_sigma_short(
const double r_pq_shifted = Rpq_shifted_sph.r;
// if the radius is the same as in previous cycle, most of the calculations can be recycled
const bool new_r_pq_shifted = (!pgen_generates_shifted_points) || (pgen_retdata.flags & PGEN_NEWR);
const bool new_r_pq_shifted = (!pgen_generates_shifted_points) || (pgen_retdata.flags & !PGEN_OLD_R);
if (!new_r_pq_shifted) assert(r_pq_shifted_prev == r_pq_shifted);
const complex double e_beta_Rpq = cexp(I*cart3_dot(beta, Rpq_shifted_cart)); // POINT-DEPENDENT

View File

@ -201,7 +201,7 @@ PGenCart2ReturnData PGen_FromPoint2DArray_next_cart2(PGen *g) {
if (s->currentIndex < s->len) {
cart2_t thePoint = s->base[s->currentIndex];
++(s->currentIndex);
PGenCart2ReturnData retval = {(PGEN_NOTDONE | PGEN_AT_XY | PGEN_NEWR | PGEN_COORDS_CART2), thePoint};
PGenCart2ReturnData retval = {(PGEN_NOTDONE | PGEN_AT_XY | PGEN_COORDS_CART2), thePoint};
return retval;
} else {
PGen_destroy(g);
@ -219,7 +219,7 @@ PGenSphReturnData PGen_FromPoint2DArray_next_sph(PGen *g) {
if (s->currentIndex < s->len) {
sph_t thePoint = cart22sph(s->base[s->currentIndex]);
++(s->currentIndex);
PGenSphReturnData retval = {(PGEN_AT_XY | PGEN_NEWR | PGEN_COORDS_SPH), thePoint};
PGenSphReturnData retval = {(PGEN_AT_XY | PGEN_COORDS_SPH), thePoint};
return retval;
} else {
PGen_destroy(g);
@ -357,8 +357,7 @@ PGenZReturnData PGen_1D_next_z(PGen *g) {
abort(); // invalid value
}
if (!theEnd) {
const PGenZReturnData retval = {PGEN_NOTDONE | PGEN_NEWR | PGEN_AT_Z,
zval};
const PGenZReturnData retval = {PGEN_NOTDONE | PGEN_AT_Z, zval};
return retval;
} else {
PGen_destroy(g);
@ -392,7 +391,7 @@ PGenSphReturnData PGen_1D_next_sph(PGen *g) {
abort(); // invalid value
}
if (!theEnd) {
const PGenSphReturnData retval = {PGEN_NOTDONE | PGEN_NEWR | PGEN_AT_Z | PGEN_COORDS_SPH,
const PGenSphReturnData retval = {PGEN_NOTDONE | PGEN_AT_Z | PGEN_COORDS_SPH,
{r, zval >= 0 ? 0 : M_PI, 0}};
return retval;
} else {
@ -556,7 +555,7 @@ PGenCart2ReturnData PGen_xyWeb_next_cart2(PGen *g) {
s->j = 0;
}
}
PGenCart2ReturnData retval = {(PGEN_NOTDONE | PGEN_AT_XY | PGEN_NEWR | PGEN_COORDS_CART2), thePoint};
PGenCart2ReturnData retval = {(PGEN_NOTDONE | PGEN_AT_XY | PGEN_COORDS_CART2), thePoint};
return retval;
} else {
PGen_destroy(g);

View File

@ -10,9 +10,15 @@
#include <assert.h>
#include <stddef.h>
#include <stdlib.h>
#ifndef M_SQRT3
#define M_SQRT3 1.7320508075688772935274463415058724
#endif
#ifndef M_SQRT3_2
#define M_SQRT3_2 (M_SQRT3/2)
#endif
#ifndef M_1_SQRT3
#define M_1_SQRT3 0.57735026918962576450914878050195746
#endif
@ -109,17 +115,19 @@ typedef enum PGenPointFlags {
* should have de-allocated all internal memory.
*/
PGEN_NOTDONE = 2,
/** Set if the r-coordinate is different than in the
/** Set if the r-coordinate is not different than in the
* previous generated point (so radial parts of the
* calculation have to be redone).
* Optional.
*/
PGEN_NEWR = 1,
/** Set if the r-coordinate has changed between the
PGEN_OLD_R = 1,
/** Set if the r-coordinate has not changed between the
* first and the last point generated in the current
* call.
* Only for the bulk generator methods.
* Optional.
*/
PGEN_RCHANGED = 16,
PGEN_SINGLE_R = 16,
PGEN_AT_Z = 4, ///< Set if the point(s) lie(s) at the z-axis (theta is either 0 or M_PI).
PGEN_AT_XY = 8, ///< Set if the point(s) lie(s) in the xy-plane (theta is M_PI2).
PGEN_METHOD_UNAVAILABLE = 2048, ///< Set if no suitable method exists (no point generated).
@ -329,7 +337,7 @@ static inline PGenReturnDataBulk PGen_fetch_any(struct PGen *g, size_t nmemb,
}
}
// Do not guarantee anything for; low priority TODO
res.flags |= PGEN_NEWR & PGEN_RCHANGED;
res.flags &= ~(PGEN_OLD_R & PGEN_SINGLE_R);
return res;
}
}