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
Erik Palmer
VTK
Commits
e4c0566b
Commit
e4c0566b
authored
11 years ago
by
George Zagaris
Browse files
Options
Downloads
Patches
Plain Diff
ENH: FieldData deserialization to a subextent
Change-Id: I52e04acecdc549410d6901116716bd50fba82875
parent
f41f521f
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
Parallel/Core/vtkFieldDataSerializer.cxx
+63
-5
63 additions, 5 deletions
Parallel/Core/vtkFieldDataSerializer.cxx
Parallel/Core/vtkFieldDataSerializer.h
+8
-0
8 additions, 0 deletions
Parallel/Core/vtkFieldDataSerializer.h
with
71 additions
and
5 deletions
Parallel/Core/vtkFieldDataSerializer.cxx
+
63
−
5
View file @
e4c0566b
...
...
@@ -12,15 +12,16 @@
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include
"vtkFieldDataSerializer.h"
#include
"vtkObjectFactory.h"
#include
"vtkFieldData.h"
#include
"vtkDataArray.h"
#include
"vtkFieldData.h"
#include
"vtkFieldDataSerializer.h"
#include
"vtkIdList.h"
#include
"vtkStructuredData.h"
#include
"vtkStringArray.h"
#include
"vtkIntArray.h"
#include
"vtkMultiProcessStream.h"
#include
"vtkObjectFactory.h"
#include
"vtkStringArray.h"
#include
"vtkStructuredData.h"
#include
"vtkStructuredExtent.h"
#include
<cassert>
// For assert()
#include
<cstring>
// For memcpy
...
...
@@ -221,6 +222,63 @@ void vtkFieldDataSerializer::SerializeSubExtent(
}
//------------------------------------------------------------------------------
void
vtkFieldDataSerializer
::
DeSerializeToSubExtent
(
int
subext
[
6
],
int
gridExtent
[
6
],
vtkFieldData
*
fieldData
,
vtkMultiProcessStream
&
bytestream
)
{
assert
(
"pre: sub-extent outside grid-extent"
&&
vtkStructuredExtent
::
Smaller
(
subext
,
gridExtent
));
if
(
fieldData
==
NULL
)
{
vtkGenericWarningMacro
(
"Field data is NULL!"
);
return
;
}
int
numArrays
=
0
;
bytestream
>>
numArrays
;
assert
(
"post: numArrays mismatch!"
&&
(
numArrays
==
fieldData
->
GetNumberOfArrays
())
);
int
ijk
[
3
];
for
(
int
array
=
0
;
array
<
numArrays
;
++
array
)
{
vtkDataArray
*
dataArray
=
NULL
;
vtkFieldDataSerializer
::
DeserializeDataArray
(
bytestream
,
dataArray
);
assert
(
"post: dataArray is NULL!"
&&
(
dataArray
!=
NULL
)
);
assert
(
"post: fieldData does not have array!"
&&
fieldData
->
HasArray
(
dataArray
->
GetName
()));
vtkDataArray
*
targetArray
=
fieldData
->
GetArray
(
dataArray
->
GetName
()
);
assert
(
"post: ncomp mismatch!"
&&
(
dataArray
->
GetNumberOfComponents
()
==
targetArray
->
GetNumberOfComponents
()));
for
(
ijk
[
0
]
=
subext
[
0
];
ijk
[
0
]
<=
subext
[
1
];
++
ijk
[
0
])
{
for
(
ijk
[
1
]
=
subext
[
2
];
ijk
[
1
]
<=
subext
[
3
];
++
ijk
[
1
])
{
for
(
ijk
[
2
]
=
subext
[
4
];
ijk
[
2
]
<=
subext
[
5
];
++
ijk
[
2
])
{
vtkIdType
sourceIdx
=
vtkStructuredData
::
ComputePointIdForExtent
(
subext
,
ijk
);
assert
(
"post: sourceIdx out-of-bounds!"
&&
(
sourceIdx
>=
0
)
&&
(
sourceIdx
<
dataArray
->
GetNumberOfTuples
())
);
vtkIdType
targetIdx
=
vtkStructuredData
::
ComputePointIdForExtent
(
gridExtent
,
ijk
);
assert
(
"post: targetIdx out-of-bounds!"
&&
(
targetIdx
>=
0
)
&&
(
targetIdx
<
targetArray
->
GetNumberOfTuples
())
);
targetArray
->
SetTuple
(
targetIdx
,
sourceIdx
,
dataArray
);
}
// END for all k
}
// END for all j
}
// END for all i
dataArray
->
Delete
();
}
// END for all arrays
}
//------------------------------------------------------------------------------
vtkDataArray
*
vtkFieldDataSerializer
::
ExtractSubExtentData
(
int
subext
[
6
],
int
gridExtent
[
6
],
vtkDataArray
*
inputDataArray
)
...
...
This diff is collapsed.
Click to expand it.
Parallel/Core/vtkFieldDataSerializer.h
+
8
−
0
View file @
e4c0566b
...
...
@@ -87,6 +87,14 @@ class VTKPARALLELCORE_EXPORT vtkFieldDataSerializer : public vtkObject
int
subext
[
6
],
int
gridExtent
[
6
],
vtkFieldData
*
fieldData
,
vtkMultiProcessStream
&
bytestream
);
// Description:
// Deserializes the field data from a bytestream to a the given sub-extent.
// The field data can be either cell-centered or node-centered depending
// on what subext and gridExtent actually represent.
static
void
DeSerializeToSubExtent
(
int
subext
[
6
],
int
gridExtent
[
6
],
vtkFieldData
*
fieldData
,
vtkMultiProcessStream
&
bytestream
);
// Description:
// Deserializes the field data from a bytestream.
static
void
Deserialize
(
...
...
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