Skip to content

Commit

Permalink
Corrected issue with monitors and commented lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Goldbach committed Apr 12, 2024
1 parent d37edfd commit c9e1d76
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions pyfoamd/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3256,7 +3256,8 @@ def __post_init__(self):
if not line.startswith("#"):
break
prevLine = line
self._columns = prevLine.lstrip('#').split('\t')
# self._columns = prevLine.lstrip('#').split('\t')
self._columns = re.split(r'\s{2,}', prevLine.lstrip('#'))
self._columns = [v.strip() for v in self._columns]

# logger.debug(f"columns: {self._columns}")
Expand Down Expand Up @@ -3417,10 +3418,9 @@ def countValues(list_, n=0):
parsedColumnLabels = False
# logger.debug(f'parsedColumnLabels set to {parsedColumnLabels}')

for i, (ofValue, ofType) in enumerate(zip(ofValues[1:], ofTypes[1:])):
print(f"columns: {self._columns}")

if len(self._columns) < i+2:
break
for i, (ofValue, ofType) in enumerate(zip(ofValues[1:], ofTypes[1:])):

if isinstance(ofValue, list):
for v in ofValue:
Expand Down Expand Up @@ -3532,11 +3532,10 @@ def update(self):
if i >= len(lines):
break # Found end of file
line = lines[i]
if not line:
break
if line.startswith('#'):
continue
data_, parsedColumnLabels, columns = \
# if not line:
# break
if line and not line.startswith('#'):
data_, parsedColumnLabels, columns = \
self._parseLine(line, i, data_, parsedColumnLabels,
columns)
# lineDf = pd.DataFrame(data_, index=i,
Expand Down Expand Up @@ -5121,7 +5120,7 @@ def _parseUniformField(self, name, string = None):
# logger.debug(f"parseUniformField string: {line}")
if line == "":
return None
if line.split()[1] == 'uniform': # whole line is passed as input
if len(line.split()) >=2 and line.split()[1] == 'uniform': # whole line is passed as input
# lineList = line.split()[2:] # Remove the 'table' designation
lineList = self._getLinesList(line)[2:] # Remove the 'table' designation
else:
Expand Down Expand Up @@ -5375,7 +5374,7 @@ def _parseLineLenGreaterThanTwo(self):

#Parse the line to extract the entry name
lineList = self._getLinesList(line_)
if lineList[1] == 'table':
if len(lineList) >=2 and lineList[1] == 'table':
entryName = " ".join(lineList[:2])
valueStr = " ".join(lineList[2:]).strip()
# logger.debug(f"entryName: {entryName}")
Expand Down

0 comments on commit c9e1d76

Please sign in to comment.