To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit a029a759 authored by sfritschi's avatar sfritschi
Browse files

Improved cellList initialization

parent 10ad95fd
......@@ -144,37 +144,59 @@ class CellList:
L = [ub-lb for lb,ub in zip(basenet.lb,basenet.ub)]
# Sort pores according to cell membership
self.poresSorted = [set() for _ in range(self.totalCells)]
for poreIdx, pore in enumerate(pores):
cellIdx = self.pore_to_index(pore)
self.poresSorted[cellIdx].add(poreIdx)
self.poresPos += pore.pos
if poreIdx < nInterior:
# Pre-fix sum
nthroats = len(pore.throats)
if isPeriodicCheck:
for poreIdx, pore in enumerate(pores):
cellIdx = self.pore_to_index(pore)
offset += nthroats
self.throatOffsets.append(offset)
self.poresSorted[cellIdx].add(poreIdx)
self.poresPos += pore.pos
if isPeriodicCheck:
if poreIdx < nInterior:
# Pre-fix sum
nthroats = len(pore.throats)
offset += nthroats
self.throatOffsets.append(offset)
self.originalIdx[poreIdx] = poreIdx # identity
copyIndices = []
for cpore in copies[pore]:
copyIndices.append(cpore.index)
self.periodicCopies[poreIdx] = copyIndices
for throat in pore.throats:
self.throatL.append(distance(*throat_ends(throat, L)))
self.throatR.append(throat.r)
self.poreThroatIndices[poreIdx].add(throatIdx)
throatIdx += 1
else: # periodic copy of pore in interior
# Determine index of original pore
originalIdx, _ = pore.label.split(' ',1)
self.originalIdx[poreIdx] = int(originalIdx)
else:
for poreIdx, pore in enumerate(pores):
cellIdx = self.pore_to_index(pore)
self.poresSorted[cellIdx].add(poreIdx)
self.poresPos += pore.pos
if poreIdx < nInterior:
# Pre-fix sum
nthroats = len(pore.throats)
for throat in pore.throats:
self.throatL.append(distance(*throat_ends(throat, L)))
self.throatR.append(throat.r)
self.poreThroatIndices[poreIdx].add(throatIdx)
throatIdx += 1
elif isPeriodicCheck: # periodic copy of pore in interior
# Determine index of original pore
originalIdx, _ = pore.label.split(' ',1)
self.originalIdx[poreIdx] = int(originalIdx)
offset += nthroats
self.throatOffsets.append(offset)
for throat in pore.throats:
self.throatL.append(distance(*throat_ends(throat, L)))
self.throatR.append(throat.r)
self.poreThroatIndices[poreIdx].add(throatIdx)
throatIdx += 1
throatTotal = throatIdx
self.poreThroatTable = mp.RawArray('i', throatTotal)
......@@ -929,7 +951,8 @@ def generate_dendrogram(basenet: Network, targetsize: List[int], \
ttbr = cellList.poreThroatIndices[poreIdx]
if (len(ttbr) == 0):
continue # Nothing left to do
# Expensive: Find alternative (multiprocessing)
candidates = cellList.find_candidates(poreIdx)
for throatIdx in ttbr.copy():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment