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