#include "MEDCouplingUMesh.hxx"
#include "BBTree.txx"
-using namespace std;
-using namespace ParaMEDMEM;
-using namespace MEDPARTITIONER;
-
-/*! Method contributing to the distant cell graph
+/*!
+ * Method contributing to the distant cell graph
*/
-
-JointFinder::JointFinder(const MeshCollection& mc):_mesh_collection(mc), _topology(mc.getTopology()),_domain_selector(mc.getParaDomainSelector())
+MEDPARTITIONER::JointFinder::JointFinder(const MeshCollection& mc):_mesh_collection(mc), _topology(mc.getTopology()),_domain_selector(mc.getParaDomainSelector())
{
}
-JointFinder::~JointFinder()
+MEDPARTITIONER::JointFinder::~JointFinder()
{
- //if (MyGlobals::_Is0verbose>100) cout<<"TODO ~JointFinder"<<endl;
}
-void JointFinder::findCommonDistantNodes()
+void MEDPARTITIONER::JointFinder::findCommonDistantNodes()
{
int nbdomain=_topology->nbDomain();
_distant_node_cell.resize(nbdomain);
}
int nbproc=_domain_selector->nbProcs();
std::vector<BBTree<3>* > bbtree(nbdomain,(BBTree<3>*) 0);
- std::vector<ParaMEDMEM::DataArrayInt*> rev(nbdomain,(DataArrayInt*) 0);
- std::vector<ParaMEDMEM::DataArrayInt*> revIndx(nbdomain,(DataArrayInt*) 0);
+ std::vector<ParaMEDMEM::DataArrayInt*> rev(nbdomain,(ParaMEDMEM::DataArrayInt*) 0);
+ std::vector<ParaMEDMEM::DataArrayInt*> revIndx(nbdomain,(ParaMEDMEM::DataArrayInt*) 0);
int meshDim;
int spaceDim;
//init rev and revIndx and bbtree for my domain (of me:proc n)
for (int mydomain=0; mydomain<nbdomain; mydomain++)
{
- if(!_domain_selector->isMyDomain(mydomain)) continue;
+ if(!_domain_selector->isMyDomain(mydomain))
+ continue;
const ParaMEDMEM::MEDCouplingUMesh* myMesh=_mesh_collection.getMesh(mydomain);
meshDim=myMesh->getMeshDimension();
spaceDim= myMesh->getSpaceDimension();
bbx[2*i+1]=bbx[2*i]+2e-12;
}
bbtree[mydomain]=new BBTree<3> (bbx,0,0,myMesh->getNumberOfNodes(),-1e-12);
- delete[] bbx;
+ delete [] bbx;
}
//send my domains to other proc an receive other domains from other proc
for (int itarget=0; itarget<nbdomain; itarget++)
{
const ParaMEDMEM::MEDCouplingUMesh* sourceMesh=_mesh_collection.getMesh(isource);
- if (_domain_selector->isMyDomain(isource)&&_domain_selector->isMyDomain(itarget)) continue;
+ if (_domain_selector->isMyDomain(isource)&&_domain_selector->isMyDomain(itarget))
+ continue;
if (_domain_selector->isMyDomain(isource))
{
//preparing data for treatment on target proc
int targetProc = _domain_selector->getProcessorID(itarget);
std::vector<double> vec(spaceDim*sourceMesh->getNumberOfNodes());
- //cvw cout<<"\nproc "<<_domain_selector->rank()<<" : numberOfNodes "<<sourceMesh->getNumberOfNodes()<<endl;
std::copy(sourceMesh->getCoords()->getConstPointer(),sourceMesh->getCoords()->getConstPointer()+sourceMesh->getNumberOfNodes()*spaceDim,&vec[0]);
SendDoubleVec(vec,targetProc);
//retrieving target data for storage in commonDistantNodes array
std::vector<int> localCorrespondency;
RecvIntVec(localCorrespondency, targetProc);
- //cvw cout<<"\nproc "<<_domain_selector->rank()<<" : nodeCellCorrespondency ";
for (int i=0; i<localCorrespondency.size()/2; i++)
{
_distant_node_cell[isource][itarget].insert(std::make_pair(localCorrespondency[2*i],localCorrespondency[2*i+1]));
- //cvw cout<<" "<<localCorrespondency[2*i]<<"/"<<localCorrespondency[2*i+1];
}
}
std::vector<double> recvVec;
RecvDoubleVec(recvVec,sourceProc);
std::map<int,int> commonNodes; // (local nodes, distant nodes) list
- //cvw cout<<"\nproc "<<_domain_selector->rank()<<" : commonNodes ";
for (int inode=0; inode<(recvVec.size()/meshDim); inode++)
{
double* bbox=new double[2*spaceDim];
}
std::vector<int> inodes;
bbtree[itarget]->getIntersectingElems(bbox,inodes);
- delete[] bbox;
+ delete [] bbox;
if (inodes.size()>0)
{
commonNodes.insert(std::make_pair(inodes[0],inode));
- //cvw cout<<" "<<inodes[0]<<"/"<<inode;
}
}
nodeCellCorrespondency.push_back(iter->second); //
int globalCell=_topology->convertCellToGlobal(itarget,revPtr[icell]);
nodeCellCorrespondency.push_back(globalCell);
- //nodeCellCorrespondency.push_back(revPtr[icell]); //need to set at global numerotation
- //cout<<"processor "<<MyGlobals::_Rank<<" : isource "<<isource<<" itarget "<<itarget<<
- // " node "<<iter->second<<" cellLoc "<<revPtr[icell]<<" cellGlob "<<globalCell<<endl;
}
}
- //std::cout<<"proc "<<_domain_selector->rank()<<" : JointFinder SendIntVec "<<_domain_selector->rank()<<std::endl; //cvwdebug
SendIntVec(nodeCellCorrespondency, sourceProc); //itarget proc send to other (otherLocalNode-itargetGlobalCell)
}
}
//free rev(nbdomain) revIndx(nbdomain) bbtree(nbdomain)
for (int i=0; i<nbdomain; i++)
{
- if (rev[i]!=0) rev[i]->decrRef();
- if (revIndx[i]!=0) revIndx[i]->decrRef();
- if (bbtree[i]!=0) delete bbtree[i];
+ if (rev[i]!=0)
+ rev[i]->decrRef();
+ if (revIndx[i]!=0)
+ revIndx[i]->decrRef();
+ if (bbtree[i]!=0)
+ delete bbtree[i];
}
if (MyGlobals::_Verbose>100)
- std::cout<<"proc "<<_domain_selector->rank()<<" : end JointFinder::findCommonDistantNodes"<<std::endl;
+ std::cout << "proc " << _domain_selector->rank() << " : end JointFinder::findCommonDistantNodes" << std::endl;
}
-std::vector<std::vector<std::multimap<int,int> > > & JointFinder::getDistantNodeCell()
+std::vector<std::vector<std::multimap<int,int> > >& MEDPARTITIONER::JointFinder::getDistantNodeCell()
{
return _distant_node_cell;
}
-std::vector<std::vector<std::vector<std::pair<int,int> > > >& JointFinder::getNodeNode()
+std::vector<std::vector<std::vector<std::pair<int,int> > > >& MEDPARTITIONER::JointFinder::getNodeNode()
{
return _node_node;
}
-void JointFinder::print()
+void MEDPARTITIONER::JointFinder::print()
//it is for debug on small arrays under mpi 2,3 cpus
{
int nbdomain=_topology->nbDomain();
//MPI_Barrier(MPI_COMM_WORLD);
if (MyGlobals::_Is0verbose>0)
- cout<<"\nJointFinder print node-node (nn)iproc|itarget|isource|i|inodefirst-inodesecond\n\n"<<
+ std::cout << "\nJointFinder print node-node (nn)iproc|itarget|isource|i|inodefirst-inodesecond\n\n" <<
"JointFinder print distantNode=cell (nc)iproc|itarget|isource|inode=icell\n\n";
for (int isource=0; isource<nbdomain; isource++)
{
for (int itarget=0; itarget<nbdomain; itarget++)
{
for (int i=0; i<_node_node[itarget][isource].size(); i++)
- cout<<" nn"<<_domain_selector->rank()<<itarget<<"|"<<isource<<"|"<<i<<"|"<<
- _node_node[itarget][isource][i].first<<"-"<<
+ std::cout << " nn" << _domain_selector->rank() << itarget << "|" << isource << "|" << i << "|" <<
+ _node_node[itarget][isource][i].first << "-" <<
_node_node[itarget][isource][i].second;
}
}
- cout<<endl;
+ std::cout<<std::endl;
//MPI_Barrier(MPI_COMM_WORLD);
-
- //cout<<"proc "<<_domain_selector->rank()<<" : JointFinder _distant_node_cell itarget/isource/inode=icell"<<endl;
for (int isource=0; isource<nbdomain; isource++)
{
for (int itarget=0; itarget<nbdomain; itarget++)
std::multimap<int,int>::iterator it;
for (it=_distant_node_cell[isource][itarget].begin() ; it!=_distant_node_cell[isource][itarget].end(); it++)
{
- cout<<" nc"<<_domain_selector->rank()<<"|"<<itarget<<"|"<<isource<<"|"<<(*it).first<<"="<<(*it).second;
+ std::cout << " nc" << _domain_selector->rank() << "|" << itarget << "|" << isource << "|" << (*it).first << "=" << (*it).second;
}
}
}
- cout<<endl;
+ std::cout << std::endl;
//MPI_Barrier(MPI_COMM_WORLD);
}
#ifndef __MEDPARTITIONER_JOINTFINDER_HXX__
#define __MEDPARTITIONER_JOINTFINDER_HXX__
-#include <vector>
#include <map>
+#include <vector>
-namespace MEDPARTITIONER {
+namespace MEDPARTITIONER
+{
+ class Topology;
class MeshCollection;
class ParaDomainSelector;
- class Topology;
+
class JointFinder
{
public:
void print();
std::vector<std::vector<std::multimap<int,int> > >& getDistantNodeCell();
std::vector<std::vector<std::vector<std::pair<int,int> > > >& getNodeNode();
-
- std::vector<std::vector<std::multimap<int,int> > > _distant_node_cell;
private:
const MeshCollection& _mesh_collection;
- const ParaDomainSelector* _domain_selector;
- const Topology* _topology;
+ const ParaDomainSelector *_domain_selector;
+ const Topology *_topology;
+ std::vector<std::vector<std::multimap<int,int> > > _distant_node_cell;
std::vector<std::vector<std::vector<std::pair<int,int> > > > _node_node;
+
};
}
#endif
#include "MEDPARTITIONER_ScotchGraph.hxx"
#endif
+#include <set>
#include <vector>
#include <string>
#include <limits>
-#include <set>
#include <iostream>
#include <fstream>
-using namespace std;
-using namespace ParaMEDMEM;
-using namespace MEDPARTITIONER;
-
-MeshCollection::MeshCollection()
+MEDPARTITIONER::MeshCollection::MeshCollection()
: _topology(0),
_owns_topology(false),
_driver(0),
_create_empty_groups(false),
_joint_finder(0)
{
- cout<<"coucou"<<endl;
}
/*!constructor creating a new mesh collection (mesh series + topology)
* \param topology topology containing the cell mappings
*/
-MeshCollection::MeshCollection(MeshCollection& initialCollection,
- Topology* topology,
- bool family_splitting,
- bool create_empty_groups)
+MEDPARTITIONER::MeshCollection::MeshCollection(MeshCollection& initialCollection,
+ Topology* topology,
+ bool family_splitting,
+ bool create_empty_groups)
: _name(initialCollection._name),
_topology(topology),
_owns_topology(false),
_joint_finder(0)
{
std::vector<std::vector<std::vector<int> > > new2oldIds(initialCollection.getTopology()->nbDomain());
- if (MyGlobals::_Verbose>10) std::cout<<"proc "<<MyGlobals::_Rank<<" : castCellMeshes"<<std::endl;
+ if (MyGlobals::_Verbose>10)
+ std::cout << "proc " << MyGlobals::_Rank << " : castCellMeshes" << std::endl;
castCellMeshes(initialCollection, new2oldIds);
//defining the name for the collection and the underlying meshes
//treating faces
/////////////////
- if (MyGlobals::_Is0verbose) std::cout<<"treating faces"<<std::endl;
+ if (MyGlobals::_Is0verbose)
+ std::cout<<"treating faces"<<std::endl;
NodeMapping nodeMapping;
//nodeMapping contains the mapping between old nodes and new nodes
// (iolddomain,ioldnode)->(inewdomain,inewnode)
createNodeMapping(initialCollection, nodeMapping);
- //cvw std::cout<<"castMeshes"<<std::endl;
std::vector<std::vector<std::vector<int> > > new2oldFaceIds;
castFaceMeshes(initialCollection, nodeMapping, new2oldFaceIds);
////////////////////
if (MyGlobals::_Is0verbose)
- if (isParallelMode()) std::cout<<"ParallelMode on "<<topology->nbDomain()<<" Domains"<<std::endl;
- else std::cout<<"NOT ParallelMode on "<<topology->nbDomain()<<" Domains"<<std::endl;
+ if (isParallelMode())
+ std::cout << "ParallelMode on " << topology->nbDomain() << " Domains" << std::endl;
+ else
+ std::cout << "NOT ParallelMode on " << topology->nbDomain() << " Domains" << std::endl;
- if (MyGlobals::_Is0verbose>10) std::cout<<"treating cell and face families"<<std::endl;
+ if (MyGlobals::_Is0verbose>10)
+ std::cout<<"treating cell and face families"<<std::endl;
castIntField2(initialCollection.getMesh(),
this->getMesh(),
initialCollection.getFaceFamilyIds(),
"faceFamily");
- //////////////////
//treating groups
- //////////////////
- if (MyGlobals::_Is0verbose) std::cout<<"treating groups"<<std::endl;
- _familyInfo=initialCollection.getFamilyInfo();
- _groupInfo=initialCollection.getGroupInfo();
+ if (MyGlobals::_Is0verbose)
+ std::cout << "treating groups" << std::endl;
+ _family_info=initialCollection.getFamilyInfo();
+ _group_info=initialCollection.getGroupInfo();
- //////////////////
//treating fields
- //////////////////
- if (MyGlobals::_Is0verbose) std::cout<<"treating fields"<<std::endl;
- //cvwat08
+ if (MyGlobals::_Is0verbose)
+ std::cout << "treating fields" << std::endl;
castAllFields(initialCollection,"cellFieldDouble");
- //castAllFields(initialCollection,"faceFieldsIds");
}
/*!
\param initialCollection collection from which the data is extracted to create the new meshes
*/
-void MeshCollection::castCellMeshes(
- MeshCollection& initialCollection,
- std::vector<std::vector<std::vector<int> > >& new2oldIds)
+void MEDPARTITIONER::MeshCollection::castCellMeshes(MeshCollection& initialCollection,
+ std::vector<std::vector<std::vector<int> > >& new2oldIds)
{
- if (_topology==0) throw INTERP_KERNEL::Exception(LOCALIZED("Topology has not been defined on call to castCellMeshes"));
+ if (_topology==0)
+ throw INTERP_KERNEL::Exception("Topology has not been defined on call to castCellMeshes");
int nbNewDomain=_topology->nbDomain();
int nbOldDomain=initialCollection.getTopology()->nbDomain();
_mesh.resize(nbNewDomain);
int rank=MyGlobals::_Rank;
- //if (MyGlobals::_Verbose>10) std::cout<<"proc "<<rank<<" : castCellMeshes splitting"<<std::endl;
//splitting the initial domains into smaller bits
std::vector<std::vector<ParaMEDMEM::MEDCouplingUMesh*> > splitMeshes;
splitMeshes.resize(nbNewDomain);
for (int inew=0; inew<nbNewDomain; inew++)
{
splitMeshes[inew].resize(nbOldDomain, (ParaMEDMEM::MEDCouplingUMesh*)0);
- /*std::fill( &(splitMeshes[inew][0]),
- &(splitMeshes[inew][0])+splitMeshes[inew].size(),
- (ParaMEDMEM::MEDCouplingUMesh*)0 );*/
}
for (int iold=0; iold<nbOldDomain; iold++)
initialCollection.getTopology()->getCellList(iold, &globalids[0]);
std::vector<int> ilocalnew(size); //local
std::vector<int> ipnew(size); //idomain old
- //cvw work locally
_topology->convertGlobalCellList(&globalids[0],size,&ilocalnew[0],&ipnew[0]);
new2oldIds[iold].resize(nbNewDomain);
&new2oldIds[iold][inew][0]+new2oldIds[iold][inew].size(),
true);
if (MyGlobals::_Verbose>400)
- std::cout<<"proc "<<rank<<" : a splitMesh iold inew NbCells "<<iold<<" "<<inew<<" "
- <<splitMeshes[inew][iold]->getNumberOfCells()<<std::endl;
+ std::cout<< "proc " << rank << " : a splitMesh iold inew NbCells " << iold << " " << inew << " "
+ << splitMeshes[inew][iold]->getNumberOfCells() << std::endl;
}
}
}
for (int iold=0; iold<nbOldDomain; iold++)
for(int inew=0; inew<nbNewDomain; inew++)
{
- if (initialCollection._domain_selector->isMyDomain(iold) && _domain_selector->isMyDomain(inew)) continue;
+ if (initialCollection._domain_selector->isMyDomain(iold) && _domain_selector->isMyDomain(inew))
+ continue;
if(initialCollection._domain_selector->isMyDomain(iold))
_domain_selector->sendMesh(*(splitMeshes[inew][iold]),_domain_selector->getProcessorID(inew));
}
//fusing the split meshes
- if (MyGlobals::_Verbose>200) std::cout<<"proc "<<rank<<" : castCellMeshes fusing"<<std::endl;
+ if (MyGlobals::_Verbose>200)
+ std::cout << "proc " << rank << " : castCellMeshes fusing" << std::endl;
for (int inew=0; inew<nbNewDomain ;inew++)
{
- vector<const ParaMEDMEM::MEDCouplingUMesh*> meshes;
+ std::vector<const ParaMEDMEM::MEDCouplingUMesh*> meshes;
for (int i=0; i< splitMeshes[inew].size();i++)
if (splitMeshes[inew][i]!=0)
{
_mesh[inew]=CreateEmptyMEDCouplingUMesh();
//throw INTERP_KERNEL::Exception(LOCALIZED("castCellMeshes fusing : no meshes"));
- cout<<"WARNING : castCellMeshes fusing : no meshes try another number of processors"<<endl;
+ std::cout << "WARNING : castCellMeshes fusing : no meshes try another number of processors" << std::endl;
}
else
{
for (int i=0; i< splitMeshes[inew].size(); i++)
if (splitMeshes[inew][i]!=0) splitMeshes[inew][i]->decrRef();
}
- if (MyGlobals::_Verbose>300) std::cout<<"proc "<<rank<<" : castCellMeshes end fusing"<<std::endl;
+ if (MyGlobals::_Verbose>300)
+ std::cout << "proc " << rank << " : castCellMeshes end fusing" << std::endl;
}
/*!
\param initialCollection source mesh collection
\param nodeMapping structure containing the correspondency between nodes in the initial collection and the node(s) in the new collection
*/
-void MeshCollection::createNodeMapping( MeshCollection& initialCollection, NodeMapping& nodeMapping)
+void MEDPARTITIONER::MeshCollection::createNodeMapping( MeshCollection& initialCollection, NodeMapping& nodeMapping)
{
using std::vector;
using std::make_pair;
}
-//getNodeIds(meshCell, meshFace, nodeIds)
-//inodeCell=nodeIds[inodeFace]
-//(put the biggest mesh in One)
-//if no corresponding node then inodeCell = -1
-void getNodeIds(ParaMEDMEM::MEDCouplingUMesh& meshOne, ParaMEDMEM::MEDCouplingUMesh& meshTwo, vector<int>& nodeIds)
+void getNodeIds(ParaMEDMEM::MEDCouplingUMesh& meshOne, ParaMEDMEM::MEDCouplingUMesh& meshTwo, std::vector<int>& nodeIds)
{
using std::vector;
if (!&meshOne || !&meshTwo) return; //empty or not existing
creates the face meshes on the new domains from the faces on the old domain and the node mapping
faces at the interface are duplicated
*/
-void MeshCollection::castFaceMeshes(MeshCollection& initialCollection,
- const std::multimap<std::pair<int,int>, std::pair<int,int> >& nodeMapping,
- std::vector<std::vector<std::vector<int> > >& new2oldIds)
+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)
{
//splitMeshes structure will contain the partition of
}
else
{
- //std::cout<<"one empty mesh from "<<iold<<std::endl; //cvw
splitMeshes[inew][iold]=CreateEmptyMEDCouplingUMesh();
}
}
for (int iold=0; iold<fromSize; iold++)
for (int inew=0; inew<newSize; inew++)
{
- /*std::cout<<"iold inew "<<iold<<" "<<inew<<" "<<
- _domain_selector->isMyDomain(iold)<<" "<<
- _domain_selector->isMyDomain(inew)<<std::endl;*/
if (_domain_selector->isMyDomain(iold) && !_domain_selector->isMyDomain(inew))
- if (splitMeshes[inew][iold] != 0) {
- //cvw std::cout<<"send NOT empty mesh "<<splitMeshes[inew][iold]->getName()<<" "<<inew<<"<-"<<iold<<std::endl;
- _domain_selector->sendMesh(*(splitMeshes[inew][iold]), _domain_selector->getProcessorID(inew));
- }
- else {
- //std::cout<<"send empty mesh "<<inew<<"<-"<<iold<<std::endl;
- _domain_selector->sendMesh(*(empty), _domain_selector->getProcessorID(inew));
- }
+ if (splitMeshes[inew][iold] != 0)
+ {
+ _domain_selector->sendMesh(*(splitMeshes[inew][iold]), _domain_selector->getProcessorID(inew));
+ }
+ else
+ {
+ _domain_selector->sendMesh(*(empty), _domain_selector->getProcessorID(inew));
+ }
if (!_domain_selector->isMyDomain(iold) && _domain_selector->isMyDomain(inew))
_domain_selector->recvMesh(splitMeshes[inew][iold], _domain_selector->getProcessorID(iold));
}
{
myMeshes.push_back(umesh);
}
- //else {
- // std::cout<<"one empty mesh "<<inew<<" "<<iold<<std::endl;
- //}
}
if (myMeshes.size()>0)
}
else
{
- //std::cout<<"one empty meshes to merge "<<inew<<std::endl;
- //ParaMEDMEM::MEDCouplingUMesh *empty=ParaMEDMEM::MEDCouplingUMesh::New(); //empty one
- //empty->setName("emptyMesh");
- //empty->setMeshDimension(3);
- //empty->allocateCells(0);
ParaMEDMEM::MEDCouplingUMesh *empty=CreateEmptyMEDCouplingUMesh();
meshesCastTo[inew]=empty;
}
- // meshesCastTo[inew]->zipCoords();
for (int iold=0; iold<fromSize; iold++)
- if (splitMeshes[inew][iold]!=0) splitMeshes[inew][iold]->decrRef();
+ if (splitMeshes[inew][iold]!=0)
+ splitMeshes[inew][iold]->decrRef();
}
- //if (MyGlobals::_Verbose>1) std::cout<<"proc "<<MyGlobals::_Rank<<" : end fuse"<<std::endl;
}
-void MeshCollection::remapIntField(const ParaMEDMEM::MEDCouplingUMesh& sourceMesh,
+void MEDPARTITIONER::MeshCollection::remapIntField(const ParaMEDMEM::MEDCouplingUMesh& sourceMesh,
const ParaMEDMEM::MEDCouplingUMesh& targetMesh,
const int* fromArray,
int* toArray)
vector<int> cI;
tmpMesh->getNodeIdsNearPoints(targetCoords->getConstPointer(),targetMesh.getNumberOfCells(),1e-10,c,cI);
if (cI.size()!= targetMesh.getNumberOfCells()+1)
- throw INTERP_KERNEL::Exception(LOCALIZED("Error in source/target projection"));
+ throw INTERP_KERNEL::Exception("Error in source/target projection");
for (int itargetnode=0; itargetnode<targetMesh.getNumberOfCells();itargetnode++)
{
- if (cI[itargetnode]==cI[itargetnode+1]) continue;
+ if (cI[itargetnode]==cI[itargetnode+1])
+ continue;
int isourcenode=c[cI[itargetnode]];
toArray[itargetnode]=fromArray[isourcenode];
}
tmpMesh->decrRef();
}
-void MeshCollection::castIntField2(std::vector<ParaMEDMEM::MEDCouplingUMesh*>& meshesCastFrom,
+void MEDPARTITIONER::MeshCollection::castIntField2(std::vector<ParaMEDMEM::MEDCouplingUMesh*>& meshesCastFrom,
std::vector<ParaMEDMEM::MEDCouplingUMesh*>& meshesCastTo,
std::vector<ParaMEDMEM::DataArrayInt*>& arrayFrom,
std::string nameArrayTo)
}
}
-void MeshCollection::remapIntField2(int inew,int iold,
- const ParaMEDMEM::MEDCouplingUMesh& sourceMesh,
- const ParaMEDMEM::MEDCouplingUMesh& targetMesh,
- const int* fromArray,
- string nameArrayTo)
+void MEDPARTITIONER::MeshCollection::remapIntField2(int inew, int iold,
+ const ParaMEDMEM::MEDCouplingUMesh& sourceMesh,
+ const ParaMEDMEM::MEDCouplingUMesh& targetMesh,
+ const int* fromArray,
+ std::string nameArrayTo)
//here we store ccI for next use in future call of castAllFields and remapDoubleField2
{
- //cout<<"remapIntField2 "<<Cle2ToStr(nameArrayTo,inew,iold)<<endl;
if (sourceMesh.getNumberOfCells()<=0) return; //empty mesh could exist
- //cvw std::cout<<"remapIntField "<<sourceMesh.getNumberOfCells()<<" "<<targetMesh.getNumberOfCells()<<std::endl;
ParaMEDMEM::DataArrayDouble* sourceCoords=sourceMesh.getBarycenterAndOwner();
ParaMEDMEM::DataArrayDouble* targetCoords=targetMesh.getBarycenterAndOwner();
ParaMEDMEM::MEDCouplingUMesh* tmpMesh=ParaMEDMEM::MEDCouplingUMesh::New();
tmpMesh->setCoords(sourceCoords);
- vector<int> c;
- vector<int> cI;
- vector<int> ccI; //memorize intersection target<-source(inew,iold)
- string str,cle;
+ std::vector<int> c;
+ std::vector<int> cI;
+ std::vector<int> ccI; //memorize intersection target<-source(inew,iold)
+ std::string str,cle;
str=nameArrayTo+"_toArray";
cle=Cle1ToStr(str,inew);
int* toArray;
int targetSize=targetMesh.getNumberOfCells();
//first time iold : create and initiate
- if (_mapDataArrayInt.find(cle)==_mapDataArrayInt.end())
+ if (_map_dataarray_int.find(cle)==_map_dataarray_int.end())
{
- if (MyGlobals::_Is0verbose>100) cout<<"create "<<cle<<" size "<<targetSize<<endl;
- ParaMEDMEM::DataArrayInt* p=DataArrayInt::New();
+ if (MyGlobals::_Is0verbose>100)
+ std::cout << "create " << cle << " size " << targetSize << std::endl;
+ ParaMEDMEM::DataArrayInt* p=ParaMEDMEM::DataArrayInt::New();
p->alloc(targetSize,1);
p->fillWithZero();
toArray=p->getPointer();
- _mapDataArrayInt[cle]=p;
+ _map_dataarray_int[cle]=p;
}
else //other times iold: refind and complete
{
- toArray=_mapDataArrayInt.find(cle)->second->getPointer();
+ toArray=_map_dataarray_int.find(cle)->second->getPointer();
}
tmpMesh->getNodeIdsNearPoints(targetCoords->getConstPointer(),targetSize,1e-10,c,cI);
if (cI.size()!=targetSize+1)
- throw INTERP_KERNEL::Exception(LOCALIZED("Error in source/target projection"));
+ throw INTERP_KERNEL::Exception("Error in source/target projection");
for (int itargetnode=0; itargetnode<targetSize; itargetnode++)
{
if (cI[itargetnode]==cI[itargetnode+1]) continue;
//memories intersection for future same job on fields (if no existing cle=no intersection)
str=Cle2ToStr(nameArrayTo+"_ccI",inew,iold);
- if (MyGlobals::_Verbose>700) cout<<"proc "<<MyGlobals::_Rank<<" : map memorize '"<<str<<"'\n";
- _mapDataArrayInt[str]=CreateDataArrayIntFromVector(ccI, 2);
+ if (MyGlobals::_Verbose>700)
+ std::cout << "proc " << MyGlobals::_Rank << " : map memorize '" << str << "'\n";
+ _map_dataarray_int[str]=CreateDataArrayIntFromVector(ccI, 2);
sourceCoords->decrRef();
targetCoords->decrRef();
tmpMesh->decrRef();
}
-void MeshCollection::castAllFields(MeshCollection& initialCollection, string nameArrayTo) //cvwat08
+void MEDPARTITIONER::MeshCollection::castAllFields(MeshCollection& initialCollection, std::string nameArrayTo) //cvwat08
{
- using std::vector;
if (nameArrayTo!="cellFieldDouble")
- throw INTERP_KERNEL::Exception(LOCALIZED("Error castAllField only on cellFieldDouble"));
+ throw INTERP_KERNEL::Exception("Error castAllField only on cellFieldDouble");
- string nameTo="typeData=6"; //resume the type of field casted
+ std::string nameTo="typeData=6"; //resume the type of field casted
// send-recv operations
int ioldMax=initialCollection.getMesh().size();
int inewMax=this->getMesh().size();
int iFieldMax=initialCollection.getFieldDescriptions().size();
- if (MyGlobals::_Verbose>10) cout<<"castAllFields with:\n"<<ReprVectorOfString(initialCollection.getFieldDescriptions())<<endl;
- //std::vector<std::string> initialCollection.getFieldDescriptions()
- //getFieldDescriptions() is a string description of field coherent and tested and set BEFORE.
+ if (MyGlobals::_Verbose>10)
+ std::cout << "castAllFields with:\n" << ReprVectorOfString(initialCollection.getFieldDescriptions()) << std::endl;
//see collection.prepareFieldDescriptions()
for (int ifield=0; ifield<iFieldMax; ifield++)
{
- string descriptionField=initialCollection.getFieldDescriptions()[ifield];
- if (descriptionField.find(nameTo)==string::npos) continue; //only nameTo accepted in Fields name description
+ std::string descriptionField=initialCollection.getFieldDescriptions()[ifield];
+ if (descriptionField.find(nameTo)==std::string::npos)
+ continue; //only nameTo accepted in Fields name description
for (int inew=0; inew<inewMax; inew++)
{
for (int iold=0; iold<ioldMax; iold++)
if (isParallelMode() && _domain_selector->isMyDomain(iold) && !_domain_selector->isMyDomain(inew))
{
int target=_domain_selector->getProcessorID(inew);
- ParaMEDMEM::DataArrayDouble* field=initialCollection.getField(descriptionField,iold); //cvwat14
- //getField look for and read it if not done, and assume decrRef() in ~MeshCollection;
+ ParaMEDMEM::DataArrayDouble* field=initialCollection.getField(descriptionField,iold);
if (MyGlobals::_Verbose>10)
- std::cout<<"proc "<<_domain_selector->rank()<<" : castAllFields sendDouble"<<std::endl;
+ std::cout << "proc " << _domain_selector->rank() << " : castAllFields sendDouble" << std::endl;
SendDataArrayDouble(field, target);
}
//receiving arrays from distant domains
int source=_domain_selector->getProcessorID(iold);
//receive vector
if (MyGlobals::_Verbose>10)
- std::cout<<"proc "<<_domain_selector->rank()<<" : castAllFields recvDouble"<<std::endl;
+ std::cout << "proc " << _domain_selector->rank() << " : castAllFields recvDouble" << std::endl;
ParaMEDMEM::DataArrayDouble* field=RecvDataArrayDouble(source);
remapDoubleField3(inew,iold,field,nameArrayTo,descriptionField);
}
for (int iold=0; iold<ioldMax; iold++)
if (!isParallelMode() || ( _domain_selector->isMyDomain(iold) && _domain_selector->isMyDomain(inew)))
{
- ParaMEDMEM::DataArrayDouble* field=initialCollection.getField(descriptionField,iold); //cvwat14
+ ParaMEDMEM::DataArrayDouble* field=initialCollection.getField(descriptionField,iold);
remapDoubleField3(inew,iold,field,nameArrayTo,descriptionField);
}
}
}
}
-void MeshCollection::remapDoubleField3(int inew, int iold,
- ParaMEDMEM::DataArrayDouble* fromArray,
- string nameArrayTo,
- string descriptionField)
+void MEDPARTITIONER::MeshCollection::remapDoubleField3(int inew, int iold,
+ ParaMEDMEM::DataArrayDouble* fromArray,
+ std::string nameArrayTo,
+ std::string descriptionField)
//here we use 'cellFamily_ccI inew iold' set in remapIntField2
{
- using std::vector;
if (nameArrayTo!="cellFieldDouble")
- throw INTERP_KERNEL::Exception(LOCALIZED("Error remapDoubleField3 only on cellFieldDouble"));
- string cle=Cle2ToStr("cellFamily_ccI",inew,iold);
+ throw INTERP_KERNEL::Exception("Error remapDoubleField3 only on cellFieldDouble");
+ std::string key=Cle2ToStr("cellFamily_ccI",inew,iold);
- map<string,ParaMEDMEM::DataArrayInt*>::iterator it1;
- it1=_mapDataArrayInt.find(cle);
- if (it1==_mapDataArrayInt.end())
+ std::map<std::string,ParaMEDMEM::DataArrayInt*>::iterator it1;
+ it1=_map_dataarray_int.find(key);
+ if (it1==_map_dataarray_int.end())
{
- cerr<<"proc "<<MyGlobals::_Rank<<" : remapDoubleField3 cle '"<<cle<<"' not found"<<endl;
- cerr<<" trying remap of field double on cells : "<<descriptionField<<endl;
+ std::cerr << "proc " << MyGlobals::_Rank << " : remapDoubleField3 key '" << key << "' not found" << std::endl;
+ std::cerr << " trying remap of field double on cells : " << descriptionField << std::endl;
return;
}
//create ccI in remapIntField2
- ParaMEDMEM::DataArrayInt* ccI=it1->second;
- if (MyGlobals::_Verbose>300) cout<<"proc "<<MyGlobals::_Rank<<" : remapDoubleField3 "<<cle<<" size "<<ccI->getNbOfElems()<<endl;
- //cout<<descriptionField<<endl;
+ ParaMEDMEM::DataArrayInt *ccI=it1->second;
+ if (MyGlobals::_Verbose>300)
+ std::cout << "proc " << MyGlobals::_Rank << " : remapDoubleField3 " << key << " size " << ccI->getNbOfElems() << std::endl;
- int nbcell=this->getMesh()[inew]->getNumberOfCells(); //number of cell of mesh
+ int nbcell=this->getMesh()[inew]->getNumberOfCells();
int nbcomp=fromArray->getNumberOfComponents();
int nbPtGauss=StrToInt(ExtractFromDescription(descriptionField, "nbPtGauss="));
- //int nbk=fromArray->getNumberOfTuples();
-
- //cle=reprGenericDescription(descriptionField)+" "+IntToStr(inew);
- string tag="inewFieldDouble="+IntToStr(inew);
- cle=descriptionField+SerializeFromString(tag);
- //cout<<"descriptionField in remapDoubleField3 : "<<descriptionField<<endl;
+ std::string tag="inewFieldDouble="+IntToStr(inew);
+ key=descriptionField+SerializeFromString(tag);
int fromArrayNbOfElem=fromArray->getNbOfElems();
int fromArrayNbOfComp=fromArray->getNumberOfComponents();
int fromArrayNbOfCell=fromArrayNbOfElem/fromArrayNbOfComp/nbPtGauss;
if (MyGlobals::_Verbose>1000)
{
- cout<<"proc "<<MyGlobals::_Rank<<" nbcell "<<nbcell<<" nbcomp "<<nbcomp<<" nbPtGauss "<<nbPtGauss<<
- " fromArray nbOfElems "<<fromArrayNbOfElem<<
- " nbTuples "<<fromArray->getNumberOfTuples()<<
- " nbcells "<<fromArrayNbOfCell<<
- " nbComponents "<<fromArray->getNumberOfComponents()<<endl;
+ std::cout<<"proc " << MyGlobals::_Rank << " nbcell " << nbcell << " nbcomp " << nbcomp << " nbPtGauss " << nbPtGauss <<
+ " fromArray nbOfElems " << fromArrayNbOfElem <<
+ " nbTuples " << fromArray->getNumberOfTuples() <<
+ " nbcells " << fromArrayNbOfCell <<
+ " nbComponents " << fromArray->getNumberOfComponents() << std::endl;
}
ParaMEDMEM::DataArrayDouble* field=0;
- map<string,ParaMEDMEM::DataArrayDouble*>::iterator it2;
- it2=_mapDataArrayDouble.find(cle);
- if (it2==_mapDataArrayDouble.end())
+ std::map<std::string,ParaMEDMEM::DataArrayDouble*>::iterator it2;
+ it2=_map_dataarray_double.find(key);
+ if (it2==_map_dataarray_double.end())
{
- if (MyGlobals::_Verbose>300) cout<<"proc "<<MyGlobals::_Rank<<" : remapDoubleField3 cle '"<<cle<<"' not found and create it"<<endl;
- field=DataArrayDouble::New();
- _mapDataArrayDouble[cle]=field;
+ if (MyGlobals::_Verbose>300)
+ std::cout << "proc "<< MyGlobals::_Rank << " : remapDoubleField3 key '" << key << "' not found and create it" << std::endl;
+ field=ParaMEDMEM::DataArrayDouble::New();
+ _map_dataarray_double[key]=field;
field->alloc(nbcell*nbPtGauss,nbcomp);
field->fillWithZero();
}
field=it2->second;
if (field->getNumberOfTuples()!=nbcell*nbPtGauss || field->getNumberOfComponents()!=nbcomp)
{
- cerr<<"proc "<<MyGlobals::_Rank<<" : remapDoubleField3 pb of size "<<
- " trying remap of field double on cells : \n"<<descriptionField<<endl;
+ std::cerr << "proc " << MyGlobals::_Rank << " : remapDoubleField3 pb of size " <<
+ " trying remap of field double on cells : \n" << descriptionField << std::endl;
return;
}
}
- //cout<<"proc "<<MyGlobals::_Rank<<" : remapDoubleField3 "<<cle<<" size "<<ccI->getNbOfElems()<<endl;
if (nbPtGauss==1)
{
itarget=pccI[i];
isource=pccI[i+1];
if ((itarget<0) || (itarget>=nbcell) || (isource<0) || (isource>=fromArrayNbOfCell))
- throw INTERP_KERNEL::Exception(LOCALIZED("Error field override"));
+ throw INTERP_KERNEL::Exception("Error field override");
int ita=itarget*delta;
int iso=isource*delta;
for (int k=0; k<delta; k++) pField[ita+k]=pFrom[iso+k]; //components and gausspoints
*
* \param filename name of the master file containing the list of all the MED files
*/
-MeshCollection::MeshCollection(const std::string& filename)
+MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename)
: _topology(0),
_owns_topology(true),
_driver(0),
_create_empty_groups(false),
_joint_finder(0)
{
- // char filenamechar[256];
- // strcpy(filenamechar,filename.c_str());
try
{
_driver=new MeshCollectionMedXmlDriver(this);
}
catch(...)
{
- if ( _driver ) delete _driver; _driver=0;
- throw INTERP_KERNEL::Exception(LOCALIZED("file does not comply with any recognized format"));
+ delete _driver;
+ _driver=0;
+ throw INTERP_KERNEL::Exception("file does not comply with any recognized format");
}
}
for ( int idomain = 0; idomain < _mesh.size(); ++idomain )
* \param filename - name of the master file containing the list of all the MED files
* \param domainSelector - selector of domains to load
*/
-MeshCollection::MeshCollection(const std::string& filename, ParaDomainSelector& domainSelector) //cvwat01
+MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename, ParaDomainSelector& domainSelector) //cvwat01
: _topology(0),
_owns_topology(true),
_driver(0),
catch(...)
{ // Handle all exceptions
if ( _driver ) delete _driver; _driver=0;
- throw INTERP_KERNEL::Exception(LOCALIZED("file .xml does not comply with any recognized format"));
+ throw INTERP_KERNEL::Exception("file .xml does not comply with any recognized format");
}
}
else
xml.replace(xml.find("$meshName"),9,meshNames[0]);
xml.replace(xml.find("$meshName"),9,meshNames[0]);
xml.replace(xml.find("$meshName"),9,meshNames[0]);
- //std::cout<<xml<<std::endl;
std::string nameFileXml=myfile;
nameFileXml.replace(nameFileXml.find(".med"),4,".xml");
nameFileXml="medpartitioner_"+nameFileXml;
catch(...)
{ // Handle all exceptions
if ( _driver ) delete _driver; _driver=0;
- throw INTERP_KERNEL::Exception(LOCALIZED("file medpartitioner_xxx.xml does not comply with any recognized format"));
+ throw INTERP_KERNEL::Exception("file medpartitioner_xxx.xml does not comply with any recognized format");
}
}
else //no extension
}
catch(...)
{
- if ( _driver ) delete _driver; _driver=0;
- throw INTERP_KERNEL::Exception(LOCALIZED("file name with no extension does not comply with any recognized format"));
+ delete _driver;
+ _driver=0;
+ throw INTERP_KERNEL::Exception("file name with no extension does not comply with any recognized format");
}
}
}
-
- /*done in MeshCollectionMedXmlDriver read
- if ( isParallelMode() )
- // to know nb of cells on each proc to compute global cell ids from locally global
- _domain_selector->gatherNbOf( getMesh() );*/
-
// find non-empty domain mesh
for ( int idomain = 0; idomain < _mesh.size(); ++idomain )
if ( _mesh[idomain] && _mesh[idomain]->getNumberOfNodes() > 0 )
try
{
- //check for all proc/file compatibility of _fieldDescriptions
+ //check for all proc/file compatibility of _field_descriptions
//*MyGlobals::_File_Names=AllgathervVectorOfString(*MyGlobals::_File_Names);
- _fieldDescriptions=AllgathervVectorOfString(MyGlobals::_Field_Descriptions); //cvwat07
+ _field_descriptions=AllgathervVectorOfString(MyGlobals::_Field_Descriptions);
}
catch(INTERP_KERNEL::Exception& e)
{
- cerr<<"proc "<<MyGlobals::_Rank<<" : INTERP_KERNEL_Exception : "<<e.what()<<endl;
- throw INTERP_KERNEL::Exception(LOCALIZED("Something wrong verifying coherency of files med ands fields"));
+ std::cerr << "proc " << MyGlobals::_Rank << " : INTERP_KERNEL_Exception : " << e.what() << std::endl;
+ throw INTERP_KERNEL::Exception("Something wrong verifying coherency of files med ands fields");
}
try
{
- //check for all proc/file compatibility of _familyInfo //cvwat05
- vector<string> v2=AllgathervVectorOfString(VectorizeFromMapOfStringInt(_familyInfo));
- _familyInfo=DevectorizeToMapOfStringInt(v2);
+ //check for all proc/file compatibility of _family_info
+ std::vector<std::string> v2=AllgathervVectorOfString(VectorizeFromMapOfStringInt(_family_info));
+ _family_info=DevectorizeToMapOfStringInt(v2);
}
catch(INTERP_KERNEL::Exception& e)
{
- cerr<<"proc "<<MyGlobals::_Rank<<" : INTERP_KERNEL_Exception : "<<e.what()<<endl;
- throw INTERP_KERNEL::Exception(LOCALIZED("Something wrong merging all familyInfo"));
+ std::cerr << "proc " << MyGlobals::_Rank << " : INTERP_KERNEL_Exception : " << e.what() << std::endl;
+ throw INTERP_KERNEL::Exception("Something wrong merging all familyInfo");
}
try
{
- //check for all proc/file compatibility of _groupInfo
- vector<string> v2=AllgathervVectorOfString(
- VectorizeFromMapOfStringVectorOfString(_groupInfo));
- _groupInfo=DeleteDuplicatesInMapOfStringVectorOfString(
- DevectorizeToMapOfStringVectorOfString(v2));
+ //check for all proc/file compatibility of _group_info
+ std::vector<std::string> v2=AllgathervVectorOfString(VectorizeFromMapOfStringVectorOfString(_group_info));
+ _group_info=DeleteDuplicatesInMapOfStringVectorOfString(DevectorizeToMapOfStringVectorOfString(v2));
}
catch(INTERP_KERNEL::Exception& e)
{
- cerr<<"proc "<<MyGlobals::_Rank<<" : INTERP_KERNEL_Exception : "<<e.what()<<endl;
- throw INTERP_KERNEL::Exception(LOCALIZED("Something wrong merging all groupInfo"));
+ std::cerr << "proc " << MyGlobals::_Rank << " : INTERP_KERNEL_Exception : " << e.what() << std::endl;
+ throw INTERP_KERNEL::Exception("Something wrong merging all groupInfo");
}
-
-
- //std::vector< std::string > _meshes=MEDLoader::GetMeshNames(filename);
- //std::vector< std::string > _fields=MEDLoader::GetAllFieldNamesOnMesh(filename,meshname[0]);
- //cout<<"number of fields "<<_fields.size()<<endl;
-
}
/*! constructing the MESH collection from a sequential MED-file
* \param filename MED file
* \param meshname name of the mesh that is to be read
*/
-MeshCollection::MeshCollection(const std::string& filename, const std::string& meshname)
+MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename, const std::string& meshname)
: _name(meshname),
_topology(0),
_owns_topology(true),
}
catch (...)
{
- if ( _driver ) delete _driver; _driver=0;
- throw INTERP_KERNEL::Exception(LOCALIZED("problem reading .med files"));
+ delete _driver;
+ _driver=0;
+ throw INTERP_KERNEL::Exception("problem reading .med files");
}
if ( _mesh[0] && _mesh[0]->getNumberOfNodes() > 0 )
_i_non_empty_mesh = 0;
}
-MeshCollection::~MeshCollection()
+MEDPARTITIONER::MeshCollection::~MeshCollection()
{
for (int i=0; i<_mesh.size();i++)
if (_mesh[i]!=0) _mesh[i]->decrRef();
- for (int i=0; i<_cellFamilyIds.size();i++)
- if (_cellFamilyIds[i]!=0) _cellFamilyIds[i]->decrRef();
+ for (int i=0; i<_cell_family_ids.size();i++)
+ if (_cell_family_ids[i]!=0)
+ _cell_family_ids[i]->decrRef();
- for (int i=0; i<_faceMesh.size();i++)
- if (_faceMesh[i]!=0) _faceMesh[i]->decrRef();
+ for (int i=0; i<_face_mesh.size();i++)
+ if (_face_mesh[i]!=0)
+ _face_mesh[i]->decrRef();
- for (int i=0; i<_faceFamilyIds.size();i++)
- if (_faceFamilyIds[i]!=0) _faceFamilyIds[i]->decrRef();
+ for (int i=0; i<_face_family_ids.size();i++)
+ if (_face_family_ids[i]!=0)
+ _face_family_ids[i]->decrRef();
- for (map<string, ParaMEDMEM::DataArrayInt*>::iterator it=_mapDataArrayInt.begin() ; it!=_mapDataArrayInt.end(); it++ )
- if ((*it).second!=0) (*it).second->decrRef();
+ for (std::map<std::string, ParaMEDMEM::DataArrayInt*>::iterator it=_map_dataarray_int.begin() ; it!=_map_dataarray_int.end(); it++ )
+ if ((*it).second!=0)
+ (*it).second->decrRef();
- for (map<string, ParaMEDMEM::DataArrayDouble*>::iterator it=_mapDataArrayDouble.begin() ; it!=_mapDataArrayDouble.end(); it++ )
- if ((*it).second!=0) (*it).second->decrRef();
+ for (std::map<std::string, ParaMEDMEM::DataArrayDouble*>::iterator it=_map_dataarray_double.begin() ; it!=_map_dataarray_double.end(); it++ )
+ if ((*it).second!=0)
+ (*it).second->decrRef();
- if (_driver !=0) {delete _driver; _driver=0;}
- if (_topology!=0 && _owns_topology) {delete _topology; _topology=0;}
+ delete _driver;
+ if (_topology!=0 && _owns_topology)
+ delete _topology;
- if (_joint_finder!=0) {delete _joint_finder; _joint_finder=0;}
+ delete _joint_finder;
}
/*! constructing the MESH collection from a file
* \param filename name of the master file that will contain the list of the MED files
*
*/
-void MeshCollection::write(const std::string& filename)
+void MEDPARTITIONER::MeshCollection::write(const std::string& filename)
{
//building the connect zones necessary for writing joints
// if (_topology->nbDomain()>1)
// buildConnectZones();
//suppresses link with driver so that it can be changed for writing
- if (_driver!=0) delete _driver;
+ delete _driver;
_driver=0;
-
- //char filenamechar[256];
- // strcpy(filenamechar,filename.c_str());
retrieveDriver()->write (filename.c_str(), _domain_selector);
}
/*! creates or gets the link to the collection driver
*/
-MeshCollectionDriver* MeshCollection::retrieveDriver()
+MEDPARTITIONER::MeshCollectionDriver* MEDPARTITIONER::MeshCollection::retrieveDriver()
{
if (_driver==0)
{
_driver=new MeshCollectionMedAsciiDriver(this);
break;
default:
- throw INTERP_KERNEL::Exception(LOCALIZED("Unrecognized driver"));
+ throw INTERP_KERNEL::Exception("Unrecognized driver");
}
}
return _driver;
/*! gets an existing driver
*
*/
-MeshCollectionDriver* MeshCollection::getDriver() const {
+MEDPARTITIONER::MeshCollectionDriver* MEDPARTITIONER::MeshCollection::getDriver() const
+{
return _driver;
}
-// /*! retrieves the mesh dimension*/
-int MeshCollection::getMeshDimension() const {
+/*!
+ * retrieves the mesh dimension
+*/
+int MEDPARTITIONER::MeshCollection::getMeshDimension() const
+{
return _i_non_empty_mesh < 0 ? -1 : _mesh[_i_non_empty_mesh]->getMeshDimension();
}
-std::vector<ParaMEDMEM::MEDCouplingUMesh*>& MeshCollection::getMesh() {
+std::vector<ParaMEDMEM::MEDCouplingUMesh*>& MEDPARTITIONER::MeshCollection::getMesh()
+{
return _mesh;
}
-std::vector<ParaMEDMEM::MEDCouplingUMesh*>& MeshCollection::getFaceMesh() {
- return _faceMesh;
+std::vector<ParaMEDMEM::MEDCouplingUMesh*>& MEDPARTITIONER::MeshCollection::getFaceMesh()
+{
+ return _face_mesh;
}
-ParaMEDMEM::MEDCouplingUMesh* MeshCollection::getMesh(int idomain) const {
+ParaMEDMEM::MEDCouplingUMesh* MEDPARTITIONER::MeshCollection::getMesh(int idomain) const
+{
return _mesh[idomain];
}
-ParaMEDMEM::MEDCouplingUMesh* MeshCollection::getFaceMesh(int idomain) {
- return _faceMesh[idomain];
+ParaMEDMEM::MEDCouplingUMesh* MEDPARTITIONER::MeshCollection::getFaceMesh(int idomain)
+{
+ return _face_mesh[idomain];
}
-std::vector<MEDPARTITIONER::ConnectZone*>& MeshCollection::getCZ() {
+std::vector<MEDPARTITIONER::ConnectZone*>& MEDPARTITIONER::MeshCollection::getCZ()
+{
return _connect_zones;
}
-Topology* MeshCollection::getTopology() const {
+MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::getTopology() const
+{
return _topology;
}
-void MeshCollection::setTopology(Topology* topo) {
+void MEDPARTITIONER::MeshCollection::setTopology(Topology* topo)
+{
if (_topology!=0)
{
- throw INTERP_KERNEL::Exception(LOCALIZED("topology is already set"));
+ throw INTERP_KERNEL::Exception("topology is already set");
}
else
_topology = topo;
* \param edgeweight returns the pointer to the table that contains the edgeweights
* (only used if indivisible regions are required)
*/
-void MeshCollection::buildCellGraph(MEDPARTITIONER::SkyLineArray* & array, int *& edgeweights ) //cvwat09
+void MEDPARTITIONER::MeshCollection::buildCellGraph(MEDPARTITIONER::SkyLineArray* & array, int *& edgeweights )
{
using std::multimap;
using std::vector;
using std::make_pair;
using std::pair;
- multimap< int, int > node2cell;
- multimap< int, int > cell2cell;
- multimap< int, int > cell2node;
+ std::multimap< int, int > node2cell;
+ std::multimap< int, int > cell2cell;
+ std::multimap< int, int > cell2node;
- vector<vector<multimap<int,int> > > commonDistantNodes;
+ std::vector<std::vector<std::multimap<int,int> > > commonDistantNodes;
int nbdomain=_topology->nbDomain();
if (isParallelMode())
{
//looking for reverse nodal connectivity i global numbering
for (int idomain=0; idomain<nbdomain; idomain++)
{
- if (isParallelMode() && !_domain_selector->isMyDomain(idomain)) continue;
-
- /*obsolete
- int offsetCell=0, offsetNode=0;
- if (isParallelMode())
- {
- offsetCell=_domain_selector->getDomainCellShift(idomain);
- offsetNode=_domain_selector->getDomainNodeShift(idomain);
- }*/
+ if (isParallelMode() && !_domain_selector->isMyDomain(idomain))
+ continue;
ParaMEDMEM::DataArrayInt* index=ParaMEDMEM::DataArrayInt::New();
ParaMEDMEM::DataArrayInt* revConn=ParaMEDMEM::DataArrayInt::New();
int nbNodes=_mesh[idomain]->getNumberOfNodes();
- //cout<<"proc "<<MyGlobals::_Rank<<" idomain "<<idomain<<" nbNodes "<<nbNodes<<" offsetCell "<<offsetCell<<" offsetNode "<<offsetNode<<endl;
_mesh[idomain]->getReverseNodalConnectivity(revConn,index);
//problem saturation over 1 000 000 nodes for 1 proc
- if (MyGlobals::_Verbose>100) cout<<"proc "<<MyGlobals::_Rank<<" getReverseNodalConnectivity done on "<<nbNodes<<" nodes"<<endl;
+ 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();
- //if (MyGlobals::_Verbose>100) cout<<"proc "<<MyGlobals::_Rank<<" create node2cell on local nodes with global numerotation idomain|inode|icell\n";
for (int i=0; i<nbNodes; i++)
{
for (int icell=index_ptr[i]; icell<index_ptr[i+1]; icell++)
{
- /*cvw local
- node2cell.insert(make_pair(i, revConnPtr[icell]));
- cout<<" "<<idomain<<"|"<<i<<"|"<<revConnPtr[icell];
- cell2node.insert(make_pair(revConnPtr[icell], i));
- */
int globalNode=_topology->convertNodeToGlobal(idomain,i);
int globalCell=_topology->convertCellToGlobal(idomain,revConnPtr[icell]);
node2cell.insert(make_pair(globalNode, globalCell));
- //cvw cout<<" "<<idomain<<"|"<<i<<"#"<< globalNode<<"|"<<revConnPtr[icell]<<"#"<<globalCell;
cell2node.insert(make_pair(globalCell, globalNode));
}
}
revConn->decrRef();
index->decrRef();
- //vector<vector<multimap<int,int> > > dNC=getDistantNodeCell()
for (int iother=0; iother<nbdomain; iother++)
{
std::multimap<int,int>::iterator it;
int isource=idomain;
int itarget=iother;
- for (it=_joint_finder->_distant_node_cell[isource][itarget].begin();
- it!=_joint_finder->_distant_node_cell[isource][itarget].end(); it++)
+ for (it=_joint_finder->getDistantNodeCell()[isource][itarget].begin();
+ it!=_joint_finder->getDistantNodeCell()[isource][itarget].end(); it++)
{
int globalNode=_topology->convertNodeToGlobal(idomain,(*it).first);
int globalCell=(*it).second;
node2cell.insert(make_pair(globalNode, globalCell));
- //cout<<"processor "<<MyGlobals::_Rank<<" : isource "<<isource<<" itarget "<<itarget<<
- // " "<<(*it).first<<"~"<<globalNode<<"~"<<globalCell<<endl;
cell2node.insert(make_pair(globalCell, globalNode));
}
}
//warning here one node have less than or equal effective number of cell with it
//but cell could have more than effective nodes
//because other equals nodes in other domain (with other global inode)
- if (MyGlobals::_Verbose>100) cout<<"proc "<<MyGlobals::_Rank<<" creating graph arcs on nbNodes "<<_topology->nbNodes()<<endl;
+ if (MyGlobals::_Verbose>100)
+ std::cout<< "proc " << MyGlobals::_Rank << " creating graph arcs on nbNodes " << _topology->nbNodes() << std::endl;
for (int inode=0; inode<_topology->nbNodes(); inode++) //on all nodes
{
typedef multimap<int,int>::const_iterator MI;
if (nbcn>=3) //cvw TODO if 2d cells set at 2
cell2cell.insert(make_pair(cell1->second,cell2->second));
//note here there is some global numerotation of cell which come from other domain (not mydomain)
- //cout<<" "<<MyGlobals::_Rank<<"!"<<cell1->second<<"!"<<cell2->second; //cvw
}
}
}
}
- if (MyGlobals::_Verbose>100) cout<<"proc "<<MyGlobals::_Rank<<" create skylinearray"<<endl;
+ if (MyGlobals::_Verbose>100)
+ std::cout << "proc " << MyGlobals::_Rank << " create skylinearray" << std::endl;
//filling up index and value to create skylinearray structure
- vector <int> index,value;
+ std::vector <int> index,value;
index.push_back(0);
int idep=0;
multimap<int,int>::iterator it;
pair<multimap<int,int>::iterator,multimap<int,int>::iterator> ret;
ret=cell2cell.equal_range(globalCell);
- //cout<<" "<<MyGlobals::_Rank<<"$"<<icell<<"$"<<globalCell;
for (it=ret.first; it!=ret.second; ++it)
{
- //cout<<" "<<MyGlobals::_Rank<<"$"<<icell<<"$"<<globalCell<<"$"<<(*it).second<<endl;
int ival=(*it).second; //no adding one existing yet
for (int i=idep ; i<idep+size ; i++)
{
if (ival!= -1)
{
value.push_back(ival);
- //cout<<"|"<<ival;
size++;
}
}
- //cout<<" ";
idep=index[index.size()-1]+size;
index.push_back(idep);
}
if (MyGlobals::_Verbose>100)
{
- std::cout<<"\nproc "<<_domain_selector->rank()<<" : end MeshCollection::buildCellGraph "<<
- index.size()-1<<" "<<value.size()<<std::endl;
+ std::cout << "\nproc " << _domain_selector->rank() << " : end MeshCollection::buildCellGraph " <<
+ index.size()-1 << " " << value.size() << std::endl;
if (index.size()>1)
{
- for (int i=0; i<10; ++i) cout<<index[i]<<" ";
- cout<<"... "<<index[index.size()-1]<<endl;
- for (int i=0; i<15; ++i) cout<<value[i]<<" ";
+ for (int i=0; i<10; ++i)
+ std::cout<<index[i]<<" ";
+ std::cout << "... " << index[index.size()-1] << std::endl;
+ for (int i=0; i<15; ++i)
+ std::cout<< value[i] << " ";
int ll=index[index.size()-1]-1;
- cout<<"... ("<<ll<<") "<<value[ll-1]<<" "<<value[ll]<<endl;
+ std::cout << "... (" << ll << ") " << value[ll-1] << " " << value[ll] << std::endl;
}
}
*
* returns a topology based on the new graph
*/
-Topology* MeshCollection::createPartition(int nbdomain, //cvwat06
- Graph::splitter_type split,
- const std::string& options_string,
- int* user_edge_weights,
- int* user_vertices_weights)
+MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::createPartition(int nbdomain,
+ Graph::splitter_type split,
+ const std::string& options_string,
+ int *user_edge_weights,
+ int *user_vertices_weights)
{
- using std::cout;
- using std::endl;
-
- if (MyGlobals::_Verbose>10) cout<<"proc "<<MyGlobals::_Rank<<" : MeshCollection::createPartition : Building cell graph"<<endl;
+ if (MyGlobals::_Verbose>10)
+ std::cout << "proc " << MyGlobals::_Rank << " : MeshCollection::createPartition : Building cell graph" << std::endl;
- if (nbdomain <1) throw INTERP_KERNEL::Exception(LOCALIZED("Number of subdomains must be > 0"));
+ if (nbdomain <1)
+ throw INTERP_KERNEL::Exception("Number of subdomains must be > 0");
MEDPARTITIONER::SkyLineArray* array=0;
int* edgeweights=0;
-
- //cout<<"Building cell graph... ";
- // if ( _domain_selector )
- // buildCellGraphParallel(array,edgeweights);
- // else
- buildCellGraph(array,edgeweights); //cvwat09
+ buildCellGraph(array,edgeweights);
//MPI_Barrier(MPI_COMM_WORLD);
- //cout<<"proc "<<MyGlobals::_Rank<<" :end barrier CellGraph done"<<endl;
Graph* cellGraph;
switch (split)
{
case Graph::METIS:
#ifdef MED_ENABLE_PARMETIS
- if (MyGlobals::_Verbose>10) cout<<"METISGraph"<<endl;
- cellGraph=(Graph*)(new METISGraph(array,edgeweights));
+ if (MyGlobals::_Verbose>10)
+ std::cout << "METISGraph" << std::endl;
+ cellGraph=new METISGraph(array,edgeweights);
#else
throw INTERP_KERNEL::Exception(LOCALIZED("METIS Graph is not available. Check your products, please."));
#endif
break;
case Graph::SCOTCH:
#ifdef MED_ENABLE_SCOTCH
- if (MyGlobals::_Verbose>10) cout<<"SCOTCHGraph"<<endl;
- cellGraph=(Graph*)(new SCOTCHGraph(array,edgeweights));
+ if (MyGlobals::_Verbose>10)
+ std::cout << "SCOTCHGraph" << std::endl;
+ cellGraph=new SCOTCHGraph(array,edgeweights);
#else
throw INTERP_KERNEL::Exception(LOCALIZED("SCOTCH Graph is not available. Check your products, please."));
#endif
if (user_vertices_weights!=0)
cellGraph->setVerticesWeights(user_vertices_weights);
- if (MyGlobals::_Is0verbose>10) cout<<"partitioning graph on "<<nbdomain<<" domains"<<endl;
- cellGraph->partGraph(nbdomain, options_string, _domain_selector); //cvwat10
+ if (MyGlobals::_Is0verbose>10)
+ std::cout << "partitioning graph on " << nbdomain << " domains" << std::endl;
+ cellGraph->partGraph(nbdomain, options_string, _domain_selector);
- if (MyGlobals::_Is0verbose>10) cout<<"building new topology"<<endl;
+ if (MyGlobals::_Is0verbose>10)
+ std::cout << "building new topology" << std::endl;
//cellGraph is a shared pointer
Topology* topology=new ParallelTopology (cellGraph, getTopology(), nbdomain, getMeshDimension());
-
//cleaning
- if (edgeweights!=0) delete[] edgeweights;
- // if (array!=0) delete array;
+ delete [] edgeweights;
delete cellGraph;
- if (MyGlobals::_Verbose>11) cout<<"proc "<<MyGlobals::_Rank<<" : end MeshCollection::createPartition"<<endl;
+ if (MyGlobals::_Verbose>11)
+ std::cout << "proc " << MyGlobals::_Rank << " : end MeshCollection::createPartition" << std::endl;
return topology;
}
*
* returns a topology based on the new partition
*/
-Topology* MeshCollection::createPartition(const int* partition)
+MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::createPartition(const int* partition)
{
- using std::set;
-
MEDPARTITIONER::SkyLineArray* array=0;
int* edgeweights=0;
buildCellGraph(array,edgeweights);
Graph* cellGraph;
- set<int> domains;
+ std::set<int> domains;
for (int i=0; i<_topology->nbCells(); i++)
{
domains.insert(partition[i]);
}
int nbdomain=domains.size();
- cellGraph=(Graph*)(new UserGraph(array, partition, _topology->nbCells()));
+ cellGraph=new UserGraph(array, partition, _topology->nbCells());
//cellGraph is a shared pointer
Topology* topology = new ParallelTopology (cellGraph, getTopology(), nbdomain, getMeshDimension());
return topology;
}
-void MeshCollection::setDomainNames(const std::string& name)
+void MEDPARTITIONER::MeshCollection::setDomainNames(const std::string& name)
{
for (int i=0; i<_topology->nbDomain(); i++)
{
}
}
-ParaMEDMEM::DataArrayDouble* MeshCollection::getField(std::string descriptionField, int iold)
+ParaMEDMEM::DataArrayDouble *MEDPARTITIONER::MeshCollection::getField(std::string descriptionField, int iold)
//getField look for and read it if not done, and assume decrRef() in ~MeshCollection;
//something like MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(name.c_str(),f1->getMesh()->getName(),0,f1->getName(),0,1);
{
int rank=MyGlobals::_Rank;
- string tag="ioldFieldDouble="+IntToStr(iold);
- string descriptionIold=descriptionField+SerializeFromString(tag);
- if (_mapDataArrayDouble.find(descriptionIold)!=_mapDataArrayDouble.end())
+ std::string tag="ioldFieldDouble="+IntToStr(iold);
+ std::string descriptionIold=descriptionField+SerializeFromString(tag);
+ if (_map_dataarray_double.find(descriptionIold)!=_map_dataarray_double.end())
{
- if (MyGlobals::_Verbose>300) cout<<"proc "<<rank<<" : YET READ getField : "<<descriptionIold<<endl;
- DataArrayDouble* res=_mapDataArrayDouble[descriptionIold];
- //cout<<res->reprZip()<<endl;
+ if (MyGlobals::_Verbose>300)
+ std::cout << "proc " << rank << " : YET READ getField : " << descriptionIold << std::endl;
+ ParaMEDMEM::DataArrayDouble* res=_map_dataarray_double[descriptionIold];
return res;
}
- if (MyGlobals::_Verbose>200) cout<<"proc "<<rank<<" : TO BE READ getField : "<<descriptionIold<<endl;
- string description, fileName, meshName, fieldName;
+ if (MyGlobals::_Verbose>200)
+ std::cout << "proc " << rank << " : TO BE READ getField : " << descriptionIold << std::endl;
+ std::string description, fileName, meshName, fieldName;
int idomain, typeField, DT, IT, entity;
idomain=iold;
fileName=MyGlobals::_File_Names[iold];
if (MyGlobals::_Verbose>10)
- cout<<"proc "<<MyGlobals::_Rank<<" : in "<<fileName<<" "<<iold<<" "<<descriptionIold<<endl;
- //cout<<"\n\n"<<"ON_CELLS "<<ON_CELLS<<" ON_NODES "<<ON_NODES<<" ON_GAUSS_PT "<<ON_GAUSS_PT<<" ON_GAUSS_NE "<<ON_GAUSS_NE<<endl;;
- //typeField ON_CELLS 0 ON_NODES 1 ON_GAUSS_PT 2 ON_GAUSS_NE 3;
- //FieldDescriptionToData(descriptionField, &idomain, &fileName, &meshName, &fieldName, &typeField, &DT, &IT);
+ std::cout << "proc " << MyGlobals::_Rank << " : in " << fileName << " " << iold << " " << descriptionIold << std::endl;
FieldShortDescriptionToData(descriptionIold, fieldName, typeField, entity, DT, IT);
meshName=MyGlobals::_Mesh_Names[iold];
- //MEDCouplingFieldDouble* f2=MEDLoader::ReadFieldCell(
- // fileName.c_str(), meshName.c_str(), meshDimRelToMax, fieldName.c_str(), DT, IT);
- MEDCouplingFieldDouble* f2=MEDLoader::ReadField((ParaMEDMEM::TypeOfField) typeField,
- fileName.c_str(), meshName.c_str(), 0, fieldName.c_str(), DT, IT);
+ ParaMEDMEM::MEDCouplingFieldDouble* f2=MEDLoader::ReadField((ParaMEDMEM::TypeOfField) typeField,
+ fileName.c_str(), meshName.c_str(), 0, fieldName.c_str(), DT, IT);
- DataArrayDouble* res=f2->getArray();
+ ParaMEDMEM::DataArrayDouble* res=f2->getArray();
//to know names of components
- vector <string> browse=BrowseFieldDouble(f2);
- //done yet
- //double time=f2->getTime(IT,DT);
- //browse.push_back("time="+DoubleToStr(time));
- string localFieldInformation=descriptionIold+SerializeFromVectorOfString(browse);
- if (MyGlobals::_Verbose>10) cout<<"proc "<<MyGlobals::_Rank<<" : localFieldInformation : "<<localFieldInformation<<endl;
+ std::vector<std::string> browse=BrowseFieldDouble(f2);
+ std::string localFieldInformation=descriptionIold+SerializeFromVectorOfString(browse);
+ if (MyGlobals::_Verbose>10)
+ std::cout << "proc " << MyGlobals::_Rank << " : localFieldInformation : " << localFieldInformation << std::endl;
MyGlobals::_General_Informations.push_back(localFieldInformation);
- res->incrRef(); //free field, keep res
+ res->incrRef();
f2->decrRef();
- _mapDataArrayDouble[descriptionIold]=res;
-
- //duplicate it! because f2->decRef!!
- //DataArrayDouble* res=f2->getArray()->deepCpy();
- //f2->decrRef();
- //cout<<res->reprZip()<<endl;
- //have to put it in map for next needs.. decRef later...~MeshCollection
+ _map_dataarray_double[descriptionIold]=res;
return res;
}
-void MeshCollection::prepareFieldDescriptions()
+void MEDPARTITIONER::MeshCollection::prepareFieldDescriptions()
//to have unique valid fields names/pointers/descriptions for partitionning
-//filter _fieldDescriptions to be in all procs compliant and equal
+//filter _field_descriptions to be in all procs compliant and equal
{
int nbfiles=MyGlobals::_File_Names.size(); //nb domains
- vector<string> r2;
+ std::vector<std::string> r2;
//from allgatherv then vector(procs) of serialised vector(fields) of vector(description) data
- for (int i=0; i<_fieldDescriptions.size(); i++)
+ for (int i=0; i<_field_descriptions.size(); i++)
{
- vector<string> r1=DeserializeToVectorOfString(_fieldDescriptions[i]);
- for (int i=0; i<r1.size(); i++) r2.push_back(r1[i]);
+ std::vector<std::string> r1=DeserializeToVectorOfString(_field_descriptions[i]);
+ for (int i=0; i<r1.size(); i++)
+ r2.push_back(r1[i]);
}
//here vector(procs*fields) of serialised vector(description) data
- _fieldDescriptions=r2;
- int nbfields=_fieldDescriptions.size(); //on all domains
+ _field_descriptions=r2;
+ int nbfields=_field_descriptions.size(); //on all domains
if ((nbfields%nbfiles)!=0)
{
if (MyGlobals::_Rank==0)
{
- cerr<<"\nERROR : incoherent number of fields references in all files .med\n"<<endl
- <<"fileMedNames :"<<endl
- <<ReprVectorOfString(MyGlobals::_File_Names)
- <<"fieldDescriptions :"<<endl
- <<ReprVectorOfString(MyGlobals::_Field_Descriptions); //cvwat07
+ std::cerr<< "\nERROR : incoherent number of fields references in all files .med\n" << std::endl
+ << "fileMedNames :" << std::endl
+ << ReprVectorOfString(MyGlobals::_File_Names)
+ << "field_descriptions :" << std::endl
+ << ReprVectorOfString(MyGlobals::_Field_Descriptions);
}
- throw INTERP_KERNEL::Exception(LOCALIZED("incoherent number of fields references in all files .med\n"));
+ throw INTERP_KERNEL::Exception("incoherent number of fields references in all files .med\n");
}
- _fieldDescriptions.resize(nbfields/nbfiles);
- for (int i=0; i<_fieldDescriptions.size(); i++)
+ _field_descriptions.resize(nbfields/nbfiles);
+ for (int i=0; i<_field_descriptions.size(); i++)
{
- string str=_fieldDescriptions[i];
+ std::string str=_field_descriptions[i];
str=EraseTagSerialized(str,"idomain=");
str=EraseTagSerialized(str,"fileName=");
- _fieldDescriptions[i]=str;
+ _field_descriptions[i]=str;
}
}
//returns true if inodes of a face are in inodes of a cell
-bool isFaceOncell(vector< int >& inodesFace,vector< int >& inodesCell)
+bool isFaceOncell(std::vector< int >& inodesFace, std::vector< int >& inodesCell)
{
int ires=0;
int nbok=inodesFace.size();
for (int i=0; i<nbok; i++)
{
int ii=inodesFace[i];
- if (ii<0) cout<<"isFaceOncell problem inodeface<0"<<endl;
+ if (ii<0)
+ std::cout << "isFaceOncell problem inodeface<0" << std::endl;
for (int j=0; j<inodesCell.size(); j++)
{
if (ii==inodesCell[j])
{
- ires=ires+1; break; //inode of face found
+ ires=ires+1;
+ break; //inode of face found
}
}
- if (ires<i+1) break; //inode of face not found do not continue...
+ if (ires<i+1)
+ break; //inode of face not found do not continue...
}
return (ires==nbok);
}
-void MeshCollection::filterFaceOnCell()
+void MEDPARTITIONER::MeshCollection::filterFaceOnCell()
{
- //meshesCells=_mesh;
- //meshesFaces=_faceMesh;
for (int inew=0; inew<_topology->nbDomain(); inew++)
{
if (isParallelMode() && _domain_selector->isMyDomain(inew))
{
if (MyGlobals::_Verbose>200)
- std::cout<<"proc "<<MyGlobals::_Rank<<" : filterFaceOnCell on inewDomain "<<inew<<
- " nbOfFaces "<<_faceMesh[inew]->getNumberOfCells()<<endl;
+ std::cout << "proc " << MyGlobals::_Rank << " : filterFaceOnCell on inewDomain " << inew << " nbOfFaces " << _face_mesh[inew]->getNumberOfCells() << std::endl;
ParaMEDMEM::MEDCouplingUMesh* mcel=_mesh[inew];
- ParaMEDMEM::MEDCouplingUMesh* mfac=_faceMesh[inew];
+ ParaMEDMEM::MEDCouplingUMesh* mfac=_face_mesh[inew];
//to have cellnode=f(facenode)... inodeCell=nodeIds[inodeFace]
- vector<int> nodeIds;
- //cout<<"proc "<<MyGlobals::_Rank<<" : nodeIds beg "<<inew<<" "<<mcel<<" "<<mfac<<endl;
+ std::vector<int> nodeIds;
getNodeIds(*mcel, *mfac, nodeIds);
- if (nodeIds.size()==0) continue; //one empty mesh nothing to do
+ if (nodeIds.size()==0)
+ continue; //one empty mesh nothing to do
- DataArrayInt *revNodalCel=DataArrayInt::New();
- DataArrayInt *revNodalIndxCel=DataArrayInt::New();
+ ParaMEDMEM::DataArrayInt *revNodalCel=ParaMEDMEM::DataArrayInt::New();
+ ParaMEDMEM::DataArrayInt *revNodalIndxCel=ParaMEDMEM::DataArrayInt::New();
mcel->getReverseNodalConnectivity(revNodalCel,revNodalIndxCel);
int *revC=revNodalCel->getPointer();
int *revIndxC=revNodalIndxCel->getPointer();
- vector< int > faceOnCell;
- vector< int > faceNotOnCell;
+ std::vector< int > faceOnCell;
+ std::vector< int > faceNotOnCell;
int nbface=mfac->getNumberOfCells();
for (int iface=0; iface<nbface; iface++)
{
bool ok;
- vector< int > inodesFace;
+ std::vector< int > inodesFace;
mfac->getNodeIdsOfCell(iface, inodesFace);
int nbnodFace=inodesFace.size();
//set inodesFace in mcel
for (int i=0; i<nbnodFace; i++) inodesFace[i]=nodeIds[inodesFace[i]];
int inod=inodesFace[0];
- if (inod<0) cout<<"filterFaceOnCell problem 1"<<endl;
+ if (inod<0)
+ std::cout << "filterFaceOnCell problem 1" << std::endl;
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];
- vector< int > inodesCell;
+ std::vector< int > inodesCell;
mcel->getNodeIdsOfCell(icel, inodesCell);
ok=isFaceOncell(inodesFace, inodesCell);
if (ok) break;
if (ok)
{
faceOnCell.push_back(iface);
- //if (MyGlobals::_Is0verbose) cout<<"face on cell "<<iface<<" "<<faceOnCell.size()-1<<endl;
}
else
{
faceNotOnCell.push_back(iface);
- if (MyGlobals::_Is0verbose) cout<<"face NOT on cell "<<iface<<" "<<faceOnCell.size()-1<<endl;
+ if (MyGlobals::_Is0verbose)
+ std::cout << "face NOT on cell " << iface << " " << faceOnCell.size()-1 << std::endl;
}
}
revNodalCel->decrRef();
revNodalIndxCel->decrRef();
- string cle;
- cle=Cle1ToStr("filterFaceOnCell",inew);
- _mapDataArrayInt[cle]=CreateDataArrayIntFromVector(faceOnCell);
- cle=Cle1ToStr("filterNotFaceOnCell",inew);
- _mapDataArrayInt[cle]=CreateDataArrayIntFromVector(faceNotOnCell);
-
- /*ParaMEDMEM::DataArrayInt* index=ParaMEDMEM::DataArrayInt::New();
- ParaMEDMEM::DataArrayInt* revConn=ParaMEDMEM::DataArrayInt::New();
- _mesh[idomain]->getReverseNodalConnectivity(revConn,index);
- int* index_ptr=index->getPointer();*/
-
- /*if (MyGlobals::_Is0verbose)
- {
- cout<<"proc "<<MyGlobals::_Rank<<" : nodeIds end "<<inew<<" "<<nodeIds.size()<<endl;
- for (int i=0; i<nodeIds.size(); i++) cout<<" "<<nodeIds[i];
- cout<<endl;
- }*/
-
+ std::string keyy;
+ keyy=Cle1ToStr("filterFaceOnCell",inew);
+ _map_dataarray_int[keyy]=CreateDataArrayIntFromVector(faceOnCell);
+ keyy=Cle1ToStr("filterNotFaceOnCell",inew);
+ _map_dataarray_int[keyy]=CreateDataArrayIntFromVector(faceNotOnCell);
}
}
}
-
-/*
-void MeshCollection::buildBoundaryOnCellMeshes()
-//no used... yet
-{
- //cout<<"buildBoundaryOnCellMeshes"<<endl;
- //meshesCells=_mesh;
- //meshesFaces=_faceMesh;
- for (int inew=0; inew<_topology->nbDomain(); inew++)
- {
- if (isParallelMode() && _domain_selector->isMyDomain(inew))
- {
- if (MyGlobals::_Verbose>1) std::cout<<"proc "<<MyGlobals::_Rank<<" : filterFaceOnCell on "<<inew<<" "<<_faceMesh[inew]->getNumberOfCells()<<endl;
- ParaMEDMEM::MEDCouplingUMesh* mcel=_mesh[inew];
- //ParaMEDMEM::MEDCouplingUMesh& mfac=_faceMesh[inew];
-
- DataArrayInt *desc=DataArrayInt::New();
- DataArrayInt *descIndx=DataArrayInt::New();
- DataArrayInt *revDesc=DataArrayInt::New();
- DataArrayInt *revDescIndx=DataArrayInt::New();
- //
- MEDCouplingUMesh *meshDM1=mcel->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
- revDesc->decrRef();
- desc->decrRef();
- descIndx->decrRef();
- int nbOfCells=meshDM1->getNumberOfCells();
- const int *revDescIndxC=revDescIndx->getConstPointer();
- std::vector<int> boundaryCells;
- for(int i=0; i<nbOfCells; i++)
- if(revDescIndxC[i+1]-revDescIndxC[i]==1)
- boundaryCells.push_back(i);
- revDescIndx->decrRef();
- bool keepCoords=true;
- MEDCouplingUMesh *ret=(MEDCouplingUMesh *)meshDM1->buildPartOfMySelf(&boundaryCells[0],&boundaryCells[0]+boundaryCells.size(),keepCoords);
- meshDM1->decrRef();
- //don't know what to do with result yet..
- //_faceMesh[inew]->decrRef();
- //_faceMesh[inew]=ret;
- }
- }
-}
-*/
-
#include "MEDCouplingUMesh.hxx"
-#include <vector>
#include <map>
+#include <vector>
#include <string>
namespace ParaMEDMEM
void write(const std::string& filename);
//getting the driver
- MeshCollectionDriver* retrieveDriver();
- MeshCollectionDriver* getDriver() const;
- void setDriverType(MEDPARTITIONER::DriverType type) {_driver_type=type;}
+ MeshCollectionDriver *retrieveDriver();
+ MeshCollectionDriver *getDriver() const;
+ void setDriverType(MEDPARTITIONER::DriverType type) { _driver_type=type; }
//creation of the cell graph
void buildCellGraph(MEDPARTITIONER::SkyLineArray* & array,int *& edgeweights );
Topology* createPartition(const int* partition);
//getting mesh dimension
- int getMeshDimension() const ;
+ int getMeshDimension() const;
//getting a reference to mesh vector
std::vector<ParaMEDMEM::MEDCouplingUMesh*>& getMesh();
std::vector<ParaMEDMEM::MEDCouplingUMesh*>& getFaceMesh();
ParaMEDMEM::MEDCouplingUMesh* getFaceMesh(int idomain);
std::vector<ParaMEDMEM::MEDCouplingUMesh*>& getGroupMeshes(int idomain);
- std::vector<ParaMEDMEM::DataArrayInt*>& getCellFamilyIds() {return _cellFamilyIds;}
- std::vector<ParaMEDMEM::DataArrayInt*>& getFaceFamilyIds() {return _faceFamilyIds;}
+ std::vector<ParaMEDMEM::DataArrayInt*>& getCellFamilyIds() { return _cell_family_ids; }
+ std::vector<ParaMEDMEM::DataArrayInt*>& getFaceFamilyIds() { return _face_family_ids; }
- std::map<std::string, ParaMEDMEM::DataArrayInt*>& getMapDataArrayInt() {return _mapDataArrayInt;}
- std::map<std::string, ParaMEDMEM::DataArrayDouble*>& getMapDataArrayDouble() {return _mapDataArrayDouble;}
+ std::map<std::string, ParaMEDMEM::DataArrayInt*>& getMapDataArrayInt() { return _map_dataarray_int; }
+ std::map<std::string, ParaMEDMEM::DataArrayDouble*>& getMapDataArrayDouble() { return _map_dataarray_double; }
- std::map<std::string,int>& getFamilyInfo() {return _familyInfo;}
- std::map<std::string, std::vector<std::string> >& getGroupInfo() {return _groupInfo;}
+ std::map<std::string,int>& getFamilyInfo() { return _family_info; }
+ std::map<std::string, std::vector<std::string> >& getGroupInfo() { return _group_info; }
ParaMEDMEM::DataArrayDouble* getField(std::string descriptionField, int iold);
- std::vector<std::string>& getFieldDescriptions() {return _fieldDescriptions;}
+ std::vector<std::string>& getFieldDescriptions() { return _field_descriptions; }
void prepareFieldDescriptions();
void filterFaceOnCell();
//getting a pointer to topology
Topology* getTopology() const ;
- ParaDomainSelector* getParaDomainSelector() const{return _domain_selector;}
+ ParaDomainSelector* getParaDomainSelector() const { return _domain_selector; }
//setting a new topology
void setTopology(Topology* topology);
//getting/setting the name of the global mesh (as opposed
//to the name of a subdomain \a nn, which is name_nn)
- std::string getName() const {return _name;}
- void setName(const std::string& name){_name=name;}
+ std::string getName() const { return _name; }
+ void setName(const std::string& name) { _name=name; }
void setDomainNames(const std::string& name);
//getting/setting the description of the global mesh
- std::string getDescription() const {return _description;}
- void setDescription(const std::string& name) { _description=name;}
+ std::string getDescription() const { return _description; }
+ void setDescription(const std::string& name) { _description=name; }
//creates the node mapping between an old collection and the present one
void createNodeMapping(MeshCollection& initialCollection,
//links to meshes
std::vector<ParaMEDMEM::MEDCouplingUMesh*> _mesh;
- std::vector<ParaMEDMEM::MEDCouplingUMesh*> _faceMesh;
+ std::vector<ParaMEDMEM::MEDCouplingUMesh*> _face_mesh;
//index of a non empty mesh within _mesh (in parallel mode all of meshes can be empty)
int _i_non_empty_mesh;
std::vector<MEDPARTITIONER::ConnectZone*> _connect_zones;
//family ids storages
- std::vector<ParaMEDMEM::DataArrayInt*> _cellFamilyIds;
- std::vector<ParaMEDMEM::DataArrayInt*> _faceFamilyIds;
+ std::vector<ParaMEDMEM::DataArrayInt*> _cell_family_ids;
+ std::vector<ParaMEDMEM::DataArrayInt*> _face_family_ids;
//DataArrayInt* storages
- std::map<std::string, ParaMEDMEM::DataArrayInt*> _mapDataArrayInt;
+ std::map<std::string, ParaMEDMEM::DataArrayInt*> _map_dataarray_int;
//DataArrayDouble* storages
- std::map<std::string, ParaMEDMEM::DataArrayDouble*> _mapDataArrayDouble;
+ std::map<std::string, ParaMEDMEM::DataArrayDouble*> _map_dataarray_double;
//fields to be partitioned
- std::vector<std::string> _fieldDescriptions;
+ std::vector<std::string> _field_descriptions;
//group family conversion
- std::map<std::string, int> _familyInfo;
- std::map<std::string, std::vector<std::string> > _groupInfo;
+ std::map<std::string, int> _family_info;
+ std::map<std::string, std::vector<std::string> > _group_info;
//list of groups that are not to be splitted
std::vector<std::string> _indivisible_regions;
#include "MEDLoader.hxx"
#include "MEDFileMesh.hxx"
-#include <vector>
-#include <string>
#include <map>
#include <set>
-#include <iostream>
+#include <vector>
+#include <string>
#include <fstream>
+#include <iostream>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
-#include <sys/time.h>
-
-extern "C" {
+extern "C"
+{
#include "med.h"
}
-using namespace std;
-using namespace ParaMEDMEM;
using namespace MEDPARTITIONER;
MeshCollectionDriver::MeshCollectionDriver(MeshCollection* collection):_collection(collection)
* */
int MeshCollectionDriver::readSeq(const char* filename, const char* meshname)
{
- cout<<"readSeq"<<endl;
+ std::cout << "readSeq" << std::endl;
MyGlobals::_File_Names.resize(1);
- MyGlobals::_File_Names[0]=string(filename);
+ MyGlobals::_File_Names[0]=std::string(filename);
ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(filename,meshname);
//puts the only mesh in the mesh vector
*/
//================================================================================
-void MeshCollectionDriver::readSubdomain(vector<int*>& cellglobal, //cvwat03
- vector<int*>& faceglobal,
- vector<int*>& nodeglobal, int idomain)
+void MeshCollectionDriver::readSubdomain(std::vector<int*>& cellglobal,
+ std::vector<int*>& faceglobal,
+ std::vector<int*>& nodeglobal, int idomain)
{
- string meshname=MyGlobals::_Mesh_Names[idomain];
- string file=MyGlobals::_File_Names[idomain];
- //cout << "Reading "<<meshname<<" in "<<file<<endl; //cvw
+ std::string meshname=MyGlobals::_Mesh_Names[idomain];
+ std::string file=MyGlobals::_File_Names[idomain];
ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(file.c_str(),meshname.c_str());
- vector<int> nonEmpty=mfm->getNonEmptyLevels();
+ std::vector<int> nonEmpty=mfm->getNonEmptyLevels();
try
{
ParaMEDMEM::DataArrayInt* empty=ParaMEDMEM::DataArrayInt::New();
empty->alloc(0,1);
(_collection->getCellFamilyIds())[idomain]=empty;
- cout<<"\nNO Level0Mesh (Cells)\n";
+ std::cout << "\nNO Level0Mesh (Cells)\n";
}
try
{
}
else
{
- throw "no faces";
+ throw INTERP_KERNEL::Exception("no faces");
}
}
catch(...)
(_collection->getFaceMesh())[idomain]=CreateEmptyMEDCouplingUMesh(); // or 0 if you want test;
ParaMEDMEM::DataArrayInt* empty=ParaMEDMEM::DataArrayInt::New();
(_collection->getFaceFamilyIds())[idomain]=empty;
- if (MyGlobals::_Verbose>10) cout<<"proc "<<MyGlobals::_Rank<<" : NO LevelM1Mesh (Faces)\n";
+ if (MyGlobals::_Verbose>10)
+ std::cout << "proc " << MyGlobals::_Rank << " : NO LevelM1Mesh (Faces)\n";
}
//reading groups
mfm->decrRef();
- vector<string> localInformation;
- string str;
+ std::vector<std::string> localInformation;
+ std::string str;
localInformation.push_back(str+"ioldDomain="+IntToStr(idomain));
localInformation.push_back(str+"meshName="+meshname);
MyGlobals::_General_Informations.push_back(SerializeFromVectorOfString(localInformation));
- vector<string> localFields=BrowseAllFieldsOnMesh(file, meshname, idomain); //cvwat07
+ std::vector<std::string> localFields=BrowseAllFieldsOnMesh(file, meshname, idomain);
if (localFields.size()>0)
MyGlobals::_Field_Descriptions.push_back(SerializeFromVectorOfString(localFields));
}
void MeshCollectionDriver::readSubdomain(int idomain)
{
- string meshname=MyGlobals::_Mesh_Names[idomain];
- string file=MyGlobals::_File_Names[idomain];
- //cout << "Reading "<<meshname<<" in "<<file<<endl; //cvw
+ std::string meshname=MyGlobals::_Mesh_Names[idomain];
+ std::string file=MyGlobals::_File_Names[idomain];
ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(file.c_str(),meshname.c_str());
- vector<int> nonEmpty=mfm->getNonEmptyLevels();
+ std::vector<int> nonEmpty=mfm->getNonEmptyLevels();
try
{
ParaMEDMEM::DataArrayInt* empty=ParaMEDMEM::DataArrayInt::New();
empty->alloc(0,1);
(_collection->getCellFamilyIds())[idomain]=empty;
- cout<<"\nNO Level0Mesh (Cells)\n";
+ std::cout<<"\nNO Level0Mesh (Cells)\n";
}
try
{
}
else
{
- throw "no faces";
+ throw INTERP_KERNEL::Exception("no faces");
}
}
catch(...)
(_collection->getFaceMesh())[idomain]=CreateEmptyMEDCouplingUMesh(); // or 0 if you want test;
ParaMEDMEM::DataArrayInt* empty=ParaMEDMEM::DataArrayInt::New();
(_collection->getFaceFamilyIds())[idomain]=empty;
- if (MyGlobals::_Verbose>10) cout<<"proc "<<MyGlobals::_Rank<<" : NO LevelM1Mesh (Faces)\n";
+ if (MyGlobals::_Verbose>10)
+ std::cout << "proc " << MyGlobals::_Rank << " : NO LevelM1Mesh (Faces)\n";
}
//reading groups
mfm->decrRef();
- vector<string> localInformation;
- string str;
+ std::vector<std::string> localInformation;
+ std::string str;
localInformation.push_back(str+"ioldDomain="+IntToStr(idomain));
localInformation.push_back(str+"meshName="+meshname);
MyGlobals::_General_Informations.push_back(SerializeFromVectorOfString(localInformation));
- vector<string> localFields=BrowseAllFieldsOnMesh(file, meshname, idomain); //cvwat07
+ std::vector<std::string> localFields=BrowseAllFieldsOnMesh(file, meshname, idomain);
if (localFields.size()>0)
MyGlobals::_Field_Descriptions.push_back(SerializeFromVectorOfString(localFields));
}
-void MeshCollectionDriver::writeMedFile(int idomain, const string& distfilename)
+void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfilename) const
{
- vector<const ParaMEDMEM::MEDCouplingUMesh*> meshes;
+ std::vector<const ParaMEDMEM::MEDCouplingUMesh*> meshes;
ParaMEDMEM::MEDCouplingUMesh* cellMesh=_collection->getMesh(idomain);
ParaMEDMEM::MEDCouplingUMesh* faceMesh=_collection->getFaceMesh(idomain);
ParaMEDMEM::MEDCouplingUMesh* faceMeshFilter=0;
- string finalMeshName=ExtractFromDescription(MyGlobals::_General_Informations[0], "finalMeshName=");
- string cleFilter=Cle1ToStr("filterFaceOnCell",idomain);
- DataArrayInt* filter=0;
+ std::string finalMeshName=ExtractFromDescription(MyGlobals::_General_Informations[0], "finalMeshName=");
+ std::string cleFilter=Cle1ToStr("filterFaceOnCell",idomain);
+ ParaMEDMEM::DataArrayInt* filter=0;
if (_collection->getMapDataArrayInt().find(cleFilter)!=_collection->getMapDataArrayInt().end())
{
filter=_collection->getMapDataArrayInt().find(cleFilter)->second;
int* index=filter->getPointer();
- faceMeshFilter=(MEDCouplingUMesh *) faceMesh->buildPartOfMySelf(index,index+filter->getNbOfElems(),true);
+ faceMeshFilter=(ParaMEDMEM::MEDCouplingUMesh *) faceMesh->buildPartOfMySelf(index,index+filter->getNbOfElems(),true);
faceMesh=faceMeshFilter;
}
cellMesh->setName(finalMeshName.c_str());
meshes.push_back(cellMesh);
- //cellMesh->zipCoords();
- //faceMesh->zipCoords();
faceMesh->checkCoherency();
if (faceMesh->getNumberOfCells()>0)
meshes.push_back(faceMesh);
}
- /*do not work
- ParaMEDMEM::MEDFileUMesh* mfm2=ParaMEDMEM::MEDFileUMesh::New();
- MEDFileUMesh* mfm2 = static_cast<MEDFileUMesh*>(cellMesh->getMeshes()->getMeshAtPos(0));
- MEDFileUMesh* mfm2 = ParaMEDMEM::MEDFileUMesh::New(cellMesh);
- string fname="FUM_"+distfilename;
- mfm2->setMeshAtLevel(0, cellMesh );
- mfm2->setMeshAtLevel(-1, faceMesh );
- mfm2->write(fname.c_str(),0);
- mfm2->decrRef();
- */
-
ParaMEDMEM::MEDCouplingUMesh* boundaryMesh=0;
- //ParaMEDMEM::MEDCouplingUMesh* boundaryMesh1=0;
- //ParaMEDMEM::MEDCouplingUMesh* finalboundaryMesh=0;
if (MyGlobals::_Creates_Boundary_Faces>0)
{
//try to write Boundary meshes
bool keepCoords=false; //TODO or true
- boundaryMesh=(MEDCouplingUMesh *) cellMesh->buildBoundaryMesh(keepCoords);
+ boundaryMesh=(ParaMEDMEM::MEDCouplingUMesh *) cellMesh->buildBoundaryMesh(keepCoords);
boundaryMesh->setName("boundaryMesh");
- //cout<<"boundaryMesh "<<boundaryMesh->getNumberOfCells()<<endl;
- //do not work if faceMesh present yet //The mesh dimension of meshes must be different each other!
- //boundaryMesh->checkCoherency();
- //boundaryMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-10);
- //meshes.push_back(boundaryMesh);
- //string boundary="boundary_"+distfilename;
-
- /*try to find joint do no work
- int rang=MyGlobals::_Rank;
- if (rang==1) (_collection->getParaDomainSelector())->sendMesh(*(boundaryMesh),0);
- if (rang==0)
- {
- (_collection->getParaDomainSelector())->recvMesh(boundaryMesh1,1);
- //vector<const ParaMEDMEM::MEDCouplingUMesh*> meshes;
- //vector<DataArrayInt* > corr;
- //meshes.push_back(boundaryMesh);
- //meshes.push_back(boundaryMesh1);
- //need share the same coords
- //boundaryMesh1->tryToShareSameCoordsPermute(*boundaryMesh, 1e-10);
- //finalboundaryMesh=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,2, corr);
- //boundaryMesh=finalboundaryMesh;
-
- boundaryMesh->zipCoords();
- boundaryMesh1->zipCoords();
- finalboundaryMesh=MEDCouplingUMesh::MergeUMeshes(boundaryMesh,boundaryMesh1);
- DataArrayInt* commonNodes=0;
- commonNodes=finalboundaryMesh->zipCoordsTraducer();
- boundaryMesh=finalboundaryMesh;
- cout<<"zipcoords"<<commonNodes->repr()<<endl;
- }
- */
}
MEDLoader::WriteUMeshes(distfilename.c_str(), meshes, true);
- if (faceMeshFilter!=0) faceMeshFilter->decrRef();
-
+ if (faceMeshFilter!=0)
+ faceMeshFilter->decrRef();
if (boundaryMesh!=0)
{
MEDLoader::WriteUMesh(distfilename.c_str(), boundaryMesh, false);
boundaryMesh->decrRef();
}
-
- //cout<<"familyInfo :\n"<<ReprMapOfStringInt(_collection->getFamilyInfo())<<endl;
- //cout<<"groupInfo :\n"<<ReprMapOfStringVectorOfString(_collection->getGroupInfo())<<endl;
ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(distfilename.c_str(), _collection->getMesh(idomain)->getName());
-
- /*example of adding new family
- (_collection->getFamilyInfo())["FaceNotOnCell"]=-500;
- vector<string> FaceNotOnCell;
- FaceNotOnCell.push_back("FaceNotOnCell");
- (_collection->getGroupInfo())["FaceNotOnCell"]=FaceNotOnCell;
- */
mfm->setFamilyInfo(_collection->getFamilyInfo());
mfm->setGroupInfo(_collection->getGroupInfo());
- //without filter mfm->setFamilyFieldArr(-1,(_collection->getFaceFamilyIds())[idomain]);
-
- string cle=Cle1ToStr("faceFamily_toArray",idomain);
- if (_collection->getMapDataArrayInt().find(cle)!=_collection->getMapDataArrayInt().end())
+ std::string key=Cle1ToStr("faceFamily_toArray",idomain);
+ if (_collection->getMapDataArrayInt().find(key)!=_collection->getMapDataArrayInt().end())
{
- DataArrayInt* fam=_collection->getMapDataArrayInt().find(cle)->second;
- DataArrayInt* famFilter=0;
+ ParaMEDMEM::DataArrayInt *fam=_collection->getMapDataArrayInt().find(key)->second;
+ ParaMEDMEM::DataArrayInt *famFilter=0;
if (filter!=0)
{
int* index=filter->getPointer();
int nbTuples=filter->getNbOfElems();
//not the good one...buildPartOfMySelf do not exist for DataArray
//Filter=fam->renumberAndReduce(index, filter->getNbOfElems());
- famFilter=DataArrayInt::New();
+ famFilter=ParaMEDMEM::DataArrayInt::New();
famFilter->alloc(nbTuples,1);
int* pfamFilter=famFilter->getPointer();
int* pfam=fam->getPointer();
- for (int i=0; i<nbTuples; i++) pfamFilter[i]=pfam[index[i]];
+ for (int i=0; i<nbTuples; i++)
+ pfamFilter[i]=pfam[index[i]];
fam=famFilter;
mfm->setFamilyFieldArr(-1,fam);
famFilter->decrRef();
}
- //cout<<"proc "<<MyGlobals::_Rank<<"cvw111 "<<nbTuples<<endl;
- //mfm->setFamilyFieldArr(-1,fam);
- //if (famFilter!=0) famFilter->decrRef();
- }
-
- /*example visualisation of filter
- if (_collection->getMapDataArrayInt().find(cle)!=_collection->getMapDataArrayInt().end())
- {
- DataArrayInt* fam=_collection->getMapDataArrayInt().find(cle)->second;
- string cle2=Cle1ToStr("filterNotFaceOnCell",idomain);
- if (_collection->getMapDataArrayInt().find(cle2)!=_collection->getMapDataArrayInt().end())
- {
- DataArrayInt* filter=_collection->getMapDataArrayInt().find(cle2)->second;
- int* index=filter->getPointer();
- int* pfam=fam->getPointer();
- for (int i=0; i<filter->getNbOfElems(); i++) pfam[index[i]]=-500;
- }
- mfm->setFamilyFieldArr(-1,fam);
- //mfm->setFamilyFieldArr(-1,_collection->getMapDataArrayInt().find(cle)->second);
}
- */
- cle=Cle1ToStr("cellFamily_toArray",idomain);
- if (_collection->getMapDataArrayInt().find(cle)!=_collection->getMapDataArrayInt().end())
- mfm->setFamilyFieldArr(0,_collection->getMapDataArrayInt().find(cle)->second);
+ key=Cle1ToStr("cellFamily_toArray",idomain);
+ if (_collection->getMapDataArrayInt().find(key)!=_collection->getMapDataArrayInt().end())
+ mfm->setFamilyFieldArr(0,_collection->getMapDataArrayInt().find(key)->second);
mfm->write(distfilename.c_str(),0);
- cle="/inewFieldDouble="+IntToStr(idomain)+"/";
+ key="/inewFieldDouble="+IntToStr(idomain)+"/";
- map<string,ParaMEDMEM::DataArrayDouble*>::iterator it;
+ std::map<std::string,ParaMEDMEM::DataArrayDouble*>::iterator it;
int nbfFieldFound=0;
for (it=_collection->getMapDataArrayDouble().begin() ; it!=_collection->getMapDataArrayDouble().end(); it++)
{
- string desc=(*it).first;
- size_t found=desc.find(cle);
- if (found==string::npos) continue;
- if (MyGlobals::_Verbose>20) cout<<"proc "<<MyGlobals::_Rank<<" : write field "<<desc<<endl;
- string meshName, fieldName;
+ std::string desc=(*it).first;
+ size_t found=desc.find(key);
+ if (found==std::string::npos)
+ continue;
+ if (MyGlobals::_Verbose>20)
+ std::cout << "proc " << MyGlobals::_Rank << " : write field " << desc << std::endl;
+ std::string meshName, fieldName;
int typeField, DT, IT, entity;
FieldShortDescriptionToData(desc, fieldName, typeField, entity, DT, IT);
double time=StrToDouble(ExtractFromDescription(desc, "time="));
int typeData=StrToInt(ExtractFromDescription(desc, "typeData="));
- //int nbPtGauss=StrToInt(ExtractFromDescription(desc, "nbPtGauss="));
- string entityName=ExtractFromDescription(desc, "entityName=");
- MEDCouplingFieldDouble* field=0;
+ std::string entityName=ExtractFromDescription(desc, "entityName=");
+ ParaMEDMEM::MEDCouplingFieldDouble* field=0;
if (typeData!=6)
{
- cout<<"WARNING : writeMedFile : typeData "<<typeData<<" not implemented for fields\n";
+ std::cout << "WARNING : writeMedFile : typeData " << typeData << " not implemented for fields\n";
continue;
}
if (entityName=="MED_CELL")
{
//there is a field of idomain to write
- field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ field=ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_CELLS,ParaMEDMEM::ONE_TIME);
}
if (entityName=="MED_NODE_ELEMENT")
{
//there is a field of idomain to write
- field=MEDCouplingFieldDouble::New(ON_GAUSS_NE,ONE_TIME);
+ field=ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_GAUSS_NE,ParaMEDMEM::ONE_TIME);
}
if (!field)
{
- cout<<"WARNING : writeMedFile : entityName "<<entityName<<" not implemented for fields\n";
+ std::cout << "WARNING : writeMedFile : entityName " << entityName << " not implemented for fields\n";
continue;
}
nbfFieldFound++;
field->setName(fieldName.c_str());
field->setMesh(mfm->getLevel0Mesh(false));
- DataArrayDouble* da=(*it).second;
+ ParaMEDMEM::DataArrayDouble *da=(*it).second;
//get information for components etc..
- vector<string> r1;
+ std::vector<std::string> r1;
r1=SelectTagsInVectorOfString(MyGlobals::_General_Informations,"fieldName="+fieldName);
r1=SelectTagsInVectorOfString(r1,"typeField="+IntToStr(typeField));
r1=SelectTagsInVectorOfString(r1,"DT="+IntToStr(DT));
r1=SelectTagsInVectorOfString(r1,"IT="+IntToStr(IT));
//not saved in file? field->setDescription(ExtractFromDescription(r1[0], "fieldDescription=").c_str());
int nbc=StrToInt(ExtractFromDescription(r1[0], "nbComponents="));
- //double time=StrToDouble(ExtractFromDescription(r1[0], "time="));
if (nbc==da->getNumberOfComponents())
{
for (int i=0; i<nbc; i++)
}
else
{
- cerr<<"Problem On field "<<fieldName<<" : number of components unexpected "<<da->getNumberOfComponents()<<endl;
+ std::cerr << "Problem On field " << fieldName << " : number of components unexpected " << da->getNumberOfComponents() << std::endl;
}
field->setArray(da);
try
{
MEDLoader::WriteField(distfilename.c_str(),field,false);
- //if entityName=="MED_NODE_ELEMENT"
- //AN INTERP_KERNEL::EXCEPTION HAS BEEN THROWN : Not implemented other profile fitting from already written mesh for fields than on NODES and on CELLS.**********
- //modification MEDLoader.cxx done
}
catch(INTERP_KERNEL::Exception& e)
{
//cout trying rewrite all data, only one field defined
- string tmp,newName=distfilename;
+ std::string tmp,newName=distfilename;
tmp+="_"+fieldName+"_"+IntToStr(nbfFieldFound)+".med";
newName.replace(newName.find(".med"),4,tmp);
- cout<<"WARNING : writeMedFile : new file name with only one field :"<<newName<<endl;
+ std::cout << "WARNING : writeMedFile : new file name with only one field :" << newName << std::endl;
MEDLoader::WriteField(newName.c_str(),field,true);
}
- //cout<<"proc "<<MyGlobals::_Rank<<" : write field "<<cle<<" done"<<endl;
}
mfm->decrRef();
}
{
public:
MeshCollectionDriver(MeshCollection*);
- virtual ~MeshCollectionDriver()
- {
- }
+ virtual ~MeshCollectionDriver() { }
virtual int read(const char*, ParaDomainSelector* sel=0) = 0;
int readSeq(const char*,const char*);
- virtual void write(const char*, ParaDomainSelector* sel=0) = 0;
-
+ virtual void write(const char*, ParaDomainSelector* sel=0) const = 0;
protected:
void readSubdomain(std::vector<int*>& cellglobal,
std::vector<int*>& faceglobal,
std::vector<int*>& nodeglobal, int idomain);
void readSubdomain(int idomain);
- void writeMedFile(int idomain, const std::string& distfilename);
-
+ void writeMedFile(int idomain, const std::string& distfilename) const;
+ protected:
MeshCollection* _collection;
};
}
#include "MEDCouplingUMesh.hxx"
#include "MEDLoader.hxx"
-#include <vector>
-#include <string>
#include <map>
#include <set>
-#include <iostream>
+#include <vector>
+#include <string>
#include <fstream>
+#include <iostream>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
-#include <sys/time.h>
-
using namespace MEDPARTITIONER;
-using namespace std;
MeshCollectionMedAsciiDriver::MeshCollectionMedAsciiDriver(MeshCollection* collection):MeshCollectionDriver(collection)
{
int MeshCollectionMedAsciiDriver::read(const char* filename, ParaDomainSelector* domainSelector)
{
//distributed meshes
- vector<int*> cellglobal;
- vector<int*> nodeglobal;
- vector<int*> faceglobal;
+ std::vector<int*> cellglobal;
+ std::vector<int*> nodeglobal;
+ std::vector<int*> faceglobal;
int nbdomain;
//reading ascii master file
try
{
- ifstream asciiinput(filename);
- if (!asciiinput) throw INTERP_KERNEL::Exception(LOCALIZED("Master ASCII File does not exist"));
+ std::ifstream asciiinput(filename);
+ if (!asciiinput)
+ throw INTERP_KERNEL::Exception("Master ASCII File does not exist");
char charbuffer[512];
asciiinput.getline(charbuffer,512);
//reading number of domains
nbdomain=atoi(charbuffer);
- //cout << "nb domain "<<nbdomain<<endl;
- // asciiinput>>nbdomain;
MyGlobals::_File_Names.resize(nbdomain);
MyGlobals::_Mesh_Names.resize(nbdomain);
(_collection->getMesh()).resize(nbdomain);
nodeglobal.resize(nbdomain);
faceglobal.resize(nbdomain);
- if (nbdomain == 0) throw INTERP_KERNEL::Exception(LOCALIZED("Empty ASCII master file"));
+ if (nbdomain == 0)
+ throw INTERP_KERNEL::Exception("Empty ASCII master file");
for (int i=0; i<nbdomain;i++)
{
//reading information about the domain
- string mesh;
+ std::string mesh,host;
int idomain;
- string host;
cellglobal[i]=0;
faceglobal[i]=0;
nodeglobal[i]=0;
if (idomain!=i+1)
{
- throw INTERP_KERNEL::Exception(LOCALIZED("domain must be written from 1 to N in ASCII file descriptor"));
+ throw INTERP_KERNEL::Exception("domain must be written from 1 to N in ASCII file descriptor");
}
if ( !domainSelector || domainSelector->isMyDomain(i))
readSubdomain(cellglobal,faceglobal,nodeglobal, i);
} //of try
catch(...)
{
- throw INTERP_KERNEL::Exception(LOCALIZED("I/O error reading parallel MED file"));
+ throw INTERP_KERNEL::Exception("I/O error reading parallel MED file");
}
//creation of topology from mesh and connect zones
- ParallelTopology* aPT = new ParallelTopology
- ((_collection->getMesh()), (_collection->getCZ()), cellglobal, nodeglobal, faceglobal);
+ ParallelTopology* aPT = new ParallelTopology((_collection->getMesh()), (_collection->getCZ()), cellglobal, nodeglobal, faceglobal);
_collection->setTopology(aPT);
for (int i=0; i<nbdomain; i++)
{
- if (cellglobal[i]!=0) delete[] cellglobal[i];
- if (nodeglobal[i]!=0) delete[] nodeglobal[i];
- if (faceglobal[i]!=0) delete[] faceglobal[i];
+ delete [] cellglobal[i];
+ delete [] nodeglobal[i];
+ delete [] faceglobal[i];
}
return 0;
}
* with the connect zones being written as joints
* \param filename name of the ascii file containing the meshes description
*/
-void MeshCollectionMedAsciiDriver::write(const char* filename, ParaDomainSelector* domainSelector)
+void MeshCollectionMedAsciiDriver::write(const char* filename, ParaDomainSelector* domainSelector) const
{
int nbdomains=_collection->getMesh().size();
- vector<string> filenames;
+ std::vector<std::string> filenames;
filenames.resize(nbdomains);
//loop on the domains
for (int idomain=0; idomain<nbdomains; idomain++)
{
- string distfilename;
- ostringstream suffix;
- suffix<<filename<<idomain+1<<".med";
+ std::string distfilename;
+ std::ostringstream suffix;
+ suffix << filename << idomain+1 << ".med";
distfilename=suffix.str();
filenames[idomain]=distfilename;
//write master file
if ( !domainSelector || domainSelector->rank() == 0 )
{
- ofstream file(filename);
- file << "#MED Fichier V 2.3"<<" "<<endl;
- file << "#"<<" "<<endl;
- file << _collection->getMesh().size()<<" "<<endl;
+ std::ofstream file(filename);
+ file << "#MED Fichier V 2.3"<<" " << std::endl;
+ file << "#" << " " << std::endl;
+ file << _collection->getMesh().size() << " " << std::endl;
for (int idomain=0; idomain<nbdomains; idomain++)
file << _collection->getName() <<" "<< idomain+1 << " "
<< (_collection->getMesh())[idomain]->getName() << " localhost "
- << filenames[idomain] << " "<<endl;
+ << filenames[idomain] << " "<< std::endl;
}
}
{
public:
MeshCollectionMedAsciiDriver(MeshCollection*);
- virtual ~MeshCollectionMedAsciiDriver()
- {
- }
+ virtual ~MeshCollectionMedAsciiDriver() { }
int read(const char*, ParaDomainSelector* sel=0);
- void write(const char*, ParaDomainSelector* sel=0);
+ void write(const char*, ParaDomainSelector* sel=0) const;
private :
std::string _master_filename;
};
#include "MEDLoader.hxx"
#include "MEDFileMesh.hxx"
-#include <vector>
-#include <string>
#include <map>
#include <set>
+#include <vector>
+#include <string>
#include <cstring>
-#include <iostream>
#include <fstream>
#include <sstream>
+#include <iostream>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
-#include <sys/time.h>
-
using namespace MEDPARTITIONER;
-using namespace std;
/*!\class MeshCollectionMedXmlDriver
*
xmlDocPtr master_doc=xmlParseFile(filename);
if (!master_doc)
- throw INTERP_KERNEL::Exception(LOCALIZED("Xml Master File does not exist or is not compliant with Xml scheme"));
+ throw INTERP_KERNEL::Exception("Xml Master File does not exist or is not compliant with Xml scheme");
//number of domains
xmlXPathContextPtr xpathCtx = xmlXPathNewContext(master_doc);
xmlXPathObjectPtr xpathObj = xmlXPathEvalExpression(BAD_CAST "//splitting/subdomain", xpathCtx);
if (xpathObj==0 || xpathObj->nodesetval->nodeNr ==0)
- throw INTERP_KERNEL::Exception(LOCALIZED("Xml Master File does not contain /MED/splitting/subdomain node"));
+ throw INTERP_KERNEL::Exception("Xml Master File does not contain /MED/splitting/subdomain node");
//as subdomain has only one property which is "number"
//it suffices to take the content of its first child
xmlXPathFreeObject(xpathObj);
xpathObj = xmlXPathEvalExpression(BAD_CAST "//content/mesh", xpathCtx);
if (xpathObj==0 || xpathObj->nodesetval->nodeNr ==0)
- throw INTERP_KERNEL::Exception(LOCALIZED("Xml Master File does not contain /MED/content/mesh node"));
+ throw INTERP_KERNEL::Exception("Xml Master File does not contain /MED/content/mesh node");
_collection->setName( (const char*)xpathObj->nodesetval->nodeTab[0]->properties->children->content);
//cout << "nb domain " << nbdomain << endl;
xmlXPathFreeObject(xpathObj);
xpathObj = xmlXPathEvalExpression(BAD_CAST filechar, xpathCtx);
if (xpathObj==0 || xpathObj->nodesetval->nodeNr ==0)
- throw INTERP_KERNEL::Exception(LOCALIZED("Xml Master File does not contain /MED/files/subfile nodes"));
+ throw INTERP_KERNEL::Exception("Xml Master File does not contain /MED/files/subfile nodes");
int nbfiles = xpathObj->nodesetval ->nodeNr;
for (int i=0; i<nbfiles;i++)
{
//reading information about the domain
- string host;
+ std::string host;
//reading file names
std::ostringstream name_search_string;
name_search_string<<"//files/subfile[@id=\""<<i+1<<"\"]/name";
xmlXPathObjectPtr xpathObjfilename =
xmlXPathEvalExpression(BAD_CAST name_search_string.str().c_str(),xpathCtx);
if (xpathObjfilename->nodesetval ==0)
- throw INTERP_KERNEL::Exception(LOCALIZED("Error retrieving a file name from subfile of Xml Master File"));
+ throw INTERP_KERNEL::Exception("Error retrieving a file name from subfile of Xml Master File");
MyGlobals::_File_Names[i]=(const char*)xpathObjfilename->nodesetval->nodeTab[0]->children->content;
//reading the local mesh names
- ostringstream mesh_search_string;
+ std::ostringstream mesh_search_string;
mesh_search_string<<"//mapping/mesh/chunk[@subdomain=\""<<i+1<<"\"]/name";
xmlXPathObjectPtr xpathMeshObj = xmlXPathEvalExpression(BAD_CAST mesh_search_string.str().c_str(),xpathCtx);
if (xpathMeshObj->nodesetval ==0)
- throw INTERP_KERNEL::Exception(LOCALIZED("Error retrieving mesh name from chunk of Xml Master File"));
+ throw INTERP_KERNEL::Exception("Error retrieving mesh name from chunk of Xml Master File");
MyGlobals::_Mesh_Names[i]=(const char*)xpathMeshObj->nodesetval->nodeTab[0]->children->content;
if ( !domainSelector || domainSelector->isMyDomain(i))
} //of try
catch(...)
{
- throw INTERP_KERNEL::Exception(LOCALIZED("I/O error reading parallel MED file"));
+ throw INTERP_KERNEL::Exception("I/O error reading parallel MED file");
}
* with the connect zones being written as joints
* \param filename name of the Xml file containing the meshes description
*/
-void MeshCollectionMedXmlDriver::write(const char* filename, ParaDomainSelector* domainSelector)
+void MeshCollectionMedXmlDriver::write(const char* filename, ParaDomainSelector* domainSelector) const
{
xmlDocPtr master_doc = 0;
xmlNodePtr root_node = 0, node, node2;
int nbdomains= _collection->getMesh().size();
//loop on the domains
- string finalMeshName=ExtractFromDescription(MyGlobals::_General_Informations[0], "finalMeshName=");
+ std::string finalMeshName=ExtractFromDescription(MyGlobals::_General_Informations[0], "finalMeshName=");
for (int idomain=nbdomains-1; idomain>=0;idomain--)
{
- string distfilename;
- ostringstream suffix;
+ std::string distfilename;
+ std::ostringstream suffix;
suffix<<filename<<idomain+1<<".med";
distfilename=suffix.str();
if ( !domainSelector || domainSelector->isMyDomain( idomain ) )
{
- if ( (_collection->getMesh())[idomain]->getNumberOfCells()==0 ) continue; //empty domain
+ if ( (_collection->getMesh())[idomain]->getNumberOfCells()==0 )
+ continue; //empty domain
if (MyGlobals::_Verbose>1)
- cout<<"proc "<<domainSelector->rank()<<" : writeMedFile "<<distfilename
- << " "<<(_collection->getMesh())[idomain]->getNumberOfCells()<<" cells"
- << " "<<(_collection->getFaceMesh())[idomain]->getNumberOfCells()<<" faces"
- << " "<<(_collection->getMesh())[idomain]->getNumberOfNodes()<<" nodes"<<endl;
+ std::cout << "proc "<< domainSelector->rank() << " : writeMedFile " << distfilename
+ << " "<< (_collection->getMesh())[idomain]->getNumberOfCells() << " cells"
+ << " " << (_collection->getFaceMesh())[idomain]->getNumberOfCells() << " faces"
+ << " " << (_collection->getMesh())[idomain]->getNumberOfNodes()<<" nodes" << std::endl;
writeMedFile(idomain,distfilename);
}
//create the ascii description file
if (domainSelector->rank()==0)
{
- string myfile(filename);
+ std::string myfile(filename);
myfile.append(".xml");
- _master_filename=myfile;
if ( !domainSelector || domainSelector->rank() == 0 )
xmlSaveFormatFileEnc(myfile.c_str(), master_doc, "UTF-8", 1);
}
{
public:
MeshCollectionMedXmlDriver(MeshCollection*);
- virtual ~MeshCollectionMedXmlDriver()
- {
- }
+ virtual ~MeshCollectionMedXmlDriver() { }
int read(const char*, ParaDomainSelector* sel=0);
- void write(const char*, ParaDomainSelector* sel=0);
+ void write(const char*, ParaDomainSelector* sel=0) const;
private :
std::string _master_filename;
};
}
#endif
-using namespace ParaMEDMEM;
using namespace MEDPARTITIONER;
METISGraph::METISGraph():Graph()
catch(...)
{
//shit ParMETIS "Error! Key -2 not found!" not catched...
- throw INTERP_KERNEL::Exception(LOCALIZED("Problem in ParMETIS_PartKway"));
+ throw INTERP_KERNEL::Exception("Problem in ParMETIS_PartKway");
}
if (n<8 && nparts==3)
{
partition[i]=i%3;
}
#else
- throw INTERP_KERNEL::Exception(LOCALIZED("ParMETIS is not available. Check your products, please."));
+ throw INTERP_KERNEL::Exception("ParMETIS is not available. Check your products, please.");
#endif
}
else
METIS_PartGraphKway(&n, xadj, adjncy, vwgt, adjwgt, &wgtflag,
&base, &nparts, options, &edgecut, partition);
#else
- throw INTERP_KERNEL::Exception(LOCALIZED("METIS is not available. Check your products, please."));
+ throw INTERP_KERNEL::Exception("METIS is not available. Check your products, please.");
#endif
}
}
#include <mpi.h>
#endif
-#ifndef WIN32
-#include <sys/sysinfo.h>
-#endif
-
-using namespace std;
-using namespace MEDPARTITIONER;
-
/*!
* \brief Constructor. Find out my rank and world size
*/
-ParaDomainSelector::ParaDomainSelector(bool mesure_memory)
+MEDPARTITIONER::ParaDomainSelector::ParaDomainSelector(bool mesure_memory)
:_rank(0),_world_size(1), _nb_result_domains(-1), _mesure_memory(mesure_memory),
_init_time(0.0), _init_memory(0), _max_memory(0)
{
evaluateMemory();
}
-ParaDomainSelector::~ParaDomainSelector()
+MEDPARTITIONER::ParaDomainSelector::~ParaDomainSelector()
{
}
/*!
* \brief Return true if is running on different hosts
*/
-bool ParaDomainSelector::isOnDifferentHosts() const
+bool MEDPARTITIONER::ParaDomainSelector::isOnDifferentHosts() const
{
evaluateMemory();
if ( _world_size < 2 ) return false;
(void*)&name_there[0], MPI_MAX_PROCESSOR_NAME, MPI_CHAR, prev_proc, tag,
MPI_COMM_WORLD, &status);
- //cout<<"proc "<<rank()<<" : names "<<name_here<<" "<<name_there<<endl;
//bug: (isOnDifferentHosts here and there) is not (isOnDifferentHosts somewhere)
//return string(name_here) != string(name_there);
int sum_same = -1;
int same = 1;
- if (string(name_here) != string(name_there)) same=0;
+ if (std::string(name_here) != std::string(name_there))
+ same=0;
MPI_Allreduce( &same, &sum_same, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
- //cout<<"proc "<<rank()<<" : sum_same "<<sum_same<<endl;
-
return (sum_same != nbProcs());
#endif
}
* \param domainIndex - index of mesh domain
* \retval bool - to load or not
*/
-bool ParaDomainSelector::isMyDomain(int domainIndex) const
+bool MEDPARTITIONER::ParaDomainSelector::isMyDomain(int domainIndex) const
{
evaluateMemory();
return (_rank == getProcessorID( domainIndex ));
* \param domainIndex - index of mesh domain
* \retval int - processor id
*/
-int ParaDomainSelector::getProcessorID(int domainIndex) const
+int MEDPARTITIONER::ParaDomainSelector::getProcessorID(int domainIndex) const
{
evaluateMemory();
return ( domainIndex % _world_size );
* 1) for MED_CELL to know global id shift for domains at graph construction;
* 2) for sub-entity to know total nb of sub-entities before creating those of joints
*/
-void ParaDomainSelector::gatherNbOf(const vector<ParaMEDMEM::MEDCouplingUMesh*>& domain_meshes)
+void MEDPARTITIONER::ParaDomainSelector::gatherNbOf(const std::vector<ParaMEDMEM::MEDCouplingUMesh*>& domain_meshes)
{
evaluateMemory();
// get nb of elems of each domain mesh
int nb_domains=domain_meshes.size();
- //cout<<"proc "<<MyGlobals::_Rank<<" : gatherNbOf "<<nb_domains<<endl;
- vector<int> nb_elems(nb_domains*2, 0); //NumberOfCells & NumberOfNodes
+ std::vector<int> nb_elems(nb_domains*2, 0); //NumberOfCells & NumberOfNodes
for (int i=0; i<nb_domains; ++i)
if ( domain_meshes[i] )
{
nb_elems[i*2+1] = domain_meshes[i]->getNumberOfNodes();
}
// receive nb of elems from other procs
- vector<int> all_nb_elems( nb_domains*2 );
+ std::vector<int> all_nb_elems( nb_domains*2 );
#ifdef HAVE_MPI2
MPI_Allreduce((void*)&nb_elems[0], (void*)&all_nb_elems[0], nb_domains*2,
MPI_INT, MPI_SUM, MPI_COMM_WORLD);
}
if (MyGlobals::_Is0verbose>10)
- cout<<"totalNbCells "<<total_nb_cells<<" totalNbNodes "<<total_nb_nodes<<endl;
+ std::cout << "totalNbCells " << total_nb_cells << " totalNbNodes " << total_nb_nodes << std::endl;
- vector<int>& cell_shift_by_domain=_cell_shift_by_domain;
- vector<int>& node_shift_by_domain=_node_shift_by_domain;
- vector<int>& face_shift_by_domain=_face_shift_by_domain;
+ std::vector<int>& cell_shift_by_domain=_cell_shift_by_domain;
+ std::vector<int>& node_shift_by_domain=_node_shift_by_domain;
+ std::vector<int>& face_shift_by_domain=_face_shift_by_domain;
- vector< int > ordered_nbs_cell, ordered_nbs_node, domain_order(nb_domains);
+ std::vector< int > ordered_nbs_cell, ordered_nbs_node, domain_order(nb_domains);
ordered_nbs_cell.push_back(0);
ordered_nbs_node.push_back(0);
for (int iproc=0; iproc<nbProcs(); ++iproc)
if (MyGlobals::_Is0verbose>300)
{
- cout<<"proc "<<MyGlobals::_Rank<<" : cellShiftByDomain ";
- for (int i=0; i<=nb_domains; ++i) cout<<cell_shift_by_domain[i]<<"|";
- cout<<endl;
- cout<<"proc "<<MyGlobals::_Rank<<" : nodeShiftBy_domain ";
- for (int i=0; i<=nb_domains; ++i) cout<<node_shift_by_domain[i]<<"|";
- cout<<endl;
+ std::cout << "proc " << MyGlobals::_Rank << " : cellShiftByDomain ";
+ for (int i=0; i<=nb_domains; ++i)
+ std::cout << cell_shift_by_domain[i] << "|";
+ std::cout << std::endl;
+ std::cout << "proc " << MyGlobals::_Rank << " : nodeShiftBy_domain ";
+ for (int i=0; i<=nb_domains; ++i)
+ std::cout << node_shift_by_domain[i] << "|";
+ std::cout << std::endl;
}
// fill _nb_vert_of_procs (is Vtxdist)
_nb_vert_of_procs.resize(_world_size+1);
if (MyGlobals::_Is0verbose>200)
{
- cout<<"proc "<<MyGlobals::_Rank<<" : gatherNbOf : vtxdist is ";
- for (int i = 0; i <= _world_size; ++i) cout<<_nb_vert_of_procs[i]<<" ";
- cout<<endl;
+ std::cout << "proc " << MyGlobals::_Rank << " : gatherNbOf : vtxdist is ";
+ for (int i = 0; i <= _world_size; ++i)
+ std::cout << _nb_vert_of_procs[i] << " ";
+ std::cout << std::endl;
}
evaluateMemory();
* The result array is to be used as the first arg of ParMETIS_V3_PartKway() and
* is freed by ParaDomainSelector.
*/
-int* ParaDomainSelector::getProcVtxdist() const
+int *MEDPARTITIONER::ParaDomainSelector::getProcVtxdist() const
{
evaluateMemory();
- if (_nb_vert_of_procs.empty()) throw INTERP_KERNEL::Exception(LOCALIZED("_nb_vert_of_procs not set"));
+ if (_nb_vert_of_procs.empty())
+ throw INTERP_KERNEL::Exception("_nb_vert_of_procs not set");
return (int*) & _nb_vert_of_procs[0];
}
* gatherNbOf() must be called before.
* Result added to local id on given domain gives id in the whole distributed mesh
*/
-int ParaDomainSelector::getDomainCellShift(int domainIndex) const
+int MEDPARTITIONER::ParaDomainSelector::getDomainCellShift(int domainIndex) const
{
evaluateMemory();
- if (_cell_shift_by_domain.empty()) throw INTERP_KERNEL::Exception(LOCALIZED("_cell_shift_by_domain not set"));
+ if (_cell_shift_by_domain.empty())
+ throw INTERP_KERNEL::Exception("_cell_shift_by_domain not set");
return _cell_shift_by_domain[domainIndex];
}
-int ParaDomainSelector::getDomainNodeShift(int domainIndex) const
+int MEDPARTITIONER::ParaDomainSelector::getDomainNodeShift(int domainIndex) const
{
evaluateMemory();
- if (_node_shift_by_domain.empty()) throw INTERP_KERNEL::Exception(LOCALIZED("_node_shift_by_domain not set"));
+ if (_node_shift_by_domain.empty())
+ throw INTERP_KERNEL::Exception("_node_shift_by_domain not set");
return _node_shift_by_domain[domainIndex];
}
* gatherNbOf() must be called before.
* Result added to global id on this processor gives id in the whole distributed mesh
*/
-int ParaDomainSelector::getProcNodeShift() const
+int MEDPARTITIONER::ParaDomainSelector::getProcNodeShift() const
{
evaluateMemory();
- if (_nb_vert_of_procs.empty()) throw INTERP_KERNEL::Exception(LOCALIZED("_nb_vert_of_procs not set"));
- //cout<<"_nb_vert_of_procs "<<_nb_vert_of_procs[0]<<" "<<_nb_vert_of_procs[1]<<endl;
+ if (_nb_vert_of_procs.empty())
+ throw INTERP_KERNEL::Exception("_nb_vert_of_procs not set");
return _nb_vert_of_procs[_rank];
}
/*!
* \brief Gather graphs from all processors into one
*/
-auto_ptr<Graph> ParaDomainSelector::gatherGraph(const Graph* graph) const
+std::auto_ptr<MEDPARTITIONER::Graph> MEDPARTITIONER::ParaDomainSelector::gatherGraph(const Graph* graph) const
{
Graph* glob_graph = 0;
// Gather indices
// ---------------
- vector<int> index_size_of_proc( nbProcs() ); // index sizes - 1
+ std::vector<int> index_size_of_proc( nbProcs() ); // index sizes - 1
for ( int i = 1; i < _nb_vert_of_procs.size(); ++i )
index_size_of_proc[i-1] = _nb_vert_of_procs[ i ] - _nb_vert_of_procs[ i-1 ];
int index_size = 1 + _cell_shift_by_domain.back();
- int* graph_index = new int[ index_size ];
- const int* index = graph->getGraph()->getIndex();
- int* proc_index_displacement = (int*) & _nb_vert_of_procs[0];
+ int *graph_index = new int[ index_size ];
+ const int *index = graph->getGraph()->getIndex();
+ int *proc_index_displacement = (int*) & _nb_vert_of_procs[0];
MPI_Allgatherv((void*) (index+1), // send local index except first 0 (or 1)
index_size_of_proc[_rank], // index size on this proc
graph_index[0] = index[0]; // it is not overwritten thanks to proc_index_displacement[0]==1
// get sizes of graph values on each proc by the got indices of graphs
- vector< int > value_size_of_proc( nbProcs() ), proc_value_displacement(1,0);
+ std::vector< int > value_size_of_proc( nbProcs() ), proc_value_displacement(1,0);
for ( int i = 0; i < nbProcs(); ++i )
{
if ( index_size_of_proc[i] > 0 )
// --------------
int value_size = graph_index[ index_size-1 ] - graph_index[ 0 ];
- int* graph_value = new int[ value_size ];
- const int* value = graph->getGraph()->getValue();
+ int *graph_value = new int[ value_size ];
+ const int *value = graph->getGraph()->getValue();
MPI_Allgatherv((void*) value, // send local value
value_size_of_proc[_rank], // value size on this proc
#endif // HAVE_MPI2
- return auto_ptr<Graph>( glob_graph );
+ return std::auto_ptr<Graph>( glob_graph );
}
/*!
* \brief Set nb of cell/cell pairs in a joint between domains
*/
-void ParaDomainSelector::setNbCellPairs( int nb_cell_pairs, int dist_domain, int loc_domain )
+void MEDPARTITIONER::ParaDomainSelector::setNbCellPairs( int nb_cell_pairs, int dist_domain, int loc_domain )
{
// This method is needed for further computing global numbers of faces in joint.
// Store if both domains are on this proc else on one of procs only
*/
//================================================================================
-int ParaDomainSelector::getNbCellPairs( int dist_domain, int loc_domain ) const
+int MEDPARTITIONER::ParaDomainSelector::getNbCellPairs( int dist_domain, int loc_domain ) const
{
evaluateMemory();
*/
//================================================================================
-void ParaDomainSelector::gatherNbCellPairs()
+void MEDPARTITIONER::ParaDomainSelector::gatherNbCellPairs()
{
if ( _nb_cell_pairs_by_joint.empty() )
_nb_cell_pairs_by_joint.resize( _nb_result_domains*(_nb_result_domains+1), 0);
evaluateMemory();
- vector< int > send_buf = _nb_cell_pairs_by_joint;
+ std::vector< int > send_buf = _nb_cell_pairs_by_joint;
#ifdef HAVE_MPI2
MPI_Allreduce((void*)&send_buf[0],
(void*)&_nb_cell_pairs_by_joint[0],
// namely that each joint is treated on one proc only
for ( int j = 0; j < _nb_cell_pairs_by_joint.size(); ++j )
if ( _nb_cell_pairs_by_joint[j] != send_buf[j] && send_buf[j]>0 )
- throw INTERP_KERNEL::Exception(LOCALIZED("invalid nb of cell pairs"));
+ throw INTERP_KERNEL::Exception("invalid nb of cell pairs");
}
//================================================================================
*/
//================================================================================
-int ParaDomainSelector::getFisrtGlobalIdOfSubentity( int loc_domain, int dist_domain ) const
+int MEDPARTITIONER::ParaDomainSelector::getFisrtGlobalIdOfSubentity( int loc_domain, int dist_domain ) const
{
// total_nb_faces includes faces existing before creation of joint faces
// (got in gatherNbOf( MED_FACE )).
int id = total_nb_faces + 1;
if ( _nb_cell_pairs_by_joint.empty() )
- throw INTERP_KERNEL::Exception(LOCALIZED("gatherNbCellPairs() must be called before"));
+ throw INTERP_KERNEL::Exception("gatherNbCellPairs() must be called before");
int joint_id = jointId( loc_domain, dist_domain );
for ( int j = 0; j < joint_id; ++j )
id += _nb_cell_pairs_by_joint[ j ];
*/
//================================================================================
-int* ParaDomainSelector::exchangeSubentityIds( int loc_domain, int dist_domain,
- const vector<int>& loc_ids_here ) const
+int *MEDPARTITIONER::ParaDomainSelector::exchangeSubentityIds( int loc_domain, int dist_domain,
+ const std::vector<int>& loc_ids_here ) const
{
int* loc_ids_dist = new int[ loc_ids_here.size()];
int dest = getProcessorID( dist_domain );
*/
//================================================================================
-int ParaDomainSelector::jointId( int local_domain, int distant_domain ) const
+int MEDPARTITIONER::ParaDomainSelector::jointId( int local_domain, int distant_domain ) const
{
evaluateMemory();
if (_nb_result_domains < 0)
- throw INTERP_KERNEL::Exception(LOCALIZED("setNbDomains() must be called before"));
+ throw INTERP_KERNEL::Exception("setNbDomains() must be called before");
if ( local_domain < distant_domain )
- swap( local_domain, distant_domain );
+ std::swap( local_domain, distant_domain );
return local_domain * _nb_result_domains + distant_domain;
}
*/
//================================================================================
-double ParaDomainSelector::getPassedTime() const
+double MEDPARTITIONER::ParaDomainSelector::getPassedTime() const
{
#ifdef HAVE_MPI2
return MPI_Wtime() - _init_time;
#endif
}
-/*!
- * \brief Evaluate current memory usage and return the maximal one in KB
- */
-int ParaDomainSelector::evaluateMemory() const
-{
- if ( _mesure_memory )
- {
- int used_memory = 0;
-#ifndef WIN32
- struct sysinfo si;
- int err = sysinfo( &si );
- if ( !err )
- used_memory =
- (( si.totalram - si.freeram + si.totalswap - si.freeswap ) * si.mem_unit ) / 1024;
-#endif
- if ( used_memory > _max_memory )
- ((ParaDomainSelector*) this)->_max_memory = used_memory;
-
- if ( !_init_memory )
- ((ParaDomainSelector*) this)->_init_memory = used_memory;
- }
- return _max_memory - _init_memory;
-}
-
/*!
Sends content of \a mesh to processor \a target. To be used with \a recvMesh method.
\param mesh mesh to be sent
\param target processor id of the target
*/
-void ParaDomainSelector::sendMesh(const ParaMEDMEM::MEDCouplingUMesh& mesh, int target) const
+void MEDPARTITIONER::ParaDomainSelector::sendMesh(const ParaMEDMEM::MEDCouplingUMesh& mesh, int target) const
{
- if (MyGlobals::_Verbose>600) cout<<"proc "<<_rank<<" : sendMesh '"<<mesh.getName()<<"' size "<<mesh.getNumberOfCells()<<" to "<<target<<endl;
+ if (MyGlobals::_Verbose>600)
+ std::cout << "proc " << _rank << " : sendMesh '" << mesh.getName() << "' size " << mesh.getNumberOfCells() << " to " << target << std::endl;
// First stage : sending sizes
// ------------------------------
- vector<int> tinyInfoLocal;
- vector<string> tinyInfoLocalS;
- vector<double> tinyInfoLocalD;
+ std::vector<int> tinyInfoLocal;
+ std::vector<std::string> tinyInfoLocalS;
+ std::vector<double> tinyInfoLocalD;
//Getting tiny info of local mesh to allow the distant proc to initialize and allocate
//the transmitted mesh.
mesh.getTinySerializationInformation(tinyInfoLocalD,tinyInfoLocal,tinyInfoLocalS);
- //cout<<"sendMesh getTinySerializationInformation "<<mesh.getName()<<endl;
tinyInfoLocal.push_back(mesh.getNumberOfCells());
#ifdef HAVE_MPI2
int tinySize=tinyInfoLocal.size();
- //cout<<"MPI_Send cvw11 "<<tinySize<<endl;
MPI_Send(&tinySize, 1, MPI_INT, target, 1113, MPI_COMM_WORLD);
- //cout<<"MPI_Send cvw22 "<<tinyInfoLocal.size()<<endl;
MPI_Send(&tinyInfoLocal[0], tinyInfoLocal.size(), MPI_INT, target, 1112, MPI_COMM_WORLD);
#endif
mesh.serialize(v1Local,v2Local);
int nbLocalElems=0;
int* ptLocal=0;
- if(v1Local) //cvw if empty getNbOfElems() is 1!
+ if(v1Local) //if empty getNbOfElems() is 1!
{
- nbLocalElems=v1Local->getNbOfElems(); //cvw if empty be 1!
+ nbLocalElems=v1Local->getNbOfElems(); // if empty be 1!
ptLocal=v1Local->getPointer();
}
-#ifdef HAVE_MPI2
+#ifdef HAVE_MPI2
MPI_Send(ptLocal, nbLocalElems, MPI_INT, target, 1111, MPI_COMM_WORLD);
#endif
int nbLocalElems2=0;
double *ptLocal2=0;
- if(v2Local) //cvw if empty be 0!
+ if(v2Local) //if empty be 0!
{
nbLocalElems2=v2Local->getNbOfElems();
ptLocal2=v2Local->getPointer();
if(v1Local) v1Local->decrRef();
if(v2Local) v2Local->decrRef();
}
- else
- {
- //cout<<"sendMesh empty Mesh cvw3344 "<<endl;
- }
- //cout<<"end sendMesh "<<mesh.getName()<<endl;
}
/*! Receives messages from proc \a source to fill mesh \a mesh.
\param mesh pointer to mesh that is filled
\param source processor id of the incoming messages
*/
-void ParaDomainSelector::recvMesh(ParaMEDMEM::MEDCouplingUMesh*& mesh, int source)const
+void MEDPARTITIONER::ParaDomainSelector::recvMesh(ParaMEDMEM::MEDCouplingUMesh*& mesh, int source)const
{
// First stage : exchanging sizes
// ------------------------------
- vector<int> tinyInfoDistant;
- vector<string> tinyInfoLocalS;
- vector<double> tinyInfoDistantD(1);
+ std::vector<int> tinyInfoDistant;
+ std::vector<std::string> tinyInfoLocalS;
+ std::vector<double> tinyInfoDistantD(1);
//Getting tiny info of local mesh to allow the distant proc to initialize and allocate
//the transmitted mesh.
#ifdef HAVE_MPI2
#endif
//there was tinyInfoLocal.push_back(mesh.getNumberOfCells());
int NumberOfCells=tinyInfoDistant[tinyVecSize-1];
- //cout<<"recvMesh NumberOfCells "<<NumberOfCells<<endl;
if (NumberOfCells>0)
{
ParaMEDMEM::DataArrayInt *v1Distant=ParaMEDMEM::DataArrayInt::New();
{
mesh=CreateEmptyMEDCouplingUMesh();
}
- if (MyGlobals::_Verbose>600) cout<<"proc "<<_rank<<" : recvMesh '"<<mesh->getName()<<"' size "<<mesh->getNumberOfCells()<<" from "<<source<<endl;
+ if (MyGlobals::_Verbose>600)
+ std::cout << "proc " << _rank << " : recvMesh '" << mesh->getName() << "' size " << mesh->getNumberOfCells() << " from " << source << std::endl;
}
+#ifndef WIN32
+#include <sys/sysinfo.h>
+#endif
+
+/*!
+ * \brief Evaluate current memory usage and return the maximal one in KB
+ */
+int MEDPARTITIONER::ParaDomainSelector::evaluateMemory() const
+{
+ if ( _mesure_memory )
+ {
+ int used_memory = 0;
+#ifndef WIN32
+ struct sysinfo si;
+ int err = sysinfo( &si );
+ if ( !err )
+ used_memory = (( si.totalram - si.freeram + si.totalswap - si.freeswap ) * si.mem_unit ) / 1024;
+#endif
+ if ( used_memory > _max_memory )
+ ((ParaDomainSelector*) this)->_max_memory = used_memory;
+
+ if ( !_init_memory )
+ ((ParaDomainSelector*) this)->_init_memory = used_memory;
+ }
+ return _max_memory - _init_memory;
+}
class MEDCouplingUMesh;
}
-
namespace MEDPARTITIONER
{
class Graph;
*/
class MEDPARTITIONER_EXPORT ParaDomainSelector
{
-
public:
-
ParaDomainSelector(bool mesure_memory=false);
~ParaDomainSelector();
void sendMesh(const ParaMEDMEM::MEDCouplingUMesh& mesh, int target) const;
void recvMesh(ParaMEDMEM::MEDCouplingUMesh*& mesh, int source) const;
-
private:
- int _rank, _world_size; //my rank and nb of processors
+ int _rank; //my rank
+ int _world_size; //nb of processors
int _nb_result_domains; //required nb of domains
std::vector< int > _nb_cell_pairs_by_joint;
std::vector< int > _face_shift_by_domain;
double _init_time;
- bool _mesure_memory;
- int _init_memory, _max_memory;
+ bool _mesure_memory;
+ int _init_memory;
+ int _max_memory;
};
}
#endif
#endif
using namespace MEDPARTITIONER;
-using namespace std;
ParallelTopology::ParallelTopology():_nb_domain(0),_mesh_dimension(0)
{
}
//constructing topology according to mesh collection without global numerotation (use setGlobalNumerotation later)
-ParallelTopology::ParallelTopology(const vector<ParaMEDMEM::MEDCouplingUMesh*>& meshes)
+ParallelTopology::ParallelTopology(const std::vector<ParaMEDMEM::MEDCouplingUMesh*>& meshes)
{
_nb_domain=meshes.size();
_nb_cells.resize(_nb_domain);
_nb_nodes.resize(_nb_domain);
// _nb_faces.resize(_nb_domain);
- if (MyGlobals::_Is0verbose>100) cout<<"new ParallelTopology\n";
+ if (MyGlobals::_Is0verbose>100)
+ std::cout << "new ParallelTopology\n";
_loc_to_glob.resize(0); //precaution, need gatherNbOf() setGlobalNumerotation()
_node_loc_to_glob.resize(0); //precaution, need gatherNbOf() setGlobalNumerotation()
//_face_loc_to_glob.resize(_nb_domain);
for (int idomain=0; !parallel_mode && idomain<_nb_domain; idomain++)
parallel_mode = (!meshes[idomain]);
- if (MyGlobals::_Is0verbose>20 && !parallel_mode) cout<<"WARNING : ParallelTopology contructor without parallel_mode"<<endl;
+ if (MyGlobals::_Is0verbose>20 && !parallel_mode)
+ std::cout << "WARNING : ParallelTopology contructor without parallel_mode" << std::endl;
for (int idomain=0; idomain<_nb_domain; idomain++)
{
if ( !meshes[idomain] ) continue;
else
{
if (_mesh_dimension!=meshes[idomain]->getMeshDimension())
- throw INTERP_KERNEL::Exception(LOCALIZED("meshes dimensions incompatible"));
+ throw INTERP_KERNEL::Exception("meshes dimensions incompatible");
}
_nb_cells[idomain]=meshes[idomain]->getNumberOfCells();
_nb_nodes[idomain]=meshes[idomain]->getNumberOfNodes();
//constructing _loc_to_glob etc by default, needs gatherNbOf() done
void ParallelTopology::setGlobalNumerotationDefault(ParaDomainSelector* domainSelector)
{
- if (MyGlobals::_Is0verbose>100) cout<<"setGlobalNumerotationDefault on "<<_nb_domain<<" domains\n";
- if (_loc_to_glob.size()!=0) throw INTERP_KERNEL::Exception(LOCALIZED("a global numerotation is done yet"));
+ if (MyGlobals::_Is0verbose>100)
+ std::cout<< "setGlobalNumerotationDefault on " << _nb_domain << " domains\n";
+ if (_loc_to_glob.size()!=0) throw INTERP_KERNEL::Exception("a global numerotation is done yet");
_loc_to_glob.resize(_nb_domain);
_node_loc_to_glob.resize(_nb_domain);
//warning because _nb_cells[idomain] is 0 if not my domain(s)
//we set loc_to_glob etc.. only for my domain(s)
- if (MyGlobals::_Is0verbose>500) cout<<"(c)idomain|ilocalCell|iglobalCell"<<endl;
+ if (MyGlobals::_Is0verbose>500)
+ std::cout << "(c)idomain|ilocalCell|iglobalCell" << std::endl;
for (int idomain=0; idomain<_nb_domain; idomain++)
{
_loc_to_glob[idomain].resize(_nb_cells[idomain]);
for (int i=0; i<_nb_cells[idomain]; i++)
{
int global=domainCellShift+i ;
- _glob_to_loc.insert(make_pair(global,make_pair(idomain,i)));
+ _glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i)));
_loc_to_glob[idomain][i]=global;
- if (MyGlobals::_Verbose>500) cout<<"c"<<idomain<<"|"<<i<<"|"<<global<<" ";
+ if (MyGlobals::_Verbose>500)
+ std::cout << "c" << idomain << "|" << i << "|" << global << " ";
}
}
if (MyGlobals::_Verbose>500) MPI_Barrier(MPI_COMM_WORLD);
- if (MyGlobals::_Is0verbose>500) cout<<endl;
+ if (MyGlobals::_Is0verbose>500) std::cout << std::endl;
- if (MyGlobals::_Is0verbose>500) cout<<"(n)idomain|ilocalNode|iglobalNode"<<endl;
+ if (MyGlobals::_Is0verbose>500) std::cout << "(n)idomain|ilocalNode|iglobalNode" << std::endl;
for (int idomain=0; idomain<_nb_domain; idomain++)
{
_node_loc_to_glob[idomain].resize(_nb_nodes[idomain]);
for (int i=0; i<_nb_nodes[idomain]; i++)
{
int global=domainNodeShift+i ;
- _node_glob_to_loc.insert(make_pair(global,make_pair(idomain,i)));
+ _node_glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i)));
_node_loc_to_glob[idomain][i]=global;
- if (MyGlobals::_Verbose>500) cout<<"n"<<idomain<<"|"<<i<<"|"<<global<<" ";
+ if (MyGlobals::_Verbose>500)
+ std::cout << "n" << idomain << "|" << i << "|" << global << " ";
}
}
if (MyGlobals::_Verbose>500) MPI_Barrier(MPI_COMM_WORLD);
- if (MyGlobals::_Is0verbose>500) cout<<endl;
+ if (MyGlobals::_Is0verbose>500) std::cout << std::endl;
_nb_total_cells=domainSelector->getNbTotalCells();
_nb_total_nodes=domainSelector->getNbTotalNodes();
_nb_total_faces=domainSelector->getNbTotalFaces();
- if (MyGlobals::_Is0verbose>200) cout<<"globalNumerotation default done meshDimension "<<_mesh_dimension<<" nbTotalCells "<<_nb_total_cells<<" nbTotalNodes "<<_nb_total_nodes<<endl;
+ if (MyGlobals::_Is0verbose>200)
+ std::cout << "globalNumerotation default done meshDimension " << _mesh_dimension << " nbTotalCells " << _nb_total_cells << " nbTotalNodes " << _nb_total_nodes << std::endl;
}
//constructing topology according to mesh collection
-ParallelTopology::ParallelTopology(const vector<ParaMEDMEM::MEDCouplingUMesh*>& meshes,
- const vector<MEDPARTITIONER::ConnectZone*>& cz,
- vector<int*>& cellglobal,
- vector<int*>& nodeglobal,
- vector<int*>& faceglobal)
+ParallelTopology::ParallelTopology(const std::vector<ParaMEDMEM::MEDCouplingUMesh*>& meshes,
+ const std::vector<MEDPARTITIONER::ConnectZone*>& cz,
+ std::vector<int*>& cellglobal,
+ std::vector<int*>& nodeglobal,
+ std::vector<int*>& faceglobal)
{
_nb_domain=meshes.size();
int index_global=0;
for (int i=0; i<_nb_cells[idomain]; i++)
{
int global=i ;//cellDomainShift+i;
- _glob_to_loc.insert(make_pair(global,make_pair(idomain,i)));
+ _glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i)));
_loc_to_glob[idomain][i]=global;
- //cvw cout<<idomain<<"|"<<i<<"|"<<global<<" ";
index_global++;
}
}
for (int i=0; i<_nb_cells[idomain]; i++)
{
int global=cellglobal[idomain][i];
- _glob_to_loc.insert(make_pair(global,make_pair(idomain,i)));
+ _glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i)));
//_loc_to_glob[make_pair(idomain,i+1)]=global;
_loc_to_glob[idomain][i]=global;
index_global++;
- // cout<<"glob:"<<global<<" --> ("<<idomain<<","<<i+1<<")"<<endl;
}
}
_node_loc_to_glob[idomain].resize(meshes[idomain]->getNumberOfNodes());
for (int i=0; i<meshes[idomain]->getNumberOfNodes(); i++)
{
- _node_glob_to_loc.insert(make_pair(i,make_pair(0,i)));
+ _node_glob_to_loc.insert(std::make_pair(i,std::make_pair(0,i)));
_node_loc_to_glob[0][i]=i;
}
_nb_total_nodes=meshes[idomain]->getNumberOfNodes();
//creating node maps
_nb_nodes[idomain]=meshes[idomain]->getNumberOfNodes();
- INTERP_KERNEL::HashMap <int,pair<int,int> > local2distant;
+ INTERP_KERNEL::HashMap <int,std::pair<int,int> > local2distant;
_node_loc_to_glob[idomain].resize(_nb_nodes[idomain]);
for (int icz=0; icz<cz.size(); icz++)
{
{
int local= node_corresp[i*2];
int distant = node_corresp[i*2+1];
- local2distant.insert(make_pair(local, make_pair(distant_ip,distant)));
+ local2distant.insert(std::make_pair(local, std::make_pair(distant_ip,distant)));
}
}
}
if (local2distant.find(inode)==local2distant.end())
{
index_node_global++;
- _node_glob_to_loc.insert(make_pair(index_node_global,make_pair(idomain,inode)));
+ _node_glob_to_loc.insert(std::make_pair(index_node_global,std::make_pair(idomain,inode)));
//_node_loc_to_glob[make_pair(idomain,inode+1)]=index_node_global;
_node_loc_to_glob[idomain][inode]=index_node_global;
}
int ip = (local2distant.find(inode)->second).first;
int distant = (local2distant.find(inode)->second).second;
int global_number=_loc_to_glob[ip][distant];
- _node_glob_to_loc.insert(make_pair(global_number,make_pair(idomain,inode)));
+ _node_glob_to_loc.insert(std::make_pair(global_number,std::make_pair(idomain,inode)));
_node_loc_to_glob[idomain][inode]=global_number;
}
}
for (int inode=0; inode<_nb_nodes[idomain]; inode++)
{
int global_number=nodeglobal[idomain][inode];
- _node_glob_to_loc.insert(make_pair(global_number,make_pair(idomain,inode)));
+ _node_glob_to_loc.insert(std::make_pair(global_number,std::make_pair(idomain,inode)));
_node_loc_to_glob[idomain][inode]=global_number;
}
}
_mesh_dimension=mesh_dimension;
if (MyGlobals::_Verbose>200)
- cout<<"proc "<<MyGlobals::_Rank<<" : new topology oldNbDomain "<<
- oldTopology->nbDomain()<<" newNbDomain "<<_nb_domain<<endl;
+ std::cout << "proc " << MyGlobals::_Rank << " : new topology oldNbDomain " <<
+ oldTopology->nbDomain() << " newNbDomain " << _nb_domain << std::endl;
_nb_cells.resize(_nb_domain,0);
_nb_nodes.resize(_nb_domain,0);
_nb_faces.resize(_nb_domain,0);
const int* 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)
- cout<<"proc "<<MyGlobals::_Rank<<" : topology from partition, nbTotalCells "<<_nb_total_cells<<endl;
+ std::cout << "proc " << MyGlobals::_Rank << " : topology from partition, nbTotalCells " << _nb_total_cells << std::endl;
int icellProc=0; //all cells of my domains are concatenated in part
for (int iold=0; iold<oldTopology->nbDomain(); iold++)
icellProc++;
int iGlobalCell=globalids[icell];
_loc_to_glob[idomain].push_back(iGlobalCell);
- _glob_to_loc.insert(make_pair(iGlobalCell, make_pair(idomain, _nb_cells[idomain])));
+ _glob_to_loc.insert(std::make_pair(iGlobalCell, std::make_pair(idomain, _nb_cells[idomain])));
}
}
if (MyGlobals::_Verbose>300)
for (int idomain=0; idomain<_nb_domain; idomain++)
- cout<<"proc "<<MyGlobals::_Rank<<" : nbCells in new domain "<<idomain<<" : "<<_nb_cells[idomain]<<endl;
+ std::cout << "proc " << MyGlobals::_Rank << " : nbCells in new domain " << idomain << " : " << _nb_cells[idomain] << std::endl;
}
ParallelTopology::~ParallelTopology()
void ParallelTopology::convertGlobalNodeList(const int* node_list, int nbnode, int* local, int* ip)
{
if (_node_glob_to_loc.empty())
- throw INTERP_KERNEL::Exception(LOCALIZED("Node mapping has not yet been built"));
+ throw INTERP_KERNEL::Exception("Node mapping has not yet been built");
for (int i=0; i< nbnode; i++)
{
- pair<int,int> local_node = _node_glob_to_loc.find(node_list[i])->second;
+ std::pair<int,int> local_node = _node_glob_to_loc.find(node_list[i])->second;
ip[i]=local_node.first;
local[i]=local_node.second;
}
void ParallelTopology::convertGlobalNodeList(const int* node_list, int nbnode, int* local, int ip)
{
if (_node_glob_to_loc.empty())
- throw INTERP_KERNEL::Exception(LOCALIZED("Node mapping has not yet been built"));
+ throw INTERP_KERNEL::Exception("Node mapping has not yet been built");
for (int i=0; i< nbnode; i++)
{
- typedef INTERP_KERNEL::HashMultiMap<int,pair<int,int> >::iterator mmiter;
- pair<mmiter,mmiter> range=_node_glob_to_loc.equal_range(node_list[i]);
+ typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
+ std::pair<mmiter,mmiter> range=_node_glob_to_loc.equal_range(node_list[i]);
for (mmiter it=range.first; it !=range.second; it++)
{
int ipfound=(it->second).first;
void ParallelTopology::convertGlobalNodeListWithTwins(const int* node_list, int nbnode, int*& local, int*& ip,int*& full_array, int& size)
{
if (_node_glob_to_loc.empty())
- throw INTERP_KERNEL::Exception(LOCALIZED("Node mapping has not yet been built"));
+ throw INTERP_KERNEL::Exception("Node mapping has not yet been built");
size=0;
for (int i=0; i< nbnode; i++)
{
int count= _node_glob_to_loc.count(node_list[i]);
- // if (count > 1)
- // cout << "noeud " << node_list[i]<< " doublon d'ordre " << count<<endl;
size+=count;
}
int index=0;
full_array=new int[size];
for (int i=0; i< nbnode; i++)
{
- typedef INTERP_KERNEL::HashMultiMap<int,pair<int,int> >::iterator mmiter;
- pair<mmiter,mmiter> range=_node_glob_to_loc.equal_range(node_list[i]);
+ typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
+ std::pair<mmiter,mmiter> range=_node_glob_to_loc.equal_range(node_list[i]);
for (mmiter it=range.first; it !=range.second; it++)
{
ip[index]=(it->second).first;
full_array=new int[size];
for (int i=0; i< nbface; i++)
{
- typedef INTERP_KERNEL::HashMultiMap<int,pair<int,int> >::iterator mmiter;
- pair<mmiter,mmiter> range=_face_glob_to_loc.equal_range(face_list[i]);
+ typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
+ std::pair<mmiter,mmiter> range=_face_glob_to_loc.equal_range(face_list[i]);
for (mmiter it=range.first; it !=range.second; it++)
{
ip[index]=(it->second).first;
{
for (int i=0; i<nbcell; i++)
{
- //cvw INTERP_KERNEL::HashMap<int, pair<int,int> >::const_iterator iter = _glob_to_loc.find(cell_list[i]);
- INTERP_KERNEL::HashMap<int, pair<int,int> >::const_iterator iter = _glob_to_loc.find(cell_list[i]);
+ INTERP_KERNEL::HashMap<int, std::pair<int,int> >::const_iterator iter = _glob_to_loc.find(cell_list[i]);
if (iter == _glob_to_loc.end())
{
- cerr<<"proc "<<MyGlobals::_Rank<<" : KO cell_list["<<i<<"] : "<<cell_list[i]<<endl;
- throw INTERP_KERNEL::Exception(LOCALIZED("ParallelTopology::convertGlobalCellList : Cell not found"));
+ std::cerr << "proc " << MyGlobals::_Rank << " : KO cell_list[" << i << "] : " << cell_list[i] << std::endl;
+ throw INTERP_KERNEL::Exception("ParallelTopology::convertGlobalCellList : Cell not found");
}
else
{
ip[i]=(iter->second).first; //no domain
local[i]=(iter->second).second; //no local cell
- //cout<<"proc "<<MyGlobals::_Rank<<" : OK cell_list["<<i<<"] : "<<cell_list[i]<<" "<<ip[i]<<" "<<local[i]<<endl;
}
}
}
{
for (int i=0; i< nbface; i++)
{
- INTERP_KERNEL::HashMap<int, pair<int,int> >::const_iterator iter = _face_glob_to_loc.find(face_list[i]);
+ INTERP_KERNEL::HashMap<int, std::pair<int,int> >::const_iterator iter = _face_glob_to_loc.find(face_list[i]);
if (iter == _face_glob_to_loc.end())
{
- throw INTERP_KERNEL::Exception(LOCALIZED("ParallelTopology::convertGlobalFaceList : Face not found"));
+ throw INTERP_KERNEL::Exception("ParallelTopology::convertGlobalFaceList : Face not found");
}
ip[i]=(iter->second).first;
local[i]=(iter->second).second;
- // cout << " in convertGlobalFAceList face global "<<face_list[i]<<" -> ("<<ip[i]<<","<<local[i]<<")"<<endl;
}
}
{
for (int i=0; i< nbface; i++)
{
- typedef INTERP_KERNEL::HashMultiMap<int,pair<int,int> >::iterator mmiter;
- pair<mmiter,mmiter> range=_face_glob_to_loc.equal_range(face_list[i]);
+ typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
+ std::pair<mmiter,mmiter> range=_face_glob_to_loc.equal_range(face_list[i]);
for (mmiter it=range.first; it !=range.second; it++)
{
int ipfound=(it->second).first;
{
// cout <<" inode :"<<inode<< " global = "<<type_connectivity[type][inode];
int global = nodes[inode];
- typedef INTERP_KERNEL::HashMultiMap<int,pair<int,int> >::iterator mmiter;
- pair<mmiter,mmiter> range=_node_glob_to_loc.equal_range(global);
+ typedef INTERP_KERNEL::HashMultiMap<int,std::pair<int,int> >::iterator mmiter;
+ std::pair<mmiter,mmiter> range=_node_glob_to_loc.equal_range(global);
for (mmiter it=range.first; it !=range.second; it++)
{
if ((it->second).first==idomain)
return max;
}
+int ParallelTopology::getNodeNumber() const
+{
+ if (_node_glob_to_loc.empty()) return 0;
+ std::set <int> keys;
+ for (INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator iter= _node_glob_to_loc.begin(); iter!=_node_glob_to_loc.end(); iter++)
+ {
+ keys.insert(iter->first);
+ }
+ return keys.size();
+}
+
+/*!
+ * retrieving list of nodes in global numbers
+ */
+void ParallelTopology::getNodeList(int idomain, int *list) const
+{
+ for (int i=0; i<_nb_nodes[idomain]; i++)
+ list[i]=_node_loc_to_glob[idomain][i];
+}
+
+/*!
+ * retrieving list of nodes in global numbers
+ */
+void ParallelTopology::getCellList(int idomain, int *list) const
+{
+ for (int i=0; i<_nb_cells[idomain];i++)
+ list[i]=_loc_to_glob[idomain][i];
+}
+
+int ParallelTopology::getFaceNumber() const
+{
+ if (_face_glob_to_loc.empty())
+ return 0;
+ std::set <int> keys;
+ for (INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator iter= _face_glob_to_loc.begin(); iter!=_face_glob_to_loc.end(); iter++)
+ {
+ keys.insert(iter->first);
+ }
+ return keys.size();
+}
+
+/*!
+ * retrieving list of faces in global numbers
+ */
+void ParallelTopology::getFaceList(int idomain, int *list) const
+{
+ for (int i=0; i<_nb_faces[idomain];i++)
+ list[i]=_face_loc_to_glob[idomain][i];
+}
+
+int ParallelTopology::convertGlobalFace(int iglobal, int idomain)
+{
+ typedef INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator MMiter;
+ std::pair<MMiter,MMiter> eq = _face_glob_to_loc.equal_range(iglobal);
+ for (MMiter it=eq.first; it != eq.second; it++)
+ if (it->second.first == idomain)
+ return it->second.second;
+ return -1;
+}
+
+int ParallelTopology::convertGlobalNode(int iglobal, int idomain)
+{
+ typedef INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator MMiter;
+ std::pair<MMiter,MMiter> eq = _node_glob_to_loc.equal_range(iglobal);
+ for (MMiter it=eq.first; it != eq.second; it++)
+ {
+ if (it->second.first == idomain)
+ return it->second.second;
+ }
+ return -1;
+}
+
+/*!
+ * adding a face to the topology
+ */
+void ParallelTopology::appendFace(int idomain, int ilocal, int iglobal)
+{
+ _face_loc_to_glob[idomain].push_back(iglobal);
+ _face_glob_to_loc.insert(std::make_pair(iglobal,std::make_pair(idomain,ilocal)));
+}
#include <set>
#include <vector>
-namespace MEDPARTITIONER {
-
+namespace MEDPARTITIONER
+{
class Graph;
class MeshCollection;
class MEDPARTITIONER_FaceModel;
void setGlobalNumerotationDefault(ParaDomainSelector* domainSelector);
- //converts a list of global cell numbers
- //to a distributed array with local cell numbers
+ /*! converts a list of global cell numbers
+ * to a distributed array with local cell numbers
+ */
void convertGlobalNodeList(const int*, int,int*,int*);
void convertGlobalNodeList(const int*, int,int*,int);
void convertGlobalNodeListWithTwins(const int* face_list, int nbnode, int*& local, int*& ip, int*& full_array, int& size);
- //converts a list of global node numbers
- //to a distributed array with local cell numbers
+ /*! converts a list of global node numbers
+ * to a distributed array with local cell numbers
+ */
void convertGlobalCellList(const int*, int , int*, int *);
- //converts a list of global face numbers
- //to a distributed array with local face numbers
+ /*! converts a list of global face numbers
+ * to a distributed array with local face numbers
+ */
void convertGlobalFaceList(const int*, int , int*, int *);
void convertGlobalFaceList(const int*, int , int*, int);
void convertGlobalFaceListWithTwins(const int* face_list, int nbface, int*& local, int*& ip, int*& full_array,int& size);
- //converting node global numberings to local numberings
+ /*! converting node global numberings to local numberings */
void convertToLocal2ndVersion(int* nodes, int nbnodes, int idomain);
- //converting node local numbering to global
- inline int convertNodeToGlobal(int ip,int icell) const
- {
- //return _node_loc_to_glob.find(make_pair(ip,icell))->second;
- return _node_loc_to_glob[ip][icell];
- }
+ /*! converting node local numbering to global */
+ int convertNodeToGlobal(int ip, int icell) const { return _node_loc_to_glob[ip][icell]; }
- //converting face local numbering to global
- inline int convertFaceToGlobal(int ip,int iface) const
- {
- // if (_face_loc_to_glob.find(make_pair(ip,icell))==_face_loc_to_glob.end())
- // return -1;
- // else
- //return _face_loc_to_glob.find(make_pair(ip,icell))->second;
- return _face_loc_to_glob[ip][iface];
- }
+ /*! converting face local numbering to global */
+ int convertFaceToGlobal(int ip, int iface) const { return _face_loc_to_glob[ip][iface]; }
- //converting cell global numbering to local
- inline int convertCellToGlobal(int ip,int icell) const
- {
- // if (_loc_to_glob.find(make_pair(ip,icell))==_loc_to_glob.end())
- // return -1;
- // else
- //return _loc_to_glob.find(make_pair(ip,icell))->second;
- return _loc_to_glob[ip][icell];
- }
+ /*! converting cell global numbering to local */
+ int convertCellToGlobal(int ip, int icell) const { return _loc_to_glob[ip][icell]; }
- inline void convertNodeToGlobal(int ip, const int* local, int n, int* global)const
+ void convertNodeToGlobal(int ip, const int* local, int n, int *global) const
{
for (int i=0; i<n; i++)
global[i]=_node_loc_to_glob[ip][local[i]];
}
- inline void convertCellToGlobal(int ip, const int* local, int n, int* global)const
+ void convertCellToGlobal(int ip, const int* local, int n, int *global) const
{
for (int i=0; i<n; i++)
global[i]=_loc_to_glob[ip][local[i]];
}
- inline void convertFaceToGlobal(int ip, const int* local, int n, int* global)const
+ void convertFaceToGlobal(int ip, const int* local, int n, int *global) const
{
for (int i=0; i<n; i++)
global[i]=_face_loc_to_glob[ip][local[i]];
}
- inline int nbDomain() const
- {
- return _nb_domain;
- }
+ int nbDomain() const { return _nb_domain; }
- int nbCells() const
- {
- return _nb_total_cells;
- }
+ int nbCells() const { return _nb_total_cells; }
- int nbNodes() const
- {
- return _nb_total_nodes;
- }
+ int nbNodes() const { return _nb_total_nodes; }
- inline int nbCells( int idomain) const
- {
- return _nb_cells[idomain];
- }
+ int nbCells( int idomain) const { return _nb_cells[idomain]; }
- //retrieving number of nodes
- inline int getNodeNumber(int idomain) const
- {
- return _nb_nodes[idomain];
- }
+ /*! retrieving number of nodes */
+ int getNodeNumber(int idomain) const { return _nb_nodes[idomain]; }
- inline int getNodeNumber() const
- {
- if (_node_glob_to_loc.empty()) return 0;
- std::set <int> keys;
- for (INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator iter= _node_glob_to_loc.begin();
- iter!=_node_glob_to_loc.end();
- iter++) {
- keys.insert(iter->first);
- }
- return keys.size();
- }
+ int getNodeNumber() const;
- //retrieving list of nodes in global numbers
- inline void getNodeList(int idomain, int* list) const
- {
- for (int i=0; i<_nb_nodes[idomain]; i++)
- list[i]=_node_loc_to_glob[idomain][i];
- }
+ void getNodeList(int idomain, int* list) const;
- //retrieving cell numbers after merging in parallel mode
- std::vector<int> & getFusedCellNumbers(int idomain)
- {
- return _cell_loc_to_glob_fuse[idomain];
- }
+ /*! retrieving cell numbers after merging in parallel mode */
+ std::vector<int> & getFusedCellNumbers(int idomain) { return _cell_loc_to_glob_fuse[idomain]; }
- const std::vector<int> & getFusedCellNumbers(int idomain) const
- {
- return _cell_loc_to_glob_fuse[idomain];
- }
+ const std::vector<int>& getFusedCellNumbers(int idomain) const { return _cell_loc_to_glob_fuse[idomain]; }
- //retrieving face numbers after merging in parallel mode
- std::vector<int> & getFusedFaceNumbers(int idomain)
- {
- return _face_loc_to_glob_fuse[idomain];
- }
- const std::vector<int> & getFusedFaceNumbers(int idomain) const
- {
- return _face_loc_to_glob_fuse[idomain];
- }
+ /*! retrieving face numbers after merging in parallel mode */
+ std::vector<int> & getFusedFaceNumbers(int idomain) { return _face_loc_to_glob_fuse[idomain]; }
+ const std::vector<int>& getFusedFaceNumbers(int idomain) const { return _face_loc_to_glob_fuse[idomain]; }
- //retrieving number of nodes
- inline int getCellNumber(int idomain) const
- {
- return _nb_cells[idomain];
- }
+ /*! retrieving number of nodes */
+ int getCellNumber(int idomain) const { return _nb_cells[idomain]; }
- inline int getCellDomainNumber(int global) const
- {
- return (_glob_to_loc.find(global)->second).first;
- }
+ int getCellDomainNumber(int global) const { return (_glob_to_loc.find(global)->second).first; }
- //retrieving list of nodes in global numbers
- inline void getCellList(int idomain, int* list) const
- {
- for (int i=0; i<_nb_cells[idomain];i++)
- list[i]=_loc_to_glob[idomain][i];
- }
+ void getCellList(int idomain, int* list) const;
- inline int getFaceNumber(int idomain) const
- {
- return _nb_faces[idomain];
- }
-
- inline int getFaceNumber() const
- {
- if (_face_glob_to_loc.empty()) return 0;
- std::set <int> keys;
- for (INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator iter= _face_glob_to_loc.begin();
- iter!=_face_glob_to_loc.end();
- iter++) {
- keys.insert(iter->first);
- }
- return keys.size();
- }
+ int getFaceNumber(int idomain) const { return _nb_faces[idomain]; }
+ int getFaceNumber() const;
- //retrieving list of faces in global numbers
- inline void getFaceList(int idomain, int* list) const
- {
- for (int i=0; i<_nb_faces[idomain];i++)
- list[i]=_face_loc_to_glob[idomain][i];
- }
+ void getFaceList(int idomain, int* list) const;
- //converting a global cell number to a local representation (domain + local number)
- inline std::pair<int,int> convertGlobalCell(int iglobal) const
- {
- return _glob_to_loc.find(iglobal)->second;
- }
+ /*! converting a global cell number to a local representation (domain + local number) */
+ std::pair<int,int> convertGlobalCell(int iglobal) const { return _glob_to_loc.find(iglobal)->second; }
- inline int convertGlobalFace(int iglobal, int idomain)
- {
- typedef INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator MMiter;
- std::pair<MMiter,MMiter> eq = _face_glob_to_loc.equal_range(iglobal);
- for (MMiter it=eq.first; it != eq.second; it++)
- if (it->second.first == idomain) return it->second.second;
- return -1;
- }
+ int convertGlobalFace(int iglobal, int idomain);
- inline int convertGlobalNode(int iglobal, int idomain)
- {
- typedef INTERP_KERNEL::HashMultiMap<int, std::pair<int,int> >::const_iterator MMiter;
- std::pair<MMiter,MMiter> eq = _node_glob_to_loc.equal_range(iglobal);
- for (MMiter it=eq.first; it != eq.second; it++)
- {
- if (it->second.first == idomain) return it->second.second;
- }
- return -1;
- }
+ int convertGlobalNode(int iglobal, int idomain);
//adding a face to the topology
- inline void appendFace(int idomain, int ilocal, int iglobal)
- {
- _face_loc_to_glob[idomain].push_back(iglobal);
- _face_glob_to_loc.insert(std::make_pair(iglobal,std::make_pair(idomain,ilocal)));
- }
+ void appendFace(int idomain, int ilocal, int iglobal);
//return max global face number
int getMaxGlobalFace() const;
SCOTCH_graphBuild(&scotch_graph,
- 1, //premier indice 1
+ 1, //first indice 1
n, // nb of graph nodes
xadj,
0,
#include <string>
-namespace MEDPARTITIONER {
+namespace MEDPARTITIONER
+{
class SkyLineArray;
class MEDPARTITIONER_EXPORT SCOTCHGraph : public Graph
{
void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector* sel=0);
};
}
+
#endif
#include <vector>
-using namespace MEDPARTITIONER;
-
-SkyLineArray::SkyLineArray()
+MEDPARTITIONER::SkyLineArray::SkyLineArray()
{
}
-SkyLineArray::SkyLineArray(const SkyLineArray &myArray)
+MEDPARTITIONER::SkyLineArray::SkyLineArray(const SkyLineArray &myArray)
{
_index=myArray._index;
_value=myArray._value;
}
-SkyLineArray::~SkyLineArray()
+MEDPARTITIONER::SkyLineArray::~SkyLineArray()
{
}
-SkyLineArray::SkyLineArray(const std::vector<int>& index, const std::vector<int>& value)
+MEDPARTITIONER::SkyLineArray::SkyLineArray(const std::vector<int>& index, const std::vector<int>& value)
{
_value=value;
_index=index;
{
class MEDPARTITIONER_EXPORT SkyLineArray
{
- private :
+ private:
std::vector<int> _index;
std::vector<int> _value;
-
- public :
- SkyLineArray(); //if used SkyLineArray will keep empty
+ public:
+ /*! if used SkyLineArray will keep empty */
+ SkyLineArray();
SkyLineArray( const SkyLineArray &myArray );
SkyLineArray( const std::vector<int>& index, const std::vector<int>& value );
~SkyLineArray();
- inline int getNumberOf() const
- {
- return _index.size()-1;
- }
-
- inline int getLength() const
- {
- return _value.size() ;
- }
-
- inline const int* getIndex() const
- {
- return (const int*)(&_index[0]) ;
- }
-
- inline const int* getValue() const
- {
- return (const int*)(&_value[0]) ;
- }
+ int getNumberOf() const { return _index.size()-1; }
+ int getLength() const { return _value.size() ; }
+ const int* getIndex() const { return (const int*)(&_index[0]); }
+ const int* getValue() const { return (const int*)(&_value[0]); }
};
}
# endif
#ifndef __MEDPARTITIONER_TOPOLOGY_HXX__
#define __MEDPARTITIONER_TOPOLOGY_HXX__
-#include <vector>
#include <map>
+#include <vector>
-namespace MEDPARTITIONER
+namespace ParaMEDMEM
{
- class ConnectZone;
- class SkyLineArray;
-}
-namespace ParaMEDMEM {
class MEDCouplingUMesh;
}
-namespace MEDPARTITIONER {
+namespace MEDPARTITIONER
+{
class Graph;
+ class ConnectZone;
+ class SkyLineArray;
class MeshCollection;
class MEDPARTITIONER_FaceModel;
class Topology
{
public:
- Topology()
- {
- }
- Topology(std::vector<ParaMEDMEM::MEDCouplingUMesh*>, std::vector<MEDPARTITIONER::ConnectZone*>)
- {
- }
- virtual ~Topology()
- {
- }
+ Topology() { }
+ Topology(std::vector<ParaMEDMEM::MEDCouplingUMesh*>, std::vector<MEDPARTITIONER::ConnectZone*>) { }
+ virtual ~Topology() { }
- //converts a list of global cell numbers
- //to a distributed array with local cell numbers
- virtual void convertGlobalNodeList(const int* list, int nb, int* local, int*ip) = 0;
- virtual void convertGlobalNodeList(const int* list, int nb, int* local, int ip) = 0;
+ /*! converts a list of global cell numbers
+ * to a distributed array with local cell numbers
+ */
+ virtual void convertGlobalNodeList(const int *list, int nb, int *local, int*ip) = 0;
+ virtual void convertGlobalNodeList(const int *list, int nb, int *local, int ip) = 0;
//converts a list of global node numbers
- //to a distributed array with local cell numbers
- virtual void convertGlobalCellList(const int*list , int nb, int* local, int*ip) = 0;
+ /*! to a distributed array with local cell numbers */
+ virtual void convertGlobalCellList(const int*list , int nb, int *local, int*ip) = 0;
- //converts a list of global face numbers
- //to a distributed array with local face numbers
- virtual void convertGlobalFaceList(const int*list , int nb, int* local, int*ip) = 0;
+ /*! converts a list of global face numbers
+ * to a distributed array with local face numbers
+ */
+ virtual void convertGlobalFaceList(const int*list , int nb, int* local, int*ip) = 0;
virtual void convertGlobalFaceList(const int*list , int nb, int* local, int ip) = 0;
- virtual void convertGlobalFaceListWithTwins(const int* face_list, int nbface, int*& local, int*& ip, int*& full_array, int& size) = 0;
- virtual void convertGlobalNodeListWithTwins(const int* face_list, int nbnode, int*& local, int*& ip, int*& full_array, int& size) = 0;
- //number of doamins
+ virtual void convertGlobalFaceListWithTwins(const int *face_list, int nbface, int*& local, int*& ip, int*& full_array, int& size) = 0;
+ virtual void convertGlobalNodeListWithTwins(const int *face_list, int nbnode, int*& local, int*& ip, int*& full_array, int& size) = 0;
+ /*! number of doamins */
virtual int nbDomain() const = 0;
- //number of cells
+ /*! number of cells */
virtual int nbCells() const = 0;
- //number of nodes
+ /*! number of nodes */
virtual int nbNodes() const = 0;
- //number of cells on a specific domain
+ /*! number of cells on a specific domain */
virtual int nbCells(int idomain) const = 0;
- //converting node global numberings to local numberings
+ /*! converting node global numberings to local numberings */
virtual void convertToLocal2ndVersion(int*,int,int) = 0;
virtual int convertNodeToGlobal(int ip,int icell) const = 0;
virtual int convertFaceToGlobal(int ip,int icell) const = 0;
virtual int convertCellToGlobal(int ip,int icell) const = 0;
- virtual void convertNodeToGlobal(int ip,const int* local, int n, int* global) const = 0 ;
- virtual void convertCellToGlobal(int ip,const int* local, int n, int* global) const = 0 ;
- virtual void convertFaceToGlobal(int ip,const int* local, int n, int* global) const = 0 ;
- //retrieving number of nodes
+ virtual void convertNodeToGlobal(int ip,const int *local, int n, int *global) const = 0;
+ virtual void convertCellToGlobal(int ip,const int *local, int n, int *global) const = 0;
+ virtual void convertFaceToGlobal(int ip,const int *local, int n, int *global) const = 0;
+ /*! retrieving number of nodes */
virtual int getNodeNumber(int idomain) const = 0;
virtual int getNodeNumber() const = 0;
- //retrieving list of nodes
- virtual void getNodeList(int idomain, int* list) const = 0;
+ /*! retrieving list of nodes */
+ virtual void getNodeList(int idomain, int *list) const = 0;
virtual std::vector<int> & getFusedCellNumbers(int idomain) = 0;
virtual const std::vector<int> & getFusedCellNumbers(int idomain) const = 0;
virtual std::vector<int> & getFusedFaceNumbers(int idomain) = 0;
virtual const std::vector<int> & getFusedFaceNumbers(int idomain) const = 0;
- //retrieving number of nodes
+ /*! retrieving number of nodes */
virtual int getCellNumber(int idomain) const = 0;
- //retrieving list of nodes
- virtual void getCellList(int idomain, int* list) const = 0;
- //retrieving number of faces
+ /*! retrieving list of nodes */
+ virtual void getCellList(int idomain, int *list) const = 0;
+ /*! retrieving number of faces */
virtual int getFaceNumber(int idomain) const = 0;
- virtual int getFaceNumber()const = 0;
- //retrieving list of nodes
- virtual void getFaceList(int idomain, int* list) const = 0;
- //adding a face to the mapping
+ virtual int getFaceNumber() const = 0;
+ /*! retrieving list of nodes */
+ virtual void getFaceList(int idomain, int *list) const = 0;
+ /*! adding a face to the mapping */
virtual void appendFace(int idomain, int ilocal, int iglobal) = 0;
- //return max global face number
+ /*! returns max global face number */
virtual int getMaxGlobalFace() const = 0;
- //converting a global cell number to a local representation
+ /*! converting a global cell number to a local representation */
virtual std::pair<int,int> convertGlobalCell(int iglobal) const = 0;
- //converting a global face number to a local representation
+ /*! converting a global face number to a local representation */
virtual int convertGlobalFace(int iglobal, int idomain) = 0;
- //converting a global node number to a local representation
+ /*! converting a global node number to a local representation */
virtual int convertGlobalNode(int iglobal, int idomain) = 0;
};
}
+
#endif
* (domain numbers range from 0 to ndomain-1
* \param n number of cells in the mesh
*/
-UserGraph::UserGraph(MEDPARTITIONER::SkyLineArray* array, const int* partition, int n):Graph(array,0)
+UserGraph::UserGraph(MEDPARTITIONER::SkyLineArray *array, const int *partition, int n):Graph(array,0)
{
std::vector<int> index(n+1),value(n);
void UserGraph::partGraph(int ndomain, const std::string& options, ParaDomainSelector* sel)
{
- std::cerr<<"MEDPARTITIONER::UserGraph::partGraph() should not have to be used"<<std::endl;
+ std::cerr << "MEDPARTITIONER::UserGraph::partGraph() should not have to be used" << std::endl;
}
public:
UserGraph(MEDPARTITIONER::SkyLineArray*, const int*, int);
virtual ~UserGraph();
- void partGraph(int, const std::string& options=std::string(""), ParaDomainSelector* sel=0);
+ void partGraph(int, const std::string& options=std::string(""), ParaDomainSelector *sel=0);
};
}
#endif
#include <mpi.h>
#endif
-using namespace std;
-using namespace ParaMEDMEM;
using namespace MEDPARTITIONER;
int MEDPARTITIONER::MyGlobals::_Verbose=0;
int MEDPARTITIONER::MyGlobals::_Is0verbose=0;
-int MEDPARTITIONER::MyGlobals::_Rank=(-1);
-int MEDPARTITIONER::MyGlobals::_World_Size=(-1);
+int MEDPARTITIONER::MyGlobals::_Rank=-1;
+int MEDPARTITIONER::MyGlobals::_World_Size=-1;
int MEDPARTITIONER::MyGlobals::_Randomize=0;
int MEDPARTITIONER::MyGlobals::_Atomize=0;
int MEDPARTITIONER::MyGlobals::_Creates_Boundary_Faces=0;
-vector<string> MEDPARTITIONER::MyGlobals::_File_Names;
-vector<string> MEDPARTITIONER::MyGlobals::_Mesh_Names;
-vector<string> MEDPARTITIONER::MyGlobals::_Field_Descriptions;
-vector<string> MEDPARTITIONER::MyGlobals::_General_Informations;
+std::vector<std::string> MEDPARTITIONER::MyGlobals::_File_Names;
+std::vector<std::string> MEDPARTITIONER::MyGlobals::_Mesh_Names;
+std::vector<std::string> MEDPARTITIONER::MyGlobals::_Field_Descriptions;
+std::vector<std::string> MEDPARTITIONER::MyGlobals::_General_Informations;
std::string MEDPARTITIONER::Trim(const std::string& s,const std::string& drop)
{
- string r=s;
+ std::string r(s);
r.erase(r.find_last_not_of(drop)+1);
return r.erase(0,r.find_first_not_of(drop));
}
std::string MEDPARTITIONER::IntToStr(const int i)
{
- ostringstream oss;
- oss<<i;
+ std::ostringstream oss;
+ oss << i;
return oss.str();
}
std::string MEDPARTITIONER::DoubleToStr(const double i)
{
- ostringstream oss;
- oss<<i;
+ std::ostringstream oss;
+ oss << i;
return oss.str();
}
int MEDPARTITIONER::StrToInt(const std::string& s)
{
int res;
- istringstream iss(s);
- iss>>res;
+ std::istringstream iss(s);
+ iss >> res;
return res;
}
double MEDPARTITIONER::StrToDouble(const std::string& s)
{
double res;
- istringstream iss(s);
- iss>>res;
+ std::istringstream iss(s);
+ iss >> res;
return res;
}
-bool MEDPARTITIONER::TestArg(const char *arg, const char *argExpected, string& argValue)
+bool MEDPARTITIONER::TestArg(const char *arg, const char *argExpected, std::string& argValue)
{
argValue="";
int i;
for (i=0; i<strlen(arg); i++)
{
- if (arg[i]=='=') break;
- if (arg[i]!=argExpected[i]) return false;
+ if (arg[i]=='=')
+ break;
+ if (arg[i]!=argExpected[i])
+ return false;
}
- for (int j=i+1; j<strlen(arg); j++) argValue+=arg[j];
- //cout<<"found at "<<i<<" "<<argValue<<endl;
+ for (int j=i+1; j<strlen(arg); j++)
+ argValue+=arg[j];
return true;
}
std::vector<int> MEDPARTITIONER::CreateRandomSize(const int size)
{
- vector<int> res(size);
- for (int i=0; i<size; i++) res[i]=i;
+ std::vector<int> res(size);
+ for (int i=0; i<size; i++)
+ res[i]=i;
//cvw TODO or not? srand( (unsigned)time( NULL ) );
srand( MyGlobals::_Randomize );
for (int i=0; i<size; i++)
res[ii]=res[i];
res[i]=tmp;
}
- //cout<<"CreateRandomSize "<<size<<endl;
- if (size<50) { for (int i=0; i<size; i++) cout<<res[i]<<" "; cout<<endl; }
return res;
}
-void MEDPARTITIONER::RandomizeAdj(int* xadj, int* adjncy, std::vector<int>& ran, vector<int>& vx, vector<int>& va)
-//randomize a xadj and adjncy, renumbering vertices belong rand.
-//work only on one processor!!!!
+/*!
+ * randomize a xadj and adjncy, renumbering vertices belong rand. Works only on one processor!!!!
+ */
+void MEDPARTITIONER::RandomizeAdj(int* xadj, int* adjncy, std::vector<int>& ran, std::vector<int>& vx, std::vector<int>& va)
{
if (MyGlobals::_World_Size>1)
{
- cerr<<"MEDPARTITIONER::RandomizeAdj only works on one proc!"<<endl;
+ std::cerr << "MEDPARTITIONER::RandomizeAdj only works on one proc!" << std::endl;
return;
}
int size=ran.size();
- vector<int> invran(size);
- for (int i=0; i<size; i++) invran[ran[i]]=i;
+ std::vector<int> invran(size);
+ for (int i=0; i<size; i++)
+ invran[ran[i]]=i;
vx.resize(size+1);
int lga=xadj[size];
va.resize(lga);
int lgj=xadj[ir+1]-ii;
for (int j=0; j<lgj; j++)
{
- //va[jj]=adjncy[ii]; //for first debug only
va[jj]=invran[adjncy[ii]];
jj=jj+1;
ii=ii+1;
//int adjncy[13]={1,4,0,2,4,1,3,4,2,4,4,3,4};
int xadj[6]={0,2,5,9,12,13};
int adjncy[13]={0,0,1,1,1,2,2,2,2,3,3,3,4};
- cout<<"TestRandomize"<<endl;
- for (int i=0; i<6; i++) cout<<xadj[i]<<" "; cout<<endl;
- for (int i=0; i<13; i++) cout<<adjncy[i]<<" "; cout<<endl;
int size=5;
- vector<int> r=CreateRandomSize(size);
- vector<int> vx,va;
+ std::vector<int> r=CreateRandomSize(size);
+ std::vector<int> vx,va;
RandomizeAdj(&xadj[0],&adjncy[0],r,vx,va);
- for (int i=0; i<vx.size(); i++) cout<<vx[i]<<" "; cout<<endl;
- for (int i=0; i<va.size(); i++) cout<<va[i]<<" "; cout<<endl;
}
-std::string MEDPARTITIONER::ReprVectorOfString(const std::vector<string>& vec)
+std::string MEDPARTITIONER::ReprVectorOfString(const std::vector<std::string>& vec)
{
- if (vec.size()==0) return string(" NONE\n");
- ostringstream oss;
- for (vector<string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
- oss<<" -> '"<<*i<<"'"<<endl;
+ if (vec.size()==0)
+ return std::string(" NONE\n");
+ std::ostringstream oss;
+ for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
+ oss << " -> '" << *i << "'" << std::endl;
return oss.str();
}
std::string MEDPARTITIONER::ReprVectorOfString(const std::vector<std::string>& vec, const std::string separator)
{
- if (vec.size()==0) return string(" NONE\n");
- ostringstream oss;
- for (vector<string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
- oss<<separator<<*i;
+ if (vec.size()==0)
+ return std::string(" NONE\n");
+ std::ostringstream oss;
+ for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
+ oss << separator << *i;
return oss.str();
}
std::string MEDPARTITIONER::ReprMapOfStringInt(const std::map<std::string,int>& mymap)
{
- if (mymap.size()==0) return string(" NONE\n");
- ostringstream oss;
- for (map<string,int>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
- oss<<" -> ["<<(*i).first<<"]="<<(*i).second<<endl;
+ 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)
+ oss << " -> [" << (*i).first << "]=" << (*i).second << std::endl;
return oss.str();
}
std::string MEDPARTITIONER::ReprMapOfStringVectorOfString(const std::map< std::string,std::vector<std::string> >& mymap)
{
- if (mymap.size()==0) return string(" NONE\n");
- ostringstream oss;
- for (map< string,vector<string> >::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
- oss<<" -> ["<<(*i).first<<"]="<<endl<<ReprVectorOfString((*i).second)<<endl;
+ if (mymap.size()==0)
+ return std::string(" NONE\n");
+ std::ostringstream oss;
+ for (std::map< std::string,std::vector<std::string> >::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
+ oss << " -> [" << (*i).first << "]=" << std::endl << ReprVectorOfString((*i).second) << std::endl;
return oss.str();
}
std::string MEDPARTITIONER::ReprFieldDescriptions(const std::vector<std::string>& vec, const std::string separator)
{
- if (vec.size()==0) return string(" NONE\n");
- ostringstream oss;
- for (vector<string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
+ if (vec.size()==0)
+ return std::string(" NONE\n");
+ std::ostringstream oss;
+ for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
{
- oss<<" ->";
- oss<<ReprVectorOfString(DeserializeToVectorOfString(*i), separator)<<endl;
+ oss << " ->";
+ oss << ReprVectorOfString(DeserializeToVectorOfString(*i), separator) << std::endl;
}
return oss.str();
}
+/*!
+ * a string "hello" gives a string " 5/hello/"
+ * serialized_FromVectorOfString_string+SerializeFromString("toto") is
+ * equivalent to vector<string>.push_back("toto") on serialized_FromVectorOfString_string
+ */
std::string MEDPARTITIONER::SerializeFromString(const std::string& s)
-//a string "hello" gives a string " 5/hello/"
-//serialized_FromVectorOfString_string+SerializeFromString("toto") is
-//equivalent to vector<string>.push_back("toto") on serialized_FromVectorOfString_string
{
- ostringstream oss;
- oss<<setw(5)<<s.size()<<"/"<<s<<"/";
+ std::ostringstream oss;
+ oss << std::setw(5) << s.size() << "/" << s << "/";
return oss.str();
}
+/*!
+ * a vector of string gives a string
+ */
std::string MEDPARTITIONER::SerializeFromVectorOfString(const std::vector<std::string>& vec)
-//a vector of string gives a string
{
- ostringstream oss;
- for (vector<string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
- oss<<setw(5)<<(*i).size()<<"/"<<*i<<"/";
- //string res(oss.str());
+ std::ostringstream oss;
+ for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
+ oss<< std::setw(5) << (*i).size() << "/" << *i << "/";
return oss.str();
}
+/*!
+ * a string gives a vector of string
+ */
std::vector<std::string> MEDPARTITIONER::DeserializeToVectorOfString(const std::string& str)
-//a string gives a vector of string
{
- //vector<string> res=new vector<string>;
- vector<string> res;
- size_t pos=0;
- size_t posmax=str.size();
- if (posmax==0) return res; //empty vector
- size_t length;
+ std::vector<std::string> res;
+ std::size_t pos=0;
+ std::size_t posmax=str.size();
+ if (posmax==0)
+ return res; //empty vector
+ std::size_t length;
while (pos < posmax-6) //setw(5)+" "
{
- istringstream iss(str.substr(pos,5));
- iss>>length;
- //cout<<"length "<<length<<endl;
+ std::istringstream iss(str.substr(pos,5));
+ iss >> length;
if ((str[pos+5]!='/') || (str[pos+6+length]!='/'))
{
- cerr<<"Error on string '"<<str<<"'"<<endl;;
- throw INTERP_KERNEL::Exception(LOCALIZED("Error on string"));
+ std::cerr << "Error on string '" << str << "'" << std::endl;;
+ throw INTERP_KERNEL::Exception("Error on string");
}
res.push_back(str.substr(pos+6,length));
pos=pos+6+length+1;
std::string MEDPARTITIONER::EraseTagSerialized(const std::string& fromStr, const std::string& tag)
{
- vector<string> vec=DeserializeToVectorOfString(fromStr);
- vector<string> res;
+ std::vector<std::string> vec=DeserializeToVectorOfString(fromStr);
+ std::vector<std::string> res;
for (int i=0; i<vec.size(); i++)
{
- if (vec[i].find(tag)==string::npos) res.push_back(vec[i]);
+ if (vec[i].find(tag)==std::string::npos)
+ res.push_back(vec[i]);
}
return MEDPARTITIONER::SerializeFromVectorOfString(res);
}
+/*!
+ * 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)
-//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
{
- vector<string> res;
- for (map<string,int>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
+ std::vector<std::string> res;
+ for (std::map<std::string,int>::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
{
- ostringstream oss;
- oss<<(*i).second<<"/"<<(*i).first;
+ std::ostringstream oss;
+ oss << (*i).second << "/" << (*i).first;
res.push_back(oss.str());
}
return res;
}
+/*
+ * if existing identicals (first,second) in vector no problem, else Exception
+ */
std::map<std::string,int> MEDPARTITIONER::DevectorizeToMapOfStringInt(const std::vector<std::string>& vec)
-//if existing identicals (first,second) in vector no problem, else Exception
{
- map<string,int> res;
- for (vector<string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
+ std::map<std::string,int> res;
+ for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
{
- size_t pos=0;
- size_t posmax=(*i).size();
- size_t found=(*i).find('/'); //first slash
- if ((found==string::npos) || (found<1))
- throw INTERP_KERNEL::Exception(LOCALIZED("Error aIntNumber/anyString is expected"));
+ std::size_t pos=0;
+ std::size_t posmax=(*i).size();
+ 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;
- istringstream iss((*i).substr(pos,found));
- iss>>second;
- string first=(*i).substr(pos+found+1,posmax-found);
- map<string,int>::iterator it=res.find(first);
+ 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);
if (it!=res.end())
if ((*it).second!=second)
- throw INTERP_KERNEL::Exception(LOCALIZED("Error not the same map value"));
+ throw INTERP_KERNEL::Exception("Error not the same map value");
res[first]=second;
}
return res;
}
+/*!
+ * elements first and second of map give one elements in result vector of string
+ * adding key map and length of second vector as first string in each serialized vector
+ * one serialized vector per key map
+ */
std::vector<std::string> MEDPARTITIONER::VectorizeFromMapOfStringVectorOfString(const std::map< std::string,std::vector<std::string> >& mymap)
-//elements first and second of map give one elements in result vector of string
-//adding key map and length of second vector as first string in each serialized vector
-//one serialized vector per key map
{
- vector<string> res;
- for (map< string,vector<string> >::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
+ std::vector<std::string> res;
+ for (std::map< std::string,std::vector<std::string> >::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
{
- vector<string> vs=(*i).second; //a vector of string;
- ostringstream oss;
- oss<<"Keymap/"<<(*i).first<<"/"<<(*i).second.size();
+ std::vector<std::string> vs=(*i).second; //a vector of string;
+ std::ostringstream oss;
+ oss << "Keymap/" << (*i).first << "/" << (*i).second.size();
vs.insert(vs.begin(), oss.str());
res.push_back(SerializeFromVectorOfString(vs));
}
return res;
}
+/*!
+ * if existing identicals keymap in vector no problem
+ * duplicates in second vector
+ */
std::map< std::string,std::vector<std::string> > MEDPARTITIONER::DevectorizeToMapOfStringVectorOfString(const std::vector<std::string>& vec)
-//if existing identicals keymap in vector no problem
-//duplicates in second vector
{
- map< string,vector<string> > res;
- for (vector<string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
+ std::map< std::string,std::vector<std::string> > res;
+ for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
{
- vector<string> vs=DeserializeToVectorOfString(*i);
+ std::vector<std::string> vs=DeserializeToVectorOfString(*i);
- string enTete=vs[0];
- size_t posmax=enTete.size();
- size_t foundKey=enTete.find("Keymap/");
- size_t foundSizeVector=enTete.find_last_of('/');
- if ((foundKey==string::npos) || (foundKey!=0) || ((foundKey+7)>=foundSizeVector))
- throw INTERP_KERNEL::Exception(LOCALIZED("Error Keymap/anyString/aIntNumber is expected"));
+ std::string enTete=vs[0];
+ std::size_t posmax=enTete.size();
+ std::size_t foundKey=enTete.find("Keymap/");
+ std::size_t foundSizeVector=enTete.find_last_of('/');
+ if ((foundKey==std::string::npos) || (foundKey!=0) || ((foundKey+7)>=foundSizeVector))
+ throw INTERP_KERNEL::Exception("Error Keymap/anyString/aIntNumber is expected");
int sizeVector;
- istringstream iss(enTete.substr(foundSizeVector+1,posmax-foundSizeVector));
- iss>>sizeVector;
- string keymap=enTete.substr(foundKey+7,foundSizeVector-foundKey-7);
- //cout<<keymap<<" : sizeVector="<<enTete.substr(foundSizeVector+1,posmax-foundSizeVector)<<endl;
+ std::istringstream iss(enTete.substr(foundSizeVector+1,posmax-foundSizeVector));
+ iss >> sizeVector;
+ std::string keymap=enTete.substr(foundKey+7,foundSizeVector-foundKey-7);
for (int i=1; i<=sizeVector; i++)
res[keymap].push_back(vs[i]); //add unconditionnaly,so merge duplicates in second vector
}
return res;
}
+/*!
+ * shit for unique and unique_copy for the duplicate CONSECUTIVE elements
+ * I do not want to sort
+ */
std::vector<std::string> MEDPARTITIONER::SelectTagsInVectorOfString(const std::vector<std::string>& vec, const std::string tag)
{
- vector<string> res;
- if (vec.size()==0) return res;
- //shit for unique and unique_copy for the duplicate CONSECUTIVE elements
- //I do not want to sort
- for (vector<string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
+ std::vector<std::string> res;
+ if (vec.size()==0)
+ return res;
+ for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
{
- if ((*i).find(tag)!=string::npos) res.push_back(*i);
+ if ((*i).find(tag)!=std::string::npos) res.push_back(*i);
}
return res;
}
+/*!
+ *
+ */
std::vector<std::string> MEDPARTITIONER::DeleteDuplicatesInVectorOfString(const std::vector<std::string>& vec)
{
- vector<string> res;
+ std::vector<std::string> res;
if (vec.size()==0) return res;
//shit for unique and unique_copy for the duplicate CONSECUTIVE elements
//I do not want to sort
- for (vector<string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
+ for (std::vector<std::string>::const_iterator i=vec.begin(); i!=vec.end(); ++i)
{
bool found=false;
- for (vector<string>::const_iterator j=res.begin(); j!=res.end(); ++j)
+ for (std::vector<std::string>::const_iterator j=res.begin(); j!=res.end(); ++j)
{
if ((*i).compare(*j)==0)
{
std::map< std::string,std::vector<std::string> > MEDPARTITIONER::DeleteDuplicatesInMapOfStringVectorOfString(const std::map< std::string,std::vector<std::string> >& mymap)
{
- map< string,vector<string> > res;
- for (map< string,vector<string> >::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
+ std::map< std::string,std::vector<std::string> > res;
+ for (std::map< std::string,std::vector<std::string> >::const_iterator i=mymap.begin(); i!=mymap.end(); ++i)
res[(*i).first]=DeleteDuplicatesInVectorOfString((*i).second);
return res;
}
-/*
- void MEDPARTITIONER::SendVectorOfString(const std::vector<std::string>& vec, const int target)
- //non conseille, interblocages, utiliser sendAndReceive
- {
- throw INTERP_KERNEL::Exception(LOCALIZED("use SendAndReceiveVectorOfString please."));
- string str=SerializeFromVectorOfString(vec);
- int tag=111000;
- int size=str.length();
- MPI_Send( &size, 1, MPI_INT, target, tag, MPI_COMM_WORLD );
- MPI_Send( (void*)str.data(), str.length(), MPI_CHAR, target, tag+100, MPI_COMM_WORLD );
- cout<<"proc "<<MyGlobals::_Rank<<" : send to "<<target<<" '"<<str<<"'"<<endl;
- }
-*/
-
-/*
- std::vector<std::string> MEDPARTITIONER::RecvVectorOfString(const int source)
- //non conseille, interblocages, utiliser sendAndReceive
- {
- throw INTERP_KERNEL::Exception(LOCALIZED("use SendAndReceiveVectorOfString please."));
- int recSize=0;
- int tag=111000;
- MPI_Status status;
- MPI_Recv(&recSize, 1, MPI_INT, source, tag, MPI_COMM_WORLD, &status);
- string recData(recSize,'x');
- MPI_Recv((void*)recData.data(), recSize, MPI_CHAR, 1, tag+100, MPI_COMM_WORLD, &status);
- //cout<<"proc "<<MyGlobals::_Rank<<" : receive from "<<source<<" '"<<recData<<"'"<<endl;
- return DeserializeToVectorOfString(recData);
- }
-*/
-
+/*!
+ * not optimized but suffisant
+ * return empty vector if i am not target
+ */
std::vector<std::string> MEDPARTITIONER::SendAndReceiveVectorOfString(const std::vector<std::string>& vec, const int source, const int target)
-//not optimized but suffisant
-//return empty vector if i am not target
{
int rank=MyGlobals::_Rank;
-
- /*for test
- ostringstream oss;
- oss<<"sendAndReceive from "<<setw(3)<<source<<" to "<<setw(3)<<target<<"-";
- string str(oss.str());
- */
MPI_Status status;
int tag = 111001;
if (rank == source)
{
- string str=SerializeFromVectorOfString(vec);
+ std::string str=SerializeFromVectorOfString(vec);
int size=str.length();
MPI_Send( &size, 1, MPI_INT, target, tag, MPI_COMM_WORLD );
- //cout<<"proc "<<source<<" : send "<<size<<endl;
MPI_Send( (void*)str.data(), str.length(), MPI_CHAR, target, tag+100, MPI_COMM_WORLD );
- //cout<<"proc "<<source<<" : send '"<<str<<"'"<<endl;
}
int recSize=0;
if (rank == target)
{
MPI_Recv(&recSize, 1, MPI_INT, source, tag, MPI_COMM_WORLD, &status);
- //cout<<"proc "<<target<<" : receive "<<recSize<<endl;
- string recData(recSize,'x');
+ std::string recData(recSize,'x');
MPI_Recv((void*)recData.data(), recSize, MPI_CHAR, source, tag+100, MPI_COMM_WORLD, &status);
- //cout<<"proc "<<target<<" : receive '"<<recData<<"'"<<endl;
return DeserializeToVectorOfString(recData); //not empty one for target proc
}
- vector<string> res;
+ std::vector<std::string> res;
return res; //empty one for other proc
}
+/*!
+ * strings NO need all same size!!!!
+ */
std::vector<std::string> MEDPARTITIONER::AllgathervVectorOfString(const std::vector<std::string>& vec)
-//strings NO need all same size!!!!
{
int world_size=MyGlobals::_World_Size;
- string str=SerializeFromVectorOfString(vec);
-
- /*for test
- int rank=MyGlobals::_Rank;
- ostringstream oss;
- oss<<"allgatherv from "<<setw(3)<<rank<<" to all"<<"-";
- string str(oss.str());*/
+ std::string str=SerializeFromVectorOfString(vec);
- vector<int> indexes(world_size);
+ std::vector<int> indexes(world_size);
int size=str.length();
MPI_Allgather(&size, 1, MPI_INT,
&indexes[0], 1, MPI_INT, MPI_COMM_WORLD);
- /*{
- ostringstream oss;
- for (int i=0; i<world_size; i++) oss<<" "<<indexes[i];
- cout<<"proc "<<rank<<" : receive '"<<oss.str()<<"'"<<endl;
- }*/
-
//calcul of displacement
- vector< int > disp(1,0);
+ std::vector< int > disp(1,0);
for (int i=0; i<world_size; i++) disp.push_back( disp.back() + indexes[i] );
- string recData(disp.back(),'x');
+ std::string recData(disp.back(),'x');
MPI_Allgatherv((void*)str.data(), str.length(), MPI_CHAR,
(void*)recData.data(), &indexes[0], &disp[0], MPI_CHAR,
MPI_COMM_WORLD);
//really extraordinary verbose for debug
- vector<string> deserial=DeserializeToVectorOfString(recData);
+ std::vector<std::string> deserial=DeserializeToVectorOfString(recData);
if (MyGlobals::_Verbose>1000)
{
- cout<<"proc "<<MyGlobals::_Rank<<" : receive '"<<recData<<"'"<<endl;
- cout<<"deserialize is : a vector of size "<<deserial.size()<<endl;
- cout<<ReprVectorOfString(deserial)<<endl;
+ std::cout << "proc "<<MyGlobals::_Rank<<" : receive '" << recData << "'" << std::endl;
+ std::cout << "deserialize is : a vector of size " << deserial.size() << std::endl;
+ std::cout << ReprVectorOfString(deserial) << std::endl;
}
return deserial;
}
//void MEDPARTITIONER::sendRecvVectorOfString(const std::vector<string>& vec, const int source, const int target)
//TODO
-
std::string MEDPARTITIONER::Cle1ToStr(const std::string& s, const int inew)
{
- ostringstream oss;
- oss<<s<<" "<<inew;
+ std::ostringstream oss;
+ oss << s << " " << inew;
return oss.str();
}
-void MEDPARTITIONER::Cle1ToData(const std::string& cle, std::string& s, int& inew)
+void MEDPARTITIONER::Cle1ToData(const std::string& key, std::string& s, int& inew)
{
- size_t posmax=cle.size();
- size_t found=cle.find(' ');
- if ((found==string::npos) || (found<1))
- throw INTERP_KERNEL::Exception(LOCALIZED("Error 'aStringWithoutWhitespace aInt' is expected"));
- s=cle.substr(0,found);
- istringstream iss(cle.substr(found,posmax-found));
- iss>>inew;
+ std::size_t posmax=key.size();
+ std::size_t found=key.find(' ');
+ if ((found==std::string::npos) || (found<1))
+ throw INTERP_KERNEL::Exception("Error 'aStringWithoutWhitespace aInt' is expected");
+ s=key.substr(0,found);
+ std::istringstream iss(key.substr(found,posmax-found));
+ iss >> inew;
}
std::string MEDPARTITIONER::Cle2ToStr(const std::string& s, const int inew, const int iold)
{
- ostringstream oss;
- oss<<s<<" "<<inew<<" "<<iold;
+ std::ostringstream oss;
+ oss << s << " " << inew << " " << iold;
return oss.str();
}
-void MEDPARTITIONER::Cle2ToData(const std::string& cle, std::string& s, int& inew, int& iold)
+void MEDPARTITIONER::Cle2ToData(const std::string& key, std::string& s, int& inew, int& iold)
{
- size_t posmax=cle.size();
- size_t found=cle.find(' ');
- if ((found==string::npos) || (found<1))
- throw INTERP_KERNEL::Exception(LOCALIZED("Error 'aStringWithoutWhitespace aInt aInt' is expected"));
- s=cle.substr(0,found);
- istringstream iss(cle.substr(found,posmax-found));
- iss>>inew>>iold;
+ std::size_t posmax=key.size();
+ std::size_t found=key.find(' ');
+ if ((found==std::string::npos) || (found<1))
+ throw INTERP_KERNEL::Exception("Error 'aStringWithoutWhitespace aInt aInt' is expected");
+ s=key.substr(0,found);
+ std::istringstream iss(key.substr(found,posmax-found));
+ iss >> inew >> iold;
}
std::string MEDPARTITIONER::ExtractFromDescription(const std::string& description,const std::string& tag)
{
- size_t found=description.find(tag);
- if ((found==string::npos) || (found<1))
+ std::size_t found=description.find(tag);
+ if ((found==std::string::npos) || (found<1))
{
- cerr<<"ERROR : not found '"<<tag<<"' in '"<<description<<"'\n";
- throw INTERP_KERNEL::Exception(LOCALIZED("Error"));
+ std::cerr << "ERROR : not found '" << tag << "' in '"<< description << "'\n";
+ throw INTERP_KERNEL::Exception("Error ExtractFromDescription");
}
- size_t beg=found;
- size_t end=beg;
+ std::size_t beg=found;
+ std::size_t end=beg;
if (description[found-1]!='/')
{
//find without '/'... and pray looking for first whitespace
//something like 'idomain=0 fileName=tmp.med meshName=...'
end=description.size();
beg+=tag.length();
- string res=description.substr(beg,end-beg);
+ std::string res=description.substr(beg,end-beg);
found=res.find(' ');
- if (found==string::npos) found=res.length();
+ if (found==std::string::npos)
+ found=res.length();
res=res.substr(0,found);
- //cout<<"find without '/' !"<<tag<<"!"<<res<<"!"<<endl;
return res;
}
- size_t lg=StrToInt(description.substr(found-6,found));
+ std::size_t lg=StrToInt(description.substr(found-6,found));
beg+=tag.length();
- //cout<<"find with '/' !"<<tag<<"!"<<description.substr(beg,lg-tag.length())<<"!"<<lg<<endl;
return description.substr(beg,lg-tag.length());
}
typeField=StrToInt(ExtractFromDescription(description,"typeField="));
DT=StrToInt(ExtractFromDescription(description,"DT="));
IT=StrToInt(ExtractFromDescription(description,"IT="));
- cout<<"idomain="<<idomain<<" fileName="<<fileName<<" meshName="<<meshName<<" fieldName="<<fieldName<<endl;
}
void MEDPARTITIONER::FieldShortDescriptionToData(const std::string& description,
std::string& fieldName, int& typeField, int& entity, int& DT, int& IT)
{
- //*meshName=ExtractFromDescription(description,"meshName=");
fieldName=ExtractFromDescription(description,"fieldName=");
typeField=StrToInt(ExtractFromDescription(description,"typeField="));
entity=StrToInt(ExtractFromDescription(description,"entity="));
DT=StrToInt(ExtractFromDescription(description,"DT="));
IT=StrToInt(ExtractFromDescription(description,"IT="));
- //cout<<" meshName="<<*meshName<<" fieldName="<<*fieldName<<endl;
}
-ParaMEDMEM::DataArrayInt* MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector<int>& v)
+ParaMEDMEM::DataArrayInt *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector<int>& v)
{
- ParaMEDMEM::DataArrayInt* p=DataArrayInt::New();
+ ParaMEDMEM::DataArrayInt* p=ParaMEDMEM::DataArrayInt::New();
p->alloc(v.size(),1);
std::copy(v.begin(),v.end(),p->getPointer());
return p;
}
-ParaMEDMEM::DataArrayInt* MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector<int>& v,const int nbComponents)
+ParaMEDMEM::DataArrayInt *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector<int>& v,const int nbComponents)
{
- ParaMEDMEM::DataArrayInt* p=DataArrayInt::New();
+ ParaMEDMEM::DataArrayInt* p=ParaMEDMEM::DataArrayInt::New();
if (v.size()%nbComponents!=0)
- throw INTERP_KERNEL::Exception(LOCALIZED("Problem size modulo nbComponents != 0"));
+ throw INTERP_KERNEL::Exception("Problem size modulo nbComponents != 0");
p->alloc(v.size()/nbComponents,nbComponents);
std::copy(v.begin(),v.end(),p->getPointer());
return p;
ParaMEDMEM::DataArrayDouble* MEDPARTITIONER::CreateDataArrayDoubleFromVector(const std::vector<double>& v)
{
- ParaMEDMEM::DataArrayDouble* p=DataArrayDouble::New();
+ ParaMEDMEM::DataArrayDouble* p=ParaMEDMEM::DataArrayDouble::New();
p->alloc(v.size(),1);
std::copy(v.begin(),v.end(),p->getPointer());
return p;
}
-std::vector<std::string> MEDPARTITIONER::BrowseFieldDouble(const MEDCouplingFieldDouble* fd)
-//quick almost human readable information on a field double
-
-/*
- example done by fd->simpleRepr() :
- FieldDouble with name : "VectorFieldOnCells"
- Description of field is : ""
- FieldDouble space discretization is : P0
- FieldDouble time discretization is : One time label. Time is defined by iteration=0 order=1 and time=2.
- Time unit is : ""
- FieldDouble nature of field is : NoNature
- FieldDouble default array has 3 components and 30000 tuples.
- FieldDouble default array has following info on components : "vx" "vy" "vz"
- Mesh support information :
- __________________________
- Unstructured mesh with name : "testMesh"
- Description of mesh : ""
- Time attached to the mesh [unit] : 0 []
- Iteration : -1 Order : -1
- Mesh dimension : 3
- Space dimension : 3
- Info attached on space dimension : "" "" ""
- Number of nodes : 33201
- Number of cells : 30000
- Cell types present : NORM_HEXA8
-*/
-
+/*!
+ */
+std::vector<std::string> MEDPARTITIONER::BrowseFieldDouble(const ParaMEDMEM::MEDCouplingFieldDouble* fd)
{
- vector<string> res;
- //res.push_back("fieldName="); res.back()+=fd->getName();
- //not saved in file? res.push_back("fieldDescription="); res.back()+=fd->getDescription();
- //ret << "FieldDouble space discretization is : " << _type->getStringRepr() << "\n";
- //ret << "FieldDouble time discretization is : " << _time_discr->getStringRepr() << "\n";
- //ret << "FieldDouble nature of field is : " << MEDCouplingNatureOfField::getRepr(_nature) << "\n";
+ std::vector<std::string> res;
if (fd->getArray())
{
int nb=fd->getArray()->getNumberOfComponents();
res.push_back("nbComponents="); res.back()+=IntToStr(nb);
- //ret << "FieldDouble default array has " << nbOfCompo << " components and " << getArray()->getNumberOfTuples() << " tuples.\n";
- //ret << "FieldDouble default array has following info on components : ";
for (int i=0; i<nb; i++)
{
- //ret << "\"" << getArray()->getInfoOnComponent(i) << "\" ";
res.push_back("componentInfo");
res.back()+=IntToStr(i)+"="+fd->getArray()->getInfoOnComponent(i);
}
return res;
}
+/*!
+ * quick almost human readable information on all fields in a .med file
+ */
std::vector<std::string> MEDPARTITIONER::BrowseAllFields(const std::string& myfile)
-//quick almost human readable information on all fields in a .med file
{
- vector<string> res;
- vector<string> meshNames=MEDLoader::GetMeshNames(myfile.c_str());
+ std::vector<std::string> res;
+ std::vector<std::string> meshNames=MEDLoader::GetMeshNames(myfile.c_str());
for (int i=0; i<meshNames.size(); i++)
{
- vector<string> fieldNames=
+ std::vector<std::string> fieldNames=
MEDLoader::GetAllFieldNamesOnMesh(myfile.c_str(),meshNames[i].c_str());
for (int j = 0; j < fieldNames.size(); j++)
{
- vector< ParaMEDMEM::TypeOfField > typeFields=
+ std::vector< ParaMEDMEM::TypeOfField > typeFields=
MEDLoader::GetTypesOfField(myfile.c_str(), meshNames[i].c_str(), fieldNames[j].c_str());
for (int k = 0; k < typeFields.size(); k++)
{
- vector< pair< int, int > > its=
+ std::vector< std::pair< int, int > > its=
MEDLoader::GetFieldIterations(typeFields[k], myfile.c_str(), meshNames[i].c_str(), fieldNames[j].c_str());
- if (MyGlobals::_Is0verbose>100) cout<<"fieldName "<<fieldNames[j].c_str()<<" typeField "<<typeFields[k]<<" its.size() "<<its.size()<<endl;
+ if (MyGlobals::_Is0verbose>100)
+ std::cout<< "fieldName " << fieldNames[j] << " typeField " << typeFields[k] << " its.size() " << its.size() << std::endl;
for (int m = 0; m < its.size(); m++)
{
- vector<string> resi;
+ std::vector<std::string> resi;
resi.push_back("fileName="); resi.back()+=myfile;
resi.push_back("meshName="); resi.back()+=meshNames[i];
resi.push_back("fieldName="); resi.back()+=fieldNames[j];
//"MED_UNDEF_ENTITY_TYPE"
};
- vector<string> res;
+ std::vector<std::string> res;
med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
med_int nbFields=MEDnField(fid);
- if (MyGlobals::_Verbose>20) cout<<"on filename "<<fileName<<" nbOfField "<<nbFields<<endl;
+ if (MyGlobals::_Verbose>20)
+ std::cout << "on filename " << fileName << " nbOfField " << nbFields << std::endl;
//
med_field_type typcha;
med_int numdt=0,numo=0;
INTERP_KERNEL::AutoPtr<char> dt_unit=new char[MED_LNAME_SIZE+1];
med_int nbPdt;
MEDfieldInfo(fid,i,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
- string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
- string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
+ std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
for (int k=1; k<=nbPdt; k++)
{
MEDfieldComputingStepInfo(fid,nomcha,k,&numdt,&numo,&dt);
if (MyGlobals::_Verbose>20)
- cout<<"on filename "<<fileName<<" field "<<i<<" fieldName "<<curFieldName<<" meshName "<<curMeshName<<
- " typ "<<typcha<<" nbComponent "<<ncomp<<" nbPdt "<<nbPdt<<" noPdt "<<k<<
- " ndt "<<numdt<<" nor "<<numo<<" dt "<<dt<<endl;
+ std::cout<< "on filename " << fileName << " field " << i << " fieldName " << curFieldName << " meshName " << curMeshName <<
+ " typ " << typcha << " nbComponent " << ncomp << " nbPdt " << nbPdt << " noPdt " << k <<
+ " ndt " << numdt << " nor " << numo << " dt " << dt << std::endl;
for (int ie=0; ie<lgentity; ie++)
{
for (int j=0; j<lggeom; j++)
char pflname[MED_NAME_SIZE+1]="";
char locname[MED_NAME_SIZE+1]="";
med_int nbofprofile=MEDfieldnProfile(fid,nomcha,numdt,numo,enttype,GEOMTYPE[j],pflname,locname);
-
- /*
- med_proto.h firefox file:///export/home/.../med-3.0.3/doc/html.dox/index.html
- MEDfieldnValueWithProfileByName(const med_idt fid, const char * const fieldname,const med_int numdt,const med_int numit,
- const med_entity_type entitype, const med_geometry_type geotype, const char * const profilename,
- const med_storage_mode storagemode,med_int * const profilesize,
- char * const localizationname, med_int * const nbofintegrationpoint);
-
- MEDfieldnValueWithProfile(const med_idt fid, const char * const fieldname,const med_int numdt,const med_int numit,
- const med_entity_type entitype, const med_geometry_type geotype,
- const int profileit,
- const med_storage_mode storagemode,char * const profilename ,med_int * const profilesize,
- char * const localizationname, med_int * const nbofintegrationpoint);
- */
int profileit=1;
if (enttype==MED_NODE)
{
if (nbOfVal>0)
{
if (MyGlobals::_Verbose>20)
- cout<<"on filename "<<fileName<<" entity "<<enttype<<" nbOfVal with "<<
- nbofprofile<<" profile(s) for geomType (AUCUN) nbOfVal "<<
- nbOfVal<<" profilName '"<<pflname<<"' profileSize "<<profilesize<<" nbPtGauss "<<nbi<<endl;
- vector<string> resi;
+ std::cout << "on filename " << fileName << " entity " << enttype << " nbOfVal with " <<
+ nbofprofile << " profile(s) for geomType (AUCUN) nbOfVal " <<
+ nbOfVal << " profilName '" << pflname << "' profileSize " << profilesize << " nbPtGauss " << nbi << std::endl;
+ std::vector<std::string> resi;
resi.push_back("idomain="); resi.back()+=IntToStr(idomain);
resi.push_back("fileName="); resi.back()+=fileName;
resi.push_back("meshName="); resi.back()+=curMeshName;
resi.push_back("fieldName="); resi.back()+=curFieldName;
- resi.push_back("typeField="); resi.back()+=IntToStr((int)ON_NODES);
+ resi.push_back("typeField="); resi.back()+=IntToStr((int)ParaMEDMEM::ON_NODES);
resi.push_back("typeData="); resi.back()+=IntToStr((int)typcha); //6 for double?
resi.push_back("nbComponent="); resi.back()+=IntToStr((int)ncomp);
resi.push_back("DT="); resi.back()+=IntToStr((int)numdt);
if (nbOfVal>0)
{
if (MyGlobals::_Verbose>20)
- cout<<"on filename "<<fileName<<" entity "<<enttype<<" nbOfVal with "<<
- nbofprofile<<" profile(s) for geomType "<<
- GEOMTYPE[j]<<" "<<GEOMTYPENAME[j]<<" nbOfVal "<<
- nbOfVal<<" profilName '"<<pflname<<"' profileSize "<<profilesize<<" nbPtGauss "<<nbi<<endl;
- int typeField=(-1); //unknown
- if (enttype==MED_CELL) typeField=ON_CELLS;
- if (enttype==MED_NODE_ELEMENT) typeField=ON_GAUSS_NE;
+ std::cout << "on filename " << fileName << " entity " << enttype << " nbOfVal with " <<
+ nbofprofile << " profile(s) for geomType " <<
+ GEOMTYPE[j] << " " << GEOMTYPENAME[j] << " nbOfVal " <<
+ nbOfVal << " profilName '" << pflname << "' profileSize " << profilesize << " nbPtGauss " << nbi << std::endl;
+ int typeField=-1; //unknown
+ if (enttype==MED_CELL)
+ typeField=ParaMEDMEM::ON_CELLS;
+ if (enttype==MED_NODE_ELEMENT)
+ typeField=ParaMEDMEM::ON_GAUSS_NE;
//if (enttype==??) typeField=ON_GAUSS_PT;
- vector<string> resi;
+ std::vector<std::string> resi;
resi.push_back("idomain="); resi.back()+=IntToStr(idomain);
resi.push_back("fileName="); resi.back()+=fileName;
resi.push_back("meshName="); resi.back()+=curMeshName;
resi.push_back("nbPtGauss="); resi.back()+=IntToStr((int)nbi);
if (typeField==(-1))
{
- cout<<"WARNING : unknown typeField for entity type "<<enttype<<endl<<
- SerializeFromVectorOfString(resi)<<endl;
+ std::cout << "WARNING : unknown typeField for entity type " << enttype << std::endl <<
+ SerializeFromVectorOfString(resi) << std::endl;
continue; //do not register push_back
}
res.push_back(SerializeFromVectorOfString(resi));
delete [] maa_ass;
delete [] nomcha;
MEDfileClose(fid);
- if (MyGlobals::_Verbose>10) cout<<"detected fields:\n"<<ReprVectorOfString(res)<<endl;
+ if (MyGlobals::_Verbose>10)
+ std::cout << "detected fields:\n" << ReprVectorOfString(res) << std::endl;
return res;
}
+/*!
+ * quick almost human readable information on all fields on a mesh in a .med file
+ */
std::vector<std::string> MEDPARTITIONER::BrowseAllFieldsOnMesh(const std::string& myfile, const std::string& mymesh, const int idomain)
-//quick almost human readable information on all fields on a mesh in a .med file
{
- vector<string> res=GetInfosOfField(myfile.c_str(),mymesh.c_str(),idomain);
+ std::vector<std::string> res=GetInfosOfField(myfile.c_str(),mymesh.c_str(),idomain);
return res;
-
- /*obsolete do no work on GetTypesOfField ON_GAUSS_NE
- vector<string> res;
- vector<string> meshNames;
- meshNames.push_back(mymesh);
-
- for (int i=0; i<meshNames.size(); i++)
- {
- vector<string> fieldNames=
- MEDLoader::GetAllFieldNamesOnMesh(myfile.c_str(),meshNames[i].c_str());
- for (int j=0; j<fieldNames.size(); j++)
- {
- vector< ParaMEDMEM::TypeOfField > typeFields=
- MEDLoader::GetTypesOfField(myfile.c_str(), meshNames[i].c_str(), fieldNames[j].c_str());
- //if (MyGlobals::_Is0verbose>100) cout<<"fieldName "<<fieldNames[j].c_str()<<"typeField.size "<<typeFields.size()<<endl;
- if (typeFields.size()==0) {
- cerr<<"problem : fieldNames "<<fieldNames[j]<<" without GetTypesOfField ! Type of field specified not managed"<<endl;
- //typeFields.push_back(ON_GAUSS_NE);
- }
- for (int k=0; k<typeFields.size(); k++)
- {
- vector< pair< int, int > > its;
- its=MEDLoader::GetFieldIterations(typeFields[k], myfile.c_str(), meshNames[i].c_str(), fieldNames[j].c_str());
- //if (typeFields[k]==ON_GAUSS_NE) its.push_back(make_pair(5,6));
- if (MyGlobals::_Is0verbose>100) cout<<"fieldName "<<fieldNames[j].c_str()<<" typeField "<<typeFields[k]<<" its.size() "<<its.size()<<endl;
- for (int m = 0; m < its.size(); m++)
- {
- vector<string> resi;
- resi.push_back("idomain="); resi.back()+=IntToStr(idomain);
- resi.push_back("fileName="); resi.back()+=myfile;
- resi.push_back("meshName="); resi.back()+=meshNames[i];
- resi.push_back("fieldName="); resi.back()+=fieldNames[j];
- resi.push_back("typeField="); resi.back()+=IntToStr((int)typeFields[k]);
- resi.push_back("DT="); resi.back()+=IntToStr((int)its[m].first);
- resi.push_back("IT="); resi.back()+=IntToStr((int)its[m].second);
- //cout<<"BrowseAllFieldsOnMesh add "<<resi.size()<<endl;
- res.push_back(SerializeFromVectorOfString(resi));
- }
- }
- }
- }
- return res;
- */
}
/*!
int tag = 111002;
int size=vec.size();
if (MyGlobals::_Verbose>1000)
- cout<<"proc "<<MyGlobals::_Rank<<" : --> SendDoubleVec "<<size<<endl;
+ std::cout << "proc " << MyGlobals::_Rank << " : --> SendDoubleVec " << size << std::endl;
#ifdef HAVE_MPI2
MPI_Send(&size, 1, MPI_INT, target, tag, MPI_COMM_WORLD);
MPI_Send(const_cast<double*>(&vec[0]), size, MPI_DOUBLE, target, tag+100, MPI_COMM_WORLD);
MPI_Status status;
MPI_Recv(&size, 1, MPI_INT, source, tag, MPI_COMM_WORLD, &status);
if (MyGlobals::_Verbose>1000)
- cout<<"proc "<<MyGlobals::_Rank<<" : <-- RecvDoubleVec "<<size<<endl;;
- vector<double>* vec=new vector<double>;
+ std::cout << "proc " << MyGlobals::_Rank << " : <-- RecvDoubleVec " << size << std::endl;
+ std::vector<double>* vec=new std::vector<double>;
vec->resize(size);
MPI_Recv(&vec[0], size, MPI_DOUBLE, source, tag+100, MPI_COMM_WORLD, &status);
#endif
MPI_Status status;
MPI_Recv(&size, 1, MPI_INT, source, tag, MPI_COMM_WORLD, &status);
if (MyGlobals::_Verbose>1000)
- cout<<"proc "<<MyGlobals::_Rank<<" : <-- RecvDoubleVec "<<size<<endl;;
+ std::cout<< "proc " << MyGlobals::_Rank << " : <-- RecvDoubleVec " << size << std::endl;;
vec.resize(size);
MPI_Recv(&vec[0], size, MPI_DOUBLE, source, tag+100, MPI_COMM_WORLD, &status);
#endif
int tag = 111003;
int size=vec.size();
if (MyGlobals::_Verbose>1000)
- cout<<"proc "<<MyGlobals::_Rank<<" : --> SendIntVec "<<size<<endl; //cvw
+ std::cout << "proc " << MyGlobals::_Rank << " : --> SendIntVec " << size << std::endl;
#ifdef HAVE_MPI2
MPI_Send(&size, 1, MPI_INT, target, tag, MPI_COMM_WORLD);
MPI_Send(const_cast<int*>(&vec[0]), size,MPI_INT, target, tag+100, MPI_COMM_WORLD);
\param vec vector that is filled
\param source processor id of the incoming messages
*/
-std::vector<int>* MEDPARTITIONER::RecvIntVec(const int source)
+std::vector<int> *MEDPARTITIONER::RecvIntVec(const int source)
{
int tag = 111003;
int size;
#ifdef HAVE_MPI2
MPI_Status status;
MPI_Recv(&size, 1, MPI_INT, source, tag, MPI_COMM_WORLD, &status);
- if (MyGlobals::_Verbose>1000)
- cout<<"proc "<<MyGlobals::_Rank<<" : <-- RecvIntVec "<<size<<endl; //cvw
- vector<int>* vec=new vector<int>;
+ if (MyGlobals::_Verbose>1000)
+ std::cout << "proc " << MyGlobals::_Rank << " : <-- RecvIntVec " << size << std::endl;
+ std::vector<int> *vec=new std::vector<int>;
vec->resize(size);
MPI_Recv(&vec[0], size, MPI_INT, source, tag+100, MPI_COMM_WORLD, &status);
#endif
MPI_Status status;
MPI_Recv(&size, 1, MPI_INT, source, tag, MPI_COMM_WORLD, &status);
if (MyGlobals::_Verbose>1000)
- cout<<"proc "<<MyGlobals::_Rank<<" : <-- RecvIntVec "<<size<<endl; //cvw
+ std::cout << "proc " << MyGlobals::_Rank << " : <-- RecvIntVec " << size << std::endl;
vec.resize(size);
MPI_Recv(&vec[0], size, MPI_INT, source, tag+100, MPI_COMM_WORLD,&status);
#endif
\param da dataArray to be sent
\param target processor id of the target
*/
-void MEDPARTITIONER::SendDataArrayInt(const ParaMEDMEM::DataArrayInt* da, const int target)
+void MEDPARTITIONER::SendDataArrayInt(const ParaMEDMEM::DataArrayInt *da, const int target)
{
- if (da==0) throw INTERP_KERNEL::Exception(LOCALIZED("Problem send DataArrayInt* NULL"));
+ if (da==0)
+ throw INTERP_KERNEL::Exception("Problem send DataArrayInt* NULL");
int tag = 111004;
int size[3];
size[0]=da->getNbOfElems();
size[1]=da->getNumberOfTuples();
size[2]=da->getNumberOfComponents();
if (MyGlobals::_Verbose>1000)
- cout<<"proc "<<MyGlobals::_Rank<<" : --> SendDataArrayInt "<<size[0]<<endl; //cvw
+ std::cout << "proc " << MyGlobals::_Rank << " : --> SendDataArrayInt " << size[0] << std::endl;
#ifdef HAVE_MPI2
MPI_Send(&size, 3, MPI_INT, target, tag, MPI_COMM_WORLD);
- const int * p=da->getConstPointer();
+ const int *p=da->getConstPointer();
MPI_Send(const_cast<int*>(&p[0]), size[0] ,MPI_INT, target, tag+100, MPI_COMM_WORLD);
#endif
}
\param da dataArrayInt that is filled
\param source processor id of the incoming messages
*/
-ParaMEDMEM::DataArrayInt* MEDPARTITIONER::RecvDataArrayInt(const int source)
+ParaMEDMEM::DataArrayInt *MEDPARTITIONER::RecvDataArrayInt(const int source)
{
int tag = 111004;
int size[3];
MPI_Status status;
MPI_Recv(size, 3, MPI_INT, source, tag, MPI_COMM_WORLD, &status);
if (MyGlobals::_Verbose>1000)
- cout<<"proc "<<MyGlobals::_Rank<<" : <-- RecvDataArrayInt "<<size[0]<<endl; //cvw
+ std::cout << "proc " << MyGlobals::_Rank << " : <-- RecvDataArrayInt " << size[0] << std::endl;
if (size[0]!=(size[1]*size[2]))
- throw INTERP_KERNEL::Exception(LOCALIZED("Problem in RecvDataArrayInt incoherent sizes"));
+ throw INTERP_KERNEL::Exception("Problem in RecvDataArrayInt incoherent sizes");
ParaMEDMEM::DataArrayInt* da=ParaMEDMEM::DataArrayInt::New();
da->alloc(size[1],size[2]);
- int * p=da->getPointer();
+ int *p=da->getPointer();
MPI_Recv(const_cast<int*>(&p[0]), size[0], MPI_INT, source, tag+100, MPI_COMM_WORLD, &status);
#endif
return da;
\param da dataArray to be sent
\param target processor id of the target
*/
-void MEDPARTITIONER::SendDataArrayDouble(const ParaMEDMEM::DataArrayDouble* da, const int target)
+void MEDPARTITIONER::SendDataArrayDouble(const ParaMEDMEM::DataArrayDouble *da, const int target)
{
- if (da==0) throw INTERP_KERNEL::Exception(LOCALIZED("Problem send DataArrayDouble* NULL"));
+ if (da==0)
+ throw INTERP_KERNEL::Exception("Problem send DataArrayDouble* NULL");
int tag = 111005;
int size[3];
size[0]=da->getNbOfElems();
size[1]=da->getNumberOfTuples();
size[2]=da->getNumberOfComponents();
if (MyGlobals::_Verbose>1000)
- cout<<"proc "<<MyGlobals::_Rank<<" : --> SendDataArrayDouble "<<size[0]<<endl; //cvw
+ std::cout << "proc " << MyGlobals::_Rank << " : --> SendDataArrayDouble " << size[0] << std::endl;
#ifdef HAVE_MPI2
MPI_Send(&size, 3, MPI_INT, target, tag, MPI_COMM_WORLD);
- const double * p=da->getConstPointer();
+ const double *p=da->getConstPointer();
MPI_Send(const_cast<double*>(&p[0]), size[0] ,MPI_DOUBLE, target, tag+100, MPI_COMM_WORLD);
#endif
}
MPI_Status status;
MPI_Recv(size, 3, MPI_INT, source, tag, MPI_COMM_WORLD, &status);
if (MyGlobals::_Verbose>1000)
- cout<<"proc "<<MyGlobals::_Rank<<" : <-- RecvDataArrayDouble "<<size[0]<<endl; //cvw
+ std::cout << "proc " << MyGlobals::_Rank << " : <-- RecvDataArrayDouble " << size[0] << std::endl;
if (size[0]!=(size[1]*size[2]))
- throw INTERP_KERNEL::Exception(LOCALIZED("Problem in RecvDataArrayDouble incoherent sizes"));
+ throw INTERP_KERNEL::Exception("Problem in RecvDataArrayDouble incoherent sizes");
ParaMEDMEM::DataArrayDouble* da=ParaMEDMEM::DataArrayDouble::New();
da->alloc(size[1],size[2]);
- double * p=da->getPointer();
+ double *p=da->getPointer();
MPI_Recv(const_cast<double*>(&p[0]), size[0], MPI_DOUBLE, source, tag+100, MPI_COMM_WORLD, &status);
#endif
return da;
}
+/*!
+ * create empty MEDCouplingUMesh* dim 3
+ */
ParaMEDMEM::MEDCouplingUMesh* MEDPARTITIONER::CreateEmptyMEDCouplingUMesh()
-//create empty MEDCouplingUMesh* dim 3
{
ParaMEDMEM::MEDCouplingUMesh* umesh=ParaMEDMEM::MEDCouplingUMesh::New();
umesh->setMeshDimension(3);
{
int rank=MyGlobals::_Rank;
int world_size=MyGlobals::_World_Size;
- vector<string> myVector;
- ostringstream oss;
- oss<<"hello from "<<setw(5)<<rank<<" "<<string(rank+1,'n')<<
+ std::vector<std::string> myVector;
+ std::ostringstream oss;
+ oss << "hello from " << std::setw(5) << rank << " " << std::string(rank+1,'n') <<
" next is an empty one";
myVector.push_back(oss.str());
myVector.push_back("");
if (rank==0)
{
- /*
- string s0=SerializeFromVectorOfString(myVector);
- cout<<"s0 is : a string '"<<s0<<"'"<<endl;
- vector<string> v0=DeserializeToVectorOfString(s0);
- cout<<"v0 is : a vector of size "<<v0.size()<<endl;
- cout<<ReprVectorOfString(v0)<<endl;
- */
- string s0=SerializeFromVectorOfString(myVector);
- vector<string> res=DeserializeToVectorOfString(s0);
+ std::string s0=SerializeFromVectorOfString(myVector);
+ std::vector<std::string> res=DeserializeToVectorOfString(s0);
if (res.size()!=myVector.size())
- throw INTERP_KERNEL::Exception(LOCALIZED("Problem in (de)serialise VectorOfString incoherent sizes"));
+ throw INTERP_KERNEL::Exception("Problem in (de)serialise VectorOfString incoherent sizes");
for (int i=0; i<myVector.size(); i++)
if (res[i]!=myVector[i])
- throw INTERP_KERNEL::Exception(LOCALIZED("Problem in (de)serialise VectorOfString incoherent elements"));
+ throw INTERP_KERNEL::Exception("Problem in (de)serialise VectorOfString incoherent elements");
}
for (int i=0; i<world_size; i++)
{
for (int j=0; j<world_size; j++)
{
- vector<string> res=SendAndReceiveVectorOfString(myVector, i, j);
+ std::vector<std::string> res=SendAndReceiveVectorOfString(myVector, i, j);
if ((rank==j) && MyGlobals::_Verbose>20)
- cout<<"proc "<<rank<<" : receive \n"<<ReprVectorOfString(res)<<endl;
+ std::cout << "proc " << rank << " : receive \n" << ReprVectorOfString(res) << std::endl;
if (rank==j)
{
if (res.size()!=myVector.size())
- throw INTERP_KERNEL::Exception(LOCALIZED("Problem in SendAndReceiveVectorOfString incoherent sizes"));
+ throw INTERP_KERNEL::Exception("Problem in SendAndReceiveVectorOfString incoherent sizes");
for (int i=1; i<myVector.size(); i++) //first is different
if (res[i]!=myVector[i])
- throw INTERP_KERNEL::Exception(LOCALIZED("Problem in SendAndReceiveVectorOfString incoherent elements"));
+ throw INTERP_KERNEL::Exception("Problem in SendAndReceiveVectorOfString incoherent elements");
}
else
{
if (res.size()!=0)
- throw INTERP_KERNEL::Exception(LOCALIZED("Problem in SendAndReceiveVectorOfString size have to be 0"));
+ throw INTERP_KERNEL::Exception("Problem in SendAndReceiveVectorOfString size have to be 0");
}
}
}
- vector<string> res=AllgathervVectorOfString(myVector);
+ std::vector<std::string> res=AllgathervVectorOfString(myVector);
//sometimes for test
res=AllgathervVectorOfString(myVector);
res=AllgathervVectorOfString(myVector);
if (rank==0 && MyGlobals::_Verbose>20)
- cout<<"proc "<<rank<<" : receive \n"<<ReprVectorOfString(res)<<endl;
+ std::cout << "proc " << rank << " : receive \n" << ReprVectorOfString(res) << std::endl;
if (res.size()!=myVector.size()*world_size)
- throw INTERP_KERNEL::Exception(LOCALIZED("Problem in AllgathervVectorOfString incoherent sizes"));
- int jj=(-1);
+ throw INTERP_KERNEL::Exception("Problem in AllgathervVectorOfString incoherent sizes");
+ int jj=-1;
for (int j=0; j<world_size; j++)
{
for (int i=0; i<myVector.size(); i++)
{
jj=jj+1;
- if (i==0) continue; //first is different
+ if (i==0)
+ continue; //first is different
if (res[jj]!=myVector[i])
- throw INTERP_KERNEL::Exception(LOCALIZED("Problem in AllgathervVectorOfString incoherent elements"));
+ throw INTERP_KERNEL::Exception("Problem in AllgathervVectorOfString incoherent elements");
}
}
- if (MyGlobals::_Verbose) cout<<"proc "<<rank<<" : OK TestVectorOfStringMpi END"<< endl;
+ if (MyGlobals::_Verbose)
+ std::cout << "proc " << rank << " : OK TestVectorOfStringMpi END" << std::endl;
}
void MEDPARTITIONER::TestMapOfStringIntMpi()
{
int rank=MyGlobals::_Rank;
- //int world_size=MyGlobals::_World_Size;
- map<string,int> myMap;
+ std::map<std::string,int> myMap;
myMap["one"]=1;
myMap["two"]=22; //a bug
myMap["three"]=3;
if (rank==0)
{
- vector<string> v2=VectorizeFromMapOfStringInt(myMap);
- /*
- cout<<"v2 is : a vector of size "<<v2.size()<<endl;
- cout<<ReprVectorOfString(v2)<<endl;
- */
- map<string,int> m3=DevectorizeToMapOfStringInt(v2);
+ std::vector<std::string> v2=VectorizeFromMapOfStringInt(myMap);
+ std::map<std::string,int> m3=DevectorizeToMapOfStringInt(v2);
if (ReprMapOfStringInt(m3)!=ReprMapOfStringInt(myMap))
- throw INTERP_KERNEL::Exception(LOCALIZED("Problem in (de)vectorize MapOfStringInt"));
+ throw INTERP_KERNEL::Exception("Problem in (de)vectorize MapOfStringInt");
}
- vector<string> v2=AllgathervVectorOfString(VectorizeFromMapOfStringInt(myMap));
+ std::vector<std::string> v2=AllgathervVectorOfString(VectorizeFromMapOfStringInt(myMap));
if (rank==0 && MyGlobals::_Verbose>20)
{
- cout<<"v2 is : a vector of size "<<v2.size()<<endl;
- cout<<ReprVectorOfString(v2)<<endl;
- map<string,int> m2=DevectorizeToMapOfStringInt(v2);
- cout<<"m2 is : a map of size "<<m2.size()<<endl;
- cout<<ReprMapOfStringInt(m2)<<endl;
+ std::cout << "v2 is : a vector of size " << v2.size() << std::endl;
+ std::cout << ReprVectorOfString(v2) << std::endl;
+ std::map<std::string,int> m2=DevectorizeToMapOfStringInt(v2);
+ std::cout << "m2 is : a map of size " << m2.size() << std::endl;
+ std::cout << ReprMapOfStringInt(m2) << std::endl;
}
- if (MyGlobals::_Verbose) cout<<"proc "<<rank<<" : OK TestMapOfStringIntMpi END"<< endl;
+ if (MyGlobals::_Verbose)
+ std::cout << "proc " << rank << " : OK TestMapOfStringIntMpi END" << std::endl;
}
void MEDPARTITIONER::TestMapOfStringVectorOfStringMpi()
{
int rank=MyGlobals::_Rank;
- //int world_size=MyGlobals::_World_Size;
- vector<string> myVector;
- ostringstream oss;
- oss<<"hello from "<<setw(5)<<MyGlobals::_Rank<<" "<<string(rank+1,'n')<<
- " next is an empty one";
+ std::vector<std::string> myVector;
+ std::ostringstream oss;
+ oss << "hello from " << std::setw(5) << MyGlobals::_Rank << " " << std::string(rank+1,'n') << " next is an empty one";
myVector.push_back(oss.str());
myVector.push_back("");
myVector.push_back("next is an singleton");
if (rank==0)
{
- map< string,vector<string> > m2;
+ std::map< std::string,std::vector<std::string> > m2;
m2["first key"]=myVector;
m2["second key"]=myVector;
- vector<string> v2=VectorizeFromMapOfStringVectorOfString(m2);
- map< string,vector<string> > m3=DevectorizeToMapOfStringVectorOfString(v2);
+ std::vector<std::string> v2=VectorizeFromMapOfStringVectorOfString(m2);
+ std::map< std::string,std::vector<std::string> > m3=DevectorizeToMapOfStringVectorOfString(v2);
if (rank==0 && MyGlobals::_Verbose>20)
- cout<<"m2 is : a MapOfStringVectorOfString of size "<<m2.size()<<endl;
- cout<<ReprMapOfStringVectorOfString(m2)<<endl;
- cout<<"v2 is : a vector of size "<<v2.size()<<endl;
- cout<<ReprVectorOfString(v2)<<endl;
- cout<<"m3 is : a map of size "<<m3.size()<<endl;
- cout<<ReprMapOfStringVectorOfString(m3)<<endl;
+ std::cout << "m2 is : a MapOfStringVectorOfString of size " << m2.size() << std::endl;
+ std::cout << ReprMapOfStringVectorOfString(m2) << std::endl;
+ std::cout << "v2 is : a vector of size " << v2.size() << std::endl;
+ std::cout << ReprVectorOfString(v2) << std::endl;
+ std::cout << "m3 is : a map of size "<<m3.size() << std::endl;
+ std::cout << ReprMapOfStringVectorOfString(m3) << std::endl;
if (ReprMapOfStringVectorOfString(m3)!=ReprMapOfStringVectorOfString(m2))
- throw INTERP_KERNEL::Exception(LOCALIZED("Problem in (de)vectorize MapOfStringVectorOfString"));
+ throw INTERP_KERNEL::Exception("Problem in (de)vectorize MapOfStringVectorOfString");
}
- map< string,vector<string> > m4;
+ std::map< std::string,std::vector<std::string> > m4;
m4["1rst key"]=myVector;
m4["2snd key"]=myVector;
- vector<string> v4=AllgathervVectorOfString(VectorizeFromMapOfStringVectorOfString(m4));
+ std::vector<std::string> v4=AllgathervVectorOfString(VectorizeFromMapOfStringVectorOfString(m4));
if (rank==0 && MyGlobals::_Verbose>20)
{
- map< string,vector<string> > m5=DevectorizeToMapOfStringVectorOfString(v4);
- map< string,vector<string> > m6=DeleteDuplicatesInMapOfStringVectorOfString(m5);
- cout<<"m5 is : a map of size "<<m5.size()<<endl;
- cout<<ReprMapOfStringVectorOfString(m5)<<endl;
- cout<<"m6 is : a map from m5 with deleteDuplicates of size "<<m6.size()<<endl;
- cout<<ReprMapOfStringVectorOfString(m6)<<endl;
+ std::map< std::string,std::vector<std::string> > m5=DevectorizeToMapOfStringVectorOfString(v4);
+ std::map< std::string,std::vector<std::string> > m6=DeleteDuplicatesInMapOfStringVectorOfString(m5);
+ std::cout<< "m5 is : a map of size "<<m5.size() << std::endl;
+ std::cout<< ReprMapOfStringVectorOfString(m5) << std::endl;
+ std::cout<< "m6 is : a map from m5 with deleteDuplicates of size " << m6.size() << std::endl;
+ std::cout<< ReprMapOfStringVectorOfString(m6) << std::endl;
}
- if (MyGlobals::_Verbose) cout<<"proc "<<rank<<" : OK TestMapOfStringVectorOfStringMpi END"<< endl;
+ if (MyGlobals::_Verbose)
+ std::cout<<"proc " << rank << " : OK TestMapOfStringVectorOfStringMpi END" << std::endl;
}
void MEDPARTITIONER::TestDataArrayMpi()
int nbOfTuples=5;
int numberOfComponents=3;
send->alloc(nbOfTuples,numberOfComponents);
- vector<int> vals;
+ std::vector<int> vals;
for (int j=0; j<nbOfTuples; j++)
for (int i=0; i<numberOfComponents; i++) vals.push_back((j+1)*10+i+1);
std::copy(vals.begin(),vals.end(),send->getPointer());
- if (rank==0) SendDataArrayInt(send, 1);
- if (rank==1) recv=RecvDataArrayInt(0);
+ if (rank==0)
+ SendDataArrayInt(send, 1);
+ if (rank==1)
+ recv=RecvDataArrayInt(0);
if (rank==1 && MyGlobals::_Verbose>20)
{
- cout<<send->repr()<<endl;
- cout<<recv->repr()<<endl;
+ std::cout << send->repr() << std::endl;
+ std::cout << recv->repr() << std::endl;
}
if (rank==1)
{
if (send->repr()!=recv->repr())
- throw INTERP_KERNEL::Exception(LOCALIZED("Problem in send&recv DataArrayInt"));
+ throw INTERP_KERNEL::Exception("Problem in send&recv DataArrayInt");
}
send->decrRef();
- if (rank==1) recv->decrRef();
+ if (rank==1)
+ recv->decrRef();
}
//double
{
int nbOfTuples=5;
int numberOfComponents=3;
send->alloc(nbOfTuples,numberOfComponents);
- vector<double> vals;
+ std::vector<double> vals;
for (int j=0; j<nbOfTuples; j++)
for (int i=0; i<numberOfComponents; i++) vals.push_back(double(j+1)+double(i+1)/10);
std::copy(vals.begin(),vals.end(),send->getPointer());
if (rank==1) recv=RecvDataArrayDouble(0);
if (rank==1 && MyGlobals::_Verbose>20)
{
- cout<<send->repr()<<endl;
- cout<<recv->repr()<<endl;
+ std::cout << send->repr() << std::endl;
+ std::cout << recv->repr() << std::endl;
}
if (rank==1)
{
if (send->repr()!=recv->repr())
- throw INTERP_KERNEL::Exception(LOCALIZED("Problem in send&recv DataArrayDouble"));
+ throw INTERP_KERNEL::Exception("Problem in send&recv DataArrayDouble");
}
send->decrRef();
if (rank==1) recv->decrRef();
}
- if (MyGlobals::_Verbose) cout<<"proc "<<rank<<" : OK TestDataArrayMpi END"<< endl;
+ if (MyGlobals::_Verbose)
+ std::cout << "proc " << rank << " : OK TestDataArrayMpi END" << std::endl;
}
void MEDPARTITIONER::TestPersistantMpi0To1(int taille, int nb)
{
double temps_debut=MPI_Wtime();
- int rang=MyGlobals::_Rank;
- vector<int> x, y;
+ int rank=MyGlobals::_Rank;
+ std::vector<int> x, y;
int tag=111111;
MPI_Request requete0, requete1;
MPI_Status statut;
int ok=0;
- string res;
- if (rang==0)
+ std::string res;
+ if (rank==0)
{
x.resize(taille);
MPI_Ssend_init(&x[0], taille, MPI_INT, 1, tag, MPI_COMM_WORLD , &requete0);
}
MPI_Request_free(&requete0);
}
- else if (rang == 1)
+ else if (rank == 1)
{
y.resize(taille);
MPI_Recv_init(&y[0], taille, MPI_INT, 0, tag, MPI_COMM_WORLD , &requete1);
if (nb==taille) ok++;
if (MyGlobals::_Verbose>9)
{
- res="0K"; if (nb!=taille) res="KO";
- cout<<res<<k<<" ";
+ res="0K";
+ if (nb!=taille)
+ res="KO";
+ std::cout << res << k << " ";
}
}
- res="0K"; if (ok!=nb) res="MAUVAIS";
+ res="0K";
+ if (ok!=nb)
+ res="BAD";
if (MyGlobals::_Verbose>1)
- cout<<"resultat "<<res<<" time(sec) "<<MPI_Wtime()-temps_debut<<endl;
+ std::cout << "result " << res << " time(sec) " << MPI_Wtime()-temps_debut << std::endl;
MPI_Request_free(&requete1);
}
- //temps_fin=(MPI_WTIME()-temps_debut);
+ //end_time=(MPI_WTIME()-start_time);
}
void MEDPARTITIONER::TestPersistantMpiRing(int taille, int nb)
{
double temps_debut=MPI_Wtime();
- int befo, next, rang, wsize, tagbefo, tagnext;
- rang=MyGlobals::_Rank;
+ int befo, next, rank, wsize, tagbefo, tagnext;
+ rank=MyGlobals::_Rank;
wsize=MyGlobals::_World_Size;
- befo=rang-1; if (befo<0) befo=wsize-1;
- next=rang+1; if (next>=wsize) next=0;
- vector<int> x, y;
+ befo=rank-1; if (befo<0) befo=wsize-1;
+ next=rank+1; if (next>=wsize) next=0;
+ std::vector<int> x, y;
tagbefo=111111+befo;
- tagnext=111111+rang;
+ tagnext=111111+rank;
MPI_Request requete0, requete1;
MPI_Status statut1, statut2;
int ok=0;
- string res;
- //cout<<"ini|"<<rang<<'|'<<befo<<'|'<<next<<' ';
+ std::string res;
+ //cout<<"ini|"<<rank<<'|'<<befo<<'|'<<next<<' ';
{
x.resize(taille);
y.resize(taille);
MPI_Ssend_init(&x[0], taille, MPI_INT, next, tagnext, MPI_COMM_WORLD , &requete0);
MPI_Recv_init(&y[0], taille, MPI_INT, befo, tagbefo, MPI_COMM_WORLD , &requete1);
- //cout<<"isr|"<<rang<<'|'<<requete0<<'|'<<requete1<<' ';
for(int k=0; k<nb; k++)
{
- for (int i=0; i<taille; ++i) x[i]=k+rang;
+ for (int i=0; i<taille; ++i) x[i]=k+rank;
//Envoi d’un gros message --> cela peut prendre du temps
MPI_Start(&requete0);
//Reception du gros message --> cela peut prendre du temps
//...
//Traitement sequentiel independant de "y"
//...
- //cout<<"dsr|"<<rang<<' ';
MPI_Wait(&requete1, &statut1);
//Traitement sequentiel dependant de "y"
//...=f(y)
if (nb==taille) ok++;
if (MyGlobals::_Verbose>9)
{
- res="0K"+IntToStr(rang); if (nb!=taille) res="KO"+IntToStr(rang);
- cout<<res<<k<<" ";
+ res="0K"+IntToStr(rank); if (nb!=taille) res="KO"+IntToStr(rank);
+ std::cout << res << k << " ";
}
MPI_Wait(&requete0, &statut2);
//Traitement sequentiel impliquant une modification de "x" en memoire
MPI_Request_free(&requete1);
MPI_Request_free(&requete0);
}
- //temps_fin=(MPI_WTIME()-temps_debut);
+ //end_time=(MPI_WTIME()-start_time);
if (MyGlobals::_Verbose>1)
- cout<<"resultat proc "<<rang<<" "<<res<<" time(sec) "<<temps_debut<<endl;
+ std::cout << "result on proc " << rank << " " << res << " time(sec) " << temps_debut << std::endl;
}
-void MEDPARTITIONER::TestPersistantMpiRingOnCommSplit(int taille, int nb)
+
+void MEDPARTITIONER::TestPersistantMpiRingOnCommSplit(int size, int nb)
{
double temps_debut=MPI_Wtime();
- int rang=MyGlobals::_Rank;
+ int rank=MyGlobals::_Rank;
MPI_Comm newcomm;
- int couleur=1;
- int rangMax=4;
- if (rang>=rangMax) couleur=MPI_UNDEFINED;
- cout<<"coul|"<<rang<<'|'<<couleur<<' ';
+ int color=1;
+ int rankMax=4;
+ if (rank>=rankMax)
+ color=MPI_UNDEFINED;
//MPI_Comm_dup (MPI_COMM_WORLD, &newcomm) ;
- MPI_Comm_split(MPI_COMM_WORLD, couleur, rang, &newcomm);
+ MPI_Comm_split(MPI_COMM_WORLD, color, rank, &newcomm);
int befo, next, wsize, tagbefo, tagnext;
- wsize=rangMax;
- if (wsize>MyGlobals::_World_Size) wsize=MyGlobals::_World_Size;
- befo=rang-1; if (befo<0) befo=wsize-1;
- next=rang+1; if (next>=wsize) next=0;
- vector<int> x, y;
+ wsize=rankMax;
+ if (wsize>MyGlobals::_World_Size)
+ wsize=MyGlobals::_World_Size;
+ befo=rank-1;
+ if (befo<0)
+ befo=wsize-1;
+ next=rank+1;
+ if (next>=wsize)
+ next=0;
+ std::vector<int> x, y;
tagbefo=111111+befo;
- tagnext=111111+rang;
+ tagnext=111111+rank;
MPI_Request requete0, requete1;
MPI_Status statut1, statut2;
int ok=0;
- string res;
+ std::string res;
- //cout<<"ini|"<<rang<<'|'<<befo<<'|'<<next<<' ';
- if (couleur==1)
+ if (color==1)
{
- x.resize(taille);
- y.resize(taille);
- MPI_Ssend_init(&x[0], taille, MPI_INT, next, tagnext, newcomm , &requete0);
- MPI_Recv_init(&y[0], taille, MPI_INT, befo, tagbefo, newcomm , &requete1);
- //cout<<"isr|"<<rang<<'|'<<requete0<<'|'<<requete1<<' ';
+ x.resize(size);
+ y.resize(size);
+ MPI_Ssend_init(&x[0], size, MPI_INT, next, tagnext, newcomm , &requete0);
+ MPI_Recv_init(&y[0], size, MPI_INT, befo, tagbefo, newcomm , &requete1);
for(int k=0; k<nb; k++)
{
- for (int i=0; i<taille; ++i) x[i]=k+rang;
- //Envoi d’un gros message --> cela peut prendre du temps
+ for (int i=0; i<size; ++i)
+ x[i]=k+rank;
+ //Send of big message --> time consuming
MPI_Start(&requete0);
- //Reception du gros message --> cela peut prendre du temps
- for (int i=0; i<taille; ++i) y[i]=(-1);
+ //Reception of big message --> time consuming
+ for (int i=0; i<size; ++i)
+ y[i]=-1;
MPI_Start(&requete1);
//Traitement sequentiel independant de "x"
//...
//Traitement sequentiel independant de "y"
//...
- //cout<<"dsr|"<<rang<<' ';
+ //cout<<"dsr|"<<rank<<' ';
MPI_Wait(&requete1, &statut1);
//Traitement sequentiel dependant de "y"
//...=f(y)
int nb=0;
- for (int i=0; i<taille; ++i)
+ for (int i=0; i<size; ++i)
if (y[i]==k+befo) nb++;
- if (nb==taille) ok++;
+ if (nb==size) ok++;
if (MyGlobals::_Verbose>9)
{
- res="0K"+IntToStr(rang); if (nb!=taille) res="KO"+IntToStr(rang);
- cout<<res<<k<<" ";
+ res="0K"+IntToStr(rank);
+ if (nb!=size)
+ res="KO"+IntToStr(rank);
+ std::cout << res << k << " ";
}
MPI_Wait(&requete0, &statut2);
//Traitement sequentiel impliquant une modification de "x" en memoire
//x=...
}
- res="0K"; if (ok!=nb) res="MAUVAIS";
+ res="0K";
+ if (ok!=nb)
+ res="MAUVAIS";
temps_debut=MPI_Wtime()-temps_debut;
MPI_Request_free(&requete1);
MPI_Request_free(&requete0);
}
//MPI_Barrier(MPI_COMM_WORLD);
- cout<<"barrier|"<<rang<<"|"<<newcomm<<" ";
- if (couleur==1) MPI_Comm_free(&newcomm);
- //temps_fin=(MPI_WTIME()-temps_debut);
+ if (color==1)
+ MPI_Comm_free(&newcomm);
if (MyGlobals::_Verbose>1)
- cout<<"resultat proc "<<rang<<" "<<res<<" time(sec) "<<temps_debut<<endl;
+ std::cout << "resultat proc " << rank <<" " << res << " time(sec) " << temps_debut << std::endl;
}
#include <vector>
#include <map>
-#ifdef LOCALIZED
-#undef LOCALIZED
-#endif
-
-#if defined(_DEBUG_) || defined(_DEBUG)
-//only for debug # define LOCALIZED(message) #message , __FILE__ , __FUNCTION__ , __LINE__
-# define LOCALIZED(message) #message , __FUNCTION__ , __LINE__
-#else
-# define LOCALIZED(message) #message
-#endif
+//# define LOCALIZED(message) #message , __FILE__ , __FUNCTION__ , __LINE__
namespace MEDPARTITIONER
{
void FieldShortDescriptionToData(const std::string& description,
std::string& fieldName, int& typeField, int& entity, int& DT, int& IT);
- ParaMEDMEM::DataArrayInt* CreateDataArrayIntFromVector(const std::vector<int>& v);
- ParaMEDMEM::DataArrayInt* CreateDataArrayIntFromVector(const std::vector<int>& v, const int nbComponents);
- ParaMEDMEM::DataArrayDouble* CreateDataArrayDoubleFromVector(const std::vector<double>& v);
+ ParaMEDMEM::DataArrayInt *CreateDataArrayIntFromVector(const std::vector<int>& v);
+ ParaMEDMEM::DataArrayInt *CreateDataArrayIntFromVector(const std::vector<int>& v, const int nbComponents);
+ ParaMEDMEM::DataArrayDouble *CreateDataArrayDoubleFromVector(const std::vector<double>& v);
- //non conseille, interblocages, utiliser sendAndReceive
+ //not adviced, interblocking, use sendAndReceive
//void SendVectorOfString(const std::vector<std::string>& vec, const int target);
//std::vector<std::string> RecvVectorOfString(const int source);
//TODO void sendRecvVectorOfString(const std::vector<std::string>& vec, const int source, const int target);
std::vector<std::string> GetInfosOfField(const char *fileName, const char *meshName, const int idomain );
void SendDoubleVec(const std::vector<double>& vec, const int target);
- std::vector<double>* RecvDoubleVec(const int source);
+ std::vector<double> *RecvDoubleVec(const int source);
void RecvDoubleVec(std::vector<double>& vec, const int source);
void SendIntVec(const std::vector<int>& vec, const int target);
void RecvIntVec(std::vector<int>& vec, const int source);
void SendDataArrayInt(const ParaMEDMEM::DataArrayInt* da, const int target);
- ParaMEDMEM::DataArrayInt* RecvDataArrayInt(const int source);
+ ParaMEDMEM::DataArrayInt *RecvDataArrayInt(const int source);
void SendDataArrayDouble(const ParaMEDMEM::DataArrayDouble* da, const int target);
- ParaMEDMEM::DataArrayDouble* RecvDataArrayDouble(const int source);
+ ParaMEDMEM::DataArrayDouble *RecvDataArrayDouble(const int source);
- ParaMEDMEM::MEDCouplingUMesh* CreateEmptyMEDCouplingUMesh();
+ ParaMEDMEM::MEDCouplingUMesh *CreateEmptyMEDCouplingUMesh();
void TestVectorOfStringMpi();
void TestMapOfStringIntMpi();
class MyGlobals
{
- public : static int _Verbose; //0 to 1000 over 200 is debug
- public : static int _Rank;
- public : static int _World_Size;
- public : static int _Randomize;
- public : static int _Atomize;
- public : static int _Creates_Boundary_Faces;
- public : static int _Is0verbose; //trace cout if rank 0 and verbose
- public : static std::vector<std::string> _File_Names; //on [iold]
- public : static std::vector<std::string> _Mesh_Names; //on [iold]
- public : static std::vector<std::string> _Field_Descriptions;
- //used for descriptions of components of fields for example...
- public : static std::vector<std::string> _General_Informations;
+ public :
+ static int _Verbose; //0 to 1000 over 200 is debug
+ static int _Rank;
+ static int _World_Size;
+ static int _Randomize;
+ static int _Atomize;
+ static int _Creates_Boundary_Faces;
+ static int _Is0verbose; //trace cout if rank 0 and verbose
+ static std::vector<std::string> _File_Names; //on [iold]
+ static std::vector<std::string> _Mesh_Names; //on [iold]
+ static std::vector<std::string> _Field_Descriptions;
+ /*! used for descriptions of components of fields for example...*/
+ static std::vector<std::string> _General_Informations;
};
}
#endif