From: rnc Date: Thu, 30 May 2013 16:39:07 +0000 (+0000) Subject: First attempt to write a size-map file from an existing .mesh file X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5c19c58d3dc6f08dde990dd239bb8002c9030925;p=modules%2Fsmesh.git First attempt to write a size-map file from an existing .mesh file --- diff --git a/src/DriverGMF/DriverGMF_Write.cxx b/src/DriverGMF/DriverGMF_Write.cxx index d4f474771..f0e2dc3f8 100644 --- a/src/DriverGMF/DriverGMF_Write.cxx +++ b/src/DriverGMF/DriverGMF_Write.cxx @@ -340,6 +340,48 @@ Driver_Mesh::Status DriverGMF_Write::Perform() return DRS_OK; } +void DriverGMF_Write::AddSizeMapSection(int meshID, int nbControlPoints) +{ +// const int dim = 3, version = sizeof(long) == 4 ? 2 : 3; +// int meshID = GmfOpenMesh( myFile.c_str(), GmfWrite, version, dim ); + int TypTab[] = {GmfSca}; + GmfSetKwd(meshID, GmfSolAtVertices, nbControlPoints, 1, TypTab); +// GmfCloseMesh(meshID); +// return DRS_OK; +} + +void DriverGMF_Write::AppendSize(int meshID, double size) +{ +// const int dim = 3, version = sizeof(long) == 4 ? 2 : 3; +// int meshID = GmfOpenMesh( myFile.c_str(), GmfWrite, version, dim ); +// int nbPoints = GmfStatKwd( meshID, GmfSolAtVertices); +// GmfSetKwd( meshID, GmfSolAtVertices, nbPoints+1, 1, 1 ); + double ValTab[] = {size}; + GmfSetLin( meshID, GmfSolAtVertices, ValTab); +// return DRS_OK; +} + +int DriverGMF_Write::NbVerticesInFile() +{ + int dim, version; + // open the file + int meshID = GmfOpenMesh( myFile.c_str(), GmfRead, &version, &dim ); + int nbVertices = GmfStatKwd( meshID, GmfVertices); + return nbVertices; +} + +int DriverGMF_Write::OpenFileToWrite() +{ + const int dim = 3, version = sizeof(long) == 4 ? 2 : 3; + int meshID = GmfOpenMesh( myFile.c_str(), GmfWrite, version, dim ); + return meshID; +} + +void DriverGMF_Write::CloseFile( int meshID ) +{ + GmfCloseMesh( meshID ); +} + //================================================================================ /*! * \brief Returns an iterator on elements of a certain type diff --git a/src/DriverGMF/DriverGMF_Write.hxx b/src/DriverGMF/DriverGMF_Write.hxx index 96c7df16e..e01f6b03a 100644 --- a/src/DriverGMF/DriverGMF_Write.hxx +++ b/src/DriverGMF/DriverGMF_Write.hxx @@ -47,8 +47,13 @@ public: { _exportRequiredGroups = toExport; } - - virtual Status Perform(); + + virtual Status Perform(); + void AddSizeMapSection( int meshID, int nbControlPoints ); + void AppendSize( int meshID, double size ); + int NbVerticesInFile(); + int OpenFileToWrite(); + void CloseFile( int ); private: