Bumped TNG to latest version.
[gromacs.git] / src / external / tng_io / src / lib / tng_io_fortran.c
blobbaceef75d1cd51fc05539d1dc6e7f1216897eca7
1 /* This code is part of the tng binary trajectory format.
3 * VERSION 1.5
5 * Written by Magnus Lundborg
6 * Copyright (c) 2012-2013, The GROMACS development team.
7 * Check out http://www.gromacs.org for more information.
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the Revised BSD License.
14 #include "../../include/tng_io.h"
16 /* The following is for calling the library from fortran */
18 tng_function_status DECLSPECDLLEXPORT tng_trajectory_init_(tng_trajectory_t *tng_data_p)
20 return(tng_trajectory_init(tng_data_p));
23 tng_function_status DECLSPECDLLEXPORT tng_trajectory_destroy_(tng_trajectory_t *tng_data_p)
25 return(tng_trajectory_destroy(tng_data_p));
28 tng_function_status DECLSPECDLLEXPORT tng_trajectory_init_from_src_(tng_trajectory_t src,
29 tng_trajectory_t *dest_p)
31 return(tng_trajectory_init_from_src(src, dest_p));
34 tng_function_status DECLSPECDLLEXPORT tng_input_file_get_(const tng_trajectory_t tng_data,
35 char *file_name, const int max_len)
37 return(tng_input_file_get(tng_data, file_name, max_len));
40 tng_function_status DECLSPECDLLEXPORT tng_input_file_set_(tng_trajectory_t tng_data,
41 const char *file_name, int name_len)
43 char *name = malloc(name_len + 1);
44 tng_function_status stat;
46 strncpy(name, file_name, name_len);
47 name[name_len] = 0;
48 stat = tng_input_file_set(tng_data, name);
49 free(name);
50 return(stat);
53 tng_function_status DECLSPECDLLEXPORT tng_output_file_get_(const tng_trajectory_t tng_data,
54 char *file_name, const int max_len)
56 return(tng_output_file_get(tng_data, file_name, max_len));
59 tng_function_status DECLSPECDLLEXPORT tng_output_file_set_(tng_trajectory_t tng_data,
60 const char *file_name, int name_len)
62 char *name = malloc(name_len + 1);
63 tng_function_status stat;
65 strncpy(name, file_name, name_len);
66 name[name_len] = 0;
67 stat = tng_output_file_set(tng_data, name);
68 free(name);
69 return(stat);
72 tng_function_status DECLSPECDLLEXPORT tng_first_program_name_get_(const tng_trajectory_t tng_data,
73 char *name, const int max_len)
75 return(tng_first_program_name_get(tng_data, name, max_len));
78 tng_function_status DECLSPECDLLEXPORT tng_output_file_endianness_get_
79 (tng_trajectory_t tng_data, tng_file_endianness *endianness)
81 return(tng_output_file_endianness_get(tng_data, endianness));
84 tng_function_status DECLSPECDLLEXPORT tng_output_file_endianness_set_
85 (tng_trajectory_t tng_data, const tng_file_endianness *endianness)
87 return(tng_output_file_endianness_set(tng_data, *endianness));
90 tng_function_status DECLSPECDLLEXPORT tng_first_program_name_set_(tng_trajectory_t tng_data,
91 const char *new_name,
92 int name_len)
94 char *name = malloc(name_len + 1);
95 tng_function_status stat;
97 strncpy(name, new_name, name_len);
98 name[name_len] = 0;
99 stat = tng_first_program_name_set(tng_data, name);
100 free(name);
101 return(stat);
104 tng_function_status DECLSPECDLLEXPORT tng_last_program_name_get_(const tng_trajectory_t tng_data,
105 char *name, const int max_len)
107 return(tng_last_program_name_get(tng_data, name, max_len));
110 tng_function_status DECLSPECDLLEXPORT tng_last_program_name_set_(tng_trajectory_t tng_data,
111 const char *new_name,
112 int name_len)
114 char *name = malloc(name_len + 1);
115 tng_function_status stat;
117 strncpy(name, new_name, name_len);
118 name[name_len] = 0;
119 stat = tng_last_program_name_set(tng_data, name);
120 free(name);
121 return(stat);
124 tng_function_status DECLSPECDLLEXPORT tng_first_user_name_get_(const tng_trajectory_t tng_data,
125 char *name, const int max_len)
127 return(tng_first_user_name_get(tng_data, name, max_len));
130 tng_function_status DECLSPECDLLEXPORT tng_first_user_name_set_(tng_trajectory_t tng_data,
131 const char *new_name,
132 int name_len)
134 char *name = malloc(name_len + 1);
135 tng_function_status stat;
137 strncpy(name, new_name, name_len);
138 name[name_len] = 0;
139 stat = tng_first_user_name_set(tng_data, name);
140 free(name);
141 return(stat);
144 tng_function_status DECLSPECDLLEXPORT tng_last_user_name_get_(const tng_trajectory_t tng_data,
145 char *name, const int max_len)
147 return(tng_last_user_name_get(tng_data, name, max_len));
150 tng_function_status DECLSPECDLLEXPORT tng_last_user_name_set_(tng_trajectory_t tng_data,
151 const char *new_name,
152 int name_len)
154 char *name = malloc(name_len + 1);
155 tng_function_status stat;
157 strncpy(name, new_name, name_len);
158 name[name_len] = 0;
159 stat = tng_last_user_name_set(tng_data, name);
160 free(name);
161 return(stat);
164 tng_function_status DECLSPECDLLEXPORT tng_first_computer_name_get_(const tng_trajectory_t tng_data,
165 char *name, const int max_len)
167 return(tng_first_computer_name_get(tng_data, name, max_len));
170 tng_function_status DECLSPECDLLEXPORT tng_first_computer_name_set_(tng_trajectory_t tng_data,
171 const char *new_name,
172 int name_len)
174 char *name = malloc(name_len + 1);
175 tng_function_status stat;
177 strncpy(name, new_name, name_len);
178 name[name_len] = 0;
179 stat = tng_first_computer_name_set(tng_data, name);
180 free(name);
181 return(stat);
184 tng_function_status DECLSPECDLLEXPORT tng_last_computer_name_get_(const tng_trajectory_t tng_data,
185 char *name, const int max_len)
187 return(tng_last_computer_name_get(tng_data, name, max_len));
190 tng_function_status DECLSPECDLLEXPORT tng_last_computer_name_set_(tng_trajectory_t tng_data,
191 const char *new_name,
192 int name_len)
194 char *name = malloc(name_len + 1);
195 tng_function_status stat;
197 strncpy(name, new_name, name_len);
198 name[name_len] = 0;
199 stat = tng_last_computer_name_set(tng_data, name);
200 free(name);
201 return(stat);
204 tng_function_status DECLSPECDLLEXPORT tng_first_signature_get_
205 (const tng_trajectory_t tng_data,
206 char *signature, const int max_len)
208 return(tng_first_signature_get(tng_data, signature, max_len));
211 tng_function_status DECLSPECDLLEXPORT tng_first_signature_set_(tng_trajectory_t tng_data,
212 const char *signature,
213 int sign_len)
215 char *sign = malloc(sign_len + 1);
216 tng_function_status stat;
218 strncpy(sign, signature, sign_len);
219 sign[sign_len] = 0;
220 stat = tng_first_signature_set(tng_data, sign);
221 free(sign);
222 return(stat);
225 tng_function_status DECLSPECDLLEXPORT tng_last_signature_get_
226 (const tng_trajectory_t tng_data,
227 char *signature, const int max_len)
229 return(tng_last_signature_get(tng_data, signature, max_len));
232 tng_function_status DECLSPECDLLEXPORT tng_last_signature_set_
233 (tng_trajectory_t tng_data,
234 const char *signature,
235 int sign_len)
237 char *sign = malloc(sign_len + 1);
238 tng_function_status stat;
240 strncpy(sign, signature, sign_len);
241 sign[sign_len] = 0;
242 stat = tng_last_signature_set(tng_data, sign);
243 free(sign);
244 return(stat);
247 tng_function_status DECLSPECDLLEXPORT tng_forcefield_name_get_
248 (const tng_trajectory_t tng_data,
249 char *name, const int max_len)
251 return(tng_forcefield_name_get(tng_data, name, max_len));
254 tng_function_status DECLSPECDLLEXPORT tng_forcefield_name_set_
255 (tng_trajectory_t tng_data,
256 const char *new_name,
257 int name_len)
259 char *name = malloc(name_len + 1);
260 tng_function_status stat;
262 strncpy(name, new_name, name_len);
263 name[name_len] = 0;
264 stat = tng_forcefield_name_set(tng_data, name);
265 free(name);
266 return(stat);
269 tng_function_status DECLSPECDLLEXPORT tng_medium_stride_length_get_
270 (const tng_trajectory_t tng_data,
271 int64_t *len)
273 return(tng_medium_stride_length_get(tng_data, len));
276 tng_function_status DECLSPECDLLEXPORT tng_medium_stride_length_set_
277 (tng_trajectory_t tng_data,
278 const int64_t *len)
280 return(tng_medium_stride_length_set(tng_data, *len));
283 tng_function_status DECLSPECDLLEXPORT tng_long_stride_length_get_
284 (const tng_trajectory_t tng_data,
285 int64_t *len)
287 return(tng_long_stride_length_get(tng_data, len));
290 tng_function_status DECLSPECDLLEXPORT tng_long_stride_length_set_
291 (tng_trajectory_t tng_data,
292 const int64_t *len)
294 return(tng_long_stride_length_set(tng_data, *len));
297 tng_function_status DECLSPECDLLEXPORT tng_time_per_frame_get_
298 (const tng_trajectory_t tng_data,
299 double *time)
301 return(tng_time_per_frame_get(tng_data, time));
304 tng_function_status DECLSPECDLLEXPORT tng_time_per_frame_set_
305 (tng_trajectory_t tng_data,
306 const double *time)
308 return(tng_time_per_frame_set(tng_data, *time));
311 tng_function_status DECLSPECDLLEXPORT tng_input_file_len_get_
312 (const tng_trajectory_t tng_data,
313 int64_t *len)
315 return(tng_input_file_len_get(tng_data, len));
318 tng_function_status DECLSPECDLLEXPORT tng_num_frames_get_
319 (const tng_trajectory_t tng_data,
320 int64_t *n)
322 return(tng_num_frames_get(tng_data, n));
325 tng_function_status DECLSPECDLLEXPORT tng_num_particles_get_
326 (const tng_trajectory_t tng_data,
327 int64_t *n)
329 return(tng_num_particles_get(tng_data, n));
332 tng_function_status DECLSPECDLLEXPORT tng_num_molecules_get_
333 (const tng_trajectory_t tng_data,
334 int64_t *n)
336 return(tng_num_molecules_get(tng_data, n));
339 tng_function_status DECLSPECDLLEXPORT tng_distance_unit_exponential_get_
340 (const tng_trajectory_t tng_data,
341 int64_t *exp)
343 return(tng_distance_unit_exponential_get(tng_data, exp));
346 tng_function_status DECLSPECDLLEXPORT tng_distance_unit_exponential_set_
347 (const tng_trajectory_t tng_data,
348 const int64_t *exp)
350 return(tng_distance_unit_exponential_set(tng_data, *exp));
353 tng_function_status DECLSPECDLLEXPORT tng_num_frames_per_frame_set_get_
354 (const tng_trajectory_t tng_data,
355 int64_t *n)
357 return(tng_num_frames_per_frame_set_get(tng_data, n));
360 tng_function_status DECLSPECDLLEXPORT tng_num_frames_per_frame_set_set_
361 (const tng_trajectory_t tng_data,
362 int64_t *n)
364 return(tng_num_frames_per_frame_set_set(tng_data, *n));
367 tng_function_status DECLSPECDLLEXPORT tng_num_frame_sets_get_
368 (const tng_trajectory_t tng_data,
369 int64_t *n)
371 return(tng_num_frame_sets_get(tng_data, n));
374 tng_function_status DECLSPECDLLEXPORT tng_current_frame_set_get_
375 (tng_trajectory_t tng_data,
376 tng_trajectory_frame_set_t *frame_set_p)
378 return(tng_current_frame_set_get(tng_data, frame_set_p));
381 tng_function_status DECLSPECDLLEXPORT tng_frame_set_nr_find_(tng_trajectory_t tng_data,
382 const int64_t *nr)
384 return(tng_frame_set_nr_find(tng_data, *nr));
387 tng_function_status DECLSPECDLLEXPORT tng_frame_set_of_frame_find_
388 (tng_trajectory_t tng_data,
389 const int64_t *frame)
391 return(tng_frame_set_of_frame_find(tng_data, *frame));
394 tng_function_status DECLSPECDLLEXPORT tng_frame_set_next_frame_set_file_pos_get_
395 (const tng_trajectory_t tng_data,
396 const tng_trajectory_frame_set_t frame_set,
397 int64_t *pos)
399 return(tng_frame_set_next_frame_set_file_pos_get(tng_data, frame_set, pos));
402 tng_function_status DECLSPECDLLEXPORT tng_frame_set_prev_frame_set_file_pos_get_
403 (const tng_trajectory_t tng_data,
404 const tng_trajectory_frame_set_t frame_set,
405 int64_t *pos)
407 return(tng_frame_set_prev_frame_set_file_pos_get(tng_data, frame_set, pos));
410 tng_function_status DECLSPECDLLEXPORT tng_frame_set_frame_range_get_
411 (const tng_trajectory_t tng_data,
412 const tng_trajectory_frame_set_t frame_set,
413 int64_t *first_frame,
414 int64_t *last_frame)
416 return(tng_frame_set_frame_range_get(tng_data, frame_set, first_frame,
417 last_frame));
420 tng_function_status DECLSPECDLLEXPORT tng_molecule_init_(const tng_trajectory_t tng_data,
421 tng_molecule_t molecule)
423 return(tng_molecule_init(tng_data, molecule));
426 tng_function_status DECLSPECDLLEXPORT tng_molecule_destroy_
427 (const tng_trajectory_t tng_data,
428 tng_molecule_t molecule)
430 return(tng_molecule_destroy(tng_data, molecule));
433 tng_function_status DECLSPECDLLEXPORT tng_molecule_add_(tng_trajectory_t tng_data,
434 const char *name,
435 tng_molecule_t *molecule,
436 int name_len)
438 char *n = malloc(name_len + 1);
439 tng_function_status stat;
441 strncpy(n, name, name_len);
442 n[name_len] = 0;
443 stat = tng_molecule_add(tng_data, n, molecule);
444 free(n);
445 return(stat);
448 tng_function_status DECLSPECDLLEXPORT tng_molecule_name_set_(tng_trajectory_t tng_data,
449 tng_molecule_t molecule,
450 const char *new_name,
451 int name_len)
453 char *name = malloc(name_len + 1);
454 tng_function_status stat;
456 strncpy(name, new_name, name_len);
457 name[name_len] = 0;
458 stat = tng_molecule_name_set(tng_data, molecule, name);
459 free(name);
460 return(stat);
463 tng_function_status DECLSPECDLLEXPORT tng_molecule_cnt_get_(tng_trajectory_t tng_data,
464 tng_molecule_t molecule,
465 int64_t *cnt)
467 return(tng_molecule_cnt_get(tng_data, molecule, cnt));
470 tng_function_status DECLSPECDLLEXPORT tng_molecule_cnt_set_(tng_trajectory_t tng_data,
471 tng_molecule_t molecule,
472 int64_t *cnt)
474 return(tng_molecule_cnt_set(tng_data, molecule, *cnt));
477 tng_function_status DECLSPECDLLEXPORT tng_molecule_find_(tng_trajectory_t tng_data,
478 const char *name,
479 int64_t nr,
480 tng_molecule_t *molecule,
481 int name_len)
483 char *n = malloc(name_len + 1);
484 tng_function_status stat;
486 strncpy(n, name, name_len);
487 n[name_len] = 0;
488 stat = tng_molecule_find(tng_data, n, nr, molecule);
489 free(n);
490 return(stat);
493 tng_function_status DECLSPECDLLEXPORT tng_molecule_chain_find_(tng_trajectory_t tng_data,
494 tng_molecule_t molecule,
495 const char *name,
496 int64_t id,
497 tng_chain_t *chain,
498 int name_len)
500 char *n = malloc(name_len + 1);
501 tng_function_status stat;
503 strncpy(n, name, name_len);
504 n[name_len] = 0;
505 stat = tng_molecule_chain_find(tng_data, molecule, n, id, chain);
506 free(n);
507 return(stat);
510 tng_function_status DECLSPECDLLEXPORT tng_molecule_chain_add_(tng_trajectory_t tng_data,
511 tng_molecule_t molecule,
512 const char *name,
513 tng_chain_t *chain,
514 int name_len)
516 char *n = malloc(name_len + 1);
517 tng_function_status stat;
519 strncpy(n, name, name_len);
520 n[name_len] = 0;
521 stat = tng_molecule_chain_add(tng_data, molecule, n, chain);
522 free(n);
523 return(stat);
526 tng_function_status DECLSPECDLLEXPORT tng_chain_name_set_(tng_trajectory_t tng_data,
527 tng_chain_t chain,
528 const char *new_name,
529 int name_len)
531 char *name = malloc(name_len + 1);
532 tng_function_status stat;
534 strncpy(name, new_name, name_len);
535 name[name_len] = 0;
536 stat = tng_chain_name_set(tng_data, chain, name);
537 free(name);
538 return(stat);
541 tng_function_status DECLSPECDLLEXPORT tng_chain_residue_add_(tng_trajectory_t tng_data,
542 tng_chain_t chain,
543 const char *name,
544 tng_residue_t *residue,
545 int name_len)
547 char *n = malloc(name_len + 1);
548 tng_function_status stat;
550 strncpy(n, name, name_len);
551 n[name_len] = 0;
552 stat = tng_chain_residue_add(tng_data, chain, n, residue);
553 free(n);
554 return(stat);
557 tng_function_status DECLSPECDLLEXPORT tng_residue_name_set_(tng_trajectory_t tng_data,
558 tng_residue_t residue,
559 const char *new_name,
560 int name_len)
562 char *name = malloc(name_len + 1);
563 tng_function_status stat;
565 strncpy(name, new_name, name_len);
566 name[name_len] = 0;
567 stat = tng_residue_name_set(tng_data, residue, name);
568 free(name);
569 return(stat);
572 tng_function_status DECLSPECDLLEXPORT tng_residue_atom_add_(tng_trajectory_t tng_data,
573 tng_residue_t residue,
574 const char *atom_name,
575 const char *atom_type,
576 tng_atom_t *atom,
577 int name_len,
578 int type_len)
580 char *name = malloc(name_len + 1);
581 char *type = malloc(type_len + 1);
582 tng_function_status stat;
584 strncpy(name, atom_name, name_len);
585 strncpy(type, atom_type, type_len);
586 name[name_len] = 0;
587 type[type_len] = 0;
588 stat = tng_residue_atom_add(tng_data, residue, name, type, atom);
589 free(name);
590 free(type);
591 return(stat);
594 tng_function_status DECLSPECDLLEXPORT tng_atom_name_set_(tng_trajectory_t tng_data,
595 tng_atom_t atom,
596 const char *new_name,
597 int name_len)
599 char *name = malloc(name_len + 1);
600 tng_function_status stat;
602 strncpy(name, new_name, name_len);
603 name[name_len] = 0;
604 stat = tng_atom_name_set(tng_data, atom, name);
605 free(name);
606 return(stat);
609 tng_function_status DECLSPECDLLEXPORT tng_atom_type_set_(tng_trajectory_t tng_data,
610 tng_atom_t atom,
611 const char *new_type,
612 int type_len)
614 char *type = malloc(type_len + 1);
615 tng_function_status stat;
617 strncpy(type, new_type, type_len);
618 type[type_len] = 0;
619 stat = tng_atom_type_set(tng_data, atom, type);
620 free(type);
621 return(stat);
624 tng_function_status DECLSPECDLLEXPORT tng_molecule_name_of_particle_nr_get_
625 (const tng_trajectory_t tng_data,
626 const int64_t nr,
627 char *name,
628 int max_len)
630 return(tng_molecule_name_of_particle_nr_get(tng_data, nr, name, max_len));
633 tng_function_status DECLSPECDLLEXPORT tng_chain_name_of_particle_nr_get_
634 (const tng_trajectory_t tng_data,
635 const int64_t nr,
636 char *name,
637 int max_len)
639 return(tng_chain_name_of_particle_nr_get(tng_data, nr, name, max_len));
642 tng_function_status DECLSPECDLLEXPORT tng_residue_name_of_particle_nr_get_
643 (const tng_trajectory_t tng_data,
644 const int64_t nr,
645 char *name,
646 int max_len)
648 return(tng_residue_name_of_particle_nr_get(tng_data, nr, name, max_len));
651 tng_function_status DECLSPECDLLEXPORT tng_residue_id_of_particle_nr_get_
652 (const tng_trajectory_t tng_data,
653 const int64_t nr,
654 int64_t *id)
656 return(tng_residue_id_of_particle_nr_get(tng_data, nr, id));
659 tng_function_status DECLSPECDLLEXPORT tng_atom_name_of_particle_nr_get_
660 (const tng_trajectory_t tng_data,
661 const int64_t nr,
662 char *name,
663 int max_len)
665 return(tng_atom_name_of_particle_nr_get(tng_data, nr, name, max_len));
668 tng_function_status DECLSPECDLLEXPORT tng_atom_type_of_particle_nr_get_
669 (const tng_trajectory_t tng_data,
670 const int64_t nr,
671 char *type,
672 int max_len)
674 return(tng_atom_type_of_particle_nr_get(tng_data, nr, type, max_len));
677 tng_function_status DECLSPECDLLEXPORT tng_particle_mapping_add_
678 (tng_trajectory_t tng_data,
679 const int64_t *first_particle_number,
680 const int64_t *n_particles,
681 const int64_t *mapping_table)
683 return(tng_particle_mapping_add(tng_data, *first_particle_number,
684 *n_particles, mapping_table));
687 tng_function_status DECLSPECDLLEXPORT tng_file_headers_read_(tng_trajectory_t tng_data,
688 const char *hash_mode)
690 return(tng_file_headers_read(tng_data, *hash_mode));
693 tng_function_status DECLSPECDLLEXPORT tng_file_headers_write_
694 (tng_trajectory_t tng_data,
695 const char *hash_mode)
697 return(tng_file_headers_write(tng_data, *hash_mode));
700 tng_function_status DECLSPECDLLEXPORT tng_block_read_next_
701 (tng_trajectory_t tng_data,
702 tng_gen_block_t block_data,
703 const char *hash_mode)
705 return(tng_block_read_next(tng_data, block_data, *hash_mode));
708 tng_function_status DECLSPECDLLEXPORT tng_frame_set_read_next_
709 (tng_trajectory_t tng_data,
710 const char *hash_mode)
712 return(tng_frame_set_read_next(tng_data, *hash_mode));
715 tng_function_status DECLSPECDLLEXPORT tng_frame_set_write_(tng_trajectory_t tng_data,
716 const char *hash_mode)
718 return(tng_frame_set_write(tng_data, *hash_mode));
721 tng_function_status DECLSPECDLLEXPORT tng_frame_set_new_(tng_trajectory_t tng_data,
722 const int64_t *first_frame,
723 const int64_t *n_frames)
725 return(tng_frame_set_new(tng_data, *first_frame, *n_frames));
728 tng_function_status DECLSPECDLLEXPORT tng_frame_set_with_time_new_
729 (tng_trajectory_t tng_data,
730 const int64_t *first_frame,
731 const int64_t *n_frames,
732 const double *first_frame_time)
734 return(tng_frame_set_with_time_new(tng_data, *first_frame, *n_frames,
735 *first_frame_time));
738 tng_function_status DECLSPECDLLEXPORT tng_frame_set_first_frame_time_set_
739 (tng_trajectory_t tng_data,
740 const double *first_frame_time)
742 return(tng_frame_set_first_frame_time_set(tng_data, *first_frame_time));
745 tng_function_status DECLSPECDLLEXPORT tng_data_block_add_
746 (tng_trajectory_t tng_data,
747 const int64_t *id,
748 const char *block_name,
749 const char *datatype,
750 const char *block_type_flag,
751 int64_t *n_frames,
752 const int64_t *n_values_per_frame,
753 const int64_t *stride_length,
754 const int64_t *codec_id,
755 void *new_data,
756 int name_len)
758 char *name = malloc(name_len + 1);
759 tng_function_status stat;
761 strncpy(name, block_name, name_len);
762 name[name_len] = 0;
763 stat = tng_data_block_add(tng_data, *id, name, *datatype, *block_type_flag,
764 *n_frames, *n_values_per_frame, *stride_length,
765 *codec_id, new_data);
766 free(name);
767 return(stat);
770 tng_function_status DECLSPECDLLEXPORT tng_particle_data_block_add_
771 (tng_trajectory_t tng_data,
772 const int64_t *id,
773 const char *block_name,
774 const char *datatype,
775 const char *block_type_flag,
776 int64_t *n_frames,
777 const int64_t *n_values_per_frame,
778 const int64_t *stride_length,
779 const int64_t *first_particle_number,
780 const int64_t *n_particles,
781 const int64_t *codec_id,
782 void *new_data,
783 int name_len)
785 char *name = malloc(name_len + 1);
786 tng_function_status stat;
788 strncpy(name, block_name, name_len);
789 name[name_len] = 0;
790 stat = tng_particle_data_block_add(tng_data, *id, name, *datatype,
791 *block_type_flag, *n_frames,
792 *n_values_per_frame, *stride_length,
793 *first_particle_number, *n_particles,
794 *codec_id, new_data);
795 free(name);
796 return(stat);
799 tng_function_status DECLSPECDLLEXPORT tng_frame_data_write_
800 (tng_trajectory_t tng_data,
801 const int64_t *frame_nr,
802 const int64_t *block_id,
803 const void *data,
804 const char *hash_mode)
806 return(tng_frame_data_write(tng_data, *frame_nr, *block_id, data,
807 *hash_mode));
810 tng_function_status DECLSPECDLLEXPORT tng_frame_particle_data_write_
811 (tng_trajectory_t tng_data,
812 const int64_t *frame_nr,
813 const int64_t *block_id,
814 const int64_t *val_first_particle,
815 const int64_t *val_n_particles,
816 const void *data,
817 const char *hash_mode)
819 return(tng_frame_particle_data_write(tng_data, *frame_nr, *block_id,
820 *val_first_particle, *val_n_particles,
821 data, *hash_mode));
824 tng_function_status DECLSPECDLLEXPORT tng_data_values_free_
825 (const tng_trajectory_t tng_data,
826 union data_values **values,
827 const int64_t *n_frames,
828 const int64_t *n_values_per_frame,
829 const char *type)
831 return(tng_data_values_free(tng_data, values, *n_frames,
832 *n_values_per_frame, *type));
835 tng_function_status DECLSPECDLLEXPORT tng_particle_data_values_free_
836 (const tng_trajectory_t tng_data,
837 union data_values ***values,
838 const int64_t *n_frames,
839 const int64_t *n_particles,
840 const int64_t *n_values_per_frame,
841 const char *type)
843 return(tng_particle_data_values_free(tng_data, values, *n_frames, *n_particles,
844 *n_values_per_frame, *type));
847 tng_function_status DECLSPECDLLEXPORT tng_data_get_
848 (tng_trajectory_t tng_data,
849 const int64_t *block_id,
850 union data_values ***values,
851 int64_t *n_frames,
852 int64_t *n_values_per_frame,
853 char *type)
855 return(tng_data_get(tng_data, *block_id, values, n_frames,
856 n_values_per_frame, type));
859 tng_function_status DECLSPECDLLEXPORT tng_data_interval_get_
860 (tng_trajectory_t tng_data,
861 const int64_t *block_id,
862 const int64_t *start_frame_nr,
863 const int64_t *end_frame_nr,
864 const char *hash_mode,
865 union data_values ***values,
866 int64_t *n_values_per_frame,
867 char *type)
869 return(tng_data_interval_get(tng_data, *block_id, *start_frame_nr,
870 *end_frame_nr, *hash_mode, values,
871 n_values_per_frame, type));
874 tng_function_status DECLSPECDLLEXPORT tng_particle_data_get_
875 (tng_trajectory_t tng_data,
876 const int64_t *block_id,
877 union data_values ****values,
878 int64_t *n_frames,
879 int64_t *n_particles,
880 int64_t *n_values_per_frame,
881 char *type)
883 return(tng_particle_data_get(tng_data, *block_id, values, n_frames,
884 n_particles, n_values_per_frame, type));
887 tng_function_status DECLSPECDLLEXPORT tng_particle_data_interval_get_
888 (tng_trajectory_t tng_data,
889 const int64_t *block_id,
890 const int64_t *start_frame_nr,
891 const int64_t *end_frame_nr,
892 const char *hash_mode,
893 union data_values ****values,
894 int64_t *n_particles,
895 int64_t *n_values_per_frame,
896 char *type)
898 return(tng_particle_data_interval_get(tng_data, *block_id, *start_frame_nr,
899 *end_frame_nr, *hash_mode, values,
900 n_particles, n_values_per_frame,
901 type));
904 tng_function_status DECLSPECDLLEXPORT tng_time_get_str_
905 (const tng_trajectory_t tng_data,
906 char *time, int64_t str_len)
908 return(tng_time_get_str(tng_data, time));
911 tng_function_status DECLSPECDLLEXPORT tng_util_trajectory_open_
912 (const char *filename, const char *mode,
913 tng_trajectory_t *tng_data_p)
915 return(tng_util_trajectory_open(filename, *mode, tng_data_p));
918 tng_function_status DECLSPECDLLEXPORT tng_util_trajectory_close_
919 (tng_trajectory_t *tng_data_p)
921 return(tng_util_trajectory_close(tng_data_p));
924 tng_function_status DECLSPECDLLEXPORT tng_util_pos_read_
925 (tng_trajectory_t tng_data,
926 float **positions,
927 int64_t *stride_length)
929 return(tng_util_pos_read(tng_data, positions, stride_length));
932 tng_function_status DECLSPECDLLEXPORT tng_util_vel_read_
933 (tng_trajectory_t tng_data,
934 float **velocities,
935 int64_t *stride_length)
937 return(tng_util_vel_read(tng_data, velocities, stride_length));
940 tng_function_status DECLSPECDLLEXPORT tng_util_force_read_
941 (tng_trajectory_t tng_data,
942 float **forces,
943 int64_t *stride_length)
945 return(tng_util_force_read(tng_data, forces, stride_length));
948 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_read_
949 (tng_trajectory_t tng_data,
950 float **box_shape,
951 int64_t *stride_length)
953 return(tng_util_box_shape_read(tng_data, box_shape, stride_length));
956 tng_function_status DECLSPECDLLEXPORT tng_util_pos_read_range_
957 (tng_trajectory_t tng_data,
958 const int64_t *first_frame,
959 const int64_t *last_frame,
960 float **positions,
961 int64_t *stride_length)
963 return(tng_util_pos_read_range(tng_data, *first_frame, *last_frame,
964 positions, stride_length));
967 tng_function_status DECLSPECDLLEXPORT tng_util_vel_read_range_
968 (tng_trajectory_t tng_data,
969 const int64_t *first_frame,
970 const int64_t *last_frame,
971 float **velocities,
972 int64_t *stride_length)
974 return(tng_util_vel_read_range(tng_data, *first_frame, *last_frame,
975 velocities, stride_length));
978 tng_function_status DECLSPECDLLEXPORT tng_util_force_read_range_
979 (tng_trajectory_t tng_data,
980 const int64_t *first_frame,
981 const int64_t *last_frame,
982 float **forces,
983 int64_t *stride_length)
985 return(tng_util_force_read_range(tng_data, *first_frame, *last_frame,
986 forces, stride_length));
989 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_read_range_
990 (tng_trajectory_t tng_data,
991 const int64_t *first_frame,
992 const int64_t *last_frame,
993 float **box_shape,
994 int64_t *stride_length)
996 return(tng_util_box_shape_read_range(tng_data, *first_frame, *last_frame,
997 box_shape, stride_length));
1000 tng_function_status DECLSPECDLLEXPORT tng_util_generic_write_frequency_set_
1001 (tng_trajectory_t tng_data,
1002 const int64_t *f,
1003 const int64_t *n_values_per_frame,
1004 const int64_t *block_id,
1005 const char *block_name,
1006 const char *particle_dependency,
1007 const char *compression)
1009 return(tng_util_generic_write_frequency_set(tng_data, *f,
1010 *n_values_per_frame, *block_id,
1011 block_name,
1012 *particle_dependency,
1013 *compression));
1016 tng_function_status DECLSPECDLLEXPORT tng_util_pos_write_frequency_set_
1017 (tng_trajectory_t tng_data,
1018 const int64_t *f)
1020 return(tng_util_pos_write_frequency_set(tng_data, *f));
1023 tng_function_status DECLSPECDLLEXPORT tng_util_vel_write_frequency_set_
1024 (tng_trajectory_t tng_data,
1025 const int64_t *f)
1027 return(tng_util_vel_write_frequency_set(tng_data, *f));
1030 tng_function_status DECLSPECDLLEXPORT tng_util_force_write_frequency_set_
1031 (tng_trajectory_t tng_data,
1032 const int64_t *f)
1034 return(tng_util_force_write_frequency_set(tng_data, *f));
1037 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_write_frequency_set_
1038 (tng_trajectory_t tng_data,
1039 const int64_t *f)
1041 return(tng_util_box_shape_write_frequency_set(tng_data, *f));
1044 tng_function_status DECLSPECDLLEXPORT tng_util_generic_write_
1045 (tng_trajectory_t tng_data,
1046 const int64_t *frame_nr,
1047 const float *values,
1048 const int64_t *n_values_per_frame,
1049 const int64_t *block_id,
1050 const char *block_name,
1051 const char *particle_dependency,
1052 const char *compression)
1054 return(tng_util_generic_write(tng_data, *frame_nr, values,
1055 *n_values_per_frame, *block_id, block_name,
1056 *particle_dependency, *compression));
1059 tng_function_status DECLSPECDLLEXPORT tng_util_pos_write_
1060 (tng_trajectory_t tng_data,
1061 const int64_t *frame_nr,
1062 const float *positions)
1064 return(tng_util_vel_write(tng_data, *frame_nr, positions));
1067 tng_function_status DECLSPECDLLEXPORT tng_util_vel_write_
1068 (tng_trajectory_t tng_data,
1069 const int64_t *frame_nr,
1070 const float *velocities)
1072 return(tng_util_vel_write(tng_data, *frame_nr, velocities));
1075 tng_function_status DECLSPECDLLEXPORT tng_util_force_write_
1076 (tng_trajectory_t tng_data,
1077 const int64_t *frame_nr,
1078 const float *forces)
1080 return(tng_util_force_write(tng_data, *frame_nr, forces));
1083 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_write_
1084 (tng_trajectory_t tng_data,
1085 const int64_t *frame_nr,
1086 const float *box_shape)
1088 return(tng_util_box_shape_write(tng_data, *frame_nr, box_shape));
1091 tng_function_status DECLSPECDLLEXPORT tng_util_pos_with_time_write_
1092 (tng_trajectory_t tng_data,
1093 const int64_t *frame_nr,
1094 const int64_t *time,
1095 const float *positions)
1097 return(tng_util_pos_with_time_write(tng_data, *frame_nr, *time,
1098 positions));
1101 tng_function_status DECLSPECDLLEXPORT tng_util_vel_with_time_write_
1102 (tng_trajectory_t tng_data,
1103 const int64_t *frame_nr,
1104 const int64_t *time,
1105 const float *velocities)
1107 return(tng_util_vel_with_time_write(tng_data, *frame_nr, *time,
1108 velocities));
1111 tng_function_status DECLSPECDLLEXPORT tng_util_force_with_time_write_
1112 (tng_trajectory_t tng_data,
1113 const int64_t *frame_nr,
1114 const int64_t *time,
1115 const float *forces)
1117 return(tng_util_force_with_time_write(tng_data, *frame_nr, *time,
1118 forces));
1121 tng_function_status DECLSPECDLLEXPORT tng_util_box_shape_with_time_write_
1122 (tng_trajectory_t tng_data,
1123 const int64_t *frame_nr,
1124 const int64_t *time,
1125 const float *box_shape)
1127 return(tng_util_box_shape_with_time_write(tng_data, *frame_nr, *time,
1128 box_shape));