1 // Copyright (C) 2007-2021 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 (EDF R&D)
21 #include "MEDFileEquivalence.hxx"
22 #include "MEDFileSafeCaller.txx"
23 #include "MEDCouplingMemArray.hxx"
24 #include "MEDCouplingMemArray.txx"
25 #include "MEDLoaderBase.hxx"
26 #include "MEDFileMesh.hxx"
27 #include "InterpKernelAutoPtr.hxx"
29 // From MEDLOader.cxx TU
30 extern med_geometry_type typmai[MED_N_CELL_FIXED_GEO];
31 extern INTERP_KERNEL::NormalizedCellType typmai2[MED_N_CELL_FIXED_GEO];
32 extern med_geometry_type typmai3[INTERP_KERNEL::NORM_MAXTYPE];
33 extern med_geometry_type typmainoeud[1];
35 using namespace MEDCoupling;
37 MEDFileEquivalencePair *MEDFileEquivalencePair::Load(MEDFileEquivalences *father, med_idt fid, const std::string& name, const std::string &desc)
40 throw INTERP_KERNEL::Exception("MEDFileEquivalencePair::Load : father is NULL ! Should not !");
41 MCAuto<MEDFileEquivalencePair> ret(new MEDFileEquivalencePair(father,name,desc));
46 void MEDFileEquivalencePair::writeLL(med_idt fid) const
48 std::string meshName(getFather()->getMeshName());
49 INTERP_KERNEL::AutoPtr<char> meshName2(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
50 INTERP_KERNEL::AutoPtr<char> name(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
51 INTERP_KERNEL::AutoPtr<char> desc(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
52 MEDLoaderBase::safeStrCpy(meshName.c_str(),MED_NAME_SIZE,meshName2,getFather()->getMesh()->getTooLongStrPolicy());
53 MEDLoaderBase::safeStrCpy(_name.c_str(),MED_NAME_SIZE,name,getFather()->getMesh()->getTooLongStrPolicy());
54 MEDLoaderBase::safeStrCpy(_description.c_str(),MED_COMMENT_SIZE,desc,getFather()->getMesh()->getTooLongStrPolicy());
55 MEDFILESAFECALLERWR0(MEDequivalenceCr,(fid,meshName2,name,desc));
56 const MEDFileEquivalenceCell *cell(_cell);
59 const MEDFileEquivalenceNode *node(_node);
64 const MEDFileMesh *MEDFileEquivalencePair::getMesh() const
66 return getFather()->getMesh();
69 MEDFileMesh *MEDFileEquivalencePair::getMesh()
71 return getFather()->getMesh();
74 MEDFileEquivalencePair *MEDFileEquivalencePair::deepCopy(MEDFileEquivalences *father) const
76 MCAuto<MEDFileEquivalencePair> ret(new MEDFileEquivalencePair(father,_name,_description));
77 const MEDFileEquivalenceCell *cell(_cell);
79 ret->_cell=cell->deepCopy(const_cast<MEDFileEquivalencePair *>(this));
80 const MEDFileEquivalenceNode *node(_node);
82 ret->_node=node->deepCopy(const_cast<MEDFileEquivalencePair *>(this));
86 bool MEDFileEquivalencePair::isEqual(const MEDFileEquivalencePair *other, std::string& what) const
88 if(_name!=other->_name)
90 std::ostringstream oss; oss << "Names differs : " << _name << " != " << other->_name << " !";
94 if(_description!=other->_description)
96 std::ostringstream oss; oss << "Description differs : " << _description << " != " << other->_description << " !";
100 const MEDFileEquivalenceCell *c1(_cell),*c2(other->_cell);
101 if((c1 && !c2) || (!c1 && c2))
103 std::ostringstream oss; oss << "Cell def of Equiv " << _name << " are defined for this and not for other (or reversely) !";
108 if(!c1->isEqual(c2,what))
110 const MEDFileEquivalenceNode *n1(_node),*n2(other->_node);
111 if((n1 && !n2) || (!n1 && n2))
113 std::ostringstream oss; oss << "Node def of Equiv " << _name << " are defined for this and not for other (or reversely) !";
118 if(!n1->isEqual(n2,what))
123 void MEDFileEquivalencePair::getRepr(std::ostream& oss) const
125 const MEDFileEquivalenceNode *node(_node);
126 const MEDFileEquivalenceCell *cell(_cell);
127 oss << std::endl << " name of equivalence : " << _name << std::endl;
128 oss << " description of equivalence : " << _description << std::endl;
131 oss << "None" << std::endl;
136 oss << "None" << std::endl;
141 MEDFileEquivalencePair *MEDFileEquivalencePair::New(MEDFileEquivalences *father, const std::string& name)
143 return new MEDFileEquivalencePair(father,name,std::string());
146 std::vector<const BigMemoryObject *> MEDFileEquivalencePair::getDirectChildrenWithNull() const
148 std::vector<const BigMemoryObject *> ret(2);
149 ret[0]=_cell; ret[1]=_node;
153 void MEDFileEquivalencePair::setArray(int meshDimRelToMaxExt, DataArrayInt *da)
155 if(meshDimRelToMaxExt>1)
156 throw INTERP_KERNEL::Exception("MEDFileEquivalencePair::setArray : meshDimRelToMaxExt must be in [1,0,-1,-2,-3] at most !");
157 if(meshDimRelToMaxExt==1)
159 MEDFileEquivalenceNode *node(_node);
162 _node=new MEDFileEquivalenceNode(this,0);
169 MEDFileEquivalenceCell *cell(_cell);
172 _cell=new MEDFileEquivalenceCell(this);
175 cell->setArray(meshDimRelToMaxExt,da);
180 * The returned pointer is a borrowed pointer.
182 MEDFileEquivalenceCell *MEDFileEquivalencePair::initCell()
184 _cell=new MEDFileEquivalenceCell(this);
189 * The returned pointer is a borrowed pointer.
191 MEDFileEquivalenceNode *MEDFileEquivalencePair::initNode()
193 _node=new MEDFileEquivalenceNode(this,0);
197 std::size_t MEDFileEquivalencePair::getHeapMemorySizeWithoutChildren() const
202 void MEDFileEquivalencePair::load(med_idt fid)
204 std::string meshName(_father->getMeshName());
206 _father->getDtIt(dt,it);
208 MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceSize,(fid,meshName.c_str(),_name.c_str(),dt,it,MED_NODE,MED_NONE,&ncor));
211 MCAuto<DataArrayMedInt> da(DataArrayMedInt::New());
213 MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceRd,(fid,meshName.c_str(),_name.c_str(),dt,it,MED_NODE,MED_NONE,da->getPointer()));
216 MCAuto<MEDFileEquivalenceNode> node(new MEDFileEquivalenceNode(this,FromMedIntArray<int>(da)));
219 _cell=MEDFileEquivalenceCell::Load(fid,this);
222 std::vector<const BigMemoryObject *> MEDFileEquivalences::getDirectChildrenWithNull() const
224 std::size_t sz(_equ.size());
225 std::vector<const BigMemoryObject *> ret(sz);
226 for(std::size_t i=0;i<sz;i++)
231 std::size_t MEDFileEquivalences::getHeapMemorySizeWithoutChildren() const
233 return sizeof(MEDFileEquivalences)+_equ.capacity()*sizeof(MEDFileEquivalencePair);
236 void MEDFileEquivalences::getDtIt(int &dt, int &it) const
238 dt=_owner->getIteration(); it=_owner->getOrder();
241 std::string MEDFileEquivalences::getMeshName() const
243 return _owner->getName();
246 void MEDFileEquivalences::pushEquivalence(MEDFileEquivalencePair *elt)
248 MCAuto<MEDFileEquivalencePair> elta(elt);
251 _equ.push_back(elta);
254 MEDFileEquivalencePair *MEDFileEquivalences::getEquivalence(int i)
259 std::ostringstream oss; oss << "MEDFileEquivalences::getEquivalence : invalid id ! Must be in [0," << sz << ") !";
260 throw INTERP_KERNEL::Exception(oss.str().c_str());
265 MEDFileEquivalencePair *MEDFileEquivalences::getEquivalenceWithName(const std::string& name)
267 for(std::vector< MCAuto<MEDFileEquivalencePair> >::iterator it=_equ.begin();it!=_equ.end();it++)
269 MEDFileEquivalencePair *elt(*it);
272 if(elt->getName()==name)
276 std::ostringstream oss; oss << "MEDFileEquivalences::getEquivalenceWithName : no equivalence with name \"" << name << "\" ! Must be in [ ";
277 std::vector<std::string> eqs(getEquivalenceNames());
278 std::copy(eqs.begin(),eqs.end(),std::ostream_iterator<std::string>(oss,", "));
280 throw INTERP_KERNEL::Exception(oss.str().c_str());
283 int MEDFileEquivalences::size() const
285 return (int)_equ.size();
288 std::vector<std::string> MEDFileEquivalences::getEquivalenceNames() const
290 std::vector<std::string> ret;
291 for(std::vector< MCAuto<MEDFileEquivalencePair> >::const_iterator it=_equ.begin();it!=_equ.end();it++)
293 const MEDFileEquivalencePair *elt(*it);
296 ret.push_back(elt->getName());
302 MEDFileEquivalencePair *MEDFileEquivalences::appendEmptyEquivalenceWithName(const std::string& name)
304 MCAuto<MEDFileEquivalencePair> elt(MEDFileEquivalencePair::New(this,name));
309 MEDFileEquivalences *MEDFileEquivalences::deepCopy(MEDFileMesh *owner) const
311 MCAuto<MEDFileEquivalences> ret(new MEDFileEquivalences(owner));
312 ret->deepCpyFrom(*this);
316 bool MEDFileEquivalences::isEqual(const MEDFileEquivalences *other, std::string& what) const
318 std::size_t sz(_equ.size());
319 if(sz!=other->_equ.size())
321 what="Equivalences differs : not same number !";
324 for(std::size_t i=0;i<sz;i++)
326 const MEDFileEquivalencePair *thisp(_equ[i]),*otherp(other->_equ[i]);
327 if(!thisp && !otherp)
331 if(!thisp->isEqual(otherp,what))
333 std::ostringstream oss; oss << "At Eq #" << i << " there is a difference !";
340 std::ostringstream oss; oss << "At Eq #" << i << " defined in this not is other (or reversely) !";
348 void MEDFileEquivalences::getRepr(std::ostream& oss) const
351 for(std::vector< MCAuto<MEDFileEquivalencePair> >::const_iterator it=_equ.begin();it!=_equ.end();it++,ii++)
353 const MEDFileEquivalencePair *elt(*it);
354 oss << "Equivalence #" << ii << " : " ;
358 oss << "None" << std::endl;
362 void MEDFileEquivalences::killEquivalenceWithName(const std::string& name)
364 std::vector< MCAuto<MEDFileEquivalencePair> >::iterator it(_equ.begin());
365 for(;it!=_equ.end();it++)
367 const MEDFileEquivalencePair *elt(*it);
368 if(elt && elt->getName()==name)
373 std::ostringstream oss; oss << "MEDFileEquivalences::killEquivalenceWithName : Equivalence with name \"" << name << "\" not found !";
374 throw INTERP_KERNEL::Exception(oss.str().c_str());
379 void MEDFileEquivalences::killEquivalenceAt(int i)
384 std::ostringstream oss; oss << "MEDFileEquivalences::killEquivalenceAt : Id must be in [0," << sz << ") !";
385 throw INTERP_KERNEL::Exception(oss.str().c_str());
387 std::vector< MCAuto<MEDFileEquivalencePair> >::iterator it(_equ.begin());
388 for(int j=0;j<i;it++,j++);
392 void MEDFileEquivalences::clear()
397 void MEDFileEquivalences::writeLL(med_idt fid) const
399 for(std::vector< MCAuto<MEDFileEquivalencePair> >::const_iterator it=_equ.begin();it!=_equ.end();it++)
401 const MEDFileEquivalencePair *elt(*it);
407 int MEDFileEquivalences::PresenceOfEquivalences(med_idt fid, const std::string& meshName)
409 med_int nequ(MEDnEquivalence(fid,meshName.c_str()));
410 return FromMedInt<int>(nequ);
413 MEDFileEquivalences *MEDFileEquivalences::Load(med_idt fid, int nbOfEq, MEDFileMesh *owner)
415 MCAuto<MEDFileEquivalences> ret(new MEDFileEquivalences(owner));
417 throw INTERP_KERNEL::Exception("MEDFileEquivalences::Load : owner is NULL !");
418 std::string meshName(owner->getName());
419 for(int i=0;i<nbOfEq;i++)
421 INTERP_KERNEL::AutoPtr<char> equ(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
422 INTERP_KERNEL::AutoPtr<char> desc(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
423 med_int nstep,nocstpncor;
424 MEDFILESAFECALLERRD0(MEDequivalenceInfo,(fid,meshName.c_str(),i+1,equ,desc,&nstep,&nocstpncor));
425 std::string eqName(MEDLoaderBase::buildStringFromFortran(equ,MED_NAME_SIZE)),eqDescName(MEDLoaderBase::buildStringFromFortran(desc,MED_COMMENT_SIZE));
426 MCAuto<MEDFileEquivalencePair> eqv(MEDFileEquivalencePair::Load(ret,fid,eqName,eqDescName));
427 ret->pushEquivalence(eqv);
432 void MEDFileEquivalences::CheckDataArray(const DataArrayInt *data)
436 data->checkAllocated();
437 if(data->getNumberOfComponents()!=2)
439 std::ostringstream oss; oss << "MEDFileEquivalences::CheckDataArray : Input DataArray must have 2 components !";
440 throw INTERP_KERNEL::Exception(oss.str().c_str());
444 void MEDFileEquivalences::deepCpyFrom(const MEDFileEquivalences& other)
446 for(std::vector< MCAuto<MEDFileEquivalencePair> >::const_iterator it=other._equ.begin();it!=other._equ.end();it++)
448 const MEDFileEquivalencePair *elt(*it);
449 MCAuto<MEDFileEquivalencePair> eltCpy;
452 eltCpy=elt->deepCopy(this);
454 _equ.push_back(eltCpy);
458 MEDFileEquivalenceBase::MEDFileEquivalenceBase(MEDFileEquivalencePair *father):_father(father)
462 MEDFileEquivalenceData::MEDFileEquivalenceData(MEDFileEquivalencePair *owner, DataArrayInt *data):MEDFileEquivalenceBase(owner),_data(data)
468 void MEDFileEquivalenceData::setArray(DataArrayInt *data)
470 MEDFileEquivalences::CheckDataArray(data);
476 std::vector<const BigMemoryObject *> MEDFileEquivalenceData::getDirectChildrenWithNull() const
478 std::vector<const BigMemoryObject *> ret(1);
483 bool MEDFileEquivalenceData::isEqual(const MEDFileEquivalenceData *other, std::string& what) const
485 const DataArrayInt *d1(_data),*d2(other->_data);
486 if((!d1 && d2) || (d1 && !d2))
488 what="Data array is defined in this not in other (or reversely) !";
493 if(!d1->isEqualIfNotWhy(*d2,what))
499 void MEDFileEquivalenceData::writeAdvanced(med_idt fid, med_entity_type medtype, med_geometry_type medgt) const
502 const DataArrayInt *da(getArray());
505 MEDFileEquivalences::CheckDataArray(da);
506 const MEDFileMesh *mesh(getFather()->getMesh());
508 mesh->getTime(dt,it);
509 std::string meshName(mesh->getName());
510 std::string equName(getFather()->getName());
511 INTERP_KERNEL::AutoPtr<char> meshName2(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
512 INTERP_KERNEL::AutoPtr<char> name(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
513 MEDLoaderBase::safeStrCpy(meshName.c_str(),MED_NAME_SIZE,meshName2,getFather()->getMesh()->getTooLongStrPolicy());
514 MEDLoaderBase::safeStrCpy(equName.c_str(),MED_NAME_SIZE,name,getFather()->getMesh()->getTooLongStrPolicy());
515 MCAuto<DataArrayMedInt> da2(DataArrayMedInt_Copy(da)); da2->rearrange(1); da2->applyLin(1,1); da2->rearrange(2);
516 MEDFILESAFECALLERWR0(MEDequivalenceCorrespondenceWr,(fid,meshName2,name,dt,it,medtype,medgt,ToMedInt(da2->getNumberOfTuples()),da2->begin()));
519 std::size_t MEDFileEquivalenceCellType::getHeapMemorySizeWithoutChildren() const
521 return sizeof(MEDFileEquivalenceCellType);
524 MEDFileEquivalenceCellType *MEDFileEquivalenceCellType::deepCopy(MEDFileEquivalencePair *owner) const
526 MCAuto<DataArrayInt> da;
528 da=getArray()->deepCopy();
529 return new MEDFileEquivalenceCellType(owner,_type,da);
532 bool MEDFileEquivalenceCellType::isEqual(const MEDFileEquivalenceCellType *other, std::string& what) const
534 if(_type!=other->_type)
536 what="Geo types differs !";
539 return MEDFileEquivalenceData::isEqual(other,what);
542 void MEDFileEquivalenceCellType::getRepr(std::ostream& oss) const
544 const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(_type));
545 const DataArrayInt *da(getArray());
546 oss << cm.getRepr() << ":";
548 oss << da->getNumberOfTuples() << " tuples";
550 oss << "no dataarray";
554 void MEDFileEquivalenceCellType::writeLL(med_idt fid) const
556 writeAdvanced(fid,MED_CELL,typmai3[_type]);
559 std::vector<const BigMemoryObject *> MEDFileEquivalenceCell::getDirectChildrenWithNull() const
561 std::size_t sz(_types.size());
562 std::vector<const BigMemoryObject *> ret(sz);
563 for(std::size_t i=0;i<sz;i++)
568 std::size_t MEDFileEquivalenceCell::getHeapMemorySizeWithoutChildren() const
570 return sizeof(MEDFileEquivalenceCell)+_types.capacity()*sizeof(MEDFileEquivalenceCellType);
573 MEDFileEquivalenceCell *MEDFileEquivalenceCell::Load(med_idt fid, MEDFileEquivalencePair *owner)
575 MCAuto<MEDFileEquivalenceCell> ret(new MEDFileEquivalenceCell(owner));
583 void MEDFileEquivalenceCell::writeLL(med_idt fid) const
585 for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
587 const MEDFileEquivalenceCellType *ct(*it);
593 MEDFileEquivalenceCell *MEDFileEquivalenceCell::deepCopy(MEDFileEquivalencePair *owner) const
595 MCAuto<MEDFileEquivalenceCell> ret(new MEDFileEquivalenceCell(owner));
596 for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
598 const MEDFileEquivalenceCellType *elt(*it);
599 MCAuto<MEDFileEquivalenceCellType> eltCpy;
601 eltCpy=elt->deepCopy(owner);
602 ret->_types.push_back(eltCpy);
607 bool MEDFileEquivalenceCell::isEqual(const MEDFileEquivalenceCell *other, std::string& what) const
609 std::size_t sz(_types.size());
610 if(sz!=other->_types.size())
612 std::ostringstream oss; oss << "Nb of geo types differs : " << sz << " != " << other->_types.size();
616 for(std::size_t i=0;i<sz;i++)
618 const MEDFileEquivalenceCellType *ct1(_types[i]),*ct2(other->_types[i]);
619 if((ct1 && !ct2) || (!ct1 && ct2))
621 std::ostringstream oss; oss << "At gt #" << i << " this is defined not other (or reversely !)";
627 if(!ct1->isEqual(ct2,what))
629 std::ostringstream oss; oss << "At gt #" << i << " of Eq " << getFather()->getName() << " it differs !";
638 void MEDFileEquivalenceCell::getRepr(std::ostream& oss) const
640 for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
642 const MEDFileEquivalenceCellType *elt(*it);
648 DataArrayInt *MEDFileEquivalenceCell::getArray(INTERP_KERNEL::NormalizedCellType type)
650 for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::iterator it=_types.begin();it!=_types.end();it++)
652 MEDFileEquivalenceCellType *elt(*it);
653 if(elt && elt->getType()==type)
654 return elt->getArray();
656 std::ostringstream oss; oss << "MEDFileEquivalenceCell::getArray : In Equivalence \"" << getFather()->getName() << "\" the geotype " << type << " is not available !";
657 throw INTERP_KERNEL::Exception(oss.str().c_str());
660 void MEDFileEquivalenceCell::setArray(int meshDimRelToMax, DataArrayInt *da)
664 MEDFileEquivalences::CheckDataArray(da);
665 MEDFileMesh *mm(getMesh());
666 mcIdType totalNbOfCells(mm->getNumberOfCellsAtLevel(meshDimRelToMax));
668 MCAuto<DataArrayInt> tmp(da->deepCopy()); tmp->rearrange(1);
670 tmp->getMinMaxValues(minv,maxv);
671 if((minv<0 || minv>=totalNbOfCells) || (maxv<0 || maxv>=totalNbOfCells))
673 std::ostringstream oss; oss << "MEDFileEquivalenceCell::setArray : Input 2 component DataArray has incorrect values ! all values must be in [0," << totalNbOfCells << ") !";
674 throw INTERP_KERNEL::Exception(oss.str().c_str());
677 std::vector<INTERP_KERNEL::NormalizedCellType> gts(mm->getGeoTypesAtLevel(meshDimRelToMax));
678 int startId(0),endId;
679 std::vector<std::size_t> compS(1,0);
680 for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator it=gts.begin();it!=gts.end();it++)
682 endId=startId+(int)mm->getNumberOfCellsWithType(*it);
683 MCAuto<DataArrayInt> da0(da->keepSelectedComponents(compS));
684 MCAuto<DataArrayIdType> ids(da0->findIdsInRange(startId,endId));
685 MCAuto<DataArrayInt> da1(da->selectByTupleIdSafe(ids->begin(),ids->end()));
686 da1->applyLin(1,-startId);
687 setArrayForType(*it,da1);
692 void MEDFileEquivalenceCell::setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da)
694 for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::iterator it=_types.begin();it!=_types.end();it++)
696 MEDFileEquivalenceCellType *elt(*it);
697 if(elt && elt->getType()==type)
703 MCAuto<MEDFileEquivalenceCellType> newElt(new MEDFileEquivalenceCellType(getFather(),type,da));
704 _types.push_back(newElt);
707 std::vector<INTERP_KERNEL::NormalizedCellType> MEDFileEquivalenceCell::getTypes() const
709 std::vector<INTERP_KERNEL::NormalizedCellType> ret;
710 for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
712 const MEDFileEquivalenceCellType *elt(*it);
714 ret.push_back(elt->getType());
719 void MEDFileEquivalenceCell::load(med_idt fid)
721 std::string meshName(getFather()->getFather()->getMeshName()),name(getName());
723 getFather()->getFather()->getDtIt(dt,it);
724 for(int i=0;i<MED_N_CELL_FIXED_GEO;i++)
727 MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceSize,(fid,meshName.c_str(),name.c_str(),dt,it,MED_CELL,typmai[i],&ncor));
730 MCAuto<DataArrayMedInt> da(DataArrayMedInt::New());
732 MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceRd,(fid,meshName.c_str(),name.c_str(),dt,it,MED_CELL,typmai[i],da->getPointer()));
735 MCAuto<MEDFileEquivalenceCellType> ct(new MEDFileEquivalenceCellType(getFather(),typmai2[i],FromMedIntArray<int>(da)));
736 _types.push_back(ct);
741 std::size_t MEDFileEquivalenceNode::getHeapMemorySizeWithoutChildren() const
743 return sizeof(MEDFileEquivalenceNode);
746 void MEDFileEquivalenceNode::writeLL(med_idt fid) const
748 writeAdvanced(fid,MED_NODE,MED_NONE);
751 MEDFileEquivalenceNode *MEDFileEquivalenceNode::deepCopy(MEDFileEquivalencePair *owner) const
753 MCAuto<DataArrayInt> da;
755 da=getArray()->deepCopy();
756 MCAuto<MEDFileEquivalenceNode> ret(new MEDFileEquivalenceNode(owner,da));
760 bool MEDFileEquivalenceNode::isEqual(const MEDFileEquivalenceNode *other, std::string& what) const
762 return MEDFileEquivalenceData::isEqual(other,what);
765 void MEDFileEquivalenceNode::getRepr(std::ostream& oss) const
767 const DataArrayInt *da(getArray());
769 oss << " No dataarray defined !" << std::endl;
771 oss << da->getNumberOfTuples() << " tuples in node equivalence." << std::endl;