Commit 44de3d4b authored by Jan Kotanski's avatar Jan Kotanski
Browse files

New upstream version 0.1.0

parent 8fdf2ee8
/build*/
/cmake-build-*/
*.user
.idea/workspace.xml
.idea/usage.statistics.xml
.idea/
*.swp
/file_open.h5
......
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<CMakeCodeStyleSettings>
<option name="FORCE_COMMANDS_CASE" value="1" />
</CMakeCodeStyleSettings>
<Objective-C>
<option name="INDENT_NAMESPACE_MEMBERS" value="0" />
<option name="INDENT_C_STRUCT_MEMBERS" value="2" />
<option name="INDENT_CLASS_MEMBERS" value="2" />
<option name="INDENT_VISIBILITY_KEYWORDS" value="1" />
<option name="INDENT_INSIDE_CODE_BLOCK" value="2" />
<option name="KEEP_STRUCTURES_IN_ONE_LINE" value="true" />
<option name="NAMESPACE_BRACE_PLACEMENT" value="5" />
<option name="FUNCTION_BRACE_PLACEMENT" value="5" />
<option name="BLOCK_BRACE_PLACEMENT" value="5" />
<option name="FUNCTION_NON_TOP_AFTER_RETURN_TYPE_WRAP" value="0" />
<option name="FUNCTION_TOP_AFTER_RETURN_TYPE_WRAP" value="0" />
<option name="FUNCTION_PARAMETERS_WRAP" value="5" />
<option name="FUNCTION_CALL_ARGUMENTS_WRAP" value="5" />
<option name="TEMPLATE_CALL_ARGUMENTS_WRAP" value="5" />
<option name="TEMPLATE_CALL_ARGUMENTS_ALIGN_MULTILINE" value="true" />
<option name="CLASS_CONSTRUCTOR_INIT_LIST_WRAP" value="5" />
<option name="CLASS_CONSTRUCTOR_INIT_LIST_COMMA_ON_NEXT_LINE" value="true" />
<option name="SUPERCLASS_LIST_COMMA_ON_NEXT_LINE" value="true" />
<option name="SPACE_BEFORE_INIT_LIST" value="true" />
<option name="SPACE_BEFORE_POINTER_IN_DECLARATION" value="false" />
<option name="SPACE_AFTER_POINTER_IN_DECLARATION" value="true" />
<option name="SPACE_BEFORE_REFERENCE_IN_DECLARATION" value="false" />
<option name="SPACE_AFTER_REFERENCE_IN_DECLARATION" value="true" />
</Objective-C>
<Objective-C-extensions>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions>
<pair source="cpp" header="h" fileNamingConvention="NONE" />
<pair source="c" header="h" fileNamingConvention="NONE" />
</extensions>
</Objective-C-extensions>
<codeStyleSettings language="CMake">
<option name="SPACE_BEFORE_IF_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_WHILE_PARENTHESES" value="false" />
<option name="SPACE_BEFORE_FOR_PARENTHESES" value="false" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="ObjectiveC">
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
<option name="BLANK_LINES_BEFORE_IMPORTS" value="0" />
<option name="BLANK_LINES_AFTER_IMPORTS" value="0" />
<option name="BLANK_LINES_AROUND_CLASS" value="0" />
<option name="BLANK_LINES_AROUND_METHOD" value="0" />
<option name="BLANK_LINES_AROUND_METHOD_IN_INTERFACE" value="0" />
<option name="BRACE_STYLE" value="5" />
<option name="CLASS_BRACE_STYLE" value="5" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="false" />
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="ENUM_CONSTANTS_WRAP" value="0" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="CidrRootsConfiguration">
<excludeRoots>
<file path="$PROJECT_DIR$/build" />
<file path="$PROJECT_DIR$/cmake-build-debug" />
</excludeRoots>
</component>
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/h5cpp.iml" filepath="$PROJECT_DIR$/.idea/h5cpp.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
cmake_minimum_required(VERSION 3.0.0)
project(h5cpp
LANGUAGES CXX C
VERSION 0.0.9
VERSION 0.1.0
)
#=============================================================================
......
......@@ -3,38 +3,38 @@ coverage_os = "centos7-release"
images = [
'centos7-release': [
'name': 'essdmscdm/centos7-build-node:3.0.0',
'name': 'essdmscdm/centos7-build-node:3.2.0',
'cmake': 'CC=/usr/lib64/mpich-3.2/bin/mpicc CXX=/usr/lib64/mpich-3.2/bin/mpicxx cmake3',
'sh': '/usr/bin/scl enable rh-python35 devtoolset-6 -- /bin/bash -e',
'cmake_flags': '-DCOV=1 -DWITH_MPI=1 -DCONAN_FILE=conanfile_ess_mpi.txt -DCMAKE_BUILD_TYPE=Release'
],
'debian9-release': [
'name': 'essdmscdm/debian9-build-node:2.0.0',
'name': 'essdmscdm/debian9-build-node:2.3.0',
'cmake': 'cmake',
'sh': 'bash -e',
'cmake_flags': '-DCMAKE_BUILD_TYPE=Release'
],
'ubuntu1804-release': [
'name': 'essdmscdm/ubuntu18.04-build-node:1.1.0',
'name': 'essdmscdm/ubuntu18.04-build-node:1.2.0',
'cmake': 'cmake',
'sh': 'bash -e',
'cmake_flags': '-DCMAKE_BUILD_TYPE=Release'
],
'centos7-debug': [
'name': 'essdmscdm/centos7-build-node:3.0.0',
'name': 'essdmscdm/centos7-build-node:3.2.0',
'cmake': 'CC=/usr/lib64/mpich-3.2/bin/mpicc CXX=/usr/lib64/mpich-3.2/bin/mpicxx cmake3',
'sh': '/usr/bin/scl enable rh-python35 devtoolset-6 -- /bin/bash -e',
'cmake_flags': '-DWITH_MPI=1 -DCONAN_FILE=conanfile_ess_mpi.txt -DCMAKE_BUILD_TYPE=Debug'
],
'debian9-debug': [
'name': 'essdmscdm/debian9-build-node:2.0.0',
'name': 'essdmscdm/debian9-build-node:2.3.0',
'cmake': 'cmake',
'sh': 'bash -e',
'cmake_flags': '-DCMAKE_BUILD_TYPE=Debug'
],
'ubuntu1804-debug': [
'name': 'essdmscdm/ubuntu18.04-build-node:1.1.0',
'name': 'essdmscdm/ubuntu18.04-build-node:1.2.0',
'cmake': 'cmake',
'sh': 'bash -e',
'cmake_flags': '-DCMAKE_BUILD_TYPE=Debug'
......@@ -71,13 +71,12 @@ def Object get_container(image_key) {
return container
}
def docker_clone(image_key) {
def docker_copy_code(image_key) {
def custom_sh = images[image_key]['sh']
sh """docker exec ${container_name(image_key)} ${custom_sh} -c \"
git clone \
--branch ${env.BRANCH_NAME} \
https://github.com/ess-dmsc/h5cpp.git /home/jenkins/${project}
\""""
sh "docker cp ${project} ${container_name(image_key)}:/home/jenkins/${project}"
sh """docker exec --user root ${container_name(image_key)} ${custom_sh} -c \"
chown -R jenkins.jenkins /home/jenkins/${project}
\""""
}
def docker_dependencies(image_key) {
......@@ -163,25 +162,24 @@ def get_pipeline(image_key)
{
return {
stage("${image_key}") {
node("docker") {
try {
def container = get_container(image_key)
try {
def container = get_container(image_key)
docker_clone(image_key)
docker_dependencies(image_key)
docker_build(image_key, images[image_key]['cmake_flags'])
docker_copy_code(image_key)
docker_dependencies(image_key)
docker_build(image_key, images[image_key]['cmake_flags'])
if (image_key == coverage_os) {
docker_coverage(image_key)
} else {
docker_test(image_key)
}
} catch (e) {
failure_function(e, "Unknown build failure for ${image_key}")
} finally {
sh "docker stop ${container_name(image_key)}"
sh "docker rm -f ${container_name(image_key)}"
if (image_key == coverage_os) {
docker_coverage(image_key)
} else {
docker_test(image_key)
}
} catch (e) {
failure_function(e, "Unknown build failure for ${image_key}")
} finally {
sh "docker stop ${container_name(image_key)}"
sh "docker rm -f ${container_name(image_key)}"
cleanWs()
}
}
}
......@@ -268,7 +266,7 @@ def get_win10_pipeline()
node('docker') {
stage('Checkout') {
dir("${project}_code") {
dir("${project}") {
try {
scm_vars = checkout scm
} catch (e) {
......
......@@ -141,7 +141,7 @@ cmake -DCMAKE_INSTALL_PREFIX=/home/user1/some/path ..
```
and accordingly, when building the client program:
```bash
cmake -Dh5cpp_DIR=/home/user1/some/path/lib/cmake/h5cpp-0.0.9 path/to/your/source
cmake -Dh5cpp_DIR=/home/user1/some/path/lib/cmake/h5cpp-0.1.0 path/to/your/source
```
where version number may vary.
......
......@@ -61,9 +61,9 @@ author = u'Eugen Wintersberger'
# built documents.
#
# The short X.Y version.
version = u'0.0.9'
version = u'0.1.0'
# The full version, including alpha/beta/rc tags.
release = u'0.0.9'
release = u'0.1.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
......
......@@ -7,7 +7,7 @@ Using *h5cpp* with :program:`cmake`
*h5cpp* not only uses *CMake* as a build system but also provides
a *CMake* package which makes using the library with *CMake* quite simple.
The *CMake* package is installed below :file:`PREFIX/lib/cmake/h5cpp-0.0.9`
The *CMake* package is installed below :file:`PREFIX/lib/cmake/h5cpp-0.1.0`
where :envvar:`PREFIX` expands to the installation prefix used in the
inital cmake call of the installation procedure.
......@@ -41,7 +41,7 @@ the following :file:`CMakeLists.txt` fiel is sufficient
cmake_minimum_required(VERSION 3.5.0)
project(h5cpp_test
LANGUAGES C CXX
VERSION 0.0.9)
VERSION 0.1.0)
set(CMAKE_CXX_STANDARD 11)
find_package(h5cpp REQUIRED)
......@@ -56,7 +56,7 @@ You can build the code with
h5cpp_test:$ mkdir build
h5cpp_test:$ cd build
h5cpp_test:$ cmake -Dh5cpp_DIR=<INSTALLPREFIX>/lib/cmake/h5cpp-0.0.9 ../
h5cpp_test:$ cmake -Dh5cpp_DIR=<INSTALLPREFIX>/lib/cmake/h5cpp-0.1.0 ../
h5cpp_test:$ make
The cmake variable :envvar:`h5cpp_DIR` tells :program:`cmake` where to look
......
......@@ -23,6 +23,9 @@ target_link_libraries(writing_image h5cpp)
add_executable(write_single_vector write_single_vector.cpp)
target_link_libraries(write_single_vector h5cpp)
add_executable(read_dataset read_dataset.cpp)
target_link_libraries(read_dataset h5cpp)
add_executable(append_scalar_data append_scalar_data.cpp)
target_link_libraries(append_scalar_data h5cpp)
......
//
// (c) Copyright 2017 DESY,ESS
//
// This file is part of h5cpp.
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
// License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library; if not, write to the
// Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
// Boston, MA 02110-1301 USA
// ===========================================================================
//
// Author: Eugen Wintersberger <eugen.wintersberger@desy.de>
// Created on: Oct 07, 2017
//
#include <h5cpp/hdf5.hpp>
#include <iostream>
#include <vector>
using namespace hdf5;
void createFile() {
file::File File = file::create("SomeFile.hdf5", file::AccessFlags::TRUNCATE);
node::Group RootGroup = File.root();
std::vector<int> Data{1, 2, 3, 4, 5, 6};
Dimensions Shape{2, 3};
Dimensions MaxShape{dataspace::Simple::UNLIMITED, 3};
Dimensions ChunkSize{512, 3};
dataspace::Simple Dataspace{Shape, MaxShape};
datatype::Datatype Datatype = datatype::create<std::int32_t>();
auto Dataset = node::ChunkedDataset(RootGroup, "test_data", Datatype,
Dataspace, ChunkSize);
Dataset.write(Data);
}
int main() {
createFile();
auto AnotherFile = file::open("SomeFile.hdf5");
auto RootGroup = AnotherFile.root();
auto Dataset = RootGroup.get_dataset("test_data");
dataspace::Simple Dataspace(Dataset.dataspace());
auto Dimensions = Dataspace.current_dimensions();
auto MaxDimensions = Dataspace.maximum_dimensions();
std::cout << "Dataset dimensions\n";
std::cout << " Current | Max\n";
for (int i = 0; i < Dimensions.size(); i++) {
std::cout << "i:" << i << " " << Dimensions[i] << " | "
<< MaxDimensions[i] << "\n";
}
auto CreationProperties = Dataset.creation_list();
auto ChunkDims = CreationProperties.chunk();
std::cout << "\nChunk size\n";
for (int i = 0; i < ChunkDims.size(); i++) {
std::cout << "i:" << i << " " << ChunkDims[i] << "\n";
}
std::cout << "\nData type\n";
auto Int32Type = datatype::create<std::int32_t>();
auto UInt32Type = datatype::create<std::uint32_t>();
auto FloatType = datatype::create<float>();
auto DataTypeClass = Dataset.datatype().get_class();
auto CurrentType = Dataset.datatype();
std::cout << "Is: " << DataTypeClass << std::endl;
std::cout << "Is int32: " << (Int32Type == CurrentType) << std::endl;
std::cout << "Is uint32: " << (UInt32Type == CurrentType) << std::endl;
std::cout << "Is float: " << (FloatType == CurrentType) << std::endl;
std::cout << "\nAll elements\n";
std::vector<int> AllElements(Dataspace.size());
Dataset.read(AllElements);
for (auto Value : AllElements) {
std::cout << Value << " ";
}
std::cout << "\n\nRow access\n";
std::vector<int> RowData(static_cast<size_t>(Dimensions[1]));
for (size_t i = 0; i < Dimensions[0]; i++) {
dataspace::Hyperslab RowSelection{{i, 0}, {1, 3}};
Dataset.read(RowData, RowSelection);
std::cout << "i: " << i << " | ";
for (auto Value : RowData) {
std::cout << Value << " ";
}
std::cout << "\n";
}
std::cout << "\nElement access\n j:0 j:1 j:2\n";
for (size_t i = 0; i < Dimensions[0]; i++) {
std::cout << "i:" << i << " ";
for (size_t j = 0; j < Dimensions[1]; j++) {
int Value;
dataspace::Hyperslab ElementSelection{{i, j}, {1, 1}};
Dataset.read(Value, ElementSelection);
std::cout << Value << "  ";
}
std::cout << "\n";
}
return 0;
}
......@@ -15,6 +15,10 @@ if(NOT TARGET Boost::filesystem)
list(APPEND BOOST_COMPONENTS filesystem)
endif()
if(NOT TARGET Boost::system)
list(APPEND BOOST_COMPONENTS system)
endif()
find_package(Boost @Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@.@Boost_SUBMINOR_VERSION@ EXACT REQUIRED COMPONENTS ${BOOST_COMPONENTS})
if(NOT Boost_FOUND)
message(FATAL_ERROR "Could not find Boost filesystem library - cannot load h5cpp targets")
......@@ -30,7 +34,7 @@ set(HDF5_PREFER_PARALLEL @WITH_MPI@)
find_package(HDF5 @HDF5_VERSION@ EXACT REQUIRED COMPONENTS C)
#
# as the libraries are attached to the imported target we have to add the
# as the libraries are attached to the imported target we have to add the
# directory where to find them according to the previous find_package call
#
foreach(HDF5_LIB ${HDF5_LIBRARIES})
......@@ -41,14 +45,14 @@ endforeach()
if(H5CPP_MPI_ENABLED AND (NOT HDF5_IS_PARALLEL))
message(FATAL_ERROR "HDF5 library with MPI support required!")
endif()
#
# load targets
# load targets
#
include(${CMAKE_CURRENT_LIST_DIR}/h5cpp_targets.cmake)
#
# add the include directories for the HDF5 library
#
include_directories(${HDF5_INCLUDE_DIRS})
\ No newline at end of file
include_directories(${HDF5_INCLUDE_DIRS})
......@@ -22,6 +22,7 @@
// Authors:
// Eugen Wintersberger <eugen.wintersberger@desy.de>
// Martin Shetty <martin.shetty@esss.se>
// Jan Kotanski <jan.kotanski@desy.de>
// Created on: Aug 07, 2017
//
......@@ -199,6 +200,9 @@ void ObjectHandle::close()
case ObjectHandle::Type::DATASPACE:
error_code = H5Sclose(handle_);
break;
case ObjectHandle::Type::GROUP:
error_code = H5Gclose(handle_);
break;
case ObjectHandle::Type::DATATYPE:
error_code = H5Tclose(handle_);
break;
......
......@@ -29,6 +29,8 @@
namespace hdf5 {
namespace dataspace {
const hsize_t Simple::UNLIMITED = H5S_UNLIMITED;
Simple::Simple() :
Dataspace(Type::SIMPLE) {}
......
......@@ -41,7 +41,7 @@ class DLL_EXPORT Simple : public Dataspace {
//!
//! \brief dimension value for unlimited number of elements
//!
static const hsize_t UNLIMITED = H5S_UNLIMITED;
static const hsize_t UNLIMITED;
//!
//! \brief default constructor
......
......@@ -9,6 +9,7 @@ set(SOURCES
${dir}/string.cpp
${dir}/types.cpp
${dir}/enum.cpp
${dir}/ebool.cpp
)
set(HEADERS
......
//
// (c) Copyright 2017 DESY,ESS
//
// This file is part of h5cpp.
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
// License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library; if not, write to the
// Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
// Boston, MA 02110-1301 USA
// ===========================================================================
//
// Authors:
// Jan Kotanski <jan.kotanski@desy.de>
// Created on: Sep 18, 2018
//
#include <sstream>
#include <h5cpp/datatype/enum.hpp>
#include <h5cpp/datatype/ebool.hpp>
#include <h5cpp/error/error.hpp>
namespace hdf5
{
namespace datatype
{
bool is_bool(const Enum & etype){
int s = etype.number_of_values();
if(s != 2){
return false;
}
if(etype.name(0) != "FALSE"){
return false;
}
if(etype.name(1) != "TRUE"){
return false;
}
return true;
}
} // namespace datatype
} // namespace hdf5
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment