-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldFloat.hxx"
-#include "MEDCouplingFieldInt.hxx"
+#include "MEDCouplingFieldInt32.hxx"
#include "MEDCouplingGaussLocalization.hxx"
#include "MEDCouplingTraits.hxx"
#include "MCAuto.hxx"
#include <numeric>
#include <iterator>
#include <algorithm>
-
+#include <memory>
med_geometry_type typmai[MED_N_CELL_FIXED_GEO] = { MED_POINT1,
MED_SEG2,
INTERP_KERNEL::NORM_QPOLYG,
INTERP_KERNEL::NORM_POLYHED };
-med_geometry_type typmai3[34] = { MED_POINT1,//0
+med_geometry_type typmai3[INTERP_KERNEL::NORM_MAXTYPE] = { MED_POINT1,//0
MED_SEG2,//1
MED_SEG3,//2
MED_TRIA3,//3
MED_NONE,//29
MED_HEXA20,//30
MED_POLYHEDRON,//31
- MED_POLYGON2,//32
- MED_NONE//33
+ MED_POLYGON2//32
};
double _EPS_FOR_NODE_COMP=1.e-12;
/// @cond INTERNAL
+INTERP_KERNEL::NormalizedCellType ConvertGeometryType(med_geometry_type geotype)
+{
+ INTERP_KERNEL::NormalizedCellType result=INTERP_KERNEL::NORM_ERROR;
+ for(int i=0; i<MED_N_CELL_FIXED_GEO; i++)
+ {
+ if (typmai[i]==geotype)
+ {
+ result=typmai2[i];
+ break;
+ }
+ }
+ return result;
+}
+
/*!
* This method returns a first quick overview of mesh with name \a meshName into the file \a fileName.
* @param possibilities the relativeToMeshDim authorized to returned maxdim. This vector is systematically cleared at the begin of this method.
med_mesh_type type_maillage;
med_int Sdim,Mdim;
std::string trueMeshName;
- med_int meshId=getIdFromMeshName(fid,meshName,trueMeshName);
+ int meshId=FromMedInt<int>(getIdFromMeshName(fid,meshName,trueMeshName));
INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
med_sorting_type sortingType;
med_int nstep;
med_axis_type axisType;
- int naxis(MEDmeshnAxis(fid,meshId));
+ med_int naxis(MEDmeshnAxis(fid,meshId));
INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&Sdim,&Mdim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit));
{
med_geometry_type curMedType=typmai[i];
med_bool changement,transformation;
- int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
- int curNbOfElemF(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));//limitation
- int curNbOfElem;
+ med_int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+ med_int curNbOfElemF(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));//limitation
+ med_int curNbOfElem;
med_entity_type whichEntity;
MEDLoaderNS::dispatchElems(curNbOfElemM,curNbOfElemF,curNbOfElem,whichEntity);
if(curNbOfElem>0)
return ret;
}
-med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName)
- {
+int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName)
+{
if(meshName.empty())
{
std::vector<std::string> meshes=getMeshNamesFid(fid);
throw INTERP_KERNEL::Exception(os2.str().c_str());
}
trueMeshName=meshName;
- return iter-meshes.begin()+1;
- }
+ return (int)( iter-meshes.begin()+1 );
+}
std::vector<std::string> MEDLoaderNS::getMeshNamesFid(med_idt fid)
{
std::vector<std::string> ret(n);
for(int i=0;i<n;i++)
{
- int naxis(MEDmeshnAxis(fid,i+1));
+ med_int naxis(MEDmeshnAxis(fid,i+1));
INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
- int nstep;
+ med_int nstep;
MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,i+1,nommaa,&space_dim,&mesh_dim,&type_maillage,maillage_description,dtunit,&stype,&nstep,&axistype,axisname,axisunit));
std::string cur=MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa));
ret[i]=cur;
/*!
* This methods allows to merger all entities and to considerate only cell types.
*/
-void MEDLoaderNS::dispatchElems(int nbOfElemCell, int nbOfElemFace, int& nbOfElem, med_entity_type& whichEntity)
+void MEDLoaderNS::dispatchElems(med_int nbOfElemCell, med_int nbOfElemFace, med_int& nbOfElem, med_entity_type& whichEntity)
{
if(nbOfElemCell>=nbOfElemFace)
{
med_err ret(MEDlibraryNumVersion(&majj,&minn,&rell));
if(ret!=0)
throw INTERP_KERNEL::Exception("MEDFileVersion : fail to call MEDlibraryNumVersion ! It looks very bad !");
- major=majj;
- minor=minn;
- release=rell;
+ major=FromMedInt<int>(majj);
+ minor=FromMedInt<int>(minn);
+ release=FromMedInt<int>(rell);
}
/*!
* - the space dimension
* - the number of nodes
*/
-std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > MEDCoupling::GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes)
+std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > MEDCoupling::GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, mcIdType& numberOfNodes)
{
MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
std::set<int> poss;
char maillage_description[MED_COMMENT_SIZE+1];
med_mesh_type type_maillage;
std::string trueMeshName;
- med_int meshId=MEDLoaderNS::getIdFromMeshName(fid,meshName,trueMeshName);
+ int meshId=MEDLoaderNS::getIdFromMeshName(fid,meshName,trueMeshName);
INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
med_sorting_type sortingType;
- med_int nstep;
+ med_int nstep, mDim, sDim;
med_axis_type axisType;
- int naxis(MEDmeshnAxis(fid,meshId));
+ med_int naxis(MEDmeshnAxis(fid,meshId));
INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
- MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&spaceDim,&meshDim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit));
+ MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&sDim,&mDim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit));
+ meshDim=FromMedInt<int>(mDim);
+ spaceDim=FromMedInt<int>(sDim);
if(type_maillage!=MED_UNSTRUCTURED_MESH)
{
std::ostringstream oss; oss << "GetUMeshGlobalInfo : Mesh \""<< meshName << "\" in file \"" << fileName;
for(int i=0;i<MED_N_CELL_FIXED_GEO;i++)
{
med_geometry_type curMedType=typmai[i];
- int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+ med_int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
if(curNbOfElemM>0)
{
INTERP_KERNEL::NormalizedCellType typp=typmai2[i];
{
ret[maxLev-dims[i]].push_back(geoTypes[i]);
}
- numberOfNodes=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation);
+ numberOfNodes=ToIdType(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
return ret;
}
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
+// see reference : https://en.cppreference.com/w/cpp/iterator/iterator
+class MEDVectorStringIterator : public std::iterator< std::input_iterator_tag, long, long, const std::string*, std::string >
+{
+ long _num = 0;
+ char *_data = nullptr;
+public:
+ explicit MEDVectorStringIterator(long num , char *data) : _num(num),_data(data) {}
+ MEDVectorStringIterator& operator++() { ++_num; return *this;}
+ bool operator==(const MEDVectorStringIterator& other) const {return _num == other._num;}
+ bool operator!=(const MEDVectorStringIterator& other) const {return !(*this == other);}
+ reference operator*() const {return MEDLoaderBase::buildStringFromFortran(_data+_num*MED_LNAME_SIZE,MED_LNAME_SIZE);}
+};
+
+void MEDCoupling::GetFamiliesGroupsInfo(const std::string& fileName, const std::string& meshName, std::map<std::string,mcIdType>& families, std::map<std::string,std::vector<std::string>>& groupsOnFam)
+{
+ MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName));
+ med_int nbFams(MEDnFamily(fid,meshName.c_str()));
+ char nomfam[MED_NAME_SIZE+1];
+ for(med_int i=0;i<nbFams;++i)
+ {
+ med_int nbGrps(MEDnFamilyGroup(fid,meshName.c_str(),i+1)),famId;
+ std::unique_ptr<char[]> gro{new char[MED_LNAME_SIZE*nbGrps+1]};
+ MEDFILESAFECALLERRD0(MEDfamilyInfo,(fid,meshName.c_str(),i+1,nomfam,&famId,gro.get()));
+ std::string fam(MEDLoaderBase::buildStringFromFortran(nomfam,MED_NAME_SIZE));
+ families[fam] = FromMedInt<mcIdType>(famId);
+ std::vector<std::string> v(nbGrps);
+ std::copy(MEDVectorStringIterator(0,gro.get()),MEDVectorStringIterator(nbGrps,gro.get()),v.begin());
+ groupsOnFam[fam] = v;
+ }
+}
+
std::vector<std::string> MEDCoupling::GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName)
{
std::vector<std::string> ret;
med_int numfam;
for(int i=0;i<nfam;i++)
{
- int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
med_int numfam;
for(int i=0;i<nfam;i++)
{
- int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
bool found=false;
for(int i=0;i<nfam && !found;i++)
{
- int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
med_int numfam;
for(int i=0;i<nfam;i++)
{
- int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
- int profilesize,nbi;
+ med_int profilesize,nbi;
if(curMeshName==meshName)
{
bool found=false;
std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
if(nbPdt>0)
{
- int profilesize,nbi;
+ med_int profilesize,nbi;
MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,1,&numdt,&numo,&dt));
med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
pflname,&profilesize,locname,&nbi));
{
for(int k=0;k<nbPdt;k++)
{
- int profilesize,nbi;
+ med_int profilesize,nbi;
MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,k+1,&numdt,&numo,&dt));
med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
pflname,&profilesize,locname,&nbi));
{
for(int k=0;k<nbPdt;k++)
{
- int profilesize,nbi;
+ med_int profilesize,nbi;
MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,k+1,&numdt,&numo,&dt));
med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
pflname,&profilesize,locname,&nbi));
}
}
{
- MCAuto<MEDFileIntField1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileIntField1TS>(f));
+ MCAuto<MEDFileInt32Field1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileInt32Field1TS>(f));
if(f1.isNotNull())
{
- MCAuto<MEDCoupling::MEDCouplingFieldInt> ret(f1->field(mesh));
- return MEDCoupling::DynamicCast<MEDCouplingFieldInt,MEDCouplingField>(ret);
+ MCAuto<MEDCoupling::MEDCouplingFieldInt32> ret(f1->field(mesh));
+ return MEDCoupling::DynamicCast<MEDCouplingFieldInt32,MEDCouplingField>(ret);
}
}
{
if(!mmuPtr)
throw INTERP_KERNEL::Exception("ReadFieldsOnSameMesh : only unstructured mesh is managed !");
MCAuto<MEDCouplingUMesh> m=mmuPtr->getMeshAtLevel(meshDimRelToMax);
- const DataArrayInt *o2n=mmuPtr->getNumberFieldAtLevel(meshDimRelToMax);
+ const DataArrayIdType *o2n=mmuPtr->getNumberFieldAtLevel(meshDimRelToMax);
MCAuto<MEDCouplingUMesh> m2(m->clone(true));
if(o2n)
m2->renumberCells(o2n->begin(),true);
MCAuto<typename Traits<T>::FieldType> ret(ff->getFieldOnMeshAtLevel(type,m));
if(muPtr.isNotNull())
{
- const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
+ const DataArrayIdType *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
if(num)
ret->renumberCells(num->begin());
}
}
}
{
- MCAuto<MEDFileIntField1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileIntField1TS>(f));
+ MCAuto<MEDFileInt32Field1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileInt32Field1TS>(f));
if(f1.isNotNull())
{
- MCAuto<MEDCoupling::MEDCouplingFieldInt> ret(ReadFieldCellLikeT<int>(f1,type,fileName,meshName,meshDimRelToMax,fieldName,iteration,order));
+ MCAuto<MEDCoupling::MEDCouplingFieldInt32> ret(ReadFieldCellLikeT<int>(f1,type,fileName,meshName,meshDimRelToMax,fieldName,iteration,order));
return ret.retn();
}
}
{
if(muPtr.isNotNull())
{
- const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
+ const DataArrayIdType *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
if(num)
ret->renumberCells(num->begin());
}
}
else
{
- DataArrayInt *pfl(nullptr),*arr2(nullptr);
+ DataArrayIdType *pfl(nullptr),*arr2(nullptr);
MCAuto<typename Traits<T>::ArrayType> arr(ff->getFieldWithProfile(ON_NODES,meshDimRelToMax,mm,pfl));
- MCAuto<DataArrayInt> pflSafe(pfl);
- MCAuto<DataArrayInt> mp(m->getCellIdsFullyIncludedInNodeIds(pfl->begin(),pfl->end()));
+ MCAuto<DataArrayIdType> pflSafe(pfl);
+ MCAuto<DataArrayIdType> mp(m->getCellIdsFullyIncludedInNodeIds(pfl->begin(),pfl->end()));
MCAuto<MEDCouplingUMesh> mzip(static_cast<MEDCouplingUMesh *>(m->buildPartAndReduceNodes(mp->begin(),mp->end(),arr2)));
- MCAuto<DataArrayInt> arr2Safe(arr2);
- MCAuto<DataArrayInt> arr3(arr2->invertArrayO2N2N2O(mzip->getNumberOfNodes()));
- MCAuto<DataArrayInt> pflSorted(pflSafe->deepCopy()); pflSorted->sort(true);
+ MCAuto<DataArrayIdType> arr2Safe(arr2);
+ MCAuto<DataArrayIdType> arr3(arr2->invertArrayO2N2N2O(mzip->getNumberOfNodes()));
+ MCAuto<DataArrayIdType> pflSorted(pflSafe->deepCopy()); pflSorted->sort(true);
if(!arr3->isEqualWithoutConsideringStr(*pflSorted))
throw INTERP_KERNEL::Exception("ReadFieldNode : not implemented yet !");
if(!arr3->isEqualWithoutConsideringStr(*pflSafe))
{
- MCAuto<DataArrayInt> o2n2(pflSafe->checkAndPreparePermutation());
- MCAuto<DataArrayInt> n2o2(o2n2->invertArrayO2N2N2O(o2n2->getNumberOfTuples()));
+ MCAuto<DataArrayIdType> o2n2(pflSafe->checkAndPreparePermutation());
+ MCAuto<DataArrayIdType> n2o2(o2n2->invertArrayO2N2N2O(o2n2->getNumberOfTuples()));
mzip->renumberNodes(n2o2->begin(),n2o2->getNumberOfTuples());
arr->setName("");
ret->setArray(arr);
}
}
{
- MCAuto<MEDFileIntField1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileIntField1TS>(f));
+ MCAuto<MEDFileInt32Field1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileInt32Field1TS>(f));
if(f1.isNotNull())
{
- MCAuto<MEDCoupling::MEDCouplingFieldInt> ret(ReadFieldNodeT<int>(f1,fileName,meshName,meshDimRelToMax,fieldName,iteration,order));
+ MCAuto<MEDCoupling::MEDCouplingFieldInt32> ret(ReadFieldNodeT<int>(f1,fileName,meshName,meshDimRelToMax,fieldName,iteration,order));
return ret.retn();
}
}
{
MCAuto<MEDFileUMesh> mmu(MEDFileUMesh::New());
AssignStaticWritePropertiesTo(*mmu);
- MCAuto<DataArrayInt> o2n(um->getRenumArrForMEDFileFrmt());
- MCAuto<DataArrayInt> n2o(o2n->invertArrayO2N2N2O(o2n->getNumberOfTuples()));
+ MCAuto<DataArrayIdType> o2n(um->getRenumArrForMEDFileFrmt());
+ MCAuto<DataArrayIdType> n2o(o2n->invertArrayO2N2N2O(o2n->getNumberOfTuples()));
f2->renumberCells(o2n->begin(),false);
mmu->setMeshAtLevel(0,const_cast<MEDCouplingUMesh *>(static_cast<const MEDCouplingUMesh *>(f2->getMesh())));
mmu->setRenumFieldArr(0,n2o);
MEDCouplingUMesh *m(dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh())));
if(!m)
throw INTERP_KERNEL::Exception("WriteField : only umesh in input field supported !");
- MCAuto<DataArrayInt> o2n(m->getRenumArrForMEDFileFrmt());
+ MCAuto<DataArrayIdType> o2n(m->getRenumArrForMEDFileFrmt());
f2->renumberCells(o2n->begin(),false);
m=static_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh()));
MCAuto<MEDCouplingUMesh> mread(mmuPtr->getMeshAtLevel(m->getMeshDimension()-mm->getMeshDimension()));
if(f2->getTypeOfField()!=ON_NODES)
{
- m->tryToShareSameCoordsPermute(*mread,_EPS_FOR_NODE_COMP);
- DataArrayInt *part(NULL);
+ if(!m->getCoords()->isEqualWithoutConsideringStr(*mread->getCoords(),_EPS_FOR_NODE_COMP))
+ m->tryToShareSameCoordsPermute(*mread,_EPS_FOR_NODE_COMP);
+ else
+ mread->setCoords(m->getCoords());
+ DataArrayIdType *part(NULL);
bool b(mread->areCellsIncludedIn(m,_COMP_FOR_CELL,part));
- MCAuto<DataArrayInt> partSafe(part);
+ MCAuto<DataArrayIdType> partSafe(part);
if(!b)
{
std::ostringstream oss; oss << "WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart) with the mesh you intend to write ! This is maybe due to a too strict policy ! Try with to lease it by calling SetCompPolicyForCell !";
}
else
{
- DataArrayInt *part(NULL);
+ DataArrayIdType *part(NULL);
bool b(mread->getCoords()->areIncludedInMe(m->getCoords(),_EPS_FOR_NODE_COMP,part));
- MCAuto<DataArrayInt> partSafe(part);
+ MCAuto<DataArrayIdType> partSafe(part);
if(!b)
{
std::ostringstream oss; oss << "WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart regarding nodes) with the mesh you intend to write ! This is maybe due to a too strict epsilon ! Try with to lease it by calling SetEpsilonForNodeComp !";
}
}
{
- const MEDCoupling::MEDCouplingFieldInt *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldInt *>(f));
+ const MEDCoupling::MEDCouplingFieldInt32 *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldInt32 *>(f));
if(f1)
{
WriteFieldT<int>(fileName,f1,writeFromScratch);
MEDCouplingUMesh *m(dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f->getMesh())));
if(m)
{
- MCAuto<DataArrayInt> o2n(m->getRenumArrForMEDFileFrmt());
+ MCAuto<DataArrayIdType> o2n(m->getRenumArrForMEDFileFrmt());
MCAuto< typename MEDCoupling::Traits<T>::FieldType > f2(f->deepCopy());
f2->renumberCells(o2n->begin(),false);
f1ts->setFieldNoProfileSBT(f2);
return ;
}
{
- const MEDCoupling::MEDCouplingFieldInt *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldInt *>(f));
+ const MEDCoupling::MEDCouplingFieldInt32 *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldInt32 *>(f));
if(f1)
WriteFieldUsingAlreadyWrittenMeshT<int>(fileName,f1);
return ;