LoopStructural 1.6.14__py3-none-any.whl → 1.6.15__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of LoopStructural might be problematic. Click here for more details.

Files changed (26) hide show
  1. LoopStructural/datatypes/_bounding_box.py +22 -13
  2. LoopStructural/datatypes/_point.py +0 -1
  3. LoopStructural/export/exporters.py +2 -2
  4. LoopStructural/interpolators/__init__.py +33 -30
  5. LoopStructural/interpolators/_constant_norm.py +205 -0
  6. LoopStructural/interpolators/_discrete_interpolator.py +15 -14
  7. LoopStructural/interpolators/_finite_difference_interpolator.py +10 -10
  8. LoopStructural/interpolators/_geological_interpolator.py +1 -1
  9. LoopStructural/interpolators/_interpolatortype.py +22 -0
  10. LoopStructural/interpolators/_p1interpolator.py +6 -2
  11. LoopStructural/interpolators/_surfe_wrapper.py +4 -1
  12. LoopStructural/interpolators/supports/_2d_base_unstructured.py +1 -1
  13. LoopStructural/interpolators/supports/_2d_structured_grid.py +16 -0
  14. LoopStructural/interpolators/supports/_3d_base_structured.py +16 -0
  15. LoopStructural/interpolators/supports/_3d_structured_tetra.py +7 -3
  16. LoopStructural/modelling/core/geological_model.py +187 -234
  17. LoopStructural/modelling/features/_base_geological_feature.py +38 -2
  18. LoopStructural/modelling/features/builders/_geological_feature_builder.py +1 -1
  19. LoopStructural/modelling/intrusions/intrusion_builder.py +1 -1
  20. LoopStructural/modelling/intrusions/intrusion_frame_builder.py +1 -1
  21. LoopStructural/version.py +1 -1
  22. {loopstructural-1.6.14.dist-info → loopstructural-1.6.15.dist-info}/METADATA +2 -2
  23. {loopstructural-1.6.14.dist-info → loopstructural-1.6.15.dist-info}/RECORD +26 -24
  24. {loopstructural-1.6.14.dist-info → loopstructural-1.6.15.dist-info}/WHEEL +0 -0
  25. {loopstructural-1.6.14.dist-info → loopstructural-1.6.15.dist-info}/licenses/LICENSE +0 -0
  26. {loopstructural-1.6.14.dist-info → loopstructural-1.6.15.dist-info}/top_level.txt +0 -0
@@ -45,7 +45,7 @@ class P1Interpolator(DiscreteInterpolator):
45
45
  points = self.get_norm_constraints()
46
46
  if points.shape[0] > 0:
47
47
  grad, elements, inside = self.support.evaluate_shape_derivatives(points[:, :3])
48
- size = self.support.element_size[elements[inside]]
48
+ size = self.support.element_scale[elements[inside]]
49
49
  wt = np.ones(size.shape[0])
50
50
  wt *= w # s* size
51
51
  elements = np.tile(self.support.elements[elements[inside]], (3, 1, 1))
@@ -70,6 +70,7 @@ class P1Interpolator(DiscreteInterpolator):
70
70
  if points.shape[0] > 1:
71
71
  N, elements, inside = self.support.evaluate_shape(points[:, :3])
72
72
  size = self.support.element_size[elements[inside]]
73
+
73
74
  wt = np.ones(size.shape[0])
74
75
  wt *= w # * size
