Commit 8d641acb authored by gbalduzz's avatar gbalduzz
Browse files

removed json output.

parent 1b49696f
Loading
Loading
Loading
Loading
+6 −23
Original line number Diff line number Diff line
@@ -121,23 +121,10 @@ BseSolver<ParametersType, DcaDataType>::BseSolver(ParametersType& parameters, Dc

template <typename ParametersType, typename DcaDataType>
void BseSolver<ParametersType, DcaDataType>::write() {
  const std::string& output_format = parameters_.get_output_format();
  const std::string& file_name = parameters_.get_directory() + parameters_.get_filename_analysis();

  std::cout << "Start writing " << file_name << "." << std::endl;

  if (output_format == "JSON") {
    dca::io::JSONWriter writer;
    writer.open_file(file_name);

    parameters_.write(writer);
    // dca_data_.write(writer);
    this->write(writer);

    writer.close_file();
  }

  else if (output_format == "HDF5") {
  dca::io::HDF5Writer writer;
  writer.open_file(file_name);

@@ -148,10 +135,6 @@ void BseSolver<ParametersType, DcaDataType>::write() {
  writer.close_file();
}

  else
    throw std::logic_error(__FUNCTION__);
}

template <typename ParametersType, typename DcaDataType>
template <typename Writer>
void BseSolver<ParametersType, DcaDataType>::write(Writer& writer) {
+4 −18
Original line number Diff line number Diff line
@@ -314,26 +314,12 @@ void DcaData<Parameters>::read(std::string filename) {
    std::cout << "\n\n\t starts reading \n\n";

  if (concurrency_.id() == concurrency_.first()) {
    const std::string& output_format = parameters_.get_output_format();

    if (output_format == static_cast<const std::string>("JSON")) {
      dca::io::JSONReader reader;
      reader.open_file(filename);
      this->read(reader);
      reader.close_file();
    }

    else if (output_format == static_cast<const std::string>("HDF5")) {
    dca::io::HDF5Reader reader;
    reader.open_file(filename);
    this->read(reader);
    reader.close_file();
  }

    else
      throw std::logic_error(__FUNCTION__);
  }

  concurrency_.broadcast(parameters_.get_chemical_potential());

  concurrency_.broadcast_object(Sigma);
+0 −10
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ class OutputParameters {
public:
  OutputParameters()
      : directory_("./"),
        output_format_("HDF5"),
        filename_dca_("dca.hdf5"),
        directory_config_read_(""),
        directory_config_write_(""),
@@ -55,10 +54,6 @@ public:
  bool autoresume() const {
      return autoresume_;
  }

  const std::string& get_output_format() const {
    return output_format_;
  }
  const std::string& get_directory_config_read() const {
    return directory_config_read_;
  }
@@ -96,7 +91,6 @@ public:
private:
  std::string directory_;
  bool autoresume_ = false;
  std::string output_format_;
  std::string filename_dca_;
  std::string directory_config_read_;
  std::string directory_config_write_;
@@ -116,7 +110,6 @@ int OutputParameters::getBufferSize(const Concurrency& concurrency) const {

  buffer_size += concurrency.get_buffer_size(directory_);
  buffer_size += concurrency.get_buffer_size(autoresume_);
  buffer_size += concurrency.get_buffer_size(output_format_);
  buffer_size += concurrency.get_buffer_size(filename_dca_);
  buffer_size += concurrency.get_buffer_size(directory_config_read_);
  buffer_size += concurrency.get_buffer_size(directory_config_write_);
@@ -137,7 +130,6 @@ void OutputParameters::pack(const Concurrency& concurrency, char* buffer, int bu
                            int& position) const {
  concurrency.pack(buffer, buffer_size, position, directory_);
  concurrency.pack(buffer, buffer_size, position, autoresume_);
  concurrency.pack(buffer, buffer_size, position, output_format_);
  concurrency.pack(buffer, buffer_size, position, filename_dca_);
  concurrency.pack(buffer, buffer_size, position, directory_config_read_);
  concurrency.pack(buffer, buffer_size, position, directory_config_write_);
@@ -156,7 +148,6 @@ void OutputParameters::unpack(const Concurrency& concurrency, char* buffer, int
                              int& position) {
  concurrency.unpack(buffer, buffer_size, position, directory_);
  concurrency.unpack(buffer, buffer_size, position, autoresume_);
  concurrency.unpack(buffer, buffer_size, position, output_format_);
  concurrency.unpack(buffer, buffer_size, position, filename_dca_);
  concurrency.unpack(buffer, buffer_size, position, directory_config_read_);
  concurrency.unpack(buffer, buffer_size, position, directory_config_write_);
@@ -185,7 +176,6 @@ void OutputParameters::readWrite(ReaderOrWriter& reader_or_writer) {

    try_to_read_or_write("directory", directory_);
    try_to_read_or_write("autoresume", autoresume_);
    try_to_read_or_write("output-format", output_format_);
    try_to_read_or_write("filename-dca", filename_dca_);
    try_to_read_or_write("directory-config-read", directory_config_read_);
    try_to_read_or_write("directory-config-write", directory_config_write_);
+1 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ TEST(AnalysisDCAParticleParticleUpDownFullTest, LeadingEigenvalues) {
  dca_data.read(static_cast<std::string>(DCA_SOURCE_DIR "/test/system-level/analysis/dca_tp.hdf5"));

  BseSolverType bse_solver(parameters, dca_data);

  bse_solver.calculateSusceptibilities();

  std::cout << "\nChecking data.\n" << std::endl;