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

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

Suppress access to CObjectFactory class and CTreeManager.

YM

File size: 2.9 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 xios
8{
9      /// ////////////////////// Définitions ////////////////////// ///
10
11      CDataOutput::~CDataOutput(void)
12      { /* Ne rien faire de plus */ }
13
14      //----------------------------------------------------------------
15
16      void CDataOutput::writeGrid
17         (const boost::shared_ptr<CGrid> grid)
18      {
19         if (grid->domain_ref.isEmpty())
20            ERROR("CDataOutput::writeGrid(grid)",
21                   << " domain is not defined !");
22
23         if (grid->axis_ref.isEmpty())
24         {
25            this->writeGrid(CDomain::get(grid->domain_ref.getValue()));
26         }
27         else
28         {
29            this->writeGrid(CDomain::get(grid->domain_ref.getValue()),
30                            CAxis::get(grid->axis_ref.getValue()));
31         }
32      }
33
34      //----------------------------------------------------------------
35
36      void CDataOutput::writeFile
37         (const boost::shared_ptr<CFile>  file)
38      {
39         this->writeFile_(file);
40      }
41 
42      void CDataOutput::syncFile(void)
43      {
44         this->syncFile_();
45      }
46
47      void CDataOutput::closeFile(void)
48      {
49         this->closeFile_();
50      }
51
52      //----------------------------------------------------------------
53
54      void CDataOutput::writeGrid
55         (const boost::shared_ptr<CDomain> domain,
56          const boost::shared_ptr<CAxis> axis)
57      {
58         this->writeDomain_(domain);
59         this->writeAxis_(axis);
60      }
61
62      //----------------------------------------------------------------
63
64      void CDataOutput::writeGrid
65         (const boost::shared_ptr<CDomain> domain)
66      {
67         this->writeDomain_(domain);
68      }
69
70      //----------------------------------------------------------------
71
72      void CDataOutput::writeField
73         (const boost::shared_ptr<CField> field)
74      {
75         boost::shared_ptr<CContext> context = CContext::getCurrent() ;
76         boost::shared_ptr<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<CField> field)
86      {
87         this->writeGrid(field->getRelGrid());
88      }
89     
90      //----------------------------------------------------------------
91     
92      void CDataOutput::writeFieldData(const boost::shared_ptr<CField> field)
93      {
94         boost::shared_ptr<CGrid> grid = CGrid::get(field->grid_ref.getValue());
95         boost::shared_ptr<CDomain> domain = CDomain::get(grid->domain_ref.getValue());
96           
97//         if (domain->isEmpty()) return;
98         this->writeFieldData_(field);
99      }
100     
101      ///----------------------------------------------------------------
102
103} // namespace xios
Note: See TracBrowser for help on using the repository browser.