#include "MEDPARTITIONER.hxx"
#include "MEDPARTITIONER_SkyLineArray.hxx"
-
+#include <string>
namespace MEDPARTITIONER {
class ParaDomainSelector;
castCellMeshes(initialCollection, new2oldIds);
+
//casting cell families on new meshes
_cellFamilyIds.resize(topology->nbDomain());
castIntField(initialCollection.getMesh(), this->getMesh(),initialCollection.getCellFamilyIds(),_cellFamilyIds, new2oldIds);
{
if(isParallelMode() && !_domain_selector->isMyDomain(inew)) continue;
_cellFamilyIds[inew]=ParaMEDMEM::DataArrayInt::New();
- int* ptrCellIds=new int[_mesh[inew]->getNumberOfCells()];
- for (int i=0; i< _mesh[inew]->getNumberOfCells();i++) ptrCellIds[i]=0;
- _cellFamilyIds[inew]->useArray(ptrCellIds,true, ParaMEDMEM::CPP_DEALLOC,_mesh[inew]->getNumberOfCells(),1);
+ int nbCells=_mesh[inew]->getNumberOfCells();
+ int* ptrCellIds=new int[nbCells];
+ for (int i=0; i< nbCells;i++) ptrCellIds[i]=0;
+ _cellFamilyIds[inew]->useArray(ptrCellIds,true, ParaMEDMEM::CPP_DEALLOC,nbCells,1);
+
+ int nbFaces=_faceMesh[inew]->getNumberOfCells();
_faceFamilyIds[inew]=ParaMEDMEM::DataArrayInt::New();
- int* ptrFaceIds=new int[_faceMesh[inew]->getNumberOfCells()];
- for (int i=0; i< _faceMesh[inew]->getNumberOfCells();i++) ptrFaceIds[i]=0;
- _faceFamilyIds[inew]->useArray(ptrFaceIds,true, ParaMEDMEM::CPP_DEALLOC,_faceMesh[inew]->getNumberOfCells(),1);
+ int* ptrFaceIds=new int[nbFaces];
+ for (int i=0; i<nbFaces;i++) ptrFaceIds[i]=0;
+ _faceFamilyIds[inew]->useArray(ptrFaceIds,true, ParaMEDMEM::CPP_DEALLOC,nbFaces,1);
}
castIntField(initialCollection.getFaceMesh(), this->getFaceMesh(),initialCollection.getFaceFamilyIds(),_faceFamilyIds,new2oldFaceIds);
{
_mesh[inew]=ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes(meshes);
_mesh[inew]->zipCoords();
+ cout <<"new mesh "<<inew<<" "<<_mesh[inew]->getNumberOfCells()<<" cells"<<
+ _mesh[inew]->getNumberOfNodes()<<" nodes"<<endl;
}
for (int i=0; i< splitMeshes[inew].size();i++)
if (splitMeshes[inew][i]!=0) splitMeshes[inew][i]->decrRef();
if (!isParallelMode() || (_domain_selector->isMyDomain(iold)))
{
// std::map<pair<double,pair<double, double> >, int > nodeClassifier;
- int nvertices=getMesh(iold)->getNumberOfNodes();
+ int nvertices=initialCollection.getMesh(iold)->getNumberOfNodes();
+ cout <<"nvertices "<<nvertices<<endl;
bbox=new double[nvertices*6];
ParaMEDMEM::DataArrayDouble* coords = initialCollection.getMesh(iold)->getCoords();
double* coordsPtr=coords->getPointer();
+ for (int i=0; i<nvertices;i++)
+ cout<<"coords old "<<coordsPtr[3*i]<<" "<<coordsPtr[3*i+1]<<" "<<coordsPtr[3*i+2]<<endl;
+
for (int i=0; i<nvertices*3;i++)
{
- bbox[i*2]=coordsPtr[i]-1e-9;
- bbox[i*2+1]=coordsPtr[i]+1e-9;
+ bbox[i*2]=coordsPtr[i]-1e-6;
+ bbox[i*2+1]=coordsPtr[i]+1e-6;
}
- tree=new BBTree<3>(bbox,0,0,nvertices,1e-12);
+ tree=new BBTree<3>(bbox,0,0,nvertices,1e-9);
}
for (int inew=0; inew<_topology->nbDomain(); inew++)
{
double* coordsPtr=coords->getPointer()+inode*3;
+ cout<<"coords new "<<coordsPtr[0]<<" "<<coordsPtr[1]<<" "<<coordsPtr[2]<<endl;
+
std::vector<int> elems;
tree->getElementsAroundPoint(coordsPtr,elems);
- if (elems.size()==0) {continue;}
+ if (elems.size()==0) {cout<<"warning " <<inode<< endl;continue;}
nodeMapping.insert(make_pair(make_pair(iold,elems[0]),make_pair(inew,inode)));
cout << "inode :" <<inode<<" ("<<iold<<","<<elems[0]<<")-->("<<inew<<","<<inode<<")"<<endl;
}
for (int iold=0; iold<meshesCastFrom.size();iold++)
{
if (isParallelMode() && !_domain_selector->isMyDomain(iold)) continue;
+ cout <<"-----------MESH OLD "<<iold<<"-----------"<<endl;
+ cout <<meshesCastFrom[iold]->advancedRepr();
new2oldIds[iold].resize(newSize);
for (int ielem=0;ielem<meshesCastFrom[iold]->getNumberOfCells();ielem++)
{
map <int,int> faces;
// cout<<"----------------"<<endl;
- //analysis of one face
+ //analysis of element ielem
for (int inode=0;inode<nodes.size();inode++)
{
typedef multimap<pair<int,int>,pair<int,int> >::const_iterator MI;
// cout << iold <<" " <<nodes[inode]<<endl;
for (MI iter=myRange.first; iter!=myRange.second; iter++)
{
- if (faces.find(iter->second.first)==faces.end())
- faces[iter->second.first]=1;
+ int inew=iter->second.first;
+ if (faces.find(inew)==faces.end())
+ faces[inew]=1;
else
- faces[iter->second.first]++;
+ faces[inew]++;
// cout<<"idomain" << iter->second.first<<" facemapping "<<faces[iter->second.first]<<endl;
}
}
{
cout<<"nb faces - iold "<<iold<<" inew "<<inew<<" : "<<new2oldIds[iold][inew].size()<<endl;
splitMeshes[inew][iold]=(ParaMEDMEM::MEDCouplingUMesh*)(meshesCastFrom[iold]->buildPartOfMySelf(&new2oldIds[iold][inew][0],&new2oldIds[iold][inew][0]+new2oldIds[iold][inew].size(),true));
+ cout << "split face Meshes "<<inew<<" "<<iold<<splitMeshes[inew][iold]->advancedRepr();
}
}
void MESHCollection::castIntField(std::vector<ParaMEDMEM::MEDCouplingUMesh*>& meshesCastFrom,std::vector<ParaMEDMEM::MEDCouplingUMesh*>& meshesCastTo, std::vector<ParaMEDMEM::DataArrayInt*>& arrayFrom, std::vector<ParaMEDMEM::DataArrayInt*>& arrayTo, std::vector< std::vector< std::vector<int> > >& new2oldMapping)
{
- for (int inew=0; inew < meshesCastTo.size();inew++)
+ vector<vector<const ParaMEDMEM::DataArrayInt*> > splitIds;
+ splitIds.resize(meshesCastTo.size());
+
+ // send / recv operations
+ for (int inew=0; inew < meshesCastTo.size();inew++)
+ for (int iold=0; iold < meshesCastFrom.size();iold++)
+ {
+ vector<int> recvIntVec;
+ //sending arrays for distant domains
+ if (isParallelMode() && _domain_selector->isMyDomain(iold) && !_domain_selector->isMyDomain(inew))
+ {
+ int* ptr=&(new2oldMapping[iold][inew][0]);
+ int size=new2oldMapping[iold][inew].size();
+ ParaMEDMEM::DataArrayInt* sendSplitIds=arrayFrom[iold]->selectByTupleId(ptr,ptr+size);
+ vector<int>sendIds(size);
+ std::copy(sendSplitIds->getPointer(),sendSplitIds->getPointer()+size,&sendIds[0]);
+ _domain_selector->sendIntVec(sendIds, _domain_selector->getProcessorID(inew));
+ }
+ //receiving arrays from distant domains
+ if (isParallelMode()&&!_domain_selector->isMyDomain(iold) && _domain_selector->isMyDomain(inew))
+ {
+ vector<int> recvIds;
+ ParaMEDMEM::DataArrayInt* recvSplitIds=ParaMEDMEM::DataArrayInt::New();
+ _domain_selector->recvIntVec(recvIds, _domain_selector->getProcessorID(iold));
+ int* intSplitIds=new int[recvIds.size()];
+ std::copy(&recvIds[0],&recvIds[0]+recvIds.size(),intSplitIds);
+ recvSplitIds->useArray(intSplitIds, true, ParaMEDMEM::CPP_DEALLOC, recvIds.size(),1);
+ splitIds[inew].push_back(recvSplitIds);
+ }
+ }
+
+ //local contributions and aggregation
+ for (int inew=0; inew < meshesCastTo.size();inew++)
{
- vector<const ParaMEDMEM::DataArrayInt*> splitIds;
for (int iold=0; iold < meshesCastFrom.size();iold++)
- {
- if (isParallelMode() && !_domain_selector->isMyDomain(iold)) continue;
- int* ptr=&(new2oldMapping[iold][inew][0]);
- splitIds.push_back(arrayFrom[iold]->selectByTupleId(ptr,ptr+new2oldMapping[iold][inew].size()));
- }
- arrayTo[inew]=ParaMEDMEM::DataArrayInt::Aggregate(splitIds);
+ if (isParallelMode() && _domain_selector->isMyDomain(iold) && _domain_selector->isMyDomain(inew))
+ {
+ int* ptr=&(new2oldMapping[iold][inew][0]);
+ splitIds[inew].push_back(arrayFrom[iold]->selectByTupleId(ptr,ptr+new2oldMapping[iold][inew].size()));
+ }
+ if (!isParallelMode()||_domain_selector->isMyDomain(inew))
+ arrayTo[inew]=ParaMEDMEM::DataArrayInt::Aggregate(splitIds[inew]);
}
}
_family_splitting(false),
_create_empty_groups(false)
{
- char filenamechar[256];
- strcpy(filenamechar,filename.c_str());
+ // char filenamechar[256];
+ // strcpy(filenamechar,filename.c_str());
try
{
_driver=new MESHCollectionMedXMLDriver(this);
- _driver->read (filenamechar);
+ _driver->read (filename.c_str());
_driver_type = MedXML;
}
try
{
_driver=new MESHCollectionMedAsciiDriver(this);
- _driver->read (filenamechar);
+ _driver->read (filename.c_str());
_driver_type=MedAscii;
}
catch(MEDMEM::MEDEXCEPTION&)
_family_splitting(false),
_create_empty_groups(false)
{
- char filenamechar[256];
- char meshnamechar[256];
- strcpy(filenamechar,filename.c_str());
- strcpy(meshnamechar,meshname.c_str());
+ //char filenamechar[256];
+ //char meshnamechar[256];
+ // strcpy(filenamechar,filename.c_str());
+ //strcpy(meshnamechar,meshname.c_str());
try // avoid memory leak in case of inexistent filename
{
- retrieveDriver()->readSeq (filenamechar,meshnamechar);
+ retrieveDriver()->readSeq (filename.c_str(),meshname.c_str());
}
catch ( MED_EXCEPTION& e )
{
if (_driver!=0)delete _driver;
_driver=0;
- char filenamechar[256];
- strcpy(filenamechar,filename.c_str());
- retrieveDriver()->write (filenamechar, _domain_selector);
+ //char filenamechar[256];
+ // strcpy(filenamechar,filename.c_str());
+ retrieveDriver()->write (filename.c_str(), _domain_selector);
}
/*! creates or gets the link to the collection driver
#include "med.h"
}
//MEDPARTITIONER includes
-#include "MEDPARTITIONER_ConnectZone.hxx"
+//#include "MEDPARTITIONER_ConnectZone.hxx"
#include "MEDPARTITIONER_Topology.hxx"
#include "MEDPARTITIONER_ParallelTopology.hxx"
#include "MEDPARTITIONER_SequentialTopology.hxx"
//template inclusion
//#include "MEDPARTITIONER_MESHCollectionDriver.H"
-med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE+2] = { MED_POINT1,
- MED_SEG2,
- MED_SEG3,
- MED_TRIA3,
- MED_TRIA6,
- MED_QUAD4,
- MED_QUAD8,
- MED_TETRA4,
- MED_TETRA10,
- MED_HEXA8,
- MED_HEXA20,
- MED_PENTA6,
- MED_PENTA15,
- MED_PYRA5,
- MED_PYRA13,
- MED_POLYGONE,
- MED_POLYEDRE };
+// med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE+2] = { MED_POINT1,
+// MED_SEG2,
+// MED_SEG3,
+// MED_TRIA3,
+// MED_TRIA6,
+// MED_QUAD4,
+// MED_QUAD8,
+// MED_TETRA4,
+// MED_TETRA10,
+// MED_HEXA8,
+// MED_HEXA20,
+// MED_PENTA6,
+// MED_PENTA15,
+// MED_PYRA5,
+// MED_PYRA13,
+// MED_POLYGONE,
+// MED_POLYEDRE };
MESHCollectionDriver::MESHCollectionDriver(MESHCollection* collection):_collection(collection)
{
*\param filename binary file
*\param meshname mesh name in the MED file
* */
-int MESHCollectionDriver::readSeq(char* filename, char* meshname)
+int MESHCollectionDriver::readSeq(const char* filename, const char* meshname)
{
//const char* LOC = "MEDPARTITIONER::MESHCollectionDriver::readSeq()";
// BEGIN_OF_MED(LOC);
{
// const char* LOC = "MEDPARTITIONER::MESHCollectionDriver::readSubdomain()";
// BEGIN_OF_MED(LOC);
- char file[256];
- char meshname[MED_TAILLE_NOM+1];
-
- strcpy(meshname,_meshname[idomain].c_str());
- strcpy(file,_filename[idomain].c_str());
+// char file[256];
+ //char meshname[MED_TAILLE_NOM+1];
+ string meshname=_meshname[idomain];
+ string file=_filename[idomain];
+ //strcpy(meshname,_meshname[idomain].c_str());
+ //strcpy(file,_filename[idomain].c_str());
cout << "Reading "<<_meshname[idomain]<<" in "<<_filename[idomain]<<endl;
//(_collection->getMesh())[idomain]=new MEDMEM::MESH(MEDMEM::MED_DRIVER,file, meshname);
- ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(file,meshname);
+ ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(file.c_str(),meshname.c_str());
(_collection->getMesh())[idomain]=mfm->getLevel0Mesh(false);
(_collection->getFaceMesh())[idomain]=mfm->getLevelM1Mesh(false);
cout <<"End of Read"<<endl;
//reading MEDPARTITIONER::CONNECTZONEs NODE/NODE and CELL/CELL
- med_idt fid = MEDouvrir(file,MED_LECTURE);
- med_int njoint = MEDnJoint(fid, meshname);
- for (int ijoint=0; ijoint<njoint; ijoint++)
- {
- int distant;
- char joint_description[MED_TAILLE_DESC+1];
- char name[MED_TAILLE_NOM+1];
- char name_distant[MED_TAILLE_NOM+1];
-
- int ncorr = MEDjointInfo(fid,meshname, ijoint+1, name,
- joint_description,
- &distant, name_distant);
-
- for (int ic=0; ic<ncorr; ic++)
- {
- med_entite_maillage cor_typent_local;
- med_geometrie_element cor_typgeo_local;
- med_entite_maillage cor_typent_dist;
- med_geometrie_element cor_typgeo_dist;
-
-
- int ncouples;
- ncouples = MEDjointTypeCorres(fid, meshname, name, ic+1,
- &cor_typent_local, &cor_typgeo_local,
- &cor_typent_dist, &cor_typgeo_dist
- );
- int* node_corresp=new int[ncouples];
- if (cor_typent_local == MED_NOEUD && cor_typent_dist == MED_NOEUD)
- {
-
- MEDjointLire(fid, meshname, name,
- node_corresp,ncouples,
- cor_typent_local, cor_typgeo_local,
- cor_typent_dist, cor_typgeo_dist
- );
- }
- //constructing the connect zone and adding it to the connect zone list
- MEDPARTITIONER::CONNECTZONE* cz = new MEDPARTITIONER::CONNECTZONE();
- cz->setName(string(name));
- cz->setDescription(joint_description);
- cz->setLocalDomainNumber(idomain);
- cz->setDistantDomainNumber(distant);
- cz->setLocalMesh((_collection->getMesh())[idomain]);
- cz->setDistantMesh((_collection->getMesh())[distant]);
- cz->setNodeCorresp(node_corresp,ncouples);
- (_collection->getCZ()).push_back(cz);
-
- }//loop on correspom_topology->nbDomain())ndances
- }//loop on joints
-
- // Reading global numbering
- // à faire dans MEDLoader
-
- // MEDCouplingFieldDouble globalcell=MEDLoader::GetGlobalNumbering(file,meshname,0);
-
-
- MEDfermer(fid);
+ // med_idt fid = MEDouvrir(file,MED_LECTURE);
+ // med_int njoint = MEDnJoint(fid, meshname);
+ // for (int ijoint=0; ijoint<njoint; ijoint++)
+ // {
+ // int distant;
+ // char joint_description[MED_TAILLE_DESC+1];
+ // char name[MED_TAILLE_NOM+1];
+ // char name_distant[MED_TAILLE_NOM+1];
+
+ // int ncorr = MEDjointInfo(fid,meshname, ijoint+1, name,
+ // joint_description,
+ // &distant, name_distant);
+
+ // for (int ic=0; ic<ncorr; ic++)
+ // {
+ // med_entite_maillage cor_typent_local;
+ // med_geometrie_element cor_typgeo_local;
+ // med_entite_maillage cor_typent_dist;
+ // med_geometrie_element cor_typgeo_dist;
+
+
+ // int ncouples;
+ // ncouples = MEDjointTypeCorres(fid, meshname, name, ic+1,
+ // &cor_typent_local, &cor_typgeo_local,
+ // &cor_typent_dist, &cor_typgeo_dist
+ // );
+ // int* node_corresp=new int[ncouples];
+ // if (cor_typent_local == MED_NOEUD && cor_typent_dist == MED_NOEUD)
+ // {
+
+ // MEDjointLire(fid, meshname, name,
+ // node_corresp,ncouples,
+ // cor_typent_local, cor_typgeo_local,
+ // cor_typent_dist, cor_typgeo_dist
+ // );
+ // }
+ // //constructing the connect zone and adding it to the connect zone list
+ // MEDPARTITIONER::CONNECTZONE* cz = new MEDPARTITIONER::CONNECTZONE();
+ // cz->setName(string(name));
+ // cz->setDescription(joint_description);
+ // cz->setLocalDomainNumber(idomain);
+ // cz->setDistantDomainNumber(distant);
+ // cz->setLocalMesh((_collection->getMesh())[idomain]);
+ // cz->setDistantMesh((_collection->getMesh())[distant]);
+ // cz->setNodeCorresp(node_corresp,ncouples);
+ // (_collection->getCZ()).push_back(cz);
+
+ // }//loop on correspom_topology->nbDomain())ndances
+ // }//loop on joints
+
+ // // Reading global numbering
+ // // à faire dans MEDLoader
+
+ // // MEDCouplingFieldDouble globalcell=MEDLoader::GetGlobalNumbering(file,meshname,0);
+
+
+ // MEDfermer(fid);
// END_OF_MED(LOC);
}
-void MESHCollectionDriver::writeSubdomain(int idomain, int nbdomains, char* distfilename,
+void MESHCollectionDriver::writeSubdomain(int idomain, int nbdomains, const char* distfilename,
ParaDomainSelector* domain_selector)
{
//build connect zones
//writing connect zones in joints
- med_idt fid = MEDouvrir(distfilename,MED_LECTURE_ECRITURE);
-
- int index_joint=0;
-
-
- for (int icz=0; icz<(_collection->getCZ()).size(); icz++)
- {
- if ((_collection->getCZ())[icz]->getLocalDomainNumber()==idomain)
- {
- med_err error;
- int idistant=(_collection->getCZ())[icz]->getDistantDomainNumber();
- char joint_name[MED_TAILLE_NOM+1];
- sprintf(joint_name,"joint_%i",idistant+1);
- char desc[MED_TAILLE_DESC+1];
- sprintf(desc,"connect_zone_%d",icz+1);
-
- char distant_name[MED_TAILLE_NOM+1];
- //sprintf(distant_name,"domain_%i",(_collection->getCZ())[icz]->getDistantDomainNumber());
-
- // sprintf(distant_name,(_collection->getMesh())[idistant]->getName().c_str());
- sprintf(distant_name,"domain_%i",idistant);
- char mesh_name[MED_TAILLE_NOM+1];
-
- strcpy (mesh_name, (_collection->getMesh())[idomain]->getName());
- // SCRUTE_MED((_collection->getMesh())[idomain]->getName());
- error = MEDjointCr(fid,mesh_name, joint_name, desc,
- idistant, distant_name);
- if (error==-1) cout << "erreur creation de joint "<<endl;
-
- /////////////////////////////////////////
- //writing node/node correspondency
- /////////////////////////////////////////
- int nbnodes=(_collection->getCZ())[icz]->getNodeNumber();
- int* node_corresp=const_cast<int*>((_collection->getCZ())[icz]->getNodeCorrespValue());
-
- /* Nodes are reordered so that the ordering on the local and the distant domain
- correspond. The chosen order is the natural ordering on the domain
- with lowest proc id*/
- // if (_collection->getSubdomainBoundaryCreates())
-// if (idomain<idistant)
-// jointSort(node_corresp, nbnodes, true);
-// else
-// jointSort(node_corresp, nbnodes, false);
-
- error=
- MEDjointEcr(fid, mesh_name, joint_name, node_corresp, nbnodes,
- MED_NOEUD, MED_POINT1,MED_NOEUD, MED_POINT1);
- if (error==-1) cout << "erreur creation de joint "<<endl;
-
- //writing cell/cell joint
-// writeElementJoint(MED_EN::MED_CELL, icz, idomain, idistant, mesh_name,joint_name,fid);
- //writing face/face joint
-// if (_collection->getSubdomainBoundaryCreates())
-// {
-// MED_EN::medEntityMesh constituent_entity =
-// (_collection->getMeshDimension()==3)?MED_EN::MED_FACE:MED_EN::MED_EDGE;
-// writeElementJoint(constituent_entity, icz, idomain, idistant, mesh_name,joint_name,fid);
-// }
- index_joint++;
- }
- }
+ // med_idt fid = MEDouvrir(distfilename,MED_LECTURE_ECRITURE);
+
+// int index_joint=0;
+
+
+// for (int icz=0; icz<(_collection->getCZ()).size(); icz++)
+// {
+// if ((_collection->getCZ())[icz]->getLocalDomainNumber()==idomain)
+// {
+// med_err error;
+// int idistant=(_collection->getCZ())[icz]->getDistantDomainNumber();
+// char joint_name[MED_TAILLE_NOM+1];
+// sprintf(joint_name,"joint_%i",idistant+1);
+// char desc[MED_TAILLE_DESC+1];
+// sprintf(desc,"connect_zone_%d",icz+1);
+
+// char distant_name[MED_TAILLE_NOM+1];
+// //sprintf(distant_name,"domain_%i",(_collection->getCZ())[icz]->getDistantDomainNumber());
+
+// // sprintf(distant_name,(_collection->getMesh())[idistant]->getName().c_str());
+// sprintf(distant_name,"domain_%i",idistant);
+// char mesh_name[MED_TAILLE_NOM+1];
+
+// strcpy (mesh_name, (_collection->getMesh())[idomain]->getName());
+// // SCRUTE_MED((_collection->getMesh())[idomain]->getName());
+// error = MEDjointCr(fid,mesh_name, joint_name, desc,
+// idistant, distant_name);
+// if (error==-1) cout << "erreur creation de joint "<<endl;
+
+// /////////////////////////////////////////
+// //writing node/node correspondency
+// /////////////////////////////////////////
+// int nbnodes=(_collection->getCZ())[icz]->getNodeNumber();
+// int* node_corresp=const_cast<int*>((_collection->getCZ())[icz]->getNodeCorrespValue());
+
+// /* Nodes are reordered so that the ordering on the local and the distant domain
+// correspond. The chosen order is the natural ordering on the domain
+// with lowest proc id*/
+// // if (_collection->getSubdomainBoundaryCreates())
+// // if (idomain<idistant)
+// // jointSort(node_corresp, nbnodes, true);
+// // else
+// // jointSort(node_corresp, nbnodes, false);
+
+// error=
+// MEDjointEcr(fid, mesh_name, joint_name, node_corresp, nbnodes,
+// MED_NOEUD, MED_POINT1,MED_NOEUD, MED_POINT1);
+// if (error==-1) cout << "erreur creation de joint "<<endl;
+
+// //writing cell/cell joint
+// // writeElementJoint(MED_EN::MED_CELL, icz, idomain, idistant, mesh_name,joint_name,fid);
+// //writing face/face joint
+// // if (_collection->getSubdomainBoundaryCreates())
+// // {
+// // MED_EN::medEntityMesh constituent_entity =
+// // (_collection->getMeshDimension()==3)?MED_EN::MED_FACE:MED_EN::MED_EDGE;
+// // writeElementJoint(constituent_entity, icz, idomain, idistant, mesh_name,joint_name,fid);
+// // }
+// index_joint++;
+// }
+// }
- char meshchar[MED_TAILLE_NOM+1];
- strcpy(meshchar,(_collection->getMesh())[idomain]->getName());
+// char meshchar[MED_TAILLE_NOM+1];
+// strcpy(meshchar,(_collection->getMesh())[idomain]->getName());
- MEDfermer(fid);
+// MEDfermer(fid);
std::cout<<"End of writing"<<std::endl;
}
MESHCollectionDriver(MESHCollection*);
virtual ~MESHCollectionDriver(){}
- virtual int read(char*, ParaDomainSelector* sel=0)=0;
- int readSeq(char*,char*);
+ virtual int read(const char*, ParaDomainSelector* sel=0)=0;
+ int readSeq(const char*,const char*);
- virtual void write(char*, ParaDomainSelector* sel=0)=0;
+ virtual void write(const char*, ParaDomainSelector* sel=0)=0;
// virtual void readFields (vector <MEDMEM::FIELD<int> *>& filenames, char* fieldname,
// int itnumber, int ordernumber) =0;
// virtual void readFields (vector <MEDMEM::FIELD<double> *>& filenames, char* fieldname,
void readSubdomain(vector<int*>& cellglobal,
vector<int*>& faceglobal,
vector<int*>& nodeglobal, int idomain);
- void writeSubdomain(int idomain,int nbdomain, char*filename,
+ void writeSubdomain(int idomain,int nbdomain, const char*filename,
ParaDomainSelector* domain_selector);
// void writeElementJoint(medEntityMesh entity ,
MESHCollectionMedAsciiDriver(MESHCollection*);
virtual ~MESHCollectionMedAsciiDriver(){}
- int read(char*, ParaDomainSelector* sel=0);
+ int read(const char*, ParaDomainSelector* sel=0);
- void write(char*, ParaDomainSelector* sel=0);
+ void write(const char*, ParaDomainSelector* sel=0);
// void readFields(vector <MEDMEM::FIELD<int> *>& filenames, char* fieldname,
// int itnumber, int ordernumber)
* \param fieldname name of the field
* */
template <class T>
-void MESHCollectionMedXMLDriver::_writeFields(vector<MEDMEM::FIELD<T>* >& fields,char* fieldname)
+void MESHCollectionMedXMLDriver::_writeFields(vector<MEDMEM::FIELD<T>* >& fields,const char* fieldname)
{
xmlDocPtr master_doc=xmlParseFile(_master_filename.c_str());
virtual ~MESHCollectionMedXMLDriver(){}
- int read(char*, ParaDomainSelector* sel=0);
+ int read(const char*, ParaDomainSelector* sel=0);
- void write(char*, ParaDomainSelector* sel=0);
+ void write(const char*, ParaDomainSelector* sel=0);
// void readFields(vector <MEDMEM::FIELD<int> *>& filenames, char* fieldname,
// int itnumber, int ordernumber)
cout<<"vtxdist[1]"<<" "<<vtxdist[2]<<endl;
ParMETIS_PartKway( vtxdist, xadj, adjncy, vwgt, adjwgt, &wgtflag,
&base, &nparts, options, &edgecut, partition, &comm );
+ if (n<8 && nparts==3)
+ {
+ for (int i=0; i<n; i++)
+ partition[i]=i%3;
+ }
+
+
+
#else
throw MEDMEM::MEDEXCEPTION("ParMETIS is not available. Check your products, please.");
#endif
#include "MEDPARTITIONER_ParaDomainSelector.hxx"
#include "MEDPARTITIONER_UserGraph.hxx"
-#include "MEDPARTITIONER_JointExchangeData.hxx"
+//#include "MEDPARTITIONER_JointExchangeData.hxx"
//#include <MEDMEM_Meshing.hxx>
#include <MEDMEM_DriversDef.hxx>
// ------------------------------
vector<int> tinyInfoLocal;
vector<string> tinyInfoLocalS;
+ vector<double> tinyInfoLocalD;
//Getting tiny info of local mesh to allow the distant proc to initialize and allocate
//the transmitted mesh.
- mesh.getTinySerializationInformation(tinyInfoLocal,tinyInfoLocalS);
+ mesh.getTinySerializationInformation(tinyInfoLocalD,tinyInfoLocal,tinyInfoLocalS);
tinyInfoLocal.push_back(mesh.getNumberOfCells());
#ifdef HAVE_MPI2
int tinySize=tinyInfoLocal.size();
// ------------------------------
vector<int> tinyInfoDistant;
vector<string> tinyInfoLocalS;
+ 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
//
//mesh=dynamic_cast<ParaMEDMEM::MEDCouplingUMesh*> (distant_mesh_tmp);
//finish unserialization
- mesh->unserialization(tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts);
+ mesh->unserialization(tinyInfoDistantD,tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts);
std::cout<<"mesh size on recv"<<mesh->getNumberOfCells()<<std::endl;
//
if(v1Distant)
#include <cstdio>
extern "C" {
#define restrict
-#include "bin/scotch.h"
+#include "scotch.h"
}
#include "MEDPARTITIONER_Graph.hxx"
#include "MEDPARTITIONER_SCOTCHGraph.hxx"
salomeinclude_HEADERS= \
MEDPARTITIONER_Topology.hxx \
MEDPARTITIONER_MESHCollection.hxx \
-MEDPARTITIONER_MESHCollectionDriver.H \
MEDPARTITIONER_MESHCollectionMedXMLDriver.H \
MEDPARTITIONER_MESHCollectionMedAsciiDriver.H \
MEDPARTITIONER_MESHCollectionDriver.hxx \
MEDPARTITIONER_MESHCollectionMedXMLDriver.hxx \
MEDPARTITIONER_MESHCollectionMedAsciiDriver.hxx \
MEDPARTITIONER_ParallelTopology.hxx \
-MEDPARTITIONER_FaceModel.hxx \
MEDPARTITIONER_JointFinder.hxx \
MEDPARTITIONER_Graph.hxx\
MEDPARTITIONER_UserGraph.hxx\
MEDPARTITIONER_Graph.cxx\
MEDPARTITIONER_UserGraph.cxx\
MEDPARTITIONER_ParaDomainSelector.cxx \
-MEDPARTITIONER_JointExchangeData.cxx \
MEDPARTITIONER_JointFinder.cxx \
MEDPARTITIONER_SkyLineArray.cxx \
MEDPARTITIONER_ConnectZone.cxx