Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mischa Dombrowski
lbmweights
Commits
2839d405
Commit
2839d405
authored
Sep 03, 2019
by
MischaD
Browse files
Added shell
parent
1a9d5134
Changes
1
Hide whitespace changes
Inline
Side-by-side
lbmweights/shell.py
0 → 100644
View file @
2839d405
import
numpy
as
np
from
.utils.mylog
import
logger
class
Shell
:
def
__init__
(
self
,
velocities
):
self
.
_weight
=
None
self
.
_c_s_sq
=
None
self
.
shell
=
abs
(
velocities
[
0
]
**
2
).
sum
()
self
.
type
=
tuple
(
np
.
sort
(
abs
(
velocities
[
0
])))
self
.
size
=
len
(
velocities
)
self
.
velocities
=
velocities
def
__repr__
(
self
):
repr_string
=
"Shell: {} - Type: {} - Amount of velocities: {}"
.
format
(
self
.
shell
,
self
.
type
,
self
.
size
)
if
self
.
_weight
is
not
None
:
repr_string
+=
" - Weight: {}"
.
format
(
self
.
weight
)
return
repr_string
@
property
def
weight
(
self
):
if
self
.
_weight
is
None
:
logger
.
warning
(
"Weight of shell uninitialized. Calculate it first"
)
return
self
.
_weight
def
set_weight
(
self
,
c_s_sq
,
weight
):
self
.
_c_s_sq
=
c_s_sq
self
.
_weight
=
weight
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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