source: XIOS/dev/XIOS_DEV_CMIP6/src/functor/maximum.cpp @ 1474

Last change on this file since 1474 was 1474, checked in by oabramkina, 6 years ago

DEV_CMIP6: porting changes in r1471.

Now DEV_CMIP6 compiles with PGI.

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 1.5 KB
Line 
1#include "maximum.hpp"
2#include "array_new.hpp"
3#include "utils.hpp"
4
5namespace xios
6{
7   namespace func
8   {
9      /// ////////////////////// Définitions ////////////////////// ///
10
11      CMaximum::CMaximum(CArray<double,1>& doutput)
12         : SuperClass(StdString("maximum"), doutput)
13      { /* Ne rien faire de plus */ }
14
15      CMaximum::CMaximum(CArray<double,1>& doutput, double missingValue)
16         : SuperClass(StdString("maximum"), doutput, missingValue)
17      { /* Ne rien faire de plus */ }
18
19      CMaximum::~CMaximum(void)
20      { /* Ne rien faire de plus */ }
21
22      //---------------------------------------------------------------
23
24      void CMaximum::apply(const CArray<double,1>& _dinput,
25                                 CArray<double,1>& _doutput)
26      {
27        const double * it1  = _dinput.dataFirst(),
28                     * end1 = _dinput.dataFirst() + _dinput.numElements();
29              double * it   = _doutput.dataFirst();
30         if (this->nbcall == 1) for (; it1 != end1; it1++, it++) *it = *it1;
31         else 
32         {
33           if (hasMissingValue) 
34           { 
35             for (; it1 != end1; it1++, it++) 
36               if (!NumTraits<double>::isNan(*it1))
37               {
38                 if (!NumTraits<double>::isNan(*it)) *it = std::max(*it1, *it);
39                 else *it=*it1 ; 
40               }
41           }
42           else for (; it1 != end1; it1++, it++) *it = std::max(*it1, *it);
43         }
44
45
46      }
47
48      //---------------------------------------------------------------
49
50   } // namespace func
51} // namespace xios
Note: See TracBrowser for help on using the repository browser.