Changeset 4266eb
- Timestamp:
- Oct 3, 2016, 5:19:53 PM (9 years ago)
- Branches:
- Fix_FitPotential_needs_atomicnumbers
- Children:
- 96af51
- Parents:
- 6d08032
- Location:
- src
- Files:
-
- 1 added
- 1 deleted
- 2 edited
- 4 moved
-
FunctionApproximation/FunctionArgument.hpp (modified) (7 diffs)
-
FunctionApproximation/Subgraph/PotentialSubgraph.hpp (moved) (moved from src/Potentials/Subgraph/PotentialSubgraph.hpp )
-
FunctionApproximation/Subgraph/SubgraphEdge.hpp (moved) (moved from src/Potentials/Subgraph/SubgraphEdge.hpp ) (4 diffs)
-
FunctionApproximation/Subgraph/unittests/Makefile.am (added)
-
FunctionApproximation/Subgraph/unittests/SubgraphEdgeUnitTest.cpp (moved) (moved from src/Potentials/Subgraph/unittests/SubgraphEdgeUnitTest.cpp ) (2 diffs)
-
FunctionApproximation/Subgraph/unittests/SubgraphEdgeUnitTest.hpp (moved) (moved from src/Potentials/Subgraph/unittests/SubgraphEdgeUnitTest.hpp )
-
Potentials/Subgraph/unittests/Makefile.am (deleted)
-
unittests/Makefile.am (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/FunctionApproximation/FunctionArgument.hpp
r6d08032 r4266eb 17 17 #include <iosfwd> 18 18 19 #include "FunctionApproximation/Subgraph/SubgraphEdge.hpp" 20 19 21 /** This class encapsulates all information with respect to a single argument 20 22 * for a high-dimensional model function. … … 25 27 * 26 28 */ 27 struct argument_t 29 struct argument_t : public SubgraphEdge 28 30 { 29 31 //!> grant operator access to private parts 30 32 friend std::ostream& operator<<(std::ostream &ost, const argument_t &arg); 31 32 //!> typedef for the two indices of the argument33 typedef std::pair<size_t, size_t> indices_t;34 //!> typedef for the underlying type of the particle35 typedef unsigned int ParticleType_t;36 //!> typedef for the two particle types of the argument37 typedef std::pair<ParticleType_t, ParticleType_t> types_t;38 33 39 34 /** Default constructor for class argument_t. … … 41 36 */ 42 37 argument_t() : 43 indices( std::make_pair(0,1) ),44 types( std::make_pair(0,0) ),45 38 distance(0.), 46 39 globalid(-1) … … 54 47 */ 55 48 argument_t(const double &_distance) : 56 indices( std::make_pair(0,1) ), 57 types( std::make_pair(0,0) ), 49 SubgraphEdge( 50 indices_t( std::make_pair(0,1) ), 51 types_t( std::make_pair(0,0) )), 58 52 distance(_distance), 59 53 globalid(-1) … … 66 60 */ 67 61 argument_t(const indices_t &_indices, const double &_distance) : 68 indices( _indices ), 69 types( std::make_pair(0,0) ), 62 SubgraphEdge( 63 indices, 64 types_t( std::make_pair(0,0) )), 70 65 distance(_distance), 71 66 globalid(-1) … … 79 74 */ 80 75 argument_t(const indices_t &_indices, const types_t &_types, const double &_distance) : 81 indices( _indices ), 82 types( _types ), 76 SubgraphEdge(_indices, _types), 83 77 distance(_distance), 84 78 globalid(-1) … … 106 100 * \return true - first type is less or if equal, second type is less, else 107 101 */ 108 bool static TypeComparator(const argument_t &one, const argument_t &other)102 bool static IndexComparator(const argument_t &one, const argument_t &other) 109 103 { 110 if (one.types.first < other.types.first) 111 return true; 112 else if (one.types.first > other.types.first) 113 return false; 114 else 115 return one.types.second < other.types.second; 104 return (static_cast<const SubgraphEdge &>(one) < static_cast<const SubgraphEdge &>(other)); 116 105 } 117 106 118 /** Comparator with respect to the pair of indices.119 *120 * \note We'll have this as static function to allow usage in e.g. STL's sort.121 *122 * \param one first argument123 * \param other other argument to compare to \a one to124 * \return true - first index is less or if equal, second index is less, else125 */126 bool static IndexComparator(const argument_t &one, const argument_t &other)127 {128 if (one.indices.first < other.indices.first)129 return true;130 else if (one.indices.first > other.indices.first)131 return false;132 else133 return one.indices.second < other.indices.second;134 }135 136 /** Less comparator for FunctionArgument.137 *138 * @param other other argument to compare to139 * @return true - this argument is less than \a other, false - else140 */141 bool operator<(const argument_t &other) const142 {143 if (types.first < other.types.first)144 return true;145 else if (types.first > other.types.first)146 return false;147 else if (types.second < other.types.second)148 return true;149 else if (types.second > other.types.second)150 return false;151 else {152 if (indices.first < other.indices.first)153 return true;154 else if (indices.first > other.indices.first)155 return false;156 else157 return indices.second < other.indices.second;158 }159 }160 161 /** Equality operator for FunctionArgument.162 *163 * \note This compares only types and indices.164 *165 * @param other other argument to compare to166 * @return true - this argument is equal to \a other, false - else167 */168 bool operator==(const argument_t &other) const169 {170 if (types.first != other.types.first)171 return false;172 else if (types.second != other.types.second)173 return false;174 if (indices.first != other.indices.first)175 return false;176 else if (indices.second != other.indices.second)177 return false;178 else179 return true;180 }181 182 //!> indices between which the distance is given183 indices_t indices;184 //!> indices between which the distance is given185 types_t types;186 107 //!> distance 187 108 double distance; -
src/FunctionApproximation/Subgraph/SubgraphEdge.hpp
r6d08032 r4266eb 7 7 8 8 9 #ifndef POTENTIALS_SUBGRAPH_SUBGRAPHEDGE_HPP_10 #define POTENTIALS_SUBGRAPH_SUBGRAPHEDGE_HPP_9 #ifndef FUNCTIONAPPROXIMATION_SUBGRAPH_SUBGRAPHEDGE_HPP_ 10 #define FUNCTIONAPPROXIMATION_SUBGRAPH_SUBGRAPHEDGE_HPP_ 11 11 12 12 // include config.h … … 18 18 * 19 19 * Each edge contains two indices and two types. 20 *21 * \sa argument_t22 20 */ 23 21 class SubgraphEdge … … 116 114 } 117 115 118 pr ivate:116 protected: 119 117 120 118 //!> indices between which the distance is given … … 125 123 126 124 127 #endif /* POTENTIALS_SUBGRAPH_SUBGRAPHEDGE_HPP_ */125 #endif /* FUNCTIONAPPROXIMATION_SUBGRAPH_SUBGRAPHEDGE_HPP_ */ -
src/FunctionApproximation/Subgraph/unittests/SubgraphEdgeUnitTest.cpp
r6d08032 r4266eb 39 39 #include <cppunit/ui/text/TestRunner.h> 40 40 41 #include " SubgraphEdgeUnitTest.hpp"41 #include "../../../FunctionApproximation/Subgraph/unittests/SubgraphEdgeUnitTest.hpp" 42 42 43 43 #include <boost/assign.hpp> … … 45 45 #include "CodePatterns/Assert.hpp" 46 46 47 #include " Potentials/Subgraph/SubgraphEdge.hpp"47 #include "../../../FunctionApproximation/Subgraph/SubgraphEdge.hpp" 48 48 49 49 using namespace boost::assign; -
src/unittests/Makefile.am
r6d08032 r4266eb 20 20 include ../../src/Filling/unittests/Makefile.am 21 21 include ../../src/FunctionApproximation/unittests/Makefile.am 22 include ../../src/FunctionApproximation/Subgraph/unittests/Makefile.am 22 23 include ../../src/Fragmentation/unittests/Makefile.am 23 24 include ../../src/Fragmentation/Exporters/unittests/Makefile.am … … 37 38 include ../../src/Potentials/unittests/Makefile.am 38 39 include ../../src/Potentials/Specifics/unittests/Makefile.am 39 include ../../src/Potentials/Subgraph/unittests/Makefile.am40 40 include ../../src/RandomNumbers/unittests/Makefile.am 41 41 include ../../src/Shapes/unittests/Makefile.am
Note:
See TracChangeset
for help on using the changeset viewer.
