#include <algorithm>
#include <numeric>
-med_geometry_type typmai[MED_NOF_CELL_PREDEFINED_TYPES+2] = { MED_POINT1,
- MED_SEG2,
- MED_SEG3,
- MED_TRIA3,
- MED_TRIA6,
- MED_QUAD4,
- MED_QUAD8,
- MED_TETRA4,
- MED_TETRA10,
- MED_HEXA8,
- MED_HEXA20,
- MED_PENTA6,
- MED_PENTA15,
- MED_PYRA5,
- MED_PYRA13,
- MED_POLYGON,
- MED_POLYHEDRON };
+med_geometry_type typmai[MED_N_CELL_FIXED_GEO] = { MED_POINT1,
+ MED_SEG2,
+ MED_SEG3,
+ MED_SEG4,
+ MED_TRIA3,
+ MED_TRIA6,
+ MED_TRIA7,
+ MED_QUAD4,
+ MED_QUAD8,
+ MED_QUAD9,
+ MED_TETRA4,
+ MED_TETRA10,
+ MED_HEXA8,
+ MED_HEXA20,
+ MED_HEXA27,
+ MED_PENTA6,
+ MED_PENTA15,
+ MED_PYRA5,
+ MED_PYRA13,
+ MED_OCTA12,
+ MED_POLYGON,
+ MED_POLYHEDRON };
med_geometry_type typmainoeud[1] = { MED_NONE };
-INTERP_KERNEL::NormalizedCellType typmai2[MED_NOF_CELL_PREDEFINED_TYPES+2] = { INTERP_KERNEL::NORM_POINT0,
- INTERP_KERNEL::NORM_SEG2,
- INTERP_KERNEL::NORM_SEG3,
- INTERP_KERNEL::NORM_TRI3,
- INTERP_KERNEL::NORM_TRI6,
- INTERP_KERNEL::NORM_QUAD4,
- INTERP_KERNEL::NORM_QUAD8,
- INTERP_KERNEL::NORM_TETRA4,
- INTERP_KERNEL::NORM_TETRA10,
- INTERP_KERNEL::NORM_HEXA8,
- INTERP_KERNEL::NORM_HEXA20,
- INTERP_KERNEL::NORM_PENTA6,
- INTERP_KERNEL::NORM_PENTA15,
- INTERP_KERNEL::NORM_PYRA5,
- INTERP_KERNEL::NORM_PYRA13,
- INTERP_KERNEL::NORM_POLYGON,
- INTERP_KERNEL::NORM_POLYHED };
+INTERP_KERNEL::NormalizedCellType typmai2[MED_N_CELL_FIXED_GEO] = { INTERP_KERNEL::NORM_POINT0,
+ INTERP_KERNEL::NORM_SEG2,
+ INTERP_KERNEL::NORM_SEG3,
+ INTERP_KERNEL::NORM_ERROR,//SEG4
+ INTERP_KERNEL::NORM_TRI3,
+ INTERP_KERNEL::NORM_TRI6,
+ INTERP_KERNEL::NORM_ERROR,//TRI7
+ INTERP_KERNEL::NORM_QUAD4,
+ INTERP_KERNEL::NORM_QUAD8,
+ INTERP_KERNEL::NORM_ERROR,//QUAD9
+ INTERP_KERNEL::NORM_TETRA4,
+ INTERP_KERNEL::NORM_TETRA10,
+ INTERP_KERNEL::NORM_HEXA8,
+ INTERP_KERNEL::NORM_HEXA20,
+ INTERP_KERNEL::NORM_ERROR,//HEXA27
+ INTERP_KERNEL::NORM_PENTA6,
+ INTERP_KERNEL::NORM_PENTA15,
+ INTERP_KERNEL::NORM_PYRA5,
+ INTERP_KERNEL::NORM_PYRA13,
+ INTERP_KERNEL::NORM_ERROR,//OCTA12
+ INTERP_KERNEL::NORM_POLYGON,
+ INTERP_KERNEL::NORM_POLYHED };
med_geometry_type typmai3[32] = { MED_POINT1,//0
MED_SEG2,//1
med_int spaceDim;
for(;idLoc<=nloc;idLoc++)
{
- MEDlocalizationInfo(fid,idLoc,locName,&typeGeo,&spaceDim,&nbOfGaussPt);
+ char geointerpname[MED_NAME_SIZE+1]="";
+ char ipointstructmeshname[MED_NAME_SIZE+1]="";
+ med_int nsectionmeshcell;
+ med_geometry_type sectiongeotype;
+ MEDlocalizationInfo(fid,idLoc,locName,&typeGeo,&spaceDim,&nbOfGaussPt, geointerpname, ipointstructmeshname, &nsectionmeshcell,
+ §iongeotype);
if(loc==locName)
break;
}
}
}
bool found=false;
- for(int j=0;j<MED_NBR_GEOMETRIE_MAILLE+2 && !found;j++)
+ for(int j=0;j<MED_N_CELL_FIXED_GEO && !found;j++)
{
if(nbPdt>0)
{
}
}
//
- for(int j=0;j<MED_NBR_GEOMETRIE_MAILLE+2 && !found;j++)
+ for(int j=0;j<MED_N_CELL_FIXED_GEO && !found;j++)
{
if(nbPdt>0)
{
if(curMeshName==meshName)
{
bool found=false;
- for(int j=0;j<MED_NBR_GEOMETRIE_MAILLE+2 && !found;j++)
+ for(int j=0;j<MED_N_CELL_FIXED_GEO && !found;j++)
{
if(nbPdt>0)
{
if(curFieldName==fieldName)
{
bool found=false;
- for(int j=0;j<MED_NBR_GEOMETRIE_MAILLE+2 && !found;j++)
+ for(int j=0;j<MED_N_CELL_FIXED_GEO && !found;j++)
{
for(int k=0;k<nbPdt;k++)
{
med_bool localmesh;
tabEnt[ON_CELLS]=MED_CELL;
tabType[ON_CELLS]=typmai;
- tabTypeLgth[ON_CELLS]=MED_NBR_GEOMETRIE_MAILLE+2;
+ tabTypeLgth[ON_CELLS]=MED_N_CELL_FIXED_GEO;
tabEnt[ON_NODES]=MED_NODE;
tabType[ON_NODES]=typmainoeud;
tabTypeLgth[ON_NODES]=1;
tabEnt[ON_GAUSS_PT]=MED_CELL;
tabType[ON_GAUSS_PT]=typmai;
- tabTypeLgth[ON_GAUSS_PT]=MED_NBR_GEOMETRIE_MAILLE+2;
+ tabTypeLgth[ON_GAUSS_PT]=MED_N_CELL_FIXED_GEO;
tabEnt[ON_GAUSS_NE]=MED_NODE_ELEMENT;
tabType[ON_GAUSS_NE]=typmai;
- tabTypeLgth[ON_GAUSS_NE]=MED_NBR_GEOMETRIE_MAILLE+2;
+ tabTypeLgth[ON_GAUSS_NE]=MED_N_CELL_FIXED_GEO;
//
for(int i=0;i<nbFields;i++)
{
delete [] dt_unit;
delete [] axisname;
delete [] axisunit;
- for(int i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
+ for(int i=0;i<MED_N_CELL_GEO_FIXED_CON;i++)
{
med_geometry_type curMedType=typmai[i];
med_bool changement,transformation;
}
delete [] comp;
delete [] unit;
- for(int i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
+ for(int i=0;i<MED_N_CELL_GEO_FIXED_CON;i++)
{
med_geometry_type curMedType=typmai[i];
med_entity_type whichEntity;
int *globArr=new int[curNbOfPolyElem];
MEDLoader::MEDConnOfOneElemType elem(INTERP_KERNEL::NORM_POLYGON,locConn,index,fam,curNbOfPolyElem,arraySize);
MEDmeshPolygonRd(fid,nommaa,numdt,numit,MED_CELL,MED_NODAL,index,locConn);
- if(MEDmeshEntityFamilyNumberRd(fid,nommaa,numdt,numit,whichPolyEntity,MED_POLYGON,fam)!=0)
- std::fill(fam,fam+curNbOfPolyElem,0);
- if(MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,whichPolyEntity,MED_POLYGON,globArr)==0)
- elem.setGlobal(globArr);
+ if(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,MED_POLYGON,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
+ {
+ if(MEDmeshEntityFamilyNumberRd(fid,nommaa,numdt,numit,MED_CELL,MED_POLYGON,fam)!=0)
+ std::fill(fam,fam+curNbOfPolyElem,0);
+ }
+ if(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,MED_POLYGON,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
+ {
+ if(MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,whichPolyEntity,MED_POLYGON,globArr)==0)
+ elem.setGlobal(globArr);
+ else
+ delete [] globArr;
+ }
else
delete [] globArr;
conn.push_back(elem);
int *fam=new int[curNbOfPolyElem];
int *globArr=new int[curNbOfPolyElem];
MEDmeshPolyhedronRd(fid,nommaa,numdt,numit,MED_CELL,MED_NODAL,index,indexFace,locConn);
- if(MEDmeshnEntity(fid,nommaa,numdt,numit,whichPolyEntity,MED_POLYHEDRON,MED_FAMILY_NUMBER,MED_NO_CMODE,&changement,&transformation)==0)
+ if(MEDmeshnEntity(fid,nommaa,numdt,numit,whichPolyEntity,MED_POLYHEDRON,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)==0)
//if(MEDmeshEntityFamilyNumberRd(fid,nommaa,numdt,numit,whichPolyEntity,MED_POLYHEDRON,fam)!=0)
std::fill(fam,fam+curNbOfPolyElem,0);
else
delete [] locConn;
delete [] indexFace;
MEDLoader::MEDConnOfOneElemType elem(INTERP_KERNEL::NORM_POLYHED,finalConn,finalIndex,fam,curNbOfPolyElem,arraySize);
- if(MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,whichPolyEntity,MED_POLYHEDRON,globArr)==0)
- elem.setGlobal(globArr);
+ if(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,MED_POLYHEDRON,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
+ {
+ if(MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,whichPolyEntity,MED_POLYHEDRON,globArr)==0)
+ elem.setGlobal(globArr);
+ else
+ delete [] globArr;
+ }
else
delete [] globArr;
conn.push_back(elem);
std::set<INTERP_KERNEL::NormalizedCellType> allTypes;
for(std::vector<const ParaMEDMEM::MEDCouplingUMesh *>::const_iterator iter=mesh.begin();iter!=mesh.end();iter++)
{
- isRenumbering|=!(*iter)->checkConsecutiveCellTypesAndOrder(typmai2,typmai2+MED_NBR_GEOMETRIE_MAILLE+2);
+ isRenumbering|=!(*iter)->checkConsecutiveCellTypesAndOrder(typmai2,typmai2+MED_N_CELL_FIXED_GEO);
isFamilies&=(families[std::distance(mesh.begin(),iter)]!=0);
conn.push_back((*iter)->getNodalConnectivity());
connIndex.push_back((*iter)->getNodalConnectivityIndex());
MEDmeshCr(fid,maa,spaceDim,meshDim,MED_UNSTRUCTURED_MESH,desc,"",MED_SORT_DTIT,MED_CARTESIAN,comp,unit);
for(std::vector<const ParaMEDMEM::MEDCouplingUMesh *>::const_iterator iter=mesh.begin();iter!=mesh.end();iter++)
{
- for(int i=0;i<MED_NBR_GEOMETRIE_MAILLE+2;i++)
+ for(int i=0;i<MED_N_CELL_FIXED_GEO;i++)
{
med_geometry_type curMedType=typmai[i];
INTERP_KERNEL::NormalizedCellType curType=typmai2[i];
const MEDCouplingUMesh *meshC=dynamic_cast<const MEDCouplingUMesh *>(mesh);
if(!meshC)
throw INTERP_KERNEL::Exception("Not implemented yet for not unstructured mesh !");
- bool renum=!meshC->checkConsecutiveCellTypesAndOrder(typmai2,typmai2+MED_NBR_GEOMETRIE_MAILLE+2);
+ bool renum=!meshC->checkConsecutiveCellTypesAndOrder(typmai2,typmai2+MED_N_CELL_FIXED_GEO);
if(renum)
{
ParaMEDMEM::MEDCouplingFieldDouble *f3=f2->clone(true);
- DataArrayInt *da=meshC->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_NBR_GEOMETRIE_MAILLE+2);
+ DataArrayInt *da=meshC->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_N_CELL_FIXED_GEO);
f3->renumberCells(da->getConstPointer(),false);
da->decrRef();
f=f3;
int id=f->getGaussLocalizationIdOfOneType((*iter).getType());
const MEDCouplingGaussLocalization& gl=f->getGaussLocalization(id);
MEDlocalizationWr(fid,nomGauss,typmai3[(int)(*iter).getType()],mesh->getMeshDimension(),&gl.getRefCoords()[0],MED_FULL_INTERLACE,
- gl.getNumberOfGaussPt(),&gl.getGaussCoords()[0],&gl.getWeights()[0]);
+ gl.getNumberOfGaussPt(),&gl.getGaussCoords()[0],&gl.getWeights()[0],MED_NO_INTERPOLATION, MED_NO_MESH_SUPPORT);
int nbOfEntity=f->getMesh()->getNumberOfCellsWithType((*iter).getType());
int nbOfValues=gl.getNumberOfGaussPt()*nbOfEntity;
char *fieldname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
const MEDCouplingUMesh *meshC=dynamic_cast<const MEDCouplingUMesh *>(mesh);
if(!meshC)
throw INTERP_KERNEL::Exception("Not implemented yet for not unstructured mesh !");
- if(!meshC->checkConsecutiveCellTypesAndOrder(typmai2,typmai2+MED_NBR_GEOMETRIE_MAILLE+2))
+ if(!meshC->checkConsecutiveCellTypesAndOrder(typmai2,typmai2+MED_N_CELL_FIXED_GEO))
throw INTERP_KERNEL::Exception("Unstructuded mesh has not consecutive cell types !");
const int *connI=meshC->getNodalConnectivityIndex()->getConstPointer();
const int *conn=meshC->getNodalConnectivity()->getConstPointer();
if(isRenumbering)
{
ParaMEDMEM::MEDCouplingFieldDouble *f2=f->clone(true);
- DataArrayInt *da=mesh->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_NBR_GEOMETRIE_MAILLE+2);
+ DataArrayInt *da=mesh->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_N_CELL_FIXED_GEO);
f2->renumberCells(da->getConstPointer(),false);
da->decrRef();
appendFieldDirectly(fileName,f2);