35#include "grid_utils.h"
36#include "gse_parser.h"
39#include "GridGeoConstraint.h"
45void gse_restart(FILE *in);
48void gse_delete_buffer(
void *buffer);
49void *gse_string(
const char *yy_str);
60void get_grids(BaseType *bt, vector<Grid *> *grids) {
65 grids->push_back(
static_cast<Grid *
>(bt));
68 case dods_structure_c: {
70 Structure &s =
static_cast<Structure &
>(*bt);
90void get_grids(DDS &dds, vector<Grid *> *grids) {
111bool is_geo_grid(Grid *grid)
124void parse_gse_expression(
gse_arg *arg, BaseType *expr) {
128 bool status = gse_parse(arg) == 0;
129 gse_delete_buffer(cls);
131 throw Error(malformed_expr,
"Error parsing grid selection.");
134static void apply_grid_selection_expr(Grid *grid,
GSEClause *clause) {
137 Grid::Map_iter map_i = grid->map_begin();
138 while (map_i != grid->map_end() && (*map_i)->name() != clause->get_map_name())
141 if (map_i == grid->map_end())
142 throw Error(malformed_expr,
143 "The map vector '" + clause->get_map_name() +
"' is not in the grid '" + grid->name() +
"'.");
146 Array::Dim_iter grid_dim = (grid->get_array()->dim_begin() + (map_i - grid->map_begin()));
148 Array *map =
dynamic_cast<Array *
>((*map_i));
150 throw InternalErr(__FILE__, __LINE__,
"Expected an Array");
156 msg <<
"The expressions passed to grid() do not result in an inclusive \n"
157 <<
"subset of '" << clause->get_map_name() <<
"'. The map's values range " <<
"from "
158 << clause->get_map_min_value() <<
" to " << clause->get_map_max_value() <<
".";
159 throw Error(malformed_expr, msg.str());
162 DBG(cerr <<
"Setting constraint on " << map->name() <<
"[" << start <<
":" << stop <<
"]" << endl);
166 grid->get_array()->add_constraint(grid_dim, start, 1, stop);
169void apply_grid_selection_expressions(Grid *grid, vector<GSEClause *>
clauses) {
170 vector<GSEClause *>::iterator clause_i =
clauses.begin();
171 while (clause_i !=
clauses.end())
172 apply_grid_selection_expr(grid, *clause_i++);
174 grid->set_read_p(
false);
virtual int dimension_start(Dim_iter i, bool constrained=false)
Return the start index of a dimension.
virtual int dimension_stop(Dim_iter i, bool constrained=false)
Return the stop index of the constraint.
virtual void add_constraint(Dim_iter i, int start, int stride, int stop)
Adds a constraint to an Array dimension.
std::vector< dimension >::iterator Dim_iter
Vars_iter var_end()
Return an iterator.
top level DAP object to house generic methods
D4FilterClauseList & clauses()
Access the filter clauses for this D4Sequence.
string extract_string_argument(BaseType *arg)