1 | #include "data_output.hpp" |
---|
2 | |
---|
3 | #include "attribute_template.hpp" |
---|
4 | #include "group_template.hpp" |
---|
5 | #include "context.hpp" |
---|
6 | |
---|
7 | namespace xios |
---|
8 | { |
---|
9 | /// ////////////////////// Définitions ////////////////////// /// |
---|
10 | |
---|
11 | CDataOutput::~CDataOutput(void) |
---|
12 | { /* Ne rien faire de plus */ } |
---|
13 | |
---|
14 | //---------------------------------------------------------------- |
---|
15 | |
---|
16 | void CDataOutput::writeGrid(CGrid* grid, bool allowCompressedOutput /*= false*/) |
---|
17 | { |
---|
18 | this->writeGrid(grid->getDomains(), grid->getAxis(), grid->getScalars()); |
---|
19 | |
---|
20 | if (allowCompressedOutput) |
---|
21 | writeGridCompressed_(grid); |
---|
22 | } |
---|
23 | |
---|
24 | //---------------------------------------------------------------- |
---|
25 | |
---|
26 | void CDataOutput::writeFile(CFile* file) |
---|
27 | { |
---|
28 | this->writeFile_(file); |
---|
29 | } |
---|
30 | |
---|
31 | void CDataOutput::writeAttribute(CVariable* var) |
---|
32 | { |
---|
33 | this->writeAttribute_(var) ; |
---|
34 | } |
---|
35 | |
---|
36 | void CDataOutput::syncFile(void) |
---|
37 | { |
---|
38 | this->syncFile_(); |
---|
39 | } |
---|
40 | |
---|
41 | void CDataOutput::closeFile(void) |
---|
42 | { |
---|
43 | this->closeFile_(); |
---|
44 | } |
---|
45 | |
---|
46 | //---------------------------------------------------------------- |
---|
47 | |
---|
48 | void CDataOutput::writeGrid(CDomain* domain, CAxis* axis) |
---|
49 | TRY |
---|
50 | { |
---|
51 | this->writeDomain_(domain); |
---|
52 | this->writeAxis_(axis); |
---|
53 | } |
---|
54 | CATCH |
---|
55 | |
---|
56 | void CDataOutput::writeGrid(std::vector<CDomain*> domains, std::vector<CAxis*> axis) |
---|
57 | TRY |
---|
58 | { |
---|
59 | int domSize = domains.size(); |
---|
60 | int aSize = axis.size(); |
---|
61 | for (int i = 0; i < domSize; ++i) this->writeDomain_(domains[i]); |
---|
62 | for (int i = 0; i < aSize; ++i) this->writeAxis_(axis[i]); |
---|
63 | } |
---|
64 | CATCH |
---|
65 | |
---|
66 | void CDataOutput::writeGrid(std::vector<CDomain*> domains, std::vector<CAxis*> axis, std::vector<CScalar*> scalars) |
---|
67 | TRY |
---|
68 | { |
---|
69 | int domSize = domains.size(); |
---|
70 | int aSize = axis.size(); |
---|
71 | int sSize = scalars.size(); |
---|
72 | for (int i = 0; i < domSize; ++i) this->writeDomain_(domains[i]); |
---|
73 | for (int i = 0; i < aSize; ++i) this->writeAxis_(axis[i]); |
---|
74 | for (int i = 0; i < sSize; ++i) this->writeScalar_(scalars[i]); |
---|
75 | } |
---|
76 | CATCH |
---|
77 | |
---|
78 | //---------------------------------------------------------------- |
---|
79 | |
---|
80 | void CDataOutput::writeGrid(CDomain* domain) |
---|
81 | TRY |
---|
82 | { |
---|
83 | this->writeDomain_(domain); |
---|
84 | } |
---|
85 | CATCH |
---|
86 | |
---|
87 | void CDataOutput::writeTimeDimension(void) |
---|
88 | TRY |
---|
89 | { |
---|
90 | this->writeTimeDimension_(); |
---|
91 | } |
---|
92 | CATCH |
---|
93 | |
---|
94 | //---------------------------------------------------------------- |
---|
95 | |
---|
96 | void CDataOutput::writeFieldTimeAxis(CField* field) |
---|
97 | TRY |
---|
98 | { |
---|
99 | CContext* context = CContext::getCurrent() ; |
---|
100 | std::shared_ptr<CCalendar> calendar = context->getCalendar(); |
---|
101 | |
---|
102 | this->writeTimeAxis_(field, calendar); |
---|
103 | } |
---|
104 | CATCH |
---|
105 | |
---|
106 | void CDataOutput::writeField(CField* field) |
---|
107 | TRY |
---|
108 | { |
---|
109 | this->writeField_(field); |
---|
110 | } |
---|
111 | CATCH |
---|
112 | |
---|
113 | //---------------------------------------------------------------- |
---|
114 | |
---|
115 | void CDataOutput::writeFieldGrid(CField* field) |
---|
116 | TRY |
---|
117 | { |
---|
118 | this->writeGrid(field->getRelGrid(), |
---|
119 | !field->indexed_output.isEmpty() && field->indexed_output); |
---|
120 | } |
---|
121 | CATCH |
---|
122 | //---------------------------------------------------------------- |
---|
123 | |
---|
124 | void CDataOutput::writeFieldData(CField* field) |
---|
125 | TRY |
---|
126 | { |
---|
127 | // CGrid* grid = CGrid::get(field->grid_ref.getValue()); |
---|
128 | // CDomain* domain = CDomain::get(grid->domain_ref.getValue()); |
---|
129 | this->writeFieldData_(field); |
---|
130 | } |
---|
131 | CATCH |
---|
132 | |
---|
133 | ///---------------------------------------------------------------- |
---|
134 | |
---|
135 | } // namespace xios |
---|