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

Use SphereOutputInfo and implement wavelength parallelism in np_sphere

parent 1a5fc963
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -5522,6 +5522,7 @@ int SphereOutputInfo::write_hdf5(const std::string &file_name) {
int SphereOutputInfo::write_legacy(const std::string &file_name) {
  const dcomplex cc0 = 0.0 + I * 0.0;
  int result = 0;
  int nks = _num_thetas * _num_phis;
  FILE *p_outfile = fopen(file_name.c_str(), "w");
  if (p_outfile != NULL) {
    if (vec_jxi[0] == 1) {
@@ -5629,7 +5630,7 @@ int SphereOutputInfo::write_legacy(const std::string &file_name) {
	  for (int jths = 0; jths < _num_thetas; jths++) {
	    for (int jphs = 0; jphs < _num_phis; jphs++) {
	      int dir_index = ndirs * jxi + done_dirs;
	      bool goto190 = (done_dirs == 0) && ((jxi > 0) || (jth > 0) || (jph > 0));
	      bool goto190 = (nks == 1) && ((jxi > 0) || (jth > 0) || (jph > 0));
	      fprintf(
		p_outfile, "********** JTH =%3d, JPH =%3d, JTHS =%3d, JPHS =%3d ********************\n",
		jth + 1, jph + 1, jths + 1, jphs + 1
+26 −3
Original line number Diff line number Diff line
@@ -34,6 +34,12 @@
#include <cstdio>
#include <string>

#ifdef USE_MPI
#ifndef MPI_VERSION
#include <mpi.h>
#endif
#endif

#ifndef INCLUDE_TYPES_H_
#include "../include/types.h"
#endif
@@ -42,9 +48,13 @@
#include "../include/Configuration.h"
#endif

#ifndef INCLUDE_COMMONS_H_
#include "../include/Commons.h"
#endif

using namespace std;

extern void sphere(const string& config_file, const string& data_file, const string& output_path);
extern void sphere(const string& config_file, const string& data_file, const string& output_path, const mixMPI *mpidata);

/*! \brief Main program entry point.
 *
@@ -59,6 +69,15 @@ extern void sphere(const string& config_file, const string& data_file, const str
 * \return result: `int` An exit code passed to the OS (0 for succesful execution).
 */
int main(int argc, char **argv) {
  int ierr = 0;
#ifdef MPI_VERSION
  ierr = MPI_Init(&argc, &argv);
  // create and initialise class with essential MPI data
  mixMPI *mpidata = new mixMPI(MPI_COMM_WORLD);
#else
  // create a the class with dummy data if we are not using MPI at all
  mixMPI *mpidata = new mixMPI();
#endif
  string config_file = "../../test_data/sphere/DEDFB";
  string data_file = "../../test_data/sphere/DSPH";
  string output_path = ".";
@@ -67,6 +86,10 @@ int main(int argc, char **argv) {
    data_file = string(argv[2]);
    output_path = string(argv[3]);
  }
  sphere(config_file, data_file, output_path);
  return 0;
  sphere(config_file, data_file, output_path, mpidata);
#ifdef MPI_VERSION
  MPI_Finalize();
#endif
  delete mpidata;
  return ierr;
}
+1127 −550

File changed.

Preview size limit exceeded, changes collapsed.