Remove gmx custom fixed int (e.g. gmx_int64_t) types
[alexxy/gromacs.git] / src / gromacs / fileio / tngio.cpp
index f068e9fdd2aa4acf0ea4758e82dc3ba72c866869..268b4fbd428245e3175cab28b65fc1bdf27f1593 100644 (file)
@@ -225,7 +225,7 @@ void gmx_tng_close(gmx_tng_trajectory_t *gmx_tng)
 static void addTngMoleculeFromTopology(gmx_tng_trajectory_t gmx_tng,
                                        const char          *moleculeName,
                                        const t_atoms       *atoms,
-                                       gmx_int64_t          numMolecules,
+                                       int64_t              numMolecules,
                                        tng_molecule_t      *tngMol)
 {
     tng_trajectory_t tng      = gmx_tng->tng;
@@ -448,9 +448,9 @@ static void set_writing_intervals(gmx_tng_trajectory_t  gmx_tng,
     /* Define pointers to specific writing functions depending on if we
      * write float or double data */
     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 int64_t,
+                                                                     const int64_t,
+                                                                     const int64_t,
                                                                      const char*,
                                                                      const char,
                                                                      const char);
@@ -620,7 +620,7 @@ static void add_selection_groups(gmx_tng_trajectory_t  gmx_tng,
     tng_residue_t            res;
     tng_atom_t               atom;
     tng_bond_t               tngBond;
-    gmx_int64_t              nMols;
+    int64_t                  nMols;
     char                    *groupName;
     tng_trajectory_t         tng = gmx_tng->tng;
 
@@ -757,7 +757,7 @@ static void add_selection_groups(gmx_tng_trajectory_t  gmx_tng,
     tng_molecule_existing_add(tng, &mol);
     tng_molecule_cnt_set(tng, mol, 1);
     tng_num_molecule_types_get(tng, &nMols);
-    for (gmx_int64_t k = 0; k < nMols; k++)
+    for (int64_t k = 0; k < nMols; k++)
     {
         tng_molecule_of_index_get(tng, k, &iterMol);
         if (iterMol == mol)
@@ -800,7 +800,7 @@ void gmx_tng_prepare_low_prec_writing(gmx_tng_trajectory_t  gmx_tng,
 
 void gmx_fwrite_tng(gmx_tng_trajectory_t gmx_tng,
                     const gmx_bool       bUseLossyCompression,
-                    gmx_int64_t          step,
+                    int64_t              step,
                     real                 elapsedPicoSeconds,
                     real                 lambda,
                     const rvec          *box,
@@ -811,11 +811,11 @@ void gmx_fwrite_tng(gmx_tng_trajectory_t gmx_tng,
 {
 #if GMX_USE_TNG
     typedef tng_function_status (*write_data_func_pointer)(tng_trajectory_t,
-                                                           const gmx_int64_t,
+                                                           const int64_t,
                                                            const double,
                                                            const real*,
-                                                           const gmx_int64_t,
-                                                           const gmx_int64_t,
+                                                           const int64_t,
+                                                           const int64_t,
                                                            const char*,
                                                            const char,
                                                            const char);
@@ -825,7 +825,7 @@ void gmx_fwrite_tng(gmx_tng_trajectory_t gmx_tng,
     static write_data_func_pointer           write_data           = tng_util_generic_with_time_write;
 #endif
     double                                   elapsedSeconds = elapsedPicoSeconds * PICO;
-    gmx_int64_t                              nParticles;
+    int64_t                                  nParticles;
     char                                     compression;
 
 
@@ -994,7 +994,7 @@ void fflush_tng(gmx_tng_trajectory_t gmx_tng)
 float gmx_tng_get_time_of_final_frame(gmx_tng_trajectory_t gmx_tng)
 {
 #if GMX_USE_TNG
-    gmx_int64_t      nFrames;
+    int64_t          nFrames;
     double           time;
     float            fTime;
     tng_trajectory_t tng = gmx_tng->tng;
@@ -1023,7 +1023,7 @@ void gmx_prepare_tng_writing(const char              *filename,
     tng_trajectory_t   *input  = (gmx_tng_input && *gmx_tng_input) ? &(*gmx_tng_input)->tng : nullptr;
     /* FIXME after 5.0: Currently only standard block types are read */
     const int           defaultNumIds              = 5;
-    static gmx_int64_t  fallbackIds[defaultNumIds] =
+    static int64_t      fallbackIds[defaultNumIds] =
     {
         TNG_TRAJ_BOX_SHAPE, TNG_TRAJ_POSITIONS,
         TNG_TRAJ_VELOCITIES, TNG_TRAJ_FORCES,
@@ -1036,9 +1036,9 @@ void gmx_prepare_tng_writing(const char              *filename,
     };
 
     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 int64_t,
+                                                                     const int64_t,
+                                                                     const int64_t,
                                                                      const char*,
                                                                      const char,
                                                                      const char);
@@ -1061,7 +1061,7 @@ void gmx_prepare_tng_writing(const char              *filename,
          * output tng container based on their respective values int
          * the input tng container */
         double      time, compression_precision;
-        gmx_int64_t n_frames_per_frame_set, interval = -1;
+        int64_t     n_frames_per_frame_set, interval = -1;
 
         tng_compression_precision_get(*input, &compression_precision);
         tng_compression_precision_set(*output, compression_precision);
@@ -1229,7 +1229,7 @@ convert_array_to_real_array(void       *from,
             {
                 for (j = 0; j < nValues; j++)
                 {
-                    to[i*nValues+j] = reinterpret_cast<gmx_int64_t *>(from)[i*nValues+j] * fact;
+                    to[i*nValues+j] = reinterpret_cast<int64_t *>(from)[i*nValues+j] * fact;
                 }
             }
             break;
@@ -1269,7 +1269,7 @@ convert_array_to_real_array(void       *from,
 
 real getDistanceScaleFactor(gmx_tng_trajectory_t in)
 {
-    gmx_int64_t exp = -1;
+    int64_t     exp = -1;
     real        distanceScaleFactor;
 
     // TODO Hopefully, TNG 2.0 will do this kind of thing for us
@@ -1300,7 +1300,7 @@ void gmx_tng_setup_atom_subgroup(gmx_tng_trajectory_t gmx_tng,
                                  const char          *name)
 {
 #if GMX_USE_TNG
-    gmx_int64_t              nAtoms, cnt, nMols;
+    int64_t                  nAtoms, cnt, nMols;
     tng_molecule_t           mol, iterMol;
     tng_chain_t              chain;
     tng_residue_t            res;
@@ -1371,7 +1371,7 @@ void gmx_tng_setup_atom_subgroup(gmx_tng_trajectory_t gmx_tng,
      * other molecules to 0 */
     tng_molecule_cnt_set(tng, mol, 1);
     tng_num_molecule_types_get(tng, &nMols);
-    for (gmx_int64_t k = 0; k < nMols; k++)
+    for (int64_t k = 0; k < nMols; k++)
     {
         tng_molecule_of_index_get(tng, k, &iterMol);
         if (iterMol == mol)
@@ -1394,22 +1394,22 @@ void gmx_tng_setup_atom_subgroup(gmx_tng_trajectory_t gmx_tng,
  * and lose no information. */
 gmx_bool gmx_read_next_tng_frame(gmx_tng_trajectory_t        gmx_tng_input,
                                  t_trxframe                 *fr,
-                                 gmx_int64_t                *requestedIds,
+                                 int64_t                    *requestedIds,
                                  int                         numRequestedIds)
 {
 #if GMX_USE_TNG
     tng_trajectory_t        input = gmx_tng_input->tng;
     gmx_bool                bOK   = TRUE;
     tng_function_status     stat;
-    gmx_int64_t             numberOfAtoms = -1, frameNumber = -1;
-    gmx_int64_t             nBlocks, blockId, *blockIds = nullptr, codecId;
+    int64_t                 numberOfAtoms = -1, frameNumber = -1;
+    int64_t                 nBlocks, blockId, *blockIds = nullptr, codecId;
     char                    datatype      = -1;
     void                   *values        = nullptr;
     double                  frameTime     = -1.0;
     int                     size, blockDependency;
     double                  prec;
     const int               defaultNumIds = 5;
-    static gmx_int64_t      fallbackRequestedIds[defaultNumIds] =
+    static int64_t          fallbackRequestedIds[defaultNumIds] =
     {
         TNG_TRAJ_BOX_SHAPE, TNG_TRAJ_POSITIONS,
         TNG_TRAJ_VELOCITIES, TNG_TRAJ_FORCES,
@@ -1449,7 +1449,7 @@ gmx_bool gmx_read_next_tng_frame(gmx_tng_trajectory_t        gmx_tng_input,
                                                                       &frameNumber,
                                                                       &nBlocks,
                                                                       &blockIds);
-    gmx::unique_cptr<gmx_int64_t, gmx::free_wrapper> blockIdsGuard(blockIds);
+    gmx::unique_cptr<int64_t, gmx::free_wrapper> blockIdsGuard(blockIds);
     if (!nextFrameExists)
     {
         return FALSE;
@@ -1460,7 +1460,7 @@ gmx_bool gmx_read_next_tng_frame(gmx_tng_trajectory_t        gmx_tng_input,
         return FALSE;
     }
 
-    for (gmx_int64_t i = 0; i < nBlocks; i++)
+    for (int64_t i = 0; i < nBlocks; i++)
     {
         blockId = blockIds[i];
         tng_data_block_dependency_get(input, blockId, &blockDependency);
@@ -1497,7 +1497,7 @@ gmx_bool gmx_read_next_tng_frame(gmx_tng_trajectory_t        gmx_tng_input,
                 switch (datatype)
                 {
                     case TNG_INT_DATA:
-                        size = sizeof(gmx_int64_t);
+                        size = sizeof(int64_t);
                         break;
                     case TNG_FLOAT_DATA:
                         size = sizeof(float);
@@ -1609,8 +1609,8 @@ void gmx_print_tng_molecule_system(gmx_tng_trajectory_t gmx_tng_input,
                                    FILE                *stream)
 {
 #if GMX_USE_TNG
-    gmx_int64_t         nMolecules, nChains, nResidues, nAtoms, nFramesRead;
-    gmx_int64_t         strideLength, nParticlesRead, nValuesPerFrameRead, *molCntList;
+    int64_t             nMolecules, nChains, nResidues, nAtoms, nFramesRead;
+    int64_t             strideLength, nParticlesRead, nValuesPerFrameRead, *molCntList;
     tng_molecule_t      molecule;
     tng_chain_t         chain;
     tng_residue_t       residue;
@@ -1629,7 +1629,7 @@ void gmx_print_tng_molecule_system(gmx_tng_trajectory_t gmx_tng_input,
     /* Can the number of particles change in the trajectory or is it constant? */
     tng_num_particles_variable_get(input, &varNAtoms);
 
-    for (gmx_int64_t i = 0; i < nMolecules; i++)
+    for (int64_t i = 0; i < nMolecules; i++)
     {
         tng_molecule_of_index_get(input, i, &molecule);
         tng_molecule_name_get(input, molecule, str, 256);
@@ -1648,19 +1648,19 @@ void gmx_print_tng_molecule_system(gmx_tng_trajectory_t gmx_tng_input,
         tng_molecule_num_chains_get(input, molecule, &nChains);
         if (nChains > 0)
         {
-            for (gmx_int64_t j = 0; j < nChains; j++)
+            for (int64_t j = 0; j < nChains; j++)
             {
                 tng_molecule_chain_of_index_get(input, molecule, j, &chain);
                 tng_chain_name_get(input, chain, str, 256);
                 fprintf(stream, "\tChain: %s\n", str);
                 tng_chain_num_residues_get(input, chain, &nResidues);
-                for (gmx_int64_t k = 0; k < nResidues; k++)
+                for (int64_t k = 0; k < nResidues; k++)
                 {
                     tng_chain_residue_of_index_get(input, chain, k, &residue);
                     tng_residue_name_get(input, residue, str, 256);
                     fprintf(stream, "\t\tResidue: %s\n", str);
                     tng_residue_num_atoms_get(input, residue, &nAtoms);
-                    for (gmx_int64_t l = 0; l < nAtoms; l++)
+                    for (int64_t l = 0; l < nAtoms; l++)
                     {
                         tng_residue_atom_of_index_get(input, residue, l, &atom);
                         tng_atom_name_get(input, atom, str, 256);
@@ -1679,13 +1679,13 @@ void gmx_print_tng_molecule_system(gmx_tng_trajectory_t gmx_tng_input,
             tng_molecule_num_residues_get(input, molecule, &nResidues);
             if (nResidues > 0)
             {
-                for (gmx_int64_t k = 0; k < nResidues; k++)
+                for (int64_t k = 0; k < nResidues; k++)
                 {
                     tng_molecule_residue_of_index_get(input, molecule, k, &residue);
                     tng_residue_name_get(input, residue, str, 256);
                     fprintf(stream, "\t\tResidue: %s\n", str);
                     tng_residue_num_atoms_get(input, residue, &nAtoms);
-                    for (gmx_int64_t l = 0; l < nAtoms; l++)
+                    for (int64_t l = 0; l < nAtoms; l++)
                     {
                         tng_residue_atom_of_index_get(input, residue, l, &atom);
                         tng_atom_name_get(input, atom, str, 256);
@@ -1698,7 +1698,7 @@ void gmx_print_tng_molecule_system(gmx_tng_trajectory_t gmx_tng_input,
             else
             {
                 tng_molecule_num_atoms_get(input, molecule, &nAtoms);
-                for (gmx_int64_t l = 0; l < nAtoms; l++)
+                for (int64_t l = 0; l < nAtoms; l++)
                 {
                     tng_molecule_atom_of_index_get(input, molecule, l, &atom);
                     tng_atom_name_get(input, atom, str, 256);
@@ -1725,10 +1725,10 @@ void gmx_print_tng_molecule_system(gmx_tng_trajectory_t gmx_tng_input,
                                     datatype);
 
         fprintf(stream, "Atom Charges (%d):\n", int(nAtoms));
-        for (gmx_int64_t i = 0; i < nAtoms; i += 10)
+        for (int64_t i = 0; i < nAtoms; i += 10)
         {
             fprintf(stream, "Atom Charges [%8d-]=[", int(i));
-            for (gmx_int64_t j = 0; (j < 10 && i + j < nAtoms); j++)
+            for (int64_t j = 0; (j < 10 && i + j < nAtoms); j++)
             {
                 fprintf(stream, " %12.5e", atomCharges[i + j]);
             }
@@ -1750,10 +1750,10 @@ void gmx_print_tng_molecule_system(gmx_tng_trajectory_t gmx_tng_input,
                                     datatype);
 
         fprintf(stream, "Atom Masses (%d):\n", int(nAtoms));
-        for (gmx_int64_t i = 0; i < nAtoms; i += 10)
+        for (int64_t i = 0; i < nAtoms; i += 10)
         {
             fprintf(stream, "Atom Masses [%8d-]=[", int(i));
-            for (gmx_int64_t j = 0; (j < 10 && i + j < nAtoms); j++)
+            for (int64_t j = 0; (j < 10 && i + j < nAtoms); j++)
             {
                 fprintf(stream, " %12.5e", atomMasses[i + j]);
             }
@@ -1771,10 +1771,10 @@ void gmx_print_tng_molecule_system(gmx_tng_trajectory_t gmx_tng_input,
 gmx_bool gmx_get_tng_data_block_types_of_next_frame(gmx_tng_trajectory_t gmx_tng_input,
                                                     int                  frame,
                                                     int                  nRequestedIds,
-                                                    gmx_int64_t         *requestedIds,
-                                                    gmx_int64_t         *nextFrame,
-                                                    gmx_int64_t         *nBlocks,
-                                                    gmx_int64_t        **blockIds)
+                                                    int64_t             *requestedIds,
+                                                    int64_t             *nextFrame,
+                                                    int64_t             *nBlocks,
+                                                    int64_t            **blockIds)
 {
 #if GMX_USE_TNG
     tng_function_status stat;
@@ -1807,12 +1807,12 @@ gmx_bool gmx_get_tng_data_block_types_of_next_frame(gmx_tng_trajectory_t gmx_tng
 }
 
 gmx_bool gmx_get_tng_data_next_frame_of_block_type(gmx_tng_trajectory_t gmx_tng_input,
-                                                   gmx_int64_t          blockId,
+                                                   int64_t              blockId,
                                                    real               **values,
-                                                   gmx_int64_t         *frameNumber,
+                                                   int64_t             *frameNumber,
                                                    double              *frameTime,
-                                                   gmx_int64_t         *nValuesPerFrame,
-                                                   gmx_int64_t         *nAtoms,
+                                                   int64_t             *nValuesPerFrame,
+                                                   int64_t             *nAtoms,
                                                    real                *prec,
                                                    char                *name,
                                                    int                  maxLen,
@@ -1821,7 +1821,7 @@ gmx_bool gmx_get_tng_data_next_frame_of_block_type(gmx_tng_trajectory_t gmx_tng_
 #if GMX_USE_TNG
     tng_function_status stat;
     char                datatype = -1;
-    gmx_int64_t         codecId;
+    int64_t             codecId;
     int                 blockDependency;
     void               *data = nullptr;
     double              localPrec;