Skip to content

Commit

Permalink
Rearrange to prevent possible crash from overflow error in case of wr…
Browse files Browse the repository at this point in the history
…ong index
  • Loading branch information
wingena committed Jun 26, 2024
1 parent e2a6595 commit 5dd1248
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions source/pfcClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,11 @@ def makePFC(self,MHD,CAD,ROIidx,clobberFlag=True):
for i,facet in enumerate(self.mesh.Facets):
neighbours = list(facet.NeighbourIndices)
for j,n in enumerate(neighbours):
n = np.int64(n)
if n >= self.Nfaces:
print('Wrong neighbour index detected in PFC ' + self.name + ': facet = ' + str(i) + ' , neighbours = ' + str(neighbours))
log.info('Wrong neighbour index detected in PFC ' + self.name + ': facet = ' + str(i) + ' , neighbours = ' + str(neighbours))
n = -1
neighbours[j] = n
neighbours[j] = np.int64(n)
self.allNeighbours[i] = neighbours

#phi vector at each mesh center
Expand Down

0 comments on commit 5dd1248

Please sign in to comment.