LALPulsar 7.1.1.1-eeff03c
GCTtoplist.c File Reference

Prototypes

int finite (double)
 
static void reduce_gctFstat_toplist_precision (toplist_t *l)
 
static int _atomic_write_gctFstat_toplist_to_file (toplist_t *l, const char *filename, UINT4 *checksum, int write_done)
 
static int print_gctFstatline_to_str (GCTtopOutputEntry fline, char *buf, int buflen)
 
static int print_single_detector_quantities_to_str (char *outstr, size_t outstrlen, const REAL4 *quantities, const UINT4 numDetectors)
 
static int print_single_detector_intval_to_str (char *outstr, size_t outstrlen, const INT4 *quantities, const UINT4 numDetectors)
 
static int write_gctFstat_toplist_item_to_fp (GCTtopOutputEntry fline, FILE *fp, UINT4 *checksum)
 
static int gctFstat_result_order (const void *a, const void *b)
 
static int gctFstat_smaller (const void *a, const void *b)
 
static int gctNC_smaller (const void *a, const void *b)
 
static int gctBSGL_smaller (const void *a, const void *b)
 
static int gctBSGLtL_smaller (const void *a, const void *b)
 
static int gctBtSGLtL_smaller (const void *a, const void *b)
 
static int gctFstat_final_qsort (const void *a, const void *b)
 
int create_gctFstat_toplist (toplist_t **tl, UINT8 length, SortBy_t whatToSortBy)
 creates a toplist with length elements, returns -1 on error (usually out of memory), else 0 More...
 
void free_gctFstat_toplist (toplist_t **l)
 frees the space occupied by the toplist More...
 
int insert_into_gctFstat_toplist (toplist_t *tl, GCTtopOutputEntry *elem)
 Inserts an element in to the toplist either if there is space left or the element is larger than the smallest element in the toplist. More...
 
void sort_gctFstat_toplist (toplist_t *l)
 sorts the toplist with an internal sorting function, used before finally writing it More...
 
static void reduce_gctFstatline_precision (void *line)
 
int write_gctFstat_toplist_to_fp (toplist_t *tl, FILE *fp, UINT4 *checksum)
 Writes the toplist to an (already open) filepointer Returns the number of written charactes sets the checksum if non-NULL Returns something <0 on error. More...
 
int write_gct_checkpoint (const char *filename, toplist_t *tl, toplist_t *t2, toplist_t *t3, UINT4 counter, BOOLEAN do_sync)
 Checkpointing. More...
 
int read_gct_checkpoint (const char *filename, toplist_t *tl, toplist_t *t2, toplist_t *t3, UINT4 *counter)
 tries to read a checkpoint More...
 
int clear_gct_checkpoint (const char *filename)
 removes a checkpoint returns 0 on success, errno on failure More...
 
int write_hfs_oputput (const char *filename, toplist_t *tl)
 write the final output file: More...
 

Go to the source code of this file.

Macros

#define min(a, b)   ((a)<(b)?(a):(b))
 
#define SYNC_FAIL_LIMIT   5
 
#define TEMP_EXT   ".tmp"
 
#define __func__   ""
 log an I/O error, i.e. More...
 
#define LOGIOERROR(mess, filename)
 
#define TMP_EXT   ".tmp"
 

Variables

charglobal_column_headings_stringp
 

Macro Definition Documentation

◆ min

#define min (   a,
 
)    ((a)<(b)?(a):(b))

Definition at line 75 of file GCTtoplist.c.

◆ SYNC_FAIL_LIMIT

#define SYNC_FAIL_LIMIT   5

Definition at line 79 of file GCTtoplist.c.

◆ TEMP_EXT

#define TEMP_EXT   ".tmp"

◆ __func__

#define __func__   ""

log an I/O error, i.e.

source code line no., ferror, errno and strerror, and doserrno on Windows, too

Definition at line 673 of file GCTtoplist.c.

◆ LOGIOERROR

