Skip to content

Commit 07c88cd

Browse files
committed
[ENH/CLN] Adding scalar_field_value at interface to StructuralElement
1 parent 94257e4 commit 07c88cd

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

gempy/core/data/geo_model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def solutions(self) -> Solutions:
146146
return self._solutions
147147

148148
@solutions.setter
149-
def solutions(self, value):
149+
def solutions(self, value: Solutions):
150150
# * This is set from the gempy engine
151151

152152
self._solutions = value
@@ -161,6 +161,8 @@ def solutions(self, value):
161161

162162
# * Set solutions per element
163163
for e, element in enumerate(self.structural_frame.structural_elements[:-1]): # * Ignore basement
164+
element.scalar_field_at_interface = value.scalar_field_at_surface_points[e]
165+
164166
if self._solutions.dc_meshes is None:
165167
continue
166168
dc_mesh = self._solutions.dc_meshes[e]

gempy/core/data/structural_element.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class StructuralElement:
3131
# ? Should we extract this to a separate class?
3232
vertices: Optional[np.ndarray] = None #: The vertices of the element in 3D space.
3333
edges: Optional[np.ndarray] = None #: The edges of the element in 3D space.
34-
scalar_field: Optional[float] = None #: The scalar field value for the element.
34+
scalar_field_at_interface: Optional[float] = None #: The scalar field value for the element.
3535

3636
_id: int = -1
3737

gempy/modules/mesh_extranction/marching_cubes.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def set_meshes_with_marching_cubes(model: GeoModel) -> None:
5555
# TODO: Attribute of element.scalar_field was None, changed it to scalar field value of that element
5656
# This should probably be done somewhere else and maybe renamed to scalar_field_value?
5757
# This is just the most basic solution to be clear what I did
58-
_set_scalar_field_to_element(model, output_lvl0, structural_groups)
58+
# _set_scalar_field_to_element(model, output_lvl0, structural_groups)
5959

6060
# Trying to use the exiting gempy masks
6161
# masks = []
@@ -96,13 +96,14 @@ def set_meshes_with_marching_cubes(model: GeoModel) -> None:
9696

9797
# TODO: This should be set somewhere else
9898
def _set_scalar_field_to_element(model, output_lvl0, structural_groups):
99+
element: StructuralElement
99100
counter = 0
100101
for e, structural_group in enumerate(structural_groups):
101102
if e >= len(output_lvl0):
102103
continue
103104

104105
for element in structural_group.elements:
105-
element.scalar_field = model.solutions.scalar_field_at_surface_points[counter]
106+
element.scalar_field_at_interface = model.solutions.scalar_field_at_surface_points[counter]
106107
counter += 1
107108

108109

@@ -139,7 +140,7 @@ def extract_mesh_for_element(structural_element: StructuralElement,
139140
# Extract mesh using marching cubes
140141
verts, faces, _, _ = measure.marching_cubes(
141142
volume=scalar_field,
142-
level=structural_element.scalar_field,
143+
level=structural_element.scalar_field_at_interface,
143144
spacing=(regular_grid.dx, regular_grid.dy, regular_grid.dz),
144145
mask=mask
145146
)

0 commit comments

Comments
 (0)