mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-28 06:40:32 +05:00
Merge from BR_size_maps
This commit is contained in:
parent
2a9fe7357b
commit
954f7dbf60
@ -32,6 +32,8 @@
|
|||||||
|
|
||||||
#include <Basics_Utils.hxx>
|
#include <Basics_Utils.hxx>
|
||||||
|
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#include "libmesh5.h"
|
#include "libmesh5.h"
|
||||||
@ -78,6 +80,29 @@ extern "C"
|
|||||||
}}}}
|
}}}}
|
||||||
|
|
||||||
|
|
||||||
|
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():
|
DriverGMF_Write::DriverGMF_Write():
|
||||||
Driver_SMESHDS_Mesh(), _exportRequiredGroups( true )
|
Driver_SMESHDS_Mesh(), _exportRequiredGroups( true )
|
||||||
{
|
{
|
||||||
@ -340,6 +365,45 @@ Driver_Mesh::Status DriverGMF_Write::Perform()
|
|||||||
return DRS_OK;
|
return DRS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Driver_Mesh::Status DriverGMF_Write::PerformSizeMap( const std::vector<Control_Pnt>& 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<Control_Pnt>::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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> DriverGMF_Write::GetSizeMapFiles()
|
||||||
|
{
|
||||||
|
std::vector<std::string> files;
|
||||||
|
files.push_back(myVerticesFile);
|
||||||
|
files.push_back(mySolFile);
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Returns an iterator on elements of a certain type
|
* \brief Returns an iterator on elements of a certain type
|
||||||
|
@ -33,6 +33,26 @@
|
|||||||
#include "SMDSAbs_ElementType.hxx"
|
#include "SMDSAbs_ElementType.hxx"
|
||||||
#include "SMDS_ElemIterator.hxx"
|
#include "SMDS_ElemIterator.hxx"
|
||||||
|
|
||||||
|
#include <gp_Pnt.hxx>
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Class for storing control points for writing GMF size maps
|
||||||
|
*/
|
||||||
|
class Control_Pnt : public gp_Pnt
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Control_Pnt();
|
||||||
|
Control_Pnt(const gp_Pnt& aPnt, double theSize);
|
||||||
|
Control_Pnt(double x, double y, double z);
|
||||||
|
Control_Pnt(double x, double y, double z, double size);
|
||||||
|
|
||||||
|
double Size() const { return size; };
|
||||||
|
void SetSize( double theSize ) { size = theSize; };
|
||||||
|
|
||||||
|
private:
|
||||||
|
double size;
|
||||||
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Driver Writing a mesh into a GMF file.
|
* \brief Driver Writing a mesh into a GMF file.
|
||||||
*/
|
*/
|
||||||
@ -50,6 +70,15 @@ public:
|
|||||||
|
|
||||||
virtual Status Perform();
|
virtual Status Perform();
|
||||||
|
|
||||||
|
// Size Maps
|
||||||
|
Status PerformSizeMap( const std::vector<Control_Pnt>& points );
|
||||||
|
void SetSizeMapPrefix( std::string prefix )
|
||||||
|
{
|
||||||
|
myVerticesFile = prefix + ".mesh";
|
||||||
|
mySolFile = prefix + ".sol";
|
||||||
|
};
|
||||||
|
std::vector<std::string> GetSizeMapFiles();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
SMDS_ElemIteratorPtr elementIterator(SMDSAbs_ElementType type);
|
SMDS_ElemIteratorPtr elementIterator(SMDSAbs_ElementType type);
|
||||||
@ -57,6 +86,8 @@ public:
|
|||||||
SMDS_ElemIteratorPtr elementIterator(SMDSAbs_GeometryType type);
|
SMDS_ElemIteratorPtr elementIterator(SMDSAbs_GeometryType type);
|
||||||
|
|
||||||
bool _exportRequiredGroups;
|
bool _exportRequiredGroups;
|
||||||
|
std::string myVerticesFile;
|
||||||
|
std::string mySolFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user