[219] | 1 | #include "data_output.hpp" |
---|
| 2 | |
---|
[352] | 3 | #include "attribute_template.hpp" |
---|
| 4 | #include "group_template.hpp" |
---|
[219] | 5 | #include "context.hpp" |
---|
| 6 | |
---|
[335] | 7 | namespace xios |
---|
[219] | 8 | { |
---|
| 9 | /// ////////////////////// Définitions ////////////////////// /// |
---|
| 10 | |
---|
| 11 | CDataOutput::~CDataOutput(void) |
---|
| 12 | { /* Ne rien faire de plus */ } |
---|
| 13 | |
---|
| 14 | //---------------------------------------------------------------- |
---|
| 15 | |
---|
[347] | 16 | void CDataOutput::writeGrid(CGrid* grid) |
---|
[219] | 17 | { |
---|
| 18 | if (grid->domain_ref.isEmpty()) |
---|
[335] | 19 | ERROR("CDataOutput::writeGrid(grid)", |
---|
[219] | 20 | << " domain is not defined !"); |
---|
| 21 | |
---|
| 22 | if (grid->axis_ref.isEmpty()) |
---|
| 23 | { |
---|
[346] | 24 | this->writeGrid(CDomain::get(grid->domain_ref.getValue())); |
---|
[219] | 25 | } |
---|
| 26 | else |
---|
| 27 | { |
---|
[346] | 28 | this->writeGrid(CDomain::get(grid->domain_ref.getValue()), |
---|
| 29 | CAxis::get(grid->axis_ref.getValue())); |
---|
[219] | 30 | } |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | //---------------------------------------------------------------- |
---|
| 34 | |
---|
[347] | 35 | void CDataOutput::writeFile(CFile* file) |
---|
[219] | 36 | { |
---|
| 37 | this->writeFile_(file); |
---|
| 38 | } |
---|
[472] | 39 | |
---|
| 40 | void CDataOutput::writeAttribute(CVariable* var) |
---|
| 41 | { |
---|
| 42 | this->writeAttribute_(var) ; |
---|
| 43 | } |
---|
| 44 | |
---|
[321] | 45 | void CDataOutput::syncFile(void) |
---|
| 46 | { |
---|
| 47 | this->syncFile_(); |
---|
| 48 | } |
---|
[219] | 49 | |
---|
[286] | 50 | void CDataOutput::closeFile(void) |
---|
| 51 | { |
---|
| 52 | this->closeFile_(); |
---|
| 53 | } |
---|
| 54 | |
---|
[219] | 55 | //---------------------------------------------------------------- |
---|
| 56 | |
---|
[347] | 57 | void CDataOutput::writeGrid(CDomain* domain,CAxis* axis) |
---|
[219] | 58 | { |
---|
| 59 | this->writeDomain_(domain); |
---|
| 60 | this->writeAxis_(axis); |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | //---------------------------------------------------------------- |
---|
| 64 | |
---|
[347] | 65 | void CDataOutput::writeGrid(CDomain* domain) |
---|
[219] | 66 | { |
---|
| 67 | this->writeDomain_(domain); |
---|
| 68 | } |
---|
| 69 | |
---|
[391] | 70 | void CDataOutput::writeTimeDimension(void) |
---|
| 71 | { |
---|
| 72 | this->writeTimeDimension_(); |
---|
| 73 | } |
---|
| 74 | |
---|
[219] | 75 | //---------------------------------------------------------------- |
---|
| 76 | |
---|
[347] | 77 | void CDataOutput::writeField(CField* field) |
---|
[219] | 78 | { |
---|
[347] | 79 | CContext* context = CContext::getCurrent() ; |
---|
[343] | 80 | boost::shared_ptr<CCalendar> calendar = context->getCalendar(); |
---|
[219] | 81 | |
---|
| 82 | this->writeField_(field); |
---|
| 83 | this->writeTimeAxis_(field, calendar); |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | //---------------------------------------------------------------- |
---|
| 87 | |
---|
[347] | 88 | void CDataOutput::writeFieldGrid(CField* field) |
---|
[219] | 89 | { |
---|
| 90 | this->writeGrid(field->getRelGrid()); |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | //---------------------------------------------------------------- |
---|
| 94 | |
---|
[347] | 95 | void CDataOutput::writeFieldData(CField* field) |
---|
[219] | 96 | { |
---|
[347] | 97 | CGrid* grid = CGrid::get(field->grid_ref.getValue()); |
---|
| 98 | CDomain* domain = CDomain::get(grid->domain_ref.getValue()); |
---|
[219] | 99 | this->writeFieldData_(field); |
---|
| 100 | } |
---|
| 101 | |
---|
| 102 | ///---------------------------------------------------------------- |
---|
| 103 | |
---|
[335] | 104 | } // namespace xios |
---|