Práce na generátorech mřížek... Dudom.
Former-commit-id: 55eeba3d3325e668ba5da3d1b556eeae406fb687
This commit is contained in:
parent
45eadd13db
commit
a06ac73663
|
@ -236,5 +236,121 @@ const PGenSphClassInfo PGenSph_zAxis = {
|
||||||
PGenSph_zAxis_destructor
|
PGenSph_zAxis_destructor
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
//==== PGenSph_xyWeb ====
|
||||||
|
// 2D lattice generator in the "spiderweb" style, generated in the "perimetre" order,
|
||||||
|
// not strictly ordered (or limited) by distance from origin.
|
||||||
|
// The minR and maxR here refer to the TODO WWHAT
|
||||||
|
|
||||||
|
extern const PGenSphClassInfo PGenSph_xyWeb; // forward declaration needed by constructor (may be placed in header file instead)
|
||||||
|
|
||||||
|
// Internal state structure
|
||||||
|
typedef struct PGenSph_xyWeb_StateData {
|
||||||
|
long i, j;
|
||||||
|
//long stopindex;
|
||||||
|
double minR, maxR;
|
||||||
|
bool inc_minR, inc_maxR;
|
||||||
|
cart2_t b1, b2; // lattice vectors
|
||||||
|
cart2_t offset; // offset of the zeroth lattice point from origin (will be normalised to the WS cell)
|
||||||
|
} PGenSph_xyWeb_StateData;
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
PGenSph PGenSph_xyWeb_new(...) {
|
||||||
|
g->stateData = malloc(sizeof(PGenSph_xyWeb_StateData));
|
||||||
|
...
|
||||||
|
PGenSph g = {&PGenSph_xyWeb, (void *) stateData};
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dectructor
|
||||||
|
void PGenSph_xyWeb_dectructor(PGenSph *g) {
|
||||||
|
...
|
||||||
|
free(g->stateData);
|
||||||
|
g->stateData = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extractor
|
||||||
|
PGenSphReturnData PGenSph_xyWeb_next(PGenSph *g) {
|
||||||
|
if (g->stateData == NULL) // already destroyed
|
||||||
|
return PGenSphDoneVal;
|
||||||
|
else {
|
||||||
|
PGenSph_xyWeb_StateData *s = (PGenSph_xyWeb_StateData *) g->stateData;
|
||||||
|
if (... /* there are still points to be generated */) {
|
||||||
|
...
|
||||||
|
PGenSphReturnData retval = {.../*flags*/, .../*thePoint*/};
|
||||||
|
return retval;
|
||||||
|
} else {
|
||||||
|
PGenSph_destroy(g);
|
||||||
|
return PGenSphDoneVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Class metadata structure; TODO maybe this can rather be done by macro.
|
||||||
|
const PGenSphClassInfo PGenSph_xyWeb = {
|
||||||
|
"PGenSph_xyWeb",
|
||||||
|
PGenSph_xyWeb_next,
|
||||||
|
PGenSph_xyWeb_destructor
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
//==== PGenSph_xyPlane ==== //TODO
|
||||||
|
|
||||||
|
extern const PGenSphClassInfo PGenSph_xyPlane; // forward declaration needed by constructor (may be placed in header file instead)
|
||||||
|
|
||||||
|
// Internal state structure
|
||||||
|
typedef struct PGenSph_xyPlane_StateData {
|
||||||
|
long i, j;
|
||||||
|
//long stopindex;
|
||||||
|
double minR, maxR;
|
||||||
|
bool inc_minR, inc_maxR;
|
||||||
|
cart2_t b1, b2; // lattice vectors
|
||||||
|
cart2_t offset; // offset of the zeroth lattice point from origin (will be normalised to the WS cell)
|
||||||
|
} PGenSph_xyPlane_StateData;
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
PGenSph PGenSph_xyPlane_new(...) {
|
||||||
|
g->stateData = malloc(sizeof(PGenSph_xyPlane_StateData));
|
||||||
|
...
|
||||||
|
PGenSph g = {&PGenSph_xyPlane, (void *) stateData};
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dectructor
|
||||||
|
void PGenSph_xyPlane_dectructor(PGenSph *g) {
|
||||||
|
...
|
||||||
|
free(g->stateData);
|
||||||
|
g->stateData = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extractor
|
||||||
|
PGenSphReturnData PGenSph_xyPlane_next(PGenSph *g) {
|
||||||
|
if (g->stateData == NULL) // already destroyed
|
||||||
|
return PGenSphDoneVal;
|
||||||
|
else {
|
||||||
|
PGenSph_xyPlane_StateData *s = (PGenSph_xyPlane_StateData *) g->stateData;
|
||||||
|
if (... /* there are still points to be generated */) {
|
||||||
|
...
|
||||||
|
PGenSphReturnData retval = {.../*flags*/, .../*thePoint*/};
|
||||||
|
return retval;
|
||||||
|
} else {
|
||||||
|
PGenSph_destroy(g);
|
||||||
|
return PGenSphDoneVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Class metadata structure; TODO maybe this can rather be done by macro.
|
||||||
|
const PGenSphClassInfo PGenSph_xyPlane = {
|
||||||
|
"PGenSph_xyPlane",
|
||||||
|
PGenSph_xyPlane_next,
|
||||||
|
PGenSph_xyPlane_destructor
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // 0
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,7 @@ PGenSph PGenSph_zAxis_new_minMaxR(double period, double offset, double minR, boo
|
||||||
|
|
||||||
#define BASIS_RTOL 1e-13
|
#define BASIS_RTOL 1e-13
|
||||||
|
|
||||||
|
// Bravais lattice types
|
||||||
typedef enum {
|
typedef enum {
|
||||||
OBLIQUE = 1,
|
OBLIQUE = 1,
|
||||||
RECTANGULAR = 2,
|
RECTANGULAR = 2,
|
||||||
|
@ -167,8 +168,14 @@ typedef enum {
|
||||||
ISOSCELE_TRIANGULAR=RHOMBIC,
|
ISOSCELE_TRIANGULAR=RHOMBIC,
|
||||||
RIGHT_ISOSCELE_TRIANGULAR=SQUARE,
|
RIGHT_ISOSCELE_TRIANGULAR=SQUARE,
|
||||||
HEXAGONAL=EQUILATERAL_TRIANGULAR
|
HEXAGONAL=EQUILATERAL_TRIANGULAR
|
||||||
} LatticeType;
|
} LatticeType2;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// Wallpaper groups
|
||||||
|
typedef enum {
|
||||||
|
TODO
|
||||||
|
} SpaceGroup2;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lagrange-Gauss reduction of a 2D basis.
|
* Lagrange-Gauss reduction of a 2D basis.
|
||||||
|
@ -197,7 +204,7 @@ bool l2d_is_obtuse(cart2_t i1, cart2_t i2);
|
||||||
/*
|
/*
|
||||||
* Given two basis vectors, returns 2D Bravais lattice type.
|
* Given two basis vectors, returns 2D Bravais lattice type.
|
||||||
*/
|
*/
|
||||||
LatticeType l2d_classifyLattice(cart2_t b1, cart2_t b2, double rtol);
|
LatticeType2 l2d_classifyLattice(cart2_t b1, cart2_t b2, double rtol);
|
||||||
|
|
||||||
// Other functions in lattices2d.py: TODO?
|
// Other functions in lattices2d.py: TODO?
|
||||||
// range2D()
|
// range2D()
|
||||||
|
|
Loading…
Reference in New Issue