IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13443


Ignore:
Timestamp:
May 21, 2007, 8:52:42 AM (19 years ago)
Author:
eugene
Message:

cleanup names, ready to compile

Location:
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/avextract.c

    r13440 r13443  
    33int avextract (int argc, char **argv) {
    44 
    5   int i, j, m, N, NPTS, param;
     5  int i, j, m, N, NPTS, last, Nfields;
    66  int Nsecfilt, mode;
    77  char *RegionName, *RegionList, *p;
     
    1111  PhotCode *code;
    1212  Vector *vec;
     13
     14  dvoFields *fields;
    1315
    1416  /* defaults */
     
    2729
    2830  // parse the fields to be extracted and returned
    29   narg = argc;
    30   fields = ParseCmdlineFields (argc, argv, DVO_TABLE_AVERAGE, &last, &Nfields);
     31  fields = dbCmdlineFields (argc, argv, DVO_TABLE_AVERAGE, &last, &Nfields);
    3132  if (fields == NULL) return (FALSE);
    3233
    33   // require 'where' before boolean math
    34   if ((last != argc) && (strcasecmp(argv[last], "where") || (last >= argc - 2))) {
    35     gprint (GP_ERR, "syntax error\n");
    36     free (fields);
    37     return (FALSE);
    38   }
    39 
    4034  // parse the remainder of the line as a boolean math expression
    41   cstack = isolate_elements (argv-last, &argv[last+1], &Ncstack);
     35  cstack = isolate_elements (argv-last, &argv[last], &Ncstack);
    4236 
    43   // construct the db Boolean math stack
    44   dbStack = db_convert_to_RPN (Ncstack, cstack, &NdbStack);
     37  // construct the db Boolean math stack (frees cstack)
     38  dbStack = dbRPN (Ncstack, cstack, &NdbStack);
    4539
    4640  Nreturn = Nfields;
    47   db_check_stack (dbStack, NdbStack, DVO_TABLE_AVERAGE, fields, &Nfields);
     41  dbCheckStack (dbStack, NdbStack, DVO_TABLE_AVERAGE, &fields, &Nfields);
     42  // XXX handle errors
    4843
    4944  /* interpret command-line options */
    50   SetSelectionParam (0);
     45  // this needs to explicitly handles -qregion and -skyregion
    5146  if (!SetRegionSelection (&argc, argv, &RegionName, &RegionList)) goto escape;
    5247
     
    5550
    5651  /* create output storage vectors */
    57   ALLOCATE (return, float, Nreturn);
     52  ALLOCATE (values, float, Nfields);
    5853  ALLOCATE (vec, Vector, Nreturn);
    5954  for (i = 0; i < Nreturn; i++) {
     
    8176      m = catalog.average[j].offset;
    8277      // extract the relevant values
     78      // XXX for measure values, this could be optimized for one loop over measures...
    8379      for (n = 0; n < Nfields; n++) {
    8480        values[n] = ExtractAveragesNew (&catalog.average[j], &catalog.secfilt[j*Nsecfilt], &catalog.measure[m], fields[n]);
    8581      }
    8682      // test the conditional statement
    87       if (!CheckBooleanCond (dbStack, NdbStack, values, fields, Nfields)) continue;
     83      if (!dbBooleanCond (dbStack, NdbStack, values, fields, Nfields)) continue;
    8884      for (n = 0; n < Nreturn; n++) {
    8985        vec[n].elements[N] = values[n];
    9086      }
    9187      N++;
    92       CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 2000);
     88      if (N >= NPTS) {
     89        NPTS += 2000;
     90        for (n = 0; n < Nreturn; n++) {
     91          REALLOCATE (vec[n].elements, float, NPTS);
     92        }
     93      }
    9394    }
    9495    dvo_catalog_free (&catalog);
    9596  }
    96   vec[0].Nelements = N;
    97   REALLOCATE (vec[0].elements, float, MAX(1,N));
     97  for (n = 0; n < Nreturn; n++) {
     98    vec[n].Nelements = N;
     99    REALLOCATE (vec[n].elements, float, MAX(1,N));
     100  }
    98101
    99102  SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL)));
  • branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/dbStackMath.c

    r13440 r13443  
    11# include "opihi.h"
    22
    3 dvoStack *db_binary (dvoStack *V1, dvoStack *V2, char *op, float *fields, int Nfields) {
     3dvoStack *dbBinary (dvoStack *V1, dvoStack *V2, char *op, float *fields, int Nfields) {
    44
    55  float M1, M2;
     
    8585}
    8686
    87 dvoStack *db_unary (dvoStack *V1, dvoStack *V2, char *op, float *fields, int Nfields) {
     87dvoStack *dbUnary (dvoStack *V1, dvoStack *V2, char *op, float *fields, int Nfields) {
    8888
    8989  float M1;
Note: See TracChangeset for help on using the changeset viewer.