Commit 0d1f2740 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

moving H5PartReader to VTK

fixes #19017.
parent a629ae7b
......@@ -1414,7 +1414,7 @@ set (ResetToVisibleRange_DISABLE_CRS TRUE)
# - Clip, UndoRedo, UndoRedo[1-8]
#
# Contains Plugin Loading actions:
# - LoadPlugins, NiftiReaderWriterPlugin, H5PartReaderPlugin
# - LoadPlugins, NiftiReaderWriterPlugin
#
# Does not work in CS or CRS mode
# - ViewSettingsDialog, RectilinearFractal, NewColorEditor
......
......@@ -520,13 +520,13 @@ list(APPEND paraview_requested_modules
ParaView::ServerManagerApplication
ParaView::ServerManagerDefault
ParaView::VTKExtensionsCGNSReader
ParaView::VTKExtensionsH5PartReader
ParaView::VTKExtensionsPoints
ParaView::WrapClientServer
VTK::FiltersFlowPaths
VTK::FiltersVerdict
VTK::IOAMR
VTK::IOAsynchronous # needed for cinema, but no harm adding always.
VTK::IOH5part
VTK::IOParallelLSDyna
VTK::IOTecplotTable
VTK::IOTRUCHAS
......
......@@ -8780,8 +8780,7 @@ series.
<SourceProxy
name="vtkVeraOutReader"
class="vtkVeraOutReader"
label="VERA OUT Reader"
>
label="VERA OUT Reader" >
<Documentation
long_help="Reads VERA OUT HDF5 data."
short_help="Reads VERA OUT HDF5 data."
......@@ -8868,5 +8867,124 @@ series.
<FileListDomain name="files"/>
</StringVectorProperty>
</SourceProxy>
<SourceProxy name="H5PartReader" class="vtkH5PartReader">
<Documentation>
Reader for H5Part (HDF5) particle files.
</Documentation>
<StringVectorProperty name="FileName"
command="SetFileName"
number_of_elements="1"
panel_visibility="never">
<FileListDomain name="files"/>
</StringVectorProperty>
<DoubleVectorProperty name="TimestepValues"
information_only="1">
<TimeStepsInformationHelper/>
</DoubleVectorProperty>
<StringVectorProperty name="XarrayInfo"
command="GetXarray"
information_only="1">
</StringVectorProperty>
<StringVectorProperty name="YarrayInfo"
command="GetYarray"
information_only="1">
</StringVectorProperty>
<StringVectorProperty name="ZarrayInfo"
command="GetZarray"
information_only="1">
</StringVectorProperty>
<StringVectorProperty name="Xarray"
command="SetXarray"
number_of_elements="1"
information_property="XarrayInfo">
<Documentation>
This property lists which point array to use for coordinates.
</Documentation>
<StringListDomain name="array_list">
<RequiredProperties>
<Property name="PointArrayInfo" function="ArrayList" />
</RequiredProperties>
</StringListDomain>
</StringVectorProperty>
<StringVectorProperty name="Yarray"
command="SetYarray"
number_of_elements="1"
information_property="YarrayInfo">
<Documentation>
This property lists which point array to use for coordinates.
</Documentation>
<StringListDomain name="array_list">
<RequiredProperties>
<Property name="PointArrayInfo" function="ArrayList" />
</RequiredProperties>
</StringListDomain>
</StringVectorProperty>
<StringVectorProperty name="Zarray"
command="SetZarray"
number_of_elements="1"
information_property="ZarrayInfo">
<Documentation>
This property lists which point array to use for coordinates.
</Documentation>
<StringListDomain name="array_list">
<RequiredProperties>
<Property name="PointArrayInfo" function="ArrayList" />
</RequiredProperties>
</StringListDomain>
</StringVectorProperty>
<StringVectorProperty name="PointArrayInfo"
information_only="1">
<ArraySelectionInformationHelper attribute_name="Point"/>
</StringVectorProperty>
<StringVectorProperty name="PointArrayStatus"
command="SetPointArrayStatus"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="2"
element_types="2 0"
information_property="PointArrayInfo"
label="Point Arrays">
<ArraySelectionDomain name="array_list">
<RequiredProperties>
<Property name="PointArrayInfo" function="ArrayList"/>
</RequiredProperties>
</ArraySelectionDomain>
<Documentation>
This property lists which point-centered arrays to read.
</Documentation>
</StringVectorProperty>
<IntVectorProperty name="GenerateVertexCells"
command="SetGenerateVertexCells"
number_of_elements="1"
default_values="1"
panel_visibility="advanced">
<BooleanDomain name="bool"/>
</IntVectorProperty>
<IntVectorProperty name="MaskOutOfTimeRangeOutput"
command="SetMaskOutOfTimeRangeOutput"
number_of_elements="1"
default_values="0"
panel_visibility="advanced">
<BooleanDomain name="bool"/>
</IntVectorProperty>
<Hints>
<ReaderFactory extensions="h5part"
file_description="H5Part particle files" />
</Hints>
</SourceProxy>
</ProxyGroup>
</ServerManagerConfiguration>
## Thanks to John Biddiscombe of
## CSCS - Swiss National Supercomputing Centre for creating and contributing
## this plugin.
set(classes
vtkH5PartReader)
set(sources
# TODO: Move H5Part to ThirdParty/
H5Part/src/H5Block.c
H5Part/src/H5Part.c)
set_source_files_properties(${sources}
PROPERTIES
LANGUAGE CXX)
vtk_module_add_module(ParaView::VTKExtensionsH5PartReader
CLASSES ${classes}
SOURCES ${sources})
if (PARAVIEW_USE_MPI)
vtk_module_definitions(ParaView::VTKExtensionsH5PartReader
PRIVATE
H5PART_HAS_MPI)
endif ()
vtk_module_definitions(ParaView::VTKExtensionsH5PartReader
PRIVATE
H5_USE_16_API)
vtk_module_include(ParaView::VTKExtensionsH5PartReader
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/H5Part/src")
paraview_add_server_manager_xmls(
XMLS H5PartServerManager.xml)
Andreas Adelmann (PSI)
Achim Gsell (PSI)
Benedikt Oswald (PSI)
Wes Bethel (NERSC/LBNL)
John Shalf (NERSC/LBNL)
Cristina Siegerist (NERSC/LBNL)
Please use h5part@lists.psi.ch for communicaion.
*** Copyright Notice ***
H5Part Copyright (c) 2006, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy) and the Paul Scherrer Institut (Switzerland). All rights reserved.
If you have questions about your rights to use or distribute this software, please contact Berkeley Lab's Technology Transfer Department at TTD@lbl.gov referring to "H5Part (LBNL Ref CR-2255)"
NOTICE. This software was developed under partial funding from the U.S. Department of Energy. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, prepare derivative works, and perform publicly and display publicly. Beginning five (5) years after the date permission to assert copyright is obtained from the U.S. Department of Energy, and subject to any subsequent five (5) year renewals, the U.S. Government is granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, prepare derivative works, distribute copies to the public, perform publicly and display publicly, and to permit others to do so.
Error Handling
--------------
Now all functions, in which an error could occur, are returning a
value. This value is either a 64bit integer or a pointer.
A negative 64bit integer as result indicates an error. Values >= 0
indicates successful execution. This is similar to the convention
used in UNIX system calls, but we do not return -1 but the error
number (which is always negative).
For functions returning a pointer the NULL-pointer is used to indicate
an error. You can call the function H5PartGetErrno() to get the error
number. For the time being there is no strerror(3) or perror(3)
equivalent.
API Changes
-----------
There are several changes in the API of H5Part. The biggest change is
a side-effect of the implementation of strict error handling. The
impact to the existing C/C++ code is very small. But now you *can*
and *should* implement some kind of error handling. The simplest
error handling is to set an error handler which aborts the program as
soon as an error occurred.
The next "biggest" change is the use of H5Part types instead of "long
long" and "double". The replacement of "long long" is "h5part_int64_t"
and for "double" "h5part_float64_t". This change has now effect in
Fortran.
In some functions the argument type changed from "int" to
"h5part_int64_t". Since on most systems "int" is a 32bit integer,
calls to these functions must be adapted to the new API. In C/C++ the
compiler will complain about it. But in Fortran you will *not* get an
error message.So, you must check your Fortran code carefully.
Changes in detail (not listed are functions where only the return
type changed from any to "h5part_int64_t"):
New API Changes to old API
h5part_int64_t void
H5PartSetNumParticles (
H5PartFile *f,
h5part_int64_t nparticles long long
);
h5part_int64_t int
H5PartWriteDataFloat64 (
H5PartFile *f,
char *name,
h5part_float64_t *dta double
);
h5part_int64_t int
H5PartWriteDataInt64 (
H5PartFile *f,
char *name,
h5part_int64_t *dta long long
);
h5part_int64_t void
H5PartSetStep (
H5PartFile *f,
h5part_int64_t step int
);
h5part_int64_t void
H5PartSetView (
H5PartFile *f,
h5part_int64_t start, long long
h5part_int64_t end long long
);
h5part_int64_t int
H5PartGetView (
H5PartFile *f,
h5part_int64_t *start, long long
h5part_int64_t *end long long
);
h5part_int64_t int
H5PartReadDataFloat64 (
H5PartFile *f,
char *name,
h5part_float64_t *dta double
);
h5part_int64_t int
H5PartReadDataInt64 (
H5PartFile *f,
char *name,
h5part_int64_t *dta long long
);
h5part_int64_t void
H5PartReadParticleStep (
H5PartFile *f,
h5part_int64_t step, int
h5part_float64_t *x, double
h5part_float64_t *y, double
h5part_float64_t *z, double
h5part_float64_t *px, double
h5part_float64_t *py, double
h5part_float64_t *pz, double
h5part_int64_t *id long long
);
New functions:
h5part_int64_t
H5PartSetVerbosityLevel (
unsigned int
);
h5part_int64_t
H5PartSetErrorHandler (
h5part_error_handler handler
);
h5part_int64_t
H5PartGetErrno (
void
);
h5part_int64_t
H5PartDefaultErrorHandler (
const char *funcname,
const h5part_int64_t eno,
const char *fmt,
...
);
h5part_int64_t
H5PartAbortErrorHandler (
const char *funcname,
const h5part_int64_t eno,
const char *fmt,
...
);
Removed functions:
int
H5PartFileIsValid (
H5PartFile *f
);
This diff is collapsed.
*** License agreement ***
H5Part Copyright (c) 2006, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy) and the Paul Scherrer Institut (Switzerland). All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
(1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
(2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
(3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, U.S. Dept. of Energy, Paul Scherrer Institut (Switzerland) nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You are under no obligation whatsoever to provide any bug fixes, patches, or upgrades to the features, functionality or performance of the source code ("Enhancements") to anyone; however, if you choose to make your Enhancements available either publicly, or directly to Lawrence Berkeley National Laboratory, without imposing a separate written license agreement for such Enhancements, then you hereby grant the following license: a non-exclusive, royalty-free perpetual license to install, use, modify, prepare derivative works, incorporate into other computer software, distribute, and sublicense such enhancements or derivative works thereof, in binary and source code form.
*****
#ifndef H5Block_h
#define H5Block_h
#ifdef __cplusplus
extern "C" {
#endif
/*!
Interface for block structured field data
*/
h5part_int64_t
H5BlockDefine3DFieldLayout (
H5PartFile *f,
const h5part_int64_t i_start,
const h5part_int64_t i_end,
const h5part_int64_t j_start,
const h5part_int64_t j_end,
const h5part_int64_t k_start,
const h5part_int64_t k_end
);
h5part_int64_t
H5Block3dGetPartitionOfProc (
H5PartFile *f,
const h5part_int64_t proc,
h5part_int64_t *i_start,
h5part_int64_t *i_end,
h5part_int64_t *j_start,
h5part_int64_t *j_end,
h5part_int64_t *k_start,
h5part_int64_t *k_end
);
h5part_int64_t
H5Block3dGetReducedPartitionOfProc (
H5PartFile *f,
h5part_int64_t proc,
h5part_int64_t *i_start,
h5part_int64_t *i_end,
h5part_int64_t *j_start,
h5part_int64_t *j_end,
h5part_int64_t *k_start,
h5part_int64_t *k_end
);
h5part_int64_t
H5Block3dGetProcOf (
H5PartFile *f,
h5part_int64_t i,
h5part_int64_t j,
h5part_int64_t k
);
h5part_int64_t
H5Block3dWriteScalarField (
H5PartFile *f,
const char *name,
const h5part_float64_t *data
);
h5part_int64_t
H5Block3dReadScalarField (
H5PartFile *f,
const char *name,
h5part_float64_t *data
);
h5part_int64_t
H5BlockGetNumFields (
H5PartFile *f
);
h5part_int64_t
H5BlockGetFieldInfo (
H5PartFile *f,
const h5part_int64_t idx,
char *name,
const h5part_int64_t len_name,
h5part_int64_t *grid_rank,
h5part_int64_t *grid_dims,
h5part_int64_t *field_dims
);
h5part_int64_t
H5BlockGetFieldInfoByName (
H5PartFile *f,
const char *field_name,
h5part_int64_t *grid_rank,
h5part_int64_t *grid_dims,
h5part_int64_t *field_dims
);
h5part_int64_t
H5Block3dGetFieldOrigin (
H5PartFile *f,
const char *field_name,
h5part_float64_t *x_origin,
h5part_float64_t *y_origin,
h5part_float64_t *z_origin
);
h5part_int64_t
H5Block3dSetFieldOrigin (
H5PartFile *f,
const char *field_name,
const h5part_float64_t x_origin,
const h5part_float64_t y_origin,
const h5part_float64_t z_origin
);
h5part_int64_t
H5Block3dGetFieldSpacing (
H5PartFile *f,
const char *field_name,
h5part_float64_t *x_spacing,
h5part_float64_t *y_spacing,
h5part_float64_t *z_spacing
);
h5part_int64_t
H5Block3dSetFieldSpacing (
H5PartFile *f,
const char *field_name,
const h5part_float64_t x_spacing,
const h5part_float64_t y_spacing,
const h5part_float64_t z_spacing
);
h5part_int64_t
H5Block3dWrite3dVectorField (
H5PartFile *f,
const char *name,
const h5part_float64_t *xval,
const h5part_float64_t *yval,
const h5part_float64_t *zval
);
h5part_int64_t
H5Block3dRead3dVectorField (
H5PartFile *f,
const char *name,
h5part_float64_t *xval,
h5part_float64_t *yval,
h5part_float64_t *zval
);
h5part_int64_t
H5BlockWriteFieldAttrib (
H5PartFile *f,
const char *field_name,
const char *attrib_name,
const h5part_int64_t attrib_type,
const void *attrib_value,
const h5part_int64_t attrib_nelem
);
h5part_int64_t
H5BlockWriteFieldAttribString (
H5PartFile *f,
const char *field_name,
const char *attrib_name,
const char *attrib_value
);
h5part_int64_t
H5BlockGetNumFieldAttribs (
H5PartFile *f,
const char *field_name
);
h5part_int64_t
H5BlockGetFieldAttribInfo (
H5PartFile *f,
const char *field_name,
const h5part_int64_t attrib_idx,
char *attrib_name,
const h5part_int64_t len_of_attrib_name,
h5part_int64_t *attrib_type,
h5part_int64_t *attrib_nelem
);
h5part_int64_t
H5BlockReadFieldAttrib (
H5PartFile *f,
const char *field_name,
const char *attrib_name,
void *attrib_value
);
h5part_int64_t
H5BlockHasFieldData (
H5PartFile *f
);
#ifdef __cplusplus
}
#endif
#endif
#ifndef H5BlockErrors_h
#define H5BlockErrors_h
#define _err_handler H5PartGetErrorHandler()
#define CHECK_LAYOUT( f ) \
if ( ! f->block->have_layout ) \
return (*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_LAYOUT, \
"No layout defined." )
#define HANDLE_H5PART_LAYOUT_ERR \
(*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_LAYOUT, \
"Bad layout." );
#define HANDLE_H5PART_NOENT_ERR( name ) \
(*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_NOENT, \
"Object \"%s\" doesn't exists.", name );
#define HANDLE_H5PART_DATASET_RANK_ERR( m, n ) \
(*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_INVAL, \
"Wrong rank of dataset: Is %d, but should be %d", \
m, n );
#define HANDLE_H5PART_GROUP_EXISTS_ERR( name ) \
(*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_INVAL, \
"Group \"%s\" already exists", name )
#define HANDLE_H5S_CREATE_SIMPLE_3D_ERR( dims ) \
(*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_HDF5, \
"Cannot create 3d dataspace with dimension sizes " \
"\"(%lld,%lld,%lld)\".", \
(long long)dims[0], (long long)dims[1], (long long)dims[2] );
#define HANDLE_H5S_GET_SIMPLE_EXTENT_DIMS_ERR \
(*_err_handler) ( \
_H5Part_get_funcname(), \
H5PART_ERR_HDF5, \
"Cannot get dimension sizes of dataset" );
#endif
INTERFACE
INTEGER*8 FUNCTION h5bl_define3dlayout ( filehandle, i_start, i_end, j_start, j_end, k_start, k_end )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: i_start
INTEGER*8, INTENT(IN) :: i_end
INTEGER*8, INTENT(IN) :: j_start
INTEGER*8, INTENT(IN) :: j_end
INTEGER*8, INTENT(IN) :: k_start
INTEGER*8, INTENT(IN) :: k_end
END FUNCTION
INTEGER*8 FUNCTION h5bl_get_partition_of_proc ( filehandle, proc, i_start, i_end, j_start, j_end, k_start, k_end )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(OUT) :: proc
INTEGER*8, INTENT(OUT) :: i_start
INTEGER*8, INTENT(OUT) :: i_end
INTEGER*8, INTENT(OUT) :: j_start
INTEGER*8, INTENT(OUT) :: j_end
INTEGER*8, INTENT(OUT) :: k_start
INTEGER*8, INTENT(OUT) :: k_end
END FUNCTION
INTEGER*8 FUNCTION h5bl_get_reduced_partition_of_proc ( filehandle, proc, i_start, i_end, j_start, j_end, k_start, k_end )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(OUT) :: proc
INTEGER*8, INTENT(OUT) :: i_start
INTEGER*8, INTENT(OUT) :: i_end
INTEGER*8, INTENT(OUT) :: j_start
INTEGER*8, INTENT(OUT) :: j_end
INTEGER*8, INTENT(OUT) :: k_start
INTEGER*8, INTENT(OUT) :: k_end
END FUNCTION
INTEGER*8 FUNCTION h5bl_get_proc_of ( filehandle, i, j, k )
INTEGER*8, INTENT(IN) :: filehandle
INTEGER*8, INTENT(IN) :: i
INTEGER*8, INTENT(IN) :: j
INTEGER*8, INTENT(IN) :: k
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_read_scalar_field ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(OUT) :: data(*)
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_write_scalar_field ( filehandle, name, data )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(IN) :: data(*)
END FUNCTION
INTEGER*8 FUNCTION h5bl_3d_read_3dvector_field ( filehandle, name, x, y, z )
INTEGER*8, INTENT(IN) :: filehandle
CHARACTER(LEN=*), INTENT(IN) :: name
REAL*8, INTENT(OUT) :: x(*)
REAL*8, INTENT(OUT) :: y(*)
REAL*8, INTENT(OUT) :: z(*)
END FUNCTION