#define __MEDFILEBASIS_HXX__
#include "InterpKernelException.hxx"
+#include "MEDCouplingMemArray.hxx"
#include <string>
#include <vector>
+#include <med.h>
+
namespace MEDCoupling
{
class MEDFileString
};
}
+namespace MEDCoupling
+{
+
+ class DataArrayMedInt : public DataArrayDiscreteSigned< med_int >
+ {
+ friend class DataArrayDiscrete<med_int>;
+ public:
+ template<class INTARRAY>
+ static DataArrayMedInt *Copy( const INTARRAY* array );
+ static DataArrayMedInt *New() { return new DataArrayMedInt(); }
+ DataArrayMedInt *deepCopy() const { return new DataArrayMedInt(*this); }
+ //DataArrayMedInt *buildNewEmptyInstance() const { return new DataArrayMedInt(); }//ko
+ DataArray *buildNewEmptyInstance() const { if ( sizeof(med_int)==sizeof(long)) return DataArrayInt64::New(); return DataArrayInt32::New(); }
+ public:
+ DataArray *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); }
+ DataArray *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); }
+ DataArray *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleIdSafe(new2OldBg,new2OldEnd); }
+ DataArray *keepSelectedComponents(const std::vector<std::size_t>& compoIds) const { return this->myKeepSelectedComponents(compoIds); }
+ DataArray *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return this->mySelectByTupleIdSafeSlice(bg,end2,step); }
+ DataArray *selectByTupleRanges(const std::vector<std::pair<mcIdType,mcIdType> >& ranges) const { return this->mySelectByTupleRanges(ranges); }
+ private:
+ ~DataArrayMedInt() { }
+ DataArrayMedInt() { }
+ };
+
+ template< class T1, class T2 >
+ MCAuto<T1> StaticCast( const MCAuto< T2 >& array )
+ {
+ DataArray *src = const_cast< T2* >((const T2*) array );
+ T1* tgt = static_cast<T1*>( src );
+ if ( tgt )
+ tgt->incrRef();
+ return tgt;
+ }
+
+ template< class INTARRAY >
+ MCAuto<DataArrayMedInt> ToMedIntArray(const MCAuto<INTARRAY>& intArray )
+ {
+ if ( sizeof( med_int ) == sizeof( typename INTARRAY::Type ))
+ return StaticCast< DataArrayMedInt >( intArray );
+ return DataArrayMedInt::Copy((const INTARRAY*) intArray );
+ }
+
+ template< class INT >
+ MCAuto<DataArrayMedInt> ToMedIntArray(const typename MEDCoupling::Traits<INT>::ArrayType* intArray )
+ {
+ if ( sizeof( med_int ) == sizeof( INT ))
+ {
+ typedef typename MEDCoupling::Traits<INT>::ArrayType INTARRAY;
+ MCAuto< INTARRAY > ia = const_cast< INTARRAY* >( intArray );
+ ia->incrRef();
+ return StaticCast< DataArrayMedInt >( ia );
+ }
+ return DataArrayMedInt::Copy( intArray );
+ }
+
+ template< class INT >
+ MCAuto< typename MEDCoupling::Traits<INT>::ArrayType> FromMedIntArray(MCAuto<DataArrayMedInt>& medIntArray )
+ {
+ typedef typename MEDCoupling::Traits<INT>::ArrayType INTARRAY;
+ if ( sizeof( med_int ) == sizeof( INT ))
+ return StaticCast< INTARRAY >( medIntArray );
+
+ INTARRAY* intArray = INTARRAY::New();
+ intArray->alloc( medIntArray->getNumberOfTuples(), medIntArray->getNumberOfComponents() );
+ intArray->copyStringInfoFrom( * medIntArray.operator->() );
+ std::copy( medIntArray->begin(), medIntArray->end(), intArray->getPointer() );
+ return intArray;
+ }
+
+ template< class INT >
+ MCAuto<DataArrayMedInt> ToMedIntArray(const std::vector<INT>& intVec )
+ {
+ DataArrayMedInt* medIntArray = DataArrayMedInt::New();
+ if ( sizeof( med_int ) == sizeof( INT ))
+ {
+ medIntArray->useArray( reinterpret_cast<const med_int*>(intVec.data()), /*owner=*/false, DeallocType::CPP_DEALLOC, intVec.size(), /*nbComp=*/1 );
+ }
+ else
+ {
+ medIntArray->alloc( intVec.size(), 1 );
+ std::copy( intVec.begin(), intVec.end(), medIntArray->getPointer() );
+ }
+ return medIntArray;
+ }
+
+ template< class INT >
+ med_int ToMedInt( INT i )
+ {
+ return static_cast< med_int >( i );
+ }
+
+ template< class INT >
+ INT FromMedInt( med_int mi )
+ {
+ return static_cast< INT >( mi );
+ }
+
+ template<class INTARRAY>
+ DataArrayMedInt * DataArrayMedInt::Copy( const INTARRAY* intArray )
+ {
+ DataArrayMedInt* medIntArray = DataArrayMedInt::New();
+ medIntArray->alloc( intArray->getNumberOfTuples(), intArray->getNumberOfComponents() );
+ medIntArray->copyStringInfoFrom( *intArray );
+ std::copy( intArray->begin(), intArray->end(), medIntArray->getPointer() );
+ return medIntArray;
+ }
+}
+
#endif
const DataArrayDouble *coo(mesh->getCoords());
if(!coo)
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLInMesh : null coords !");
- MCAuto<DataArrayInt> conn(zeStr->getConn());
+ MCAuto<DataArrayIdType> conn(zeStr->getConn());
if(conn.isNull())
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLInMesh : null connectivity !");
conn->checkAllocated();
MCAuto<MEDCouplingUMesh> mcOut(MEDCouplingUMesh::Build0DMeshFromCoords(connOut));
mcOut->setName(BuildNewMeshName(mesh->getName(),MED_BALL_STR));
mOut->setMeshAtLevel(0,mcOut);
- const DataArrayInt *ff1(mesh->getFamilyFieldAtLevel(1));
+ const DataArrayIdType *ff1(mesh->getFamilyFieldAtLevel(1));
if(ff1)
{
- MCAuto<DataArrayInt> ff1o(ff1->selectByTupleIdSafe(conn->begin(),conn->end()));
+ MCAuto<DataArrayIdType> ff1o(ff1->selectByTupleIdSafe(conn->begin(),conn->end()));
mOut->setFamilyFieldArr(1,ff1o);
}
- const DataArrayInt *nf1(mesh->getNumberFieldAtLevel(1));
+ const DataArrayIdType *nf1(mesh->getNumberFieldAtLevel(1));
if(nf1)
{
- MCAuto<DataArrayInt> nf1o(nf1->selectByTupleIdSafe(conn->begin(),conn->end()));
+ MCAuto<DataArrayIdType> nf1o(nf1->selectByTupleIdSafe(conn->begin(),conn->end()));
mOut->setRenumFieldArr(1,nf1o);
}
MCAuto<MEDFileUMeshPerTypeCommon> md(zeStr->getMeshDef());
- const DataArrayInt *ff0(md->getFam());
+ const DataArrayIdType *ff0(md->getFam());
if(ff0)
- mOut->setFamilyFieldArr(0,const_cast<DataArrayInt *>(ff0));
- const DataArrayInt *nf0(md->getNum());
+ mOut->setFamilyFieldArr(0,const_cast<DataArrayIdType *>(ff0));
+ const DataArrayIdType *nf0(md->getNum());
if(nf0)
- mOut->setRenumFieldArr(0,const_cast<DataArrayInt *>(nf0));
+ mOut->setRenumFieldArr(0,const_cast<DataArrayIdType *>(nf0));
mOut->copyFamGrpMapsFrom(*mesh);
const std::vector< MCAuto<DataArray> >& vars(zeStr->getVars());
for(std::vector< MCAuto<DataArray> >::const_iterator it=vars.begin();it!=vars.end();it++)
std::vector<std::string> pfls(zeGuideForPfl->getPflsReallyUsed());
if(pfls.size()>=2)
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLSInFields : drink less coffee");
- MCAuto<DataArrayInt> pflMyLove;
+ MCAuto<DataArrayIdType> pflMyLove;
if(pfls.size()==1)
pflMyLove.takeRef(zeGuideForPfl->getProfile(pfls[0]));
// Yeah we have pfls
MCAuto<MEDCouplingUMesh> LocInfo::BuildMeshCommon(INTERP_KERNEL::NormalizedCellType gt, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs, MCAuto<DataArrayDouble>& ptsForLoc)
{
- MCAuto<DataArrayInt> conn(zeStr->getConn());
+ MCAuto<DataArrayIdType> conn(zeStr->getConn());
conn=conn->deepCopy(); conn->rearrange(1);
MCAuto<MEDCouplingUMesh> geoMesh;
{
//
if(!pfl.empty())
{
- const DataArrayInt *pflArr(globs->getProfile(pfl));
+ const DataArrayIdType *pflArr(globs->getProfile(pfl));
geoMesh=geoMesh->buildPartOfMySelf(pflArr->begin(),pflArr->end(),true);
}
//
MCConstAuto<DataArrayDouble> angleVrille;
if(!pfl.empty())
{
- const DataArrayInt *pflArr(globs->getProfile(pfl));
+ const DataArrayIdType *pflArr(globs->getProfile(pfl));
angleVrille=angleDeVrille->selectByTupleIdSafe(pflArr->begin(),pflArr->end());
}
else
int nbSecPts(secPts->getNumberOfTuples()),nbCells(geoMesh->getNumberOfCells()),nbg(loc.getGaussWeights().size());
{
const int TAB[3]={2,0,1};
- std::vector<int> v(TAB,TAB+3);
+ std::vector<std::size_t> v(TAB,TAB+3);
secPts=secPts->keepSelectedComponents(v);
}
const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.};
MCConstAuto<DataArrayDouble> zeThickness;
if(!pfl.empty())
{
- const DataArrayInt *pflArr(globs->getProfile(pfl));
+ const DataArrayIdType *pflArr(globs->getProfile(pfl));
zeThickness=thickness->selectByTupleIdSafe(pflArr->begin(),pflArr->end());
}
else
MCConstAuto<DataArrayDouble> zeAngle,zeScale;
if(!pfl.empty())
{
- const DataArrayInt *pflArr(globs->getProfile(pfl));
+ const DataArrayIdType *pflArr(globs->getProfile(pfl));
zeAngle=angle->selectByTupleIdSafe(pflArr->begin(),pflArr->end());
zeScale=scale->selectByTupleIdSafe(pflArr->begin(),pflArr->end());
}
MCAuto<DataArrayDouble> secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.));
{
const int TAB[3]={2,0,1};
- std::vector<int> v(TAB,TAB+3);
+ std::vector<std::size_t> v(TAB,TAB+3);
secPts=secPts->keepSelectedComponents(v);
}
const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.};
if(um->getNumberOfCells()!=1)
throw INTERP_KERNEL::Exception(MSG1);
gt=um->getTypeOfCell(0);
- std::vector<int> v;
+ std::vector<mcIdType> v;
um->getNodeIdsOfCell(0,v);
std::size_t sz2(v.size());
for(std::size_t j=0;j<sz2;j++)
- if(v[j]!=j)
+ if(v[j]!=ToIdType(j))
throw INTERP_KERNEL::Exception(MSG1);
}
const std::vector< MCAuto<MEDFileEltStruct4Mesh> >& strs(mesh->getAccessOfUndergroundEltStrs());
if(!ms)
return false;
std::vector< MEDFileMesh * > meshesImpacted;
- std::vector< DataArrayInt * > renumParamsOfMeshImpacted;//same size as meshesImpacted
- std::vector< std::vector<int> > oldCodeOfMeshImpacted,newCodeOfMeshImpacted;//same size as meshesImpacted
- std::vector<MCAuto<DataArrayInt> > memSaverIfThrow;//same size as meshesImpacted
+ std::vector< DataArrayIdType * > renumParamsOfMeshImpacted;//same size as meshesImpacted
+ std::vector< std::vector<mcIdType> > oldCodeOfMeshImpacted,newCodeOfMeshImpacted;//same size as meshesImpacted
+ std::vector<MCAuto<DataArrayIdType> > memSaverIfThrow;//same size as meshesImpacted
for(int i=0;i<ms->getNumberOfMeshes();i++)
{
MEDFileMesh *m=ms->getMeshAtPos(i);
if(m)
{
- std::vector<int> oldCode,newCode;
- DataArrayInt *o2nRenumCell=0;
+ std::vector<mcIdType> oldCode,newCode;
+ DataArrayIdType *o2nRenumCell=0;
bool modif=m->unPolyze(oldCode,newCode,o2nRenumCell);
if(!modif)
continue;
std::size_t sz(mfds.size()),i(0);
MCAuto<MEDFileData> ret(MEDFileData::New());
std::vector<const MEDFileUMesh *> ms(sz);
- std::vector< std::vector< std::pair<int,int> > > dts(sz);
+ std::vector< std::vector< std::pair<int,mcIdType> > > dts(sz);
for(std::vector<const MEDFileData *>::const_iterator it=mfds.begin();it!=mfds.end();it++,i++)
{
const MEDFileData *elt(*it);
#include "MEDFileEquivalence.hxx"
#include "MEDFileSafeCaller.txx"
#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingMemArray.txx"
#include "MEDLoaderBase.hxx"
#include "MEDFileMesh.hxx"
#include "InterpKernelAutoPtr.hxx"
//
std::vector<INTERP_KERNEL::NormalizedCellType> gts(mm->getGeoTypesAtLevel(meshDimRelToMax));
int startId(0),endId;
- std::vector<int> compS(1,0);
+ std::vector<std::size_t> compS(1,0);
for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator it=gts.begin();it!=gts.end();it++)
{
endId=startId+mm->getNumberOfCellsWithType(*it);
MCAuto<DataArrayInt> da0(da->keepSelectedComponents(compS));
- MCAuto<DataArrayInt> ids(da0->findIdsInRange(startId,endId));
+ MCAuto<DataArrayIdType> ids(da0->findIdsInRange(startId,endId));
MCAuto<DataArrayInt> da1(da->selectByTupleIdSafe(ids->begin(),ids->end()));
da1->applyLin(1,-startId);
setArrayForType(*it,da1);
void MEDFileFields::destroyFieldsAtPos2(int bg, int end, int step)
{
static const char msg[]="MEDFileFields::destroyFieldsAtPos2";
- int nbOfEntriesToKill(DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg));
+ int nbOfEntriesToKill(DataArrayIdType::GetNumberOfItemGivenBESRelative(bg,end,step,msg));
std::vector<bool> b(_fields.size(),true);
int k=bg;
for(int i=0;i<nbOfEntriesToKill;i++,k+=step)
* \return If true a renumbering has been performed. The structure in \a this has been modified. If false, nothing has been done: it is typically the case if \a meshName is not referred by any
* field in \a this.
*/
-bool MEDFileFields::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N)
+bool MEDFileFields::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N)
{
bool ret(false);
for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
*
* \return A new object that the caller is responsible to deallocate.
*/
-MEDFileFields *MEDFileFields::extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const
+MEDFileFields *MEDFileFields::extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const
{
if(!mm)
throw INTERP_KERNEL::Exception("MEDFileFields::extractPart : input mesh is NULL !");
{
public:
PFLData():_add_pts_in_pfl(0) { }
- PFLData(const MCAuto<DataArrayInt>& mat, const MCAuto<DataArrayInt>& pfl, int nbOfNewPts):_matrix(mat),_pfl(pfl),_add_pts_in_pfl(nbOfNewPts) { }
+ PFLData(const MCAuto<DataArrayIdType>& mat, const MCAuto<DataArrayIdType>& pfl, int nbOfNewPts):_matrix(mat),_pfl(pfl),_add_pts_in_pfl(nbOfNewPts) { }
std::string getPflName() const { if(_pfl.isNull()) { return std::string(); } else { return _pfl->getName(); } }
int getNbOfAddPtsInPfl() const { return _add_pts_in_pfl; }
- MCAuto<DataArrayInt> getProfile() const { return _pfl; }
- MCAuto<DataArrayInt> getMatrix() const { return _matrix; }
+ MCAuto<DataArrayIdType> getProfile() const { return _pfl; }
+ MCAuto<DataArrayIdType> getMatrix() const { return _matrix; }
private:
- MCAuto<DataArrayInt> _matrix;
- MCAuto<DataArrayInt> _pfl;
+ MCAuto<DataArrayIdType> _matrix;
+ MCAuto<DataArrayIdType> _pfl;
int _add_pts_in_pfl;
};
updateData(pmtdToModify,(*itCache).second.getNbOfAddPtsInPfl());
return ;
}
- MCAuto<DataArrayInt> pfl;
+ MCAuto<DataArrayIdType> pfl;
if(pflName.empty())
- pfl=DataArrayInt::Range(0,pmptpd->getNumberOfVals(),1);
+ pfl=DataArrayIdType::Range(0,pmptpd->getNumberOfVals(),1);
else
pfl=_lin_globs->getProfile(pflName)->deepCopy();
//
MCAuto<MEDCouplingUMesh> mesh3D(_lin->getMeshAtLevel(0)),mesh3DQuadratic(_quad->getMeshAtLevel(0));
- MCAuto<DataArrayInt> cellIds(mesh3D->getCellIdsLyingOnNodes(pfl->begin(),pfl->end(),true));
+ MCAuto<DataArrayIdType> cellIds(mesh3D->getCellIdsLyingOnNodes(pfl->begin(),pfl->end(),true));
MCAuto<MEDCouplingUMesh> mesh3DQuadraticRestricted(mesh3DQuadratic->buildPartOfMySelf(cellIds->begin(),cellIds->end(),true));
- MCAuto<DataArrayInt> mesh3DQuadraticRestrictedNodeIds(mesh3DQuadraticRestricted->computeFetchedNodeIds());
+ MCAuto<DataArrayIdType> mesh3DQuadraticRestrictedNodeIds(mesh3DQuadraticRestricted->computeFetchedNodeIds());
mesh3DQuadraticRestrictedNodeIds->checkMonotonic(true);
- MCAuto<DataArrayInt> newPtsIds(mesh3DQuadraticRestrictedNodeIds->buildSubstraction(pfl));
+ MCAuto<DataArrayIdType> newPtsIds(mesh3DQuadraticRestrictedNodeIds->buildSubstraction(pfl));
MCAuto<MEDCoupling1SGTUMesh> allSeg3;
{
- MCAuto<DataArrayInt> a,b,c,d;
+ MCAuto<DataArrayIdType> a,b,c,d;
MCAuto<MEDCouplingUMesh> seg3Tmp(mesh3DQuadraticRestricted->explodeIntoEdges(a,b,c,d));
allSeg3=MEDCoupling1SGTUMesh::New(seg3Tmp);
}
if(allSeg3->getCellModelEnum()!=INTERP_KERNEL::NORM_SEG3)
throw INTERP_KERNEL::Exception("MEDFileFieldLin2QuadVisitor::newPerMeshPerTypePerDisc : invalid situation where SEG3 expected !");
- MCAuto<DataArrayInt> midPts,cellSeg3Ids,matrix;
+ MCAuto<DataArrayIdType> midPts,cellSeg3Ids,matrix;
{
- DataArrayInt *nodeConn(allSeg3->getNodalConnectivity());
+ DataArrayIdType *nodeConn(allSeg3->getNodalConnectivity());
nodeConn->rearrange(3);
{
- std::vector<int> v(1,2);
+ std::vector<std::size_t> v(1,2);
midPts=nodeConn->keepSelectedComponents(v);
}
- cellSeg3Ids=DataArrayInt::FindPermutationFromFirstToSecond(midPts,newPtsIds);
+ cellSeg3Ids=DataArrayIdType::FindPermutationFromFirstToSecond(midPts,newPtsIds);
{
- std::vector<int> v(2); v[0]=0; v[1]=1;
- MCAuto<DataArrayInt> tmp(nodeConn->keepSelectedComponents(v));
+ std::vector<std::size_t> v(2); v[0]=0; v[1]=1;
+ MCAuto<DataArrayIdType> tmp(nodeConn->keepSelectedComponents(v));
matrix=tmp->selectByTupleId(cellSeg3Ids->begin(),cellSeg3Ids->end());
}
nodeConn->rearrange(1);
}
- MCAuto<DataArrayInt> pflq;
+ MCAuto<DataArrayIdType> pflq;
if(!pflName.empty())
{
- std::vector<const DataArrayInt *> vs(2);
+ std::vector<const DataArrayIdType *> vs(2);
vs[0]=pfl; vs[1]=newPtsIds;
- pflq=DataArrayInt::Aggregate(vs);
+ pflq=DataArrayIdType::Aggregate(vs);
pflq->setName(pflName);
}
PFLData pdata(matrix,pflq,newPtsIds->getNumberOfTuples());
return ;
if(_1ts_update_requested)
{
- MCAuto<DataArrayInt> matrix,oldPfl;
+ MCAuto<DataArrayIdType> matrix,oldPfl;
for(std::vector<std::string>::const_iterator it=_pfls_to_be_updated.begin();it!=_pfls_to_be_updated.end();it++)
{
std::map< std::string, PFLData >::const_iterator it2(_cache.find(*it));
DataArrayDouble *arr(_cur_f1ts->getUndergroundDataArray());
MCAuto<DataArrayDouble> res;
{
- std::vector<int> v(1,0),v2(1,1);
- MCAuto<DataArrayInt> pts0(matrix->keepSelectedComponents(v));
- MCAuto<DataArrayInt> pts1(matrix->keepSelectedComponents(v2));
+ std::vector<std::size_t> v(1,0),v2(1,1);
+ MCAuto<DataArrayIdType> pts0(matrix->keepSelectedComponents(v));
+ MCAuto<DataArrayIdType> pts1(matrix->keepSelectedComponents(v2));
if(oldPfl.isNotNull())
{
pts0=oldPfl->findIdForEach(pts0->begin(),pts0->end());
MEDLOADER_EXPORT void destroyFieldsAtPos(const int *startIds, const int *endIds);
MEDLOADER_EXPORT void destroyFieldsAtPos2(int bg, int end, int step);
MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
- MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N);
+ MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N);
MEDLOADER_EXPORT void accept(MEDFileFieldVisitor& visitor) const;
MEDLOADER_EXPORT MCAuto<MEDFileFields> linearToQuadratic(const MEDFileMeshes *oldLin, const MEDFileMeshes *newQuad) const;
public:
- MEDLOADER_EXPORT MEDFileFields *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const;
+ MEDLOADER_EXPORT MEDFileFields *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const;
public:
MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed() const;
MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsed() const;
* \sa getUndergroundDataArrayTemplate()
*/
template<class T>
- typename Traits<T>::ArrayType *MEDFileField1TSTemplateWithoutSDA<T>::getUndergroundDataArrayTemplateExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+ typename Traits<T>::ArrayType *MEDFileField1TSTemplateWithoutSDA<T>::getUndergroundDataArrayTemplateExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
if(this->_field_per_mesh.size()!=1)
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !");
}
template<class T>
- void MEDFileField1TSTemplateWithoutSDA<T>::aggregate(const std::vector<typename MLFieldTraits<T>::F1TSWSDAType const *>& f1tss, const std::vector< std::vector< std::pair<int,int> > >& dts)
+ void MEDFileField1TSTemplateWithoutSDA<T>::aggregate(const std::vector<typename MLFieldTraits<T>::F1TSWSDAType const *>& f1tss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts)
{
if(f1tss.empty())
throw INTERP_KERNEL::Exception("MEDFileField1TSTemplateWithoutSDA::aggregate : empty vector !");
setName(refPt->getName());
const DataArray *arr(refPt->getUndergroundDataArray());
- int nbCompo(arr->getNumberOfComponents());
+ std::size_t nbCompo(arr->getNumberOfComponents());
for(typename std::vector<typename MLFieldTraits<T>::F1TSWSDAType const *>::const_iterator it=f1tss.begin();it!=f1tss.end();it++)
{
const typename Traits<T>::ArrayType *myArr((*it)->getUndergroundDataArrayTemplate());
if(myArr->getNumberOfComponents()!=nbCompo)
throw INTERP_KERNEL::Exception("MEDFileField1TSTemplateWithoutSDA::aggregate : arrays must have same number of components !");
}
- std::vector<std::pair< int, std::pair<int,int> > > extractInfo;
- int start(0);
+ std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > > extractInfo;
+ mcIdType start(0);
MCAuto<MEDFileFieldPerMesh> fpm(MEDFileFieldPerMesh::Aggregate(start,pms,dts,this,extractInfo));
_field_per_mesh.push_back(fpm);
int iteration,order;
_arr=Traits<T>::ArrayType::New();
_arr->alloc(start,nbCompo); _arr->copyStringInfoFrom(*arr);
start=0;
- for(std::vector<std::pair< int, std::pair<int,int> > >::const_iterator it=extractInfo.begin();it!=extractInfo.end();it++)
+ for(std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >::const_iterator it=extractInfo.begin();it!=extractInfo.end();it++)
{
const DataArray *zeArr(das[(*it).first]);
_arr->setContigPartOfSelectedValuesSlice(start,zeArr,(*it).second.first,(*it).second.second,1);
* \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
*/
template<class T>
- typename Traits<T>::ArrayType *MEDFileTemplateField1TS<T>::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const
+ typename Traits<T>::ArrayType *MEDFileTemplateField1TS<T>::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl) const
{
MCAuto<DataArray> arr(contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull()));
return ReturnSafelyTypedDataArray(arr);
}
template<class T>
- typename Traits<T>::ArrayType *MEDFileTemplateField1TS<T>::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+ typename Traits<T>::ArrayType *MEDFileTemplateField1TS<T>::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
return contentNotNull()->getUndergroundDataArrayTemplateExt(entries);
}
* \sa setFieldNoProfileSBT, setFieldProfileFlatly
*/
template<class T>
- void MEDFileTemplateField1TS<T>::setFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
+ void MEDFileTemplateField1TS<T>::setFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile)
{
setFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,true);
}
* \sa setFieldProfile
*/
template<class T>
- void MEDFileTemplateField1TS<T>::setFieldProfileFlatly(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
+ void MEDFileTemplateField1TS<T>::setFieldProfileFlatly(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile)
{
setFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,false);
}
template<class T>
- void MEDFileTemplateField1TS<T>::setFieldProfileGeneral(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller)
+ void MEDFileTemplateField1TS<T>::setFieldProfileGeneral(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, bool smartPflKiller)
{
setFileName("");
MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::NewWithoutCheck(*field));
* \sa MEDFileUMesh::deduceNodeSubPartFromCellSubPart , MEDFileUMesh::extractPart
*/
template<class T>
- typename MLFieldTraits<T>::F1TSType *MEDFileTemplateField1TS<T>::extractPartImpl(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const
+ typename MLFieldTraits<T>::F1TSType *MEDFileTemplateField1TS<T>::extractPartImpl(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const
{
if(!mm)
throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : input mesh is NULL !");
getNonEmptyLevels(mm->getName(),levs);
for(std::vector<int>::const_iterator lev=levs.begin();lev!=levs.end();lev++)
{
- std::map<int, MCAuto<DataArrayInt> >::const_iterator it2(extractDef.find(*lev));
+ std::map<int, MCAuto<DataArrayIdType> >::const_iterator it2(extractDef.find(*lev));
if(it2!=extractDef.end())
{
- MCAuto<DataArrayInt> t((*it2).second);
+ MCAuto<DataArrayIdType> t((*it2).second);
if(t.isNull())
throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a value with null pointer 1 !");
MCAuto<typename Traits<T>::FieldType> f(getFieldOnMeshAtLevel(ON_CELLS,(*lev),mm));
}
else
{
- std::map<int, MCAuto<DataArrayInt> >::const_iterator it2(extractDef.find(1));
+ std::map<int, MCAuto<DataArrayIdType> >::const_iterator it2(extractDef.find(1));
if(it2==extractDef.end())
throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a NODE field and no extract array available for NODE !");
- MCAuto<DataArrayInt> t((*it2).second);
+ MCAuto<DataArrayIdType> t((*it2).second);
if(t.isNull())
throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a value with null pointer 1 !");
MCAuto<typename Traits<T>::FieldType> f(getFieldOnMeshAtLevel(ON_NODES,0,mm));
* \return A new object that the caller is responsible to deallocate.
*/
template<class T>
- typename MLFieldTraits<T>::FMTSType *MEDFileTemplateFieldMultiTS<T>::extractPartImpl(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const
+ typename MLFieldTraits<T>::FMTSType *MEDFileTemplateFieldMultiTS<T>::extractPartImpl(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const
{
if(!mm)
throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::extractPart : mesh is null !");
* \param [in] order - the iteration order number of required time step.
* \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
* \param [in] mesh - the supporting mesh.
- * \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the
+ * \param [out] pfl - a new instance of DataArrayIdType holding ids of mesh entities the
* field of interest lies on. If the field lies on all entities of the given
* dimension, all ids in \a pfl are zero. The caller is to delete this array
* using decrRef() as it is no more needed.
* \throw If no field values of the required parameters are available.
*/
template<class T>
- typename Traits<T>::ArrayType *MEDFileTemplateFieldMultiTS<T>::getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const
+ typename Traits<T>::ArrayType *MEDFileTemplateFieldMultiTS<T>::getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl) const
{
const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
const typename MLFieldTraits<T>::F1TSWSDAType *myF1TSC(dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(&myF1TS));
* \sa setFieldNoProfileSBT, appendFieldProfileFlatly
*/
template<class T>
- void MEDFileTemplateFieldMultiTS<T>::appendFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
+ void MEDFileTemplateFieldMultiTS<T>::appendFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile)
{
appendFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,true);
}
* same as appendFieldProfile except that here profile is created unconditionaly
*/
template<class T>
- void MEDFileTemplateFieldMultiTS<T>::appendFieldProfileFlatly(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
+ void MEDFileTemplateFieldMultiTS<T>::appendFieldProfileFlatly(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile)
{
appendFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,false);
}
template<class T>
- void MEDFileTemplateFieldMultiTS<T>::appendFieldProfileGeneral(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller)
+ void MEDFileTemplateFieldMultiTS<T>::appendFieldProfileGeneral(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, bool smartPflKiller)
{
const typename Traits<T>::ArrayType *arr(NULL);
if(field)
}
template<class T>
- typename Traits<T>::ArrayType *MEDFileTemplateFieldMultiTS<T>::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+ typename Traits<T>::ArrayType *MEDFileTemplateFieldMultiTS<T>::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
DataArray *ret(contentNotNull()->getUndergroundDataArrayExt(iteration,order,entries));
if(!ret)
for(int i=0;i<nbOfCompo;i++)
{
ret[i]=deepCopy();
- std::vector<int> v(1,i);
+ std::vector<std::size_t> v(1,i);
MCAuto<DataArray> arr2=arr->keepSelectedComponents(v);
ret[i]->setArray(arr2);
}
* Length of this and of nested sequences is the same as that of \a typesF.
* \throw If no field is lying on \a mname.
*/
-std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeField1TSWithoutSDA::getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
+std::vector< std::vector< std::pair<mcIdType,mcIdType> > > MEDFileAnyTypeField1TSWithoutSDA::getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
{
if(_field_per_mesh.empty())
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !");
(*it)->convertMedBallIntoClassic();
}
-void MEDFileAnyTypeField1TSWithoutSDA::makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl)
+void MEDFileAnyTypeField1TSWithoutSDA::makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayIdType *pfl)
{
if(!pfl)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::makeReduction : null pfl !");
return sz;
}
-bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
+bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N,
MEDFileFieldGlobsReal& glob)
{
bool ret=false;
std::vector<INTERP_KERNEL::NormalizedCellType> types;
std::vector< std::vector<TypeOfField> > typesF;
std::vector< std::vector<std::string> > pfls,locs;
- std::vector< std::vector<std::pair<int,int> > > bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs));
+ std::vector< std::vector<std::pair<mcIdType,mcIdType> > > bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs));
std::set<TypeOfField> allEnt;
for(std::vector< std::vector<TypeOfField> >::const_iterator it1=typesF.begin();it1!=typesF.end();it1++)
for(std::vector<TypeOfField>::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
std::set<TypeOfField>::const_iterator it3(allEnt.begin());
for(std::size_t i=0;i<allEnt.size();i++,it3++)
{
- std::vector< std::pair<int,int> > its;
+ std::vector< std::pair<mcIdType,mcIdType> > its;
ret[i]=shallowCpy();
- int newLgth(ret[i]->keepOnlySpatialDiscretization(*it3,its));
+ mcIdType newLgth(ret[i]->keepOnlySpatialDiscretization(*it3,its));
ret[i]->updateData(newLgth,its);
}
return ret;
std::vector<INTERP_KERNEL::NormalizedCellType> types;
std::vector< std::vector<TypeOfField> > typesF;
std::vector< std::vector<std::string> > pfls,locs;
- std::vector< std::vector<std::pair<int,int> > > bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs));
+ std::vector< std::vector<std::pair<mcIdType,mcIdType> > > bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs));
std::set<TypeOfField> allEnt;
std::size_t nbOfMDPGT(0),ii(0);
for(std::vector< std::vector<TypeOfField> >::const_iterator it1=typesF.begin();it1!=typesF.end();it1++,ii++)
std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret(nbOfMDPGT);
for(std::size_t i=0;i<nbOfMDPGT;i++)
{
- std::vector< std::pair<int,int> > its;
+ std::vector< std::pair<mcIdType,mcIdType> > its;
ret[i]=shallowCpy();
- int newLgth(ret[i]->keepOnlyGaussDiscretization(i,its));
+ mcIdType newLgth(ret[i]->keepOnlyGaussDiscretization(i,its));
ret[i]->updateData(newLgth,its);
}
return ret;
}
-int MEDFileAnyTypeField1TSWithoutSDA::keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair<int,int> >& its)
+mcIdType MEDFileAnyTypeField1TSWithoutSDA::keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair<mcIdType,mcIdType> >& its)
{
- int globalCounter(0);
+ mcIdType globalCounter(0);
for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
(*it)->keepOnlySpatialDiscretization(tof,globalCounter,its);
return globalCounter;
}
-int MEDFileAnyTypeField1TSWithoutSDA::keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair<int,int> >& its)
+mcIdType MEDFileAnyTypeField1TSWithoutSDA::keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair<mcIdType,mcIdType> >& its)
{
- int globalCounter(0);
+ mcIdType globalCounter(0);
for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
(*it)->keepOnlyGaussDiscretization(idOfDisc,globalCounter,its);
return globalCounter;
}
-void MEDFileAnyTypeField1TSWithoutSDA::updateData(int newLgth, const std::vector< std::pair<int,int> >& oldStartStops)
+void MEDFileAnyTypeField1TSWithoutSDA::updateData(mcIdType newLgth, const std::vector< std::pair<mcIdType,mcIdType> >& oldStartStops)
{
if(_nb_of_tuples_to_be_allocated>=0)
{
if(oldArr)
newArr->copyStringInfoFrom(*oldArr);
int pos=0;
- for(std::vector< std::pair<int,int> >::const_iterator it=oldStartStops.begin();it!=oldStartStops.end();it++)
+ for(std::vector< std::pair<mcIdType,mcIdType> >::const_iterator it=oldStartStops.begin();it!=oldStartStops.end();it++)
{
if((*it).second<(*it).first)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::updateData : the range in the leaves was invalid !");
const MEDCouplingMesh *mesh(field->getMesh());
//
TypeOfField type(field->getTypeOfField());
- std::vector<DataArrayInt *> dummy;
+ std::vector<DataArrayIdType *> dummy;
if(mesh)
setMeshName(mesh->getName());
- int start(copyTinyInfoFrom(th,field,arr));
+ mcIdType start(copyTinyInfoFrom(th,field,arr));
int pos(addNewEntryIfNecessary(mesh));
if(type!=ON_NODES)
{
- std::vector<int> code=MEDFileField1TSWithoutSDA::CheckSBTMesh(mesh);
+ std::vector<mcIdType> code=MEDFileField1TSWithoutSDA::CheckSBTMesh(mesh);
_field_per_mesh[pos]->assignFieldNoProfileNoRenum(start,code,field,arr,glob,nasc);
}
else
* \throw If elements in \a mesh are not in the order suitable for writing to the MED file.
* \sa setFieldNoProfileSBT()
*/
-void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc, bool smartPflKiller)
+void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc, bool smartPflKiller)
{
if(!field)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : input field is null !");
if(!arrOfVals || !arrOfVals->isAllocated())
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : input array is null or not allocated !");
TypeOfField type=field->getTypeOfField();
- std::vector<DataArrayInt *> idsInPflPerType;
- std::vector<DataArrayInt *> idsPerType;
- std::vector<int> code,code2;
+ std::vector<DataArrayIdType *> idsInPflPerType;
+ std::vector<DataArrayIdType *> idsPerType;
+ std::vector<mcIdType> code,code2;
MCAuto<MEDCouplingMesh> m(mesh->getMeshAtLevel(meshDimRelToMax));
if(type!=ON_NODES)
{
m->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller);
- std::vector< MCAuto<DataArrayInt> > idsInPflPerType2(idsInPflPerType.size()); std::copy(idsInPflPerType.begin(),idsInPflPerType.end(),idsInPflPerType2.begin());
- std::vector< MCAuto<DataArrayInt> > idsPerType2(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType2.begin());
- std::vector<const DataArrayInt *> idsPerType3(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType3.begin());
+ std::vector< MCAuto<DataArrayIdType> > idsInPflPerType2(idsInPflPerType.size()); std::copy(idsInPflPerType.begin(),idsInPflPerType.end(),idsInPflPerType2.begin());
+ std::vector< MCAuto<DataArrayIdType> > idsPerType2(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType2.begin());
+ std::vector<const DataArrayIdType *> idsPerType3(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType3.begin());
// start of check
MCAuto<MEDCouplingFieldTemplate> field2=field->clone(false);
- int nbOfTuplesExp=field2->getNumberOfTuplesExpectedRegardingCode(code,idsPerType3);
+ mcIdType nbOfTuplesExp=field2->getNumberOfTuplesExpectedRegardingCode(code,idsPerType3);
if(nbOfTuplesExp!=arrOfVals->getNumberOfTuples())
{
std::ostringstream oss; oss << "MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : The array is expected to have " << nbOfTuplesExp << " tuples ! It has " << arrOfVals->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str());
}
// end of check
- int start(copyTinyInfoFrom(th,field,arrOfVals));
+ mcIdType start(copyTinyInfoFrom(th,field,arrOfVals));
code2=m->getDistributionOfTypes();
//
- int pos=addNewEntryIfNecessary(m);
+ mcIdType pos=addNewEntryIfNecessary(m);
_field_per_mesh[pos]->assignFieldProfile(start,profile,code,code2,idsInPflPerType,idsPerType,field,arrOfVals,m,glob,nasc);
}
else
{
if(!profile || !profile->isAllocated() || profile->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : input profile is null, not allocated or with number of components != 1 !");
- std::vector<int> v(3); v[0]=-1; v[1]=profile->getNumberOfTuples(); v[2]=0;
- std::vector<const DataArrayInt *> idsPerType3(1); idsPerType3[0]=profile;
- int nbOfTuplesExp=field->getNumberOfTuplesExpectedRegardingCode(v,idsPerType3);
+ std::vector<mcIdType> v(3); v[0]=-1; v[1]=profile->getNumberOfTuples(); v[2]=0;
+ std::vector<const DataArrayIdType *> idsPerType3(1); idsPerType3[0]=profile;
+ mcIdType nbOfTuplesExp=field->getNumberOfTuplesExpectedRegardingCode(v,idsPerType3);
if(nbOfTuplesExp!=arrOfVals->getNumberOfTuples())
{
std::ostringstream oss; oss << "MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : For node field, the array is expected to have " << nbOfTuplesExp << " tuples ! It has " << arrOfVals->getNumberOfTuples() << " !";
throw INTERP_KERNEL::Exception(oss.str());
}
- int start(copyTinyInfoFrom(th,field,arrOfVals));
- int pos(addNewEntryIfNecessary(m));
+ mcIdType start(copyTinyInfoFrom(th,field,arrOfVals));
+ mcIdType pos(addNewEntryIfNecessary(m));
_field_per_mesh[pos]->assignNodeFieldProfile(start,profile,field,arrOfVals,glob,nasc);
}
}
/*!
* \param [in] newNbOfTuples - The new nb of tuples to be allocated.
*/
-void MEDFileAnyTypeField1TSWithoutSDA::allocNotFromFile(int newNbOfTuples)
+void MEDFileAnyTypeField1TSWithoutSDA::allocNotFromFile(mcIdType newNbOfTuples)
{
if(_nb_of_tuples_to_be_allocated>=0)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::allocNotFromFile : the object is expected to be appended to a data coming from a file but not loaded ! Load before appending data !");
* \throw If \a this->_arr is already allocated but has different number of components
* than \a field.
*/
-int MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr)
+mcIdType MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr)
{
if(!field)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom : input field is NULL !");
}
else
{
- int oldNbOfTuples=getOrCreateAndGetArray()->getNumberOfTuples();
- int newNbOfTuples=oldNbOfTuples+arr->getNumberOfTuples();
+ mcIdType oldNbOfTuples=getOrCreateAndGetArray()->getNumberOfTuples();
+ mcIdType newNbOfTuples=oldNbOfTuples+arr->getNumberOfTuples();
getOrCreateAndGetArray()->reAlloc(newNbOfTuples);
_nb_of_tuples_to_be_allocated=-3;
return oldNbOfTuples;
* Returns number of components in \a this field
* \return int - the number of components.
*/
-int MEDFileAnyTypeField1TSWithoutSDA::getNumberOfComponents() const
+std::size_t MEDFileAnyTypeField1TSWithoutSDA::getNumberOfComponents() const
{
return getOrCreateAndGetArray()->getNumberOfComponents();
}
MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
MCAuto<MEDCouplingMesh> m(mesh->getMeshAtLevel(meshDimRelToMax,false));
- const DataArrayInt *d(mesh->getNumberFieldAtLevel(meshDimRelToMax)),*e(mesh->getNumberFieldAtLevel(1));
+ const DataArrayIdType *d(mesh->getNumberFieldAtLevel(meshDimRelToMax)),*e(mesh->getNumberFieldAtLevel(1));
if(meshDimRelToMax==1)
(static_cast<MEDCouplingUMesh *>((MEDCouplingMesh *)m))->setMeshDimension(0);
return MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(type,renumPol,glob,m,d,e,arrOut,nasc);
* \throw If no field of \a this is lying on \a mesh.
* \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
*/
-MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayIdType *cellRenum, const DataArrayIdType *nodeRenum, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
static const char msg1[]="MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : request for a renumbered field following mesh numbering whereas it is a profile field !";
bool isPfl=false;
oss << "\"" << nasc.getName() << "\" not defined on all nodes !";
throw INTERP_KERNEL::Exception(oss.str());
}
- MCAuto<DataArrayInt> nodeRenumSafe=nodeRenum->checkAndPreparePermutation();
+ MCAuto<DataArrayIdType> nodeRenumSafe=nodeRenum->checkAndPreparePermutation();
if(!dynamic_cast<DataArrayDouble *>((DataArray *)arrOut))
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : node renumbering not implemented for not double DataArrays !");
ret->renumberNodes(nodeRenumSafe->getConstPointer());
* \param [in] type - a spatial discretization of the field.
* \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
* \param [in] mesh - the supporting mesh.
- * \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the
+ * \param [out] pfl - a new instance of DataArrayIdType holding ids of mesh entities the
* field of interest lies on. If the field lies on all entities of the given
* dimension, all ids in \a pfl are zero. The caller is to delete this array
* using decrRef() as it is no more needed.
* \throw If no field of \a this is lying on \a mesh.
* \throw If no field values of the given \a type are available.
*/
-DataArray *MEDFileAnyTypeField1TSWithoutSDA::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const
+DataArray *MEDFileAnyTypeField1TSWithoutSDA::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const
{
MCAuto<MEDCouplingMesh> m(mesh->getMeshAtLevel(meshDimRelToMax));
MCAuto<DataArray> ret=_field_per_mesh[0]->getFieldOnMeshAtLevelWithPfl(type,m,pfl,glob,nasc);
* These values are in full-interlace mode.
* \throw If elements in \a mesh are not in the order suitable for writing to the MED file.
*/
-std::vector<int> MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingMesh *mesh)
+std::vector<mcIdType> MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingMesh *mesh)
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::CheckSBTMesh : input mesh is NULL !");
std::set<INTERP_KERNEL::NormalizedCellType> geoTypes=mesh->getAllGeoTypes();
int nbOfTypes=geoTypes.size();
- std::vector<int> code(3*nbOfTypes);
- MCAuto<DataArrayInt> arr1=DataArrayInt::New();
+ std::vector<mcIdType> code(3*nbOfTypes);
+ MCAuto<DataArrayIdType> arr1=DataArrayIdType::New();
arr1->alloc(nbOfTypes,1);
- int *arrPtr=arr1->getPointer();
+ mcIdType *arrPtr=arr1->getPointer();
std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=geoTypes.begin();
for(int i=0;i<nbOfTypes;i++,it++)
arrPtr[i]=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,*it));
- MCAuto<DataArrayInt> arr2=arr1->checkAndPreparePermutation();
- const int *arrPtr2=arr2->getConstPointer();
+ MCAuto<DataArrayIdType> arr2=arr1->checkAndPreparePermutation();
+ const mcIdType *arrPtr2=arr2->getConstPointer();
int i=0;
for(it=geoTypes.begin();it!=geoTypes.end();it++,i++)
{
- int pos=arrPtr2[i];
- int nbCells=mesh->getNumberOfCellsWithType(*it);
- code[3*pos]=(int)(*it);
+ mcIdType pos=arrPtr2[i];
+ mcIdType nbCells=mesh->getNumberOfCellsWithType(*it);
+ code[3*pos]=(mcIdType)(*it);
code[3*pos+1]=nbCells;
code[3*pos+2]=-1;//no profiles
}
- std::vector<const DataArrayInt *> idsPerType;//no profiles
- DataArrayInt *da=mesh->checkTypeConsistencyAndContig(code,idsPerType);
+ std::vector<const DataArrayIdType *> idsPerType;//no profiles
+ DataArrayIdType *da=mesh->checkTypeConsistencyAndContig(code,idsPerType);
if(da)
{
da->decrRef();
if(mname.empty())
if(_field_per_mesh.empty())
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !");
- std::vector< std::vector< std::pair<int,int> > > ret0=_field_per_mesh[0]->getFieldSplitedByType(types,typesF,pfls,locs);
+ std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret0=_field_per_mesh[0]->getFieldSplitedByType(types,typesF,pfls,locs);
int nbOfRet=ret0.size();
std::vector< std::vector<DataArrayDouble *> > ret(nbOfRet);
for(int i=0;i<nbOfRet;i++)
{
- const std::vector< std::pair<int,int> >& p=ret0[i];
+ const std::vector< std::pair<mcIdType,mcIdType> >& p=ret0[i];
int nbOfRet1=p.size();
ret[i].resize(nbOfRet1);
for(int j=0;j<nbOfRet1;j++)
const DataArrayDouble *arr(_arr);
if(arr)
{
- MCAuto<DataArrayInt> arr2(arr->convertToIntArr());
+ MCAuto<DataArrayIdType> arr2(arr->convertToIntArr());
ret->setArray(arr2);
}
return ret.retn();
* \throw If no field values are available.
* \sa getUndergroundDataArray()
*/
-DataArray *MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+DataArray *MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
return getUndergroundDataArrayTemplateExt(entries);
}
MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order,
const std::vector<std::string>& infos):MEDFileField1TSNDTemplateWithoutSDA<int>(fieldName,meshName,csit,iteration,order,infos)
{
- DataArrayInt *arr(getOrCreateAndGetArrayTemplate());
+ DataArrayInt32 *arr(getOrCreateAndGetArrayTemplate());
arr->setInfoAndChangeNbOfCompo(infos);
}
}
/*!
- * Returns a pointer to the underground DataArrayInt instance and a
+ * Returns a pointer to the underground DataArrayIdType instance and a
* sequence describing parameters of a support of each part of \a this field. The
- * caller should not decrRef() the returned DataArrayInt. This method allows for a
+ * caller should not decrRef() the returned DataArrayIdType. This method allows for a
* direct access to the field values. This method is intended for the field lying on one
* mesh only.
* \param [in,out] entries - the sequence describing parameters of a support of each
* first part describes a type of mesh entity and an id of discretization of a
* current field part. The second part describes a range of values [begin,end)
* within the returned array relating to the current field part.
- * \return DataArrayInt * - the pointer to the field values array.
+ * \return DataArrayIdType * - the pointer to the field values array.
* \throw If the number of underlying meshes is not equal to 1.
* \throw If no field values are available.
* \sa getUndergroundDataArray()
*/
-DataArray *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+DataArray *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
return getUndergroundDataArrayIntExt(entries);
}
/*!
* Returns a pointer to the underground DataArrayInt instance and a
* sequence describing parameters of a support of each part of \a this field. The
- * caller should not decrRef() the returned DataArrayInt. This method allows for a
+ * caller should not decrRef() the returned DataArrayIdType. This method allows for a
* direct access to the field values. This method is intended for the field lying on one
* mesh only.
* \param [in,out] entries - the sequence describing parameters of a support of each
* \throw If no field values are available.
* \sa getUndergroundDataArray()
*/
-DataArrayInt *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayIntExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+DataArrayInt *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayIntExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
if(_field_per_mesh.size()!=1)
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !");
* \throw If no field values are available.
* \sa getUndergroundDataArray()
*/
-DataArray *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+DataArray *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
return getUndergroundDataArrayFloatExt(entries);
}
* \throw If no field values are available.
* \sa getUndergroundDataArray()
*/
-DataArrayFloat *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayFloatExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+DataArrayFloat *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayFloatExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
if(_field_per_mesh.size()!=1)
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !");
if(forceRenameOnGlob || (!existsPfl(newPflName) && nbOfOcc==1))
{
disc->setProfile(newPflName);
- DataArrayInt *pfl=getProfile(oldPflName.c_str());
+ DataArrayIdType *pfl=getProfile(oldPflName.c_str());
pfl->setName(newPflName);
}
else
return contentNotNullBase()->getMeshOrder();
}
-int MEDFileAnyTypeField1TS::getNumberOfComponents() const
+std::size_t MEDFileAnyTypeField1TS::getNumberOfComponents() const
{
return contentNotNullBase()->getNumberOfComponents();
}
return contentNotNullBase()->convertMedBallIntoClassic();
}
-void MEDFileAnyTypeField1TS::makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl)
+void MEDFileAnyTypeField1TS::makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayIdType *pfl)
{
return contentNotNullBase()->makeReduction(ct,tof,pfl);
}
return contentNotNullBase()->getTypesOfFieldAvailable();
}
-std::vector< std::vector<std::pair<int,int> > > MEDFileAnyTypeField1TS::getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
+std::vector< std::vector<std::pair<mcIdType,mcIdType> > > MEDFileAnyTypeField1TS::getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
{
return contentNotNullBase()->getFieldSplitedByType(mname,types,typesF,pfls,locs);
return ret.retn();
}
-int MEDFileAnyTypeField1TS::copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr)
+mcIdType MEDFileAnyTypeField1TS::copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr)
{
MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::New(*field));
return copyTinyInfoFrom(field->timeDiscrSafe(),ft,arr);
}
-int MEDFileAnyTypeField1TS::copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr)
+mcIdType MEDFileAnyTypeField1TS::copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr)
{
return contentNotNullBase()->copyTinyInfoFrom(th,field,arr);
}
//
MEDLOADER_EXPORT int getNonEmptyLevels(const std::string& mname, std::vector<int>& levs) const;
MEDLOADER_EXPORT void convertMedBallIntoClassic();
- MEDLOADER_EXPORT void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl);
- MEDLOADER_EXPORT std::vector< std::vector<std::pair<int,int> > > getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
+ MEDLOADER_EXPORT void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayIdType *pfl);
+ MEDLOADER_EXPORT std::vector< std::vector<std::pair<mcIdType,mcIdType> > > getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
//
MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId);
MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const;
MEDLOADER_EXPORT void deepCpyLeavesFrom(const MEDFileAnyTypeField1TSWithoutSDA& other);
MEDLOADER_EXPORT void accept(MEDFileFieldVisitor& visitor) const;
public:
- MEDLOADER_EXPORT int getNumberOfComponents() const;
+ MEDLOADER_EXPORT std::size_t getNumberOfComponents() const;
MEDLOADER_EXPORT const std::vector<std::string>& getInfo() const;
MEDLOADER_EXPORT std::vector<std::string>& getInfo();
MEDLOADER_EXPORT bool presenceOfMultiDiscPerGeoType() const;
MEDLOADER_EXPORT void setInfo(const std::vector<std::string>& infos);
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
- MEDLOADER_EXPORT int copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr);
+ MEDLOADER_EXPORT mcIdType copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr);
MEDLOADER_EXPORT void setFieldNoProfileSBT(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
- MEDLOADER_EXPORT void setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc, bool smartPflKiller=true);
+ MEDLOADER_EXPORT void setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc, bool smartPflKiller=true);
MEDLOADER_EXPORT virtual void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const;
MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TSWithoutSDA *deepCopy() const = 0;
MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const = 0;
MEDLOADER_EXPORT virtual std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > splitComponents() const;
MEDLOADER_EXPORT virtual const char *getTypeStr() const = 0;
MEDLOADER_EXPORT virtual DataArray *getUndergroundDataArray() const = 0;
- MEDLOADER_EXPORT virtual DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const = 0;
+ MEDLOADER_EXPORT virtual DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const = 0;
MEDLOADER_EXPORT virtual void setArray(DataArray *arr) = 0;
MEDLOADER_EXPORT virtual DataArray *createNewEmptyDataArrayInstance() const = 0;
MEDLOADER_EXPORT virtual DataArray *getOrCreateAndGetArray() = 0;
MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
- MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
- DataArray *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const;
+ MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayIdType *cellRenum, const DataArrayIdType *nodeRenum, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
+ DataArray *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const;
public:
- MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob);
+ MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob);
MEDLOADER_EXPORT std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > splitDiscretizations() const;
MEDLOADER_EXPORT std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > splitMultiDiscrPerGeoTypes() const;
- MEDLOADER_EXPORT int keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair<int,int> >& its);
- MEDLOADER_EXPORT int keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair<int,int> >& its);
+ MEDLOADER_EXPORT mcIdType keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair<mcIdType,mcIdType> >& its);
+ MEDLOADER_EXPORT mcIdType keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair<mcIdType,mcIdType> >& its);
public:
- MEDLOADER_EXPORT void allocNotFromFile(int newNbOfTuples);
+ MEDLOADER_EXPORT void allocNotFromFile(mcIdType newNbOfTuples);
MEDLOADER_EXPORT bool allocIfNecessaryTheArrayToReceiveDataFromFile();
MEDLOADER_EXPORT void loadOnlyStructureOfDataRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const MEDFileMeshes *ms, const MEDFileEntities *entities);
MEDLOADER_EXPORT void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc);
protected:
int getMeshIdFromMeshName(const std::string& mName) const;
int addNewEntryIfNecessary(const MEDCouplingMesh *mesh);
- void updateData(int newLgth, const std::vector< std::pair<int,int> >& oldStartStops);
+ void updateData(mcIdType newLgth, const std::vector< std::pair<mcIdType,mcIdType> >& oldStartStops);
protected:
std::vector< MCAuto< MEDFileFieldPerMesh > > _field_per_mesh;
int _iteration;
// -2 means allocated and read from a file
// -1 means not allocated and build from scratch
// >=0 means not allocated and read from a file
- mutable int _nb_of_tuples_to_be_allocated;
+ mutable mcIdType _nb_of_tuples_to_be_allocated;
};
class MEDFileIntField1TSWithoutSDA;
MEDLOADER_EXPORT typename Traits<T>::ArrayType *getOrCreateAndGetArrayTemplate();
MEDLOADER_EXPORT typename Traits<T>::ArrayType const *getOrCreateAndGetArrayTemplate() const;
MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayTemplate() const;
- MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayTemplateExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+ MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayTemplateExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
MEDLOADER_EXPORT DataArray *getOrCreateAndGetArray();
MEDLOADER_EXPORT const DataArray *getOrCreateAndGetArray() const;
MEDLOADER_EXPORT DataArray *getUndergroundDataArray() const;
- MEDLOADER_EXPORT void aggregate(const typename std::vector< typename MLFieldTraits<T>::F1TSWSDAType const * >& f1tss, const std::vector< std::vector< std::pair<int,int> > >& dts);
+ MEDLOADER_EXPORT void aggregate(const typename std::vector< typename MLFieldTraits<T>::F1TSWSDAType const * >& f1tss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts);
MEDLOADER_EXPORT void copyTimeInfoFrom(const typename Traits<T>::FieldType *mcf);
protected:
MCAuto< typename Traits<T>::ArrayType > _arr;
{
public:
MEDLOADER_EXPORT const char *getTypeStr() const;
- MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+ MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
MEDLOADER_EXPORT static void CheckMeshDimRel(int meshDimRelToMax);
- MEDLOADER_EXPORT static std::vector<int> CheckSBTMesh(const MEDCouplingMesh *mesh);
+ MEDLOADER_EXPORT static std::vector<mcIdType> CheckSBTMesh(const MEDCouplingMesh *mesh);
MEDLOADER_EXPORT static MEDFileField1TSWithoutSDA *New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos);
public:
MEDLOADER_EXPORT MEDFileField1TSWithoutSDA();
MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *deepCopy() const;
MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *shallowCpy() const;
MEDLOADER_EXPORT const char *getTypeStr() const;
- MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
- MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArrayIntExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+ MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
+ MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArrayIntExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
protected:
MEDFileIntField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos);
public:
MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *deepCopy() const;
MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *shallowCpy() const;
MEDLOADER_EXPORT const char *getTypeStr() const;
- MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
- MEDLOADER_EXPORT DataArrayFloat *getUndergroundDataArrayFloatExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+ MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
+ MEDLOADER_EXPORT DataArrayFloat *getUndergroundDataArrayFloatExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
protected:
MEDFileFloatField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector<std::string>& infos);
public:
MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
MEDLOADER_EXPORT int getMeshIteration() const;
MEDLOADER_EXPORT int getMeshOrder() const;
- MEDLOADER_EXPORT int getNumberOfComponents() const;
+ MEDLOADER_EXPORT std::size_t getNumberOfComponents() const;
MEDLOADER_EXPORT bool isDealingTS(int iteration, int order) const;
MEDLOADER_EXPORT std::pair<int,int> getDtIt() const;
MEDLOADER_EXPORT void fillIteration(std::pair<int,int>& p) const;
MEDLOADER_EXPORT std::vector<std::string>& getInfo();
MEDLOADER_EXPORT bool presenceOfMultiDiscPerGeoType() const;
MEDLOADER_EXPORT std::vector<TypeOfField> getTypesOfFieldAvailable() const;
- MEDLOADER_EXPORT std::vector< std::vector<std::pair<int,int> > > getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
+ MEDLOADER_EXPORT std::vector< std::vector<std::pair<mcIdType,mcIdType> > > getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId);
MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const;
MEDLOADER_EXPORT int getNonEmptyLevels(const std::string& mname, std::vector<int>& levs) const;
MEDLOADER_EXPORT void convertMedBallIntoClassic();
- MEDLOADER_EXPORT void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl);
- MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const = 0;
+ MEDLOADER_EXPORT void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayIdType *pfl);
+ MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const = 0;
MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *shallowCpy() const = 0;
public:
MEDLOADER_EXPORT void loadArrays();
MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeField1TS > > splitDiscretizations() const;
MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeField1TS > > splitMultiDiscrPerGeoTypes() const;
MEDLOADER_EXPORT MEDFileAnyTypeField1TS *deepCopy() const;
- MEDLOADER_EXPORT int copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr);
- MEDLOADER_EXPORT int copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr);
+ MEDLOADER_EXPORT mcIdType copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr);
+ MEDLOADER_EXPORT mcIdType copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr);
public:
//! underground method see MEDFileField1TSWithoutSDA::setProfileNameOnLeaf
MEDLOADER_EXPORT void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
MEDLOADER_EXPORT static typename MLFieldTraits<T>::F1TSType *New(const typename MLFieldTraits<T>::F1TSWSDAType& other, bool shallowCopyOfContent);
public:
MEDLOADER_EXPORT static typename Traits<T>::ArrayType *ReturnSafelyTypedDataArray(MCAuto<DataArray>& arr);
- MEDLOADER_EXPORT typename Traits<T>::ArrayType *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
+ MEDLOADER_EXPORT typename Traits<T>::ArrayType *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl) const;
MEDLOADER_EXPORT void setArray(DataArray *arr);
MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArray() const;
- MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+ MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
MEDLOADER_EXPORT static MCAuto<typename Traits<T>::FieldType> SetDataArrayInField(MEDCouplingFieldDouble *f, MCAuto<DataArray>& arr);
MEDLOADER_EXPORT static MCAuto<MEDCouplingFieldDouble> ToFieldTemplateWithTime(const typename Traits<T>::FieldType *f);
public:
MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
MEDLOADER_EXPORT void setFieldNoProfileSBT(const typename Traits<T>::FieldType *field);
- MEDLOADER_EXPORT void setFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
- MEDLOADER_EXPORT void setFieldProfileFlatly(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
- MEDLOADER_EXPORT typename MLFieldTraits<T>::F1TSType *extractPartImpl(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const;
- MEDLOADER_EXPORT MEDFileAnyTypeField1TS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); }
+ MEDLOADER_EXPORT void setFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
+ MEDLOADER_EXPORT void setFieldProfileFlatly(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
+ MEDLOADER_EXPORT typename MLFieldTraits<T>::F1TSType *extractPartImpl(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const;
+ MEDLOADER_EXPORT MEDFileAnyTypeField1TS *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); }
protected:
~MEDFileTemplateField1TS() { }
MEDFileTemplateField1TS();
MEDFileTemplateField1TS(const typename MLFieldTraits<T>::F1TSWSDAType& other, bool shallowCopyOfContent):MEDFileAnyTypeField1TS(other,shallowCopyOfContent) { }
const typename MLFieldTraits<T>::F1TSWSDAType *contentNotNull() const;
typename MLFieldTraits<T>::F1TSWSDAType *contentNotNull();
- void setFieldProfileGeneral(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller);
+ void setFieldProfileGeneral(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, bool smartPflKiller);
};
/*!
#include "MEDFileBlowStrEltUp.hxx"
#include "MEDFileFieldVisitor.hxx"
+#include "MEDCouplingMemArray.txx"
#include "MEDCouplingFieldDiscretization.hxx"
#include "MCType.hxx"
{
if(id>=(int)_pfls.size())
_pfls.resize(id+1);
- _pfls[id]=DataArrayInt::New();
+ MCAuto<DataArrayMedInt> miPfl=DataArrayMedInt::New();
int lgth(MEDprofileSizeByName(fid,pflName.c_str()));
- _pfls[id]->setName(pflName);
- _pfls[id]->alloc(lgth,1);
- MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName.c_str(),_pfls[id]->getPointer()));
+ miPfl->setName(pflName);
+ miPfl->alloc(lgth,1);
+ MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName.c_str(),miPfl->getPointer()));
+ _pfls[id]=FromMedIntArray<mcIdType>(miPfl);
_pfls[id]->applyLin(1,-1,0);//Converting into C format
}
std::string pflCpp=MEDLoaderBase::buildStringFromFortran(pflName,MED_NAME_SIZE);
if(i>=(int)_pfls.size())
_pfls.resize(i+1);
- _pfls[i]=DataArrayInt::New();
- _pfls[i]->alloc(sz,1);
- _pfls[i]->setName(pflCpp.c_str());
- MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName,_pfls[i]->getPointer()));
+ MCAuto<DataArrayMedInt> miPfl=DataArrayMedInt::New();
+ miPfl->alloc(sz,1);
+ miPfl->setName(pflCpp.c_str());
+ MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName,miPfl->getPointer()));
+ _pfls[i]=FromMedIntArray<mcIdType>(miPfl);
_pfls[i]->applyLin(1,-1,0);//Converting into C format
}
int nbOfPfls=_pfls.size();
for(int i=0;i<nbOfPfls;i++)
{
- MCAuto<DataArrayInt> cpy=_pfls[i]->deepCopy();
+ MCAuto<DataArrayMedInt> cpy=DataArrayMedInt::Copy((const DataArrayIdType*)_pfls[i]);
cpy->applyLin(1,1,0);
INTERP_KERNEL::AutoPtr<char> pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
MEDLoaderBase::safeStrCpy(_pfls[i]->getName().c_str(),MED_NAME_SIZE,pflName,opt.getTooLongStrPolicy());
void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps)
{
std::vector<std::string> pfls=getPfls();
- for(std::vector< MCAuto<DataArrayInt> >::const_iterator it=other._pfls.begin();it!=other._pfls.end();it++)
+ for(std::vector< MCAuto<DataArrayIdType> >::const_iterator it=other._pfls.begin();it!=other._pfls.end();it++)
{
std::vector<std::string>::iterator it2=std::find(pfls.begin(),pfls.end(),(*it)->getName());
if(it2==pfls.end())
std::vector<const BigMemoryObject *> MEDFileFieldGlobs::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(std::vector< MCAuto< DataArrayInt > >::const_iterator it=_pfls.begin();it!=_pfls.end();it++)
- ret.push_back((const DataArrayInt *)*it);
+ for(std::vector< MCAuto< DataArrayIdType > >::const_iterator it=_pfls.begin();it!=_pfls.end();it++)
+ ret.push_back((const DataArrayIdType *)*it);
for(std::vector< MCAuto<MEDFileFieldLoc> >::const_iterator it=_locs.begin();it!=_locs.end();it++)
ret.push_back((const MEDFileFieldLoc *)*it);
return ret;
{
MCAuto<MEDFileFieldGlobs> ret=new MEDFileFieldGlobs(*this);
std::size_t i=0;
- for(std::vector< MCAuto<DataArrayInt> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
+ for(std::vector< MCAuto<DataArrayIdType> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
{
- if((const DataArrayInt *)*it)
+ if((const DataArrayIdType *)*it)
ret->_pfls[i]=(*it)->deepCopy();
}
i=0;
MCAuto<MEDFileFieldGlobs> ret=MEDFileFieldGlobs::New();
for(std::vector<std::string>::const_iterator it1=pfls.begin();it1!=pfls.end();it1++)
{
- DataArrayInt *pfl=const_cast<DataArrayInt *>(getProfile((*it1).c_str()));
+ DataArrayIdType *pfl=const_cast<DataArrayIdType *>(getProfile((*it1).c_str()));
if(!pfl)
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::shallowCpyPart : internal error ! pfl null !");
pfl->incrRef();
- MCAuto<DataArrayInt> pfl2(pfl);
+ MCAuto<DataArrayIdType> pfl2(pfl);
ret->_pfls.push_back(pfl2);
}
for(std::vector<std::string>::const_iterator it2=locs.begin();it2!=locs.end();it2++)
MCAuto<MEDFileFieldGlobs> ret=MEDFileFieldGlobs::New();
for(std::vector<std::string>::const_iterator it1=pfls.begin();it1!=pfls.end();it1++)
{
- DataArrayInt *pfl=const_cast<DataArrayInt *>(getProfile((*it1).c_str()));
+ DataArrayIdType *pfl=const_cast<DataArrayIdType *>(getProfile((*it1).c_str()));
if(!pfl)
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::deepCpyPart : internal error ! pfl null !");
ret->_pfls.push_back(pfl->deepCopy());
for(std::size_t i=0;i<n;i++)
{
oss << " - #" << i << " ";
- const DataArrayInt *pfl=_pfls[i];
+ const DataArrayIdType *pfl=_pfls[i];
if(pfl)
oss << "\"" << pfl->getName() << "\"\n";
else
void MEDFileFieldGlobs::changePflsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
{
- for(std::vector< MCAuto<DataArrayInt> >::iterator it=_pfls.begin();it!=_pfls.end();it++)
+ for(std::vector< MCAuto<DataArrayIdType> >::iterator it=_pfls.begin();it!=_pfls.end();it++)
{
- DataArrayInt *elt(*it);
+ DataArrayIdType *elt(*it);
if(elt)
{
std::string name(elt->getName());
{
public:
PflFinder(const std::string& pfl):_pfl(pfl) { }
- bool operator() (const MCAuto<DataArrayInt>& loc) { return loc->getName()==_pfl; }
+ bool operator() (const MCAuto<DataArrayIdType>& loc) { return loc->getName()==_pfl; }
private:
const std::string _pfl;
};
int MEDFileFieldGlobs::getProfileId(const std::string& pfl) const
{
- std::vector< MCAuto<DataArrayInt> >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pfl));
+ std::vector< MCAuto<DataArrayIdType> >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pfl));
if(it==_pfls.end())
{
std::ostringstream oss; oss << "MEDFileFieldGlobs::getProfileId : no such profile name : \"" << pfl << "\" Possible localizations are : ";
/*!
* The returned value is never null.
*/
-const DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName) const
+const DataArrayIdType *MEDFileFieldGlobs::getProfile(const std::string& pflName) const
{
return getProfileFromId(getProfileId(pflName));
}
-const DataArrayInt *MEDFileFieldGlobs::getProfileFromId(int pflId) const
+const DataArrayIdType *MEDFileFieldGlobs::getProfileFromId(int pflId) const
{
if(pflId<0 || pflId>=(int)_pfls.size())
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::getProfileFromId : Invalid profile id !");
/*!
* The returned value is never null. Borrowed reference returned.
*/
-DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName)
+DataArrayIdType *MEDFileFieldGlobs::getProfile(const std::string& pflName)
{
std::string pflNameCpp(pflName);
- std::vector< MCAuto<DataArrayInt> >::iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp));
+ std::vector< MCAuto<DataArrayIdType> >::iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp));
if(it==_pfls.end())
{
std::ostringstream oss; oss << "MEDFileFieldGlobs::getProfile: no such profile name : \"" << pflNameCpp << "\" Possible profiles are : ";
return *it;
}
-DataArrayInt *MEDFileFieldGlobs::getProfileFromId(int pflId)
+DataArrayIdType *MEDFileFieldGlobs::getProfileFromId(int pflId)
{
if(pflId<0 || pflId>=(int)_pfls.size())
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::getProfileFromId : Invalid profile id !");
void MEDFileFieldGlobs::killProfileIds(const std::vector<int>& pflIds)
{
- std::vector< MCAuto<DataArrayInt> > newPfls;
+ std::vector< MCAuto<DataArrayIdType> > newPfls;
int i=0;
- for(std::vector< MCAuto<DataArrayInt> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
+ for(std::vector< MCAuto<DataArrayIdType> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
{
if(std::find(pflIds.begin(),pflIds.end(),i)==pflIds.end())
newPfls.push_back(*it);
{
std::map<int,std::vector<int> > m;
int i=0;
- for(std::vector< MCAuto<DataArrayInt> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
+ for(std::vector< MCAuto<DataArrayIdType> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
{
- const DataArrayInt *tmp=(*it);
+ const DataArrayIdType *tmp=(*it);
if(tmp)
{
m[tmp->getHashCode()].push_back(i);
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::whichAreEqualLocs : no implemented yet ! Sorry !");
}
-void MEDFileFieldGlobs::appendProfile(DataArrayInt *pfl)
+void MEDFileFieldGlobs::appendProfile(DataArrayIdType *pfl)
{
std::string name(pfl->getName());
if(name.empty())
throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::appendProfile : unsupported profiles with no name !");
- for(std::vector< MCAuto<DataArrayInt> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++)
+ for(std::vector< MCAuto<DataArrayIdType> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++)
if(name==(*it)->getName())
{
if(!pfl->isEqual(*(*it)))
/*!
* Returns a profile array by its name.
* \param [in] pflName - the name of the profile of interest.
- * \return const DataArrayInt * - the profile array having the name \a pflName.
+ * \return const DataArrayIdType * - the profile array having the name \a pflName.
* \throw If there is no a profile named \a pflName.
*/
-const DataArrayInt *MEDFileFieldGlobsReal::getProfile(const std::string& pflName) const
+const DataArrayIdType *MEDFileFieldGlobsReal::getProfile(const std::string& pflName) const
{
return contentNotNull()->getProfile(pflName);
}
/*!
* Returns a profile array by its id.
* \param [in] pflId - the id of the profile of interest.
- * \return const DataArrayInt * - the profile array having the id \a pflId.
+ * \return const DataArrayIdType * - the profile array having the id \a pflId.
* \throw If there is no a profile with id \a pflId.
*/
-const DataArrayInt *MEDFileFieldGlobsReal::getProfileFromId(int pflId) const
+const DataArrayIdType *MEDFileFieldGlobsReal::getProfileFromId(int pflId) const
{
return contentNotNull()->getProfileFromId(pflId);
}
/*!
* Returns a profile array, apt for modification, by its name.
* \param [in] pflName - the name of the profile of interest.
- * \return DataArrayInt * - Borrowed reference - a non-const pointer to the profile array having the name \a pflName.
+ * \return DataArrayIdType * - Borrowed reference - a non-const pointer to the profile array having the name \a pflName.
* \throw If there is no a profile named \a pflName.
*/
-DataArrayInt *MEDFileFieldGlobsReal::getProfile(const std::string& pflName)
+DataArrayIdType *MEDFileFieldGlobsReal::getProfile(const std::string& pflName)
{
return contentNotNull()->getProfile(pflName);
}
/*!
* Returns a profile array, apt for modification, by its id.
* \param [in] pflId - the id of the profile of interest.
- * \return DataArrayInt * - Borrowed reference - a non-const pointer to the profile array having the id \a pflId.
+ * \return DataArrayIdType * - Borrowed reference - a non-const pointer to the profile array having the id \a pflId.
* \throw If there is no a profile with id \a pflId.
*/
-DataArrayInt *MEDFileFieldGlobsReal::getProfileFromId(int pflId)
+DataArrayIdType *MEDFileFieldGlobsReal::getProfileFromId(int pflId)
{
return contentNotNull()->getProfileFromId(pflId);
}
* \throw If a profile with the same name as that of \a pfl already exists but contains
* different ids.
*/
-void MEDFileFieldGlobsReal::appendProfile(DataArrayInt *pfl)
+void MEDFileFieldGlobsReal::appendProfile(DataArrayIdType *pfl)
{
contentNotNull()->appendProfile(pfl);
}
std::string getFileName() const { return _file_name; }
const MEDFileFieldLoc& getLocalizationFromId(int locId) const;
const MEDFileFieldLoc& getLocalization(const std::string& locName) const;
- const DataArrayInt *getProfileFromId(int pflId) const;
- const DataArrayInt *getProfile(const std::string& pflName) const;
+ const DataArrayIdType *getProfileFromId(int pflId) const;
+ const DataArrayIdType *getProfile(const std::string& pflName) const;
MEDFileFieldLoc& getLocalizationFromId(int locId);
MEDFileFieldLoc& getLocalization(const std::string& locName);
- DataArrayInt *getProfile(const std::string& pflName);
- DataArrayInt *getProfileFromId(int pflId);
+ DataArrayIdType *getProfile(const std::string& pflName);
+ DataArrayIdType *getProfileFromId(int pflId);
void killProfileIds(const std::vector<int>& pflIds);
void killLocalizationIds(const std::vector<int>& locIds);
void killStructureElementsInGlobs();
//
- void appendProfile(DataArrayInt *pfl);
+ void appendProfile(DataArrayIdType *pfl);
void appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
//
static std::string CreateNewNameNotIn(const std::string& prefix, const std::vector<std::string>& namesToAvoid);
MEDFileFieldGlobs();
~MEDFileFieldGlobs();
protected:
- std::vector< MCAuto<DataArrayInt> > _pfls;
+ std::vector< MCAuto<DataArrayIdType> > _pfls;
std::vector< MCAuto<MEDFileFieldLoc> > _locs;
std::string _file_name;
};
MEDLOADER_EXPORT const MEDFileFieldLoc& getLocalization(const std::string& locName) const;
MEDLOADER_EXPORT MEDFileFieldLoc& getLocalizationFromId(int locId);
MEDLOADER_EXPORT MEDFileFieldLoc& getLocalization(const std::string& locName);
- MEDLOADER_EXPORT const DataArrayInt *getProfile(const std::string& pflName) const;
- MEDLOADER_EXPORT const DataArrayInt *getProfileFromId(int pflId) const;
- MEDLOADER_EXPORT DataArrayInt *getProfile(const std::string& pflName);
- MEDLOADER_EXPORT DataArrayInt *getProfileFromId(int pflId);
+ MEDLOADER_EXPORT const DataArrayIdType *getProfile(const std::string& pflName) const;
+ MEDLOADER_EXPORT const DataArrayIdType *getProfileFromId(int pflId) const;
+ MEDLOADER_EXPORT DataArrayIdType *getProfile(const std::string& pflName);
+ MEDLOADER_EXPORT DataArrayIdType *getProfileFromId(int pflId);
MEDLOADER_EXPORT void killProfileIds(const std::vector<int>& pflIds);
MEDLOADER_EXPORT void killLocalizationIds(const std::vector<int>& locIds);
//
- MEDLOADER_EXPORT void appendProfile(DataArrayInt *pfl);
+ MEDLOADER_EXPORT void appendProfile(DataArrayIdType *pfl);
MEDLOADER_EXPORT void appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
protected:
MEDFileFieldGlobs *contentNotNull();
}
MEDFileFieldLoc::MEDFileFieldLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType,
- const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w):_name(locName),_gt(new MEDFileGTKeeperSta(geoType)),_ref_coo(refCoo),_gs_coo(gsCoo),_w(w)
+ const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w):_gt(new MEDFileGTKeeperSta(geoType)),_name(locName),_ref_coo(refCoo),_gs_coo(gsCoo),_w(w)
{
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getGeoType()));
_dim=cm.getDimension();
return oss.str();
}
-void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
_type=field->getTypeOfField();
_start=start;
}
case ON_GAUSS_NE:
{
- MCAuto<DataArrayInt> arr=field->getDiscretization()->getOffsetArr(field->getMesh());
- const int *arrPtr=arr->getConstPointer();
+ MCAuto<DataArrayIdType> arr=field->getDiscretization()->getOffsetArr(field->getMesh());
+ const mcIdType *arrPtr=arr->getConstPointer();
getOrCreateAndGetArray()->setContigPartOfSelectedValuesSlice(_start,arrr,arrPtr[offset],arrPtr[offset+nbOfCells],1);
_end=_start+(arrPtr[offset+nbOfCells]-arrPtr[offset]);
_nval=nbOfCells;
const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc));
if(!disc2)
throw INTERP_KERNEL::Exception("assignFieldNoProfile : invalid call to this method ! Internal Error !");
- const DataArrayInt *dai(disc2->getArrayOfDiscIds());
- MCAuto<DataArrayInt> dai2(disc2->getOffsetArr(field->getMesh()));
- const int *dai2Ptr(dai2->getConstPointer());
+ const DataArrayIdType *dai(disc2->getArrayOfDiscIds());
+ MCAuto<DataArrayIdType> dai2(disc2->getOffsetArr(field->getMesh()));
+ const mcIdType *dai2Ptr(dai2->getConstPointer());
int nbi(gsLoc.getWeights().size());
- MCAuto<DataArrayInt> da2(dai->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1));
- MCAuto<DataArrayInt> da3(da2->findIdsEqual(_loc_id));
- const int *da3Ptr(da3->getConstPointer());
+ MCAuto<DataArrayIdType> da2(dai->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1));
+ MCAuto<DataArrayIdType> da3(da2->findIdsEqual(_loc_id));
+ const mcIdType *da3Ptr(da3->getConstPointer());
if(da3->getNumberOfTuples()!=nbOfCells)
{//profile : for gauss even in NoProfile !!!
std::ostringstream oss; oss << "Pfl_" << nasc.getName() << "_" << INTERP_KERNEL::CellModel::GetCellModel(getGeoType()).getRepr() << "_" << _loc_id;
da3->setName(_profile.c_str());
glob.appendProfile(da3);
}
- MCAuto<DataArrayInt> da4(DataArrayInt::New());
+ MCAuto<DataArrayIdType> da4(DataArrayIdType::New());
_nval=da3->getNbOfElems();
da4->alloc(_nval*nbi,1);
- int *da4Ptr(da4->getPointer());
- for(int i=0;i<_nval;i++)
+ mcIdType *da4Ptr(da4->getPointer());
+ for(mcIdType i=0;i<_nval;i++)
{
- int ref=dai2Ptr[offset+da3Ptr[i]];
- for(int j=0;j<nbi;j++)
+ mcIdType ref=dai2Ptr[offset+da3Ptr[i]];
+ for(mcIdType j=0;j<nbi;j++)
*da4Ptr++=ref+j;
}
std::ostringstream oss2; oss2 << "Loc_" << nasc.getName() << "_" << INTERP_KERNEL::CellModel::GetCellModel(getGeoType()).getRepr() << "_" << _loc_id;
* \b WARNING if not null the MED file profile can be subdivided again in case of Gauss points.
* \param [in] mesh is the mesh coming from the MEDFileMesh instance in correspondence with the MEDFileField. The mesh inside the \a field is simply ignored.
*/
-void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
_profile.clear();
_type=field->getTypeOfField();
}
case ON_GAUSS_NE:
{
- MCAuto<DataArrayInt> arr=field->getDiscretization()->getOffsetArr(mesh);
- MCAuto<DataArrayInt> arr2=arr->deltaShiftIndex();
- MCAuto<DataArrayInt> arr3=arr2->selectByTupleId(multiTypePfl->begin(),multiTypePfl->end());
+ MCAuto<DataArrayIdType> arr=field->getDiscretization()->getOffsetArr(mesh);
+ MCAuto<DataArrayIdType> arr2=arr->deltaShiftIndex();
+ MCAuto<DataArrayIdType> arr3=arr2->selectByTupleId(multiTypePfl->begin(),multiTypePfl->end());
arr3->computeOffsetsFull();
- MCAuto<DataArrayInt> tmp=idsInPfl->buildExplicitArrByRanges(arr3);
- int trueNval=tmp->getNumberOfTuples();
+ MCAuto<DataArrayIdType> tmp=idsInPfl->buildExplicitArrByRanges(arr3);
+ mcIdType trueNval=tmp->getNumberOfTuples();
_nval=idsInPfl->getNumberOfTuples();
getOrCreateAndGetArray()->setContigPartOfSelectedValues(_start,arrr,tmp);
_end=_start+trueNval;
const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(field->getDiscretization());
if(!disc2)
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !");
- const DataArrayInt *da1=disc2->getArrayOfDiscIds();
+ const DataArrayIdType *da1=disc2->getArrayOfDiscIds();
const MEDCouplingGaussLocalization& gsLoc=field->getGaussLocalization(_loc_id);
- MCAuto<DataArrayInt> da2=da1->selectByTupleId(idsInPfl->begin(),idsInPfl->end());
- MCAuto<DataArrayInt> da3=da2->findIdsEqual(_loc_id);
- MCAuto<DataArrayInt> da4=idsInPfl->selectByTupleId(da3->begin(),da3->end());
+ MCAuto<DataArrayIdType> da2=da1->selectByTupleId(idsInPfl->begin(),idsInPfl->end());
+ MCAuto<DataArrayIdType> da3=da2->findIdsEqual(_loc_id);
+ MCAuto<DataArrayIdType> da4=idsInPfl->selectByTupleId(da3->begin(),da3->end());
//
MCAuto<MEDCouplingMesh> mesh2=mesh->buildPart(multiTypePfl->begin(),multiTypePfl->end());
- MCAuto<DataArrayInt> arr=disc2->getOffsetArr(mesh2);
+ MCAuto<DataArrayIdType> arr=disc2->getOffsetArr(mesh2);
//
- MCAuto<DataArrayInt> tmp=DataArrayInt::New();
- int trueNval=0;
- for(const int *pt=da4->begin();pt!=da4->end();pt++)
+ MCAuto<DataArrayIdType> tmp=DataArrayIdType::New();
+ mcIdType trueNval=0;
+ for(const mcIdType *pt=da4->begin();pt!=da4->end();pt++)
trueNval+=arr->getIJ(*pt+1,0)-arr->getIJ(*pt,0);
tmp->alloc(trueNval,1);
- int *tmpPtr=tmp->getPointer();
- for(const int *pt=da4->begin();pt!=da4->end();pt++)
- for(int j=arr->getIJ(*pt,0);j<arr->getIJ(*pt+1,0);j++)
+ mcIdType *tmpPtr=tmp->getPointer();
+ for(const mcIdType *pt=da4->begin();pt!=da4->end();pt++)
+ for(mcIdType j=arr->getIJ(*pt,0);j<arr->getIJ(*pt+1,0);j++)
*tmpPtr++=j;
//
_nval=da4->getNumberOfTuples();
oss << "_loc_" << _loc_id;
if(locIds)
{
- MCAuto<DataArrayInt> da5=locIds->selectByTupleId(da3->begin(),da3->end());
+ MCAuto<DataArrayIdType> da5=locIds->selectByTupleId(da3->begin(),da3->end());
da5->setName(oss.str());
glob.appendProfile(da5);
_profile=oss.str();
start=_end;
}
-void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob)
+void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob)
{
_start=start;
_nval=arrr->getNumberOfTuples();
start=_end;
}
-MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd)
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType profileIt, const PartDefinition *pd)
{
return new MEDFileFieldPerMeshPerTypePerDisc(fath,type,profileIt,pd);
}
return ret.retn();
}
-MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField atype, int profileIt, const PartDefinition *pd)
+MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField atype, mcIdType profileIt, const PartDefinition *pd)
try:_type(atype),_father(fath),_profile_it(profileIt),_pd(const_cast<PartDefinition *>(pd))
{
if(pd)
throw e;
}
-MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int locId, const std::string& dummy):_type(type),_father(fath),_loc_id(locId)
+MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType locId, const std::string& dummy):_type(type),_father(fath),_loc_id(locId)
{
}
{
}
-MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc():_type(ON_CELLS),_father(0),_start(-std::numeric_limits<int>::max()),_end(-std::numeric_limits<int>::max()),
- _nval(-std::numeric_limits<int>::max()),_loc_id(-std::numeric_limits<int>::max())
+MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc():_type(ON_CELLS),_father(0),_start(-std::numeric_limits<mcIdType>::max()),_end(-std::numeric_limits<mcIdType>::max()),
+ _nval(-std::numeric_limits<mcIdType>::max()),_loc_id(-std::numeric_limits<int>::max())
{
}
const SlicePartDefinition *spd(dynamic_cast<const SlicePartDefinition *>(pd));
if(spd)
{
- int start,stop,step;
+ mcIdType start,stop,step;
spd->getSlice(start,stop,step);
int nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(start,stop,step,"MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile"));
med_filter filter=MED_FILTER_INIT;
if(dpd)
{
dpd->checkConsistencyLight();
- MCAuto<DataArrayInt> myIds(dpd->toDAI());
+ MCAuto<DataArrayIdType> myIds(dpd->toDAI());
int a(myIds->getMinValueInArray()),b(myIds->getMaxValueInArray());
myIds=myIds->deepCopy();// WARNING deep copy here because _pd is modified by applyLin !!!
myIds->applyLin(1,-a);
return _father;
}
-void MEDFileFieldPerMeshPerTypePerDisc::loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypePerDisc::loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType& start, const MEDFileFieldNameScope& nasc)
{
INTERP_KERNEL::AutoPtr<char> locname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
INTERP_KERNEL::AutoPtr<char> pflname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast<unsigned char*>(startFeeding));
return ;
}
- DataArrayInt *arrI(dynamic_cast<DataArrayInt *>(arr));
+ DataArrayIdType *arrI(dynamic_cast<DataArrayIdType *>(arr));
if(arrI)
{
- int *startFeeding(arrI->getPointer()+_start*nbOfCompo);
+ mcIdType *startFeeding(arrI->getPointer()+_start*nbOfCompo);
goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast<unsigned char*>(startFeeding));
return ;
}
/*!
* Set a \c this->_start **and** \c this->_end keeping the same delta between the two.
*/
-void MEDFileFieldPerMeshPerTypePerDisc::setNewStart(int newValueOfStart)
+void MEDFileFieldPerMeshPerTypePerDisc::setNewStart(mcIdType newValueOfStart)
{
- int delta=_end-_start;
+ mcIdType delta=_end-_start;
_start=newValueOfStart;
_end=_start+delta;
}
_type=newType;
}
-int MEDFileFieldPerMeshPerTypePerDisc::getNumberOfComponents() const
+std::size_t MEDFileFieldPerMeshPerTypePerDisc::getNumberOfComponents() const
{
return _father->getNumberOfComponents();
}
-int MEDFileFieldPerMeshPerTypePerDisc::getNumberOfTuples() const
+mcIdType MEDFileFieldPerMeshPerTypePerDisc::getNumberOfTuples() const
{
return _end-_start;
}
-void MEDFileFieldPerMeshPerTypePerDisc::incrementNbOfVals(int deltaNbVal)
+void MEDFileFieldPerMeshPerTypePerDisc::incrementNbOfVals(mcIdType deltaNbVal)
{
- int nbi((_end-_start)/_nval);
+ mcIdType nbi((_end-_start)/_nval);
_nval+=deltaNbVal;
_end+=nbi*deltaNbVal;
}
}
}
-void MEDFileFieldPerMeshPerTypePerDisc::getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const
+void MEDFileFieldPerMeshPerTypePerDisc::getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const
{
if(type!=_type)
return ;
- dads.push_back(std::pair<int,int>(_start,_end));
+ dads.push_back(std::pair<mcIdType,mcIdType>(_start,_end));
geoTypes.push_back(getGeoType());
if(_profile.empty())
pfls.push_back(0);
}
}
-void MEDFileFieldPerMeshPerTypePerDisc::fillValues(int discId, int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+void MEDFileFieldPerMeshPerTypePerDisc::fillValues(int discId, mcIdType& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
- entries[startEntryId]=std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int> ,std::pair<int,int> >(std::pair<INTERP_KERNEL::NormalizedCellType,int>(getGeoType(),discId),std::pair<int,int>(_start,_end));
+ entries[startEntryId]=std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,mcIdType> ,std::pair<mcIdType,mcIdType> >(std::pair<INTERP_KERNEL::NormalizedCellType,mcIdType>(getGeoType(),discId),std::pair<mcIdType,mcIdType>(_start,_end));
startEntryId++;
}
if(!arr->isAllocated())
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : the array to be written is not allocated !");
const DataArrayDouble *arrD(dynamic_cast<const DataArrayDouble *>(arr));
- const DataArrayInt *arrI(dynamic_cast<const DataArrayInt *>(arr));
+ const DataArrayIdType *arrI(dynamic_cast<const DataArrayIdType *>(arr));
const DataArrayFloat *arrF(dynamic_cast<const DataArrayFloat *>(arr));
const unsigned char *locToWrite=0;
if(arrD)
locToWrite));
}
-void MEDFileFieldPerMeshPerTypePerDisc::getCoarseData(TypeOfField& type, std::pair<int,int>& dad, std::string& pfl, std::string& loc) const
+void MEDFileFieldPerMeshPerTypePerDisc::getCoarseData(TypeOfField& type, std::pair<mcIdType,mcIdType>& dad, std::string& pfl, std::string& loc) const
{
type=_type;
pfl=_profile;
* \param [out] ptToFill memory zone where the output will be stored.
* \return the size of data pushed into output param \a ptToFill
*/
-int MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(int offset, const std::vector<int>& codeOfMesh, const MEDFileFieldGlobsReal& glob, int *ptToFill) const
+mcIdType MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(mcIdType offset, const std::vector<mcIdType>& codeOfMesh, const MEDFileFieldGlobsReal& glob, mcIdType *ptToFill) const
{
_loc_id=offset;
std::ostringstream oss;
oss << "MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode : not found geometric type " << cm.getRepr() << " in the referenced mesh of field !";
throw INTERP_KERNEL::Exception(oss.str());
}
- int *work=ptToFill;
+ mcIdType *work=ptToFill;
if(_profile.empty())
{
if(_nval!=codeOfMesh[3*found+1])
oss << " whereas mesh has " << codeOfMesh[3*found+1] << " for this geometric type !";
throw INTERP_KERNEL::Exception(oss.str());
}
- for(int ii=codeOfMesh[3*found+2];ii<codeOfMesh[3*found+2]+_nval;ii++)
+ for(mcIdType ii=codeOfMesh[3*found+2];ii<codeOfMesh[3*found+2]+_nval;ii++)
*work++=ii;
}
else
{
- const DataArrayInt *pfl=glob.getProfile(_profile.c_str());
+ const DataArrayIdType *pfl=glob.getProfile(_profile.c_str());
if(pfl->getNumberOfTuples()!=_nval)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getGeoType());
oss << pfl->getNumberOfTuples() << " whereas the number of ids is set to " << _nval << " for this geometric type !";
throw INTERP_KERNEL::Exception(oss.str());
}
- int offset2=codeOfMesh[3*found+2];
- for(const int *pflId=pfl->begin();pflId!=pfl->end();pflId++)
+ mcIdType offset2=codeOfMesh[3*found+2];
+ for(const mcIdType *pflId=pfl->begin();pflId!=pfl->end();pflId++)
{
if(*pflId<codeOfMesh[3*found+1])
*work++=offset2+*pflId;
return _nval;
}
-int MEDFileFieldPerMeshPerTypePerDisc::fillTupleIds(int *ptToFill) const
+mcIdType MEDFileFieldPerMeshPerTypePerDisc::fillTupleIds(mcIdType *ptToFill) const
{
- for(int i=_start;i<_end;i++)
+ for(mcIdType i=_start;i<_end;i++)
*ptToFill++=i;
return _end-_start;
}
* \param [out] result All new entries will be appended on it.
* \return false if the configuration of renumbering leads to an unnecessary resplit of input \a entriesOnSameDisc. If not true is returned (the most general case !)
*/
-bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(int offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
- const DataArrayInt *explicitIdsInMesh,
- const std::vector<int>& newCode,
+bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(mcIdType offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
+ const DataArrayIdType *explicitIdsInMesh,
+ const std::vector<mcIdType>& newCode,
MEDFileFieldGlobsReal& glob, DataArrayDouble *arr,
std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >& result)
{
if(entriesOnSameDisc.empty())
return false;
TypeOfField type=entriesOnSameDisc[0]->getType();
- int szEntities=0,szTuples=0;
+ mcIdType szEntities=0,szTuples=0;
for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++)
{ szEntities+=(*it)->_nval; szTuples+=(*it)->_end-(*it)->_start; }
- int nbi=szTuples/szEntities;
+ mcIdType nbi=szTuples/szEntities;
if(szTuples%szEntities!=0)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks : internal error the splitting into same dicretization failed !");
- MCAuto<DataArrayInt> renumTuples=DataArrayInt::New(); renumTuples->alloc(szTuples,1);
- MCAuto<DataArrayInt> ranges=MEDCouplingUMesh::ComputeRangesFromTypeDistribution(newCode);
- std::vector< MCAuto<DataArrayInt> > newGeoTypesPerChunk(entriesOnSameDisc.size());
- std::vector< const DataArrayInt * > newGeoTypesPerChunk2(entriesOnSameDisc.size());
- std::vector< MCAuto<DataArrayInt> > newGeoTypesPerChunk_bis(entriesOnSameDisc.size());
- std::vector< const DataArrayInt * > newGeoTypesPerChunk3(entriesOnSameDisc.size());
- MCAuto<DataArrayInt> newGeoTypesPerChunk4=DataArrayInt::New(); newGeoTypesPerChunk4->alloc(szEntities,nbi);
+ MCAuto<DataArrayIdType> renumTuples=DataArrayIdType::New(); renumTuples->alloc(szTuples,1);
+ MCAuto<DataArrayIdType> ranges=MEDCouplingUMesh::ComputeRangesFromTypeDistribution(newCode);
+ std::vector< MCAuto<DataArrayIdType> > newGeoTypesPerChunk(entriesOnSameDisc.size());
+ std::vector< const DataArrayIdType * > newGeoTypesPerChunk2(entriesOnSameDisc.size());
+ std::vector< MCAuto<DataArrayIdType> > newGeoTypesPerChunk_bis(entriesOnSameDisc.size());
+ std::vector< const DataArrayIdType * > newGeoTypesPerChunk3(entriesOnSameDisc.size());
+ MCAuto<DataArrayIdType> newGeoTypesPerChunk4=DataArrayIdType::New(); newGeoTypesPerChunk4->alloc(szEntities,nbi);
int id=0;
for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++,id++)
{
int startOfEltIdOfChunk=(*it)->_start;
- MCAuto<DataArrayInt> newEltIds=explicitIdsInMesh->subArray(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval);
- MCAuto<DataArrayInt> rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges);
- MCAuto<DataArrayInt> idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges);
+ MCAuto<DataArrayIdType> newEltIds=explicitIdsInMesh->subArray(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval);
+ MCAuto<DataArrayIdType> rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges);
+ MCAuto<DataArrayIdType> idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges);
//
- MCAuto<DataArrayInt> tmp=rangeIdsForChunk->duplicateEachTupleNTimes(nbi); rangeIdsForChunk->rearrange(nbi);
+ MCAuto<DataArrayIdType> tmp=rangeIdsForChunk->duplicateEachTupleNTimes(nbi); rangeIdsForChunk->rearrange(nbi);
newGeoTypesPerChunk4->setPartOfValues1(tmp,(*it)->_tmp_work1-offset,(*it)->_tmp_work1+(*it)->_nval*nbi-offset,1,0,nbi,1);
//
newGeoTypesPerChunk[id]=rangeIdsForChunk; newGeoTypesPerChunk2[id]=rangeIdsForChunk;
newGeoTypesPerChunk_bis[id]=idsInRrangeForChunk; newGeoTypesPerChunk3[id]=idsInRrangeForChunk;
}
- MCAuto<DataArrayInt> newGeoTypesEltIdsAllGather=DataArrayInt::Aggregate(newGeoTypesPerChunk2); newGeoTypesPerChunk.clear(); newGeoTypesPerChunk2.clear();
- MCAuto<DataArrayInt> newGeoTypesEltIdsAllGather2=DataArrayInt::Aggregate(newGeoTypesPerChunk3); newGeoTypesPerChunk_bis.clear(); newGeoTypesPerChunk3.clear();
- MCAuto<DataArrayInt> diffVals=newGeoTypesEltIdsAllGather->getDifferentValues();
- MCAuto<DataArrayInt> renumEltIds=newGeoTypesEltIdsAllGather->buildPermArrPerLevel();
+ MCAuto<DataArrayIdType> newGeoTypesEltIdsAllGather=DataArrayIdType::Aggregate(newGeoTypesPerChunk2); newGeoTypesPerChunk.clear(); newGeoTypesPerChunk2.clear();
+ MCAuto<DataArrayIdType> newGeoTypesEltIdsAllGather2=DataArrayIdType::Aggregate(newGeoTypesPerChunk3); newGeoTypesPerChunk_bis.clear(); newGeoTypesPerChunk3.clear();
+ MCAuto<DataArrayIdType> diffVals=newGeoTypesEltIdsAllGather->getDifferentValues();
+ MCAuto<DataArrayIdType> renumEltIds=newGeoTypesEltIdsAllGather->buildPermArrPerLevel();
//
- MCAuto<DataArrayInt> renumTupleIds=newGeoTypesPerChunk4->buildPermArrPerLevel();
+ MCAuto<DataArrayIdType> renumTupleIds=newGeoTypesPerChunk4->buildPermArrPerLevel();
//
MCAuto<DataArrayDouble> arrPart=arr->subArray(offset,offset+szTuples);
arrPart->renumberInPlace(renumTupleIds->begin());
arr->setPartOfValues1(arrPart,offset,offset+szTuples,1,0,arrPart->getNumberOfComponents(),1);
bool ret=false;
- const int *idIt=diffVals->begin();
+ const mcIdType *idIt=diffVals->begin();
std::list<const MEDFileFieldPerMeshPerTypePerDisc *> li(entriesOnSameDisc.begin(),entriesOnSameDisc.end());
- int offset2=0;
- for(int i=0;i<diffVals->getNumberOfTuples();i++,idIt++)
+ mcIdType offset2=0;
+ for(mcIdType i=0;i<diffVals->getNumberOfTuples();i++,idIt++)
{
- MCAuto<DataArrayInt> ids=newGeoTypesEltIdsAllGather->findIdsEqual(*idIt);
- MCAuto<DataArrayInt> subIds=newGeoTypesEltIdsAllGather2->selectByTupleId(ids->begin(),ids->end());
- int nbEntityElts=subIds->getNumberOfTuples();
+ MCAuto<DataArrayIdType> ids=newGeoTypesEltIdsAllGather->findIdsEqual(*idIt);
+ MCAuto<DataArrayIdType> subIds=newGeoTypesEltIdsAllGather2->selectByTupleId(ids->begin(),ids->end());
+ mcIdType nbEntityElts=subIds->getNumberOfTuples();
bool ret2;
MCAuto<MEDFileFieldPerMeshPerTypePerDisc> eltToAdd=MEDFileFieldPerMeshPerTypePerDisc::
NewObjectOnSameDiscThanPool(type,(INTERP_KERNEL::NormalizedCellType)newCode[3*(*idIt)],subIds,!subIds->isIota(newCode[3*(*idIt)+1]),nbi,
* and corresponding entry erased from \a entriesOnSameDisc.
* \return a newly allocated chunk
*/
-MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayInt *idsOfMeshElt,
- bool isPfl, int nbi, int offset,
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayIdType *idsOfMeshElt,
+ bool isPfl, int nbi, mcIdType offset,
std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
MEDFileFieldGlobsReal& glob,
bool ¬InExisting)
{
- int nbMeshEntities=idsOfMeshElt->getNumberOfTuples();
+ mcIdType nbMeshEntities=idsOfMeshElt->getNumberOfTuples();
std::list< const MEDFileFieldPerMeshPerTypePerDisc *>::iterator it=entriesOnSameDisc.begin();
for(;it!=entriesOnSameDisc.end();it++)
{
else
if(!(*it)->_profile.empty())
{
- const DataArrayInt *pfl=glob.getProfile((*it)->_profile.c_str());
+ const DataArrayIdType *pfl=glob.getProfile((*it)->_profile.c_str());
if(pfl->isEqualWithoutConsideringStr(*idsOfMeshElt))
break;
}
return ret;
}
-void MEDFileFieldPerMeshPerTypeCommon::assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypeCommon::assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
- std::vector<int> pos=addNewEntryIfNecessary(field,offset,nbOfCells);
- for(std::vector<int>::const_iterator it=pos.begin();it!=pos.end();it++)
+ std::vector<mcIdType> pos=addNewEntryIfNecessary(field,offset,nbOfCells);
+ for(std::vector<mcIdType>::const_iterator it=pos.begin();it!=pos.end();it++)
_field_pm_pt_pd[*it]->assignFieldNoProfile(start,offset,nbOfCells,field,arr,glob,nasc);
}
* \param [in] nbOfEltsInWholeMesh nb of elts of type \a this->_geo_type in \b WHOLE mesh
* \param [in] mesh is the mesh coming from the MEDFileMesh instance in correspondence with the MEDFileField. The mesh inside the \a field is simply ignored.
*/
-void MEDFileFieldPerMeshPerTypeCommon::assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypeCommon::assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
- std::vector<int> pos=addNewEntryIfNecessary(field,idsInPfl);
- for(std::vector<int>::const_iterator it=pos.begin();it!=pos.end();it++)
+ std::vector<mcIdType> pos=addNewEntryIfNecessary(field,idsInPfl);
+ for(std::vector<mcIdType>::const_iterator it=pos.begin();it!=pos.end();it++)
_field_pm_pt_pd[*it]->assignFieldProfile(isPflAlone,start,multiTypePfl,idsInPfl,locIds,nbOfEltsInWholeMesh,field,arr,mesh,glob,nasc);
}
-void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob)
+void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob)
{
_field_pm_pt_pd.resize(1);
_field_pm_pt_pd[0]=MEDFileFieldPerMeshPerTypePerDisc::New(this,ON_NODES,-3);
_field_pm_pt_pd[0]->assignNodeFieldNoProfile(start,field,arr,glob);
}
-void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
- MCAuto<DataArrayInt> pfl2=pfl->deepCopy();
+ MCAuto<DataArrayIdType> pfl2=pfl->deepCopy();
if(!arr || !arr->isAllocated())
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile : input array is null, or not allocated !");
_field_pm_pt_pd.resize(1);
_field_pm_pt_pd[0]->assignFieldProfile(true,start,pfl,pfl2,pfl2,-1,field,arr,0,glob,nasc);//mesh is not requested so 0 is send.
}
-std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells)
+std::vector<mcIdType> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells)
{
TypeOfField type=field->getTypeOfField();
if(type!=ON_GAUSS_PT)
_field_pm_pt_pd.resize(sz+1);
_field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind);
}
- std::vector<int> ret(1,(int)sz);
+ std::vector<mcIdType> ret(1,(mcIdType)sz);
return ret;
}
else
{
- std::vector<int> ret2=addNewEntryIfNecessaryGauss(field,offset,nbOfCells);
- int sz2=ret2.size();
- std::vector<int> ret3(sz2);
- int k=0;
- for(int i=0;i<sz2;i++)
+ std::vector<mcIdType> ret2=addNewEntryIfNecessaryGauss(field,offset,nbOfCells);
+ mcIdType sz2=ret2.size();
+ std::vector<mcIdType> ret3(sz2);
+ mcIdType k=0;
+ for(mcIdType i=0;i<sz2;i++)
{
- int sz=_field_pm_pt_pd.size();
- int locIdToFind=ret2[i];
+ mcIdType sz=_field_pm_pt_pd.size();
+ mcIdType locIdToFind=ret2[i];
bool found=false;
- for(int j=0;j<sz && !found;j++)
+ for(mcIdType j=0;j<sz && !found;j++)
{
if(_field_pm_pt_pd[j]->getLocId()==locIdToFind)
{
}
}
-std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells)
+std::vector<mcIdType> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells)
{
const MEDCouplingFieldDiscretization *disc=field->getDiscretization();
const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc);
if(!disc2)
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !");
- const DataArrayInt *da=disc2->getArrayOfDiscIds();
+ const DataArrayIdType *da=disc2->getArrayOfDiscIds();
if(!da)
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss (no profile) : no localization ids per cell array available ! The input Gauss node field is maybe invalid !");
- MCAuto<DataArrayInt> da2=da->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1);
- MCAuto<DataArrayInt> retTmp=da2->getDifferentValues();
+ MCAuto<DataArrayIdType> da2=da->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1);
+ MCAuto<DataArrayIdType> retTmp=da2->getDifferentValues();
if(retTmp->presenceOfValue(-1))
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : some cells have no dicretization description !");
- std::vector<int> ret(retTmp->begin(),retTmp->end());
+ std::vector<mcIdType> ret(retTmp->begin(),retTmp->end());
return ret;
}
-std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells)
+std::vector<mcIdType> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells)
{
TypeOfField type=field->getTypeOfField();
if(type!=ON_GAUSS_PT)
{
int locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0);
- int sz=_field_pm_pt_pd.size();
+ mcIdType sz=_field_pm_pt_pd.size();
bool found=false;
- for(int j=0;j<sz && !found;j++)
+ for(mcIdType j=0;j<sz && !found;j++)
{
if(_field_pm_pt_pd[j]->getLocId()==locIdToFind)
{
_field_pm_pt_pd.resize(sz+1);
_field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind);
}
- std::vector<int> ret(1,0);
+ std::vector<mcIdType> ret(1,0);
return ret;
}
else
{
- std::vector<int> ret2=addNewEntryIfNecessaryGauss(field,subCells);
- int sz2=ret2.size();
- std::vector<int> ret3(sz2);
- int k=0;
- for(int i=0;i<sz2;i++)
+ std::vector<mcIdType> ret2=addNewEntryIfNecessaryGauss(field,subCells);
+ mcIdType sz2=ret2.size();
+ std::vector<mcIdType> ret3(sz2);
+ mcIdType k=0;
+ for(mcIdType i=0;i<sz2;i++)
{
- int sz=_field_pm_pt_pd.size();
- int locIdToFind=ret2[i];
+ mcIdType sz=_field_pm_pt_pd.size();
+ mcIdType locIdToFind=ret2[i];
bool found=false;
- for(int j=0;j<sz && !found;j++)
+ for(mcIdType j=0;j<sz && !found;j++)
{
if(_field_pm_pt_pd[j]->getLocId()==locIdToFind)
{
}
}
-std::vector<int> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells)
+std::vector<mcIdType> MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells)
{
const MEDCouplingFieldDiscretization *disc=field->getDiscretization();
const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc);
if(!disc2)
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !");
- const DataArrayInt *da=disc2->getArrayOfDiscIds();
+ const DataArrayIdType *da=disc2->getArrayOfDiscIds();
if(!da)
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : no localization ids per cell array available ! The input Gauss node field is maybe invalid !");
- MCAuto<DataArrayInt> da2=da->selectByTupleIdSafe(subCells->getConstPointer(),subCells->getConstPointer()+subCells->getNumberOfTuples());
- MCAuto<DataArrayInt> retTmp=da2->getDifferentValues();
+ MCAuto<DataArrayIdType> da2=da->selectByTupleIdSafe(subCells->getConstPointer(),subCells->getConstPointer()+subCells->getNumberOfTuples());
+ MCAuto<DataArrayIdType> retTmp=da2->getDifferentValues();
if(retTmp->presenceOfValue(-1))
throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : some cells have no dicretization description !");
- std::vector<int> ret(retTmp->begin(),retTmp->end());
+ std::vector<mcIdType> ret(retTmp->begin(),retTmp->end());
return ret;
}
}
}
-void MEDFileFieldPerMeshPerTypeCommon::fillFieldSplitedByType(std::vector< std::pair<int,int> >& dads, std::vector<TypeOfField>& types, std::vector<std::string>& pfls, std::vector<std::string>& locs) const
+void MEDFileFieldPerMeshPerTypeCommon::fillFieldSplitedByType(std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<TypeOfField>& types, std::vector<std::string>& pfls, std::vector<std::string>& locs) const
{
- int sz=_field_pm_pt_pd.size();
+ mcIdType sz=_field_pm_pt_pd.size();
dads.resize(sz); types.resize(sz); pfls.resize(sz); locs.resize(sz);
- for(int i=0;i<sz;i++)
+ for(mcIdType i=0;i<sz;i++)
{
_field_pm_pt_pd[i]->getCoarseData(types[i],dads[i],pfls[i],locs[i]);
}
return _father->getMeshName();
}
-void MEDFileFieldPerMeshPerTypeCommon::getSizes(int& globalSz, int& nbOfEntries) const
+void MEDFileFieldPerMeshPerTypeCommon::getSizes(mcIdType& globalSz, mcIdType& nbOfEntries) const
{
for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
{
globalSz+=(*it)->getNumberOfTuples();
}
- nbOfEntries+=(int)_field_pm_pt_pd.size();
+ nbOfEntries+=(mcIdType)_field_pm_pt_pd.size();
}
-int MEDFileFieldPerMeshPerTypeCommon::getNumberOfComponents() const
+std::size_t MEDFileFieldPerMeshPerTypeCommon::getNumberOfComponents() const
{
return _father->getNumberOfComponents();
}
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypeCommon::locIdOfLeaf : not found such a leaf in this !");
}
-void MEDFileFieldPerMeshPerTypeCommon::fillValues(int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+void MEDFileFieldPerMeshPerTypeCommon::fillValues(mcIdType& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
int i=0;
for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++)
* \param [out] its - list of pair (start,stop) kept
* \return bool - false if the type of field \a tof is not contained in \a this.
*/
-bool MEDFileFieldPerMeshPerTypeCommon::keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair<int,int> >& its)
+bool MEDFileFieldPerMeshPerTypeCommon::keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its)
{
bool ret(false);
std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > newPmPtPd;
if((*it)->getType()==tof)
{
newPmPtPd.push_back(*it);
- std::pair<int,int> bgEnd; bgEnd.first=(*it)->getStart(); bgEnd.second=(*it)->getEnd();
+ std::pair<mcIdType,mcIdType> bgEnd; bgEnd.first=(*it)->getStart(); bgEnd.second=(*it)->getEnd();
(*it)->setNewStart(globalNum);
globalNum=(*it)->getEnd();
its.push_back(bgEnd);
* \param [out] its - list of pair (start,stop) kept
* \return bool - false if the type of field \a tof is not contained in \a this.
*/
-bool MEDFileFieldPerMeshPerTypeCommon::keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair<int,int> >& its)
+bool MEDFileFieldPerMeshPerTypeCommon::keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its)
{
if(_field_pm_pt_pd.size()<=idOfDisc)
return false;
MCAuto<MEDFileFieldPerMeshPerTypePerDisc> elt(_field_pm_pt_pd[idOfDisc]);
std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > newPmPtPd(1,elt);
- std::pair<int,int> bgEnd; bgEnd.first=_field_pm_pt_pd[idOfDisc]->getStart(); bgEnd.second=_field_pm_pt_pd[idOfDisc]->getEnd();
+ std::pair<mcIdType,mcIdType> bgEnd; bgEnd.first=_field_pm_pt_pd[idOfDisc]->getStart(); bgEnd.second=_field_pm_pt_pd[idOfDisc]->getEnd();
elt->setNewStart(globalNum);
globalNum=elt->getEnd();
its.push_back(bgEnd);
return true;
}
-void MEDFileFieldPerMeshPerTypeCommon::loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMeshPerTypeCommon::loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType &start, const MEDFileFieldNameScope& nasc)
{
for(std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
(*it)->loadOnlyStructureOfDataRecursively(fid,start,nasc);
return ret.retn();
}
-void MEDFileFieldPerMeshPerType::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const
+void MEDFileFieldPerMeshPerType::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const
{
if(_geo_type!=INTERP_KERNEL::NORM_ERROR)
{
}
}
-MCAuto<MEDFileFieldPerMeshPerType> MEDFileFieldPerMeshPerType::Aggregate(int &start, const std::vector<std::pair<int,const MEDFileFieldPerMeshPerType *> >& pms, const std::vector< std::vector< std::pair<int,int> > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector<std::pair< int, std::pair<int,int> > >& extractInfo)
+MCAuto<MEDFileFieldPerMeshPerType> MEDFileFieldPerMeshPerType::Aggregate(mcIdType &start, const std::vector<std::pair<int,const MEDFileFieldPerMeshPerType *> >& pms, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >& extractInfo)
{
MCAuto<MEDFileFieldPerMeshPerType> ret(MEDFileFieldPerMeshPerType::New(father,gt));
std::map<TypeOfField, std::vector< std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc * > > > m;
return ret.retn();
}
-void MEDFileFieldPerMeshPerTypeDyn::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const
+void MEDFileFieldPerMeshPerTypeDyn::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const
{
throw INTERP_KERNEL::Exception("not implemented yet !");
}
mesh->getTime(_mesh_iteration,_mesh_order);
}
-void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(int& start, const std::vector<int>& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(mcIdType& start, const std::vector<mcIdType>& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
- int nbOfTypes=code.size()/3;
+ std::size_t nbOfTypes=code.size()/3;
int offset=0;
- for(int i=0;i<nbOfTypes;i++)
+ for(std::size_t i=0;i<nbOfTypes;i++)
{
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)code[3*i];
- int nbOfCells=code[3*i+1];
- int pos=addNewEntryIfNecessary(type);
+ mcIdType nbOfCells=code[3*i+1];
+ mcIdType pos=addNewEntryIfNecessary(type);
_field_pm_pt[pos]->assignFieldNoProfile(start,offset,nbOfCells,field,arr,glob,nasc);
offset+=nbOfCells;
}
* \param [in] idsPerType is a vector containing the profiles needed to be created for MED file format. \b WARNING these processed MED file profiles can be subdivided again in case of Gauss points.
* \param [in] mesh is the mesh coming from the MEDFileMesh instance in correspondence with the MEDFileField. The mesh inside the \a field is simply ignored.
*/
-void MEDFileFieldPerMesh::assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const std::vector<int>& code, const std::vector<int>& code2, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMesh::assignFieldProfile(mcIdType& start, const DataArrayIdType *multiTypePfl, const std::vector<mcIdType>& code, const std::vector<mcIdType>& code2, const std::vector<DataArrayIdType *>& idsInPflPerType, const std::vector<DataArrayIdType *>& idsPerType, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
- int nbOfTypes(code.size()/3);
- for(int i=0;i<nbOfTypes;i++)
+ std::size_t nbOfTypes(code.size()/3);
+ for(std::size_t i=0;i<nbOfTypes;i++)
{
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)code[3*i];
- int pos=addNewEntryIfNecessary(type);
- DataArrayInt *pfl=0;
+ mcIdType pos=addNewEntryIfNecessary(type);
+ DataArrayIdType *pfl=0;
if(code[3*i+2]!=-1)
pfl=idsPerType[code[3*i+2]];
- int nbOfTupes2=code2.size()/3;
- int found=0;
+ mcIdType nbOfTupes2=code2.size()/3;
+ mcIdType found=0;
for(;found<nbOfTupes2;found++)
if(code[3*i]==code2[3*found])
break;
}
}
-void MEDFileFieldPerMesh::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob)
+void MEDFileFieldPerMesh::assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob)
{
- int pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR);
+ mcIdType pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR);
_field_pm_pt[pos]->assignNodeFieldNoProfile(start,field,arr,glob);
}
-void MEDFileFieldPerMesh::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMesh::assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc)
{
- int pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR);
+ mcIdType pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR);
_field_pm_pt[pos]->assignNodeFieldProfile(start,pfl,field,arr,glob,nasc);
}
-void MEDFileFieldPerMesh::loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc)
+void MEDFileFieldPerMesh::loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType& start, const MEDFileFieldNameScope& nasc)
{
for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
(*it)->loadOnlyStructureOfDataRecursively(fid,start,nasc);
void MEDFileFieldPerMesh::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const
{
- int nbOfTypes=_field_pm_pt.size();
- for(int i=0;i<nbOfTypes;i++)
+ mcIdType nbOfTypes=_field_pm_pt.size();
+ for(mcIdType i=0;i<nbOfTypes;i++)
{
_field_pm_pt[i]->copyOptionsFrom(*this);
_field_pm_pt[i]->writeLL(fid,nasc);
(*it)->fillTypesOfFieldAvailable(types);
}
-std::vector< std::vector< std::pair<int,int> > > MEDFileFieldPerMesh::getFieldSplitedByType(std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> > & locs) const
+std::vector< std::vector< std::pair<mcIdType,mcIdType> > > MEDFileFieldPerMesh::getFieldSplitedByType(std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> > & locs) const
{
int sz=_field_pm_pt.size();
- std::vector< std::vector<std::pair<int,int> > > ret(sz);
+ std::vector< std::vector<std::pair<mcIdType,mcIdType> > > ret(sz);
types.resize(sz); typesF.resize(sz); pfls.resize(sz); locs.resize(sz);
for(int i=0;i<sz;i++)
{
return _father->getOrder();
}
-int MEDFileFieldPerMesh::getNumberOfComponents() const
+std::size_t MEDFileFieldPerMesh::getNumberOfComponents() const
{
return _father->getNumberOfComponents();
}
* - 'notNullPfls' contains sz2 values that are extracted from 'pfls' in which null profiles have been removed.
* 'code' and 'notNullPfls' are in MEDCouplingUMesh::checkTypeConsistencyAndContig format.
*/
-void MEDFileFieldPerMesh::SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<int,int> >& dads, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& locs, std::vector<int>& code, std::vector<DataArrayInt *>& notNullPfls)
+void MEDFileFieldPerMesh::SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<const DataArrayIdType *>& pfls, const std::vector<int>& locs, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& notNullPfls)
{
int notNullPflsSz=0;
int nbOfArrs=geoTypes.size();
{
int startZone=j;
INTERP_KERNEL::NormalizedCellType refType=geoTypes[j];
- std::vector<const DataArrayInt *> notNullTmp;
+ std::vector<const DataArrayIdType *> notNullTmp;
if(pfls[j])
notNullTmp.push_back(pfls[j]);
j++;
}
else
break;
- std::vector< std::pair<int,int> > tmpDads(dads.begin()+startZone,dads.begin()+j);
- std::vector<const DataArrayInt *> tmpPfls(pfls.begin()+startZone,pfls.begin()+j);
+ std::vector< std::pair<mcIdType,mcIdType> > tmpDads(dads.begin()+startZone,dads.begin()+j);
+ std::vector<const DataArrayIdType *> tmpPfls(pfls.begin()+startZone,pfls.begin()+j);
std::vector<int> tmpLocs(locs.begin()+startZone,locs.begin()+j);
- code[3*i]=(int)refType;
+ code[3*i]=(mcIdType)refType;
std::vector<INTERP_KERNEL::NormalizedCellType> refType2(1,refType);
code[3*i+1]=ComputeNbOfElems(glob,type,refType2,tmpDads,tmpLocs);
if(notNullTmp.empty())
code[3*i+2]=-1;
else
{
- notNullPfls[notNullPflsSz]=DataArrayInt::Aggregate(notNullTmp);
+ notNullPfls[notNullPflsSz]=DataArrayIdType::Aggregate(notNullTmp);
code[3*i+2]=notNullPflsSz++;
}
}
/*!
* 'dads' 'geoTypes' and 'locs' are input parameters that should have same size sz. sz should be >=1.
*/
-int MEDFileFieldPerMesh::ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs)
+mcIdType MEDFileFieldPerMesh::ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs)
{
int sz=dads.size();
int ret=0;
_field_pm_pt[0]=DynamicCast<MEDFileFieldPerMeshPerType,MEDFileFieldPerMeshPerTypeCommon>(pt2);
}
-bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
+bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N,
MEDFileFieldGlobsReal& glob)
{
if(getMeshName()!=meshName)
return false;
std::set<INTERP_KERNEL::NormalizedCellType> typesToKeep;
for(std::size_t i=0;i<oldCode.size()/3;i++) typesToKeep.insert((INTERP_KERNEL::NormalizedCellType)oldCode[3*i]);
- std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > entries;
+ std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > > entries;
std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> entriesKept;
std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> otherEntries;
getUndergroundDataArrayExt(entries);
int sz=0;
if(!arr)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArrayDouble storing values of field is null !");
- for(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >::const_iterator it=entries.begin();it!=entries.end();it++)
+ for(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >::const_iterator it=entries.begin();it!=entries.end();it++)
{
if(typesToKeep.find((*it).first.first)!=typesToKeep.end())
{
else
otherEntries.push_back(getLeafGivenTypeAndLocId((*it).first.first,(*it).first.second));
}
- MCAuto<DataArrayInt> renumDefrag=DataArrayInt::New(); renumDefrag->alloc(arr->getNumberOfTuples(),1); renumDefrag->fillWithZero();
+ MCAuto<DataArrayIdType> renumDefrag=DataArrayIdType::New(); renumDefrag->alloc(arr->getNumberOfTuples(),1); renumDefrag->fillWithZero();
////////////////////
- MCAuto<DataArrayInt> explicitIdsOldInMesh=DataArrayInt::New(); explicitIdsOldInMesh->alloc(sz,1);//sz is a majorant of the real size. A realloc will be done after
- int *workI2=explicitIdsOldInMesh->getPointer();
+ MCAuto<DataArrayIdType> explicitIdsOldInMesh=DataArrayIdType::New(); explicitIdsOldInMesh->alloc(sz,1);//sz is a majorant of the real size. A realloc will be done after
+ mcIdType *workI2=explicitIdsOldInMesh->getPointer();
int sz1=0,sz2=0,sid=1;
std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > entriesKeptML=MEDFileFieldPerMeshPerTypePerDisc::SplitPerDiscretization(entriesKept);
// std::vector<int> tupleIdOfStartOfNewChuncksV(entriesKeptML.size());
for(std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator itL1=entriesKeptML.begin();itL1!=entriesKeptML.end();itL1++,sid++)
{
// tupleIdOfStartOfNewChuncksV[sid-1]=sz2;
- MCAuto<DataArrayInt> explicitIdsOldInArr=DataArrayInt::New(); explicitIdsOldInArr->alloc(sz,1);
- int *workI=explicitIdsOldInArr->getPointer();
+ MCAuto<DataArrayIdType> explicitIdsOldInArr=DataArrayIdType::New(); explicitIdsOldInArr->alloc(sz,1);
+ mcIdType *workI=explicitIdsOldInArr->getPointer();
for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator itL2=(*itL1).begin();itL2!=(*itL1).end();itL2++)
{
- int delta1=(*itL2)->fillTupleIds(workI); workI+=delta1; sz1+=delta1;
+ mcIdType delta1=(*itL2)->fillTupleIds(workI); workI+=delta1; sz1+=delta1;
(*itL2)->setLocId(sz2);
(*itL2)->_tmp_work1=(*itL2)->getStart();
- int delta2=(*itL2)->fillEltIdsFromCode(sz2,oldCode,glob,workI2); workI2+=delta2; sz2+=delta2;
+ mcIdType delta2=(*itL2)->fillEltIdsFromCode(sz2,oldCode,glob,workI2); workI2+=delta2; sz2+=delta2;
}
renumDefrag->setPartOfValuesSimple3(sid,explicitIdsOldInArr->begin(),explicitIdsOldInArr->end(),0,1,1);
}
explicitIdsOldInMesh->reAlloc(sz2);
- int tupleIdOfStartOfNewChuncks=arr->getNumberOfTuples()-sz2;
+ mcIdType tupleIdOfStartOfNewChuncks=arr->getNumberOfTuples()-sz2;
////////////////////
- MCAuto<DataArrayInt> permArrDefrag=renumDefrag->buildPermArrPerLevel(); renumDefrag=0;
+ MCAuto<DataArrayIdType> permArrDefrag=renumDefrag->buildPermArrPerLevel(); renumDefrag=0;
// perform redispatching of non concerned MEDFileFieldPerMeshPerTypePerDisc
std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> > otherEntriesNew;
for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=otherEntries.begin();it!=otherEntries.end();it++)
for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesKept.begin();it!=entriesKept.end();it++)
{
MCAuto<MEDFileFieldPerMeshPerTypePerDisc> elt=MEDFileFieldPerMeshPerTypePerDisc::New(*(*it));
- int newStart=elt->getLocId();
+ mcIdType newStart=elt->getLocId();
elt->setLocId((*it)->getGeoType());
elt->setNewStart(newStart);
elt->_tmp_work1=permArrDefrag->getIJ(elt->_tmp_work1,0);
}
MCAuto<DataArrayDouble> arr2=arr->renumber(permArrDefrag->getConstPointer());
// perform redispatching of concerned MEDFileFieldPerMeshPerTypePerDisc -> values are in arr2
- MCAuto<DataArrayInt> explicitIdsNewInMesh=renumO2N->selectByTupleId(explicitIdsOldInMesh->begin(),explicitIdsOldInMesh->end());
+ MCAuto<DataArrayIdType> explicitIdsNewInMesh=renumO2N->selectByTupleId(explicitIdsOldInMesh->begin(),explicitIdsOldInMesh->end());
std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > entriesKeptPerDisc=MEDFileFieldPerMeshPerTypePerDisc::SplitPerDiscretization(entriesKeptNew2);
bool ret=false;
for(std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator it4=entriesKeptPerDisc.begin();it4!=entriesKeptPerDisc.end();it4++)
* \param [in,out] globalNum a global numbering counter for the renumbering.
* \param [out] its - list of pair (start,stop) kept
*/
-void MEDFileFieldPerMesh::keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair<int,int> >& its)
+void MEDFileFieldPerMesh::keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its)
{
std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > ret;
for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- std::vector< std::pair<int,int> > its2;
+ std::vector< std::pair<mcIdType,mcIdType> > its2;
if((*it)->keepOnlySpatialDiscretization(tof,globalNum,its2))
{
ret.push_back(*it);
* \param [in,out] globalNum a global numbering counter for the renumbering.
* \param [out] its - list of pair (start,stop) kept
*/
-void MEDFileFieldPerMesh::keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair<int,int> >& its)
+void MEDFileFieldPerMesh::keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its)
{
std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > ret;
for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
- std::vector< std::pair<int,int> > its2;
+ std::vector< std::pair<mcIdType,mcIdType> > its2;
if((*it)->keepOnlyGaussDiscretization(idOfDisc,globalNum,its2))
{
ret.push_back(*it);
if(_field_pm_pt.empty())
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : no types field set !");
//
- std::vector< std::pair<int,int> > dads;
- std::vector<const DataArrayInt *> pfls;
- std::vector<DataArrayInt *> notNullPflsPerGeoType;
- std::vector<int> locs,code;
+ std::vector< std::pair<mcIdType,mcIdType> > dads;
+ std::vector<const DataArrayIdType *> pfls;
+ std::vector<DataArrayIdType *> notNullPflsPerGeoType;
+ std::vector<int> locs;
+ std::vector<mcIdType>code;
std::vector<INTERP_KERNEL::NormalizedCellType> geoTypes;
for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
(*it)->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes);
throw INTERP_KERNEL::Exception(oss.str());
}
//
- std::vector< MCAuto<DataArrayInt> > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
- std::vector< const DataArrayInt *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
+ std::vector< MCAuto<DataArrayIdType> > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
+ std::vector< const DataArrayIdType *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
if(type!=ON_NODES)
{
- DataArrayInt *arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3);
+ DataArrayIdType *arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3);
if(!arr)
return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc);
else
{
- MCAuto<DataArrayInt> arr2(arr);
+ MCAuto<DataArrayIdType> arr2(arr);
return finishField2(type,glob,dads,locs,geoTypes,mesh,arr,isPfl,arrOut,nasc);
}
}
}
}
-DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const
+DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayIdType *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const
{
if(_field_pm_pt.empty())
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : no types field set !");
//
- std::vector<std::pair<int,int> > dads;
- std::vector<const DataArrayInt *> pfls;
- std::vector<DataArrayInt *> notNullPflsPerGeoType;
- std::vector<int> locs,code;
+ std::vector<std::pair<mcIdType,mcIdType> > dads;
+ std::vector<const DataArrayIdType *> pfls;
+ std::vector<DataArrayIdType *> notNullPflsPerGeoType;
+ std::vector<int> locs;
+ std::vector<mcIdType> code;
std::vector<INTERP_KERNEL::NormalizedCellType> geoTypes;
for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
(*it)->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes);
std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl : " << "The field \"" << nasc.getName() << "\" exists but not with such spatial discretization or such dimension specified !";
throw INTERP_KERNEL::Exception(oss.str());
}
- std::vector< MCAuto<DataArrayInt> > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
- std::vector< const DataArrayInt *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
+ std::vector< MCAuto<DataArrayIdType> > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
+ std::vector< const DataArrayIdType *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
if(type!=ON_NODES)
{
- MCAuto<DataArrayInt> arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3);
+ MCAuto<DataArrayIdType> arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3);
return finishField4(dads,arr,mesh->getNumberOfCells(),pfl);
}
else
}
}
-void MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+void MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
- int globalSz=0;
- int nbOfEntries=0;
+ mcIdType globalSz=0;
+ mcIdType nbOfEntries=0;
for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
{
(*it)->getSizes(globalSz,nbOfEntries);
* \param [in] dts - (Distribution of types) = level 1 : meshes to aggregate. Level 2 : all geo type. Level 3 pair specifying geo type and number of elem in geotype.
* \param [out] extractInfo - Gives information about the where the data comes from. It is a vector of triplet. First element in the triplet the mesh pos. The 2nd one the start pos. The 3rd the end pos.
*/
-MCAuto<MEDFileFieldPerMeshPerTypePerDisc> MEDFileFieldPerMeshPerTypePerDisc::Aggregate(int &start, const std::vector< std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc *> >& pms, const std::vector< std::vector< std::pair<int,int> > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector<std::pair< int, std::pair<int,int> > >& extractInfo)
+MCAuto<MEDFileFieldPerMeshPerTypePerDisc> MEDFileFieldPerMeshPerTypePerDisc::Aggregate(mcIdType &start, const std::vector< std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc *> >& pms, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >& extractInfo)
{
MCAuto<MEDFileFieldPerMeshPerTypePerDisc> ret(new MEDFileFieldPerMeshPerTypePerDisc(father,tof));
if(pms.empty())
INTERP_KERNEL::NormalizedCellType gt(pms[0].second->getGeoType());
std::size_t i(0);
std::vector< std::pair<int,int> > filteredDTS;
- for(std::vector< std::vector< std::pair<int,int> > >::const_iterator it=dts.begin();it!=dts.end();it++,i++)
- for(std::vector< std::pair<int,int> >::const_iterator it2=(*it).begin();it2!=(*it).end();it2++)
+ for(std::vector< std::vector< std::pair<int,mcIdType> > >::const_iterator it=dts.begin();it!=dts.end();it++,i++)
+ for(std::vector< std::pair<int,mcIdType> >::const_iterator it2=(*it).begin();it2!=(*it).end();it2++)
if((*it2).first==gt)
filteredDTS.push_back(std::pair<int,int>(i,(*it2).second));
if(pms.size()!=filteredDTS.size())
return ret;
}
-MCAuto<MEDFileFieldPerMesh> MEDFileFieldPerMesh::Aggregate(int &start, const std::vector<const MEDFileFieldPerMesh *>& pms, const std::vector< std::vector< std::pair<int,int> > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector<std::pair< int, std::pair<int,int> > >& extractInfo)
+MCAuto<MEDFileFieldPerMesh> MEDFileFieldPerMesh::Aggregate(mcIdType &start, const std::vector<const MEDFileFieldPerMesh *>& pms, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >& extractInfo)
{
MCAuto<MEDFileFieldPerMesh> ret(new MEDFileFieldPerMesh(father,pms[0]->getMeshName(),pms[0]->getMeshIteration(),pms[0]->getMeshOrder()));
std::map<INTERP_KERNEL::NormalizedCellType, std::vector< std::pair<int,const MEDFileFieldPerMeshPerType *> > > m;
* \param [in] mesh is \b NOT the global mesh, but the possibly reduced mesh. \a mesh parameter will be directly aggregated in the returned field
*/
MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob,
- const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
+ const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs,
const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
isPfl=false;
int nbOfArrs=dads.size();
for(int i=0;i<nbOfArrs;i++)
{
- std::vector<std::pair<int,int> > dads2(1,dads[i]); const std::vector<int> locs2(1,locs[i]);
+ std::vector<std::pair<mcIdType,mcIdType> > dads2(1,dads[i]); const std::vector<int> locs2(1,locs[i]);
const std::vector<INTERP_KERNEL::NormalizedCellType> geoTypes2(1,INTERP_KERNEL::NORM_ERROR);
int nbOfElems=ComputeNbOfElems(glob,type,geoTypes2,dads2,locs2);
- MCAuto<DataArrayInt> di=DataArrayInt::New();
+ MCAuto<DataArrayIdType> di=DataArrayIdType::New();
di->alloc(nbOfElems,1);
di->iota(offset);
const MEDFileFieldLoc& fl=glob->getLocalizationFromId(locs[i]);
* \param [in] mesh is the global mesh.
*/
MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob,
- const std::vector<std::pair<int,int> >& dads, const std::vector<int>& locs,
+ const std::vector<std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs,
const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes,
- const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+ const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
if(da->isIota(mesh->getNumberOfCells()))
return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc);
* This method is the complement of MEDFileFieldPerMesh::finishField2 method except that this method works for node profiles.
*/
MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileFieldGlobsReal *glob,
- const std::vector<std::pair<int,int> >& dads, const std::vector<int>& locs,
- const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+ const std::vector<std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs,
+ const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
if(da->isIota(mesh->getNumberOfNodes()))
return finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc);
if(meshu->getNodalConnectivity()==0)
{
MCAuto<MEDCouplingFieldDouble> ret=finishField(ON_CELLS,glob,dads,locs,mesh,isPfl,arrOut,nasc);
- int nb=da->getNbOfElems();
- const int *ptr=da->getConstPointer();
+ mcIdType nb=da->getNbOfElems();
+ const mcIdType *ptr=da->getConstPointer();
MEDCouplingUMesh *meshuc=const_cast<MEDCouplingUMesh *>(meshu);
meshuc->allocateCells(nb);
- for(int i=0;i<nb;i++)
+ for(mcIdType i=0;i<nb;i++)
meshuc->insertNextCell(INTERP_KERNEL::NORM_POINT1,1,ptr+i);
meshuc->finishInsertingCells();
ret->setMesh(meshuc);
//
MCAuto<MEDCouplingFieldDouble> ret=finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc);
isPfl=true;
- DataArrayInt *arr2=0;
- MCAuto<DataArrayInt> cellIds=mesh->getCellIdsFullyIncludedInNodeIds(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
+ DataArrayIdType *arr2=0;
+ MCAuto<DataArrayIdType> cellIds=mesh->getCellIdsFullyIncludedInNodeIds(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
MCAuto<MEDCouplingMesh> mesh2=mesh->buildPartAndReduceNodes(cellIds->getConstPointer(),cellIds->getConstPointer()+cellIds->getNbOfElems(),arr2);
- MCAuto<DataArrayInt> arr3(arr2);
- int nnodes=mesh2->getNumberOfNodes();
- if(nnodes==(int)da->getNbOfElems())
+ MCAuto<DataArrayIdType> arr3(arr2);
+ mcIdType nnodes=mesh2->getNumberOfNodes();
+ if(nnodes==(mcIdType)da->getNbOfElems())
{
- MCAuto<DataArrayInt> da3=da->transformWithIndArrR(arr2->begin(),arr2->end());
+ MCAuto<DataArrayIdType> da3=da->transformWithIndArrR(arr2->begin(),arr2->end());
arrOut->renumberInPlace(da3->getConstPointer());
mesh2->setName(mesh->getName().c_str());
ret->setMesh(mesh2);
/*!
* This method is the most light method of field retrieving.
*/
-DataArray *MEDFileFieldPerMesh::finishField4(const std::vector<std::pair<int,int> >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const
+DataArray *MEDFileFieldPerMesh::finishField4(const std::vector<std::pair<mcIdType,mcIdType> >& dads, const DataArrayIdType *pflIn, mcIdType nbOfElems, DataArrayIdType *&pflOut) const
{
if(!pflIn)
{
- pflOut=DataArrayInt::New();
+ pflOut=DataArrayIdType::New();
pflOut->alloc(nbOfElems,1);
pflOut->iota(0);
}
else
{
- pflOut=const_cast<DataArrayInt*>(pflIn);
+ pflOut=const_cast<DataArrayIdType*>(pflIn);
pflOut->incrRef();
}
- MCAuto<DataArrayInt> safePfl(pflOut);
+ MCAuto<DataArrayIdType> safePfl(pflOut);
MCAuto<DataArray> da=getOrCreateAndGetArray()->selectByTupleRanges(dads);
const std::vector<std::string>& infos=getInfo();
- int nbOfComp=infos.size();
- for(int i=0;i<nbOfComp;i++)
+ std::size_t nbOfComp=infos.size();
+ for(std::size_t i=0;i<nbOfComp;i++)
da->setInfoOnComponent(i,infos[i].c_str());
safePfl->incrRef();
return da.retn();
class MEDFileFieldPerMeshPerTypePerDisc : public RefCountObject, public MEDFileWritable
{
public:
- static MEDFileFieldPerMeshPerTypePerDisc *NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd);
+ static MEDFileFieldPerMeshPerTypePerDisc *NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType profileIt, const PartDefinition *pd);
static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int locId);
static MEDFileFieldPerMeshPerTypePerDisc *New(const MEDFileFieldPerMeshPerTypePerDisc& other);
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDFileFieldPerMeshPerTypePerDisc *deepCopy(MEDFileFieldPerMeshPerTypeCommon *father) const;
- void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
- void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
- void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob);
- void getCoarseData(TypeOfField& type, std::pair<int,int>& dad, std::string& pfl, std::string& loc) const;
+ void assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+ void assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+ void assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob);
+ void getCoarseData(TypeOfField& type, std::pair<mcIdType,mcIdType>& dad, std::string& pfl, std::string& loc) const;
void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const;
const MEDFileFieldPerMeshPerTypeCommon *getFather() const;
- void loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc);
+ void loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType& start, const MEDFileFieldNameScope& nasc);
void loadBigArray(med_idt fid, const MEDFileFieldNameScope& nasc);
- void setNewStart(int newValueOfStart);
+ void setNewStart(mcIdType newValueOfStart);
int getIteration() const;
int getOrder() const;
double getTime() const;
void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const;
void setType(TypeOfField newType);
INTERP_KERNEL::NormalizedCellType getGeoType() const;
- int getNumberOfComponents() const;
- int getNumberOfTuples() const;
- int getStart() const { return _start; }
- int getEnd() const { return _end; }
- void setEnd(int endd) { _end=endd; }
- int getNumberOfVals() const { return _nval; }
- void incrementNbOfVals(int deltaNbVal);
+ std::size_t getNumberOfComponents() const;
+ mcIdType getNumberOfTuples() const;
+ mcIdType getStart() const { return _start; }
+ mcIdType getEnd() const { return _end; }
+ void setEnd(mcIdType endd) { _end=endd; }
+ mcIdType getNumberOfVals() const { return _nval; }
+ void incrementNbOfVals(mcIdType deltaNbVal);
DataArray *getOrCreateAndGetArray();
const DataArray *getOrCreateAndGetArray() const;
const std::vector<std::string>& getInfo() const;
void setFather(MEDFileFieldPerMeshPerTypeCommon *newFather) { _father=newFather; }
void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
- void getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs,
+ void getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs,
std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
- void fillValues(int discId, int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
- int fillEltIdsFromCode(int offset, const std::vector<int>& codeOfMesh, const MEDFileFieldGlobsReal& glob, int *ptToFill) const;
- int fillTupleIds(int *ptToFill) const;
+ void fillValues(int discId, mcIdType& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
+ mcIdType fillEltIdsFromCode(mcIdType offset, const std::vector<mcIdType>& codeOfMesh, const MEDFileFieldGlobsReal& glob, mcIdType *ptToFill) const;
+ mcIdType fillTupleIds(mcIdType *ptToFill) const;
static int ConvertType(TypeOfField type, int locId);
static std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > SplitPerDiscretization(const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entries);
- static bool RenumberChunks(int offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
- const DataArrayInt *explicitIdsInMesh, const std::vector<int>& newCode,
+ static bool RenumberChunks(mcIdType offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
+ const DataArrayIdType *explicitIdsInMesh, const std::vector<mcIdType>& newCode,
MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, std::vector< MCAuto<MEDFileFieldPerMeshPerTypePerDisc> >& result);
- static MEDFileFieldPerMeshPerTypePerDisc *NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayInt *idsOfMeshElt,
- bool isPfl, int nbi, int offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
+ static MEDFileFieldPerMeshPerTypePerDisc *NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayIdType *idsOfMeshElt,
+ bool isPfl, int nbi, mcIdType offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc,
MEDFileFieldGlobsReal& glob, bool ¬InExisting);
- static MCAuto<MEDFileFieldPerMeshPerTypePerDisc> Aggregate(int &start, const std::vector<std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc *> >& pms, const std::vector< std::vector< std::pair<int,int> > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector<std::pair< int, std::pair<int,int> > >& extractInfo);
+ static MCAuto<MEDFileFieldPerMeshPerTypePerDisc> Aggregate(mcIdType &start, const std::vector<std::pair<int,const MEDFileFieldPerMeshPerTypePerDisc *> >& pms, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >& extractInfo);
MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type):_type(type),_father(fath),_start(-1),_end(-1),_nval(-1),_loc_id(-5),_profile_it(-1) { }
private:
- MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd);
- MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const std::string& dummy);
+ MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType profileIt, const PartDefinition *pd);
+ MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType profileIt, const std::string& dummy);
MEDFileFieldPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc& other);
MEDFileFieldPerMeshPerTypePerDisc();
private:
private:
TypeOfField _type;
MEDFileFieldPerMeshPerTypeCommon *_father;
- int _start;
- int _end;
+ mcIdType _start;
+ mcIdType _end;
//! _nval is different than end-start in case of ON_GAUSS_PT and ON_GAUSS_NE ! (_nval=(_end-_start)/nbi)
- int _nval;
+ mcIdType _nval;
std::string _profile;
std::string _localization;
//! only on assignment -3 : ON_NODES, -2 : ON_CELLS, -1 : ON_GAUSS_NE, 0..* : ON_GAUSS_PT
mutable int _loc_id;
- mutable int _profile_it;
+ mutable mcIdType _profile_it;
MCAuto<PartDefinition> _pd;
public:
mutable int _tmp_work1;
public:
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
- void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
- void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
- void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
- void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+ void assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+ void assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+ void assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
+ void assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
const MEDFileFieldPerMesh *getFather() const;
- void loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc);
+ void loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType &start, const MEDFileFieldNameScope& nasc);
void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc);
void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const;
bool isUniqueLevel(int& dim) const;
void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const;
- void fillFieldSplitedByType(std::vector< std::pair<int,int> >& dads, std::vector<TypeOfField>& types, std::vector<std::string>& pfls, std::vector<std::string>& locs) const;
+ void fillFieldSplitedByType(std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<TypeOfField>& types, std::vector<std::string>& pfls, std::vector<std::string>& locs) const;
int getIteration() const;
int getOrder() const;
double getTime() const;
std::string getMeshName() const;
- void getSizes(int& globalSz, int& nbOfEntries) const;
- int getNumberOfComponents() const;
+ void getSizes(mcIdType& globalSz, mcIdType& nbOfEntries) const;
+ std::size_t getNumberOfComponents() const;
bool presenceOfMultiDiscPerGeoType() const;
void pushDiscretization(MEDFileFieldPerMeshPerTypePerDisc *disc);
DataArray *getOrCreateAndGetArray();
const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId) const;
int getNumberOfLoc() const { return _field_pm_pt_pd.size(); }
int locIdOfLeaf(const MEDFileFieldPerMeshPerTypePerDisc *leaf) const;
- void fillValues(int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+ void fillValues(mcIdType& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
void setLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves);
- bool keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair<int,int> >& its);
- bool keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair<int,int> >& its);
+ bool keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its);
+ bool keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its);
static med_entity_type ConvertIntoMEDFileType(TypeOfField ikType, INTERP_KERNEL::NormalizedCellType ikGeoType, med_geometry_type& medfGeoType);
MEDFileFieldPerMeshPerTypeCommon(MEDFileFieldPerMesh *father):_father(father) { }
void setFather(MEDFileFieldPerMesh *father);
virtual void simpleRepr(int bkOffset, std::ostream& oss, int id) const = 0;
virtual std::string getGeoTypeRepr() const = 0;
virtual MEDFileFieldPerMeshPerTypeCommon *deepCopy(MEDFileFieldPerMesh *father) const = 0;
- virtual void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const = 0;
+ virtual void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const = 0;
protected:
void deepCopyElements();
- std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells);
- std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells);
- std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells);
- std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells);
+ std::vector<mcIdType> addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells);
+ std::vector<mcIdType> addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells);
+ std::vector<mcIdType> addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells);
+ std::vector<mcIdType> addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells);
private:
MEDFileFieldPerMesh *_father;
protected:
public:
static MEDFileFieldPerMeshPerType *New(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType);
static MEDFileFieldPerMeshPerType *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd);
- static MCAuto<MEDFileFieldPerMeshPerType> Aggregate(int &start, const std::vector< std::pair<int,const MEDFileFieldPerMeshPerType *> >& pms, const std::vector< std::vector< std::pair<int,int> > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector<std::pair< int, std::pair<int,int> > >& extractInfo);
+ static MCAuto<MEDFileFieldPerMeshPerType> Aggregate(mcIdType &start, const std::vector< std::pair<int,const MEDFileFieldPerMeshPerType *> >& pms, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >& extractInfo);
public:// overload of abstract methods
void getDimension(int& dim) const;
INTERP_KERNEL::NormalizedCellType getGeoType() const;
void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
std::string getGeoTypeRepr() const;
MEDFileFieldPerMeshPerType *deepCopy(MEDFileFieldPerMesh *father) const;
- void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
+ void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
private:
MEDFileFieldPerMeshPerType(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd);
MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *father, INTERP_KERNEL::NormalizedCellType gt);
void simpleRepr(int bkOffset, std::ostream& oss, int id) const;
std::string getGeoTypeRepr() const;
MEDFileFieldPerMeshPerTypeDyn *deepCopy(MEDFileFieldPerMesh *father) const;
- void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
+ void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair<mcIdType,mcIdType> >& dads, std::vector<const DataArrayIdType *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
private:
MEDFileFieldPerMeshPerTypeDyn(med_idt fid, MEDFileFieldPerMesh *fath, const MEDFileStructureElement *se, const MEDFileFieldNameScope& nasc);
private:
MEDFileFieldPerMesh *deepCopy(MEDFileAnyTypeField1TSWithoutSDA *father) const;
void simpleRepr(int bkOffset,std::ostream& oss, int id) const;
void copyTinyInfoFrom(const MEDCouplingMesh *mesh);
- void assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const std::vector<int>& code, const std::vector<int>& code2, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
- void assignFieldNoProfileNoRenum(int& start, const std::vector<int>& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
- void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
- void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
- void loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc);
+ void assignFieldProfile(mcIdType& start, const DataArrayIdType *multiTypePfl, const std::vector<mcIdType>& code, const std::vector<mcIdType>& code2, const std::vector<DataArrayIdType *>& idsInPflPerType, const std::vector<DataArrayIdType *>& idsPerType, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+ void assignFieldNoProfileNoRenum(mcIdType& start, const std::vector<mcIdType>& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+ void assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
+ void assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc);
+ void loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType &start, const MEDFileFieldNameScope& nasc);
void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc);
void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const;
void fillTypesOfFieldAvailable(std::set<TypeOfField>& types) const;
- std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
+ std::vector< std::vector< std::pair<mcIdType,mcIdType> > > getFieldSplitedByType(std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
void accept(MEDFileFieldVisitor& visitor) const;
void getDimension(int& dim) const;
bool isUniqueLevel(int& dim) const;
int getMeshOrder() const { return _mesh_order; }
std::string getMeshName() const;
void setMeshName(const std::string& meshName);
- int getNumberOfComponents() const;
+ std::size_t getNumberOfComponents() const;
bool presenceOfMultiDiscPerGeoType() const;
bool presenceOfStructureElements() const;
bool onlyStructureElements() const;
std::vector<std::string> getLocsReallyUsedMulti() const;
void convertMedBallIntoClassic();
bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
- bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob);
- void keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair<int,int> >& its);
- void keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair<int,int> >& its);
+ bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob);
+ void keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its);
+ void keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair<mcIdType,mcIdType> >& its);
void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
- DataArray *getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const;
- void getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+ DataArray *getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayIdType *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const;
+ void getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId);
const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const;
- static MCAuto<MEDFileFieldPerMesh> Aggregate(int &start, const std::vector<const MEDFileFieldPerMesh *>& pms, const std::vector< std::vector< std::pair<int,int> > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector<std::pair< int, std::pair<int,int> > >& extractInfo);
+ static MCAuto<MEDFileFieldPerMesh> Aggregate(mcIdType &start, const std::vector<const MEDFileFieldPerMesh *>& pms, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector<std::pair< int, std::pair<mcIdType,mcIdType> > >& extractInfo);
private:
int addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type);
MEDCouplingFieldDouble *finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob,
- const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
+ const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
MEDCouplingFieldDouble *finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob,
- const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
+ const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs,
const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes,
- const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
+ const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
MEDCouplingFieldDouble *finishFieldNode2(const MEDFileFieldGlobsReal *glob,
- const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs,
- const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
- DataArray *finishField4(const std::vector< std::pair<int,int> >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const;
+ const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs,
+ const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
+ DataArray *finishField4(const std::vector< std::pair<mcIdType,mcIdType> >& dads, const DataArrayIdType *pflIn, mcIdType nbOfElems, DataArrayIdType *&pflOut) const;
void assignNewLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves);
static void SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type,
- const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<int,int> >& dads, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& locs,
- std::vector<int>& code, std::vector<DataArrayInt *>& notNullPfls);
- static int ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<int,int> >& dads, const std::vector<int>& locs);
+ const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<const DataArrayIdType *>& pfls, const std::vector<int>& locs,
+ std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& notNullPfls);
+ static mcIdType ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector< std::pair<mcIdType,mcIdType> >& dads, const std::vector<int>& locs);
MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const MEDFileEntities *entities);
MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh);
- MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const std::string& meshName, int meshIt, int meshOrd):_father(fath),_mesh_iteration(meshIt),_mesh_order(meshOrd) { }
+ MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const std::string& meshName, int meshIt, int meshOrd):_mesh_iteration(meshIt),_mesh_order(meshOrd),_father(fath) { }
private:
int _mesh_iteration;
int _mesh_order;
MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
{
- int id=0;
+ mcIdType id=0;
MCAuto<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++)
{
MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
{
- int id=0;
+ mcIdType id=0;
MCAuto<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++)
{
/*!
* See doc at MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt
*/
-DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
{
return getTimeStepEntry(iteration,order).getUndergroundDataArrayExt(entries);
}
-bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
+bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N,
MEDFileFieldGlobsReal& glob)
{
bool ret=false;
/*!
* entry point for users that want to iterate into MEDFile DataStructure without any overhead.
*/
-std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeFieldMultiTSWithoutSDA::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
+std::vector< std::vector< std::pair<mcIdType,mcIdType> > > MEDFileAnyTypeFieldMultiTSWithoutSDA::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
{
return getTimeStepEntry(iteration,order).getFieldSplitedByType(mname,types,typesF,pfls,locs);
}
_time_steps.push_back(obj);
}
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller)
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller)
{
if(!field)
throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !");
const MEDFileAnyTypeField1TSWithoutSDA *tsPtr(ts);
if(tsPtr)
{
- if(tsPtr->getNumberOfComponents()!=(int)_infos.size())
+ if(tsPtr->getNumberOfComponents()!=_infos.size())
{
std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration : trying to set element with " << tsPtr->getNumberOfComponents() << " components ! Should be " << _infos.size() << " !";
throw INTERP_KERNEL::Exception(oss.str());
return contentNotNullBase()->getTypesOfFieldAvailable();
}
-std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeFieldMultiTS::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
+std::vector< std::vector< std::pair<mcIdType,mcIdType> > > MEDFileAnyTypeFieldMultiTS::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
{
return contentNotNullBase()->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
}
}
template<class T>
-MCAuto<MEDFileAnyTypeField1TS> AggregateHelperF1TS(const std::vector< typename MLFieldTraits<T>::F1TSType const *>& f1tss, const std::vector< std::vector< std::pair<int,int> > >& dts)
+MCAuto<MEDFileAnyTypeField1TS> AggregateHelperF1TS(const std::vector< typename MLFieldTraits<T>::F1TSType const *>& f1tss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts)
{
MCAuto< typename MLFieldTraits<T>::F1TSType > ret(MLFieldTraits<T>::F1TSType::New());
if(f1tss.empty())
}
template<class T>
-MCAuto< MEDFileAnyTypeFieldMultiTS > AggregateHelperFMTS(const std::vector< typename MLFieldTraits<T>::FMTSType const *>& fmtss, const std::vector< std::vector< std::pair<int,int> > >& dts)
+MCAuto< MEDFileAnyTypeFieldMultiTS > AggregateHelperFMTS(const std::vector< typename MLFieldTraits<T>::FMTSType const *>& fmtss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts)
{
MCAuto< typename MLFieldTraits<T>::FMTSType > ret(MLFieldTraits<T>::FMTSType::New());
if(fmtss.empty())
/*!
* \a dts and \a ftmss are expected to have same size.
*/
-MCAuto<MEDFileAnyTypeFieldMultiTS> MEDFileAnyTypeFieldMultiTS::Aggregate(const std::vector<const MEDFileAnyTypeFieldMultiTS *>& fmtss, const std::vector< std::vector< std::pair<int,int> > >& dts)
+MCAuto<MEDFileAnyTypeFieldMultiTS> MEDFileAnyTypeFieldMultiTS::Aggregate(const std::vector<const MEDFileAnyTypeFieldMultiTS *>& fmtss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts)
{
if(fmtss.empty())
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : input vector is empty !");
MEDLOADER_EXPORT void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const;
MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const;
MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
- MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller);
- MEDLOADER_EXPORT std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
+ MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller);
+ MEDLOADER_EXPORT std::vector< std::vector< std::pair<mcIdType,mcIdType> > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
MEDLOADER_EXPORT std::vector< std::vector<TypeOfField> > getTypesOfFieldAvailable() const;
MEDLOADER_EXPORT DataArray *getUndergroundDataArray(int iteration, int order) const;
- MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
- MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob);
+ MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
+ MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob);
MEDLOADER_EXPORT void accept(MEDFileFieldVisitor& visitor) const;
MEDLOADER_EXPORT void loadStructureOrStructureAndBigArraysRecursively(med_idt fid, int nbPdt, med_field_type fieldTyp, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities);
MEDLOADER_EXPORT void writeLL(med_idt fid, const MEDFileWritable& opts) const;
MEDLOADER_EXPORT int getNumberOfComponents() const;
MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const;
MEDLOADER_EXPORT std::vector< std::vector<TypeOfField> > getTypesOfFieldAvailable() const;
- MEDLOADER_EXPORT std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
+ MEDLOADER_EXPORT std::vector< std::vector< std::pair<mcIdType,mcIdType> > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
MEDLOADER_EXPORT MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> getContent();
public:
MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *buildNewEmpty() const = 0;
- MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const = 0;
- MEDLOADER_EXPORT static MCAuto<MEDFileAnyTypeFieldMultiTS> Aggregate(const std::vector<const MEDFileAnyTypeFieldMultiTS *>& fmtss, const std::vector< std::vector< std::pair<int,int> > >& dts);
+ MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const = 0;
+ MEDLOADER_EXPORT static MCAuto<MEDFileAnyTypeFieldMultiTS> Aggregate(const std::vector<const MEDFileAnyTypeFieldMultiTS *>& fmtss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts);
public:
MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed() const;
MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsed() const;
MEDLOADER_EXPORT static typename MLFieldTraits<T>::FMTSType *New(med_idt fid, const std::string& fieldName, bool loadAll=true);
MEDLOADER_EXPORT static typename MLFieldTraits<T>::FMTSType *New(const typename MLFieldTraits<T>::FMTSWSDAType& other, bool shallowCopyOfContent);
MEDLOADER_EXPORT static typename MLFieldTraits<T>::FMTSType *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities, bool loadAll=true);
- MEDLOADER_EXPORT typename MLFieldTraits<T>::FMTSType *extractPartImpl(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const;
- MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); }
+ MEDLOADER_EXPORT typename MLFieldTraits<T>::FMTSType *extractPartImpl(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const;
+ MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); }
//
MEDLOADER_EXPORT typename Traits<T>::FieldType *field(int iteration, int order, const MEDFileMesh *mesh) const;
MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
- MEDLOADER_EXPORT typename Traits<T>::ArrayType *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
+ MEDLOADER_EXPORT typename Traits<T>::ArrayType *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl) const;
//
MEDLOADER_EXPORT void appendFieldNoProfileSBT(const typename Traits<T>::FieldType *field);
- MEDLOADER_EXPORT void appendFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
- MEDLOADER_EXPORT void appendFieldProfileFlatly(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ MEDLOADER_EXPORT void appendFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
+ MEDLOADER_EXPORT void appendFieldProfileFlatly(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
//
MEDLOADER_EXPORT typename MLFieldTraits<T>::F1TSType *getTimeStepAtPos(int pos) const;
MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArray(int iteration, int order) const;
- MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+ MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const;
MEDLOADER_EXPORT typename MLFieldTraits<T>::FMTSType *buildNewEmptyImpl() const;
MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const;
protected:
const typename MLFieldTraits<T>::FMTSWSDAType *contentNotNull() const;
typename MLFieldTraits<T>::FMTSWSDAType *contentNotNull();
- void appendFieldProfileGeneral(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller);
+ void appendFieldProfileGeneral(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, bool smartPflKiller);
protected:
~MEDFileTemplateFieldMultiTS() { }
MEDFileTemplateFieldMultiTS();
std::size_t MEDFileMeshStruct::getHeapMemorySizeWithoutChildren() const
{
std::size_t ret(0);
- for(std::vector< std::vector<int> >::const_iterator it0=_geo_types_distrib.begin();it0!=_geo_types_distrib.end();it0++)
+ for(std::vector< std::vector<mcIdType> >::const_iterator it0=_geo_types_distrib.begin();it0!=_geo_types_distrib.end();it0++)
ret+=(*it0).capacity()*sizeof(int);
- ret+=_geo_types_distrib.capacity()*sizeof(std::vector<int>);
+ ret+=_geo_types_distrib.capacity()*sizeof(std::vector<mcIdType>);
return ret;
}
int MEDFileMeshStruct::getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) const
{
int j=0;
- for(std::vector< std::vector<int> >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++,j--)
+ for(std::vector< std::vector<mcIdType> >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++,j--)
{
std::size_t sz=(*it1).size();
if(sz%3!=0)
/*!
* \sa MEDFileMeshStruct::doesManageGeoType
*/
-int MEDFileMeshStruct::getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const
+mcIdType MEDFileMeshStruct::getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const
{
- for(std::vector< std::vector<int> >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++)
+ for(std::vector< std::vector<mcIdType> >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++)
{
std::size_t sz=(*it1).size();
if(sz%3!=0)
*/
bool MEDFileMeshStruct::doesManageGeoType(INTERP_KERNEL::NormalizedCellType t) const
{
- for(std::vector< std::vector<int> >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++)
+ for(std::vector< std::vector<mcIdType> >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++)
{
std::size_t sz=(*it1).size();
if(sz%3!=0)
std::size_t nbGeo(sz/3);
if(nbGeo!=1)
throw INTERP_KERNEL::Exception(MSG);
- std::vector<int> arr(3); arr[0]=(int)t; arr[1]=_mesh->buildImplicitPartIfAny(t); arr[2]=-1;
+ std::vector<mcIdType> arr(3); arr[0]=(mcIdType)t; arr[1]=_mesh->buildImplicitPartIfAny(t); arr[2]=-1;
_geo_types_distrib.push_back(arr);
}
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::New : unrecognized type of mesh ! Must be in [MEDFileUMesh,MEDFileCMesh,MEDFileCurveLinearMesh] !");
}
-MEDMeshMultiLev *MEDMeshMultiLev::New(const MEDFileMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities)
+MEDMeshMultiLev *MEDMeshMultiLev::New(const MEDFileMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities)
{
if(!m)
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::New 2 : null input pointer !");
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::New 2 : unrecognized type of mesh ! Must be in [MEDFileUMesh,MEDFileCMesh,MEDFileCurveLinearMesh] !");
}
-MEDMeshMultiLev *MEDMeshMultiLev::NewOnlyOnNode(const MEDFileMesh *m, const DataArrayInt *pflOnNode)
+MEDMeshMultiLev *MEDMeshMultiLev::NewOnlyOnNode(const MEDFileMesh *m, const DataArrayIdType *pflOnNode)
{
MCAuto<MEDMeshMultiLev> ret(MEDMeshMultiLev::New(m,m->getNonEmptyLevels()));
ret->selectPartOfNodes(pflOnNode);
return ret.retn();
}
-void MEDMeshMultiLev::setNodeReduction(const DataArrayInt *nr)
+void MEDMeshMultiLev::setNodeReduction(const DataArrayIdType *nr)
{
if(nr)
nr->incrRef();
- _node_reduction=const_cast<DataArrayInt*>(nr);
+ _node_reduction=const_cast<DataArrayIdType*>(nr);
}
-void MEDMeshMultiLev::setCellReduction(const DataArrayInt *cr)
+void MEDMeshMultiLev::setCellReduction(const DataArrayIdType *cr)
{
if(_pfls.size()!=1)
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::setCellReduction : can be used only for single geo type mesh !");
- _pfls[0]=const_cast<DataArrayInt*>(cr);
+ _pfls[0]=const_cast<DataArrayIdType*>(cr);
if(cr)
cr->incrRef();
}
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::isFastlyTheSameStruct : unexpected situation for nodes !");
const MEDFileField1TSStructItem2& p(fst[0]);
std::string pflName(p.getPflName());
- const DataArrayInt *nr(_node_reduction);
+ const DataArrayIdType *nr(_node_reduction);
if(pflName.empty() && !nr)
return true;
if(!pflName.empty() && !nr)
std::size_t sz(fst.getNumberOfItems());
if(sz!=_geo_types.size())
return false;
- int strt(0);
+ mcIdType strt(0);
for(std::size_t i=0;i<sz;i++)
{
const MEDFileField1TSStructItem2& p(fst[i]);
* \param [out] famIds - Can be null. If not null the instance has to be dealt by the caller (decrRef).
* \param [out] isWithoutCopy - When true the returned instance \a famIds if not null is directly those in the data structure.
*/
-void MEDMeshMultiLev::retrieveFamilyIdsOnCells(DataArrayInt *& famIds, bool& isWithoutCopy) const
+void MEDMeshMultiLev::retrieveFamilyIdsOnCells(DataArrayIdType *& famIds, bool& isWithoutCopy) const
{
- const DataArrayInt *fids(_cell_fam_ids);
+ const DataArrayIdType *fids(_cell_fam_ids);
if(!fids)
{ famIds=0; isWithoutCopy=true; return ; }
std::size_t sz(_geo_types.size());
bool presenceOfPfls(false);
for(std::size_t i=0;i<sz && !presenceOfPfls;i++)
{
- const DataArrayInt *pfl(_pfls[i]);
+ const DataArrayIdType *pfl(_pfls[i]);
if(pfl)
presenceOfPfls=true;
}
if(!presenceOfPfls)
- { famIds=const_cast<DataArrayInt *>(fids); famIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(famIds); return ; }
+ { famIds=const_cast<DataArrayIdType *>(fids); famIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(famIds); return ; }
//bad luck the slowest part
isWithoutCopy=false;
- std::vector< MCAuto<DataArrayInt> > retSafe(sz);
- std::vector< const DataArrayInt *> ret(sz);
+ std::vector< MCAuto<DataArrayIdType> > retSafe(sz);
+ std::vector< const DataArrayIdType *> ret(sz);
int start(0);
for(std::size_t i=0;i<sz;i++)
{
- const DataArrayInt *pfl(_pfls[i]);
+ const DataArrayIdType *pfl(_pfls[i]);
int lgth(_nb_entities[i]);
if(pfl)
{
- MCAuto<DataArrayInt> tmp(fids->selectByTupleIdSafeSlice(start,start+lgth,1));
+ MCAuto<DataArrayIdType> tmp(fids->selectByTupleIdSafeSlice(start,start+lgth,1));
retSafe[i]=tmp->selectByTupleIdSafe(pfl->begin(),pfl->end());
}
else
ret[i]=retSafe[i];
start+=lgth;
}
- famIds=DataArrayInt::Aggregate(ret);
+ famIds=DataArrayIdType::Aggregate(ret);
}
/*!
* \param [out] numIds - Can be null. If not null the instance has to be dealt by the caller (decrRef).
* \param [out] isWithoutCopy - When true the returned instance \a numIds if not null is directly those in the data structure.
*/
-void MEDMeshMultiLev::retrieveNumberIdsOnCells(DataArrayInt *& numIds, bool& isWithoutCopy) const
+void MEDMeshMultiLev::retrieveNumberIdsOnCells(DataArrayIdType *& numIds, bool& isWithoutCopy) const
{
- const DataArrayInt *nids(_cell_num_ids);
+ const DataArrayIdType *nids(_cell_num_ids);
if(!nids)
{ numIds=0; isWithoutCopy=true; return ; }
std::size_t sz(_geo_types.size());
bool presenceOfPfls(false);
for(std::size_t i=0;i<sz && !presenceOfPfls;i++)
{
- const DataArrayInt *pfl(_pfls[i]);
+ const DataArrayIdType *pfl(_pfls[i]);
if(pfl)
presenceOfPfls=true;
}
if(!presenceOfPfls)
- { numIds=const_cast<DataArrayInt *>(nids); numIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(numIds); return ; }
+ { numIds=const_cast<DataArrayIdType *>(nids); numIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(numIds); return ; }
//bad luck the slowest part
isWithoutCopy=false;
- std::vector< MCAuto<DataArrayInt> > retSafe(sz);
- std::vector< const DataArrayInt *> ret(sz);
+ std::vector< MCAuto<DataArrayIdType> > retSafe(sz);
+ std::vector< const DataArrayIdType *> ret(sz);
int start(0);
for(std::size_t i=0;i<sz;i++)
{
- const DataArrayInt *pfl(_pfls[i]);
+ const DataArrayIdType *pfl(_pfls[i]);
int lgth(_nb_entities[i]);
if(pfl)
{
- MCAuto<DataArrayInt> tmp(nids->selectByTupleIdSafeSlice(start,start+lgth,1));
+ MCAuto<DataArrayIdType> tmp(nids->selectByTupleIdSafeSlice(start,start+lgth,1));
retSafe[i]=tmp->selectByTupleIdSafe(pfl->begin(),pfl->end());
}
else
ret[i]=retSafe[i];
start+=lgth;
}
- numIds=DataArrayInt::Aggregate(ret);
+ numIds=DataArrayIdType::Aggregate(ret);
}
/*!
* \param [out] famIds - Can be null. If not null the instance has to be dealt by the caller (decrRef).
* \param [out] isWithoutCopy - When true the returned instance \a famIds if not null is directly those in the data structure.
*/
-void MEDMeshMultiLev::retrieveFamilyIdsOnNodes(DataArrayInt *& famIds, bool& isWithoutCopy) const
+void MEDMeshMultiLev::retrieveFamilyIdsOnNodes(DataArrayIdType *& famIds, bool& isWithoutCopy) const
{
- const DataArrayInt *fids(_node_fam_ids);
+ const DataArrayIdType *fids(_node_fam_ids);
if(!fids)
{ famIds=0; isWithoutCopy=true; return ; }
- const DataArrayInt *nr(_node_reduction);
+ const DataArrayIdType *nr(_node_reduction);
if(nr)
{
isWithoutCopy=false;
}
else
{
- famIds=const_cast<DataArrayInt *>(fids); famIds->incrRef();
+ famIds=const_cast<DataArrayIdType *>(fids); famIds->incrRef();
isWithoutCopy=_mesh->isObjectInTheProgeny(famIds);
}
}
* \param [out] numIds - Can be null. If not null the instance has to be dealt by the caller (decrRef).
* \param [out] isWithoutCopy - When true the returned instance \a numIds if not null is directly those in the data structure.
*/
-void MEDMeshMultiLev::retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isWithoutCopy) const
+void MEDMeshMultiLev::retrieveNumberIdsOnNodes(DataArrayIdType *& numIds, bool& isWithoutCopy) const
{
- const DataArrayInt *fids(_node_num_ids);
+ const DataArrayIdType *fids(_node_num_ids);
if(!fids)
{ numIds=0; isWithoutCopy=true; return ; }
- const DataArrayInt *nr(_node_reduction);
+ const DataArrayIdType *nr(_node_reduction);
if(nr)
{
isWithoutCopy=false;
}
else
{
- numIds=const_cast<DataArrayInt *>(fids); numIds->incrRef();
+ numIds=const_cast<DataArrayIdType *>(fids); numIds->incrRef();
isWithoutCopy=_mesh->isObjectInTheProgeny(numIds);
}
}
* This method returns, if any, a new object containing the global node ids **BUT CONTRARY TO OTHER RETRIEVE METHODS** the returned object is always a NON AGGREGATED object. So the returned object if not null
* can be used as this safely.
*/
-DataArrayInt *MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny() const
+DataArrayIdType *MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny() const
{
const MEDFileUMesh *umesh(dynamic_cast<const MEDFileUMesh *>(_mesh));
if(!umesh)
const PartDefinition *pd(umesh->getPartDefAtLevel(1));
if(!pd)
return 0;
- MCAuto<DataArrayInt> tmp(pd->toDAI());
- const DataArrayInt *tmpCpp(tmp);
+ MCAuto<DataArrayIdType> tmp(pd->toDAI());
+ const DataArrayIdType *tmpCpp(tmp);
if(!tmpCpp)
return 0;
//
- const DataArrayInt *nr(_node_reduction);
+ const DataArrayIdType *nr(_node_reduction);
if(nr)
return tmp->selectByTupleIdSafe(nr->begin(),nr->end());
else
return _geo_types;
}
-void MEDMeshMultiLev::setFamilyIdsOnCells(DataArrayInt *famIds)
+void MEDMeshMultiLev::setFamilyIdsOnCells(DataArrayIdType *famIds)
{
_cell_fam_ids=famIds;
if(famIds)
famIds->incrRef();
}
-void MEDMeshMultiLev::setNumberIdsOnCells(DataArrayInt *numIds)
+void MEDMeshMultiLev::setNumberIdsOnCells(DataArrayIdType *numIds)
{
_cell_num_ids=numIds;
if(numIds)
numIds->incrRef();
}
-void MEDMeshMultiLev::setFamilyIdsOnNodes(DataArrayInt *famIds)
+void MEDMeshMultiLev::setFamilyIdsOnNodes(DataArrayIdType *famIds)
{
_node_fam_ids=famIds;
if(famIds)
famIds->incrRef();
}
-void MEDMeshMultiLev::setNumberIdsOnNodes(DataArrayInt *numIds)
+void MEDMeshMultiLev::setNumberIdsOnNodes(DataArrayIdType *numIds)
{
_node_num_ids=numIds;
if(numIds)
std::size_t sz(_pfls.size());
if(id<0 || id>=(int)sz)
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::getPflNameOfId : invalid input id !");
- const DataArrayInt *pfl(_pfls[id]);
+ const DataArrayIdType *pfl(_pfls[id]);
if(!pfl)
return std::string("");
return pfl->getName();
* Returns the number of cells having geometric type \a t.
* The profiles are **NOT** taken into account here.
*/
-int MEDMeshMultiLev::getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const
+mcIdType MEDMeshMultiLev::getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const
{
std::size_t sz(_nb_entities.size());
for(std::size_t i=0;i<sz;i++)
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::getNumberOfCells : not existing geometric type in this !");
}
-int MEDMeshMultiLev::getNumberOfNodes() const
+mcIdType MEDMeshMultiLev::getNumberOfNodes() const
{
return _nb_nodes;
}
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes !");
const MEDFileField1TSStructItem2& p(fst[0]);
std::string pflName(p.getPflName());
- const DataArrayInt *nr(_node_reduction);
+ const DataArrayIdType *nr(_node_reduction);
if(pflName.empty() && !nr)
return vals->deepCopy();
if(pflName.empty() && nr)
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes 2 !");
if(!pflName.empty() && nr)
{
- MCAuto<DataArrayInt> p1(globs->getProfile(pflName.c_str())->deepCopy());
- MCAuto<DataArrayInt> p2(nr->deepCopy());
+ MCAuto<DataArrayIdType> p1(globs->getProfile(pflName.c_str())->deepCopy());
+ MCAuto<DataArrayIdType> p2(nr->deepCopy());
p1->sort(true); p2->sort(true);
if(!p1->isEqualWithoutConsideringStr(*p2))
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : it appears that a profile on nodes does not cover the cells correctly !");
- p1=DataArrayInt::FindPermutationFromFirstToSecond(globs->getProfile(pflName.c_str()),nr);
+ p1=DataArrayIdType::FindPermutationFromFirstToSecond(globs->getProfile(pflName.c_str()),nr);
MCAuto<DataArray> ret(vals->deepCopy());
ret->renumberInPlace(p1->begin());
return ret.retn();
}
if(!pflName.empty() && !nr)
{
- MCAuto<DataArrayInt> p1(globs->getProfile(pflName.c_str())->deepCopy());
+ MCAuto<DataArrayIdType> p1(globs->getProfile(pflName.c_str())->deepCopy());
p1->sort(true);
if(!p1->isIota(getNumberOfNodes()))
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes 4 !");
std::vector<std::string> compInfo(vals->getInfoOnComponents());
for(std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator it=_geo_types.begin();it!=_geo_types.end();it++,iii++)
{
- const DataArrayInt *thisP(_pfls[iii]);
+ const DataArrayIdType *thisP(_pfls[iii]);
std::vector<const MEDFileField1TSStructItem2 *> ps;
for(std::size_t i=0;i<sz;i++)
{
if(ps.size()==1)
{
int nbi(ps[0]->getNbOfIntegrationPts(globs));
- const DataArrayInt *otherP(ps[0]->getPfl(globs));
+ const DataArrayIdType *otherP(ps[0]->getPfl(globs));
const std::pair<int,int>& strtStop(ps[0]->getStartStop());
MCAuto<DataArray> ret(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1));
if(!thisP && !otherP)
}
if(thisP && otherP)
{
- MCAuto<DataArrayInt> p1(otherP->invertArrayN2O2O2N(getNumberOfCells(ps[0]->getGeo())));
- MCAuto<DataArrayInt> p2(thisP->deepCopy());
+ MCAuto<DataArrayIdType> p1(otherP->invertArrayN2O2O2N(getNumberOfCells(ps[0]->getGeo())));
+ MCAuto<DataArrayIdType> p2(thisP->deepCopy());
p2->transformWithIndArr(p1->begin(),p1->end());
//p1=p2->findIdsNotEqual(-1);
//p1=p2->selectByTupleIdSafe(p1->begin(),p1->end());
}
if(!thisP && otherP)
{
- MCAuto<DataArrayInt> p1(otherP->deepCopy());
+ MCAuto<DataArrayIdType> p1(otherP->deepCopy());
p1->sort(true);
p1->checkAllIdsInRange(0,getNumberOfCells(ps[0]->getGeo()));
- p1=DataArrayInt::FindPermutationFromFirstToSecond(otherP,p1);
+ p1=DataArrayIdType::FindPermutationFromFirstToSecond(otherP,p1);
ret->rearrange(nbi*nc); ret->renumberInPlace(p1->begin()); ret->rearrange(nc); ret->setInfoOnComponents(compInfo);
arrSafe[iii]=ret; arr[iii]=ret;
continue;
}
else
{
- std::vector< const DataArrayInt * >otherPS(ps.size());
+ std::vector< const DataArrayIdType * >otherPS(ps.size());
std::vector< const DataArray * > arr2(ps.size());
std::vector< MCAuto<DataArray> > arr2Safe(ps.size());
- std::vector< const DataArrayInt * > nbis(ps.size());
- std::vector< MCAuto<DataArrayInt> > nbisSafe(ps.size());
+ std::vector< const DataArrayIdType * > nbis(ps.size());
+ std::vector< MCAuto<DataArrayIdType> > nbisSafe(ps.size());
int jj(0);
for(std::vector<const MEDFileField1TSStructItem2 *>::const_iterator it2=ps.begin();it2!=ps.end();it2++,jj++)
{
int nbi((*it2)->getNbOfIntegrationPts(globs));
- const DataArrayInt *otherPfl((*it2)->getPfl(globs));
+ const DataArrayIdType *otherPfl((*it2)->getPfl(globs));
const std::pair<int,int>& strtStop((*it2)->getStartStop());
MCAuto<DataArray> ret2(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1));
if(!otherPfl)
throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for cells 4 !");
arr2[jj]=ret2; arr2Safe[jj]=ret2; otherPS[jj]=otherPfl;
- nbisSafe[jj]=DataArrayInt::New(); nbisSafe[jj]->alloc(otherPfl->getNumberOfTuples(),1); nbisSafe[jj]->fillWithValue(nbi);
+ nbisSafe[jj]=DataArrayIdType::New(); nbisSafe[jj]->alloc(otherPfl->getNumberOfTuples(),1); nbisSafe[jj]->fillWithValue(nbi);
nbis[jj]=nbisSafe[jj];
}
MCAuto<DataArray> arr3(DataArray::Aggregate(arr2));
- MCAuto<DataArrayInt> otherP(DataArrayInt::Aggregate(otherPS));
- MCAuto<DataArrayInt> zenbis(DataArrayInt::Aggregate(nbis));
- MCAuto<DataArrayInt> otherPN(otherP->invertArrayN2O2O2N(getNumberOfCells(*it)));
- MCAuto<DataArrayInt> p1;
+ MCAuto<DataArrayIdType> otherP(DataArrayIdType::Aggregate(otherPS));
+ MCAuto<DataArrayIdType> zenbis(DataArrayIdType::Aggregate(nbis));
+ MCAuto<DataArrayIdType> otherPN(otherP->invertArrayN2O2O2N(getNumberOfCells(*it)));
+ MCAuto<DataArrayIdType> p1;
if(thisP)
- p1=DataArrayInt::FindPermutationFromFirstToSecond(otherP,thisP);
+ p1=DataArrayIdType::FindPermutationFromFirstToSecond(otherP,thisP);
else
p1=otherP->deepCopy();
- MCAuto<DataArrayInt> zenbisN(zenbis->renumber(p1->begin()));
+ MCAuto<DataArrayIdType> zenbisN(zenbis->renumber(p1->begin()));
zenbisN->computeOffsetsFull();
jj=0;
for(std::vector<const MEDFileField1TSStructItem2 *>::const_iterator it2=ps.begin();it2!=ps.end();it2++,jj++)
{
//int nbi((*it2)->getNbOfIntegrationPts(globs));
- const DataArrayInt *otherPfl((*it2)->getPfl(globs));
+ const DataArrayIdType *otherPfl((*it2)->getPfl(globs));
const std::pair<int,int>& strtStop((*it2)->getStartStop());
MCAuto<DataArray> ret2(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1));
//
- MCAuto<DataArrayInt> p2(otherPfl->deepCopy());
+ MCAuto<DataArrayIdType> p2(otherPfl->deepCopy());
p2->transformWithIndArr(otherPN->begin(),otherPN->end());
p2->transformWithIndArr(p1->begin(),p1->end());
- MCAuto<DataArrayInt> idsN(p2->buildExplicitArrByRanges(zenbisN));
+ MCAuto<DataArrayIdType> idsN(p2->buildExplicitArrByRanges(zenbisN));
arr3->setPartOfValuesBase3(ret2,idsN->begin(),idsN->end(),0,nc,1);
}
arrSafe[iii]=arr3; arr[iii]=arr3;
/*!
* This method is called to add NORM_POINT1 cells in \a this so that orphan nodes in \a verticesToAdd will be fetched.
*/
-void MEDMeshMultiLev::appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr)
+void MEDMeshMultiLev::appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr)
{
int nbOfVertices(verticesToAdd->getNumberOfTuples());
std::size_t sz(_pfls.size());
_nb_entities.resize(sz+1,nbOfVertices);
_node_reduction=nr; nr->incrRef();
_nb_nodes+=nbOfVertices;
- const DataArrayInt *cf(_cell_fam_ids),*cn(_cell_num_ids),*nf(_node_fam_ids),*nn(_node_num_ids);
+ const DataArrayIdType *cf(_cell_fam_ids),*cn(_cell_num_ids),*nf(_node_fam_ids),*nn(_node_num_ids);
if(cf)
{
- MCAuto<DataArrayInt> tmp;
- std::vector<const DataArrayInt *> a(2);
+ MCAuto<DataArrayIdType> tmp;
+ std::vector<const DataArrayIdType *> a(2);
a[0]=cf;
if(nf)
tmp=nf->selectByTupleIdSafe(verticesToAdd->begin(),verticesToAdd->end());
else
{
- tmp=DataArrayInt::New(); tmp->alloc(nbOfVertices,1); tmp->fillWithZero();
+ tmp=DataArrayIdType::New(); tmp->alloc(nbOfVertices,1); tmp->fillWithZero();
}
a[1]=tmp;
- _cell_fam_ids=DataArrayInt::Aggregate(a);
+ _cell_fam_ids=DataArrayIdType::Aggregate(a);
}
if(cn)
{
- MCAuto<DataArrayInt> tmp;
- std::vector<const DataArrayInt *> a(2);
+ MCAuto<DataArrayIdType> tmp;
+ std::vector<const DataArrayIdType *> a(2);
a[0]=cn;
if(nn)
tmp=nn->selectByTupleIdSafe(verticesToAdd->begin(),verticesToAdd->end());
else
{
- tmp=DataArrayInt::New(); tmp->alloc(nbOfVertices,1); tmp->fillWithZero();
+ tmp=DataArrayIdType::New(); tmp->alloc(nbOfVertices,1); tmp->fillWithZero();
}
a[1]=tmp;
- _cell_num_ids=DataArrayInt::Aggregate(a);
+ _cell_num_ids=DataArrayIdType::Aggregate(a);
}
}
{
}
-MEDMeshMultiLev::MEDMeshMultiLev(const MEDFileMesh *mesh, int nbNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):_mesh(mesh),_geo_types(gts),_nb_entities(nbEntities),_nb_nodes(nbNodes)
+MEDMeshMultiLev::MEDMeshMultiLev(const MEDFileMesh *mesh, mcIdType nbNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities):_mesh(mesh),_geo_types(gts),_nb_entities(nbEntities),_nb_nodes(nbNodes)
{
std::size_t sz(_geo_types.size());
if(sz!=pfls.size() || sz!=nbEntities.size())
{
if(pfls[i])
pfls[i]->incrRef();
- _pfls[i]=const_cast<DataArrayInt *>(pfls[i]);
+ _pfls[i]=const_cast<DataArrayIdType *>(pfls[i]);
}
}
bool cellFamIdsNoCpy(levs.size()==1);
if(cellFamIdsNoCpy)
{
- const DataArrayInt *tmp(m->getFamilyFieldAtLevel(levs[0]));
+ const DataArrayIdType *tmp(m->getFamilyFieldAtLevel(levs[0]));
if(tmp)
{
tmp->incrRef();
- _cell_fam_ids=(const_cast<DataArrayInt *>(tmp));
+ _cell_fam_ids=(const_cast<DataArrayIdType *>(tmp));
}
}
else
{
- std::vector<const DataArrayInt *> tmps(levs.size());
+ std::vector<const DataArrayIdType *> tmps(levs.size());
bool f(true);
for(std::size_t i=0;i<levs.size();i++)
{
f=false;
}
if(f && !tmps.empty())
- _cell_fam_ids=DataArrayInt::Aggregate(tmps);
+ _cell_fam_ids=DataArrayIdType::Aggregate(tmps);
}
bool cellNumIdsNoCpy(levs.size()==1);
if(cellNumIdsNoCpy)
{
- const DataArrayInt *tmp(m->getNumberFieldAtLevel(levs[0]));
+ const DataArrayIdType *tmp(m->getNumberFieldAtLevel(levs[0]));
if(tmp)
{
tmp->incrRef();
- _cell_num_ids=(const_cast<DataArrayInt *>(tmp));
+ _cell_num_ids=(const_cast<DataArrayIdType *>(tmp));
}
}
else
{
- std::vector<const DataArrayInt *> tmps(levs.size());
+ std::vector<const DataArrayIdType *> tmps(levs.size());
bool n(true);
for(std::size_t i=0;i<levs.size();i++)
{
n=false;
}
if(n && !tmps.empty())
- _cell_num_ids=DataArrayInt::Aggregate(tmps);
+ _cell_num_ids=DataArrayIdType::Aggregate(tmps);
}
// node part
{
- const DataArrayInt *tmp(m->getFamilyFieldAtLevel(1));
+ const DataArrayIdType *tmp(m->getFamilyFieldAtLevel(1));
if(tmp)
{
tmp->incrRef();
- _node_fam_ids=(const_cast<DataArrayInt *>(tmp));
+ _node_fam_ids=(const_cast<DataArrayIdType *>(tmp));
}
}
{
- const DataArrayInt *tmp(m->getNumberFieldAtLevel(1));
+ const DataArrayIdType *tmp(m->getNumberFieldAtLevel(1));
if(tmp)
{
tmp->incrRef();
- _node_num_ids=(const_cast<DataArrayInt *>(tmp));
+ _node_num_ids=(const_cast<DataArrayIdType *>(tmp));
}
}
}
-MEDUMeshMultiLev *MEDUMeshMultiLev::New(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities)
+MEDUMeshMultiLev *MEDUMeshMultiLev::New(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities)
{
return new MEDUMeshMultiLev(m,gts,pfls,nbEntities);
}
-MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities)
+MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities):MEDMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities)
{
std::size_t sz(gts.size());
if(sz<1)
int lev((int)dim-m->getMeshDimension());
if(isSameDim && isNoPfl && m->getGeoTypesAtLevel(lev)==gts)//optimized part
{
- const DataArrayInt *famIds(m->getFamilyFieldAtLevel(lev));
+ const DataArrayIdType *famIds(m->getFamilyFieldAtLevel(lev));
if(famIds)
- { _cell_fam_ids=const_cast<DataArrayInt*>(famIds); famIds->incrRef(); }
- const DataArrayInt *numIds(m->getNumberFieldAtLevel(lev));
+ { _cell_fam_ids=const_cast<DataArrayIdType*>(famIds); famIds->incrRef(); }
+ const DataArrayIdType *numIds(m->getNumberFieldAtLevel(lev));
if(numIds)
- { _cell_num_ids=const_cast<DataArrayInt*>(numIds); numIds->incrRef(); }
+ { _cell_num_ids=const_cast<DataArrayIdType*>(numIds); numIds->incrRef(); }
famIds=m->getFamilyFieldAtLevel(1);
if(famIds)
- { _node_fam_ids=const_cast<DataArrayInt*>(famIds); famIds->incrRef(); }
+ { _node_fam_ids=const_cast<DataArrayIdType*>(famIds); famIds->incrRef(); }
numIds=m->getNumberFieldAtLevel(1);
if(numIds)
- { _node_num_ids=const_cast<DataArrayInt*>(numIds); numIds->incrRef(); }
+ { _node_num_ids=const_cast<DataArrayIdType*>(numIds); numIds->incrRef(); }
return ;
}
//
- std::vector< MCAuto<DataArrayInt> > famIdsSafe(sz);
- std::vector<const DataArrayInt *> famIds(sz);
+ std::vector< MCAuto<DataArrayIdType> > famIdsSafe(sz);
+ std::vector<const DataArrayIdType *> famIds(sz);
bool f(true);
for(std::size_t i=0;i<sz;i++)
{
f=false;
}
if(f)
- _cell_fam_ids=DataArrayInt::Aggregate(famIds);
- std::vector< MCAuto<DataArrayInt> > numIdsSafe(sz);
- std::vector<const DataArrayInt *> numIds(sz);
+ _cell_fam_ids=DataArrayIdType::Aggregate(famIds);
+ std::vector< MCAuto<DataArrayIdType> > numIdsSafe(sz);
+ std::vector<const DataArrayIdType *> numIds(sz);
bool n(true);
for(std::size_t i=0;i<sz;i++)
{
n=false;
}
if(n)
- _cell_num_ids=DataArrayInt::Aggregate(numIds);
+ _cell_num_ids=DataArrayIdType::Aggregate(numIds);
// node ids management
- const DataArrayInt *nodeFamIds(m->getFamilyFieldAtLevel(1));
+ const DataArrayIdType *nodeFamIds(m->getFamilyFieldAtLevel(1));
if(nodeFamIds)
- { _node_fam_ids=const_cast<DataArrayInt*>(nodeFamIds); nodeFamIds->incrRef(); }
- const DataArrayInt *nodeNumIds(m->getNumberFieldAtLevel(1));
+ { _node_fam_ids=const_cast<DataArrayIdType*>(nodeFamIds); nodeFamIds->incrRef(); }
+ const DataArrayIdType *nodeNumIds(m->getNumberFieldAtLevel(1));
if(nodeNumIds)
- { _node_num_ids=const_cast<DataArrayInt*>(nodeNumIds); nodeNumIds->incrRef(); }
+ { _node_num_ids=const_cast<DataArrayIdType*>(nodeNumIds); nodeNumIds->incrRef(); }
}
-void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes)
+void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayIdType *pflNodes)
{
if(!pflNodes || !pflNodes->isAllocated())
return ;
std::size_t sz(_parts.size());
- std::vector< MCAuto<DataArrayInt> > a(sz);
- std::vector< const DataArrayInt *> aa(sz);
+ std::vector< MCAuto<DataArrayIdType> > a(sz);
+ std::vector< const DataArrayIdType *> aa(sz);
for(std::size_t i=0;i<sz;i++)
{
- const DataArrayInt *pfl(_pfls[i]);
+ const DataArrayIdType *pfl(_pfls[i]);
MCAuto<MEDCoupling1GTUMesh> m(_parts[i]);
if(pfl)
m=dynamic_cast<MEDCoupling1GTUMesh *>(_parts[i]->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end()));
- DataArrayInt *cellIds=0;
+ DataArrayIdType *cellIds=0;
m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds);
- MCAuto<DataArrayInt> cellIdsSafe(cellIds);
+ MCAuto<DataArrayIdType> cellIdsSafe(cellIds);
MCAuto<MEDCouplingPointSet> m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end()));
- int tmp=-1;
- MCAuto<DataArrayInt> o2n(m2->getNodeIdsInUse(tmp));
+ mcIdType tmp=-1;
+ MCAuto<DataArrayIdType> o2n(m2->getNodeIdsInUse(tmp));
a[i]=o2n->invertArrayO2N2N2O(tmp); aa[i]=a[i];
if(pfl)
_pfls[i]=pfl->selectByTupleIdSafe(cellIds->begin(),cellIds->end());
_pfls[i]=cellIdsSafe;
}
if(!aa.empty())
- _node_reduction=DataArrayInt::Aggregate(aa);//general case
+ _node_reduction=DataArrayIdType::Aggregate(aa);//general case
else
_node_reduction=pflNodes->deepCopy();//case where no cells in read mesh.
_node_reduction->sort(true);
if(_node_reduction->getNumberOfTuples()>pflNodes->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::selectPartOfNodes : internal error in MEDCoupling during cell select from a list of nodes !");
// Here the cells available in _parts is not enough to cover all the nodes in pflNodes. So adding vertices cells in _parts...
- MCAuto<DataArrayInt> pflNodes2(pflNodes->deepCopy());
+ MCAuto<DataArrayIdType> pflNodes2(pflNodes->deepCopy());
pflNodes2->sort(true);
- MCAuto<DataArrayInt> diff(pflNodes2->buildSubstractionOptimized(_node_reduction));
+ MCAuto<DataArrayIdType> diff(pflNodes2->buildSubstractionOptimized(_node_reduction));
appendVertices(diff,pflNodes2);
}
* If returned value is false output pointer \a coords is not the internal pointer. If returned value is true output pointer \a coords is directly the internal pointer.
* If true is returned, the \a coords output parameter should be used with care (non const method call) to avoid to change the internal state of MEDFileUMesh instance.
*/
-bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const
+bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayIdType *&cellLocations, DataArrayIdType *& cells, DataArrayIdType *&faceLocations, DataArrayIdType *&faces) const
{
const DataArrayDouble *tmp(0);
if(_parts.empty())
if(!cur)
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : a part is null !");
//
- const DataArrayInt *pfl(_pfls[iii]);
+ const DataArrayIdType *pfl(_pfls[iii]);
MCAuto<MEDCoupling1GTUMesh> cur2;
if(!pfl)
{ cur2=const_cast<MEDCoupling1GTUMesh *>(cur); cur2->incrRef(); }
else
{
isPolyh=true;
- MCAuto<DataArrayInt> tmp2(cur->computeEffectiveNbOfNodesPerCell());
+ MCAuto<DataArrayIdType> tmp2(cur->computeEffectiveNbOfNodesPerCell());
szD+=tmp2->accumulate((std::size_t)0)+curNbCells;
szF+=2*curNbCells+cur->getNodalConnectivity()->getNumberOfTuples();
}
}
MCAuto<DataArrayByte> b(DataArrayByte::New()); b->alloc(szBCE,1); char *bPtr(b->getPointer());
- MCAuto<DataArrayInt> c(DataArrayInt::New()); c->alloc(szBCE,1); int *cPtr(c->getPointer());
- MCAuto<DataArrayInt> d(DataArrayInt::New()); d->alloc(szD,1); int *dPtr(d->getPointer());
- MCAuto<DataArrayInt> e(DataArrayInt::New()),f(DataArrayInt::New()); int *ePtr(0),*fPtr(0);
+ MCAuto<DataArrayIdType> c(DataArrayIdType::New()); c->alloc(szBCE,1); mcIdType *cPtr(c->getPointer());
+ MCAuto<DataArrayIdType> d(DataArrayIdType::New()); d->alloc(szD,1); mcIdType *dPtr(d->getPointer());
+ MCAuto<DataArrayIdType> e(DataArrayIdType::New()),f(DataArrayIdType::New()); mcIdType *ePtr(0),*fPtr(0);
if(isPolyh)
{ e->alloc(szBCE,1); ePtr=e->getPointer(); f->alloc(szF,1); fPtr=f->getPointer(); }
int k(0);
{
const MEDCoupling1GTUMesh *cur(*it);
//
- const DataArrayInt *pfl(_pfls[iii]);
+ const DataArrayIdType *pfl(_pfls[iii]);
MCAuto<MEDCoupling1GTUMesh> cur2;
if(!pfl)
{ cur2=const_cast<MEDCoupling1GTUMesh *>(cur); cur2->incrRef(); }
std::fill(bPtr,bPtr+curNbCells,gtvtk); bPtr+=curNbCells;
const MEDCoupling1SGTUMesh *scur(dynamic_cast<const MEDCoupling1SGTUMesh *>(cur));
const MEDCoupling1DGTUMesh *dcur(dynamic_cast<const MEDCoupling1DGTUMesh *>(cur));
- const int *connPtr(cur->getNodalConnectivity()->begin());
+ const mcIdType *connPtr(cur->getNodalConnectivity()->begin());
if(!scur && !dcur)
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : internal error !");
if(scur)
}
else
{
- const int *connIPtr(dcur->getNodalConnectivityIndex()->begin());
+ const mcIdType *connIPtr(dcur->getNodalConnectivityIndex()->begin());
if(cur->getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED)
{
for(int i=0;i<curNbCells;i++,connIPtr++)
}
else
{
- for(int i=0;i<curNbCells;i++,connIPtr++)
+ for(mcIdType i=0;i<curNbCells;i++,connIPtr++)
{
- std::set<int> s(connPtr+connIPtr[0],connPtr+connIPtr[1]); s.erase(-1);
- *dPtr++=(int)s.size();
+ std::set<mcIdType> s(connPtr+connIPtr[0],connPtr+connIPtr[1]); s.erase(-1);
+ *dPtr++=(mcIdType)s.size();
dPtr=std::copy(s.begin(),s.end(),dPtr);
- *cPtr++=k; k+=(int)s.size()+1;
+ *cPtr++=k; k+=(mcIdType)s.size()+1;
}
}
if(isPolyh)
{
int nbFace(std::count(connPtr+connIPtr[0],connPtr+connIPtr[1],-1)+1);
*fPtr++=nbFace;
- const int *work(connPtr+connIPtr[0]);
+ const mcIdType *work(connPtr+connIPtr[0]);
for(int j=0;j<nbFace;j++)
{
- const int *work2=std::find(work,connPtr+connIPtr[1],-1);
+ const mcIdType *work2=std::find(work,connPtr+connIPtr[1],-1);
*fPtr++=std::distance(work,work2);
fPtr=std::copy(work,work2,fPtr);
work=work2+1;
return _mesh->isObjectInTheProgeny(coords);
}
-void MEDUMeshMultiLev::reorderNodesIfNecessary(MCAuto<DataArrayDouble>& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const
+void MEDUMeshMultiLev::reorderNodesIfNecessary(MCAuto<DataArrayDouble>& coords, DataArrayIdType *nodalConnVTK, DataArrayIdType *polyhedNodalConnVTK) const
{
- const DataArrayInt *nr(_node_reduction);
+ const DataArrayIdType *nr(_node_reduction);
if(!nr)
return ;
if(nodalConnVTK->empty() && !polyhedNodalConnVTK)
}
int sz(coords->getNumberOfTuples());
std::vector<bool> b(sz,false);
- const int *work(nodalConnVTK->begin()),*endW(nodalConnVTK->end());
+ const mcIdType *work(nodalConnVTK->begin()),*endW(nodalConnVTK->end());
while(work!=endW)
{
int nb(*work++);
if(szExp!=nr->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::reorderNodesIfNecessary : internal error #3 !");
// Go renumbering !
- MCAuto<DataArrayInt> o2n(DataArrayInt::New()); o2n->alloc(sz,1);
- int *o2nPtr(o2n->getPointer());
+ MCAuto<DataArrayIdType> o2n(DataArrayIdType::New()); o2n->alloc(sz,1);
+ mcIdType *o2nPtr(o2n->getPointer());
int newId(0);
for(int i=0;i<sz;i++,o2nPtr++)
if(b[i]) *o2nPtr=newId++; else *o2nPtr=-1;
- const int *o2nPtrc(o2n->begin());
- MCAuto<DataArrayInt> n2o(o2n->invertArrayO2N2N2O(nr->getNumberOfTuples()));
- MCAuto<DataArrayInt> perm(DataArrayInt::FindPermutationFromFirstToSecond(n2o,nr));
- const int *permPtr(perm->begin());
- int *work2(nodalConnVTK->getPointer()),*endW2(nodalConnVTK->getPointer()+nodalConnVTK->getNumberOfTuples());
+ const mcIdType *o2nPtrc(o2n->begin());
+ MCAuto<DataArrayIdType> n2o(o2n->invertArrayO2N2N2O(nr->getNumberOfTuples()));
+ MCAuto<DataArrayIdType> perm(DataArrayIdType::FindPermutationFromFirstToSecond(n2o,nr));
+ const mcIdType *permPtr(perm->begin());
+ mcIdType *work2(nodalConnVTK->getPointer()),*endW2(nodalConnVTK->getPointer()+nodalConnVTK->getNumberOfTuples());
while(work2!=endW2)
{
int nb(*work2++);
}
-void MEDUMeshMultiLev::appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr)
+void MEDUMeshMultiLev::appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr)
{
int nbOfCells(verticesToAdd->getNumberOfTuples());//it is not a bug cells are NORM_POINT1
MEDMeshMultiLev::appendVertices(verticesToAdd,nr);
elt->allocateCells(nbOfCells);
for(int i=0;i<nbOfCells;i++)
{
- int pt(verticesToAdd->getIJ(i,0));
+ mcIdType pt(verticesToAdd->getIJ(i,0));
elt->insertNextCell(&pt,&pt+1);
}
if(_parts.empty())
initStdFieldOfIntegers(m);
}
-MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDMeshMultiLev(m,nbOfNodes,gts,pfls,nbEntities),_is_internal(true)
+MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, mcIdType nbOfNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities):MEDMeshMultiLev(m,nbOfNodes,gts,pfls,nbEntities),_is_internal(true)
{
initStdFieldOfIntegers(m);
}
void MEDStructuredMeshMultiLev::initStdFieldOfIntegers(const MEDFileStructuredMesh *m)
{
// ids fields management
- const DataArrayInt *tmp(0);
+ const DataArrayIdType *tmp(0);
tmp=m->getFamilyFieldAtLevel(0);
if(tmp)
{
tmp->incrRef();
- _cell_fam_ids=const_cast<DataArrayInt *>(tmp);
+ _cell_fam_ids=const_cast<DataArrayIdType *>(tmp);
}
tmp=m->getNumberFieldAtLevel(0);
if(tmp)
{
tmp->incrRef();
- _cell_num_ids=const_cast<DataArrayInt *>(tmp);
+ _cell_num_ids=const_cast<DataArrayIdType *>(tmp);
}
//
tmp=0;
if(tmp)
{
tmp->incrRef();
- _node_fam_ids=const_cast<DataArrayInt *>(tmp);
+ _node_fam_ids=const_cast<DataArrayIdType *>(tmp);
}
tmp=m->getNumberFieldAtLevel(1);
if(tmp)
{
tmp->incrRef();
- _node_num_ids=const_cast<DataArrayInt *>(tmp);
+ _node_num_ids=const_cast<DataArrayIdType *>(tmp);
}
// faces (if any)
tmp=m->getFamilyFieldAtLevel(-1);
if(tmp)
{
tmp->incrRef();
- _face_fam_ids=const_cast<DataArrayInt *>(tmp);
+ _face_fam_ids=const_cast<DataArrayIdType *>(tmp);
}
tmp=m->getNumberFieldAtLevel(-1);
if(tmp)
{
tmp->incrRef();
- _face_num_ids=const_cast<DataArrayInt *>(tmp);
+ _face_num_ids=const_cast<DataArrayIdType *>(tmp);
}
}
MEDCoupling1GTUMesh *facesIfPresent((static_cast<const MEDFileStructuredMesh *>(_mesh))->getImplicitFaceMesh());
if(!facesIfPresent)
return false;
- const DataArrayInt *pfl(0),*nr(_node_reduction);
+ const DataArrayIdType *pfl(0),*nr(_node_reduction);
if(!_pfls.empty())
pfl=_pfls[0];
MCAuto<MEDCoupling1GTUMesh> facesIfPresent2(facesIfPresent); facesIfPresent->incrRef();
void MEDStructuredMeshMultiLev::dealWithImplicitUnstructuredMesh(const MEDFileMesh *m)
{
- const DataArrayInt *tmp(0);
+ const DataArrayIdType *tmp(0);
tmp=m->getFamilyFieldAtLevel(-1);
if(tmp)
{
tmp->incrRef();
- _cell_fam_ids=const_cast<DataArrayInt *>(tmp);
+ _cell_fam_ids=const_cast<DataArrayIdType *>(tmp);
}
tmp=m->getNumberFieldAtLevel(-1);
if(tmp)
{
tmp->incrRef();
- _cell_num_ids=const_cast<DataArrayInt *>(tmp);
+ _cell_num_ids=const_cast<DataArrayIdType *>(tmp);
}
}
-void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes)
+void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayIdType *pflNodes)
{
if(!pflNodes || !pflNodes->isAllocated())
return ;
- std::vector<int> ngs(getNodeGridStructure());
- MCAuto<DataArrayInt> conn(MEDCouplingStructuredMesh::Build1GTNodalConnectivity(&ngs[0],&ngs[0]+ngs.size()));
+ std::vector<mcIdType> ngs(getNodeGridStructure());
+ MCAuto<DataArrayIdType> conn(MEDCouplingStructuredMesh::Build1GTNodalConnectivity(&ngs[0],&ngs[0]+ngs.size()));
MCAuto<MEDCoupling1SGTUMesh> m(MEDCoupling1SGTUMesh::New("",MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(ngs.size())));
m->setNodalConnectivity(conn);
- const DataArrayInt *pfl(_pfls[0]);
+ const DataArrayIdType *pfl(_pfls[0]);
if(pfl)
{
m=dynamic_cast<MEDCoupling1SGTUMesh *>(m->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end()));
}
- DataArrayInt *cellIds=0;
+ DataArrayIdType *cellIds=0;
m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds);
- MCAuto<DataArrayInt> cellIdsSafe(cellIds);
+ MCAuto<DataArrayIdType> cellIdsSafe(cellIds);
MCAuto<MEDCouplingPointSet> m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end()));
- int tmp=-1;
+ mcIdType tmp=-1;
_node_reduction=m2->getNodeIdsInUse(tmp);
if(pfl)
_pfls[0]=pfl->selectByTupleIdSafe(cellIds->begin(),cellIds->end());
return new MEDCMeshMultiLev(m,levs);
}
-MEDCMeshMultiLev *MEDCMeshMultiLev::New(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities)
+MEDCMeshMultiLev *MEDCMeshMultiLev::New(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities)
{
return new MEDCMeshMultiLev(m,gts,pfls,nbEntities);
}
}
}
-MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDStructuredMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities)
+MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities):MEDStructuredMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities)
{
if(!m)
throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : null input pointer !");
{
}
-std::vector<int> MEDCMeshMultiLev::getNodeGridStructure() const
+std::vector<mcIdType> MEDCMeshMultiLev::getNodeGridStructure() const
{
- std::vector<int> ret(_coords.size());
+ std::vector<mcIdType> ret(_coords.size());
for(std::size_t i=0;i<_coords.size();i++)
ret[i]=_coords[i]->getNumberOfTuples();
return ret;
MEDMeshMultiLev *retSpecific(0);
if(prepareForImplicitUnstructuredMeshCase(retSpecific))
return retSpecific;
- const DataArrayInt *pfl(0),*nr(_node_reduction);
+ const DataArrayIdType *pfl(0),*nr(_node_reduction);
if(!_pfls.empty())
pfl=_pfls[0];
- MCAuto<DataArrayInt> nnr;
- std::vector<int> cgs,ngs(getNodeGridStructure());
+ MCAuto<DataArrayIdType> nnr;
+ std::vector<mcIdType> cgs,ngs(getNodeGridStructure());
cgs.resize(ngs.size());
- std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus<int>(),-1));
+ std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus<mcIdType>(),-1));
if(pfl)
{
- std::vector< std::pair<int,int> > cellParts;
+ std::vector< std::pair<mcIdType,mcIdType> > cellParts;
MCAuto<MEDMeshMultiLev> ret2;
if(MEDCouplingStructuredMesh::IsPartStructured(pfl->begin(),pfl->end(),cgs,cellParts))
{
{ m3->zipCoords(); nnr=nr->deepCopy(); nnr->sort(true); ret->setNodeReduction(nnr); }
ret2=(MEDUMeshMultiLev *)ret; ret2->incrRef();
}
- const DataArrayInt *famIds(_cell_fam_ids),*numIds(_cell_num_ids);
+ const DataArrayIdType *famIds(_cell_fam_ids),*numIds(_cell_num_ids);
if(famIds)
{
- MCAuto<DataArrayInt> tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
+ MCAuto<DataArrayIdType> tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
ret2->setFamilyIdsOnCells(tmp);
}
if(numIds)
{
- MCAuto<DataArrayInt> tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
+ MCAuto<DataArrayIdType> tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
ret2->setNumberIdsOnCells(tmp);
}
return ret2.retn();
return new MEDCurveLinearMeshMultiLev(m,levs);
}
-MEDCurveLinearMeshMultiLev *MEDCurveLinearMeshMultiLev::New(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities)
+MEDCurveLinearMeshMultiLev *MEDCurveLinearMeshMultiLev::New(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities)
{
return new MEDCurveLinearMeshMultiLev(m,gts,pfls,nbEntities);
}
_structure=m->getMesh()->getNodeGridStructure();
}
-MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDStructuredMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities)
+MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities):MEDStructuredMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities)
{
if(!m)
throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : null input pointer !");
{
}
-std::vector<int> MEDCurveLinearMeshMultiLev::getNodeGridStructure() const
+std::vector<mcIdType> MEDCurveLinearMeshMultiLev::getNodeGridStructure() const
{
return _structure;
}
MEDMeshMultiLev *retSpecific(0);
if(prepareForImplicitUnstructuredMeshCase(retSpecific))
return retSpecific;
- const DataArrayInt *pfl(0),*nr(_node_reduction);
+ const DataArrayIdType *pfl(0),*nr(_node_reduction);
if(!_pfls.empty())
pfl=_pfls[0];
- MCAuto<DataArrayInt> nnr;
- std::vector<int> cgs,ngs(getNodeGridStructure());
+ MCAuto<DataArrayIdType> nnr;
+ std::vector<mcIdType> cgs,ngs(getNodeGridStructure());
cgs.resize(ngs.size());
- std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus<int>(),-1));
+ std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus<mcIdType>(),-1));
if(pfl)
{
- std::vector< std::pair<int,int> > cellParts,nodeParts;
+ std::vector< std::pair<mcIdType,mcIdType> > cellParts,nodeParts;
MCAuto<MEDMeshMultiLev> ret2;
if(MEDCouplingStructuredMesh::IsPartStructured(pfl->begin(),pfl->end(),cgs,cellParts))
{
nodeParts=cellParts;
- std::vector<int> st(ngs.size());
+ std::vector<mcIdType> st(ngs.size());
for(std::size_t i=0;i<ngs.size();i++)
{
nodeParts[i].second++;
st[i]=nodeParts[i].second-nodeParts[i].first;
}
- MCAuto<DataArrayInt> p(MEDCouplingStructuredMesh::BuildExplicitIdsFrom(ngs,nodeParts));
+ MCAuto<DataArrayIdType> p(MEDCouplingStructuredMesh::BuildExplicitIdsFrom(ngs,nodeParts));
MCAuto<MEDCurveLinearMeshMultiLev> ret(new MEDCurveLinearMeshMultiLev(*this));
ret->_is_internal=false;
if(nr)
{ m3->zipCoords(); nnr=nr->deepCopy(); nnr->sort(true); ret->setNodeReduction(nnr); }
ret2=(MEDUMeshMultiLev *)ret; ret2->incrRef();
}
- const DataArrayInt *famIds(_cell_fam_ids),*numIds(_cell_num_ids);
+ const DataArrayIdType *famIds(_cell_fam_ids),*numIds(_cell_num_ids);
if(famIds)
{
- MCAuto<DataArrayInt> tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
+ MCAuto<DataArrayIdType> tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
ret2->setFamilyIdsOnCells(tmp);
}
if(numIds)
{
- MCAuto<DataArrayInt> tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
+ MCAuto<DataArrayIdType> tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end()));
ret2->setNumberIdsOnCells(tmp);
}
return ret2.retn();
}
}
-void MEDCurveLinearMeshMultiLev::buildVTUArrays(DataArrayDouble *&coords, std::vector<int>& nodeStrct, bool& isInternal) const
+void MEDCurveLinearMeshMultiLev::buildVTUArrays(DataArrayDouble *&coords, std::vector<mcIdType>& nodeStrct, bool& isInternal) const
{
isInternal=_is_internal;
nodeStrct=_structure;
{
}
-MEDFileField1TSStructItem2::MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair<int,int>& b, const std::string& c, const std::string& d):_geo_type(a),_start_end(b),_pfl(DataArrayInt::New()),_loc(d),_nb_of_entity(-1)
+MEDFileField1TSStructItem2::MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair<mcIdType,mcIdType>& b, const std::string& c, const std::string& d):_geo_type(a),_start_end(b),_pfl(DataArrayIdType::New()),_loc(d),_nb_of_entity(-1)
{
_pfl->setName(c.c_str());
}
MEDFileMeshStruct *mstUnConstCasted(const_cast<MEDFileMeshStruct *>(mst));
mstUnConstCasted->appendIfImplicitType(_geo_type);
}
- int nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
+ mcIdType nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
checkInRange(nbOfEnt,1,globs);
}
void MEDFileField1TSStructItem2::checkWithMeshStructForGaussNE(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs)
{
- int nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
+ mcIdType nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type);
checkInRange(nbOfEnt,(int)cm.getNumberOfNodes(),globs);
}
if(_loc.empty())
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkWithMeshStructForGaussPT : no localization specified !");
const MEDFileFieldLoc& loc=globs->getLocalization(_loc.c_str());
- int nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
+ mcIdType nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type);
checkInRange(nbOfEnt,loc.getNumberOfGaussPoints(),globs);
}
return _pfl->getName();
}
-const DataArrayInt *MEDFileField1TSStructItem2::getPfl(const MEDFileFieldGlobsReal *globs) const
+const DataArrayIdType *MEDFileField1TSStructItem2::getPfl(const MEDFileFieldGlobsReal *globs) const
{
if(!_pfl->isAllocated())
{
* \param [in] nbOfEntity - number of entity that can be either cells or nodes. Not other possibility.
* \param [in] nip - number of integration points. 1 for ON_CELLS and NO_NODES
*/
-void MEDFileField1TSStructItem2::checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs)
+void MEDFileField1TSStructItem2::checkInRange(mcIdType nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs)
{
_nb_of_entity=nbOfEntity;
if(_pfl->getName().empty())
{
if(!globs)
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkInRange : Presence of a profile on field whereas no globals found in file !");
- const DataArrayInt *pfl=globs->getProfile(_pfl->getName().c_str());
+ const DataArrayIdType *pfl=globs->getProfile(_pfl->getName().c_str());
if(!pfl)
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkInRange : Presence of a profile on field whereas no such profile found in file !");
pfl->checkAllIdsInRange(0,nbOfEntity);
}
}
-bool MEDFileField1TSStructItem2::isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const
+bool MEDFileField1TSStructItem2::isFastlyEqual(mcIdType& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const
{
if(startExp!=_start_end.first)
return false;
return false;
if(_pfl->getName().empty() && other._pfl->getName().empty())
return true;
- const DataArrayInt *pfl1(getPfl(globs)),*pfl2(other.getPfl(globs));
+ const DataArrayIdType *pfl1(getPfl(globs)),*pfl2(other.getPfl(globs));
return pfl1->isEqualWithoutConsideringStr(*pfl2);
}
if(objs.size()==1)
return MEDFileField1TSStructItem2(*objs[0]);
INTERP_KERNEL::NormalizedCellType gt(objs[0]->_geo_type);
- int nbEntityRef(objs[0]->_nb_of_entity);
+ mcIdType nbEntityRef(objs[0]->_nb_of_entity);
std::size_t sz(objs.size());
- std::vector<const DataArrayInt *> arrs(sz);
+ std::vector<const DataArrayIdType *> arrs(sz);
for(std::size_t i=0;i<sz;i++)
{
const MEDFileField1TSStructItem2 *obj(objs[i]);
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::BuildAggregationOf : invalid situation ! Several same geo type chunk must all lie on profiles !");
arrs[i]=globs->getProfile(obj->_pfl->getName().c_str());
}
- MCAuto<DataArrayInt> arr(DataArrayInt::Aggregate(arrs));
+ MCAuto<DataArrayIdType> arr(DataArrayIdType::Aggregate(arrs));
arr->sort();
- int oldNbTuples(arr->getNumberOfTuples());
+ mcIdType oldNbTuples(arr->getNumberOfTuples());
arr=arr->buildUnique();
if(oldNbTuples!=arr->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::BuildAggregationOf : some entities are present several times !");
if(arr->isIota(nbEntityRef))
{
- std::pair<int,int> p(0,nbEntityRef);
+ std::pair<mcIdType,mcIdType> p(0,nbEntityRef);
std::string a,b;
MEDFileField1TSStructItem2 ret(gt,p,a,b);
ret._nb_of_entity=nbEntityRef;
else
{
arr->setName(NEWLY_CREATED_PFL_NAME);
- std::pair<int,int> p(0,oldNbTuples);
+ std::pair<mcIdType,mcIdType> p(0,oldNbTuples);
std::string a,b;
MEDFileField1TSStructItem2 ret(gt,p,a,b);
ret._nb_of_entity=nbEntityRef;
std::vector<const BigMemoryObject *> MEDFileField1TSStructItem2::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- ret.push_back((const DataArrayInt *)_pfl);
+ ret.push_back((const DataArrayIdType *)_pfl);
return ret;
}
{
case ON_NODES:
{
- int nbOfEnt=mst->getNumberOfNodes();
+ mcIdType nbOfEnt=mst->getNumberOfNodes();
if(_items.size()!=1)
throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::checkWithMeshStruct : for nodes field only one subdivision supported !");
_items[0].checkInRange(nbOfEnt,1,globs);
int theFirstLevFull;
bool ret0=isFullyOnOneLev(meshSt,theFirstLevFull);
const MEDFileField1TSStructItem2& otherNodeIt(other._items[0]);
- int nbOfNodes(meshSt->getNumberOfNodes());
+ mcIdType nbOfNodes(meshSt->getNumberOfNodes());
if(otherNodeIt.getPflName().empty())
{//on all nodes
if(!ret0)
}
else
{
- const DataArrayInt *pfl=globs->getProfile(otherNodeIt.getPflName().c_str());
- MCAuto<DataArrayInt> cpyPfl(pfl->deepCopy());
+ const DataArrayIdType *pfl=globs->getProfile(otherNodeIt.getPflName().c_str());
+ MCAuto<DataArrayIdType> cpyPfl(pfl->deepCopy());
cpyPfl->sort();
if(cpyPfl->isIota(nbOfNodes))
{//on all nodes also !
{
std::size_t sz(_items.size());
std::vector<INTERP_KERNEL::NormalizedCellType> a0(sz);
- std::vector<const DataArrayInt *> a1(sz);
- std::vector<int> a2(sz);
+ std::vector<const DataArrayIdType *> a1(sz);
+ std::vector<mcIdType> a2(sz);
std::size_t i(0);
for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++,i++)
{
std::vector< std::vector<std::string> > pfls,locs;
std::vector< std::vector<TypeOfField> > typesF;
std::vector<INTERP_KERNEL::NormalizedCellType> geoTypes;
- std::vector< std::vector<std::pair<int,int> > > strtEnds=ref->getFieldSplitedByType(std::string(),geoTypes,typesF,pfls,locs);
+ std::vector< std::vector<std::pair<mcIdType,mcIdType> > > strtEnds=ref->getFieldSplitedByType(std::string(),geoTypes,typesF,pfls,locs);
std::size_t nbOfGeoTypes(geoTypes.size());
if(nbOfGeoTypes==0)
throw INTERP_KERNEL::Exception("MEDFileField1TSStruct : not null by empty ref !");
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
const MEDFileMesh *getTheMesh() const { return _mesh; }
- int getNumberOfNodes() const { return _nb_nodes; }
+ mcIdType getNumberOfNodes() const { return _nb_nodes; }
bool doesManageGeoType(INTERP_KERNEL::NormalizedCellType t) const;
- int getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const;
+ mcIdType getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const;
int getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) const;
int getNumberOfLevs() const;
int getNumberOfGeoTypesInLev(int relativeLev) const;
private:
const MEDFileMesh *_mesh;
std::string _name;
- int _nb_nodes;
- std::vector< std::vector<int> > _geo_types_distrib;
+ mcIdType _nb_nodes;
+ std::vector< std::vector<mcIdType> > _geo_types_distrib;
};
class MEDFileField1TSStructItem;
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
public:
- static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
+ static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector<int>& levs);
- static MEDMeshMultiLev *NewOnlyOnNode(const MEDFileMesh *m, const DataArrayInt *pflOnNode);
- void setNodeReduction(const DataArrayInt *nr);
- void setCellReduction(const DataArrayInt *cr);
+ static MEDMeshMultiLev *NewOnlyOnNode(const MEDFileMesh *m, const DataArrayIdType *pflOnNode);
+ void setNodeReduction(const DataArrayIdType *nr);
+ void setCellReduction(const DataArrayIdType *cr);
bool isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs) const;
MEDLOADER_EXPORT DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const;
- MEDLOADER_EXPORT void retrieveFamilyIdsOnCells(DataArrayInt *& famIds, bool& isWithoutCopy) const;
- MEDLOADER_EXPORT void retrieveNumberIdsOnCells(DataArrayInt *& numIds, bool& isWithoutCopy) const;
- MEDLOADER_EXPORT void retrieveFamilyIdsOnNodes(DataArrayInt *& famIds, bool& isWithoutCopy) const;
- MEDLOADER_EXPORT void retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isWithoutCopy) const;
- MEDLOADER_EXPORT DataArrayInt *retrieveGlobalNodeIdsIfAny() const;
+ MEDLOADER_EXPORT void retrieveFamilyIdsOnCells(DataArrayIdType *& famIds, bool& isWithoutCopy) const;
+ MEDLOADER_EXPORT void retrieveNumberIdsOnCells(DataArrayIdType *& numIds, bool& isWithoutCopy) const;
+ MEDLOADER_EXPORT void retrieveFamilyIdsOnNodes(DataArrayIdType *& famIds, bool& isWithoutCopy) const;
+ MEDLOADER_EXPORT void retrieveNumberIdsOnNodes(DataArrayIdType *& numIds, bool& isWithoutCopy) const;
+ MEDLOADER_EXPORT DataArrayIdType *retrieveGlobalNodeIdsIfAny() const;
MEDLOADER_EXPORT std::vector< INTERP_KERNEL::NormalizedCellType > getGeoTypes() const;
- void setFamilyIdsOnCells(DataArrayInt *famIds);
- void setNumberIdsOnCells(DataArrayInt *numIds);
- void setFamilyIdsOnNodes(DataArrayInt *famIds);
- void setNumberIdsOnNodes(DataArrayInt *numIds);
- virtual void selectPartOfNodes(const DataArrayInt *pflNodes) = 0;
+ void setFamilyIdsOnCells(DataArrayIdType *famIds);
+ void setNumberIdsOnCells(DataArrayIdType *numIds);
+ void setFamilyIdsOnNodes(DataArrayIdType *famIds);
+ void setNumberIdsOnNodes(DataArrayIdType *numIds);
+ virtual void selectPartOfNodes(const DataArrayIdType *pflNodes) = 0;
virtual MEDMeshMultiLev *prepare() const = 0;
- int getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const;
- int getNumberOfNodes() const;
+ mcIdType getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const;
+ mcIdType getNumberOfNodes() const;
protected:
std::string getPflNameOfId(int id) const;
DataArray *constructDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const;
- virtual void appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr);
+ virtual void appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr);
protected:
MEDMeshMultiLev(const MEDFileMesh *mesh);
MEDMeshMultiLev(const MEDMeshMultiLev& other);
- MEDMeshMultiLev(const MEDFileMesh *mesh, int nbNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
+ MEDMeshMultiLev(const MEDFileMesh *mesh, mcIdType nbNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
protected:
const MEDFileMesh *_mesh;
- std::vector< MCAuto<DataArrayInt> > _pfls;
+ std::vector< MCAuto<DataArrayIdType> > _pfls;
std::vector< INTERP_KERNEL::NormalizedCellType > _geo_types;
- std::vector<int> _nb_entities;
- MCAuto<DataArrayInt> _node_reduction;
- int _nb_nodes;
+ std::vector<mcIdType> _nb_entities;
+ MCAuto<DataArrayIdType> _node_reduction;
+ mcIdType _nb_nodes;
//
- MCAuto<DataArrayInt> _cell_fam_ids;
- MCAuto<DataArrayInt> _cell_num_ids;
- MCAuto<DataArrayInt> _node_fam_ids;
- MCAuto<DataArrayInt> _node_num_ids;
+ MCAuto<DataArrayIdType> _cell_fam_ids;
+ MCAuto<DataArrayIdType> _cell_num_ids;
+ MCAuto<DataArrayIdType> _node_fam_ids;
+ MCAuto<DataArrayIdType> _node_num_ids;
public:
MEDLOADER_EXPORT static const int PARAMEDMEM_2_VTKTYPE_LGTH=34;
MEDLOADER_EXPORT static const unsigned char PARAMEDMEM_2_VTKTYPE[PARAMEDMEM_2_VTKTYPE_LGTH];
{
public:
static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector<int>& levs);
- static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
- void selectPartOfNodes(const DataArrayInt *pflNodes);
+ static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
+ void selectPartOfNodes(const DataArrayIdType *pflNodes);
MEDMeshMultiLev *prepare() const;
MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MCAuto<MEDCoupling1GTUMesh>& part);
- MEDLOADER_EXPORT bool buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const;
+ MEDLOADER_EXPORT bool buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayIdType *&cellLocations, DataArrayIdType *& cells, DataArrayIdType *&faceLocations, DataArrayIdType *&faces) const;
protected:
- void appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr);
+ void appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr);
private:
- void reorderNodesIfNecessary(MCAuto<DataArrayDouble>& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const;
+ void reorderNodesIfNecessary(MCAuto<DataArrayDouble>& coords, DataArrayIdType *nodalConnVTK, DataArrayIdType *polyhedNodalConnVTK) const;
private:
MEDUMeshMultiLev(const MEDUMeshMultiLev& other);
MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<int>& levs);
- MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
+ MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
private:
std::vector< MCAuto<MEDCoupling1GTUMesh> > _parts;
//! this attribute is used only for mesh with no cells but having coordinates. For classical umeshes those pointer is equal to pointer of coordinates of instances in this->_parts.
class MEDStructuredMeshMultiLev : public MEDMeshMultiLev
{
public:
- void selectPartOfNodes(const DataArrayInt *pflNodes);
- virtual std::vector<int> getNodeGridStructure() const = 0;
+ void selectPartOfNodes(const DataArrayIdType *pflNodes);
+ virtual std::vector<mcIdType> getNodeGridStructure() const = 0;
protected:
MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other);
MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector<int>& lev);
- MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
+ MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, mcIdType nbOfNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
void dealWithImplicitUnstructuredMesh(const MEDFileMesh *m);
protected:
void moveFaceToCell() const;
void initStdFieldOfIntegers(const MEDFileStructuredMesh *m);
protected:
bool _is_internal;
- MCAuto<DataArrayInt> _face_fam_ids;
- MCAuto<DataArrayInt> _face_num_ids;
+ MCAuto<DataArrayIdType> _face_fam_ids;
+ MCAuto<DataArrayIdType> _face_num_ids;
};
class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
{
public:
static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector<int>& levs);
- static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
- std::vector<int> getNodeGridStructure() const;
+ static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
+ std::vector<mcIdType> getNodeGridStructure() const;
MEDMeshMultiLev *prepare() const;
MEDLOADER_EXPORT std::vector< DataArrayDouble * > buildVTUArrays(bool& isInternal) const;
private:
MEDCMeshMultiLev(const MEDCMeshMultiLev& other);
MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<int>& levs);
- MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
+ MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
private:
std::vector< MCAuto<DataArrayDouble> > _coords;
};
{
public:
static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector<int>& levs);
- static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls , const std::vector<int>& nbEntities);
- std::vector<int> getNodeGridStructure() const;
+ static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls , const std::vector<mcIdType>& nbEntities);
+ std::vector<mcIdType> getNodeGridStructure() const;
MEDMeshMultiLev *prepare() const;
- MEDLOADER_EXPORT void buildVTUArrays(DataArrayDouble *&coords, std::vector<int>& nodeStrct, bool& isInternal) const;
+ MEDLOADER_EXPORT void buildVTUArrays(DataArrayDouble *&coords, std::vector<mcIdType>& nodeStrct, bool& isInternal) const;
private:
MEDCurveLinearMeshMultiLev(const MEDCurveLinearMeshMultiLev& other);
MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<int>& levs);
- MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
+ MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayIdType *>& pfls, const std::vector<mcIdType>& nbEntities);
private:
MCAuto<DataArrayDouble> _coords;
- std::vector<int> _structure;
+ std::vector<mcIdType> _structure;
};
class MEDFileField1TSStructItem2 : public BigMemoryObject
{
public:
MEDFileField1TSStructItem2();
- MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair<int,int>& b, const std::string& pfl, const std::string& loc);
+ MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair<mcIdType,mcIdType>& b, const std::string& pfl, const std::string& loc);
void checkWithMeshStructForCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs);
void checkWithMeshStructForGaussNE(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs);
void checkWithMeshStructForGaussPT(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs);
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
//
- const DataArrayInt *getPfl(const MEDFileFieldGlobsReal *globs) const;
+ const DataArrayIdType *getPfl(const MEDFileFieldGlobsReal *globs) const;
INTERP_KERNEL::NormalizedCellType getGeo() const { return _geo_type; }
- int getNbEntity() const { return _nb_of_entity; }
- const std::pair<int,int>& getStartStop() const { return _start_end; }
+ mcIdType getNbEntity() const { return _nb_of_entity; }
+ const std::pair<mcIdType,mcIdType>& getStartStop() const { return _start_end; }
std::string getPflName() const;
int getNbOfIntegrationPts(const MEDFileFieldGlobsReal *globs) const;
//! warning this method also set _nb_of_entity attribute !
- void checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs);
- bool isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const;
+ void checkInRange(mcIdType nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs);
+ bool isFastlyEqual(mcIdType& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const;
bool operator==(const MEDFileField1TSStructItem2& other) const;
bool isCellSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const;
bool isNodeSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const;
static const char NEWLY_CREATED_PFL_NAME[];
private:
INTERP_KERNEL::NormalizedCellType _geo_type;
- std::pair<int,int> _start_end;
- MCAuto<DataArrayInt> _pfl;
+ std::pair<mcIdType,mcIdType> _start_end;
+ MCAuto<DataArrayIdType> _pfl;
std::string _loc;
- int _nb_of_entity;
+ mcIdType _nb_of_entity;
};
class MEDFileField1TSStructItem : public BigMemoryObject
//
#include "MEDFileJoint.hxx"
+#include "MEDFileBasis.hxx"
#include "MEDLoader.hxx"
#include "MEDLoaderBase.hxx"
#include "MEDFileSafeCaller.txx"
std::size_t MEDFileJointCorrespondence::getHeapMemorySizeWithoutChildren() const
{
- return sizeof(MCAuto<DataArrayInt>);
+ return sizeof(MCAuto<DataArrayIdType>);
}
std::vector<const BigMemoryObject *> MEDFileJointCorrespondence::getDirectChildrenWithNull() const
* \param [in] loc_geo_type - the local geometry type of correspondence.
* \param [in] rem_geo_type - the remote geometry type of correspondence.
*/
-MEDFileJointCorrespondence::MEDFileJointCorrespondence(DataArrayInt* correspondence,
+MEDFileJointCorrespondence::MEDFileJointCorrespondence(DataArrayIdType* correspondence,
bool isNodal,
INTERP_KERNEL::NormalizedCellType loc_geo_type,
INTERP_KERNEL::NormalizedCellType rem_geo_type):
MEDFileJointCorrespondence::setCorrespondence( correspondence );
}
-MEDFileJointCorrespondence* MEDFileJointCorrespondence::New(DataArrayInt* correspondence,
+MEDFileJointCorrespondence* MEDFileJointCorrespondence::New(DataArrayIdType* correspondence,
INTERP_KERNEL::NormalizedCellType loc_geo_type,
INTERP_KERNEL::NormalizedCellType rem_geo_type)
{
/*!
* Returns a new MEDFileJointCorrespondence of nodes
*/
-MEDFileJointCorrespondence *MEDFileJointCorrespondence::New(DataArrayInt* correspondence)
+MEDFileJointCorrespondence *MEDFileJointCorrespondence::New(DataArrayIdType* correspondence)
{
return new MEDFileJointCorrespondence(correspondence);
}
throw INTERP_KERNEL::Exception( "Geometric type not specified for a cell Joint" );
}
- if ( (const DataArrayInt *)_correspondence )
+ if ( (const DataArrayIdType *)_correspondence )
{
writeLL(fid, localMeshName, jointName, order, iteration);
}
MED_NODE, MED_NONE,
MED_NODE, MED_NONE,
_correspondence->getNbOfElems()/2,
- _correspondence->getConstPointer()));
+ ToMedIntArray(_correspondence)->getConstPointer()));
}
else
{
MED_CELL, typmai3[ _loc_geo_type ],
MED_CELL, typmai3[ _rem_geo_type ],
_correspondence->getNbOfElems()/2,
- _correspondence->getConstPointer()));
+ ToMedIntArray(_correspondence)->getConstPointer()));
}
}
-void MEDFileJointCorrespondence::setCorrespondence(DataArrayInt *corr)
+void MEDFileJointCorrespondence::setCorrespondence(DataArrayIdType *corr)
{
_correspondence=corr;
if ( corr )
oss << "- entity type of the correspondence : " << ( getIsNodal() ? "NODE" : "CELL" ) << "\n";
oss << "- Local geometry type of the correspondence : " << INTERP_KERNEL::CellModel::GetCellModel( _loc_geo_type ).getRepr() << "\n";
oss << "- Remote geometry type of the correspondence : " << INTERP_KERNEL::CellModel::GetCellModel( _rem_geo_type ).getRepr() << "\n";
- if ( (const DataArrayInt *)_correspondence )
+ if ( (const DataArrayIdType *)_correspondence )
{
oss << "- Number entity of the correspondence : " << getCorrespondence()->getNumberOfTuples() << "\n";
- const DataArrayInt* tmp=getCorrespondence();
+ const DataArrayIdType* tmp=getCorrespondence();
oss << "- Correspondence : <<";
- for(const int *it=tmp->begin();it!=tmp->end();it++)
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++)
oss<< *it << " ";
}
else
std::size_t MEDFileJointOneStep::getHeapMemorySizeWithoutChildren() const
{
- return _correspondences.capacity()*sizeof(MCAuto<DataArrayInt>);
+ return _correspondences.capacity()*sizeof(MCAuto<DataArrayIdType>);
}
std::vector<const BigMemoryObject *> MEDFileJointOneStep::getDirectChildrenWithNull() const
&loc_ent_type, &loc_geo_type, &rem_ent_type, &rem_geo_type, &num_entity));
if ( num_entity > 0 )
{
- MCAuto<DataArrayInt> correspondence=DataArrayInt::New();
+ MCAuto<DataArrayMedInt> correspondence=DataArrayMedInt::New();
correspondence->alloc(num_entity*2, 1);
MEDFILESAFECALLERRD0(MEDsubdomainCorrespondenceRd,(fid, mName.c_str(), jointName.c_str(), order, iteration, loc_ent_type,
loc_geo_type, rem_ent_type, rem_geo_type, correspondence->getPointer()));
cor->setIsNodal( loc_ent_type == MED_NODE );
cor->setLocalGeometryType ( convertGeometryType( loc_geo_type ));
cor->setRemoteGeometryType( convertGeometryType( rem_geo_type ));
- cor->setCorrespondence( correspondence );
+ cor->setCorrespondence( FromMedIntArray<mcIdType>(correspondence ));
_correspondences.push_back(cor);
}
}
{
public:
MEDLOADER_EXPORT static MEDFileJointCorrespondence *New();
- MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayInt* correspondence); // nodes
- MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayInt* correspondence, // cells
+ MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence); // nodes
+ MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence, // cells
INTERP_KERNEL::NormalizedCellType loc_geo_type,
INTERP_KERNEL::NormalizedCellType rem_geo_type);
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const { return _loc_geo_type; }
MEDLOADER_EXPORT void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type) { _rem_geo_type=type; }
MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const { return _rem_geo_type; }
- MEDLOADER_EXPORT void setCorrespondence(DataArrayInt *corr);
- MEDLOADER_EXPORT const DataArrayInt *getCorrespondence() const { return _correspondence; }
+ MEDLOADER_EXPORT void setCorrespondence(DataArrayIdType *corr);
+ MEDLOADER_EXPORT const DataArrayIdType *getCorrespondence() const { return _correspondence; }
MEDLOADER_EXPORT void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
MEDLOADER_EXPORT std::string simpleRepr() const;
MEDLOADER_EXPORT void writeLL(med_idt fid, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
private:
MEDFileJointCorrespondence();
- MEDFileJointCorrespondence(DataArrayInt* correspondence,
+ MEDFileJointCorrespondence(DataArrayIdType* correspondence,
bool is_nodal = true,
INTERP_KERNEL::NormalizedCellType loc_geo_type = INTERP_KERNEL::NORM_ERROR,
INTERP_KERNEL::NormalizedCellType rem_geo_type = INTERP_KERNEL::NORM_ERROR);
bool _is_nodal;
INTERP_KERNEL::NormalizedCellType _loc_geo_type;
INTERP_KERNEL::NormalizedCellType _rem_geo_type;
- MCAuto<DataArrayInt> _correspondence;
+ MCAuto<DataArrayIdType> _correspondence;
};
/*!
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingMappedExtrudedMesh.hxx"
+#include "MEDCouplingMemArray.txx"
#include "InterpKernelAutoPtr.hxx"
for(std::vector<std::string>::const_iterator it2=(*it).second.begin();it2!=(*it).second.end();it2++)
ret+=(*it2).capacity();
}
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
- ret+=(*it).first.capacity()+sizeof(int);
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
+ ret+=(*it).first.capacity()+sizeof(mcIdType);
return ret;
}
* \return std::vector<int> - sequence of ids of the families.
* \throw If the name of a nonexistent group is specified.
*/
-std::vector<int> MEDFileMesh::getFamiliesIdsOnGroup(const std::string& name) const
+std::vector<mcIdType> MEDFileMesh::getFamiliesIdsOnGroup(const std::string& name) const
{
std::string oname(name);
std::map<std::string, std::vector<std::string> >::const_iterator it=_groups.find(oname);
_groups[oname]=fams;
for(std::vector<std::string>::const_iterator it1=fams.begin();it1!=fams.end();it1++)
{
- std::map<std::string,int>::iterator it2=_families.find(*it1);
+ std::map<std::string,mcIdType>::iterator it2=_families.find(*it1);
if(it2==_families.end())
_families[*it1]=0;
}
* \param [in] famIds - a sequence of ids of families constituting the group.
* \throw If a family name is not found by its id.
*/
-void MEDFileMesh::setFamiliesIdsOnGroup(const std::string& name, const std::vector<int>& famIds)
+void MEDFileMesh::setFamiliesIdsOnGroup(const std::string& name, const std::vector<mcIdType>& famIds)
{
std::string oname(name);
std::vector<std::string> fams(famIds.size());
int i=0;
- for(std::vector<int>::const_iterator it1=famIds.begin();it1!=famIds.end();it1++,i++)
+ for(std::vector<mcIdType>::const_iterator it1=famIds.begin();it1!=famIds.end();it1++,i++)
{
std::string name2=getFamilyNameGivenId(*it1);
fams[i]=name2;
void MEDFileMesh::setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps)
{
std::string fName(famName);
- const std::map<std::string,int>::const_iterator it=_families.find(fName);
+ const std::map<std::string,mcIdType>::const_iterator it=_families.find(fName);
if(it==_families.end())
{
std::vector<std::string> fams=getFamiliesNames();
{
std::vector<std::string> ret(_families.size());
int i=0;
- for(std::map<std::string, int >::const_iterator it=_families.begin();it!=_families.end();it++,i++)
+ for(std::map<std::string, mcIdType >::const_iterator it=_families.begin();it!=_families.end();it++,i++)
ret[i]=(*it).first;
return ret;
}
std::vector<std::string> allGrps(getGroupsNames());
for(std::vector<std::string>::const_iterator it=allGrps.begin();it!=allGrps.end();it++)
{
- std::vector<int> levs(getGrpNonEmptyLevelsExt((*it)));
+ std::vector<mcIdType> levs(getGrpNonEmptyLevelsExt((*it)));
if(std::find(levs.begin(),levs.end(),meshDimRelToMaxExt)!=levs.end())
ret.push_back(*it);
}
/*!
* Returns all relative mesh levels (including nodes) where a given group is defined.
* \param [in] grp - the name of the group of interest.
- * \return std::vector<int> - a sequence of the relative dimensions.
+ * \return std::vector<mcIdType> - a sequence of the relative dimensions.
*/
-std::vector<int> MEDFileMesh::getGrpNonEmptyLevelsExt(const std::string& grp) const
+std::vector<mcIdType> MEDFileMesh::getGrpNonEmptyLevelsExt(const std::string& grp) const
{
std::vector<std::string> fams(getFamiliesOnGroup(grp));
return getFamsNonEmptyLevelsExt(fams);
* Returns all relative mesh levels (**excluding nodes**) where given groups are defined.
* To include nodes, call getGrpsNonEmptyLevelsExt() method.
* \param [in] grps - a sequence of names of the groups of interest.
- * \return std::vector<int> - a sequence of the relative dimensions.
+ * \return std::vector<mcIdType> - a sequence of the relative dimensions.
*/
-std::vector<int> MEDFileMesh::getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const
+std::vector<mcIdType> MEDFileMesh::getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const
{
std::vector<std::string> fams(getFamiliesOnGroups(grps));
return getFamsNonEmptyLevels(fams);
/*!
* Returns all relative mesh levels (including nodes) where given groups are defined.
* \param [in] grps - a sequence of names of the groups of interest.
- * \return std::vector<int> - a sequence of the relative dimensions.
+ * \return std::vector<mcIdType> - a sequence of the relative dimensions.
*/
-std::vector<int> MEDFileMesh::getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const
+std::vector<mcIdType> MEDFileMesh::getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const
{
std::vector<std::string> fams(getFamiliesOnGroups(grps));
return getFamsNonEmptyLevelsExt(fams);
* Returns all relative mesh levels (**excluding nodes**) where a given group is defined.
* To include nodes, call getGrpNonEmptyLevelsExt() method.
* \param [in] grp - the name of the group of interest.
- * \return std::vector<int> - a sequence of the relative dimensions.
+ * \return std::vector<mcIdType> - a sequence of the relative dimensions.
*/
-std::vector<int> MEDFileMesh::getGrpNonEmptyLevels(const std::string& grp) const
+std::vector<mcIdType> MEDFileMesh::getGrpNonEmptyLevels(const std::string& grp) const
{
std::vector<std::string> fams(getFamiliesOnGroup(grp));
return getFamsNonEmptyLevels(fams);
* Returns all relative mesh levels (**excluding nodes**) where a given family is defined.
* To include nodes, call getFamNonEmptyLevelsExt() method.
* \param [in] fam - the name of the family of interest.
- * \return std::vector<int> - a sequence of the relative dimensions.
+ * \return std::vector<mcIdType> - a sequence of the relative dimensions.
*/
-std::vector<int> MEDFileMesh::getFamNonEmptyLevels(const std::string& fam) const
+std::vector<mcIdType> MEDFileMesh::getFamNonEmptyLevels(const std::string& fam) const
{
std::vector<std::string> fams(1,std::string(fam));
return getFamsNonEmptyLevels(fams);
/*!
* Returns all relative mesh levels (including nodes) where a given family is defined.
* \param [in] fam - the name of the family of interest.
- * \return std::vector<int> - a sequence of the relative dimensions.
+ * \return std::vector<mcIdType> - a sequence of the relative dimensions.
*/
-std::vector<int> MEDFileMesh::getFamNonEmptyLevelsExt(const std::string& fam) const
+std::vector<mcIdType> MEDFileMesh::getFamNonEmptyLevelsExt(const std::string& fam) const
{
std::vector<std::string> fams(1,std::string(fam));
return getFamsNonEmptyLevelsExt(fams);
void MEDFileMesh::assignFamilyNameWithGroupName()
{
std::map<std::string, std::vector<std::string> > groups(_groups);
- std::map<std::string,int> newFams;
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ std::map<std::string,mcIdType> newFams;
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
std::vector<std::string> grps=getGroupsOnFamily((*it).first);
if(grps.size()==1 && groups[grps[0]].size()==1)
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
const std::vector<std::string> &famsOnGrp((*it).second);
- std::vector<int> famIds(getFamiliesIdsOnGroup(name));
- const DataArrayInt *famArr(getFamilyFieldAtLevel(meshDimRelToMaxExt));
+ std::vector<mcIdType> famIds(getFamiliesIdsOnGroup(name));
+ const DataArrayIdType *famArr(getFamilyFieldAtLevel(meshDimRelToMaxExt));
if(!famArr)
return ;
- MCAuto<DataArrayInt> vals(famArr->getDifferentValues());
- MCAuto<DataArrayInt> famIds2(DataArrayInt::NewFromStdVector(famIds));
- MCAuto<DataArrayInt> idsToKill(famIds2->buildIntersection(vals));
+ MCAuto<DataArrayIdType> vals(famArr->getDifferentValues());
+ MCAuto<DataArrayIdType> famIds2(DataArrayIdType::NewFromStdVector(famIds));
+ MCAuto<DataArrayIdType> idsToKill(famIds2->buildIntersection(vals));
if(idsToKill->empty())
return ;
std::vector<std::string> newFamsOnGrp;
void MEDFileMesh::removeFamily(const std::string& name)
{
std::string oname(name);
- std::map<std::string, int >::iterator it=_families.find(oname);
+ std::map<std::string, mcIdType >::iterator it=_families.find(oname);
std::vector<std::string> fams=getFamiliesNames();
if(it==_families.end())
{
*/
std::vector<std::string> MEDFileMesh::removeOrphanFamilies()
{
- MCAuto<DataArrayInt> allFamIdsInUse=computeAllFamilyIdsInUse();
+ MCAuto<DataArrayIdType> allFamIdsInUse=computeAllFamilyIdsInUse();
std::vector<std::string> ret;
- if(!((DataArrayInt*)allFamIdsInUse))
+ if(!((DataArrayIdType*)allFamIdsInUse))
{
ret=getFamiliesNames();
_families.clear(); _groups.clear();
return ret;
}
- std::map<std::string,int> famMap;
+ std::map<std::string,mcIdType> famMap;
std::map<std::string, std::vector<std::string> > grps(_groups);
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
if(allFamIdsInUse->presenceOfValue((*it).second))
famMap[(*it).first]=(*it).second;
*/
void MEDFileMesh::removeFamiliesReferedByNoGroups()
{
- std::map<std::string,int> fams;
+ std::map<std::string,mcIdType> fams;
std::set<std::string> sfams;
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
sfams.insert((*it).first);
for(std::map<std::string, std::vector<std::string> >::const_iterator it0=_groups.begin();it0!=_groups.end();it0++)
for(std::vector<std::string>::const_iterator it1=(*it0).second.begin();it1!=(*it0).second.end();it1++)
//
std::vector<int> levels(getNonEmptyLevelsExt());
std::set<int> idsRefed;
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
idsRefed.insert((*it).second);
if((*it).second==0)
}
for(std::vector<int>::const_iterator it=levels.begin();it!=levels.end();it++)
{
- const DataArrayInt *fams(0);
+ const DataArrayIdType *fams(0);
try
{
fams=getFamilyFieldAtLevel(*it);
std::vector<bool> v(fams->getNumberOfTuples(),false);
for(std::set<int>::const_iterator pt=idsRefed.begin();pt!=idsRefed.end();pt++)
fams->switchOnTupleEqualTo(*pt,v);
- MCAuto<DataArrayInt> unfetchedIds(DataArrayInt::BuildListOfSwitchedOff(v));
+ MCAuto<DataArrayIdType> unfetchedIds(DataArrayIdType::BuildListOfSwitchedOff(v));
if(!unfetchedIds->empty())
{
- MCAuto<DataArrayInt> newFams(fams->deepCopy());
+ MCAuto<DataArrayIdType> newFams(fams->deepCopy());
newFams->setPartOfValuesSimple3(0,unfetchedIds->begin(),unfetchedIds->end(),0,1,1);
setFamilyFieldArr(*it,newFams);
}
}
//
std::map<std::string, std::vector<std::string> > newGroups(_groups);
- std::map<std::string,int> newFams(_families);
+ std::map<std::string,mcIdType> newFams(_families);
std::vector<int> levels(getNonEmptyLevelsExt());
- std::map<int, std::vector<int> > famIdsToSubstitute;
+ std::map<mcIdType, std::vector<mcIdType> > famIdsToSubstitute;
// iterate on all different set of groups
std::set<std::string> familiesToKill;
for(auto setOfCommonGrp : setOfFamilies)
{
for(std::vector<int>::const_iterator it=levels.begin();it!=levels.end();it++)
{
- DataArrayInt *fams(nullptr);
+ DataArrayIdType *fams(nullptr);
try
{
fams=getFamilyFieldAtLevel(*it);
catch(INTERP_KERNEL::Exception& e) { }
if(!fams)
continue;
- MCAuto<DataArrayInt> idsToModif(fams->findIdsEqualList(famIdsSubstSession.second.data(),famIdsSubstSession.second.data()+famIdsSubstSession.second.size()));
+ MCAuto<DataArrayIdType> idsToModif(fams->findIdsEqualList(famIdsSubstSession.second.data(),famIdsSubstSession.second.data()+famIdsSubstSession.second.size()));
fams->setPartOfValuesSimple3(famIdsSubstSession.first,idsToModif->begin(),idsToModif->end(),0,1,1);
}
}
* \param [in] oldId - a current id of the family.
* \param [in] newId - a new family id.
*/
-void MEDFileMesh::changeFamilyId(int oldId, int newId)
+void MEDFileMesh::changeFamilyId(mcIdType oldId, mcIdType newId)
{
changeFamilyIdArr(oldId,newId);
- std::map<std::string,int> fam2;
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ std::map<std::string,mcIdType> fam2;
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
if((*it).second==oldId)
fam2[(*it).first]=newId;
void MEDFileMesh::changeFamilyName(const std::string& oldName, const std::string& newName)
{
std::string oname(oldName);
- std::map<std::string, int >::iterator it=_families.find(oname);
+ std::map<std::string, mcIdType >::iterator it=_families.find(oname);
std::vector<std::string> fams=getFamiliesNames();
if(it==_families.end())
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
std::string nname(newName);
- std::map<std::string, int >::iterator it2=_families.find(nname);
+ std::map<std::string, mcIdType >::iterator it2=_families.find(nname);
if(it2!=_families.end())
{
std::ostringstream oss; oss << "Such familyname \"" << newName << " already exists ! Kill it before !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- int cpy=(*it).second;
+ mcIdType cpy=(*it).second;
_families.erase(it);
_families[newName]=cpy;
for(std::map<std::string, std::vector<std::string> >::iterator it3=_groups.begin();it3!=_groups.end();it3++)
{
if(_families==other->_families)
return true;
- std::map<std::string,int> fam0;
- std::map<std::string,int> fam1;
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ std::map<std::string,mcIdType> fam0;
+ std::map<std::string,mcIdType> fam1;
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
if((*it).second!=0)
fam0[(*it).first]=(*it).second;
- for(std::map<std::string,int>::const_iterator it=other->_families.begin();it!=other->_families.end();it++)
+ for(std::map<std::string,mcIdType>::const_iterator it=other->_families.begin();it!=other->_families.end();it++)
if((*it).second!=0)
fam1[(*it).first]=(*it).second;
return fam0==fam1;
* \param [in] famId - the family id.
* \return bool - \c true the family with the id \a famId exists in \a this mesh.
*/
-bool MEDFileMesh::existsFamily(int famId) const
+bool MEDFileMesh::existsFamily(mcIdType famId) const
{
- for(std::map<std::string,int>::const_iterator it2=_families.begin();it2!=_families.end();it2++)
+ for(std::map<std::string,mcIdType>::const_iterator it2=_families.begin();it2!=_families.end();it2++)
if((*it2).second==famId)
return true;
return false;
* \param [in] familyName - the family name.
* \param [in] id - a new id of the family.
*/
-void MEDFileMesh::setFamilyId(const std::string& familyName, int id)
+void MEDFileMesh::setFamilyId(const std::string& familyName, mcIdType id)
{
std::string fname(familyName);
_families[fname]=id;
}
-void MEDFileMesh::setFamilyIdUnique(const std::string& familyName, int id)
+void MEDFileMesh::setFamilyIdUnique(const std::string& familyName, mcIdType id)
{
std::string fname(familyName);
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
if((*it).second==id)
{
if((*it).first!=familyName)
* \param [in] famId - an id of the family.
* \throw If a family with the same name or id already exists in \a this mesh.
*/
-void MEDFileMesh::addFamily(const std::string& familyName, int famId)
+void MEDFileMesh::addFamily(const std::string& familyName, mcIdType famId)
{
std::string fname(familyName);
- std::map<std::string,int>::const_iterator it=_families.find(fname);
+ std::map<std::string,mcIdType>::const_iterator it=_families.find(fname);
if(it==_families.end())
{
- for(std::map<std::string,int>::const_iterator it2=_families.begin();it2!=_families.end();it2++)
+ for(std::map<std::string,mcIdType>::const_iterator it2=_families.begin();it2!=_families.end();it2++)
if((*it2).second==famId)
{
std::ostringstream oss;
oss << std::endl << "Please choose an another group name or call removeGroup(\"" << grpName << "\") method !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- const DataArrayInt *fieldFamIds=getFamilyFieldAtLevel(meshDimRelToMaxExt);
+ const DataArrayIdType *fieldFamIds=getFamilyFieldAtLevel(meshDimRelToMaxExt);
if(fieldFamIds==0)
throw INTERP_KERNEL::Exception("MEDFileMesh::createGroupOnAll : Family field arr ids is not defined for this level !");
- MCAuto<DataArrayInt> famIds=fieldFamIds->getDifferentValues();
+ MCAuto<DataArrayIdType> famIds=fieldFamIds->getDifferentValues();
std::vector<std::string> familiesOnWholeGroup;
- for(const int *it=famIds->begin();it!=famIds->end();it++)
+ for(const mcIdType *it=famIds->begin();it!=famIds->end();it++)
{
bool tmp;
familiesOnWholeGroup.push_back(findOrCreateAndGiveFamilyWithId(*it,tmp));
* famIds should exclusively belong.
* \return bool - \c true if no modification is done in \a this mesh by this method.
*/
-bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& vMeshDimRelToMaxExt)
+bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector<mcIdType>& famIds, const std::vector<int>& vMeshDimRelToMaxExt)
{
std::set<int> levsInput(vMeshDimRelToMaxExt.begin(),vMeshDimRelToMaxExt.end());
std::vector<int> levs=getNonEmptyLevelsExt();
std::set<int> levs2(levs.begin(),levs.end());
std::vector<int> levsToTest;
std::set_difference(levs2.begin(),levs2.end(),levsInput.begin(),levsInput.end(),std::back_insert_iterator< std::vector<int> >(levsToTest));
- std::set<int> famIds2(famIds.begin(),famIds.end());
+ std::set<mcIdType> famIds2(famIds.begin(),famIds.end());
bool ret=true;
- int maxFamId=1;
+ mcIdType maxFamId=1;
if(!_families.empty())
maxFamId=getMaxFamilyId()+1;
std::vector<std::string> allFams=getFamiliesNames();
for(std::vector<int>::const_iterator it=levsToTest.begin();it!=levsToTest.end();it++)
{
- const DataArrayInt *fieldFamIds=getFamilyFieldAtLevel(*it);
+ const DataArrayIdType *fieldFamIds=getFamilyFieldAtLevel(*it);
if(fieldFamIds)
{
- MCAuto<DataArrayInt> famIds3=fieldFamIds->getDifferentValues();
- std::vector<int> tmp;
- std::set_intersection(famIds3->begin(),famIds3->end(),famIds2.begin(),famIds2.end(),std::back_insert_iterator< std::vector<int> >(tmp));
- for(std::vector<int>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ MCAuto<DataArrayIdType> famIds3=fieldFamIds->getDifferentValues();
+ std::vector<mcIdType> tmp;
+ std::set_intersection(famIds3->begin(),famIds3->end(),famIds2.begin(),famIds2.end(),std::back_insert_iterator< std::vector<mcIdType> >(tmp));
+ for(std::vector<mcIdType>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
{
ret=false;
std::string famName=getFamilyNameGivenId(*it2);
std::string zeName=CreateNameNotIn(oss.str(),allFams);
addFamilyOnAllGroupsHaving(famName,zeName);
_families[zeName]=maxFamId;
- (const_cast<DataArrayInt *>(fieldFamIds))->changeValue(*it2,maxFamId);
+ (const_cast<DataArrayIdType *>(fieldFamIds))->changeValue(*it2,maxFamId);
maxFamId++;
}
}
}
}
-void MEDFileMesh::checkNoGroupClash(const DataArrayInt *famArr, const std::string& grpName) const
+void MEDFileMesh::checkNoGroupClash(const DataArrayIdType *famArr, const std::string& grpName) const
{
std::vector<std::string> grpsNames(getGroupsNames());
if(std::find(grpsNames.begin(),grpsNames.end(),grpName)==grpsNames.end())
return ;
- std::vector<int> famIds(getFamiliesIdsOnGroup(grpName));
+ std::vector<mcIdType> famIds(getFamiliesIdsOnGroup(grpName));
if(famArr->presenceOfValue(famIds))
{
std::ostringstream oss; oss << "MEDFileUMesh::addGroup : Group with name \"" << grpName << "\" already exists at specified level ! Destroy it before calling this method !";
/*!
* \param [in] ids ids and group name of the new group to add. The ids should be sorted and different each other (MED file norm).
- * \parma [in,out] famArr family array on level of interest to be renumbered. The input pointer should be not \c NULL (no check of that will be performed)
+ * \param [in,out] famArr family array on level of interest to be renumbered. The input pointer should be not \c NULL (no check of that will be performed)
*/
-void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, DataArrayInt *famArr)
+void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayIdType *ids, DataArrayIdType *famArr)
{
if(!ids)
throw INTERP_KERNEL::Exception("MEDFileUMesh::addGroup : NULL pointer in input !");
throw INTERP_KERNEL::Exception("MEDFileUMesh::addGroup : empty group name ! MED file format do not accept empty group name !");
ids->checkStrictlyMonotonic(true);
checkNoGroupClash(famArr,grpName);
- MCAuto<DataArrayInt> famArrTmp; famArrTmp.takeRef(famArr);
- std::list< MCAuto<DataArrayInt> > allFamIds(getAllNonNullFamilyIds());
+ MCAuto<DataArrayIdType> famArrTmp; famArrTmp.takeRef(famArr);
+ std::list< MCAuto<DataArrayIdType> > allFamIds(getAllNonNullFamilyIds());
allFamIds.erase(std::find(allFamIds.begin(),allFamIds.end(),famArrTmp));
- MCAuto<DataArrayInt> famIds=famArr->selectByTupleIdSafe(ids->begin(),ids->end());
- MCAuto<DataArrayInt> diffFamIds=famIds->getDifferentValues();
- std::vector<int> familyIds;
- std::vector< MCAuto<DataArrayInt> > idsPerfamiliyIds;
- int maxVal=getTheMaxAbsFamilyId()+1;
- std::map<std::string,int> families(_families);
+ MCAuto<DataArrayIdType> famIds=famArr->selectByTupleIdSafe(ids->begin(),ids->end());
+ MCAuto<DataArrayIdType> diffFamIds=famIds->getDifferentValues();
+ std::vector<mcIdType> familyIds;
+ std::vector< MCAuto<DataArrayIdType> > idsPerfamiliyIds;
+ mcIdType maxVal=getTheMaxAbsFamilyId()+1;
+ std::map<std::string,mcIdType> families(_families);
std::map<std::string, std::vector<std::string> > groups(_groups);
std::vector<std::string> fams;
bool created(false);
- for(const int *famId=diffFamIds->begin();famId!=diffFamIds->end();famId++)
+ for(const mcIdType *famId=diffFamIds->begin();famId!=diffFamIds->end();famId++)
{
- MCAuto<DataArrayInt> ids2Tmp=famIds->findIdsEqual(*famId);
- MCAuto<DataArrayInt> ids2=ids->selectByTupleId(ids2Tmp->begin(),ids2Tmp->end());
- MCAuto<DataArrayInt> ids1=famArr->findIdsEqual(*famId);
- MCAuto<DataArrayInt> ret0(ids1->buildSubstractionOptimized(ids2));
+ MCAuto<DataArrayIdType> ids2Tmp=famIds->findIdsEqual(*famId);
+ MCAuto<DataArrayIdType> ids2=ids->selectByTupleId(ids2Tmp->begin(),ids2Tmp->end());
+ MCAuto<DataArrayIdType> ids1=famArr->findIdsEqual(*famId);
+ MCAuto<DataArrayIdType> ret0(ids1->buildSubstractionOptimized(ids2));
if(ret0->empty())
{
bool isFamPresent=false;
- for(std::list< MCAuto<DataArrayInt> >::const_iterator itl=allFamIds.begin();itl!=allFamIds.end() && !isFamPresent;itl++)
+ for(std::list< MCAuto<DataArrayIdType> >::const_iterator itl=allFamIds.begin();itl!=allFamIds.end() && !isFamPresent;itl++)
isFamPresent=(*itl)->presenceOfValue(*famId);
if(!isFamPresent && *famId!=0)
{ familyIds.push_back(*famId); idsPerfamiliyIds.push_back(ret0); fams.push_back(FindOrCreateAndGiveFamilyWithId(families,*famId,created)); } // adding *famId in grp
}
for(std::size_t i=0;i<familyIds.size();i++)
{
- DataArrayInt *da=idsPerfamiliyIds[i];
+ DataArrayIdType *da=idsPerfamiliyIds[i];
famArr->setPartOfValuesSimple3(familyIds[i],da->begin(),da->end(),0,1,1);
}
_families=families;
* \return std::string - the name of the existing or the created family.
* \throw If it is not possible to create a unique family name.
*/
-std::string MEDFileMesh::findOrCreateAndGiveFamilyWithId(int id, bool& created)
+std::string MEDFileMesh::findOrCreateAndGiveFamilyWithId(mcIdType id, bool& created)
{
return FindOrCreateAndGiveFamilyWithId(_families,id,created);
}
* will be modified.
* This method will throws an exception if it is not possible to create a unique family name.
*/
-std::string MEDFileMesh::FindOrCreateAndGiveFamilyWithId(std::map<std::string,int>& families, int id, bool& created)
+std::string MEDFileMesh::FindOrCreateAndGiveFamilyWithId(std::map<std::string,mcIdType>& families, mcIdType id, bool& created)
{
std::vector<std::string> famAlreadyExisting(families.size());
int ii=0;
- for(std::map<std::string,int>::const_iterator it=families.begin();it!=families.end();it++,ii++)
+ for(std::map<std::string,mcIdType>::const_iterator it=families.begin();it!=families.end();it++,ii++)
{
if((*it).second!=id)
{
* Sets names and ids of all families in \a this mesh.
* \param [in] info - a map of a family name to a family id.
*/
-void MEDFileMesh::setFamilyInfo(const std::map<std::string,int>& info)
+void MEDFileMesh::setFamilyInfo(const std::map<std::string,mcIdType>& info)
{
_families=info;
}
/*!
* Returns an id of the family having a given name.
* \param [in] name - the name of the family of interest.
- * \return int - the id of the family of interest.
+ * \return mcIdType - the id of the family of interest.
* \throw If no family with such a \a name exists.
*/
-int MEDFileMesh::getFamilyId(const std::string& name) const
+mcIdType MEDFileMesh::getFamilyId(const std::string& name) const
{
- std::map<std::string, int>::const_iterator it=_families.find(name);
+ std::map<std::string, mcIdType>::const_iterator it=_families.find(name);
if(it==_families.end())
{
std::vector<std::string> fams(getFamiliesNames());
/*!
* Returns ids of the families having given names.
* \param [in] fams - a sequence of the names of families of interest.
- * \return std::vector<int> - a sequence of the ids of families of interest.
+ * \return std::vector<mcIdType> - a sequence of the ids of families of interest.
* \throw If \a fams contains a name of an inexistent family.
*/
-std::vector<int> MEDFileMesh::getFamiliesIds(const std::vector<std::string>& fams) const
+std::vector<mcIdType> MEDFileMesh::getFamiliesIds(const std::vector<std::string>& fams) const
{
- std::vector<int> ret(fams.size());
+ std::vector<mcIdType> ret(fams.size());
int i=0;
for(std::vector<std::string>::const_iterator it=fams.begin();it!=fams.end();it++,i++)
{
- std::map<std::string, int>::const_iterator it2=_families.find(*it);
+ std::map<std::string, mcIdType>::const_iterator it2=_families.find(*it);
if(it2==_families.end())
{
std::vector<std::string> fams2=getFamiliesNames();
/*!
* Returns a maximal abs(id) of families in \a this mesh.
- * \return int - the maximal norm of family id.
+ * \return mcIdType - the maximal norm of family id.
* \throw If there are no families in \a this mesh.
*/
-int MEDFileMesh::getMaxAbsFamilyId() const
+mcIdType MEDFileMesh::getMaxAbsFamilyId() const
{
if(_families.empty())
throw INTERP_KERNEL::Exception("MEDFileMesh::getMaxFamilyId : no families set !");
- int ret=-std::numeric_limits<int>::max();
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ mcIdType ret=-std::numeric_limits<mcIdType>::max();
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
ret=std::max(std::abs((*it).second),ret);
}
/*!
* Returns a maximal id of families in \a this mesh.
- * \return int - the maximal family id.
+ * \return mcIdType - the maximal family id.
* \throw If there are no families in \a this mesh.
*/
-int MEDFileMesh::getMaxFamilyId() const
+mcIdType MEDFileMesh::getMaxFamilyId() const
{
if(_families.empty())
throw INTERP_KERNEL::Exception("MEDFileMesh::getMaxFamilyId : no families set !");
- int ret=-std::numeric_limits<int>::max();
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ mcIdType ret=-std::numeric_limits<mcIdType>::max();
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
ret=std::max((*it).second,ret);
}
/*!
* Returns a minimal id of families in \a this mesh.
- * \return int - the minimal family id.
+ * \return mcIdType - the minimal family id.
* \throw If there are no families in \a this mesh.
*/
-int MEDFileMesh::getMinFamilyId() const
+mcIdType MEDFileMesh::getMinFamilyId() const
{
if(_families.empty())
throw INTERP_KERNEL::Exception("MEDFileMesh::getMinFamilyId : no families set !");
- int ret=std::numeric_limits<int>::max();
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ mcIdType ret=std::numeric_limits<mcIdType>::max();
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
ret=std::min((*it).second,ret);
}
/*!
* Returns a maximal id of families in \a this mesh. Not only named families are
* considered but all family fields as well.
- * \return int - the maximal family id.
+ * \return mcIdType - the maximal family id.
*/
-int MEDFileMesh::getTheMaxAbsFamilyId() const
+mcIdType MEDFileMesh::getTheMaxAbsFamilyId() const
{
- int m1=-std::numeric_limits<int>::max();
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ mcIdType m1=-std::numeric_limits<mcIdType>::max();
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
m1=std::max(std::abs((*it).second),m1);
- int m2=getMaxAbsFamilyIdInArrays();
+ mcIdType m2=getMaxAbsFamilyIdInArrays();
return std::max(m1,m2);
}
/*!
* Returns a maximal id of families in \a this mesh. Not only named families are
* considered but all family fields as well.
- * \return int - the maximal family id.
+ * \return mcIdType - the maximal family id.
*/
-int MEDFileMesh::getTheMaxFamilyId() const
+mcIdType MEDFileMesh::getTheMaxFamilyId() const
{
- int m1=-std::numeric_limits<int>::max();
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ mcIdType m1=-std::numeric_limits<mcIdType>::max();
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
m1=std::max((*it).second,m1);
- int m2=getMaxFamilyIdInArrays();
+ mcIdType m2=getMaxFamilyIdInArrays();
return std::max(m1,m2);
}
/*!
* Returns a minimal id of families in \a this mesh. Not only named families are
* considered but all family fields as well.
- * \return int - the minimal family id.
+ * \return mcIdType - the minimal family id.
*/
-int MEDFileMesh::getTheMinFamilyId() const
+mcIdType MEDFileMesh::getTheMinFamilyId() const
{
- int m1=std::numeric_limits<int>::max();
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ mcIdType m1=std::numeric_limits<mcIdType>::max();
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
m1=std::min((*it).second,m1);
- int m2=getMinFamilyIdInArrays();
+ mcIdType m2=getMinFamilyIdInArrays();
return std::min(m1,m2);
}
*
* \sa MEDFileMesh::computeAllFamilyIdsInUse
*/
-DataArrayInt *MEDFileMesh::getAllFamiliesIdsReferenced() const
+DataArrayIdType *MEDFileMesh::getAllFamiliesIdsReferenced() const
{
- MCAuto<DataArrayInt> ret=DataArrayInt::New();
- std::set<int> v;
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ MCAuto<DataArrayIdType> ret=DataArrayIdType::New();
+ std::set<mcIdType> v;
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
v.insert((*it).second);
- ret->alloc((int)v.size(),1);
+ ret->alloc((mcIdType)v.size(),1);
std::copy(v.begin(),v.end(),ret->getPointer());
return ret.retn();
}
*
* \sa MEDFileMesh::getAllFamiliesIdsReferenced
*/
-DataArrayInt *MEDFileMesh::computeAllFamilyIdsInUse() const
+DataArrayIdType *MEDFileMesh::computeAllFamilyIdsInUse() const
{
std::vector<int> famLevs=getFamArrNonEmptyLevelsExt();
- MCAuto<DataArrayInt> ret;
+ MCAuto<DataArrayIdType> ret;
for(std::vector<int>::const_iterator it=famLevs.begin();it!=famLevs.end();it++)
{
- const DataArrayInt *arr=getFamilyFieldAtLevel(*it);//arr not null due to spec of getFamArrNonEmptyLevelsExt
- MCAuto<DataArrayInt> dv=arr->getDifferentValues();
- if((DataArrayInt *) ret)
+ const DataArrayIdType *arr=getFamilyFieldAtLevel(*it);//arr not null due to spec of getFamArrNonEmptyLevelsExt
+ MCAuto<DataArrayIdType> dv=arr->getDifferentValues();
+ if((DataArrayIdType *) ret)
ret=dv->buildUnion(ret);
else
ret=dv;
bool MEDFileMesh::ensureDifferentFamIdsPerLevel()
{
std::vector<int> levs=getNonEmptyLevelsExt();
- std::set<int> allFamIds;
- int maxId=getMaxFamilyId()+1;
- std::map<int,std::vector<int> > famIdsToRenum;
+ std::set<mcIdType> allFamIds;
+ mcIdType maxId=getMaxFamilyId()+1;
+ std::map<mcIdType,std::vector<mcIdType> > famIdsToRenum;
for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
{
- const DataArrayInt *fam=getFamilyFieldAtLevel(*it);
+ const DataArrayIdType *fam=getFamilyFieldAtLevel(*it);
if(fam)
{
- MCAuto<DataArrayInt> tmp=fam->getDifferentValues();
- std::set<int> r2;
+ MCAuto<DataArrayIdType> tmp=fam->getDifferentValues();
+ std::set<mcIdType> r2;
std::set_intersection(tmp->begin(),tmp->end(),allFamIds.begin(),allFamIds.end(),std::inserter(r2,r2.end()));
if(!r2.empty())
famIdsToRenum[*it].insert(famIdsToRenum[*it].end(),r2.begin(),r2.end());
- std::set<int> r3;
+ std::set<mcIdType> r3;
std::set_union(tmp->begin(),tmp->end(),allFamIds.begin(),allFamIds.end(),std::inserter(r3,r3.end()));
}
}
if(famIdsToRenum.empty())
return true;
- MCAuto<DataArrayInt> allIds=getAllFamiliesIdsReferenced();
- for(std::map<int,std::vector<int> >::const_iterator it2=famIdsToRenum.begin();it2!=famIdsToRenum.end();it2++)
+ MCAuto<DataArrayIdType> allIds=getAllFamiliesIdsReferenced();
+ for(std::map<mcIdType,std::vector<mcIdType> >::const_iterator it2=famIdsToRenum.begin();it2!=famIdsToRenum.end();it2++)
{
- DataArrayInt *fam=const_cast<DataArrayInt *>(getFamilyFieldAtLevel((*it2).first));
- int *famIdsToChange=fam->getPointer();
- std::map<int,int> ren;
- for(std::vector<int>::const_iterator it3=(*it2).second.begin();it3!=(*it2).second.end();it3++,maxId++)
+ DataArrayIdType *fam=const_cast<DataArrayIdType *>(getFamilyFieldAtLevel((*it2).first));
+ mcIdType *famIdsToChange=fam->getPointer();
+ std::map<mcIdType,mcIdType> ren;
+ for(std::vector<mcIdType>::const_iterator it3=(*it2).second.begin();it3!=(*it2).second.end();it3++,maxId++)
{
if(allIds->presenceOfValue(*it3))
{
addFamilyOnGrp((*it4),newFam);
}
}
- MCAuto<DataArrayInt> ids=fam->findIdsEqualList(&(*it2).second[0],&(*it2).second[0]+(*it2).second.size());
- for(const int *id=ids->begin();id!=ids->end();id++)
+ MCAuto<DataArrayIdType> ids=fam->findIdsEqualList(&(*it2).second[0],&(*it2).second[0]+(*it2).second.size());
+ for(const mcIdType *id=ids->begin();id!=ids->end();id++)
famIdsToChange[*id]=ren[famIdsToChange[*id]];
}
return false;
void MEDFileMesh::normalizeFamIdsTrio()
{
ensureDifferentFamIdsPerLevel();
- MCAuto<DataArrayInt> allIds=getAllFamiliesIdsReferenced();
+ MCAuto<DataArrayIdType> allIds=getAllFamiliesIdsReferenced();
std::vector<int> levs=getNonEmptyLevelsExt();
std::set<int> levsS(levs.begin(),levs.end());
std::set<std::string> famsFetched;
- std::map<std::string,int> families;
+ std::map<std::string,mcIdType> families;
if(std::find(levs.begin(),levs.end(),0)!=levs.end())
{
levsS.erase(0);
- const DataArrayInt *fam=getFamilyFieldAtLevel(0);
+ const DataArrayIdType *fam=getFamilyFieldAtLevel(0);
if(fam)
{
- int refId=1;
- MCAuto<DataArrayInt> tmp=fam->getDifferentValues();
- std::map<int,int> ren;
- for(const int *it=tmp->begin();it!=tmp->end();it++,refId++)
+ mcIdType refId=1;
+ MCAuto<DataArrayIdType> tmp=fam->getDifferentValues();
+ std::map<mcIdType,mcIdType> ren;
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId++)
ren[*it]=refId;
- int nbOfTuples=fam->getNumberOfTuples();
- int *start=const_cast<DataArrayInt *>(fam)->getPointer();
- for(int *w=start;w!=start+nbOfTuples;w++)
+ mcIdType nbOfTuples=fam->getNumberOfTuples();
+ mcIdType *start=const_cast<DataArrayIdType *>(fam)->getPointer();
+ for(mcIdType *w=start;w!=start+nbOfTuples;w++)
*w=ren[*w];
- for(const int *it=tmp->begin();it!=tmp->end();it++)
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++)
{
if(allIds->presenceOfValue(*it))
{
if(std::find(levs.begin(),levs.end(),-1)!=levs.end())
{
levsS.erase(-1);
- const DataArrayInt *fam=getFamilyFieldAtLevel(-1);
+ const DataArrayIdType *fam=getFamilyFieldAtLevel(-1);
if(fam)
{
- int refId=-1;
- MCAuto<DataArrayInt> tmp=fam->getDifferentValues();
- std::map<int,int> ren;
- for(const int *it=tmp->begin();it!=tmp->end();it++,refId--)
+ mcIdType refId=-1;
+ MCAuto<DataArrayIdType> tmp=fam->getDifferentValues();
+ std::map<mcIdType,mcIdType> ren;
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId--)
ren[*it]=refId;
- int nbOfTuples=fam->getNumberOfTuples();
- int *start=const_cast<DataArrayInt *>(fam)->getPointer();
- for(int *w=start;w!=start+nbOfTuples;w++)
+ mcIdType nbOfTuples=fam->getNumberOfTuples();
+ mcIdType *start=const_cast<DataArrayIdType *>(fam)->getPointer();
+ for(mcIdType *w=start;w!=start+nbOfTuples;w++)
*w=ren[*w];
- for(const int *it=tmp->begin();it!=tmp->end();it++)
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++)
{
if(allIds->presenceOfValue(*it))
{
}
for(std::set<int>::const_iterator it2=levsS.begin();it2!=levsS.end();it2++)
{
- DataArrayInt *fam=const_cast<DataArrayInt*>(getFamilyFieldAtLevel(*it2));
+ DataArrayIdType *fam=const_cast<DataArrayIdType*>(getFamilyFieldAtLevel(*it2));
if(fam)
{
- MCAuto<DataArrayInt> tmp=fam->getDifferentValues();
+ MCAuto<DataArrayIdType> tmp=fam->getDifferentValues();
fam->fillWithZero();
- for(const int *it3=tmp->begin();it3!=tmp->end();it3++)
+ for(const mcIdType *it3=tmp->begin();it3!=tmp->end();it3++)
if(allIds->presenceOfValue(*it3))
{
std::string famName=getFamilyNameGivenId(*it3);
void MEDFileMesh::normalizeFamIdsMEDFile()
{
ensureDifferentFamIdsPerLevel();
- MCAuto<DataArrayInt> allIds=getAllFamiliesIdsReferenced();
+ MCAuto<DataArrayIdType> allIds=getAllFamiliesIdsReferenced();
std::vector<int> levs=getNonEmptyLevelsExt();
std::set<int> levsS(levs.begin(),levs.end());
std::set<std::string> famsFetched;
- std::map<std::string,int> families;
- int refId=1;
+ std::map<std::string,mcIdType> families;
+ mcIdType refId=1;
if(std::find(levs.begin(),levs.end(),1)!=levs.end())
{
levsS.erase(1);
- const DataArrayInt *fam=getFamilyFieldAtLevel(1);
+ const DataArrayIdType *fam=getFamilyFieldAtLevel(1);
if(fam)
{
- MCAuto<DataArrayInt> tmp=fam->getDifferentValues();
- std::map<int,int> ren;
- for(const int *it=tmp->begin();it!=tmp->end();it++,refId++)
+ MCAuto<DataArrayIdType> tmp=fam->getDifferentValues();
+ std::map<mcIdType,mcIdType> ren;
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId++)
ren[*it]=refId;
- int nbOfTuples=fam->getNumberOfTuples();
- int *start=const_cast<DataArrayInt *>(fam)->getPointer();
- for(int *w=start;w!=start+nbOfTuples;w++)
+ mcIdType nbOfTuples=fam->getNumberOfTuples();
+ mcIdType *start=const_cast<DataArrayIdType *>(fam)->getPointer();
+ for(mcIdType *w=start;w!=start+nbOfTuples;w++)
*w=ren[*w];
- for(const int *it=tmp->begin();it!=tmp->end();it++)
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++)
{
if(allIds->presenceOfValue(*it))
{
refId=-1;
for(std::set<int>::const_reverse_iterator it2=levsS.rbegin();it2!=levsS.rend();it2++)
{
- const DataArrayInt *fam=getFamilyFieldAtLevel(*it2);
+ const DataArrayIdType *fam=getFamilyFieldAtLevel(*it2);
if(fam)
{
- MCAuto<DataArrayInt> tmp=fam->getDifferentValues();
- std::map<int,int> ren;
- for(const int *it=tmp->begin();it!=tmp->end();it++,refId--)
+ MCAuto<DataArrayIdType> tmp=fam->getDifferentValues();
+ std::map<mcIdType,mcIdType> ren;
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId--)
ren[*it]=refId;
- int nbOfTuples=fam->getNumberOfTuples();
- int *start=const_cast<DataArrayInt *>(fam)->getPointer();
- for(int *w=start;w!=start+nbOfTuples;w++)
+ mcIdType nbOfTuples=fam->getNumberOfTuples();
+ mcIdType *start=const_cast<DataArrayIdType *>(fam)->getPointer();
+ for(mcIdType *w=start;w!=start+nbOfTuples;w++)
*w=ren[*w];
- for(const int *it=tmp->begin();it!=tmp->end();it++)
+ for(const mcIdType *it=tmp->begin();it!=tmp->end();it++)
{
if(allIds->presenceOfValue(*it))
{
* \return std::string - the name of the found family.
* \throw If no family with the given \a id exists.
*/
-std::string MEDFileMesh::getFamilyNameGivenId(int id) const
+std::string MEDFileMesh::getFamilyNameGivenId(mcIdType id) const
{
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
if((*it).second==id)
return (*it).first;
std::ostringstream oss; oss << "MEDFileUMesh::getFamilyNameGivenId : no such family id : " << id;
* This method is nearly like getFamilyFieldAtLevel method. Except that if the array does not exist at the specified level \a meshDimRelToMaxExt
* an empty one is created.
*/
-DataArrayInt *MEDFileMesh::getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt)
+DataArrayIdType *MEDFileMesh::getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt)
{
- DataArrayInt *ret(getFamilyFieldAtLevel(meshDimRelToMaxExt));
+ DataArrayIdType *ret(getFamilyFieldAtLevel(meshDimRelToMaxExt));
if(ret)
return ret;
- MCAuto<DataArrayInt> arr(DataArrayInt::New());
+ MCAuto<DataArrayIdType> arr(DataArrayIdType::New());
arr->alloc(getSizeAtLevel(meshDimRelToMaxExt),1);
arr->fillWithZero();
setFamilyFieldArr(meshDimRelToMaxExt,arr);
* \param [in] grp - the name of the group of interest.
* \param [in] renum - if \c true, the optional numbers of entities, if available, are
* returned instead of ids.
- * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or
* numbers, if available and required, of mesh entities of the group. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the name of a nonexistent group is specified.
* \throw If the family field is missing for \a meshDimRelToMaxExt.
*/
-DataArrayInt *MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum) const
+DataArrayIdType *MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum) const
{
std::vector<std::string> tmp(1);
tmp[0]=grp;
- DataArrayInt *ret=getGroupsArr(meshDimRelToMaxExt,tmp,renum);
+ DataArrayIdType *ret=getGroupsArr(meshDimRelToMaxExt,tmp,renum);
ret->setName(grp);
return ret;
}
* \param [in] grps - the names of the groups of interest.
* \param [in] renum - if \c true, the optional numbers of entities, if available, are
* returned instead of ids.
- * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or
* numbers, if available and required, of mesh entities of the groups. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the name of a nonexistent group is present in \a grps.
* \throw If the family field is missing for \a meshDimRelToMaxExt.
*/
-DataArrayInt *MEDFileMesh::getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum) const
+DataArrayIdType *MEDFileMesh::getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum) const
{
std::vector<std::string> fams2=getFamiliesOnGroups(grps);
return getFamiliesArr(meshDimRelToMaxExt,fams2,renum);
* \param [in] fam - the name of the family of interest.
* \param [in] renum - if \c true, the optional numbers of entities, if available, are
* returned instead of ids.
- * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or
* numbers, if available and required, of mesh entities of the family. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the family field is missing for \a meshDimRelToMaxExt.
*/
-DataArrayInt *MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum) const
+DataArrayIdType *MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum) const
{
std::vector<std::string> tmp(1);
tmp[0]=fam;
- DataArrayInt *ret=getFamiliesArr(meshDimRelToMaxExt,tmp,renum);
+ DataArrayIdType *ret=getFamiliesArr(meshDimRelToMaxExt,tmp,renum);
ret->setName(fam);
return ret;
}
* \param [in] grp - the name of the group of interest.
* \param [in] renum - if \c true, the optional numbers of nodes, if available, are
* returned instead of ids.
- * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or
* numbers, if available and required, of nodes of the group. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the name of a nonexistent group is specified.
* \throw If the family field is missing for nodes.
*/
-DataArrayInt *MEDFileMesh::getNodeGroupArr(const std::string& grp, bool renum) const
+DataArrayIdType *MEDFileMesh::getNodeGroupArr(const std::string& grp, bool renum) const
{
std::vector<std::string> tmp(1);
tmp[0]=grp;
- DataArrayInt *ret=getNodeGroupsArr(tmp,renum);
+ DataArrayIdType *ret=getNodeGroupsArr(tmp,renum);
ret->setName(grp);
return ret;
}
* \param [in] grps - the names of the groups of interest.
* \param [in] renum - if \c true, the optional numbers of nodes, if available, are
* returned instead of ids.
- * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or
* numbers, if available and required, of nodes of the groups. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the name of a nonexistent group is present in \a grps.
* \throw If the family field is missing for nodes.
*/
-DataArrayInt *MEDFileMesh::getNodeGroupsArr(const std::vector<std::string>& grps, bool renum) const
+DataArrayIdType *MEDFileMesh::getNodeGroupsArr(const std::vector<std::string>& grps, bool renum) const
{
return getGroupsArr(1,grps,renum);
}
* \param [in] grp - the name of the group of interest.
* \param [in] renum - if \c true, the optional numbers of nodes, if available, are
* returned instead of ids.
- * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or
* numbers, if available and required, of nodes of the group. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the name of a nonexistent group is specified.
* \throw If the family field is missing for nodes.
*/
-DataArrayInt *MEDFileMesh::getNodeFamilyArr(const std::string& fam, bool renum) const
+DataArrayIdType *MEDFileMesh::getNodeFamilyArr(const std::string& fam, bool renum) const
{
std::vector<std::string> tmp(1);
tmp[0]=fam;
- DataArrayInt *ret=getNodeFamiliesArr(tmp,renum);
+ DataArrayIdType *ret=getNodeFamiliesArr(tmp,renum);
ret->setName(fam);
return ret;
}
* \param [in] fams - the names of the families of interest.
* \param [in] renum - if \c true, the optional numbers of nodes, if available, are
* returned instead of ids.
- * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or
* numbers, if available and required, of nodes of the families. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the family field is missing for nodes.
*/
-DataArrayInt *MEDFileMesh::getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum) const
+DataArrayIdType *MEDFileMesh::getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum) const
{
return getFamiliesArr(1,fams,renum);
}
* \throw If \a grps includes invalid ids (or numbers if \a renum == \c true ).
* \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh.
*/
-void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector<const DataArrayInt *>& grps, bool renum)
+void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector<const DataArrayIdType *>& grps, bool renum)
{
if(grps.empty())
return ;
std::vector<std::string> grpsName2(grps.size());
int i=0;
- for(std::vector<const DataArrayInt *>::const_iterator it=grps.begin();it!=grps.end();it++,i++)
+ for(std::vector<const DataArrayIdType *>::const_iterator it=grps.begin();it!=grps.end();it++,i++)
{
grpsName.insert((*it)->getName());
grpsName2[i]=(*it)->getName();
if(grpsName.find(std::string(""))!=grpsName.end())
throw INTERP_KERNEL::Exception("MEDFileUMesh::setGroupsAtLevel : groups name must be different empty string !");
int sz=getSizeAtLevel(meshDimRelToMaxExt);
- MCAuto<DataArrayInt> fam;
- std::vector< std::vector<int> > fidsOfGroups;
+ MCAuto<DataArrayIdType> fam;
+ std::vector< std::vector<mcIdType> > fidsOfGroups;
if(!renum)
{
- fam=DataArrayInt::MakePartition(grps,sz,fidsOfGroups);
+ fam=DataArrayIdType::MakePartition(grps,sz,fidsOfGroups);
}
else
{
- std::vector< MCAuto<DataArrayInt> > grps2(grps.size());
+ std::vector< MCAuto<DataArrayIdType> > grps2(grps.size());
for(unsigned int ii=0;ii<grps.size();ii++)
{
grps2[ii]=MEDFileUMeshSplitL1::Renumber(getRevNumberFieldAtLevel(meshDimRelToMaxExt),grps[ii]);
grps2[ii]->setName(grps[ii]->getName());
}
- std::vector<const DataArrayInt *> grps3(grps2.begin(),grps2.end());
- fam=DataArrayInt::MakePartition(grps3,sz,fidsOfGroups);
+ std::vector<const DataArrayIdType *> grps3(grps2.begin(),grps2.end());
+ fam=DataArrayIdType::MakePartition(grps3,sz,fidsOfGroups);
}
- int offset=1;
+ mcIdType offset=1;
if(!_families.empty())
offset=getMaxAbsFamilyId()+1;
TranslateFamilyIds(meshDimRelToMaxExt==1?offset:-offset,fam,fidsOfGroups);
- MCAuto<DataArrayInt> ids=fam->getDifferentValues();
+ MCAuto<DataArrayIdType> ids=fam->getDifferentValues();
appendFamilyEntries(ids,fidsOfGroups,grpsName2);
setFamilyFieldArr(meshDimRelToMaxExt,fam);
}
* not in '_families'. Groups information are given in parameters in order to give to families representative names.
* For the moment, the two last input parameters are not taken into account.
*/
-void MEDFileMesh::appendFamilyEntries(const DataArrayInt *famIds, const std::vector< std::vector<int> >& fidsOfGrps, const std::vector<std::string>& grpNames)
+void MEDFileMesh::appendFamilyEntries(const DataArrayIdType *famIds, const std::vector< std::vector<mcIdType> >& fidsOfGrps, const std::vector<std::string>& grpNames)
{
- std::map<int,std::string> famInv;
- for(const int *it=famIds->begin();it!=famIds->end();it++)
+ std::map<mcIdType,std::string> famInv;
+ for(const mcIdType *it=famIds->begin();it!=famIds->end();it++)
{
std::ostringstream oss;
oss << "Family_" << (*it);
famInv[*it]=oss.str();
}
int i=0;
- for(std::vector< std::vector<int> >::const_iterator it1=fidsOfGrps.begin();it1!=fidsOfGrps.end();it1++,i++)
+ for(std::vector< std::vector<mcIdType> >::const_iterator it1=fidsOfGrps.begin();it1!=fidsOfGrps.end();it1++,i++)
{
- for(std::vector<int>::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
+ for(std::vector<mcIdType>::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++)
{
_groups[grpNames[i]].push_back(famInv[*it2]);
}
/*!
* \sa getAllDistributionOfTypes
*/
-std::vector<int> MEDFileMesh::getDistributionOfTypes(int meshDimRelToMax) const
+std::vector<mcIdType> MEDFileMesh::getDistributionOfTypes(int meshDimRelToMax) const
{
MCAuto<MEDCouplingMesh> mLev(getMeshAtLevel(meshDimRelToMax));
return mLev->getDistributionOfTypes();
loadEquivalences(fid);
}
-void MEDFileMesh::TranslateFamilyIds(int offset, DataArrayInt *famArr, std::vector< std::vector<int> >& famIdsPerGrp)
+void MEDFileMesh::TranslateFamilyIds(mcIdType offset, DataArrayIdType *famArr, std::vector< std::vector<mcIdType> >& famIdsPerGrp)
{
famArr->applyLin(offset>0?1:-1,offset,0);
- for(std::vector< std::vector<int> >::iterator it1=famIdsPerGrp.begin();it1!=famIdsPerGrp.end();it1++)
+ for(std::vector< std::vector<mcIdType> >::iterator it1=famIdsPerGrp.begin();it1!=famIdsPerGrp.end();it1++)
{
if(offset<0)
- std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::negate<int>());
- std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::bind2nd(std::plus<int>(),offset));
+ std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::negate<mcIdType>());
+ std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::bind2nd(std::plus<mcIdType>(),offset));
}
}
throw INTERP_KERNEL::Exception("MEDFileMesh::CreateNameNotIn : impossible to find a not already used name !");
}
-int MEDFileMesh::PutInThirdComponentOfCodeOffset(std::vector<int>& code, int strt)
+mcIdType MEDFileMesh::PutInThirdComponentOfCodeOffset(std::vector<mcIdType>& code, mcIdType strt)
{
std::size_t nbOfChunks=code.size()/3;
if(code.size()%3!=0)
throw INTERP_KERNEL::Exception("MEDFileMesh::PutInThirdComponentOfCodeOffset : code has invalid size : should be of size 3*x !");
- int ret=strt;
+ mcIdType ret=strt;
for(std::size_t i=0;i<nbOfChunks;i++)
{
code[3*i+2]=ret;
void MEDFileMesh::getFamilyRepr(std::ostream& oss) const
{
oss << "(**************************)\n(* FAMILIES OF THE MESH : *)\n(**************************)\n";
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
oss << "- Family with name \"" << (*it).first << "\" with number " << (*it).second << std::endl;
oss << " - Groups lying on this family : ";
m2D->setCoords(m3D->getCoords());
ret->setMeshAtLevel(0,m3D);
ret->setMeshAtLevel(-1,m2D);
- ret->setFamilyId(GetSpeStr4ExtMesh(),std::numeric_limits<int>::max()-mem->get2DCellIdForExtrusion());
+ ret->setFamilyId(GetSpeStr4ExtMesh(),std::numeric_limits<mcIdType>::max()-mem->get2DCellIdForExtrusion());
return ret.retn();
}
* \param [in] mrs - the request for what to be loaded.
* \return MEDFileUMesh * - a new instance of MEDFileUMesh. The caller is to delete this mesh using decrRef() as it is no more needed.
*/
-MEDFileUMesh *MEDFileUMesh::LoadPartOf(const std::string& fileName, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
+MEDFileUMesh *MEDFileUMesh::LoadPartOf(const std::string& fileName, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid(MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY));
* Please refer to the other MEDFileUMesh::LoadPartOf method that has the same semantic and the same parameter (excepted the first).
* This method is \b NOT wrapped into python.
*/
-MEDFileUMesh *MEDFileUMesh::LoadPartOf(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
+MEDFileUMesh *MEDFileUMesh::LoadPartOf(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
{
MCAuto<MEDFileUMesh> ret(MEDFileUMesh::New());
ret->loadPartUMeshFromFile(fid,mName,types,slicPerTyp,dt,it,mrs);
{
std::vector<const BigMemoryObject *> ret(MEDFileMesh::getDirectChildrenWithNull());
ret.push_back((const DataArrayDouble*)_coords);
- ret.push_back((const DataArrayInt *)_fam_coords);
- ret.push_back((const DataArrayInt *)_num_coords);
- ret.push_back((const DataArrayInt *)_global_num_coords);
- ret.push_back((const DataArrayInt *)_rev_num_coords);
+ ret.push_back((const DataArrayIdType *)_fam_coords);
+ ret.push_back((const DataArrayIdType *)_num_coords);
+ ret.push_back((const DataArrayIdType *)_global_num_coords);
+ ret.push_back((const DataArrayIdType *)_rev_num_coords);
ret.push_back((const DataArrayAsciiChar *)_name_coords);
ret.push_back((const PartDefinition *)_part_coords);
for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
}
}
{
- const DataArrayInt *famc1(_fam_coords),*famc2(otherC->_fam_coords);
+ const DataArrayIdType *famc1(_fam_coords),*famc2(otherC->_fam_coords);
if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0))
{
what="Mismatch of families arr on nodes ! One is defined and not other !";
}
}
{
- const DataArrayInt *numc1(_num_coords),*numc2(otherC->_num_coords);
+ const DataArrayIdType *numc1(_num_coords),*numc2(otherC->_num_coords);
if((numc1==0 && numc2!=0) || (numc1!=0 && numc2==0))
{
what="Mismatch of numbering arr on nodes ! One is defined and not other !";
}
}
{
- const DataArrayInt *gnumc1(_global_num_coords),*gnumc2(otherC->_global_num_coords);
+ const DataArrayIdType *gnumc1(_global_num_coords),*gnumc2(otherC->_global_num_coords);
if((gnumc1==0 && gnumc2!=0) || (gnumc1!=0 && gnumc2==0))
{
what="Mismatch of numbering arr on nodes ! One is defined and not other !";
}
else
{
- int nbCoo = _coords->getNumberOfTuples();
+ mcIdType nbCoo = _coords->getNumberOfTuples();
if (_fam_coords.isNotNull())
_fam_coords->checkNbOfTuplesAndComp(nbCoo,1,"MEDFileUMesh::checkConsistency(): inconsistent internal node family array!");
if (_num_coords.isNotNull())
{
_num_coords->checkNbOfTuplesAndComp(nbCoo,1,"MEDFileUMesh::checkConsistency(): inconsistent internal node numbering array!");
- int pos;
- int maxValue=_num_coords->getMaxValue(pos);
+ mcIdType pos;
+ mcIdType maxValue=_num_coords->getMaxValue(pos);
if (!_rev_num_coords || _rev_num_coords->getNumberOfTuples() != (maxValue+1))
throw INTERP_KERNEL::Exception("MEDFileUMesh::checkConsistency(): inconsistent internal revert node numbering array!");
}
if (_ms.size())
{
std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();
- std::vector< const DataArrayInt * > v;
+ std::vector< const DataArrayIdType * > v;
bool voidOrNot = ((*it)->_num == 0);
for (it++; it != _ms.end(); it++)
if( ((*it)->_num == 0) != voidOrNot )
{
// don't forget the 1st one:
v.push_back(_ms[0]->_num);
- MCAuto<DataArrayInt> inter = DataArrayInt::BuildIntersection(v);
+ MCAuto<DataArrayIdType> inter = DataArrayIdType::BuildIntersection(v);
if (inter->getNumberOfTuples())
throw INTERP_KERNEL::Exception("MEDFileUMesh::checkConsistency(): overlapping entity numbering between mesh sub-levels!");
}
*
* \sa loadLL
*/
-void MEDFileUMesh::loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
+void MEDFileUMesh::loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
{
MEDFileUMeshL2 loaderl2;
MEDCoupling::MEDCouplingMeshType meshType;
std::vector<int> MEDFileUMesh::getFamArrNonEmptyLevelsExt() const
{
std::vector<int> ret;
- const DataArrayInt *famCoo(_fam_coords);
+ const DataArrayIdType *famCoo(_fam_coords);
if(famCoo)
ret.push_back(1);
int lev=0;
* \param [in] fams - the name of the family of interest.
* \return std::vector<int> - a sequence of the relative dimensions.
*/
-std::vector<int> MEDFileUMesh::getFamsNonEmptyLevels(const std::vector<std::string>& fams) const
+std::vector<mcIdType> MEDFileUMesh::getFamsNonEmptyLevels(const std::vector<std::string>& fams) const
{
- std::vector<int> ret;
+ std::vector<mcIdType> ret;
std::vector<int> levs(getNonEmptyLevels());
- std::vector<int> famIds(getFamiliesIds(fams));
+ std::vector<mcIdType> famIds(getFamiliesIds(fams));
for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
if(_ms[-(*it)]->presenceOfOneFams(famIds))
ret.push_back(*it);
* \param [in] fams - the names of the families of interest.
* \return std::vector<int> - a sequence of the relative dimensions.
*/
-std::vector<int> MEDFileUMesh::getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const
+std::vector<mcIdType> MEDFileUMesh::getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const
{
- std::vector<int> ret0(getFamsNonEmptyLevels(fams));
- const DataArrayInt *famCoords(_fam_coords);
+ std::vector<mcIdType> ret0(getFamsNonEmptyLevels(fams));
+ const DataArrayIdType *famCoords(_fam_coords);
if(!famCoords)
return ret0;
- std::vector<int> famIds(getFamiliesIds(fams));
+ std::vector<mcIdType> famIds(getFamiliesIds(fams));
if(famCoords->presenceOfValue(famIds))
{
- std::vector<int> ret(ret0.size()+1);
+ std::vector<mcIdType> ret(ret0.size()+1);
ret[0]=1;
std::copy(ret0.begin(),ret0.end(),ret.begin()+1);
return ret;
return ret0;
}
-int MEDFileUMesh::getMaxAbsFamilyIdInArrays() const
+mcIdType MEDFileUMesh::getMaxAbsFamilyIdInArrays() const
{
- int ret=-std::numeric_limits<int>::max(),tmp=-1;
- if((const DataArrayInt *)_fam_coords)
+ mcIdType ret=-std::numeric_limits<mcIdType>::max(),tmp=-1;
+ if((const DataArrayIdType *)_fam_coords)
{
- int val=_fam_coords->getMaxValue(tmp);
+ mcIdType val=_fam_coords->getMaxValue(tmp);
ret=std::max(ret,std::abs(val));
}
for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
if((const MEDFileUMeshSplitL1 *)(*it))
{
- const DataArrayInt *da=(*it)->getFamilyField();
+ const DataArrayIdType *da=(*it)->getFamilyField();
if(da)
{
- int val=da->getMaxValue(tmp);
+ mcIdType val=da->getMaxValue(tmp);
ret=std::max(ret,std::abs(val));
}
}
return ret;
}
-int MEDFileUMesh::getMaxFamilyIdInArrays() const
+mcIdType MEDFileUMesh::getMaxFamilyIdInArrays() const
{
- int ret=-std::numeric_limits<int>::max(),tmp=-1;
- if((const DataArrayInt *)_fam_coords)
+ mcIdType ret=-std::numeric_limits<mcIdType>::max(),tmp=-1;
+ if((const DataArrayIdType *)_fam_coords)
{
- int val=_fam_coords->getMaxValue(tmp);
+ mcIdType val=_fam_coords->getMaxValue(tmp);
ret=std::max(ret,val);
}
for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
if((const MEDFileUMeshSplitL1 *)(*it))
{
- const DataArrayInt *da=(*it)->getFamilyField();
+ const DataArrayIdType *da=(*it)->getFamilyField();
if(da)
{
- int val=da->getMaxValue(tmp);
+ mcIdType val=da->getMaxValue(tmp);
ret=std::max(ret,val);
}
}
return ret;
}
-int MEDFileUMesh::getMinFamilyIdInArrays() const
+mcIdType MEDFileUMesh::getMinFamilyIdInArrays() const
{
- int ret=std::numeric_limits<int>::max(),tmp=-1;
- if((const DataArrayInt *)_fam_coords)
+ mcIdType ret=std::numeric_limits<mcIdType>::max(),tmp=-1;
+ if((const DataArrayIdType *)_fam_coords)
{
- int val=_fam_coords->getMinValue(tmp);
+ mcIdType val=_fam_coords->getMinValue(tmp);
ret=std::min(ret,val);
}
for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
if((const MEDFileUMeshSplitL1 *)(*it))
{
- const DataArrayInt *da=(*it)->getFamilyField();
+ const DataArrayIdType *da=(*it)->getFamilyField();
if(da)
{
- int val=da->getMinValue(tmp);
+ mcIdType val=da->getMinValue(tmp);
ret=std::min(ret,val);
}
}
/*!
* Returns number of mesh entities of a given relative dimension in \a this mesh.
* \param [in] meshDimRelToMaxExt - the relative dimension of interest.
- * \return int - the number of entities.
+ * \return mcIdType - the number of entities.
* \throw If no mesh entities of dimension \a meshDimRelToMaxExt are available in \a this mesh.
*/
-int MEDFileUMesh::getSizeAtLevel(int meshDimRelToMaxExt) const
+mcIdType MEDFileUMesh::getSizeAtLevel(int meshDimRelToMaxExt) const
{
if(meshDimRelToMaxExt==1)
{
/*!
* Returns the family field for mesh entities of a given dimension.
* \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities.
- * \return const DataArrayInt * - the family field. It is an array of ids of families
+ * \return const DataArrayIdType * - the family field. It is an array of ids of families
* each mesh entity belongs to. It can be \c NULL.
*/
-const DataArrayInt *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
+const DataArrayIdType *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
{
if(meshDimRelToMaxExt==1)
return _fam_coords;
return l1->getFamilyField();
}
-DataArrayInt *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt)
+DataArrayIdType *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt)
{
if(meshDimRelToMaxExt==1)
return _fam_coords;
/*!
* Returns the optional numbers of mesh entities of a given dimension.
* \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities.
- * \return const DataArrayInt * - the array of the entity numbers.
+ * \return const DataArrayIdType * - the array of the entity numbers.
* \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh.
*/
-const DataArrayInt *MEDFileUMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const
+const DataArrayIdType *MEDFileUMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const
{
if(meshDimRelToMaxExt==1)
return _num_coords;
return l1->getNameField();
}
-MCAuto<DataArrayInt> MEDFileUMesh::getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
+MCAuto<DataArrayIdType> MEDFileUMesh::getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
{
if(meshDimRelToMaxExt!=1)
throw INTERP_KERNEL::Exception("MEDFileUMesh::getGlobalNumFieldAtLevel : not implemented yet for structured mesh !");
return l1->getPartDef(gt);
}
-int MEDFileUMesh::getNumberOfNodes() const
+mcIdType MEDFileUMesh::getNumberOfNodes() const
{
const DataArrayDouble *coo(_coords);
if(!coo)
return coo->getNumberOfTuples();
}
-int MEDFileUMesh::getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const
+mcIdType MEDFileUMesh::getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const
{
const MEDFileUMeshSplitL1 *l1(getMeshAtLevSafe(meshDimRelToMaxExt));
return l1->getNumberOfCells();
return false;
}
-int MEDFileUMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const
+mcIdType MEDFileUMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const
{
throw INTERP_KERNEL::Exception("MEDFileUMesh::buildImplicitPartIfAny : unstructured meshes do not have implicit part !");
}
m->computeNodeIdsAlg(nodesFetched);
else
{
- const DataArrayInt *arr(globs->getProfile(st[i].getPflName()));
+ const DataArrayIdType *arr(globs->getProfile(st[i].getPflName()));
MCAuto<MEDCoupling1GTUMesh> m2(dynamic_cast<MEDCoupling1GTUMesh *>(m->buildPartOfMySelf(arr->begin(),arr->end(),true)));
m2->computeNodeIdsAlg(nodesFetched);
}
/*!
* Returns the optional numbers of mesh entities of a given dimension transformed using
- * DataArrayInt::invertArrayN2O2O2N().
+ * DataArrayIdType::invertArrayN2O2O2N().
* \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities.
- * \return const DataArrayInt * - the array of the entity numbers transformed using
- * DataArrayInt::invertArrayN2O2O2N().
+ * \return const DataArrayIdType * - the array of the entity numbers transformed using
+ * DataArrayIdType::invertArrayN2O2O2N().
* \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh.
*/
-const DataArrayInt *MEDFileUMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
+const DataArrayIdType *MEDFileUMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
{
if(meshDimRelToMaxExt==1)
{
synchronizeTinyInfoOnLeaves();
if(meshDimRelToMaxExt==1)
{
- MCAuto<DataArrayInt> arr=getFamiliesArr(1,fams,renum);
+ MCAuto<DataArrayIdType> arr=getFamiliesArr(1,fams,renum);
MCAuto<MEDCouplingUMesh> ret=MEDCouplingUMesh::New();
MCAuto<DataArrayDouble> c=_coords->selectByTupleId(arr->getConstPointer(),arr->getConstPointer()+arr->getNbOfElems());
ret->setCoords(c);
return ret.retn();
}
- std::vector<int> famIds=getFamiliesIds(fams);
+ std::vector<mcIdType> famIds=getFamiliesIds(fams);
const MEDFileUMeshSplitL1 *l1=getMeshAtLevSafe(meshDimRelToMaxExt);
MCAuto<MEDCouplingUMesh> zeRet;
if(!famIds.empty())
* \param [in] fams - the names of the families of interest.
* \param [in] renum - if \c true, the optional numbers of entities, if available, are
* returned instead of ids.
- * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or
* numbers, if available and required, of mesh entities of the families. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the family field is missing for \a meshDimRelToMaxExt.
*/
-DataArrayInt *MEDFileUMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum) const
+DataArrayIdType *MEDFileUMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum) const
{
- std::vector<int> famIds=getFamiliesIds(fams);
+ std::vector<mcIdType> famIds=getFamiliesIds(fams);
if(meshDimRelToMaxExt==1)
{
- if((const DataArrayInt *)_fam_coords)
+ if((const DataArrayIdType *)_fam_coords)
{
- MCAuto<DataArrayInt> da;
+ MCAuto<DataArrayIdType> da;
if(!famIds.empty())
da=_fam_coords->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size());
else
return l1->getWholeMesh(renum);
}
-std::vector<int> MEDFileUMesh::getDistributionOfTypes(int meshDimRelToMax) const
+std::vector<mcIdType> MEDFileUMesh::getDistributionOfTypes(int meshDimRelToMax) const
{
const MEDFileUMeshSplitL1 *l1(getMeshAtLevSafe(meshDimRelToMax));
return l1->getDistributionOfTypes();
*
* \sa getDistributionOfTypes
*/
-std::vector< std::pair<int,int> > MEDFileUMesh::getAllDistributionOfTypes() const
+std::vector< std::pair<int,mcIdType> > MEDFileUMesh::getAllDistributionOfTypes() const
{
- std::vector< std::pair<int,int> > ret;
+ std::vector< std::pair<int,mcIdType> > ret;
std::vector<int> nel(getNonEmptyLevels());
for(std::vector<int>::reverse_iterator it=nel.rbegin();it!=nel.rend();it++)
{
std::vector<INTERP_KERNEL::NormalizedCellType> gt(getGeoTypesAtLevel(*it));
for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator it1=gt.begin();it1!=gt.end();it1++)
{
- int nbCells(getNumberOfCellsWithType(*it1));
- ret.push_back(std::pair<int,int>(*it1,nbCells));
+ mcIdType nbCells(getNumberOfCellsWithType(*it1));
+ ret.push_back(std::pair<int,mcIdType>(*it1,nbCells));
}
}
- ret.push_back(std::pair<int,int>(INTERP_KERNEL::NORM_ERROR,getNumberOfNodes()));
+ ret.push_back(std::pair<int,mcIdType>(INTERP_KERNEL::NORM_ERROR,getNumberOfNodes()));
return ret;
}
return sp->getGeoTypes();
}
-int MEDFileUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const
+mcIdType MEDFileUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(ct);
const MEDFileUMeshSplitL1 *sp(getMeshAtLevSafe( ((int)cm.getDimension())-getMeshDimension() ));
/*!
* This method extracts from whole family field ids the part relative to the input parameter \a gt.
* \param [in] gt - the geometric type for which the family field is asked.
- * \return DataArrayInt * - a pointer to DataArrayInt that the caller is to
+ * \return DataArrayIdType * - a pointer to DataArrayIdType that the caller is to
* delete using decrRef() as it is no more needed.
* \sa MEDFileUMesh::extractNumberFieldOnGeoType
*/
-DataArrayInt *MEDFileUMesh::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
+DataArrayIdType *MEDFileUMesh::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(gt);
int lev=(int)cm.getDimension()-getMeshDimension();
/*!
* This method extracts from whole number field ids the part relative to the input parameter \a gt.
* \param [in] gt - the geometric type for which the number field is asked.
- * \return DataArrayInt * - a pointer to DataArrayInt that the caller is to
+ * \return DataArrayIdType * - a pointer to DataArrayIdType that the caller is to
* delete using decrRef() as it is no more needed.
* \sa MEDFileUMesh::extractFamilyFieldOnGeoType
*/
-DataArrayInt *MEDFileUMesh::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
+DataArrayIdType *MEDFileUMesh::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(gt);
int lev=(int)cm.getDimension()-getMeshDimension();
coords->checkAllocated();
int nbOfTuples(coords->getNumberOfTuples());
_coords.takeRef(coords);
- _fam_coords=DataArrayInt::New();
+ _fam_coords=DataArrayIdType::New();
_fam_coords->alloc(nbOfTuples,1);
_fam_coords->fillWithZero();
_num_coords.nullify(); _rev_num_coords.nullify(); _name_coords.nullify(); _global_num_coords.nullify();
{
if(meshDimRelToMaxExt==1)
{
- if((DataArrayInt *)_fam_coords)
+ if((DataArrayIdType *)_fam_coords)
_fam_coords->fillWithZero();
return ;
}
std::set<int> allFamsIds;
for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
{
- const DataArrayInt *ffield=getFamilyFieldAtLevel(*it);
- MCAuto<DataArrayInt> ids=ffield->getDifferentValues();
+ const DataArrayIdType *ffield=getFamilyFieldAtLevel(*it);
+ MCAuto<DataArrayIdType> ids=ffield->getDifferentValues();
std::set<int> res;
std::set_union(ids->begin(),ids->end(),allFamsIds.begin(),allFamsIds.end(),std::inserter(res,res.begin()));
allFamsIds=res;
}
std::set<std::string> famNamesToKill;
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
if(allFamsIds.find((*it).second)!=allFamsIds.end())
famNamesToKill.insert((*it).first);
* \param[out] cellsNotModified ids of the rest of cells bordering the new boundary whose connectivity remains unchanged.
* \sa clearNodeAndCellNumbers()
*/
-void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayInt *&nodesDuplicated,
- DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified)
+void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayIdType *&nodesDuplicated,
+ DataArrayIdType *&cellsModified, DataArrayIdType *&cellsNotModified)
{
typedef MCAuto<MEDCouplingUMesh> MUMesh;
- typedef MCAuto<DataArrayInt> DAInt;
+ typedef MCAuto<DataArrayIdType> DAInt;
std::vector<int> levs=getNonEmptyLevels();
if(std::find(levs.begin(),levs.end(),0)==levs.end() || std::find(levs.begin(),levs.end(),-1)==levs.end())
throw INTERP_KERNEL::Exception("MEDFileUMesh::buildInnerBoundaryAlongM1Group : This method works only for mesh defined on level 0 and -1 !");
MUMesh m0=getMeshAtLevel(0);
MUMesh m1=getMeshAtLevel(-1);
- int nbNodes=m0->getNumberOfNodes();
+ mcIdType nbNodes=m0->getNumberOfNodes();
MUMesh m11=getGroup(-1,grpNameM1);
- DataArrayInt *tmp00=0,*tmp11=0,*tmp22=0;
+ DataArrayIdType *tmp00=0,*tmp11=0,*tmp22=0;
m0->findNodesToDuplicate(*m11,tmp00,tmp11,tmp22);
DAInt nodeIdsToDuplicate(tmp00);
DAInt cellsToModifyConn0(tmp11);
DAInt cellsToModifyConn1(tmp22);
MUMesh tmp0=static_cast<MEDCouplingUMesh *>(m0->buildPartOfMySelf(cellsToModifyConn0->begin(),cellsToModifyConn0->end(),true));
// node renumbering of cells in m1 impacted by duplication of node but not in group 'grpNameM1' on level -1
- DAInt descTmp0=DataArrayInt::New(),descITmp0=DataArrayInt::New(),revDescTmp0=DataArrayInt::New(),revDescITmp0=DataArrayInt::New();
+ DAInt descTmp0=DataArrayIdType::New(),descITmp0=DataArrayIdType::New(),revDescTmp0=DataArrayIdType::New(),revDescITmp0=DataArrayIdType::New();
MUMesh tmp0Desc=tmp0->buildDescendingConnectivity(descTmp0,descITmp0,revDescTmp0,revDescITmp0);
descTmp0=0; descITmp0=0; revDescTmp0=0; revDescITmp0=0;
DAInt cellsInM1ToRenumW2=tmp0Desc->getCellIdsLyingOnNodes(nodeIdsToDuplicate->begin(),nodeIdsToDuplicate->end(),false);
MUMesh cellsInM1ToRenumW3=static_cast<MEDCouplingUMesh *>(tmp0Desc->buildPartOfMySelf(cellsInM1ToRenumW2->begin(),cellsInM1ToRenumW2->end(),true));
- DataArrayInt *cellsInM1ToRenumW4Tmp=0;
+ DataArrayIdType *cellsInM1ToRenumW4Tmp=0;
m1->areCellsIncludedIn(cellsInM1ToRenumW3,2,cellsInM1ToRenumW4Tmp);
DAInt cellsInM1ToRenumW4(cellsInM1ToRenumW4Tmp);
DAInt cellsInM1ToRenumW5=cellsInM1ToRenumW4->findIdsInRange(0,m1->getNumberOfCells());
_coords=m0->getCoords(); _coords->incrRef();
// duplication of cells in group 'grpNameM1' on level -1, but not duplicating cells for which nothing has changed
m11->duplicateNodesInConn(nodeIdsToDuplicate->begin(),nodeIdsToDuplicate->end(),nbNodes); m11->setCoords(m0->getCoords());
- DataArrayInt * duplCells;
+ DataArrayIdType * duplCells;
m1->areCellsIncludedIn(m11, 0, duplCells);
DAInt zeIds = duplCells->findIdsNotInRange(-1, m1->getNumberOfCells()-1); duplCells->decrRef();
MUMesh m11Part=static_cast<MEDCouplingUMesh *>(m11->buildPartOfMySelf(zeIds->begin(),zeIds->end(),true));
DAInt idInMsOfCellGrpOfSameType(tmp11);
//
newm1->setName(getName());
- const DataArrayInt *fam=getFamilyFieldAtLevel(-1);
+ const DataArrayIdType *fam=getFamilyFieldAtLevel(-1);
if(!fam)
throw INTERP_KERNEL::Exception("MEDFileUMesh::buildInnerBoundaryAlongM1Group(): internal error no family field !");
- DAInt newFam=DataArrayInt::New();
+ DAInt newFam=DataArrayIdType::New();
newFam->alloc(newm1->getNumberOfCells(),1);
// Get a new family ID: care must be taken if we need a positive ID or a negative one:
// Positive ID for family of nodes, negative for all the rest.
- int idd;
+ mcIdType idd;
if (m1->getMeshDimension() == 0)
idd=getMaxFamilyId()+1;
else
idd=getMinFamilyId()-1;
- int globStart=0,start=0,end,globEnd;
- int nbOfChunks=szOfCellGrpOfSameType->getNumberOfTuples();
- for(int i=0;i<nbOfChunks;i++)
+ mcIdType globStart=0,start=0,end,globEnd;
+ mcIdType nbOfChunks=szOfCellGrpOfSameType->getNumberOfTuples();
+ for(mcIdType i=0;i<nbOfChunks;i++)
{
globEnd=globStart+szOfCellGrpOfSameType->getIJ(i,0);
if(idInMsOfCellGrpOfSameType->getIJ(i,0)==0)
fam=_fam_coords;
if(fam)
{
- int newNbOfNodes=getCoords()->getNumberOfTuples();
- newFam=DataArrayInt::New(); newFam->alloc(newNbOfNodes,1);
+ mcIdType newNbOfNodes=getCoords()->getNumberOfTuples();
+ newFam=DataArrayIdType::New(); newFam->alloc(newNbOfNodes,1);
newFam->setPartOfValues1(fam,0,nbNodes,1,0,1,1,true);
newFam->setPartOfValuesSimple1(0,nbNodes,newNbOfNodes,1,0,1,1);
_fam_coords=newFam;
* in this method.
*
* \param [out] oldCode retrieves the distribution of types before the call if true is returned
- * \param [out] newCode etrieves the distribution of types after the call if true is returned
+ * \param [out] newCode retrieves the distribution of types after the call if true is returned
* \param [out] o2nRenumCell tells for **all levels** the old 2 new renumbering of cells.
*
* \return false if no modification has been performed linked to the unpolyzation. Neither cell type, not cell numbers. When false is returned no need of field on cells or on gauss renumbering.
* Inversely, if true is returned, it means that distribution of cell by geometric type has changed and field on cell and field on gauss point must be renumbered.
*/
-bool MEDFileUMesh::unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell)
+bool MEDFileUMesh::unPolyze(std::vector<mcIdType>& oldCode, std::vector<mcIdType>& newCode, DataArrayIdType *& o2nRenumCell)
{
o2nRenumCell=0; oldCode.clear(); newCode.clear();
std::vector<int> levs=getNonEmptyLevels();
bool ret=false;
- std::vector< const DataArrayInt* > renumCellsSplited;//same than memorySaverIfThrow
- std::vector< MCAuto<DataArrayInt> > memorySaverIfThrow;//same than renumCellsSplited only in case of throw
- int start=0;
- int end=0;
+ std::vector< const DataArrayIdType* > renumCellsSplited;//same than memorySaverIfThrow
+ std::vector< MCAuto<DataArrayIdType> > memorySaverIfThrow;//same than renumCellsSplited only in case of throw
+ mcIdType start=0;
+ mcIdType end=0;
for(std::vector<int>::reverse_iterator it=levs.rbegin();it!=levs.rend();it++)
{
MCAuto<MEDCouplingUMesh> m=getMeshAtLevel(*it);
- std::vector<int> code1=m->getDistributionOfTypes();
+ std::vector<mcIdType> code1=m->getDistributionOfTypes();
end=PutInThirdComponentOfCodeOffset(code1,start);
oldCode.insert(oldCode.end(),code1.begin(),code1.end());
bool hasChanged=m->unPolyze();
- DataArrayInt *fake=0;
- MCAuto<DataArrayInt> o2nCellsPart=m->getLevArrPerCellTypes(MEDCouplingUMesh::MEDMEM_ORDER,
+ DataArrayIdType *fake=0;
+ MCAuto<DataArrayIdType> o2nCellsPart=m->getLevArrPerCellTypes(MEDCouplingUMesh::MEDMEM_ORDER,
MEDCouplingUMesh::MEDMEM_ORDER+MEDCouplingUMesh::N_MEDMEM_ORDER,fake);
fake->decrRef();
renumCellsSplited.push_back(o2nCellsPart); memorySaverIfThrow.push_back(o2nCellsPart);
if(hasChanged)
{
- MCAuto<DataArrayInt> o2nCellsPart2=o2nCellsPart->buildPermArrPerLevel();
+ MCAuto<DataArrayIdType> o2nCellsPart2=o2nCellsPart->buildPermArrPerLevel();
m->renumberCells(o2nCellsPart2->getConstPointer(),false);
ret=true;
- MCAuto<DataArrayInt> famField2,numField2;
- const DataArrayInt *famField=getFamilyFieldAtLevel(*it); if(famField) { famField->incrRef(); famField2=const_cast<DataArrayInt *>(famField); }
- const DataArrayInt *numField=getNumberFieldAtLevel(*it); if(numField) { numField->incrRef(); numField2=const_cast<DataArrayInt *>(numField); }
+ MCAuto<DataArrayIdType> famField2,numField2;
+ const DataArrayIdType *famField=getFamilyFieldAtLevel(*it); if(famField) { famField->incrRef(); famField2=const_cast<DataArrayIdType *>(famField); }
+ const DataArrayIdType *numField=getNumberFieldAtLevel(*it); if(numField) { numField->incrRef(); numField2=const_cast<DataArrayIdType *>(numField); }
setMeshAtLevel(*it,m);
- std::vector<int> code2=m->getDistributionOfTypes();
+ std::vector<mcIdType> code2=m->getDistributionOfTypes();
end=PutInThirdComponentOfCodeOffset(code2,start);
newCode.insert(newCode.end(),code2.begin(),code2.end());
//
continue;
if(famField)
{
- MCAuto<DataArrayInt> newFamField=famField->renumber(o2nCellsPart2->getConstPointer());
+ MCAuto<DataArrayIdType> newFamField=famField->renumber(o2nCellsPart2->getConstPointer());
setFamilyFieldArr(*it,newFamField);
}
if(numField)
{
- MCAuto<DataArrayInt> newNumField=numField->renumber(o2nCellsPart2->getConstPointer());
+ MCAuto<DataArrayIdType> newNumField=numField->renumber(o2nCellsPart2->getConstPointer());
setRenumFieldArr(*it,newNumField);
}
}
}
if(ret)
{
- MCAuto<DataArrayInt> renumCells=DataArrayInt::Aggregate(renumCellsSplited);
- MCAuto<DataArrayInt> o2nRenumCellRet=renumCells->buildPermArrPerLevel();
+ MCAuto<DataArrayIdType> renumCells=DataArrayIdType::Aggregate(renumCellsSplited);
+ MCAuto<DataArrayIdType> o2nRenumCellRet=renumCells->buildPermArrPerLevel();
o2nRenumCell=o2nRenumCellRet.retn();
}
return ret;
struct MEDLoaderAccVisit1
{
MEDLoaderAccVisit1():_new_nb_of_nodes(0) { }
- int operator()(bool val) { return val?_new_nb_of_nodes++:-1; }
- int _new_nb_of_nodes;
+ mcIdType operator()(bool val) { return val?_new_nb_of_nodes++:-1; }
+ mcIdType _new_nb_of_nodes;
};
/*! \endcond */
* \throw If no coordinates are set in \a this or if there is in any available mesh in \a this a cell having a nodal connectivity containing a node id not in the range of
* set coordinates.
*/
-DataArrayInt *MEDFileUMesh::zipCoords()
+DataArrayIdType *MEDFileUMesh::zipCoords()
{
const DataArrayDouble *coo(getCoords());
if(!coo)
throw INTERP_KERNEL::Exception("MEDFileUMesh::zipCoords : no coordinates set in this !");
- int nbOfNodes(coo->getNumberOfTuples());
+ mcIdType nbOfNodes(coo->getNumberOfTuples());
std::vector<bool> nodeIdsInUse(nbOfNodes,false);
std::vector<int> neLevs(getNonEmptyLevels());
for(std::vector<int>::const_iterator lev=neLevs.begin();lev!=neLevs.end();lev++)
mesh->computeNodeIdsAlg(nodeIdsInUse);
}
}
- int nbrOfNodesInUse((int)std::count(nodeIdsInUse.begin(),nodeIdsInUse.end(),true));
+ mcIdType nbrOfNodesInUse((mcIdType)std::count(nodeIdsInUse.begin(),nodeIdsInUse.end(),true));
if(nbrOfNodesInUse==nbOfNodes)
return 0;//no need to update _part_coords
- MCAuto<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbOfNodes,1);
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New()); ret->alloc(nbOfNodes,1);
std::transform(nodeIdsInUse.begin(),nodeIdsInUse.end(),ret->getPointer(),MEDLoaderAccVisit1());
- MCAuto<DataArrayInt> ret2(ret->invertArrayO2N2N2OBis(nbrOfNodesInUse));
+ MCAuto<DataArrayIdType> ret2(ret->invertArrayO2N2N2OBis(nbrOfNodesInUse));
MCAuto<DataArrayDouble> newCoords(coo->selectByTupleIdSafe(ret2->begin(),ret2->end()));
- MCAuto<DataArrayInt> newFamCoords;
+ MCAuto<DataArrayIdType> newFamCoords;
MCAuto<DataArrayAsciiChar> newNameCoords;
- if((const DataArrayInt *)_fam_coords)
+ if((const DataArrayIdType *)_fam_coords)
newFamCoords=_fam_coords->selectByTupleIdSafe(ret2->begin(),ret2->end());
- MCAuto<DataArrayInt> newNumCoords,newGlobalNumCoords;
+ MCAuto<DataArrayIdType> newNumCoords,newGlobalNumCoords;
if(_num_coords.isNotNull())
newNumCoords=_num_coords->selectByTupleIdSafe(ret2->begin(),ret2->end());
if(_global_num_coords.isNotNull())
* The extraction of \a this is specified by the extractDef \a input map.
* This map tells for each level of cells, the cells kept in the extraction.
*
- * \return - a new reference of DataArrayInt that represents sorted node ids, the extraction is lying on.
+ * \return - a new reference of DataArrayIdType that represents sorted node ids, the extraction is lying on.
* \sa MEDFileField1TS::extractPart, MEDFileUMesh::extractPart
*/
-DataArrayInt *MEDFileUMesh::deduceNodeSubPartFromCellSubPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef) const
+DataArrayIdType *MEDFileUMesh::deduceNodeSubPartFromCellSubPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef) const
{
std::vector<int> levs(getNonEmptyLevels());
std::vector<bool> fetchedNodes(getNumberOfNodes(),false);
- for(std::map<int, MCAuto<DataArrayInt> >::const_iterator it=extractDef.begin();it!=extractDef.end();it++)
+ for(std::map<int, MCAuto<DataArrayIdType> >::const_iterator it=extractDef.begin();it!=extractDef.end();it++)
{
if((*it).first>1)
throw INTERP_KERNEL::Exception("MEDFileUMesh::deduceNodeSubPartFromCellSubPart : invalid key ! Must be <=1 !");
MCAuto<MEDCouplingUMesh> mPart(m->buildPartOfMySelf((*it).second->begin(),(*it).second->end(),true));
mPart->computeNodeIdsAlg(fetchedNodes);
}
- return DataArrayInt::BuildListOfSwitchedOn(fetchedNodes);
+ return DataArrayIdType::BuildListOfSwitchedOn(fetchedNodes);
}
/*!
* \return - a new reference of MEDFileUMesh
* \sa MEDFileUMesh::deduceNodeSubPartFromCellSubPart, MEDFileFields::extractPart
*/
-MEDFileUMesh *MEDFileUMesh::extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef) const
+MEDFileUMesh *MEDFileUMesh::extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef) const
{
MCAuto<MEDFileUMesh> ret(MEDFileUMesh::New()); ret->setName(getName()); ret->copyFamGrpMapsFrom(*this);
std::vector<int> levs(getNonEmptyLevels());
- for(std::map<int, MCAuto<DataArrayInt> >::const_iterator it=extractDef.begin();it!=extractDef.end();it++)
+ for(std::map<int, MCAuto<DataArrayIdType> >::const_iterator it=extractDef.begin();it!=extractDef.end();it++)
{
if((*it).first>1)
throw INTERP_KERNEL::Exception("MEDFileUMesh::extractPart : invalid key ! Must be <=1 !");
MCAuto<MEDCouplingUMesh> m(getMeshAtLevel((*it).first));
MCAuto<MEDCouplingUMesh> mPart(m->buildPartOfMySelf((*it).second->begin(),(*it).second->end(),true));
ret->setMeshAtLevel((*it).first,mPart);
- const DataArrayInt *fam(getFamilyFieldAtLevel((*it).first)),*num(getNumberFieldAtLevel((*it).first));
+ const DataArrayIdType *fam(getFamilyFieldAtLevel((*it).first)),*num(getNumberFieldAtLevel((*it).first));
if(fam)
{
- MCAuto<DataArrayInt> famPart(fam->selectByTupleIdSafe((*it).second->begin(),(*it).second->end()));
+ MCAuto<DataArrayIdType> famPart(fam->selectByTupleIdSafe((*it).second->begin(),(*it).second->end()));
ret->setFamilyFieldArr((*it).first,famPart);
}
if(num)
{
- MCAuto<DataArrayInt> numPart(num->selectByTupleIdSafe((*it).second->begin(),(*it).second->end()));
+ MCAuto<DataArrayIdType> numPart(num->selectByTupleIdSafe((*it).second->begin(),(*it).second->end()));
ret->setFamilyFieldArr((*it).first,numPart);
}
}
- std::map<int, MCAuto<DataArrayInt> >::const_iterator it2(extractDef.find(1));
+ std::map<int, MCAuto<DataArrayIdType> >::const_iterator it2(extractDef.find(1));
if(it2!=extractDef.end())
{
const DataArrayDouble *coo(ret->getCoords());
if(!coo)
throw INTERP_KERNEL::Exception("MEDFileUMesh::extractPart : trying to extract nodes whereas there is no nodes !");
- MCAuto<DataArrayInt> o2nNodes(((*it2).second)->invertArrayN2O2O2N(coo->getNumberOfTuples()));
+ MCAuto<DataArrayIdType> o2nNodes(((*it2).second)->invertArrayN2O2O2N(coo->getNumberOfTuples()));
MCAuto<DataArrayDouble> cooPart(coo->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end()));
ret->setCoords(cooPart);
- const DataArrayInt *fam(getFamilyFieldAtLevel(1)),*num(getNumberFieldAtLevel(1));
+ const DataArrayIdType *fam(getFamilyFieldAtLevel(1)),*num(getNumberFieldAtLevel(1));
if(fam)
{
- MCAuto<DataArrayInt> famPart(fam->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end()));
+ MCAuto<DataArrayIdType> famPart(fam->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end()));
ret->setFamilyFieldArr(1,famPart);
}
if(num)
{
- MCAuto<DataArrayInt> numPart(num->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end()));
+ MCAuto<DataArrayIdType> numPart(num->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end()));
ret->setFamilyFieldArr(1,numPart);
}
- for(std::map<int, MCAuto<DataArrayInt> >::const_iterator it3=extractDef.begin();it3!=extractDef.end();it3++)
+ for(std::map<int, MCAuto<DataArrayIdType> >::const_iterator it3=extractDef.begin();it3!=extractDef.end();it3++)
{
if((*it3).first==1)
continue;
m1D->checkConsistencyLight();
if(m1D->getMeshDimension()!=1)
throw INTERP_KERNEL::Exception("MEDFileUMesh::buildExtrudedMesh : input mesh must have a mesh dimension equal to one !");
- int nbRep(m1D->getNumberOfCells());
+ mcIdType nbRep(m1D->getNumberOfCells());
std::vector<int> levs(getNonEmptyLevels());
std::vector<std::string> grps(getGroupsNames());
std::vector< MCAuto<MEDCouplingUMesh> > zeList;
DataArrayDouble *coords(0);
std::size_t nbOfLevsOut(levs.size()+1);
- std::vector< MCAuto<DataArrayInt> > o2ns(nbOfLevsOut);
+ std::vector< MCAuto<DataArrayIdType> > o2ns(nbOfLevsOut);
for(std::vector<int>::const_iterator lev=levs.begin();lev!=levs.end();lev++)
{
MCAuto<MEDCouplingUMesh> item(getMeshAtLevel(*lev));
{
MCAuto<MEDCouplingUMesh> elt1(getMeshAtLevel(lev+1));
MCAuto<MEDCouplingUMesh> elt2(elt1->clone(false));
- MCAuto<DataArrayInt> tmp(elt2->getNodalConnectivity()->deepCopy());
+ MCAuto<DataArrayIdType> tmp(elt2->getNodalConnectivity()->deepCopy());
elt2->setConnectivity(tmp,elt2->getNodalConnectivityIndex());
elt2->shiftNodeNumbersInConn(nbRep*elt1->getNumberOfNodes());
elt1->setCoords(elt->getCoords()); elt2->setCoords(elt->getCoords());
}
MCAuto<MEDCouplingUMesh> endLev(getMeshAtLevel(levs.back())),endLev2;
endLev=endLev->clone(false); endLev->setCoords(coords);
- MCAuto<DataArrayInt> tmp(endLev->getNodalConnectivity()->deepCopy());
+ MCAuto<DataArrayIdType> tmp(endLev->getNodalConnectivity()->deepCopy());
endLev2=endLev->clone(false); endLev2->setConnectivity(tmp,endLev->getNodalConnectivityIndex());
endLev2->shiftNodeNumbersInConn(nbRep*getNumberOfNodes());
endLev=MEDCouplingUMesh::MergeUMeshesOnSameCoords(endLev,endLev2);
for(std::size_t ii=0;ii!=zeList.size();ii++)
{
int lev(levs[ii]);
- std::vector< MCAuto<DataArrayInt> > outGrps;
- std::vector< const DataArrayInt * > outGrps2;
+ std::vector< MCAuto<DataArrayIdType> > outGrps;
+ std::vector< const DataArrayIdType * > outGrps2;
if(lev<=-1)
{
for(std::vector<std::string>::const_iterator grp=grps.begin();grp!=grps.end();grp++)
{
- MCAuto<DataArrayInt> grpArr(getGroupArr(lev+1,*grp));
+ MCAuto<DataArrayIdType> grpArr(getGroupArr(lev+1,*grp));
if(!grpArr->empty())
{
- MCAuto<DataArrayInt> grpArr1(grpArr->deepCopy()),grpArr2(grpArr->deepCopy());
- int offset0(zeList[ii]->getNumberOfCells());
- int offset1(offset0+getNumberOfCellsAtLevel(lev+1));
+ MCAuto<DataArrayIdType> grpArr1(grpArr->deepCopy()),grpArr2(grpArr->deepCopy());
+ mcIdType offset0(zeList[ii]->getNumberOfCells());
+ mcIdType offset1(offset0+getNumberOfCellsAtLevel(lev+1));
grpArr1->applyLin(1,offset0); grpArr2->applyLin(1,offset1);
std::ostringstream oss; oss << grpArr2->getName() << "_top";
grpArr2->setName(oss.str());
//
for(std::vector<std::string>::const_iterator grp=grps.begin();grp!=grps.end();grp++)
{
- MCAuto<DataArrayInt> grpArr(getGroupArr(lev,*grp));
+ MCAuto<DataArrayIdType> grpArr(getGroupArr(lev,*grp));
if(!grpArr->empty())
{
- int nbCellsB4Extrusion(getNumberOfCellsAtLevel(lev));
- std::vector< MCAuto<DataArrayInt> > grpArrs(nbRep);
- std::vector< const DataArrayInt *> grpArrs2(nbRep);
+ mcIdType nbCellsB4Extrusion(getNumberOfCellsAtLevel(lev));
+ std::vector< MCAuto<DataArrayIdType> > grpArrs(nbRep);
+ std::vector< const DataArrayIdType *> grpArrs2(nbRep);
for(int iii=0;iii<nbRep;iii++)
{
grpArrs[iii]=grpArr->deepCopy(); grpArrs[iii]->applyLin(1,iii*nbCellsB4Extrusion);
grpArrs2[iii]=grpArrs[iii];
}
- MCAuto<DataArrayInt> grpArrExt(DataArrayInt::Aggregate(grpArrs2));
+ MCAuto<DataArrayIdType> grpArrExt(DataArrayIdType::Aggregate(grpArrs2));
grpArrExt->transformWithIndArr(o2ns[ii]->begin(),o2ns[ii]->end());
std::ostringstream grpName; grpName << *grp << "_extruded";
grpArrExt->setName(grpName.str());
}
ret->setGroupsAtLevel(lev,outGrps2);
}
- std::vector< MCAuto<DataArrayInt> > outGrps;
- std::vector< const DataArrayInt * > outGrps2;
+ std::vector< MCAuto<DataArrayIdType> > outGrps;
+ std::vector< const DataArrayIdType * > outGrps2;
for(std::vector<std::string>::const_iterator grp=grps.begin();grp!=grps.end();grp++)
{
- MCAuto<DataArrayInt> grpArr1(getGroupArr(levs.back(),*grp));
+ MCAuto<DataArrayIdType> grpArr1(getGroupArr(levs.back(),*grp));
if(grpArr1->empty())
continue;
- MCAuto<DataArrayInt> grpArr2(grpArr1->deepCopy());
+ MCAuto<DataArrayIdType> grpArr2(grpArr1->deepCopy());
std::ostringstream grpName; grpName << *grp << "_top";
grpArr2->setName(grpName.str());
grpArr2->applyLin(1,getNumberOfCellsAtLevel(levs.back()));
{
checkCartesian();
MCAuto<MEDFileUMesh> ret(MEDFileUMesh::New());
- int initialNbNodes(getNumberOfNodes());
+ mcIdType initialNbNodes(getNumberOfNodes());
MCAuto<MEDCouplingUMesh> m0Tmp(getMeshAtLevel(0));
MCAuto<MEDCouplingUMesh> m0(dynamic_cast<MEDCouplingUMesh *>(m0Tmp->deepCopy()));
{
- MCAuto<DataArrayInt> notUsed(m0->convertLinearCellsToQuadratic(conversionType));
+ MCAuto<DataArrayIdType> notUsed(m0->convertLinearCellsToQuadratic(conversionType));
}
DataArrayDouble *zeCoords(m0->getCoords());
ret->setMeshAtLevel(0,m0);
std::vector<int> levs(getNonEmptyLevels());
- const DataArrayInt *famField(getFamilyFieldAtLevel(0));
+ const DataArrayIdType *famField(getFamilyFieldAtLevel(0));
if(famField)
{
- MCAuto<DataArrayInt> famFieldCpy(famField->deepCopy());
+ MCAuto<DataArrayIdType> famFieldCpy(famField->deepCopy());
ret->setFamilyFieldArr(0,famFieldCpy);
}
famField=getFamilyFieldAtLevel(1);
if(famField)
{
- MCAuto<DataArrayInt> fam(DataArrayInt::New()); fam->alloc(zeCoords->getNumberOfTuples(),1);
+ MCAuto<DataArrayIdType> fam(DataArrayIdType::New()); fam->alloc(zeCoords->getNumberOfTuples(),1);
fam->fillWithZero();
fam->setPartOfValues1(famField,0,initialNbNodes,1,0,1,1);
ret->setFamilyFieldArr(1,fam);
if(m1->getMeshDimension()!=0)
{
{
- MCAuto<DataArrayInt> notUsed(m1->convertLinearCellsToQuadratic(conversionType));
+ MCAuto<DataArrayIdType> notUsed(m1->convertLinearCellsToQuadratic(conversionType));
}//kill unused notUsed var
MCAuto<DataArrayDouble> m1Coords(m1->getCoords()->selectByTupleIdSafeSlice(initialNbNodes,m1->getNumberOfNodes(),1));
- DataArrayInt *b(0);
+ DataArrayIdType *b(0);
bool a(partZeCoords->areIncludedInMe(m1Coords,eps,b));
- MCAuto<DataArrayInt> bSafe(b);
+ MCAuto<DataArrayIdType> bSafe(b);
if(!a)
{
std::ostringstream oss; oss << "MEDFileUMesh::linearCellsToQuadratic : for level " << *lev << " problem to identify nodes generated !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
b->applyLin(1,initialNbNodes);
- MCAuto<DataArrayInt> l0(DataArrayInt::New()); l0->alloc(initialNbNodes,1); l0->iota();
- std::vector<const DataArrayInt *> v(2); v[0]=l0; v[1]=b;
- MCAuto<DataArrayInt> renum(DataArrayInt::Aggregate(v));
+ MCAuto<DataArrayIdType> l0(DataArrayIdType::New()); l0->alloc(initialNbNodes,1); l0->iota();
+ std::vector<const DataArrayIdType *> v(2); v[0]=l0; v[1]=b;
+ MCAuto<DataArrayIdType> renum(DataArrayIdType::Aggregate(v));
m1->renumberNodesInConn(renum->begin());
}
m1->setCoords(zeCoords);
famField=getFamilyFieldAtLevel(*lev);
if(famField)
{
- MCAuto<DataArrayInt> famFieldCpy(famField->deepCopy());
+ MCAuto<DataArrayIdType> famFieldCpy(famField->deepCopy());
ret->setFamilyFieldArr(*lev,famFieldCpy);
}
}
DataArrayDouble *zeCoords(m0->getCoords());
ret->setMeshAtLevel(0,m0);
std::vector<int> levs(getNonEmptyLevels());
- const DataArrayInt *famField(getFamilyFieldAtLevel(0));
+ const DataArrayIdType *famField(getFamilyFieldAtLevel(0));
if(famField)
{
- MCAuto<DataArrayInt> famFieldCpy(famField->deepCopy());
+ MCAuto<DataArrayIdType> famFieldCpy(famField->deepCopy());
ret->setFamilyFieldArr(0,famFieldCpy);
}
famField=getFamilyFieldAtLevel(1);
if(famField)
{
- MCAuto<DataArrayInt> fam(famField->selectByTupleIdSafeSlice(0,zeCoords->getNumberOfTuples(),1));
+ MCAuto<DataArrayIdType> fam(famField->selectByTupleIdSafeSlice(0,zeCoords->getNumberOfTuples(),1));
ret->setFamilyFieldArr(1,fam);
}
ret->copyFamGrpMapsFrom(*this);
MCAuto<MEDCouplingUMesh> m1(dynamic_cast<MEDCouplingUMesh *>(m1Tmp->deepCopy()));
m1->convertQuadraticCellsToLinear();
m1->zipCoords();
- DataArrayInt *b(0);
+ DataArrayIdType *b(0);
bool a(zeCoords->areIncludedInMe(m1->getCoords(),eps,b));
- MCAuto<DataArrayInt> bSafe(b);
+ MCAuto<DataArrayIdType> bSafe(b);
if(!a)
{
std::ostringstream oss; oss << "MEDFileUMesh::quadraticToLinear : for level " << *lev << " problem to identify nodes generated !";
famField=getFamilyFieldAtLevel(*lev);
if(famField)
{
- MCAuto<DataArrayInt> famFieldCpy(famField->deepCopy());
+ MCAuto<DataArrayIdType> famFieldCpy(famField->deepCopy());
ret->setFamilyFieldArr(*lev,famFieldCpy);
}
}
throw INTERP_KERNEL::Exception("MEDFileUMesh::Aggregate : empty input vector !");
std::size_t sz(meshes.size()),i(0);
std::vector<const DataArrayDouble *> coos(sz);
- std::vector<const DataArrayInt *> fam_coos(sz),num_coos(sz);
+ std::vector<const DataArrayIdType *> fam_coos(sz),num_coos(sz);
for(auto it=meshes.begin();it!=meshes.end();it++,i++)
{
if(!(*it))
const MEDFileUMesh *ref(meshes[0]);
int spaceDim(ref->getSpaceDimension()),meshDim(ref->getMeshDimension());
std::vector<int> levs(ref->getNonEmptyLevels());
- std::map<int, std::vector<const DataArrayInt *> > m_fam,m_renum;
+ std::map<int, std::vector<const DataArrayIdType *> > m_fam,m_renum;
std::map<int, std::vector< MCAuto< MEDCouplingUMesh > > > m_mesh2;
std::map<int, std::vector<const MEDCouplingUMesh *> > m_mesh;
- std::map<std::string,int> famNumMap;
- std::map<int, std::string> famNumMap_rev;
+ std::map<std::string,mcIdType> famNumMap;
+ std::map<mcIdType, std::string> famNumMap_rev;
std::map<std::string, std::vector<std::string> > grpFamMap;
- std::set< MCAuto<DataArrayInt> > mem_cleanup; // Memory clean-up. At set deletion (end of method), arrays will be deallocated.
+ std::set< MCAuto<DataArrayIdType> > mem_cleanup; // Memory clean-up. At set deletion (end of method), arrays will be deallocated.
// Identify min family number used:
- int min_fam_num(0);
+ mcIdType min_fam_num(0);
for(const auto& msh : meshes)
{
- const std::map<std::string,int>& locMap1(msh->getFamilyInfo());
+ const std::map<std::string,mcIdType>& locMap1(msh->getFamilyInfo());
for(const auto& it3 : locMap1)
if(it3.second < min_fam_num)
min_fam_num = it3.second;
if(msh->getNonEmptyLevels()!=levs)
throw INTERP_KERNEL::Exception("MEDFileUMesh::Aggregate : levels must be the same for elements in input vector !");
- const std::map<std::string,int>& locMap1(msh->getFamilyInfo());
+ const std::map<std::string,mcIdType>& locMap1(msh->getFamilyInfo());
std::map<std::string, std::string> substitute;
- std::map<int, int> substituteN;
+ std::map<mcIdType, mcIdType> substituteN;
bool fam_conflict(false);
for(const auto& it3 : locMap1)
{
const std::string& famName = it3.first;
- int famNum = it3.second;
+ mcIdType famNum = it3.second;
if (famNumMap_rev.find(famNum) != famNumMap_rev.end()) // Family number is already used!
{
// Is it used by a group of the current mesh or a group from a previous mesh?
// Family field - substitute new family number if needed:
if(fam_conflict)
{
- DataArrayInt* dai(msh->getFamilyFieldAtLevel(level)->deepCopy()); // Need a copy
- mem_cleanup.insert(MCAuto<DataArrayInt>(dai)); // Make sure array will decrRef() at end of method
+ DataArrayIdType* dai(msh->getFamilyFieldAtLevel(level)->deepCopy()); // Need a copy
+ mem_cleanup.insert(MCAuto<DataArrayIdType>(dai)); // Make sure array will decrRef() at end of method
for (const auto& subN : substituteN)
dai->changeValue(subN.first, subN.second);
m_fam[level].push_back(dai);
MCAuto<MEDFileUMesh> ret(MEDFileUMesh::New());
MCAuto<DataArrayDouble> coo(DataArrayDouble::Aggregate(coos));
ret->setCoords(coo);
- if(std::find(fam_coos.begin(),fam_coos.end(),(const DataArrayInt *)0)==fam_coos.end())
+ if(std::find(fam_coos.begin(),fam_coos.end(),(const DataArrayIdType *)0)==fam_coos.end())
{
- MCAuto<DataArrayInt> fam_coo(DataArrayInt::Aggregate(fam_coos));
+ MCAuto<DataArrayIdType> fam_coo(DataArrayIdType::Aggregate(fam_coos));
ret->setFamilyFieldArr(1,fam_coo);
}
- if(std::find(num_coos.begin(),num_coos.end(),(const DataArrayInt *)0)==num_coos.end())
+ if(std::find(num_coos.begin(),num_coos.end(),(const DataArrayIdType *)0)==num_coos.end())
{
- MCAuto<DataArrayInt> num_coo(DataArrayInt::Aggregate(num_coos));
+ MCAuto<DataArrayIdType> num_coo(DataArrayIdType::Aggregate(num_coos));
ret->setRenumFieldArr(1,num_coo);
}
// cells
throw INTERP_KERNEL::Exception("MEDFileUMesh::Aggregate : internal error 1 !");
MCAuto<MEDCouplingUMesh> mesh(MEDCouplingUMesh::MergeUMeshes((*it2).second));
mesh->setCoords(coo); mesh->setName(ref->getName());
- MCAuto<DataArrayInt> renum(mesh->sortCellsInMEDFileFrmt());
+ MCAuto<DataArrayIdType> renum(mesh->sortCellsInMEDFileFrmt());
ret->setMeshAtLevel(level,mesh);
auto it3(m_fam.find(level)),it4(m_renum.find(level));
if(it3==m_fam.end()) // Should never happen (all levels exist for all meshes)
if(it4==m_renum.end())
throw INTERP_KERNEL::Exception("MEDFileUMesh::Aggregate : internal error 3!");
// Set new family field if it was defined for all input meshes
- const std::vector<const DataArrayInt *>& fams((*it3).second);
- if(std::find(fams.begin(),fams.end(),(const DataArrayInt *)0)==fams.end())
+ const std::vector<const DataArrayIdType *>& fams((*it3).second);
+ if(std::find(fams.begin(),fams.end(),(const DataArrayIdType *)0)==fams.end())
{
- MCAuto<DataArrayInt> famm(DataArrayInt::Aggregate(fams));
+ MCAuto<DataArrayIdType> famm(DataArrayIdType::Aggregate(fams));
famm->renumberInPlace(renum->begin());
ret->setFamilyFieldArr(level,famm);
}
// Set optional number field if defined for all input meshes:
- const std::vector<const DataArrayInt *>& renums((*it4).second);
- if(std::find(renums.begin(),renums.end(),(const DataArrayInt *)0)==renums.end())
+ const std::vector<const DataArrayIdType *>& renums((*it4).second);
+ if(std::find(renums.begin(),renums.end(),(const DataArrayIdType *)0)==renums.end())
{
- MCAuto<DataArrayInt> renumm(DataArrayInt::Aggregate(renums));
+ MCAuto<DataArrayIdType> renumm(DataArrayIdType::Aggregate(renums));
renumm->renumberInPlace(renum->begin());
ret->setRenumFieldArr(level,renumm);
}
MCAuto<MEDCouplingUMesh> m3D(getMeshAtLevel(0)),m2D(getMeshAtLevel(-1));
if(m3D.isNull() || m2D.isNull())
throw INTERP_KERNEL::Exception("MEDFileUMesh::convertToExtrudedMesh : this must be defined both at level 0 and level -1 !");
- int zeId(std::numeric_limits<int>::max()-getFamilyId(GetSpeStr4ExtMesh()));
+ mcIdType zeId(std::numeric_limits<mcIdType>::max()-getFamilyId(GetSpeStr4ExtMesh()));
MCAuto<MEDCouplingMappedExtrudedMesh> ret(MEDCouplingMappedExtrudedMesh::New(m3D,m2D,zeId));
return ret.retn();
}
-void MEDFileUMesh::serialize(std::vector<double>& tinyDouble, std::vector<int>& tinyInt, std::vector<std::string>& tinyStr, std::vector< MCAuto<DataArrayInt> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD)
+void MEDFileUMesh::serialize(std::vector<double>& tinyDouble, std::vector<mcIdType>& tinyInt, std::vector<std::string>& tinyStr, std::vector< MCAuto<DataArrayIdType> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD)
{
clearNonDiscrAttributes();
forceComputationOfParts();
for(int i=0;i<getSpaceDimension();i++)
tinyStr.push_back(_coords->getInfoOnComponent(i));
layer0.push_back((int)_families.size());//4 i <- key info aa layer#0
- for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
+ for(std::map<std::string,mcIdType>::const_iterator it=_families.begin();it!=_families.end();it++)
{
tinyStr.push_back((*it).first);
layer0.push_back((*it).second);
}
- layer0.push_back((int)_groups.size());//4+aa i <- key info bb layer#0
+ layer0.push_back((mcIdType)_groups.size());//4+aa i <- key info bb layer#0
for(std::map<std::string, std::vector<std::string> >::const_iterator it0=_groups.begin();it0!=_groups.end();it0++)
{
layer0.push_back((int)(*it0).second.size());
layer0.push_back(-1);
else
{
- std::vector<int> tmp0;
+ std::vector<mcIdType> tmp0;
pd->serialize(tmp0,bigArraysI);
tinyInt.push_back(tmp0.size());
tinyInt.insert(tinyInt.end(),tmp0.begin(),tmp0.end());
}
//
- std::vector<int> layer1;
+ std::vector<mcIdType> layer1;
std::vector<int> levs(getNonEmptyLevels());
- layer1.push_back((int)levs.size());// 0 i <- key
+ layer1.push_back((mcIdType)levs.size());// 0 i <- key
layer1.insert(layer1.end(),levs.begin(),levs.end());
for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
{
tinyInt.insert(tinyInt.end(),layer1.begin(),layer1.end());
}
-void MEDFileUMesh::unserialize(std::vector<double>& tinyDouble, std::vector<int>& tinyInt, std::vector<std::string>& tinyStr,
- std::vector< MCAuto<DataArrayInt> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD)
+void MEDFileUMesh::unserialize(std::vector<double>& tinyDouble, std::vector<mcIdType>& tinyInt, std::vector<std::string>& tinyStr,
+ std::vector< MCAuto<DataArrayIdType> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD)
{
- int sz0(tinyInt[0]);
- std::vector<int> layer0(tinyInt.begin()+1,tinyInt.begin()+1+sz0);
- int sz1(tinyInt[sz0+1]);
- std::vector<int> layer1(tinyInt.begin()+2+sz0,tinyInt.begin()+2+sz0+sz1);
+ mcIdType sz0(tinyInt[0]);
+ std::vector<mcIdType> layer0(tinyInt.begin()+1,tinyInt.begin()+1+sz0);
+ mcIdType sz1(tinyInt[sz0+1]);
+ std::vector<mcIdType> layer1(tinyInt.begin()+2+sz0,tinyInt.begin()+2+sz0+sz1);
//
std::reverse(layer0.begin(),layer0.end());
std::reverse(layer1.begin(),layer1.end());
_coords->setInfoOnComponent(i,tinyStr.back());
tinyStr.pop_back();
}
- int nbOfFams(layer0.back()); layer0.pop_back();
+ mcIdType nbOfFams(layer0.back()); layer0.pop_back();
_families.clear();
- for(int i=0;i<nbOfFams;i++)
+ for(mcIdType i=0;i<nbOfFams;i++)
{
_families[tinyStr.back()]=layer0.back();
tinyStr.pop_back(); layer0.pop_back();
}
- int nbGroups(layer0.back()); layer0.pop_back();
+ mcIdType nbGroups(layer0.back()); layer0.pop_back();
_groups.clear();
- for(int i=0;i<nbGroups;i++)
+ for(mcIdType i=0;i<nbGroups;i++)
{
std::string grpName(tinyStr.back()); tinyStr.pop_back();
- int nbOfFamsOnGrp(layer0.back()); layer0.pop_back();
+ mcIdType nbOfFamsOnGrp(layer0.back()); layer0.pop_back();
std::vector<std::string> fams(nbOfFamsOnGrp);
- for(int j=0;j<nbOfFamsOnGrp;j++)
+ for(mcIdType j=0;j<nbOfFamsOnGrp;j++)
{
fams[j]=tinyStr.back(); tinyStr.pop_back();
}
_fam_coords=bigArraysI.back(); bigArraysI.pop_back();
_num_coords=bigArraysI.back(); bigArraysI.pop_back();
_part_coords=0;
- int isPd(layer0.back()); layer0.pop_back();
+ mcIdType isPd(layer0.back()); layer0.pop_back();
if(isPd!=-1)
{
- std::vector<int> tmp0(layer0.begin(),layer0.begin()+isPd);
+ std::vector<mcIdType> tmp0(layer0.begin(),layer0.begin()+isPd);
layer0.erase(layer0.begin(),layer0.begin()+isPd);
_part_coords=PartDefinition::Unserialize(tmp0,bigArraysI);
}
if(!layer0.empty())
throw INTERP_KERNEL::Exception("MEDFileUMesh::unserialize : something wrong during unserialization #1 !");
//
- int nbLevs(layer1.back()); layer1.pop_back();
- std::vector<int> levs(layer1.rbegin(),layer1.rbegin()+nbLevs); layer1.erase(layer1.end()-nbLevs,layer1.end());
+ mcIdType nbLevs(layer1.back()); layer1.pop_back();
+ std::vector<mcIdType> levs(layer1.rbegin(),layer1.rbegin()+nbLevs); layer1.erase(layer1.end()-nbLevs,layer1.end());
_ms.clear();
- int maxLev(-(*std::min_element(levs.begin(),levs.end())));
+ mcIdType maxLev(-(*std::min_element(levs.begin(),levs.end())));
_ms.resize(maxLev+1);
- for(int i=0;i<nbLevs;i++)
+ for(mcIdType i=0;i<nbLevs;i++)
{
- int lev(levs[i]);
- int pos(-lev);
+ mcIdType lev(levs[i]);
+ mcIdType pos(-lev);
_ms[pos]=MEDFileUMeshSplitL1::Unserialize(_name,_coords,layer1,bigArraysI);
}
}
/*!
* Adds a group of nodes to \a this mesh.
- * \param [in] ids - a DataArrayInt providing ids and a name of the group to add.
+ * \param [in] ids - a DataArrayIdType providing ids and a name of the group to add.
* The ids should be sorted and different each other (MED file norm).
*
* \warning this method can alter default "FAMILLE_ZERO" family.
* \throw If \a ids does not respect the MED file norm.
* \throw If a group with name \a ids->getName() already exists.
*/
-void MEDFileUMesh::addNodeGroup(const DataArrayInt *ids)
+void MEDFileUMesh::addNodeGroup(const DataArrayIdType *ids)
{
const DataArrayDouble *coords(_coords);
if(!coords)
throw INTERP_KERNEL::Exception("MEDFileUMesh::addNodeGroup : no coords set !");
int nbOfNodes(coords->getNumberOfTuples());
if(_fam_coords.isNull())
- { _fam_coords=DataArrayInt::New(); _fam_coords->alloc(nbOfNodes,1); _fam_coords->fillWithZero(); }
+ { _fam_coords=DataArrayIdType::New(); _fam_coords->alloc(nbOfNodes,1); _fam_coords->fillWithZero(); }
//
addGroupUnderground(true,ids,_fam_coords);
}
/*!
* Adds a group of nodes/cells/faces/edges to \a this mesh.
*
- * \param [in] ids - a DataArrayInt providing ids and a name of the group to add.
+ * \param [in] ids - a DataArrayIdType providing ids and a name of the group to add.
* The ids should be sorted and different each other (MED file norm).
*
* \warning this method can alter default "FAMILLE_ZERO" family.
* \throw If \a ids does not respect the MED file norm.
* \throw If a group with name \a ids->getName() already exists.
*/
-void MEDFileUMesh::addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids)
+void MEDFileUMesh::addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids)
{
std::vector<int> levs(getNonEmptyLevelsExt());
if(std::find(levs.begin(),levs.end(),meshDimRelToMaxExt)==levs.end())
if(meshDimRelToMaxExt==1)
{ addNodeGroup(ids); return ; }
MEDFileUMeshSplitL1 *lev(getMeshAtLevSafe(meshDimRelToMaxExt));
- DataArrayInt *fam(lev->getOrCreateAndGetFamilyField());
+ DataArrayIdType *fam(lev->getOrCreateAndGetFamilyField());
addGroupUnderground(false,ids,fam);
}
* \param [in] newFamName - the new family name.
* \throw If no family with the given \a id exists.
*/
-void MEDFileUMesh::setFamilyNameAttachedOnId(int id, const std::string& newFamName)
+void MEDFileUMesh::setFamilyNameAttachedOnId(mcIdType id, const std::string& newFamName)
{
std::string oldName=getFamilyNameGivenId(id);
_families.erase(oldName);
else
if((DataArrayDouble *)_coords!=coo)
throw INTERP_KERNEL::Exception("MEDFileUMesh::setGroupsFromScratch : coordinates mismatches !");
- std::vector<DataArrayInt *> corr;
+ std::vector<DataArrayIdType *> corr;
MCAuto<MEDCouplingUMesh> m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,_zipconn_pol,corr);
- std::vector< MCAuto<DataArrayInt> > corr3(corr.begin(),corr.end());
+ std::vector< MCAuto<DataArrayIdType> > corr3(corr.begin(),corr.end());
setMeshAtLevel(meshDimRelToMax,m,renum);
- std::vector<const DataArrayInt *> corr2(corr.begin(),corr.end());
+ std::vector<const DataArrayIdType *> corr2(corr.begin(),corr.end());
setGroupsAtLevel(meshDimRelToMax,corr2,true);
}
if((DataArrayDouble *)_coords!=coo)
throw INTERP_KERNEL::Exception("MEDFileUMesh::setGroupsOnSetMesh : coordinates mismatches !");
MEDCouplingUMesh *m=getMeshAtLevel(meshDimRelToMax,renum);
- std::vector< MCAuto<DataArrayInt> > corr(ms.size());
+ std::vector< MCAuto<DataArrayIdType> > corr(ms.size());
int i=0;
for(std::vector<const MEDCouplingUMesh *>::const_iterator it=ms.begin();it!=ms.end();it++,i++)
{
- DataArrayInt *arr=0;
+ DataArrayIdType *arr=0;
bool test=m->areCellsIncludedIn(*it,_zipconn_pol,arr);
corr[i]=arr;
if(!test)
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- std::vector<const DataArrayInt *> corr2(corr.begin(),corr.end());
+ std::vector<const DataArrayIdType *> corr2(corr.begin(),corr.end());
setGroupsAtLevel(meshDimRelToMax,corr2,renum);
}
* \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh.
* \throw If \a famArr has an invalid size.
*/
-void MEDFileUMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr)
+void MEDFileUMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr)
{
if(meshDimRelToMaxExt==1)
{
* \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh.
* \throw If \a renumArr has an invalid size.
*/
-void MEDFileUMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr)
+void MEDFileUMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr)
{
if(meshDimRelToMaxExt==1)
{
return _ms[traducedRk]->setNameArr(nameArr);
}
-void MEDFileUMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr)
+void MEDFileUMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr)
{
if(meshDimRelToMaxExt!=1)
throw INTERP_KERNEL::Exception("MEDFileUMesh::setGlobalNumFieldAtLevel : Only implemented for meshDimRelToMaxExt==1 for the moment !");
/*!
* This method is called by MEDFileMesh::changeFamilyId. It performs only one part of the family id modification.
*/
-void MEDFileUMesh::changeFamilyIdArr(int oldId, int newId)
+void MEDFileUMesh::changeFamilyIdArr(mcIdType oldId, mcIdType newId)
{
- DataArrayInt *arr=_fam_coords;
+ DataArrayIdType *arr=_fam_coords;
if(arr)
arr->changeValue(oldId,newId);
for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
}
}
-std::list< MCAuto<DataArrayInt> > MEDFileUMesh::getAllNonNullFamilyIds() const
+std::list< MCAuto<DataArrayIdType> > MEDFileUMesh::getAllNonNullFamilyIds() const
{
- std::list< MCAuto<DataArrayInt> > ret;
- const DataArrayInt *da(_fam_coords);
+ std::list< MCAuto<DataArrayIdType> > ret;
+ const DataArrayIdType *da(_fam_coords);
if(da)
- { da->incrRef(); ret.push_back(MCAuto<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
+ { da->incrRef(); ret.push_back(MCAuto<DataArrayIdType>(const_cast<DataArrayIdType *>(da))); }
for(std::vector< MCAuto<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
const MEDFileUMeshSplitL1 *elt(*it);
{
da=elt->getFamilyField();
if(da)
- { da->incrRef(); ret.push_back(MCAuto<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
+ { da->incrRef(); ret.push_back(MCAuto<DataArrayIdType>(const_cast<DataArrayIdType *>(da))); }
}
}
return ret;
{
if(_num_coords.isNotNull())
{
- int pos;
- int maxValue=_num_coords->getMaxValue(pos);
+ mcIdType pos;
+ mcIdType maxValue=_num_coords->getMaxValue(pos);
_rev_num_coords=_num_coords->invertArrayN2O2O2N(maxValue+1);
}
}
std::vector<const BigMemoryObject *> MEDFileStructuredMesh::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret(MEDFileMesh::getDirectChildrenWithNull());
- ret.push_back((const DataArrayInt *)_fam_nodes);
- ret.push_back((const DataArrayInt *)_num_nodes);
+ ret.push_back((const DataArrayIdType *)_fam_nodes);
+ ret.push_back((const DataArrayIdType *)_num_nodes);
ret.push_back((const DataArrayAsciiChar *)_names_nodes);
- ret.push_back((const DataArrayInt *)_fam_cells);
- ret.push_back((const DataArrayInt *)_num_cells);
+ ret.push_back((const DataArrayIdType *)_fam_cells);
+ ret.push_back((const DataArrayIdType *)_num_cells);
ret.push_back((const DataArrayAsciiChar *)_names_cells);
- ret.push_back((const DataArrayInt *)_fam_faces);
- ret.push_back((const DataArrayInt *)_num_faces);
- ret.push_back((const DataArrayInt *)_rev_num_nodes);
+ ret.push_back((const DataArrayIdType *)_fam_faces);
+ ret.push_back((const DataArrayIdType *)_num_faces);
+ ret.push_back((const DataArrayIdType *)_rev_num_nodes);
ret.push_back((const DataArrayAsciiChar *)_names_faces);
- ret.push_back((const DataArrayInt *)_rev_num_cells);
+ ret.push_back((const DataArrayIdType *)_rev_num_cells);
ret.push_back((const MEDCoupling1SGTUMesh*)_faces_if_necessary);
return ret;
}
-int MEDFileStructuredMesh::getMaxAbsFamilyIdInArrays() const
+mcIdType MEDFileStructuredMesh::getMaxAbsFamilyIdInArrays() const
{
- int ret=-std::numeric_limits<int>::max(),tmp=-1;
- if((const DataArrayInt *)_fam_nodes)
+ mcIdType ret=-std::numeric_limits<mcIdType>::max(),tmp=-1;
+ if((const DataArrayIdType *)_fam_nodes)
{
- int val=_fam_nodes->getMaxValue(tmp);
+ mcIdType val=_fam_nodes->getMaxValue(tmp);
ret=std::max(ret,std::abs(val));
}
- if((const DataArrayInt *)_fam_cells)
+ if((const DataArrayIdType *)_fam_cells)
{
- int val=_fam_cells->getMaxValue(tmp);
+ mcIdType val=_fam_cells->getMaxValue(tmp);
ret=std::max(ret,std::abs(val));
}
- if((const DataArrayInt *)_fam_faces)
+ if((const DataArrayIdType *)_fam_faces)
{
- int val=_fam_faces->getMaxValue(tmp);
+ mcIdType val=_fam_faces->getMaxValue(tmp);
ret=std::max(ret,std::abs(val));
}
return ret;
}
-int MEDFileStructuredMesh::getMaxFamilyIdInArrays() const
+mcIdType MEDFileStructuredMesh::getMaxFamilyIdInArrays() const
{
- int ret=-std::numeric_limits<int>::max(),tmp=-1;
- if((const DataArrayInt *)_fam_nodes)
+ mcIdType ret=-std::numeric_limits<mcIdType>::max(),tmp=-1;
+ if((const DataArrayIdType *)_fam_nodes)
{
- int val=_fam_nodes->getMaxValue(tmp);
+ mcIdType val=_fam_nodes->getMaxValue(tmp);
ret=std::max(ret,val);
}
- if((const DataArrayInt *)_fam_cells)
+ if((const DataArrayIdType *)_fam_cells)
{
- int val=_fam_cells->getMaxValue(tmp);
+ mcIdType val=_fam_cells->getMaxValue(tmp);
ret=std::max(ret,val);
}
- if((const DataArrayInt *)_fam_faces)
+ if((const DataArrayIdType *)_fam_faces)
{
- int val=_fam_faces->getMaxValue(tmp);
+ mcIdType val=_fam_faces->getMaxValue(tmp);
ret=std::max(ret,val);
}
return ret;
}
-int MEDFileStructuredMesh::getMinFamilyIdInArrays() const
+mcIdType MEDFileStructuredMesh::getMinFamilyIdInArrays() const
{
- int ret=std::numeric_limits<int>::max(),tmp=-1;
- if((const DataArrayInt *)_fam_nodes)
+ mcIdType ret=std::numeric_limits<mcIdType>::max(),tmp=-1;
+ if((const DataArrayIdType *)_fam_nodes)
{
- int val=_fam_nodes->getMinValue(tmp);
+ mcIdType val=_fam_nodes->getMinValue(tmp);
ret=std::min(ret,val);
}
- if((const DataArrayInt *)_fam_cells)
+ if((const DataArrayIdType *)_fam_cells)
{
- int val=_fam_cells->getMinValue(tmp);
+ mcIdType val=_fam_cells->getMinValue(tmp);
ret=std::min(ret,val);
}
- if((const DataArrayInt *)_fam_faces)
+ if((const DataArrayIdType *)_fam_faces)
{
- int val=_fam_faces->getMinValue(tmp);
+ mcIdType val=_fam_faces->getMinValue(tmp);
ret=std::min(ret,val);
}
return ret;
what="Mesh types differ ! This is structured and other is NOT !";
return false;
}
- const DataArrayInt *famc1=_fam_nodes;
- const DataArrayInt *famc2=otherC->_fam_nodes;
+ const DataArrayIdType *famc1=_fam_nodes;
+ const DataArrayIdType *famc2=otherC->_fam_nodes;
if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0))
{
what="Mismatch of families arr on nodes ! One is defined and not other !";
void MEDFileStructuredMesh::clearNonDiscrAttributes() const
{
MEDFileMesh::clearNonDiscrAttributes();
- const DataArrayInt *tmp=_fam_nodes;
+ const DataArrayIdType *tmp=_fam_nodes;
if(tmp)
- (const_cast<DataArrayInt *>(tmp))->setName("");
+ (const_cast<DataArrayIdType *>(tmp))->setName("");
tmp=_num_nodes;
if(tmp)
- (const_cast<DataArrayInt *>(tmp))->setName("");
+ (const_cast<DataArrayIdType *>(tmp))->setName("");
tmp=_fam_cells;
if(tmp)
- (const_cast<DataArrayInt *>(tmp))->setName("");
+ (const_cast<DataArrayIdType *>(tmp))->setName("");
tmp=_num_cells;
if(tmp)
- (const_cast<DataArrayInt *>(tmp))->setName("");
+ (const_cast<DataArrayIdType *>(tmp))->setName("");
tmp=_fam_faces;
if(tmp)
- (const_cast<DataArrayInt *>(tmp))->setName("");
+ (const_cast<DataArrayIdType *>(tmp))->setName("");
tmp=_num_faces;
if(tmp)
- (const_cast<DataArrayInt *>(tmp))->setName("");
+ (const_cast<DataArrayIdType *>(tmp))->setName("");
}
/*!
* \param [in] fams - the names of the families of interest.
* \param [in] renum - if \c true, the optional numbers of entities, if available, are
* returned instead of ids.
- * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or
+ * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or
* numbers, if available and required, of mesh entities of the families. The caller
* is to delete this array using decrRef() as it is no more needed.
* \throw If the family field is missing for \a meshDimRelToMaxExt.
*/
-DataArrayInt *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum) const
+DataArrayIdType *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum) const
{
- std::vector<int> famIds(getFamiliesIds(fams));
+ std::vector<mcIdType> famIds(getFamiliesIds(fams));
switch(meshDimRelToMaxExt)
{
case 1:
{
- if((const DataArrayInt *)_fam_nodes)
+ if((const DataArrayIdType *)_fam_nodes)
{
- MCAuto<DataArrayInt> da;
+ MCAuto<DataArrayIdType> da;
if(!famIds.empty())
da=_fam_nodes->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size());
else
}
case 0:
{
- if((const DataArrayInt *)_fam_cells)
+ if((const DataArrayIdType *)_fam_cells)
{
- MCAuto<DataArrayInt> da;
+ MCAuto<DataArrayIdType> da;
if(!famIds.empty())
da=_fam_cells->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size());
else
}
case -1:
{
- if((const DataArrayInt *)_fam_faces)
+ if((const DataArrayIdType *)_fam_faces)
{
- MCAuto<DataArrayInt> da;
+ MCAuto<DataArrayIdType> da;
if(!famIds.empty())
da=_fam_faces->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size());
else
* \throw If \a famArr has an invalid size.
* \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1 and \a meshDimRelToMaxExt != -1.
*/
-void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr)
+void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr)
{
const MEDCouplingStructuredMesh *mesh(getStructuredMesh());
if(!mesh)
{
case 0:
{
- int nbCells(mesh->getNumberOfCells());
+ mcIdType nbCells(mesh->getNumberOfCells());
if(famArr)
famArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setFamilyFieldArr : Problem in size of Family arr ! Mismatch with number of cells of mesh !");
_fam_cells=famArr;
}
case 1:
{
- int nbNodes(mesh->getNumberOfNodes());
+ mcIdType nbNodes(mesh->getNumberOfNodes());
if(famArr)
famArr->checkNbOfTuplesAndComp(nbNodes,1,"MEDFileStructuredMesh::setFamilyFieldArr : Problem in size of Family arr ! Mismatch with number of nodes of mesh !");
_fam_nodes=famArr;
}
case -1:
{
- int nbCells(mesh->getNumberOfCellsOfSubLevelMesh());
+ mcIdType nbCells(mesh->getNumberOfCellsOfSubLevelMesh());
if(famArr)
famArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setFamilyFieldArr : Problem in size of Family arr ! Mismatch with number of faces of mesh !");
_fam_faces=famArr;
* \throw If \a renumArr has an invalid size.
* \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1.
*/
-void MEDFileStructuredMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr)
+void MEDFileStructuredMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr)
{
const MEDCouplingStructuredMesh *mesh=getStructuredMesh();
if(!mesh)
{
case 0:
{
- int nbCells=mesh->getNumberOfCells();
+ mcIdType nbCells=mesh->getNumberOfCells();
renumArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setRenumFieldArr : Problem in size of Renum arr ! Mismatch with number of cells of mesh !");
_num_cells=renumArr;
break;
}
case 1:
{
- int nbNodes=mesh->getNumberOfNodes();
+ mcIdType nbNodes=mesh->getNumberOfNodes();
renumArr->checkNbOfTuplesAndComp(nbNodes,1,"MEDFileStructuredMesh::setRenumFieldArr : Problem in size of Family arr ! Mismatch with number of nodes of mesh !");
_num_nodes=renumArr;
break;
}
case -1:
{
- int nbCells=mesh->getNumberOfCellsOfSubLevelMesh();
+ mcIdType nbCells=mesh->getNumberOfCellsOfSubLevelMesh();
renumArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setRenumFieldArr : Problem in size of Renum arr ! Mismatch with number of faces of mesh !");
_num_faces=renumArr;
break;
{
case 0:
{
- int nbCells=mesh->getNumberOfCells();
+ mcIdType 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;
break;
}
case 1:
{
- int nbNodes=mesh->getNumberOfNodes();
+ mcIdType 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;
break;
}
case -1:
{
- int nbCells=mesh->getNumberOfCellsOfSubLevelMesh();
+ mcIdType nbCells=mesh->getNumberOfCellsOfSubLevelMesh();
nameArr->checkNbOfTuplesAndComp(nbCells,MED_SNAME_SIZE,"MEDFileStructuredMesh::setNameFieldAtLevel : Problem in size of names arr ! Mismatch with number of faces of mesh !");
_names_faces=nameArr;
}
nameArr->incrRef();
}
-void MEDFileStructuredMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr)
+void MEDFileStructuredMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr)
{
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::setGlobalNumFieldAtLevel : not implemented yet !");
}
/*!
* Adds a group of nodes to \a this mesh.
- * \param [in] ids - a DataArrayInt providing ids and a name of the group to add.
+ * \param [in] ids - a DataArrayIdType providing ids and a name of the group to add.
* The ids should be sorted and different each other (MED file norm).
*
* \warning this method can alter default "FAMILLE_ZERO" family.
* \throw If \a ids does not respect the MED file norm.
* \throw If a group with name \a ids->getName() already exists.
*/
-void MEDFileStructuredMesh::addNodeGroup(const DataArrayInt *ids)
+void MEDFileStructuredMesh::addNodeGroup(const DataArrayIdType *ids)
{
addGroup(1,ids);
}
/*!
* Adds a group of nodes/cells/faces/edges to \a this mesh.
*
- * \param [in] ids - a DataArrayInt providing ids and a name of the group to add.
+ * \param [in] ids - a DataArrayIdType providing ids and a name of the group to add.
* The ids should be sorted and different each other (MED file norm).
*
* \warning this method can alter default "FAMILLE_ZERO" family.
* \throw If \a ids does not respect the MED file norm.
* \throw If a group with name \a ids->getName() already exists.
*/
-void MEDFileStructuredMesh::addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids)
+void MEDFileStructuredMesh::addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids)
{
- DataArrayInt *fam(getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt));
+ DataArrayIdType *fam(getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt));
addGroupUnderground(false,ids,fam);
return ;
}
/*!
* Returns the family field for mesh entities of a given dimension.
* \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities.
- * \return const DataArrayInt * - the family field. It is an array of ids of families
+ * \return const DataArrayIdType * - the family field. It is an array of ids of families
* each mesh entity belongs to. It can be \c NULL.
* \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1.
*/
-const DataArrayInt *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
+const DataArrayIdType *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
{
switch(meshDimRelToMaxExt)
{
/*!
* Returns the family field for mesh entities of a given dimension.
* \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities.
- * \return const DataArrayInt * - the family field. It is an array of ids of families
+ * \return const DataArrayIdType * - the family field. It is an array of ids of families
* each mesh entity belongs to. It can be \c NULL.
* \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1.
*/
-DataArrayInt *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt)
+DataArrayIdType *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt)
{
switch(meshDimRelToMaxExt)
{
/*!
* Returns the optional numbers of mesh entities of a given dimension.
* \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities.
- * \return const DataArrayInt * - the array of the entity numbers.
+ * \return const DataArrayIdType * - the array of the entity numbers.
* \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh.
* \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1.
*/
-const DataArrayInt *MEDFileStructuredMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const
+const DataArrayIdType *MEDFileStructuredMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const
{
switch(meshDimRelToMaxExt)
{
/*!
* Returns the optional numbers of mesh entities of a given dimension transformed using
- * DataArrayInt::invertArrayN2O2O2N().
+ * DataArrayIdType::invertArrayN2O2O2N().
* \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities.
- * \return const DataArrayInt * - the array of the entity numbers transformed using
- * DataArrayInt::invertArrayN2O2O2N().
+ * \return const DataArrayIdType * - the array of the entity numbers transformed using
+ * DataArrayIdType::invertArrayN2O2O2N().
* \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1.
* \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh.
*/
-const DataArrayInt *MEDFileStructuredMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
+const DataArrayIdType *MEDFileStructuredMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
{
if(meshDimRelToMaxExt!=0 && meshDimRelToMaxExt!=1)
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getRevNumberFieldAtLevel : Only available for levels 0 or 1 !");
if(meshDimRelToMaxExt==0)
{
- if((const DataArrayInt *)_num_cells)
+ if((const DataArrayIdType *)_num_cells)
{
- int pos;
- int maxValue=_num_cells->getMaxValue(pos);
+ mcIdType pos;
+ mcIdType maxValue=_num_cells->getMaxValue(pos);
_rev_num_cells=_num_cells->invertArrayN2O2O2N(maxValue+1);
return _rev_num_cells;
}
}
else
{
- if((const DataArrayInt *)_num_nodes)
+ if((const DataArrayIdType *)_num_nodes)
{
- int pos;
- int maxValue=_num_nodes->getMaxValue(pos);
+ mcIdType pos;
+ mcIdType maxValue=_num_nodes->getMaxValue(pos);
_rev_num_nodes=_num_nodes->invertArrayN2O2O2N(maxValue+1);
return _rev_num_nodes;
}
}
}
-MCAuto<DataArrayInt> MEDFileStructuredMesh::getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
+MCAuto<DataArrayIdType> MEDFileStructuredMesh::getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
{
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getGlobalNumFieldAtLevel : not implemented yet for structured mesh !");
}
std::vector<int> MEDFileStructuredMesh::getFamArrNonEmptyLevelsExt() const
{
std::vector<int> ret;
- const DataArrayInt *famNodes(_fam_nodes),*famCells(_fam_cells),*famFaces(_fam_faces);
+ const DataArrayIdType *famNodes(_fam_nodes),*famCells(_fam_cells),*famFaces(_fam_faces);
if(famNodes)
ret.push_back(1);
if(famCells)
std::vector<int> MEDFileStructuredMesh::getNumArrNonEmptyLevelsExt() const
{
std::vector<int> ret;
- const DataArrayInt *numNodes(_num_nodes),*numCells(_num_cells),*numFaces(_num_faces);
+ const DataArrayIdType *numNodes(_num_nodes),*numCells(_num_cells),*numFaces(_num_faces);
if(numNodes)
ret.push_back(1);
if(numCells)
/*!
* no implementation here, it is not a bug, but intresically no polyhedra in \a this.
*/
-bool MEDFileStructuredMesh::unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell)
+bool MEDFileStructuredMesh::unPolyze(std::vector<mcIdType>& oldCode, std::vector<mcIdType>& newCode, DataArrayIdType *& o2nRenumCell)
{
oldCode.clear(); newCode.clear(); o2nRenumCell=0;
return false;
}
-void MEDFileStructuredMesh::changeFamilyIdArr(int oldId, int newId)
+void MEDFileStructuredMesh::changeFamilyIdArr(mcIdType oldId, mcIdType newId)
{
- DataArrayInt *arr=_fam_nodes;
+ DataArrayIdType *arr=_fam_nodes;
if(arr)
arr->changeValue(oldId,newId);
arr=_fam_cells;
arr->changeValue(oldId,newId);
}
-std::list< MCAuto<DataArrayInt> > MEDFileStructuredMesh::getAllNonNullFamilyIds() const
+std::list< MCAuto<DataArrayIdType> > MEDFileStructuredMesh::getAllNonNullFamilyIds() const
{
- std::list< MCAuto<DataArrayInt> > ret;
- const DataArrayInt *da(_fam_nodes);
+ std::list< MCAuto<DataArrayIdType> > ret;
+ const DataArrayIdType *da(_fam_nodes);
if(da)
- { da->incrRef(); ret.push_back(MCAuto<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
+ { da->incrRef(); ret.push_back(MCAuto<DataArrayIdType>(const_cast<DataArrayIdType *>(da))); }
da=_fam_cells;
if(da)
- { da->incrRef(); ret.push_back(MCAuto<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
+ { da->incrRef(); ret.push_back(MCAuto<DataArrayIdType>(const_cast<DataArrayIdType *>(da))); }
da=_fam_faces;
if(da)
- { da->incrRef(); ret.push_back(MCAuto<DataArrayInt>(const_cast<DataArrayInt *>(da))); }
+ { da->incrRef(); ret.push_back(MCAuto<DataArrayIdType>(const_cast<DataArrayIdType *>(da))); }
return ret;
}
void MEDFileStructuredMesh::deepCpyAttributes()
{
- if((const DataArrayInt*)_fam_nodes)
+ if((const DataArrayIdType*)_fam_nodes)
_fam_nodes=_fam_nodes->deepCopy();
- if((const DataArrayInt*)_num_nodes)
+ if((const DataArrayIdType*)_num_nodes)
_num_nodes=_num_nodes->deepCopy();
if((const DataArrayAsciiChar*)_names_nodes)
_names_nodes=_names_nodes->deepCopy();
- if((const DataArrayInt*)_fam_cells)
+ if((const DataArrayIdType*)_fam_cells)
_fam_cells=_fam_cells->deepCopy();
- if((const DataArrayInt*)_num_cells)
+ if((const DataArrayIdType*)_num_cells)
_num_cells=_num_cells->deepCopy();
if((const DataArrayAsciiChar*)_names_cells)
_names_cells=_names_cells->deepCopy();
- if((const DataArrayInt*)_fam_faces)
+ if((const DataArrayIdType*)_fam_faces)
_fam_faces=_fam_faces->deepCopy();
- if((const DataArrayInt*)_num_faces)
+ if((const DataArrayIdType*)_num_faces)
_num_faces=_num_faces->deepCopy();
if((const DataArrayAsciiChar*)_names_faces)
_names_faces=_names_faces->deepCopy();
- if((const DataArrayInt*)_rev_num_nodes)
+ if((const DataArrayIdType*)_rev_num_nodes)
_rev_num_nodes=_rev_num_nodes->deepCopy();
- if((const DataArrayInt*)_rev_num_cells)
+ if((const DataArrayIdType*)_rev_num_cells)
_rev_num_cells=_rev_num_cells->deepCopy();
}
}
}
-std::vector<int> MEDFileStructuredMesh::getFamsNonEmptyLevels(const std::vector<std::string>& fams) const
+std::vector<mcIdType> MEDFileStructuredMesh::getFamsNonEmptyLevels(const std::vector<std::string>& fams) const
{
- std::vector<int> ret;
- const DataArrayInt *famCells(_fam_cells),*famFaces(_fam_faces);
+ std::vector<mcIdType> ret;
+ const DataArrayIdType *famCells(_fam_cells),*famFaces(_fam_faces);
if(famCells && famCells->presenceOfValue(ret))
ret.push_back(0);
if(famFaces && famFaces->presenceOfValue(ret))
return ret;
}
-std::vector<int> MEDFileStructuredMesh::getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const
+std::vector<mcIdType> MEDFileStructuredMesh::getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const
{
- std::vector<int> ret(getFamsNonEmptyLevels(fams));
- const DataArrayInt *famNodes(_fam_nodes);
+ std::vector<mcIdType> ret(getFamsNonEmptyLevels(fams));
+ const DataArrayIdType *famNodes(_fam_nodes);
if(famNodes && famNodes->presenceOfValue(ret))
ret.push_back(1);
return ret;
/*!
* Returns number of mesh entities of a given relative dimension in \a this mesh.
* \param [in] meshDimRelToMaxExt - the relative dimension of interest.
- * \return int - the number of entities.
+ * \return mcIdType - the number of entities.
* \throw If no mesh entities of dimension \a meshDimRelToMaxExt are available in \a this mesh.
*/
-int MEDFileStructuredMesh::getSizeAtLevel(int meshDimRelToMaxExt) const
+mcIdType MEDFileStructuredMesh::getSizeAtLevel(int meshDimRelToMaxExt) const
{
const MEDCouplingStructuredMesh *cmesh(getStructuredMesh());
if(!cmesh)
}
}
-int MEDFileStructuredMesh::getNumberOfNodes() const
+mcIdType MEDFileStructuredMesh::getNumberOfNodes() const
{
const MEDCouplingStructuredMesh *cmesh(getStructuredMesh());
if(!cmesh)
return cmesh->getNumberOfNodes();
}
-int MEDFileStructuredMesh::getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const
+mcIdType MEDFileStructuredMesh::getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const
{
const MEDCouplingStructuredMesh *cmesh(getStructuredMesh());
if(!cmesh)
/*!
* \sa MEDFileStructuredMesh::getImplicitFaceMesh
*/
-int MEDFileStructuredMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const
+mcIdType MEDFileStructuredMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const
{
static const char MSG[]="MEDFileStructuredMesh::buildImplicitPartIfAny : the given geo type is not manageable by a structured mesh !";
const MEDCoupling1SGTUMesh *zeFaceMesh(_faces_if_necessary);
}
}
-int MEDFileStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const
+mcIdType MEDFileStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const
{
if(ct!=MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(getMeshDimension()))
return 0;
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::whichAreNodesFetched : The sturture of field is not lying on single geo type ! it is not managed yet for structured mesh !");
if(st[0].getGeo()!=MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(getMeshDimension()))
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::whichAreNodesFetched : The sturture of field is not lying on expected geo type !");
- if(getNumberOfNodes()!=(int)nodesFetched.size())
+ if(getNumberOfNodes()!=(mcIdType)nodesFetched.size())
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::whichAreNodesFetched : invalid size of array !");
if(st[0].getPflName().empty())
{
std::fill(nodesFetched.begin(),nodesFetched.end(),true);
return ;
}
- const DataArrayInt *arr(globs->getProfile(st[0].getPflName()));
+ const DataArrayIdType *arr(globs->getProfile(st[0].getPflName()));
const MEDCouplingStructuredMesh *cmesh=getStructuredMesh();//cmesh not null because getNumberOfNodes called before
- int sz(nodesFetched.size());
- for(const int *work=arr->begin();work!=arr->end();work++)
+ mcIdType sz(nodesFetched.size());
+ for(const mcIdType *work=arr->begin();work!=arr->end();work++)
{
- std::vector<int> conn;
+ std::vector<mcIdType> conn;
cmesh->getNodeIdsOfCell(*work,conn);
- for(std::vector<int>::const_iterator it=conn.begin();it!=conn.end();it++)
+ for(std::vector<mcIdType>::const_iterator it=conn.begin();it!=conn.end();it++)
if(*it>=0 && *it<sz)
nodesFetched[*it]=true;
else
}
void MEDFileStructuredMesh::LoadStrMeshDAFromFile(med_idt fid, int meshDim, int dt, int it, const std::string& mName, MEDFileMeshReadSelector *mrs,
- MCAuto<DataArrayInt>& famCells, MCAuto<DataArrayInt>& numCells, MCAuto<DataArrayAsciiChar>& namesCells)
+ MCAuto<DataArrayIdType>& famCells, MCAuto<DataArrayIdType>& numCells, MCAuto<DataArrayAsciiChar>& namesCells)
{
med_bool chgt=MED_FALSE,trsf=MED_FALSE;
med_geometry_type geoTypeReq=MEDFileStructuredMesh::GetGeoTypeFromMeshDim(meshDim);
- int nbOfElt(0);
+ mcIdType nbOfElt(0);
nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf);
if(nbOfElt>0)
{
if(!mrs || mrs->isCellFamilyFieldReading())
{
- famCells=DataArrayInt::New();
- famCells->alloc(nbOfElt,1);
- MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,famCells->getPointer()));
+ MCAuto<DataArrayMedInt> miFamCells=DataArrayMedInt::New();
+ miFamCells->alloc(nbOfElt,1);
+ MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,miFamCells->getPointer()));
+ famCells = FromMedIntArray<mcIdType>( miFamCells );
}
}
nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_NUMBER,MED_NODAL,&chgt,&trsf);
{
if(!mrs || mrs->isCellNumFieldReading())
{
- numCells=DataArrayInt::New();
- numCells->alloc(nbOfElt,1);
- MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,numCells->getPointer()));
+ MCAuto<DataArrayMedInt> miNumCells=DataArrayMedInt::New();
+ miNumCells->alloc(nbOfElt,1);
+ MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,miNumCells->getPointer()));
+ numCells = FromMedIntArray<mcIdType>( miNumCells );
}
}
nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_NAME,MED_NODAL,&chgt,&trsf);
setTimeUnit(strm->getTimeUnit());
MEDFileMeshL2::ReadFamiliesAndGrps(fid,mName,_families,_groups,mrs);
med_bool chgt=MED_FALSE,trsf=MED_FALSE;
- int nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf));
+ mcIdType nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf));
if(nbOfElt>0)
{
if(!mrs || mrs->isNodeFamilyFieldReading())
{
- int nbNodes(getNumberOfNodes());
+ mcIdType nbNodes(getNumberOfNodes());
if(nbOfElt>nbNodes)
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::loadStrMeshFromFile : invalid size of family node array regarding number of nodes in this ! File seems to be corrupted !");
- _fam_nodes=DataArrayInt::New();
- _fam_nodes->alloc(nbNodes,1);//yes nbNodes and not nbOfElt see next line.
+ MCAuto<DataArrayMedInt> miFamNodes=DataArrayMedInt::New();
+ miFamNodes->alloc(nbNodes,1);//yes nbNodes and not nbOfElt see next line.
if(nbNodes>nbOfElt)//yes it appends some times... It explains surely the mdump implementation. Bug revealed by PARAVIS EDF #2475 on structured.med file where only 12 first nodes are !=0 so nbOfElt=12 and nbOfNodes=378...
- _fam_nodes->fillWithZero();
- MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_fam_nodes->getPointer()));
+ miFamNodes->fillWithZero();
+ MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,miFamNodes->getPointer()));
+ _fam_nodes = FromMedIntArray<mcIdType>( miFamNodes );
}
}
nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_NUMBER,MED_NODAL,&chgt,&trsf);
{
if(!mrs || mrs->isNodeNumFieldReading())
{
- _num_nodes=DataArrayInt::New();
- _num_nodes->alloc(nbOfElt,1);
- MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_num_nodes->getPointer()));
+ MCAuto<DataArrayMedInt> miNumNodes=DataArrayMedInt::New();
+ miNumNodes->alloc(nbOfElt,1);
+ MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,miNumNodes->getPointer()));
+ _num_nodes = FromMedIntArray<mcIdType>( miNumNodes );
}
}
nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_NAME,MED_NODAL,&chgt,&trsf);
int meshDim(getStructuredMesh()->getMeshDimension());
med_geometry_type geoTypeReq(GetGeoTypeFromMeshDim(meshDim)),geoTypeReq2(GetGeoTypeFromMeshDim(meshDim-1));
//
- if((const DataArrayInt *)_fam_cells)
- MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_fam_cells->getNumberOfTuples(),_fam_cells->getConstPointer()));
- if((const DataArrayInt *)_fam_faces)
- MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_fam_faces->getNumberOfTuples(),_fam_faces->getConstPointer()));
- if((const DataArrayInt *)_fam_nodes)
- MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_fam_nodes->getNumberOfTuples(),_fam_nodes->getConstPointer()));
- if((const DataArrayInt *)_num_cells)
- MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_num_cells->getNumberOfTuples(),_num_cells->getConstPointer()));
- if((const DataArrayInt *)_num_faces)
- MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_num_faces->getNumberOfTuples(),_num_faces->getConstPointer()));
- if((const DataArrayInt *)_num_nodes)
- MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_num_nodes->getNumberOfTuples(),_num_nodes->getConstPointer()));
+ if((const DataArrayIdType *)_fam_cells)
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_fam_cells->getNumberOfTuples(),ToMedIntArray(_fam_cells)->getConstPointer()));
+ if((const DataArrayIdType *)_fam_faces)
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_fam_faces->getNumberOfTuples(),ToMedIntArray(_fam_faces)->getConstPointer()));
+ if((const DataArrayIdType *)_fam_nodes)
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_fam_nodes->getNumberOfTuples(),ToMedIntArray(_fam_nodes)->getConstPointer()));
+ if((const DataArrayIdType *)_num_cells)
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_num_cells->getNumberOfTuples(),ToMedIntArray(_num_cells)->getConstPointer()));
+ if((const DataArrayIdType *)_num_faces)
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_num_faces->getNumberOfTuples(),ToMedIntArray(_num_faces)->getConstPointer()));
+ if((const DataArrayIdType *)_num_nodes)
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_num_nodes->getNumberOfTuples(),ToMedIntArray(_num_nodes)->getConstPointer()));
if((const DataArrayAsciiChar *)_names_cells)
{
if(_names_cells->getNumberOfComponents()!=MED_SNAME_SIZE)
if(_univ_wr_status)
MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa));
MEDFILESAFECALLERWR0(MEDmeshGridTypeWr,(fid,maa,MED_CURVILINEAR_GRID));
- std::vector<int> nodeGridSt=_clmesh->getNodeGridStructure();
- MEDFILESAFECALLERWR0(MEDmeshGridStructWr,(fid,maa,_iteration,_order,_time,&nodeGridSt[0]));
+ std::vector<mcIdType> nodeGridSt=_clmesh->getNodeGridStructure();
+ MEDFILESAFECALLERWR0(MEDmeshGridStructWr,(fid,maa,_iteration,_order,_time,ToMedIntArray(nodeGridSt)->getConstPointer()));
MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,maa,_iteration,_order,_time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->begin()));
//
MEDLOADER_EXPORT void setAxisType(MEDCouplingAxisType at) { _axis_type=at; }
MEDLOADER_EXPORT MEDCouplingAxisType getAxisType() const { return _axis_type; }
MEDLOADER_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
- MEDLOADER_EXPORT virtual int getNumberOfNodes() const = 0;
- MEDLOADER_EXPORT virtual int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const = 0;
+ MEDLOADER_EXPORT virtual mcIdType getNumberOfNodes() const = 0;
+ MEDLOADER_EXPORT virtual mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const = 0;
MEDLOADER_EXPORT virtual bool hasImplicitPart() const = 0;
- MEDLOADER_EXPORT virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const = 0;
+ MEDLOADER_EXPORT virtual mcIdType buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const = 0;
MEDLOADER_EXPORT virtual void releaseImplicitPartIfAny() const = 0;
MEDLOADER_EXPORT virtual std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypesAtLevel(int meshDimRelToMax) const = 0;
- MEDLOADER_EXPORT virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const = 0;
+ MEDLOADER_EXPORT virtual mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const = 0;
MEDLOADER_EXPORT virtual std::vector<int> getNonEmptyLevels() const = 0;
MEDLOADER_EXPORT virtual std::vector<int> getNonEmptyLevelsExt() const = 0;
MEDLOADER_EXPORT virtual std::vector<int> getFamArrNonEmptyLevelsExt() const = 0;
MEDLOADER_EXPORT virtual std::vector<int> getNumArrNonEmptyLevelsExt() const = 0;
MEDLOADER_EXPORT virtual std::vector<int> getNameArrNonEmptyLevelsExt() const = 0;
- MEDLOADER_EXPORT virtual int getSizeAtLevel(int meshDimRelToMaxExt) const = 0;
+ MEDLOADER_EXPORT virtual mcIdType getSizeAtLevel(int meshDimRelToMaxExt) const = 0;
MEDLOADER_EXPORT virtual MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const = 0;
- MEDLOADER_EXPORT virtual std::vector<int> getDistributionOfTypes(int meshDimRelToMax) const;
+ MEDLOADER_EXPORT virtual std::vector<mcIdType> getDistributionOfTypes(int meshDimRelToMax) const;
MEDLOADER_EXPORT virtual void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const = 0;
MEDLOADER_EXPORT virtual MEDFileMesh *cartesianize() const = 0;
MEDLOADER_EXPORT virtual bool presenceOfStructureElements() const = 0;
MEDLOADER_EXPORT bool areFamsEqual(const MEDFileMesh *other, std::string& what) const;
MEDLOADER_EXPORT bool areGrpsEqual(const MEDFileMesh *other, std::string& what) const;
MEDLOADER_EXPORT bool existsGroup(const std::string& groupName) const;
- MEDLOADER_EXPORT bool existsFamily(int famId) const;
+ MEDLOADER_EXPORT bool existsFamily(mcIdType famId) const;
MEDLOADER_EXPORT bool existsFamily(const std::string& familyName) const;
- MEDLOADER_EXPORT void setFamilyId(const std::string& familyName, int id);
- MEDLOADER_EXPORT void setFamilyIdUnique(const std::string& familyName, int id);
- MEDLOADER_EXPORT virtual void addFamily(const std::string& familyName, int id);
+ MEDLOADER_EXPORT void setFamilyId(const std::string& familyName, mcIdType id);
+ MEDLOADER_EXPORT void setFamilyIdUnique(const std::string& familyName, mcIdType id);
+ MEDLOADER_EXPORT virtual void addFamily(const std::string& familyName, mcIdType id);
MEDLOADER_EXPORT virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName);
- MEDLOADER_EXPORT virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs);
+ MEDLOADER_EXPORT virtual bool keepFamIdsOnlyOnLevs(const std::vector<mcIdType>& famIds, const std::vector<int>& levs);
MEDLOADER_EXPORT void addFamilyOnGrp(const std::string& grpName, const std::string& famName);
- MEDLOADER_EXPORT std::string findOrCreateAndGiveFamilyWithId(int id, bool& created);
- MEDLOADER_EXPORT void setFamilyInfo(const std::map<std::string,int>& info);
+ MEDLOADER_EXPORT std::string findOrCreateAndGiveFamilyWithId(mcIdType id, bool& created);
+ MEDLOADER_EXPORT void setFamilyInfo(const std::map<std::string,mcIdType>& info);
MEDLOADER_EXPORT void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
MEDLOADER_EXPORT void copyFamGrpMapsFrom(const MEDFileMesh& other);
MEDLOADER_EXPORT void clearGrpMap();
MEDLOADER_EXPORT void clearFamMap();
MEDLOADER_EXPORT void clearFamGrpMaps();
- MEDLOADER_EXPORT const std::map<std::string,int>& getFamilyInfo() const { return _families; }
+ MEDLOADER_EXPORT const std::map<std::string,mcIdType>& getFamilyInfo() const { return _families; }
MEDLOADER_EXPORT const std::map<std::string, std::vector<std::string> >& getGroupInfo() const { return _groups; }
MEDLOADER_EXPORT std::vector<std::string> getFamiliesOnGroup(const std::string& name) const;
MEDLOADER_EXPORT std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const;
- MEDLOADER_EXPORT std::vector<int> getFamiliesIdsOnGroup(const std::string& name) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamiliesIdsOnGroup(const std::string& name) const;
MEDLOADER_EXPORT void setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams);
- MEDLOADER_EXPORT void setFamiliesIdsOnGroup(const std::string& name, const std::vector<int>& famIds);
+ MEDLOADER_EXPORT void setFamiliesIdsOnGroup(const std::string& name, const std::vector<mcIdType>& famIds);
MEDLOADER_EXPORT std::vector<std::string> getGroupsOnFamily(const std::string& name) const;
MEDLOADER_EXPORT void setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps);
MEDLOADER_EXPORT std::vector<std::string> getGroupsNames() const;
MEDLOADER_EXPORT std::vector<std::string> getFamiliesNames() const;
MEDLOADER_EXPORT std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const;
- MEDLOADER_EXPORT std::vector<int> getGrpNonEmptyLevelsExt(const std::string& grp) const;
- MEDLOADER_EXPORT std::vector<int> getGrpNonEmptyLevels(const std::string& grp) const;
- MEDLOADER_EXPORT std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
- MEDLOADER_EXPORT std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
- MEDLOADER_EXPORT virtual std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const = 0;
- MEDLOADER_EXPORT virtual std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const = 0;
- MEDLOADER_EXPORT std::vector<int> getFamNonEmptyLevels(const std::string& fam) const;
- MEDLOADER_EXPORT std::vector<int> getFamNonEmptyLevelsExt(const std::string& fam) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getGrpNonEmptyLevelsExt(const std::string& grp) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getGrpNonEmptyLevels(const std::string& grp) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
+ MEDLOADER_EXPORT virtual std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const = 0;
+ MEDLOADER_EXPORT virtual std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const = 0;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamNonEmptyLevels(const std::string& fam) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamNonEmptyLevelsExt(const std::string& fam) const;
MEDLOADER_EXPORT std::vector<std::string> getFamiliesNamesWithFilePointOfView() const;
MEDLOADER_EXPORT static std::string GetMagicFamilyStr();
MEDLOADER_EXPORT void assignFamilyNameWithGroupName();
MEDLOADER_EXPORT void checkOrphanFamilyZero() const;
MEDLOADER_EXPORT void changeGroupName(const std::string& oldName, const std::string& newName);
MEDLOADER_EXPORT void changeFamilyName(const std::string& oldName, const std::string& newName);
- MEDLOADER_EXPORT void changeFamilyId(int oldId, int newId);
+ MEDLOADER_EXPORT void changeFamilyId(mcIdType oldId, mcIdType newId);
MEDLOADER_EXPORT void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
- MEDLOADER_EXPORT int getFamilyId(const std::string& name) const;
- MEDLOADER_EXPORT int getMaxAbsFamilyId() const;
- MEDLOADER_EXPORT int getMaxFamilyId() const;
- MEDLOADER_EXPORT int getMinFamilyId() const;
- MEDLOADER_EXPORT int getTheMaxAbsFamilyId() const;
- MEDLOADER_EXPORT int getTheMaxFamilyId() const;
- MEDLOADER_EXPORT int getTheMinFamilyId() const;
- MEDLOADER_EXPORT virtual int getMaxAbsFamilyIdInArrays() const = 0;
- MEDLOADER_EXPORT virtual int getMaxFamilyIdInArrays() const = 0;
- MEDLOADER_EXPORT virtual int getMinFamilyIdInArrays() const = 0;
- MEDLOADER_EXPORT DataArrayInt *getAllFamiliesIdsReferenced() const;
- MEDLOADER_EXPORT DataArrayInt *computeAllFamilyIdsInUse() const;
- MEDLOADER_EXPORT std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const;
- MEDLOADER_EXPORT std::string getFamilyNameGivenId(int id) const;
+ MEDLOADER_EXPORT mcIdType getFamilyId(const std::string& name) const;
+ MEDLOADER_EXPORT mcIdType getMaxAbsFamilyId() const;
+ MEDLOADER_EXPORT mcIdType getMaxFamilyId() const;
+ MEDLOADER_EXPORT mcIdType getMinFamilyId() const;
+ MEDLOADER_EXPORT mcIdType getTheMaxAbsFamilyId() const;
+ MEDLOADER_EXPORT mcIdType getTheMaxFamilyId() const;
+ MEDLOADER_EXPORT mcIdType getTheMinFamilyId() const;
+ MEDLOADER_EXPORT virtual mcIdType getMaxAbsFamilyIdInArrays() const = 0;
+ MEDLOADER_EXPORT virtual mcIdType getMaxFamilyIdInArrays() const = 0;
+ MEDLOADER_EXPORT virtual mcIdType getMinFamilyIdInArrays() const = 0;
+ MEDLOADER_EXPORT DataArrayIdType *getAllFamiliesIdsReferenced() const;
+ MEDLOADER_EXPORT DataArrayIdType *computeAllFamilyIdsInUse() const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamiliesIds(const std::vector<std::string>& famNames) const;
+ MEDLOADER_EXPORT std::string getFamilyNameGivenId(mcIdType id) const;
MEDLOADER_EXPORT bool ensureDifferentFamIdsPerLevel();
MEDLOADER_EXPORT void normalizeFamIdsTrio();
MEDLOADER_EXPORT void normalizeFamIdsMEDFile();
MEDLOADER_EXPORT virtual std::string simpleRepr() const;
MEDLOADER_EXPORT virtual std::string advancedRepr() const = 0;
//
- MEDLOADER_EXPORT virtual void setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector<const DataArrayInt *>& grps, bool renum=false);
- MEDLOADER_EXPORT virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) = 0;
- MEDLOADER_EXPORT virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) = 0;
+ MEDLOADER_EXPORT virtual void setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector<const DataArrayIdType *>& grps, bool renum=false);
+ MEDLOADER_EXPORT virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr) = 0;
+ MEDLOADER_EXPORT virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr) = 0;
MEDLOADER_EXPORT virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) = 0;
- MEDLOADER_EXPORT virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr) = 0;
- MEDLOADER_EXPORT virtual void addNodeGroup(const DataArrayInt *ids) = 0;
- MEDLOADER_EXPORT virtual void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) = 0;
- MEDLOADER_EXPORT virtual const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const = 0;
- MEDLOADER_EXPORT virtual DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) = 0;
- MEDLOADER_EXPORT DataArrayInt *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt);
- MEDLOADER_EXPORT virtual const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0;
- MEDLOADER_EXPORT virtual const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0;
+ MEDLOADER_EXPORT virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr) = 0;
+ MEDLOADER_EXPORT virtual void addNodeGroup(const DataArrayIdType *ids) = 0;
+ MEDLOADER_EXPORT virtual void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids) = 0;
+ MEDLOADER_EXPORT virtual const DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const = 0;
+ MEDLOADER_EXPORT virtual DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) = 0;
+ MEDLOADER_EXPORT DataArrayIdType *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt);
+ MEDLOADER_EXPORT virtual const DataArrayIdType *getNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0;
+ MEDLOADER_EXPORT virtual const DataArrayIdType *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0;
MEDLOADER_EXPORT virtual const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const = 0;
- MEDLOADER_EXPORT virtual MCAuto<DataArrayInt> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const = 0;
- MEDLOADER_EXPORT virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const = 0;
- MEDLOADER_EXPORT virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
- MEDLOADER_EXPORT virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
- MEDLOADER_EXPORT virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
- MEDLOADER_EXPORT virtual DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const;
- MEDLOADER_EXPORT virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
- MEDLOADER_EXPORT virtual DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
- MEDLOADER_EXPORT virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
+ MEDLOADER_EXPORT virtual MCAuto<DataArrayIdType> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const = 0;
+ MEDLOADER_EXPORT virtual DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const = 0;
+ MEDLOADER_EXPORT virtual DataArrayIdType *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
+ MEDLOADER_EXPORT virtual DataArrayIdType *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
+ MEDLOADER_EXPORT virtual DataArrayIdType *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
+ MEDLOADER_EXPORT virtual DataArrayIdType *getNodeGroupArr(const std::string& grp, bool renum=false) const;
+ MEDLOADER_EXPORT virtual DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
+ MEDLOADER_EXPORT virtual DataArrayIdType *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
+ MEDLOADER_EXPORT virtual DataArrayIdType *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
// tools
- MEDLOADER_EXPORT virtual bool unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell) = 0;
+ MEDLOADER_EXPORT virtual bool unPolyze(std::vector<mcIdType>& oldCode, std::vector<mcIdType>& newCode, DataArrayIdType *& o2nRenumCell) = 0;
MEDLOADER_EXPORT int getNumberOfJoints() const;
MEDLOADER_EXPORT MEDFileJoints *getJoints() const;
MEDLOADER_EXPORT void setJoints( MEDFileJoints* joints );
void dealWithTinyInfo(const MEDCouplingMesh *m);
virtual void synchronizeTinyInfoOnLeaves() const = 0;
void getFamilyRepr(std::ostream& oss) const;
- virtual void appendFamilyEntries(const DataArrayInt *famIds, const std::vector< std::vector<int> >& fidsOfGrps, const std::vector<std::string>& grpNames);
- virtual void changeFamilyIdArr(int oldId, int newId) = 0;
- virtual std::list< MCAuto<DataArrayInt> > getAllNonNullFamilyIds() const = 0;
+ virtual void appendFamilyEntries(const DataArrayIdType *famIds, const std::vector< std::vector<mcIdType> >& fidsOfGrps, const std::vector<std::string>& grpNames);
+ virtual void changeFamilyIdArr(mcIdType oldId, mcIdType newId) = 0;
+ virtual std::list< MCAuto<DataArrayIdType> > getAllNonNullFamilyIds() const = 0;
virtual void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) = 0;
void loadLLWithAdditionalItems(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
- void addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, DataArrayInt *famArr);
- static void TranslateFamilyIds(int offset, DataArrayInt *famArr, std::vector< std::vector<int> >& famIdsPerGrp);
+ void addGroupUnderground(bool isNodeGroup, const DataArrayIdType *ids, DataArrayIdType *famArr);
+ static void TranslateFamilyIds(mcIdType offset, DataArrayIdType *famArr, std::vector< std::vector<mcIdType> >& famIdsPerGrp);
static void ChangeAllGroupsContainingFamily(std::map<std::string, std::vector<std::string> >& groups, const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
- static std::string FindOrCreateAndGiveFamilyWithId(std::map<std::string,int>& families, int id, bool& created);
+ static std::string FindOrCreateAndGiveFamilyWithId(std::map<std::string,mcIdType>& families, mcIdType id, bool& created);
static std::string CreateNameNotIn(const std::string& nameTry, const std::vector<std::string>& namesToAvoid);
- static int PutInThirdComponentOfCodeOffset(std::vector<int>& code, int strt);
+ static mcIdType PutInThirdComponentOfCodeOffset(std::vector<mcIdType>& code, mcIdType strt);
void writeJoints(med_idt fid) const;
void loadJointsFromFile(med_idt fid, MEDFileJoints *toUseInstedOfReading=0);
void loadEquivalences(med_idt fid);
bool areEquivalencesEqual(const MEDFileMesh *other, std::string& what) const;
void getEquivalencesRepr(std::ostream& oss) const;
void checkCartesian() const;
- void checkNoGroupClash(const DataArrayInt *famArr, const std::string& grpName) const;
+ void checkNoGroupClash(const DataArrayIdType *famArr, const std::string& grpName) const;
private:
virtual void writeMeshLL(med_idt fid) const = 0;
protected:
MCAuto<MEDFileEquivalences> _equiv;
protected:
std::map<std::string, std::vector<std::string> > _groups;
- std::map<std::string,int> _families;
+ std::map<std::string,mcIdType> _families;
public:
MEDLOADER_EXPORT static const char DFT_FAM_NAME[];
};
MEDLOADER_EXPORT static MEDFileUMesh *New(DataArrayByte *db) { return BuildFromMemoryChunk<MEDFileUMesh>(db); }
MEDLOADER_EXPORT static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem);
MEDLOADER_EXPORT static MEDFileUMesh *New();
- MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
- MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
MEDLOADER_EXPORT static const char *GetSpeStr4ExtMesh() { return SPE_FAM_STR_EXTRUDED_MESH; }
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDLOADER_EXPORT void setName(const std::string& name);
MEDLOADER_EXPORT const std::vector< MCAuto<MEDFileEltStruct4Mesh> >& getAccessOfUndergroundEltStrs() const { return _elt_str; }
//
- MEDLOADER_EXPORT int getMaxAbsFamilyIdInArrays() const;
- MEDLOADER_EXPORT int getMaxFamilyIdInArrays() const;
- MEDLOADER_EXPORT int getMinFamilyIdInArrays() const;
+ MEDLOADER_EXPORT mcIdType getMaxAbsFamilyIdInArrays() const;
+ MEDLOADER_EXPORT mcIdType getMaxFamilyIdInArrays() const;
+ MEDLOADER_EXPORT mcIdType getMinFamilyIdInArrays() const;
MEDLOADER_EXPORT int getMeshDimension() const;
MEDLOADER_EXPORT int getSpaceDimension() const;
MEDLOADER_EXPORT std::string simpleRepr() const;
MEDLOADER_EXPORT std::string advancedRepr() const;
- MEDLOADER_EXPORT int getSizeAtLevel(int meshDimRelToMaxExt) const;
- MEDLOADER_EXPORT const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const;
- MEDLOADER_EXPORT DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt);
- MEDLOADER_EXPORT const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const;
- MEDLOADER_EXPORT const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT mcIdType getSizeAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT const DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt);
+ MEDLOADER_EXPORT const DataArrayIdType *getNumberFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT const DataArrayIdType *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const;
MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const;
- MEDLOADER_EXPORT MCAuto<DataArrayInt> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT MCAuto<DataArrayIdType> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const;
MEDLOADER_EXPORT const PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const;
- MEDLOADER_EXPORT int getNumberOfNodes() const;
- MEDLOADER_EXPORT int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT mcIdType getNumberOfNodes() const;
+ MEDLOADER_EXPORT mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
MEDLOADER_EXPORT bool hasImplicitPart() const;
- MEDLOADER_EXPORT int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
+ MEDLOADER_EXPORT mcIdType buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
MEDLOADER_EXPORT void releaseImplicitPartIfAny() const;
MEDLOADER_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypesAtLevel(int meshDimRelToMax) const;
- MEDLOADER_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
+ MEDLOADER_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const;
MEDLOADER_EXPORT MEDFileMesh *cartesianize() const;
MEDLOADER_EXPORT bool presenceOfStructureElements() const;
MEDLOADER_EXPORT std::vector<int> getFamArrNonEmptyLevelsExt() const;
MEDLOADER_EXPORT std::vector<int> getNumArrNonEmptyLevelsExt() const;
MEDLOADER_EXPORT std::vector<int> getNameArrNonEmptyLevelsExt() const;
- MEDLOADER_EXPORT std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
- MEDLOADER_EXPORT std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
MEDLOADER_EXPORT DataArrayDouble *getCoords() const;
MEDLOADER_EXPORT MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
MEDLOADER_EXPORT MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
MEDLOADER_EXPORT MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
MEDLOADER_EXPORT MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
- MEDLOADER_EXPORT DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
+ MEDLOADER_EXPORT DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
MEDLOADER_EXPORT MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
- MEDLOADER_EXPORT std::vector<int> getDistributionOfTypes(int meshDimRelToMax) const;
- MEDLOADER_EXPORT std::vector< std::pair<int,int> > getAllDistributionOfTypes() const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getDistributionOfTypes(int meshDimRelToMax) const;
+ MEDLOADER_EXPORT std::vector< std::pair<int,mcIdType> > getAllDistributionOfTypes() const;
MEDLOADER_EXPORT MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const;
MEDLOADER_EXPORT MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const;
MEDLOADER_EXPORT MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const;
MEDLOADER_EXPORT void forceComputationOfParts() const;
MEDLOADER_EXPORT std::vector<MEDCoupling1GTUMesh *> getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const;
MEDLOADER_EXPORT MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const;
- MEDLOADER_EXPORT DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
- MEDLOADER_EXPORT DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
+ MEDLOADER_EXPORT DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
+ MEDLOADER_EXPORT DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
MEDLOADER_EXPORT int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
//
- MEDLOADER_EXPORT void setFamilyNameAttachedOnId(int id, const std::string& newFamName);
+ MEDLOADER_EXPORT void setFamilyNameAttachedOnId(mcIdType id, const std::string& newFamName);
MEDLOADER_EXPORT void setCoords(DataArrayDouble *coords);
MEDLOADER_EXPORT void setCoordsForced(DataArrayDouble *coords);
MEDLOADER_EXPORT void eraseGroupsAtLevel(int meshDimRelToMaxExt);
- MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr);
- MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr);
+ MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr);
+ MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr);
MEDLOADER_EXPORT void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
- MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr);
- MEDLOADER_EXPORT void addNodeGroup(const DataArrayInt *ids);
- MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids);
+ MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr);
+ MEDLOADER_EXPORT void addNodeGroup(const DataArrayIdType *ids);
+ MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids);
MEDLOADER_EXPORT void removeMeshAtLevel(int meshDimRelToMax);
MEDLOADER_EXPORT void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m);
MEDLOADER_EXPORT void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false);
MEDLOADER_EXPORT void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms, bool renum=false);
MEDLOADER_EXPORT void optimizeFamilies();
// tools
- MEDLOADER_EXPORT void buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayInt *&nodesDuplicated, DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified);
- MEDLOADER_EXPORT bool unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell);
- MEDLOADER_EXPORT DataArrayInt *zipCoords();
- MEDLOADER_EXPORT DataArrayInt *deduceNodeSubPartFromCellSubPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef) const;
- MEDLOADER_EXPORT MEDFileUMesh *extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef) const;
+ MEDLOADER_EXPORT void buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayIdType *&nodesDuplicated, DataArrayIdType *&cellsModified, DataArrayIdType *&cellsNotModified);
+ MEDLOADER_EXPORT bool unPolyze(std::vector<mcIdType>& oldCode, std::vector<mcIdType>& newCode, DataArrayIdType *& o2nRenumCell);
+ MEDLOADER_EXPORT DataArrayIdType *zipCoords();
+ MEDLOADER_EXPORT DataArrayIdType *deduceNodeSubPartFromCellSubPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef) const;
+ MEDLOADER_EXPORT MEDFileUMesh *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef) const;
MEDLOADER_EXPORT MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const;
MEDLOADER_EXPORT MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const;
MEDLOADER_EXPORT MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
MEDLOADER_EXPORT static MCAuto<MEDFileUMesh> Aggregate(const std::vector<const MEDFileUMesh *>& meshes);
MEDLOADER_EXPORT MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const;
// serialization
- MEDLOADER_EXPORT void serialize(std::vector<double>& tinyDouble, std::vector<int>& tinyInt, std::vector<std::string>& tinyStr,
- std::vector< MCAuto<DataArrayInt> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD);
- MEDLOADER_EXPORT void unserialize(std::vector<double>& tinyDouble, std::vector<int>& tinyInt, std::vector<std::string>& tinyStr,
- std::vector< MCAuto<DataArrayInt> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD);
+ MEDLOADER_EXPORT void serialize(std::vector<double>& tinyDouble, std::vector<mcIdType>& tinyInt, std::vector<std::string>& tinyStr,
+ std::vector< MCAuto<DataArrayIdType> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD);
+ MEDLOADER_EXPORT void unserialize(std::vector<double>& tinyDouble, std::vector<mcIdType>& tinyInt, std::vector<std::string>& tinyStr,
+ std::vector< MCAuto<DataArrayIdType> >& bigArraysI, MCAuto<DataArrayDouble>& bigArrayD);
private:
MEDLOADER_EXPORT ~MEDFileUMesh();
void writeMeshLL(med_idt fid) const;
MEDFileUMesh();
MEDFileUMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
- void loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+ void loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
void dispatchLoadedPart(med_idt fid, const MEDFileUMeshL2& loaderl2, const std::string& mName, MEDFileMeshReadSelector *mrs);
const MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMaxExt) const;
DataArrayDouble *checkMultiMesh(const std::vector<const MEDCouplingUMesh *>& ms) const;
void computeRevNum() const;
void synchronizeTinyInfoOnLeaves() const;
- void changeFamilyIdArr(int oldId, int newId);
- std::list< MCAuto<DataArrayInt> > getAllNonNullFamilyIds() const;
+ void changeFamilyIdArr(mcIdType oldId, mcIdType newId);
+ std::list< MCAuto<DataArrayIdType> > getAllNonNullFamilyIds() const;
MCAuto<MEDFileUMeshSplitL1>& checkAndGiveEntryInSplitL1(int meshDimRelToMax, MEDCouplingPointSet *m);
private:
static const char SPE_FAM_STR_EXTRUDED_MESH[];
private:
std::vector< MCAuto<MEDFileUMeshSplitL1> > _ms;
MCAuto<DataArrayDouble> _coords;
- MCAuto<DataArrayInt> _fam_coords; ///< Node family indices
- MCAuto<DataArrayInt> _num_coords;
- MCAuto<DataArrayInt> _global_num_coords;
+ MCAuto<DataArrayIdType> _fam_coords; ///< Node family indices
+ MCAuto<DataArrayIdType> _num_coords;
+ MCAuto<DataArrayIdType> _global_num_coords;
MCAuto<DataArrayAsciiChar> _name_coords;
- mutable MCAuto<DataArrayInt> _rev_num_coords;
+ mutable MCAuto<DataArrayIdType> _rev_num_coords;
MCAuto<PartDefinition> _part_coords;
std::vector< MCAuto<MEDFileEltStruct4Mesh> > _elt_str;
};
public:
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
- MEDLOADER_EXPORT int getMaxAbsFamilyIdInArrays() const;
- MEDLOADER_EXPORT int getMaxFamilyIdInArrays() const;
- MEDLOADER_EXPORT int getMinFamilyIdInArrays() const;
+ MEDLOADER_EXPORT mcIdType getMaxAbsFamilyIdInArrays() const;
+ MEDLOADER_EXPORT mcIdType getMaxFamilyIdInArrays() const;
+ MEDLOADER_EXPORT mcIdType getMinFamilyIdInArrays() const;
MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
MEDLOADER_EXPORT void clearNonDiscrAttributes() const;
- MEDLOADER_EXPORT DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
- MEDLOADER_EXPORT const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const;
- MEDLOADER_EXPORT DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt);
- MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr);
- MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr);
+ MEDLOADER_EXPORT DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
+ MEDLOADER_EXPORT const DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt);
+ MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr);
+ MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr);
MEDLOADER_EXPORT void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
- MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr);
- MEDLOADER_EXPORT void addNodeGroup(const DataArrayInt *ids);
- MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids);
- MEDLOADER_EXPORT const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const;
- MEDLOADER_EXPORT const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr);
+ MEDLOADER_EXPORT void addNodeGroup(const DataArrayIdType *ids);
+ MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids);
+ MEDLOADER_EXPORT const DataArrayIdType *getNumberFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT const DataArrayIdType *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const;
MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const;
- MEDLOADER_EXPORT MCAuto<DataArrayInt> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT MCAuto<DataArrayIdType> getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const;
MEDLOADER_EXPORT std::vector<int> getNonEmptyLevels() const;
MEDLOADER_EXPORT std::vector<int> getNonEmptyLevelsExt() const;
MEDLOADER_EXPORT std::vector<int> getFamArrNonEmptyLevelsExt() const;
MEDLOADER_EXPORT std::vector<int> getNumArrNonEmptyLevelsExt() const;
MEDLOADER_EXPORT std::vector<int> getNameArrNonEmptyLevelsExt() const;
MEDLOADER_EXPORT MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
- MEDLOADER_EXPORT std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
- MEDLOADER_EXPORT std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
- MEDLOADER_EXPORT int getSizeAtLevel(int meshDimRelToMaxExt) const;
- MEDLOADER_EXPORT int getNumberOfNodes() const;
- MEDLOADER_EXPORT int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
+ MEDLOADER_EXPORT std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
+ MEDLOADER_EXPORT mcIdType getSizeAtLevel(int meshDimRelToMaxExt) const;
+ MEDLOADER_EXPORT mcIdType getNumberOfNodes() const;
+ MEDLOADER_EXPORT mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const;
MEDLOADER_EXPORT bool hasImplicitPart() const;
- MEDLOADER_EXPORT int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
+ MEDLOADER_EXPORT mcIdType buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const;
MEDLOADER_EXPORT void releaseImplicitPartIfAny() const;
MEDLOADER_EXPORT MEDCoupling1SGTUMesh *getImplicitFaceMesh() const;
MEDLOADER_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypesAtLevel(int meshDimRelToMax) const;
- MEDLOADER_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
+ MEDLOADER_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const;
MEDLOADER_EXPORT bool presenceOfStructureElements() const { return false; }
MEDLOADER_EXPORT virtual const MEDCouplingStructuredMesh *getStructuredMesh() const = 0;
// tools
- MEDLOADER_EXPORT bool unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell);
+ MEDLOADER_EXPORT bool unPolyze(std::vector<mcIdType>& oldCode, std::vector<mcIdType>& newCode, DataArrayIdType *& o2nRenumCell);
protected:
~MEDFileStructuredMesh() { }
- void changeFamilyIdArr(int oldId, int newId);
- std::list< MCAuto<DataArrayInt> > getAllNonNullFamilyIds() const;
+ void changeFamilyIdArr(mcIdType oldId, mcIdType newId);
+ std::list< MCAuto<DataArrayIdType> > getAllNonNullFamilyIds() const;
void deepCpyAttributes();
void loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
void writeStructuredLL(med_idt fid, const std::string& maa) const;
static med_geometry_type GetGeoTypeFromMeshDim(int meshDim);
private:
static void LoadStrMeshDAFromFile(med_idt fid, int meshDim, int dt, int it, const std::string& mName, MEDFileMeshReadSelector *mrs,
- MCAuto<DataArrayInt>& famCells, MCAuto<DataArrayInt>& numCells, MCAuto<DataArrayAsciiChar>& namesCells);
+ MCAuto<DataArrayIdType>& famCells, MCAuto<DataArrayIdType>& numCells, MCAuto<DataArrayAsciiChar>& namesCells);
private:
- MCAuto<DataArrayInt> _fam_nodes;
- MCAuto<DataArrayInt> _num_nodes;
+ MCAuto<DataArrayIdType> _fam_nodes;
+ MCAuto<DataArrayIdType> _num_nodes;
MCAuto<DataArrayAsciiChar> _names_nodes;
- MCAuto<DataArrayInt> _fam_cells;
- MCAuto<DataArrayInt> _num_cells;
+ MCAuto<DataArrayIdType> _fam_cells;
+ MCAuto<DataArrayIdType> _num_cells;
MCAuto<DataArrayAsciiChar> _names_cells;
- MCAuto<DataArrayInt> _fam_faces;
- MCAuto<DataArrayInt> _num_faces;
+ MCAuto<DataArrayIdType> _fam_faces;
+ MCAuto<DataArrayIdType> _num_faces;
MCAuto<DataArrayAsciiChar> _names_faces;
- mutable MCAuto<DataArrayInt> _rev_num_nodes;
- mutable MCAuto<DataArrayInt> _rev_num_cells;
+ mutable MCAuto<DataArrayIdType> _rev_num_nodes;
+ mutable MCAuto<DataArrayIdType> _rev_num_cells;
mutable MCAuto<MEDCoupling1SGTUMesh> _faces_if_necessary;
};
#include "MEDFileMeshElt.hxx"
#include "MEDFileSafeCaller.txx"
#include "MEDFileMeshReadSelector.hxx"
+#include "MEDFileBasis.hxx"
#include "MEDCouplingUMesh.hxx"
{
if(!mrs || mrs->isCellFamilyFieldReading())
{
- _fam=DataArrayInt::New();
- _fam->alloc(curNbOfElem,1);
- if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,entity,geoElt,_fam->getPointer())!=0)
- std::fill(_fam->getPointer(),_fam->getPointer()+curNbOfElem,0);
+ MCAuto<DataArrayMedInt> miFam=DataArrayMedInt::New();
+ miFam->alloc(curNbOfElem,1);
+ if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,entity,geoElt,miFam->getPointer())!=0)
+ std::fill(miFam->getPointer(),miFam->getPointer()+curNbOfElem,0);
+ _fam=FromMedIntArray<mcIdType>( miFam );
}
}
_num=0;
{
if(!mrs || mrs->isCellNumFieldReading())
{
- _num=DataArrayInt::New();
- _num->alloc(curNbOfElem,1);
- if(MEDmeshEntityNumberRd(fid,mName,dt,it,entity,geoElt,_num->getPointer())!=0)
- _num=0;
+ MCAuto<DataArrayMedInt> miNum=DataArrayMedInt::New();
+ miNum->alloc(curNbOfElem,1);
+ if(MEDmeshEntityNumberRd(fid,mName,dt,it,entity,geoElt,miNum->getPointer())!=0)
+ miNum=0;
+ _num=FromMedIntArray<mcIdType>(miNum);
}
}
_names=0;
std::vector<const BigMemoryObject *> MEDFileUMeshPerTypeCommon::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- ret.push_back((const DataArrayInt *)_num);
- ret.push_back((const DataArrayInt *)_fam);
+ ret.push_back((const DataArrayIdType *)_num);
+ ret.push_back((const DataArrayIdType *)_fam);
ret.push_back((const DataArrayAsciiChar *)_names);
return ret;
}
{
_m=MEDCoupling1SGTUMesh::New(mName,type);
MEDCoupling1SGTUMesh *mc(dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh *)_m));
- MCAuto<DataArrayInt> conn(DataArrayInt::New());
+ MCAuto<DataArrayMedInt> conn(DataArrayMedInt::New());
int nbOfNodesPerCell(mc->getNumberOfNodesPerCell());
conn->alloc(nbOfNodesPerCell*curNbOfElem,1);
MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName,dt,it,entity,geoElt,MED_NODAL,MED_FULL_INTERLACE,conn->getPointer()));
std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<int>(),-1));
- mc->setNodalConnectivity(conn);
+ mc->setNodalConnectivity(FromMedIntArray<mcIdType>(conn));
loadCommonPart(fid,mName,dt,it,curNbOfElem,geoElt,entity,mrs);
}
int nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,end,step,"MEDFileUMeshPerType::loadPartStaticType"));
_m=MEDCoupling1SGTUMesh::New(mName,type);
MEDCoupling1SGTUMesh *mc(dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh *)_m));
- MCAuto<DataArrayInt> conn(DataArrayInt::New());
+ MCAuto<DataArrayMedInt> conn(DataArrayMedInt::New());
int nbOfNodesPerCell(mc->getNumberOfNodesPerCell());
conn->alloc(nbOfNodesPerCell*nbOfEltsToLoad,1);
med_filter filter=MED_FILTER_INIT;
MEDFILESAFECALLERRD0(MEDmeshElementConnectivityAdvancedRd,(fid,mName,dt,it,entity,geoElt,MED_NODAL,&filter,conn->getPointer()));
MEDfilterClose(&filter);
std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<int>(),-1));
- mc->setNodalConnectivity(conn);
+ mc->setNodalConnectivity(FromMedIntArray<mcIdType>(conn));
loadPartOfCellCommonPart(fid,mName,strt,end,step,dt,it,mdim,curNbOfElem,geoElt,entity,mrs);
}
{
if(!mrs || mrs->isCellFamilyFieldReading())
{
- _fam=DataArrayInt::New();
+ _fam=DataArrayIdType::New();
_fam->alloc(nbOfEltsToLoad,1);
med_filter filter=MED_FILTER_INIT;
MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/1,
{
if(!mrs || mrs->isCellNumFieldReading())
{
- _num=DataArrayInt::New();
+ _num=DataArrayIdType::New();
_num->alloc(nbOfEltsToLoad,1);
med_filter filter=MED_FILTER_INIT;
MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/1,
med_int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1);
_m=MEDCoupling1DGTUMesh::New(mName,geoElt==MED_POLYGON?INTERP_KERNEL::NORM_POLYGON:INTERP_KERNEL::NORM_QPOLYG);
MCAuto<MEDCoupling1DGTUMesh> mc(DynamicCast<MEDCoupling1GTUMesh,MEDCoupling1DGTUMesh>(_m));
- MCAuto<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New());
+ MCAuto<DataArrayMedInt> conn(DataArrayMedInt::New()),connI(DataArrayMedInt::New());
conn->alloc(arraySize,1); connI->alloc(curNbOfElem+1,1);
MEDFILESAFECALLERRD0(MEDmeshPolygon2Rd,(fid,mName,dt,it,MED_CELL,geoElt,MED_NODAL,connI->getPointer(),conn->getPointer()));
std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<int>(),-1));
std::transform(connI->begin(),connI->end(),connI->getPointer(),std::bind2nd(std::plus<int>(),-1));
- mc->setNodalConnectivity(conn,connI);
+ mc->setNodalConnectivity(FromMedIntArray<mcIdType>(conn),FromMedIntArray<mcIdType>(connI));
loadCommonPart(fid,mName,dt,it,curNbOfElem,geoElt,entity,mrs);
}
INTERP_KERNEL::AutoPtr<int> indexFace=new int[indexFaceLgth];
INTERP_KERNEL::AutoPtr<int> locConn=new int[connFaceLgth];
MEDFILESAFECALLERRD0(MEDmeshPolyhedronRd,(fid,mName,dt,it,MED_CELL,MED_NODAL,index,indexFace,locConn));
- MCAuto<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New());
+ MCAuto<DataArrayIdType> conn(DataArrayIdType::New()),connI(DataArrayIdType::New());
int arraySize=connFaceLgth;
for(int i=0;i<curNbOfElem;i++)
arraySize+=index[i+1]-index[i]-1;
- conn=DataArrayInt::New();
+ conn=DataArrayIdType::New();
conn->alloc(arraySize,1);
- int *wFinalConn=conn->getPointer();
+ mcIdType *wFinalConn=conn->getPointer();
connI->alloc(curNbOfElem+1,1);
- int *finalIndex(connI->getPointer());
+ mcIdType *finalIndex(connI->getPointer());
finalIndex[0]=0;
- for(int i=0;i<curNbOfElem;i++)
+ for(mcIdType i=0;i<curNbOfElem;i++)
{
finalIndex[i+1]=finalIndex[i]+index[i+1]-index[i]-1+indexFace[index[i+1]-1]-indexFace[index[i]-1];
- wFinalConn=std::transform(locConn+indexFace[index[i]-1]-1,locConn+indexFace[index[i]]-1,wFinalConn,std::bind2nd(std::plus<int>(),-1));
- for(int j=index[i];j<index[i+1]-1;j++)
+ wFinalConn=std::transform(locConn+indexFace[index[i]-1]-1,locConn+indexFace[index[i]]-1,wFinalConn,std::bind2nd(std::plus<mcIdType>(),-1));
+ for(mcIdType j=index[i];j<index[i+1]-1;j++)
{
*wFinalConn++=-1;
- wFinalConn=std::transform(locConn+indexFace[j]-1,locConn+indexFace[j+1]-1,wFinalConn,std::bind2nd(std::plus<int>(),-1));
+ wFinalConn=std::transform(locConn+indexFace[j]-1,locConn+indexFace[j+1]-1,wFinalConn,std::bind2nd(std::plus<mcIdType>(),-1));
}
}
mc->setNodalConnectivity(conn,connI);
loadCommonPart(fid,mName,dt,it,curNbOfElem,MED_POLYHEDRON,entity,mrs);
}
-void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names)
+void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayIdType *fam, const DataArrayIdType *num, const DataArrayAsciiChar *names)
{
int nbOfCells=m->getNumberOfCells();
if(nbOfCells<1)
const MEDCoupling1SGTUMesh *m0(dynamic_cast<const MEDCoupling1SGTUMesh *>(m));
if(!m0)
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #1 !");
- MCAuto<DataArrayInt> arr(m0->getNodalConnectivity()->deepCopy());
+ MCAuto<DataArrayMedInt> arr(DataArrayMedInt::Copy(m0->getNodalConnectivity()));
std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus<int>(),1));
MEDFILESAFECALLERWR0(MEDmeshElementConnectivityWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,nbOfCells,arr->begin()));
}
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #2 !");
if(ikt==INTERP_KERNEL::NORM_POLYGON || ikt==INTERP_KERNEL::NORM_QPOLYG)
{
- MCAuto<DataArrayInt> arr(m0->getNodalConnectivity()->deepCopy()),arrI(m0->getNodalConnectivityIndex()->deepCopy());
+ MCAuto<DataArrayMedInt> arr(DataArrayMedInt::Copy(m0->getNodalConnectivity())),arrI(DataArrayMedInt::Copy(m0->getNodalConnectivityIndex()));
std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus<int>(),1));
std::transform(arrI->begin(),arrI->end(),arrI->getPointer(),std::bind2nd(std::plus<int>(),1));
MEDFILESAFECALLERWR0(MEDmeshPolygon2Wr,(fid,mname.c_str(),dt,it,timm,MED_CELL,ikt==INTERP_KERNEL::NORM_POLYGON?MED_POLYGON:MED_POLYGON2,MED_NODAL,nbOfCells+1,arrI->begin(),arr->begin()));
}
else
{
- const int *conn(m0->getNodalConnectivity()->begin()),*connI(m0->getNodalConnectivityIndex()->begin());
- int meshLgth=m0->getNodalConnectivityLength();
- int nbOfFaces=std::count(conn,conn+meshLgth,-1)+nbOfCells;
- INTERP_KERNEL::AutoPtr<int> tab1=new int[nbOfCells+1];
- int *w1=tab1; *w1=1;
- INTERP_KERNEL::AutoPtr<int> tab2=new int[nbOfFaces+1];
- int *w2=tab2; *w2=1;
- INTERP_KERNEL::AutoPtr<int> bigtab=new int[meshLgth];
- int *bt=bigtab;
- for(int i=0;i<nbOfCells;i++,w1++)
+ const mcIdType *conn(m0->getNodalConnectivity()->begin()),*connI(m0->getNodalConnectivityIndex()->begin());
+ mcIdType meshLgth=m0->getNodalConnectivityLength();
+ mcIdType nbOfFaces=std::count(conn,conn+meshLgth,-1)+nbOfCells;
+ INTERP_KERNEL::AutoPtr<med_int> tab1=new med_int[nbOfCells+1];
+ med_int *w1=tab1; *w1=1;
+ INTERP_KERNEL::AutoPtr<med_int> tab2=new med_int[nbOfFaces+1];
+ med_int *w2=tab2; *w2=1;
+ INTERP_KERNEL::AutoPtr<med_int> bigtab=new med_int[meshLgth];
+ med_int *bt=bigtab;
+ for(mcIdType i=0;i<nbOfCells;i++,w1++)
{
int nbOfFaces2=0;
- for(const int *w=conn+connI[i];w!=conn+connI[i+1];w2++)
+ for(const mcIdType *w=conn+connI[i];w!=conn+connI[i+1];w2++)
{
- const int *wend=std::find(w,conn+connI[i+1],-1);
- bt=std::transform(w,wend,bt,std::bind2nd(std::plus<int>(),1));
+ const mcIdType *wend=std::find(w,conn+connI[i+1],-1);
+ bt=std::transform(w,wend,bt,std::bind2nd(std::plus<mcIdType>(),1));
int nbOfNode=std::distance(w,wend);
w2[1]=w2[0]+nbOfNode;
if(wend!=conn+connI[i+1])
}
}
if(fam)
- MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,fam->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,ToMedIntArray<mcIdType>(fam)->getConstPointer()));
if(num)
- MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,num->getConstPointer()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,ToMedIntArray<mcIdType>(num)->getConstPointer()));
if(names)
{
if(names->getNumberOfComponents()!=MED_SNAME_SIZE)
med_entity_type entity, MEDFileMeshReadSelector *mrs);
std::size_t getHeapMemorySizeWithoutChildren() const;
std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
- const DataArrayInt *getFam() const { return _fam; }
- const DataArrayInt *getNum() const { return _num; }
+ const DataArrayIdType *getFam() const { return _fam; }
+ const DataArrayIdType *getNum() const { return _num; }
const DataArrayAsciiChar *getNames() const { return _names; }
protected:
- MCAuto<DataArrayInt> _num;
- MCAuto<DataArrayInt> _fam;
+ MCAuto<DataArrayIdType> _num;
+ MCAuto<DataArrayIdType> _fam;
MCAuto<DataArrayAsciiChar> _names;
};
int getDim() const;
MEDCoupling1GTUMesh *getMesh() const { return const_cast<MEDCoupling1GTUMesh *>((const MEDCoupling1GTUMesh *)_m); }
const PartDefinition *getPartDef() const { return _pd; }
- static void Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names);
+ static void Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayIdType *fam, const DataArrayIdType *num, const DataArrayAsciiChar *names);
private:
MEDFileUMeshPerType();
MEDFileUMeshPerType(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
{
meshType=UNSTRUCTURED;
dt=MED_NO_DT; it=MED_NO_IT; dtunit1.clear();
- axType=axType=TraduceAxisType(axistype);
+ axType=TraduceAxisType(axistype);
return new StructMeshCls(ret);
}
default:
return mId->getAxisInfoOnMesh(fid,mName,meshType,axType,nstep,Mdim,_description,_dt_unit,_univ_name);
}
-void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const std::string& meshName, std::map<std::string,int>& fams, std::map<std::string, std::vector<std::string> >& grps, MEDFileMeshReadSelector *mrs)
+void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const std::string& meshName, std::map<std::string,mcIdType>& fams, std::map<std::string, std::vector<std::string> >& grps, MEDFileMeshReadSelector *mrs)
{
if(mrs && !(mrs->isCellFamilyFieldReading() || mrs->isNodeFamilyFieldReading()))
return ;
char nomfam[MED_NAME_SIZE+1];
med_int numfam;
- int nfam=MEDnFamily(fid,meshName.c_str());
- std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > > crudeFams(nfam);
- for(int i=0;i<nfam;i++)
+ mcIdType nfam=MEDnFamily(fid,meshName.c_str());
+ std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > > crudeFams(nfam);
+ for(mcIdType i=0;i<nfam;i++)
{
int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
crudeFams[i]=std::pair<std::string,std::pair<int,std::vector<std::string> > >(famName,std::pair<int,std::vector<std::string> >(numfam,grps));
}
RenameFamiliesFromFileToMemInternal(crudeFams);
- for(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >::const_iterator it0=crudeFams.begin();it0!=crudeFams.end();it0++)
+ for(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >::const_iterator it0=crudeFams.begin();it0!=crudeFams.end();it0++)
{
fams[(*it0).first]=(*it0).second.first;
for(std::vector<std::string>::const_iterator it1=(*it0).second.second.begin();it1!=(*it0).second.second.end();it1++)
}
}
-void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map<std::string,int>& fams, const std::map<std::string, std::vector<std::string> >& grps, int tooLongStrPol)
+void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map<std::string,mcIdType>& fams, const std::map<std::string, std::vector<std::string> >& grps, int tooLongStrPol)
{
- std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > > crudeFams(fams.size());
+ std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > > crudeFams(fams.size());
std::size_t ii(0);
- for(std::map<std::string,int>::const_iterator it=fams.begin();it!=fams.end();it++,ii++)
+ for(std::map<std::string,mcIdType>::const_iterator it=fams.begin();it!=fams.end();it++,ii++)
{
std::vector<std::string> grpsOfFam;
for(std::map<std::string, std::vector<std::string> >::const_iterator it1=grps.begin();it1!=grps.end();it1++)
if(std::find((*it1).second.begin(),(*it1).second.end(),(*it).first)!=(*it1).second.end())
grpsOfFam.push_back((*it1).first);
}
- crudeFams[ii]=std::pair<std::string,std::pair<int,std::vector<std::string> > >((*it).first,std::pair<int,std::vector<std::string> >((*it).second,grpsOfFam));
+ crudeFams[ii]=std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > >((*it).first,std::pair<mcIdType,std::vector<std::string> >((*it).second,grpsOfFam));
}
RenameFamiliesFromMemToFileInternal(crudeFams);
- for(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++)
+ for(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++)
{
- int ngro((*it).second.second.size());
+ mcIdType ngro((*it).second.second.size());
INTERP_KERNEL::AutoPtr<char> groName=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE*ngro);
int i=0;
for(std::vector<std::string>::const_iterator it2=(*it).second.second.begin();it2!=(*it).second.second.end();it2++,i++)
}
}
-void MEDFileMeshL2::RenameFamiliesPatternInternal(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >& crudeFams, RenameFamiliesPatternFunc func)
+void MEDFileMeshL2::RenameFamiliesPatternInternal(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >& crudeFams, RenameFamiliesPatternFunc func)
{
std::size_t ii(0);
std::vector<std::string> fams(crudeFams.size());
- for(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++,ii++)
+ for(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++,ii++)
fams[ii]=(*it).first;
if(!func(fams))
return ;
ii=0;
- for(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >::iterator it=crudeFams.begin();it!=crudeFams.end();it++,ii++)
+ for(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >::iterator it=crudeFams.begin();it!=crudeFams.end();it++,ii++)
(*it).first=fams[ii];
}
* This method is dedicated to the killers that use a same family name to store different family ids. MED file API authorizes it.
* So this method renames families (if needed generally not !) in order to have a discriminant name for families.
*/
-void MEDFileMeshL2::RenameFamiliesFromFileToMemInternal(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >& crudeFams)
+void MEDFileMeshL2::RenameFamiliesFromFileToMemInternal(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >& crudeFams)
{
RenameFamiliesPatternInternal(crudeFams,RenameFamiliesFromFileToMem);
}
bool MEDFileMeshL2::RenameFamiliesFromFileToMem(std::vector< std::string >& famNames)
{
- std::map<std::string,int> m;
+ std::map<std::string,mcIdType> m;
std::set<std::string> s;
for(std::vector< std::string >::const_iterator it=famNames.begin();it!=famNames.end();it++)
{
return false;// the general case !
for(std::vector< std::string >::iterator it=famNames.begin();it!=famNames.end();it++)
{
- std::map<std::string,int>::iterator it2(m.find(*it));
+ std::map<std::string,mcIdType>::iterator it2(m.find(*it));
if(it2!=m.end())
{
std::ostringstream oss; oss << *it << ZE_SEP_FOR_FAMILY_KILLERS << std::setfill('0') << std::setw(ZE_SEP2_FOR_FAMILY_KILLERS) << (*it2).second++;
* This method is dedicated to the killers that use a same family name to store different family ids. MED file API authorizes it.
* So this method renames families (if needed generally not !) in order to have a discriminant name for families.
*/
-void MEDFileMeshL2::RenameFamiliesFromMemToFileInternal(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >& crudeFams)
+void MEDFileMeshL2::RenameFamiliesFromMemToFileInternal(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >& crudeFams)
{
RenameFamiliesPatternInternal(crudeFams,RenameFamiliesFromMemToFile);
}
if(found!=std::string::npos && found>=1)
{
std::string s1((*it).substr(found+sizeof(ZE_SEP_FOR_FAMILY_KILLERS)-1));
- if(s1.size()!=ZE_SEP2_FOR_FAMILY_KILLERS)
+ if((int)s1.size()!=ZE_SEP2_FOR_FAMILY_KILLERS)
continue;
int k(-1);
std::istringstream iss(s1);
loadCoords(fid,infosOnComp,mName,dt,it);
}
-void MEDFileUMeshL2::loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
+void MEDFileUMeshL2::loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
{
int Mdim;
std::vector<std::string> infosOnComp(loadCommonPart(fid,mId,mName,dt,it,Mdim));
return ;
loadPartOfConnectivity(fid,Mdim,mName,types,slicPerTyp,dt,it,mrs);
med_bool changement,transformation;
- int nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
+ mcIdType nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation));
std::vector<bool> fetchedNodeIds(nCoords,false);
for(std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++)
for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
(*it1)->getMesh()->computeNodeIdsAlg(fetchedNodeIds);
- int nMin(std::distance(fetchedNodeIds.begin(),std::find(fetchedNodeIds.begin(),fetchedNodeIds.end(),true)));
- int nMax(std::distance(fetchedNodeIds.rbegin(),std::find(fetchedNodeIds.rbegin(),fetchedNodeIds.rend(),true)));
+ mcIdType nMin(std::distance(fetchedNodeIds.begin(),std::find(fetchedNodeIds.begin(),fetchedNodeIds.end(),true)));
+ mcIdType nMax(std::distance(fetchedNodeIds.rbegin(),std::find(fetchedNodeIds.rbegin(),fetchedNodeIds.rend(),true)));
nMax=nCoords-nMax;
for(std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++)
for(std::vector< MCAuto<MEDFileUMeshPerType> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
sortTypes();
}
-void MEDFileUMeshL2::loadPartOfConnectivity(med_idt fid, int mdim, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
+void MEDFileUMeshL2::loadPartOfConnectivity(med_idt fid, int mdim, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs)
{
std::size_t nbOfTypes(types.size());
if(slicPerTyp.size()!=3*nbOfTypes)
_per_type_mesh[0].clear();
for(std::size_t ii=0;ii<nbOfTypes;ii++)
{
- int strt(slicPerTyp[3*ii+0]),stp(slicPerTyp[3*ii+1]),step(slicPerTyp[3*ii+2]);
+ mcIdType strt(slicPerTyp[3*ii+0]),stp(slicPerTyp[3*ii+1]),step(slicPerTyp[3*ii+2]);
MCAuto<MEDFileUMeshPerType> tmp(MEDFileUMeshPerType::NewPart(fid,mName.c_str(),dt,it,mdim,types[ii],strt,stp,step,mrs));
_per_type_mesh[0].push_back(tmp);
}
MEDFILESAFECALLERRD0(MEDmeshNodeCoordinateRd,(fid,mName.c_str(),dt,it,MED_FULL_INTERLACE,coordsPtr));
if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
- _fam_coords=DataArrayInt::New();
- _fam_coords->alloc(nCoords,1);
- MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_fam_coords->getPointer()));
+ MCAuto<DataArrayMedInt> miFamCoord=DataArrayMedInt::New();
+ miFamCoord->alloc(nCoords,1);
+ MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,miFamCoord->getPointer()));
+ _fam_coords=FromMedIntArray<mcIdType>(miFamCoord);
}
else
_fam_coords=0;
if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
- _num_coords=DataArrayInt::New();
- _num_coords->alloc(nCoords,1);
- MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_num_coords->getPointer()));
+ MCAuto<DataArrayMedInt> miNumCoord=DataArrayMedInt::New();
+ miNumCoord->alloc(nCoords,1);
+ MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,miNumCoord->getPointer()));
+ _num_coords=FromMedIntArray<mcIdType>(miNumCoord);
}
else
_num_coords=0;
_name_coords=0;
if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_GLOBAL_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
- _global_num_coords=DataArrayInt::New();
- _global_num_coords->alloc(nCoords,1);
- MEDFILESAFECALLERRD0(MEDmeshGlobalNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_global_num_coords->getPointer()));
+ MCAuto<DataArrayMedInt> miNumCoord=DataArrayMedInt::New();
+ miNumCoord->alloc(nCoords,1);
+ MEDFILESAFECALLERRD0(MEDmeshGlobalNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,miNumCoord->getPointer()));
+ _global_num_coords=FromMedIntArray<mcIdType>(miNumCoord);
}
for(int i=0;i<spaceDim;i++)
_coords->setInfoOnComponent(i,infosOnComp[i]);
MED_NO_PROFILE,nMin+1,1,1,nbNodesToLoad,0,&filter2);
if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
- _fam_coords=DataArrayInt::New();
- _fam_coords->alloc(nbNodesToLoad,1);
- MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_FAMILY_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,_fam_coords->getPointer()));
+ MCAuto<DataArrayMedInt> miFamCoord=DataArrayMedInt::New();
+ miFamCoord->alloc(nbNodesToLoad,1);
+ MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_FAMILY_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,miFamCoord->getPointer()));
+ _fam_coords=FromMedIntArray<mcIdType>(miFamCoord);
}
else
_fam_coords=0;
if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
- _num_coords=DataArrayInt::New();
- _num_coords->alloc(nbNodesToLoad,1);
- MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,_num_coords->getPointer()));
+ MCAuto<DataArrayMedInt> miNumCoord=DataArrayMedInt::New();
+ miNumCoord->alloc(nbNodesToLoad,1);
+ MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,miNumCoord->getPointer()));
+ _num_coords=FromMedIntArray<mcIdType>(miNumCoord);
}
else
_num_coords=0;
_per_type_mesh.resize(_per_type_mesh.size()-nbOfUselessLev);
}
-void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayInt *globalNumCoords)
+void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayIdType *famCoords, const DataArrayIdType *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayIdType *globalNumCoords)
{
if(!coords)
return ;
MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->begin()));
if(famCoords)
- MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),famCoords->begin()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),ToMedIntArray<mcIdType>(famCoords)->begin()));
if(numCoords)
- MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),numCoords->begin()));
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),ToMedIntArray<mcIdType>(numCoords)->begin()));
if(nameCoords)
{
if(nameCoords->getNumberOfComponents()!=MED_SNAME_SIZE)
MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->begin()));
}
if(globalNumCoords)
- MEDFILESAFECALLERWR0(MEDmeshGlobalNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NONE,globalNumCoords->getNumberOfTuples(),globalNumCoords->begin()));
+ MEDFILESAFECALLERWR0(MEDmeshGlobalNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NONE,globalNumCoords->getNumberOfTuples(),ToMedIntArray<mcIdType>(globalNumCoords)->begin()));
}
bool MEDFileUMeshL2::isFamDefinedOnLev(int levId) const
_order=it;
//
_clmesh=MEDCouplingCurveLinearMesh::New();
- INTERP_KERNEL::AutoPtr<int> stGrid=new int[Mdim];
- MEDFILESAFECALLERRD0(MEDmeshGridStructRd,(fid,mName.c_str(),dt,it,stGrid));
- _clmesh->setNodeGridStructure(stGrid,((int *)stGrid)+Mdim);
+ MCAuto<DataArrayMedInt> miStGrid=DataArrayMedInt::New();
+ miStGrid->alloc(Mdim,1);
+ MEDFILESAFECALLERRD0(MEDmeshGridStructRd,(fid,mName.c_str(),dt,it,miStGrid->getPointer()));
+ MCAuto<DataArrayIdType> stGrid=FromMedIntArray<mcIdType>(miStGrid);
+ _clmesh->setNodeGridStructure(stGrid->begin(),stGrid->end());
med_bool chgt=MED_FALSE,trsf=MED_FALSE;
int nbNodes(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf));
MCAuto<DataArrayDouble> da=DataArrayDouble::New();
return;
int sz=v.size();
std::vector<const MEDCoupling1GTUMesh *> ms(sz);
- std::vector<const DataArrayInt *> fams(sz),nums(sz);
+ std::vector<const DataArrayIdType *> fams(sz),nums(sz);
std::vector<const DataArrayChar *> names(sz);
std::vector<const PartDefinition *> pds(sz);
for(int i=0;i<sz;i++)
for(int i=0;i<sz;i++)
fams[i]=v[i]->getFam();
if(sz!=1)
- _fam=DataArrayInt::Aggregate(fams);
+ _fam=DataArrayIdType::Aggregate(fams);
else
{
fams[0]->incrRef();
- _fam=const_cast<DataArrayInt *>(fams[0]);
+ _fam=const_cast<DataArrayIdType *>(fams[0]);
}
}
if(l2.isNumDefinedOnLev(id))
for(int i=0;i<sz;i++)
nums[i]=v[i]->getNum();
if(sz!=1)
- _num=DataArrayInt::Aggregate(nums);
+ _num=DataArrayIdType::Aggregate(nums);
else
{
nums[0]->incrRef();
- _num=const_cast<DataArrayInt *>(nums[0]);
+ _num=const_cast<DataArrayIdType *>(nums[0]);
}
computeRevNum();
}
std::vector<const BigMemoryObject *> ret;
ret.push_back(&_m_by_types);
ret.push_back(&_m);
- ret.push_back((const DataArrayInt*)_fam);
- ret.push_back((const DataArrayInt*)_num);
- ret.push_back((const DataArrayInt*)_rev_num);
+ ret.push_back((const DataArrayIdType*)_fam);
+ ret.push_back((const DataArrayIdType*)_num);
+ ret.push_back((const DataArrayIdType*)_rev_num);
ret.push_back((const DataArrayAsciiChar*)_names);
return ret;
}
{
MCAuto<MEDFileUMeshSplitL1> ret(new MEDFileUMeshSplitL1(*this));
ret->_m_by_types=_m_by_types.deepCopy(coords);
- if((const DataArrayInt *)_fam)
+ if((const DataArrayIdType *)_fam)
ret->_fam=_fam->deepCopy();
- if((const DataArrayInt *)_num)
+ if((const DataArrayIdType *)_num)
ret->_num=_num->deepCopy();
- if((const DataArrayInt *)_rev_num)
+ if((const DataArrayIdType *)_rev_num)
ret->_rev_num=_rev_num->deepCopy();
if((const DataArrayAsciiChar *)_names)
ret->_names=_names->deepCopy();
{
if (!_fam || _fam->getNumberOfTuples() != getSize())
throw INTERP_KERNEL::Exception("MEDFileUMeshSplitL1::checkConsistency(): internal family array has an invalid size!");
- int nbCells = getSize();
+ mcIdType nbCells = getSize();
if (_num)
{
_num->checkNbOfTuplesAndComp(nbCells,1,"MEDFileUMeshSplitL1::checkConsistency(): inconsistent internal node numbering array!");
- int pos;
- int maxValue=_num->getMaxValue(pos);
+ mcIdType pos;
+ mcIdType maxValue=_num->getMaxValue(pos);
if (!_rev_num || _rev_num->getNumberOfTuples() != (maxValue+1))
throw INTERP_KERNEL::Exception("MEDFileUMeshSplitL1::checkConsistency(): inconsistent internal revert node numbering array!");
}
{
if(!_m_by_types.isEqual(other->_m_by_types,eps,what))
return false;
- const DataArrayInt *d1=_fam;
- const DataArrayInt *d2=other->_fam;
+ const DataArrayIdType *d1=_fam;
+ const DataArrayIdType *d2=other->_fam;
if((d1==0 && d2!=0) || (d1!=0 && d2==0))
{
what="Presence of family arr in one sublevel and not in other!";
m->incrRef();
_m=m;
_m_by_types.assignUMesh(dynamic_cast<MEDCouplingUMesh *>(m->deepCopy()));
- MCAuto<DataArrayInt> da=_m_by_types.getUmesh()->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_N_CELL_FIXED_GEO);
+ MCAuto<DataArrayIdType> da=_m_by_types.getUmesh()->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_N_CELL_FIXED_GEO);
if(!da->isIota(m->getNumberOfCells()))
{
_num=da->invertArrayO2N2N2O(m->getNumberOfCells());
void MEDFileUMeshSplitL1::assignCommonPart()
{
- _fam=DataArrayInt::New();
+ _fam=DataArrayIdType::New();
_fam->alloc(_m_by_types.getSize(),1);
_fam->fillWithValue(0);
}
return _m_by_types.empty();
}
-bool MEDFileUMeshSplitL1::presenceOfOneFams(const std::vector<int>& ids) const
+bool MEDFileUMeshSplitL1::presenceOfOneFams(const std::vector<mcIdType>& ids) const
{
- const DataArrayInt *fam=_fam;
+ const DataArrayIdType *fam=_fam;
if(!fam)
return false;
return fam->presenceOfValue(ids);
void MEDFileUMeshSplitL1::simpleRepr(std::ostream& oss) const
{
- std::vector<int> code=_m_by_types.getDistributionOfTypes();
- int nbOfTypes=code.size()/3;
- for(int i=0;i<nbOfTypes;i++)
+ std::vector<mcIdType> code=_m_by_types.getDistributionOfTypes();
+ std::size_t nbOfTypes=code.size()/3;
+ for(std::size_t i=0;i<nbOfTypes;i++)
{
INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType) code[3*i];
oss << " - Number of cells with type " << INTERP_KERNEL::CellModel::GetCellModel(typ).getRepr() << " : " << code[3*i+1] << std::endl;
}
}
-int MEDFileUMeshSplitL1::getSize() const
+mcIdType MEDFileUMeshSplitL1::getSize() const
{
return _m_by_types.getSize();
}
-MEDCouplingUMesh *MEDFileUMeshSplitL1::getFamilyPart(const int *idsBg, const int *idsEnd, bool renum) const
+MEDCouplingUMesh *MEDFileUMeshSplitL1::getFamilyPart(const mcIdType *idsBg, const mcIdType *idsEnd, bool renum) const
{
- MCAuto<DataArrayInt> eltsToKeep=_fam->findIdsEqualList(idsBg,idsEnd);
+ MCAuto<DataArrayIdType> eltsToKeep=_fam->findIdsEqualList(idsBg,idsEnd);
MEDCouplingUMesh *m=(MEDCouplingUMesh *)_m_by_types.getUmesh()->buildPartOfMySelf(eltsToKeep->begin(),eltsToKeep->end(),true);
if(renum)
return renumIfNeeded(m,eltsToKeep->begin());
return m;
}
-DataArrayInt *MEDFileUMeshSplitL1::getFamilyPartArr(const int *idsBg, const int *idsEnd, bool renum) const
+DataArrayIdType *MEDFileUMeshSplitL1::getFamilyPartArr(const mcIdType *idsBg, const mcIdType *idsEnd, bool renum) const
{
- MCAuto<DataArrayInt> da=_fam->findIdsEqualList(idsBg,idsEnd);
+ MCAuto<DataArrayIdType> da=_fam->findIdsEqualList(idsBg,idsEnd);
if(renum)
return renumIfNeededArr(da);
return da.retn();
return _m_by_types.getGeoTypes();
}
-int MEDFileUMeshSplitL1::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const
+mcIdType MEDFileUMeshSplitL1::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const
{
return _m_by_types.getNumberOfCellsWithType(ct);
}
MEDCouplingUMesh *MEDFileUMeshSplitL1::getWholeMesh(bool renum) const
{
MCAuto<MEDCouplingUMesh> tmp;
- if(renum && ((const DataArrayInt *)_num))
+ if(renum && ((const DataArrayIdType *)_num))
tmp=_m;
else
{ tmp=_m_by_types.getUmesh(); if(tmp) tmp->incrRef(); }
return tmp.retn();
}
-int MEDFileUMeshSplitL1::getNumberOfCells() const
+mcIdType MEDFileUMeshSplitL1::getNumberOfCells() const
{
return _m_by_types.getNumberOfCells();
}
-DataArrayInt *MEDFileUMeshSplitL1::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
+DataArrayIdType *MEDFileUMeshSplitL1::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
{
- const DataArrayInt *fam(_fam);
+ const DataArrayIdType *fam(_fam);
if(!fam)
return 0;
- int start(0),stop(0);
+ mcIdType start(0),stop(0);
_m_by_types.getStartStopOfGeoTypeWithoutComputation(gt,start,stop);
return fam->selectByTupleIdSafeSlice(start,stop,1);
}
-DataArrayInt *MEDFileUMeshSplitL1::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
+DataArrayIdType *MEDFileUMeshSplitL1::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const
{
- const DataArrayInt *num(_num);
+ const DataArrayIdType *num(_num);
if(!num)
return 0;
- int start(0),stop(0);
+ mcIdType start(0),stop(0);
_m_by_types.getStartStopOfGeoTypeWithoutComputation(gt,start,stop);
return num->selectByTupleIdSafeSlice(start,stop,1);
}
-DataArrayInt *MEDFileUMeshSplitL1::getOrCreateAndGetFamilyField()
+DataArrayIdType *MEDFileUMeshSplitL1::getOrCreateAndGetFamilyField()
{
- if((DataArrayInt *)_fam)
+ if((DataArrayIdType *)_fam)
return _fam;
- int nbOfTuples=_m_by_types.getSize();
- _fam=DataArrayInt::New(); _fam->alloc(nbOfTuples,1); _fam->fillWithZero();
+ mcIdType nbOfTuples=_m_by_types.getSize();
+ _fam=DataArrayIdType::New(); _fam->alloc(nbOfTuples,1); _fam->fillWithZero();
return _fam;
}
-const DataArrayInt *MEDFileUMeshSplitL1::getFamilyField() const
+const DataArrayIdType *MEDFileUMeshSplitL1::getFamilyField() const
{
return _fam;
}
-const DataArrayInt *MEDFileUMeshSplitL1::getNumberField() const
+const DataArrayIdType *MEDFileUMeshSplitL1::getNumberField() const
{
return _num;
}
-const DataArrayInt *MEDFileUMeshSplitL1::getRevNumberField() const
+const DataArrayIdType *MEDFileUMeshSplitL1::getRevNumberField() const
{
return _rev_num;
}
/*!
* This method ignores _m and _m_by_types.
*/
-void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector<const MEDCouplingUMesh *>& ms, std::map<std::string,int>& familyIds,
+void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector<const MEDCouplingUMesh *>& ms, std::map<std::string,mcIdType>& familyIds,
std::map<std::string, std::vector<std::string> >& groups)
{
- std::vector< DataArrayInt * > corr;
+ std::vector< DataArrayIdType * > corr;
_m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,0,corr);
- std::vector< MCAuto<DataArrayInt> > corrMSafe(corr.begin(),corr.end());
- std::vector< std::vector<int> > fidsOfGroups;
- std::vector< const DataArrayInt * > corr2(corr.begin(),corr.end());
- _fam=DataArrayInt::MakePartition(corr2,((MEDCouplingUMesh *)_m)->getNumberOfCells(),fidsOfGroups);
- int nbOfCells=((MEDCouplingUMesh *)_m)->getNumberOfCells();
- std::map<int,std::string> newfams;
- std::map<int,int> famIdTrad;
+ std::vector< MCAuto<DataArrayIdType> > corrMSafe(corr.begin(),corr.end());
+ std::vector< std::vector<mcIdType> > fidsOfGroups;
+ std::vector< const DataArrayIdType * > corr2(corr.begin(),corr.end());
+ _fam=DataArrayIdType::MakePartition(corr2,((MEDCouplingUMesh *)_m)->getNumberOfCells(),fidsOfGroups);
+ mcIdType nbOfCells=((MEDCouplingUMesh *)_m)->getNumberOfCells();
+ std::map<mcIdType,std::string> newfams;
+ std::map<mcIdType,mcIdType> famIdTrad;
TraduceFamilyNumber(fidsOfGroups,familyIds,famIdTrad,newfams);
- int *w=_fam->getPointer();
- for(int i=0;i<nbOfCells;i++,w++)
+ mcIdType *w=_fam->getPointer();
+ for(mcIdType i=0;i<nbOfCells;i++,w++)
*w=famIdTrad[*w];
}
void MEDFileUMeshSplitL1::write(med_idt fid, const std::string& mName, int mdim) const
{
std::vector<MEDCoupling1GTUMesh *> ms(_m_by_types.getParts());
- int start=0;
+ mcIdType start=0;
for(std::vector<MEDCoupling1GTUMesh *>::const_iterator it=ms.begin();it!=ms.end();it++)
{
- int nbCells=(*it)->getNumberOfCells();
- int end=start+nbCells;
- MCAuto<DataArrayInt> fam,num;
+ mcIdType nbCells=(*it)->getNumberOfCells();
+ mcIdType end=start+nbCells;
+ MCAuto<DataArrayIdType> fam,num;
MCAuto<DataArrayAsciiChar> names;
- if((const DataArrayInt *)_fam)
+ if((const DataArrayIdType *)_fam)
fam=_fam->subArray(start,end);
- if((const DataArrayInt *)_num)
+ if((const DataArrayIdType *)_num)
num=_num->subArray(start,end);
if((const DataArrayAsciiChar *)_names)
names=static_cast<DataArrayAsciiChar *>(_names->subArray(start,end));
}
}
-void MEDFileUMeshSplitL1::renumberNodesInConn(const int *newNodeNumbersO2N)
+void MEDFileUMeshSplitL1::renumberNodesInConn(const mcIdType *newNodeNumbersO2N)
{
_m_by_types.renumberNodesInConnWithoutComputation(newNodeNumbersO2N);
}
-void MEDFileUMeshSplitL1::serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const
+void MEDFileUMeshSplitL1::serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const
{
bigArraysI.push_back(_fam);
bigArraysI.push_back(_num);
_m_by_types.serialize(tinyInt,bigArraysI);
}
-void MEDFileUMeshSplitL1::unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI)
+void MEDFileUMeshSplitL1::unserialize(const std::string& name, DataArrayDouble *coo, std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI)
{
_fam=bigArraysI.back(); bigArraysI.pop_back();
_num=bigArraysI.back(); bigArraysI.pop_back();
_m_by_types.unserialize(name,coo,tinyInt,bigArraysI);
}
-void MEDFileUMeshSplitL1::changeFamilyIdArr(int oldId, int newId)
+void MEDFileUMeshSplitL1::changeFamilyIdArr(mcIdType oldId, mcIdType newId)
{
- DataArrayInt *arr=_fam;
+ DataArrayIdType *arr=_fam;
if(arr)
arr->changeValue(oldId,newId);
}
-void MEDFileUMeshSplitL1::setFamilyArr(DataArrayInt *famArr)
+void MEDFileUMeshSplitL1::setFamilyArr(DataArrayIdType *famArr)
{
if(!famArr)
{
_fam=0;
return ;
}
- int sz(_m_by_types.getSize());
+ mcIdType sz(_m_by_types.getSize());
famArr->checkNbOfTuplesAndComp(sz,1,"MEDFileUMeshSplitL1::setFamilyArr : Problem in size of Family arr ! ");
famArr->incrRef();
_fam=famArr;
}
-DataArrayInt *MEDFileUMeshSplitL1::getFamilyField()
+DataArrayIdType *MEDFileUMeshSplitL1::getFamilyField()
{
return _fam;
}
-void MEDFileUMeshSplitL1::setRenumArr(DataArrayInt *renumArr)
+void MEDFileUMeshSplitL1::setRenumArr(DataArrayIdType *renumArr)
{
if(!renumArr)
{
_rev_num=0;
return ;
}
- int sz(_m_by_types.getSize());
+ mcIdType sz(_m_by_types.getSize());
renumArr->checkNbOfTuplesAndComp(sz,1,"MEDFileUMeshSplitL1::setRenumArr : Problem in size of numbering arr ! ");
renumArr->incrRef();
_num=renumArr;
_names=0;
return ;
}
- int sz(_m_by_types.getSize());
+ mcIdType sz(_m_by_types.getSize());
nameArr->checkNbOfTuplesAndComp(sz,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)
+MEDCouplingUMesh *MEDFileUMeshSplitL1::Renumber2(const DataArrayIdType *renum, MEDCouplingUMesh *m, const mcIdType *cellIds)
{
if(renum==0)
return m;
m->renumberCells(renum->begin(),true);
else
{
- MCAuto<DataArrayInt> locnum=renum->selectByTupleId(cellIds,cellIds+m->getNumberOfCells());
+ MCAuto<DataArrayIdType> locnum=renum->selectByTupleId(cellIds,cellIds+m->getNumberOfCells());
m->renumberCells(locnum->begin(),true);
}
return m;
}
-MEDFileUMeshSplitL1 *MEDFileUMeshSplitL1::Unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI)
+MEDFileUMeshSplitL1 *MEDFileUMeshSplitL1::Unserialize(const std::string& name, DataArrayDouble *coo, std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI)
{
MCAuto<MEDFileUMeshSplitL1> ret(new MEDFileUMeshSplitL1);
ret->unserialize(name,coo,tinyInt,bigArraysI);
return ret.retn();
}
-MEDCouplingUMesh *MEDFileUMeshSplitL1::renumIfNeeded(MEDCouplingUMesh *m, const int *cellIds) const
+MEDCouplingUMesh *MEDFileUMeshSplitL1::renumIfNeeded(MEDCouplingUMesh *m, const mcIdType *cellIds) const
{
return Renumber2(_num,m,cellIds);
}
-DataArrayInt *MEDFileUMeshSplitL1::Renumber(const DataArrayInt *renum, const DataArrayInt *da)
+DataArrayIdType *MEDFileUMeshSplitL1::Renumber(const DataArrayIdType *renum, const DataArrayIdType *da)
{
- if((const DataArrayInt *)renum==0)
+ if((const DataArrayIdType *)renum==0)
{
da->incrRef();
- return const_cast<DataArrayInt *>(da);
+ return const_cast<DataArrayIdType *>(da);
}
return renum->selectByTupleId(da->begin(),da->end());
}
-DataArrayInt *MEDFileUMeshSplitL1::renumIfNeededArr(const DataArrayInt *da) const
+DataArrayIdType *MEDFileUMeshSplitL1::renumIfNeededArr(const DataArrayIdType *da) const
{
return Renumber(_num,da);
}
-std::vector<int> MEDFileUMeshSplitL1::GetNewFamiliesNumber(int nb, const std::map<std::string,int>& families)
+std::vector<mcIdType> MEDFileUMeshSplitL1::GetNewFamiliesNumber(mcIdType nb, const std::map<std::string,mcIdType>& families)
{
- int id=-1;
- for(std::map<std::string,int>::const_iterator it=families.begin();it!=families.end();it++)
+ mcIdType id=-1;
+ for(std::map<std::string,mcIdType>::const_iterator it=families.begin();it!=families.end();it++)
id=std::max(id,(*it).second);
if(id==-1)
id=0;
- std::vector<int> ret(nb);
- for(int i=1;i<=nb;i++)
+ std::vector<mcIdType> ret(nb);
+ for(mcIdType i=1;i<=nb;i++)
ret[i]=id+i;
return ret;
}
-void MEDFileUMeshSplitL1::TraduceFamilyNumber(const std::vector< std::vector<int> >& fidsGrps, std::map<std::string,int>& familyIds,
- std::map<int,int>& famIdTrad, std::map<int,std::string>& newfams)
+void MEDFileUMeshSplitL1::TraduceFamilyNumber(const std::vector< std::vector<mcIdType> >& fidsGrps, std::map<std::string,mcIdType>& familyIds,
+ std::map<mcIdType,mcIdType>& famIdTrad, std::map<mcIdType,std::string>& newfams)
{
- std::set<int> allfids;
+ std::set<mcIdType> allfids;
//tony
}
void MEDFileUMeshSplitL1::computeRevNum() const
{
- int pos;
- int maxValue=_num->getMaxValue(pos);
+ mcIdType pos;
+ mcIdType maxValue=_num->getMaxValue(pos);
_rev_num=_num->invertArrayN2O2O2N(maxValue+1);
}
return _m;
}
-int MEDFileUMeshAggregateCompute::getNumberOfCells() const
+mcIdType MEDFileUMeshAggregateCompute::getNumberOfCells() const
{
if(_mp_time<=_m_time)
return _m->getNumberOfCells();
- int ret(0);
+ mcIdType ret(0);
for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
ret+=(*it)->getNumberOfCells();
return ret;
return _m->getAllGeoTypesSorted();
}
-int MEDFileUMeshAggregateCompute::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const
+mcIdType MEDFileUMeshAggregateCompute::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const
{
if(_mp_time>=_m_time)
{
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartWithoutComputation : the geometric type is not existing !");
}
-void MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, int& start, int& stop) const
+void MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, mcIdType& start, mcIdType& stop) const
{
start=0; stop=0;
std::vector<MEDCoupling1GTUMesh *> v(retrievePartsWithoutComputation());
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation : the geometric type is not existing !");
}
-void MEDFileUMeshAggregateCompute::renumberNodesInConnWithoutComputation(const int *newNodeNumbersO2N)
+void MEDFileUMeshAggregateCompute::renumberNodesInConnWithoutComputation(const mcIdType *newNodeNumbersO2N)
{
if(_mp_time>_m_time)
{
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartDefOfWithoutComputation : The input geo type is not existing in this !");
}
-void MEDFileUMeshAggregateCompute::serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const
+void MEDFileUMeshAggregateCompute::serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const
{
if(_mp_time<_m_time)
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::serialize : the parts require a computation !");
std::size_t sz(_m_parts.size());
- tinyInt.push_back((int)sz);
+ tinyInt.push_back((mcIdType)sz);
for(std::size_t i=0;i<sz;i++)
{
const MEDCoupling1GTUMesh *mesh(_m_parts[i]);
const MEDCoupling1DGTUMesh *mesh2(dynamic_cast<const MEDCoupling1DGTUMesh *>(mesh));
if(mesh1)
{
- DataArrayInt *elt(mesh1->getNodalConnectivity());
+ DataArrayIdType *elt(mesh1->getNodalConnectivity());
if(elt)
elt->incrRef();
- MCAuto<DataArrayInt> elt1(elt);
+ MCAuto<DataArrayIdType> elt1(elt);
bigArraysI.push_back(elt1);
}
else if(mesh2)
{
- DataArrayInt *elt1(mesh2->getNodalConnectivity()),*elt2(mesh2->getNodalConnectivityIndex());
+ DataArrayIdType *elt1(mesh2->getNodalConnectivity()),*elt2(mesh2->getNodalConnectivityIndex());
if(elt1)
elt1->incrRef();
if(elt2)
elt2->incrRef();
- MCAuto<DataArrayInt> elt11(elt1),elt22(elt2);
+ MCAuto<DataArrayIdType> elt11(elt1),elt22(elt2);
bigArraysI.push_back(elt11); bigArraysI.push_back(elt22);
}
else
tinyInt.push_back(-1);
else
{
- std::vector<int> tinyTmp;
+ std::vector<mcIdType> tinyTmp;
pd->serialize(tinyTmp,bigArraysI);
- tinyInt.push_back((int)tinyTmp.size());
+ tinyInt.push_back((mcIdType)tinyTmp.size());
tinyInt.insert(tinyInt.end(),tinyTmp.begin(),tinyTmp.end());
}
}
}
-void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI)
+void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArrayDouble *coo, std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI)
{
- int nbParts(tinyInt.back()); tinyInt.pop_back();
+ mcIdType nbParts(tinyInt.back()); tinyInt.pop_back();
_part_def.clear(); _part_def.resize(nbParts);
_m_parts.clear(); _m_parts.resize(nbParts);
- for(int i=0;i<nbParts;i++)
+ for(mcIdType i=0;i<nbParts;i++)
{
INTERP_KERNEL::NormalizedCellType tp((INTERP_KERNEL::NormalizedCellType) tinyInt.back()); tinyInt.pop_back();
MCAuto<MEDCoupling1GTUMesh> mesh(MEDCoupling1GTUMesh::New(name,tp));
}
else if(mesh2)
{
- MCAuto<DataArrayInt> elt0,elt1;
+ MCAuto<DataArrayIdType> elt0,elt1;
elt0=bigArraysI.back(); bigArraysI.pop_back();
elt1=bigArraysI.back(); bigArraysI.pop_back();
mesh2->setNodalConnectivity(elt0,elt1);
else
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::unserialize : unrecognized single geo type mesh !");
_m_parts[i]=mesh;
- int pdid(tinyInt.back()); tinyInt.pop_back();
+ mcIdType pdid(tinyInt.back()); tinyInt.pop_back();
if(pdid!=-1)
_part_def[i]=PartDefinition::Unserialize(tinyInt,bigArraysI);
_mp_time=std::max(_mp_time,_m_time)+1;
}
}
-std::vector<int> MEDFileUMeshAggregateCompute::getDistributionOfTypes() const
+std::vector<mcIdType> MEDFileUMeshAggregateCompute::getDistributionOfTypes() const
{
if(_mp_time<_m_time)
{
}
else
{
- std::vector<int> ret;
+ std::vector<mcIdType> ret;
for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
const MEDCoupling1GTUMesh *tmp(*it);
if(!tmp)
throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getDistributionOfTypes : part mesh contains null instance !");
- std::vector<int> ret0(tmp->getDistributionOfTypes());
+ std::vector<mcIdType> ret0(tmp->getDistributionOfTypes());
ret.insert(ret.end(),ret0.begin(),ret0.end());
}
return ret;
}
}
-int MEDFileUMeshAggregateCompute::getSize() const
+mcIdType MEDFileUMeshAggregateCompute::getSize() const
{
if(_mp_time<_m_time)
{
}
else
{
- int ret=0;
+ mcIdType ret=0;
for(std::vector< MCAuto<MEDCoupling1GTUMesh> >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++)
{
const MEDCoupling1GTUMesh *m(*it);
MEDFILESAFECALLERRD0(MEDmeshEntityInfo,(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,iterOnStEltOfMesh+1,geoTypeName,&geoType));
_geo_type=geoType;
_geo_type_name=MEDLoaderBase::buildStringFromFortran(geoTypeName,MED_NAME_SIZE);
- int nCells(0);
+ mcIdType nCells(0);
{
med_bool chgt=MED_FALSE,trsf=MED_FALSE;
nCells=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,geoType,MED_CONNECTIVITY,MED_NODAL,&chgt,&trsf);
}
MCAuto<MEDFileMeshSupports> mss(MEDFileMeshSupports::New(fid));
MCAuto<MEDFileStructureElements> mse(MEDFileStructureElements::New(fid,mss));
- int nbEntities(mse->getNumberOfNodesPerSE(_geo_type_name));
- _conn=DataArrayInt::New(); _conn->alloc(nCells*nbEntities);
- MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,_geo_type,MED_NODAL,MED_FULL_INTERLACE,_conn->getPointer()));
+ mcIdType nbEntities(mse->getNumberOfNodesPerSE(_geo_type_name));
+ MCAuto<DataArrayMedInt> miConn=DataArrayMedInt::New(); miConn->alloc(nCells*nbEntities);
+ MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,_geo_type,MED_NODAL,MED_FULL_INTERLACE,miConn->getPointer()));
+ _conn=FromMedIntArray<mcIdType>(miConn);
_conn->applyLin(1,-1);
_conn->rearrange(nbEntities);
_common=MEDFileUMeshPerTypeCommon::New();
MCAuto<PartDefinition> getPartDefOfCoo() const { return _part_coords; }
std::vector<std::string> getAxisInfoOnMesh(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim);
static INTERP_KERNEL::AutoCppPtr<MeshOrStructMeshCls> GetMeshIdFromName(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& dt, int& it, std::string& dtunit1);
- static void ReadFamiliesAndGrps(med_idt fid, const std::string& mname, std::map<std::string,int>& fams, std::map<std::string, std::vector<std::string> >& grps, MEDFileMeshReadSelector *mrs);
- static void WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map<std::string,int>& fams, const std::map<std::string, std::vector<std::string> >& grps, int tooLongStrPol);
+ static void ReadFamiliesAndGrps(med_idt fid, const std::string& mname, std::map<std::string,mcIdType>& fams, std::map<std::string, std::vector<std::string> >& grps, MEDFileMeshReadSelector *mrs);
+ static void WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map<std::string,mcIdType>& fams, const std::map<std::string, std::vector<std::string> >& grps, int tooLongStrPol);
static bool RenameFamiliesFromFileToMem(std::vector< std::string >& famNames);
static bool RenameFamiliesFromMemToFile(std::vector< std::string >& famNames);
static MEDCoupling::MEDCouplingAxisType TraduceAxisType(med_axis_type at);
static med_grid_type TraduceAxisTypeRevStruct(MEDCoupling::MEDCouplingAxisType at);
private:
typedef bool (*RenameFamiliesPatternFunc)(std::vector< std::string >&);
- static void RenameFamiliesPatternInternal(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >& crudeFams, RenameFamiliesPatternFunc func);
- static void RenameFamiliesFromFileToMemInternal(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >& crudeFams);
- static void RenameFamiliesFromMemToFileInternal(std::vector< std::pair<std::string,std::pair<int,std::vector<std::string> > > >& crudeFams);
+ static void RenameFamiliesPatternInternal(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >& crudeFams, RenameFamiliesPatternFunc func);
+ static void RenameFamiliesFromFileToMemInternal(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >& crudeFams);
+ static void RenameFamiliesFromMemToFileInternal(std::vector< std::pair<std::string,std::pair<mcIdType,std::vector<std::string> > > >& crudeFams);
public:
static const char ZE_SEP_FOR_FAMILY_KILLERS[];
static int ZE_SEP2_FOR_FAMILY_KILLERS;
MEDFileUMeshL2();
std::vector<std::string> loadCommonPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, int dt, int it, int& Mdim);
void loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
- void loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs);
+ void loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs);
void loadConnectivity(med_idt fid, int mdim, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
- void loadPartOfConnectivity(med_idt fid, int mdim, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<int>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs);
+ void loadPartOfConnectivity(med_idt fid, int mdim, const std::string& mName, const std::vector<INTERP_KERNEL::NormalizedCellType>& types, const std::vector<mcIdType>& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs);
void loadCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it);
void loadPartCoords(med_idt fid, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it, int nMin, int nMax);
int getNumberOfLevels() const { return _per_type_mesh.size(); }
bool isNumDefinedOnLev(int levId) const;
bool isNamesDefinedOnLev(int levId) const;
MCAuto<DataArrayDouble> getCoords() const { return _coords; }
- MCAuto<DataArrayInt> getCoordsFamily() const { return _fam_coords; }
- MCAuto<DataArrayInt> getCoordsNum() const { return _num_coords; }
- MCAuto<DataArrayInt> getCoordsGlobalNum() const { return _global_num_coords; }
+ MCAuto<DataArrayIdType> getCoordsFamily() const { return _fam_coords; }
+ MCAuto<DataArrayIdType> getCoordsNum() const { return _num_coords; }
+ MCAuto<DataArrayIdType> getCoordsGlobalNum() const { return _global_num_coords; }
MCAuto<DataArrayAsciiChar> getCoordsName() const { return _name_coords; }
- static void WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayInt *globalNumCoords);
+ static void WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayIdType *famCoords, const DataArrayIdType *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayIdType *globalNumCoords);
private:
void sortTypes();
private:
std::vector< std::vector< MCAuto<MEDFileUMeshPerType> > > _per_type_mesh;
MCAuto<DataArrayDouble> _coords;
- MCAuto<DataArrayInt> _fam_coords;
- MCAuto<DataArrayInt> _num_coords;
- MCAuto<DataArrayInt> _global_num_coords;
+ MCAuto<DataArrayIdType> _fam_coords;
+ MCAuto<DataArrayIdType> _num_coords;
+ MCAuto<DataArrayIdType> _global_num_coords;
MCAuto<DataArrayAsciiChar> _name_coords;
};
void assignDefParts(const std::vector<const PartDefinition *>& partDefs);
void assignUMesh(MEDCouplingUMesh *m);
MEDCouplingUMesh *getUmesh() const;
- int getNumberOfCells() const;
+ mcIdType getNumberOfCells() const;
std::vector<MEDCoupling1GTUMesh *> getParts() const;
std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypes() const;
- int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
+ mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
std::vector<MEDCoupling1GTUMesh *> retrievePartsWithoutComputation() const;
MEDCoupling1GTUMesh *retrievePartWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const;
- void getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, int& start, int& stop) const;
- void renumberNodesInConnWithoutComputation(const int *newNodeNumbersO2N);
+ void getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, mcIdType& start, mcIdType& stop) const;
+ void renumberNodesInConnWithoutComputation(const mcIdType *newNodeNumbersO2N);
bool isStoredSplitByType() const;
std::size_t getTimeOfThis() const;
std::size_t getHeapMemorySizeWithoutChildren() const;
void synchronizeTinyInfo(const MEDFileMesh& master) const;
bool empty() const;
int getMeshDimension() const;
- std::vector<int> getDistributionOfTypes() const;
- int getSize() const;
+ std::vector<mcIdType> getDistributionOfTypes() const;
+ mcIdType getSize() const;
void setCoords(DataArrayDouble *coords);
void forceComputationOfPartsFromUMesh() const;
const PartDefinition *getPartDefOfWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const;
- void serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const;
- void unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI);
+ void serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const;
+ void unserialize(const std::string& name, DataArrayDouble *coo, std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI);
private:
std::size_t getTimeOfParts() const;
std::size_t getTimeOfUMesh() const;
void assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts);
void forceComputationOfParts() const;
bool empty() const;
- bool presenceOfOneFams(const std::vector<int>& ids) const;
+ bool presenceOfOneFams(const std::vector<mcIdType>& ids) const;
int getMeshDimension() const;
void simpleRepr(std::ostream& oss) const;
- int getSize() const;
- MEDCouplingUMesh *getFamilyPart(const int *idsBg, const int *idsEnd, bool renum) const;
- DataArrayInt *getFamilyPartArr(const int *idsBg, const int *idsEnd, bool renum) const;
+ mcIdType getSize() const;
+ MEDCouplingUMesh *getFamilyPart(const mcIdType *idsBg, const mcIdType *idsEnd, bool renum) const;
+ DataArrayIdType *getFamilyPartArr(const mcIdType *idsBg, const mcIdType *idsEnd, bool renum) const;
MEDCouplingUMesh *getWholeMesh(bool renum) const;
- int getNumberOfCells() const;
+ mcIdType getNumberOfCells() const;
bool isMeshStoredSplitByType() const { return _m_by_types.isStoredSplitByType(); }
std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypes() const;
- int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
+ mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const;
std::vector<MEDCoupling1GTUMesh *> getDirectUndergroundSingleGeoTypeMeshes() const { return _m_by_types.retrievePartsWithoutComputation(); }
MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const { return _m_by_types.retrievePartWithoutComputation(gt); }
- DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
- DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
- std::vector<int> getDistributionOfTypes() const { return _m_by_types.getDistributionOfTypes(); }
- DataArrayInt *getOrCreateAndGetFamilyField();
- const DataArrayInt *getFamilyField() const;
- const DataArrayInt *getNumberField() const;
+ DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
+ DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
+ std::vector<mcIdType> getDistributionOfTypes() const { return _m_by_types.getDistributionOfTypes(); }
+ DataArrayIdType *getOrCreateAndGetFamilyField();
+ const DataArrayIdType *getFamilyField() const;
+ const DataArrayIdType *getNumberField() const;
const DataArrayAsciiChar *getNameField() const;
- const DataArrayInt *getRevNumberField() const;
+ const DataArrayIdType *getRevNumberField() const;
const PartDefinition *getPartDef(INTERP_KERNEL::NormalizedCellType gt) const;
void eraseFamilyField();
- void setGroupsFromScratch(const std::vector<const MEDCouplingUMesh *>& ms, std::map<std::string,int>& familyIds,
+ void setGroupsFromScratch(const std::vector<const MEDCouplingUMesh *>& ms, std::map<std::string,mcIdType>& familyIds,
std::map<std::string, std::vector<std::string> >& groups);
void write(med_idt fid, const std::string& mName, int mdim) const;
//
- void setFamilyArr(DataArrayInt *famArr);
- DataArrayInt *getFamilyField();
- void setRenumArr(DataArrayInt *renumArr);
+ void setFamilyArr(DataArrayIdType *famArr);
+ DataArrayIdType *getFamilyField();
+ void setRenumArr(DataArrayIdType *renumArr);
void setNameArr(DataArrayAsciiChar *nameArr);
- void changeFamilyIdArr(int oldId, int newId);
+ void changeFamilyIdArr(mcIdType oldId, mcIdType newId);
//
- void renumberNodesInConn(const int *newNodeNumbersO2N);
+ void renumberNodesInConn(const mcIdType *newNodeNumbersO2N);
//
- void serialize(std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI) const;
- void unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI);
+ void serialize(std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI) const;
+ void unserialize(const std::string& name, DataArrayDouble *coo, std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI);
//
static void ClearNonDiscrAttributes(const MEDCouplingMesh *tmp);
- static std::vector<int> GetNewFamiliesNumber(int nb, const std::map<std::string,int>& families);
- static void TraduceFamilyNumber(const std::vector< std::vector<int> >& fidsGrps, std::map<std::string,int>& familyIds,
- std::map<int,int>& famIdTrad, std::map<int,std::string>& newfams);
- static DataArrayInt *Renumber(const DataArrayInt *renum, const DataArrayInt *da);
- static MEDCouplingUMesh *Renumber2(const DataArrayInt *renum, MEDCouplingUMesh *m, const int *cellIds);
- static MEDFileUMeshSplitL1 *Unserialize(const std::string& name, DataArrayDouble *coo, std::vector<int>& tinyInt, std::vector< MCAuto<DataArrayInt> >& bigArraysI);
+ static std::vector<mcIdType> GetNewFamiliesNumber(mcIdType nb, const std::map<std::string,mcIdType>& families);
+ static void TraduceFamilyNumber(const std::vector< std::vector<mcIdType> >& fidsGrps, std::map<std::string,mcIdType>& familyIds,
+ std::map<mcIdType,mcIdType>& famIdTrad, std::map<mcIdType,std::string>& newfams);
+ static DataArrayIdType *Renumber(const DataArrayIdType *renum, const DataArrayIdType *da);
+ static MEDCouplingUMesh *Renumber2(const DataArrayIdType *renum, MEDCouplingUMesh *m, const mcIdType *cellIds);
+ static MEDFileUMeshSplitL1 *Unserialize(const std::string& name, DataArrayDouble *coo, std::vector<mcIdType>& tinyInt, std::vector< MCAuto<DataArrayIdType> >& bigArraysI);
private:
MEDFileUMeshSplitL1();
void assignCommonPart();
- MEDCouplingUMesh *renumIfNeeded(MEDCouplingUMesh *m, const int *cellIds) const;
- DataArrayInt *renumIfNeededArr(const DataArrayInt *da) const;
+ MEDCouplingUMesh *renumIfNeeded(MEDCouplingUMesh *m, const mcIdType *cellIds) const;
+ DataArrayIdType *renumIfNeededArr(const DataArrayIdType *da) const;
void computeRevNum() const;
private:
MEDFileUMeshAggregateCompute _m_by_types;
- MCAuto<DataArrayInt> _fam;
- MCAuto<DataArrayInt> _num;
- MCAuto<DataArrayInt> _global_num;
+ MCAuto<DataArrayIdType> _fam;
+ MCAuto<DataArrayIdType> _num;
+ MCAuto<DataArrayIdType> _global_num;
MCAuto<DataArrayAsciiChar> _names;
- mutable MCAuto<DataArrayInt> _rev_num;
+ mutable MCAuto<DataArrayIdType> _rev_num;
MEDFileUMeshPermCompute _m;
};
public:
static MEDFileEltStruct4Mesh *New(med_idt fid, const std::string& mName, int dt, int it, int iterOnStEltOfMesh, MEDFileMeshReadSelector *mrs);
std::string getGeoTypeName() const { return _geo_type_name; }
- MCAuto<DataArrayInt> getConn() const { return _conn; }
+ MCAuto<DataArrayIdType> getConn() const { return _conn; }
MCAuto<MEDFileUMeshPerTypeCommon> getMeshDef() const { return _common; }
const std::vector< MCAuto<DataArray> >& getVars() const { return _vars; }
private:
private:
std::string _geo_type_name;
int _geo_type;
- MCAuto<DataArrayInt> _conn;
+ MCAuto<DataArrayIdType> _conn;
MCAuto<MEDFileUMeshPerTypeCommon> _common;
std::vector< MCAuto<DataArray> > _vars;
};
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());
}
{
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<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()));
m->tryToShareSameCoordsPermute(*mread,_EPS_FOR_NODE_COMP);
else
mread->setCoords(m->getCoords());
- DataArrayInt *part(NULL);
+ 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 !";
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);
{
if ( ma._sortedNodeIDs )
{
- _sortedNodeIDs = new int[ _nodes.size() ];
+ _sortedNodeIDs = new TID[ _nodes.size() ];
std::copy( ma._sortedNodeIDs, ma._sortedNodeIDs + _nodes.size(), _sortedNodeIDs );
}
}
if ( !_sortedNodeIDs )
{
size_t l=_nodes.size();
- _sortedNodeIDs = new int[ l ];
+ _sortedNodeIDs = new TID[ l ];
for (size_t i=0; i!=l; ++i)
_sortedNodeIDs[i]=_nodes[i]->_number;
if ( _nodes.size() == 1 )
return _nodes[0] < ma._nodes[0];
- const int* v1 = getSortedNodes();
- const int* v2 = ma.getSortedNodes();
- for ( const int* vEnd = v1 + _nodes.size(); v1 < vEnd; ++v1, ++v2 )
+ const TID* v1 = getSortedNodes();
+ const TID* v2 = ma.getSortedNodes();
+ for ( const TID* vEnd = v1 + _nodes.size(); v1 < vEnd; ++v1, ++v2 )
if(*v1 != *v2)
return *v1 < *v2;
return false;
// fill connectivity array to take into account order of elements in the sauv file
const int nbCellNodes = cells->begin()->_nodes.size();
std::vector< TID > connectivity( cells->size() * nbCellNodes );
- int * nodalConnOfCell;
+ TID * nodalConnOfCell;
for ( elemIt = cells->begin(), elemEnd = cells->end(); elemIt != elemEnd; ++elemIt )
{
const Cell& cell = *elemIt;
{
const int meshDimRelToMaxExt = ( dim == 0 ? 1 : dim - meshDim );
- std::vector<const DataArrayInt *> medGroups;
- std::vector<MCAuto<DataArrayInt> > refGroups;
+ std::vector<const DataArrayIdType *> medGroups;
+ std::vector<MCAuto<DataArrayIdType> > refGroups;
for ( size_t i = 0; i < _groups.size(); ++i )
{
Group& grp = _groups[i];
}
}
// create a med group
- grp._medGroup = DataArrayInt::New();
+ grp._medGroup = DataArrayIdType::New();
grp._medGroup->setName( grp._name.c_str() );
grp._medGroup->alloc( cell2order.size(), /*nbOfCompo=*/1 );
- int * idsPtr = grp._medGroup->getPointer();
+ TID * idsPtr = grp._medGroup->getPointer();
TCellToOrderMap::iterator cell2orderIt, cell2orderEnd = cell2order.end();
for ( cell2orderIt = cell2order.begin(); cell2orderIt != cell2orderEnd; ++cell2orderIt )
*idsPtr++ = (*cell2orderIt).first->_number - 1;
struct IntermediateMED;
// ==============================================================================
- typedef int TID; // an ID countered from 1
+ typedef mcIdType TID; // an ID countered from 1
typedef std::pair<TID,TID> Link; // a pair of node numbers
typedef INTERP_KERNEL::NormalizedCellType TCellType;
reference is converted into a copy of the medGroup
(issue 0021311)
*/
- MEDCoupling::DataArrayInt* _medGroup; // result of conversion
- std::vector< unsigned > _relocTable; // for _cells[i] gives its index in _medGroup
+ MEDCoupling::DataArrayIdType* _medGroup; // result of conversion
+ std::vector< unsigned > _relocTable; // for _cells[i] gives its index in _medGroup
bool empty() const { return _cells.empty() && _groups.empty(); }
int size() const;
{
int dimRelExt = dims[ iDim ];
MCAuto< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel(dimRelExt);
- const DataArrayInt * famIds = _fileMesh->getFamilyFieldAtLevel(dimRelExt);
+ const DataArrayIdType * famIds = _fileMesh->getFamilyFieldAtLevel(dimRelExt);
if ( !famIds ) continue;
- int curFamID = 0;
+ mcIdType curFamID = 0;
SubMesh* curSubMesh = addSubMesh( "", dimRelExt ); // submesh of zero family
_famIDs2Sub[0] = curSubMesh;
int sub0Index = _subs.size()-1;
- const int * famID = famIds->begin(), * famIDEnd = famIds->end();
- for ( int cellID = 0; famID < famIDEnd; ++famID, cellID++ )
+ const mcIdType * famID = famIds->begin(), * famIDEnd = famIds->end();
+ for ( mcIdType cellID = 0; famID < famIDEnd; ++famID, cellID++ )
{
if ( *famID != curFamID )
{
curFamID = *famID;
- map< int, SubMesh* >::iterator f2s = _famIDs2Sub.insert( make_pair( curFamID, nilSm )).first;
+ map< mcIdType, SubMesh* >::iterator f2s = _famIDs2Sub.insert( make_pair( curFamID, nilSm )).first;
if ( !f2s->second )
f2s->second = addSubMesh( "", dimRelExt ); // no names for families
curSubMesh = f2s->second;
std::size_t k = 0;
for ( size_t i = 0; i < famNames.size(); ++i )
{
- int famID = _fileMesh->getFamilyId( famNames[i].c_str() );
- map< int, SubMesh* >::iterator i2f = _famIDs2Sub.find( famID );
+ mcIdType famID = _fileMesh->getFamilyId( famNames[i].c_str() );
+ map< mcIdType, SubMesh* >::iterator i2f = _famIDs2Sub.find( famID );
if ( i2f != _famIDs2Sub.end() )
{
famSubMeshes[ k ] = i2f->second;
if ( !pfl2sm->second )
{
SubMesh* sm = pfl2sm->second = addSubMesh( "", dimRelExt ); // no names for profiles
- const DataArrayInt * pfl = isOnAll ? 0 : fields[i]->getProfile( pfls[iType][iPfl].c_str() );
+ const DataArrayIdType * pfl = isOnAll ? 0 : fields[i]->getProfile( pfls[iType][iPfl].c_str() );
makeProfileIDs( sm, types[iType], pfl );
}
}
void SauvWriter::makeProfileIDs( SubMesh* sm,
INTERP_KERNEL::NormalizedCellType type,
- const DataArrayInt* profile )
+ const DataArrayIdType* profile )
{
MCAuto< MEDCouplingMesh >
mesh = _fileMesh->getMeshAtLevel(sm->_dimRelExt);
else
{
// profile on cells
- vector<int> code(3);
+ vector<mcIdType> code(3);
code[0] = type;
if ( profile ) // on profile
{
code[1] = mesh->getNumberOfCellsWithType( type );
code[2] = -1;
}
- vector<const DataArrayInt *> idsPerType( 1, profile );
- MCAuto<DataArrayInt>
+ vector<const DataArrayIdType *> idsPerType( 1, profile );
+ MCAuto<DataArrayIdType>
resIDs = uMesh->checkTypeConsistencyAndContig( code, idsPerType );
- if (( const DataArrayInt *) resIDs )
+ if (( const DataArrayIdType *) resIDs )
{
ids.assign( resIDs->begin(), resIDs->end() );
}
// indices to transform MED connectivity to GIBI one
const int * toMedConn = getGibi2MedQuadraticInterlace( cellType );
- vector< int > cellConn( nbElemNodes ), transformedConn( nbElemNodes );
+ vector< mcIdType > cellConn( nbElemNodes ), transformedConn( nbElemNodes );
for ( size_t i = 0; i < nbElems; ++i )
{
cellConn.clear();
// (2) for each sub-component (iteration)
// write support, number of values and number of components
fcount.init(10);
- vector< int > vals(3);
+ vector< mcIdType > vals(3);
for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt )
{
pair<int,int> it = iters[iIt];
vector<INTERP_KERNEL::NormalizedCellType> types;
vector< vector<TypeOfField> > typesF;
vector< vector<string> > pfls, locs;
- vector< vector< std::pair<int,int> > > valsVec;
+ vector< vector< std::pair<mcIdType,mcIdType> > > valsVec;
valsVec=_nodeFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(),
types, typesF, pfls, locs);
// believe that there can be only one type in a nodal field,
fcount.init(8);
*_sauvFile << left;
for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt )
- for ( size_t i = 0; i < compInfo.size(); ++i, fcount++ )
+ for ( std::size_t i = 0; i < compInfo.size(); ++i, fcount++ )
*_sauvFile << " " << setw(4) << mapMedToGibi[compInfo[i]];
*_sauvFile << right;
fcount.stop();
vector<INTERP_KERNEL::NormalizedCellType> types;
vector< vector<TypeOfField> > typesF;
vector< vector<string> > pfls, locs;
- vector< vector< std::pair<int,int> > > valsVec;
+ vector< vector< std::pair<mcIdType,mcIdType> > > valsVec;
valsVec = _nodeFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(),
types, typesF, pfls, locs);
// believe that there can be only one type in a nodal field,
vector<INTERP_KERNEL::NormalizedCellType> types;
vector< vector<TypeOfField> > typesF;
vector< vector<string> > pfls, locs;
- vector< vector< std::pair<int,int> > > valsVec;
+ vector< vector< std::pair<mcIdType,mcIdType> > > valsVec;
valsVec = _cellFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(),
types, typesF, pfls, locs);
for ( size_t i = 0; i < valsVec.size(); ++i )
vector<INTERP_KERNEL::NormalizedCellType> types;
vector< vector<TypeOfField> > typesF;
vector< vector<string> > pfls, locs;
- vector< vector< std::pair<int,int> > > valsVec;
+ vector< vector< std::pair<mcIdType,mcIdType> > > valsVec;
valsVec = _cellFields[iF]->getFieldSplitedByType( iter, order, _fileMesh->getName().c_str(),
types, typesF, pfls, locs);
for ( size_t iType = 0; iType < pfls.size(); ++iType )
class MEDFileData;
class MEDFileMesh;
class MEDFileFieldMultiTS;
- class DataArrayInt;
+ class DataArrayIdType;
/*!
* \brief Class to write a MEDFileData into a SAUVE format file
std::map<std::string, std::string>& compMedToGibi );
void makeProfileIDs( SubMesh* sm,
INTERP_KERNEL::NormalizedCellType type,
- const DataArrayInt* profile );
+ const DataArrayIdType* profile );
void writeFileHead();
void writeSubMeshes();
void writeCompoundSubMesh(int iSub);
std::vector< MCAuto< MEDFileFieldMultiTS > > _cellFields;
std::vector<SubMesh> _subs;
- std::map< int, SubMesh* > _famIDs2Sub;
+ std::map< mcIdType, SubMesh* > _famIDs2Sub;
std::map< std::string, SubMesh* > _profile2Sub;
enum
{
SET_SOURCE_FILES_PROPERTIES(MEDLoader.i PROPERTIES SWIG_DEFINITIONS "-shadow")
ENDIF()
SET(SWIG_MODULE_MEDLoader_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
+IF(MEDCOUPLING_USE_64BIT_IDS)
+ STRING(APPEND SWIG_MODULE_MEDLoader_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS")
+ENDIF(MEDCOUPLING_USE_64BIT_IDS)
SET (MEDLoader_SWIG_DPYS_FILES
MEDLoaderCommon.i
{
public:
static MEDFileJointCorrespondence *New();
- static MEDFileJointCorrespondence *New(DataArrayInt* correspondence) // nodes
+ static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence) // nodes
;
- static MEDFileJointCorrespondence *New(DataArrayInt* correspondence, // cells
+ static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence, // cells
INTERP_KERNEL::NormalizedCellType loc_geo_type,
INTERP_KERNEL::NormalizedCellType rem_geo_type)
;
INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const;
void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type);
INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const;
- void setCorrespondence(DataArrayInt *corr);
+ void setCorrespondence(DataArrayIdType *corr);
void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const;
std::string simpleRepr() const;
%extend
{
return MEDFileJointCorrespondence::New();
}
- MEDFileJointCorrespondence(DataArrayInt* correspondence)
+ MEDFileJointCorrespondence(DataArrayIdType* correspondence)
{
return MEDFileJointCorrespondence::New(correspondence);
}
- MEDFileJointCorrespondence(DataArrayInt* correspondence, // cells
+ MEDFileJointCorrespondence(DataArrayIdType* correspondence, // cells
INTERP_KERNEL::NormalizedCellType loc_geo_type,
INTERP_KERNEL::NormalizedCellType rem_geo_type)
{
return self->simpleRepr();
}
- DataArrayInt *getCorrespondence() const
+ DataArrayIdType *getCorrespondence() const
{
- const DataArrayInt *ret(self->getCorrespondence());
+ const DataArrayIdType *ret(self->getCorrespondence());
if(ret)
ret->incrRef();
- return const_cast<DataArrayInt *>(ret);
+ return const_cast<DataArrayIdType *>(ret);
}
}
};
private:
MEDFileEquivalenceData();
public:
- void setArray(DataArrayInt *data);
+ void setArray(DataArrayInt32 *data);
%extend
{
- DataArrayInt *getArray()
+ DataArrayInt32 *getArray()
{
- DataArrayInt *ret(self->getArray());
+ DataArrayInt32 *ret(self->getArray());
if(ret) ret->incrRef();
return ret;
}
public:
void clear();
std::size_t size() const;
- void setArray(int meshDimRelToMax, DataArrayInt *da);
- void setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da);
+ void setArray(int meshDimRelToMax, DataArrayInt32 *da);
+ void setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt32 *da);
%extend
{
- DataArrayInt *getArray(INTERP_KERNEL::NormalizedCellType type)
+ DataArrayInt32 *getArray(INTERP_KERNEL::NormalizedCellType type)
{
- DataArrayInt *ret(self->getArray(type));
+ DataArrayInt32 *ret(self->getArray(type));
if(ret) ret->incrRef();
return ret;
}
void setName(const std::string& name);
std::string getDescription() const;
void setDescription(const std::string& descr);
- void setArray(int meshDimRelToMaxExt, DataArrayInt *da);;
+ void setArray(int meshDimRelToMaxExt, DataArrayInt32 *da);;
%extend
{
MEDFileEquivalenceCell *initCell()
virtual std::vector<int> getFamArrNonEmptyLevelsExt() const;
virtual std::vector<int> getNumArrNonEmptyLevelsExt() const;
virtual std::vector<int> getNameArrNonEmptyLevelsExt() const;
- virtual std::vector<int> getDistributionOfTypes(int meshDimRelToMax) const;
+ virtual std::vector<mcIdType> getDistributionOfTypes(int meshDimRelToMax) const;
virtual MEDFileMesh *cartesianize() const;
std::vector<int> getNonEmptyLevels() const;
std::vector<int> getNonEmptyLevelsExt() const;
void addFamily(const std::string& familyName, int id);
void addFamilyOnGrp(const std::string& grpName, const std::string& famName);
virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName);
- virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs);
+ virtual bool keepFamIdsOnlyOnLevs(const std::vector<mcIdType>& famIds, const std::vector<int>& levs);
void copyFamGrpMapsFrom(const MEDFileMesh& other);
void clearGrpMap();
void clearFamMap();
const std::map<std::string, std::vector<std::string> >& getGroupInfo() const;
std::vector<std::string> getFamiliesOnGroup(const std::string& name) const;
std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const;
- std::vector<int> getFamiliesIdsOnGroup(const std::string& name) const;
+ std::vector<mcIdType> getFamiliesIdsOnGroup(const std::string& name) const;
void setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams);
- void setFamiliesIdsOnGroup(const std::string& name, const std::vector<int>& famIds);
+ void setFamiliesIdsOnGroup(const std::string& name, const std::vector<mcIdType>& famIds);
std::vector<std::string> getGroupsOnFamily(const std::string& name) const;
void setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps);
std::vector<std::string> getGroupsNames() const;
std::vector<std::string> getFamiliesNames() const;
std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const;
- std::vector<int> getGrpNonEmptyLevelsExt(const std::string& grp) const;
- std::vector<int> getGrpNonEmptyLevels(const std::string& grp) const;
- std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
- std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
- std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
- std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
- std::vector<int> getFamNonEmptyLevels(const std::string& fam) const;
- std::vector<int> getFamNonEmptyLevelsExt(const std::string& fam) const;
+ std::vector<mcIdType> getGrpNonEmptyLevelsExt(const std::string& grp) const;
+ std::vector<mcIdType> getGrpNonEmptyLevels(const std::string& grp) const;
+ std::vector<mcIdType> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
+ std::vector<mcIdType> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
+ std::vector<mcIdType> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
+ std::vector<mcIdType> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
+ std::vector<mcIdType> getFamNonEmptyLevels(const std::string& fam) const;
+ std::vector<mcIdType> getFamNonEmptyLevelsExt(const std::string& fam) const;
std::vector<std::string> getFamiliesNamesWithFilePointOfView() const;
static std::string GetMagicFamilyStr();
void assignFamilyNameWithGroupName();
void changeFamilyName(const std::string& oldName, const std::string& newName);
void changeFamilyId(int oldId, int newId);
void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
- void setFamilyInfo(const std::map<std::string,int>& info);
+ void setFamilyInfo(const std::map<std::string,mcIdType>& info);
void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
int getFamilyId(const std::string& name) const;
int getMaxAbsFamilyId() const;
virtual int getMaxAbsFamilyIdInArrays() const;
virtual int getMaxFamilyIdInArrays() const;
virtual int getMinFamilyIdInArrays() const;
- DataArrayInt *getAllFamiliesIdsReferenced() const;
- DataArrayInt *computeAllFamilyIdsInUse() const;
- std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const;
+ DataArrayIdType *getAllFamiliesIdsReferenced() const;
+ DataArrayIdType *computeAllFamilyIdsInUse() const;
+ std::vector<mcIdType> getFamiliesIds(const std::vector<std::string>& famNames) const;
std::string getFamilyNameGivenId(int id) const;
bool ensureDifferentFamIdsPerLevel();
void normalizeFamIdsTrio();
virtual std::string advancedRepr() const;
//
virtual MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
- virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr);
- virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr);
+ virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr);
+ virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr);
virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr);
- virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr);
- virtual void addNodeGroup(const DataArrayInt *ids);
- virtual void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids);
- virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
- virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
- virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
- virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
- virtual DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const;
- virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
- virtual DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
- virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
+ virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr);
+ virtual void addNodeGroup(const DataArrayIdType *ids);
+ virtual void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids);
+ virtual DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
+ virtual DataArrayIdType *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
+ virtual DataArrayIdType *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
+ virtual DataArrayIdType *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
+ virtual DataArrayIdType *getNodeGroupArr(const std::string& grp, bool renum=false) const;
+ virtual DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
+ virtual DataArrayIdType *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
+ virtual DataArrayIdType *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
int getNumberOfJoints();
MEDFileJoints *getJoints();
void setJoints( MEDFileJoints* joints );
void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false)
{
- std::vector<const DataArrayInt *> grps;
- convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",grps);
+ std::vector<const DataArrayIdType *> grps;
+ convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayIdType *>(li,SWIGTITraits<mcIdType>::TI,"DataArrayInt",grps);
self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
}
PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const
{
- const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
+ const DataArrayIdType *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
if(tmp)
tmp->incrRef();
- return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
PyObject *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt)
{
- const DataArrayInt *tmp=self->getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt);
+ const DataArrayIdType *tmp=self->getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt);
if(tmp)
tmp->incrRef();
- return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const
{
- const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
+ const DataArrayIdType *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt);
if(tmp)
tmp->incrRef();
- return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const
{
- const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
+ const DataArrayIdType *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt);
if(tmp)
tmp->incrRef();
- return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const
PyObject *unPolyze()
{
- DataArrayInt *ret3=0;
- std::vector<int> ret1,ret2;
+ DataArrayIdType *ret3=0;
+ std::vector<mcIdType> ret1,ret2;
bool ret0=self->unPolyze(ret1,ret2,ret3);
PyObject *ret=PyTuple_New(4);
PyTuple_SetItem(ret,0,SWIG_From_bool(ret0));
}
PyTuple_SetItem(ret,2,retLev1_1);
//
- PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
return ret;
}
- virtual DataArrayInt *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
+ virtual DataArrayIdType *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const
{
- MCAuto<DataArrayInt> ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt));
+ MCAuto<DataArrayIdType> ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt));
return ret.retn();
}
}
MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
- DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
+ DataArrayIdType *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const;
MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const;
MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const;
void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m);
void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false);
void optimizeFamilies();
- DataArrayInt *zipCoords();
- DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
- DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
+ DataArrayIdType *zipCoords();
+ DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
+ DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;
MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const;
MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const;
MEDFileUMesh *quadraticToLinear(double eps=1e-12) const;
return MEDFileUMesh::New();
}
- static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, PyObject *types, const std::vector<int>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
+ static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, PyObject *types, const std::vector<mcIdType>& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0)
{
std::vector<int> typesCpp1;
convertPyToNewIntArr3(types,typesCpp1);
PyObject *__getstate__()
{
std::vector<double> a0;
- std::vector<int> a1;
+ std::vector<mcIdType> a1;
std::vector<std::string> a2;
- std::vector< MCAuto<DataArrayInt> > a3;
+ std::vector< MCAuto<DataArrayIdType> > a3;
MCAuto<DataArrayDouble> a4;
self->serialize(a0,a1,a2,a3,a4);
PyObject *ret(PyTuple_New(5));
PyObject *ret3(PyList_New(sz));
for(int i=0;i<sz;i++)
{
- DataArrayInt *elt(a3[i]);
+ DataArrayIdType *elt(a3[i]);
if(elt)
elt->incrRef();
- PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
}
PyTuple_SetItem(ret,3,ret3);
DataArrayDouble *ret4(a4);
if(sz!=5)
throw INTERP_KERNEL::Exception(MSG);
std::vector<double> a0;
- std::vector<int> a1;
+ std::vector<mcIdType> a1;
std::vector<std::string> a2;
- std::vector< MCAuto<DataArrayInt> > a3;
+ std::vector< MCAuto<DataArrayIdType> > a3;
MCAuto<DataArrayDouble> a4;
//
PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2));
- int tmp(-1);
+ mcIdType tmp(-1);
fillArrayWithPyListDbl3(a0py,tmp,a0);
convertPyToNewIntArr3(a1py,a1);
fillStringVector(a2py,a2);
if((DataArrayDouble *)a4)
a4->incrRef();
{
- std::vector< DataArrayInt * > a3Tmp;
- convertFromPyObjVectorOfObj<MEDCoupling::DataArrayInt *>(b0py,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",a3Tmp);
+ std::vector< DataArrayIdType * > a3Tmp;
+ convertFromPyObjVectorOfObj<MEDCoupling::DataArrayIdType *>(b0py,SWIGTITraits<mcIdType>::TI,"DataArrayInt",a3Tmp);
std::size_t sz(a3Tmp.size());
a3.resize(sz);
for(std::size_t i=0;i<sz;i++)
DataArrayDouble *a,*a2;
DataArrayDoubleTuple *aa,*aa2;
std::vector<double> bb,bb2;
- int sw;
+ mcIdType sw;
const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
MCAuto<MEDFileUMesh> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
PyObject *getAllDistributionOfTypes() const
{
- std::vector< std::pair<int,int> > ret(self->getAllDistributionOfTypes());
+ std::vector< std::pair<int,mcIdType> > ret(self->getAllDistributionOfTypes());
return convertVecPairIntToPy(ret);
}
- DataArrayInt *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const
+ DataArrayIdType *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const
{
- std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
+ std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
convertToMapIntDataArrayInt(extractDef,extractDefCpp);
return self->deduceNodeSubPartFromCellSubPart(extractDefCpp);
}
MEDFileUMesh *extractPart(PyObject *extractDef) const
{
- std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
+ std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
convertToMapIntDataArrayInt(extractDef,extractDefCpp);
return self->extractPart(extractDefCpp);
}
PyObject *buildInnerBoundaryAlongM1Group(const std::string& grpNameM1)
{
- DataArrayInt *ret0=0,*ret1=0,*ret2=0;
+ DataArrayIdType *ret0=0,*ret1=0,*ret2=0;
self->buildInnerBoundaryAlongM1Group(grpNameM1,ret0,ret1,ret2);
PyObject *ret=PyTuple_New(3);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
{
PyObject *getProfile(const std::string& pflName) const
{
- const DataArrayInt *ret=self->getProfile(pflName);
+ const DataArrayIdType *ret=self->getProfile(pflName);
if(ret)
ret->incrRef();
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
PyObject *getProfileFromId(int pflId) const
{
- const DataArrayInt *ret=self->getProfileFromId(pflId);
+ const DataArrayIdType *ret=self->getProfileFromId(pflId);
if(ret)
ret->incrRef();
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 );
}
PyObject *getLocalizationFromId(int locId) const
std::vector< std::vector<TypeOfField> > typesF;
std::vector< std::vector<std::string> > pfls;
std::vector< std::vector<std::string> > locs;
- std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
+ std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
int sz=ret.size();
PyObject *ret2=PyList_New(sz);
for(int i=0;i<sz;i++)
{
- const std::vector< std::pair<int,int> >& dadsI=ret[i];
+ const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
const std::vector<TypeOfField>& typesFI=typesF[i];
const std::vector<std::string>& pflsI=pfls[i];
const std::vector<std::string>& locsI=locs[i];
MEDFileAnyTypeField1TS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
{
- std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
+ std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
convertToMapIntDataArrayInt(extractDef,extractDefCpp);
return self->extractPart(extractDefCpp,mm);
}
MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
//
void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
- void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
- void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
+ void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false);
%extend
MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
//
void setFieldNoProfileSBT(const MEDCouplingFieldInt *field);
- void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
- void setFieldProfileFlatly(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
+ void setFieldProfileFlatly(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
void copyTimeInfoFrom(MEDCouplingFieldInt *mcf);
MEDCouplingFieldInt *field(const MEDFileMesh *mesh) const;
MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
return MEDFileField1TS_getFieldWithProfile<int>(self,type,meshDimRelToMax,mesh);
}
- DataArrayInt *getUndergroundDataArray() const
+ DataArrayInt32 *getUndergroundDataArray() const
{
- DataArrayInt *ret=self->getUndergroundDataArray();
+ DataArrayInt32 *ret=self->getUndergroundDataArray();
if(ret)
ret->incrRef();
return ret;
MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
//
void setFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
- void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
- void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
+ void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
void copyTimeInfoFrom(MEDCouplingFieldFloat *mcf);
MEDCouplingFieldFloat *field(const MEDFileMesh *mesh) const;
MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
std::vector< std::vector<TypeOfField> > typesF;
std::vector< std::vector<std::string> > pfls;
std::vector< std::vector<std::string> > locs;
- std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
+ std::vector< std::vector< std::pair<mcIdType,mcIdType> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
int sz=ret.size();
PyObject *ret2=PyList_New(sz);
for(int i=0;i<sz;i++)
{
- const std::vector< std::pair<int,int> >& dadsI=ret[i];
+ const std::vector< std::pair<mcIdType,mcIdType> >& dadsI=ret[i];
const std::vector<TypeOfField>& typesFI=typesF[i];
const std::vector<std::string>& pflsI=pfls[i];
const std::vector<std::string>& locsI=locs[i];
void eraseTimeStepIds(PyObject *li)
{
- int sw;
+ mcIdType sw;
int pos1;
std::vector<int> pos2;
- DataArrayInt *pos3=0;
+ DataArrayInt32 *pos3=0;
DataArrayIntTuple *pos4=0;
convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
switch(sw)
if(elt0 && PyList_Check(elt0))
{
int sz=PyList_Size(elt0);
- MCAuto<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
+ MCAuto<DataArrayInt32> da=DataArrayInt32::New(); da->alloc(sz,1);
int *pt=da->getPointer();
for(int i=0;i<sz;i++,pt++)
{
MEDFileAnyTypeFieldMultiTS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
{
- std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
+ std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
convertToMapIntDataArrayInt(extractDef,extractDefCpp);
return self->extractPart(extractDefCpp,mm);
}
MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
//
void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
- void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const;
%extend
{
PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
{
- DataArrayInt *ret1=0;
+ DataArrayIdType *ret1=0;
DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *getUndergroundDataArrayExt(int iteration, int order) const
{
- std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
+ std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > > elt1Cpp;
DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp);
if(elt0)
elt0->incrRef();
static MEDFileIntFieldMultiTS *New(DataArrayByte *db);
//
void appendFieldNoProfileSBT(const MEDCouplingFieldInt *field);
- void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
MEDCouplingFieldInt *field(int iteration, int order, const MEDFileMesh *mesh) const;
MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
{
- DataArrayInt *ret1=0;
- DataArrayInt *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
+ DataArrayIdType *ret1=0;
+ DataArrayInt32 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<int>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
- DataArrayInt *getUndergroundDataArray(int iteration, int order) const
+ DataArrayInt32 *getUndergroundDataArray(int iteration, int order) const
{
- DataArrayInt *ret=self->getUndergroundDataArray(iteration,order);
+ DataArrayInt32 *ret=self->getUndergroundDataArray(iteration,order);
if(ret)
ret->incrRef();
return ret;
static MEDFileFloatFieldMultiTS *New(DataArrayByte *db);
//
void appendFieldNoProfileSBT(const MEDCouplingFieldFloat *field);
- void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile);
MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
MEDCouplingFieldFloat *field(int iteration, int order, const MEDFileMesh *mesh) const;
MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const
{
- DataArrayInt *ret1=0;
+ DataArrayIdType *ret1=0;
DataArrayFloat *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
PyObject *ret=PyTuple_New(2);
PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayFloat, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
MEDFileFields *extractPart(PyObject *extractDef, MEDFileMesh *mm) const
{
- std::map<int, MCAuto<DataArrayInt> > extractDefCpp;
+ std::map<int, MCAuto<DataArrayIdType> > extractDefCpp;
convertToMapIntDataArrayInt(extractDef,extractDefCpp);
return self->extractPart(extractDefCpp,mm);
}
void eraseTimeStepIds(PyObject *ids)
{
- int sw;
+ mcIdType sw;
int pos1;
std::vector<int> pos2;
DataArrayInt *pos3=0;
public:
virtual MEDMeshMultiLev *prepare() const;
DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const;
- DataArrayInt *retrieveGlobalNodeIdsIfAny() const;
+ DataArrayIdType *retrieveGlobalNodeIdsIfAny() const;
protected:
~MEDMeshMultiLev();
public:
{
PyObject *retrieveFamilyIdsOnCells() const
{
- DataArrayInt *famIds(0);
+ DataArrayIdType *famIds(0);
bool isWithoutCopy(false);
self->retrieveFamilyIdsOnCells(famIds,isWithoutCopy);
PyObject *ret=PyTuple_New(2);
PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
Py_XINCREF(ret1Py);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(ret,1,ret1Py);
return ret;
}
PyObject *retrieveNumberIdsOnCells() const
{
- DataArrayInt *numIds(0);
+ DataArrayIdType *numIds(0);
bool isWithoutCopy(false);
self->retrieveNumberIdsOnCells(numIds,isWithoutCopy);
PyObject *ret=PyTuple_New(2);
PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
Py_XINCREF(ret1Py);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(ret,1,ret1Py);
return ret;
}
PyObject *retrieveFamilyIdsOnNodes() const
{
- DataArrayInt *famIds(0);
+ DataArrayIdType *famIds(0);
bool isWithoutCopy(false);
self->retrieveFamilyIdsOnNodes(famIds,isWithoutCopy);
PyObject *ret=PyTuple_New(2);
PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
Py_XINCREF(ret1Py);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(ret,1,ret1Py);
return ret;
}
PyObject *retrieveNumberIdsOnNodes() const
{
- DataArrayInt *numIds(0);
+ DataArrayIdType *numIds(0);
bool isWithoutCopy(false);
self->retrieveNumberIdsOnNodes(numIds,isWithoutCopy);
PyObject *ret=PyTuple_New(2);
PyObject *ret1Py=isWithoutCopy?Py_True:Py_False;
Py_XINCREF(ret1Py);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(ret,1,ret1Py);
return ret;
}
{
PyObject *buildVTUArrays() const
{
- DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayInt *cellLocations(0),*cells(0),*faceLocations(0),*faces(0);
+ DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayIdType *cellLocations(0),*cells(0),*faceLocations(0),*faces(0);
bool ncc(self->buildVTUArrays(coords,types,cellLocations,cells,faceLocations,faces));
PyObject *ret0Py=ncc?Py_True:Py_False;
Py_XINCREF(ret0Py);
PyTuple_SetItem(ret,0,ret0Py);
PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(coords),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(types),SWIGTYPE_p_MEDCoupling__DataArrayByte, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
}
PyObject *buildVTUArrays() const
{
DataArrayDouble *ret0(0);
- std::vector<int> ret1;
+ std::vector<mcIdType> ret1;
bool ret2;
self->buildVTUArrays(ret0,ret1,ret2);
std::size_t sz(ret1.size());
{
const char fileName[]="file10.med";
MEDCouplingUMesh *mesh1=build3DMesh_1();
- const int part1[5]={1,2,4,13,15};
+ const mcIdType part1[5]={1,2,4,13,15};
MEDCouplingUMesh *mesh2=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part1,part1+5,true);
mesh2->setName("mesh2");
- const int part2[4]={3,4,13,14};
+ const mcIdType part2[4]={3,4,13,14};
MEDCouplingUMesh *mesh3=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part2,part2+4,true);
mesh3->setName("mesh3");
MEDCouplingUMesh *mesh4=MEDCouplingUMesh::New();
mesh4->setName("mesh4");
mesh4->setMeshDimension(3);
mesh4->allocateCells(1);
- int conn[4]={0,11,1,3};
+ mcIdType conn[4]={0,11,1,3};
mesh4->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn);
mesh4->finishInsertingCells();
mesh4->setCoords(mesh1->getCoords());
//
MEDCouplingUMesh *mesh5=ReadUMeshFromFile(fileName,mnane);
mesh1->setName(mnane);
- const int part3[18]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
+ const mcIdType part3[18]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
MEDCouplingUMesh *mesh6=(MEDCouplingUMesh *)mesh5->buildPartOfMySelf(part3,part3+18,true);
mesh6->setName(mnane);
mesh5->decrRef();
const char fileName[]="file12.med";
MEDCouplingUMesh *mesh1=build3DMesh_1();
bool b;
- int newNbOfNodes;
- DataArrayInt *da=mesh1->mergeNodes(1e-12,b,newNbOfNodes);
+ mcIdType newNbOfNodes;
+ DataArrayIdType *da=mesh1->mergeNodes(1e-12,b,newNbOfNodes);
da->decrRef();
WriteUMesh(fileName,mesh1,true);
- const int part1[5]={1,2,4,13,15};
+ const mcIdType part1[5]={1,2,4,13,15};
MEDCouplingUMesh *mesh2=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part1,part1+5,true);
mesh2->setName(mesh1->getName().c_str());//<- important for the test
//
- int nbOfCells=mesh2->getNumberOfCells();
- CPPUNIT_ASSERT_EQUAL(5,nbOfCells);
+ mcIdType nbOfCells=mesh2->getNumberOfCells();
+ CPPUNIT_ASSERT_EQUAL(ToIdType(5),nbOfCells);
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
f1->setName("VectorFieldOnCells");
f1->setMesh(mesh2);
const char fileName[]="file19.med";
const char fileName2[]="file20.med";
MEDCouplingUMesh *m=build2DMesh_1();
- int nbOfNodes=m->getNumberOfNodes();
+ mcIdType nbOfNodes=m->getNumberOfNodes();
WriteUMesh(fileName,m,true);
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME);
f1->setName("VFieldOnNodes");
array->decrRef();
f1->setTime(3.14,2,7);
f1->checkConsistencyLight();
- const int arr2[2]={1,4};//node ids are 2,4,5,3,6,7
+ const mcIdType arr2[2]={1,4};//node ids are 2,4,5,3,6,7
MEDCouplingFieldDouble *f2=f1->buildSubPart(arr2,arr2+2);
(const_cast<MEDCouplingMesh *>(f2->getMesh()))->setName(f1->getMesh()->getName().c_str());
WriteField(fileName,f2,false);//<- false important for the test
CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12));
f3->decrRef();
//
- const int arr3[6]={1,3,0,5,2,4};
+ const mcIdType arr3[6]={1,3,0,5,2,4};
f2->renumberNodes(arr3);
WriteUMesh(fileName2,m,true);
WriteField(fileName2,f2,false);//<- false important for the test
std::copy(arr2,arr2+24,tmp);
f1->setTime(3.17,2,7);
//
- const int renumArr[12]={3,7,2,1,5,11,10,0,9,6,8,4};
+ const mcIdType renumArr[12]={3,7,2,1,5,11,10,0,9,6,8,4};
f1->renumberNodes(renumArr);
f1->checkConsistencyLight();
WriteField(fileName,f1,false);//<- false important for the test
{
const char fileName[]="file15.med";
MEDCouplingUMesh *mesh=build3DSurfMesh_1();
- const int renumber1[6]={2,5,1,0,3,4};
+ const mcIdType renumber1[6]={2,5,1,0,3,4};
mesh->renumberCells(renumber1,false);
mesh->checkConsistencyLight();
WriteUMesh(fileName,mesh,true);
f1->setTime(3.14,2,7);
f1->checkConsistencyLight();
//
- const int renumber1[6]={2,1,5,0,3,4};
+ const mcIdType renumber1[6]={2,1,5,0,3,4};
f1->renumberCells(renumber1,false);
WriteField(fileName,f1,true);
MEDCouplingFieldDouble *f2=dynamic_cast<MEDCouplingFieldDouble *>((MEDCouplingField *)ReadFieldCell(fileName,mesh->getName().c_str(),0,f1->getName().c_str(),2,7));
const char fileName[]="file17.med";
MEDCouplingUMesh *m=build3DMesh_2();
CPPUNIT_ASSERT_EQUAL(20,(int)m->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(45,m->getNumberOfNodes());
- const int polys[3]={1,4,6};
- std::vector<int> poly2(polys,polys+3);
+ CPPUNIT_ASSERT_EQUAL(ToIdType(45),m->getNumberOfNodes());
+ const mcIdType polys[3]={1,4,6};
+ std::vector<mcIdType> poly2(polys,polys+3);
m->convertToPolyTypes(&poly2[0],&poly2[0]+poly2.size());
- const int renum[20]={1,3,2,8,9,12,13,16,19,0,4,7,5,15,14,17,10,18,6,11};
+ const mcIdType renum[20]={1,3,2,8,9,12,13,16,19,0,4,7,5,15,14,17,10,18,6,11};
m->renumberCells(renum,false);
m->orientCorrectlyPolyhedrons();
// Writing
MEDCouplingUMesh *m3d=build3DMesh_2();
const double pt[3]={0.,0.,-0.3};
const double vec[3]={0.,0.,1.};
- std::vector<int> nodes;
+ std::vector<mcIdType> nodes;
m3d->findNodesOnPlane(pt,vec,1e-12,nodes);
MEDCouplingUMesh *m2d=(MEDCouplingUMesh *)m3d->buildFacePartOfMySelfNode(&nodes[0],&nodes[0]+nodes.size(),true);
- const int renumber[5]={1,2,0,4,3};
+ const mcIdType renumber[5]={1,2,0,4,3};
m2d->renumberCells(renumber,false);
m2d->setName("ExampleOfMultiDimW");
std::vector<const MEDCouplingUMesh *> meshes;
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(16,(int)mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getAllGeoTypes().size());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,mesh->getTypeOfCell(13));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,mesh->getTypeOfCell(14));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,mesh->getTypeOfCell(15));
- CPPUNIT_ASSERT_EQUAL((std::size_t)90,mesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(90),mesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(701,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+90,0));
CPPUNIT_ASSERT_EQUAL(705,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+17,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12);
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(0));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,mesh->getTypeOfCell(1));
- CPPUNIT_ASSERT_EQUAL((std::size_t)11,mesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(11),mesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(132,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+11,0));
CPPUNIT_ASSERT_EQUAL(16,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+3,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12);
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(7,(int)mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
for(int i=0;i<6;i++)
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,mesh->getTypeOfCell(6));
- CPPUNIT_ASSERT_EQUAL((std::size_t)36,mesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(36),mesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(254,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+36,0));
CPPUNIT_ASSERT_EQUAL(141,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+8,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12);
CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(16,(int)constMesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),constMesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(13));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(14));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(15));
- CPPUNIT_ASSERT_EQUAL((std::size_t)90,constMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(90),constMesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(701,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+90,0));
CPPUNIT_ASSERT_EQUAL(705,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+17,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12);
CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(16,(int)constMesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),constMesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(13));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(14));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(15));
- CPPUNIT_ASSERT_EQUAL((std::size_t)90,constMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(90),constMesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(701,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+90,0));
CPPUNIT_ASSERT_EQUAL(705,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+17,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12);
CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(16,(int)constMesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),constMesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(13));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(14));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(15));
- CPPUNIT_ASSERT_EQUAL((std::size_t)90,constMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(90),constMesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(701,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+90,0));
CPPUNIT_ASSERT_EQUAL(705,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+17,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12);
CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(16,(int)constMesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),constMesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size());
for(int i=0;i<12;i++)
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(13));
CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(14));
CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(15));
- CPPUNIT_ASSERT_EQUAL((std::size_t)90,constMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(90),constMesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(701,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+90,0));
CPPUNIT_ASSERT_EQUAL(705,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+17,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12);
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(538,(int)mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(579,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(579),mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
for(int i=0;i<514;i++)
CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,mesh->getTypeOfCell(i));
std::transform(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+12,expectedVals1,diffValue1,std::minus<double>());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::max_element(diffValue1,diffValue1+12),1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::min_element(diffValue1,diffValue1+12),1e-12);
- CPPUNIT_ASSERT_EQUAL((std::size_t)2768,mesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2768),mesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(651050,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+2768,0));
CPPUNIT_ASSERT_EQUAL(725943,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+539,0));
mesh->decrRef();
CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,constMesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(538,(int)constMesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(579,constMesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(579),constMesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,(int)constMesh->getAllGeoTypes().size());
for(int i=0;i<514;i++)
CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,constMesh->getTypeOfCell(i));
std::transform(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+12,expectedVals1,diffValue1,std::minus<double>());
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::max_element(diffValue1,diffValue1+12),1e-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::min_element(diffValue1,diffValue1+12),1e-12);
- CPPUNIT_ASSERT_EQUAL((std::size_t)2768,constMesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(2768),constMesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(651050,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+2768,0));
CPPUNIT_ASSERT_EQUAL(725943,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+539,0));
const double *values=field->getArray()->getPointer();
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size());
CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(0));
CPPUNIT_ASSERT_EQUAL(NORM_POLYHED,mesh->getTypeOfCell(1));
CPPUNIT_ASSERT_EQUAL(NORM_POLYHED,mesh->getTypeOfCell(2));
- CPPUNIT_ASSERT_EQUAL((std::size_t)98,mesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(98),mesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(725,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+98,0));
CPPUNIT_ASSERT_DOUBLES_EQUAL(110.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12);
CPPUNIT_ASSERT_EQUAL(155,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+4,0));
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(17,(int)mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getAllGeoTypes().size());
CPPUNIT_ASSERT_EQUAL(NORM_POLYGON,mesh->getTypeOfCell(0));
CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,mesh->getTypeOfCell(1));
CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,mesh->getTypeOfCell(15));
CPPUNIT_ASSERT_EQUAL(NORM_TRI3,mesh->getTypeOfCell(16));
CPPUNIT_ASSERT_DOUBLES_EQUAL(110.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12);
- CPPUNIT_ASSERT_EQUAL((std::size_t)83,mesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(83),mesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(619,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+83,0));
mesh->decrRef();
//
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(1,(int)mesh->getAllGeoTypes().size());
for(int i=0;i<3;i++)
CPPUNIT_ASSERT_EQUAL(NORM_POLYGON,mesh->getTypeOfCell(i));
- CPPUNIT_ASSERT_EQUAL((std::size_t)19,mesh->getNodalConnectivity()->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNodalConnectivity()->getNbOfElems());
CPPUNIT_ASSERT_EQUAL(117,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+19,0));
mesh->decrRef();
//
mesh=ReadUMeshFromFamilies(fileName.c_str(),meshNames[0].c_str(),0,families2);
CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension());
CPPUNIT_ASSERT_EQUAL(0,(int)mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension());
CPPUNIT_ASSERT_EQUAL(0,(int)mesh->getAllGeoTypes().size());
mesh->decrRef();
MEDCouplingUMesh *MEDLoaderTest::build1DMesh_1()
{
double coords[6]={ 0.0, 0.3, 0.75, 1.0, 1.4, 1.3 };
- int conn[9]={ 0,1, 1,2, 2,3 , 3,4,5};
+ mcIdType conn[9]={ 0,1, 1,2, 2,3 , 3,4,5};
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
mesh->setName("1DMesh_1");
mesh->setMeshDimension(1);
MEDCouplingUMesh *MEDLoaderTest::build2DCurveMesh_1()
{
double coords[12]={ 0.0,0.0, 0.3,0.3, 0.75,0.75, 1.0,1.0, 1.4,1.4, 1.3,1.3 };
- int conn[9]={ 0,1, 1,2, 2,3 , 3,4,5};
+ mcIdType conn[9]={ 0,1, 1,2, 2,3 , 3,4,5};
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
mesh->setName("2DCurveMesh_1");
mesh->setMeshDimension(1);
MEDCouplingUMesh *MEDLoaderTest::build2DMesh_1()
{
double targetCoords[24]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7, -0.05,0.95, 0.2,1.2, 0.45,0.95 };
- int targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4};
+ mcIdType targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(2);
targetMesh->allocateCells(6);
-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7,
-0.05,0.95, 0.2,1.2, 0.45,0.95
};
- int targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4};
+ mcIdType targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(2);
targetMesh->allocateCells(5);
-0.3,-0.3,-0.3, 0.2,-0.3,-0.3, 0.7,-0.3,-0.3, -0.3,0.2,-0.3, 0.2,0.2,-0.3, 0.7,0.2,-0.3, -0.3,0.7,-0.3, 0.2,0.7,-0.3, 0.7,0.7,-0.3
,-0.05,0.95,-0.3, 0.2,1.2,-0.3, 0.45,0.95,-0.3
};
- int targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4};
+ mcIdType targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4};
MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
targetMesh->setMeshDimension(2);
targetMesh->allocateCells(6);
0.,0.,3., 1.,1.,3., 1.,1.25,3., 0.,1.,3., 1.,1.5,3., 2.,0.,3., 2.,1.,3., 1.,2.,3., 0.,2.,3., 3.,1.,3.,
3.,2.,3., 0.,1.,3., 1.,3.,3., 2.,2.,3., 2.,3.,3.};
- int conn[354]={
+ mcIdType conn[354]={
// 0
0,11,1,3,15,26,16,18, 1,2,4,7,13,6,-1,1,16,21,6,-1,6,21,28,13,-1,13,7,22,28,-1,7,4,19,22,-1,4,2,17,19,-1,2,1,16,17,-1,16,21,28,22,19,17,
1,6,5,3,16,21,20,18, 13,10,9,6,28,25,24,21,
MEDCouplingUMesh *MEDLoaderTest::build3DMesh_2()
{
MEDCouplingUMesh *m3dsurfBase=build3DSurfMesh_1();
- int numbers[5]={0,1,2,3,5};
+ mcIdType numbers[5]={0,1,2,3,5};
MEDCouplingUMesh *m3dsurf=(MEDCouplingUMesh *)m3dsurfBase->buildPartOfMySelf(numbers,numbers+5,false);
m3dsurfBase->decrRef();
MEDCouplingUMesh *m1dBase=build1DMesh_1();
- int numbers2[4]={0,1,2,3};
+ mcIdType numbers2[4]={0,1,2,3};
MEDCouplingUMesh *m1d=(MEDCouplingUMesh *)m1dBase->buildPartOfMySelf(numbers2,numbers2+4,false);
m1dBase->decrRef();
m1d->changeSpaceDimension(3);
MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnCells_1()
{
MEDCouplingUMesh *mesh=build3DSurfMesh_1();
- int nbOfCells=mesh->getNumberOfCells();
+ mcIdType nbOfCells=mesh->getNumberOfCells();
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
f1->setName("VectorFieldOnCells");
f1->setMesh(mesh);
MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnNodes_1()
{
MEDCouplingUMesh *mesh=build3DSurfMesh_1();
- int nbOfNodes=mesh->getNumberOfNodes();
+ mcIdType nbOfNodes=mesh->getNumberOfNodes();
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME);
f1->setName("VectorFieldOnNodes");
f1->setMesh(mesh);
const int spaceDim = 2;
const int nbOfNodes = 6;
double coords[nbOfNodes*spaceDim] = {0,0, 1,0, 1,1, 0,1, 2,0, 2,1};
- int conn[8]={0,1,2,3, 1,4,5,2};
+ mcIdType conn[8]={0,1,2,3, 1,4,5,2};
MCAuto<MEDCouplingUMesh> mesh2d=MEDCouplingUMesh::New("Mesh",spaceDim);
mesh2d->allocateCells(2);
mesh2d->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn);
// Create families and groups
- MCAuto<DataArrayInt> fam = DataArrayInt::New();
+ MCAuto<DataArrayIdType> fam = DataArrayIdType::New();
fam->alloc(2,1);
- int elemsFams[2] = {-2,-3};
+ mcIdType elemsFams[2] = {-2,-3};
std::copy(elemsFams,elemsFams+2,fam->getPointer());
m->setFamilyFieldArr(0,fam);
- std::map<std::string,int> theFamilies;
+ std::map<std::string,mcIdType> theFamilies;
theFamilies["FAM_-1"]=-1;
theFamilies["FAM_-2"]=-2;
theFamilies["FAM_-3"]=-3;
-6.111413346910e-07,
-6.111413346910e-07};
- for (int i=0; i < field1d->getNumberOfTuples(); i++)
+ for (mcIdType i=0; i < field1d->getNumberOfTuples(); i++)
{
CPPUNIT_ASSERT_DOUBLES_EQUAL( values[i], field1d->getIJ(i, 0), 1e-12 );
}
pointeM1D->setCoords( coords );
pointeM1D->setMeshDimension( 2 );
pointeM1D->allocateCells( 3 );
- int conn[]=
+ mcIdType conn[]=
{
0,1,2, 0,1,3, 10,11,12,13
};
};
std::copy(vals,vals+d->getNbOfElems(),d->getPointer());
f1->setArray(d);
- MCAuto<DataArrayInt> da=DataArrayInt::New();
- int ids[] =
+ MCAuto<DataArrayIdType> da=DataArrayIdType::New();
+ mcIdType ids[] =
{
0,2
};
CPPUNIT_ASSERT( std::find(groups.begin(),groups.end(),"groupe4") != groups.end() );
CPPUNIT_ASSERT( std::find(groups.begin(),groups.end(),"groupe5") != groups.end() );
CPPUNIT_ASSERT( std::find(groups.begin(),groups.end(),"maa1") != groups.end() );
- CPPUNIT_ASSERT_EQUAL(16,m->getSizeAtLevel(0));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(16),m->getSizeAtLevel(0));
MCAuto<MEDCouplingMesh> um0 = m->getMeshAtLevel(0);
CPPUNIT_ASSERT_EQUAL(12, (int)um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TETRA4 ));
CPPUNIT_ASSERT_EQUAL(2, (int)um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_PYRA5 ));
// - Nombre de mailles de type MED_HEXA8 : 24
// - Nombre de mailles de type MED_PENTA6 : 3
MEDFileUMesh* m = static_cast<MEDFileUMesh*>( d2->getMeshes()->getMeshAtPos(0));
- CPPUNIT_ASSERT_EQUAL(6, m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TRI3 ));
- CPPUNIT_ASSERT_EQUAL(43, m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_QUAD4 ));
- CPPUNIT_ASSERT_EQUAL(24, m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_HEXA8 ));
- CPPUNIT_ASSERT_EQUAL(3, m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_PENTA6 ));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(6), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TRI3 ));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(43), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_QUAD4 ));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(24), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_HEXA8 ));
+ CPPUNIT_ASSERT_EQUAL(ToIdType(3), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_PENTA6 ));
}
void SauvLoaderTest::tearDown()
if (access(fileToRemove[i], F_OK) == 0)
#endif
#if defined(WIN32) && defined(UNICODE)
- _wremove(fileToRemove[i]);
+ _wremove(fileToRemove[i]);
#else
remove(fileToRemove[i]);
#endif
,_description("")
,_local_domain_number(0)
,_distant_domain_number(0)
- ,_node_corresp(0)
- ,_face_corresp(0)
,_local_mesh(0)
,_distant_mesh(0)
+ ,_node_corresp(0)
+ ,_face_corresp(0)
{
}
,_description(myConnectZone._description)
,_local_domain_number(myConnectZone._local_domain_number)
,_distant_domain_number(myConnectZone._distant_domain_number)
+ ,_local_mesh(0)
+ ,_distant_mesh(0)
,_node_corresp(myConnectZone._node_corresp)
,_face_corresp(myConnectZone._face_corresp)
,_entity_corresp(myConnectZone._entity_corresp)
- ,_local_mesh(0)
- ,_distant_mesh(0)
{
}
return false;
}
-const int *MEDPARTITIONER::ConnectZone::getNodeCorrespIndex() const
+const mcIdType *MEDPARTITIONER::ConnectZone::getNodeCorrespIndex() const
{
return _node_corresp->getIndex();
}
-const int *MEDPARTITIONER::ConnectZone::getNodeCorrespValue() const
+const mcIdType *MEDPARTITIONER::ConnectZone::getNodeCorrespValue() const
{
return _node_corresp->getValues();
}
-int MEDPARTITIONER::ConnectZone::getNodeNumber() const
+mcIdType MEDPARTITIONER::ConnectZone::getNodeNumber() const
{
return _node_corresp->getNumberOf();
}
return (const MEDCouplingSkyLineArray *)_node_corresp;
}
-const int *MEDPARTITIONER::ConnectZone::getFaceCorrespIndex() const
+const mcIdType *MEDPARTITIONER::ConnectZone::getFaceCorrespIndex() const
{
return _face_corresp->getIndex();
}
-const int *MEDPARTITIONER::ConnectZone::getFaceCorrespValue() const
+const mcIdType *MEDPARTITIONER::ConnectZone::getFaceCorrespValue() const
{
return _face_corresp->getValues();
}
-int MEDPARTITIONER::ConnectZone::getFaceNumber() const
+mcIdType MEDPARTITIONER::ConnectZone::getFaceNumber() const
{
return _face_corresp->getNumberOf();
}
return _face_corresp;
}
-const int *MEDPARTITIONER::ConnectZone::getEntityCorrespIndex(int localEntity,
- int distantEntity) const
+const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespIndex(int localEntity,
+ int distantEntity) const
{
typedef std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
return 0;
}
-const int *MEDPARTITIONER::ConnectZone::getEntityCorrespValue(int localEntity,
- int distantEntity) const
+const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespValue(int localEntity,
+ int distantEntity) const
{
typedef std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
return 0;
}
-int MEDPARTITIONER::ConnectZone::getEntityCorrespNumber(int localEntity,
- int distantEntity) const
+mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespNumber(int localEntity,
+ int distantEntity) const
{
typedef std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
return 0;
}
-int MEDPARTITIONER::ConnectZone::getEntityCorrespLength(int localEntity,
+mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespLength(int localEntity,
int distantEntity) const
{
typedef std::map<std::pair<int,int>, MEDCouplingSkyLineArray*>::const_iterator map_iter;
* the node-node connections
* to a MEDCouplingSkyLineArray
*/
-void MEDPARTITIONER::ConnectZone::setNodeCorresp(const int * nodeCorresp, int nbnode)
+void MEDPARTITIONER::ConnectZone::setNodeCorresp(const mcIdType * nodeCorresp, mcIdType nbnode)
{
- MCAuto<DataArrayInt> indexArr( DataArrayInt::New() );
- MCAuto<DataArrayInt> valueArr( DataArrayInt::New() );
+ MCAuto<DataArrayIdType> indexArr( DataArrayIdType::New() );
+ MCAuto<DataArrayIdType> valueArr( DataArrayIdType::New() );
indexArr->alloc( nbnode+1 );
valueArr->alloc( 2*nbnode );
- int * index = indexArr->getPointer();
- int * value = valueArr->getPointer();
- for (int i=0; i<nbnode; i++)
+ mcIdType * index = indexArr->getPointer();
+ mcIdType * value = valueArr->getPointer();
+ for (mcIdType i=0; i<nbnode; i++)
{
index[i]=2*i;
value[2*i ]=nodeCorresp[2*i];
* the face-face connections
* to a MEDCouplingSkyLineArray
*/
-void MEDPARTITIONER::ConnectZone::setFaceCorresp(const int * faceCorresp, int nbface)
+void MEDPARTITIONER::ConnectZone::setFaceCorresp(const mcIdType * faceCorresp, mcIdType nbface)
{
- MCAuto<DataArrayInt> indexArr( DataArrayInt::New() );
- MCAuto<DataArrayInt> valueArr( DataArrayInt::New() );
+ MCAuto<DataArrayIdType> indexArr( DataArrayIdType::New() );
+ MCAuto<DataArrayIdType> valueArr( DataArrayIdType::New() );
indexArr->alloc( nbface+1 );
valueArr->alloc( 2*nbface );
- int * index = indexArr->getPointer();
- int * value = valueArr->getPointer();
- for (int i=0; i<nbface; i++)
+ mcIdType * index = indexArr->getPointer();
+ mcIdType * value = valueArr->getPointer();
+ for (mcIdType i=0; i<nbface; i++)
{
index[i]=2*i;
value[2*i]=faceCorresp[2*i];
*
* the resulting MEDCouplingSkyLineArray is put in the map
*/
-void MEDPARTITIONER::ConnectZone::setEntityCorresp(int localEntity, int distantEntity,
- const int *entityCorresp, int nbentity)
+void MEDPARTITIONER::ConnectZone::setEntityCorresp(mcIdType localEntity, mcIdType distantEntity,
+ const mcIdType *entityCorresp, mcIdType nbentity)
{
- MCAuto<DataArrayInt> indexArr( DataArrayInt::New() );
- MCAuto<DataArrayInt> valueArr( DataArrayInt::New() );
+ MCAuto<DataArrayIdType> indexArr( DataArrayIdType::New() );
+ MCAuto<DataArrayIdType> valueArr( DataArrayIdType::New() );
indexArr->alloc( nbentity+1 );
valueArr->alloc( 2*nbentity );
- int * index = indexArr->getPointer();
- int * value = valueArr->getPointer();
- for (int i=0; i<nbentity; i++)
+ mcIdType * index = indexArr->getPointer();
+ mcIdType * value = valueArr->getPointer();
+ for (mcIdType i=0; i<nbentity; i++)
{
index[i]=2*i;
value[2*i ]=entityCorresp[2*i];
setEntityCorresp( localEntity, distantEntity, MEDCouplingSkyLineArray::New(indexArr,valueArr));
}
-void MEDPARTITIONER::ConnectZone::setEntityCorresp(int localEntity, int distantEntity,
+void MEDPARTITIONER::ConnectZone::setEntityCorresp(mcIdType localEntity, mcIdType distantEntity,
MEDCouplingSkyLineArray *array)
{
MEDCouplingSkyLineArray * nullArray = 0;
#include "MEDPARTITIONER.hxx"
#include "MCAuto.hxx"
+#include "MCType.hxx"
namespace MEDCoupling
{
MEDCouplingUMesh *getDistantMesh() const ;
bool isEntityCorrespPresent(int localEntity,int distantEntity) const;
- const int *getNodeCorrespIndex() const;
- const int *getNodeCorrespValue() const;
- int getNodeNumber() const;
+ const mcIdType *getNodeCorrespIndex() const;
+ const mcIdType *getNodeCorrespValue() const;
+ mcIdType getNodeNumber() const;
const MEDCouplingSkyLineArray * getNodeCorresp() const;
- const int *getFaceCorrespIndex() const;
- const int *getFaceCorrespValue() const;
- int getFaceNumber() const;
+ const mcIdType *getFaceCorrespIndex() const;
+ const mcIdType *getFaceCorrespValue() const;
+ mcIdType getFaceNumber() const;
const MEDCouplingSkyLineArray * getFaceCorresp() const;
- const int *getEntityCorrespIndex(int localEntity,
- int distantEntity) const;
- const int *getEntityCorrespValue(int localEntity,
- int distantEntity) const;
- int getEntityCorrespNumber(int localEntity,
- int distantEntity) const;
- int getEntityCorrespLength(int localEntity,
- int distantEntity) const;
+ const mcIdType *getEntityCorrespIndex(int localEntity,
+ int distantEntity) const;
+ const mcIdType *getEntityCorrespValue(int localEntity,
+ int distantEntity) const;
+ mcIdType getEntityCorrespNumber(int localEntity,
+ int distantEntity) const;
+ mcIdType getEntityCorrespLength(int localEntity,
+ int distantEntity) const;
const MEDCouplingSkyLineArray * getEntityCorresp(int localEntity,
- int distantEntity) const;
+ int distantEntity) const;
std::vector< std::pair< int,int > > getEntities() const;
void setName(const std::string& name) ;
void setLocalMesh(MEDCouplingUMesh * localMesh) ;
void setDistantMesh(MEDCouplingUMesh * distantMesh) ;
- void setNodeCorresp(const int * nodeCorresp, int nbnode);
+ void setNodeCorresp(const mcIdType * nodeCorresp, mcIdType nbnode);
void setNodeCorresp(MEDCouplingSkyLineArray* array);
- void setFaceCorresp(const int * faceCorresp, int nbface);
+ void setFaceCorresp(const mcIdType * faceCorresp, mcIdType nbface);
void setFaceCorresp(MEDCouplingSkyLineArray* array);
- void setEntityCorresp(int localEntity, int distantEntity,
- const int * entityCorresp, int nbentity);
- void setEntityCorresp(int localEntity, int distantEntity,
+ void setEntityCorresp(mcIdType localEntity, mcIdType distantEntity,
+ const mcIdType * entityCorresp, mcIdType nbentity);
+ void setEntityCorresp(mcIdType localEntity, mcIdType distantEntity,
MEDCouplingSkyLineArray *array);
private :
std::string _name;
int Graph::nbDomains() const
{
- std::set<int> domains;
+ std::set<mcIdType> domains;
if ( _partition.isNotNull() )
- if ( MEDCoupling::DataArrayInt* array = _partition->getValuesArray() )
+ if ( MEDCoupling::DataArrayIdType* array = _partition->getValuesArray() )
{
- for ( const int * dom = array->begin(); dom != array->end(); ++dom )
+ for ( const mcIdType * dom = array->begin(); dom != array->end(); ++dom )
domains.insert( *dom );
}
return domains.size();
}
- const int *Graph::getPart() const
+ const mcIdType *Graph::getPart() const
{
return _partition->getValues();
}
- int Graph::nbVertices() const
+ mcIdType Graph::nbVertices() const
{
return _graph->getNumberOf();
}
#include "MEDPARTITIONER.hxx"
#include "MCAuto.hxx"
+#include "MCType.hxx"
#include <string>
virtual void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=0) = 0;
//returns the partitioning
- const int *getPart() const;
+ const mcIdType *getPart() const;
//returns the number of graph vertices (which can correspond to the cells in the mesh!)
- int nbVertices() const;
+ mcIdType nbVertices() const;
// returns nb of domains in _partition
int nbDomains() const;
-
+
const MEDCouplingSkyLineArray *getGraph() const { return (const MEDCouplingSkyLineArray*)_graph; }
const MEDCouplingSkyLineArray *getPartition() const { return (const MEDCouplingSkyLineArray*)_partition; }
_create_empty_groups(create_empty_groups),
_joint_finder(0)
{
- std::vector<std::vector<std::vector<int> > > new2oldIds(initialCollection.getTopology()->nbDomain());
- std::vector<MEDCoupling::DataArrayInt*> o2nRenumber;
+ std::vector<std::vector<std::vector<mcIdType> > > new2oldIds(initialCollection.getTopology()->nbDomain());
+ std::vector<MEDCoupling::DataArrayIdType*> o2nRenumber;
castCellMeshes(initialCollection, new2oldIds, o2nRenumber );
//nodeMapping contains the mapping between old nodes and new nodes
// (iolddomain,ioldnode)->(inewdomain,inewnode)
createNodeMapping(initialCollection, nodeMapping);
- std::vector<std::vector<std::vector<int> > > new2oldFaceIds;
+ std::vector<std::vector<std::vector<mcIdType> > > new2oldFaceIds;
castFaceMeshes(initialCollection, nodeMapping, new2oldFaceIds);
////////////////////
*/
void MEDPARTITIONER::MeshCollection::castCellMeshes(MeshCollection& initialCollection,
- std::vector<std::vector<std::vector<int> > >& new2oldIds,
- std::vector<MEDCoupling::DataArrayInt*> & o2nRenumber)
+ std::vector<std::vector<std::vector<mcIdType> > >& new2oldIds,
+ std::vector<MEDCoupling::DataArrayIdType*> & o2nRenumber)
{
if (MyGlobals::_Verbose>10)
std::cout << "proc " << MyGlobals::_Rank << " : castCellMeshes" << std::endl;
_mesh[inew]=MEDCoupling::MEDCouplingUMesh::MergeUMeshes(meshes);
o2nRenumber[inew]=_mesh[inew]->sortCellsInMEDFileFrmt();
bool areNodesMerged;
- int nbNodesMerged;
+ mcIdType nbNodesMerged;
if (meshes.size()>1)
{
- MEDCoupling::DataArrayInt* array=_mesh[inew]->mergeNodes(1e-12,areNodesMerged,nbNodesMerged);
+ MEDCoupling::DataArrayIdType* array=_mesh[inew]->mergeNodes(1e-12,areNodesMerged,nbNodesMerged);
array->decrRef(); // array is not used in this case
}
_mesh[inew]->zipCoords();
*/
void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialCollection,
const std::multimap<std::pair<int,int>, std::pair<int,int> >& nodeMapping,
- std::vector<std::vector<std::vector<int> > >& new2oldIds)
+ std::vector<std::vector<std::vector<mcIdType> > >& new2oldIds)
{
//splitMeshes structure will contain the partition of
//the old faces on the new ones
{
for (int ielem=0; ielem<meshesCastFrom[iold]->getNumberOfCells(); ielem++)
{
- vector<int> nodes;
+ vector<mcIdType> nodes;
meshesCastFrom[iold]->getNodeIdsOfCell(ielem,nodes);
map <int,int> faces;
void MEDPARTITIONER::MeshCollection::castIntField(std::vector<MEDCoupling::MEDCouplingUMesh*>& meshesCastFrom,
std::vector<MEDCoupling::MEDCouplingUMesh*>& meshesCastTo,
- std::vector<MEDCoupling::DataArrayInt*>& arrayFrom,
+ std::vector<MEDCoupling::DataArrayIdType*>& arrayFrom,
std::string nameArrayTo)
{
using std::vector;
void MEDPARTITIONER::MeshCollection::remapIntField(int inew, int iold,
const MEDCoupling::MEDCouplingUMesh& sourceMesh,
const MEDCoupling::MEDCouplingUMesh& targetMesh,
- const int* fromArray,
+ const mcIdType* fromArray,
std::string nameArrayTo,
const BBTreeOfDim* myTree)
{
if (sourceMesh.getNumberOfCells()<=0) return; //empty mesh could exist
MEDCoupling::DataArrayDouble* targetCoords=targetMesh.computeCellCenterOfMass();
const double* tc=targetCoords->getConstPointer();
- int targetSize=targetMesh.getNumberOfCells();
- int sourceSize=sourceMesh.getNumberOfCells();
+ mcIdType targetSize=targetMesh.getNumberOfCells();
+ mcIdType sourceSize=sourceMesh.getNumberOfCells();
if (MyGlobals::_Verbose>200)
std::cout<<"remap vers target de taille "<<targetSize<<std::endl;
- std::vector<int> ccI;
+ std::vector<mcIdType> ccI;
std::string str,cle;
str=nameArrayTo+"_toArray";
cle=Cle1ToStr(str,inew);
- int* toArray;
+ mcIdType* toArray;
const BBTreeOfDim* tree;
bool cleantree=false;
{
if (MyGlobals::_Is0verbose>100)
std::cout << "create " << cle << " size " << targetSize << std::endl;
- MEDCoupling::DataArrayInt* p=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType* p=MEDCoupling::DataArrayIdType::New();
p->alloc(targetSize,1);
p->fillWithZero();
toArray=p->getPointer();
throw INTERP_KERNEL::Exception("Error remapDoubleField only on cellFieldDouble");
std::string key=Cle2ToStr("cellFamily_ccI",inew,iold);
- std::map<std::string,MEDCoupling::DataArrayInt*>::iterator it1;
+ std::map<std::string,MEDCoupling::DataArrayIdType*>::iterator it1;
it1=_map_dataarray_int.find(key);
if (it1==_map_dataarray_int.end())
{
return;
}
//create ccI in remapIntField
- MEDCoupling::DataArrayInt *ccI=it1->second;
+ MEDCoupling::DataArrayIdType *ccI=it1->second;
if (MyGlobals::_Verbose>300)
std::cout << "proc " << MyGlobals::_Rank << " : remapDoubleField " << key << " size " << ccI->getNbOfElems() << std::endl;
- int nbcell=this->getMesh()[inew]->getNumberOfCells();
- int nbcomp=fromArray->getNumberOfComponents();
+ mcIdType nbcell=this->getMesh()[inew]->getNumberOfCells();
+ std::size_t nbcomp=fromArray->getNumberOfComponents();
int nbPtGauss=StrToInt(ExtractFromDescription(descriptionField, "nbPtGauss="));
std::string tag="inewFieldDouble="+IntToStr(inew);
else
{
//replaced by setPartOfValuesAdv if nbPtGauss==1
- int iMax=ccI->getNbOfElems();
- int* pccI=ccI->getPointer();
+ mcIdType iMax=ccI->getNbOfElems();
+ mcIdType* pccI=ccI->getPointer();
double* pField=field->getPointer();
double* pFrom=fromArray->getPointer();
int itarget, isource, delta=nbPtGauss*nbcomp;
*/
//================================================================================
- DataArrayInt* sortCorrespondences( DataArrayInt* ids1,
- DataArrayInt* ids2,
- int delta,
- bool removeEqual = false)
+ DataArrayIdType* sortCorrespondences( DataArrayIdType* ids1,
+ DataArrayIdType* ids2,
+ int delta,
+ bool removeEqual = false)
{
// sort
- MCAuto< DataArrayInt > renumN2O = ids1->buildPermArrPerLevel();
+ MCAuto< DataArrayIdType > renumN2O = ids1->buildPermArrPerLevel();
ids1->renumberInPlaceR( renumN2O->begin() );
ids2->renumberInPlaceR( renumN2O->begin() );
}
if ( delta != 0 )
{
- int * id = ids1->getPointer();
+ mcIdType * id = ids1->getPointer();
for ( ; id < ids1->end(); ++id )
++(*id);
id = ids2->getPointer();
}
// join
- DataArrayInt* ids12 = DataArrayInt::Meld( ids1, ids2 ); // two components
+ DataArrayIdType* ids12 = DataArrayIdType::Meld( ids1, ids2 ); // two components
ids12->rearrange( 1 ); // make one component
return ids12;
}
*/
//================================================================================
- void renumber( DataArrayInt* ids, const DataArrayInt* o2nRenumber )
+ void renumber( DataArrayIdType* ids, const DataArrayIdType* o2nRenumber )
{
if ( !ids || !o2nRenumber )
return;
- int * id = ids->getPointer();
- const int * o2n = o2nRenumber->getConstPointer();
+ mcIdType * id = ids->getPointer();
+ const mcIdType * o2n = o2nRenumber->getConstPointer();
for ( ; id < ids->end(); ++id )
{
*id = o2n[ *id ];
//================================================================================
void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeMapping,
- const std::vector<MEDCoupling::DataArrayInt*> & o2nRenumber,
+ const std::vector<MEDCoupling::DataArrayIdType*> & o2nRenumber,
int nbInitialDomains)
{
if ( !MyGlobals::_Create_Joints || _topology->nbDomain() < 2 )
// 1) add node correspondences
// ==================================
- std::vector< std::vector< std::vector< int > > > nodeCorresp( nb_domains );
+ std::vector< std::vector< std::vector< mcIdType > > > nodeCorresp( nb_domains );
for ( int idomain = 0; idomain < nb_domains; ++idomain )
{
nodeCorresp[ idomain ].resize( nb_domains );
{
for ( int idomainNear = 0; idomainNear < nb_domains; ++idomainNear )
{
- std::vector< int > & corresp = nodeCorresp[ idomain ][ idomainNear ];
+ std::vector< mcIdType > & corresp = nodeCorresp[ idomain ][ idomainNear ];
if ( corresp.empty() )
continue;
// separate ids of two domains
const MEDCoupling::MEDCouplingSkyLineArray *corrArray = cz->getEntityCorresp( 0, 0 );
- const DataArrayInt* ids12 = corrArray->getValuesArray();
- MCAuto<DataArrayInt> ids1, ids2, ids12Sorted;
+ const DataArrayIdType* ids12 = corrArray->getValuesArray();
+ MCAuto<DataArrayIdType> ids1, ids2, ids12Sorted;
ids1 = ids12->selectByTupleIdSafeSlice( 0, corrArray->getLength(), 2 );
ids2 = ids12->selectByTupleIdSafeSlice( 1, corrArray->getLength(), 2 );
}
else // split and sort
{
- typedef std::pair< std::vector< int >, std::vector< int > > T2Vecs;
+ typedef std::pair< std::vector< mcIdType >, std::vector< mcIdType > > T2Vecs;
T2Vecs idsByType[ INTERP_KERNEL::NORM_MAXTYPE ][ INTERP_KERNEL::NORM_MAXTYPE ];
int t1, t2;
- const int nbIds = ids1->getNbOfElems();
- const int * p1 = ids1->begin(), * p2 = ids2->begin();
- for ( int i = 0; i < nbIds; ++i )
+ const mcIdType nbIds = ids1->getNbOfElems();
+ const mcIdType * p1 = ids1->begin(), * p2 = ids2->begin();
+ for ( mcIdType i = 0; i < nbIds; ++i )
{
t1 = mesh1->getTypeOfCell( p1[ i ]);
t2 = mesh2->getTypeOfCell( p2[ i ]);
// separate ids of two domains
const MEDCoupling::MEDCouplingSkyLineArray *corrArray = cz->getNodeCorresp();
- const DataArrayInt *ids12 = corrArray->getValuesArray();
- MCAuto<DataArrayInt> ids1, ids2, ids12Sorted;
+ const DataArrayIdType *ids12 = corrArray->getValuesArray();
+ MCAuto<DataArrayIdType> ids1, ids2, ids12Sorted;
ids1 = ids12->selectByTupleIdSafeSlice( 0, corrArray->getLength(), 2 );
ids2 = ids12->selectByTupleIdSafeSlice( 1, corrArray->getLength(), 2 );
_group_info.erase( groupName );
// get family IDs array
- int* famIDs = 0;
+ mcIdType* famIDs = 0;
int inew = (is2nd ? inew2 : inew1 );
- int totalNbFaces = _face_mesh[ inew ] ? _face_mesh[ inew ]->getNumberOfCells() : 0;
+ mcIdType totalNbFaces = _face_mesh[ inew ] ? _face_mesh[ inew ]->getNumberOfCells() : 0;
std::string cle = Cle1ToStr( "faceFamily_toArray", inew );
if ( !_map_dataarray_int.count(cle) )
{
if ( totalNbFaces > 0 )
{
- MEDCoupling::DataArrayInt* p=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType* p=MEDCoupling::DataArrayIdType::New();
p->alloc( totalNbFaces, 1 );
p->fillWithZero();
famIDs = p->getPointer();
famIDs = _map_dataarray_int.find(cle)->second->getPointer();
}
// find a family ID of an existing JOINT group
- int familyID = 0;
- std::map<std::string, int>::iterator name2id = _family_info.find( groupName );
+ mcIdType familyID = 0;
+ std::map<std::string, mcIdType>::iterator name2id = _family_info.find( groupName );
if ( name2id != _family_info.end() )
familyID = name2id->second;
if ( familyID == 0 ) // generate a family ID for JOINT group
{
- std::set< int > familyIDs;
+ std::set< mcIdType > familyIDs;
for ( name2id = _family_info.begin(); name2id != _family_info.end(); ++name2id )
familyIDs.insert( name2id->second );
// find the next free family ID
if (_face_family_ids[i]!=0)
_face_family_ids[i]->decrRef();
- for (std::map<std::string, MEDCoupling::DataArrayInt*>::iterator it=_map_dataarray_int.begin() ; it!=_map_dataarray_int.end(); it++ )
+ for (std::map<std::string, MEDCoupling::DataArrayIdType*>::iterator it=_map_dataarray_int.begin() ; it!=_map_dataarray_int.end(); it++ )
if ((*it).second!=0)
(*it).second->decrRef();
//looking for reverse nodal connectivity i global numbering
if (isParallelMode() && !_domain_selector->isMyDomain(0))
{
- vector<int> value;
- vector<int> index(1,0);
+ vector<mcIdType> value;
+ vector<mcIdType> index(1,0);
array = MEDCoupling::MEDCouplingSkyLineArray::New(index,value);
return;
continue;
meshDim = _mesh[idomain]->getMeshDimension();
- MEDCoupling::DataArrayInt* index=MEDCoupling::DataArrayInt::New();
- MEDCoupling::DataArrayInt* revConn=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType* index=MEDCoupling::DataArrayIdType::New();
+ MEDCoupling::DataArrayIdType* revConn=MEDCoupling::DataArrayIdType::New();
int nbNodes=_mesh[idomain]->getNumberOfNodes();
_mesh[idomain]->getReverseNodalConnectivity(revConn,index);
//problem saturation over 1 000 000 nodes for 1 proc
if (MyGlobals::_Verbose>100)
std::cout << "proc " << MyGlobals::_Rank << " : getReverseNodalConnectivity done on " << nbNodes << " nodes" << std::endl;
- int* index_ptr=index->getPointer();
- int* revConnPtr=revConn->getPointer();
+ mcIdType* index_ptr=index->getPointer();
+ mcIdType* revConnPtr=revConn->getPointer();
for (int i=0; i<nbNodes; i++)
{
- for (int icell=index_ptr[i]; icell<index_ptr[i+1]; icell++)
+ for (mcIdType icell=index_ptr[i]; icell<index_ptr[i+1]; icell++)
{
- int globalNode=_topology->convertNodeToGlobal(idomain,i);
- int globalCell=_topology->convertCellToGlobal(idomain,revConnPtr[icell]);
+ mcIdType globalNode=_topology->convertNodeToGlobal(idomain,i);
+ mcIdType globalCell=_topology->convertCellToGlobal(idomain,revConnPtr[icell]);
node2cell.insert(make_pair(globalNode, globalCell));
}
}
if (MyGlobals::_Verbose>50)
std::cout << "proc " << MyGlobals::_Rank << " : create skylinearray" << std::endl;
//filling up index and value to create skylinearray structure
- std::vector <int> index,value;
+ std::vector <mcIdType> index,value;
index.push_back(0);
int idep=0;
*
* returns a topology based on the new partition
*/
-MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::createPartition(const int* partition)
+MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::createPartition(const mcIdType* partition)
{
MEDCoupling::MEDCouplingSkyLineArray* array=0;
int* edgeweights=0;
}
//returns true if inodes of a face are in inodes of a cell
-bool isFaceOncell(std::vector< int >& inodesFace, std::vector< int >& inodesCell)
+bool isFaceOncell(std::vector< mcIdType >& inodesFace, std::vector< mcIdType >& inodesCell)
{
int ires=0;
int nbok=inodesFace.size();
for (int i=0; i<nbok; i++)
{
- int ii=inodesFace[i];
+ mcIdType ii=inodesFace[i];
if (ii<0)
std::cout << "isFaceOncell problem inodeface<0" << std::endl;
for (int j=0; j<(int)inodesCell.size(); j++)
if (nodeIds.size()==0)
continue; //one empty mesh nothing to do
- MEDCoupling::DataArrayInt *revNodalCel=MEDCoupling::DataArrayInt::New();
- MEDCoupling::DataArrayInt *revNodalIndxCel=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType *revNodalCel=MEDCoupling::DataArrayIdType::New();
+ MEDCoupling::DataArrayIdType *revNodalIndxCel=MEDCoupling::DataArrayIdType::New();
mcel->getReverseNodalConnectivity(revNodalCel,revNodalIndxCel);
- int *revC=revNodalCel->getPointer();
- int *revIndxC=revNodalIndxCel->getPointer();
+ mcIdType *revC=revNodalCel->getPointer();
+ mcIdType *revIndxC=revNodalIndxCel->getPointer();
- std::vector< int > faceOnCell;
- std::vector< int > faceNotOnCell;
- int nbface=mfac->getNumberOfCells();
- for (int iface=0; iface<nbface; iface++)
+ std::vector< mcIdType > faceOnCell;
+ std::vector< mcIdType > faceNotOnCell;
+ mcIdType nbface=mfac->getNumberOfCells();
+ for (mcIdType iface=0; iface<nbface; iface++)
{
bool ok;
- std::vector< int > inodesFace;
+ std::vector< mcIdType > inodesFace;
mfac->getNodeIdsOfCell(iface, inodesFace);
int nbnodFace=inodesFace.size();
if ( nbnodFace != mfac->getNumberOfNodesInCell( iface ))
int nbcell=revIndxC[inod+1]-revIndxC[inod];
for (int j=0; j<nbcell; j++) //look for each cell with inod
{
- int icel=revC[revIndxC[inod]+j];
- std::vector< int > inodesCell;
+ mcIdType icel=revC[revIndxC[inod]+j];
+ std::vector< mcIdType > inodesCell;
mcel->getNodeIdsOfCell(icel, inodesCell);
ok=isFaceOncell(inodesFace, inodesCell);
if (ok) break;
std::string key = Cle1ToStr("faceFamily_toArray",inew);
if ( getMapDataArrayInt().count( key ))
{
- MEDCoupling::DataArrayInt * & fam = getMapDataArrayInt()[ key ];
- MEDCoupling::DataArrayInt * famFilter = MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType * & fam = getMapDataArrayInt()[ key ];
+ MEDCoupling::DataArrayIdType * famFilter = MEDCoupling::DataArrayIdType::New();
famFilter->alloc(faceOnCell.size(),1);
- int* pfamFilter = famFilter->getPointer();
- int* pfam = fam->getPointer();
+ mcIdType* pfamFilter = famFilter->getPointer();
+ mcIdType* pfam = fam->getPointer();
for ( size_t i=0; i<faceOnCell.size(); i++ )
pfamFilter[i]=pfam[faceOnCell[i]];
fam->decrRef();
const std::string& ="", int* edgeweights=0, int* verticesweights=0);
//creation of a user specified partition
- Topology* createPartition(const int* partition);
+ Topology* createPartition(const mcIdType* partition);
//getting mesh dimension
int getMeshDimension() const;
MEDCoupling::MEDCouplingUMesh* getFaceMesh(int idomain);
std::vector<MEDCoupling::MEDCouplingUMesh*>& getGroupMeshes(int idomain);
- std::vector<MEDCoupling::DataArrayInt*>& getCellFamilyIds() { return _cell_family_ids; }
- std::vector<MEDCoupling::DataArrayInt*>& getFaceFamilyIds() { return _face_family_ids; }
+ std::vector<MEDCoupling::DataArrayIdType*>& getCellFamilyIds() { return _cell_family_ids; }
+ std::vector<MEDCoupling::DataArrayIdType*>& getFaceFamilyIds() { return _face_family_ids; }
- std::map<std::string, MEDCoupling::DataArrayInt*>& getMapDataArrayInt() { return _map_dataarray_int; }
+ std::map<std::string, MEDCoupling::DataArrayIdType*>& getMapDataArrayInt() { return _map_dataarray_int; }
std::map<std::string, MEDCoupling::DataArrayDouble*>& getMapDataArrayDouble() { return _map_dataarray_double; }
- std::map<std::string,int>& getFamilyInfo() { return _family_info; }
+ std::map<std::string,mcIdType>& getFamilyInfo() { return _family_info; }
std::map<std::string, std::vector<std::string> >& getGroupInfo() { return _group_info; }
MEDCoupling::DataArrayDouble* getField(std::string descriptionField, int iold);
std::multimap<std::pair<int,int>,std::pair<int,int> >& nodeMapping);
void castCellMeshes(MeshCollection& initialCollection,
- std::vector<std::vector<std::vector<int> > >& new2oldIds,
- std::vector<MEDCoupling::DataArrayInt*> & o2nRenumber);
+ std::vector<std::vector<std::vector<mcIdType> > >& new2oldIds,
+ std::vector<MEDCoupling::DataArrayIdType*> & o2nRenumber);
//creates faces on the new collection
void castFaceMeshes(MeshCollection& initialCollection,
const std::multimap<std::pair<int,int>, std::pair<int,int> >& nodeMapping,
- std::vector<std::vector<std::vector<int> > >& new2oldIds);
+ std::vector<std::vector<std::vector<mcIdType> > >& new2oldIds);
//constructing connect zones
void buildConnectZones( const NodeMapping& nodeMapping,
- const std::vector<MEDCoupling::DataArrayInt*> & o2nRenumber,
+ const std::vector<MEDCoupling::DataArrayIdType*> & o2nRenumber,
int nbInitialDomains );
// Find faces common with neighbor domains and put them in groups
private:
void castIntField(std::vector<MEDCoupling::MEDCouplingUMesh*>& meshesCastFrom,
std::vector<MEDCoupling::MEDCouplingUMesh*>& meshesCastTo,
- std::vector<MEDCoupling::DataArrayInt*>& arrayFrom,
+ std::vector<MEDCoupling::DataArrayIdType*>& arrayFrom,
std::string nameArrayTo);
void castAllFields(MeshCollection& initialCollection,
void remapIntField(int inew, int iold,
const MEDCoupling::MEDCouplingUMesh& sourceMesh,
const MEDCoupling::MEDCouplingUMesh& targetMesh,
- const int* fromArray,
+ const mcIdType* fromArray,
std::string nameArrayTo,
const BBTreeOfDim* tree);
int _i_non_empty_mesh;
//family ids storages
- std::vector<MEDCoupling::DataArrayInt*> _cell_family_ids;
- std::vector<MEDCoupling::DataArrayInt*> _face_family_ids;
+ std::vector<MEDCoupling::DataArrayIdType*> _cell_family_ids;
+ std::vector<MEDCoupling::DataArrayIdType*> _face_family_ids;
//DataArrayInt* storages
- std::map<std::string, MEDCoupling::DataArrayInt*> _map_dataarray_int;
+ std::map<std::string, MEDCoupling::DataArrayIdType*> _map_dataarray_int;
//DataArrayDouble* storages
std::map<std::string, MEDCoupling::DataArrayDouble*> _map_dataarray_double;
std::vector<std::string> _field_descriptions;
//group family conversion
- std::map<std::string, int> _family_info;
+ std::map<std::string, mcIdType> _family_info;
std::map<std::string, std::vector<std::string> > _group_info;
//list of groups that are not to be split
(_collection->getFaceMesh()).push_back(mfm->getLevelM1Mesh(false));
//reading family ids
- MEDCoupling::DataArrayInt* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCopy());
- MEDCoupling::DataArrayInt* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCopy());
+ MEDCoupling::DataArrayIdType* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCopy());
+ MEDCoupling::DataArrayIdType* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCopy());
(_collection->getCellFamilyIds()).push_back(cellIds);
(_collection->getFaceFamilyIds()).push_back(faceIds);
{
(_collection->getMesh())[idomain]=mfm->getLevel0Mesh(false);
//reading families groups
- MEDCoupling::DataArrayInt* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCopy());
+ MEDCoupling::DataArrayIdType* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCopy());
(_collection->getCellFamilyIds())[idomain]=cellIds;
}
catch(...)
{
(_collection->getMesh())[idomain]=CreateEmptyMEDCouplingUMesh(); // or 0 if you want tests;
- MEDCoupling::DataArrayInt* empty=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType* empty=MEDCoupling::DataArrayIdType::New();
empty->alloc(0,1);
(_collection->getCellFamilyIds())[idomain]=empty;
std::cout<<"\nNO Level0Mesh (Cells)\n";
{
(_collection->getFaceMesh())[idomain]=mfm->getLevelM1Mesh(false);
//reading families groups
- MEDCoupling::DataArrayInt* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCopy());
+ MEDCoupling::DataArrayIdType* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCopy());
(_collection->getFaceFamilyIds())[idomain]=faceIds;
if (MyGlobals::_Verbose>10)
std::cout << "proc " << MyGlobals::_Rank << " : WITH Faces\n";
catch(...)
{
(_collection->getFaceMesh())[idomain]=CreateEmptyMEDCouplingUMesh(); // or 0 if you want test;
- MEDCoupling::DataArrayInt* empty=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType* empty=MEDCoupling::DataArrayIdType::New();
(_collection->getFaceFamilyIds())[idomain]=empty;
if (MyGlobals::_Verbose>10)
std::cout << "proc " << MyGlobals::_Rank << " : WITHOUT Faces\n";
r1=SelectTagsInVectorOfString(r1,"DT="+IntToStr(DT));
r1=SelectTagsInVectorOfString(r1,"IT="+IntToStr(IT));
//not saved in file? field->setDescription(ExtractFromDescription(r1[0], "fieldDescription="));
- int nbc=StrToInt(ExtractFromDescription(r1[0], "nbComponents="));
+ std::size_t nbc=StrToInt(ExtractFromDescription(r1[0], "nbComponents="));
if (nbc==da->getNumberOfComponents())
{
- for (int i=0; i<nbc; i++)
+ for (std::size_t i=0; i<nbc; i++)
da->setInfoOnComponent(i,ExtractFromDescription(r1[0], "componentInfo"+IntToStr(i)+"="));
}
else
std::cout << "proc " << MyGlobals::_Rank << " : METISGraph::partGraph" << std::endl;
//number of graph vertices
- int n=_graph->getNumberOf();
+ int n=FromIdType<int>(_graph->getNumberOf());
//graph
+#ifdef MEDCOUPLING_USE_64BIT_IDS
+ std::vector<int> indexVec( _graph->getIndex(), _graph->getIndexArray()->end() );
+ std::vector<int> valueVec( _graph->getValues(), _graph->getValuesArray()->end() );
+ int * xadj=indexVec.data();
+ int * adjncy=valueVec.data();
+#else
int * xadj=const_cast<int*>(_graph->getIndex());
int * adjncy=const_cast<int*>(_graph->getValues());
+#endif
//constraints
int * vwgt=_cell_weight;
int * adjwgt=_edge_weight;
for (int i=0; i<n; i++)
partition[i]=0;
}
- vector<int> index(n+1);
- vector<int> value(n);
+ vector<mcIdType> index(n+1);
+ vector<mcIdType> value(n);
index[0]=0;
for (int i=0; i<n; i++)
{
index[i+1]=index[i]+1;
- value[i]=partition[i];
+ value[i]=ToIdType(partition[i]);
}
delete [] partition;
if (cz[icz]->getLocalDomainNumber() == idomain &&
cz[icz]->getLocalDomainNumber()>cz[icz]->getDistantDomainNumber())
{
- int nb_node= cz[icz]->getNodeNumber();
- const int* node_corresp=cz[icz]->getNodeCorrespValue();
+ mcIdType nb_node= cz[icz]->getNodeNumber();
+ const mcIdType* node_corresp=cz[icz]->getNodeCorrespValue();
int distant_ip = cz[icz]->getDistantDomainNumber();
- for (int i=0; i< nb_node; i++)
+ for (mcIdType i=0; i< nb_node; i++)
{
int local= node_corresp[i*2];
int distant = node_corresp[i*2+1];
_node_loc_to_glob.resize(_nb_domain);
_face_loc_to_glob.resize(_nb_domain);
- const int* part=graph->getPart(); //all cells for this proc (may be more domains)
+ const mcIdType* part=graph->getPart(); //all cells for this proc (may be more domains)
_nb_total_cells=graph->nbVertices(); //all cells for this proc (may be more domains)
if (MyGlobals::_Verbose>300)
std::cout << "proc " << MyGlobals::_Rank << " : topology from partition, nbTotalCells " << _nb_total_cells << std::endl;
if ( MyGlobals::_Create_Joints && nb_domain > 1 )
{
- std::vector< std::vector< std::vector< int > > > cellCorresp( nb_domain );
+ std::vector< std::vector< std::vector< mcIdType > > > cellCorresp( nb_domain );
for ( int idomain = 0; idomain < nb_domain; ++idomain )
{
cellCorresp[ idomain ].resize( nb_domain );
}
const MEDCoupling::MEDCouplingSkyLineArray* skylinegraph = graph->getGraph();
- const int* index = skylinegraph->getIndex();
- const int* value = skylinegraph->getValues();
- const int nbCells = skylinegraph->getNumberOf();
+ const mcIdType* index = skylinegraph->getIndex();
+ const mcIdType* value = skylinegraph->getValues();
+ const mcIdType nbCells = skylinegraph->getNumberOf();
- for ( int iGlob = 0; iGlob < nbCells; ++iGlob )
+ for ( mcIdType iGlob = 0; iGlob < nbCells; ++iGlob )
{
int iGlobDom = part[ iGlob ];
for ( int i = index[ iGlob ]; i < index[ iGlob+1 ]; i++ )
{
for ( int idomainNear = 0; idomainNear < nb_domain; ++idomainNear )
{
- std::vector< int > & corresp = cellCorresp[ idomain ][ idomainNear ];
+ std::vector< mcIdType > & corresp = cellCorresp[ idomain ][ idomainNear ];
if ( corresp.empty() )
continue;
MEDPARTITIONER::ConnectZone* cz = new MEDPARTITIONER::ConnectZone();
//number of graph vertices
int n = _graph->getNumberOf();
//graph
+#ifdef MEDCOUPLING_USE_64BIT_IDS
+ std::vector<int> indexVec( _graph->getIndex(), _graph->getIndexArray()->end() );
+ std::vector<int> valueVec( _graph->getValues(), _graph->getValuesArray()->end() );
+ int * xadj=indexVec.data();
+ int * adjncy=valueVec.data();
+#else
int * xadj=const_cast<int*>(_graph->getIndex());
int * adjncy=const_cast<int*>(_graph->getValues());
+#endif
//ndomain
int nparts=ndomain;
SCOTCH_stratExit(&scotch_strategy);
SCOTCH_graphExit(&scotch_graph);
- std::vector<int> index(n+1);
- std::vector<int> value(n);
+ std::vector<mcIdType> index(n+1);
+ std::vector<mcIdType> value(n);
index[0]=0;
for (int i=0; i<n; i++)
{
index[i+1]=index[i]+1;
- value[i]=partition[i];
+ value[i]=ToIdType(partition[i]);
}
delete [] partition;
* (domain numbers range from 0 to ndomain-1
* \param n number of cells in the mesh
*/
-UserGraph::UserGraph(MEDCoupling::MEDCouplingSkyLineArray *array, const int *partition, int n):Graph(array,0)
+UserGraph::UserGraph(MEDCoupling::MEDCouplingSkyLineArray *array, const mcIdType *partition, mcIdType n):Graph(array,0)
{
- std::vector<int> index(n+1),value(n);
+ std::vector<mcIdType> index(n+1),value(n);
index[0]=0;
- for (int i=0; i<n; i++)
+ for (mcIdType i=0; i<n; i++)
{
index[i+1]=index[i]+1;
value[i]=partition[i];
class MEDPARTITIONER_EXPORT UserGraph : public Graph
{
public:
- UserGraph(MEDCoupling::MEDCouplingSkyLineArray*, const int*, int);
+ UserGraph(MEDCoupling::MEDCouplingSkyLineArray*, const mcIdType*, mcIdType);
virtual ~UserGraph();
void partGraph(int, const std::string& options=std::string(""), ParaDomainSelector *sel=0);
};
IT=StrToInt(ExtractFromDescription(description,"IT="));
}
-MEDCoupling::DataArrayInt *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector<int>& v)
+MEDCoupling::DataArrayIdType *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector<mcIdType>& v)
{
- MEDCoupling::DataArrayInt* p=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType* p=MEDCoupling::DataArrayIdType::New();
p->alloc(v.size(),1);
std::copy(v.begin(),v.end(),p->getPointer());
return p;
}
-MEDCoupling::DataArrayInt *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector<int>& v,const int nbComponents)
+MEDCoupling::DataArrayIdType *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector<mcIdType>& v,const int nbComponents)
{
- MEDCoupling::DataArrayInt* p=MEDCoupling::DataArrayInt::New();
+ MEDCoupling::DataArrayIdType* p=MEDCoupling::DataArrayIdType::New();
if (v.size()%nbComponents!=0)
throw INTERP_KERNEL::Exception("Problem size modulo nbComponents != 0");
p->alloc(v.size()/nbComponents,nbComponents);
MEDPARTITIONER_EXPORT void FieldShortDescriptionToData(const std::string& description,
std::string& fieldName, int& typeField, int& entity, int& DT, int& IT);
- MEDCoupling::DataArrayInt *CreateDataArrayIntFromVector(const std::vector<int>& v);
- MEDCoupling::DataArrayInt *CreateDataArrayIntFromVector(const std::vector<int>& v, const int nbComponents);
+ MEDCoupling::DataArrayIdType *CreateDataArrayIntFromVector(const std::vector<mcIdType>& v);
+ MEDCoupling::DataArrayIdType *CreateDataArrayIntFromVector(const std::vector<mcIdType>& v, const int nbComponents);
MEDCoupling::DataArrayDouble *CreateDataArrayDoubleFromVector(const std::vector<double>& v);
MEDCoupling::MEDCouplingUMesh *CreateEmptyMEDCouplingUMesh();
MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh()
//only hexa8
{
- vector<int> conn;
+ vector<mcIdType> conn;
vector<double> coor;
for (int k=0; k<=_nk; k++)
for (int j=0; j<=_nj; j++)
MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
mesh->setMeshDimension(3);
- int nbc=conn.size()/8; //nb of cells
- int nbv=coor.size()/3; //nb of vertices
+ mcIdType nbc=conn.size()/8; //nb of cells
+ mcIdType nbv=coor.size()/3; //nb of vertices
mesh->allocateCells(nbc);
- for(int i=0; i<nbc; i++)
+ for(mcIdType i=0; i<nbc; i++)
{
- int onehexa[8];
+ mcIdType onehexa[8];
std::copy(conn.begin()+i*8,conn.begin()+(i+1)*8,onehexa);
if (false) //(_verbose)
{
MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCARRE3DMesh()
//only quad4 in oblique (k=j)
{
- vector<int> conn;
+ vector<mcIdType> conn;
vector<double> coor;
for (int j=0; j<=_nj; j++)
for (int i=0; i<=_ni; i++)
mesh->allocateCells(nbc);
for(int i=0; i<nbc; i++)
{
- int onequa[4];
+ mcIdType onequa[4];
std::copy(conn.begin()+i*4,conn.begin()+(i+1)*4,onequa);
if (false) //(_verbose)
{
mesh->allocateCells(nbc);
for(int i=0; i<nbc; i++)
{
- int onequa[4];
+ mcIdType onequa[4];
std::copy(conn.begin()+i*4,conn.begin()+(i+1)*4,onequa);
if (false) //(_verbose)
{
WriteUMeshes(_file_name_with_faces.c_str(), meshes, true);
MEDCoupling::MEDFileUMesh* mfm=MEDCoupling::MEDFileUMesh::New(_file_name_with_faces.c_str(), mesh1->getName().c_str());
- DataArrayInt* FacesFam=DataArrayInt::New();
+ DataArrayIdType* FacesFam=DataArrayIdType::New();
FacesFam->alloc(mfm->getSizeAtLevel(-1),1);
FacesFam->fillWithValue(-1);
- DataArrayInt* CellsFam=DataArrayInt::New();
+ DataArrayIdType* CellsFam=DataArrayIdType::New();
CellsFam->alloc(mfm->getSizeAtLevel(0),1);
CellsFam->fillWithValue(1);
mfm->setFamilyFieldArr(-1,FacesFam);
mfm->setFamilyFieldArr(0,CellsFam);
- map<string,int> theFamilies;
+ map<string,mcIdType> theFamilies;
theFamilies["FAMILLE_ZERO"]=0;
theFamilies["FamilyFaces"]=-1;
theFamilies["FamilyCells"]=1;
*/
std::vector<const MEDCouplingUMesh *> meshes;
- std::vector<DataArrayInt *> corr;
+ std::vector<DataArrayIdType *> corr;
meshes.push_back(cellMesh);
refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9);
meshes.push_back(refusedCellMesh);
CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells());
std::vector<const MEDCouplingUMesh *> meshes;
- std::vector<DataArrayInt *> corr;
+ std::vector<DataArrayIdType *> corr;
meshes.push_back(cellMesh);
refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9);
meshes.push_back(refusedCellMesh);
int nbcomp=field1->getNumberOfComponents();
double* p1=f1->getPointer();
double* p2=f2->getPointer();
- int* pc=corr[1]->getPointer();
+ mcIdType* pc=corr[1]->getPointer();
for (int i = 0; i < nbcells; i++)
{
- int i1=pc[i]*nbcomp;
+ mcIdType i1=pc[i]*nbcomp;
int i2=i*nbcomp;
for (int j = 0; j < nbcomp; j++)
{
CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells());
std::vector<const MEDCouplingUMesh *> meshes;
- std::vector<DataArrayInt *> corr;
+ std::vector<DataArrayIdType *> corr;
meshes.push_back(cellMesh);
refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9);
meshes.push_back(refusedCellMesh);
int nbcomp=field1->getNumberOfComponents();
double* p1=f1->getPointer();
double* p2=f2->getPointer();
- int* pc=corr[1]->getPointer();
+ mcIdType* pc=corr[1]->getPointer();
for (int i = 0; i < nbcells; i++)
{
- int i1=pc[i]*nbcomp*nbptgauss;
+ mcIdType i1=pc[i]*nbcomp*nbptgauss;
int i2=i*nbcomp*nbptgauss;
for (int j = 0; j < nbcomp*nbptgauss; j++)
{
int nbFam1, nbFam2, nbc;
{
const int nbX = 20, nbY = 15;
- vector<int> conn;
+ vector<mcIdType> conn;
vector<double> coor;
for (int j=0; j<=nbY; j++)
for (int i=0; i<=nbX; i++)
nbc=conn.size()/4; //nb of cells
mesh->allocateCells(nbc);
- int* pConn = &conn[0];
+ mcIdType* pConn = &conn[0];
for(int i=0; i<nbc; i++, pConn+=4)
mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,pConn);
mesh->finishInsertingCells();
mesh->checkConsistencyLight();
// groups of cells
- DataArrayInt* cellsFam=DataArrayInt::New();
+ DataArrayIdType* cellsFam=DataArrayIdType::New();
cellsFam->alloc(nbc,1);
nbFam1 = nbc/3, nbFam2 = nbc/2;
int iE = 0;
for ( int i = 0; i < nbFam1; ++i ) cellsFam->getPointer()[ iE++ ] = idFam1;
for ( int i = 0; i < nbFam2; ++i ) cellsFam->getPointer()[ iE++ ] = idFam2;
for ( ; iE < nbc; ) cellsFam->getPointer()[ iE++ ] = 0;
- map<string,int> theFamilies;
+ map<string,mcIdType> theFamilies;
theFamilies["FAMILLE_ZERO"]=0;
theFamilies["Family1" ]=idFam1;
theFamilies["Family2" ]=idFam2;
std::map< int, int > famId2nb; // count total nb of cells in divided families
std::map< int, int >::iterator id2nn;
{
- const std::vector<MEDCoupling::DataArrayInt*>& famIdsVec = new_collection.getCellFamilyIds();
+ const std::vector<MEDCoupling::DataArrayIdType*>& famIdsVec = new_collection.getCellFamilyIds();
for ( size_t i = 0; i < famIdsVec.size(); ++i )
{
- MEDCoupling::DataArrayInt* famIdsArr = famIdsVec[i];
+ MEDCoupling::DataArrayIdType* famIdsArr = famIdsVec[i];
for ( int j = famIdsArr->getNbOfElems()-1; j >= 0; --j )
{
id2nn = famId2nb.insert( make_pair( famIdsArr->getPointer()[j], 0 )).first;
// Check that "creates boundary faces option is handled"
famId2nb.clear();
- const std::vector<MEDCoupling::DataArrayInt*>& famIdsVec = new_collection.getFaceFamilyIds();
+ const std::vector<MEDCoupling::DataArrayIdType*>& famIdsVec = new_collection.getFaceFamilyIds();
for ( size_t i = 0; i < famIdsVec.size(); ++i )
{
- MEDCoupling::DataArrayInt* famIdsArr = famIdsVec[i];
+ MEDCoupling::DataArrayIdType* famIdsArr = famIdsVec[i];
for ( int j = famIdsArr->getNbOfElems()-1; j >= 0; --j )
{
id2nn = famId2nb.insert( make_pair( famIdsArr->getPointer()[j], 0 )).first;
// for each "JOINT_n_p_..." group there must be "JOINT_p_n_..." group
// of the same size
- std::map<std::string,int>& famName2id = new_collection.getFamilyInfo();
- std::map<std::string,int>::iterator na2id = famName2id.begin(), na2id2;
+ std::map<std::string,mcIdType>& famName2id = new_collection.getFamilyInfo();
+ std::map<std::string,mcIdType>::iterator na2id = famName2id.begin(), na2id2;
std::set< int > okFamIds;
okFamIds.insert(0);
for ( ; na2id != famName2id.end(); ++na2id )
#include <boost/graph/properties.hpp>
#include <boost/graph/bandwidth.hpp>
-void BOOSTRenumbering::renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm)
+void BOOSTRenumbering::renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm)
{
- MEDCoupling::MCAuto<MEDCoupling::DataArrayInt> out0(MEDCoupling::DataArrayInt::New()),out1(MEDCoupling::DataArrayInt::New());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> out0(MEDCoupling::DataArrayIdType::New()),out1(MEDCoupling::DataArrayIdType::New());
out0->alloc(nbCell,1); out1->alloc(nbCell,1);
out0->fillWithZero(); out1->fillWithZero();
//
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS,
boost::property<boost::vertex_color_t, boost::default_color_type,
- boost::property<boost::vertex_degree_t,int> > > Graph;
+ boost::property<boost::vertex_degree_t,mcIdType> > > Graph;
typedef boost::graph_traits<Graph>::vertex_descriptor Vertex;
typedef boost::graph_traits<Graph>::vertices_size_type size_type;
Graph G(nbCell);
- for (int i=0;i<nbCell;++i)
- for (int j=index_graph[i];j<index_graph[i+1];++j)
+ for (mcIdType i=0;i<nbCell;++i)
+ for (mcIdType j=index_graph[i];j<index_graph[i+1];++j)
add_edge(i,graph[j],G);
boost::property_map<Graph, boost::vertex_index_t>::type
index_map = boost::get(boost::vertex_index, G);
boost::cuthill_mckee_ordering(G, out0->getPointer(), boost::get(boost::vertex_color, G),
boost::make_degree_map(G));
- int *out0Ptr(out0->getPointer()),*out1Ptr(out1->getPointer());
- for(int c=0;c!=nbCell;++c)
+ mcIdType *out0Ptr(out0->getPointer()),*out1Ptr(out1->getPointer());
+ for(mcIdType c=0;c!=nbCell;++c)
out1Ptr[index_map[out0Ptr[nbCell-c-1]]]=c;
out0->reverse();
iperm=out0.retn(); perm=out1.retn();
class RENUMBER_EXPORT BOOSTRenumbering:public Renumbering
{
public:
- void renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm);
+ void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm);
};
#endif /*BOOSTRENUMBERING_HXX_*/
#include "RENUMBER_METISRenumbering.hxx"
-void METISRenumbering::renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm)
+#ifdef MEDCOUPLING_USE_64BIT_IDS
+#define ID_TYPE_SIZE 64
+#else
+#define ID_TYPE_SIZE 32
+#endif
+
+void METISRenumbering::renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm)
{
- MEDCoupling::MCAuto<MEDCoupling::DataArrayInt> out0(MEDCoupling::DataArrayInt::New()),out1(MEDCoupling::DataArrayInt::New());
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> out0(MEDCoupling::DataArrayIdType::New()),out1(MEDCoupling::DataArrayIdType::New());
out0->alloc(nbCell,1); out1->alloc(nbCell,1);
out0->fillWithZero(); out1->fillWithZero();
int num_flag=1;
int options=0;
- METIS_NodeND(&nbCell,(int*)index_graph,(int*)graph,&num_flag,&options,out0->getPointer(),out1->getPointer());
+
+#if ID_TYPE_SIZE == IDXTYPEWIDTH
+
+ METIS_NodeND(&nbCell,(idx_t*)index_graph,(idx_t*)graph,&num_flag,&options,out0->getPointer(),out1->getPointer());
+
+#else
+
+ mcIdType indexSize = nbCell + 1, graphSize = index_graph[indexSize];
+ std::vector<idx_t> indexVec( index_graph, index_graph + indexSize );
+ std::vector<idx_t> graphVec( graph, graph + graphSize );
+ std::vector<idx_t> out0Vec( nbCell ), out1Vec( nbCell );
+ idx_t nb = static_cast<idx_t>( nbCell );
+ METIS_NodeND(&nb,indexVec.data(),graphVec.data(),&num_flag,&options,out0Vec.data(),out1Vec.data());
+ std::copy( out0Vec.begin(),out0Vec.end(),out0->getPointer() );
+ std::copy( out1Vec.begin(),out1Vec.end(),out1->getPointer() );
+
+#endif
+
iperm=out0.retn(); perm=out1.retn();
}
class RENUMBER_EXPORT METISRenumbering:public Renumbering
{
public:
- virtual void renumber(const int *graph, const int *index_graph, int nb_cell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm);
+ virtual void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nb_cell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm);
};
#endif /*METISRENUMBERING_HXX_*/
namespace MEDCoupling
{
- class DataArrayInt;
+ class DataArrayIdType;
}
class RENUMBER_EXPORT Renumbering
{
public:
- virtual void renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm) = 0;
+ virtual void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm) = 0;
virtual ~Renumbering() { }
};
cout << (t_read_st-t_begin)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
// Reading mesh
MCAuto<MEDCouplingUMesh> workMesh=mc->getMeshAtLevel(0);
- std::vector<int> code=workMesh->getDistributionOfTypes();
+ //std::vector<mcIdType> code=workMesh->getDistributionOfTypes();
cout << "Building the graph : " << flush;
- DataArrayInt *neighb=0,*neighbI=0;
+ DataArrayIdType *neighb=0,*neighbI=0;
workMesh->computeNeighborsOfCells(neighb,neighbI);
- MCAuto<DataArrayInt> neighbSafe(neighb),neighbISafe(neighbI),ipermSafe,permSafe;
- const int *graph=neighbSafe->begin();
- const int *graph_index=neighbISafe->begin();
+ MCAuto<DataArrayIdType> neighbSafe(neighb),neighbISafe(neighbI),ipermSafe,permSafe;
+ const mcIdType *graph=neighbSafe->begin();
+ const mcIdType *graph_index=neighbISafe->begin();
// Compute permutation iperm->new2old perm->old2new
- DataArrayInt *iperm(0),*perm(0);
+ DataArrayIdType *iperm(0),*perm(0);
Renumbering *renumb=RenumberingFactory(type_renum);
renumb->renumber(graph,graph_index,workMesh->getNumberOfCells(),iperm,perm);
ipermSafe=iperm; permSafe=perm;
cout << "Reordering connectivity & families and writing : " << flush;
workMesh->renumberCells(perm->begin(),false);
mc->setMeshAtLevel(0,workMesh);
- const DataArrayInt *famField=mc->getFamilyFieldAtLevel(0);
+ const DataArrayIdType *famField=mc->getFamilyFieldAtLevel(0);
if(famField)
{
- MCAuto<DataArrayInt> famField2=famField->renumber(perm->begin());
+ MCAuto<DataArrayIdType> famField2=famField->renumber(perm->begin());
mc->setFamilyFieldArr(0,famField2);
}
mc->write(filename_out,2);
SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES SWIG_DEFINITIONS "-shadow")
ENDIF()
SET(SWIG_MODULE_MEDRenumber_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS};-DWITHOUT_AUTOFIELD")
+IF(MEDCOUPLING_USE_64BIT_IDS)
+ STRING(APPEND SWIG_MODULE_MEDRenumber_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS")
+ENDIF(MEDCOUPLING_USE_64BIT_IDS)
SET (MEDRenumber_SWIG_DPYS_FILES
MEDRenumberCommon.i
public:
%extend
{
- virtual PyObject *renumber(const MEDCoupling::DataArrayInt *graph, const MEDCoupling::DataArrayInt *index_graph)
+ virtual PyObject *renumber(const MEDCoupling::DataArrayIdType *graph, const MEDCoupling::DataArrayIdType *index_graph)
{
if(!graph || !index_graph)
throw INTERP_KERNEL::Exception("wrap of Renumbering::renumber : One of the input arrays is NULL !");
if(!graph->isAllocated() || !index_graph->isAllocated())
throw INTERP_KERNEL::Exception("wrap of Renumbering::renumber : One of the input arrays is not allocated !");
- MEDCoupling::DataArrayInt *out0(0),*out1(0);
+ MEDCoupling::DataArrayIdType *out0(0),*out1(0);
self->renumber(graph->begin(),index_graph->begin(),index_graph->getNumberOfTuples()-1,out0,out1);
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(out0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(out1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(out0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(out1),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
return ret;
}
}