New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
field_impl.hpp in vendors/XIOS/current/src – NEMO

source: vendors/XIOS/current/src/field_impl.hpp @ 3408

Last change on this file since 3408 was 3408, checked in by rblod, 12 years ago

importing initial XIOS vendor drop

  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1
2#ifndef __FIELD_IMPL_HPP__
3#define __FIELD_IMPL_HPP__
4
5#include "xmlioserver_spl.hpp"
6#include "field.hpp"
7#include "context.hpp"
8#include "grid.hpp"
9#include "timer.hpp"
10
11
12namespace xios {
13
14   template <StdSize N>
15   void CField::setData(const ARRAY(double, N) _data)
16   {
17     const std::vector<CField*>& refField=getAllReference();
18     std::vector<CField*>::const_iterator  it = refField.begin(), end = refField.end();
19     
20     for (; it != end; it++) (*it)->updateData(_data) ;
21    }
22   
23   template <StdSize N>
24      bool CField::updateData(const ARRAY(double, N) _data)
25   {       
26      CContext* context=CContext::getCurrent();
27      const CDate & currDate = context->getCalendar()->getCurrentDate();
28      const CDate opeDate      = *last_operation + freq_operation;
29      const CDate writeDate    = *last_Write     + freq_write;       
30
31   
32      info(50) << "CField::updateData " << currDate <<  " : send data to " << this->getBaseFieldId() << std::endl;
33      info(50) << "Next operation "  << opeDate<<std::endl;
34
35      if (opeDate <= currDate)
36      {
37         if (this->data->num_elements() != this->grid->storeIndex_client->num_elements())
38         {
39            this->data->resize(boost::extents[this->grid->storeIndex_client ->num_elements()]);
40         }
41           
42         ARRAY_CREATE(input, double, 1, [this->data->num_elements()]);
43         this->grid->inputField(_data, input);         
44         (*this->foperation)(input);
45         
46         *last_operation = currDate;
47         info(50) << "(*last_operation = currDate) : " << *last_operation << " = " << currDate << std::endl; 
48      }
49     
50      if (writeDate < (currDate + freq_operation))
51      {
52         this->foperation->final();
53         *last_Write = writeDate;
54         info(50) << "(*last_Write = currDate) : " << *last_Write << " = " << currDate << std::endl;
55         CTimer::get("XIOS Send Data").resume() ;
56         sendUpdateData() ;
57         CTimer::get("XIOS Send Data").suspend() ;
58         return (true);       
59      }
60
61      return (false);
62   }
63
64} // namespace xios
65
66#endif
Note: See TracBrowser for help on using the repository browser.