source: XIOS/dev/XIOS_DEV_CMIP6/src/functor/minimum.cpp @ 1211

Last change on this file since 1211 was 1158, checked in by oabramkina, 7 years ago

Two server levels: merging with trunk r1137.
There are bugs.

  • 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.6 KB
Line 
1#include "minimum.hpp"
2#include "array_new.hpp"
3#include <algorithm>
4#include "utils.hpp"
5
6namespace xios
7{
8   namespace func
9   {
10      /// ////////////////////// Définitions ////////////////////// ///
11
12      CMinimum::CMinimum(CArray<double,1>& doutput)
13         : SuperClass(StdString("minimum"), doutput)
14      { /* Ne rien faire de plus */ }
15
16      CMinimum::CMinimum(CArray<double,1>& doutput, double missingValue)
17         : SuperClass(StdString("minimum"), doutput, missingValue)
18      { /* Ne rien faire de plus */ }
19
20      CMinimum::~CMinimum(void)
21      { /* Ne rien faire de plus */ }
22
23      //---------------------------------------------------------------
24
25      void CMinimum::apply(const CArray<double,1>& _dinput,
26                                 CArray<double,1>& _doutput)
27      {
28        const double * it1  = _dinput.dataFirst(),
29                      *end1 = _dinput.dataFirst() + _dinput.numElements();
30        double * it   = _doutput.dataFirst();
31       
32        if (this->nbcall == 1)  for (; it1 != end1; it1++, it++) *it = *it1;
33        else 
34        {
35          if (hasMissingValue) 
36          { 
37            for (; it1 != end1; it1++, it++) 
38              if (!NumTraits<double>::isnan(*it1))
39              {
40                if (!NumTraits<double>::isnan(*it)) *it = std::min(*it1, *it);
41                else *it=*it1 ;
42              }
43          }
44          else for (; it1 != end1; it1++, it++) *it = std::min(*it1, *it);
45        }
46
47      }
48
49      //---------------------------------------------------------------
50
51   } // namespace func
52} // namespace xios
Note: See TracBrowser for help on using the repository browser.