source: XIOS/dev/dev_ym/XIOS_COUPLING/src/data_output.cpp @ 2121

Last change on this file since 2121 was 1961, checked in by ymipsl, 4 years ago

Rewrite file writing filter.
YM

  • 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: 3.6 KB
RevLine 
[219]1#include "data_output.hpp"
2
[352]3#include "attribute_template.hpp"
4#include "group_template.hpp"
[219]5#include "context.hpp"
6
[335]7namespace xios
[219]8{
9      /// ////////////////////// Définitions ////////////////////// ///
10
11      CDataOutput::~CDataOutput(void)
12      { /* Ne rien faire de plus */ }
13
14      //----------------------------------------------------------------
15
[676]16      void CDataOutput::writeGrid(CGrid* grid, bool allowCompressedOutput /*= false*/)
[219]17      {
[887]18        this->writeGrid(grid->getDomains(), grid->getAxis(), grid->getScalars());
[676]19
20        if (allowCompressedOutput)
21          writeGridCompressed_(grid);
[219]22      }
23
24      //----------------------------------------------------------------
25
[347]26      void CDataOutput::writeFile(CFile*  file)
[219]27      {
28         this->writeFile_(file);
29      }
[472]30
31      void CDataOutput::writeAttribute(CVariable*  var)
32      {
33         this->writeAttribute_(var) ;
34      }
35
[321]36      void CDataOutput::syncFile(void)
37      {
38         this->syncFile_();
39      }
[219]40
[286]41      void CDataOutput::closeFile(void)
42      {
43         this->closeFile_();
44      }
45
[219]46      //----------------------------------------------------------------
47
[676]48      void CDataOutput::writeGrid(CDomain* domain, CAxis* axis)
[1622]49      TRY
[219]50      {
51         this->writeDomain_(domain);
52         this->writeAxis_(axis);
53      }
[1622]54      CATCH
[219]55
[540]56      void CDataOutput::writeGrid(std::vector<CDomain*> domains, std::vector<CAxis*> axis)
[1622]57      TRY
[540]58      {
59        int domSize = domains.size();
60        int aSize = axis.size();
61        for (int i = 0; i < domSize; ++i) this->writeDomain_(domains[i]);
62        for (int i = 0; i < aSize; ++i) this->writeAxis_(axis[i]);
63      }
[1622]64      CATCH
[540]65
[887]66      void CDataOutput::writeGrid(std::vector<CDomain*> domains, std::vector<CAxis*> axis, std::vector<CScalar*> scalars)
[1622]67      TRY
[887]68      {
69        int domSize = domains.size();
70        int aSize = axis.size();
71        int sSize = scalars.size();
72        for (int i = 0; i < domSize; ++i) this->writeDomain_(domains[i]);
73        for (int i = 0; i < aSize; ++i) this->writeAxis_(axis[i]);
74        for (int i = 0; i < sSize; ++i) this->writeScalar_(scalars[i]);
75      }
[1622]76      CATCH
[887]77
[219]78      //----------------------------------------------------------------
79
[347]80      void CDataOutput::writeGrid(CDomain* domain)
[1622]81      TRY
[219]82      {
83         this->writeDomain_(domain);
84      }
[1622]85      CATCH
[219]86
[391]87      void CDataOutput::writeTimeDimension(void)
[1622]88      TRY
[391]89      {
90         this->writeTimeDimension_();
91      }
[1622]92      CATCH
[391]93
[219]94      //----------------------------------------------------------------
95
[1158]96      void CDataOutput::writeFieldTimeAxis(CField* field)
[1622]97      TRY
[219]98      {
[347]99         CContext* context = CContext::getCurrent() ;
[1542]100         std::shared_ptr<CCalendar> calendar = context->getCalendar();
[540]101
[219]102         this->writeTimeAxis_(field, calendar);
103      }
[1622]104      CATCH
105
[1158]106      void CDataOutput::writeField(CField* field)
[1622]107      TRY
[1158]108      {
109         this->writeField_(field);
110      }
[1622]111      CATCH
[219]112
113      //----------------------------------------------------------------
114
[347]115      void CDataOutput::writeFieldGrid(CField* field)
[1622]116      TRY
[219]117      {
[676]118         this->writeGrid(field->getRelGrid(),
119                         !field->indexed_output.isEmpty() && field->indexed_output);
[219]120      }
[1622]121      CATCH
[219]122      //----------------------------------------------------------------
[540]123
[1961]124      int CDataOutput::writeFieldData(CField* field, const CArray<double,1>& data, const CDate& lastWrite, const CDate& currentWrite, int nstep)
[1622]125      TRY
[219]126      {
[1961]127        return this->writeFieldData_(field, data, lastWrite, currentWrite, nstep);
[219]128      }
[1622]129      CATCH
[540]130
[1961]131
[219]132      ///----------------------------------------------------------------
133
[335]134} // namespace xios
Note: See TracBrowser for help on using the repository browser.