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
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
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
Spiros Tsalikis
VTK
Commits
2d477d62
Commit
2d477d62
authored
2 weeks ago
by
Dan Lipsa
Browse files
Options
Downloads
Patches
Plain Diff
Deal with 0 dimensions
parent
29d5db76
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
IO/NetCDF/vtkNetCDFReader.cxx
+6
-2
6 additions, 2 deletions
IO/NetCDF/vtkNetCDFReader.cxx
IO/NetCDF/vtkXArrayAccessor.cxx
+10
-7
10 additions, 7 deletions
IO/NetCDF/vtkXArrayAccessor.cxx
with
16 additions
and
9 deletions
IO/NetCDF/vtkNetCDFReader.cxx
+
6
−
2
View file @
2d477d62
...
...
@@ -299,7 +299,11 @@ int vtkNetCDFReader::RequestInformation(vtkInformation* vtkNotUsed(request),
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
this
->
WholeExtent
[
2
*
i
]
=
0
;
if
(
i
<
this
->
LoadingDimensions
->
GetNumberOfTuples
())
vtkIdType
ndims
=
this
->
LoadingDimensions
->
GetNumberOfTuples
();
// if there are 0 dimensions
// generate an empty image with (0, -1, 0 -1, 0, -1)
int
maxExtent
=
ndims
>
0
?
0
:
-
1
;
if
(
i
<
ndims
)
{
size_t
dimlength
;
// Remember that netCDF arrays are indexed backward from VTK images.
...
...
@@ -312,7 +316,7 @@ int vtkNetCDFReader::RequestInformation(vtkInformation* vtkNotUsed(request),
}
else
{
this
->
WholeExtent
[
2
*
i
+
1
]
=
0
;
this
->
WholeExtent
[
2
*
i
+
1
]
=
maxExtent
;
}
}
vtkDebugMacro
(
<<
"Whole extents: "
<<
this
->
WholeExtent
[
0
]
<<
", "
<<
this
->
WholeExtent
[
1
]
<<
", "
...
...
This diff is collapsed.
Click to expand it.
IO/NetCDF/vtkXArrayAccessor.cxx
+
10
−
7
View file @
2d477d62
...
...
@@ -323,9 +323,9 @@ void vtkXArrayAccessor::PrintVarValue(
bool
vtkXArrayAccessor
::
IsContiguous
(
int
varid
,
const
size_t
*
startp
,
const
size_t
*
countp
)
{
// the last dim is the most rapidly varying
size_
t
ndims
=
this
->
VarDims
[
varid
].
size
();
size_
t
contiguousDims
=
0
;
for
(
int
i
=
static_cast
<
int
>
(
ndims
-
1
)
;
i
>=
0
;
--
i
)
in
t
ndims
=
static_cast
<
int
>
(
this
->
VarDims
[
varid
].
size
()
)
;
in
t
contiguousDims
=
0
;
for
(
int
i
=
ndims
-
1
;
i
>=
0
;
--
i
)
{
if
(
startp
[
i
]
==
0
&&
countp
[
i
]
==
this
->
DimLen
[
this
->
VarDims
[
varid
][
i
]])
{
...
...
@@ -343,11 +343,14 @@ std::vector<size_t> vtkXArrayAccessor::GetDimIncrement(int varid)
{
size_t
ndims
=
this
->
VarDims
[
varid
].
size
();
std
::
vector
<
size_t
>
dimIncrement
;
dimIncrement
.
resize
(
ndims
);
dimIncrement
[
ndims
-
1
]
=
1
;
for
(
size_t
i
=
ndims
-
1
;
i
>=
1
;
--
i
)
if
(
ndims
>
0
)
{
dimIncrement
[
i
-
1
]
=
dimIncrement
[
i
]
*
this
->
DimLen
[
this
->
VarDims
[
varid
][
i
]];
dimIncrement
.
resize
(
ndims
);
dimIncrement
[
ndims
-
1
]
=
1
;
for
(
size_t
i
=
ndims
-
1
;
i
>=
1
;
--
i
)
{
dimIncrement
[
i
-
1
]
=
dimIncrement
[
i
]
*
this
->
DimLen
[
this
->
VarDims
[
varid
][
i
]];
}
}
return
dimIncrement
;
}
...
...
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