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
Uwe Siems
VTK
Commits
2e1174ef
Commit
2e1174ef
authored
1 year ago
by
Spiros Tsalikis
Browse files
Options
Downloads
Patches
Plain Diff
vtkExtractSelection: When input is AMR create PDC
Also fix issue with using amr iterator.
parent
18feca43
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
Filters/Extraction/vtkExtractSelection.cxx
+15
-28
15 additions, 28 deletions
Filters/Extraction/vtkExtractSelection.cxx
Filters/Extraction/vtkExtractSelection.h
+12
-3
12 additions, 3 deletions
Filters/Extraction/vtkExtractSelection.h
with
27 additions
and
31 deletions
Filters/Extraction/vtkExtractSelection.cxx
+
15
−
28
View file @
2e1174ef
...
...
@@ -120,8 +120,8 @@ int vtkExtractSelection::RequestDataObject(
}
else
if
(
vtkCompositeDataSet
::
SafeDownCast
(
inputDO
))
{
// For other composite datasets, we create a vtk
MultiBlockDataSet
as output;
outputType
=
VTK_
MULTIBLOCK_DATA_SET
;
// For other composite datasets, we create a vtk
PartitionedDataSetCollection
as output;
outputType
=
VTK_
PARTITIONED_DATA_SET_COLLECTION
;
}
else
if
(
vtkDataSet
::
SafeDownCast
(
inputDO
)
||
(
this
->
HyperTreeGridToUnstructuredGrid
&&
vtkHyperTreeGrid
::
SafeDownCast
(
inputDO
)))
...
...
@@ -314,8 +314,7 @@ int vtkExtractSelection::RequestData(vtkInformation* vtkNotUsed(request),
assert
(
outputCD
!=
nullptr
);
outputCD
->
CopyStructure
(
inputCD
);
vtkSmartPointer
<
vtkCompositeDataIterator
>
inIter
;
inIter
.
TakeReference
(
inputCD
->
NewIterator
());
auto
inIter
=
vtk
::
TakeSmartPointer
(
inputCD
->
NewIterator
());
// Initialize the output composite dataset to have blocks with the same type
// as the input.
...
...
@@ -365,39 +364,31 @@ int vtkExtractSelection::RequestData(vtkInformation* vtkNotUsed(request),
vtkLogStartScope
(
TRACE
,
"evaluate expression and extract output"
);
// Now iterate again over the composite dataset and evaluate the expression to
// combine all the insidedness arrays and then extract the elements.
vtkSmartPointer
<
vtkCompositeDataIterator
>
outIter
;
outIter
.
TakeReference
(
outputCD
->
NewIterator
());
bool
globalEvaluationResult
=
true
;
// input iterator is needed because if inputCD is subclass of vtkUniformGridAMR,
// GetDataSet requires the iterator to be vtkUniformGridAMRDataIterator
vtkTypeBool
isUniformGridAMR
=
outputCD
->
IsA
(
"vtkUniformGridAMR"
);
if
(
isUniformGridAMR
)
{
inIter
->
GoToFirstItem
();
}
for
(
outIter
->
GoToFirstItem
();
!
outIter
->
IsDoneWithTraversal
();
outIter
->
GoToNextItem
())
// we use the input iterator instead of the output one, because if inputCD is subclass of
// vtkUniformGridAMR, GetDataSet requires the iterator to be vtkUniformGridAMRDataIterator
for
(
inIter
->
GoToFirstItem
();
!
inIter
->
IsDoneWithTraversal
();
inIter
->
GoToNextItem
())
{
if
(
this
->
CheckAbort
())
{
break
;
}
auto
outputBlock
=
outIter
->
GetCurrentDataObject
();
if
(
outputBlock
)
auto
inBlock
=
inIter
->
GetCurrentDataObject
();
auto
outBlock
=
outputCD
->
GetDataSet
(
inIter
);
if
(
inBlock
&&
outBlock
)
{
// Evaluate the expression.
auto
evaluationResult
=
this
->
EvaluateSelection
(
out
put
Block
,
assoc
,
selection
,
selectors
);
auto
evaluationResult
=
this
->
EvaluateSelection
(
outBlock
,
assoc
,
selection
,
selectors
);
if
(
evaluationResult
!=
EvaluationResult
::
INVALID
)
{
vtkSmartPointer
<
vtkUnsignedCharArray
>
colorArray
=
this
->
EvaluateColorArrayInSelection
(
out
put
Block
,
assoc
,
selection
);
this
->
EvaluateColorArrayInSelection
(
outBlock
,
assoc
,
selection
);
// Extract the elements.
auto
iter
=
isUniformGridAMR
?
inIter
:
outIter
;
auto
extractResult
=
this
->
ExtractElements
(
inputCD
->
GetDataSet
(
iter
),
assoc
,
evaluationResult
,
outputBlock
);
auto
extractResult
=
this
->
ExtractElements
(
inBlock
,
assoc
,
evaluationResult
,
outBlock
);
this
->
AddColorArrayOnObject
(
extractResult
,
colorArray
);
outputCD
->
SetDataSet
(
out
Iter
,
extractResult
);
outputCD
->
SetDataSet
(
in
Iter
,
extractResult
);
}
else
{
...
...
@@ -405,19 +396,15 @@ int vtkExtractSelection::RequestData(vtkInformation* vtkNotUsed(request),
break
;
}
}
if
(
isUniformGridAMR
)
{
inIter
->
GoToNextItem
();
}
}
vtkLogEndScope
(
"evaluate expression and extract output"
);
// check for evaluate result errors
if
(
!
globalEvaluationResult
)
{
// If the expression evaluation failed, then we need to set all the blocks to null.
for
(
out
Iter
->
GoToFirstItem
();
!
out
Iter
->
IsDoneWithTraversal
();
out
Iter
->
GoToNextItem
())
for
(
in
Iter
->
GoToFirstItem
();
!
in
Iter
->
IsDoneWithTraversal
();
in
Iter
->
GoToNextItem
())
{
outputCD
->
SetDataSet
(
out
Iter
,
nullptr
);
outputCD
->
SetDataSet
(
in
Iter
,
nullptr
);
}
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
Filters/Extraction/vtkExtractSelection.h
+
12
−
3
View file @
2e1174ef
...
...
@@ -5,14 +5,23 @@
* @brief extract a subset from a vtkDataSet.
*
* vtkExtractSelection extracts some subset of cells and points from
* its input dataobject. The dataobject is given on its first input port.
* its input data
object. The data
object is given on its first input port.
* The subset is described by the contents of the vtkSelection on its
* second input port. Depending on the contents of the vtkSelection
* this will create various vtkSelectors to identify the
* selected elements.
*
* This filter supports vtkCompositeDataSet (output is vtkMultiBlockDataSet),
* vtkTable and vtkDataSet (output is vtkUnstructuredGrid).
* This filter supports vtkCompositeDataSet, vtkDataSet, vtkHyperTreeGrid and vtkTable.
*
* 1. If preserve topology is on, the output type is the same as the input.
* 2. If preserve topology is on.
* 1. If input is a subclass of vtkDataObjectTree, the output is the same subclass.
* 2. If input is vtkUniformGridAMR, the output is vtkPartitionedDataSetCollection.
* 3. If input is vtkDataSet, the output is vtkUnstructuredGrid.
* 4. If input is vtkHyperTreeGrid, the output is vtkHyperTreeGrid or vtkUnstructuredGrid
* depending on the HyperTreeGridToUnstructuredGrid flag.
* 5. If input is vtkTable, the output is vtkTable.
*
* Other types of input are not processed and the corresponding output is a
* default constructed object of the input type.
*
...
...
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