Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / fileio / tngio_for_tools.cpp
index 1c579a6f81744798b72b727f3771e90fc305a132..b4cfc5f011924f0ab868360e2c7e06be94da68bd 100644 (file)
  * To help us fund GROMACS development, we humbly ask that you cite
  * the research papers on the package. Check out http://www.gromacs.org.
  */
+#include "gmxpre.h"
+
 #include "tngio_for_tools.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
 
 #include <math.h>
 
-#include "tngio.h"
-#include "trx.h"
-
 #ifdef GMX_USE_TNG
 #include "tng/tng_io.h"
 #endif
 
-#include "gromacs/legacyheaders/types/atoms.h"
-#include "gromacs/legacyheaders/physics.h"
-#include "gromacs/legacyheaders/gmx_fatal.h"
-
+#include "gromacs/fileio/tngio.h"
+#include "gromacs/fileio/trx.h"
+#include "gromacs/math/units.h"
 #include "gromacs/utility/common.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
 void gmx_prepare_tng_writing(const char              *filename,
@@ -78,6 +75,18 @@ void gmx_prepare_tng_writing(const char              *filename,
         "FORCES", "LAMBDAS"
     };
 
+    typedef tng_function_status (*set_writing_interval_func_pointer)(tng_trajectory_t,
+                                                                     const gmx_int64_t,
+                                                                     const gmx_int64_t,
+                                                                     const gmx_int64_t,
+                                                                     const char*,
+                                                                     const char,
+                                                                     const char);
+#ifdef GMX_DOUBLE
+    set_writing_interval_func_pointer set_writing_interval = tng_util_generic_write_interval_double_set;
+#else
+    set_writing_interval_func_pointer set_writing_interval = tng_util_generic_write_interval_set;
+#endif
 
     gmx_tng_open(filename, mode, output);
 
@@ -115,24 +124,24 @@ void gmx_prepare_tng_writing(const char              *filename,
                 {
                     case TNG_TRAJ_POSITIONS:
                     case TNG_TRAJ_VELOCITIES:
-                        tng_util_generic_write_interval_set(*output, interval, 3, fallbackIds[i],
-                                                            fallbackNames[i], TNG_PARTICLE_BLOCK_DATA,
-                                                            compression_type);
+                        set_writing_interval(*output, interval, 3, fallbackIds[i],
+                                             fallbackNames[i], TNG_PARTICLE_BLOCK_DATA,
+                                             compression_type);
                         break;
                     case TNG_TRAJ_FORCES:
-                        tng_util_generic_write_interval_set(*output, interval, 3, fallbackIds[i],
-                                                            fallbackNames[i], TNG_PARTICLE_BLOCK_DATA,
-                                                            TNG_GZIP_COMPRESSION);
+                        set_writing_interval(*output, interval, 3, fallbackIds[i],
+                                             fallbackNames[i], TNG_PARTICLE_BLOCK_DATA,
+                                             TNG_GZIP_COMPRESSION);
                         break;
                     case TNG_TRAJ_BOX_SHAPE:
-                        tng_util_generic_write_interval_set(*output, interval, 9, fallbackIds[i],
-                                                            fallbackNames[i], TNG_NON_PARTICLE_BLOCK_DATA,
-                                                            TNG_GZIP_COMPRESSION);
+                        set_writing_interval(*output, interval, 9, fallbackIds[i],
+                                             fallbackNames[i], TNG_NON_PARTICLE_BLOCK_DATA,
+                                             TNG_GZIP_COMPRESSION);
                         break;
                     case TNG_GMX_LAMBDA:
-                        tng_util_generic_write_interval_set(*output, interval, 1, fallbackIds[i],
-                                                            fallbackNames[i], TNG_NON_PARTICLE_BLOCK_DATA,
-                                                            TNG_GZIP_COMPRESSION);
+                        set_writing_interval(*output, interval, 1, fallbackIds[i],
+                                             fallbackNames[i], TNG_NON_PARTICLE_BLOCK_DATA,
+                                             TNG_GZIP_COMPRESSION);
                     default:
                         continue;
                 }
@@ -528,7 +537,6 @@ gmx_bool gmx_read_next_tng_frame(tng_trajectory_t            input,
                         size = sizeof(double);
                         break;
                     default:
-                        size = 0; /* Just to make the compiler happy. */
                         gmx_incons("Illegal datatype of box shape values!");
                 }
                 for (int i = 0; i < DIM; i++)