Changeset 1a00bb for src/Jobs/Grid
- Timestamp:
- Feb 15, 2013, 9:51:48 AM (12 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- e2404f
- Parents:
- 98f8fe
- git-author:
- Frederik Heber <heber@…> (12/03/12 09:02:23)
- git-committer:
- Frederik Heber <heber@…> (02/15/13 09:51:48)
- Location:
- src/Jobs/Grid
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Jobs/Grid/SamplingGrid.cpp
r98f8fe r1a00bb 46 46 #include "CodePatterns/Assert.hpp" 47 47 #include "CodePatterns/Log.hpp" 48 49 // static instances 50 const double SamplingGrid::zeroOffset[3] = { 0., 0., 0. }; 51 52 SamplingGrid::SamplingGrid() : 53 SamplingGridProperties() 54 { 55 setWindowSize(zeroOffset, zeroOffset); 56 ASSERT( getWindowGridPoints() == (size_t)0, 57 "SamplingGrid::SamplingGrid() - incorrect number of samples given for the window."); 58 } 48 59 49 60 SamplingGrid::SamplingGrid(const double _begin[3], … … 53 64 SamplingGridProperties(_begin, _end, _level), 54 65 sampled_grid(_sampled_grid) 55 {} 66 { 67 setWindowSize(_begin, _end); 68 ASSERT( getWindowGridPoints() == (size_t)_sampled_grid.size(), 69 "SamplingGrid::SamplingGrid() - incorrect number of samples given for the window."); 70 } 56 71 57 72 SamplingGrid::SamplingGrid(const SamplingGrid &_grid) : 58 73 SamplingGridProperties(_grid), 59 74 sampled_grid(_grid.sampled_grid) 60 {} 75 { 76 setWindowSize(_grid.begin, _grid.end); 77 } 61 78 62 79 SamplingGrid::SamplingGrid(const SamplingGridProperties &_props) : 63 80 SamplingGridProperties(_props) 64 {} 81 { 82 setWindowSize(_props.begin, _props.end); 83 } 65 84 66 85 SamplingGrid::SamplingGrid( … … 69 88 SamplingGridProperties(_props), 70 89 sampled_grid(_sampled_grid) 71 {} 90 { 91 setWindowSize(_props.begin, _props.end); 92 ASSERT( getWindowGridPoints() == (size_t)_sampled_grid.size(), 93 "SamplingGrid::SamplingGrid() - incorrect number of samples given for the window."); 94 } 72 95 73 96 SamplingGrid::~SamplingGrid() … … 79 102 if (this != &other) { 80 103 static_cast<SamplingGridProperties &>(*this) = other; 104 setWindow(other.begin_window, other.end_window); 81 105 sampled_grid = other.sampled_grid; 82 106 } … … 100 124 void SamplingGrid::superposeOtherGrids(const SamplingGrid &other, const double prefactor) 101 125 { 102 // check that grids are compatible126 /// check that grids are compatible 103 127 if (isCompatible(other)) { 128 /// get maximum of window 129 double max_begin_window[3]; 130 double max_end_window[3]; 131 bool doExtend = false; 132 for (size_t index=0; index<3;++index) { 133 if (begin_window[index] >= other.begin_window[index]) { 134 max_begin_window[index] = other.begin_window[index]; 135 doExtend = true; 136 } else { 137 max_begin_window[index] = begin_window[index]; 138 } 139 if (end_window[index] >= other.end_window[index]) { 140 max_end_window[index] = end_window[index]; 141 } else { 142 max_end_window[index] = other.end_window[index]; 143 doExtend = true; 144 } 145 } 146 if (doExtend) 147 extendWindow(max_begin_window, max_end_window); 148 /// and copy other into larger window, too 149 addOntoWindow(other.begin_window, other.end_window, other.sampled_grid); 104 150 // then add other's grid onto this one 105 151 sampledvalues_t::iterator iter = sampled_grid.begin(); … … 112 158 } 113 159 114 double SamplingGrid::getVolume() const160 const double SamplingGrid::getVolume() const 115 161 { 116 162 double volume = 1.; … … 120 166 } 121 167 168 const double SamplingGrid::getWindowVolume() const 169 { 170 double volume = 1.; 171 for (size_t i=0;i<3;++i) 172 volume *= end_window[i]-begin_window[i]; 173 return volume; 174 } 175 122 176 const size_t SamplingGrid::getTotalGridPoints() const 123 177 { … … 128 182 { 129 183 return pow(2, level); 184 } 185 186 const size_t SamplingGrid::getWindowGridPoints() const 187 { 188 const double volume = getVolume(); 189 if (fabs(volume) < std::numeric_limits<double>::epsilon()) 190 return 0; 191 else 192 return (getWindowVolume()*getTotalGridPoints())/volume; 130 193 } 131 194 … … 146 209 { 147 210 if (isCompatible(weight)) { 148 const size_t gridpoints = pow(2, level);149 211 const double volume_element = getVolume()/(double)getTotalGridPoints(); 150 212 double int_value = 0.; … … 160 222 } 161 223 224 void SamplingGrid::setWindowSize( 225 const double _begin_window[3], 226 const double _end_window[3]) 227 { 228 for (size_t index=0;index<3;++index) { 229 begin_window[index] = _begin_window[index]; 230 end_window[index] = _end_window[index]; 231 } 232 } 233 234 void SamplingGrid::setWindow( 235 const double _begin_window[3], 236 const double _end_window[3]) 237 { 238 setWindowSize(_begin_window, _end_window); 239 const size_t gridpoints_window = getWindowGridPoints(); 240 sampled_grid.resize(gridpoints_window, 0.); 241 } 242 243 void SamplingGrid::setWindowSize( 244 const double _begin_window[3], 245 const double _size) 246 { 247 for (size_t index=0;index<3;++index) { 248 begin_window[index] = _begin_window[index]; 249 end_window[index] = _begin_window[index]+_size; 250 } 251 } 252 253 void SamplingGrid::extendWindow( 254 const double _begin_window[3], 255 const double _end_window[3]) 256 { 257 // check that we truly have to extend the window 258 #ifndef NDEBUG 259 for(size_t index=0;index < 3; ++index) { 260 ASSERT ( begin_window[index] >= _begin_window[index], 261 "SamplingGrid::extendWindow() - component "+toString(index)+ 262 " of window start is greater than old value."); 263 ASSERT ( end_window[index] <= _end_window[index], 264 "SamplingGrid::extendWindow() - component "+toString(index)+ 265 " of window end is less than old value."); 266 } 267 #endif 268 // copy old window size and values 269 double old_begin_window[3]; 270 double old_end_window[3]; 271 for(size_t index=0;index<3;++index) { 272 old_begin_window[index] = begin_window[index]; 273 old_end_window[index] = end_window[index]; 274 } 275 sampledvalues_t old_values(sampled_grid); 276 // now extend it ... 277 addOntoWindow(old_begin_window, old_end_window, old_values); 278 } 279 280 void SamplingGrid::addOntoWindow( 281 const double _begin_window[3], 282 const double _end_window[3], 283 const sampledvalues_t &_sampled_grid) 284 { 285 #ifndef NDEBUG 286 for(size_t index=0;index<3;++index) { 287 ASSERT( _begin_window[index] >= begin_window[index], 288 "SamplingGrid::addOntoWindow() - given window starts earlier in component " 289 +toString(index)+"."); 290 ASSERT( _end_window[index] <= end_window[index], 291 "SamplingGrid::addOntoWindow() - given window ends later in component " 292 +toString(index)+"."); 293 } 294 #endif 295 // the only issue are indices 296 const size_t gridpoints_axis = pow(2, level); 297 size_t offset[3]; 298 size_t length[3]; 299 for(size_t index=0;index<3;++index) { 300 offset[index] = gridpoints_axis*(_begin_window[index] - begin_window[index]); 301 length[index] = gridpoints_axis*(_end_window[index] - _begin_window[index]); 302 } 303 ASSERT( length[0]*length[1]*length[2] == _sampled_grid.size(), 304 "SamplingGrid::addOntoWindow() - not enough sampled values given."); 305 size_t N[3]; 306 // sampledvalues_t::iterator griditer = sampled_grid.begin(); 307 sampledvalues_t::const_iterator copyiter = _sampled_grid.begin(); 308 for(N[0]=offset[0]; N[0] < length[0]; ++N[0]) { 309 for(N[1]=offset[1]; N[1] < length[1]; ++N[1]) { 310 for(N[2]=offset[2]; N[2] < length[2]; ++N[2]) { 311 const size_t index = 312 (N[0]*gridpoints_axis+N[1])*gridpoints_axis+N[2]; 313 sampled_grid[index] += *copyiter; 314 } 315 } 316 } 317 } 318 162 319 std::ostream & operator<<(std::ostream &ost, const SamplingGrid& other) 163 320 { 164 ost << "SamplingGrid starting at " << other.begin[0] << "," << other.begin[1] << "," << other.begin[2]; 165 ost << ", ending at " << other.end[0] << "," << other.end[1] << "," << other.end[2]; 321 ost << "SamplingGrid"; 322 ost << " starting at " << other.begin[0] << "," << other.begin[1] << "," << other.begin[2]; 323 ost << " ending at " << other.end[0] << "," << other.end[1] << "," << other.end[2]; 324 ost << ", window starting at " << other.begin_window[0] << "," << other.begin_window[1] << "," << other.begin_window[2]; 325 ost << ", window ending at " << other.end_window[0] << "," << other.end_window[1] << "," << other.end_window[2]; 166 326 ost << ", level of " << other.level; 167 327 ost << " and integrated value of " << other.integral(); -
src/Jobs/Grid/SamplingGrid.hpp
r98f8fe r1a00bb 75 75 /** default cstor. 76 76 */ 77 SamplingGrid() 78 {} 77 SamplingGrid(); 79 78 80 79 virtual ~SamplingGrid(); … … 128 127 double integral(const SamplingGrid &weight) const; 129 128 129 /** Returns the volume of the domain for this sampled function. 130 * 131 * @return volume 132 */ 133 const double getVolume() const; 134 135 /** Returns the total number of gridpoints of the discrete mesh covering the (window) volume. 136 * 137 * @return number of gridpoints sampled_values should have 138 */ 139 const size_t getWindowGridPoints() const; 140 141 /** Returns the total number of gridpoints of the discrete mesh covering the volume. 142 * 143 * @return number of gridpoints sampled_values should have 144 */ 145 const size_t getTotalGridPoints() const; 146 147 /** Returns the number of grid points per axis. 148 * 149 * @return number of grid points per unit length 150 */ 151 const size_t getGridPointsPerAxis() const; 152 153 /** Returns the volume of the domain covered by the current window. 154 * 155 * @return volume of window 156 */ 157 const double getWindowVolume() const; 158 159 /** Sets the size of the window. 160 * 161 * \note also resets the sampled points so far. 162 * 163 * \param _begin_window start of new window 164 * \param _end_window end of window 165 */ 166 void setWindow(const double _begin_window[3], const double _end_window[3]); 167 130 168 private: 131 /** Returns the volume of the domain for this sampled function. 132 * 133 * @return volume 134 */ 135 double getVolume() const; 136 137 /** Returns the total number of gridpoints of the discrete mesh covering the (window) volume. 138 * 139 * @return number of gridpoints sampled_values should have 140 */ 141 const size_t getTotalGridPoints() const; 142 143 /** Returns the number of grid points per axis. 144 * 145 * @return number of grid points per unit length 146 */ 147 const size_t getGridPointsPerAxis() const; 148 169 /** Extends the window while keeping the values. 170 * 171 * \param _begin_window new start of window 172 * \param _end_window new end of window 173 */ 174 void extendWindow(const double _begin_window[3], const double _end_window[3]); 175 176 /** Adds another window onto the one in this instance. 177 * 178 * \note We assume here that the given window fits on the this one. 179 * 180 * \param _begin_window start of other window 181 * \param _end_window end of other window 182 * \param _sampled_grid other set of sampled values 183 */ 184 void addOntoWindow( 185 const double _begin_window[3], 186 const double _end_window[3], 187 const sampledvalues_t &_sampled_grid); 149 188 150 189 /** Helper function that contains all the logic of how to superpose two … … 158 197 void superposeOtherGrids(const SamplingGrid &other, const double prefactor); 159 198 199 /** Sets the size of the window. 200 * 201 * \note also resets the sampled points so far. 202 * 203 * \param _begin_window start of new window 204 * \param _size size of the window 205 */ 206 void setWindowSize(const double _begin_window[3], const double _size); 207 208 /** Sets the size of the window. 209 * 210 * \note also resets the sampled points so far. 211 * 212 * \param _begin_window start of new window 213 * \param _end_window end of window 214 */ 215 void setWindowSize(const double _begin_window[3], const double _end_window[3]); 216 160 217 public: 161 //!> sample points 218 /// We do not store the whole grid if many entries are actually zero 219 /// but only a window wherein the sampled function is non-zero. 220 221 //!> sample points of the window 162 222 sampledvalues_t sampled_grid; 223 224 //!> start of the window relative to SamplingGridProperties::begin and SamplingGridProperties::size 225 double begin_window[3]; 226 //!> end of the window relative to SamplingGridProperties::begin and SamplingGridProperties::size 227 double end_window[3]; 163 228 164 229 private: … … 172 237 ar & boost::serialization::base_object<SamplingGridProperties>(*this); 173 238 ar & const_cast< sampledvalues_t &>(sampled_grid); 239 for(size_t i=0;i<3;++i) { 240 ar & begin_window[i]; 241 ar & end_window[i]; 242 } 174 243 } 244 245 //!> static typedef to use in cstor when no initial values are given 246 static const double zeroOffset[3]; 175 247 }; 176 248 -
src/Jobs/Grid/SamplingGridProperties.hpp
r98f8fe r1a00bb 52 52 bool isCompatible(const SamplingGridProperties &_props) const 53 53 { 54 return *this == _props;54 return level == _props.level; 55 55 } 56 56 -
src/Jobs/Grid/unittests/Makefile.am
r98f8fe r1a00bb 14 14 SamplingGridUnitTest 15 15 16 XFAIL_TESTS += SamplingGridUnitTest 16 17 TESTS += $(JOBSGRIDTESTS) 17 18 check_PROGRAMS += $(JOBSGRIDTESTS) -
src/Jobs/Grid/unittests/SamplingGridPropertiesUnitTest.cpp
r98f8fe r1a00bb 85 85 SamplingGridProperties moreotherprops(begin, end, 4); 86 86 87 // only checks for same level 87 88 CPPUNIT_ASSERT( props->isCompatible(*props) ); 88 89 CPPUNIT_ASSERT( props->isCompatible(sameprops) ); 89 90 CPPUNIT_ASSERT( sameprops.isCompatible(*props) ); 90 CPPUNIT_ASSERT( !props->isCompatible(otherprops) );91 CPPUNIT_ASSERT( !otherprops.isCompatible(*props) );92 CPPUNIT_ASSERT( !props->isCompatible(anotherprops) );93 CPPUNIT_ASSERT( !anotherprops.isCompatible(*props) );91 CPPUNIT_ASSERT( props->isCompatible(otherprops) ); 92 CPPUNIT_ASSERT( otherprops.isCompatible(*props) ); 93 CPPUNIT_ASSERT( props->isCompatible(anotherprops) ); 94 CPPUNIT_ASSERT( anotherprops.isCompatible(*props) ); 94 95 CPPUNIT_ASSERT( !props->isCompatible(moreotherprops) ); 95 96 CPPUNIT_ASSERT( !moreotherprops.isCompatible(*props) ); … … 111 112 SamplingGridProperties moreotherprops(begin, end, 4); 112 113 114 // check for same level, begin, and end 113 115 CPPUNIT_ASSERT( *props == *props ); 114 116 CPPUNIT_ASSERT( *props == sameprops ); 115 CPPUNIT_ASSERT( *props != otherprops ); 117 CPPUNIT_ASSERT( sameprops == *props); 118 CPPUNIT_ASSERT( *props != otherprops); 119 CPPUNIT_ASSERT( otherprops != *props); 116 120 CPPUNIT_ASSERT( *props != anotherprops ); 121 CPPUNIT_ASSERT( anotherprops != *props ); 117 122 CPPUNIT_ASSERT( *props != moreotherprops ); 123 CPPUNIT_ASSERT( moreotherprops != *props ); 118 124 } 119 125 -
src/Jobs/Grid/unittests/SamplingGridUnitTest.cpp
r98f8fe r1a00bb 82 82 } 83 83 84 #define NUMBEROFSAMPLES(n) pow(pow(2,n),3) 85 86 /** UnitTest for operator+=() 87 */ 88 void SamplingGridTest::superposeOtherGrid_Test() 84 /** UnitTest on compatible combination of props and values 85 */ 86 void SamplingGridTest::compatibleGrids_Test() 89 87 { 90 88 // check illegal grid … … 92 90 const double end[3] = { 2., 2., 2. }; 93 91 SamplingGridProperties illegal_props(begin, end, 1); 92 SamplingGridProperties legal_props(begin, end, 2); 94 93 CPPUNIT_ASSERT( !grid->isCompatible(illegal_props) ); 94 CPPUNIT_ASSERT( grid->isCompatible(legal_props) ); 95 95 SamplingGrid::sampledvalues_t illegal_values; 96 96 for (size_t i=0; i< NUMBEROFSAMPLES(1); ++i) 97 97 illegal_values += 1.5; 98 SamplingGrid illegal_grid(illegal_props, illegal_values); 98 SamplingGrid::sampledvalues_t legal_values; 99 for (size_t i=0; i< NUMBEROFSAMPLES(2); ++i) 100 illegal_values += 1.5; 99 101 #ifndef NDEBUG 100 std::cout << "The following assertion is intended and does not indicate a failure of the test." << std::endl; 101 CPPUNIT_ASSERT_THROW( *grid += illegal_grid, Assert::AssertionFailure ); 102 #else 103 *grid += illegal_grid; 102 // throws because props and size of illegal_values don't match 103 std::cout << "The following assertion is intended and does not indicate a failure of the test." << std::endl; 104 CPPUNIT_ASSERT_THROW( SamplingGrid illegal_grid(illegal_props, illegal_values), Assert::AssertionFailure ); 105 std::cout << "The following assertion is intended and does not indicate a failure of the test." << std::endl; 106 CPPUNIT_ASSERT_THROW( SamplingGrid illegal_grid(legal_props, illegal_values), Assert::AssertionFailure ); 107 std::cout << "The following assertion is intended and does not indicate a failure of the test." << std::endl; 108 CPPUNIT_ASSERT_THROW( SamplingGrid illegal_grid(illegal_props, legal_values), Assert::AssertionFailure ); 104 109 #endif 105 106 110 // check that grid is still the same 107 111 for (SamplingGrid::sampledvalues_t::const_iterator iter = grid->sampled_grid.begin(); … … 115 119 { 116 120 CPPUNIT_ASSERT_EQUAL( 1., grid->getVolume() ); 121 } 122 123 /** UnitTest for getWindowSize_Test 124 */ 125 void SamplingGridTest::getWindowSize_Test() 126 { 127 // check size of default grid 128 CPPUNIT_ASSERT_EQUAL( (size_t)NUMBEROFSAMPLES(2), grid->getWindowGridPoints() ); 129 130 // create another one and check its size, too 131 const double begin[3] = { 0., 0., 0. }; 132 const double end[3] = { 1., 1., 1. }; 133 for (size_t level = 3; level<=6; ++level) { 134 values.clear(); 135 for (size_t i=0; i< NUMBEROFSAMPLES(level); ++i) 136 values += grid_value; 137 delete grid; 138 grid = new SamplingGrid(begin, end, level, values); 139 CPPUNIT_ASSERT_EQUAL( (size_t)NUMBEROFSAMPLES(level), grid->getWindowGridPoints() ); 140 } 141 } 142 143 /** UnitTest for extendWindow() 144 */ 145 void SamplingGridTest::extendWindow_Test() 146 { 147 // we have a grid with size of two, extend to twice the size and check 148 const double begin[3] = { 0., 0., 0. }; 149 const double end[3] = { 2., 2., 2. }; 150 grid->extendWindow(begin, end); 151 152 // check integral 153 CPPUNIT_ASSERT_EQUAL( NUMBEROFSAMPLES(2)*grid_value, grid->integral() ); 154 155 // check number of points 156 CPPUNIT_ASSERT_EQUAL( (size_t)NUMBEROFSAMPLES(3), grid->getWindowGridPoints() ); 157 } 158 159 /** UnitTest for addOntoWindow() 160 */ 161 void SamplingGridTest::addOntoWindow_Test() 162 { 163 // first window is from (0,0,0) to (1,1,1) 164 CPPUNIT_ASSERT_EQUAL( 1.*grid_value, grid->integral() ); 165 166 // create another window from (.5,.5,.5) to (1., 1., 1.) 167 const double begin[3] = { .5, .5, .5 }; 168 const double end[3] = { 1., 1., 1. }; 169 values.clear(); 170 for (size_t i=0; i< NUMBEROFSAMPLES(2)/pow(2,3); ++i) // cut in half 171 values += grid_value; 172 // check that too large a window throws 173 #ifndef NDEBUG 174 const double wrongend[3] = { 1.5, 1.5, 1.5 }; 175 std::cout << "The following assertion is intended and does not indicate a failure of the test." << std::endl; 176 CPPUNIT_ASSERT_THROW( grid->addOntoWindow(begin, wrongend, values), Assert::AssertionFailure ); 177 #endif 178 // now perform working operation 179 grid->addOntoWindow(begin, end, values); 180 181 // check integral to be one and half times the old value 182 CPPUNIT_ASSERT_EQUAL( (1.+pow(.5,3))*grid_value, grid->integral() ); 117 183 } 118 184 -
src/Jobs/Grid/unittests/SamplingGridUnitTest.hpp
r98f8fe r1a00bb 24 24 { 25 25 CPPUNIT_TEST_SUITE( SamplingGridTest) ; 26 CPPUNIT_TEST ( superposeOtherGrid_Test );26 CPPUNIT_TEST ( compatibleGrids_Test ); 27 27 CPPUNIT_TEST ( operatorPlusEqual_Test ); 28 28 CPPUNIT_TEST ( operatorMinusEqual_Test ); 29 29 CPPUNIT_TEST ( getVolume_Test ); 30 CPPUNIT_TEST ( getWindowSize_Test ); 31 CPPUNIT_TEST ( extendWindow_Test ); 32 CPPUNIT_TEST ( addOntoWindow_Test ); 30 33 CPPUNIT_TEST_SUITE_END(); 31 34 … … 33 36 void setUp(); 34 37 void tearDown(); 35 void superposeOtherGrid_Test();38 void compatibleGrids_Test(); 36 39 void getVolume_Test(); 40 void getWindowSize_Test(); 41 void extendWindow_Test(); 42 void addOntoWindow_Test(); 37 43 void operatorPlusEqual_Test(); 38 44 void operatorMinusEqual_Test();
Note:
See TracChangeset
for help on using the changeset viewer.