ret+=_num_coords->getHeapMemorySize();
if((const DataArrayInt *)_rev_num_coords)
ret+=_rev_num_coords->getHeapMemorySize();
+ if((const DataArrayAsciiChar *)_name_coords)
+ ret+=_name_coords->getHeapMemorySize();
ret+=_ms.capacity()*(sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1>));
for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
if((const MEDFileUMeshSplitL1*) *it)
ret->_num_coords=_num_coords->deepCpy();
if((const DataArrayInt*)_rev_num_coords)
ret->_rev_num_coords=_rev_num_coords->deepCpy();
+ if((const DataArrayAsciiChar*)_name_coords)
+ ret->_name_coords=_name_coords->deepCpy();
std::size_t i=0;
for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,i++)
{
return false;
}
}
+ const DataArrayAsciiChar *namec1=_name_coords;
+ const DataArrayAsciiChar *namec2=otherC->_name_coords;
+ if((namec1==0 && namec2!=0) || (namec1!=0 && namec2==0))
+ {
+ what="Mismatch of naming arr on nodes ! One is defined and not other !";
+ return false;
+ }
+ if(namec1)
+ {
+ bool ret=namec1->isEqual(*namec2);
+ if(!ret)
+ {
+ what="Names arr on node differ !";
+ return false;
+ }
+ }
if(_ms.size()!=otherC->_ms.size())
{
what="Number of levels differs !";
const DataArrayInt *numc1=_num_coords;
if(numc1)
(const_cast<DataArrayInt *>(numc1))->setName("");//This parameter is not discriminant for comparison
+ const DataArrayAsciiChar *namc1=_name_coords;
+ if(namc1)
+ (const_cast<DataArrayAsciiChar *>(namc1))->setName("");//This parameter is not discriminant for comparison
for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
const MEDFileUMeshSplitL1 *tmp=(*it);
_coords=loaderl2.getCoords();
_fam_coords=loaderl2.getCoordsFamily();
_num_coords=loaderl2.getCoordsNum();
+ _name_coords=loaderl2.getCoordsName();
computeRevNum();
}
MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE-1,unit+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
}
MEDmeshCr(fid,maa,spaceDim,mdim,MED_UNSTRUCTURED_MESH,desc,"",MED_SORT_DTIT,MED_CARTESIAN,comp,unit);
- MEDFileUMeshL2::WriteCoords(fid,maa,_iteration,_order,_time,_coords,_fam_coords,_num_coords);
+ MEDFileUMeshL2::WriteCoords(fid,maa,_iteration,_order,_time,_coords,_fam_coords,_num_coords,_name_coords);
for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
if((const MEDFileUMeshSplitL1 *)(*it)!=0)
(*it)->write(fid,maa,mdim);
return l1->getNumberField();
}
+const DataArrayAsciiChar *MEDFileUMesh::getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
+{
+ if(meshDimRelToMaxExt==1)
+ return _name_coords;
+ const MEDFileUMeshSplitL1 *l1=getMeshAtLevSafe(meshDimRelToMaxExt);
+ return l1->getNameField();
+}
+
int MEDFileUMesh::getNumberOfNodes() const throw(INTERP_KERNEL::Exception)
{
const DataArrayDouble *coo=_coords;
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2=ret->invertArrayO2N2N2OBis(nbrOfNodesInUse);
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> newCoords=coo->selectByTupleIdSafe(ret2->begin(),ret2->end());
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newFamCoords;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> newNameCoords;
if((const DataArrayInt *)_fam_coords)
newFamCoords=_fam_coords->selectByTupleIdSafe(ret2->begin(),ret2->end());
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newNumCoords;
if((const DataArrayInt *)_num_coords)
newNumCoords=_num_coords->selectByTupleIdSafe(ret2->begin(),ret2->end());
- _coords=newCoords; _fam_coords=newFamCoords; _num_coords=newNumCoords; _rev_num_coords=0;
+ if((const DataArrayAsciiChar *)_name_coords)
+ newNameCoords=static_cast<DataArrayAsciiChar *>(_name_coords->selectByTupleIdSafe(ret2->begin(),ret2->end()));
+ _coords=newCoords; _fam_coords=newFamCoords; _num_coords=newNumCoords; _name_coords=newNameCoords; _rev_num_coords=0;
for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
{
if((MEDFileUMeshSplitL1*)*it)
return _ms[traducedRk]->setRenumArr(renumArr);
}
+void MEDFileUMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception)
+{
+ if(meshDimRelToMaxExt==1)
+ {
+ if(!nameArr)
+ {
+ _name_coords=0;
+ return ;
+ }
+ DataArrayDouble *coo(_coords);
+ if(!coo)
+ throw INTERP_KERNEL::Exception("MEDFileUMesh::setRenumFieldArr : the coordinates have not been set !");
+ nameArr->checkNbOfTuplesAndComp(coo->getNumberOfTuples(),MED_SNAME_SIZE,"MEDFileUMesh::setRenumArr : Problem in size of node numbering arr ! ");
+ nameArr->incrRef();
+ _name_coords=nameArr;
+ return ;
+ }
+ if(meshDimRelToMaxExt>1)
+ throw INTERP_KERNEL::Exception("MEDFileUMesh::setRenumArr : Dimension request is invalid (>1) !");
+ int traducedRk=-meshDimRelToMaxExt;
+ if(traducedRk>=(int)_ms.size())
+ throw INTERP_KERNEL::Exception("Invalid mesh dim relative to max given ! To low !");
+ if((MEDFileUMeshSplitL1 *)_ms[traducedRk]==0)
+ throw INTERP_KERNEL::Exception("On specified lev (or entity) no cells exists !");
+ return _ms[traducedRk]->setNameArr(nameArr);
+}
+
void MEDFileUMesh::synchronizeTinyInfoOnLeaves() const
{
for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
return false;
}
}
+ const DataArrayAsciiChar *d1=_names_cells;
+ const DataArrayAsciiChar *d2=otherC->_names_cells;
+ if((d1==0 && d2!=0) || (d1!=0 && d2==0))
+ {
+ what="Mismatch of naming arr on cells ! One is defined and not other !";
+ return false;
+ }
+ if(d1)
+ {
+ bool ret=d1->isEqual(*d2);
+ if(!ret)
+ {
+ what="Naming arr on cells differ !";
+ return false;
+ }
+ }
+ d1=_names_nodes;
+ d2=otherC->_names_nodes;
+ if((d1==0 && d2!=0) || (d1!=0 && d2==0))
+ {
+ what="Mismatch of naming arr on nodes ! One is defined and not other !";
+ return false;
+ }
+ if(d1)
+ {
+ bool ret=d1->isEqual(*d2);
+ if(!ret)
+ {
+ what="Naming arr on nodes differ !";
+ return false;
+ }
+ }
return true;
}
if(meshDimRelToMaxExt==0)
{
int nbCells=mesh->getNumberOfCells();
- famArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setFamilyArr : Problem in size of Family arr ! Mismatch with number of cells of mesh !");
+ famArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setFamilyFieldArr : Problem in size of Family arr ! Mismatch with number of cells of mesh !");
_fam_cells=famArr;
}
else
{
int nbNodes=mesh->getNumberOfNodes();
- famArr->checkNbOfTuplesAndComp(nbNodes,1,"MEDFileStructuredMesh::setFamilyArr : Problem in size of Family arr ! Mismatch with number of nodes of mesh !");
+ famArr->checkNbOfTuplesAndComp(nbNodes,1,"MEDFileStructuredMesh::setFamilyFieldArr : Problem in size of Family arr ! Mismatch with number of nodes of mesh !");
_fam_nodes=famArr;
}
if(famArr)
else
{
int nbNodes=mesh->getNumberOfNodes();
- renumArr->checkNbOfTuplesAndComp(nbNodes,1,"MEDFileStructuredMesh::setFamilyArr : Problem in size of Family arr ! Mismatch with number of nodes of mesh !");
+ renumArr->checkNbOfTuplesAndComp(nbNodes,1,"MEDFileStructuredMesh::setRenumFieldArr : Problem in size of Family arr ! Mismatch with number of nodes of mesh !");
_num_nodes=renumArr;
}
if(renumArr)
renumArr->incrRef();
}
+void MEDFileStructuredMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception)
+{
+ if(meshDimRelToMaxExt!=0 && meshDimRelToMaxExt!=1)
+ throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::setNameFieldAtLevel : Only available for levels 0 or 1 !");
+ const MEDCouplingStructuredMesh *mesh=getStructuredMesh();
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::setNameFieldAtLevel : no structured mesh specified ! Impossible to set names array !");
+ if(meshDimRelToMaxExt==0)
+ {
+ int nbCells=mesh->getNumberOfCells();
+ nameArr->checkNbOfTuplesAndComp(nbCells,MED_SNAME_SIZE,"MEDFileStructuredMesh::setNameFieldAtLevel : Problem in size of names arr ! Mismatch with number of cells of mesh !");
+ _names_cells=nameArr;
+ }
+ else
+ {
+ int nbNodes=mesh->getNumberOfNodes();
+ nameArr->checkNbOfTuplesAndComp(nbNodes,MED_SNAME_SIZE,"MEDFileStructuredMesh::setNameFieldAtLevel : Problem in size of names arr ! Mismatch with number of nodes of mesh !");
+ _names_nodes=nameArr;
+ }
+ if(nameArr)
+ nameArr->incrRef();
+}
+
const DataArrayInt *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
{
if(meshDimRelToMaxExt!=0 && meshDimRelToMaxExt!=1)
}
}
+const DataArrayAsciiChar *MEDFileStructuredMesh::getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
+{
+ if(meshDimRelToMaxExt!=0 && meshDimRelToMaxExt!=1)
+ throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getNameFieldAtLevel : Only available for levels 0 or 1 !");
+ if(meshDimRelToMaxExt==0)
+ return _names_cells;
+ else
+ return _names_nodes;
+}
+
std::vector<int> MEDFileStructuredMesh::getNonEmptyLevels() const
{
std::vector<int> ret(1);
_num_cells->alloc(nbOfElt,1);
MEDmeshEntityNumberRd(fid,mName,dt,it,MED_CELL,geoTypeReq,_num_cells->getPointer());
}
+ nbOfElt=MEDmeshnEntity(fid,mName,dt,it,MED_CELL,geoTypeReq,MED_NAME,MED_NODAL,&chgt,&trsf);
+ if(nbOfElt>0)
+ {
+ _names_cells=DataArrayAsciiChar::New();
+ _names_cells->alloc(nbOfElt+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end
+ MEDmeshEntityNameRd(fid,mName,dt,it,MED_CELL,geoTypeReq,_names_cells->getPointer());
+ _names_cells->reAlloc(nbOfElt);//not a bug to avoid the memory corruption due to last \0 at the end
+ }
+ nbOfElt=MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NONE,MED_NAME,MED_NODAL,&chgt,&trsf);
+ if(nbOfElt>0)
+ {
+ _names_nodes=DataArrayAsciiChar::New();
+ _names_nodes->alloc(nbOfElt+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end
+ MEDmeshEntityNameRd(fid,mName,dt,it,MED_NODE,MED_NONE,_names_nodes->getPointer());
+ _names_nodes->reAlloc(nbOfElt);//not a bug to avoid the memory corruption due to last \0 at the end
+ }
}
void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const char *maa) const throw(INTERP_KERNEL::Exception)
MEDmeshEntityNumberWr(fid,maa,_iteration,_order,MED_CELL,geoTypeReq,_num_cells->getNumberOfTuples(),_num_cells->getConstPointer());
if((const DataArrayInt *)_num_nodes)
MEDmeshEntityNumberWr(fid,maa,_iteration,_order,MED_NODE,MED_NONE,_num_nodes->getNumberOfTuples(),_num_nodes->getConstPointer());
+ if((const DataArrayAsciiChar *)_names_cells)
+ {
+ if(_names_cells->getNumberOfComponents()!=MED_SNAME_SIZE)
+ {
+ std::ostringstream oss; oss << "MEDFileStructuredMesh::writeStructuredLL : expected a name field on cells with number of components set to " << MED_SNAME_SIZE;
+ oss << " ! The array has " << _names_cells->getNumberOfComponents() << " components !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ MEDmeshEntityNameWr(fid,maa,_iteration,_order,MED_CELL,geoTypeReq,_names_cells->getNumberOfTuples(),_names_cells->getConstPointer());
+ }
+ if((const DataArrayAsciiChar *)_names_nodes)
+ {
+ if(_names_nodes->getNumberOfComponents()!=MED_SNAME_SIZE)
+ {
+ std::ostringstream oss; oss << "MEDFileStructuredMesh::writeStructuredLL : expected a name field on nodes with number of components set to " << MED_SNAME_SIZE;
+ oss << " ! The array has " << _names_cells->getNumberOfComponents() << " components !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ MEDmeshEntityNameWr(fid,maa,_iteration,_order,MED_NODE,MED_NONE,_names_nodes->getNumberOfTuples(),_names_nodes->getConstPointer());
+ }
//
MEDFileUMeshL2::WriteFamiliesAndGrps(fid,maa,_families,_groups,_too_long_str);
}
virtual void setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector<const DataArrayInt *>& grps, bool renum=false) throw(INTERP_KERNEL::Exception);
virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception) = 0;
virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception) = 0;
+ virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception) = 0;
virtual const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) = 0;
virtual const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) = 0;
virtual const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) = 0;
+ virtual const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) = 0;
virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception) = 0;
virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
+ const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
std::vector<int> getNonEmptyLevels() const;
std::vector<int> getNonEmptyLevelsExt() const;
void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
+ void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception);
void addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> _coords;
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam_coords;
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num_coords;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> _name_coords;
mutable MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _rev_num_coords;
};
const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
+ void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception);
const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
+ const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
std::vector<int> getNonEmptyLevels() const;
std::vector<int> getNonEmptyLevelsExt() const;
MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception);
private:
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam_nodes;
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num_nodes;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> _names_nodes;
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam_cells;
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num_cells;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> _names_cells;
mutable MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _rev_num_nodes;
mutable MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _rev_num_cells;
};
_conn_index=DataArrayInt::New();
_conn_index->alloc(curNbOfElem+1,1);
INTERP_KERNEL::AutoPtr<int> connTab=new int[(nbOfNodesPerCell)*curNbOfElem];
- _num=DataArrayInt::New();
- _num->alloc(curNbOfElem,1);
+ MEDmeshElementConnectivityRd(fid,mName,dt,it,entity,geoElt,MED_NODAL,MED_FULL_INTERLACE,connTab);
+ loadCommonPart(fid,mName,dt,it,mdim,curNbOfElem,geoElt,entity);
+ int *w1=_conn->getPointer();
+ int *w2=_conn_index->getPointer();
+ *w2++=0;
+ const int *wi=connTab;
+ for(int i=0;i<curNbOfElem;i++,wi+=nbOfNodesPerCell,w2++)
+ {
+ *w1++=(int)type;
+ w1=std::transform(wi,wi+nbOfNodesPerCell,w1,std::bind2nd(std::plus<int>(),-1));
+ *w2=w2[-1]+nbOfNodesPerCell+1;
+ }
+}
+
+void MEDFileUMeshPerType::loadCommonPart(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt,
+ med_entity_type entity)
+{
+ med_bool changement,transformation;
_fam=DataArrayInt::New();
_fam->alloc(curNbOfElem,1);
- med_bool changement,transformation;
- INTERP_KERNEL::AutoPtr<char> noms=new char[MED_SNAME_SIZE*(std::size_t)curNbOfElem+1];
- MEDmeshElementConnectivityRd(fid,mName,dt,it,entity,geoElt,MED_NODAL,MED_FULL_INTERLACE,connTab);
if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,entity,geoElt,_fam->getPointer())!=0)
}
else
_num=0;
- int *w1=_conn->getPointer();
- int *w2=_conn_index->getPointer();
- *w2++=0;
- const int *wi=connTab;
- for(int i=0;i<curNbOfElem;i++,wi+=nbOfNodesPerCell,w2++)
+ if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_NAME,MED_NODAL,&changement,&transformation)>0)
{
- *w1++=(int)type;
- w1=std::transform(wi,wi+nbOfNodesPerCell,w1,std::bind2nd(std::plus<int>(),-1));
- *w2=w2[-1]+nbOfNodesPerCell+1;
+ _names=DataArrayAsciiChar::New();
+ _names->alloc(curNbOfElem+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end
+ if(MEDmeshEntityNameRd(fid,mName,dt,it,entity,geoElt,_names->getPointer())!=0)
+ _names=0;
+ else
+ _names->reAlloc(curNbOfElem);//not a bug to avoid the memory corruption due to last \0 at the end
}
}
_conn_index->alloc(curNbOfElem+1,1);
_conn=DataArrayInt::New();
_conn->alloc(arraySize+curNbOfElem,1);
- _num=DataArrayInt::New();
- _num->alloc(curNbOfElem,1);
- _fam=DataArrayInt::New();
- _fam->alloc(curNbOfElem,1);
INTERP_KERNEL::AutoPtr<int> locConn=new int[arraySize];
MEDmeshPolygonRd(fid,mName,dt,it,MED_CELL,MED_NODAL,_conn_index->getPointer(),locConn);
int *w1=_conn->getPointer();
*w2=*w2-1+i;
}
*w2=*w2-1+curNbOfElem;
- if(MEDmeshnEntity(fid,mName,dt,it,entity,MED_POLYGON,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
- {
- if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,entity,MED_POLYGON,_fam->getPointer())!=0)
- std::fill(_fam->getPointer(),_fam->getPointer()+curNbOfElem,0);
- }
- else
- std::fill(_fam->getPointer(),_fam->getPointer()+curNbOfElem,0);
- if(MEDmeshnEntity(fid,mName,dt,it,entity,MED_POLYGON,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
- {
- if(MEDmeshEntityNumberRd(fid,mName,dt,it,entity,MED_POLYGON,_num->getPointer())!=0)
- _num=0;
- }
- else
- _num=0;
+ loadCommonPart(fid,mName,dt,it,mdim,curNbOfElem,MED_POLYGON,entity);
}
void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, int connFaceLgth, med_geometry_type geoElt,
INTERP_KERNEL::AutoPtr<int> index=new int[curNbOfElem+1];
INTERP_KERNEL::AutoPtr<int> indexFace=new int[indexFaceLgth];
INTERP_KERNEL::AutoPtr<int> locConn=new int[connFaceLgth];
- _fam=DataArrayInt::New();
- _fam->alloc(curNbOfElem,1);
MEDmeshPolyhedronRd(fid,mName,dt,it,MED_CELL,MED_NODAL,index,indexFace,locConn);
- if(MEDmeshnEntity(fid,mName,dt,it,entity,MED_POLYHEDRON,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
- {
- if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,entity,MED_POLYHEDRON,_fam->getPointer())!=0)
- std::fill(_fam->getPointer(),_fam->getPointer()+curNbOfElem,0);
- }
- else
- std::fill(_fam->getPointer(),_fam->getPointer()+curNbOfElem,0);
int arraySize=connFaceLgth;
for(int i=0;i<curNbOfElem;i++)
arraySize+=index[i+1]-index[i]-1;
wFinalConn=std::transform(locConn+indexFace[j]-1,locConn+indexFace[j+1]-1,wFinalConn,std::bind2nd(std::plus<int>(),-1));
}
}
- _num=DataArrayInt::New();
- _num->alloc(curNbOfElem,1);
- if(MEDmeshnEntity(fid,mName,dt,it,entity,MED_POLYHEDRON,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
- {
- if(MEDmeshEntityNumberRd(fid,mName,dt,it,entity,MED_POLYHEDRON,_num->getPointer())!=0)
- _num=0;
- }
- else
- _num=0;
+ loadCommonPart(fid,mName,dt,it,mdim,curNbOfElem,MED_POLYHEDRON,entity);
}
-void MEDFileUMeshPerType::write(med_idt fid, const char *mname, int mdim, const MEDCouplingUMesh *m, const DataArrayInt *fam, const DataArrayInt *num)
+void MEDFileUMeshPerType::write(med_idt fid, const char *mname, int mdim, const MEDCouplingUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names)
{
int nbOfCells=m->getNumberOfCells();
if(nbOfCells<1)
MEDmeshEntityFamilyNumberWr(fid,mname,dt,it,MED_CELL,curMedType,nbOfCells,fam->getConstPointer());
if(num)
MEDmeshEntityNumberWr(fid,mname,dt,it,MED_CELL,curMedType,nbOfCells,num->getConstPointer());
+ if(names)
+ {
+ if(names->getNumberOfComponents()!=MED_SNAME_SIZE)
+ {
+ std::ostringstream oss; oss << "MEDFileUMeshPerType::write : expected a name field on cells with number of components set to " << MED_SNAME_SIZE;
+ oss << " ! The array has " << names->getNumberOfComponents() << " components !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ MEDmeshEntityNameWr(fid,mname,dt,it,MED_CELL,curMedType,nbOfCells,names->getConstPointer());
+ }
}
const DataArrayInt *getNodalIndex() const { return _conn_index; }
const DataArrayInt *getFam() const { return _fam; }
const DataArrayInt *getNum() const { return _num; }
- static void write(med_idt fid, const char *mname, int mdim, const MEDCouplingUMesh *m, const DataArrayInt *fam, const DataArrayInt *num);
+ const DataArrayAsciiChar *getNames() const { return _names; }
+ static void write(med_idt fid, const char *mname, int mdim, const MEDCouplingUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names);
private:
MEDFileUMeshPerType(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
med_entity_type entity);
med_entity_type entity);
void loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, int connFaceLgth, med_geometry_type geoElt,
med_entity_type entity);
+ void loadCommonPart(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, med_entity_type entity);
private:
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _conn;
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _conn_index;
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num;
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> _names;
INTERP_KERNEL::NormalizedCellType _type;
med_entity_type _entity;
};
_coords->alloc(nCoords,spaceDim);
double *coordsPtr=_coords->getPointer();
MEDmeshNodeCoordinateRd(fid,mName,dt,it,MED_FULL_INTERLACE,coordsPtr);
- _fam_coords=DataArrayInt::New();
- _fam_coords->alloc(nCoords,1);
- _num_coords=DataArrayInt::New();
- _num_coords->alloc(nCoords,1);
if(MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
- MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,_fam_coords->getPointer());
+ {
+ _fam_coords=DataArrayInt::New();
+ _fam_coords->alloc(nCoords,1);
+ MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,_fam_coords->getPointer());
+ }
else
_fam_coords=0;
if(MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
- MEDmeshEntityNumberRd(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,_num_coords->getPointer());
+ {
+ _num_coords=DataArrayInt::New();
+ _num_coords->alloc(nCoords,1);
+ MEDmeshEntityNumberRd(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,_num_coords->getPointer());
+ }
else
_num_coords=0;
+ if(MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NAME,MED_NODAL,&changement,&transformation)>0)
+ {
+ _name_coords=DataArrayAsciiChar::New();
+ _name_coords->alloc(nCoords+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end
+ MEDmeshEntityNameRd(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,_name_coords->getPointer());
+ _name_coords->reAlloc(nCoords);//not a bug to avoid the memory corruption due to last \0 at the end
+ }
+ else
+ _name_coords=0;
for(int i=0;i<spaceDim;i++)
_coords->setInfoOnComponent(i,infosOnComp[i].c_str());
}
_per_type_mesh.resize(_per_type_mesh.size()-nbOfUselessLev);
}
-void MEDFileUMeshL2::WriteCoords(med_idt fid, const char *mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords)
+void MEDFileUMeshL2::WriteCoords(med_idt fid, const char *mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords)
{
if(!coords)
return ;
MEDmeshEntityFamilyNumberWr(fid,mname,dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),famCoords->getConstPointer());
if(numCoords)
MEDmeshEntityNumberWr(fid,mname,dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),numCoords->getConstPointer());
+ if(nameCoords)
+ {
+ if(nameCoords->getNumberOfComponents()!=MED_SNAME_SIZE)
+ {
+ std::ostringstream oss; oss << " MEDFileUMeshL2::WriteCoords : expected a name field on nodes with number of components set to " << MED_SNAME_SIZE;
+ oss << " ! The array has " << nameCoords->getNumberOfComponents() << " components !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ MEDmeshEntityNameWr(fid,mname,dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->getConstPointer());
+ }
}
bool MEDFileUMeshL2::isFamDefinedOnLev(int levId) const
return true;
}
+bool MEDFileUMeshL2::isNamesDefinedOnLev(int levId) const
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> >::const_iterator it=_per_type_mesh[levId].begin();it!=_per_type_mesh[levId].end();it++)
+ if((*it)->getNames()==0)
+ return false;
+ return true;
+}
+
MEDFileCMeshL2::MEDFileCMeshL2()
{
}
_num_time=_st->_num->getTimeOfThis();
}
-MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshSplitL1& other):_m_by_types(other._m_by_types),_fam(other._fam),_num(other._num),_rev_num(other._rev_num),_m(this)
+MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshSplitL1& other):_m_by_types(other._m_by_types),_fam(other._fam),_num(other._num),_names(other._names),_rev_num(other._rev_num),_m(this)
{
}
w=std::copy(v[i]->getNum()->getConstPointer(),v[i]->getNum()->getConstPointer()+v[i]->getNum()->getNumberOfTuples(),w);
computeRevNum();
}
+ if(l2.isNamesDefinedOnLev(id))
+ {
+ int nbOfCells=_m_by_types->getNumberOfCells();
+ _names=DataArrayAsciiChar::New();
+ _names->alloc(nbOfCells,MED_SNAME_SIZE);
+ char *w=_names->getPointer();
+ for(int i=0;i<sz;i++)
+ w=std::copy(v[i]->getNames()->getConstPointer(),v[i]->getNames()->getConstPointer()+v[i]->getNames()->getNbOfElems(),w);
+ }
}
MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(MEDCouplingUMesh *m):_m(this)
if((const DataArrayDouble *)_m_by_types->getCoords())
ret-=_m_by_types->getCoords()->getHeapMemorySize();
}
- if((const DataArrayInt*)_fam)
+ if((const DataArrayInt*)_fam)
ret+=_fam->getHeapMemorySize();
- if((const DataArrayInt*)_num)
+ if((const DataArrayInt*)_num)
ret+=_num->getHeapMemorySize();
- if((const DataArrayInt*)_rev_num)
+ if((const DataArrayInt*)_rev_num)
ret+=_rev_num->getHeapMemorySize();
+ if((const DataArrayAsciiChar*)_names)
+ ret+=_names->getHeapMemorySize();
return ret;
}
ret->_num=_num->deepCpy();
if((const DataArrayInt *)_rev_num)
ret->_rev_num=_rev_num->deepCpy();
+ if((const DataArrayAsciiChar *)_names)
+ ret->_names=_names->deepCpy();
return ret.retn();
}
what="Numbering cell arr at a sublevel are not deeply equal !";
return false;
}
+ const DataArrayAsciiChar *e1=_names;
+ const DataArrayAsciiChar *e2=other->_names;
+ if((e1==0 && e2!=0) || (e1!=0 && e2==0))
+ {
+ what="Presence of cell names arr in one sublevel and not in other!";
+ return false;
+ }
+ if(e1)
+ if(!e1->isEqual(*e2))
+ {
+ what="Name cell arr at a sublevel are not deeply equal !";
+ return false;
+ }
return true;
}
return _rev_num;
}
+const DataArrayAsciiChar *MEDFileUMeshSplitL1::getNameField() const
+{
+ return _names;
+}
+
void MEDFileUMeshSplitL1::eraseFamilyField()
{
_fam->fillWithZero();
int nbCells=(*it)->getNumberOfCells();
int end=start+nbCells;
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> fam,num;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> names;
if((const DataArrayInt *)_fam)
fam=_fam->substr(start,end);
if((const DataArrayInt *)_num)
num=_num->substr(start,end);
- MEDFileUMeshPerType::write(fid,mName,mdim,(*it),fam,num);
+ if((const DataArrayAsciiChar *)_names)
+ names=static_cast<DataArrayAsciiChar *>(_names->substr(start,end));
+ MEDFileUMeshPerType::write(fid,mName,mdim,(*it),fam,num,names);
start=end;
}
}
computeRevNum();
}
+void MEDFileUMeshSplitL1::setNameArr(DataArrayAsciiChar *nameArr)
+{
+ if(!nameArr)
+ {
+ _names=0;
+ return ;
+ }
+ MEDCouplingUMesh *mbt(_m_by_types);
+ if(!mbt)
+ throw INTERP_KERNEL::Exception("MEDFileUMeshSplitL1::setNameArr : no mesh defined on this level !");
+ nameArr->checkNbOfTuplesAndComp(mbt->getNumberOfCells(),MED_SNAME_SIZE,"MEDFileUMeshSplitL1::setNameArr : Problem in size of name arr ! ");
+ nameArr->incrRef();
+ _names=nameArr;
+}
+
MEDCouplingUMesh *MEDFileUMeshSplitL1::Renumber2(const DataArrayInt *renum, MEDCouplingUMesh *m, const int *cellIds)
{
if(renum==0)
const std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> >& getLev(int levId) const { return _per_type_mesh[levId]; }
bool isFamDefinedOnLev(int levId) const;
bool isNumDefinedOnLev(int levId) const;
+ bool isNamesDefinedOnLev(int levId) const;
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> getCoords() const { return _coords; }
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> getCoordsFamily() const { return _fam_coords; }
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> getCoordsNum() const { return _num_coords; }
- static void WriteCoords(med_idt fid, const char *mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> getCoordsName() const { return _name_coords; }
+ static void WriteCoords(med_idt fid, const char *mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords);
private:
void sortTypes();
private:
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> _coords;
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam_coords;
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num_coords;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> _name_coords;
};
class MEDFileStrMeshL2 : public MEDFileMeshL2
DataArrayInt *getOrCreateAndGetFamilyField() throw(INTERP_KERNEL::Exception);
const DataArrayInt *getFamilyField() const;
const DataArrayInt *getNumberField() const;
+ const DataArrayAsciiChar *getNameField() const;
const DataArrayInt *getRevNumberField() const;
void eraseFamilyField();
void setGroupsFromScratch(const std::vector<const MEDCouplingUMesh *>& ms, std::map<std::string,int>& familyIds,
//
void setFamilyArr(DataArrayInt *famArr);
void setRenumArr(DataArrayInt *renumArr);
+ void setNameArr(DataArrayAsciiChar *nameArr);
void changeFamilyIdArr(int oldId, int newId) throw(INTERP_KERNEL::Exception);
//
void renumberNodesInConn(const int *newNodeNumbersO2N) throw(INTERP_KERNEL::Exception);
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> _m_by_types;
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam;
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> _names;
mutable MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _rev_num;
MEDFileUMeshPermCompute _m;
};
virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const throw(INTERP_KERNEL::Exception);
virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
+ virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception);
virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
tmp->incrRef();
return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
+
+ PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
+ {
+ const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
+ if(tmp)
+ tmp->incrRef();
+ return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
+ }
PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created) throw(INTERP_KERNEL::Exception)
{
self.assertEqual(2,data2.getNumberOfParams())
self.assertAlmostEqual(data2.getParams()["B"][1,2].getValue(),567.89,13)
pass
+
+ def testNamesOnCellAndNodesInMeshes1(self):
+ fname="Pyfile58.med"
+ fname2="Pyfile59.med"
+ m=MEDLoaderDataForTest.build3DSurfMesh_1()
+ m1=m.buildDescendingConnectivity()[0]
+ m1.sortCellsInMEDFileFrmt()
+ #
+ mm=MEDFileUMesh()
+ mm.setMeshAtLevel(0,m)
+ mm.setMeshAtLevel(-1,m1)
+ namesCellL0=DataArrayAsciiChar(6,16)
+ namesCellL0[:]=["CellL0#%.3d "%(i) for i in xrange(6)]
+ mm.setNameFieldAtLevel(0,namesCellL0)
+ namesCellL1=DataArrayAsciiChar.Aggregate([namesCellL0,namesCellL0,namesCellL0.substr(2)])
+ namesCellL1[:]=["CellLM1#%.3d "%(i) for i in xrange(16)]
+ mm.setNameFieldAtLevel(-1,namesCellL1)
+ namesNodes=namesCellL1.substr(4,16)
+ namesNodes[:]=["Node#%.3d "%(i) for i in xrange(12)]
+ mm.setNameFieldAtLevel(1,namesNodes)
+ mm.write(fname,2)
+ #
+ mmr=MEDFileMesh.New(fname)
+ self.assertTrue(mm.getNameFieldAtLevel(0).isEqual(DataArrayAsciiChar(["CellL0#%.3d "%(i) for i in xrange(6)])))
+ self.assertTrue(mm.getNameFieldAtLevel(-1).isEqual(DataArrayAsciiChar(["CellLM1#%.3d "%(i) for i in xrange(16)])))
+ self.assertTrue(mm.getNameFieldAtLevel(1).isEqual(DataArrayAsciiChar(["Node#%.3d "%(i) for i in xrange(12)])))
+ self.assertTrue(mm.isEqual(mmr,1e-12)[0])
+ mmr.getNameFieldAtLevel(1).setIJ(0,0,'M')
+ self.assertTrue(not mm.isEqual(mmr,1e-12)[0])
+ mmr.getNameFieldAtLevel(1).setIJ(0,0,'N')
+ self.assertTrue(mm.isEqual(mmr,1e-12)[0])
+ mmCpy=mm.deepCpy()
+ self.assertTrue(mm.isEqual(mmCpy,1e-12)[0])
+ #
+ c=MEDCouplingCMesh()
+ arr=DataArrayDouble([0.,1.1,2.3])
+ c.setCoords(arr,arr)
+ c.setName("cmesh")
+ cc=MEDFileCMesh()
+ cc.setMesh(c)
+ cc.setNameFieldAtLevel(0,DataArrayAsciiChar(["Cell#%.3d "%(i) for i in xrange(4)]))
+ cc.setNameFieldAtLevel(1,DataArrayAsciiChar(["Node#%.3d "%(i) for i in xrange(9)]))
+ cc.write(fname2,2)
+ ccr=MEDFileMesh.New(fname2)
+ self.assertTrue(ccr.getNameFieldAtLevel(0).isEqual(DataArrayAsciiChar(["Cell#%.3d "%(i) for i in xrange(4)])))
+ self.assertTrue(ccr.getNameFieldAtLevel(1).isEqual(DataArrayAsciiChar(["Node#%.3d "%(i) for i in xrange(9)])))
+ self.assertTrue(cc.isEqual(ccr,1e-12)[0])
+ ccr.getNameFieldAtLevel(1).setIJ(0,0,'M')
+ self.assertTrue(not cc.isEqual(ccr,1e-12)[0])
+ ccr.getNameFieldAtLevel(1).setIJ(0,0,'N')
+ self.assertTrue(cc.isEqual(ccr,1e-12)[0])
+ ccCpy=cc.deepCpy()
+ self.assertTrue(cc.isEqual(ccCpy,1e-12)[0])
+ pass
pass
unittest.main()