LoopStructural 1.0.4__zip → 1.0.71.dev0__zip
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.
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/__init__.py +12 -7
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/__pycache__/{__init__.cpython-37.pyc → __init__.cpython-36.pyc} +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/__pycache__/{_base.cpython-37.pyc → _base.cpython-36.pyc} +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__init__.py +3 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/base_structured_3d_support.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/discrete_fold_interpolator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/discrete_interpolator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/finite_difference_interpolator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/geological_interpolator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/operator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/piecewiselinear_interpolator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/structured_grid.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/structured_tetra.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/surfe_wrapper.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/base_structured_3d_support.py +101 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/cython/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/cython/dsi_helper.c +3899 -2455
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/cython/dsi_helper.cp36-win_amd64.pyd +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/discrete_fold_interpolator.py +53 -22
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/discrete_interpolator.py +61 -28
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/finite_difference_interpolator.py +68 -11
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/geological_interpolator.py +8 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/operator.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/piecewiselinear_interpolator.py +97 -8
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/structured_grid.py +25 -69
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/structured_tetra.py +86 -43
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/surfe_wrapper.py +4 -3
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/__pycache__/{__init__.cpython-37.pyc → __init__.cpython-36.pyc} +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/__pycache__/geological_model.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/__pycache__/geological_model_graph.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/__pycache__/stratigraphic_column.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/geological_model.py +303 -150
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/geological_model_graph.py +881 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/stratigraphic_column.py +5 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__init__.py +1 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/fault_builder.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/fault_function.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/fault_function_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/fault_segment.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/fault_builder.py +127 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/fault_function.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/fault_function_feature.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/fault_segment.py +30 -3
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__init__.py +1 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/cross_product_geological_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/geological_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/geological_feature_builder.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/lambda_geological_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/{region_feature.cpython-37.pyc → region_feature.cpython-36.pyc} +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/structural_frame.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/structural_frame_builder.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/unconformity_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/cross_product_geological_feature.py +18 -5
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/geological_feature.py +10 -44
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/geological_feature_builder.py +127 -43
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/lambda_geological_feature.py +31 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/structural_frame.py +28 -11
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/structural_frame_builder.py +25 -15
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/unconformity_feature.py +6 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/{__init__.cpython-37.pyc → __init__.cpython-36.pyc} +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/fold.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/fold_rotation_angle.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/fold_rotation_angle_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/foldframe.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/svariogram.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/fold.py +13 -5
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/fold_rotation_angle.py +5 -4
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/fold_rotation_angle_feature.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/foldframe.py +6 -5
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/svariogram.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__init__.py +5 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/bounding_box.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/exceptions.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/helper.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/logging.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/map2loop.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/regions.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/utils.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/bounding_box.py +21 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/exceptions.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/helper.py +5 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/logging.py +60 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/map2loop.py +47 -19
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/regions.py +11 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/utils.py +2 -53
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/{__init__.cpython-37.pyc → __init__.cpython-36.pyc} +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/map_viewer.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/model_plotter.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/model_visualisation.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/rotation_angle_plotter.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/{sphinx_scraper.cpython-37.pyc → sphinx_scraper.cpython-36.pyc} +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/stratigraphic_column.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/map_viewer.py +17 -2
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/model_plotter.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/model_visualisation.py +152 -84
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/rotation_angle_plotter.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/stratigraphic_column.py +60 -0
- Miniconda/envs/loop/Lib/site-packages/{LoopStructural-1.0.4-py3.7.egg-info → LoopStructural-1.0.71.dev0-py3.6.egg-info}/PKG-INFO +1 -1
- Miniconda/envs/loop/Lib/site-packages/{LoopStructural-1.0.4-py3.7.egg-info → LoopStructural-1.0.71.dev0-py3.6.egg-info}/SOURCES.txt +10 -5
- Miniconda/envs/loop/Lib/site-packages/{LoopStructural-1.0.4-py3.7.egg-info → LoopStructural-1.0.71.dev0-py3.6.egg-info}/requires.txt +1 -1
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/discrete_fold_interpolator.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/discrete_interpolator.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/finite_difference_interpolator.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/geological_interpolator.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/operator.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/piecewiselinear_interpolator.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/structured_grid.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/structured_tetra.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/surfe_wrapper.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/cython/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/cython/dsi_helper.cp37-win_amd64.pyd +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/__pycache__/geological_model.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/fault_function.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/fault_function_feature.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/fault_segment.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/cross_product_geological_feature.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/geological_feature.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/geological_feature_builder.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/structural_frame.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/structural_frame_builder.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/unconformity_feature.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/fold.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/fold_rotation_angle.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/fold_rotation_angle_feature.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/foldframe.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/svariogram.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/exceptions.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/helper.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/map2loop.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/utils.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/map_viewer.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/model_plotter.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/model_visualisation.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/rotation_angle_plotter.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/__init__.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/test_faults.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/test_fold.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/test_interpolator.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/test_refolded.cpython-37.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/test_faults.py +0 -17
- Miniconda/envs/loop/Lib/site-packages/tests/test_fold.py +0 -57
- Miniconda/envs/loop/Lib/site-packages/tests/test_interpolator.py +0 -88
- Miniconda/envs/loop/Lib/site-packages/tests/test_refolded.py +0 -22
- /Miniconda/envs/loop/Lib/site-packages/{LoopStructural-1.0.4-py3.7.egg-info → LoopStructural-1.0.71.dev0-py3.6.egg-info}/dependency_links.txt +0 -0
- /Miniconda/envs/loop/Lib/site-packages/{LoopStructural-1.0.4-py3.7.egg-info → LoopStructural-1.0.71.dev0-py3.6.egg-info}/top_level.txt +0 -0
Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/piecewiselinear_interpolator.py
CHANGED
|
@@ -9,7 +9,8 @@ from LoopStructural.interpolators.discrete_interpolator import \
|
|
|
9
9
|
DiscreteInterpolator
|
|
10
10
|
from LoopStructural.utils.helper import get_vectors
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
from LoopStructural.utils import getLogger
|
|
13
|
+
logger = getLogger(__name__)
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class PiecewiseLinearInterpolator(DiscreteInterpolator):
|
|
@@ -32,7 +33,6 @@ class PiecewiseLinearInterpolator(DiscreteInterpolator):
|
|
|
32
33
|
DiscreteInterpolator.__init__(self, mesh)
|
|
33
34
|
# whether to assemble a rectangular matrix or a square matrix
|
|
34
35
|
self.interpolator_type = 'PLI'
|
|
35
|
-
self.nx = len(self.support.nodes[self.region])
|
|
36
36
|
self.support = mesh
|
|
37
37
|
|
|
38
38
|
self.interpolation_weights = {'cgw': 0.1, 'cpw': 1., 'npw': 1.,
|
|
@@ -72,7 +72,10 @@ class PiecewiseLinearInterpolator(DiscreteInterpolator):
|
|
|
72
72
|
self.interpolation_weights[key] = kwargs[key]
|
|
73
73
|
if self.interpolation_weights['cgw'] > 0.:
|
|
74
74
|
self.up_to_date = False
|
|
75
|
-
self.add_constant_gradient(self.interpolation_weights['cgw']
|
|
75
|
+
self.add_constant_gradient(self.interpolation_weights['cgw'],
|
|
76
|
+
direction_feature=kwargs.get('direction_feature',None),
|
|
77
|
+
direction_vector=kwargs.get('direction_vector',None)
|
|
78
|
+
)
|
|
76
79
|
logger.info("Using constant gradient regularisation w = %f"
|
|
77
80
|
%self.interpolation_weights['cgw'])
|
|
78
81
|
logger.info("Added %i gradient constraints, %i normal constraints,"
|
|
@@ -84,7 +87,10 @@ class PiecewiseLinearInterpolator(DiscreteInterpolator):
|
|
|
84
87
|
self.add_ctr_pts(self.interpolation_weights['cpw'])
|
|
85
88
|
self.add_tangent_ctr_pts(self.interpolation_weights['tpw'])
|
|
86
89
|
self.add_interface_ctr_pts(self.interpolation_weights['ipw'])
|
|
87
|
-
|
|
90
|
+
if 'constant_norm' in kwargs:
|
|
91
|
+
self.add_constant_norm(w=kwargs['constant_norm'])
|
|
92
|
+
|
|
93
|
+
def add_constant_gradient(self, w= 0.1, direction_vector=None, direction_feature=None):
|
|
88
94
|
"""
|
|
89
95
|
Add the constant gradient regularisation to the system
|
|
90
96
|
|
|
@@ -96,8 +102,17 @@ class PiecewiseLinearInterpolator(DiscreteInterpolator):
|
|
|
96
102
|
-------
|
|
97
103
|
|
|
98
104
|
"""
|
|
105
|
+
if direction_feature is not None:
|
|
106
|
+
print('dir fe')
|
|
107
|
+
direction_vector = direction_feature.evaluate_gradient(self.support.barycentre())
|
|
108
|
+
if direction_vector is not None:
|
|
109
|
+
if direction_vector.shape[0] == 1:
|
|
110
|
+
# if using a constant direction, tile array so it works for cg calc
|
|
111
|
+
direction_vector = np.tile(direction_vector,(self.support.barycentre().shape[0],1))
|
|
112
|
+
|
|
113
|
+
|
|
99
114
|
# iterate over all elements
|
|
100
|
-
A, idc, B = self.support.get_constant_gradient(region=self.region)
|
|
115
|
+
A, idc, B = self.support.get_constant_gradient(region=self.region,direction=direction_vector)
|
|
101
116
|
A = np.array(A)
|
|
102
117
|
B = np.array(B)
|
|
103
118
|
idc = np.array(idc)
|
|
@@ -114,6 +129,79 @@ class PiecewiseLinearInterpolator(DiscreteInterpolator):
|
|
|
114
129
|
name='regularisation')
|
|
115
130
|
return
|
|
116
131
|
|
|
132
|
+
def add_direction_constant_gradient(self, w= 0.1, direction_vector=None, direction_feature=None):
|
|
133
|
+
"""
|
|
134
|
+
Add the constant gradient regularisation to the system where regularisation is projected
|
|
135
|
+
on a vector
|
|
136
|
+
|
|
137
|
+
Parameters
|
|
138
|
+
----------
|
|
139
|
+
w (double) - weighting of the cg parameter
|
|
140
|
+
direction_vector
|
|
141
|
+
direction_feature
|
|
142
|
+
|
|
143
|
+
Returns
|
|
144
|
+
-------
|
|
145
|
+
|
|
146
|
+
"""
|
|
147
|
+
if direction_feature:
|
|
148
|
+
print('dir fe')
|
|
149
|
+
direction_vector = direction_feature.evaluate_gradient(self.support.barycentre())
|
|
150
|
+
if direction_vector:
|
|
151
|
+
if direction_vector.shape[0] == 1:
|
|
152
|
+
# if using a constant direction, tile array so it works for cg calc
|
|
153
|
+
direction_vector = np.tile(direction_vector,(self.support.barycentre().shape[0],1))
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
# iterate over all elements
|
|
157
|
+
A, idc, B = self.support.get_constant_gradient(region=self.region,direction=direction_vector)
|
|
158
|
+
A = np.array(A)
|
|
159
|
+
B = np.array(B)
|
|
160
|
+
idc = np.array(idc)
|
|
161
|
+
|
|
162
|
+
gi = np.zeros(self.support.n_nodes)
|
|
163
|
+
gi[:] = -1
|
|
164
|
+
gi[self.region] = np.arange(0, self.nx)
|
|
165
|
+
idc = gi[idc]
|
|
166
|
+
outside = ~np.any(idc == -1, axis=1)
|
|
167
|
+
|
|
168
|
+
# w/=A.shape[0]
|
|
169
|
+
self.add_constraints_to_least_squares(A[outside, :] * w,
|
|
170
|
+
B[outside] * w, idc[outside, :],
|
|
171
|
+
name='directional regularisation')
|
|
172
|
+
return
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def add_constant_norm(self, w=0.1):
|
|
176
|
+
"""
|
|
177
|
+
Add the constant gradient regularisation to the system
|
|
178
|
+
|
|
179
|
+
Parameters
|
|
180
|
+
----------
|
|
181
|
+
w (double) - weighting of the cg parameter
|
|
182
|
+
|
|
183
|
+
Returns
|
|
184
|
+
-------
|
|
185
|
+
|
|
186
|
+
"""
|
|
187
|
+
# iterate over all elements
|
|
188
|
+
A, idc, B = self.support.get_constant_norm(region=self.region)
|
|
189
|
+
A = np.array(A)
|
|
190
|
+
B = np.array(B)
|
|
191
|
+
idc = np.array(idc)
|
|
192
|
+
|
|
193
|
+
gi = np.zeros(self.support.n_nodes)
|
|
194
|
+
gi[:] = -1
|
|
195
|
+
gi[self.region] = np.arange(0, self.nx)
|
|
196
|
+
idc = gi[idc]
|
|
197
|
+
outside = ~np.any(idc == -1, axis=1)
|
|
198
|
+
|
|
199
|
+
# w/=A.shape[0]
|
|
200
|
+
self.add_constraints_to_least_squares(A[outside, :] * w,
|
|
201
|
+
B[outside] * w, idc[outside, :],
|
|
202
|
+
name='norm_regularisation')
|
|
203
|
+
return
|
|
204
|
+
|
|
117
205
|
def add_gradient_ctr_pts(self, w=1.0):
|
|
118
206
|
"""
|
|
119
207
|
Adds gradient constraints to the least squares system with a weight
|
|
@@ -303,7 +391,7 @@ class PiecewiseLinearInterpolator(DiscreteInterpolator):
|
|
|
303
391
|
outside = ~np.any(interface_idc == -1, axis=1)
|
|
304
392
|
self.add_constraints_to_least_squares(interface_A[outside,:] * w,
|
|
305
393
|
np.zeros(interface_A[outside,:].shape[0]),
|
|
306
|
-
interface_idc[outside, :], name='
|
|
394
|
+
interface_idc[outside, :], name='interface')
|
|
307
395
|
|
|
308
396
|
def add_gradient_orthogonal_constraint(self, points, vector, w=1.0,
|
|
309
397
|
B=0):
|
|
@@ -325,6 +413,7 @@ class PiecewiseLinearInterpolator(DiscreteInterpolator):
|
|
|
325
413
|
vertices, element_gradients, tetras, inside = self.support.get_tetra_gradient_for_location(points[:,:3])
|
|
326
414
|
#e, inside = self.support.elements_for_array(points[:, :3])
|
|
327
415
|
#nodes = self.support.nodes[self.support.elements[e]]
|
|
416
|
+
vector /= np.linalg.norm(vector,axis=1)[:,None]
|
|
328
417
|
vecs = vertices[:, 1:, :] - vertices[:, 0, None, :]
|
|
329
418
|
vol = np.abs(np.linalg.det(vecs)) # / 6
|
|
330
419
|
# d_t = self.support.get_elements_gradients(e)
|
|
@@ -340,9 +429,9 @@ class PiecewiseLinearInterpolator(DiscreteInterpolator):
|
|
|
340
429
|
gi[self.region] = np.arange(0, self.nx).astype(int)
|
|
341
430
|
w /= 3
|
|
342
431
|
idc = gi[tetras]
|
|
343
|
-
B = np.zeros(idc.shape[0])
|
|
432
|
+
B = np.zeros(idc.shape[0])+B
|
|
344
433
|
outside = ~np.any(idc == -1, axis=1)
|
|
345
434
|
self.add_constraints_to_least_squares(A[outside, :] * w,
|
|
346
|
-
B[outside], idc[outside, :])
|
|
435
|
+
B[outside], idc[outside, :], name='gradient_orthogonal')
|
|
347
436
|
|
|
348
437
|
|
|
@@ -6,10 +6,14 @@ import logging
|
|
|
6
6
|
|
|
7
7
|
import numpy as np
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
from .base_structured_3d_support import BaseStructuredSupport
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
from LoopStructural.utils import getLogger
|
|
13
|
+
logger = getLogger(__name__)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class StructuredGrid(BaseStructuredSupport):
|
|
13
17
|
"""
|
|
14
18
|
|
|
15
19
|
"""
|
|
@@ -17,7 +21,7 @@ class StructuredGrid:
|
|
|
17
21
|
origin=np.zeros(3),
|
|
18
22
|
nsteps=np.array([10, 10, 10]),
|
|
19
23
|
step_vector=np.ones(3),
|
|
20
|
-
|
|
24
|
+
name=None
|
|
21
25
|
):
|
|
22
26
|
"""
|
|
23
27
|
|
|
@@ -26,71 +30,15 @@ class StructuredGrid:
|
|
|
26
30
|
origin - 3d list or numpy array
|
|
27
31
|
nsteps - 3d list or numpy array of ints
|
|
28
32
|
step_vector - 3d list or numpy array of int
|
|
29
|
-
maximum
|
|
30
33
|
"""
|
|
31
|
-
|
|
32
|
-
self.nsteps = np.array(nsteps)
|
|
33
|
-
self.step_vector = np.array(step_vector)
|
|
34
|
-
self.origin = np.array(origin)
|
|
35
|
-
self.maximum = origin+self.nsteps*self.step_vector
|
|
36
|
-
|
|
37
|
-
# self.nsteps+=1
|
|
38
|
-
self.n_nodes = self.nsteps[0] * self.nsteps[1] * self.nsteps[2]
|
|
39
|
-
# self.nsteps-=1
|
|
40
|
-
self.dim = 3
|
|
41
|
-
self.nsteps_cells = self.nsteps - 1
|
|
42
|
-
self.n_cell_x = self.nsteps[0] - 1
|
|
43
|
-
self.n_cell_y = self.nsteps[1] - 1
|
|
44
|
-
self.n_cell_z = self.nsteps[2] - 1
|
|
45
|
-
self.properties = {}
|
|
46
|
-
self.n_elements = self.n_cell_x * self.n_cell_y * self.n_cell_z
|
|
47
|
-
|
|
48
|
-
# calculate the node positions using numpy (this should probably not
|
|
49
|
-
# be stored as it defeats
|
|
50
|
-
# the purpose of a structured grid
|
|
51
|
-
|
|
52
|
-
# self.barycentre = self.cell_centres(np.arange(self.n_elements))
|
|
53
|
-
|
|
34
|
+
BaseStructuredSupport.__init__(self,origin,nsteps,step_vector)
|
|
54
35
|
self.regions = {}
|
|
55
36
|
self.regions['everywhere'] = np.ones(self.n_nodes).astype(bool)
|
|
56
|
-
|
|
57
|
-
@property
|
|
58
|
-
def nodes(self):
|
|
59
|
-
max = self.origin + self.nsteps_cells * self.step_vector
|
|
60
|
-
x = np.linspace(self.origin[0], max[0], self.nsteps[0])
|
|
61
|
-
y = np.linspace(self.origin[1], max[1], self.nsteps[1])
|
|
62
|
-
z = np.linspace(self.origin[2], max[2], self.nsteps[2])
|
|
63
|
-
xx, yy, zz = np.meshgrid(x, y, z, indexing='ij')
|
|
64
|
-
return np.array([xx.flatten(order='F'), yy.flatten(order='F'),
|
|
65
|
-
zz.flatten(order='F')]).T
|
|
37
|
+
self.name = name
|
|
66
38
|
|
|
67
39
|
def barycentre(self):
|
|
68
40
|
return self.cell_centres(np.arange(self.n_elements))
|
|
69
41
|
|
|
70
|
-
def print_geometry(self):
|
|
71
|
-
print('Origin: %f %f %f' % (
|
|
72
|
-
self.origin[0], self.origin[1], self.origin[2]))
|
|
73
|
-
print('Cell size: %f %f %f' % (
|
|
74
|
-
self.step_vector[0], self.step_vector[1], self.step_vector[2]))
|
|
75
|
-
max = self.origin + self.nsteps_cells * self.step_vector
|
|
76
|
-
print('Max extent: %f %f %f' % (max[0], max[1], max[2]))
|
|
77
|
-
|
|
78
|
-
def update_property(self, propertyname, values):
|
|
79
|
-
"""[summary]
|
|
80
|
-
|
|
81
|
-
[extended_summary]
|
|
82
|
-
|
|
83
|
-
Parameters
|
|
84
|
-
----------
|
|
85
|
-
propertyname : [type]
|
|
86
|
-
[description]
|
|
87
|
-
values : [type]
|
|
88
|
-
[description]
|
|
89
|
-
"""
|
|
90
|
-
if values.shape[0] == self.n_nodes:
|
|
91
|
-
self.properties[propertyname] = values
|
|
92
|
-
if values.shape[0] == self.n_elements:
|
|
93
|
-
self.cell_properties[propertyname] = values
|
|
94
42
|
|
|
95
43
|
def cell_centres(self, global_index):
|
|
96
44
|
"""[summary]
|
|
@@ -369,7 +317,7 @@ class StructuredGrid:
|
|
|
369
317
|
globalidx[~inside] = -1
|
|
370
318
|
return globalidx, inside
|
|
371
319
|
|
|
372
|
-
def evaluate_value(self, evaluation_points,
|
|
320
|
+
def evaluate_value(self, evaluation_points, property_array):
|
|
373
321
|
"""
|
|
374
322
|
Evaluate the value of of the property at the locations.
|
|
375
323
|
Trilinear interpolation dot corner values
|
|
@@ -383,28 +331,36 @@ class StructuredGrid:
|
|
|
383
331
|
-------
|
|
384
332
|
|
|
385
333
|
"""
|
|
334
|
+
if property_array.shape[0] != self.n_nodes:
|
|
335
|
+
logger.error("Property array does not match grid")
|
|
336
|
+
raise BaseException
|
|
386
337
|
idc, inside = self.position_to_cell_corners(evaluation_points)
|
|
387
338
|
v = np.zeros(idc.shape)
|
|
388
339
|
v[:, :] = np.nan
|
|
389
340
|
|
|
390
341
|
v[inside, :] = self.position_to_dof_coefs(
|
|
391
342
|
evaluation_points[inside, :]).T
|
|
392
|
-
|
|
343
|
+
|
|
344
|
+
v[inside, :] *= property_array[idc[inside, :]]
|
|
345
|
+
|
|
393
346
|
return np.sum(v, axis=1)
|
|
394
347
|
|
|
395
|
-
def evaluate_gradient(self, evaluation_points,
|
|
348
|
+
def evaluate_gradient(self, evaluation_points, property_array):
|
|
349
|
+
if property_array.shape[0] != self.n_nodes:
|
|
350
|
+
logger.error("Property array does not match grid")
|
|
351
|
+
raise BaseException
|
|
396
352
|
idc, inside = self.position_to_cell_corners(evaluation_points)
|
|
397
353
|
T = np.zeros((idc.shape[0], 3, 8))
|
|
398
354
|
T[inside, :, :] = self.calcul_T(evaluation_points[inside, :])
|
|
399
355
|
# indices = np.array([self.position_to_cell_index(evaluation_points)])
|
|
400
356
|
# idc = self.global_indicies(indices.swapaxes(0,1))
|
|
401
357
|
# print(idc)
|
|
402
|
-
T[inside, 0, :] *=
|
|
403
|
-
T[inside, 1, :] *=
|
|
404
|
-
T[inside, 2, :] *=
|
|
358
|
+
T[inside, 0, :] *= property_array[idc[inside, :]]
|
|
359
|
+
T[inside, 1, :] *= property_array[idc[inside, :]]
|
|
360
|
+
T[inside, 2, :] *= property_array[idc[inside, :]]
|
|
405
361
|
return np.array(
|
|
406
|
-
[np.sum(T[:, 0, :], axis=1)
|
|
407
|
-
np.sum(T[:, 2, :], axis=1)
|
|
362
|
+
[np.sum(T[:, 0, :], axis=1), np.sum(T[:, 1, :], axis=1) ,
|
|
363
|
+
np.sum(T[:, 2, :], axis=1) ]).T
|
|
408
364
|
|
|
409
365
|
def calcul_T(self, pos):
|
|
410
366
|
"""
|
|
@@ -4,9 +4,10 @@ Tetmesh based on cartesian grid for piecewise linear interpolation
|
|
|
4
4
|
import logging
|
|
5
5
|
|
|
6
6
|
import numpy as np
|
|
7
|
-
from LoopStructural.interpolators.cython.dsi_helper import cg
|
|
7
|
+
from LoopStructural.interpolators.cython.dsi_helper import cg, constant_norm, fold_cg
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
from LoopStructural.utils import getLogger
|
|
10
|
+
logger = getLogger(__name__)
|
|
10
11
|
|
|
11
12
|
class TetMesh:
|
|
12
13
|
"""
|
|
@@ -15,13 +16,14 @@ class TetMesh:
|
|
|
15
16
|
def __init__(self, origin = [0,0,0], nsteps = [10,10,10], step_vector = [1,1,1]):
|
|
16
17
|
self.origin = np.array(origin)
|
|
17
18
|
self.step_vector = np.array(step_vector)
|
|
18
|
-
self.nsteps = np.array(nsteps)
|
|
19
|
+
self.nsteps = np.array(nsteps)
|
|
20
|
+
self.n_nodes = self.nsteps[0]*self.nsteps[1]*self.nsteps[2]
|
|
21
|
+
|
|
19
22
|
self.nsteps_cells = self.nsteps - 1
|
|
20
23
|
self.n_cell_x = self.nsteps[0] - 1
|
|
21
24
|
self.n_cell_y = self.nsteps[1] - 1
|
|
22
25
|
self.n_cell_z = self.nsteps[2] - 1
|
|
23
26
|
self.n_cells = self.n_cell_x * self.n_cell_y * self.n_cell_z
|
|
24
|
-
self.n_nodes = self.nsteps[0]*self.nsteps[1]*self.nsteps[2]
|
|
25
27
|
self.maximum = origin+self.nsteps*self.step_vector
|
|
26
28
|
self.tetra_mask_even = np.array([
|
|
27
29
|
[7,1,2,4],
|
|
@@ -39,8 +41,6 @@ class TetMesh:
|
|
|
39
41
|
[1,0,3,5]
|
|
40
42
|
])
|
|
41
43
|
self.ntetra = self.n_cells * 5
|
|
42
|
-
self.properties = {}
|
|
43
|
-
self.property_gradients = {}
|
|
44
44
|
self.n_elements = self.ntetra
|
|
45
45
|
self.cg = None
|
|
46
46
|
|
|
@@ -83,11 +83,7 @@ class TetMesh:
|
|
|
83
83
|
axis=1) / 4.
|
|
84
84
|
return barycentre
|
|
85
85
|
|
|
86
|
-
def
|
|
87
|
-
|
|
88
|
-
self.properties[name] = value
|
|
89
|
-
|
|
90
|
-
def evaluate_value(self, pos, prop):
|
|
86
|
+
def evaluate_value(self, pos, property_array):
|
|
91
87
|
"""
|
|
92
88
|
Evaluate value of interpolant
|
|
93
89
|
|
|
@@ -105,11 +101,10 @@ class TetMesh:
|
|
|
105
101
|
values = np.zeros(pos.shape[0])
|
|
106
102
|
values[:] = np.nan
|
|
107
103
|
vertices, c, tetras, inside = self.get_tetra_for_location(pos)
|
|
108
|
-
|
|
109
|
-
values[inside] = np.sum(c[inside,:]*self.properties[prop][tetras[inside,:]],axis=1)
|
|
104
|
+
values[inside] = np.sum(c[inside,:]*property_array[tetras[inside,:]],axis=1)
|
|
110
105
|
return values
|
|
111
106
|
|
|
112
|
-
def evaluate_gradient(self, pos,
|
|
107
|
+
def evaluate_gradient(self, pos, property_array):
|
|
113
108
|
"""
|
|
114
109
|
Evaluate the gradient of an interpolant at the locations
|
|
115
110
|
|
|
@@ -128,13 +123,20 @@ class TetMesh:
|
|
|
128
123
|
values = np.zeros(pos.shape)
|
|
129
124
|
values[:] = np.nan
|
|
130
125
|
vertices, element_gradients, tetras, inside = self.get_tetra_gradient_for_location(pos)
|
|
131
|
-
vertex_vals = self.properties[prop][tetras]
|
|
132
126
|
#grads = np.zeros(tetras.shape)
|
|
133
|
-
values[inside,:] = (element_gradients[inside,:,:]*
|
|
127
|
+
values[inside,:] = (element_gradients[inside,:,:]*property_array[tetras[inside,None,:]]).sum(2)
|
|
134
128
|
length = np.sum(values[inside,:],axis=1)
|
|
135
|
-
values[inside,:] /= length[:,None]
|
|
129
|
+
# values[inside,:] /= length[:,None]
|
|
136
130
|
return values
|
|
137
131
|
|
|
132
|
+
def inside(self, pos):
|
|
133
|
+
inside = np.ones(pos.shape[0]).astype(bool)
|
|
134
|
+
for i in range(3):
|
|
135
|
+
inside *= pos[:, i] > self.origin[None, i]
|
|
136
|
+
inside *= pos[:, i] < self.origin[None, i] + \
|
|
137
|
+
self.step_vector[None, i] * self.nsteps_cells[None, i]
|
|
138
|
+
return inside
|
|
139
|
+
|
|
138
140
|
def get_tetra_for_location(self, pos):
|
|
139
141
|
"""
|
|
140
142
|
Determine the tetrahedron from a numpy array of points
|
|
@@ -150,11 +152,13 @@ class TetMesh:
|
|
|
150
152
|
|
|
151
153
|
"""
|
|
152
154
|
pos = np.array(pos)
|
|
155
|
+
inside = self.inside(pos)
|
|
153
156
|
# initialise array for tetrahedron vertices
|
|
154
157
|
vertices = np.zeros((5, 4, pos.shape[0], 3))
|
|
155
158
|
vertices[:] = np.nan
|
|
156
159
|
# get cell indexes
|
|
157
160
|
c_xi, c_yi, c_zi = self.position_to_cell_index(pos)
|
|
161
|
+
|
|
158
162
|
# determine if using +ve or -ve mask
|
|
159
163
|
even_mask = (c_xi + c_yi + c_zi) % 2 == 0
|
|
160
164
|
# get cell corners
|
|
@@ -192,12 +196,17 @@ class TetMesh:
|
|
|
192
196
|
# if all coords are +ve then point is inside cell
|
|
193
197
|
mask = np.all(c > 0, axis=2)
|
|
194
198
|
|
|
195
|
-
inside = np.any(mask,axis=1)
|
|
199
|
+
inside = np.logical_and(inside,np.any(mask,axis=1))
|
|
196
200
|
# get cell corners
|
|
197
201
|
xi, yi, zi = self.cell_corner_indexes(c_xi, c_yi, c_zi)
|
|
198
202
|
#create mask to see which cells are even
|
|
199
203
|
even_mask = (c_xi + c_yi + c_zi) % 2 == 0
|
|
200
204
|
# create global node index list
|
|
205
|
+
# print('nsteps',self.nsteps, 'nsteps_cells', self.nsteps_cells)
|
|
206
|
+
# print('x',np.min(c_xi),np.max(c_xi),np.min(xi),np.max(xi))
|
|
207
|
+
# print('y',np.min(c_yi),np.max(c_yi),np.min(yi),np.max(yi))
|
|
208
|
+
# print('z',np.min(c_zi),np.max(c_zi),np.min(zi),np.max(zi))
|
|
209
|
+
|
|
201
210
|
gi = xi + yi * self.nsteps[0] + zi * self.nsteps[0] * self.nsteps[1]
|
|
202
211
|
# container for tetras
|
|
203
212
|
tetras = np.zeros((xi.shape[0], 5, 4)).astype(int)
|
|
@@ -218,7 +227,7 @@ class TetMesh:
|
|
|
218
227
|
tetra_return[inside,:] = tetras[mask,:]
|
|
219
228
|
return vertices_return, c_return, tetra_return, inside
|
|
220
229
|
|
|
221
|
-
def get_constant_gradient(self, region):
|
|
230
|
+
def get_constant_gradient(self, region, direction=None):
|
|
222
231
|
"""
|
|
223
232
|
Get the constant gradient for the specified nodes
|
|
224
233
|
|
|
@@ -231,6 +240,34 @@ class TetMesh:
|
|
|
231
240
|
-------
|
|
232
241
|
|
|
233
242
|
"""
|
|
243
|
+
"""
|
|
244
|
+
Add the constant gradient regularisation to the system
|
|
245
|
+
|
|
246
|
+
Parameters
|
|
247
|
+
----------
|
|
248
|
+
w (double) - weighting of the cg parameter
|
|
249
|
+
|
|
250
|
+
Returns
|
|
251
|
+
-------
|
|
252
|
+
|
|
253
|
+
"""
|
|
254
|
+
if direction is not None:
|
|
255
|
+
print('using cg direction')
|
|
256
|
+
logger.info("Running constant gradient")
|
|
257
|
+
elements_gradients = self.get_element_gradients(np.arange(self.ntetra))
|
|
258
|
+
if elements_gradients.shape[0] != direction.shape[0]:
|
|
259
|
+
logger.error('Cannot add directional CG, vector field is not the correct length')
|
|
260
|
+
return
|
|
261
|
+
region = region.astype('int64')
|
|
262
|
+
|
|
263
|
+
neighbours = self.get_neighbours()
|
|
264
|
+
elements = self.get_elements()
|
|
265
|
+
idc, c, ncons = fold_cg(elements_gradients, direction, neighbours.astype('int64'), elements.astype('int64'), self.nodes)
|
|
266
|
+
|
|
267
|
+
idc = np.array(idc[:ncons, :])
|
|
268
|
+
c = np.array(c[:ncons, :])
|
|
269
|
+
B = np.zeros(c.shape[0])
|
|
270
|
+
return c, idc, B
|
|
234
271
|
if self.cg is None:
|
|
235
272
|
logger.info("Running constant gradient")
|
|
236
273
|
elements_gradients = self.get_element_gradients(np.arange(self.ntetra))
|
|
@@ -246,7 +283,34 @@ class TetMesh:
|
|
|
246
283
|
B = np.zeros(c.shape[0])
|
|
247
284
|
self.cg = (c,idc,B)
|
|
248
285
|
return self.cg[0], self.cg[1], self.cg[2]
|
|
286
|
+
def get_constant_norm(self, region):
|
|
287
|
+
"""
|
|
288
|
+
Get the constant gradient for the specified nodes
|
|
289
|
+
|
|
290
|
+
Parameters
|
|
291
|
+
----------
|
|
292
|
+
region : np.array(dtype=bool)
|
|
293
|
+
mask of nodes to calculate cg for
|
|
294
|
+
|
|
295
|
+
Returns
|
|
296
|
+
-------
|
|
297
|
+
|
|
298
|
+
"""
|
|
299
|
+
|
|
300
|
+
logger.info("Running constant gradient")
|
|
301
|
+
elements_gradients = self.get_element_gradients(np.arange(self.ntetra))
|
|
302
|
+
region = region.astype('int64')
|
|
303
|
+
|
|
304
|
+
neighbours = self.get_neighbours()
|
|
305
|
+
elements = self.get_elements()
|
|
306
|
+
idc, c, ncons = constant_norm(elements_gradients, neighbours.astype('int64'), elements.astype('int64'), self.nodes,
|
|
307
|
+
region.astype('int64'))
|
|
249
308
|
|
|
309
|
+
idc = np.array(idc[:ncons, :])
|
|
310
|
+
c = np.array(c[:ncons, :])
|
|
311
|
+
B = np.zeros(c.shape[0])
|
|
312
|
+
|
|
313
|
+
return c,idc,B
|
|
250
314
|
def get_elements(self):
|
|
251
315
|
"""
|
|
252
316
|
Get a numpy array of all of the elements in the mesh
|
|
@@ -347,12 +411,9 @@ class TetMesh:
|
|
|
347
411
|
vertices, bc, tetras, inside = self.get_tetra_for_location(pos)
|
|
348
412
|
ps = vertices
|
|
349
413
|
m = np.array(
|
|
350
|
-
[[(ps[:, 1, 0] - ps[:, 0, 0]), (ps[:, 1, 1] - ps[:, 0, 1]),
|
|
351
|
-
|
|
352
|
-
[(ps[:,
|
|
353
|
-
(ps[:, 2, 2] - ps[:, 0, 2])],
|
|
354
|
-
[(ps[:, 3, 0] - ps[:, 0, 0]), (ps[:, 3, 1] - ps[:, 0, 1]),
|
|
355
|
-
(ps[:, 3, 2] - ps[:, 0, 2])]])
|
|
414
|
+
[[(ps[:, 1, 0] - ps[:, 0, 0]), (ps[:, 1, 1] - ps[:, 0, 1]),(ps[:, 1, 2] - ps[:, 0, 2])],
|
|
415
|
+
[(ps[:, 2, 0] - ps[:, 0, 0]), (ps[:, 2, 1] - ps[:, 0, 1]),(ps[:, 2, 2] - ps[:, 0, 2])],
|
|
416
|
+
[(ps[:, 3, 0] - ps[:, 0, 0]), (ps[:, 3, 1] - ps[:, 0, 1]),(ps[:, 3, 2] - ps[:, 0, 2])]])
|
|
356
417
|
I = np.array(
|
|
357
418
|
[[-1., 1., 0., 0.],
|
|
358
419
|
[-1., 0., 1., 0.],
|
|
@@ -364,25 +425,7 @@ class TetMesh:
|
|
|
364
425
|
element_gradients = element_gradients @ I
|
|
365
426
|
return vertices, element_gradients, tetras, inside
|
|
366
427
|
|
|
367
|
-
def inside(self, pos):
|
|
368
|
-
"""
|
|
369
|
-
Check if a point is inside the structured grid
|
|
370
|
-
|
|
371
|
-
Parameters
|
|
372
|
-
----------
|
|
373
|
-
pos
|
|
374
428
|
|
|
375
|
-
Returns
|
|
376
|
-
-------
|
|
377
|
-
|
|
378
|
-
"""
|
|
379
|
-
# check whether point is inside box
|
|
380
|
-
inside = np.ones(pos.shape[0]).astype(bool)
|
|
381
|
-
for i in range(3):
|
|
382
|
-
inside = np.logical_and(inside, pos[:, i] >= self.origin[None, i])
|
|
383
|
-
inside = np.logical_and(inside,pos[:, i] <= self.origin[None, i] + \
|
|
384
|
-
self.step_vector[None, i] * self.nsteps[None, i])
|
|
385
|
-
return inside
|
|
386
429
|
|
|
387
430
|
def global_node_indicies(self, indexes):
|
|
388
431
|
"""
|
|
@@ -9,7 +9,8 @@ from .geological_interpolator import GeologicalInterpolator
|
|
|
9
9
|
import logging
|
|
10
10
|
import numpy as np
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
from LoopStructural.utils import getLogger
|
|
13
|
+
logger = getLogger(__name__)
|
|
13
14
|
|
|
14
15
|
import surfepy
|
|
15
16
|
|
|
@@ -75,13 +76,13 @@ class SurfeRBFInterpolator(GeologicalInterpolator):
|
|
|
75
76
|
regression = kwargs.get("regression_smoothing", 0.)
|
|
76
77
|
if regression > 0:
|
|
77
78
|
logger.info("Using regression smoothing %f" % regression)
|
|
78
|
-
|
|
79
|
+
self.surfe.SetRegressionSmoothing(True,regression)
|
|
79
80
|
greedy = kwargs.get("greedy", (0, 0))
|
|
80
81
|
|
|
81
82
|
if greedy[0] > 0 or greedy[1] > 0:
|
|
82
83
|
logger.info("Using greedy algorithm: inferface %f and angular %f" %
|
|
83
84
|
(greedy[0], greedy[1]))
|
|
84
|
-
self.surfe.
|
|
85
|
+
self.surfe.SetGreedyAlgorithm(True, greedy[0], greedy[1])
|
|
85
86
|
poly_order = kwargs.get('poly_order',None)
|
|
86
87
|
if poly_order:
|
|
87
88
|
logger.info("Setting poly order to %i"%poly_order)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|