source: XIOS/dev/dev_olga/src/data_output.cpp @ 1612

Last change on this file since 1612 was 1612, checked in by oabramkina, 5 years ago

Dev: adding exception handling.

To activate it, compilation flag -DXIOS_EXCEPTION should be added.

  • 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)
[1612]49      TRY
[219]50      {
51         this->writeDomain_(domain);
52         this->writeAxis_(axis);
53      }
[1612]54      CATCH
[219]55
[540]56      void CDataOutput::writeGrid(std::vector<CDomain*> domains, std::vector<CAxis*> axis)
[1612]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      }
[1612]64      CATCH
[540]65
[887]66      void CDataOutput::writeGrid(std::vector<CDomain*> domains, std::vector<CAxis*> axis, std::vector<CScalar*> scalars)
[1612]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      }
[1612]76      CATCH
[887]77
[219]78      //----------------------------------------------------------------
79
[347]80      void CDataOutput::writeGrid(CDomain* domain)
[1612]81      TRY
[219]82      {
83         this->writeDomain_(domain);
84      }
[1612]85      CATCH
[219]86
[391]87      void CDataOutput::writeTimeDimension(void)
[1612]88      TRY
[391]89      {
90         this->writeTimeDimension_();
91      }
[1612]92      CATCH
[391]93
[219]94      //----------------------------------------------------------------
95
[1158]96      void CDataOutput::writeFieldTimeAxis(CField* field)
[1612]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      }
[1612]104      CATCH
105
[1158]106      void CDataOutput::writeField(CField* field)
[1612]107      TRY
[1158]108      {
109         this->writeField_(field);
110      }
[1612]111      CATCH
[219]112
113      //----------------------------------------------------------------
114
[347]115      void CDataOutput::writeFieldGrid(CField* field)
[1612]116      TRY
[219]117      {
[676]118         this->writeGrid(field->getRelGrid(),
119                         !field->indexed_output.isEmpty() && field->indexed_output);
[219]120      }
[1612]121      CATCH
[219]122      //----------------------------------------------------------------
[540]123
[347]124      void CDataOutput::writeFieldData(CField* field)
[1612]125      TRY
[219]126      {
[540]127//         CGrid* grid = CGrid::get(field->grid_ref.getValue());
128//         CDomain* domain = CDomain::get(grid->domain_ref.getValue());
[219]129         this->writeFieldData_(field);
130      }
[1612]131      CATCH
[540]132
[219]133      ///----------------------------------------------------------------
134
[335]135} // namespace xios
Note: See TracBrowser for help on using the repository browser.