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

Last change on this file since 321 was 321, checked in by ymipsl, 12 years ago

Add splitting file functionality
new file attribut "split_freq" to put the frequency of splitting

YM

File size: 3.3 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::syncFile(void)
47      {
48         this->syncFile_();
49      }
50
51      void CDataOutput::closeFile(void)
52      {
53         this->closeFile_();
54      }
55
56      //----------------------------------------------------------------
57
58      void CDataOutput::writeGrid
59         (const boost::shared_ptr<tree::CDomain> domain,
60          const boost::shared_ptr<tree::CAxis> axis)
61      {
62         this->writeDomain_(domain);
63         this->writeAxis_(axis);
64      }
65
66      //----------------------------------------------------------------
67
68      void CDataOutput::writeGrid
69         (const boost::shared_ptr<tree::CDomain> domain)
70      {
71         this->writeDomain_(domain);
72      }
73
74      //----------------------------------------------------------------
75
76      void CDataOutput::writeField
77         (const boost::shared_ptr<tree::CField> field)
78      {
79         boost::shared_ptr<tree::CContext> context =
80         CObjectFactory::GetObject<tree::CContext>(CObjectFactory::GetCurrentContextId());
81         boost::shared_ptr<date::CCalendar> calendar = context->getCalendar();
82         
83         this->writeField_(field);
84         this->writeTimeAxis_(field, calendar);
85      }
86
87      //----------------------------------------------------------------
88
89      void CDataOutput::writeFieldGrid
90         (const boost::shared_ptr<tree::CField> field)
91      {
92         this->writeGrid(field->getRelGrid());
93      }
94     
95      //----------------------------------------------------------------
96     
97      void CDataOutput::writeFieldData(const boost::shared_ptr<tree::CField> field)
98      {
99         boost::shared_ptr<CGrid> grid =
100            CObjectFactory::GetObject<CGrid>(field->grid_ref.getValue());
101         boost::shared_ptr<CDomain> domain =
102            CObjectFactory::GetObject<CDomain>(grid->domain_ref.getValue());
103           
104//         if (domain->isEmpty()) return;
105         this->writeFieldData_(field);
106      }
107     
108      ///----------------------------------------------------------------
109
110   } // namespace io
111} // namespace xmlioserver
Note: See TracBrowser for help on using the repository browser.