diff --git a/boundaries/boundaryhandling.py b/boundaries/boundaryhandling.py index 885b1b350ec77a6d6f1453e32e514bc5da295e53..7a276f28eb00527f39d305bbae5004758223bbfe 100644 --- a/boundaries/boundaryhandling.py +++ b/boundaries/boundaryhandling.py @@ -69,7 +69,7 @@ class BoundaryHandling: @property def boundary_objects(self): - return tuple(self._boundary_objectToName.keys()) + return tuple(self._boundary_object_to_boundary_info.keys()) @property def flag_array_name(self): @@ -97,21 +97,24 @@ class BoundaryHandling: def set_boundary(self, boundary_obj, slice_obj=None, mask_callback=None, ghost_layers=True, inner_ghost_layers=True, replace=True): - """ - Sets boundary using either a rectangular slice, a boolean mask or a combination of both - - :param boundary_obj: instance of a boundary object that should be set - :param slice_obj: a slice object (can be created with make_slice[]) that selects a part of the domain where - the boundary should be set. If none, the complete domain is selected which makes only sense - if a mask_callback is passed. The slice can have ':' placeholders, which are interpreted - depending on the 'inner_ghost_layers' parameter i.e. if it is True, the slice extends - into the ghost layers - :param mask_callback: callback function getting x,y (z) parameters of the cell midpoints and returning a - boolean mask with True entries where boundary cells should be set. - The x, y, z arrays have 2D/3D shape such that they can be used directly - to create the boolean return array. i.e return x < 10 sets boundaries in cells with - midpoint x coordinate smaller than 10. - :param ghost_layers see DataHandling.iterate() + """Sets boundary using either a rectangular slice, a boolean mask or a combination of both. + + Args: + boundary_obj: instance of a boundary object that should be set + slice_obj: a slice object (can be created with make_slice[]) that selects a part of the domain where + the boundary should be set. If none, the complete domain is selected which makes only sense + if a mask_callback is passed. The slice can have ':' placeholders, which are interpreted + depending on the 'inner_ghost_layers' parameter i.e. if it is True, the slice extends + into the ghost layers + mask_callback: callback function getting x,y (z) parameters of the cell midpoints and returning a + boolean mask with True entries where boundary cells should be set. + The x, y, z arrays have 2D/3D shape such that they can be used directly + to create the boolean return array. i.e return x < 10 sets boundaries in cells with + midpoint x coordinate smaller than 10. + ghost_layers: see DataHandling.iterate() + inner_ghost_layers: see DataHandling.iterate() + replace: by default all other flags are erased in the cells where the boundary is set. To add a + boundary condition, set this replace flag to False """ if isinstance(boundary_obj, str) and boundary_obj.lower() == 'domain': flag = self.flag_interface.domain_flag diff --git a/field.py b/field.py index 7c61db7bc1654d30438221dabf94ea03a2b8c379..cc7a5f072019d3771eeb60e68cda70c7525b5776 100644 --- a/field.py +++ b/field.py @@ -393,11 +393,7 @@ class Field(object): @property def offsets(self): - return self._offsets - - @offsets.setter - def offsets(self, value): - self._offsets = value + return tuple(self._offsets) @property def required_ghost_layers(self): @@ -415,9 +411,6 @@ class Field(object): def index(self): return self._index - def get_neighbor(self, *offsets) -> 'Field.Access': - return Field.Access(self.field, offsets, self.index) - def neighbor(self, coord_id: int, offset: Sequence[int]) -> 'Field.Access': offset_list = list(self.offsets) offset_list[coord_id] += offset