Skip to content

Commit

Permalink
Merge pull request #61 from CyrilleBonamy/master
Browse files Browse the repository at this point in the history
issue #60 resolution
  • Loading branch information
CyrilleBonamy authored Nov 21, 2024
2 parents 2e3ef41 + f9922db commit 42aa07f
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 16 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_and_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- run: pip install -U pip pipenv coverage
- run: pip install -U numpy scipy matplotlib
- name: Check out repository code
uses: actions/checkout@v2
uses: actions/checkout@v4
- run: set -o pipefail
- name: Build and install fluidfoam
run: |
Expand All @@ -38,8 +38,8 @@ jobs:
if: startsWith(github.event.ref, 'refs/tags')
steps:
- name: Check out repository code
uses: actions/checkout@v2
- uses: actions/setup-python@v2
uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Deploy package
uses: casperdcl/deploy-pypi@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- run: pip install -U pip pipenv coverage
- run: pip install -U numpy scipy matplotlib
- name: Check out repository code
uses: actions/checkout@v2
uses: actions/checkout@v4
- run: set -o pipefail
- name: Build and install fluidfoam
run: |
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ What is this repository for?
----------------------------

* Openfoam Tools
* Version : 0.2.7
* Supported OpenFoam Versions : 2.4.0, 4.1 to 9, v1712plus to v2312plus
* Version : 0.2.8
* Supported OpenFoam Versions : 2.4.0, 4.1 to 9, v1712plus to v2406plus
* Supported Python Versions : >= 3.8

Documentation and Examples
Expand Down
4 changes: 2 additions & 2 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ What is this repository for?
----------------------------

* Openfoam Tools
* Version : 0.2.7
* Supported OpenFoam Versions : 2.4.0, 4.1 to 9, v1712plus to v2312plus
* Version : 0.2.8
* Supported OpenFoam Versions : 2.4.0, 4.1 to 9, v1712plus to v2406plus
* Supported Python Versions : >= 3.8

Deployment instructions
Expand Down
2 changes: 1 addition & 1 deletion fluidfoam/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
'a' or 'alpha' means alpha version (internal testing),
'b' or 'beta' means beta version (external testing).
"""
__version__ = "0.2.7"
__version__ = "0.2.8"
25 changes: 22 additions & 3 deletions fluidfoam/readof.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,10 @@ def _parse_session(self, title):
elif level == 2:
if previous_line not in dict_session:
dict_session[previous_line] = {}
dict_session[previous_line][tmp[0]] = tmp[1]
try:
dict_session[previous_line][tmp[0]] = tmp[1]
except TypeError:
pass
if level == 0:
break
previous_line = line
Expand All @@ -214,10 +217,26 @@ def _parse_session(self, title):

def _parse_data(self, boundary, datatype, precision=15):

import sys
if boundary is not None:
boun = str.encode(boundary)
if b"value" in self.content.split(boun)[1].split(b"}")[0]:
data = self.content.split(boun)[1].split(b"value")[1]
if (np.size(self.content.split(boun))<=2):
iboun =1
else:
lines = self.content.split(b"\n")
iboun = 0
for line in lines:
if boun in line.strip():
iboun += 1
if boun == line.strip():
break

if iboun >= np.size(self.content.split(boun)):
print(R+"Error : No boundary/patch "+str(boun)+W)
sys.exit(1)

elif b"value" in self.content.split(boun)[iboun].split(b"}")[0]:
data = self.content.split(boun)[iboun].split(b"value")[1]
else:
if self.verbose:
print(R+"Warning : No data on boundary/patch")
Expand Down
8 changes: 4 additions & 4 deletions fluidfoam/readpostpro.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def readforce(path, namepatch="forces", time_name="0", name="forces"):
path_namepatch = path+namepatch
else:
path_namepatch = path+'/postProcessing/'+namepatch
if time_name is "latestTime":
if time_name == "latestTime":
time_name = _find_latesttime(path_namepatch)
elif time_name is "mergeTime":
elif time_name == "mergeTime":
time_list = []
dir_list = os.listdir(path_namepatch)
for directory in dir_list:
Expand Down Expand Up @@ -135,9 +135,9 @@ def readprobes(path, probes_name="probes", time_name="0", name="U"):
path_probes_name = path+probes_name
else:
path_probes_name = path+'/postProcessing/'+probes_name
if time_name is "latestTime":
if time_name == "latestTime":
time_name = _find_latesttime(path_probes_name)
elif time_name is "mergeTime":
elif time_name == "mergeTime":
time_list = []
dir_list = os.listdir(path_probes_name)
for directory in dir_list:
Expand Down

0 comments on commit 42aa07f

Please sign in to comment.