Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PySWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
PySWIFTsim
Commits
967371f8
Commit
967371f8
authored
6 years ago
by
Loic Hausammann
Browse files
Options
Downloads
Patches
Plain Diff
Update test
parent
c1bfdcd3
No related branches found
No related tags found
1 merge request
!5
Last commit before huge rework
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Readme.md
+1
-0
1 addition, 0 deletions
Readme.md
pyswiftsim/structure.py
+6
-4
6 additions, 4 deletions
pyswiftsim/structure.py
test/test_struct.py
+4
-38
4 additions, 38 deletions
test/test_struct.py
with
11 additions
and
42 deletions
Readme.md
+
1
−
0
View file @
967371f8
...
...
@@ -11,6 +11,7 @@ Install
To install PySWIFT, you can run the following command:
`python3 setup.py install --with-swift SWIFT_PATH --user`
.
The setup script will read all your parameters in the config file of swift, therefore you need to reinstall PySWIFT with each configuration of SWIFT.
You may need to remove the build directory to recompile PySWIFT.
Adding a new structure
...
...
This diff is collapsed.
Click to expand it.
pyswiftsim/structure.py
+
6
−
4
View file @
967371f8
...
...
@@ -347,14 +347,16 @@ class Part(SwiftStruct):
# #
######################################################################
class
Parameter
(
SwiftStruct
):
_format
=
"
{line_size}c{line_size}c
"
.
format
(
_format
=
"
{line_size}c{line_size}c
ii
"
.
format
(
line_size
=
PARSER_MAX_LINE_SIZE
)
_name
=
[
"
name
"
,
"
value
"
]
"
name
"
,
"
value
"
,
"
used
"
,
"
is_default
"
]
def
__init__
(
self
,
data
,
parent
=
None
):
super
().
__init__
(
self
.
struct_format
,
data
,
parent
)
...
...
This diff is collapsed.
Click to expand it.
test/test_struct.py
+
4
−
38
View file @
967371f8
...
...
@@ -18,46 +18,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from
pyswiftsim
import
wrapper
from
pyswiftsim
import
structure
us
=
wrapper
.
unitSystemTestStruct
()
filename
=
"
parameter_example.yml
"
params
=
wrapper
.
parserReadFile
(
filename
)
print
(
us
)
part
=
wrapper
.
partTestStruct
()
print
(
part
)
#us = structure.Units(t)
print
(
params
)
#print(type(us), us.struct_name)
#print(us.struct_size_format)
#for i in us.struct_name:
# print(i, getattr(us, i))
"""
print(us.pos)
us.pos = [12., 16., 11.]
#us.pos[0] = 10.
us
=
wrapper
.
unitSystemInit
(
params
)
print
(
us
)
print(us.pos)
print(
"
setitem
"
)
us.pos[2] = 20.
print(us.pos)
print(us)
d = {}
d[
"
UnitMass_in_cgs
"
] = 1.
d[
"
UnitLength_in_cgs
"
] = 2.
d[
"
UnitTime_in_cgs
"
] = 3.
d[
"
UnitCurrent_in_cgs
"
] = 4.
d[
"
UnitTemperature_in_cgs
"
] = 5.
us = structure.UnitSystem(d)
print(us)
"""
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment