IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 4, 2016, 1:12:14 PM (11 years ago)
Author:
eugene
Message:

changes to dvomerge to handle a cpt list restriction

Location:
trunk/Ohana/src/libdvo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libdvo/include/dvo.h

    r39293 r39301  
    10711071SkyTable  *SkyTableLoadOptimal     PROTO((char *catdir, char *SKYFILE, char *GSCFILE, int readwrite, int depth, int VERBOSE));
    10721072int        SkyTableSetDepth        PROTO((SkyTable *sky, int depth));
     1073SkyList   *SkyListMatchList        PROTO((SkyList *inlist, char **cptlist, int Ncptlist));
    10731074SkyList   *SkyRegionByIndex        PROTO((SkyTable *table, int index));
    10741075SkyList   *SkyRegionByCPT          PROTO((SkyTable *table, char *filename));
  • trunk/Ohana/src/libdvo/src/skyregion_ops.c

    r38553 r39301  
    154154    }
    155155  }
     156  list[0].Nregions = N;
     157  return (list);
     158}
     159
     160/* find regions at all levels which match list of names */
     161SkyList *SkyListMatchList (SkyList *inlist, char **cptlist, int Ncptlist) {
     162
     163  int i, j;
     164  SkyList *list;
     165 
     166  int N = 0;
     167  int NREGIONS = 10;
     168  ALLOCATE (list, SkyList, 1);
     169  ALLOCATE (list[0].regions, SkyRegion *, NREGIONS);
     170  ALLOCATE (list[0].filename, char *, NREGIONS);
     171  list[0].Nregions = N;
     172  list[0].ownElements = FALSE; // this list is only holding a view to the elements
     173  strcpy (list[0].hosts, inlist[0].hosts);
     174
     175  SkyRegion **regions = inlist[0].regions;
     176
     177  for (i = 0; i < inlist[0].Nregions; i++) {
     178    int found = FALSE;
     179    for (j = 0; !found && (j < Ncptlist); j++) {
     180      int Nchar = strlen (cptlist[j]);
     181      if (strncasecmp (regions[i][0].name, cptlist[j], Nchar)) continue;
     182
     183      list[0].regions[N] = regions[i];
     184      list[0].filename[N] = inlist[0].filename[i];
     185      N++;
     186      if (N >= NREGIONS) {
     187        NREGIONS += 10;
     188        REALLOCATE (list[0].regions, SkyRegion *, NREGIONS);
     189        REALLOCATE (list[0].filename, char *, NREGIONS);
     190      }
     191      found = TRUE;
     192    }
     193    // we do not care if one of the regions does not match.  do we care if any of the
     194    // cptfile do not match?
     195  }
     196  SkyListFree (inlist);
     197
    156198  list[0].Nregions = N;
    157199  return (list);
Note: See TracChangeset for help on using the changeset viewer.