mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-15 01:58:35 +05:00
allow multiple size-maps definition
This commit is contained in:
parent
71c2daf85e
commit
b41bee030f
@ -79,7 +79,7 @@ extern "C"
|
|||||||
|
|
||||||
|
|
||||||
DriverGMF_Write::DriverGMF_Write():
|
DriverGMF_Write::DriverGMF_Write():
|
||||||
Driver_SMESHDS_Mesh(), _exportRequiredGroups( true )
|
Driver_SMESHDS_Mesh(), _exportRequiredGroups( true ), mySizeMapVerticesNumber( 0 ), mySizeMapMeshes(), myLocalSizes()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
DriverGMF_Write::~DriverGMF_Write()
|
DriverGMF_Write::~DriverGMF_Write()
|
||||||
@ -370,49 +370,94 @@ Driver_Mesh::Status DriverGMF_Write::Perform()
|
|||||||
// return nbVertices;
|
// return nbVertices;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// int DriverGMF_Write::OpenFileToWrite()
|
// int DriverGMF_Write::BeginSizeMap()
|
||||||
// {
|
// {
|
||||||
// const int dim = 3, version = sizeof(long) == 4 ? 2 : 3;
|
// const int dim = 3, version = sizeof(long) == 4 ? 2 : 3;
|
||||||
// int meshID = GmfOpenMesh( myFile.c_str(), GmfWrite, version, dim );
|
// myGmfID = GmfOpenMesh( myFile.c_str(), GmfWrite, version, dim );
|
||||||
// return meshID;
|
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// void DriverGMF_Write::CloseFile( int meshID )
|
// void DriverGMF_Write::EndSizeMap()
|
||||||
// {
|
// {
|
||||||
// GmfCloseMesh( meshID );
|
// GmfCloseMesh( myGmfID );
|
||||||
// }
|
// }
|
||||||
|
void DriverGMF_Write::AddSizeMapFromMesh( SMESHDS_Mesh* mesh, double size)
|
||||||
|
{
|
||||||
|
mySizeMapMeshes.push_back( mesh );
|
||||||
|
mySizeMapVerticesNumber += mesh->NbNodes();
|
||||||
|
myLocalSizes.push_back(TLocalSize(mesh->NbNodes(), size));
|
||||||
|
}
|
||||||
|
|
||||||
void DriverGMF_Write::WriteSizeMapFromMesh( double size )
|
Driver_Mesh::Status DriverGMF_Write::PerformSizeMap()
|
||||||
{
|
{
|
||||||
// Open file
|
// Open file
|
||||||
const int dim = 3, version = sizeof(long) == 4 ? 2 : 3;
|
const int dim = 3, version = sizeof(long) == 4 ? 2 : 3;
|
||||||
int meshID = GmfOpenMesh( myFile.c_str(), GmfWrite, version, dim );
|
int meshID = GmfOpenMesh( myFile.c_str(), GmfWrite, version, dim );
|
||||||
|
|
||||||
// Vertices Keyword
|
// Vertices Keyword
|
||||||
int iN = 0, nbNodes = myMesh->NbNodes();
|
GmfSetKwd( meshID, GmfVertices, mySizeMapVerticesNumber );
|
||||||
GmfSetKwd( meshID, GmfVertices, nbNodes );
|
|
||||||
double xyz[3];
|
double xyz[3];
|
||||||
SMDS_NodeIteratorPtr nodeIt = myMesh->nodesIterator();
|
std::list<TLocalSize>::iterator sizes_it;
|
||||||
while ( nodeIt->more() )
|
std::list<SMESHDS_Mesh*>::iterator meshes_it;
|
||||||
|
SMESHDS_Mesh* aMesh;
|
||||||
|
for ( sizes_it = myLocalSizes.begin(), meshes_it = mySizeMapMeshes.begin()
|
||||||
|
; sizes_it != myLocalSizes.end()
|
||||||
|
; sizes_it++, meshes_it++ )
|
||||||
{
|
{
|
||||||
const SMDS_MeshNode* n = nodeIt->next();
|
aMesh= *meshes_it;
|
||||||
n->GetXYZ( xyz );
|
SMDS_NodeIteratorPtr nodeIt = aMesh->nodesIterator();
|
||||||
GmfSetLin( meshID, GmfVertices, xyz[0], xyz[1], xyz[2], n->getshapeId() );
|
while ( nodeIt->more() )
|
||||||
}
|
{
|
||||||
|
const SMDS_MeshNode* n = nodeIt->next();
|
||||||
|
n->GetXYZ( xyz );
|
||||||
|
GmfSetLin( meshID, GmfVertices, xyz[0], xyz[1], xyz[2], n->getshapeId() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// solAtVertices Keyword
|
||||||
|
int TypTab[] = {GmfSca};
|
||||||
|
GmfSetKwd(meshID, GmfSolAtVertices, mySizeMapVerticesNumber, 1, TypTab);
|
||||||
|
|
||||||
// solAtVertices Keyword
|
for ( int i = 1; i <= sizes_it->nbNodes; i++ )
|
||||||
int TypTab[] = {GmfSca};
|
{
|
||||||
GmfSetKwd(meshID, GmfSolAtVertices, nbNodes, 1, TypTab);
|
double ValTab[] = {sizes_it->size};
|
||||||
for ( int i=1; i<= nbNodes; i++)
|
GmfSetLin( meshID, GmfSolAtVertices, ValTab);
|
||||||
{
|
}
|
||||||
double ValTab[] = {size};
|
|
||||||
GmfSetLin( meshID, GmfSolAtVertices, ValTab);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close File
|
// Close File
|
||||||
GmfCloseMesh( meshID );
|
GmfCloseMesh( meshID );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// void DriverGMF_Write::WriteSizeMapFromMesh( double size )
|
||||||
|
// {
|
||||||
|
// // Open file
|
||||||
|
// const int dim = 3, version = sizeof(long) == 4 ? 2 : 3;
|
||||||
|
// int meshID = GmfOpenMesh( myFile.c_str(), GmfWrite, version, dim );
|
||||||
|
//
|
||||||
|
// // Vertices Keyword
|
||||||
|
// int iN = 0, nbNodes = myMesh->NbNodes();
|
||||||
|
// GmfSetKwd( meshID, GmfVertices, nbNodes );
|
||||||
|
// double xyz[3];
|
||||||
|
// SMDS_NodeIteratorPtr nodeIt = myMesh->nodesIterator();
|
||||||
|
// while ( nodeIt->more() )
|
||||||
|
// {
|
||||||
|
// const SMDS_MeshNode* n = nodeIt->next();
|
||||||
|
// n->GetXYZ( xyz );
|
||||||
|
// GmfSetLin( meshID, GmfVertices, xyz[0], xyz[1], xyz[2], n->getshapeId() );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // solAtVertices Keyword
|
||||||
|
// int TypTab[] = {GmfSca};
|
||||||
|
// GmfSetKwd(meshID, GmfSolAtVertices, nbNodes, 1, TypTab);
|
||||||
|
// for ( int i=1; i<= nbNodes; i++)
|
||||||
|
// {
|
||||||
|
// double ValTab[] = {size};
|
||||||
|
// GmfSetLin( meshID, GmfSolAtVertices, ValTab);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Close File
|
||||||
|
// GmfCloseMesh( meshID );
|
||||||
|
// }
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Returns an iterator on elements of a certain type
|
* \brief Returns an iterator on elements of a certain type
|
||||||
|
@ -33,6 +33,17 @@
|
|||||||
#include "SMDSAbs_ElementType.hxx"
|
#include "SMDSAbs_ElementType.hxx"
|
||||||
#include "SMDS_ElemIterator.hxx"
|
#include "SMDS_ElemIterator.hxx"
|
||||||
|
|
||||||
|
struct TLocalSize
|
||||||
|
{
|
||||||
|
TLocalSize( int theNbNodes, double theSize)
|
||||||
|
{
|
||||||
|
nbNodes = theNbNodes;
|
||||||
|
size = theSize;
|
||||||
|
}
|
||||||
|
int nbNodes;
|
||||||
|
double size;
|
||||||
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Driver Writing a mesh into a GMF file.
|
* \brief Driver Writing a mesh into a GMF file.
|
||||||
*/
|
*/
|
||||||
@ -48,8 +59,10 @@ public:
|
|||||||
_exportRequiredGroups = toExport;
|
_exportRequiredGroups = toExport;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Status Perform();
|
virtual Status Perform();
|
||||||
void WriteSizeMapFromMesh( double size );
|
Status PerformSizeMap();
|
||||||
|
void AddSizeMapFromMesh( SMESHDS_Mesh* mesh, double size);
|
||||||
|
// void WriteSizeMapFromMesh( double size );
|
||||||
// void AddSizeMapSection( int meshID, int nbControlPoints );
|
// void AddSizeMapSection( int meshID, int nbControlPoints );
|
||||||
// void AppendSize( int meshID, double size );
|
// void AppendSize( int meshID, double size );
|
||||||
// int NbVerticesInFile();
|
// int NbVerticesInFile();
|
||||||
@ -63,6 +76,9 @@ public:
|
|||||||
SMDS_ElemIteratorPtr elementIterator(SMDSAbs_GeometryType type);
|
SMDS_ElemIteratorPtr elementIterator(SMDSAbs_GeometryType type);
|
||||||
|
|
||||||
bool _exportRequiredGroups;
|
bool _exportRequiredGroups;
|
||||||
|
int mySizeMapVerticesNumber;
|
||||||
|
std::list<SMESHDS_Mesh*> mySizeMapMeshes;
|
||||||
|
std::list<TLocalSize> myLocalSizes;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user