41 static const string DEBUG_CHANNEL(
"ncml:2");
47 const libdap::Grid& proto,
55 createRep(proto, memberDatasets);
61 , _joinDim(proto._joinDim)
91 auto_ptr<ArrayJoinExistingAggregation>
95 "Making an aggregated map " <<
96 "as a coordinate variable..." << endl);
98 NCML_ASSERT_MSG(pGridGranuleTemplate,
"Expected grid granule template but got null.");
101 NCML_ASSERT_MSG(pMapTemplate,
"Expected to find a dim map for the joinExisting agg but failed!");
106 auto_ptr<agg_util::ArrayGetterInterface> mapArrayGetter(
109 auto_ptr<ArrayJoinExistingAggregation> pNewMap =
110 auto_ptr<ArrayJoinExistingAggregation>(
128 transferConstraintsToSubGridMaps(pSubGrid);
129 transferConstraintsToSubGridArray(pSubGrid);
146 _joinDim = rhs._joinDim;
150 GridJoinExistingAggregation::cleanup() throw()
155 GridJoinExistingAggregation::createRep(
156 const libdap::Grid& constProtoSubGrid,
160 Grid& protoSubGrid =
const_cast<Grid&
>(constProtoSubGrid);
167 Grid::Map_iter firstIt = protoSubGrid.map_begin();
168 Grid::Map_iter endIt = protoSubGrid.map_end();
169 for (Grid::Map_iter it = firstIt;
177 "Expected the first map to be the outer dimension "
178 "named " + _joinDim.
name +
179 " but it was not! Logic problem.");
184 Array* pMap =
dynamic_cast<Array*
>(*it);
190 "Replacing the Grid's data Array with an ArrayAggregateOnOuterDimension..." << endl);
193 Array* pArr =
static_cast<Array*
>(array_var());
195 "Expected to find a contained data Array but we did not!");
198 std::auto_ptr<ArrayGetterInterface> arrayGetter(
new TopLevelGridDataArrayGetter());
202 std::auto_ptr<ArrayJoinExistingAggregation> aggDataArray(
203 new ArrayJoinExistingAggregation(
215 set_array(aggDataArray.get());
219 aggDataArray.release();
223 GridJoinExistingAggregation::transferConstraintsToSubGridMaps(Grid* pSubGrid)
225 BESDEBUG(DEBUG_CHANNEL,
"Transferring constraints to the subgrid maps..." << endl);
226 Map_iter subGridMapIt = pSubGrid->map_begin();
227 for (Map_iter it = map_begin(); it != map_end(); ++it)
230 if (it != map_begin())
232 Array* subGridMap =
static_cast<Array*
>(*subGridMapIt);
233 Array* superGridMap =
static_cast<Array*
>(*it);
246 GridJoinExistingAggregation::transferConstraintsToSubGridArray(Grid* )
virtual const AMDList & getDatasetList() const
Accessor for the dataset description list that describes this aggregation.
#define BESDEBUG_FUNC(channel, info)
GridJoinExistingAggregation(const libdap::Grid &proto, const AMDList &memberDatasets, const DDSLoader &loaderProto, const Dimension &joinDim)
virtual const Dimension & getAggregationDimension() const
Get the contained aggregation dimension info.
#define NCML_ASSERT(cond)
void setShapeFrom(const libdap::Grid &protoSubGrid, bool addMaps)
Use the data array and maps from protoSubGrid as the initial point for the shape of the Grid...
static const libdap::Array * findMapByName(const libdap::Grid &inGrid, const std::string &findName)
Find the given map name in the given Grid and return it if found, else NULL.
Helper class for temporarily hijacking an existing dhi to load a DDX response for one particular file...
#define NCML_ASSERT_MSG(cond, msg)
virtual void transferConstraintsToSubGridHook(Grid *pSubGrid)
Required specialization for the read() call stack.
Struct for holding information about a dimension of data, minimally a name and a cardinality (size)...
virtual GridJoinExistingAggregation * ptr_duplicate()
GridJoinExistingAggregation & operator=(const GridJoinExistingAggregation &rhs)
std::vector< RCPtr< AggMemberDataset > > AMDList
static void transferArrayConstraints(libdap::Array *pToArray, const libdap::Array &fromArray, bool skipFirstFromDim, bool skipFirstToDim, bool printDebug=false, const std::string &debugChannel="agg_util")
Copy the constraints from the from Array into the pToArray in Dim_iter order.
Grid * getSubGridTemplate()
Reveals the raw ptr, but only to subclasses.
auto_ptr< ArrayJoinExistingAggregation > makeAggregatedOuterMapVector() const
Create a new map aggregated map vector for this aggregation, using its data templates, granule list, and outer dimension.
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
GridAggregationBase & operator=(const GridAggregationBase &rhs)
virtual ~GridJoinExistingAggregation()