source: src/Potentials/StreamFactory_EmpiricalPotential.hpp@ 20fc6f

Candidate_v1.7.0 stable
Last change on this file since 20fc6f was c98620, checked in by Frederik Heber <frederik.heber@…>, 4 years ago

FIX: StreamFactory did not set BindingModel.

  • we streamed into a default potential instance but this does not set the BindingModel. Now, we use the particle types from that deseralized instance and instantiate a new potential that then also generates the BindingModel.
  • added output operator to BindingModel.
  • TEST: This fixes the fit-compound-potential regression test case.
  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 * StreamFactory_EmpiricalPotential.hpp
3 *
4 * Created on: Feb 28, 2016
5 * Author: heber
6 */
7
8
9#ifndef STREAMFACTORY_EMPIRICALPOTENTIAL_HPP_
10#define STREAMFACTORY_EMPIRICALPOTENTIAL_HPP_
11
12// include config.h
13#ifdef HAVE_CONFIG_H
14#include <config.h>
15#endif
16
17#include "StreamFactory.hpp"
18
19#include <string>
20
21#include "Potentials/EmpiricalPotential.hpp"
22
23/** This implements the StreamFactory (template) interface for EmpiricalPotentials.
24 *
25 * This has to be inherited by a higher class that may actually instantiate
26 * default constructed potentials, i.e. who is friend with EmpiricalPotential.
27 */
28template <>
29struct StreamFactory<EmpiricalPotential>
30{
31 /** Destructor of class StreamFactory<EmpiricalPotential>.
32 *
33 */
34 virtual ~StreamFactory<EmpiricalPotential>();
35
36 /** Creates an instance of the requested potential.
37 *
38 * \param potentialtype key of potential to create
39 * \param serialized stream to parser SerializablePotential from
40 */
41 EmpiricalPotential *createInstance(
42 const std::string &potentialtype,
43 std::istream &serialized) const;
44
45private:
46
47 /** Getter for a default constructed potential.
48 *
49 * This has to be implemented in inheriting factory class.
50 */
51 virtual EmpiricalPotential* getDefaultPotential(const std::string &_name) const=0;
52
53 virtual EmpiricalPotential *createInstance(
54 const std::string &potentialtype,
55 const SerializablePotential::ParticleTypes_t &charges) const=0;
56
57};
58
59#endif /* STREAMFACTORY_EMPIRICALPOTENTIAL_HPP_ */
Note: See TracBrowser for help on using the repository browser.