Skip to content

Commit 8933053

Browse files
committed
2 parents 19015cf + fd3a263 commit 8933053

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+8738
-1838
lines changed

.github/workflows/conda.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: publish_conda
22

33
on:
44
release:
5-
types: [published]
5+
types: [edited, created]
66
jobs:
77
conda-deploy:
88
name: Uploading to Loop3d for python ${{ matrix.os }})

.github/workflows/documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build documentation and deploy
22

33
on:
44
release:
5-
types: [published]
5+
types: [edited, created]
66

77
jobs:
88
flake8:

.github/workflows/python-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Python package build and publish
22

33
on:
44
release:
5-
types: [published]
5+
types: [edited, created]
66

77
jobs:
88
build_wheels_macos:

CHANGELOG.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,109 @@
11
# Changelog
22

3+
### [1.3.6](https://www.github.com/Loop3D/LoopStructural/compare/v1.3.5...v1.3.6) (2021-10-12)
4+
5+
6+
### Bug Fixes
7+
8+
* removing invalid classifiers ([5d8de87](https://www.github.com/Loop3D/LoopStructural/commit/5d8de8782cbfb41ebf229d5e87ac53f6c06f65c3))
9+
10+
### [1.3.5](https://www.github.com/Loop3D/LoopStructural/compare/v1.3.4...v1.3.5) (2021-10-11)
11+
12+
13+
### Bug Fixes
14+
15+
* adding aabb ([512f0a3](https://www.github.com/Loop3D/LoopStructural/commit/512f0a3ec2dddfe0032a03a1d5f24c1a039ddc9e))
16+
* adding gradient option for m2l wrapper ([cdce6e8](https://www.github.com/Loop3D/LoopStructural/commit/cdce6e8887f771d274ef68ad6ad94b25f745a3d5))
17+
* adding option to define custom mesh builder for pli ([b21fa8c](https://www.github.com/Loop3D/LoopStructural/commit/b21fa8c309590c6dd85ea28f0c456a7acb854df2))
18+
* changed to boolean logic for aabb ([f5a5f9b](https://www.github.com/Loop3D/LoopStructural/commit/f5a5f9b811220f534c2b667a652d063ad530294f))
19+
* cleaning up ([262a89d](https://www.github.com/Loop3D/LoopStructural/commit/262a89da9be5aabb3462b5a35dfea830eda6c728))
20+
* incorrect indexing for FDI grad constraints ([d6b8280](https://www.github.com/Loop3D/LoopStructural/commit/d6b82808e8f2716de313a9695293902b499bc27f))
21+
* move cg call to interpolator ([53492a2](https://www.github.com/Loop3D/LoopStructural/commit/53492a2436c6b90cf1ebe7a10283a5d8e5e49749))
22+
* moved generic methods to base class ([23ec788](https://www.github.com/Loop3D/LoopStructural/commit/23ec7889500863bf6f3a43e8b8b5c9a30433a190))
23+
* names kwarg wasn't used for multiple slices ([daebcf0](https://www.github.com/Loop3D/LoopStructural/commit/daebcf04ca0558c2f19ac60646d2e7adca8ef08a))
24+
* pli grad constraint weights were divided by 3 ([cedcffb](https://www.github.com/Loop3D/LoopStructural/commit/cedcffb2577257baa3bd30dc5e38ff7c5451b37a))
25+
* removing old lavavu wrapper, name wasn't ([9226f40](https://www.github.com/Loop3D/LoopStructural/commit/9226f40cdebd2d65ef4d723dfbc5c736a003051c))
26+
* renaming mesh to support for PLI ([2d07317](https://www.github.com/Loop3D/LoopStructural/commit/2d0731740958bd8ef284aa7f7f8d73f6d45734de))
27+
* setup.py codec and filename error ([479ae2b](https://www.github.com/Loop3D/LoopStructural/commit/479ae2b9f9805fb2061da9ae9aa7e5dac9c2f49f))
28+
* unstructured mesh seems to work ([3bd5e24](https://www.github.com/Loop3D/LoopStructural/commit/3bd5e248a2be44812c0d689c60ac0fa33e1c2e31))
29+
* updating setup.py to include metadata for pypi ([fea4317](https://www.github.com/Loop3D/LoopStructural/commit/fea4317b11a7bdbeffadc8c69f9ffc08ada4b3ca))
30+
31+
### [1.3.4](https://www.github.com/Loop3D/LoopStructural/compare/v1.3.3...v1.3.4) (2021-10-05)
32+
33+
34+
### Bug Fixes
35+
36+
* adding loop specific exceptions and project file ([a7664d2](https://www.github.com/Loop3D/LoopStructural/commit/a7664d261f3c6524c3e29f2c0e082ef6b5512813))
37+
* adding non-linear constraint template ([03b9e73](https://www.github.com/Loop3D/LoopStructural/commit/03b9e734dd058dc774dc4c755efc0a7e247e5d92))
38+
* adding non-linear constraint template ([1be8a45](https://www.github.com/Loop3D/LoopStructural/commit/1be8a45473828c90dc56eb23f698e8f20970a609))
39+
* boolean operator in surfe wrapper ([f11816e](https://www.github.com/Loop3D/LoopStructural/commit/f11816e9d1ed92076e5d9719aead0a4e3ad206a0))
40+
* bugfix for gradient constraints ([5fbbb08](https://www.github.com/Loop3D/LoopStructural/commit/5fbbb08733c2fbdf2975a143d996ae18a4711959))
41+
* constant fold axis was referencing fold_frame ([2050b68](https://www.github.com/Loop3D/LoopStructural/commit/2050b68b6ac837cb5113fdce481a78540fc1bdf5))
42+
* intersection visualisation was using the ([1cf531b](https://www.github.com/Loop3D/LoopStructural/commit/1cf531b51a82228133d47d2be6485d742e180e6d))
43+
* method names for FDI/PLI are consistent ([aebba23](https://www.github.com/Loop3D/LoopStructural/commit/aebba23b84c894e1bee75200547514793b32b4ae))
44+
* structural frame weights were being overwritten by ([15e7f23](https://www.github.com/Loop3D/LoopStructural/commit/15e7f23fa4207ce4ded440a99637e0d950010558))
45+
46+
### [1.3.3](https://www.github.com/Loop3D/LoopStructural/compare/v1.3.2...v1.3.3) (2021-09-29)
47+
48+
49+
### Bug Fixes
50+
51+
* kernel parameter for surfe wasn't being applied ([4e99bbf](https://www.github.com/Loop3D/LoopStructural/commit/4e99bbf942467d39d82f1ee8acfe52174b45bb7b))
52+
53+
### [1.3.2](https://www.github.com/Loop3D/LoopStructural/compare/v1.3.1...v1.3.2) (2021-09-28)
54+
55+
56+
### Bug Fixes
57+
58+
* adding missing functions to lavavu wrapper ([8a7b92c](https://www.github.com/Loop3D/LoopStructural/commit/8a7b92ca149c4798a977181c77bbc7338c2d3457))
59+
* adding tangents to surfepy wrapper ([1c0917e](https://www.github.com/Loop3D/LoopStructural/commit/1c0917e4b821383281fb8b507c44bf55fa9f3103))
60+
61+
### [1.3.1](https://www.github.com/Loop3D/LoopStructural/compare/v1.3.0...v1.3.1) (2021-09-28)
62+
63+
64+
### Bug Fixes
65+
66+
* updating workflows to run on edited ([5b051f4](https://www.github.com/Loop3D/LoopStructural/commit/5b051f4b58e56c08a6a0f5f9366733879be7761c))
67+
68+
## [1.3.0](https://www.github.com/Loop3D/LoopStructural/compare/v1.2.4...v1.3.0) (2021-09-27)
69+
70+
71+
### Features
72+
73+
* updating viewer to use base class ([7c314a0](https://www.github.com/Loop3D/LoopStructural/commit/7c314a057c7217d6e120eb2398a7955e32dfa62f))
74+
75+
76+
### Bug Fixes
77+
78+
* adding base plotting class for easy inheritance ([1a9614d](https://www.github.com/Loop3D/LoopStructural/commit/1a9614d6f3ebf63e073f261de5346a49c326b275))
79+
* adding builders for fold and folded frame ([a6b61fb](https://www.github.com/Loop3D/LoopStructural/commit/a6b61fb0660f37d890377a7f30a4b00b4f13a879))
80+
* adding callback function to builder update ([1eca6f5](https://www.github.com/Loop3D/LoopStructural/commit/1eca6f59e18f3f4b116e6f3c7396860ee26dae47))
81+
* adding callback to model.update ([1fe5fad](https://www.github.com/Loop3D/LoopStructural/commit/1fe5fad5a8c4ec70ef691899e942299481ede189))
82+
* adding callbackfunction to isosurface ([038df51](https://www.github.com/Loop3D/LoopStructural/commit/038df51d1f9fedc4499012350b02e7debbda50ef))
83+
* adding check to see if a feature is valid. ([c9bd3b0](https://www.github.com/Loop3D/LoopStructural/commit/c9bd3b0e1871e4b6d8644ea26dbba4f6ad3cc80c))
84+
* adding exception if fold frame hasn't ([59a9d66](https://www.github.com/Loop3D/LoopStructural/commit/59a9d66ec1a86a22d86fe0556d1401dde8db5afb))
85+
* adding exception when modelling faults with surfe ([15806d7](https://www.github.com/Loop3D/LoopStructural/commit/15806d74a8841cb6532f95f678021c26145279be))
86+
* adding function to generate cmap and range for ([6354712](https://www.github.com/Loop3D/LoopStructural/commit/6354712a5907ac22c4a59d7269760b00779afa74))
87+
* adding lavavu subclass ([b3c042f](https://www.github.com/Loop3D/LoopStructural/commit/b3c042fb87a376d107a3b39e551731f19fc2e6d3))
88+
* adding loop exception for interpolator ([f43a583](https://www.github.com/Loop3D/LoopStructural/commit/f43a583f8e793c2690f45246fb6d2b9c1da08e95))
89+
* adding set item for fold frame to change ([7d975bd](https://www.github.com/Loop3D/LoopStructural/commit/7d975bd3a7bc0dcbf2ecb7336e193f50a05b96d9))
90+
* adding vtk export ([7e7d63a](https://www.github.com/Loop3D/LoopStructural/commit/7e7d63a2044713eba77e8176915d591a3b6a621d))
91+
* changing structural frames to have a setup ([d6fcdea](https://www.github.com/Loop3D/LoopStructural/commit/d6fcdea0efee978f5aba8845c2edd6aee5d22139))
92+
* checking type for vector plotter + adding name ([19c7d5e](https://www.github.com/Loop3D/LoopStructural/commit/19c7d5e7f0bfbccd78aec6fabe52c39e9ecba5b0))
93+
* cmap not being passed for add_isosurface ([491fb34](https://www.github.com/Loop3D/LoopStructural/commit/491fb34ceb16290f08016dac605ac43234baab83))
94+
* creating specific builder for folded foliations ([b40ba9a](https://www.github.com/Loop3D/LoopStructural/commit/b40ba9a90294cc79ddbddc19bc1ded6591f43d07))
95+
* end of day fold frame ([6c49981](https://www.github.com/Loop3D/LoopStructural/commit/6c4998126fb12356cb31e173bd3638c4854efb8b))
96+
* error to catch when not enough data ([bdd93ea](https://www.github.com/Loop3D/LoopStructural/commit/bdd93ea928b428cb4ca2da3313eb7603b78d3afd))
97+
* import vtk exception ([01005b3](https://www.github.com/Loop3D/LoopStructural/commit/01005b3fb7a0483d0b2947f84d482810db1e3617))
98+
* process data doesn't allow bad formatted ([b9f8364](https://www.github.com/Loop3D/LoopStructural/commit/b9f83649cfebe825acc8f5f2e8839867e6a06cb4))
99+
* removing function to calculate intersection, ([9080877](https://www.github.com/Loop3D/LoopStructural/commit/9080877707456a86fe36649218ef27e29a660bf1))
100+
* removing kwargs that have value of None ([ce05b5f](https://www.github.com/Loop3D/LoopStructural/commit/ce05b5f7e142e49dfc7bb5d67bf635bc47349d0d))
101+
* removing normalisation from ([3216d07](https://www.github.com/Loop3D/LoopStructural/commit/3216d07efdca58f445afdfcc06de631c10c8f654))
102+
* removing specific builder for folded fold frame ([9eed793](https://www.github.com/Loop3D/LoopStructural/commit/9eed793cb9be6b62422b7e1237f7e77ea841ff83))
103+
* sections can be painted with a feature ([905eeb1](https://www.github.com/Loop3D/LoopStructural/commit/905eeb1406d3cf0c9110de3bef8288577a37807a))
104+
* transitioning fold frame building into ([7d12b3b](https://www.github.com/Loop3D/LoopStructural/commit/7d12b3b92d4f7f83f61553257716e26375024b06))
105+
* typo in parameter ([917711a](https://www.github.com/Loop3D/LoopStructural/commit/917711a4beeee4b90a203aae0de6a52772766c88))
106+
3107
### [1.2.4](https://www.github.com/Loop3D/LoopStructural/compare/v1.2.3...v1.2.4) (2021-09-07)
4108

5109

LoopStructural/interpolators/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from LoopStructural.interpolators.piecewiselinear_interpolator import \
99
PiecewiseLinearInterpolator
1010
from LoopStructural.interpolators.structured_tetra import TetMesh
11+
from LoopStructural.interpolators.unstructured_tetra import UnStructuredTetMesh
1112
from LoopStructural.interpolators.structured_grid import StructuredGrid
1213
from LoopStructural.interpolators.geological_interpolator import GeologicalInterpolator
14+
from LoopStructural.interpolators.discrete_interpolator import DiscreteInterpolator
1315

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# class LinearTetrahedron:
2+
# def __init__(self):
3+
# pass
4+
5+
# def element_gradient(self, elements):
6+
# ps = self.
7+
# m = np.array(
8+
# [[(ps[:, 1, 0] - ps[:, 0, 0]), (ps[:, 1, 1] - ps[:, 0, 1]),
9+
# (ps[:, 1, 2] - ps[:, 0, 2])],
10+
# [(ps[:, 2, 0] - ps[:, 0, 0]), (ps[:, 2, 1] - ps[:, 0, 1]),
11+
# (ps[:, 2, 2] - ps[:, 0, 2])],
12+
# [(ps[:, 3, 0] - ps[:, 0, 0]), (ps[:, 3, 1] - ps[:, 0, 1]),
13+
# (ps[:, 3, 2] - ps[:, 0, 2])]])
14+
# I = np.array(
15+
# [[-1., 1., 0., 0.],
16+
# [-1., 0., 1., 0.],
17+
# [-1., 0., 0., 1.]])
18+
# m = np.swapaxes(m, 0, 2)
19+
# element_gradients = np.linalg.inv(m)
20+
21+
# element_gradients = element_gradients.swapaxes(1, 2)
22+
# element_gradients = element_gradients @ I
23+
24+
# return element_gradients[elements,:,:]

LoopStructural/interpolators/base_structured_3d_support.py

Lines changed: 123 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self,
2222
# we use property decorators to update these when different parts of
2323
# the geometry need to change
2424
# inisialise the private attributes
25-
self._nsteps = np.array(nsteps)
25+
self._nsteps = np.array(nsteps,dtype=int)
2626
self._step_vector = np.array(step_vector)
2727
self._origin = np.array(origin)
2828
self.supporttype='Base'
@@ -181,4 +181,125 @@ def check_position(self, pos):
181181
if len(pos.shape) != 2:
182182
print("Position array needs to be a list of points or a point")
183183
return False
184-
return pos
184+
return pos
185+
186+
def global_cell_indicies(self, indexes):
187+
"""
188+
Convert from cell indexes to global cell index
189+
190+
Parameters
191+
----------
192+
indexes
193+
194+
Returns
195+
-------
196+
197+
"""
198+
indexes = np.array(indexes).swapaxes(0, 2)
199+
return indexes[:, :, 0] + self.nsteps_cells[None, None, 0] \
200+
* indexes[:, :, 1] + self.nsteps_cells[None, None, 0] * \
201+
self.nsteps_cells[None, None, 1] * indexes[:, :, 2]
202+
203+
def cell_corner_indexes(self, x_cell_index, y_cell_index, z_cell_index):
204+
"""
205+
Returns the indexes of the corners of a cell given its location xi,
206+
yi, zi
207+
208+
Parameters
209+
----------
210+
x_cell_index
211+
y_cell_index
212+
z_cell_index
213+
214+
Returns
215+
-------
216+
217+
"""
218+
xcorner = np.array([0, 1, 0, 0, 1, 0, 1, 1])
219+
ycorner = np.array([0, 0, 1, 0, 0, 1, 1, 1])
220+
zcorner = np.array([0, 0, 0, 1, 1, 1, 0, 1])
221+
xcorners = x_cell_index[:, None] + xcorner[None, :]
222+
ycorners = y_cell_index[:, None] + ycorner[None, :]
223+
zcorners = z_cell_index[:, None] + zcorner[None, :]
224+
return xcorners, ycorners, zcorners
225+
226+
def position_to_cell_corners(self, pos):
227+
228+
inside = self.inside(pos)
229+
ix, iy, iz = self.position_to_cell_index(pos)
230+
cornersx, cornersy, cornersz = self.cell_corner_indexes(ix, iy, iz)
231+
globalidx = self.global_indicies(
232+
np.dstack([cornersx, cornersy, cornersz]).T)
233+
# if global index is not inside the support set to -1
234+
globalidx[~inside] = -1
235+
return globalidx, inside
236+
237+
def node_indexes_to_position(self, xindex, yindex, zindex):
238+
239+
x = self.origin[0] + self.step_vector[0] * xindex
240+
y = self.origin[1] + self.step_vector[1] * yindex
241+
z = self.origin[2] + self.step_vector[2] * zindex
242+
243+
return x, y, z
244+
245+
def global_index_to_cell_index(self, global_index):
246+
"""
247+
Convert from global indexes to xi,yi,zi
248+
249+
Parameters
250+
----------
251+
global_index
252+
253+
Returns
254+
-------
255+
256+
"""
257+
# determine the ijk indices for the global index.
258+
# remainder when dividing by nx = i
259+
# remained when dividing modulus of nx by ny is j
260+
261+
x_index = global_index % self.nsteps_cells[0, None]
262+
y_index = global_index // self.nsteps_cells[0, None] % \
263+
self.nsteps_cells[1, None]
264+
z_index = global_index // self.nsteps_cells[0, None] // \
265+
self.nsteps_cells[1, None]
266+
return x_index, y_index, z_index
267+
268+
269+
def global_index_to_node_index(self, global_index):
270+
"""
271+
Convert from global indexes to xi,yi,zi
272+
273+
Parameters
274+
----------
275+
global_index
276+
277+
Returns
278+
-------
279+
280+
"""
281+
# determine the ijk indices for the global index.
282+
# remainder when dividing by nx = i
283+
# remained when dividing modulus of nx by ny is j
284+
x_index = global_index % self.nsteps[0, None]
285+
y_index = global_index // self.nsteps[0, None] % \
286+
self.nsteps[1, None]
287+
z_index = global_index // self.nsteps[0, None] // \
288+
self.nsteps[1, None]
289+
return x_index, y_index, z_index
290+
def global_node_indicies(self, indexes):
291+
"""
292+
Convert from node indexes to global node index
293+
294+
Parameters
295+
----------
296+
indexes
297+
298+
Returns
299+
-------
300+
301+
"""
302+
indexes = np.array(indexes).swapaxes(0, 2)
303+
return indexes[:, :, 0] + self.nsteps[None, None, 0] \
304+
* indexes[:, :, 1] + self.nsteps[None, None, 0] * \
305+
self.nsteps[None, None, 1] * indexes[:, :, 2]

LoopStructural/interpolators/discrete_interpolator.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def __init__(self, support):
4747
self.eq_const_col = []
4848
self.eq_const_d = []
4949
self.eq_const_c_ = 0
50+
self.non_linear_constraints = []
5051
self.constraints = {}
5152
self.interpolation_weights= {}
5253
logger.info("Creating discrete interpolator with {} degrees of freedom".format(self.nx))
@@ -177,15 +178,18 @@ def add_constraints_to_least_squares(self, A, B, idc, name='undefined'):
177178
rows += self.c_
178179
constraint_ids = rows.copy()
179180

180-
if name in self.constraints:
181+
if name in self.constraints:
182+
count = 0
183+
if '_' in name:
184+
count = int(name.split('_')[0])+1
185+
name = name + '_{}'.format(count)
181186

182-
self.constraints[name]['A'] = np.vstack([self.constraints[name]['A'],A])
183-
self.constraints[name]['B'] = np.hstack([self.constraints[name]['B'], B])
184-
self.constraints[name]['idc'] = np.vstack([self.constraints[name]['idc'],
185-
idc])
187+
# self.constraints[name]['A'] = A#np.vstack([self.constraints[name]['A'],A])
188+
# self.constraints[name]['B'] = B#np.hstack([self.constraints[name]['B'], B])
189+
# self.constraints[name]['idc'] = idc#np.vstack([self.constraints[name]['idc'],
190+
# idc])
186191

187-
if name not in self.constraints:
188-
self.constraints[name] = {'node_indexes':constraint_ids,'A':A,'B':B.flatten(),'idc':idc}
192+
self.constraints[name] = {'node_indexes':constraint_ids,'A':A,'B':B.flatten(),'idc':idc}
189193
rows = np.tile(rows, (A.shape[-1], 1)).T
190194

191195
self.c_ += nr
@@ -272,8 +276,11 @@ def add_equality_constraints(self, node_idx, values):
272276
self.eq_const_row.extend((np.arange(0, idc[outside].shape[0])))
273277
self.eq_const_d.extend(values[outside].tolist())
274278
self.eq_const_c_ += idc[outside].shape[0]
279+
280+
def add_non_linear_constraints(self, nonlinear_constraint):
281+
self.non_linear_constraints.append(nonlinear_constraint)
275282

276-
def add_tangent_ctr_pts(self, w=1.0):
283+
def add_tangent_constraints(self, w=1.0):
277284
"""
278285
279286
Parameters
@@ -287,7 +294,7 @@ def add_tangent_ctr_pts(self, w=1.0):
287294
"""
288295
points = self.get_tangent_constraints()
289296
if points.shape[0] > 1:
290-
self.add_gradient_orthogonal_constraint(points[:,:3],points[:,3:6],w)
297+
self.add_gradient_orthogonal_constraints(points[:,:3],points[:,3:6],w)
291298

292299
def build_matrix(self, square=True, damp=True):
293300
"""
@@ -531,11 +538,15 @@ def _solve(self, solver='cg', **kwargs):
531538
# check solution is not nan
532539
# self.support.properties[self.propertyname] = self.c
533540
if np.all(self.c == np.nan):
541+
self.valid = False
534542
logger.warning("Solver not run, no scalar field")
543+
return
535544
# if solution is all 0, probably didn't work
536545
if np.all(self.c[self.region] == 0):
546+
self.valid = False
537547
logger.warning("No solution, {} scalar field 0. Add more data.".format(self.propertyname))
538-
548+
return
549+
self.valid = True
539550
def update(self):
540551
"""
541552
Check if the solver is up to date, if not rerun interpolation using

0 commit comments

Comments
 (0)