+/*! \brief
+ * Wraps reading of header before and after introduction of size field.
+ *
+ * \param[in] tpx The file header.
+ * \param[in] serializer The Serialization interface used to read the TPR.
+ * \param[in] isDouble Whether the file is double or single precision.
+ * \param[out] ir Input rec to populate.
+ * \param[out] state State vectors to populate.
+ * \param[out] x Coordinates to populate if needed.
+ * \param[out] v Velocities to populate if needed.
+ * \param[out] mtop Global topology to populate.
+ *
+ * \returns Flag for pbc.
+ */
+static int do_tpx_body_dispatcher(TpxFileHeader *tpx,
+ gmx::ISerializer *serializer,
+ bool isDouble,
+ t_inputrec *ir,
+ t_state *state,
+ rvec *x, rvec *v,
+ gmx_mtop_t *mtop)
+{
+ int ePBC;
+ if (tpx->fileVersion >= tpxv_AddSizeField && tpx->fileGeneration >= 27)
+ {
+ std::vector<char> tprBody(tpx->sizeOfTprBody);
+ doTpxBodyBuffer(serializer, tprBody);
+ gmx::InMemoryDeserializer tprBodyDeserializer(tprBody, isDouble);
+
+ ePBC = do_tpx_body(&tprBodyDeserializer,
+ tpx,
+ ir,
+ state,
+ x,
+ v,
+ mtop);
+ }
+ else
+ {
+ ePBC = do_tpx_body(serializer,
+ tpx,
+ ir,
+ state,
+ x,
+ v,
+ mtop);
+ }
+ return ePBC;
+}
+
+