Skip to content

Commit

Permalink
[ck2cti] Show name of species with undefined elements in error message
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed Feb 18, 2019
1 parent aa9721d commit d04fd8c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions interfaces/cython/cantera/ck2cti.py
Original file line number Diff line number Diff line change
Expand Up @@ -1995,17 +1995,16 @@ def parseTransportData(self, lines, filename, line_offset):

def getSpeciesString(self, speciesList, indent):
speciesNameLength = 1
elementsFromSpecies = set()
allElements = set(self.elements)
for s in speciesList:
if s.composition is None:
raise InputParseError('No thermo data found for species: {0!r}'.format(s.label))
elementsFromSpecies.update(s.composition)
missingElements = set(s.composition) - allElements
if missingElements:
raise InputParseError("Undefined elements in species '{}':"
" {}".format(s.label, ','.join(repr(e) for e in missingElements)))
speciesNameLength = max(speciesNameLength, len(s.label))

missingElements = elementsFromSpecies - set(self.elements)
if missingElements:
raise InputParseError('Undefined elements: ' + str(missingElements))

speciesNames = ['']
speciesPerLine = max(int((80-indent)/(speciesNameLength + 2)), 1)

Expand Down

0 comments on commit d04fd8c

Please sign in to comment.