Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogstools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Max Bittens
ogstools
Commits
9880a079
Commit
9880a079
authored
1 year ago
by
Florian Zill
Browse files
Options
Downloads
Patches
Plain Diff
[meshlib] function to get the difference of two meshes
parent
e84425cb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ogstools/meshlib/__init__.py
+2
-0
2 additions, 0 deletions
ogstools/meshlib/__init__.py
ogstools/meshlib/data_processing.py
+26
-0
26 additions, 0 deletions
ogstools/meshlib/data_processing.py
with
28 additions
and
0 deletions
ogstools/meshlib/__init__.py
+
2
−
0
View file @
9880a079
from
.boundary
import
Boundary
,
Layer
,
LocationFrame
,
Raster
from
.boundary_set
import
LayerSet
from
.boundary_subset
import
Surface
from
.data_processing
import
difference
from
.gmsh_meshing
import
cuboid
,
rect
from
.mesh_series
import
MeshSeries
...
...
@@ -12,6 +13,7 @@ __all__ = [
"
Boundary
"
,
"
MeshSeries
"
,
"
LayerSet
"
,
"
difference
"
,
"
rect
"
,
"
cuboid
"
,
]
This diff is collapsed.
Click to expand it.
ogstools/meshlib/data_processing.py
0 → 100644
+
26
−
0
View file @
9880a079
from
typing
import
Union
import
pyvista
as
pv
from
ogstools.propertylib
import
Property
,
presets
def
difference
(
mesh1
:
pv
.
UnstructuredGrid
,
mesh2
:
pv
.
UnstructuredGrid
,
mesh_property
:
Union
[
Property
,
str
],
)
->
pv
.
UnstructuredGrid
:
"""
Compute the difference between two meshes based on a specified property.
:param mesh1: The first mesh to be subtracted from.
:param mesh2: The second mesh whose data is subtracted from the first mesh.
:param mesh_property: The property to of interest.
:returns: A new mesh representing the difference between mesh1 and mesh2.
"""
if
isinstance
(
mesh_property
,
str
):
data_shape
=
mesh1
[
mesh_property
].
shape
mesh_property
=
presets
.
get_preset
(
mesh_property
,
data_shape
)
diff_mesh
=
mesh1
.
copy
(
deep
=
True
)
diff_mesh
[
mesh_property
.
data_name
]
-=
mesh2
[
mesh_property
.
data_name
]
return
diff_mesh
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment