Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pycodegen
lbmpy
Commits
13df23c8
Commit
13df23c8
authored
Dec 21, 2021
by
Helen Schottenhamml
Browse files
Merge branch 'RoundOffError' into 'master'
Fix precision problems See merge request
!112
parents
553eb5bf
3f114046
Pipeline
#36490
failed with stages
in 48 minutes and 55 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
lbmpy/boundaries/boundaryhandling.py
View file @
13df23c8
...
...
@@ -160,7 +160,7 @@ class LbmWeightInfo(CustomCodeNode):
self
.
weights_symbol
=
TypedSymbol
(
"weights"
,
data_type
)
data_type_string
=
"double"
if
self
.
weights_symbol
.
dtype
.
numpy_dtype
==
np
.
float64
else
"float"
weights
=
[
str
(
w
.
evalf
())
for
w
in
lb_method
.
weights
]
weights
=
[
str
(
w
.
evalf
(
17
))
for
w
in
lb_method
.
weights
]
if
data_type_string
==
"float"
:
weights
=
"f, "
.
join
(
weights
)
weights
+=
"f"
# suffix for the last element
...
...
@@ -172,7 +172,7 @@ class LbmWeightInfo(CustomCodeNode):
def
weight_of_direction
(
self
,
dir_idx
,
lb_method
=
None
):
if
isinstance
(
sp
.
sympify
(
dir_idx
),
sp
.
Integer
):
return
lb_method
.
weights
[
dir_idx
].
evalf
()
return
lb_method
.
weights
[
dir_idx
].
evalf
(
17
)
else
:
return
sp
.
IndexedBase
(
self
.
weights_symbol
,
shape
=
(
1
,))[
dir_idx
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment