this->_ntot=_ni*_nj*_nk;
string ijk=IntToStr(ni)+"x"+IntToStr(nj)+"x"+IntToStr(nk);
this->_fileName="tmp_testMesh_"+ijk+".med";
- this->_fileNameWithFaces="tmp_testMeshWithFaces_"+ijk+".med";
+ this->_file_name_with_faces="tmp_testMeshWithFaces_"+ijk+".med";
string ij=IntToStr(ni)+"x"+IntToStr(nj);
- this->_fileName2="tmp_testMesh_"+ij+".med";
- this->_meshName="testMesh";
+ this->_file_name2="tmp_testMesh_"+ij+".med";
+ this->_mesh_name="testMesh";
}
void MEDPARTITIONERTest::setSmallSize()
// ============================================================================
void MEDPARTITIONERTest::setUp()
{
- this->_verbose=100;
+ this->_verbose=0;
}
// ============================================================================
myCoords->alloc(nbv,3);
std::copy(coor.begin(),coor.end(),myCoords->getPointer());
mesh->setCoords(myCoords);
- mesh->setName(_meshName.c_str());
+ mesh->setName(_mesh_name.c_str());
myCoords->decrRef();
mesh->checkCoherency();
return mesh;
myCoords->alloc(nbv,3);
std::copy(coor.begin(),coor.end(),myCoords->getPointer());
mesh->setCoords(myCoords);
- mesh->setName(_meshName.c_str());
+ mesh->setName(_mesh_name.c_str());
myCoords->decrRef();
mesh->checkCoherency();
return mesh;
myCoords->alloc(nbv,3);
std::copy(coor.begin(),coor.end(),myCoords->getPointer());
mesh->setCoords(myCoords);
- mesh->setName(_meshName.c_str());
+ mesh->setName(_mesh_name.c_str());
myCoords->decrRef();
mesh->checkCoherency();
return mesh;
field.push_back(k+.3);
}
//cvwat
- MEDCouplingUMesh *mesh=MEDLoader::ReadUMeshFromFile(myfileName.c_str(),_meshName.c_str(),0);
+ MEDCouplingUMesh *mesh=MEDLoader::ReadUMeshFromFile(myfileName.c_str(),_mesh_name.c_str(),0);
int nbOfCells=mesh->getNumberOfCells();
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
f1->setName("VectorFieldOnCells");
field.push_back(k+.3);
}
- MEDCouplingUMesh *mesh=MEDLoader::ReadUMeshFromFile(_fileName.c_str(),_meshName.c_str(),0);
+ MEDCouplingUMesh *mesh=MEDLoader::ReadUMeshFromFile(_fileName.c_str(),_mesh_name.c_str(),0);
int nbOfNodes=mesh->getNumberOfNodes();
MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME);
f1->setName("VectorFieldOnNodes");
mesh1->checkCoherency();
meshes.push_back(mesh1);
meshes.push_back(mesh2);
- MEDLoader::WriteUMeshes(_fileNameWithFaces.c_str(), meshes, true);
+ MEDLoader::WriteUMeshes(_file_name_with_faces.c_str(), meshes, true);
- ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(_fileNameWithFaces.c_str(), mesh1->getName());
+ ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(_file_name_with_faces.c_str(), mesh1->getName());
DataArrayInt* FacesFam=DataArrayInt::New();
FacesFam->alloc(mfm->getSizeAtLevel(-1),1);
FacesFam->fillWithValue(-1);
theGroups["GroupCells"].push_back("FamilyCells");
mfm->setFamilyInfo(theFamilies);
mfm->setGroupInfo(theGroups);
- mfm->write(_fileNameWithFaces.c_str(),0);
+ mfm->write(_file_name_with_faces.c_str(),0);
FacesFam->decrRef();
CellsFam->decrRef();
/*ce truc marche pas!
- ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(_fileNameWithFaces.c_str(), mesh1->getName());
+ ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(_file_name_with_faces.c_str(), mesh1->getName());
vector<const ParaMEDMEM::MEDCouplingUMesh*> ms;
ms.push_back(mesh2);
mfm->setGroupsFromScratch(-1, ms);
- mfm->write(_fileNameWithFaces.c_str(),0);
+ mfm->write(_file_name_with_faces.c_str(),0);
*/
- if (_verbose) cout<<endl<<_fileNameWithFaces<<" created"<<endl;
+ if (_verbose) cout<<endl<<_file_name_with_faces<<" created"<<endl;
if (_ntot<1000000) //too long
{
- MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile(_fileNameWithFaces.c_str(),mesh1->getName(),0);
- if (_verbose) cout<<_fileNameWithFaces<<" reread"<<endl;
+ MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile(_file_name_with_faces.c_str(),mesh1->getName(),0);
+ if (_verbose) cout<<_file_name_with_faces<<" reread"<<endl;
CPPUNIT_ASSERT(mesh1->isEqual(mesh_rw,1e-12));
mesh_rw->decrRef();
}
{
MEDCouplingUMesh * mesh = buildCARRE3DMesh();
- MEDLoader::WriteUMesh(_fileName2.c_str(),mesh,true);
- if (_verbose) cout<<endl<<_fileName2<<" created"<<endl;
- MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile(_fileName2.c_str(),mesh->getName(),0);
- if (_verbose) cout<<_fileName2<<" reread"<<endl;
+ MEDLoader::WriteUMesh(_file_name2.c_str(),mesh,true);
+ if (_verbose) cout<<endl<<_file_name2<<" created"<<endl;
+ MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile(_file_name2.c_str(),mesh->getName(),0);
+ if (_verbose) cout<<_file_name2<<" reread"<<endl;
CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12));
mesh_rw->decrRef();
mesh->decrRef();
}
}
+/*
+create a set of nbx*nby*nbz files mesh of ni*ny*nz cells
+*/
void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int nby, int nbz, int nbTarget)
{
setSize(ni,nj,nk);
- _nbTargetHuge=nbTarget;
+ _nb_target_huge=nbTarget;
MEDCouplingUMesh * mesh = buildCUBE3DMesh();
//int nbx=1, nby=1, nbz=2;
std::vector< double > cooDep,cooFin;
tagXml.replace(tagXml.find("$tagMesh"),8,tagMeshes);
string nameFileXml;
- _fileNameHugeXml="tmp_testMeshHuge_"+IntToStr(_ni)+"x"+IntToStr(_nj)+"x"+IntToStr(_nk)+"_"+sxyz+".xml";
- std::ofstream f(_fileNameHugeXml.c_str());
+ _file_name_huge_xml="tmp_testMeshHuge_"+IntToStr(_ni)+"x"+IntToStr(_nj)+"x"+IntToStr(_nk)+"_"+sxyz+".xml";
+ std::ofstream f(_file_name_huge_xml.c_str());
f<<tagXml;
f.close();
//cout<<"\n"<<tagXml<<endl;
f3->decrRef();
}
{
- string name=_fileNameWithFaces;
+ string name=_file_name_with_faces;
MEDCouplingFieldDouble *f1=buildVecFieldOnCells(name);
name.replace(name.find(".med"),4,"_WithVecFieldOnCells.med");
MEDLoader::WriteField(name.c_str(),f1,true);
{
string name=_fileName;
name.replace(name.find(".med"),4,"_WithVecFieldOnNodes.med");
- MEDCouplingUMesh * m=MEDLoader::ReadUMeshFromFile(name.c_str(),_meshName.c_str(),0);
+ MEDCouplingUMesh * m=MEDLoader::ReadUMeshFromFile(name.c_str(),_mesh_name.c_str(),0);
const std::set<INTERP_KERNEL::NormalizedCellType>& types=m->getAllTypes();
if (_verbose)
{
string fileName,cmd,execName,sourceName,targetName,input;
execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED
execName+="/bin/salome/medpartitioner_para";
- fileName=_fileNameWithFaces;
+ fileName=_file_name_with_faces;
- ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_meshName.c_str());
+ ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_mesh_name.c_str());
ParaMEDMEM::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false);
ParaMEDMEM::MEDCouplingUMesh* faceMesh=initialMesh->getLevelM1Mesh(false);
CPPUNIT_ASSERT_EQUAL(0, res);
string refusedName=targetName+"1.med";
- ParaMEDMEM::MEDFileUMesh* refusedMesh=ParaMEDMEM::MEDFileUMesh::New(refusedName.c_str(),_meshName.c_str());
+ ParaMEDMEM::MEDFileUMesh* refusedMesh=ParaMEDMEM::MEDFileUMesh::New(refusedName.c_str(),_mesh_name.c_str());
ParaMEDMEM::MEDCouplingUMesh* refusedCellMesh=refusedMesh->getLevel0Mesh(false);
ParaMEDMEM::MEDCouplingUMesh* refusedFaceMesh=refusedMesh->getLevelM1Mesh(false);
fileName=_fileName;
fileName.replace(fileName.find(".med"),4,"_WithVecFieldOnCells.med");
- ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_meshName.c_str());
+ ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_mesh_name.c_str());
ParaMEDMEM::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false);
cmd="mpirun -np 5 "+execName+" --ndomains=5 --split-method=metis"; //on same proc
CPPUNIT_ASSERT_EQUAL(0, res);
string refusedName=targetName+"1.med";
- ParaMEDMEM::MEDFileUMesh* refusedMesh=ParaMEDMEM::MEDFileUMesh::New(refusedName.c_str(),_meshName.c_str());
+ ParaMEDMEM::MEDFileUMesh* refusedMesh=ParaMEDMEM::MEDFileUMesh::New(refusedName.c_str(),_mesh_name.c_str());
ParaMEDMEM::MEDCouplingUMesh* refusedCellMesh=refusedMesh->getLevel0Mesh(false);
CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells());
//use corr to test equality of field
DataArrayDouble* f1=field1->getArray();
DataArrayDouble* f2=field2->getArray();
- if (_verbose)
+ if (_verbose>300)
{
cout<<"\nf1 : "<<f1->reprZip();
cout<<"\nf2 : "<<f2->reprZip(); //field2->advancedRepradvancedRepr();
fileName=_fileName;
fileName.replace(fileName.find(".med"),4,"_WithVecFieldOnGaussNe.med");
- ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_meshName.c_str());
+ ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_mesh_name.c_str());
ParaMEDMEM::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false);
cmd="mpirun -np 5 "+execName+" --ndomains=5 --split-method=metis"; //on same proc
CPPUNIT_ASSERT_EQUAL(0, res);
string refusedName=targetName+"1.med";
- ParaMEDMEM::MEDFileUMesh* refusedMesh=ParaMEDMEM::MEDFileUMesh::New(refusedName.c_str(),_meshName.c_str());
+ ParaMEDMEM::MEDFileUMesh* refusedMesh=ParaMEDMEM::MEDFileUMesh::New(refusedName.c_str(),_mesh_name.c_str());
ParaMEDMEM::MEDCouplingUMesh* refusedCellMesh=refusedMesh->getLevel0Mesh(false);
CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells());
//use corr to test equality of field
DataArrayDouble* f1=field1->getArray();
DataArrayDouble* f2=field2->getArray();
- if (_verbose)
+ if (_verbose>300)
{
cout << "\nf1 : " << f1->reprZip(); //123.4 for 12th cell,3rd component, 4th gausspoint
cout << "\nf2 : " << f2->reprZip(); //field2->advancedRepradvancedRepr();
execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED
execName+="/bin/salome/medpartitioner_para";
- string snbTarget=IntToStr(_nbTargetHuge);
+ string snbTarget=IntToStr(_nb_target_huge);
cmd="mpirun -np "+snbTarget+" "+execName+" --ndomains="+snbTarget+" --split-method=metis"; //on same proc
- sourceName=_fileNameHugeXml;
- targetName=_fileNameHugeXml;
+ sourceName=_file_name_huge_xml;
+ targetName=_file_name_huge_xml;
string tmp="_partitionedTo"+snbTarget+"_";
targetName.replace(targetName.find(".xml"),4,tmp);
cmd+=" --input-file="+sourceName+" --output-file="+targetName+" --verbose="+IntToStr(_verbose);
setMedianSize();
createTestMeshes();
launchMedpartitionerOnTestMeshes();
- createHugeTestMesh(_ni, _nj, _nk, 2, 2, 2, 20); //it is now to know how far we are going to test
+}
+
+void MEDPARTITIONERTest::testHugeSize()
+{
+ //setBigSize(); //may be a lot for now
+ setMedianSize();
+ //create a set of nbx*nby*nbz files mesh of ni*ny*nz cells
+ //_verbose=1;
+ createHugeTestMesh(_ni, _nj, _nk, 2, 2, 2, 32); //it is now to know how far we are going to test
launchMedpartitionerOnHugeTestMeshes();
}
+