Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VTK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
VTK
VTK
Commits
2272a71a
Commit
2272a71a
authored
6 months ago
by
Sebastien Jourdain
Browse files
Options
Downloads
Patches
Plain Diff
python: add rectilinear grid override
parent
411b4e17
No related branches found
No related tags found
1 merge request
!11546
Python override rectilinear
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Wrapping/Python/vtkmodules/util/data_model.py
+73
-1
73 additions, 1 deletion
Wrapping/Python/vtkmodules/util/data_model.py
with
73 additions
and
1 deletion
Wrapping/Python/vtkmodules/util/data_model.py
+
73
−
1
View file @
2272a71a
...
...
@@ -2,7 +2,7 @@
to VTK datasets. See examples at bottom.
"""
from
contextlib
import
suppress
from
vtkmodules.vtkCommonCore
import
vtkPoints
,
vtkAbstractArray
from
vtkmodules.vtkCommonCore
import
vtkPoints
,
vtkAbstractArray
,
vtkDataArray
from
vtkmodules.vtkCommonDataModel
import
(
vtkCellArray
,
vtkDataObject
,
...
...
@@ -13,6 +13,7 @@ from vtkmodules.vtkCommonDataModel import (
vtkDataObject
,
vtkImageData
,
vtkPolyData
,
vtkRectilinearGrid
,
vtkUnstructuredGrid
,
vtkPartitionedDataSet
)
...
...
@@ -395,6 +396,77 @@ class vtkPolyData(PointSet, vtkPolyData):
offsets
=
dsa
.
vtkDataArrayToVTKArray
(
offsets_vtk
)
return
{
'
connectivity
'
:
conn
,
'
offsets
'
:
offsets
}
@vtkRectilinearGrid.override
class
vtkRectilinearGrid
(
DataSet
,
vtkRectilinearGrid
):
@property
def
x_coordinates
(
self
):
pts
=
self
.
GetXCoordinates
()
if
not
NUMPY_AVAILABLE
:
return
pts
if
not
pts
:
return
None
return
dsa
.
vtkDataArrayToVTKArray
(
pts
)
@x_coordinates.setter
def
x_coordinates
(
self
,
points
):
if
isinstance
(
points
,
vtkDataArray
):
self
.
SetXCoordinates
(
points
)
return
if
not
NUMPY_AVAILABLE
:
raise
ValueError
(
"
Expect vtkDataArray
"
)
pts
=
dsa
.
numpyTovtkDataArray
(
points
,
"
x_coords
"
)
self
.
SetXCoordinates
(
pts
)
@property
def
y_coordinates
(
self
):
pts
=
self
.
GetYCoordinates
()
if
not
NUMPY_AVAILABLE
:
return
pts
if
not
pts
:
return
None
return
dsa
.
vtkDataArrayToVTKArray
(
pts
)
@y_coordinates.setter
def
y_coordinates
(
self
,
points
):
if
isinstance
(
points
,
vtkDataArray
):
self
.
SetYCoordinates
(
points
)
return
if
not
NUMPY_AVAILABLE
:
raise
ValueError
(
"
Expect vtkDataArray
"
)
pts
=
dsa
.
numpyTovtkDataArray
(
points
,
"
y_coords
"
)
self
.
SetYCoordinates
(
pts
)
@property
def
z_coordinates
(
self
):
pts
=
self
.
GetZCoordinates
()
if
not
NUMPY_AVAILABLE
:
return
pts
if
not
pts
:
return
None
return
dsa
.
vtkDataArrayToVTKArray
(
pts
)
@z_coordinates.setter
def
z_coordinates
(
self
,
points
):
if
isinstance
(
points
,
vtkDataArray
):
self
.
SetZCoordinates
(
points
)
return
if
not
NUMPY_AVAILABLE
:
raise
ValueError
(
"
Expect vtkDataArray
"
)
pts
=
dsa
.
numpyTovtkDataArray
(
points
,
"
z_coords
"
)
self
.
SetZCoordinates
(
pts
)
class
CompositeDataIterator
(
object
):
"""
Wrapper for a vtkCompositeDataIterator class to satisfy
the python iterator protocol. This iterator iterates
...
...
This diff is collapsed.
Click to expand it.
Ben Boeckel
@ben.boeckel
mentioned in commit
5a1bc78b
·
5 months ago
mentioned in commit
5a1bc78b
mentioned in commit 5a1bc78b8f5a1547250646986171faf4e3e5c20e
Toggle commit list
Ben Boeckel
@ben.boeckel
mentioned in commit
758a11a1
·
5 months ago
mentioned in commit
758a11a1
mentioned in commit 758a11a1a4371def24dd6701e5f1ef5421f512a1
Toggle commit list
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