+MEDCouplingGridCollection *MEDCouplingGridCollection::New(const std::vector<const MEDCouplingCartesianAMRMeshGen *>& ms, const std::vector< std::pair<std::string,int> >& fieldNames)
+{
+ return new MEDCouplingGridCollection(ms,fieldNames);
+}
+
+void MEDCouplingGridCollection::alloc(int ghostLev)
+{
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
+ {
+ int nbTuples((*it).first->getNumberOfCellsAtCurrentLevelGhost(ghostLev));
+ DataArrayDoubleCollection *dadc((*it).second);
+ if(dadc)
+ dadc->allocTuples(nbTuples);
+ else
+ throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::alloc : internal error !");
+ }
+}
+
+void MEDCouplingGridCollection::dealloc()
+{
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
+ {
+ DataArrayDoubleCollection *dadc((*it).second);
+ if(dadc)
+ dadc->dellocTuples();
+ else
+ throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::dealloc : internal error !");
+ }
+}
+
+void MEDCouplingGridCollection::spillInfoOnComponents(const std::vector< std::vector<std::string> >& compNames)
+{
+ for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
+ (*it).second->spillInfoOnComponents(compNames);
+}
+
+MEDCouplingGridCollection::MEDCouplingGridCollection(const std::vector<const MEDCouplingCartesianAMRMeshGen *>& ms, const std::vector< std::pair<std::string,int> >& fieldNames):_map_of_dadc(ms.size())
+{
+ std::size_t sz(ms.size());
+ for(std::size_t i=0;i<sz;i++)
+ {
+ if(!ms[i])
+ throw INTERP_KERNEL::Exception("MEDCouplingGridCollection constructor : presence of NULL MEDCouplingCartesianAMRMeshGen instance !");
+ _map_of_dadc[i].first=ms[i];
+ _map_of_dadc[i].second=DataArrayDoubleCollection::New(fieldNames);
+ }
+}
+