From c4fe563395b2cd471163fc876112535d5983babc Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Sun, 9 Apr 2017 22:26:09 -0400 Subject: [PATCH] Added clone method to Geometry class --- openmc/geometry.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openmc/geometry.py b/openmc/geometry.py index ce7d47d9e2..424a7053e5 100644 --- a/openmc/geometry.py +++ b/openmc/geometry.py @@ -1,4 +1,5 @@ from collections import OrderedDict, Iterable +from copy import deepcopy from xml.etree import ElementTree as ET from six import string_types @@ -497,3 +498,11 @@ class Geometry(object): # Recursively traverse the CSG tree to count all cell instances self.root_universe._determine_paths() + + def clone(self): + """Create a copy of this geometry with new unique IDs for all of its + enclosed materials, surfaces, cells, universes and lattices.""" + + clone = deepcopy(self) + clone.root_universe = deepcopy(self.root_universe) + return clone