source: src/FunctionApproximation/FunctionArgument.hpp@ 36f3d3

Fix_FitPotential_needs_atomicnumbers
Last change on this file since 36f3d3 was 4266eb, checked in by Frederik Heber <heber@…>, 9 years ago

Moved SubgraphEdge over to FunctionApproximation and derived argument_t from it.

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 * FunctionArgument.hpp
3 *
4 * Created on: 02.10.2012
5 * Author: heber
6 */
7
8#ifndef FUNCTIONARGUMENT_HPP_
9#define FUNCTIONARGUMENT_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include <utility>
17#include <iosfwd>
18
19#include "FunctionApproximation/Subgraph/SubgraphEdge.hpp"
20
21/** This class encapsulates all information with respect to a single argument
22 * for a high-dimensional model function.
23 *
24 * We restrict ourselves here to a function that dependent on a set of
25 * three-dimensional vectors, i.e. a set of positions in space. And for
26 * the moment to distances in between these sets.
27 *
28 */
29struct argument_t : public SubgraphEdge
30{
31 //!> grant operator access to private parts
32 friend std::ostream& operator<<(std::ostream &ost, const argument_t &arg);
33
34 /** Default constructor for class argument_t.
35 *
36 */
37 argument_t() :
38 distance(0.),
39 globalid(-1)
40 {}
41
42 /** Constructor for class argument_t.
43 *
44 * This constructors uses the index pair (0,1) as default.
45 *
46 * \param _distance distance argument
47 */
48 argument_t(const double &_distance) :
49 SubgraphEdge(
50 indices_t( std::make_pair(0,1) ),
51 types_t( std::make_pair(0,0) )),
52 distance(_distance),
53 globalid(-1)
54 {}
55
56 /** Constructor for class argument_t.
57 *
58 * \param _indices pair of indices associated with the \a _distance
59 * \param _distance distance argument
60 */
61 argument_t(const indices_t &_indices, const double &_distance) :
62 SubgraphEdge(
63 indices,
64 types_t( std::make_pair(0,0) )),
65 distance(_distance),
66 globalid(-1)
67 {}
68
69 /** Constructor for class argument_t.
70 *
71 * \param _indices pair of indices associated with the \a _distance
72 * \param _types pair of particle type
73 * \param _distance distance argument
74 */
75 argument_t(const indices_t &_indices, const types_t &_types, const double &_distance) :
76 SubgraphEdge(_indices, _types),
77 distance(_distance),
78 globalid(-1)
79 {}
80
81 /** Comparator with respect to the distance.
82 *
83 * \note We'll have this as static function to allow usage in e.g. STL's sort.
84 *
85 * \param one first argument
86 * \param other other argument to compare to \a one to
87 * \return true - first distance is less
88 */
89 static bool DistanceComparator(const argument_t &one, const argument_t &other)
90 {
91 return one.distance < other.distance;
92 }
93
94 /** Comparator with respect to the pair of types.
95 *
96 * \note We'll have this as static function to allow usage in e.g. STL's sort.
97 *
98 * \param one first argument
99 * \param other other argument to compare to \a one to
100 * \return true - first type is less or if equal, second type is less, else
101 */
102 bool static IndexComparator(const argument_t &one, const argument_t &other)
103 {
104 return (static_cast<const SubgraphEdge &>(one) < static_cast<const SubgraphEdge &>(other));
105 }
106
107 //!> distance
108 double distance;
109 //!> global id refers to some global index, e.g. the configuration id in training set
110 size_t globalid;
111};
112
113/** Print given \a arg to stream \a ost.
114 *
115 * \param ost output stream to print to
116 * \param arg argument to print
117 * \return output stream for concatenation
118 */
119std::ostream& operator<<(std::ostream &ost, const argument_t &arg);
120
121
122#endif /* FUNCTIONARGUMENT_HPP_ */
Note: See TracBrowser for help on using the repository browser.