95 #include <lal/LALStdlib.h>
96 #include <lal/LALConstants.h>
97 #include <lal/TwoDMesh.h>
100 #define UNUSED __attribute__ ((unused))
130 if ( retry > 1.0 && retry * retry >
params->widthMaxFac ) {
200 UINT4 UNUSED lost = 0;
211 for ( ; fineMesh != NULL; fineMesh = fineMesh->
next ) {
213 REAL4 xFine = fineMesh->
x;
214 REAL4 yFine = fineMesh->
y;
216 REAL4 dyFine = 0.5 * ( fineMesh->
dy[1] - fineMesh->
dy[0] );
217 REAL4 mFine = 0.5 * ( fineMesh->
dy[1] + fineMesh->
dy[0] ) / dxFine;
222 for ( here = coarseMesh; here != NULL; here = here->
next ) {
224 if ( fabs(
x ) <= dxFine + here->
dx ) {
228 REAL4 y = here->
y + mFine *
x - yFine;
229 REAL4 dy0 = here->
dy[0] + mFine * here->
dx;
230 REAL4 dy1 = here->
dy[1] + mFine * here->
dx;
233 if ( ( fabs(
y ) <= dyFine + fabs( dy0 ) ) ||
234 ( fabs(
y ) <= dyFine + fabs( dy1 ) ) ) {
242 INT2 overlap[2] = { 0, 0 };
246 REAL4 dy = 0.5 * ( dy1 - dy0 );
247 REAL4 m = 0.5 * ( dy1 + dy0 );
253 if ( xOver < -
x - dxFine ) {
256 if ( -dy +
m * xOver <= dyFine ) {
257 if ( dy +
m * xOver >= -dyFine ) {
271 if ( xOver > -
x + dxFine ) {
274 if ( -dy +
m * xOver <= dyFine ) {
275 if ( dy +
m * xOver >= -dyFine ) {
287 overlap[0] *= overlap[1];
306 LALInfo(
stat,
"Fine mesh tile has no overlapping coarse tile" );
#define TRY(func, statusptr)
#define ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
int LALWarning(LALStatus *status, const char *warning)
int LALInfo(LALStatus *status, const char *info)
void LALTwoDMesh(LALStatus *status, TwoDMeshNode **tail, TwoDMeshParamStruc *params)
#define TWODMESHH_MSGENUL
void LALCreateTwoDMesh(LALStatus *stat, TwoDMeshNode **mesh, TwoDMeshParamStruc *params)
void LALTwoDNodeCopy(LALStatus *status, TwoDMeshNode **new_, TwoDMeshNode *old)
void LALRefineTwoDMesh(LALStatus *stat, TwoDMeshNode *coarseMesh, TwoDMeshNode *fineMesh)
#define TWODMESHH_MSGEOUT
void LALDestroyTwoDMesh(LALStatus *stat, TwoDMeshNode **mesh, UINT4 *nFree)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
This structure represents a single node in a linked list of mesh points, specified in the coordinate ...
struct tagTwoDMeshNode * next
The next mesh point in the linked list; NULL if this is the tail.
REAL4 dx
The half-width of the tile centred on the mesh point.
struct tagTwoDMeshNode * subMesh
The head of a linked list of fine mesh points within the rectangular area spanned by this mesh point ...
REAL4 dy[2]
The heights of the two right-hand corners of the tile, relative to the mesh point.
REAL4 y
The coordinates of the mesh point.
This structure stores the parameters required by the two-dimensional mesh placement functions.