1 // Copyright (C) 2007-2013 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.
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 (CEA/DEN)
21 #include "MEDFileFieldOverView.hxx"
22 #include "MEDFileField.hxx"
23 #include "MEDFileMesh.hxx"
25 #include "CellModel.hxx"
27 using namespace ParaMEDMEM;
29 const char MEDFileField1TSStructItem2::NEWLY_CREATED_PFL_NAME[]="???";
31 MEDFileMeshStruct *MEDFileMeshStruct::New(const MEDFileMesh *mesh)
33 return new MEDFileMeshStruct(mesh);
36 std::size_t MEDFileMeshStruct::getHeapMemorySize() const
39 for(std::vector< std::vector<int> >::const_iterator it0=_geo_types_distrib.begin();it0!=_geo_types_distrib.end();it0++)
40 ret+=(*it0).capacity()*sizeof(int);
41 ret+=_geo_types_distrib.capacity()*sizeof(std::vector<int>);
45 MEDFileMeshStruct::MEDFileMeshStruct(const MEDFileMesh *mesh):_mesh(mesh)
47 std::vector<int> levs=mesh->getNonEmptyLevels();
48 _name=mesh->getName();
49 _nb_nodes=mesh->getNumberOfNodes();
50 _geo_types_distrib.resize(levs.size());
51 for(std::vector<int>::const_iterator lev=levs.begin();lev!=levs.end();lev++)
53 MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> mLev=mesh->getGenMeshAtLevel(*lev);
54 _geo_types_distrib[-(*lev)]=mLev->getDistributionOfTypes();
58 int MEDFileMeshStruct::getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) const throw(INTERP_KERNEL::Exception)
61 for(std::vector< std::vector<int> >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++,j--)
63 std::size_t sz=(*it1).size();
65 throw INTERP_KERNEL::Exception("MEDFileMeshStruct::getLevelOfGeoType : internal error in code !");
66 std::size_t nbGeo=sz/3;
67 for(std::size_t i=0;i<nbGeo;i++)
68 if((*it1)[3*i]==(int)t)
71 throw INTERP_KERNEL::Exception("MEDFileMeshStruct::getLevelOfGeoType : The specified geometric type is not present in the mesh structure !");
74 int MEDFileMeshStruct::getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const throw(INTERP_KERNEL::Exception)
76 for(std::vector< std::vector<int> >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++)
78 std::size_t sz=(*it1).size();
80 throw INTERP_KERNEL::Exception("MEDFileMeshStruct::getNumberOfElemsOfGeoType : internal error in code !");
81 std::size_t nbGeo=sz/3;
82 for(std::size_t i=0;i<nbGeo;i++)
83 if((*it1)[3*i]==(int)t)
86 throw INTERP_KERNEL::Exception("The specified geometric type is not present in the mesh structure !");
89 int MEDFileMeshStruct::getNumberOfLevs() const
91 return (int)_geo_types_distrib.size();
94 int MEDFileMeshStruct::getNumberOfGeoTypesInLev(int relativeLev) const throw(INTERP_KERNEL::Exception)
96 int pos(-relativeLev);
97 if(pos<0 || pos>=_geo_types_distrib.size())
98 throw INTERP_KERNEL::Exception("MEDFileMeshStruct::getNumberOfGeoTypesInLev : invalid level specified !");
99 std::size_t sz=_geo_types_distrib[pos].size();
101 throw INTERP_KERNEL::Exception("MEDFileMeshStruct::getNumberOfGeoTypesInLev : internal error in code !");
107 MEDFileField1TSStructItem2::MEDFileField1TSStructItem2()
111 MEDFileField1TSStructItem2::MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair<int,int>& b, const std::string& c, const std::string& d):_geo_type(a),_start_end(b),_pfl(DataArrayInt::New()),_loc(d),_nb_of_entity(-1)
113 _pfl->setName(c.c_str());
116 void MEDFileField1TSStructItem2::checkWithMeshStructForCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) throw(INTERP_KERNEL::Exception)
118 int nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
119 checkInRange(nbOfEnt,1,globs);
122 void MEDFileField1TSStructItem2::checkWithMeshStructForGaussNE(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) throw(INTERP_KERNEL::Exception)
124 int nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
125 const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type);
126 checkInRange(nbOfEnt,(int)cm.getNumberOfNodes(),globs);
129 void MEDFileField1TSStructItem2::checkWithMeshStructForGaussPT(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) throw(INTERP_KERNEL::Exception)
132 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkWithMeshStructForGaussPT : no globals specified !");
134 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkWithMeshStructForGaussPT : no localization specified !");
135 const MEDFileFieldLoc& loc=globs->getLocalization(_loc.c_str());
136 int nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
137 checkInRange(nbOfEnt,loc.getNumberOfGaussPoints(),globs);
140 std::string MEDFileField1TSStructItem2::getPflName() const
142 return _pfl->getName();
145 const DataArrayInt *MEDFileField1TSStructItem2::getPfl(const MEDFileFieldGlobsReal *globs) const
147 if(!_pfl->isAllocated())
149 if(_pfl->getName().empty())
152 return globs->getProfile(_pfl->getName().c_str());
159 * \param [in] nbOfEntity - number of entity that can be either cells or nodes. Not other possiblity.
160 * \param [in] nip - number of integration points. 1 for ON_CELLS and NO_NODES
162 void MEDFileField1TSStructItem2::checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs) throw(INTERP_KERNEL::Exception)
164 _nb_of_entity=nbOfEntity;
165 if(_pfl->getName().empty())
167 if(nbOfEntity!=(_start_end.second-_start_end.first)/nip)
168 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkInRange : Mismatch between number of entities and size of node field !");
174 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkInRange : Presence of a profile on field whereas no globals found in file !");
175 const DataArrayInt *pfl=globs->getProfile(_pfl->getName().c_str());
177 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkInRange : Presence of a profile on field whereas no such profile found in file !");
178 pfl->checkAllIdsInRange(0,nbOfEntity);
182 bool MEDFileField1TSStructItem2::operator==(const MEDFileField1TSStructItem2& other) const throw(INTERP_KERNEL::Exception)
184 //_nb_of_entity is not taken into account here. It is not a bug, because no mesh consideration needed here to perform fast compare.
185 //idem for _loc. It is not an effective attribute for support comparison.
186 return _geo_type==other._geo_type && _start_end==other._start_end && _pfl->getName()==other._pfl->getName();
189 bool MEDFileField1TSStructItem2::isCellSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception)
191 if(_geo_type!=other._geo_type)
193 if(_nb_of_entity!=other._nb_of_entity)
195 if((_pfl->getName().empty() && !other._pfl->getName().empty()) || (!_pfl->getName().empty() && other._pfl->getName().empty()))
197 if(_pfl->getName().empty() && other._pfl->getName().empty())
199 const DataArrayInt *pfl1(getPfl(globs)),*pfl2(other.getPfl(globs));
200 return pfl1->isEqualWithoutConsideringStr(*pfl2);
203 bool MEDFileField1TSStructItem2::isNodeSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception)
205 return isCellSupportEqual(other,globs);
209 * \a objs must be non empty. \a objs should contain items having same geometric type.
211 MEDFileField1TSStructItem2 MEDFileField1TSStructItem2::BuildAggregationOf(const std::vector<const MEDFileField1TSStructItem2 *>& objs, const MEDFileFieldGlobsReal *globs) throw(INTERP_KERNEL::Exception)
214 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::BuildAggregationOf : empty input !");
216 return MEDFileField1TSStructItem2(*objs[0]);
217 INTERP_KERNEL::NormalizedCellType gt(objs[0]->_geo_type);
218 int nbEntityRef(objs[0]->_nb_of_entity);
219 std::size_t sz(objs.size());
220 std::vector<const DataArrayInt *> arrs(sz);
221 for(std::size_t i=0;i<sz;i++)
223 const MEDFileField1TSStructItem2 *obj(objs[i]);
224 if(gt!=obj->_geo_type)
225 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::BuildAggregationOf : invalid situation ! All input must have the same geo type !");
226 if(nbEntityRef!=obj->_nb_of_entity)
227 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::BuildAggregationOf : invalid situation ! All input must have the global nb of entity !");
228 if(obj->_pfl->getName().empty())
229 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::BuildAggregationOf : invalid situation ! Several same geo type chunk must all lie on profiles !");
230 arrs[i]=globs->getProfile(obj->_pfl->getName().c_str());
232 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr(DataArrayInt::Aggregate(arrs));
234 int oldNbTuples(arr->getNumberOfTuples());
235 arr=arr->buildUnique();
236 if(oldNbTuples!=arr->getNumberOfTuples())
237 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::BuildAggregationOf : some entities are present several times !");
238 if(arr->isIdentity() && oldNbTuples==nbEntityRef)
240 std::pair<int,int> p(0,nbEntityRef);
242 MEDFileField1TSStructItem2 ret(gt,p,a,b);
243 ret._nb_of_entity=nbEntityRef;
248 arr->setName(NEWLY_CREATED_PFL_NAME);
249 std::pair<int,int> p(0,oldNbTuples);
251 MEDFileField1TSStructItem2 ret(gt,p,a,b);
252 ret._nb_of_entity=nbEntityRef;
258 std::size_t MEDFileField1TSStructItem2::getHeapMemorySize() const
261 const DataArrayInt *pfl(_pfl);
263 ret+=pfl->getHeapMemorySize();
264 ret+=_loc.capacity();
270 MEDFileField1TSStructItem::MEDFileField1TSStructItem(TypeOfField a, const std::vector< MEDFileField1TSStructItem2 >& b):_computed(false),_type(a),_items(b)
274 void MEDFileField1TSStructItem::checkWithMeshStruct(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) throw(INTERP_KERNEL::Exception)
280 int nbOfEnt=mst->getNumberOfNodes();
282 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::checkWithMeshStruct : for nodes field only one subdivision supported !");
283 _items[0].checkInRange(nbOfEnt,1,globs);
288 for(std::vector< MEDFileField1TSStructItem2 >::iterator it=_items.begin();it!=_items.end();it++)
289 (*it).checkWithMeshStructForCells(mst,globs);
294 for(std::vector< MEDFileField1TSStructItem2 >::iterator it=_items.begin();it!=_items.end();it++)
295 (*it).checkWithMeshStructForGaussNE(mst,globs);
300 for(std::vector< MEDFileField1TSStructItem2 >::iterator it=_items.begin();it!=_items.end();it++)
301 (*it).checkWithMeshStructForGaussPT(mst,globs);
305 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::checkWithMeshStruct : not managed field type !");
309 bool MEDFileField1TSStructItem::operator==(const MEDFileField1TSStructItem& other) const throw(INTERP_KERNEL::Exception)
311 if(_type!=other._type)
313 if(_items.size()!=other._items.size())
315 for(std::size_t i=0;i<_items.size();i++)
316 if(!(_items[i]==other._items[i]))
321 bool MEDFileField1TSStructItem::isCellSupportEqual(const MEDFileField1TSStructItem& other, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception)
323 if(_type!=other._type)
325 if(_items.size()!=other._items.size())
327 for(std::size_t i=0;i<_items.size();i++)
328 if(!(_items[i].isCellSupportEqual(other._items[i],globs)))
333 bool MEDFileField1TSStructItem::isNodeSupportEqual(const MEDFileField1TSStructItem& other, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception)
335 if(_type!=other._type)
337 if(_items.size()!=other._items.size())
339 for(std::size_t i=0;i<_items.size();i++)
340 if(!(_items[i].isNodeSupportEqual(other._items[i],globs)))
345 bool MEDFileField1TSStructItem::isEntityCell() const
356 CmpGeo(INTERP_KERNEL::NormalizedCellType geoTyp):_geo_type(geoTyp) { }
357 bool operator()(const std::pair< INTERP_KERNEL::NormalizedCellType, std::vector<std::size_t> > & v) const { return _geo_type==v.first; }
359 INTERP_KERNEL::NormalizedCellType _geo_type;
362 MEDFileField1TSStructItem MEDFileField1TSStructItem::simplifyMeOnCellEntity(const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception)
365 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::simplifyMeOnCellEntity : must be on ON_CELLS, ON_GAUSS_NE or ON_GAUSS_PT !");
366 std::vector< std::pair< INTERP_KERNEL::NormalizedCellType, std::vector<std::size_t> > > m;
368 for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++,i++)
370 std::vector< std::pair< INTERP_KERNEL::NormalizedCellType, std::vector<std::size_t> > >::iterator it0(std::find_if(m.begin(),m.end(),CmpGeo((*it).getGeo())));
372 m.push_back(std::pair< INTERP_KERNEL::NormalizedCellType, std::vector<std::size_t> >((*it).getGeo(),std::vector<std::size_t>(1,i)));
374 (*it0).second.push_back(i);
376 if(m.size()==_items.size())
378 MEDFileField1TSStructItem ret(*this);
382 std::size_t sz(m.size());
383 std::vector< MEDFileField1TSStructItem2 > items(sz);
386 const std::vector<std::size_t>& ids=m[i].second;
387 std::vector<const MEDFileField1TSStructItem2 *>objs(ids.size());
388 for(std::size_t j=0;j<ids.size();j++)
389 objs[j]=&_items[ids[j]];
390 items[i]=MEDFileField1TSStructItem2::BuildAggregationOf(objs,globs);
392 MEDFileField1TSStructItem ret(ON_CELLS,items);
398 * \a this is expected to be ON_CELLS and simplified.
400 bool MEDFileField1TSStructItem::isCompatibleWithNodesDiscr(const MEDFileField1TSStructItem& other, const MEDFileMeshStruct *meshSt, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception)
402 if(other._type!=ON_NODES)
403 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::isCompatibleWithNodesDiscr : other must be on nodes !");
404 if(other._items.size()!=1)
405 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::isCompatibleWithNodesDiscr : other is on nodes but number of subparts !");
407 bool ret0=isFullyOnOneLev(meshSt,theFirstLevFull);
408 const MEDFileField1TSStructItem2& otherNodeIt(other._items[0]);
409 if(otherNodeIt.getPflName().empty())
413 return theFirstLevFull==0;
417 const DataArrayInt *pfl=globs->getProfile(otherNodeIt.getPflName().c_str());
418 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cpyPfl(pfl->deepCpy());
420 int nbOfNodes(meshSt->getNumberOfNodes());
421 if(cpyPfl->isIdentity() && cpyPfl->getNumberOfTuples()==nbOfNodes)
422 {//on all nodes also !
425 return theFirstLevFull==0;
427 std::vector<bool> nodesFetched(nbOfNodes,false);
428 meshSt->getTheMesh()->whichAreNodesFetched(*this,globs,nodesFetched);
429 return cpyPfl->isFittingWith(nodesFetched);
433 bool MEDFileField1TSStructItem::isFullyOnOneLev(const MEDFileMeshStruct *meshSt, int& theFirstLevFull) const throw(INTERP_KERNEL::Exception)
436 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::isFullyOnOneLev : works only for ON_CELLS discretization !");
438 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::isFullyOnOneLev : items vector is empty !");
439 int nbOfLevs(meshSt->getNumberOfLevs());
441 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::isFullyOnOneLev : no levels in input mesh structure !");
442 std::vector<int> levs(nbOfLevs);
445 std::set<INTERP_KERNEL::NormalizedCellType> gts;
446 for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++)
448 if(!(*it).getPflName().empty())
450 INTERP_KERNEL::NormalizedCellType gt((*it).getGeo());
451 if(gts.find(gt)!=gts.end())
452 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::isFullyOnOneLev : internal error !");
454 int pos(meshSt->getLevelOfGeoType((*it).getGeo()));
457 for(int i=0;i<nbOfLevs;i++)
458 if(meshSt->getNumberOfGeoTypesInLev(-i)==levs[i])
459 { theFirstLevFull=-i; return true; }
463 const MEDFileField1TSStructItem2& MEDFileField1TSStructItem::operator[](std::size_t i) const throw(INTERP_KERNEL::Exception)
465 if(i<0 || i>=_items.size())
466 throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::operator[] : input is not in valid range !");
470 std::size_t MEDFileField1TSStructItem::getHeapMemorySize() const
473 for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++)
474 ret+=(*it).getHeapMemorySize();
475 ret+=_items.size()*sizeof(MEDFileField1TSStructItem2);
479 MEDMeshMultiLev *MEDFileField1TSStructItem::buildFromScratchDataSetSupportOnCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception)
481 std::vector<INTERP_KERNEL::NormalizedCellType> a0;
482 std::vector<const DataArrayInt *> a1;
485 for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++,i++)
487 a0[i]=(*it).getGeo();
488 a1[i]=(*it).getPfl(globs);
489 a2[i]=mst->getNumberOfElemsOfGeoType((*it).getGeo());
491 return MEDMeshMultiLev::New(mst->getTheMesh(),a0,a1,a2);
496 MEDFileField1TSStruct *MEDFileField1TSStruct::New(const MEDFileAnyTypeField1TS *ref, MEDFileMeshStruct *mst) throw(INTERP_KERNEL::Exception)
498 return new MEDFileField1TSStruct(ref,mst);
501 MEDFileField1TSStruct::MEDFileField1TSStruct(const MEDFileAnyTypeField1TS *ref, MEDFileMeshStruct *mst)
503 _already_checked.push_back(BuildItemFrom(ref,mst));
506 void MEDFileField1TSStruct::checkWithMeshStruct(MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) throw(INTERP_KERNEL::Exception)
508 if(_already_checked.empty())
509 throw INTERP_KERNEL::Exception("MEDFileField1TSStruct::checkWithMeshStruct : not correctly initialized !");
510 _already_checked.back().checkWithMeshStruct(mst,globs);
513 bool MEDFileField1TSStruct::isEqualConsideringThePast(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *mst) const throw(INTERP_KERNEL::Exception)
515 MEDFileField1TSStructItem b(BuildItemFrom(other,mst));
516 for(std::vector<MEDFileField1TSStructItem>::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++)
525 * Not const because \a other structure will be added to the \c _already_checked attribute in case of success.
527 bool MEDFileField1TSStruct::isSupportSameAs(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt) throw(INTERP_KERNEL::Exception)
529 if(_already_checked.empty())
530 throw INTERP_KERNEL::Exception("MEDFileField1TSStruct::isSupportSameAs : no ref !");
531 MEDFileField1TSStructItem b(BuildItemFrom(other,meshSt));
532 if(!_already_checked[0].isEntityCell() || !b.isEntityCell())
533 throw INTERP_KERNEL::Exception("MEDFileField1TSStruct::isSupportSameAs : only available on cell entities !");
534 MEDFileField1TSStructItem other1(b.simplifyMeOnCellEntity(other));
536 for(std::vector<MEDFileField1TSStructItem>::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++,i++)
537 if((*it).isComputed())
542 MEDFileField1TSStructItem this1(_already_checked[0].simplifyMeOnCellEntity(other));
543 ret=this1.isCellSupportEqual(other1,other);
545 _already_checked.push_back(this1);
548 ret=_already_checked[found].isCellSupportEqual(other1,other);
550 _already_checked.push_back(b);
554 bool MEDFileField1TSStruct::isCompatibleWithNodesDiscr(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt) throw(INTERP_KERNEL::Exception)
556 if(_already_checked.empty())
557 throw INTERP_KERNEL::Exception("MEDFileField1TSStruct::isCompatibleWithNodesDiscr : no ref !");
558 if(!_already_checked[0].isEntityCell())
559 throw INTERP_KERNEL::Exception("MEDFileField1TSStruct::isCompatibleWithNodesDiscr : only available on cell entities !");
560 MEDFileField1TSStructItem other1(BuildItemFrom(other,meshSt));
563 for(std::vector<MEDFileField1TSStructItem>::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++,i++)
564 if((*it).isComputed())
569 MEDFileField1TSStructItem this1(_already_checked[0].simplifyMeOnCellEntity(other));
570 ret=this1.isCompatibleWithNodesDiscr(other1,meshSt,other);
572 _already_checked.push_back(this1);
575 ret=_already_checked[found].isCompatibleWithNodesDiscr(other1,meshSt,other);
577 _already_checked.push_back(other1);
581 std::size_t MEDFileField1TSStruct::getHeapMemorySize() const
584 for(std::vector<MEDFileField1TSStructItem>::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++)
585 ret+=(*it).getHeapMemorySize();
586 ret+=_already_checked.capacity()*sizeof(MEDFileField1TSStructItem);
590 MEDFileField1TSStructItem MEDFileField1TSStruct::BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt)
593 std::vector< MEDFileField1TSStructItem2 > anItems;
595 std::vector< std::vector<std::string> > pfls,locs;
596 std::vector< std::vector<TypeOfField> > typesF;
597 std::vector<INTERP_KERNEL::NormalizedCellType> geoTypes;
598 std::vector< std::vector<std::pair<int,int> > > strtEnds=ref->getFieldSplitedByType(0,geoTypes,typesF,pfls,locs);
599 std::size_t nbOfGeoTypes(geoTypes.size());
601 throw INTERP_KERNEL::Exception("MEDFileField1TSStruct : not null by empty ref !");
603 for(std::size_t i=0;i<nbOfGeoTypes;i++)
605 std::size_t sz=typesF[i].size();
606 if(strtEnds[i].size()<1 || sz<1 || pfls[i].size()<1)
607 throw INTERP_KERNEL::Exception("MEDFileField1TSStruct : internal error #1 !");
613 for(std::size_t j=0;j<sz;j++)
615 if(atype==typesF[i][j])
616 anItems.push_back(MEDFileField1TSStructItem2(geoTypes[i],strtEnds[i][j],pfls[i][j],locs[i][j]));
618 throw INTERP_KERNEL::Exception("MEDFileField1TSStruct : can be applied only on single spatial discretization fields ! Call SplitPerDiscretization method !");
621 MEDFileField1TSStructItem ret(atype,anItems);
622 ret.checkWithMeshStruct(meshSt,ref);
626 MEDMeshMultiLev *MEDFileField1TSStruct::buildFromScratchDataSetSupport(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception)
628 if(_already_checked.empty())
629 throw INTERP_KERNEL::Exception("MEDFileField1TSStruct::buildFromScratchDataSetSupport : No outline structure in this !");
630 int pos0(-1),pos1(-1);
631 if(presenceOfCellDiscr(pos0))
633 MEDCouplingAutoRefCountObjectPtr<MEDMeshMultiLev> ret(_already_checked[pos0].buildFromScratchDataSetSupportOnCells(mst,globs));
634 if(presenceOfPartialNodeDiscr(pos1))
635 ret->setNodeReduction(_already_checked[pos1][0].getPfl(globs));
640 if(!presenceOfPartialNodeDiscr(pos1))
641 {//we have only all nodes, no cell definition info -> level 0;
642 std::vector<int> levs(1,0);
643 return MEDMeshMultiLev::New(mst->getTheMesh(),levs);
646 return MEDMeshMultiLev::NewOnlyOnNode(mst->getTheMesh(),_already_checked[pos1][0].getPfl(globs));
650 bool MEDFileField1TSStruct::isDataSetSupportFastlyEqualTo(const MEDFileField1TSStruct& other, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception)
653 bool a0(presenceOfCellDiscr(b0)),a1(presenceOfPartialNodeDiscr(b1));
655 bool c0(other.presenceOfCellDiscr(d0)),c1(other.presenceOfPartialNodeDiscr(d1));
659 if(!_already_checked[b0].isCellSupportEqual(other._already_checked[d0],globs))
662 if(!_already_checked[b1].isNodeSupportEqual(other._already_checked[d1],globs))
668 * Returns true if presence in \a this of discretization ON_CELLS, ON_GAUSS_PT, ON_GAUSS_NE.
669 * If true is returned the pos of the easiest is returned. The easiest is the first element in \a this having the less splitted subparts.
671 bool MEDFileField1TSStruct::presenceOfCellDiscr(int& pos) const throw(INTERP_KERNEL::Exception)
673 std::size_t refSz(std::numeric_limits<std::size_t>::max());
676 for(std::vector<MEDFileField1TSStructItem>::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++,i++)
678 if((*it).getType()!=ON_NODES)
681 std::size_t sz((*it).getNumberOfItems());
687 throw INTERP_KERNEL::Exception("MEDFileField1TSStruct::presenceOfCellDiscr : an element in this on entity CELL is empty !");
692 * Returns true if presence in \a this of discretization ON_NODES.
693 * If true is returned the pos of the first element containing the single subpart.
695 bool MEDFileField1TSStruct::presenceOfPartialNodeDiscr(int& pos) const throw(INTERP_KERNEL::Exception)
698 for(std::vector<MEDFileField1TSStructItem>::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++,i++)
700 if((*it).getType()==ON_NODES)
702 std::size_t sz((*it).getNumberOfItems());
705 if(!(*it)[0].getPflName().empty())
706 { pos=i; return true; }
709 throw INTERP_KERNEL::Exception("MEDFileField1TSStruct::presenceOfPartialNodeDiscr : an element in this on entity NODE is split into several parts !");
717 MEDFileFastCellSupportComparator *MEDFileFastCellSupportComparator::New(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref) throw(INTERP_KERNEL::Exception)
719 return new MEDFileFastCellSupportComparator(m,ref);
722 MEDFileFastCellSupportComparator::MEDFileFastCellSupportComparator(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref)
725 throw INTERP_KERNEL::Exception("MEDFileFastCellSupportComparator constructor : null input mesh struct !");
726 _mesh_comp=const_cast<MEDFileMeshStruct *>(m); _mesh_comp->incrRef();
727 int nbPts=ref->getNumberOfTS();
728 _f1ts_cmps.resize(nbPts);
729 for(int i=0;i<nbPts;i++)
731 MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> elt=ref->getTimeStepAtPos(i);
732 _f1ts_cmps[i]=MEDFileField1TSStruct::New(elt,_mesh_comp);
733 _f1ts_cmps[i]->checkWithMeshStruct(_mesh_comp,elt);
737 std::size_t MEDFileFastCellSupportComparator::getHeapMemorySize() const
740 const MEDFileMeshStruct *mst(_mesh_comp);
742 ret+=mst->getHeapMemorySize();
743 for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSStruct> >::const_iterator it=_f1ts_cmps.begin();it!=_f1ts_cmps.end();it++)
745 const MEDFileField1TSStruct *cur(*it);
747 ret+=cur->getHeapMemorySize()+sizeof(MEDFileField1TSStruct);
749 ret+=_f1ts_cmps.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSStruct>);
753 bool MEDFileFastCellSupportComparator::isEqual(const MEDFileAnyTypeFieldMultiTS *other) throw(INTERP_KERNEL::Exception)
755 int nbPts=other->getNumberOfTS();
756 if(nbPts!=(int)_f1ts_cmps.size())
758 std::ostringstream oss; oss << "MEDFileFastCellSupportComparator::isEqual : unexpected nb of time steps in input ! Should be " << _f1ts_cmps.size() << " it is in reality " << nbPts << " !";
759 throw INTERP_KERNEL::Exception(oss.str().c_str());
761 for(int i=0;i<nbPts;i++)
763 MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> elt=other->getTimeStepAtPos(i);
764 if(!_f1ts_cmps[i]->isEqualConsideringThePast(elt,_mesh_comp))
765 if(!_f1ts_cmps[i]->isSupportSameAs(elt,_mesh_comp))
771 bool MEDFileFastCellSupportComparator::isCompatibleWithNodesDiscr(const MEDFileAnyTypeFieldMultiTS *other) throw(INTERP_KERNEL::Exception)
773 int nbPts=other->getNumberOfTS();
774 if(nbPts!=(int)_f1ts_cmps.size())
776 std::ostringstream oss; oss << "MEDFileFastCellSupportComparator::isCompatibleWithNodesDiscr : unexpected nb of time steps in input ! Should be " << _f1ts_cmps.size() << " it is in reality " << nbPts << " !";
777 throw INTERP_KERNEL::Exception(oss.str().c_str());
779 for(int i=0;i<nbPts;i++)
781 MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> elt=other->getTimeStepAtPos(i);
782 if(!_f1ts_cmps[i]->isCompatibleWithNodesDiscr(elt,_mesh_comp))
788 MEDMeshMultiLev *MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception)
790 if(timeStepId<0 || timeStepId>=(int)_f1ts_cmps.size())
792 std::ostringstream oss; oss << "MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport : requested time step id #" << timeStepId << " is not in [0," << _f1ts_cmps.size() << ") !";
793 throw INTERP_KERNEL::Exception(oss.str().c_str());
795 const MEDFileField1TSStruct *obj(_f1ts_cmps[timeStepId]);
798 std::ostringstream oss; oss << "MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport : at time step id #" << timeStepId << " no field structure overview defined !";
799 throw INTERP_KERNEL::Exception(oss.str().c_str());
801 return obj->buildFromScratchDataSetSupport(_mesh_comp,globs);
804 bool MEDFileFastCellSupportComparator::isDataSetSupportEqualToThePreviousOne(int timeStepId, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception)
806 if(timeStepId<=0 || timeStepId>=(int)_f1ts_cmps.size())
808 std::ostringstream oss; oss << "MEDFileFastCellSupportComparator::isDataSetSupportEqualToThePreviousOne : requested time step id #" << timeStepId << " is not in [1," << _f1ts_cmps.size() << ") !";
809 throw INTERP_KERNEL::Exception(oss.str().c_str());
811 const MEDFileField1TSStruct *obj(_f1ts_cmps[timeStepId]);
812 const MEDFileField1TSStruct *objRef(_f1ts_cmps[timeStepId-1]);
813 return objRef->isDataSetSupportFastlyEqualTo(*obj,globs);
818 std::size_t MEDMeshMultiLev::getHeapMemorySize() const
823 MEDMeshMultiLev *MEDMeshMultiLev::New(const MEDFileMesh *m, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception)
826 throw INTERP_KERNEL::Exception("MEDMeshMultiLev::New : null input pointer !");
827 const MEDFileUMesh *um(dynamic_cast<const MEDFileUMesh *>(m));
829 return MEDUMeshMultiLev::New(um,levs);
830 const MEDFileCMesh *cm(dynamic_cast<const MEDFileCMesh *>(m));
832 return MEDCMeshMultiLev::New(cm,levs);
833 const MEDFileCurveLinearMesh *clm(dynamic_cast<const MEDFileCurveLinearMesh *>(m));
835 return MEDCurveLinearMeshMultiLev::New(clm,levs);
836 throw INTERP_KERNEL::Exception("MEDMeshMultiLev::New : unrecognized type of mesh ! Must be in [MEDFileUMesh,MEDFileCMesh,MEDFileCurveLinearMesh] !");
839 MEDMeshMultiLev *MEDMeshMultiLev::New(const MEDFileMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities) throw(INTERP_KERNEL::Exception)
842 throw INTERP_KERNEL::Exception("MEDMeshMultiLev::New 2 : null input pointer !");
843 const MEDFileUMesh *um(dynamic_cast<const MEDFileUMesh *>(m));
845 return MEDUMeshMultiLev::New(um,gts,pfls,nbEntities);
846 const MEDFileCMesh *cm(dynamic_cast<const MEDFileCMesh *>(m));
848 return MEDCMeshMultiLev::New(cm,gts,pfls,nbEntities);
849 const MEDFileCurveLinearMesh *clm(dynamic_cast<const MEDFileCurveLinearMesh *>(m));
851 return MEDCurveLinearMeshMultiLev::New(clm,gts,pfls,nbEntities);
852 throw INTERP_KERNEL::Exception("MEDMeshMultiLev::New 2 : unrecognized type of mesh ! Must be in [MEDFileUMesh,MEDFileCMesh,MEDFileCurveLinearMesh] !");
855 MEDMeshMultiLev *MEDMeshMultiLev::NewOnlyOnNode(const MEDFileMesh *m, const DataArrayInt *pflOnNode) throw(INTERP_KERNEL::Exception)
857 std::vector<int> levs(1,0);
858 MEDCouplingAutoRefCountObjectPtr<MEDMeshMultiLev> ret(MEDMeshMultiLev::New(m,levs));
859 ret->selectPartOfNodes(pflOnNode);
863 void MEDMeshMultiLev::setNodeReduction(const DataArrayInt *nr)
867 _node_reduction=const_cast<DataArrayInt*>(nr);
870 MEDMeshMultiLev::MEDMeshMultiLev()
874 MEDMeshMultiLev::MEDMeshMultiLev(const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):_geo_types(gts),_nb_entities(nbEntities)
876 std::size_t sz(_geo_types.size());
877 if(sz!=pfls.size() || sz!=nbEntities.size())
878 throw INTERP_KERNEL::Exception("MEDMeshMultiLev::MEDMeshMultiLev : input vector must have the same size !");
880 for(std::size_t i=0;i<sz;i++)
884 _pfls[i]=const_cast<DataArrayInt *>(pfls[i]);
888 MEDUMeshMultiLev *MEDUMeshMultiLev::New(const MEDFileUMesh *m, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception)
890 return new MEDUMeshMultiLev(m,levs);
893 MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<int>& levs)
896 throw INTERP_KERNEL::Exception("MEDUMeshMultiLev constructor : null input pointer !");
897 std::vector<MEDCoupling1GTUMesh *> v;
898 for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
900 std::vector<MEDCoupling1GTUMesh *> vTmp(m->getDirectUndergroundSingleGeoTypeMeshes(*it));
901 v.insert(v.end(),vTmp.begin(),vTmp.end());
903 std::size_t sz(v.size());
906 _geo_types.resize(sz);
907 for(std::size_t i=0;i<sz;i++)
909 MEDCoupling1GTUMesh *obj(v[i]);
913 throw INTERP_KERNEL::Exception("MEDUMeshMultiLev constructor : presence of a null pointer !");
915 _geo_types[i]=obj->getCellModelEnum();
919 MEDUMeshMultiLev *MEDUMeshMultiLev::New(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities) throw(INTERP_KERNEL::Exception)
921 return new MEDUMeshMultiLev(m,gts,pfls,nbEntities);
924 MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDMeshMultiLev(gts,pfls,nbEntities)
926 std::size_t sz(gts.size());
928 for(std::size_t i=0;i<sz;i++)
930 MEDCoupling1GTUMesh *elt(m->getDirectUndergroundSingleGeoTypeMesh(gts[i]));
937 void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes) throw(INTERP_KERNEL::Exception)
939 if(!pflNodes || !pflNodes->isAllocated())
941 /*std::vector<int> ngs(getNodeGridStructure());
942 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(MEDCouplingStructuredMesh::Build1GTNodalConnectivity(&ngs[0],&ngs[0]+ngs.size()));
943 MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> m(MEDCoupling1SGTUMesh::New("",GMEDCouplingStructuredMesh::etGeoTypeGivenMeshDimension(ngs.size())));
944 m->setNodalConnectivity(conn);
945 DataArrayInt *cellIds=0;
946 m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds);
947 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIdsSafe(cellIds);
948 MEDCouplingAutoRefCountObjectPtr<MEDCouplingPointSet> m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end()));
950 _node_reduction=m2->getNodeIdsInUse(tmp);*/
953 MEDCMeshMultiLev *MEDCMeshMultiLev::New(const MEDFileCMesh *m, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception)
955 return new MEDCMeshMultiLev(m,levs);
958 MEDCMeshMultiLev *MEDCMeshMultiLev::New(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities) throw(INTERP_KERNEL::Exception)
960 return new MEDCMeshMultiLev(m,gts,pfls,nbEntities);
963 MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<int>& levs)
966 throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor : null input pointer !");
967 if(levs.size()!=1 || levs[0]!=0)
968 throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor : levels supported is 0 only !");
969 int mdim(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(m->getMeshDimension()));
970 _coords.resize(mdim);
971 for(int i=0;i<mdim;i++)
973 DataArrayDouble *elt(const_cast<DataArrayDouble *>(m->getMesh()->getCoordsAt(i)));
975 throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : presence of null pointer for an vector of double along an axis !");
980 MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDStructuredMeshMultiLev(gts,pfls,nbEntities)
983 throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : null input pointer !");
984 if(gts.size()!=1 || pfls.size()!=1)
985 throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : lengthes of gts and pfls must be equal to one !");
986 int mdim(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(m->getMeshDimension()));
988 throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : the unique geo type is invalid regarding meshdim !");
989 _coords.resize(mdim);
990 for(int i=0;i<mdim;i++)
992 DataArrayDouble *elt(const_cast<DataArrayDouble *>(m->getMesh()->getCoordsAt(i)));
994 throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : presence of null pointer for an vector of double along an axis !");
999 std::vector<int> MEDCMeshMultiLev::getNodeGridStructure() const throw(INTERP_KERNEL::Exception)
1001 std::vector<int> ret(_coords.size());
1002 for(std::size_t i=0;i<_coords.size();i++)
1003 ret[i]=_coords[i]->getNumberOfTuples();
1009 MEDCurveLinearMeshMultiLev *MEDCurveLinearMeshMultiLev::New(const MEDFileCurveLinearMesh *m, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception)
1011 return new MEDCurveLinearMeshMultiLev(m,levs);
1014 MEDCurveLinearMeshMultiLev *MEDCurveLinearMeshMultiLev::New(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities) throw(INTERP_KERNEL::Exception)
1016 return new MEDCurveLinearMeshMultiLev(m,gts,pfls,nbEntities);
1019 MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<int>& levs)
1022 throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor : null input pointer !");
1023 if(levs.size()!=1 || levs[0]!=0)
1024 throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor : levels supported is 0 only !");
1025 DataArrayDouble *coords(const_cast<DataArrayDouble *>(m->getMesh()->getCoords()));
1027 throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : no coords set !");
1030 _structure=m->getMesh()->getNodeGridStructure();
1033 MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDStructuredMeshMultiLev(gts,pfls,nbEntities)
1036 throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : null input pointer !");
1037 if(gts.size()!=1 || pfls.size()!=1)
1038 throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : lengthes of gts and pfls must be equal to one !");
1039 int mdim(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(m->getMeshDimension()));
1041 throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : the unique geo type is invalid regarding meshdim !");
1042 DataArrayDouble *coords(const_cast<DataArrayDouble *>(m->getMesh()->getCoords()));
1044 throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : no coords set !");
1047 _structure=m->getMesh()->getNodeGridStructure();
1050 std::vector<int> MEDCurveLinearMeshMultiLev::getNodeGridStructure() const throw(INTERP_KERNEL::Exception)
1057 MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev()
1061 MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDMeshMultiLev(gts,pfls,nbEntities)
1065 void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes) throw(INTERP_KERNEL::Exception)
1067 if(!pflNodes || !pflNodes->isAllocated())
1069 std::vector<int> ngs(getNodeGridStructure());
1070 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(MEDCouplingStructuredMesh::Build1GTNodalConnectivity(&ngs[0],&ngs[0]+ngs.size()));
1071 MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> m(MEDCoupling1SGTUMesh::New("",MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(ngs.size())));
1072 m->setNodalConnectivity(conn);
1073 DataArrayInt *cellIds=0;
1074 m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds);
1075 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIdsSafe(cellIds);
1076 MEDCouplingAutoRefCountObjectPtr<MEDCouplingPointSet> m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end()));
1078 _node_reduction=m2->getNodeIdsInUse(tmp);