Action_Thermostats
        Add_AtomRandomPerturbation
        Add_SelectAtomByNameAction
        Adding_Graph_to_ChangeBondActions
        Adding_MD_integration_tests
        Adding_StructOpt_integration_tests
        AutomationFragmentation_failures
        Candidate_v1.6.1
        Candidate_v1.7.0
        ChangeBugEmailaddress
        ChemicalSpaceEvaluator
        EmpiricalPotential_contain_HomologyGraph_documentation
        Enhance_userguide
        Enhanced_StructuralOptimization
        Enhanced_StructuralOptimization_continued
        Example_ManyWaysToTranslateAtom
        Exclude_Hydrogens_annealWithBondGraph
        Fix_Verbose_Codepatterns
        ForceAnnealing_oldresults
        ForceAnnealing_with_BondGraph
        ForceAnnealing_with_BondGraph_continued
        ForceAnnealing_with_BondGraph_continued_betteresults
        ForceAnnealing_with_BondGraph_contraction-expansion
        GeometryObjects
        Gui_displays_atomic_force_velocity
        IndependentFragmentGrids_IntegrationTest
        JobMarket_RobustOnKillsSegFaults
        JobMarket_StableWorkerPool
        PythonUI_with_named_parameters
        QtGui_reactivate_TimeChanged_changes
        Recreated_GuiChecks
        StoppableMakroAction
        TremoloParser_IncreasedPrecision
        TremoloParser_MultipleTimesteps
        stable
      
      
        
          | 
            Last change
 on this file since 48eab8 was             c1948c, checked in by Frederik Heber <heber@…>, 9 years ago           | 
        
        
          | 
             
Added getDiscreteWindowIndices() and getDiscreteWindowLengthPerAxis() to SamplingGrid. 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100644
               
             
           | 
        
        
          | 
            File size:
            1.5 KB
           | 
        
      
      
| Line |   | 
|---|
| 1 | /*
 | 
|---|
| 2 |  * SamplingGrid_inline.hpp
 | 
|---|
| 3 |  *
 | 
|---|
| 4 |  *  Created on: Jan 27, 2013
 | 
|---|
| 5 |  *      Author: heber
 | 
|---|
| 6 |  */
 | 
|---|
| 7 | 
 | 
|---|
| 8 | #ifndef SAMPLINGGRID_INLINE_HPP_
 | 
|---|
| 9 | #define SAMPLINGGRID_INLINE_HPP_
 | 
|---|
| 10 | 
 | 
|---|
| 11 | // include config.h
 | 
|---|
| 12 | #ifdef HAVE_CONFIG_H
 | 
|---|
| 13 | #include <config.h>
 | 
|---|
| 14 | #endif
 | 
|---|
| 15 | 
 | 
|---|
| 16 | #include "SamplingGrid.hpp"
 | 
|---|
| 17 | 
 | 
|---|
| 18 | #ifdef HAVE_INLINE
 | 
|---|
| 19 | inline
 | 
|---|
| 20 | #endif
 | 
|---|
| 21 | const double SamplingGrid::getWindowVolume() const
 | 
|---|
| 22 | {
 | 
|---|
| 23 |   double volume = 1.;
 | 
|---|
| 24 |   for (size_t i=0;i<NDIM;++i)
 | 
|---|
| 25 |     volume *= end_window[i]-begin_window[i];
 | 
|---|
| 26 |   return volume;
 | 
|---|
| 27 | }
 | 
|---|
| 28 | 
 | 
|---|
| 29 | #ifdef HAVE_INLINE
 | 
|---|
| 30 | inline
 | 
|---|
| 31 | #endif
 | 
|---|
| 32 | const double SamplingGrid::getWindowLengthPerAxis(const size_t axis) const
 | 
|---|
| 33 | {
 | 
|---|
| 34 |   return (end_window[axis] - begin_window[axis]);
 | 
|---|
| 35 | }
 | 
|---|
| 36 | 
 | 
|---|
| 37 | #ifdef HAVE_INLINE
 | 
|---|
| 38 | inline
 | 
|---|
| 39 | #endif
 | 
|---|
| 40 | const size_t SamplingGrid::getDiscreteWindowLengthPerAxis(const size_t axis) const
 | 
|---|
| 41 | {
 | 
|---|
| 42 |   const double round_offset =
 | 
|---|
| 43 |       (std::numeric_limits<size_t>::round_style == std::round_toward_zero) ?
 | 
|---|
| 44 |           0.5 : 0.; // need offset to get to round_toward_nearest behavior
 | 
|---|
| 45 |   const double length =
 | 
|---|
| 46 |     (double)getGridPointsPerAxis()*getWindowLengthPerAxis(axis)/getTotalLengthPerAxis(axis)+round_offset;
 | 
|---|
| 47 |   return length;
 | 
|---|
| 48 | }
 | 
|---|
| 49 | 
 | 
|---|
| 50 | #ifdef HAVE_INLINE
 | 
|---|
| 51 | inline
 | 
|---|
| 52 | #endif
 | 
|---|
| 53 | const size_t SamplingGrid::getWindowGridPoints() const
 | 
|---|
| 54 | {
 | 
|---|
| 55 |   return getWindowGridPointsPerAxis(0)
 | 
|---|
| 56 |       *getWindowGridPointsPerAxis(1)
 | 
|---|
| 57 |       *getWindowGridPointsPerAxis(2);
 | 
|---|
| 58 | }
 | 
|---|
| 59 | 
 | 
|---|
| 60 | #ifdef HAVE_INLINE
 | 
|---|
| 61 | inline
 | 
|---|
| 62 | #endif
 | 
|---|
| 63 | void SamplingGrid::setDomainSize(
 | 
|---|
| 64 |     const double _begin[NDIM],
 | 
|---|
| 65 |     const double _end[NDIM])
 | 
|---|
| 66 | {
 | 
|---|
| 67 |   for (size_t index=0;index<NDIM;++index) {
 | 
|---|
| 68 |     begin[index] = _begin[index];
 | 
|---|
| 69 |     end[index] = _end[index];
 | 
|---|
| 70 |   }
 | 
|---|
| 71 | }
 | 
|---|
| 72 | 
 | 
|---|
| 73 | #endif /* SAMPLINGGRID_INLINE_HPP_ */
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.