LCOV - code coverage report
Current view: top level - msvis/MSVis/statistics - Vi2StatsUVRangeIterator.cc (source / functions) Hit Total Coverage
Test: ctest_coverage.info Lines: 0 27 0.0 %
Date: 2023-11-02 14:27:30 Functions: 0 9 0.0 %

          Line data    Source code
       1             : //# Copyright (C) 1996,1997,1998,1999,2000,2002,2003,2015
       2             : //# Associated Universities, Inc. Washington DC, USA.
       3             : //#
       4             : //# This library is free software; you can redistribute it and/or modify it
       5             : //# under the terms of the GNU Library General Public License as published by
       6             : //# the Free Software Foundation; either version 2 of the License, or (at your
       7             : //# option) any later version.
       8             : //#
       9             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      10             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      11             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
      12             : //# License for more details.
      13             : //#
      14             : //# You should have received a copy of the GNU Library General Public License
      15             : //# along with this library; if not, write to the Free Software Foundation,
      16             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      17             : //#
      18             : //# Correspondence concerning AIPS++ should be addressed as follows:
      19             : //#        Internet email: aips2-request@nrao.edu.
      20             : //#        Postal address: AIPS++ Project Office
      21             : //#                        National Radio Astronomy Observatory
      22             : //#                        520 Edgemont Road
      23             : //#                        Charlottesville, VA 22903-2475 USA
      24             : //#
      25             : //
      26             : // Data provider of uvrange values, based on uvw column
      27             : //
      28             : #include <msvis/MSVis/statistics/Vi2StatsUVRangeIterator.h>
      29             : #include <casacore/casa/Arrays/Matrix.h>
      30             : #include <cmath>
      31             : 
      32             : using namespace casacore;
      33             : namespace casa {
      34             : 
      35           0 : Vi2StatsUVRangeIterator::Vi2StatsUVRangeIterator(const Array<Double>& a)
      36             :         : array(&a)
      37           0 :         , array_iter(array->begin())
      38           0 :         , end_iter(array->end()) {}
      39             : 
      40           0 : Vi2StatsUVRangeIterator::Vi2StatsUVRangeIterator()
      41           0 :         : Vi2StatsUVRangeIterator(empty_array) {}
      42             : 
      43             : Vi2StatsUVRangeIterator&
      44           0 : Vi2StatsUVRangeIterator::operator++()
      45             : {
      46           0 :         ++array_iter;
      47           0 :         ++array_iter;
      48           0 :         ++array_iter;
      49           0 :         return *this;
      50             : }
      51             : 
      52             : Vi2StatsUVRangeIterator
      53           0 : Vi2StatsUVRangeIterator::operator++(int)
      54             : {
      55           0 :         Vi2StatsUVRangeIterator tmp(*this);
      56           0 :         operator++();
      57           0 :         return tmp;
      58             : }
      59             : 
      60             : bool
      61           0 : Vi2StatsUVRangeIterator::operator==(const Vi2StatsUVRangeIterator& rhs)
      62             : {
      63           0 :         return array_iter == rhs.array_iter;
      64             : }
      65             : 
      66             : bool
      67           0 : Vi2StatsUVRangeIterator::operator!=(const Vi2StatsUVRangeIterator& rhs)
      68             : {
      69           0 :         return array_iter != rhs.array_iter;
      70             : }
      71             : 
      72             : Double
      73           0 : Vi2StatsUVRangeIterator::operator*()
      74             : {
      75           0 :         Matrix<Double>::const_iterator iter = array_iter;
      76           0 :         Double u = *iter;
      77           0 :         Double v = *(++iter);
      78           0 :         return std::hypot(u, v);
      79             : }
      80             : 
      81             : bool
      82           0 : Vi2StatsUVRangeIterator::atEnd()
      83             : {
      84           0 :         return array_iter == end_iter;
      85             : }
      86             : 
      87             : uInt64
      88           0 : Vi2StatsUVRangeIterator::getCount()
      89             : {
      90           0 :         return array->size() / 3;
      91             : }
      92             : 
      93             : const Array<Double> Vi2StatsUVRangeIterator::empty_array;
      94             : 
      95             : using namespace casacore;
      96             : } // namespace casa

Generated by: LCOV version 1.16