diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/compression/CMakeLists.txt | 15 | ||||
-rw-r--r-- | src/lib/CMakeLists.txt | 37 | ||||
-rw-r--r-- | src/lib/md5.c | 2 | ||||
-rw-r--r-- | src/lib/tng_io-config.cmake.in | 13 | ||||
-rw-r--r-- | src/lib/tng_io-configVersion.cmake.in | 12 | ||||
-rw-r--r-- | src/lib/tng_io.c | 60 | ||||
-rw-r--r-- | src/tests/compression/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/tests/compression/testsuite.c | 2 | ||||
-rw-r--r-- | src/tests/md_openmp.c | 12 | ||||
-rw-r--r-- | src/tests/md_openmp_util.c | 12 | ||||
-rw-r--r-- | src/tests/tng_io_read_pos.c | 2 | ||||
-rw-r--r-- | src/tests/tng_io_read_pos_util.c | 2 | ||||
-rw-r--r-- | src/tests/tng_io_testing.c | 14 | ||||
-rw-r--r-- | src/tests/tng_parallel_read.c | 2 |
15 files changed, 110 insertions, 83 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d5f2bc0..88c0516 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,3 +1 @@ -add_subdirectory(compression) -add_subdirectory(lib) add_subdirectory(tests) diff --git a/src/compression/CMakeLists.txt b/src/compression/CMakeLists.txt deleted file mode 100644 index 8bb0220..0000000 --- a/src/compression/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -set(source_files bwlzh.c bwt.c coder.c dict.c fixpoint.c huffman.c huffmem.c lz77.c merge_sort.c mtf.c rle.c tng_compress.c vals16.c warnmalloc.c widemuldiv.c xtc2.c xtc3.c) - -add_library(tng_compress ${source_files}) - -# Append the required library dependencies -if(UNIX) - target_link_libraries(tng_compress m) -endif() - -# Use GNUInstallDirst to set paths on multiarch systems -include(GNUInstallDirs) - -install(TARGETS tng_compress - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt deleted file mode 100644 index 838f827..0000000 --- a/src/lib/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -set(source_files tng_io.c md5.c) -if(TNG_BUILD_FORTRAN) - list(APPEND source_files tng_io_fortran.c) -endif() - -add_library(tng_io ${source_files}) - -# Now add source-file compilation properties to the source-file -# targets - -if(HAVE_INTTYPES_H) - set_property(SOURCE tng_io.c APPEND PROPERTY COMPILE_DEFINITIONS USE_STD_INTTYPES_H) -endif() -if(TNG_BUILD_WITH_ZLIB) - set_property(SOURCE tng_io.c APPEND PROPERTY COMPILE_DEFINITIONS USE_ZLIB) -endif() - -# This test is for md5. The TNG library itself determines the actual byte order - -# not just if it is small or big endian. -include(TestBigEndian) -test_big_endian(TNG_INTEGER_BIG_ENDIAN) -if(TNG_INTEGER_BIG_ENDIAN) - set_property(SOURCE md5.c APPEND PROPERTY COMPILE_DEFINITIONS TNG_INTEGER_BIG_ENDIAN) -endif() - -# Append the required library dependencies -target_link_libraries(tng_io tng_compress) -if(TNG_BUILD_WITH_ZLIB) - target_link_libraries(tng_io ${ZLIB_LIBRARIES}) -endif() - -# Use GNUInstallDirst to set paths on multiarch systems -include(GNUInstallDirs) - -install(TARGETS tng_io - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/src/lib/md5.c b/src/lib/md5.c index ea8bb37..f6a2391 100644 --- a/src/lib/md5.c +++ b/src/lib/md5.c @@ -75,7 +75,7 @@ 1999-05-03 lpd Original version. */ -#include "../../include/md5.h" +#include "tng/md5.h" #include <string.h> #undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */ diff --git a/src/lib/tng_io-config.cmake.in b/src/lib/tng_io-config.cmake.in new file mode 100644 index 0000000..06c0470 --- /dev/null +++ b/src/lib/tng_io-config.cmake.in @@ -0,0 +1,13 @@ +# - Config file for the TNG_IO package +# It defines the following variables +# TNG_IO_INCLUDE_DIRS - include directories for TNG_IO +# TNG_IO_LIBRARIES - libraries to link against +# TNG_IO_DEFINITIONS - definitions used when compiling + +# Compute paths +get_filename_component(TNG_IO_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +set(TNG_IO_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@") +set(TNG_IO_DEFINITIONS "@TNG_COMPILE_DEFS@") + +set(TNG_IO_LIBRARIES tng_io) + diff --git a/src/lib/tng_io-configVersion.cmake.in b/src/lib/tng_io-configVersion.cmake.in new file mode 100644 index 0000000..8946f5e --- /dev/null +++ b/src/lib/tng_io-configVersion.cmake.in @@ -0,0 +1,12 @@ +set(PACKAGE_VERSION "@TNG_IO_VERSION@") + +# Check whether the requested PACKAGE_FIND_VERSION is compatible +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() + diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c index 252cbb2..792be2e 100644 --- a/src/lib/tng_io.c +++ b/src/lib/tng_io.c @@ -22,10 +22,10 @@ #include <zlib.h> #endif -#include "../../include/tng_io.h" -#include "../../include/md5.h" -#include "../../include/compression/tng_compress.h" -#include "../include/version.h" +#include "tng/tng_io.h" +#include "tng/md5.h" +#include "compression/tng_compress.h" +#include "tng/version.h" struct tng_bond { @@ -7852,6 +7852,52 @@ static tng_function_status tng_atom_destroy(tng_atom_t atom) return(TNG_SUCCESS); } +tng_function_status DECLSPECDLLEXPORT tng_version_major + (const tng_trajectory_t tng_data, + int *version) +{ + (void)tng_data; + + *version = TNG_VERSION_MAJOR; + + return(TNG_SUCCESS); +} + +tng_function_status DECLSPECDLLEXPORT tng_version_minor + (const tng_trajectory_t tng_data, + int *version) +{ + (void)tng_data; + + *version = TNG_VERSION_MINOR; + + return(TNG_SUCCESS); +} + +tng_function_status DECLSPECDLLEXPORT tng_version_patchlevel + (const tng_trajectory_t tng_data, + int *patch_level) +{ + (void)tng_data; + + *patch_level = TNG_VERSION_PATCHLEVEL; + + return(TNG_SUCCESS); +} + +tng_function_status DECLSPECDLLEXPORT tng_version + (const tng_trajectory_t tng_data, + char *version, + const int max_len) +{ + (void)tng_data; + TNG_ASSERT(version, "TNG library: version must not be a NULL pointer"); + + TNG_SNPRINTF(version, max_len, "%s", TNG_VERSION); + + return(TNG_SUCCESS); +} + tng_function_status DECLSPECDLLEXPORT tng_molecule_add (tng_trajectory_t tng_data, const char *name, @@ -18889,7 +18935,7 @@ tng_function_status DECLSPECDLLEXPORT tng_util_frame_current_compression_get (tng_trajectory_t tng_data, const int64_t block_id, int64_t *codec_id, - float *factor) + double *factor) { tng_trajectory_frame_set_t frame_set; tng_particle_data_t p_data = 0; @@ -18986,12 +19032,12 @@ tng_function_status DECLSPECDLLEXPORT tng_util_frame_current_compression_get if(block_type == TNG_PARTICLE_BLOCK_DATA) { *codec_id = p_data->codec_id; - *factor = (float)p_data->compression_multiplier; + *factor = p_data->compression_multiplier; } else if(block_type == TNG_NON_PARTICLE_BLOCK_DATA) { *codec_id = np_data->codec_id; - *factor = (float)np_data->compression_multiplier; + *factor = np_data->compression_multiplier; } return(TNG_SUCCESS); } diff --git a/src/tests/compression/CMakeLists.txt b/src/tests/compression/CMakeLists.txt index 075b06b..d29791b 100644 --- a/src/tests/compression/CMakeLists.txt +++ b/src/tests/compression/CMakeLists.txt @@ -4,8 +4,6 @@ add_definitions(-DTNG_COMPRESS_FILES_DIR="${CMAKE_BINARY_DIR}/test_tng_compress_ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/test_tng_compress_files) -include_directories(${CMAKE_BINARY_DIR}/include/) - set(number 0) set(numtests 78) @@ -14,7 +12,7 @@ while( number LESS ${numtests}) math( EXPR number "${number} + 1" ) add_executable(test_tng_compress_gen${number} testsuite.c) -target_link_libraries(test_tng_compress_gen${number} tng_compress) +target_link_libraries(test_tng_compress_gen${number} tng_io) if(UNIX) target_link_libraries(test_tng_compress_gen${number} m) endif() @@ -25,7 +23,7 @@ add_dependencies(test_tng_compress_gen${number} test${number}.h) set_property(TARGET test_tng_compress_gen${number} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/compression_tests) add_executable(test_tng_compress_read${number} testsuite.c) -target_link_libraries(test_tng_compress_read${number} tng_compress) +target_link_libraries(test_tng_compress_read${number} tng_io) if(UNIX) target_link_libraries(test_tng_compress_read${number} m) endif() diff --git a/src/tests/compression/testsuite.c b/src/tests/compression/testsuite.c index 2cfe05e..e266c11 100644 --- a/src/tests/compression/testsuite.c +++ b/src/tests/compression/testsuite.c @@ -8,7 +8,7 @@ #include <stdlib.h> #include <string.h> #include <math.h> -#include "../../../include/compression/tng_compress.h" +#include "compression/tng_compress.h" #include TESTPARAM #ifdef TEST_FLOAT diff --git a/src/tests/md_openmp.c b/src/tests/md_openmp.c index fd9f4b0..aac8b3b 100644 --- a/src/tests/md_openmp.c +++ b/src/tests/md_openmp.c @@ -1,11 +1,11 @@ #ifdef TNG_BUILD_OPENMP_EXAMPLES -# include <stdlib.h> -# include <stdio.h> -# include <time.h> -# include <math.h> -# include <omp.h> -#include "../../include/tng_io.h" +#include <stdlib.h> +#include <stdio.h> +#include <time.h> +#include <math.h> +#include <omp.h> +#include "tng/tng_io.h" int main (); void compute ( int np, int nd, double pos[], double vel[], diff --git a/src/tests/md_openmp_util.c b/src/tests/md_openmp_util.c index 8c332f3..9fe6c91 100644 --- a/src/tests/md_openmp_util.c +++ b/src/tests/md_openmp_util.c @@ -1,11 +1,11 @@ #ifdef TNG_BUILD_OPENMP_EXAMPLES -# include <stdlib.h> -# include <stdio.h> -# include <time.h> -# include <math.h> -# include <omp.h> -#include "../../include/tng_io.h" +#include <stdlib.h> +#include <stdio.h> +#include <time.h> +#include <math.h> +#include <omp.h> +#include "tng/tng_io.h" int main (); void compute ( int np, int nd, float pos[], float vel[], diff --git a/src/tests/tng_io_read_pos.c b/src/tests/tng_io_read_pos.c index 2a0bb09..b29cec7 100644 --- a/src/tests/tng_io_read_pos.c +++ b/src/tests/tng_io_read_pos.c @@ -15,7 +15,7 @@ #include <stdlib.h> #include <stdio.h> -#include "../../include/tng_io.h" +#include "tng/tng_io.h" int main(int argc, char **argv) { diff --git a/src/tests/tng_io_read_pos_util.c b/src/tests/tng_io_read_pos_util.c index 1667bae..b237dad 100644 --- a/src/tests/tng_io_read_pos_util.c +++ b/src/tests/tng_io_read_pos_util.c @@ -17,7 +17,7 @@ #include <stdlib.h> #include <stdio.h> -#include "../../include/tng_io.h" +#include "tng/tng_io.h" int main(int argc, char **argv) { diff --git a/src/tests/tng_io_testing.c b/src/tests/tng_io_testing.c index dd13d92..e1e2726 100644 --- a/src/tests/tng_io_testing.c +++ b/src/tests/tng_io_testing.c @@ -15,7 +15,8 @@ #include <stdlib.h> #include <string.h> -#include "../../include/tng_io.h" +#include "tng/tng_io.h" +#include "tng/version.h" static tng_function_status tng_test_setup_molecules(tng_trajectory_t traj) { @@ -595,6 +596,17 @@ int main() tng_trajectory_t traj; tng_function_status stat; char time_str[TNG_MAX_DATE_STR_LEN]; + char version_str[TNG_MAX_STR_LEN]; + + tng_version(traj, version_str, TNG_MAX_STR_LEN); + if(strncmp(TNG_VERSION, version_str, TNG_MAX_STR_LEN) == 0) + { + printf("Test version control: \t\t\t\tSucceeded.\n"); + } + else + { + printf("Test version control: \t\t\t\tFailed.\n"); + } if(tng_trajectory_init(&traj) != TNG_SUCCESS) { diff --git a/src/tests/tng_parallel_read.c b/src/tests/tng_parallel_read.c index e2e23c6..44e8f79 100644 --- a/src/tests/tng_parallel_read.c +++ b/src/tests/tng_parallel_read.c @@ -13,7 +13,7 @@ #include <stdlib.h> #include <stdio.h> -#include "../../include/tng_io.h" +#include "tng/tng_io.h" /* N.B. this code is for testing parallel reading of trajectory frame sets. The |