diff --git a/dagmc/dagnav.py b/dagmc/dagnav.py index e6b92ed..5d3a3ce 100644 --- a/dagmc/dagnav.py +++ b/dagmc/dagnav.py @@ -90,6 +90,15 @@ def geom_dimension_tag(self): create_if_missing=True, ) + def write_file(self, filename): + """Write the model to a file. + + Parameters + ---------- + filename : str + The file to write to. + """ + self.mb.write_file(filename) class DAGSet: """ diff --git a/test/test_basic.py b/test/test_basic.py index cffaa36..71bdc35 100644 --- a/test/test_basic.py +++ b/test/test_basic.py @@ -256,6 +256,7 @@ def test_eq(request): assert model1_v0 != model2_v0 + def test_delete(fuel_pin_model): model = dagmc.DAGModel(fuel_pin_model) @@ -270,3 +271,11 @@ def test_delete(fuel_pin_model): assert 'mat:fuel' not in model.groups +def test_write(request, tmpdir): + test_file = str(request.path.parent / 'fuel_pin.h5m') + model = dagmc.DAGModel(test_file) + model.volumes[1].id = 12345 + model.write_file('fuel_pin_copy.h5m') + + model = dagmc.DAGModel('fuel_pin_copy.h5m') + assert 12345 in model.volumes