23 int main(
int argc, 
char **argv)
 
   36     JParser<> zap(
"Auxiliary program to run fast Fourier transformation (FFT).");
 
   38     zap[
'f'] = 
make_field(inputFile,  
"input file (containing 1D array of values)");
 
   40     zap[
'B'] = 
make_field(binWidth,   
"bin width of input array (if zero, use index)") = 0.0;
 
   41     zap[
'F'] = 
make_field(precision,  
"number of decimals if output format")           = 9;
 
   46   catch(
const exception& error) {
 
   47     FATAL(error.what() << endl);
 
   54   istream* 
in = open<istream>(inputFile);
 
   57     FATAL(
"Invalid file " << inputFile << endl);
 
   60   for (
double x; *
in >> 
x; ) {
 
   66   const size_t N  = data.size(); 
 
   69     FATAL(
"Number of points: " << 
N << endl);
 
   74   const size_t  NS     = 
N/2 + 1;
 
   75   double*       input  = (
double*) malloc(
sizeof(
double) *  
N);
 
   76   fftw_complex* output = (fftw_complex*) fftw_malloc(
sizeof(fftw_complex) * NS);
 
   77   fftw_plan     plan   = fftw_plan_dft_r2c_1d(
N, input, output, FFTW_MEASURE);
 
   79   for (
size_t i = 0; i != 
N; ++i) {
 
   89   fftw_destroy_plan(plan);
 
   93   const double xmin  = (binWidth != 0.0 ? 1.0 / (
N * binWidth) : 0.0);
 
   94   const double xmax  = (binWidth != 0.0 ? 1.0 / (binWidth)     : 0.0);
 
   96   const int    width = precision + 7;
 
   98   ostream* out = open<ostream>(
outputFile.c_str());
 
  100   for (
size_t i = 0; i != NS; ++i) {
 
  102     const double real  = output[i][0];
 
  103     const double imag  = output[i][1];
 
  104     const double power = sqrt(real*real + imag*imag);
 
  112     *out << 
SCIENTIFIC(width,precision) << power << endl;
 
Utility class to parse command line options. 
 
int main(int argc, char *argv[])
 
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
void close(std::istream *pf)
Close file. 
 
General purpose messaging. 
 
Utility class to parse command line options. 
 
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
 
Auxiliary data structure for floating point format specification.