42 #include <InternalErr.h>
75 Grid::Map_iter i = grid->map_begin();
76 Grid::Map_iter e = grid->map_end();
85 BaseType::set_send_p(grid->send_p());
95 BESDEBUG(
"ascii",
"In AsciiGrid::print_ascii" << endl);
97 Grid *g =
dynamic_cast<Grid *
> (_redirect);
108 if (projection_yields_grid()) {
109 if (dynamic_cast<Array &> (*g->array_var()).dimensions(
true) > 1)
110 print_grid(strm, print_name);
112 print_vector(strm, print_name);
115 Map_iter m = map_begin();
116 while (m != map_end()) {
117 if ((*m)->send_p()) {
124 if (array_var()->send_p()) {
125 dynamic_cast<AsciiArray&
>(*array_var()).print_ascii(strm, print_name);
139 void AsciiGrid::print_vector(ostream &strm,
bool print_name)
141 BESDEBUG(
"ascii",
"In AsciiGrid::print_vector" << endl);
150 void AsciiGrid::print_grid(ostream &strm,
bool print_name)
152 BESDEBUG(
"ascii",
"In AsciiGrid::print_grid" << endl);
154 Grid *g =
dynamic_cast<Grid *
> (
_redirect);
159 Array *grid_array =
dynamic_cast<Array *
> (g->array_var());
165 int dims = grid_array->dimensions(
true);
167 throw InternalErr(__FILE__, __LINE__,
168 "Dimension count is <= 1 while printing multidimensional array.");
179 vector<int> state(dims - 1, 0);
200 vector<int>::iterator state_iter = state.begin();
201 Grid::Map_iter p = g->map_begin();
202 Grid::Map_iter ap = map_begin();
203 while (state_iter != state.end()) {
204 Array *map =
dynamic_cast<Array *
> (*p);
222 index = a_grid_array->
print_row(strm, index, rightmost_dim_size - 1);
228 }
while (more_indices);
bool increment_state(vector< int > *state, const vector< int > &shape)
Increment #state# to the next value given #shape#.
virtual void print_ascii(ostream &strm, bool print_name=true)
Print an ASCII representation for an instance of BaseType's children.
virtual BaseType * ptr_duplicate()
int get_nth_dim_size(size_t n)
Get the size of dimension #n#.
BaseType * basetype_to_asciitype(BaseType *bt)
int print_row(ostream &strm, int index, int number)
Print a single row of values for a N-dimensional array.
vector< int > get_shape_vector(size_t n)
Get the sizes of the first N dimensions of this array.
virtual void print_ascii(ostream &strm, bool print_name=true)
Print an ASCII representation for an instance of BaseType's children.
virtual void print_ascii(ostream &strm, bool print_name=true)
Print an ASCII representation for an instance of BaseType's children.
AsciiGrid(const string &n)
string get_full_name()
Get the fully qualified name of this object.
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream