Changeset bd8b57


Ignore:
Timestamp:
Oct 8, 2016, 7:25:46 PM (9 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Add_FitFragmentPartialChargesAction, Fix_ChargeSampling_PBC, Fix_FitPartialCharges
Children:
f5d635
Parents:
e08108
git-author:
Frederik Heber <heber@…> (06/12/16 14:28:29)
git-committer:
Frederik Heber <heber@…> (10/08/16 19:25:46)
Message:

Extracted IndexedValue from IndexedVectors.

  • we may now sum up indexed values of arbitrary type, i.e. an arbitrary class that fulfills a certain interface, and each instance connected to a specific index (within index sets).
  • added detail::force where std::vector<double> is specialized for three components.
  • IndexedVectors is now a specialization of IndexedValue for detail::force.
  • adapated usage signatures in AnalyseFragmentationResultsAction, InterfaceVMGJob, and MPQCCommandJob.
  • slight changes in IndexedVectorsUnitTest because boost::assign is no longer used for detail::force.
Location:
src
Files:
4 added
8 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/FragmentationAction/AnalyseFragmentationResultsAction.cpp

    re08108 rbd8b57  
    574574
    575575static void AddForces(
    576     const IndexedVectors::indexedvectors_t &_forces,
     576    const IndexedVectors::indexedvalues_t &_forces,
    577577    const bool _IsAngstroem)
    578578{
    579   for(IndexedVectors::indexedvectors_t::const_iterator iter = _forces.begin();
     579  for(IndexedVectors::indexedvalues_t::const_iterator iter = _forces.begin();
    580580      iter != _forces.end(); ++iter) {
    581581    const IndexedVectors::index_t &index = iter->first;
    582     const IndexedVectors::vector_t &forcevector = iter->second;
     582    const IndexedVectors::value_t &forcevector = iter->second;
    583583    ASSERT( forcevector.size() == NDIM,
    584584        "printReceivedShortResults() - obtained force vector has incorrect dimension.");
     
    667667  // adding obtained forces
    668668  if ( const_cast<const World &>(World::getInstance()).getAllAtoms().size() != 0) {
    669     const IndexedVectors::indexedvectors_t shortrange_forces =
     669    const IndexedVectors::indexedvalues_t shortrange_forces =
    670670        boost::fusion::at_key<MPQCDataFused::forces>(
    671671            shortrangeresults.Result_Force_fused.back()
    672             ).getVectors();
     672            ).getValues();
    673673    AddForces(shortrange_forces,IsAngstroem);
    674674  } else {
     
    740740    // add long-range forces
    741741    if ( const_cast<const World &>(World::getInstance()).getAllAtoms().size() != 0) {
    742       const IndexedVectors::indexedvectors_t longrange_forces =
     742      const IndexedVectors::indexedvalues_t longrange_forces =
    743743          boost::fusion::at_key<VMGDataFused::forces_longrange>(
    744744              longrangeresults.Result_ForcesLongRangeIntegrated_fused.back()
    745               ).getVectors();
     745              ).getValues();
    746746      AddForces(longrange_forces,IsAngstroem);
    747747    } else {
  • src/Fragmentation/Summation/Containers/FragmentationLongRangeResults.cpp

    re08108 rbd8b57  
    266266      if (hasLongRangeForces()) {
    267267        VMGDataLongRangeForceMap_t forceinstance;
    268         IndexedVectors fullforces( fullindices, fullsolutionData[level-1].forces);
     268        IndexedVectors::values_t fullforcevalues(
     269            fullsolutionData[level-1].forces.begin(), fullsolutionData[level-1].forces.end());
     270        IndexedVectors fullforces( fullindices, fullforcevalues);
    269271        IndexedVectors longrangeforces =
    270272            boost::fusion::at_key<VMGDataFused::forces>(Result_ForceLongRange_fused[level-1]);
  • src/Fragmentation/Summation/Converter/DataConverter.hpp

    re08108 rbd8b57  
    2727
    2828#include "Fragmentation/KeySetsContainer.hpp"
     29#include "Fragmentation/Summation/SetValues/detail.hpp"
    2930#include "Fragmentation/Summation/SetValues/Eigenvalues.hpp"
    3031#include "Fragmentation/Summation/SetValues/Histogram.hpp"
     
    139140    }
    140141    IndexedVectors::indices_t indices(arrayiter->begin(), arrayiter->end());
     142    IndexedVectors::values_t values(extractedData.forces.begin(), extractedData.forces.end());
    141143    boost::fusion::at_key<typename dataforcefused::forces>(instance) =
    142         IndexedVectors(indices, extractedData.forces);
     144        IndexedVectors(indices, values);
    143145    Data_Force_fused.insert( std::make_pair(dataiter->first, instance) );
    144146  }
  • src/Fragmentation/Summation/SetValues/IndexedVectors.cpp

    re08108 rbd8b57  
    22 * Project: MoleCuilder
    33 * Description: creates and alters molecular systems
    4  * Copyright (C)  2012 University of Bonn. All rights reserved.
    5  * Copyright (C)  2013 Frederik Heber. All rights reserved.
    6  *
     4 * Copyright (C)  2016 Frederik Heber. All rights reserved.
     5 *
    76 *
    87 *   This file is part of MoleCuilder.
     
    2524 * IndexedVectors.cpp
    2625 *
    27  *  Created on: 29.07.2012
     26 *  Created on: Jun 12, 2016
    2827 *      Author: heber
    2928 */
     29
    3030
    3131// include config.h
     
    3636#include "CodePatterns/MemDebug.hpp"
    3737
    38 #include "Fragmentation/Summation/SetValues/IndexedVectors.hpp"
     38#include "IndexedVectors.hpp"
    3939
    40 #include <iostream>
    41 
    42 #include "CodePatterns/Assert.hpp"
    43 
    44 // static member variables
    45 const size_t IndexedVectors::FixedSize = 3;
    46 const IndexedVectors::vector_t IndexedVectors::nullvector( FixedSize, 0.);
    47 
    48 IndexedVectors::IndexedVectors(const indices_t &_indices, const vectors_t &_vectors)
    49 {
    50   ASSERT(_indices.size() == _vectors.size(),
    51       "IndexedVectors::IndexedVectors() - vector of indices and vectors don't match in size.");
    52   indices_t::const_iterator indexiter = _indices.begin();
    53   vectors_t::const_iterator vectoriter = _vectors.begin();
    54   for (; vectoriter != _vectors.end(); ++indexiter, ++vectoriter) {
    55     ASSERT( vectoriter->size() == FixedSize,
    56         "IndexedVectors::IndexedVectors() - vector to instance "
    57         +toString(*indexiter)+" has size "
    58         +toString(vectoriter->size())+" different to FixedSize "
    59         +toString(FixedSize)+".");
    60     if (*indexiter != (size_t)DropIndex) { // skip all force vectors associated to -1
    61 #ifndef NDEBUG
    62       std::pair<indexedvectors_t::iterator, bool> inserter =
    63 #endif
    64       vectors.insert( std::make_pair( *indexiter, *vectoriter) );
    65       ASSERT( inserter.second,
    66           "IndexedVectors::IndexedVectors() - index "
    67           +toString(inserter.first->first)+" already present with vector "
    68           +toString(inserter.first->second)+".");
    69     }
    70   }
    71 }
    72 
    73 IndexedVectors& IndexedVectors::operator=(const IndexedVectors &other)
    74 {
    75   // check for self-assignment
    76   if (this != &other) {
    77     vectors.clear();
    78     vectors = other.vectors;
    79   }
    80   return *this;
    81 }
    82 
    83 void IndexedVectors::superposeOtherIndexedVectors(const IndexedVectors &other, const double prefactor)
    84 {
    85   for (indexedvectors_t::const_iterator otheriter = other.vectors.begin();
    86       otheriter != other.vectors.end(); ++otheriter) {
    87     indexedvectors_t::iterator iter = vectors.find(otheriter->first);
    88     if (iter == vectors.end()) {
    89       // index does not exist
    90       std::pair<indexedvectors_t::iterator, bool> inserter =
    91           vectors.insert( std::make_pair( otheriter->first, nullvector) );
    92       ASSERT( inserter.second,
    93           "IndexedVectors::superposeOtherIndexedVectors() - index is present though unfound before?");
    94       iter = inserter.first;
    95     }
    96     // now simply vector to index from other instance add with prefactor
    97     vector_t::iterator vectoriter = iter->second.begin();
    98     vector_t::const_iterator othervectoriter = otheriter->second.begin();
    99     for (;vectoriter != iter->second.end(); ++vectoriter, ++othervectoriter) {
    100       *vectoriter += prefactor * (*othervectoriter);
    101     }
    102   }
    103 }
    104 
    105 bool IndexedVectors::operator==(const IndexedVectors& other) const
    106 {
    107   bool status = vectors == other.vectors;
    108   return status;
    109 }
    110 
    111 std::ostream & operator<<(std::ostream &ost, const IndexedVectors &other)
    112 {
    113   for (IndexedVectors::indexedvectors_t::const_iterator iter = other.vectors.begin();
    114       iter != other.vectors.end(); ++iter)
    115     ost << "(" << iter->first << "," << iter->second << ") ";
    116   return ost;
    117 }
    118 
    119 template<> IndexedVectors ZeroInstance<IndexedVectors>()
     40template <>
     41IndexedVectors ZeroInstance<IndexedVectors>()
    12042{
    12143  IndexedVectors returnvalue;
    12244  return returnvalue;
    12345}
     46
     47template<>
     48detail::force ZeroInstance< detail::force >()
     49{
     50  return detail::force::nullvector;
     51}
  • src/Fragmentation/Summation/SetValues/IndexedVectors.hpp

    re08108 rbd8b57  
    22 * IndexedVectors.hpp
    33 *
    4  *  Created on: 29.07.2012
     4 *  Created on: Jun 12, 2016
    55 *      Author: heber
    66 */
     7
    78
    89#ifndef INDEXEDVECTORS_HPP_
     
    1415#endif
    1516
    16 #include <iosfwd>
    17 #include <map>
    18 #include <vector>
     17#include "Fragmentation/Summation/SetValues/detail.hpp"
     18#include "Fragmentation/Summation/SetValues/IndexedValue.hpp"
     19#include "Fragmentation/Summation/ZeroInstance.hpp"
    1920
    20 class IndexedVectorsTest;
     21/** This struct is basically just a typedef for an IndexedValue with
     22 * detail::force as the code was refactored into this more general state
     23 * from the original IndexedVectors class.
     24 *
     25 * Also, we need to implement the ZeroInstance here, as nested template
     26 * declarations a la ZeroInstance< IndexedValue<detail::force> > are
     27 * ambiguous with ZeroInstance< detail::force >.
     28 */
     29class IndexedVectors : public IndexedValue<detail::force>
     30{
     31public:
     32  IndexedVectors(
     33    const typename IndexedValue<detail::force>::indices_t &_indices,
     34    const typename IndexedValue<detail::force>::values_t &_vectors) :
     35    IndexedValue<detail::force>(_indices, _vectors)
     36    {}
    2137
    22 /** IndexedVectors represents a class that contains a a set of vectors,
    23  * each associated to a specific index. When adding or subtracting only
    24  * the ones are combined that have matching indices.
    25  *
    26  * This is needed for summing up force vectors per nuclei obtained from
    27  * fragment calculations.
    28  *
    29  */
    30 class IndexedVectors
    31 {
    32   //!> grant unit test access to private parts
    33   friend class IndexedVectorsTest;
    34 public:
    35   //!> typedef for a single vector
    36   typedef std::vector<double> vector_t;
    37   //!> typedef for the index type
    38   typedef size_t index_t;
    39   //!> typedef for the indices matching the bunch of vectors
    40   typedef std::vector<vector_t> vectors_t;
    41   //!> typedef for the ordered indices matching the bunch of vectors
    42   typedef std::vector<index_t> indices_t;
    43   //!> typedef for a bunch of indexed vectors
    44   typedef std::map<index_t, vector_t> indexedvectors_t;
    45 
    46   enum SpecificIndices_t {
    47     DropIndex = -1
    48   };
    49 
    50   /** Default constructor for class IndexedVectors.
    51    *
    52    */
    53   IndexedVectors() {}
    54 
    55   /** Constructor for class IndexedVectors.
    56    *
    57    * We construct the internal map from \a _indices and \a _vectors. For
    58    * every index -1 contained in \a _indices the respective vector in
    59    * \a _vectors is \b not added but silently dropped.
    60    *
    61    * \param _indices index to each vector
    62    * \param _vectors vectors
    63    */
    64   IndexedVectors(const indices_t &_indices, const vectors_t &_vectors);
    65 
    66   /** Assignment operator.
    67    *
    68    * \note This is required to place IndexedVectors in STL containers.
    69    *
    70    * \param other other instance to assign this one to
    71    * \return ref to this instance
    72    */
    73   IndexedVectors& operator=(const IndexedVectors &other);
    74 
    75   /** Addition operator with another IndexedVector instance \a other.
    76    *
    77    * \param other other instance to sum onto this one.
    78    * \return ref to this instance
    79    */
    80   IndexedVectors& operator+=(const IndexedVectors &other)
    81   {
    82     superposeOtherIndexedVectors(other, +1.);
    83     return *this;
    84   }
    85 
    86   /** Subtraction operator with another IndexedVector instance \a other.
    87    *
    88    * \param other other instance to subtract from this one.
    89    * \return ref to this instance
    90    */
    91   IndexedVectors& operator-=(const IndexedVectors &other)
    92   {
    93     superposeOtherIndexedVectors(other, -1.);
    94     return *this;
    95   }
    96 
    97   /** Const getter to index vectors.
    98    *
    99    * \return const reference to indexed vectors
    100    */
    101   const indexedvectors_t& getVectors() const
    102   { return vectors; }
    103 
    104   /** Equality operator.
    105    *
    106    * @param other other instance to check against
    107    * @return true - both are equal, false - some IndexedVectors differ
    108    */
    109   bool operator==(const IndexedVectors& other) const;
    110 
    111   bool operator!=(const IndexedVectors& other) const
    112   {
    113     return (!(*this == other));
    114   }
    115 
    116 private:
    117   /** Helper function that contains all the logic of how to superpose two
    118    * indexed vectors.
    119    *
    120    * Is called by IndexedVectors::operator+=() and IndexedVectors::operator-=()
    121    *
    122    * @param other other histogram
    123    * @param prefactor +1. is then addition, -1. is subtraction.
    124    */
    125   void superposeOtherIndexedVectors(const IndexedVectors &other, const double prefactor);
    126 
    127 private:
    128   //!> internal map with all indexed vectors
    129   indexedvectors_t vectors;
    130   //!> fixed size of all vector_t
    131   static const size_t FixedSize;
    132   //!> static instance representing a null vector
    133   static const vector_t nullvector;
    134 
    135   //!> grant access to output operator
    136   friend std::ostream & operator<<(std::ostream &ost, const IndexedVectors &other);
     38  IndexedVectors()
     39  {}
    13740};
    13841
    139 /** Output operator for IndexedVector.
    140  *
    141  *  Prints a space-separated list of all members as "(index, vector)".
    142  *
    143  * \param ost output stream to print to
    144  * \param other instance to print
    145  * \return ref to ost for concatenation
    146  */
    147 std::ostream & operator<<(std::ostream &ost, const IndexedVectors &other);
    148 
    14942template<typename T> T ZeroInstance();
    150 template<> IndexedVectors ZeroInstance<IndexedVectors>();
    151 
     43template<> IndexedVectors ZeroInstance< IndexedVectors >();
     44template<> detail::force ZeroInstance< detail::force >();
    15245
    15346#endif /* INDEXEDVECTORS_HPP_ */
  • src/Fragmentation/Summation/SetValues/Makefile.am

    re08108 rbd8b57  
    33
    44FRAGMENTATIONSETVALUESSOURCE = \
     5        Fragmentation/Summation/SetValues/detail.cpp \
    56        Fragmentation/Summation/SetValues/Eigenvalues.cpp \
    67        Fragmentation/Summation/SetValues/Fragment.cpp \
     
    1213
    1314FRAGMENTATIONSETVALUESHEADER = \
     15        Fragmentation/Summation/SetValues/detail.hpp \
    1416        Fragmentation/Summation/SetValues/Eigenvalues.hpp \
    1517        Fragmentation/Summation/SetValues/Fragment.hpp \
    1618        Fragmentation/Summation/SetValues/FragmentForces.hpp \
    1719        Fragmentation/Summation/SetValues/Histogram.hpp \
     20        Fragmentation/Summation/SetValues/IndexedValue.hpp \
     21        Fragmentation/Summation/SetValues/IndexedValue_impl.hpp \
    1822        Fragmentation/Summation/SetValues/IndexedVectors.hpp \
    1923        Fragmentation/Summation/SetValues/SamplingGrid.hpp \
  • src/Fragmentation/Summation/SetValues/unittests/IndexedVectorsUnitTest.cpp

    re08108 rbd8b57  
    4747#include <boost/assign.hpp>
    4848
    49 
    5049#include "CodePatterns/Assert.hpp"
    5150
     
    6867
    6968  // create two vector_t
    70   ones += 1.,1.,1.;
    71   twos += 2.,2.,2.;
    72   threes += 3.,3.,3.;
    73   CPPUNIT_ASSERT_EQUAL( IndexedVectors::FixedSize, ones.size() );
    74   CPPUNIT_ASSERT_EQUAL( IndexedVectors::FixedSize, twos.size() );
    75   CPPUNIT_ASSERT_EQUAL( IndexedVectors::FixedSize, threes.size() );
    76 
    77   // create vectors
    78 
    79   IndexedVectors::vectors_t vectors;
    80   vectors.push_back(ones);
    81   vectors.push_back(twos);
    82   IndexedVectors::vectors_t othervectors;
    83   othervectors.push_back(threes);
    84   othervectors.push_back(threes);
     69  ones(1.,1.,1.);
     70  twos(2.,2.,2.);
     71  threes(3.,3.,3.);
     72  CPPUNIT_ASSERT_EQUAL( IndexedVectors::value_t::FixedSize, ones.size() );
     73  CPPUNIT_ASSERT_EQUAL( IndexedVectors::value_t::FixedSize, twos.size() );
     74  CPPUNIT_ASSERT_EQUAL( IndexedVectors::value_t::FixedSize, threes.size() );
     75
     76  // create values
     77
     78  IndexedVectors::values_t values;
     79  values.push_back(ones);
     80  values.push_back(twos);
     81  IndexedVectors::values_t othervalues;
     82  othervalues.push_back(threes);
     83  othervalues.push_back(threes);
    8584
    8685  // create two indices
     
    9089  otherindices += 1,3;
    9190
    92   // create indexed vectors
    93   ivectors = new IndexedVectors(indices, vectors);
    94   otherivectors = new IndexedVectors(otherindices, othervectors);
     91  // create indexed values
     92  ivectors = new IndexedVectors(indices, values);
     93  otherivectors = new IndexedVectors(otherindices, othervalues);
    9594}
    9695
     
    102101}
    103102
     103static void checkValueInIndexedVectors(
     104    const IndexedVectors &_vectors,
     105    const IndexedVectors::index_t &_index,
     106    const IndexedVectors::value_t &_compareto
     107    )
     108{
     109  const IndexedVectors::indexedvalues_t &indexedvalues = _vectors.getValues();
     110  IndexedVectors::indexedvalues_t::const_iterator iter = indexedvalues.find(_index);
     111  CPPUNIT_ASSERT( iter != indexedvalues.end() );
     112  CPPUNIT_ASSERT( _compareto == iter->second );
     113}
    104114
    105115/** UnitTest for cstor's
     
    110120  IndexedVectors::indices_t indices;
    111121  indices += 1,-1,3;
    112   IndexedVectors::vectors_t vectors;
    113   vectors.push_back(ones);
    114   vectors.push_back(twos);
    115   vectors.push_back(threes);
    116   IndexedVectors testivectors(indices, vectors);
    117 
    118   CPPUNIT_ASSERT_EQUAL( (size_t)2, testivectors.vectors.size() );
    119   CPPUNIT_ASSERT( ones == testivectors.vectors[1] );
    120   CPPUNIT_ASSERT( threes == testivectors.vectors[3] );
    121   CPPUNIT_ASSERT( testivectors.vectors.find(-1) == testivectors.vectors.end() );
     122  IndexedVectors::values_t values;
     123  values.push_back(ones);
     124  values.push_back(twos);
     125  values.push_back(threes);
     126  IndexedVectors testivectors(indices, values);
     127
     128  CPPUNIT_ASSERT_EQUAL( (size_t)2, testivectors.getValues().size() );
     129  checkValueInIndexedVectors(testivectors, 1, ones);
     130  checkValueInIndexedVectors(testivectors, 3, threes);
     131  CPPUNIT_ASSERT( testivectors.getValues().find(-1) == testivectors.getValues().end() );
    122132}
    123133
     
    127137{
    128138  // safeguard initial sizes
    129   CPPUNIT_ASSERT_EQUAL( (size_t)2, ivectors->vectors.size() );
    130   CPPUNIT_ASSERT_EQUAL( (size_t)2, otherivectors->vectors.size() );
     139  CPPUNIT_ASSERT_EQUAL( (size_t)2, ivectors->getValues().size() );
     140  CPPUNIT_ASSERT_EQUAL( (size_t)2, otherivectors->getValues().size() );
    131141
    132142  // perform operation
     
    134144
    135145  // check new and ole sizes
    136   CPPUNIT_ASSERT_EQUAL( (size_t)3, ivectors->vectors.size() );
    137   CPPUNIT_ASSERT_EQUAL( (size_t)2, otherivectors->vectors.size() );
     146  CPPUNIT_ASSERT_EQUAL( (size_t)3, ivectors->getValues().size() );
     147  CPPUNIT_ASSERT_EQUAL( (size_t)2, otherivectors->getValues().size() );
    138148
    139149  // then check result
    140   IndexedVectors::vector_t result( IndexedVectors::nullvector );
    141   CPPUNIT_ASSERT_EQUAL( IndexedVectors::FixedSize, result.size() );
    142   for (size_t i=0; i<IndexedVectors::FixedSize; ++i)
     150  IndexedVectors::value_t result;
     151  CPPUNIT_ASSERT_EQUAL( IndexedVectors::value_t::FixedSize, result.size() );
     152  for (size_t i=0; i<IndexedVectors::value_t::FixedSize; ++i)
    143153    result[i] = ones[i] + threes[i];
    144   for (IndexedVectors::indexedvectors_t::const_iterator iter = ivectors->vectors.begin();
    145       iter != ivectors->vectors.end(); ++iter) {
    146     CPPUNIT_ASSERT_EQUAL( IndexedVectors::FixedSize, iter->second.size() );
     154  for (IndexedVectors::indexedvalues_t::const_iterator iter = ivectors->getValues().begin();
     155      iter != ivectors->getValues().end(); ++iter) {
     156    CPPUNIT_ASSERT_EQUAL( IndexedVectors::value_t::FixedSize, iter->second.size() );
    147157  }
    148   CPPUNIT_ASSERT( result == ivectors->vectors[1] );
    149   CPPUNIT_ASSERT( twos == ivectors->vectors[2] );
    150   CPPUNIT_ASSERT( threes == ivectors->vectors[3] );
     158  checkValueInIndexedVectors(*ivectors, 1, result);
     159  checkValueInIndexedVectors(*ivectors, 2, twos);
     160  checkValueInIndexedVectors(*ivectors, 3, threes);
    151161}
    152162
     
    156166{
    157167  // safeguard initial sizes
    158   CPPUNIT_ASSERT_EQUAL( (size_t)2, ivectors->vectors.size() );
    159   CPPUNIT_ASSERT_EQUAL( (size_t)2, otherivectors->vectors.size() );
     168  CPPUNIT_ASSERT_EQUAL( (size_t)2, ivectors->getValues().size() );
     169  CPPUNIT_ASSERT_EQUAL( (size_t)2, otherivectors->getValues().size() );
    160170
    161171  // perform operation
     
    163173
    164174  // check new and ole sizes
    165   CPPUNIT_ASSERT_EQUAL( (size_t)3, ivectors->vectors.size() );
    166   CPPUNIT_ASSERT_EQUAL( (size_t)2, otherivectors->vectors.size() );
     175  CPPUNIT_ASSERT_EQUAL( (size_t)3, ivectors->getValues().size() );
     176  CPPUNIT_ASSERT_EQUAL( (size_t)2, otherivectors->getValues().size() );
    167177
    168178  // then check result
    169   IndexedVectors::vector_t result( IndexedVectors::nullvector );
    170   IndexedVectors::vector_t thirdresult( IndexedVectors::nullvector );
    171   CPPUNIT_ASSERT_EQUAL( IndexedVectors::FixedSize, result.size() );
    172   for (size_t i=0; i<IndexedVectors::FixedSize; ++i) {
     179  IndexedVectors::value_t result;
     180  IndexedVectors::value_t thirdresult;
     181  CPPUNIT_ASSERT_EQUAL( IndexedVectors::value_t::FixedSize, result.size() );
     182  for (size_t i=0; i<IndexedVectors::value_t::FixedSize; ++i) {
    173183    result[i] = ones[i] - threes[i];
    174184    thirdresult[i] = -threes[i];
    175185  }
    176   for (IndexedVectors::indexedvectors_t::const_iterator iter = ivectors->vectors.begin();
    177       iter != ivectors->vectors.end(); ++iter) {
    178     CPPUNIT_ASSERT_EQUAL( IndexedVectors::FixedSize, iter->second.size() );
     186  for (IndexedVectors::indexedvalues_t::const_iterator iter = ivectors->getValues().begin();
     187      iter != ivectors->getValues().end(); ++iter) {
     188    CPPUNIT_ASSERT_EQUAL( IndexedVectors::value_t::FixedSize, iter->second.size() );
    179189  }
    180   CPPUNIT_ASSERT( result == ivectors->vectors[1] );
    181   CPPUNIT_ASSERT( twos == ivectors->vectors[2] );
    182   CPPUNIT_ASSERT( thirdresult == ivectors->vectors[3] );
     190  checkValueInIndexedVectors(*ivectors, 1, result);
     191  checkValueInIndexedVectors(*ivectors, 2, twos);
     192  checkValueInIndexedVectors(*ivectors, 3, thirdresult);
    183193}
    184194
  • src/Fragmentation/Summation/SetValues/unittests/IndexedVectorsUnitTest.hpp

    re08108 rbd8b57  
    4141      IndexedVectors *ivectors;
    4242      IndexedVectors *otherivectors;
    43       IndexedVectors::vector_t ones;
    44       IndexedVectors::vector_t twos;
    45       IndexedVectors::vector_t threes;
     43      IndexedVectors::value_t ones;
     44      IndexedVectors::value_t twos;
     45      IndexedVectors::value_t threes;
    4646
    4747};
Note: See TracChangeset for help on using the changeset viewer.