X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FDriverGMF%2FDriverGMF_Write.cxx;h=158eea06760e45717a5bda9b7204e77f5be4dcf1;hp=d4f474771395ce3206d9c9deeb1bf8634901d7b6;hb=c1754b24c3f5502d2981c494a2072da39ec2ac6d;hpb=6d0acadd44c80b820b712557cfa7f286a46d9e8c diff --git a/src/DriverGMF/DriverGMF_Write.cxx b/src/DriverGMF/DriverGMF_Write.cxx index d4f474771..158eea067 100644 --- a/src/DriverGMF/DriverGMF_Write.cxx +++ b/src/DriverGMF/DriverGMF_Write.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -32,6 +32,8 @@ #include +#include "utilities.h" + extern "C" { #include "libmesh5.h" @@ -76,7 +78,30 @@ extern "C" #define END_EXTRA_VERTICES_WRITE() \ ); \ }}}} + +Control_Pnt::Control_Pnt(): gp_Pnt() +{ + size=0; +} +Control_Pnt::Control_Pnt( const gp_Pnt& aPnt, + double theSize): gp_Pnt( aPnt ) +{ + size=theSize; +} +Control_Pnt::Control_Pnt(double theX, + double theY, + double theZ): gp_Pnt(theX, theY, theZ) +{ + size=0; +} +Control_Pnt::Control_Pnt(double theX, + double theY, + double theZ, + double theSize): gp_Pnt(theX, theY, theZ) +{ + size=theSize; +} DriverGMF_Write::DriverGMF_Write(): Driver_SMESHDS_Mesh(), _exportRequiredGroups( true ) @@ -96,7 +121,7 @@ Driver_Mesh::Status DriverGMF_Write::Perform() { Kernel_Utils::Localizer loc; - const int dim = 3, version = sizeof(long) == 4 ? 2 : 3; + const int dim = 3, version = sizeof(double) < 8 ? 1 : 2; int meshID = GmfOpenMesh( myFile.c_str(), GmfWrite, version, dim ); if ( !meshID ) @@ -340,6 +365,47 @@ Driver_Mesh::Status DriverGMF_Write::Perform() return DRS_OK; } +Driver_Mesh::Status DriverGMF_Write::PerformSizeMap( const std::vector& points ) +{ +// const int dim = 3, version = sizeof(long) == 4 ? 2 : 3; + const int dim = 3, version = 2; // Version 3 not supported by mg-hexa + + // Open files + int verticesFileID = GmfOpenMesh( myVerticesFile.c_str(), GmfWrite, version, dim ); + int solFileID = GmfOpenMesh( mySolFile.c_str(), GmfWrite, version, dim ); + + int pointsNumber = points.size(); + + // Vertices Keyword + GmfSetKwd( verticesFileID, GmfVertices, pointsNumber ); + // SolAtVertices Keyword + int TypTab[] = {GmfSca}; + GmfSetKwd(solFileID, GmfSolAtVertices, pointsNumber, 1, TypTab); + + // Read the control points information from the vector and write it into the files + std::vector::const_iterator points_it; + for (points_it = points.begin(); points_it != points.end(); points_it++ ) + { + GmfSetLin( verticesFileID, GmfVertices, points_it->X(), points_it->Y(), points_it->Z(), 0 ); + double ValTab[] = {points_it->Size()}; + GmfSetLin( solFileID, GmfSolAtVertices, ValTab); + } + + // Close Files + GmfCloseMesh( verticesFileID ); + GmfCloseMesh( solFileID ); + + return DRS_OK; +} + +std::vector DriverGMF_Write::GetSizeMapFiles() +{ + std::vector files; + files.push_back(myVerticesFile); + files.push_back(mySolFile); + return files; +} + //================================================================================ /*! * \brief Returns an iterator on elements of a certain type