Ignore:
Timestamp:
Sep 14, 2016, 6:42:53 PM (9 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, Candidate_v1.7.0, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, 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_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, GeometryObjects, Gui_displays_atomic_force_velocity, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, RotateToPrincipalAxisSystem_UndoRedo, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, Ubuntu_1604_changes, stable
Children:
d56e21
Parents:
06653a
git-author:
Frederik Heber <heber@…> (05/26/16 09:46:06)
git-committer:
Frederik Heber <heber@…> (09/14/16 18:42:53)
Message:

SamplingGridUnitTest checks downsample on window.

  • FIX: getLengthsOfGrid() asserted that total equals 2level which is only true if the window spans the whole grid. We now assert for equal or less.
  • Renamed getLengthsOfGrid -> getLengthsOfWindow.
  • Extended downsample() tests to check for level difference of one to three.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Summation/SetValues/SamplingGrid.cpp

    r06653a r91e7658  
    674674};
    675675
    676 static void getLengthsOfGrid(
     676static void getLengthsOfWindow(
    677677    int _total[NDIM],
    678678    const SamplingGrid &_grid)
     
    688688          } else
    689689            _total[index] = 0;
    690           ASSERT (_total[index] == ::pow(2, _grid.level),
     690          // we can only assert that its atmost the maximum number of grid points
     691          ASSERT (_total[index] <= ::pow(2, _grid.level),
    691692              "SamplingGrid::downsample() - total "+toString(_total[index])
    692               +" does not match 2^level: "+toString(_grid.level));
     693              +" is not equal or less than 2^level: "+toString(_grid.level));
    693694        }
    694695}
     
    788789    static_cast<SamplingGridProperties &>(instance) = other;
    789790    instance.setWindowSize(other.begin_window, other.end_window);
    790     if (_level >= other.level) {
     791    ASSERT( _level <= other.level,
     792        "SamplingGrid::downsample() - desired level "+toString(_level)
     793        +" larger than level "+toString(other.level)+" of the given values.");
     794    if (_level == other.level) {
    791795      instance.sampled_grid = other.sampled_grid;
    792796    } else {
     
    801805      int length_d[3];
    802806      int length_s[3];
    803       getLengthsOfGrid(length_s, other);
     807      getLengthsOfWindow(length_s, other);
    804808      for (instance.level = other.level-1; instance.level >= _level; --instance.level) {
    805         getLengthsOfGrid(length_d, instance);
     809        getLengthsOfWindow(length_d, instance);
    806810        // we always have an eighth of the number of sample points as we stop
     811        ASSERT( sourcevalues->size() % 8 == 0,
     812            "SamplingGrid::downsample() - at level "+toString( instance.level)
     813            +" given grid points "+toString(sourcevalues->size())+" are not even numbered per axis anymore.");
    807814        sampledvalues_t downsampled(sourcevalues->size()/(size_t)8, 0.);
    808815        restrictFullWeight(downsampled, length_d, *sourcevalues, length_s);
Note: See TracChangeset for help on using the changeset viewer.