source: XMLIO_V2/dev/common/src/xmlio/data_output.cpp @ 286

Last change on this file since 286 was 286, checked in by ymipsl, 13 years ago

reprise en main de la version de H. Ozdoba. Correction de différentes erreurs de conception et bug.
Version NEMO operationnel en client/server, interoperabilita avec OASIS, reconstition de fichiers via netcdf4/HDF5

YM

File size: 3.2 KB
Line 
1#include "data_output.hpp"
2
3#include "attribute_template_impl.hpp"
4#include "group_template_impl.hpp"
5#include "context.hpp"
6
7namespace xmlioserver
8{
9   namespace io
10   {
11      /// ////////////////////// Définitions ////////////////////// ///
12
13      CDataOutput::~CDataOutput(void)
14      { /* Ne rien faire de plus */ }
15
16      //----------------------------------------------------------------
17
18      void CDataOutput::writeGrid
19         (const boost::shared_ptr<tree::CGrid> grid)
20      {
21         if (grid->domain_ref.isEmpty())
22            ERROR("CONetCDF4Adv::writeGrid(grid)",
23                   << " domain is not defined !");
24
25         if (grid->axis_ref.isEmpty())
26         {
27            this->writeGrid
28            (CObjectFactory::GetObject<tree::CDomain>(grid->domain_ref.getValue()));
29         }
30         else
31         {
32            this->writeGrid
33            (CObjectFactory::GetObject<tree::CDomain>(grid->domain_ref.getValue()),
34             CObjectFactory::GetObject<tree::CAxis>(grid->axis_ref.getValue()));
35         }
36      }
37
38      //----------------------------------------------------------------
39
40      void CDataOutput::writeFile
41         (const boost::shared_ptr<tree::CFile>  file)
42      {
43         this->writeFile_(file);
44      }
45
46      void CDataOutput::closeFile(void)
47      {
48         this->closeFile_();
49      }
50
51      //----------------------------------------------------------------
52
53      void CDataOutput::writeGrid
54         (const boost::shared_ptr<tree::CDomain> domain,
55          const boost::shared_ptr<tree::CAxis> axis)
56      {
57         this->writeDomain_(domain);
58         this->writeAxis_(axis);
59      }
60
61      //----------------------------------------------------------------
62
63      void CDataOutput::writeGrid
64         (const boost::shared_ptr<tree::CDomain> domain)
65      {
66         this->writeDomain_(domain);
67      }
68
69      //----------------------------------------------------------------
70
71      void CDataOutput::writeField
72         (const boost::shared_ptr<tree::CField> field)
73      {
74         boost::shared_ptr<tree::CContext> context =
75         CObjectFactory::GetObject<tree::CContext>(CObjectFactory::GetCurrentContextId());
76         boost::shared_ptr<date::CCalendar> calendar = context->getCalendar();
77         
78         this->writeField_(field);
79         this->writeTimeAxis_(field, calendar);
80      }
81
82      //----------------------------------------------------------------
83
84      void CDataOutput::writeFieldGrid
85         (const boost::shared_ptr<tree::CField> field)
86      {
87         this->writeGrid(field->getRelGrid());
88      }
89     
90      //----------------------------------------------------------------
91     
92      void CDataOutput::writeFieldData(const boost::shared_ptr<tree::CField> field)
93      {
94         boost::shared_ptr<CGrid> grid =
95            CObjectFactory::GetObject<CGrid>(field->grid_ref.getValue());
96         boost::shared_ptr<CDomain> domain =
97            CObjectFactory::GetObject<CDomain>(grid->domain_ref.getValue());
98           
99//         if (domain->isEmpty()) return;
100         this->writeFieldData_(field);
101      }
102     
103      ///----------------------------------------------------------------
104
105   } // namespace io
106} // namespace xmlioserver
Note: See TracBrowser for help on using the repository browser.