LCOV - code coverage report
Current view: top level - msvis/MSVis/statistics - Vi2StatsUVRangeIterator.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 19 30 63.3 %
Date: 2024-11-06 17:42:47 Functions: 5 9 55.6 %

          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: casa-feedback@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      185132 : Vi2StatsUVRangeIterator::Vi2StatsUVRangeIterator(const Array<Double>& a)
      36      185132 :         : array(&a)
      37      185132 :         , array_iter(array->begin())
      38      185132 :         , end_iter(array->end()) {}
      39             : 
      40      179522 : Vi2StatsUVRangeIterator::Vi2StatsUVRangeIterator()
      41      179522 :         : Vi2StatsUVRangeIterator(empty_array) {}
      42             : 
      43             : Vi2StatsUVRangeIterator&
      44      116604 : Vi2StatsUVRangeIterator::operator++()
      45             : {
      46      116604 :         ++array_iter;
      47      116604 :         ++array_iter;
      48      116604 :         ++array_iter;
      49      116604 :         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           0 : }
      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      116604 : Vi2StatsUVRangeIterator::operator*()
      74             : {
      75      116604 :         Matrix<Double>::const_iterator iter = array_iter;
      76      116604 :         Double u = *iter;
      77      116604 :         Double v = *(++iter);
      78      233208 :         return std::hypot(u, v);
      79      116604 : }
      80             : 
      81             : bool
      82           0 : Vi2StatsUVRangeIterator::atEnd()
      83             : {
      84           0 :         return array_iter == end_iter;
      85             : }
      86             : 
      87             : uInt64
      88        5610 : Vi2StatsUVRangeIterator::getCount()
      89             : {
      90        5610 :         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