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

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

removed "tree" namespace

YM

File size: 3.1 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
26            (CObjectFactory::GetObject<CDomain>(grid->domain_ref.getValue()));
27         }
28         else
29         {
30            this->writeGrid
31            (CObjectFactory::GetObject<CDomain>(grid->domain_ref.getValue()),
32             CObjectFactory::GetObject<CAxis>(grid->axis_ref.getValue()));
33         }
34      }
35
36      //----------------------------------------------------------------
37
38      void CDataOutput::writeFile
39         (const boost::shared_ptr<CFile>  file)
40      {
41         this->writeFile_(file);
42      }
43 
44      void CDataOutput::syncFile(void)
45      {
46         this->syncFile_();
47      }
48
49      void CDataOutput::closeFile(void)
50      {
51         this->closeFile_();
52      }
53
54      //----------------------------------------------------------------
55
56      void CDataOutput::writeGrid
57         (const boost::shared_ptr<CDomain> domain,
58          const boost::shared_ptr<CAxis> axis)
59      {
60         this->writeDomain_(domain);
61         this->writeAxis_(axis);
62      }
63
64      //----------------------------------------------------------------
65
66      void CDataOutput::writeGrid
67         (const boost::shared_ptr<CDomain> domain)
68      {
69         this->writeDomain_(domain);
70      }
71
72      //----------------------------------------------------------------
73
74      void CDataOutput::writeField
75         (const boost::shared_ptr<CField> field)
76      {
77         boost::shared_ptr<CContext> context =
78         CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId());
79         boost::shared_ptr<CCalendar> calendar = context->getCalendar();
80         
81         this->writeField_(field);
82         this->writeTimeAxis_(field, calendar);
83      }
84
85      //----------------------------------------------------------------
86
87      void CDataOutput::writeFieldGrid
88         (const boost::shared_ptr<CField> field)
89      {
90         this->writeGrid(field->getRelGrid());
91      }
92     
93      //----------------------------------------------------------------
94     
95      void CDataOutput::writeFieldData(const boost::shared_ptr<CField> field)
96      {
97         boost::shared_ptr<CGrid> grid =
98            CObjectFactory::GetObject<CGrid>(field->grid_ref.getValue());
99         boost::shared_ptr<CDomain> domain =
100            CObjectFactory::GetObject<CDomain>(grid->domain_ref.getValue());
101           
102//         if (domain->isEmpty()) return;
103         this->writeFieldData_(field);
104      }
105     
106      ///----------------------------------------------------------------
107
108} // namespace xios
Note: See TracBrowser for help on using the repository browser.