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

Last change on this file since 593 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
Line 
1#include "data_output.hpp"
2
3#include "attribute_template.hpp"
4#include "group_template.hpp"
5#include "context.hpp"
6
7namespace xios
8{
9      /// ////////////////////// Définitions ////////////////////// ///
10
11      CDataOutput::~CDataOutput(void)
12      { /* Ne rien faire de plus */ }
13
14      //----------------------------------------------------------------
15
16      void CDataOutput::writeGrid(CGrid* grid)
17      {
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());
33      }
34
35      //----------------------------------------------------------------
36
37      void CDataOutput::writeFile(CFile*  file)
38      {
39         this->writeFile_(file);
40      }
41
42      void CDataOutput::writeAttribute(CVariable*  var)
43      {
44         this->writeAttribute_(var) ;
45      }
46
47      void CDataOutput::syncFile(void)
48      {
49         this->syncFile_();
50      }
51
52      void CDataOutput::closeFile(void)
53      {
54         this->closeFile_();
55      }
56
57      //----------------------------------------------------------------
58
59      void CDataOutput::writeGrid(CDomain* domain,CAxis* axis)
60      {
61         this->writeDomain_(domain);
62         this->writeAxis_(axis);
63      }
64
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
73      //----------------------------------------------------------------
74
75      void CDataOutput::writeGrid(CDomain* domain)
76      {
77         this->writeDomain_(domain);
78      }
79
80      void CDataOutput::writeTimeDimension(void)
81      {
82         this->writeTimeDimension_();
83      }
84
85      //----------------------------------------------------------------
86
87      void CDataOutput::writeField(CField* field)
88      {
89         CContext* context = CContext::getCurrent() ;
90         boost::shared_ptr<CCalendar> calendar = context->getCalendar();
91
92         this->writeField_(field);
93         this->writeTimeAxis_(field, calendar);
94      }
95
96      //----------------------------------------------------------------
97
98      void CDataOutput::writeFieldGrid(CField* field)
99      {
100         this->writeGrid(field->getRelGrid());
101      }
102
103      //----------------------------------------------------------------
104
105      void CDataOutput::writeFieldData(CField* field)
106      {
107//         CGrid* grid = CGrid::get(field->grid_ref.getValue());
108//         CDomain* domain = CDomain::get(grid->domain_ref.getValue());
109         this->writeFieldData_(field);
110      }
111
112      ///----------------------------------------------------------------
113
114} // namespace xios
Note: See TracBrowser for help on using the repository browser.