[352] | 1 | |
---|
| 2 | #ifndef __FIELD_IMPL_HPP__ |
---|
| 3 | #define __FIELD_IMPL_HPP__ |
---|
| 4 | |
---|
[591] | 5 | #include "xios_spl.hpp" |
---|
[352] | 6 | #include "field.hpp" |
---|
| 7 | #include "context.hpp" |
---|
| 8 | #include "grid.hpp" |
---|
| 9 | #include "timer.hpp" |
---|
[369] | 10 | #include "array_new.hpp" |
---|
[640] | 11 | #include "source_filter.hpp" |
---|
| 12 | #include "store_filter.hpp" |
---|
[352] | 13 | |
---|
[369] | 14 | |
---|
[352] | 15 | namespace xios { |
---|
| 16 | |
---|
[459] | 17 | template <int N> |
---|
[2131] | 18 | void CField::setData(const CArray<double, N>& _data, int tileid) |
---|
[1622] | 19 | TRY |
---|
[459] | 20 | { |
---|
[640] | 21 | if (clientSourceFilter) |
---|
[1201] | 22 | { |
---|
| 23 | if (check_if_active.isEmpty() || (!check_if_active.isEmpty() && (!check_if_active) || isActive(true))) |
---|
[2131] | 24 | if (tileid > -1) |
---|
| 25 | clientSourceFilter->streamTile(CContext::getCurrent()->getCalendar()->getCurrentDate(), _data, tileid); // tiled domain |
---|
| 26 | else |
---|
| 27 | clientSourceFilter->streamData(CContext::getCurrent()->getCalendar()->getCurrentDate(), _data); |
---|
[1201] | 28 | } |
---|
[1021] | 29 | else if (instantDataFilter) |
---|
[640] | 30 | ERROR("void CField::setData(const CArray<double, N>& _data)", |
---|
| 31 | << "Impossible to receive data from the model for a field [ id = " << getId() << " ] with a reference or an arithmetic operation."); |
---|
[459] | 32 | } |
---|
[1622] | 33 | CATCH_DUMP_ATTR |
---|
[459] | 34 | |
---|
[593] | 35 | template <int N> |
---|
| 36 | void CField::getData(CArray<double, N>& _data) const |
---|
[1622] | 37 | TRY |
---|
[593] | 38 | { |
---|
[640] | 39 | if (storeFilter) |
---|
[593] | 40 | { |
---|
[640] | 41 | CDataPacket::StatusCode status = storeFilter->getData(CContext::getCurrent()->getCalendar()->getCurrentDate(), _data); |
---|
| 42 | |
---|
| 43 | if (status == CDataPacket::END_OF_STREAM) |
---|
| 44 | ERROR("void CField::getData(CArray<double, N>& _data) const", |
---|
| 45 | << "Impossible to access field data, all the records of the field [ id = " << getId() << " ] have been already read."); |
---|
[593] | 46 | } |
---|
| 47 | else |
---|
| 48 | { |
---|
| 49 | ERROR("void CField::getData(CArray<double, N>& _data) const", |
---|
| 50 | << "Impossible to access field data, the field [ id = " << getId() << " ] does not have read access."); |
---|
| 51 | } |
---|
| 52 | } |
---|
[1622] | 53 | CATCH |
---|
[352] | 54 | } // namespace xios |
---|
| 55 | |
---|
| 56 | #endif |
---|