Skip to content

Commit bfd6383

Browse files
committed
rcx: some renaming and new comment to improve readability
Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
1 parent 5f0ba34 commit bfd6383

2 files changed

Lines changed: 28 additions & 19 deletions

File tree

src/rcx/src/extmeasure.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2569,9 +2569,10 @@ void extMeasure::measureRC(CoupleOptions& options)
25692569
" ---------------------------------------------------------------"
25702570
"------------------\n");
25712571
}
2572-
double deltaRes[10];
2572+
2573+
double base_resistances[10];
25732574
for (uint32_t jj = 0; jj < _metRCTable.getCnt(); jj++) {
2574-
deltaRes[jj] = 0.0;
2575+
base_resistances[jj] = 0.0;
25752576
}
25762577

25772578
SEQ* s = addSeq(_ll, _ur);
@@ -2583,15 +2584,18 @@ void extMeasure::measureRC(CoupleOptions& options)
25832584
len_covered += len_down_not_coupled;
25842585
}
25852586
if (len_covered > 0) {
2586-
calcRes0(deltaRes, _met, len_covered);
2587+
calcRes0(base_resistances, _met, len_covered);
25872588
}
25882589

25892590
for (uint32_t jj = 0; jj < _metRCTable.getCnt(); jj++) {
2590-
double totR1 = _rc[jj]->res_;
2591-
if (totR1 > 0) {
2592-
totR1 -= deltaRes[jj];
2593-
if (totR1 != 0.0) {
2594-
_extMain->updateRes(rseg1, totR1, jj);
2591+
const double total_resistance = _rc[jj]->res_;
2592+
2593+
if (total_resistance > 0) {
2594+
const double neighboring_adjustment
2595+
= total_resistance - base_resistances[jj];
2596+
2597+
if (neighboring_adjustment != 0.0) {
2598+
_extMain->updateRes(rseg1, neighboring_adjustment, jj);
25952599
}
25962600
}
25972601
}

src/rcx/src/extmeasure_res.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,20 +103,21 @@ uint32_t extMeasure::computeRes(SEQ* s,
103103
return 0;
104104
}
105105

106-
Array1D<SEQ*> overlapSeq(16);
107-
getDgOverlap_res(s, _dir, dgContext, &overlapSeq, residueSeq);
106+
Array1D<SEQ*> neighbor_regions(16);
107+
getDgOverlap_res(s, _dir, dgContext, &neighbor_regions, residueSeq);
108108

109-
uint32_t len = 0;
110-
for (uint32_t jj = 0; jj < overlapSeq.getCnt(); jj++) {
111-
SEQ* tgt = overlapSeq.get(jj);
112-
uint32_t diagDist = calcDist(tgt->_ll, tgt->_ur);
113-
uint32_t len1 = getLength(tgt, !_dir);
109+
uint32_t total_neighbors_span = 0;
110+
for (uint32_t jj = 0; jj < neighbor_regions.getCnt(); jj++) {
111+
SEQ* neighbor_region = neighbor_regions.get(jj);
112+
uint32_t distance_to_neighbor
113+
= calcDist(neighbor_region->_ll, neighbor_region->_ur);
114+
uint32_t neighbor_span = getLength(neighbor_region, !_dir);
114115

115-
len += len1;
116-
calcRes(_rsegSrcId, len1, _dist, diagDist, _met);
116+
total_neighbors_span += neighbor_span;
117+
calcRes(_rsegSrcId, neighbor_span, _dist, distance_to_neighbor, _met);
117118
}
118-
seq_release(&overlapSeq);
119-
return len;
119+
seq_release(&neighbor_regions);
120+
return total_neighbors_span;
120121
}
121122

122123
int extMeasure::getMaxDist(int tgtMet, uint32_t modelIndex)
@@ -236,6 +237,8 @@ extDistRC* extDistRCTable::getComputeRC_res(uint32_t dist1, uint32_t dist2)
236237
return nullptr;
237238
}
238239

240+
// This represents the first RESOVER table row i.e., the entry
241+
// in which there is no neighboring context effect.
239242
extDistRC* rc1 = measureTableR_[0]->geti(0);
240243
rc1->diag_ = 0.0;
241244
if (rc1 == nullptr) {
@@ -245,9 +248,11 @@ extDistRC* extDistRCTable::getComputeRC_res(uint32_t dist1, uint32_t dist2)
245248
if (dist1 + dist2 == 0) { // ASSUMPTION: 0 dist exists as first
246249
return rc1;
247250
}
251+
248252
if (dist1 >= maxDist_ && dist2 >= maxDist_) {
249253
return nullptr;
250254
}
255+
251256
if (dist2 > maxDist_) {
252257
dist2 = dist1;
253258
dist1 = 0;

0 commit comments

Comments
 (0)