Skip to content

Commit

Permalink
Merge pull request #267 from vincentcasseau/dev
Browse files Browse the repository at this point in the history
KCore - test: when the number of child nodes differ, list differences…
  • Loading branch information
vincentcasseau authored Jan 28, 2025
2 parents 9b31edd + 9dda204 commit 92c0cdc
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Cassiopee/KCore/KCore/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,29 @@ def checkTree__(node1, node2):
if GEOMETRIC_DIFF and node1[0] in ['NGonElements', 'NFaceElements']:
return 1
if len(node1[2]) != len(node2[2]):
childNames1 = [n[0] for n in node1[2]]
childNames2 = [n[0] for n in node2[2]]
childNamesSet1 = set(childNames1)
childNamesSet2 = set(childNames2)
diffSet12 = childNamesSet1 - childNamesSet2
diffSet21 = childNamesSet2 - childNamesSet1
print('DIFF: longueur des fils differente pour le noeud: %s.'%node1[0])
if len(diffSet12) > 0:
print(' - Noms des noeuds de courant qui ne sont pas dans '\
'ref:\n{}.'.format(', '.join(f'{i}' for i in diffSet12)))
if len(diffSet21) > 0:
print(' - Noms des noeuds de ref qui ne sont pas dans '\
'courant:\n{}.'.format(', '.join(f'{i}' for i in diffSet21)))
if len(diffSet12) == 0 and len(diffSet21) == 0:
from collections import Counter
if len(childNamesSet1) != len(childNames1):
doublons = set(i for i, count in Counter(childNames1).items() if count > 1)
print(' - Noeuds doublons detectes dans courant: {}.'.format(
', '.join(f'{i}' for i in doublons)))
if len(childNamesSet2) != len(childNames2):
doublons = set(i for i, count in Counter(childNames2).items() if count > 1)
print(' - Noeuds doublons detectes dans ref: {}.'.format(
', '.join(f'{i}' for i in doublons)))
return 0
if GEOMETRIC_DIFF and node1[0] in ['ElementRange', 'ElementConnectivity']:
return 1
Expand Down

0 comments on commit 92c0cdc

Please sign in to comment.