| 1 | /*
|
|---|
| 2 | * Extractors.hpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: 15.10.2012
|
|---|
| 5 | * Author: heber
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #ifndef TRAININGDATA_EXTRACTORS_HPP_
|
|---|
| 9 | #define TRAININGDATA_EXTRACTORS_HPP_
|
|---|
| 10 |
|
|---|
| 11 | // include config.h
|
|---|
| 12 | #ifdef HAVE_CONFIG_H
|
|---|
| 13 | #include <config.h>
|
|---|
| 14 | #endif
|
|---|
| 15 |
|
|---|
| 16 | #include "Fragmentation/SetValues/Fragment.hpp"
|
|---|
| 17 | #include "FunctionApproximation/FunctionModel.hpp"
|
|---|
| 18 |
|
|---|
| 19 | class Fragment;
|
|---|
| 20 |
|
|---|
| 21 | /** Namespace containing all simple extractor functions.
|
|---|
| 22 | *
|
|---|
| 23 | */
|
|---|
| 24 | namespace Extractors {
|
|---|
| 25 | typedef Fragment::charges_t::const_iterator chargeiter_t;
|
|---|
| 26 | typedef std::vector<chargeiter_t> chargeiters_t;
|
|---|
| 27 |
|
|---|
| 28 | typedef size_t count_t;
|
|---|
| 29 | typedef Fragment::charge_t element_t;
|
|---|
| 30 | typedef std::map< element_t, count_t> elementcounts_t;
|
|---|
| 31 | typedef std::map< element_t, chargeiters_t > elementtargets_t;
|
|---|
| 32 |
|
|---|
| 33 | /** Namespace for some internal helper functions.
|
|---|
| 34 | *
|
|---|
| 35 | */
|
|---|
| 36 | namespace _detail {
|
|---|
| 37 | /** Gather all distances from a given set of positions.
|
|---|
| 38 | *
|
|---|
| 39 | * \param positins vector of positions
|
|---|
| 40 | * \param globalid index to associated in argument_t with
|
|---|
| 41 | * \return vector of argument_ , each with a distance
|
|---|
| 42 | */
|
|---|
| 43 | FunctionModel::arguments_t
|
|---|
| 44 | gatherAllDistanceArguments(
|
|---|
| 45 | const Fragment::positions_t &positions,
|
|---|
| 46 | const size_t globalid);
|
|---|
| 47 |
|
|---|
| 48 | /** Gather all positions from the same aligned vector of charges.
|
|---|
| 49 | *
|
|---|
| 50 | * Basically, we filter the positions indicated by the targets but
|
|---|
| 51 | * from a different vector that has the same layout.
|
|---|
| 52 | *
|
|---|
| 53 | * \param positions positions to search
|
|---|
| 54 | * \param charges charges to match with \targets
|
|---|
| 55 | * \param targets iterators on charges
|
|---|
| 56 | * \return filtered positions
|
|---|
| 57 | */
|
|---|
| 58 | Fragment::positions_t gatherPositionsFromCharges(
|
|---|
| 59 | const Fragment::positions_t &positions,
|
|---|
| 60 | const Fragment::charges_t &charges,
|
|---|
| 61 | const chargeiters_t targets
|
|---|
| 62 | );
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | /** Simple extractor of all unique pair distances of a given \a fragment.
|
|---|
| 66 | *
|
|---|
| 67 | * \param fragment fragment with all nuclei positions
|
|---|
| 68 | * \param index index refers to the index within the global set of configurations
|
|---|
| 69 | * \return vector of of argument_t containing all found distances
|
|---|
| 70 | */
|
|---|
| 71 | inline FunctionModel::arguments_t gatherAllDistances(
|
|---|
| 72 | const Fragment& fragment,
|
|---|
| 73 | const size_t index
|
|---|
| 74 | ) {
|
|---|
| 75 | // get distance out of Fragment
|
|---|
| 76 | return _detail::gatherAllDistanceArguments(fragment.getPositions(), index);
|
|---|
| 77 | }
|
|---|
| 78 |
|
|---|
| 79 | /** Gather all positions associated to the matching \a elements.
|
|---|
| 80 | *
|
|---|
| 81 | * \param fragment fragment with all nuclei positions
|
|---|
| 82 | * \param elements tuple of desired elements
|
|---|
| 83 | * \return vector of positions_t containing
|
|---|
| 84 | */
|
|---|
| 85 | Fragment::positions_t gatherDistanceOfTuples(
|
|---|
| 86 | const Fragment& fragment,
|
|---|
| 87 | const Fragment::charges_t elements
|
|---|
| 88 | );
|
|---|
| 89 |
|
|---|
| 90 | /** Reorder arguments by increasing distance.
|
|---|
| 91 | *
|
|---|
| 92 | * \param args arguments to reorder
|
|---|
| 93 | * \return reordered args
|
|---|
| 94 | */
|
|---|
| 95 | FunctionModel::arguments_t reorderArgumentsByIncreasingDistance(
|
|---|
| 96 | const FunctionModel::arguments_t &args
|
|---|
| 97 | );
|
|---|
| 98 |
|
|---|
| 99 | }; /* namespace Extractors */
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 | #endif /* TRAININGDATA_EXTRACTORS_HPP_ */
|
|---|