28 #include <Structure.h>
54 void getGrids(BaseType *bt, vector<Grid *> *grids)
61 grids->push_back(static_cast<Grid*>(bt));
64 case dods_structure_c: {
66 Structure &s =
static_cast<Structure&
>(*bt);
67 for (Structure::Vars_iter i = s.var_begin(); i != s.var_begin(); i++) {
89 for (DDS::Vars_iter i = dds.var_begin(); i != dds.var_end(); i++) {
119 void *cls =
gse_string(extract_string_argument(expr).c_str());
124 throw Error(malformed_expr,
"Error parsing grid selection.");
127 static void apply_grid_selection_expr(Grid *grid, GSEClause *clause)
131 Grid::Map_iter map_i = grid->map_begin();
132 while (map_i != grid->map_end() && (*map_i)->name() != clause->get_map_name())
135 if (map_i == grid->map_end())
136 throw Error(malformed_expr,
"The map vector '" + clause->get_map_name()
137 +
"' is not in the grid '" + grid->name() +
"'.");
140 Array::Dim_iter grid_dim = (grid->get_array()->dim_begin() + (map_i - grid->map_begin()));
142 Array *map = dynamic_cast < Array * >((*map_i));
144 throw InternalErr(__FILE__, __LINE__,
"Expected an Array");
145 int start = max(map->dimension_start(map->dim_begin()), clause->get_start());
146 int stop = min(map->dimension_stop(map->dim_begin()), clause->get_stop());
151 <<
"The expressions passed to grid() do not result in an inclusive \n"
152 <<
"subset of '" << clause->get_map_name()
153 <<
"'. The map's values range " <<
"from "
154 << clause->get_map_min_value() <<
" to "
155 << clause->get_map_max_value() <<
".";
156 throw Error(malformed_expr,msg.str());
159 BESDEBUG(
"GeoGrid",
"Setting constraint on " << map->name() <<
"[" << start <<
":" << stop <<
"]" << endl);
162 map->add_constraint(map->dim_begin(), start, 1, stop);
163 grid->get_array()->add_constraint(grid_dim, start, 1, stop);
168 vector < GSEClause * >::iterator clause_i = clauses.begin();
169 while (clause_i != clauses.end())
170 apply_grid_selection_expr(grid, *clause_i++);
172 grid->set_read_p(
false);
void getGrids(BaseType *bt, vector< Grid * > *grids)
Recursively traverses the BaseType bt (if its a constructor type) and collects pointers to all of the...
void apply_grid_selection_expressions(Grid *grid, vector< GSEClause * >clauses)
void * gse_string(const char *yy_str)
int gse_parse(libdap::gse_arg *arg)
bool isGeoGrid(Grid *grid)
Evaluates a Grid to see if has suitable semantics for use with function_geogrid.
void gse_delete_buffer(void *buffer)
Argument to the GSE parser.
void parse_gse_expression(gse_arg *arg, BaseType *expr)
void gse_restart(FILE *in)
Immediately switch to a different input stream.
Geographical constraint applied to a grid.
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream