IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 22, 2006, 5:09:57 PM (20 years ago)
Author:
Paul Price
Message:

Adding pmFPAUtils.[ch], moving findChip and findCell in, renaming those

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/rel10_ifa/psModules/src/astrom/pmFPAConstruct.c

    r6663 r6673  
    99#include "pmFPAConstruct.h"
    1010#include "pmFPAview.h"
     11#include "pmFPAUtils.h"
    1112
    1213//////////////////////////////////////////////////////////////////////////////////////////////////////////////
     
    3233
    3334    return cellData;
    34 }
    35 
    36 // Find a chip by name; return the index
    37 static int findChip(pmFPA *fpa, // FPA in which to find the chip
    38                     const char *name // Name of the chip
    39                    )
    40 {
    41     psArray *chips = fpa->chips;    // Array of chips
    42     for (int i = 0; i < chips->n; i++) {
    43         pmChip *chip = chips->data[i]; // The chip of interest
    44         psString testName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); // Name of this chip
    45         if (strcmp(name, testName) == 0) {
    46             return i;
    47         }
    48     }
    49 
    50     psError(PS_ERR_IO, true, "Unable to find chip %s\n", name);
    51     return -1;
    52 }
    53 
    54 // Find a cell by name; return the index
    55 static int findCell(pmChip *chip, // Chip in which to find the cell
    56                     const char *name // Name of the cell
    57                    )
    58 {
    59     psArray *cells = chip->cells;    // Array of cells
    60     for (int i = 0; i < cells->n; i++) {
    61         pmCell *cell = cells->data[i]; // The cell of interest
    62         psString testName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); // Name of this cell
    63         if (strcmp(name, testName) == 0) {
    64             return i;
    65         }
    66     }
    67 
    68     psError(PS_ERR_IO, true, "Unable to find cell %s\n", name);
    69     return -1;
    7035}
    7136
     
    232197        // Get the chip
    233198        phuChipName = phuNameFromHeader("CHIP.NAME", formatSpec, phu); // Name of the chip
    234         int chipNum = findChip(fpa, phuChipName); // Chip number
     199        int chipNum = pmFPAFindChip(fpa, phuChipName); // Chip number
    235200        if (chipNum == -1) {
    236201            psError(PS_ERR_IO, true, "Unable to find chip %s in FPA.\n", phuChipName);
     
    257222            // Added this for possible future plans which might allow PHU=CELL
    258223            phuCellName = phuNameFromHeader("CELL.NAME", formatSpec, phu); // Name of the cell
    259             int cellNum = findCell(chip, phuCellName); // Cell number
     224            int cellNum = pmChipFindCell(chip, phuCellName); // Cell number
    260225            if (cellNum == -1) {
    261226                psError(PS_ERR_IO, true, "Unable to find cell %s in chip %s.\n", phuCellName, phuChipName);
     
    330295                         "(%s) --- there may be problems when reading!\n", chipName, phuChipName);
    331296                // Find the other chip
    332                 int chipNum = findChip(fpa, chipName); // The chip we're looking for
     297                int chipNum = pmFPAFindChip(fpa, chipName); // The chip we're looking for
    333298                if (chipNum == -1) {
    334299                    psLogMsg(__func__, PS_LOG_WARN, "Unable to find chip %s in fpa --- ignored.\n", chipName);
     
    338303            }
    339304            psString cellName = values->data[i]; // The name of the cell specified
    340             int cellNum = findCell(chip, cellName); // The cell we're looking for
     305            int cellNum = pmChipFindCell(chip, cellName); // The cell we're looking for
    341306            if (cellNum == -1) {
    342307                psLogMsg(__func__, PS_LOG_WARN, "Unable to find cell %s in chip %s --- ignored.\n",
     
    388353                psString chipName = names->data[i]; // The name of the chip
    389354                psString cellName = values->data[i]; // The name of the cell
    390                 int chipNum = findChip(fpa, chipName); // The chip we're looking for
     355                int chipNum = pmFPAFindChip(fpa, chipName); // The chip we're looking for
    391356                if (chipNum == -1) {
    392357                    psLogMsg(__func__, PS_LOG_WARN, "Unable to find chip %s in FPA --- ignored.\n", chipName);
     
    394359                }
    395360                chip = fpa->chips->data[chipNum];
    396                 int cellNum = findCell(chip, cellName); // The cell we're looking for
     361                int cellNum = pmChipFindCell(chip, cellName); // The cell we're looking for
    397362                if (cellNum == -1) {
    398363                    psLogMsg(__func__, PS_LOG_WARN, "Unable to find cell %s in chip %s --- ignored\n",
     
    429394                // Need to look up the name of the chip
    430395                chipName = phuNameFromHeader("CHIP.NAME", formatSpec, phu);
    431                 int chipNum = findChip(fpa, chipName);
     396                int chipNum = pmFPAFindChip(fpa, chipName);
    432397                if (chipNum == -1) {
    433398                    psLogMsg(__func__, PS_LOG_WARN, "Unable to find chip %s in FPA --- ignored.\n", chipName);
     
    444409                    chipName = names->data[i];
    445410                    cellName = cellType;
    446                     int chipNum = findChip(fpa, chipName); // The chip we're looking for
     411                    int chipNum = pmFPAFindChip(fpa, chipName); // The chip we're looking for
    447412                    if (chipNum == -1) {
    448413                        psLogMsg(__func__, PS_LOG_WARN, "Unable to find chip %s in FPA --- ignored.\n",
     
    455420                    cellName = names->data[i];
    456421                }
    457                 int cellNum = findCell(chip, cellName); // The cell we're looking for
     422                int cellNum = pmChipFindCell(chip, cellName); // The cell we're looking for
    458423                if (cellNum == -1) {
    459424                    psLogMsg(__func__, PS_LOG_WARN, "Unable to find cell %s in chip %s --- ignored.\n",
Note: See TracChangeset for help on using the changeset viewer.