mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
removed incomplete HDF5 support (now in branch format-h5pt)
This commit is contained in:
parent
5d0ba771c6
commit
f994e996a0
5 changed files with 0 additions and 187 deletions
|
@ -70,7 +70,6 @@ RUN dnf -y install \
|
|||
libnl3-devel \
|
||||
libcurl-devel \
|
||||
jansson-devel \
|
||||
hdf5-devel \
|
||||
libwebsockets-devel \
|
||||
zeromq-devel \
|
||||
nanomsg-devel \
|
||||
|
|
|
@ -72,7 +72,6 @@ RUN yum -y install \
|
|||
openssl openssl-devel \
|
||||
libconfig-devel \
|
||||
libnl3-devel \
|
||||
hdf5-devel \
|
||||
zeromq-devel \
|
||||
nanomsg-devel \
|
||||
libxil-devel
|
||||
|
|
|
@ -74,7 +74,6 @@ RUN apt-get update && apt-get install -y \
|
|||
libnl-3-dev libnl-route-3-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libjansson-dev \
|
||||
libhdf5-dev \
|
||||
libzmq3-dev \
|
||||
libnanomsg-dev
|
||||
|
||||
|
|
|
@ -21,17 +21,3 @@
|
|||
###################################################################################
|
||||
|
||||
LIB_SRCS += $(addprefix lib/io/,json.c villas.c csv.c raw.c msg.c)
|
||||
|
||||
WITH_HDF5 ?= 0
|
||||
|
||||
ifeq ($(PLATFORM),Darwin)
|
||||
HDF5_PREFIX ?= /opt/local
|
||||
else
|
||||
HDF5_PREFIX ?= /usr
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_HDF5),1)
|
||||
ifneq ($(wildcard $(HDF5_PREFIX)/include/hdf5_hl.h),)
|
||||
LIB_SRCS += lib/formats/hdf5.c
|
||||
endif
|
||||
endif
|
||||
|
|
170
lib/io/h5pt.c
170
lib/io/h5pt.c
|
@ -1,170 +0,0 @@
|
|||
/** HDF5 Packet Table IO format based-on the H5PT high-level API.
|
||||
*
|
||||
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
||||
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
|
||||
* @license GNU General Public License (version 3)
|
||||
*
|
||||
* VILLASnode
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <hdf5_hl.h>
|
||||
|
||||
#include "plugin.h"
|
||||
#include "io.h"
|
||||
|
||||
enum h5pt_flags {
|
||||
FORMAT_H5PT_COMPRESS = (1 << 16)
|
||||
};
|
||||
|
||||
struct h5pt {
|
||||
hsize_t index;
|
||||
hsize_t num_packets;
|
||||
|
||||
hid_t fid; /**< File identifier. */
|
||||
hid_t ptable; /**< Packet table identifier. */
|
||||
}
|
||||
|
||||
hid_t h5pt_create_datatype(int values)
|
||||
{
|
||||
hid_t dt = H5Tcreate(H5T_COMPOUND, sizeof());
|
||||
}
|
||||
|
||||
int h5pt_open(struct io *io, const char *uri, const char *mode)
|
||||
{
|
||||
struct h5pt *h5 = io->_vd;
|
||||
|
||||
herr_t err;
|
||||
|
||||
/* Create a file using default properties */
|
||||
h5->fid = H5Fcreate(uri, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
|
||||
/* Create a fixed-length packet table within the file */
|
||||
/* This table's "packets" will be simple integers. */
|
||||
h5->ptable = H5PTcreate_fl(fid, "Packet Test Dataset", H5T_NATIVE_INT, 1, 1);
|
||||
if (h5->ptable == H5I_INVALID_HID)
|
||||
return -1;
|
||||
|
||||
err = H5PTis_valid(h5->ptable);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
err = H5PTget_num_packets(h5->ptable, h5->num_packets);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
io_format_h5pt_rewind(io);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int h5pt_close(struct io *io)
|
||||
{
|
||||
struct h5pt *h5 = io->_vd;
|
||||
|
||||
herr_t err;
|
||||
|
||||
/* Close dataset */
|
||||
err = H5PTclose(h5->ptable);
|
||||
if (err < 0)
|
||||
goto out;
|
||||
|
||||
/* Close file */
|
||||
out: err = H5Fclose(h5->fid);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int h5pt_rewind(struct io *io)
|
||||
{
|
||||
struct h5pt *h5 = io->_vd;
|
||||
|
||||
herr_t err;
|
||||
|
||||
err = H5PTcreate_index(h5->ptable);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
h5->index = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int h5pt_eof(struct io *io)
|
||||
{
|
||||
struct h5pt *h5 = io->_vd;
|
||||
|
||||
return h5->index >= h5->num_packets;
|
||||
}
|
||||
|
||||
int h5pt_flush(struct io *io)
|
||||
{
|
||||
struct h5pt *h5 = io->_vd;
|
||||
|
||||
herr_t err;
|
||||
|
||||
err = H5Fflush(h5->fid, H5F_SCOPE_GLOBAL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int h5pt_print(struct io *io, struct sample *smps[], size_t cnt)
|
||||
{
|
||||
struct h5pt *h5 = io->_vd;
|
||||
|
||||
herr_t err;
|
||||
|
||||
/* Write one packet to the packet table */
|
||||
err = H5PTappend(h5->ptable, smps, cnt);
|
||||
if (err < 0)
|
||||
goto out;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int h5pt_scan(struct io *io, struct sample *smps[], size_t cnt)
|
||||
{
|
||||
struct h5pt *h5 = io->_vd;
|
||||
|
||||
herr_t err;
|
||||
|
||||
H5PTget_next(h5->ptable, cnt, smps)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct plugin p = {
|
||||
.name = "hdf5",
|
||||
.description = "HDF5 Packet Table",
|
||||
.type = PLUGIN_TYPE_FORMAT,
|
||||
.format = {
|
||||
.open = h5pt_open,
|
||||
.close = h5pt_close,
|
||||
.rewind = h5pt_rewind,
|
||||
.eof = h5pt_eof,
|
||||
.flush = h5pt_flush,
|
||||
.print = h5pt_print,
|
||||
.scan = h5pt_scan,
|
||||
|
||||
.flags = IO_FORMAT_BINARY,
|
||||
.size = sizeof(struct h5pt)
|
||||
}
|
||||
};
|
Loading…
Add table
Reference in a new issue