source: XIOS/dev/branch_yushan/src/functor/minimum.cpp @ 1074

Last change on this file since 1074 was 1037, checked in by yushan, 8 years ago

initialize the branch

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