75
76
  self.add_constraints_to_least_squares(
@@ -110,13 +111,16 @@ class P1Interpolator(DiscreteInterpolator):
110
111
  const_n = -np.einsum("ij,ijk->ik", norm, Dn)
111
112
  # const_t_cp2 = np.einsum('ij,ikj->ik',normal,cp2_Dt)
112
113
  # const_n_cp2 = -np.einsum('ij,ikj->ik',normal,cp2_Dn)
113
-
114
+ # shared_element_size = self.support.shared_element_size
115
+ # const_t /= shared_element_size[:, None] # normalise by element size
116
+ # const_n /= shared_element_size[:, None] # normalise by element size
114
117
  const = np.hstack([const_t, const_n])
115
118
 
116
119
  # get vertex indexes
117
120
  tri_cp1 = np.hstack([self.support.elements[tri1], self.support.elements[tri2]])
118
121
  # tri_cp2 = np.hstack([self.support.elements[cp2_tri1],self.support.elements[tri2]])
119
122
  # add cp1 and cp2 to the least squares system
123
+
120
124
  self.add_constraints_to_least_squares(
121
125
  const,
122
126
  np.zeros(const.shape[0]),
@@ -203,5 +203,8 @@ class SurfeRBFInterpolator(GeologicalInterpolator):
203
203
  return
204
204
 
205
205
  @property
206
- def nx(self):
206
+ def dof(self):
207
207
  return self.get_data_locations().shape[0]
208
+ @property
209
+ def n_elements(self)->int:
210
+ return self.get_data_locations().shape[0]
@@ -30,7 +30,7 @@ class BaseUnstructured2d(BaseSupport):
30
30
  self.order = 1
31
31
  elif self.elements.shape[1] == 6:
32
32
  self.order = 2
33
- self.nx = self.vertices.shape[0]
33
+ self.dof = self.vertices.shape[0]
34
34
  self.neighbours = neighbours
35
35
  self.minimum = np.min(self.nodes, axis=0)
36
36
  self.maximum = np.max(self.nodes, axis=0)
@@ -372,6 +372,22 @@ class StructuredGrid2D(BaseSupport):
372
372
  return xy
373
373
 
374
374
  def position_to_cell_corners(self, pos):
375
+ """Get the global indices of the vertices (corner) nodes of the cell containing each point.
376
+
377
+ Parameters
378
+ ----------
379
+ pos : np.array
380
+ (N, 2) array of xy coordinates representing the positions of N points.
381
+
382
+ Returns
383
+ -------
384
+ globalidx : np.array
385
+ (N, 4) array of global indices corresponding to the 4 corner nodes of the cell
386
+ each point lies in. If a point lies outside the support, its corresponding entry
387
+ will be set to -1.
388
+ inside : np.array
389
+ (N,) boolean array indicating whether each point is inside the support domain.
390
+ """
375
391
  corner_index, inside = self.position_to_cell_index(pos)
376
392
  corners = self.cell_corner_indexes(corner_index)
377
393
  globalidx = self.global_node_indices(corners)
@@ -373,6 +373,22 @@ class BaseStructuredSupport(BaseSupport):
373
373
  return corner_indexes
374
374
 
375
375
  def position_to_cell_corners(self, pos):
376
+ """Get the global indices of the vertices (corners) of the cell containing each point.
377
+
378
+ Parameters
379
+ ----------
380
+ pos : np.array
381
+ (N, 3) array of xyz coordinates representing the positions of N points.
382
+
383
+ Returns
384
+ -------
385
+ globalidx : np.array
386
+ (N, 8) array of global indices corresponding to the 8 corner nodes of the cell
387
+ each point lies in. If a point lies outside the support, its corresponding entry
388
+ will be set to -1.
389
+ inside : np.array
390
+ (N,) boolean array indicating whether each point is inside the support domain.
391
+ """
376
392
  cell_indexes, inside = self.position_to_cell_index(pos)
377
393
  corner_indexes = self.cell_corner_indexes(cell_indexes)
378
394
  globalidx = self.global_node_indices(corner_indexes)
@@ -85,10 +85,14 @@ class TetMesh(BaseStructuredSupport):
85
85
  )
86
86
 
87
87
  return np.abs(np.linalg.det(vecs)) / 6
88
-
88
+
89
89
  @property
90
90
  def element_scale(self):
91
- return self.element_size / np.mean(self.element_size)
91
+ size = self.element_size
92
+ size-= np.min(size)
93
+ size/= np.max(size)
94
+ size+=1.
95
+ return size
92
96
 
93
97
  @property
94
98
  def barycentre(self) -> np.ndarray:
@@ -189,7 +193,7 @@ class TetMesh(BaseStructuredSupport):
189
193
  """
190
194
  norm = self.shared_element_norm
191
195
  return 0.5 * np.linalg.norm(norm, axis=1)
192
-
196
+
193
197
  @property
194
198
  def shared_element_scale(self):
195
199
  return self.shared_element_size / np.mean(self.shared_element_size)