1 // Copyright (C) 2007-2019 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 extern med_geometry_type typmai[MED_N_CELL_FIXED_GEO];
30 extern INTERP_KERNEL::NormalizedCellType typmai2[MED_N_CELL_FIXED_GEO];
31 extern med_geometry_type typmai3[34];
32 extern med_geometry_type typmainoeud[1];
34 using namespace MEDCoupling;
36 MEDFileEquivalencePair *MEDFileEquivalencePair::Load(MEDFileEquivalences *father, med_idt fid, const std::string& name, const std::string &desc)
39 throw INTERP_KERNEL::Exception("MEDFileEquivalencePair::Load : father is NULL ! Should not !");
40 MCAuto<MEDFileEquivalencePair> ret(new MEDFileEquivalencePair(father,name,desc));
45 void MEDFileEquivalencePair::writeLL(med_idt fid) const
47 std::string meshName(getFather()->getMeshName());
48 INTERP_KERNEL::AutoPtr<char> meshName2(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
49 INTERP_KERNEL::AutoPtr<char> name(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
50 INTERP_KERNEL::AutoPtr<char> desc(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
51 MEDLoaderBase::safeStrCpy(meshName.c_str(),MED_NAME_SIZE,meshName2,getFather()->getMesh()->getTooLongStrPolicy());
52 MEDLoaderBase::safeStrCpy(_name.c_str(),MED_NAME_SIZE,name,getFather()->getMesh()->getTooLongStrPolicy());
53 MEDLoaderBase::safeStrCpy(_description.c_str(),MED_COMMENT_SIZE,desc,getFather()->getMesh()->getTooLongStrPolicy());
54 MEDFILESAFECALLERWR0(MEDequivalenceCr,(fid,meshName2,name,desc));
55 const MEDFileEquivalenceCell *cell(_cell);
58 const MEDFileEquivalenceNode *node(_node);
63 const MEDFileMesh *MEDFileEquivalencePair::getMesh() const
65 return getFather()->getMesh();
68 MEDFileMesh *MEDFileEquivalencePair::getMesh()
70 return getFather()->getMesh();
73 MEDFileEquivalencePair *MEDFileEquivalencePair::deepCopy(MEDFileEquivalences *father) const
75 MCAuto<MEDFileEquivalencePair> ret(new MEDFileEquivalencePair(father,_name,_description));
76 const MEDFileEquivalenceCell *cell(_cell);
78 ret->_cell=cell->deepCopy(const_cast<MEDFileEquivalencePair *>(this));
79 const MEDFileEquivalenceNode *node(_node);
81 ret->_node=node->deepCopy(const_cast<MEDFileEquivalencePair *>(this));
85 bool MEDFileEquivalencePair::isEqual(const MEDFileEquivalencePair *other, std::string& what) const
87 if(_name!=other->_name)
89 std::ostringstream oss; oss << "Names differs : " << _name << " != " << other->_name << " !";
93 if(_description!=other->_description)
95 std::ostringstream oss; oss << "Description differs : " << _description << " != " << other->_description << " !";
99 const MEDFileEquivalenceCell *c1(_cell),*c2(other->_cell);
100 if((c1 && !c2) || (!c1 && c2))
102 std::ostringstream oss; oss << "Cell def of Equiv " << _name << " are defined for this and not for other (or reversely) !";
107 if(!c1->isEqual(c2,what))
109 const MEDFileEquivalenceNode *n1(_node),*n2(other->_node);
110 if((n1 && !n2) || (!n1 && n2))
112 std::ostringstream oss; oss << "Node def of Equiv " << _name << " are defined for this and not for other (or reversely) !";
117 if(!n1->isEqual(n2,what))
122 void MEDFileEquivalencePair::getRepr(std::ostream& oss) const
124 const MEDFileEquivalenceNode *node(_node);
125 const MEDFileEquivalenceCell *cell(_cell);
126 oss << std::endl << " name of equivalence : " << _name << std::endl;
127 oss << " description of equivalence : " << _description << std::endl;
130 oss << "None" << std::endl;
135 oss << "None" << std::endl;
140 MEDFileEquivalencePair *MEDFileEquivalencePair::New(MEDFileEquivalences *father, const std::string& name)
142 return new MEDFileEquivalencePair(father,name,std::string());
145 std::vector<const BigMemoryObject *> MEDFileEquivalencePair::getDirectChildrenWithNull() const
147 std::vector<const BigMemoryObject *> ret(2);
148 ret[0]=_cell; ret[1]=_node;
152 void MEDFileEquivalencePair::setArray(int meshDimRelToMaxExt, DataArrayInt *da)
154 if(meshDimRelToMaxExt>1)
155 throw INTERP_KERNEL::Exception("MEDFileEquivalencePair::setArray : meshDimRelToMaxExt must be in [1,0,-1,-2,-3] at most !");
156 if(meshDimRelToMaxExt==1)
158 MEDFileEquivalenceNode *node(_node);
161 _node=new MEDFileEquivalenceNode(this,0);
168 MEDFileEquivalenceCell *cell(_cell);
171 _cell=new MEDFileEquivalenceCell(this);
174 cell->setArray(meshDimRelToMaxExt,da);
179 * The returned pointer is a borrowed pointer.
181 MEDFileEquivalenceCell *MEDFileEquivalencePair::initCell()
183 _cell=new MEDFileEquivalenceCell(this);
188 * The returned pointer is a borrowed pointer.
190 MEDFileEquivalenceNode *MEDFileEquivalencePair::initNode()
192 _node=new MEDFileEquivalenceNode(this,0);
196 std::size_t MEDFileEquivalencePair::getHeapMemorySizeWithoutChildren() const
201 void MEDFileEquivalencePair::load(med_idt fid)
203 std::string meshName(_father->getMeshName());
205 _father->getDtIt(dt,it);
207 MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceSize,(fid,meshName.c_str(),_name.c_str(),dt,it,MED_NODE,MED_NONE,&ncor));
210 MCAuto<DataArrayMedInt> da(DataArrayMedInt::New());
212 MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceRd,(fid,meshName.c_str(),_name.c_str(),dt,it,MED_NODE,MED_NONE,da->getPointer()));
215 MCAuto<MEDFileEquivalenceNode> node(new MEDFileEquivalenceNode(this,FromMedIntArray<int>(da)));
218 _cell=MEDFileEquivalenceCell::Load(fid,this);
221 std::vector<const BigMemoryObject *> MEDFileEquivalences::getDirectChildrenWithNull() const
223 std::size_t sz(_equ.size());
224 std::vector<const BigMemoryObject *> ret(sz);
225 for(std::size_t i=0;i<sz;i++)
230 std::size_t MEDFileEquivalences::getHeapMemorySizeWithoutChildren() const
232 return sizeof(MEDFileEquivalences)+_equ.capacity()*sizeof(MEDFileEquivalencePair);
235 void MEDFileEquivalences::getDtIt(int &dt, int &it) const
237 dt=_owner->getIteration(); it=_owner->getOrder();
240 std::string MEDFileEquivalences::getMeshName() const
242 return _owner->getName();
245 void MEDFileEquivalences::pushEquivalence(MEDFileEquivalencePair *elt)
247 MCAuto<MEDFileEquivalencePair> elta(elt);
250 _equ.push_back(elta);
253 MEDFileEquivalencePair *MEDFileEquivalences::getEquivalence(int i)
258 std::ostringstream oss; oss << "MEDFileEquivalences::getEquivalence : invalid id ! Must be in [0," << sz << ") !";
259 throw INTERP_KERNEL::Exception(oss.str().c_str());
264 MEDFileEquivalencePair *MEDFileEquivalences::getEquivalenceWithName(const std::string& name)
266 for(std::vector< MCAuto<MEDFileEquivalencePair> >::iterator it=_equ.begin();it!=_equ.end();it++)
268 MEDFileEquivalencePair *elt(*it);
271 if(elt->getName()==name)
275 std::ostringstream oss; oss << "MEDFileEquivalences::getEquivalenceWithName : no equivalence with name \"" << name << "\" ! Must be in [ ";
276 std::vector<std::string> eqs(getEquivalenceNames());
277 std::copy(eqs.begin(),eqs.end(),std::ostream_iterator<std::string>(oss,", "));
279 throw INTERP_KERNEL::Exception(oss.str().c_str());
282 int MEDFileEquivalences::size() const
284 return (int)_equ.size();
287 std::vector<std::string> MEDFileEquivalences::getEquivalenceNames() const
289 std::vector<std::string> ret;
290 for(std::vector< MCAuto<MEDFileEquivalencePair> >::const_iterator it=_equ.begin();it!=_equ.end();it++)
292 const MEDFileEquivalencePair *elt(*it);
295 ret.push_back(elt->getName());
301 MEDFileEquivalencePair *MEDFileEquivalences::appendEmptyEquivalenceWithName(const std::string& name)
303 MCAuto<MEDFileEquivalencePair> elt(MEDFileEquivalencePair::New(this,name));
308 MEDFileEquivalences *MEDFileEquivalences::deepCopy(MEDFileMesh *owner) const
310 MCAuto<MEDFileEquivalences> ret(new MEDFileEquivalences(owner));
311 ret->deepCpyFrom(*this);
315 bool MEDFileEquivalences::isEqual(const MEDFileEquivalences *other, std::string& what) const
317 std::size_t sz(_equ.size());
318 if(sz!=other->_equ.size())
320 what="Equivalences differs : not same number !";
323 for(std::size_t i=0;i<sz;i++)
325 const MEDFileEquivalencePair *thisp(_equ[i]),*otherp(other->_equ[i]);
326 if(!thisp && !otherp)
330 if(!thisp->isEqual(otherp,what))
332 std::ostringstream oss; oss << "At Eq #" << i << " there is a difference !";
339 std::ostringstream oss; oss << "At Eq #" << i << " defined in this not is other (or reversely) !";
347 void MEDFileEquivalences::getRepr(std::ostream& oss) const
350 for(std::vector< MCAuto<MEDFileEquivalencePair> >::const_iterator it=_equ.begin();it!=_equ.end();it++,ii++)
352 const MEDFileEquivalencePair *elt(*it);
353 oss << "Equivalence #" << ii << " : " ;
357 oss << "None" << std::endl;
361 void MEDFileEquivalences::killEquivalenceWithName(const std::string& name)
363 std::vector< MCAuto<MEDFileEquivalencePair> >::iterator it(_equ.begin());
364 for(;it!=_equ.end();it++)
366 const MEDFileEquivalencePair *elt(*it);
367 if(elt && elt->getName()==name)
372 std::ostringstream oss; oss << "MEDFileEquivalences::killEquivalenceWithName : Equivalence with name \"" << name << "\" not found !";
373 throw INTERP_KERNEL::Exception(oss.str().c_str());
378 void MEDFileEquivalences::killEquivalenceAt(int i)
383 std::ostringstream oss; oss << "MEDFileEquivalences::killEquivalenceAt : Id must be in [0," << sz << ") !";
384 throw INTERP_KERNEL::Exception(oss.str().c_str());
386 std::vector< MCAuto<MEDFileEquivalencePair> >::iterator it(_equ.begin());
387 for(int j=0;j<i;it++,j++);
391 void MEDFileEquivalences::clear()
396 void MEDFileEquivalences::writeLL(med_idt fid) const
398 for(std::vector< MCAuto<MEDFileEquivalencePair> >::const_iterator it=_equ.begin();it!=_equ.end();it++)
400 const MEDFileEquivalencePair *elt(*it);
406 int MEDFileEquivalences::PresenceOfEquivalences(med_idt fid, const std::string& meshName)
408 med_int nequ(MEDnEquivalence(fid,meshName.c_str()));
409 return FromMedInt<int>(nequ);
412 MEDFileEquivalences *MEDFileEquivalences::Load(med_idt fid, int nbOfEq, MEDFileMesh *owner)
414 MCAuto<MEDFileEquivalences> ret(new MEDFileEquivalences(owner));
416 throw INTERP_KERNEL::Exception("MEDFileEquivalences::Load : owner is NULL !");
417 std::string meshName(owner->getName());
418 for(int i=0;i<nbOfEq;i++)
420 INTERP_KERNEL::AutoPtr<char> equ(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
421 INTERP_KERNEL::AutoPtr<char> desc(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
422 med_int nstep,nocstpncor;
423 MEDFILESAFECALLERRD0(MEDequivalenceInfo,(fid,meshName.c_str(),i+1,equ,desc,&nstep,&nocstpncor));
424 std::string eqName(MEDLoaderBase::buildStringFromFortran(equ,MED_NAME_SIZE)),eqDescName(MEDLoaderBase::buildStringFromFortran(desc,MED_COMMENT_SIZE));
425 MCAuto<MEDFileEquivalencePair> eqv(MEDFileEquivalencePair::Load(ret,fid,eqName,eqDescName));
426 ret->pushEquivalence(eqv);
431 void MEDFileEquivalences::CheckDataArray(const DataArrayInt *data)
435 data->checkAllocated();
436 if(data->getNumberOfComponents()!=2)
438 std::ostringstream oss; oss << "MEDFileEquivalences::CheckDataArray : Input DataArray must have 2 components !";
439 throw INTERP_KERNEL::Exception(oss.str().c_str());
443 void MEDFileEquivalences::deepCpyFrom(const MEDFileEquivalences& other)
445 for(std::vector< MCAuto<MEDFileEquivalencePair> >::const_iterator it=other._equ.begin();it!=other._equ.end();it++)
447 const MEDFileEquivalencePair *elt(*it);
448 MCAuto<MEDFileEquivalencePair> eltCpy;
451 eltCpy=elt->deepCopy(this);
453 _equ.push_back(eltCpy);
457 MEDFileEquivalenceBase::MEDFileEquivalenceBase(MEDFileEquivalencePair *father):_father(father)
461 MEDFileEquivalenceData::MEDFileEquivalenceData(MEDFileEquivalencePair *owner, DataArrayInt *data):MEDFileEquivalenceBase(owner),_data(data)
467 void MEDFileEquivalenceData::setArray(DataArrayInt *data)
469 MEDFileEquivalences::CheckDataArray(data);
475 std::vector<const BigMemoryObject *> MEDFileEquivalenceData::getDirectChildrenWithNull() const
477 std::vector<const BigMemoryObject *> ret(1);
482 bool MEDFileEquivalenceData::isEqual(const MEDFileEquivalenceData *other, std::string& what) const
484 const DataArrayInt *d1(_data),*d2(other->_data);
485 if((!d1 && d2) || (d1 && !d2))
487 what="Data array is defined in this not in other (or reversely) !";
492 if(!d1->isEqualIfNotWhy(*d2,what))
498 void MEDFileEquivalenceData::writeAdvanced(med_idt fid, med_entity_type medtype, med_geometry_type medgt) const
501 const DataArrayInt *da(getArray());
504 MEDFileEquivalences::CheckDataArray(da);
505 const MEDFileMesh *mesh(getFather()->getMesh());
507 mesh->getTime(dt,it);
508 std::string meshName(mesh->getName());
509 std::string equName(getFather()->getName());
510 INTERP_KERNEL::AutoPtr<char> meshName2(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
511 INTERP_KERNEL::AutoPtr<char> name(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
512 MEDLoaderBase::safeStrCpy(meshName.c_str(),MED_NAME_SIZE,meshName2,getFather()->getMesh()->getTooLongStrPolicy());
513 MEDLoaderBase::safeStrCpy(equName.c_str(),MED_NAME_SIZE,name,getFather()->getMesh()->getTooLongStrPolicy());
514 MCAuto<DataArrayMedInt> da2(DataArrayMedInt::Copy(da)); da2->rearrange(1); da2->applyLin(1,1); da2->rearrange(2);
515 MEDFILESAFECALLERWR0(MEDequivalenceCorrespondenceWr,(fid,meshName2,name,dt,it,medtype,medgt,ToMedInt(da2->getNumberOfTuples()),da2->begin()));
518 std::size_t MEDFileEquivalenceCellType::getHeapMemorySizeWithoutChildren() const
520 return sizeof(MEDFileEquivalenceCellType);
523 MEDFileEquivalenceCellType *MEDFileEquivalenceCellType::deepCopy(MEDFileEquivalencePair *owner) const
525 MCAuto<DataArrayInt> da;
527 da=getArray()->deepCopy();
528 return new MEDFileEquivalenceCellType(owner,_type,da);
531 bool MEDFileEquivalenceCellType::isEqual(const MEDFileEquivalenceCellType *other, std::string& what) const
533 if(_type!=other->_type)
535 what="Geo types differs !";
538 return MEDFileEquivalenceData::isEqual(other,what);
541 void MEDFileEquivalenceCellType::getRepr(std::ostream& oss) const
543 const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(_type));
544 const DataArrayInt *da(getArray());
545 oss << cm.getRepr() << ":";
547 oss << da->getNumberOfTuples() << " tuples";
549 oss << "no dataarray";
553 void MEDFileEquivalenceCellType::writeLL(med_idt fid) const
555 writeAdvanced(fid,MED_CELL,typmai3[_type]);
558 std::vector<const BigMemoryObject *> MEDFileEquivalenceCell::getDirectChildrenWithNull() const
560 std::size_t sz(_types.size());
561 std::vector<const BigMemoryObject *> ret(sz);
562 for(std::size_t i=0;i<sz;i++)
567 std::size_t MEDFileEquivalenceCell::getHeapMemorySizeWithoutChildren() const
569 return sizeof(MEDFileEquivalenceCell)+_types.capacity()*sizeof(MEDFileEquivalenceCellType);
572 MEDFileEquivalenceCell *MEDFileEquivalenceCell::Load(med_idt fid, MEDFileEquivalencePair *owner)
574 MCAuto<MEDFileEquivalenceCell> ret(new MEDFileEquivalenceCell(owner));
582 void MEDFileEquivalenceCell::writeLL(med_idt fid) const
584 for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
586 const MEDFileEquivalenceCellType *ct(*it);
592 MEDFileEquivalenceCell *MEDFileEquivalenceCell::deepCopy(MEDFileEquivalencePair *owner) const
594 MCAuto<MEDFileEquivalenceCell> ret(new MEDFileEquivalenceCell(owner));
595 for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
597 const MEDFileEquivalenceCellType *elt(*it);
598 MCAuto<MEDFileEquivalenceCellType> eltCpy;
600 eltCpy=elt->deepCopy(owner);
601 ret->_types.push_back(eltCpy);
606 bool MEDFileEquivalenceCell::isEqual(const MEDFileEquivalenceCell *other, std::string& what) const
608 std::size_t sz(_types.size());
609 if(sz!=other->_types.size())
611 std::ostringstream oss; oss << "Nb of geo types differs : " << sz << " != " << other->_types.size();
615 for(std::size_t i=0;i<sz;i++)
617 const MEDFileEquivalenceCellType *ct1(_types[i]),*ct2(other->_types[i]);
618 if((ct1 && !ct2) || (!ct1 && ct2))
620 std::ostringstream oss; oss << "At gt #" << i << " this is defined not other (or reversely !)";
626 if(!ct1->isEqual(ct2,what))
628 std::ostringstream oss; oss << "At gt #" << i << " of Eq " << getFather()->getName() << " it differs !";
637 void MEDFileEquivalenceCell::getRepr(std::ostream& oss) const
639 for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
641 const MEDFileEquivalenceCellType *elt(*it);
647 DataArrayInt *MEDFileEquivalenceCell::getArray(INTERP_KERNEL::NormalizedCellType type)
649 for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::iterator it=_types.begin();it!=_types.end();it++)
651 MEDFileEquivalenceCellType *elt(*it);
652 if(elt && elt->getType()==type)
653 return elt->getArray();
655 std::ostringstream oss; oss << "MEDFileEquivalenceCell::getArray : In Equivalence \"" << getFather()->getName() << "\" the geotype " << type << " is not available !";
656 throw INTERP_KERNEL::Exception(oss.str().c_str());
659 void MEDFileEquivalenceCell::setArray(int meshDimRelToMax, DataArrayInt *da)
663 MEDFileEquivalences::CheckDataArray(da);
664 MEDFileMesh *mm(getMesh());
665 mcIdType totalNbOfCells(mm->getNumberOfCellsAtLevel(meshDimRelToMax));
667 MCAuto<DataArrayInt> tmp(da->deepCopy()); tmp->rearrange(1);
669 tmp->getMinMaxValues(minv,maxv);
670 if((minv<0 || minv>=totalNbOfCells) || (maxv<0 || maxv>=totalNbOfCells))
672 std::ostringstream oss; oss << "MEDFileEquivalenceCell::setArray : Input 2 component DataArray has incorrect values ! all values must be in [0," << totalNbOfCells << ") !";
673 throw INTERP_KERNEL::Exception(oss.str().c_str());
676 std::vector<INTERP_KERNEL::NormalizedCellType> gts(mm->getGeoTypesAtLevel(meshDimRelToMax));
677 int startId(0),endId;
678 std::vector<std::size_t> compS(1,0);
679 for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator it=gts.begin();it!=gts.end();it++)
681 endId=startId+(int)mm->getNumberOfCellsWithType(*it);
682 MCAuto<DataArrayInt> da0(da->keepSelectedComponents(compS));
683 MCAuto<DataArrayIdType> ids(da0->findIdsInRange(startId,endId));
684 MCAuto<DataArrayInt> da1(da->selectByTupleIdSafe(ids->begin(),ids->end()));
685 da1->applyLin(1,-startId);
686 setArrayForType(*it,da1);
691 void MEDFileEquivalenceCell::setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da)
693 for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::iterator it=_types.begin();it!=_types.end();it++)
695 MEDFileEquivalenceCellType *elt(*it);
696 if(elt && elt->getType()==type)
702 MCAuto<MEDFileEquivalenceCellType> newElt(new MEDFileEquivalenceCellType(getFather(),type,da));
703 _types.push_back(newElt);
706 std::vector<INTERP_KERNEL::NormalizedCellType> MEDFileEquivalenceCell::getTypes() const
708 std::vector<INTERP_KERNEL::NormalizedCellType> ret;
709 for(std::vector< MCAuto<MEDFileEquivalenceCellType> >::const_iterator it=_types.begin();it!=_types.end();it++)
711 const MEDFileEquivalenceCellType *elt(*it);
713 ret.push_back(elt->getType());
718 void MEDFileEquivalenceCell::load(med_idt fid)
720 std::string meshName(getFather()->getFather()->getMeshName()),name(getName());
722 getFather()->getFather()->getDtIt(dt,it);
723 for(int i=0;i<MED_N_CELL_FIXED_GEO;i++)
726 MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceSize,(fid,meshName.c_str(),name.c_str(),dt,it,MED_CELL,typmai[i],&ncor));
729 MCAuto<DataArrayMedInt> da(DataArrayMedInt::New());
731 MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceRd,(fid,meshName.c_str(),name.c_str(),dt,it,MED_CELL,typmai[i],da->getPointer()));
734 MCAuto<MEDFileEquivalenceCellType> ct(new MEDFileEquivalenceCellType(getFather(),typmai2[i],FromMedIntArray<int>(da)));
735 _types.push_back(ct);
740 std::size_t MEDFileEquivalenceNode::getHeapMemorySizeWithoutChildren() const
742 return sizeof(MEDFileEquivalenceNode);
745 void MEDFileEquivalenceNode::writeLL(med_idt fid) const
747 writeAdvanced(fid,MED_NODE,MED_NONE);
750 MEDFileEquivalenceNode *MEDFileEquivalenceNode::deepCopy(MEDFileEquivalencePair *owner) const
752 MCAuto<DataArrayInt> da;
754 da=getArray()->deepCopy();
755 MCAuto<MEDFileEquivalenceNode> ret(new MEDFileEquivalenceNode(owner,da));
759 bool MEDFileEquivalenceNode::isEqual(const MEDFileEquivalenceNode *other, std::string& what) const
761 return MEDFileEquivalenceData::isEqual(other,what);
764 void MEDFileEquivalenceNode::getRepr(std::ostream& oss) const
766 const DataArrayInt *da(getArray());
768 oss << " No dataarray defined !" << std::endl;
770 oss << da->getNumberOfTuples() << " tuples in node equivalence." << std::endl;