Skip to content
Snippets Groups Projects
Commit 967371f8 authored by Loic Hausammann's avatar Loic Hausammann
Browse files

Update test

parent c1bfdcd3
No related branches found
No related tags found
1 merge request!5Last commit before huge rework
...@@ -11,6 +11,7 @@ Install ...@@ -11,6 +11,7 @@ Install
To install PySWIFT, you can run the following command: `python3 setup.py install --with-swift SWIFT_PATH --user`. 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. 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 Adding a new structure
......
...@@ -347,14 +347,16 @@ class Part(SwiftStruct): ...@@ -347,14 +347,16 @@ class Part(SwiftStruct):
# # # #
###################################################################### ######################################################################
class Parameter(SwiftStruct): class Parameter(SwiftStruct):
_format = "{line_size}c{line_size}c".format( _format = "{line_size}c{line_size}cii".format(
line_size=PARSER_MAX_LINE_SIZE line_size=PARSER_MAX_LINE_SIZE
) )
_name = [ _name = [
"name", "name",
"value" "value",
] "used",
"is_default"
]
def __init__(self, data, parent=None): def __init__(self, data, parent=None):
super().__init__(self.struct_format, data, parent) super().__init__(self.struct_format, data, parent)
......
...@@ -18,46 +18,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -18,46 +18,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
""" """
from pyswiftsim import wrapper from pyswiftsim import wrapper
from pyswiftsim import structure
us = wrapper.unitSystemTestStruct() filename = "parameter_example.yml"
params = wrapper.parserReadFile(filename)
print(us) print(params)
part = wrapper.partTestStruct()
print(part)
#us = structure.Units(t)
#print(type(us), us.struct_name) us = wrapper.unitSystemInit(params)
#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.
print(us) 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)
"""
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment