45 #ifdef HAVE_SYS_PARAM_H
46 #include <sys/param.h>
53 #include <InternalErr.h>
78 vector<array_ce> a_ce_vec;
81 for (Grid::Map_iter p = map_begin(); p != map_end(); ++p) {
82 Array & a =
static_cast<Array &
> (**p);
83 Array::Dim_iter q = a.dim_begin();
84 int start = a.dimension_start(q,
true);
85 int stop = a.dimension_stop(q,
true);
86 int stride = a.dimension_stride(q,
true);
87 int edge = (int) ((stop - start) / stride) + 1;
89 a_ce_vec.push_back(a_ce);
100 throw Error(unknown_error,
"Could not read from dataset.");
110 string hdf_file = dataset();
111 string hdf_name = this->name();
118 vector<int> start,
edge, stride;
121 throw InternalErr(__FILE__, __LINE__,
"Expected an HDFArray.");
127 sdsin.setslab(start, edge, stride,
false);
135 sdsin.seek(hdf_name.c_str());
138 if (array_var()->send_p() || array_var()->is_in_selection()) {
142 string(
"Could not read ") + array_var()->name()
143 +
string(
" from dataset ") + dataset()
157 if (!(array_var()->send_p() || array_var()->is_in_selection())) {
160 sds.
dims = vector<hdf_dim> ();
166 for (Grid::Map_iter p = map_begin(); p != map_end(); ++p) {
167 if ((*p)->send_p() || (*p)->is_in_selection()) {
168 for (
unsigned int i = 0; i < sds.
dims.size(); i++) {
169 if ((*p)->name() == sds.
dims[i].name) {
175 (*p)->set_read_p(
true);
193 array_var()->transfer_attributes(at);
195 Map_iter map = map_begin();
196 while (map != map_end()) {
197 (*map)->transfer_attributes(at);
201 AttrTable *mine = at->get_attr_table(name());
204 mine->set_is_global_attribute(
false);
205 AttrTable::Attr_iter at_p = mine->attr_begin();
206 while (at_p != mine->attr_end()) {
207 if (mine->get_attr_type(at_p) == Attr_container)
208 get_attr_table().append_container(
209 new AttrTable(*mine->get_attr_table(at_p)),
210 mine->get_name(at_p));
212 get_attr_table().append_attr(mine->get_name(at_p),
213 mine->get_type(at_p), mine->get_attr_vector(at_p));
220 string dim_name_base = name() +
"_dim_";
222 AttrTable::Attr_iter a_p = at->attr_begin();
223 while (a_p != at->attr_end()) {
224 string::size_type i = at->get_name(a_p).find(dim_name_base);
228 if (i == 0 && at->get_attr_type(a_p) == Attr_container) {
229 AttrTable *dim = at->get_attr_table(a_p);
232 BESDEBUG(
"h4",
"dim->name(): " << dim->get_name() << endl);
233 BESDEBUG(
"h4",
"dim->get_name().substr(i + dim_name_base.length()): "
234 << dim->get_name().substr(i + dim_name_base.length()) << endl);
235 int n = atoi(dim->get_name().substr(i + dim_name_base.length()).c_str());
238 BESDEBUG(
"h4",
"Inside HDFGrid::transfer_attreibutes: n = " << n << endl);
239 static_cast<HDFArray&
> (*(*(map_begin() + n))).transfer_dimension_attribute(dim);
HDFGrid(const string &n, const string &d)
bool GetSlabConstraint(vector< int > &start_array, vector< int > &edge_array, vector< int > &stride_array)
virtual bool read_tagref(int32 tag, int32 ref, int &error)
virtual BaseType * ptr_duplicate()
void * ExportDataForDODS(const hdf_genvec &v)
virtual void transfer_attributes(AttrTable *at_container)
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
void LoadGridFromSDS(HDFGrid *gr, const hdf_sds &sds)
virtual vector< array_ce > get_map_constraints()