1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay
21 #include "MEDCouplingAMRAttribute.hxx"
22 #include "MEDCouplingFieldDouble.hxx"
23 #include "MEDCouplingMemArray.hxx"
24 #include "MEDCouplingIMesh.hxx"
28 using namespace ParaMEDMEM;
30 DataArrayDoubleCollection *DataArrayDoubleCollection::New(const std::vector< std::pair<std::string,int> >& fieldNames)
32 return new DataArrayDoubleCollection(fieldNames);
35 void DataArrayDoubleCollection::allocTuples(int nbOfTuples)
37 std::size_t sz(_arrs.size());
38 for(std::size_t i=0;i<sz;i++)
39 _arrs[i].first->reAlloc(nbOfTuples);
42 void DataArrayDoubleCollection::dellocTuples()
44 std::size_t sz(_arrs.size());
45 for(std::size_t i=0;i<sz;i++)
46 _arrs[i].first->reAlloc(0);
49 void DataArrayDoubleCollection::spillInfoOnComponents(const std::vector< std::vector<std::string> >& compNames)
51 std::size_t sz(_arrs.size());
52 if(sz!=compNames.size())
53 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::spillInfoOnComponents : first size of compNames has to be equal to the number of fields defined !");
54 for(std::size_t i=0;i<sz;i++)
56 const std::vector<std::string>& names(compNames[i]);
57 _arrs[i].first->setInfoOnComponents(names);
61 void DataArrayDoubleCollection::spillNatures(const std::vector<NatureOfField>& nfs)
63 std::size_t sz(_arrs.size());
65 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::spillNatures : first size of vector of NatureOfField has to be equal to the number of fields defined !");
66 for(std::size_t i=0;i<sz;i++)
67 _arrs[i].second=nfs[i];
70 std::vector<DataArrayDouble *> DataArrayDoubleCollection::retrieveFields() const
72 std::size_t sz(_arrs.size());
73 std::vector<DataArrayDouble *> ret(sz);
74 for(std::size_t i=0;i<sz;i++)
76 const DataArrayDouble *tmp(_arrs[i].first);
77 ret[i]=const_cast<DataArrayDouble *>(tmp);
84 const DataArrayDouble *DataArrayDoubleCollection::getFieldWithName(const std::string& name) const
86 std::vector<std::string> vec;
87 for(std::vector< std::pair< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble>, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++)
89 const DataArrayDouble *obj((*it).first);
92 if(obj->getName()==name)
95 vec.push_back(obj->getName());
98 std::ostringstream oss; oss << "DataArrayDoubleCollection::getFieldWithName : fieldName \"" << name << "\" does not exist in this ! Possibilities are :";
99 std::copy(vec.begin(),vec.end(),std::ostream_iterator<std::string>(oss," "));
100 throw INTERP_KERNEL::Exception(oss.str().c_str());
103 void DataArrayDoubleCollection::SynchronizeFineToCoarse(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *fine, DataArrayDoubleCollection *coarse)
106 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineToCoarse : the input DataArrayDouble collections must be non NULL !");
107 std::size_t sz(coarse->_arrs.size());
108 if(fine->_arrs.size()!=sz)
109 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineToCoarse : the input DataArrayDouble collection must have the same size !");
110 for(std::size_t i=0;i<sz;i++)
112 CheckSameNatures(fine->_arrs[i].second,coarse->_arrs[i].second);
113 fatherOfFineMesh->fillCellFieldComingFromPatchGhost(patchId,fine->_arrs[i].first,coarse->_arrs[i].first,ghostLev,IsConservativeNature(coarse->_arrs[i].second));
117 void DataArrayDoubleCollection::SynchronizeCoarseToFine(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine)
120 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeCoarseToFine : the input DataArrayDouble collections must be non NULL !");
121 std::size_t sz(coarse->_arrs.size());
122 if(fine->_arrs.size()!=sz)
123 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeCoarseToFine : the input DataArrayDouble collection must have the same size !");
124 for(std::size_t i=0;i<sz;i++)
126 CheckSameNatures(fine->_arrs[i].second,coarse->_arrs[i].second);
127 fatherOfFineMesh->fillCellFieldOnPatchGhost(patchId,coarse->_arrs[i].first,fine->_arrs[i].first,ghostLev,IsConservativeNature(coarse->_arrs[i].second));
131 void DataArrayDoubleCollection::SynchronizeFineEachOther(int patchId, int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, const std::vector<const MEDCouplingCartesianAMRMeshGen *>& children, const std::vector<DataArrayDoubleCollection *>& fieldsOnFine)
133 if(!fatherOfFineMesh)
134 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineEachOther : father is NULL !");
135 std::size_t sz(children.size());
136 if(fieldsOnFine.size()!=sz)
137 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineEachOther : sizes of vectors mismatch !");
140 std::size_t nbOfCall(fieldsOnFine[0]->_arrs.size());
141 for(std::size_t i=0;i<sz;i++)
142 if(fatherOfFineMesh->getPatchIdFromChildMesh(children[i])!=(int)i)
143 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineEachOther : internal error !");
144 for(std::size_t i=1;i<sz;i++)
145 if(nbOfCall!=fieldsOnFine[i]->_arrs.size())
146 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineEachOther : the collection of DataArrayDouble must have all the same size !");
147 for(std::size_t i=0;i<nbOfCall;i++)
149 std::vector<const DataArrayDouble *> arrs(sz);
150 for(std::size_t j=0;j<sz;j++)
151 arrs[j]=fieldsOnFine[j]->_arrs[i].first;
152 fatherOfFineMesh->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrs);
157 * This method updates \a p1dac ghost zone parts using \a p2dac (which is really const). \a p2 is in the neighborhood of \a p1 (which size is defined by \a ghostLev).
159 void DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const DataArrayDoubleCollection *p1dac, const MEDCouplingCartesianAMRPatch *p2, const DataArrayDoubleCollection *p2dac)
161 if(!p1 || !p1dac || !p2 || !p2dac)
162 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo : input pointer must be not NULL !");
163 std::size_t sz(p1dac->_arrs.size());
164 if(p2dac->_arrs.size()!=sz)
165 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo : size of DataArrayDouble Collection must be the same !");
166 for(std::size_t i=0;i<sz;i++)
168 const DataArrayDouble *zeArrWhichGhostsWillBeUpdated(p1dac->_arrs[i].first);
169 MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoMixedLev(ghostLev,p1,p2,const_cast<DataArrayDouble *>(zeArrWhichGhostsWillBeUpdated),p2dac->_arrs[i].first);
173 void DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine)
176 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone : the input DataArrayDouble collections must be non NULL !");
177 std::size_t sz(coarse->_arrs.size());
178 if(fine->_arrs.size()!=sz)
179 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone : the input DataArrayDouble collection must have the same size !");
180 for(std::size_t i=0;i<sz;i++)
181 fatherOfFineMesh->fillCellFieldOnPatchOnlyOnGhostZone(patchId,coarse->_arrs[i].first,fine->_arrs[i].first,ghostLev);
184 void DataArrayDoubleCollection::synchronizeMyGhostZoneUsing(int ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp, const MEDCouplingCartesianAMRMeshGen *father) const
186 DataArrayDoubleCollection *thisNC(const_cast<DataArrayDoubleCollection *>(this));
187 std::size_t sz(_arrs.size());
188 if(other._arrs.size()!=sz)
189 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::synchronizeMyGhostZoneUsing : sizes of collections must match !");
190 for(std::size_t i=0;i<sz;i++)
191 father->fillCellFieldOnPatchOnlyOnGhostZoneWith(ghostLev,thisp,otherp,thisNC->_arrs[i].first,other._arrs[i].first);
194 void DataArrayDoubleCollection::synchronizeMyGhostZoneUsingExt(int ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp) const
196 DataArrayDoubleCollection *thisNC(const_cast<DataArrayDoubleCollection *>(this));
197 std::size_t sz(_arrs.size());
198 if(other._arrs.size()!=sz)
199 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::synchronizeMyGhostZoneUsingExt : sizes of collections must match !");
200 for(std::size_t i=0;i<sz;i++)
201 MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoExt(ghostLev,thisp,otherp,thisNC->_arrs[i].first,other._arrs[i].first);
204 DataArrayDoubleCollection::DataArrayDoubleCollection(const std::vector< std::pair<std::string,int> >& fieldNames):_arrs(fieldNames.size())
206 std::size_t sz(fieldNames.size());
207 std::vector<std::string> names(sz);
208 for(std::size_t i=0;i<sz;i++)
210 const std::pair<std::string,int>& info(fieldNames[i]);
211 _arrs[i].first=DataArrayDouble::New();
212 _arrs[i].first->alloc(0,info.second);
213 _arrs[i].first->setName(info.first);
214 names[i]=info.second;
215 _arrs[i].second=ConservativeVolumic;
217 CheckDiscriminantNames(names);
220 std::size_t DataArrayDoubleCollection::getHeapMemorySizeWithoutChildren() const
222 std::size_t ret(sizeof(DataArrayDoubleCollection));
223 ret+=_arrs.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr<DataArrayDouble>);
227 std::vector<const BigMemoryObject *> DataArrayDoubleCollection::getDirectChildren() const
229 std::vector<const BigMemoryObject *> ret;
230 for(std::vector< std::pair< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble>, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++)
232 const DataArrayDouble *pt((*it).first);
239 void DataArrayDoubleCollection::updateTime() const
241 for(std::vector< std::pair< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble>, NatureOfField > >::const_iterator it=_arrs.begin();it!=_arrs.end();it++)
243 const DataArrayDouble *pt((*it).first);
249 void DataArrayDoubleCollection::CheckDiscriminantNames(const std::vector<std::string>& names)
251 std::set<std::string> s(names.begin(),names.end());
252 if(s.size()!=names.size())
253 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::CheckDiscriminantNames : The names of fields must be different each other ! It is not the case !");
256 bool DataArrayDoubleCollection::IsConservativeNature(NatureOfField n)
259 return n==RevIntegral || n==IntegralGlobConstraint;
262 void DataArrayDoubleCollection::CheckSameNatures(NatureOfField n1, NatureOfField n2)
264 CheckValidNature(n1);
265 CheckValidNature(n2);
267 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::CheckSameNatures : natures are not the same !");
270 void DataArrayDoubleCollection::CheckValidNature(NatureOfField n)
272 if(n!=ConservativeVolumic && n!=Integral && n!=IntegralGlobConstraint && n!=RevIntegral)
273 throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::CheckValidNature : unrecognized nature !");
276 MEDCouplingGridCollection *MEDCouplingGridCollection::New(const std::vector<const MEDCouplingCartesianAMRMeshGen *>& ms, const std::vector< std::pair<std::string,int> >& fieldNames)
278 return new MEDCouplingGridCollection(ms,fieldNames);
281 void MEDCouplingGridCollection::alloc(int ghostLev)
283 for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
285 int nbTuples((*it).first->getNumberOfCellsAtCurrentLevelGhost(ghostLev));
286 DataArrayDoubleCollection *dadc((*it).second);
288 dadc->allocTuples(nbTuples);
290 throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::alloc : internal error !");
294 void MEDCouplingGridCollection::dealloc()
296 for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
298 DataArrayDoubleCollection *dadc((*it).second);
300 dadc->dellocTuples();
302 throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::dealloc : internal error !");
306 void MEDCouplingGridCollection::spillInfoOnComponents(const std::vector< std::vector<std::string> >& compNames)
308 for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
309 (*it).second->spillInfoOnComponents(compNames);
312 void MEDCouplingGridCollection::spillNatures(const std::vector<NatureOfField>& nfs)
314 for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
315 (*it).second->spillNatures(nfs);
318 bool MEDCouplingGridCollection::presenceOf(const MEDCouplingCartesianAMRMeshGen *m, int& pos) const
321 for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++,ret++)
332 const DataArrayDoubleCollection& MEDCouplingGridCollection::getFieldsAt(int pos) const
334 if(pos<0 || pos>(int)_map_of_dadc.size())
335 throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::getFieldsAt : invalid pos given in input ! Must be in [0,size) !");
336 return *_map_of_dadc[pos].second;
339 void MEDCouplingGridCollection::SynchronizeFineToCoarse(int ghostLev, const MEDCouplingGridCollection *fine, const MEDCouplingGridCollection *coarse)
342 throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeFineToCoarse : one or more input pointer is NULL !");
343 const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >& mf(fine->_map_of_dadc);
344 const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >& mc(coarse->_map_of_dadc);
345 for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it=mf.begin();it!=mf.end();it++)
347 const MEDCouplingCartesianAMRMeshGen *fineMesh((*it).first);
348 const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh(fineMesh->getFather());
350 for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++)
352 if((*it0).first==fatherOfFineMesh)
355 int patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh));
356 const DataArrayDoubleCollection *coarseDaCol((*it0).second);
357 DataArrayDoubleCollection *coarseModified(const_cast<DataArrayDoubleCollection *>(coarseDaCol));//coarse values in DataArrayDouble will be altered
358 DataArrayDoubleCollection::SynchronizeFineToCoarse(ghostLev,fatherOfFineMesh,patchId,(*it).second,coarseModified);
362 throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeFineToCoarse : a fine mesh is orphan regarding given coarse meshes !");
366 void MEDCouplingGridCollection::SynchronizeCoarseToFine(int ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine)
369 throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeCoarseToFine : one or more input pointer is NULL !");
370 const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >& mf(fine->_map_of_dadc);
371 const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >& mc(coarse->_map_of_dadc);
372 for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it=mf.begin();it!=mf.end();it++)
374 const MEDCouplingCartesianAMRMeshGen *fineMesh((*it).first);
375 const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh(fineMesh->getFather());
377 for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++)
379 if((*it0).first==fatherOfFineMesh)
382 int patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh));
383 const DataArrayDoubleCollection *fineDaCol((*it).second);
384 DataArrayDoubleCollection *fineModified(const_cast<DataArrayDoubleCollection *>(fineDaCol));//fine values in DataArrayDouble will be altered
385 DataArrayDoubleCollection::SynchronizeCoarseToFine(ghostLev,fatherOfFineMesh,patchId,(*it0).second,fineModified);
389 throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeCoarseToFine : a fine mesh is orphan regarding given coarse meshes !");
394 * All the pairs in \a ps must share the same father. If not call synchronizeFineEachOtherExt instead.
396 * \sa synchronizeFineEachOtherExt
398 void MEDCouplingGridCollection::synchronizeFineEachOther(int ghostLev, const std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& ps) const
400 for(std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >::const_iterator it=ps.begin();it!=ps.end();it++)
403 if(!presenceOf((*it).first->getMesh(),p1))
404 throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::synchronizeFineEachOther : internal error #1 !");
405 if(!presenceOf((*it).second->getMesh(),p2))
406 throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::synchronizeFineEachOther : internal error #2 !");
407 const DataArrayDoubleCollection& col1(getFieldsAt(p1));
408 const DataArrayDoubleCollection& col2(getFieldsAt(p2));
409 col1.synchronizeMyGhostZoneUsing(ghostLev,col2,(*it).first,(*it).second,(*it).first->getMesh()->getFather());
414 * This method is a generalization of synchronizeFineEachOther because elements in pairs are \b not sharing the same father but are neighbors nevertheless.
416 * \sa synchronizeFineEachOther
418 void MEDCouplingGridCollection::synchronizeFineEachOtherExt(int ghostLev, const std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >& ps) const
420 for(std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >::const_iterator it=ps.begin();it!=ps.end();it++)
423 if(!presenceOf((*it).first->getMesh(),p1))
424 throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::synchronizeFineEachOtherExt : internal error #1 !");
425 if(!presenceOf((*it).second->getMesh(),p2))
426 throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::synchronizeFineEachOtherExt : internal error #2 !");
427 const DataArrayDoubleCollection& col1(getFieldsAt(p1));
428 const DataArrayDoubleCollection& col2(getFieldsAt(p2));
429 col1.synchronizeMyGhostZoneUsingExt(ghostLev,col2,(*it).first,(*it).second);
434 * The pairs returned share the same direct father. The number of returned elements must be even.
436 std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > MEDCouplingGridCollection::findNeighbors(int ghostLev) const
438 std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > ret;
439 std::map<const MEDCouplingCartesianAMRMeshGen *,std::vector< const MEDCouplingCartesianAMRMeshGen * > > m;
440 for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
442 const MEDCouplingCartesianAMRMeshGen *fineMesh((*it).first);
443 const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh(fineMesh->getFather());
444 m[fatherOfFineMesh].push_back(fineMesh);
446 for(std::map<const MEDCouplingCartesianAMRMeshGen *,std::vector< const MEDCouplingCartesianAMRMeshGen * > >::const_iterator it0=m.begin();it0!=m.end();it0++)
448 for(std::vector<const MEDCouplingCartesianAMRMeshGen *>::const_iterator it1=(*it0).second.begin();it1!=(*it0).second.end();it1++)
450 int patchId((*it0).first->getPatchIdFromChildMesh(*it1));
451 std::vector<int> neighs((*it0).first->getPatchIdsInTheNeighborhoodOf(patchId,ghostLev));
452 const MEDCouplingCartesianAMRPatch *pRef((*it0).first->getPatch(patchId));
453 for(std::vector<int>::const_iterator it2=neighs.begin();it2!=neighs.end();it2++)
455 const MEDCouplingCartesianAMRPatch *pLoc((*it0).first->getPatch(*it2));
456 ret.push_back(std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *>(pRef,pLoc));
461 throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::findNeighbors : something is wrong ! The number of neighbor pairs must be %2 ==0 !");
465 void MEDCouplingGridCollection::SynchronizeCoarseToFineOnlyInGhostZone(int ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine)
468 throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeCoarseToFineOnlyInGhostZone : one or more input pointer is NULL !");
469 const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >& mf(fine->_map_of_dadc);
470 const std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >& mc(coarse->_map_of_dadc);
471 for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it=mf.begin();it!=mf.end();it++)
473 const MEDCouplingCartesianAMRMeshGen *fineMesh((*it).first);
474 const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh(fineMesh->getFather());
476 for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it0=mc.begin();it0!=mc.end() && !found;it0++)
478 if((*it0).first==fatherOfFineMesh)
481 int patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh));
482 const DataArrayDoubleCollection *fineDaCol((*it).second);
483 DataArrayDoubleCollection *fineModified(const_cast<DataArrayDoubleCollection *>(fineDaCol));//fine values in DataArrayDouble will be altered
484 DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone(ghostLev,fatherOfFineMesh,patchId,(*it0).second,fineModified);
488 throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeCoarseToFineOnlyInGhostZone : a fine mesh is orphan regarding given coarse meshes !");
492 void MEDCouplingGridCollection::fillIfInTheProgenyOf(const std::string& fieldName, const MEDCouplingCartesianAMRMeshGen *head, std::vector<const DataArrayDouble *>& recurseArrs) const
494 for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
496 const MEDCouplingCartesianAMRMeshGen *a((*it).first);
497 if(head==a || head->isObjectInTheProgeny(a))
499 const DataArrayDoubleCollection *gc((*it).second);
500 recurseArrs.push_back(gc->getFieldWithName(fieldName));
505 MEDCouplingGridCollection::MEDCouplingGridCollection(const std::vector<const MEDCouplingCartesianAMRMeshGen *>& ms, const std::vector< std::pair<std::string,int> >& fieldNames):_map_of_dadc(ms.size())
507 std::size_t sz(ms.size());
508 for(std::size_t i=0;i<sz;i++)
511 throw INTERP_KERNEL::Exception("MEDCouplingGridCollection constructor : presence of NULL MEDCouplingCartesianAMRMeshGen instance !");
512 _map_of_dadc[i].first=ms[i];
513 _map_of_dadc[i].second=DataArrayDoubleCollection::New(fieldNames);
517 std::size_t MEDCouplingGridCollection::getHeapMemorySizeWithoutChildren() const
519 std::size_t ret(sizeof(MEDCouplingGridCollection));
520 ret+=_map_of_dadc.capacity()*sizeof(std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> >);
524 std::vector<const BigMemoryObject *> MEDCouplingGridCollection::getDirectChildren() const
526 std::vector<const BigMemoryObject *> ret;
527 for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
529 const DataArrayDoubleCollection *col((*it).second);
536 void MEDCouplingGridCollection::updateTime() const
538 for(std::vector< std::pair<const MEDCouplingCartesianAMRMeshGen *,MEDCouplingAutoRefCountObjectPtr<DataArrayDoubleCollection> > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++)
540 const MEDCouplingCartesianAMRMeshGen *a((*it).first);
543 const DataArrayDoubleCollection *b((*it).second);
550 * This method creates, attach to a main AMR mesh \a gf ( called god father :-) ) and returns a data linked to \a gf ready for the computation.
552 MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMeshGen *gf, const std::vector< std::pair<std::string,int> >& fieldNames, int ghostLev)
554 return new MEDCouplingAMRAttribute(gf,fieldNames,ghostLev);
557 MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMeshGen *gf, const std::vector< std::pair<std::string, std::vector<std::string> > >& fieldNames, int ghostLev)
559 std::size_t sz(fieldNames.size());
560 std::vector< std::pair<std::string,int> > fieldNames2(sz);
561 std::vector< std::vector<std::string> > compNames(sz);
562 for(std::size_t i=0;i<sz;i++)
564 fieldNames2[i].first=fieldNames[i].first;
565 fieldNames2[i].second=(int)fieldNames[i].second.size();
566 compNames[i]=fieldNames[i].second;
568 MEDCouplingAutoRefCountObjectPtr<MEDCouplingAMRAttribute> ret(New(gf,fieldNames2,ghostLev));
569 ret->spillInfoOnComponents(compNames);
574 * Assign the info on components for all DataArrayDouble instance recursively stored in \a this.
575 * The first dim of input \a compNames is the field id in the same order than those implicitely specified in \a fieldNames parameter of MEDCouplingAMRAttribute::New.
576 * The second dim of \a compNames represent the component names component per component corresponding to the field. The size of this 2nd dimension has
577 * to perfectly fit with those specified in MEDCouplingAMRAttribute::New.
579 void MEDCouplingAMRAttribute::spillInfoOnComponents(const std::vector< std::vector<std::string> >& compNames)
582 for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
583 (*it)->spillInfoOnComponents(compNames);
587 * Assign nature for each fields in \a this.
590 void MEDCouplingAMRAttribute::spillNatures(const std::vector<NatureOfField>& nfs)
593 for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
594 (*it)->spillNatures(nfs);
598 * This method returns all DataArrayDouble instances lying on the specified mesh \a mesh.
599 * If \a mesh is not part of the progeny of god father object given at construction of \a this an exception will be thrown.
601 * \return std::vector<DataArrayDouble *> - DataArrayDouble instances to be deallocated by the caller (using decrRef).
602 * \sa retrieveFieldOn
604 std::vector<DataArrayDouble *> MEDCouplingAMRAttribute::retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const
606 for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
609 if((*it)->presenceOf(mesh,tmp))
611 const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp));
612 return ddc.retrieveFields();
615 throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::retrieveFieldsOn : the mesh specified is not in the progeny of this !");
619 * \sa retrieveFieldsOn
621 const DataArrayDouble *MEDCouplingAMRAttribute::getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
623 for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
626 if((*it)->presenceOf(mesh,tmp))
628 const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp));
629 return ddc.getFieldWithName(fieldName);
632 throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::retrieveFieldOn : the mesh specified is not in the progeny of this !");
636 * This method returns a field on an unstructured mesh the most refined as possible without overlap.
637 * Ghost part are not visible here.
639 * \return MEDCouplingFieldDouble * - a field on cells that the caller has to deal with (deallocate it).
641 MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
643 std::vector<const DataArrayDouble *> recurseArrs;
645 for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++,lev++)
648 if((*it)->presenceOf(mesh,tmp))
650 const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp));
651 recurseArrs.push_back(ddc.getFieldWithName(fieldName));
656 for(std::size_t i=lev;i<_levs.size();i++)
658 const MEDCouplingGridCollection *gc(_levs[i]);
659 gc->fillIfInTheProgenyOf(fieldName,mesh,recurseArrs);
661 return mesh->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(_ghost_lev,recurseArrs);
665 * This method builds a newly created field on cell just lying on mesh \a mesh without its eventual refinement.
666 * The output field also displays ghost cells.
668 * \return MEDCouplingFieldDouble * - a field on cells that the caller has to deal with (deallocate it).
670 * \sa buildCellFieldOnWithoutGhost
672 MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
674 const DataArrayDouble *arr(0);
675 for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
678 if((*it)->presenceOf(mesh,tmp))
680 const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp));
681 arr=ddc.getFieldWithName(fieldName);
685 throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::buildCellFieldOnWithGhost : the mesh specified is not in the progeny of this !");
686 MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> im(mesh->getImageMesh()->buildWithGhost(_ghost_lev));
687 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS));
689 ret->setArray(const_cast<DataArrayDouble *>(arr));
690 ret->setName(arr->getName());
695 * This method builds a newly created field on cell just lying on mesh \a mesh without its eventual refinement.
696 * The output field does not display ghost cells.
698 * \return MEDCouplingFieldDouble * - a field on cells that the caller has to deal with (deallocate it).
700 * \sa buildCellFieldOnWithGhost
702 MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const
705 const DataArrayDouble *arr(0);
706 for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
709 if((*it)->presenceOf(mesh,tmp))
711 const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp));
712 arr=ddc.getFieldWithName(fieldName);
716 throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost : the mesh specified is not in the progeny of this !");
718 MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> im(mesh->getImageMesh()->buildWithGhost(_ghost_lev));
719 std::vector<int> cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure());
720 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr2(DataArrayDouble::New());
721 arr2->alloc(mesh->getImageMesh()->getNumberOfCells(),arr->getNumberOfComponents());
722 std::vector< std::pair<int,int> > cgs2(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(cgs));
723 MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(cgs2,_ghost_lev);
724 std::vector<int> fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1);
725 MEDCouplingIMesh::SpreadCoarseToFine(arr,cgsWG,arr2,cgs2,fakeFactors);
726 arr2->copyStringInfoFrom(*arr);
728 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(ON_CELLS));
729 ret->setMesh(mesh->getImageMesh());
731 ret->setName(arr->getName());
736 * This method synchronizes from fine to coarse direction arrays. This method makes the hypothesis that \a this has been allocated before using
737 * MEDCouplingAMRAttribute::alloc method.
739 void MEDCouplingAMRAttribute::synchronizeFineToCoarse()
742 throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeFineToCoarse : not any levels in this !");
743 std::size_t sz(_levs.size());
748 const MEDCouplingGridCollection *fine(_levs[sz]),*coarse(_levs[sz-1]);
749 MEDCouplingGridCollection::SynchronizeFineToCoarse(_ghost_lev,fine,coarse);
754 * This method synchronizes from coarse to fine arrays and fine to fine each other (if _ghost_lev is >0). This method makes the hypothesis that \a this has been allocated before using
755 * MEDCouplingAMRAttribute::alloc method.
757 void MEDCouplingAMRAttribute::synchronizeCoarseToFine()
760 throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeCoarseToFine : not any levels in this !");
761 std::size_t sz(_levs.size());
763 for(std::size_t i=1;i<sz;i++)
765 const MEDCouplingGridCollection *fine(_levs[i]),*coarse(_levs[i-1]);
766 MEDCouplingGridCollection::SynchronizeCoarseToFine(_ghost_lev,coarse,fine);
771 * This method synchronizes the ghost zone of all patches (excepted the god father one).
772 * This method operates in 4 steps. Larger is the number of steps more accurate is the information in the ghost zone.
774 * - firstly coarse to fine with no interactions between brother patches.
775 * - secondly connected brother patches in a same master patch are updated.
776 * - thirdly connected nephew patches are updated each other.
777 * - forthly nth generation cousin patches are updated each other.
779 * This method makes the hypothesis that \a this has been allocated before using MEDCouplingAMRAttribute::alloc method.
780 * So if \a _ghost_lev == 0 this method has no effect.
782 void MEDCouplingAMRAttribute::synchronizeAllGhostZones()
785 throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeFineEachOther : not any levels in this !");
786 // 1st - synchronize from coarse to the finest all the patches (excepted the god father one)
787 std::size_t sz(_levs.size());
788 for(std::size_t i=1;i<sz;i++)
790 const MEDCouplingGridCollection *fine(_levs[i]),*coarse(_levs[i-1]);
791 MEDCouplingGridCollection::SynchronizeCoarseToFineOnlyInGhostZone(_ghost_lev,coarse,fine);
793 // 2nd - classical direct sublevel inside common patch
794 for(std::size_t i=1;i<sz;i++)
796 const MEDCouplingGridCollection *fine(_levs[i]);
798 throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeFineEachOtherInGhostZone : presence of a NULL element !");
799 fine->synchronizeFineEachOther(_ghost_lev,_neighbors[i]);
802 for(std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >::const_iterator it=_mixed_lev_neighbors.begin();it!=_mixed_lev_neighbors.end();it++)
804 const DataArrayDoubleCollection *firstDAC(&findCollectionAttachedTo((*it).first->getMesh())),*secondDAC(&findCollectionAttachedTo((*it).second->getMesh()));
805 DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo(_ghost_lev,(*it).first,firstDAC,(*it).second,secondDAC);
807 // 4th - same level but with far ancestor.
808 for(std::size_t i=1;i<sz;i++)
810 const MEDCouplingGridCollection *fine(_levs[i]);
811 fine->synchronizeFineEachOtherExt(_ghost_lev,_cross_lev_neighbors[i]);
816 * This method allocates all DataArrayDouble instances stored recursively in \a this.
820 void MEDCouplingAMRAttribute::alloc()
823 for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
825 MEDCouplingGridCollection *elt(*it);
827 elt->alloc(_ghost_lev);
829 throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::alloc : internal error !");
834 * This method deallocates all DataArrayDouble instances stored recursively in \a this.
837 void MEDCouplingAMRAttribute::dealloc()
840 for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::iterator it=_levs.begin();it!=_levs.end();it++)
842 MEDCouplingGridCollection *elt(*it);
846 throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::dealloc : internal error !");
850 bool MEDCouplingAMRAttribute::changeGodFather(MEDCouplingCartesianAMRMeshGen *gf)
852 bool ret(MEDCouplingDataForGodFather::changeGodFather(gf));
856 std::size_t MEDCouplingAMRAttribute::getHeapMemorySizeWithoutChildren() const
858 std::size_t ret(sizeof(MEDCouplingAMRAttribute));
859 ret+=_levs.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection>);
863 std::vector<const BigMemoryObject *> MEDCouplingAMRAttribute::getDirectChildren() const
865 std::vector<const BigMemoryObject *> ret;
866 for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
868 const MEDCouplingGridCollection *elt(*it);
875 void MEDCouplingAMRAttribute::updateTime() const
879 MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMeshGen *gf, const std::vector< std::pair<std::string,int> >& fieldNames, int ghostLev):MEDCouplingDataForGodFather(gf),_ghost_lev(ghostLev)
881 //gf non empty, checked by constructor
882 int maxLev(gf->getMaxNumberOfLevelsRelativeToThis());
883 _levs.resize(maxLev);
884 for(int i=0;i<maxLev;i++)
886 std::vector<MEDCouplingCartesianAMRPatchGen *> patches(gf->retrieveGridsAt(i));
887 std::size_t sz(patches.size());
888 std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingCartesianAMRPatchGen> > patchesSafe(patches.size());
889 for(std::size_t j=0;j<sz;j++)
890 patchesSafe[j]=patches[j];
891 std::vector<const MEDCouplingCartesianAMRMeshGen *> ms(sz);
892 for(std::size_t j=0;j<sz;j++)
894 ms[j]=patches[j]->getMesh();
896 _levs[i]=MEDCouplingGridCollection::New(ms,fieldNames);
898 // updates cross levels neighbors
899 _neighbors.resize(_levs.size());
900 _cross_lev_neighbors.resize(_levs.size());
902 throw INTERP_KERNEL::Exception("constructor of MEDCouplingAMRAttribute : not any levels in this !");
903 std::size_t sz(_levs.size());
904 for(std::size_t i=1;i<sz;i++)
906 const MEDCouplingGridCollection *fine(_levs[i]);
908 throw INTERP_KERNEL::Exception("constructor of MEDCouplingAMRAttribute : presence of a NULL element !");
909 _neighbors[i]=fine->findNeighbors(_ghost_lev);
912 for(std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> >::const_iterator it=_neighbors[i].begin();it!=_neighbors[i].end();it++)
914 MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOf(_ghost_lev,(*it).first,(*it).second,_mixed_lev_neighbors);
915 std::vector< std::vector < std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > > neighs2(MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOfSameLev(_ghost_lev,(*it).first,(*it).second));
916 std::size_t fullLev(i+neighs2.size());
918 throw INTERP_KERNEL::Exception("constructor of MEDCouplingAMRAttribute : internal error ! something is wrong in computation of cross level neighbors !");
920 for(std::vector< std::vector< std::pair<const MEDCouplingCartesianAMRPatch *,const MEDCouplingCartesianAMRPatch *> > >::const_iterator it0=neighs2.begin();it0!=neighs2.end();it0++,ii++)
921 _cross_lev_neighbors[ii].insert(_cross_lev_neighbors[ii].end(),(*it0).begin(),(*it0).end());
927 const DataArrayDoubleCollection& MEDCouplingAMRAttribute::findCollectionAttachedTo(const MEDCouplingCartesianAMRMeshGen *m) const
929 for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingGridCollection> >::const_iterator it=_levs.begin();it!=_levs.end();it++)
931 const MEDCouplingGridCollection *elt(*it);
935 if(elt->presenceOf(m,tmp))
937 return elt->getFieldsAt(tmp);
941 throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::findCollectionAttachedTo : unable to find such part of mesh in this !");