X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDPartitioner%2FMEDPARTITIONER_MeshCollectionDriver.cxx;h=9c6001bc0e686c1f4494c1c58ee21c652553b8e1;hb=d9a53c35a1b1e11594bbe617e37f05fca29a37a1;hp=c2c997d0e060d096b196ddc4ccd7113cd872f0e5;hpb=94d102d362379da8b0dc676e72a7af0a0a0af49a;p=modules%2Fmed.git diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx index c2c997d0e..9c6001bc0 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -228,18 +228,18 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile std::vector meshes; ParaMEDMEM::MEDCouplingUMesh* cellMesh=_collection->getMesh(idomain); ParaMEDMEM::MEDCouplingUMesh* faceMesh=_collection->getFaceMesh(idomain); - ParaMEDMEM::MEDCouplingUMesh* faceMeshFilter=0; + //ParaMEDMEM::MEDCouplingUMesh* faceMeshFilter=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=(ParaMEDMEM::MEDCouplingUMesh *) faceMesh->buildPartOfMySelf(index,index+filter->getNbOfElems(),true); - faceMesh=faceMeshFilter; - } + // 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=(ParaMEDMEM::MEDCouplingUMesh *) faceMesh->buildPartOfMySelf(index,index+filter->getNbOfElems(),true); + // faceMesh=faceMeshFilter; + // } cellMesh->setName(finalMeshName.c_str()); meshes.push_back(cellMesh); @@ -250,60 +250,45 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile meshes.push_back(faceMesh); } - ParaMEDMEM::MEDCouplingUMesh* boundaryMesh=0; - if (MyGlobals::_Creates_Boundary_Faces>0) - { - //try to write Boundary meshes - bool keepCoords=false; //TODO or true - boundaryMesh=(ParaMEDMEM::MEDCouplingUMesh *) cellMesh->buildBoundaryMesh(keepCoords); - boundaryMesh->setName("boundaryMesh"); - } - + //ParaMEDMEM::MEDCouplingUMesh* boundaryMesh=0; + // if (MyGlobals::_Creates_Boundary_Faces>0) + // { + // //try to write Boundary meshes + // bool keepCoords=false; //TODO or true + // boundaryMesh=(ParaMEDMEM::MEDCouplingUMesh *) cellMesh->buildBoundaryMesh(keepCoords); + // boundaryMesh->setName("boundaryMesh"); + // } + MEDLoader::WriteUMeshes(distfilename.c_str(), meshes, true); - if (faceMeshFilter!=0) - faceMeshFilter->decrRef(); - - if (boundaryMesh!=0) - { - //doing that testMesh becomes second mesh sorted by alphabetical order of name - MEDLoader::WriteUMesh(distfilename.c_str(), boundaryMesh, false); - boundaryMesh->decrRef(); - } - ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(distfilename.c_str(), _collection->getMesh(idomain)->getName()); - + // if (faceMeshFilter!=0) + // faceMeshFilter->decrRef(); + + // if (boundaryMesh!=0) + // { + // //doing that testMesh becomes second mesh sorted by alphabetical order of name + // MEDLoader::WriteUMesh(distfilename.c_str(), boundaryMesh, false); + // boundaryMesh->decrRef(); + // } + ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(distfilename.c_str(), _collection->getMesh(idomain)->getName().c_str()); + mfm->setFamilyInfo(_collection->getFamilyInfo()); mfm->setGroupInfo(_collection->getGroupInfo()); - + std::string key=Cle1ToStr("faceFamily_toArray",idomain); - if (_collection->getMapDataArrayInt().find(key)!=_collection->getMapDataArrayInt().end()) + if ( meshes.size() == 2 && + _collection->getMapDataArrayInt().find(key)!=_collection->getMapDataArrayInt().end()) { 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=ParaMEDMEM::DataArrayInt::New(); - famFilter->alloc(nbTuples,1); - int* pfamFilter=famFilter->getPointer(); - int* pfam=fam->getPointer(); - for (int i=0; isetFamilyFieldArr(-1,fam); - famFilter->decrRef(); - } + mfm->setFamilyFieldArr(-1,fam); } - + 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); key="/inewFieldDouble="+IntToStr(idomain)+"/"; - + std::map::iterator it; int nbfFieldFound=0; for (it=_collection->getMapDataArrayDouble().begin() ; it!=_collection->getMapDataArrayDouble().end(); it++)