X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH%2FSMESH_Gen.cxx;h=d120f41f1a4dbdc4d237ab0a147408d4470d4c2a;hb=61c36a7e0c3f43b3aedd77ef20793ff15620defe;hp=ec40c71ff9a7d3335fdee3cb5a09e6687dd55897;hpb=bb2c60c2b654843ed9727afde458334b108a26f4;p=modules%2Fsmesh.git diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index ec40c71ff..d120f41f1 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -30,6 +30,7 @@ #include "SMESH_subMesh.hxx" #include "SMDS_MeshElement.hxx" #include "SMDS_MeshNode.hxx" +#include "SMESHDriver.h" #include #include @@ -96,8 +97,8 @@ SMESH_Hypothesis *SMESH_Gen::CreateHypothesis(const char *anHyp, int studyId) */ //============================================================================= -SMESH_Mesh *SMESH_Gen::Init(int studyId, const TopoDS_Shape & aShape) -throw(SALOME_Exception) +SMESH_Mesh *SMESH_Gen::Init(int studyId, const TopoDS_Shape & aShape, int meshID) + throw(SALOME_Exception) { MESSAGE("SMESH_Gen::Init"); // if (aShape.ShapeType() == TopAbs_COMPOUND) @@ -112,11 +113,16 @@ throw(SALOME_Exception) // create a new SMESH_mesh object - SMESH_Mesh *mesh = new SMESH_Mesh(_localId++, + if(meshID == -1) + meshID=_localId++; + else if(_localId<=meshID) + _localId=meshID+1; + + SMESH_Mesh *mesh = new SMESH_Mesh(meshID, studyId, this, myStudyContext->myDocument); - myStudyContext->mapMesh[_localId] = mesh; + myStudyContext->mapMesh[meshID] = mesh; // associate a TopoDS_Shape to the mesh @@ -126,7 +132,8 @@ throw(SALOME_Exception) //============================================================================= /*! - * + * @TODO Doing a full update after computation is not optimal when doing a local + * remeshing. */ //============================================================================= @@ -138,7 +145,7 @@ throw(SALOME_Exception) /* Algo : s'appuie ou non sur une geometrie Si geometrie: -Vertex : rien à faire (range le point) +Vertex : rien �faire (range le point) Edge, Wire, collection d'edge et wire : 1D Face, Shell, collection de Face et Shells : 2D Solid, Collection de Solid : 3D @@ -183,6 +190,8 @@ Solid, Collection de Solid : 3D smToCompute = sm->GetFirstToCompute(); } + aMesh.GetMeshDS()->logFullUpdate(); + return ret; } @@ -404,3 +413,40 @@ int SMESH_Gen::GetShapeDim(const TopoDS_Shape & aShape) // SCRUTE(shapeDim); return shapeDim; } + +/** + * Import a mesh from a file + * @param fileName file name to be imported + * @param fileType Currently it could be either "DAT", "UNV" or "MED". + * @todo + */ +SMESH_Mesh * SMESH_Gen::Import(int studyId, const char * fileName, + const char * fileType) +{ + MESSAGE("SMESH_Gen::Import("<SetDocument(myStudyContext->myDocument); + reader->SetFile(string(fileName)); + reader->Read();*/ + // currently we only read one mesh from a file (limitation on MED files). + + // create a new SMESH_mesh object + SMESH_Mesh *mesh = new SMESH_Mesh(_localId++, studyId, this, + myStudyContext->myDocument); + myStudyContext->mapMesh[_localId] = mesh; + + Mesh_Reader * reader = SMESHDriver::GetMeshReader(string(fileType)); + reader->SetMesh(mesh->GetMeshDS()); + reader->SetFile(string(fileName)); + reader->Read(); + + mesh->GetMeshDS()->logFullUpdate(); + + return mesh; +} +