Skip to content
Snippets Groups Projects
Select Git revision
  • 3f147e49852e19b79b873f3f88edaff2314ae196
  • master default protected
  • hierarchical-basis
  • revert-ef4a3a4f
  • patch_releases_4_14
  • overlaps_tags_and_distributed_export
  • overlaps_tags_and_distributed_export_rebased
  • relaying
  • alphashapes
  • steplayer
  • bl
  • pluginMeshQuality
  • fixBugsAmaury
  • new_export_boris
  • oras_vs_osm
  • reassign_partitions
  • distributed_fwi
  • rename-classes
  • fix/fortran-api-example-t4
  • robust_partitions
  • reducing_files
  • gmsh_4_14_0
  • gmsh_4_13_1
  • gmsh_4_13_0
  • gmsh_4_12_2
  • gmsh_4_12_1
  • gmsh_4_12_0
  • gmsh_4_11_1
  • gmsh_4_11_0
  • gmsh_4_10_5
  • gmsh_4_10_4
  • gmsh_4_10_3
  • gmsh_4_10_2
  • gmsh_4_10_1
  • gmsh_4_10_0
  • gmsh_4_9_5
  • gmsh_4_9_4
  • gmsh_4_9_3
  • gmsh_4_9_2
  • gmsh_4_9_1
  • gmsh_4_9_0
41 results

Range.h

Blame
  • Range.h 1.08 KiB
    // Gmsh - Copyright (C) 1997-2019 C. Geuzaine, J.-F. Remacle
    //
    // See the LICENSE.txt file for license information. Please report all
    // issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
    
    #ifndef RANGE_H
    #define RANGE_H
    
    // represents a range of values of the template type
    template <class T> class Range {
    private:
      T Low;
      T High;
    
    public:
      Range() {}
      Range(const T &low, const T &high) : Low(low), High(high) {}
      T low() const { return Low; }
      void low(const T &low) { Low = low; }
      T high() const { return High; }
      void high(const T &high) { High = high; }
      int contains(const T &value) const;
      int contains(const Range<T> &range) const;
      int operator==(const Range<T> &range) const;
    };
    
    template <class T> int Range<T>::contains(const T &value) const
    {
      return ((value >= Low) && (value <= High));
    }
    
    template <class T> int Range<T>::contains(const Range<T> &range) const
    {
      return ((range.low() >= Low) && (range.high() <= High));
    }
    
    template <class T> int Range<T>::operator==(const Range<T> &range) const
    {
      return ((range.low() == Low) && (range.high() == High));
    }
    
    #endif