Commit a6e80e3a authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Implement MPI send/receive functions for ClusterOutputInfo

parent c2c6d9dd
Loading
Loading
Loading
Loading
+28 −9
Original line number Diff line number Diff line
@@ -21,15 +21,6 @@
#ifndef INCLUDE_OUTPUTS_H_
#define INCLUDE_OUTPUTS_H_

//! \brief General output type identifier.
#define OUT_GNRL 0
//! \brief Cluster output type identifier.
#define OUT_CLST 1
//! \brief Inclusion output type identifier.
#define OUT_INCL 2
//! \brief Single sphere output type identifier.
#define OUT_SPHR 3

/*! \brief Class to collect output information for scattering from clusters.
 *
 * The results of the calculation can be saved in different formats.
@@ -504,5 +495,33 @@ public:
   * \return result: `int` Exit code (0 if successful).
   */
  int write(const std::string &output, const std::string &format);

#ifdef MPI_VERSION
  /*! \brief Receive output data from worker processes.
   *
   * This function is invoked by the MPI rank-0 process to fetch the
   * output data produced by higher rank processes. When calling this
   * function, process 0 halts until a valid data chunk is transmitted
   * by the queried process.
   *
   * \param mpidata: `const mixMPI*` Pointer to a `mixMPI` instance.
   * \param pid: `int` Rank of the process that is transmitting data.
   * \return result: `int` An exit code (0 for success).
   */
  int mpireceive(const mixMPI* mpidata, int pid);

  /*! \brief Send output data to process 0.
   *
   * This function is invoked by non-zero ranked MPI processes when
   * they are ready to send back the output data. When a process meets
   * this function call, it halts until MPI process 0 asks for the
   * data transmission.
   *
   * \param mpidata: `const mixMPI*` Pointer to a `mixMPI` instance.
   * \param pid: `int` Rank of the process that is transmitting data.
   * \return result: `int` An exit code (0 for success).
   */
  int mpisend(const mixMPI *mpidata);
#endif // MPI_VERSION
};
#endif // INCLUDE_OUTPUTS_H_
+396 −0

File changed.

Preview size limit exceeded, changes collapsed.