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 | { |
---|
50 | this->writeDomain_(domain); |
---|
51 | this->writeAxis_(axis); |
---|
52 | } |
---|
53 | |
---|
54 | void CDataOutput::writeGrid(std::vector<CDomain*> domains, std::vector<CAxis*> axis) |
---|
55 | { |
---|
56 | int domSize = domains.size(); |
---|
57 | int aSize = axis.size(); |
---|
58 | for (int i = 0; i < domSize; ++i) this->writeDomain_(domains[i]); |
---|
59 | for (int i = 0; i < aSize; ++i) this->writeAxis_(axis[i]); |
---|
60 | } |
---|
61 | |
---|
62 | void CDataOutput::writeGrid(std::vector<CDomain*> domains, std::vector<CAxis*> axis, std::vector<CScalar*> scalars) |
---|
63 | { |
---|
64 | int domSize = domains.size(); |
---|
65 | int aSize = axis.size(); |
---|
66 | int sSize = scalars.size(); |
---|
67 | for (int i = 0; i < domSize; ++i) this->writeDomain_(domains[i]); |
---|
68 | for (int i = 0; i < aSize; ++i) this->writeAxis_(axis[i]); |
---|
69 | for (int i = 0; i < sSize; ++i) this->writeScalar_(scalars[i]); |
---|
70 | } |
---|
71 | |
---|
72 | //---------------------------------------------------------------- |
---|
73 | |
---|
74 | void CDataOutput::writeGrid(CDomain* domain) |
---|
75 | { |
---|
76 | this->writeDomain_(domain); |
---|
77 | } |
---|
78 | |
---|
79 | void CDataOutput::writeTimeDimension(void) |
---|
80 | { |
---|
81 | this->writeTimeDimension_(); |
---|
82 | } |
---|
83 | |
---|
84 | //---------------------------------------------------------------- |
---|
85 | |
---|
86 | void CDataOutput::writeFieldTimeAxis(CField* field) |
---|
87 | { |
---|
88 | CContext* context = CContext::getCurrent() ; |
---|
89 | std::shared_ptr<CCalendar> calendar = context->getCalendar(); |
---|
90 | |
---|
91 | this->writeTimeAxis_(field, calendar); |
---|
92 | } |
---|
93 | |
---|
94 | void CDataOutput::writeField(CField* field) |
---|
95 | { |
---|
96 | this->writeField_(field); |
---|
97 | } |
---|
98 | |
---|
99 | //---------------------------------------------------------------- |
---|
100 | |
---|
101 | void CDataOutput::writeFieldGrid(CField* field) |
---|
102 | { |
---|
103 | this->writeGrid(field->getRelGrid(), |
---|
104 | !field->indexed_output.isEmpty() && field->indexed_output); |
---|
105 | } |
---|
106 | |
---|
107 | //---------------------------------------------------------------- |
---|
108 | |
---|
109 | void CDataOutput::writeFieldData(CField* field) |
---|
110 | { |
---|
111 | // CGrid* grid = CGrid::get(field->grid_ref.getValue()); |
---|
112 | // CDomain* domain = CDomain::get(grid->domain_ref.getValue()); |
---|
113 | this->writeFieldData_(field); |
---|
114 | } |
---|
115 | |
---|
116 | ///---------------------------------------------------------------- |
---|
117 | |
---|
118 | } // namespace xios |
---|