-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
int MEDPARTITIONER::MyGlobals::_World_Size=-1;
int MEDPARTITIONER::MyGlobals::_Randomize=0;
int MEDPARTITIONER::MyGlobals::_Atomize=0;
-int MEDPARTITIONER::MyGlobals::_Creates_Boundary_Faces=0;
+int MEDPARTITIONER::MyGlobals::_Create_Boundary_Faces=0;
int MEDPARTITIONER::MyGlobals::_Create_Joints=0;
std::vector<std::string> MEDPARTITIONER::MyGlobals::_File_Names;
std::vector<std::string> MEDPARTITIONER::MyGlobals::_Mesh_Names;
std::cerr << "MEDPARTITIONER::RandomizeAdj only works on one proc!" << std::endl;
return;
}
- int size=ran.size();
+ std::size_t size=ran.size();
std::vector<int> invran(size);
- for (int i=0; i<size; i++)
+ for (unsigned int i=0; i<size; i++)
invran[ran[i]]=i;
vx.resize(size+1);
int lga=xadj[size];
va.resize(lga);
int jj=0;
vx[0]=0;
- for (int i=0; i<size; i++)
+ for (std::size_t i=0; i<size; i++)
{
int ir=ran[i];
int ii=xadj[ir];
return oss.str();
}
-std::string MEDPARTITIONER::ReprMapOfStringInt(const std::map<std::string,int>& mymap)
+std::string MEDPARTITIONER::ReprMapOfStringInt(const std::map<std::string,mcIdType>& mymap)
{
if (mymap.size()==0)
return std::string(" NONE\n");
std::ostringstream oss;
- for (std::map<std::string,int>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
+ for (std::map<std::string,mcIdType>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
oss << " -> [" << (*i).first << "]=" << (*i).second << std::endl;
return oss.str();
}
* elements first and second of map give one elements in result vector of string
* converting formatted the int second as firsts characters ending at first slash
*/
-std::vector<std::string> MEDPARTITIONER::VectorizeFromMapOfStringInt(const std::map<std::string,int>& mymap)
+std::vector<std::string> MEDPARTITIONER::VectorizeFromMapOfStringInt(const std::map<std::string,mcIdType>& mymap)
{
std::vector<std::string> res;
- for (std::map<std::string,int>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
+ for (std::map<std::string,mcIdType>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
{
std::ostringstream oss;
oss << (*i).second << "/" << (*i).first;
/*
* if existing identicals (first,second) in vector no problem, else Exception
*/
-std::map<std::string,int> MEDPARTITIONER::DevectorizeToMapOfStringInt(const std::vector<std::string>& vec)
+std::map<std::string,mcIdType> MEDPARTITIONER::DevectorizeToMapOfStringInt(const std::vector<std::string>& vec)
{
- std::map<std::string,int> res;
+ std::map<std::string,mcIdType> res;
for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
{
std::size_t pos=0;
std::size_t found=(*i).find('/'); //first slash
if ((found==std::string::npos) || (found<1))
throw INTERP_KERNEL::Exception("Error aIntNumber/anyString is expected");
- int second;
+ mcIdType second;
std::istringstream iss((*i).substr(pos,found));
iss >> second;
std::string first=(*i).substr(pos+found+1,posmax-found);
- std::map<std::string,int>::iterator it=res.find(first);
+ std::map<std::string,mcIdType>::iterator it=res.find(first);
if (it!=res.end())
if ((*it).second!=second)
throw INTERP_KERNEL::Exception("Error not the same map value");
iss >> sizeVector;
std::string keymap=enTete.substr(foundKey+7,foundSizeVector-foundKey-7);
for (int ii=1; ii<=sizeVector; ii++)
- res[keymap].push_back(vs[ii]); //add unconditionnaly,so merge duplicates in second vector
+ res[keymap].push_back(vs[ii]); //add unconditionally,so merge duplicates in second vector
}
return res;
}
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);
std::vector<std::string> res;
if (fd->getArray())
{
- int nb=fd->getArray()->getNumberOfComponents();
- res.push_back("nbComponents="); res.back()+=IntToStr(nb);
- for (int i=0; i<nb; i++)
+ std::size_t nb=fd->getArray()->getNumberOfComponents();
+ res.push_back("nbComponents="); res.back()+=IntToStr((int)nb);
+ for (unsigned int i=0; i<nb; i++)
{
res.push_back("componentInfo");
res.back()+=IntToStr(i)+"="+fd->getArray()->getInfoOnComponent(i);
{
for (int j=0; j<lggeom; j++)
{
- int profilesize=0,nbi=0;
+ med_int profilesize=0,nbi=0;
med_entity_type enttype=ENTITYTYPE[ie];
//enttype=MED_NODE;enttype=MED_CELL;enttype=MED_NODE_ELEMENT;
char pflname[MED_NAME_SIZE+1]="";
return res;
}
+MEDCoupling::MCAuto< MEDCoupling::DataArrayInt32 > MEDPARTITIONER::FromIdTypeVec( const std::vector< mcIdType >& vec )
+{
+ MEDCoupling::DataArrayInt32* array = MEDCoupling::DataArrayInt32::New();
+ array->alloc( vec.size(), 1 );
+ std::copy( vec.begin(), vec.end(), array->getPointer() );
+ return array;
+}
+
+
/*!
* quick almost human readable information on all fields on a mesh in a .med file
*/
namespace MEDPARTITIONER
{
- BBTreeOfDim::BBTreeOfDim( int dim,
+ BBTreeOfDim::BBTreeOfDim( std::size_t dim,
const double* bbs,
- int* elems,
+ mcIdType* elems,
int level,
- int nbelems,
+ mcIdType nbelems,
double epsilon)
{
switch ( dim )
{
case 3:
- _tree=new BBTree<3> (bbs,elems,level,nbelems,epsilon);
+ _tree=new BBTree<3,mcIdType> (bbs,elems,level,nbelems,epsilon);
_PgetElementsAroundPoint = & BBTreeOfDim::_getElementsAroundPoint< 3 >;
_PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 3 >;
break;
case 2:
- _tree=new BBTree<2> (bbs,elems,level,nbelems,epsilon);
+ _tree=new BBTree<2,mcIdType> (bbs,elems,level,nbelems,epsilon);
_PgetElementsAroundPoint = & BBTreeOfDim::_getElementsAroundPoint< 2 >;
_PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 2 >;
break;
case 1:
- _tree=new BBTree<1> (bbs,elems,level,nbelems,epsilon);
+ _tree=new BBTree<1,mcIdType> (bbs,elems,level,nbelems,epsilon);
_PgetElementsAroundPoint = & BBTreeOfDim::_getElementsAroundPoint< 1 >;
_PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 1 >;
break;
}
void BBTreeOfDim::getElementsAroundPoint( const double* coordsPtr,
- std::vector<int>& elems ) const
+ std::vector<mcIdType>& elems ) const
{
BBTreeOfDim* me = (BBTreeOfDim*) this;
(me->*_PgetElementsAroundPoint) ( coordsPtr, elems );
}
void BBTreeOfDim::getIntersectingElems(const double* bb,
- std::vector<int>& elems) const
+ std::vector<mcIdType>& elems) const
{
BBTreeOfDim* me = (BBTreeOfDim*) this;
(me->*_PgetIntersectingElems) ( bb, elems );