source: XIOS/trunk/src/data_output.cpp @ 540

Last change on this file since 540 was 540, checked in by mhnguyen, 9 years ago

Reorganizing structure of grid

+) Grid doesn't have domain_ref and axis_ref anymore.
All domain and axis of a grid must be inside grid (These domain and axis can be defined or refer to others)
+) Grid contains list of domain and axis
+) Reorder some functions to make sure new functionlities work

Test
+) On Curie
+) Mode attached and detached
+) Only test_new_features
+) Passed

  • 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.2 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
[347]16      void CDataOutput::writeGrid(CGrid* grid)
[219]17      {
[540]18//         if (grid->domain_ref.isEmpty())
19//            ERROR("CDataOutput::writeGrid(grid)",
20//                   << " domain is not defined !");
21//
22//         if (grid->axis_ref.isEmpty())
23//         {
24//            this->writeGrid(CDomain::get(grid->domain_ref.getValue()));
25//         }
26//         else
27//         {
28//            this->writeGrid(CDomain::get(grid->domain_ref.getValue()),
29//                            CAxis::get(grid->axis_ref.getValue()));
30//         }
31//        this->writeGrid(grid->domain, grid->axis);
32        this->writeGrid(grid->getDomains(), grid->getAxis());
[219]33      }
34
35      //----------------------------------------------------------------
36
[347]37      void CDataOutput::writeFile(CFile*  file)
[219]38      {
39         this->writeFile_(file);
40      }
[472]41
42      void CDataOutput::writeAttribute(CVariable*  var)
43      {
44         this->writeAttribute_(var) ;
45      }
46
[321]47      void CDataOutput::syncFile(void)
48      {
49         this->syncFile_();
50      }
[219]51
[286]52      void CDataOutput::closeFile(void)
53      {
54         this->closeFile_();
55      }
56
[219]57      //----------------------------------------------------------------
58
[347]59      void CDataOutput::writeGrid(CDomain* domain,CAxis* axis)
[219]60      {
61         this->writeDomain_(domain);
62         this->writeAxis_(axis);
63      }
64
[540]65      void CDataOutput::writeGrid(std::vector<CDomain*> domains, std::vector<CAxis*> axis)
66      {
67        int domSize = domains.size();
68        int aSize = axis.size();
69        for (int i = 0; i < domSize; ++i) this->writeDomain_(domains[i]);
70        for (int i = 0; i < aSize; ++i) this->writeAxis_(axis[i]);
71      }
72
[219]73      //----------------------------------------------------------------
74
[347]75      void CDataOutput::writeGrid(CDomain* domain)
[219]76      {
77         this->writeDomain_(domain);
78      }
79
[391]80      void CDataOutput::writeTimeDimension(void)
81      {
82         this->writeTimeDimension_();
83      }
84
[219]85      //----------------------------------------------------------------
86
[347]87      void CDataOutput::writeField(CField* field)
[219]88      {
[347]89         CContext* context = CContext::getCurrent() ;
[343]90         boost::shared_ptr<CCalendar> calendar = context->getCalendar();
[540]91
[219]92         this->writeField_(field);
93         this->writeTimeAxis_(field, calendar);
94      }
95
96      //----------------------------------------------------------------
97
[347]98      void CDataOutput::writeFieldGrid(CField* field)
[219]99      {
100         this->writeGrid(field->getRelGrid());
101      }
[540]102
[219]103      //----------------------------------------------------------------
[540]104
[347]105      void CDataOutput::writeFieldData(CField* field)
[219]106      {
[540]107//         CGrid* grid = CGrid::get(field->grid_ref.getValue());
108//         CDomain* domain = CDomain::get(grid->domain_ref.getValue());
[219]109         this->writeFieldData_(field);
110      }
[540]111
[219]112      ///----------------------------------------------------------------
113
[335]114} // namespace xios
Note: See TracBrowser for help on using the repository browser.