IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 14, 2008, 4:26:09 PM (18 years ago)
Author:
Paul Price
Message:

Gene needs the concepts copied over in pmFPAfileDefineChipMosaic, so to avoid the error due to differing number of cells, I've made new functions that provide optional recursion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/concepts/pmConcepts.c

    r16218 r16481  
    11201120    return true;
    11211121}
     1122
     1123
     1124bool pmConceptsCopyFPA(pmFPA *target, const pmFPA *source, bool chips, bool cells)
     1125{
     1126    PS_ASSERT_PTR_NON_NULL(target, false);
     1127    PS_ASSERT_PTR_NON_NULL(source, false);
     1128
     1129    // Copy FPA concepts
     1130    copyConcepts(target->concepts, source->concepts, dontCopyConceptsFPA);
     1131
     1132    // Copy chip concepts
     1133    bool status = true;                 // Status of chips
     1134    if (chips) {
     1135        psArray *targetChips = target->chips; // Chips in target
     1136        psArray *sourceChips = source->chips; // Chips in source
     1137        if (targetChips->n != sourceChips->n) {
     1138            psError(PS_ERR_IO, true,
     1139                    "Number of chips in target (%ld) and source (%ld) differ --- unable to copy concepts.",
     1140                    targetChips->n, sourceChips->n);
     1141            return false;
     1142        }
     1143        for (int i = 0; i < targetChips->n; i++) {
     1144            pmChip *targetChip = targetChips->data[i]; // Target chip of interest
     1145            pmChip *sourceChip = sourceChips->data[i]; // Source chip of interest
     1146            if (! targetChip || ! sourceChip) {
     1147                continue;
     1148            }
     1149
     1150            status &= pmConceptsCopyChip(targetChip, sourceChip, cells);
     1151        }
     1152    }
     1153
     1154    return status;
     1155}
     1156
     1157bool pmConceptsCopyChip(pmChip *target, const pmChip *source, bool cells)
     1158{
     1159    PS_ASSERT_PTR_NON_NULL(target, false);
     1160    PS_ASSERT_PTR_NON_NULL(source, false);
     1161
     1162    // Copy chip concepts
     1163    copyConcepts(target->concepts, source->concepts, dontCopyConceptsChip);
     1164
     1165    // Copy cell concepts
     1166    bool status = true;                 // Status of cells
     1167    if (cells) {
     1168        psArray *targetCells = target->cells; // Cells in target
     1169        psArray *sourceCells = source->cells; // Cells in source
     1170        if (targetCells->n != sourceCells->n) {
     1171            psError(PS_ERR_IO, true,
     1172                    "Number of cells in target (%ld) and source (%ld) differ --- unable to copy concepts.",
     1173                    targetCells->n, sourceCells->n);
     1174            return false;
     1175        }
     1176        for (int j = 0; j < targetCells->n; j++) {
     1177            pmCell *targetCell = targetCells->data[j]; // Target chip of interest
     1178            pmCell *sourceCell = sourceCells->data[j]; // Source chip of interest
     1179            if (! targetCell || ! sourceCell) {
     1180                continue;
     1181            }
     1182
     1183            status &= pmConceptsCopyCell(targetCell, sourceCell);
     1184        }
     1185    }
     1186
     1187    return status;
     1188}
     1189
     1190
     1191bool pmConceptsCopyCell(pmCell *target, const pmCell *source)
     1192{
     1193    PS_ASSERT_PTR_NON_NULL(target, false);
     1194    PS_ASSERT_PTR_NON_NULL(source, false);
     1195
     1196    copyConcepts(target->concepts, source->concepts, dontCopyConceptsCell);
     1197
     1198    return true;
     1199}
Note: See TracChangeset for help on using the changeset viewer.