diff options
-rw-r--r-- | BuildTNG.cmake | 6 | ||||
-rw-r--r-- | include/tng/tng_io.h | 13 | ||||
-rw-r--r-- | src/lib/tng_io.c | 6 | ||||
-rw-r--r-- | src/tests/tng_io_testing.c | 10 |
4 files changed, 30 insertions, 5 deletions
diff --git a/BuildTNG.cmake b/BuildTNG.cmake index 4c04fb2..a442be6 100644 --- a/BuildTNG.cmake +++ b/BuildTNG.cmake @@ -4,10 +4,10 @@ set(TNG_ROOT_BINARY_DIR ${CMAKE_BINARY_DIR}/${TNG_ROOT_BINARY_DIR}) function (TNG_GENERATE_VERSION_H) set(TNG_MAJOR_VERSION "1") - set(TNG_MINOR_VERSION "6") - set(TNG_VERSION_PATCH_LEVEL "3") + set(TNG_MINOR_VERSION "7") + set(TNG_VERSION_PATCH_LEVEL "0") set(TNG_IO_VERSION "${TNG_MAJOR_VERSION}.${TNG_MINOR_VERSION}.${TNG_VERSION_PATCH_LEVEL}") - set(TNG_API_VERSION "6") + set(TNG_API_VERSION "0") configure_file(${TNG_ROOT_SOURCE_DIR}/include/tng/version.h.in ${TNG_ROOT_BINARY_DIR}/include/tng/version.h) diff --git a/include/tng/tng_io.h b/include/tng/tng_io.h index 367aa29..de4dd32 100644 --- a/include/tng/tng_io.h +++ b/include/tng/tng_io.h @@ -4877,6 +4877,19 @@ tng_function_status DECLSPECDLLEXPORT tng_util_prepare_append_after_frame (tng_trajectory_t tng_data, const int64_t prev_frame); + +/** @brief Get the number of frames containing data of a specific type. + * @param tng_data is the trajectory to use. + * @param block_id is the id of the block of the data type. + * @param n_frames is set to the number of frames containing data of + * the requested data type. + * @return TNG_SUCCESS (0) if successful or TNG_CRITICAL (2) if a major + * error has occured. + */ +tng_function_status DECLSPECDLLEXPORT tng_util_num_frames_with_data_of_block_id_get + (tng_trajectory_t tng_data, + const int64_t block_id, + int64_t *n_frames); /** @} */ /* end of group2 */ diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c index 1f68388..bb6c26a 100644 --- a/src/lib/tng_io.c +++ b/src/lib/tng_io.c @@ -17635,7 +17635,7 @@ tng_function_status DECLSPECDLLEXPORT tng_util_num_frames_with_data_of_block_id_ stat = tng_frame_set_n_frames_of_data_block_get(tng_data, block_id, &curr_n_frames); - while(stat == TNG_SUCCESS) + while(stat == TNG_SUCCESS && tng_data->current_trajectory_frame_set.next_frame_set_file_pos != -1) { *n_frames += curr_n_frames; fseeko(tng_data->input_file, @@ -17643,6 +17643,10 @@ tng_function_status DECLSPECDLLEXPORT tng_util_num_frames_with_data_of_block_id_ SEEK_SET); stat = tng_frame_set_n_frames_of_data_block_get(tng_data, block_id, &curr_n_frames); } + if(stat == TNG_SUCCESS) + { + *n_frames += curr_n_frames; + } fseeko(tng_data->input_file, curr_file_pos, SEEK_SET); if(stat == TNG_CRITICAL) { diff --git a/src/tests/tng_io_testing.c b/src/tests/tng_io_testing.c index 7f778c0..c606217 100644 --- a/src/tests/tng_io_testing.c +++ b/src/tests/tng_io_testing.c @@ -1035,7 +1035,7 @@ tng_function_status tng_test_get_positions_data(tng_trajectory_t traj, tng_function_status tng_test_utility_functions(tng_trajectory_t traj, const char hash_mode) { tng_function_status stat; - int64_t n_particles, i, j, k, codec_id; + int64_t n_particles, i, j, k, codec_id, n_frames, n_frames_per_frame_set; int64_t n_frames_to_read=30, stride_len, next_frame, n_blocks, *block_ids = 0; double time, multiplier; float *positions = 0; @@ -1057,6 +1057,14 @@ tng_function_status tng_test_utility_functions(tng_trajectory_t traj, const char return(stat); } + tng_num_frames_per_frame_set_get(traj, &n_frames_per_frame_set); + + stat = tng_util_num_frames_with_data_of_block_id_get(traj, TNG_TRAJ_POSITIONS, &n_frames); + if(stat != TNG_SUCCESS || n_frames != n_frames_per_frame_set * N_FRAME_SETS) + { + return(stat); + } + tng_num_particles_get(traj, &n_particles); stat = tng_util_pos_read_range(traj, 1, n_frames_to_read, &positions, &stride_len); |