Swarm-NG  1.1
swarm::query Namespace Reference

This namespace contains routines for opening and querying a swarm log file. More...

Classes

struct  idx_t
 Sort the raw outputs. More...
 
class  index_creator
 Define class for creating index. More...
 
struct  sysinfo
 Define structure sysinfo. More...
 
struct  range
 Structure defines data range. More...
 
class  swarmdb
 Defines swarmdb class. More...
 

Enumerations

enum  planets_coordinate_system_t
 Execute a query on the datafile. More...
 

Functions

bool sort_binary_log_file (const std::string &outfn, const std::string &infn)
 Sort the binary file.
 
void set_keplerian_output (const planets_coordinate_system_t &coordinate_system=jacobi)
 Set the output format of the execute to be in Keplerian coordinates.
 
void set_cartesian_output (const planets_coordinate_system_t &coordinate_system=origin)
 Set the output format of the execute to be in Cartesian coordinates.
 
void set_coordinate_system (const planets_coordinate_system_t &coordinate_system)
 Set the output format of the execute for the coordinates. More...
 
std::ostream & output_record (std::ostream &out, gpulog::logrecord &lr, const body_range_t &bod=body_range_t())
 Pretty print a log record to the output. More...
 
template<typename T >
arg_parse (const std::string &s)
 Parse the input.
 
template<typename T >
void validate (boost::any &v, const std::vector< std::string > &values, range< T > *target_type, int)
 Parser for range datatype to use with boost::program_options. More...
 
template<typename T >
std::ostream & operator<< (std::ostream &out, const range< T > &r)
 Petty print a range object. More...
 

Detailed Description

This namespace contains routines for opening and querying a swarm log file.

Swarm log file is a binary file with a simple textual header and a number of fixed size C structs (gpulog::logrecord).

swarmdb is used to open the log file and query it. API users should only interact with swarmdb.

swarmdb uses indexes for fast retrieval of data. The indexes are built the first time file is opened and then cached on disk. There are two indexes:

  1. Time index sorted based on time of records
  2. System index sorted based on system id of records

Although sort_binary_output_file function can be used to sort the entire data file, there is no reason to do so. Since all the accesses to the file go through the index.

Enumeration Type Documentation

Execute a query on the datafile.

The query consists of ranges for time (T), systems (sys) and bodies (bod)

Parameters
datafileFilename for the swarm binary log to query from
TRange of times to output
sysRange of systems to output
bodRange of bodies to output

Definition at line 129 of file query.hpp.

Function Documentation

template<typename T >
std::ostream& swarm::query::operator<< ( std::ostream &  out,
const range< T > &  r 
)

Petty print a range object.

Definition at line 100 of file query.hpp.

std::ostream & swarm::query::output_record ( std::ostream &  out,
gpulog::logrecord &  lr,
const body_range_t &  bod = body_range_t() 
)

Pretty print a log record to the output.

Definition at line 297 of file query.cpp.

void swarm::query::set_coordinate_system ( const planets_coordinate_system_t &  coordinate_system)

Set the output format of the execute for the coordinates.

Parameters
coordinate_systemChoice of coordinate system, c.f. planets_coordinate_system_t

Definition at line 73 of file query.cpp.

template<typename T >
void swarm::query::validate ( boost::any &  v,
const std::vector< std::string > &  values,
range< T > *  target_type,
int   
)

Parser for range datatype to use with boost::program_options.

Parse ranges of the form: <r1>..<r2> MIN..<r2> <r1>..MAX ALL

Definition at line 54 of file query.hpp.