#define LOGIOERROR (   mess,
  filename 
)
Value:
LogPrintf(LOG_CRITICAL, "ERROR: %s %s: %s (%s:%d): errno:%d: %s\n",\
mess,filename,__func__,__FILE__,__LINE__,errno,strerror(errno))
#define __func__
log an I/O error, i.e.
Definition: GCTtoplist.c:673
void LogPrintf(LogLevel_t, const char *format,...) _LAL_GCC_PRINTF_FORMAT_(2
LOG_CRITICAL

Definition at line 682 of file GCTtoplist.c.

◆ TMP_EXT

#define TMP_EXT   ".tmp"

Function Documentation

◆ finite()

int finite ( double  )

◆ reduce_gctFstat_toplist_precision()

static void reduce_gctFstat_toplist_precision ( toplist_t l)
static

Definition at line 480 of file GCTtoplist.c.

◆ _atomic_write_gctFstat_toplist_to_file()

static int _atomic_write_gctFstat_toplist_to_file ( toplist_t l,
const char filename,
UINT4 checksum,
int  write_done 
)
static

Definition at line 514 of file GCTtoplist.c.

◆ print_gctFstatline_to_str()

static int print_gctFstatline_to_str ( GCTtopOutputEntry  fline,
char buf,
int  buflen 
)
static

Definition at line 298 of file GCTtoplist.c.

◆ print_single_detector_quantities_to_str()

static int print_single_detector_quantities_to_str ( char outstr,
size_t  outstrlen,
const REAL4 quantities,
const UINT4  numDetectors 
)
static

Definition at line 389 of file GCTtoplist.c.

◆ print_single_detector_intval_to_str()

static int print_single_detector_intval_to_str ( char outstr,
size_t  outstrlen,
const INT4 quantities,
const UINT4  numDetectors 
)
static

Definition at line 411 of file GCTtoplist.c.

◆ write_gctFstat_toplist_item_to_fp()

static int write_gctFstat_toplist_item_to_fp ( GCTtopOutputEntry  fline,
FILE *  fp,
UINT4 checksum 
)
static

Definition at line 439 of file GCTtoplist.c.

◆ gctFstat_result_order()

static int gctFstat_result_order ( const void *  a,
const void *  b 
)
static

Definition at line 93 of file GCTtoplist.c.

◆ gctFstat_smaller()

static int gctFstat_smaller ( const void *  a,
const void *  b 
)
static

Definition at line 125 of file GCTtoplist.c.

◆ gctNC_smaller()

static int gctNC_smaller ( const void *  a,
const void *  b 
)
static

Definition at line 148 of file GCTtoplist.c.

◆ gctBSGL_smaller()

static int gctBSGL_smaller ( const void *  a,
const void *  b 
)
static

Definition at line 171 of file GCTtoplist.c.

◆ gctBSGLtL_smaller()

static int gctBSGLtL_smaller ( const void *  a,
const void *  b 
)
static

Definition at line 192 of file GCTtoplist.c.

◆ gctBtSGLtL_smaller()

static int gctBtSGLtL_smaller ( const void *  a,
const void *  b 
)
static

Definition at line 213 of file GCTtoplist.c.

◆ gctFstat_final_qsort()

static int gctFstat_final_qsort ( const void *  a,
const void *  b 
)
static

Definition at line 236 of file GCTtoplist.c.

◆ create_gctFstat_toplist()

int create_gctFstat_toplist ( toplist_t **  tl,
UINT8  length,
SortBy_t  whatToSortBy 
)

creates a toplist with length elements, returns -1 on error (usually out of memory), else 0

Definition at line 246 of file GCTtoplist.c.

◆ free_gctFstat_toplist()

void free_gctFstat_toplist ( toplist_t **  l)

frees the space occupied by the toplist

Definition at line 270 of file GCTtoplist.c.

◆ insert_into_gctFstat_toplist()

int insert_into_gctFstat_toplist ( toplist_t list,
GCTtopOutputEntry line 
)

Inserts an element in to the toplist either if there is space left or the element is larger than the smallest element in the toplist.

In the latter case, remove the smallest element from the toplist Returns 1 if the element was actually inserted, 0 if not.

Definition at line 281 of file GCTtoplist.c.

◆ sort_gctFstat_toplist()

void sort_gctFstat_toplist ( toplist_t l)

sorts the toplist with an internal sorting function, used before finally writing it

Definition at line 291 of file GCTtoplist.c.

◆ reduce_gctFstatline_precision()

static void reduce_gctFstatline_precision ( void *  line)
static

Definition at line 464 of file GCTtoplist.c.

◆ write_gctFstat_toplist_to_fp()

int write_gctFstat_toplist_to_fp ( toplist_t tl,
FILE *  fp,
UINT4 checksum 
)

Writes the toplist to an (already open) filepointer Returns the number of written charactes sets the checksum if non-NULL Returns something <0 on error.

Definition at line 489 of file GCTtoplist.c.

◆ write_gct_checkpoint()

int write_gct_checkpoint ( const char filename,
toplist_t tl,
toplist_t t2,
toplist_t t3,
UINT4  counter,
BOOLEAN  do_sync 
)

Checkpointing.

writes a checkpoint:

  • constructs temporary filename (by appending .TMP)
  • writes number of elements ("elems") in toplist to tempfile
  • dumps data to tempfile
  • appends counter
  • appends checksum (of elems, data and counter)
  • renames tempfile to final name returns -1 in case of an I/O error, -2 if out of memory, 0 otherwise (successful)

Definition at line 688 of file GCTtoplist.c.

◆ read_gct_checkpoint()

int read_gct_checkpoint ( const char filename,
toplist_t tl,
toplist_t t2,
toplist_t t3,
UINT4 counter 
)

tries to read a checkpoint

  • tries to open the file, returns 1 if no file found
  • reads elems, data, counter and checksum
  • verifies checksum
  • restores the heap by sorting returns 0 if successfully read a checkpoint 1 if no checkpoint was found -1 in case of an I/O error -2 if the checksum was wrong or elems was unreasonable

Definition at line 941 of file GCTtoplist.c.

◆ clear_gct_checkpoint()

int clear_gct_checkpoint ( const char filename)

removes a checkpoint returns 0 on success, errno on failure

Definition at line 1242 of file GCTtoplist.c.

◆ write_hfs_oputput()

int write_hfs_oputput ( const char filename,
toplist_t tl 
)

write the final output file:

  • re-sort the toplist into freq/alpha/delta/fdot order
  • write out the toplist in ASCII format with end marker to a temporary file
  • rename the file to the final name

Definition at line 1284 of file GCTtoplist.c.

Variable Documentation

◆ global_column_headings_stringp

char* global_column_headings_stringp
extern

Definition at line 231 of file HierarchSearchGCT.c.