diff options
author | Magnus Lundborg <lundborg.magnus@gmail.com> | 2013-10-15 14:42:31 (GMT) |
---|---|---|
committer | Magnus Lundborg <lundborg.magnus@gmail.com> | 2013-10-15 14:42:31 (GMT) |
commit | 394e17a4088cc91ea12cf45ad801515de4ccbc68 (patch) | |
tree | 1e32d818b712be85c192f6d973bfa0cdd9bb483f /src/tests | |
parent | ba62d1b75275732e8604630d05bce4532ab1675b (diff) |
Specifically typed min and max functions.
Explicitly compare signed and unsigned in many places to avoid
warnings.
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/tng_io_read_pos.c | 18 | ||||
-rw-r--r-- | src/tests/tng_io_read_pos_util.c | 14 | ||||
-rw-r--r-- | src/tests/tng_io_testing.c | 17 |
3 files changed, 24 insertions, 25 deletions
diff --git a/src/tests/tng_io_read_pos.c b/src/tests/tng_io_read_pos.c index 6741bec..c1cec55 100644 --- a/src/tests/tng_io_read_pos.c +++ b/src/tests/tng_io_read_pos.c @@ -20,12 +20,12 @@ int main(int argc, char **argv) { tng_trajectory_t traj; - union data_values ***positions = 0; // A 3-dimensional array to be populated + union data_values ***positions = 0; /* A 3-dimensional array to be populated */ int64_t n_particles, n_values_per_frame, n_frames, tot_n_frames; char data_type; int i, j; int particle = 0; - // Set a default frame range + /* Set a default frame range */ int first_frame = 0, last_frame = 50; char atom_name[64], res_name[64], chain_name[64]; @@ -39,7 +39,7 @@ int main(int argc, char **argv) exit(1); } - // A reference must be passed to allocate memory + /* A reference must be passed to allocate memory */ if(tng_trajectory_init(&traj) != TNG_SUCCESS) { tng_trajectory_destroy(&traj); @@ -47,7 +47,7 @@ int main(int argc, char **argv) } tng_input_file_set(traj, argv[1]); - // Read the file headers + /* Read the file headers */ tng_file_headers_read(traj, TNG_USE_HASH); if(argc >= 3) @@ -96,9 +96,9 @@ int main(int argc, char **argv) printf("Particle name not found\n"); } - // Get the positions of all particles in the requested frame range. - // The positions are stored in the positions array. - // N.B. No proper error checks. + /* Get the positions of all particles in the requested frame range. + The positions are stored in the positions array. + N.B. No proper error checks. */ if(tng_particle_data_interval_get(traj, TNG_TRAJ_POSITIONS, first_frame, last_frame, TNG_USE_HASH, &positions, &n_particles, &n_values_per_frame, &data_type) == TNG_SUCCESS) @@ -109,7 +109,7 @@ int main(int argc, char **argv) } else { - // Print the positions of the wanted particle (zero based) + /* Print the positions of the wanted particle (zero based) */ for(i=0; i<n_frames; i++) { printf("%d", first_frame + i); @@ -139,7 +139,7 @@ int main(int argc, char **argv) printf("Cannot read positions\n"); } - // Free memory + /* Free memory */ if(positions) { tng_particle_data_values_free(traj, positions, n_frames, n_particles, diff --git a/src/tests/tng_io_read_pos_util.c b/src/tests/tng_io_read_pos_util.c index 5d2c8ea..797788c 100644 --- a/src/tests/tng_io_read_pos_util.c +++ b/src/tests/tng_io_read_pos_util.c @@ -26,7 +26,7 @@ int main(int argc, char **argv) * arrays */ float *positions = 0, *box_shape = 0; int64_t n_particles, n_frames, tot_n_frames, stride_length, i, j; - // Set a default frame range + /* Set a default frame range */ int first_frame = 0, last_frame = 5000, n_strides; if(argc <= 1) @@ -39,7 +39,7 @@ int main(int argc, char **argv) exit(1); } - // A reference must be passed to allocate memory + /* A reference must be passed to allocate memory */ tng_util_trajectory_open(argv[1], 'r', &traj); if(argc >= 3) @@ -93,13 +93,13 @@ int main(int argc, char **argv) n_strides = (n_frames % stride_length) ? n_frames / stride_length + 1: n_frames / stride_length; - // Get the positions of all particles in the requested frame range. - // The positions are stored in the positions array. - // N.B. No proper error checks. + /* Get the positions of all particles in the requested frame range. + * The positions are stored in the positions array. + * N.B. No proper error checks. */ if(tng_util_pos_read_range(traj, 0, last_frame, &positions, &stride_length) == TNG_SUCCESS) { - // Print the positions of the wanted particle (zero based) + /* Print the positions of the wanted particle (zero based) */ for(i=0; i < n_strides; i++) { printf("\nFrame %"PRId64":\n", first_frame + i*stride_length); @@ -118,7 +118,7 @@ int main(int argc, char **argv) printf("Cannot read positions\n"); } - // Free memory + /* Free memory */ if(positions) { free(positions); diff --git a/src/tests/tng_io_testing.c b/src/tests/tng_io_testing.c index 5cd3461..158bcfa 100644 --- a/src/tests/tng_io_testing.c +++ b/src/tests/tng_io_testing.c @@ -29,7 +29,6 @@ static tng_function_status tng_test_setup_molecules(tng_trajectory_t traj) tng_residue_t residue; tng_atom_t atom; int64_t cnt; -// int i; tng_molecule_add(traj, "water", &molecule); tng_molecule_chain_add(traj, molecule, "W", &chain); @@ -48,9 +47,9 @@ static tng_function_status tng_test_setup_molecules(tng_trajectory_t traj) } tng_molecule_cnt_set(traj, molecule, 200); tng_molecule_cnt_get(traj, molecule, &cnt); -// printf("Created %"PRId64" %s molecules.\n", cnt, molecule->name); +/* printf("Created %"PRId64" %s molecules.\n", cnt, molecule->name); */ -// traj->molecule_cnt_list[traj->n_molecules-1] = 5; +/* traj->molecule_cnt_list[traj->n_molecules-1] = 5; // tng_molecule_name_set(traj, &traj->molecules[1], "ligand"); // tng_molecule_name_set(traj, &traj->molecules[2], "water"); // tng_molecule_name_set(traj, &traj->molecules[3], "dummy"); @@ -107,7 +106,7 @@ static tng_function_status tng_test_setup_molecules(tng_trajectory_t traj) // { // return(TNG_CRITICAL); // } - +*/ return(TNG_SUCCESS); } @@ -348,7 +347,7 @@ static tng_function_status tng_test_write_and_read_traj(tng_trajectory_t traj) TNG_TRAJECTORY_BLOCK, n_frames_per_frame_set, 3, 1, 0, n_particles, -// TNG_UNCOMPRESSED, +/* TNG_UNCOMPRESSED, */ TNG_GZIP_COMPRESSION, data) != TNG_SUCCESS) { @@ -508,7 +507,7 @@ tng_function_status tng_test_get_box_data(tng_trajectory_t traj) return(TNG_CRITICAL); } - +/* // int64_t i, j; // printf("Box shape:"); // for(i=0; i<n_frames; i++) @@ -519,7 +518,7 @@ tng_function_status tng_test_get_box_data(tng_trajectory_t traj) // } // printf("\n"); // } - +*/ tng_data_values_free(traj, values, n_frames, n_values_per_frame, type); return(TNG_SUCCESS); @@ -542,7 +541,7 @@ tng_function_status tng_test_get_positions_data(tng_trajectory_t traj) return(TNG_CRITICAL); } - +/* // int64_t i, j, k; // struct tng_trajectory_frame_set *frame_set = // &traj->current_trajectory_frame_set; @@ -559,7 +558,7 @@ tng_function_status tng_test_get_positions_data(tng_trajectory_t traj) // printf("\n"); // } // } - +*/ tng_particle_data_values_free(traj, values, n_frames, n_particles, n_values_per_frame, type); |