Changeset 928f65


Ignore:
Timestamp:
May 18, 2016, 10:04:49 PM (9 years ago)
Author:
Frederik Heber <heber@…>
Branches:
CombiningParticlePotentialParsing
Children:
52b5ca
Parents:
9bb977
git-author:
Frederik Heber <heber@…> (03/10/16 11:52:01)
git-committer:
Frederik Heber <heber@…> (05/18/16 22:04:49)
Message:

SavePotentialsAction writes both Particles and EmpiricalPotentials.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/PotentialAction/SavePotentialsAction.cpp

    r9bb977 r928f65  
    5050#include "Potentials/Exceptions.hpp"
    5151#include "Potentials/RegistrySerializer.hpp"
     52#include "Potentials/Particles/Particle.hpp"
     53#include "Potentials/Particles/ParticleRegistry.hpp"
    5254#include "Potentials/PotentialRegistry.hpp"
    5355
     
    6365  // store the potentials
    6466  if (!params.potential_file.get().string().empty()) {
    65     // print fitted potentials
    66     std::stringstream potentials;
    67     RegistrySerializer<EmpiricalPotential> serialize(
    68         potentials,
    69         PotentialRegistry::getInstance(),
    70         std::string("potential"));
    71     serialize();
    72     LOG(1, "STATUS: Resulting parameters are " << std::endl << potentials.str());
    7367    std::ofstream returnstream(params.potential_file.get().string().c_str());
    7468    if (returnstream.good()) {
     69      // print particles
     70      std::stringstream particles;
     71      RegistrySerializer<Particle> serialize(
     72          particles,
     73          ParticleRegistry::getInstance(),
     74          std::string("particle"));
     75      serialize();
     76      LOG(1, "STATUS: Resulting particles are " << std::endl << particles.str());
     77      returnstream << particles.str();
     78    } else {
     79      STATUS("Could not open stream to write particles!");
     80      return Action::failure;
     81    }
     82    if (returnstream.good()) {
     83      // print fitted potentials
     84      std::stringstream potentials;
     85      RegistrySerializer<EmpiricalPotential> serialize(
     86          potentials,
     87          PotentialRegistry::getInstance(),
     88          std::string("potential"));
     89      serialize();
     90      LOG(1, "STATUS: Resulting parameters are " << std::endl << potentials.str());
    7591      returnstream << potentials.str();
    7692    } else {
     
    7995    }
    8096  } else {
    81     STATUS("No existing potential file given!");
     97    STATUS("No usable potential filename given!");
    8298    return Action::failure;
    8399  }
Note: See TracChangeset for help on using the changeset viewer.