source: src/Parameters/Specifics/Parameter_vector.hpp@ f79d65

Action_Thermostats Add_AtomRandomPerturbation Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.1 ChangeBugEmailaddress ChemicalSpaceEvaluator EmpiricalPotential_contain_HomologyGraph_documentation Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph Fix_Verbose_Codepatterns ForceAnnealing_oldresults ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks StoppableMakroAction TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps
Last change on this file since f79d65 was 2eded3e, checked in by Frederik Heber <frederik.heber@…>, 8 years ago

Added specific Value and Parameter implemenations for Vector.

  • for the CommandLineParser the values are get parsed immediately (prior to executing any Action). Hence, names of geometry objects that first need to be created by an action cannot yet be present in the registry and thus the Action will fail.
  • we need to postpone the replacement of the geometry name by its stored vector components until the Parameter<>::get() call. This is possible as the value is validated only on get(), not on set(), i.e. giving illegal values is ok, only the Action will fail.
  • therefore, we override the specialize the template Value for Vector to allow storing of a string instead of a Vector and to allow putting the actual parsing of the string in front.
  • the Parameter overriding becomes necessary in order to override clone() and copy cstor(), there using string setters.
  • ContinuousValueTest now needs lib..Parameters, lib..Geometry.
  • static functions parseAsVector and setFromVector for convenience, e.g. QtUI needs to convert from string and to Vector.
  • TESTS: Marked dryrun store-session again as XFAIL, removed XFAIL from load- session python.
  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 * Parameter_vector.hpp
3 *
4 * Created on: Mar 31, 2017
5 * Author: heber
6 */
7
8
9#ifndef PARAMETERS_SPECIFICS_PARAMETER_VECTOR_HPP_
10#define PARAMETERS_SPECIFICS_PARAMETER_VECTOR_HPP_
11
12// include config.h
13#ifdef HAVE_CONFIG_H
14#include <config.h>
15#endif
16
17#include "LinearAlgebra/Vector.hpp"
18
19#include "Parameters/Parameter.hpp"
20
21template <>
22class Parameter<Vector> :
23 public ParameterInterface,
24 public ValueInterface<Vector>
25{
26public:
27 Parameter(const Parameter<Vector> &instance);
28 Parameter(const std::string &_name);
29 Parameter(const std::string &_name, const Vector &_value);
30 Parameter(const std::string &_name, const Validator<Vector> &_Validator);
31 Parameter(const std::string &_name, const Validator<Vector> &_Validator, const Vector &_value);
32 Parameter(const std::string &_name, const std::vector<Vector> &_ValidValues);
33 Parameter(const std::string &_name, const std::vector<Vector> &_ValidValues, const Vector &_value);
34 Parameter(const std::string &_name, const range<Vector> &_ValidRange);
35 Parameter(const std::string &_name, const range<Vector> &_ValidRange, const Vector &_value);
36 virtual ~Parameter();
37
38 // wrap the following functions from ValueAsString to add exception information
39 bool isValidAsString(const std::string &_value) const throw(ParameterValidatorException);
40 const std::string getAsString() const throw(ParameterValueException);
41 const std::string getAsStringUnvalidated() const throw(ParameterValueException);
42 void setAsString(const std::string &_value) throw(ParameterValueException);
43
44 // wrap the following functions from Value<Vector> to add exception information
45 bool isValid(const Vector &_value) const throw(ParameterValidatorException);
46 const Vector & get() const throw(ParameterValueException);
47 const Vector & getUnvalidated() const throw(ParameterValueException);
48 void set(const Vector & _value) throw(ParameterValueException);
49 bool isSet() const
50 { return value.isSet(); }
51
52 const Validator<Vector> & getValidator() const
53 { return value.getValidator(); }
54 Validator<Vector> & getValidator()
55 { return value.getValidator(); }
56
57 // comparator
58 bool operator==(const Parameter<Vector> &_instance) const throw(ParameterException);
59 bool operator!=(const Parameter<Vector> &_instance) const throw(ParameterException)
60 { return !((*this)==(_instance)); }
61
62 ParameterInterface* clone() const;
63
64//private: // TODO...
65 Parameter();
66
67private:
68 //!> contained value of this parameter
69 Value<Vector> value;
70};
71
72
73#endif /* PARAMETERS_SPECIFICS_PARAMETER_VECTOR_HPP_ */
Note: See TracBrowser for help on using the repository browser.