24#include <lal/XLALError.h>
25#include <lal/LALFrameU.h>
34#if defined HAVE_FRAMEL_H && defined HAVE_LIBFRAMEL
36# define CASE_FRAMEL(errval, function, ...) case LAL_FRAMEU_FRAME_LIBRARY_FRAMEL: return function ## _FrameL_ (__VA_ARGS__)
37# ifndef LAL_FRAMEU_FRAME_LIBRARY_DEFAULT
38# define LAL_FRAMEU_FRAME_LIBRARY_DEFAULT LAL_FRAMEU_FRAME_LIBRARY_FRAMEL
41# define CASE_FRAMEL(errval, function, ...) case LAL_FRAMEU_FRAME_LIBRARY_FRAMEL: XLAL_ERROR_VAL(errval, XLAL_EERR, "FrameL library unavailable")
45#if defined HAVE_FRAMECPPC_FRAMEC_H && defined HAVE_LIBFRAMECPPC
47# define CASE_FRAMEC(errval, function, ...) case LAL_FRAMEU_FRAME_LIBRARY_FRAMEC: return function ## _FrameC_ (__VA_ARGS__)
48# ifndef LAL_FRAMEU_FRAME_LIBRARY_DEFAULT
49# define LAL_FRAMEU_FRAME_LIBRARY_DEFAULT LAL_FRAMEU_FRAME_LIBRARY_FRAMEC
52# define CASE_FRAMEC(errval, function, ...) case LAL_FRAMEU_FRAME_LIBRARY_FRAMEC: XLAL_ERROR_VAL(errval, XLAL_EERR, "FrameC library unavailable")
57#ifndef LAL_FRAMEU_FRAME_LIBRARY_DEFAULT
58#define LAL_FRAMEU_FRAME_LIBRARY_DEFAULT LAL_FRAMEU_FRAME_LIBRARY_UNAVAILABLE
59#error No frame library available
62#define FRAME_LIBRARY_SELECT_VAL(errval, function, ...) \
64 switch (XLALFrameLibrary()) { \
65 CASE_FRAMEL(errval, function, __VA_ARGS__); \
66 CASE_FRAMEC(errval, function, __VA_ARGS__); \
68 XLAL_ERROR_VAL(errval, XLAL_EERR, "No frame library available"); \
72#define FRAME_LIBRARY_SELECT_VOID(function, ...) FRAME_LIBRARY_SELECT_VAL(, function, __VA_ARGS__)
73#define FRAME_LIBRARY_SELECT_NULL(function, ...) FRAME_LIBRARY_SELECT_VAL(NULL, function, __VA_ARGS__)
74#define FRAME_LIBRARY_SELECT_REAL8(function, ...) FRAME_LIBRARY_SELECT_VAL(XLAL_REAL8_FAIL_NAN, function, __VA_ARGS__)
75#define FRAME_LIBRARY_SELECT(function, ...) FRAME_LIBRARY_SELECT_VAL(XLAL_FAILURE, function, __VA_ARGS__)
86 static int lalFrameLibrary = -1;
87 if (lalFrameLibrary < 0) {
88 const char *env = getenv(
"LAL_FRAME_LIBRARY");
90 if (strcmp(env,
"FrameL") == 0) {
91#if defined HAVE_FRAMEL_H && defined HAVE_LIBFRAMEL
95 "LAL_FRAME_LIBRARY=%s: FrameL frame library not available", env);
97 }
else if (strcmp(env,
"FrameC") == 0) {
98#if defined HAVE_FRAMECPPC_FRAMEC_H && defined HAVE_LIBFRAMECPPC
102 "LAL_FRAME_LIBRARY=%s: FrameC frame library not available", env);
105 XLAL_PRINT_WARNING(
"LAL_FRAME_LIBRARY=%s: No valid frame library specified [expect: \"FrameL\" or \"FrameC\"]", env);
111 switch (lalFrameLibrary) {
122 return lalFrameLibrary;
441 double elevation,
double azimuthX,
double azimuthY,
double altitudeX,
double altitudeY,
double midpointX,
double midpointY,
445 altitudeX, altitudeY, midpointX, midpointY, localTime);
#define FRAME_LIBRARY_SELECT_REAL8(function,...)
#define FRAME_LIBRARY_SELECT_NULL(function,...)
#define LAL_FRAMEU_FRAME_LIBRARY_DEFAULT
static int XLALFrameLibrary(void)
#define FRAME_LIBRARY_SELECT_VOID(function,...)
@ LAL_FRAMEU_FRAME_LIBRARY_FRAMEC
@ LAL_FRAMEU_FRAME_LIBRARY_FRAMEL
@ LAL_FRAMEU_FRAME_LIBRARY_UNAVAILABLE
#define FRAME_LIBRARY_SELECT(function,...)
int XLALFrameUFrameHQueryFrame(const LALFrameUFrameH *frame)
Query FrameH structure for the frame number.
const char * XLALFrameUFrTOCQuerySimName(const LALFrameUFrTOC *toc, size_t sim)
Query FrTOC structure for the name of a FrSimData structure.
int XLALFrameUFrChanVectorQueryCompress(const LALFrameUFrChan *channel)
Query FrChan structure for the compression scheme of its FrVect structure.
size_t XLALFrameUFrTOCQueryNFrame(const LALFrameUFrTOC *toc)
Query FrTOC structure for number of FrameH structures contained.
LALFrameUFrameH * XLALFrameUFrameHAlloc(const char *name, double start1, double start2, double dt, int frnum)
Allocate memory for a new frame header FrameH structure.
LALFrameUFrDetector * XLALFrameUFrDetectorAlloc(const char *name, const char *prefix, double latitude, double longitude, double elevation, double azimuthX, double azimuthY, double altitudeX, double altitudeY, double midpointX, double midpointY, int localTime)
Allocate memory for a new detector FrDetector structure.
int XLALFrameUFrameHWrite(LALFrameUFrFile *stream, LALFrameUFrameH *frame)
Write a FrameH structure to an output FrFile stream.
double XLALFrameUFrDetectorQueryElevation(const LALFrameUFrDetector *detector)
Query FrDetector structure for the detector elevation.
double XLALFrameUFrDetectorQueryLatitude(const LALFrameUFrDetector *detector)
Query FrDetector structure for the detector latitude.
void * XLALFrameUFrChanVectorQueryData(const LALFrameUFrChan *channel)
Query FrChan structure for the data pointer in its FrVect structure.
int XLALFrameUFrChanVectorQueryType(const LALFrameUFrChan *channel)
Query FrChan structure for the data type of its FrVect structure.
int XLALFrameUFrameHFrDetectorAdd(LALFrameUFrameH *frame, LALFrameUFrDetector *detector)
Add a FrDetector structure to a FrameH structure.
int XLALFrameUFrChanSetTimeOffset(LALFrameUFrChan *channel, double timeOffset)
Set the time offset in a FrChan structure.
int XLALFrameUFrChanSetTRange(LALFrameUFrChan *channel, double tRange)
Set the time range in a FrChan structure.
const char * XLALFrameUFrChanVectorQueryName(const LALFrameUFrChan *channel)
Query FrChan structure for the name of its FrVect structure.
void XLALFrameUFrTOCFree(LALFrameUFrTOC *toc)
Free a FrTOC structure.
LALFrameUFrChan * XLALFrameUFrChanRead(LALFrameUFrFile *stream, const char *name, size_t pos)
Read a channel FrChan structure from a FrFile stream.
size_t XLALFrameUFrTOCQuerySimN(const LALFrameUFrTOC *toc)
Query FrTOC structure for number of FrSimData structures.
void XLALFrameUFrameHFree(LALFrameUFrameH *frame)
Free a FrameH structure.
void XLALFrameUFrChanFree(LALFrameUFrChan *channel)
Free a FrChan structure.
size_t XLALFrameUFrChanVectorQueryNDim(const LALFrameUFrChan *channel)
Query FrChan structure for the number of dimensions of the multi-dimensional data in its FrVect struc...
void XLALFrameUFrHistoryFree(LALFrameUFrHistory *history)
Free a FrHistory structure.
int XLALFrameUFrChanVectorSetDx(LALFrameUFrChan *channel, double dx)
Set the sampling interval for the data in the FrVect structure contained in a FrChan structure.
int XLALFrameUFrameHFrChanAdd(LALFrameUFrameH *frame, LALFrameUFrChan *channel)
Add a FrChan structure to a FrameH structure.
const char * XLALFrameUFrDetectorQueryPrefix(const LALFrameUFrDetector *detector)
Query FrDetector structure for the detector prefix.
struct tagLALFrameUFrameH LALFrameUFrameH
Incomplete type for a frame header FrameH structure.
int XLALFrameUFrChanVectorExpand(LALFrameUFrChan *channel)
Expands a FrVect structure within a FrChan structure.
LALFrameUFrChan * XLALFrameUFrSimChanAlloc(const char *name, int dtype, size_t ndata)
Allocate memory for a new FrChan structure of FrSimData type.
int XLALFrameUFrChanVectorSetStartX(LALFrameUFrChan *channel, double x0)
Set the starting value for the domain of the data in the FrVect structure contained in a FrChan struc...
size_t XLALFrameUFrChanVectorQueryNx(const LALFrameUFrChan *channel, size_t dim)
Query FrChan structure for the number of points in the dim dimension of the multi-dimensional data in...
double XLALFrameUFrameHQueryDt(const LALFrameUFrameH *frame)
Query FrameH structure for the duration.
int XLALFrameUFrChanVectorSetUnitY(LALFrameUFrChan *channel, const char *unit)
Set the units of the data in the FrVect structure contained in a FrChan structure.
int XLALFrameUFrameHQueryULeapS(const LALFrameUFrameH *frame)
Query FrameH structure for the number of leap seconds.
LALFrameUFrHistory * XLALFrameUFrHistoryAlloc(const char *name, double gpssec, const char *comment)
Allocate memory for a new detector FrHistory structure.
double XLALFrameUFrChanQueryTimeOffset(const LALFrameUFrChan *channel)
Query FrChan structure for time offset for this channel.
LALFrameUFrTOC * XLALFrameUFrTOCRead(LALFrameUFrFile *stream)
Read the table of contents FrTOC structure for a FrFile stream.
LALFrameUFrChan * XLALFrameUFrAdcChanAlloc(const char *name, int dtype, size_t ndata)
Allocate memory for a new FrChan structure of FrAdcData type.
LALFrameUFrameH * XLALFrameUFrameHRead(LALFrameUFrFile *stream, int pos)
Read a frame header FrameH structure from a FrFile stream.
int XLALFrameUFrameHFrHistoryAdd(LALFrameUFrameH *frame, LALFrameUFrHistory *history)
Add a FrHistory structure to a FrameH structure.
size_t XLALFrameUFrTOCQueryProcN(const LALFrameUFrTOC *toc)
Query FrTOC structure for number of FrProcData structures.
int XLALFrameUFrChanVectorAlloc(LALFrameUFrChan *channel, int dtype, size_t ndata)
Allocate memory for a FrVect structure within a FrChan structure.
double XLALFrameUFrChanVectorQueryDx(const LALFrameUFrChan *channel, size_t dim)
Query FrChan structure for the sampling interval in the dim dimension of the multi-dimensional data i...
const char * XLALFrameUFrTOCQueryProcName(const LALFrameUFrTOC *toc, size_t proc)
Query FrTOC structure for the name of a FrProcData structure.
size_t XLALFrameUFrChanVectorQueryNData(const LALFrameUFrChan *channel)
Query FrChan structure for the number of points of data in its FrVect structure.
const char * XLALFrameUFrameHQueryName(const LALFrameUFrameH *frame)
Query FrameH structure for its name.
double XLALFrameUFrDetectorQueryArmXMidpoint(const LALFrameUFrDetector *detector)
Query FrDetector structure for the detector x-arm midpoint.
double XLALFrameUFrDetectorQueryArmXAltitude(const LALFrameUFrDetector *detector)
Query FrDetector structure for the detector x-arm altitude.
int XLALFrameUFrameHSetRun(LALFrameUFrameH *frame, int run)
Set the run number in a FrameH structure.
struct tagLALFrameUFrHistory LALFrameUFrHistory
Incomplete type for a history data FrHistory structure.
double XLALFrameUFrTOCQueryGTimeModf(double *iptr, const LALFrameUFrTOC *toc, size_t pos)
Query FrTOC structure for start time of a FrameH structure.
const char * XLALFrameUFrChanVectorQueryUnitY(const LALFrameUFrChan *channel)
Query FrChan structure for sample units of the data in the FrVect structure.
double XLALFrameUFrDetectorQueryArmYAltitude(const LALFrameUFrDetector *detector)
Query FrDetector structure for the detector y-arm altitude.
void XLALFrameUFrDetectorFree(LALFrameUFrDetector *detector)
Free a FrDetector structure.
int XLALFrameUFrChanVectorCompress(LALFrameUFrChan *channel, int compressLevel)
Compress a FrVect structure within a FrChan structure.
const char * XLALFrameUFrTOCQueryAdcName(const LALFrameUFrTOC *toc, size_t adc)
Query FrTOC structure for the name of a FrAdcData structure.
double XLALFrameUFrDetectorQueryArmYMidpoint(const LALFrameUFrDetector *detector)
Query FrDetector structure for the detector y-arm midpoint.
const char * XLALFrameUFrChanVectorQueryUnitX(const LALFrameUFrChan *channel, size_t dim)
Query FrChan structure for the units of the domain of the dim dimension of the multi-dimensional data...
LALFrameUFrFile * XLALFrameUFrFileOpen(const char *filename, const char *mode)
Open a frame file FrFile stream.
double XLALFrameUFrDetectorQueryLongitude(const LALFrameUFrDetector *detector)
Query FrDetector structure for the detector longitude.
double XLALFrameUFrChanVectorQueryStartX(const LALFrameUFrChan *channel, size_t dim)
Query FrChan structure for the starting value of the dim dimension of the multi-dimensional data in t...
double XLALFrameUFrameHQueryGTimeModf(double *iptr, const LALFrameUFrameH *frame)
Query FrameH structure for the start time.
struct tagLALFrameUFrTOC LALFrameUFrTOC
Incomplete type for a table of contents FrTOC structure.
LALFrameUFrChan * XLALFrameUFrProcChanAlloc(const char *name, int type, int subtype, int dtype, size_t ndata)
Allocate memory for a new FrChan structure of FrAdcData type.
double XLALFrameUFrTOCQueryDt(const LALFrameUFrTOC *toc, size_t pos)
Query FrTOC structure for duration of a FrameH structure.
int XLALFrameUFrDetectorQueryLocalTime(const LALFrameUFrDetector *detector)
Query FrDetector structure for the local time offset at the detector.
int XLALFrameUFrChanVectorSetName(LALFrameUFrChan *channel, const char *name)
Set the name of the FrVect structure contained in a FrChan structure.
void XLALFrameUFrFileClose(LALFrameUFrFile *stream)
Close a FrFile stream.
int XLALFrameUFileCksumValid(LALFrameUFrFile *stream)
Use checksum to determine if FrFile stream is valid.
size_t XLALFrameUFrTOCQueryAdcN(const LALFrameUFrTOC *toc)
Query FrTOC structure for number of FrAdcData structures.
int XLALFrameUFrameHQueryDataQuality(const LALFrameUFrameH *frame)
Query FrameH structure for the data quality word.
int XLALFrameUFrameHQueryRun(const LALFrameUFrameH *frame)
Query FrameH structure for the run number.
size_t XLALFrameUFrTOCQueryDetectorN(const LALFrameUFrTOC *toc)
Query FrTOC structure for number of FrDetector structures.
int XLALFrameUFrChanVectorSetUnitX(LALFrameUFrChan *channel, const char *unit)
Set the units of the domain of the data in the FrVect structure contained in a FrChan structure.
const char * XLALFrameUFrDetectorQueryName(const LALFrameUFrDetector *detector)
Query FrDetector structure for the detector name.
double XLALFrameUFrDetectorQueryArmXAzimuth(const LALFrameUFrDetector *detector)
Query FrDetector structure for the detector x-arm azimuth.
LALFrameUFrDetector * XLALFrameUFrDetectorRead(LALFrameUFrFile *stream, const char *name)
Read a detector FrDetector structure from a FrFile stream.
int XLALFrameUFrChanSetSampleRate(LALFrameUFrChan *channel, double sampleRate)
Set the sample rate in a FrChan structure.
size_t XLALFrameUFrChanVectorQueryNBytes(const LALFrameUFrChan *channel)
Query FrChan structure for the number of bytes of data in its FrVect structure.
const char * XLALFrameUFrTOCQueryDetectorName(const LALFrameUFrTOC *toc, size_t det)
Query FrTOC structure for the name of a FrDetector structure.
const char * XLALFrameUFrChanQueryName(const LALFrameUFrChan *channel)
Query FrChan structure for its name.
double XLALFrameUFrDetectorQueryArmYAzimuth(const LALFrameUFrDetector *detector)
Query FrDetector structure for the detector y-arm azimuth.
#define XLAL_ERROR_VAL(val,...)
#define XLAL_PRINT_INFO(...)
#define XLAL_PRINT_WARNING(...)