Skip to content

Commit 42aa07f

Browse files
Merge pull request #61 from CyrilleBonamy/master
issue #60 resolution
2 parents 2e3ef41 + f9922db commit 42aa07f

File tree

7 files changed

+35
-16
lines changed

7 files changed

+35
-16
lines changed

.github/workflows/build_and_pypi.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- run: pip install -U pip pipenv coverage
1515
- run: pip install -U numpy scipy matplotlib
1616
- name: Check out repository code
17-
uses: actions/checkout@v2
17+
uses: actions/checkout@v4
1818
- run: set -o pipefail
1919
- name: Build and install fluidfoam
2020
run: |
@@ -38,8 +38,8 @@ jobs:
3838
if: startsWith(github.event.ref, 'refs/tags')
3939
steps:
4040
- name: Check out repository code
41-
uses: actions/checkout@v2
42-
- uses: actions/setup-python@v2
41+
uses: actions/checkout@v4
42+
- uses: actions/setup-python@v5
4343
- name: Deploy package
4444
uses: casperdcl/deploy-pypi@v2
4545
with:

.github/workflows/build_and_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- run: pip install -U pip pipenv coverage
1515
- run: pip install -U numpy scipy matplotlib
1616
- name: Check out repository code
17-
uses: actions/checkout@v2
17+
uses: actions/checkout@v4
1818
- run: set -o pipefail
1919
- name: Build and install fluidfoam
2020
run: |

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ What is this repository for?
2626
----------------------------
2727

2828
* Openfoam Tools
29-
* Version : 0.2.7
30-
* Supported OpenFoam Versions : 2.4.0, 4.1 to 9, v1712plus to v2312plus
29+
* Version : 0.2.8
30+
* Supported OpenFoam Versions : 2.4.0, 4.1 to 9, v1712plus to v2406plus
3131
* Supported Python Versions : >= 3.8
3232

3333
Documentation and Examples

doc/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ What is this repository for?
1313
----------------------------
1414

1515
* Openfoam Tools
16-
* Version : 0.2.7
17-
* Supported OpenFoam Versions : 2.4.0, 4.1 to 9, v1712plus to v2312plus
16+
* Version : 0.2.8
17+
* Supported OpenFoam Versions : 2.4.0, 4.1 to 9, v1712plus to v2406plus
1818
* Supported Python Versions : >= 3.8
1919

2020
Deployment instructions

fluidfoam/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
'a' or 'alpha' means alpha version (internal testing),
1212
'b' or 'beta' means beta version (external testing).
1313
"""
14-
__version__ = "0.2.7"
14+
__version__ = "0.2.8"

fluidfoam/readof.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,10 @@ def _parse_session(self, title):
205205
elif level == 2:
206206
if previous_line not in dict_session:
207207
dict_session[previous_line] = {}
208-
dict_session[previous_line][tmp[0]] = tmp[1]
208+
try:
209+
dict_session[previous_line][tmp[0]] = tmp[1]
210+
except TypeError:
211+
pass
209212
if level == 0:
210213
break
211214
previous_line = line
@@ -214,10 +217,26 @@ def _parse_session(self, title):
214217

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

220+
import sys
217221
if boundary is not None:
218222
boun = str.encode(boundary)
219-
if b"value" in self.content.split(boun)[1].split(b"}")[0]:
220-
data = self.content.split(boun)[1].split(b"value")[1]
223+
if (np.size(self.content.split(boun))<=2):
224+
iboun =1
225+
else:
226+
lines = self.content.split(b"\n")
227+
iboun = 0
228+
for line in lines:
229+
if boun in line.strip():
230+
iboun += 1
231+
if boun == line.strip():
232+
break
233+
234+
if iboun >= np.size(self.content.split(boun)):
235+
print(R+"Error : No boundary/patch "+str(boun)+W)
236+
sys.exit(1)
237+
238+
elif b"value" in self.content.split(boun)[iboun].split(b"}")[0]:
239+
data = self.content.split(boun)[iboun].split(b"value")[1]
221240
else:
222241
if self.verbose:
223242
print(R+"Warning : No data on boundary/patch")

fluidfoam/readpostpro.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ def readforce(path, namepatch="forces", time_name="0", name="forces"):
4949
path_namepatch = path+namepatch
5050
else:
5151
path_namepatch = path+'/postProcessing/'+namepatch
52-
if time_name is "latestTime":
52+
if time_name == "latestTime":
5353
time_name = _find_latesttime(path_namepatch)
54-
elif time_name is "mergeTime":
54+
elif time_name == "mergeTime":
5555
time_list = []
5656
dir_list = os.listdir(path_namepatch)
5757
for directory in dir_list:
@@ -135,9 +135,9 @@ def readprobes(path, probes_name="probes", time_name="0", name="U"):
135135
path_probes_name = path+probes_name
136136
else:
137137
path_probes_name = path+'/postProcessing/'+probes_name
138-
if time_name is "latestTime":
138+
if time_name == "latestTime":
139139
time_name = _find_latesttime(path_probes_name)
140-
elif time_name is "mergeTime":
140+
elif time_name == "mergeTime":
141141
time_list = []
142142
dir_list = os.listdir(path_probes_name)
143143
for directory in dir_list:

0 commit comments

Comments
 (0)