mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-29 19:00:35 +05:00
PR: mesh and visu hexa no copy
This commit is contained in:
parent
256c68c3f9
commit
ea70fb0809
@ -147,60 +147,65 @@ SMESH_VisualObjDef::~SMESH_VisualObjDef()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
vtkIdType SMESH_VisualObjDef::GetNodeObjId( int theVTKID )
|
vtkIdType SMESH_VisualObjDef::GetNodeObjId( int theVTKID )
|
||||||
{
|
{
|
||||||
TMapOfIds::const_iterator i = myVTK2SMDSNodes.find(theVTKID);
|
// TMapOfIds::const_iterator i = myVTK2SMDSNodes.find(theVTKID);
|
||||||
return i == myVTK2SMDSNodes.end() ? -1 : i->second;
|
// return i == myVTK2SMDSNodes.end() ? -1 : i->second;
|
||||||
|
return theVTKID;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkIdType SMESH_VisualObjDef::GetNodeVTKId( int theObjID )
|
vtkIdType SMESH_VisualObjDef::GetNodeVTKId( int theObjID )
|
||||||
{
|
{
|
||||||
TMapOfIds::const_iterator i = mySMDS2VTKNodes.find(theObjID);
|
// TMapOfIds::const_iterator i = mySMDS2VTKNodes.find(theObjID);
|
||||||
return i == mySMDS2VTKNodes.end() ? -1 : i->second;
|
// return i == mySMDS2VTKNodes.end() ? -1 : i->second;
|
||||||
|
return theObjID;
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkIdType SMESH_VisualObjDef::GetElemObjId( int theVTKID )
|
vtkIdType SMESH_VisualObjDef::GetElemObjId( int theVTKID )
|
||||||
{
|
{
|
||||||
TMapOfIds::const_iterator i = myVTK2SMDSElems.find(theVTKID);
|
// TMapOfIds::const_iterator i = myVTK2SMDSElems.find(theVTKID);
|
||||||
return i == myVTK2SMDSElems.end() ? -1 : i->second;
|
// return i == myVTK2SMDSElems.end() ? -1 : i->second;
|
||||||
|
return this->GetMesh()->fromVtkToSmds(theVTKID);
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkIdType SMESH_VisualObjDef::GetElemVTKId( int theObjID )
|
vtkIdType SMESH_VisualObjDef::GetElemVTKId( int theObjID )
|
||||||
{
|
{
|
||||||
TMapOfIds::const_iterator i = mySMDS2VTKElems.find(theObjID);
|
// TMapOfIds::const_iterator i = mySMDS2VTKElems.find(theObjID);
|
||||||
return i == mySMDS2VTKElems.end() ? -1 : i->second;
|
// return i == mySMDS2VTKElems.end() ? -1 : i->second;
|
||||||
|
return this->GetMesh()->fromSmdsToVtk(theObjID);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SMESH_VisualObjDef::createPoints
|
// function : SMESH_VisualObjDef::createPoints
|
||||||
// purpose : Create points from nodes
|
// purpose : Create points from nodes
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESH_VisualObjDef::createPoints( vtkPoints* thePoints )
|
|
||||||
{
|
|
||||||
if ( thePoints == 0 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
TEntityList aNodes;
|
//void SMESH_VisualObjDef::createPoints( vtkPoints* thePoints )
|
||||||
vtkIdType nbNodes = GetEntities( SMDSAbs_Node, aNodes );
|
//{
|
||||||
thePoints->SetNumberOfPoints( nbNodes );
|
// if ( thePoints == 0 )
|
||||||
|
// return;
|
||||||
int nbPoints = 0;
|
//
|
||||||
|
// TEntityList aNodes;
|
||||||
TEntityList::const_iterator anIter;
|
// vtkIdType nbNodes = GetEntities( SMDSAbs_Node, aNodes );
|
||||||
for ( anIter = aNodes.begin(); anIter != aNodes.end(); ++anIter )
|
// thePoints->SetNumberOfPoints( nbNodes );
|
||||||
{
|
//
|
||||||
const SMDS_MeshNode* aNode = ( const SMDS_MeshNode* )(*anIter);
|
// int nbPoints = 0;
|
||||||
if ( aNode != 0 )
|
//
|
||||||
{
|
// TEntityList::const_iterator anIter;
|
||||||
thePoints->SetPoint( nbPoints, aNode->X(), aNode->Y(), aNode->Z() );
|
// for ( anIter = aNodes.begin(); anIter != aNodes.end(); ++anIter )
|
||||||
int anId = aNode->GetID();
|
// {
|
||||||
mySMDS2VTKNodes.insert( TMapOfIds::value_type( anId, nbPoints ) );
|
// const SMDS_MeshNode* aNode = ( const SMDS_MeshNode* )(*anIter);
|
||||||
myVTK2SMDSNodes.insert( TMapOfIds::value_type( nbPoints, anId ) );
|
// if ( aNode != 0 )
|
||||||
nbPoints++;
|
// {
|
||||||
}
|
// thePoints->SetPoint( nbPoints, aNode->X(), aNode->Y(), aNode->Z() );
|
||||||
}
|
// int anId = aNode->GetID();
|
||||||
|
// mySMDS2VTKNodes.insert( TMapOfIds::value_type( anId, nbPoints ) );
|
||||||
if ( nbPoints != nbNodes )
|
// myVTK2SMDSNodes.insert( TMapOfIds::value_type( nbPoints, anId ) );
|
||||||
thePoints->SetNumberOfPoints( nbPoints );
|
// nbPoints++;
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if ( nbPoints != nbNodes )
|
||||||
|
// thePoints->SetNumberOfPoints( nbPoints );
|
||||||
|
//}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : buildPrs
|
// function : buildPrs
|
||||||
@ -208,29 +213,30 @@ void SMESH_VisualObjDef::createPoints( vtkPoints* thePoints )
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESH_VisualObjDef::buildPrs()
|
void SMESH_VisualObjDef::buildPrs()
|
||||||
{
|
{
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
mySMDS2VTKNodes.clear();
|
// mySMDS2VTKNodes.clear();
|
||||||
myVTK2SMDSNodes.clear();
|
// myVTK2SMDSNodes.clear();
|
||||||
mySMDS2VTKElems.clear();
|
// mySMDS2VTKElems.clear();
|
||||||
myVTK2SMDSElems.clear();
|
// myVTK2SMDSElems.clear();
|
||||||
|
//
|
||||||
if ( IsNodePrs() )
|
// if ( IsNodePrs() )
|
||||||
buildNodePrs();
|
// buildNodePrs();
|
||||||
else
|
// else
|
||||||
buildElemPrs();
|
// buildElemPrs();
|
||||||
}
|
// }
|
||||||
catch(...)
|
// catch(...)
|
||||||
{
|
// {
|
||||||
mySMDS2VTKNodes.clear();
|
// mySMDS2VTKNodes.clear();
|
||||||
myVTK2SMDSNodes.clear();
|
// myVTK2SMDSNodes.clear();
|
||||||
mySMDS2VTKElems.clear();
|
// mySMDS2VTKElems.clear();
|
||||||
myVTK2SMDSElems.clear();
|
// myVTK2SMDSElems.clear();
|
||||||
|
//
|
||||||
myGrid->SetPoints( 0 );
|
// myGrid->SetPoints( 0 );
|
||||||
myGrid->SetCells( 0, 0, 0 );
|
// myGrid->SetCells( 0, 0, 0 );
|
||||||
throw;
|
// throw;
|
||||||
}
|
// }
|
||||||
|
myGrid = GetMesh()->getGrid();
|
||||||
|
|
||||||
if( MYDEBUG ) MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() );
|
if( MYDEBUG ) MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() );
|
||||||
if( MYDEBUGWITHFILES ) SMESH::WriteUnstructuredGrid( myGrid,"/tmp/buildPrs" );
|
if( MYDEBUGWITHFILES ) SMESH::WriteUnstructuredGrid( myGrid,"/tmp/buildPrs" );
|
||||||
@ -240,19 +246,20 @@ void SMESH_VisualObjDef::buildPrs()
|
|||||||
// function : buildNodePrs
|
// function : buildNodePrs
|
||||||
// purpose : create VTK cells for nodes
|
// purpose : create VTK cells for nodes
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESH_VisualObjDef::buildNodePrs()
|
|
||||||
{
|
|
||||||
// PAL16631: without swap, bad_alloc is not thrown but hung up and crash instead,
|
|
||||||
// so check remaining memory size for safety
|
|
||||||
SMDS_Mesh::CheckMemory(); // PAL16631
|
|
||||||
vtkPoints* aPoints = vtkPoints::New();
|
|
||||||
createPoints( aPoints );
|
|
||||||
SMDS_Mesh::CheckMemory();
|
|
||||||
myGrid->SetPoints( aPoints );
|
|
||||||
aPoints->Delete();
|
|
||||||
|
|
||||||
myGrid->SetCells( 0, 0, 0 );
|
//void SMESH_VisualObjDef::buildNodePrs()
|
||||||
}
|
//{
|
||||||
|
// // PAL16631: without swap, bad_alloc is not thrown but hung up and crash instead,
|
||||||
|
// // so check remaining memory size for safety
|
||||||
|
// SMDS_Mesh::CheckMemory(); // PAL16631
|
||||||
|
// vtkPoints* aPoints = vtkPoints::New();
|
||||||
|
// createPoints( aPoints );
|
||||||
|
// SMDS_Mesh::CheckMemory();
|
||||||
|
// myGrid->SetPoints( aPoints );
|
||||||
|
// aPoints->Delete();
|
||||||
|
//
|
||||||
|
// myGrid->SetCells( 0, 0, 0 );
|
||||||
|
//}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : buildElemPrs
|
// function : buildElemPrs
|
||||||
@ -284,199 +291,199 @@ namespace{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SMESH_VisualObjDef::buildElemPrs()
|
//void SMESH_VisualObjDef::buildElemPrs()
|
||||||
{
|
//{
|
||||||
// Create points
|
// // Create points
|
||||||
|
//
|
||||||
vtkPoints* aPoints = vtkPoints::New();
|
// vtkPoints* aPoints = vtkPoints::New();
|
||||||
createPoints( aPoints );
|
// createPoints( aPoints );
|
||||||
myGrid->SetPoints( aPoints );
|
// myGrid->SetPoints( aPoints );
|
||||||
aPoints->Delete();
|
// aPoints->Delete();
|
||||||
|
//
|
||||||
if ( MYDEBUG )
|
// if ( MYDEBUG )
|
||||||
MESSAGE("Update - myGrid->GetNumberOfPoints() = "<<myGrid->GetNumberOfPoints());
|
// MESSAGE("Update - myGrid->GetNumberOfPoints() = "<<myGrid->GetNumberOfPoints());
|
||||||
|
//
|
||||||
// Calculate cells size
|
// // Calculate cells size
|
||||||
|
//
|
||||||
static SMDSAbs_ElementType aTypes[ 4 ] =
|
// static SMDSAbs_ElementType aTypes[ 4 ] =
|
||||||
{ SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume };
|
// { SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume };
|
||||||
|
//
|
||||||
// get entity data
|
// // get entity data
|
||||||
map<SMDSAbs_ElementType,int> nbEnts;
|
// map<SMDSAbs_ElementType,int> nbEnts;
|
||||||
map<SMDSAbs_ElementType,TEntityList> anEnts;
|
// map<SMDSAbs_ElementType,TEntityList> anEnts;
|
||||||
|
//
|
||||||
for ( int i = 0; i <= 3; i++ )
|
// for ( int i = 0; i <= 3; i++ )
|
||||||
nbEnts[ aTypes[ i ] ] = GetEntities( aTypes[ i ], anEnts[ aTypes[ i ] ] );
|
// nbEnts[ aTypes[ i ] ] = GetEntities( aTypes[ i ], anEnts[ aTypes[ i ] ] );
|
||||||
|
//
|
||||||
// PAL16631: without swap, bad_alloc is not thrown but hung up and crash instead,
|
// // PAL16631: without swap, bad_alloc is not thrown but hung up and crash instead,
|
||||||
// so check remaining memory size for safety
|
// // so check remaining memory size for safety
|
||||||
SMDS_Mesh::CheckMemory(); // PAL16631
|
// SMDS_Mesh::CheckMemory(); // PAL16631
|
||||||
|
//
|
||||||
vtkIdType aCellsSize = 2 * nbEnts[ SMDSAbs_0DElement ] + 3 * nbEnts[ SMDSAbs_Edge ];
|
// vtkIdType aCellsSize = 2 * nbEnts[ SMDSAbs_0DElement ] + 3 * nbEnts[ SMDSAbs_Edge ];
|
||||||
|
//
|
||||||
for ( int i = 2; i <= 3; i++ ) // iterate through faces and volumes
|
// for ( int i = 2; i <= 3; i++ ) // iterate through faces and volumes
|
||||||
{
|
// {
|
||||||
if ( nbEnts[ aTypes[ i ] ] )
|
// if ( nbEnts[ aTypes[ i ] ] )
|
||||||
{
|
// {
|
||||||
const TEntityList& aList = anEnts[ aTypes[ i ] ];
|
// const TEntityList& aList = anEnts[ aTypes[ i ] ];
|
||||||
TEntityList::const_iterator anIter;
|
// TEntityList::const_iterator anIter;
|
||||||
for ( anIter = aList.begin(); anIter != aList.end(); ++anIter )
|
// for ( anIter = aList.begin(); anIter != aList.end(); ++anIter )
|
||||||
aCellsSize += (*anIter)->NbNodes() + 1;
|
// aCellsSize += (*anIter)->NbNodes() + 1;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
vtkIdType aNbCells = nbEnts[ SMDSAbs_0DElement ] + nbEnts[ SMDSAbs_Edge ] +
|
// vtkIdType aNbCells = nbEnts[ SMDSAbs_0DElement ] + nbEnts[ SMDSAbs_Edge ] +
|
||||||
nbEnts[ SMDSAbs_Face ] + nbEnts[ SMDSAbs_Volume ];
|
// nbEnts[ SMDSAbs_Face ] + nbEnts[ SMDSAbs_Volume ];
|
||||||
|
//
|
||||||
if ( MYDEBUG )
|
// if ( MYDEBUG )
|
||||||
MESSAGE( "Update - aNbCells = "<<aNbCells<<"; aCellsSize = "<<aCellsSize );
|
// MESSAGE( "Update - aNbCells = "<<aNbCells<<"; aCellsSize = "<<aCellsSize );
|
||||||
|
//
|
||||||
// Create cells
|
// // Create cells
|
||||||
|
//
|
||||||
vtkCellArray* aConnectivity = vtkCellArray::New();
|
// vtkCellArray* aConnectivity = vtkCellArray::New();
|
||||||
aConnectivity->Allocate( aCellsSize, 0 );
|
// aConnectivity->Allocate( aCellsSize, 0 );
|
||||||
|
//
|
||||||
SMDS_Mesh::CheckMemory(); // PAL16631
|
// SMDS_Mesh::CheckMemory(); // PAL16631
|
||||||
|
//
|
||||||
vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
|
// vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
|
||||||
aCellTypesArray->SetNumberOfComponents( 1 );
|
// aCellTypesArray->SetNumberOfComponents( 1 );
|
||||||
aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
|
// aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
|
||||||
|
//
|
||||||
SMDS_Mesh::CheckMemory(); // PAL16631
|
// SMDS_Mesh::CheckMemory(); // PAL16631
|
||||||
|
//
|
||||||
vtkIdList *anIdList = vtkIdList::New();
|
// vtkIdList *anIdList = vtkIdList::New();
|
||||||
vtkIdType iElem = 0;
|
// vtkIdType iElem = 0;
|
||||||
|
//
|
||||||
TConnect aConnect;
|
// TConnect aConnect;
|
||||||
aConnect.reserve(VTK_CELL_SIZE);
|
// aConnect.reserve(VTK_CELL_SIZE);
|
||||||
|
//
|
||||||
SMDS_Mesh::CheckMemory(); // PAL16631
|
// SMDS_Mesh::CheckMemory(); // PAL16631
|
||||||
|
//
|
||||||
for ( int i = 0; i <= 3; i++ ) // iterate through 0d elements, edges, faces and volumes
|
// for ( int i = 0; i <= 3; i++ ) // iterate through 0d elements, edges, faces and volumes
|
||||||
{
|
// {
|
||||||
if ( nbEnts[ aTypes[ i ] ] > 0 )
|
// if ( nbEnts[ aTypes[ i ] ] > 0 )
|
||||||
{
|
// {
|
||||||
const SMDSAbs_ElementType& aType = aTypes[ i ];
|
// const SMDSAbs_ElementType& aType = aTypes[ i ];
|
||||||
const TEntityList& aList = anEnts[ aType ];
|
// const TEntityList& aList = anEnts[ aType ];
|
||||||
TEntityList::const_iterator anIter;
|
// TEntityList::const_iterator anIter;
|
||||||
for ( anIter = aList.begin(); anIter != aList.end(); ++anIter )
|
// for ( anIter = aList.begin(); anIter != aList.end(); ++anIter )
|
||||||
{
|
// {
|
||||||
const SMDS_MeshElement* anElem = *anIter;
|
// const SMDS_MeshElement* anElem = *anIter;
|
||||||
|
//
|
||||||
vtkIdType aNbNodes = anElem->NbNodes();
|
// vtkIdType aNbNodes = anElem->NbNodes();
|
||||||
anIdList->SetNumberOfIds( aNbNodes );
|
// anIdList->SetNumberOfIds( aNbNodes );
|
||||||
|
//
|
||||||
int anId = anElem->GetID();
|
// int anId = anElem->GetID();
|
||||||
|
//
|
||||||
mySMDS2VTKElems.insert( TMapOfIds::value_type( anId, iElem ) );
|
// mySMDS2VTKElems.insert( TMapOfIds::value_type( anId, iElem ) );
|
||||||
myVTK2SMDSElems.insert( TMapOfIds::value_type( iElem, anId ) );
|
// myVTK2SMDSElems.insert( TMapOfIds::value_type( iElem, anId ) );
|
||||||
|
//
|
||||||
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
|
// SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
|
||||||
switch (aType) {
|
// switch (aType) {
|
||||||
case SMDSAbs_Volume:{
|
// case SMDSAbs_Volume:{
|
||||||
aConnect.clear();
|
// aConnect.clear();
|
||||||
std::vector<int> aConnectivities;
|
// std::vector<int> aConnectivities;
|
||||||
// Convertions connectivities from SMDS to VTK
|
// // Convertions connectivities from SMDS to VTK
|
||||||
if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
|
// if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
|
||||||
|
//
|
||||||
if ( const SMDS_PolyhedralVolumeOfNodes* ph =
|
// if ( const SMDS_PolyhedralVolumeOfNodes* ph =
|
||||||
dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem))
|
// dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem))
|
||||||
{
|
// {
|
||||||
aNbNodes = GetConnect(ph->uniqueNodesIterator(),aConnect);
|
// aNbNodes = GetConnect(ph->uniqueNodesIterator(),aConnect);
|
||||||
anIdList->SetNumberOfIds( aNbNodes );
|
// anIdList->SetNumberOfIds( aNbNodes );
|
||||||
}
|
// }
|
||||||
for (int k = 0; k < aNbNodes; k++)
|
// for (int k = 0; k < aNbNodes; k++)
|
||||||
aConnectivities.push_back(k);
|
// aConnectivities.push_back(k);
|
||||||
|
//
|
||||||
} else if (aNbNodes == 4) {
|
// } else if (aNbNodes == 4) {
|
||||||
static int anIds[] = {0,2,1,3};
|
// static int anIds[] = {0,2,1,3};
|
||||||
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
// for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
||||||
|
//
|
||||||
} else if (aNbNodes == 5) {
|
// } else if (aNbNodes == 5) {
|
||||||
static int anIds[] = {0,3,2,1,4};
|
// static int anIds[] = {0,3,2,1,4};
|
||||||
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
// for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
||||||
|
//
|
||||||
} else if (aNbNodes == 6) {
|
// } else if (aNbNodes == 6) {
|
||||||
static int anIds[] = {0,1,2,3,4,5};
|
// static int anIds[] = {0,1,2,3,4,5};
|
||||||
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
// for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
else if (aNbNodes == 8) {
|
// else if (aNbNodes == 8) {
|
||||||
static int anIds[] = {0,3,2,1,4,7,6,5};
|
// static int anIds[] = {0,3,2,1,4,7,6,5};
|
||||||
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
// for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
else if (aNbNodes == 10) {
|
// else if (aNbNodes == 10) {
|
||||||
static int anIds[] = {0,2,1,3,6,5,4,7,9,8};
|
// static int anIds[] = {0,2,1,3,6,5,4,7,9,8};
|
||||||
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
// for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
||||||
}
|
// }
|
||||||
else if (aNbNodes == 13) {
|
// else if (aNbNodes == 13) {
|
||||||
static int anIds[] = {0,3,2,1,4,8,7,6,5,9,12,11,10};
|
// static int anIds[] = {0,3,2,1,4,8,7,6,5,9,12,11,10};
|
||||||
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
// for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
||||||
}
|
// }
|
||||||
else if (aNbNodes == 15) {
|
// else if (aNbNodes == 15) {
|
||||||
//static int anIds[] = {0,2,1,3,5,4,8,7,6,11,10,9,12,14,13};
|
// //static int anIds[] = {0,2,1,3,5,4,8,7,6,11,10,9,12,14,13};
|
||||||
static int anIds[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
|
// static int anIds[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
|
||||||
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
// for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
||||||
//for (int k = 0; k < aNbNodes; k++) {
|
// //for (int k = 0; k < aNbNodes; k++) {
|
||||||
// int nn = aConnectivities[k];
|
// // int nn = aConnectivities[k];
|
||||||
// const SMDS_MeshNode* N = static_cast<const SMDS_MeshNode*> (aConnect[nn]);
|
// // const SMDS_MeshNode* N = static_cast<const SMDS_MeshNode*> (aConnect[nn]);
|
||||||
// cout<<"k="<<k<<" N("<<N->X()<<","<<N->Y()<<","<<N->Z()<<")"<<endl;
|
// // cout<<"k="<<k<<" N("<<N->X()<<","<<N->Y()<<","<<N->Z()<<")"<<endl;
|
||||||
//}
|
// //}
|
||||||
}
|
// }
|
||||||
else if (aNbNodes == 20) {
|
// else if (aNbNodes == 20) {
|
||||||
static int anIds[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17};
|
// static int anIds[] = {0,3,2,1,4,7,6,5,11,10,9,8,15,14,13,12,16,19,18,17};
|
||||||
for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
// for (int k = 0; k < aNbNodes; k++) aConnectivities.push_back(anIds[k]);
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if ( aConnect.empty() )
|
// if ( aConnect.empty() )
|
||||||
GetConnect(aNodesIter,aConnect);
|
// GetConnect(aNodesIter,aConnect);
|
||||||
|
//
|
||||||
if (aConnectivities.size() > 0) {
|
// if (aConnectivities.size() > 0) {
|
||||||
for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++)
|
// for (vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++)
|
||||||
SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]);
|
// SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]);
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
default:
|
// default:
|
||||||
for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ ){
|
// for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ ){
|
||||||
const SMDS_MeshElement* aNode = aNodesIter->next();
|
// const SMDS_MeshElement* aNode = aNodesIter->next();
|
||||||
anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] );
|
// anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
aConnectivity->InsertNextCell( anIdList );
|
// aConnectivity->InsertNextCell( anIdList );
|
||||||
aCellTypesArray->InsertNextValue( getCellType( aType, anElem->IsPoly(), aNbNodes ) );
|
// aCellTypesArray->InsertNextValue( getCellType( aType, anElem->IsPoly(), aNbNodes ) );
|
||||||
|
//
|
||||||
iElem++;
|
// iElem++;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
SMDS_Mesh::CheckMemory(); // PAL16631
|
// SMDS_Mesh::CheckMemory(); // PAL16631
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// Insert cells in grid
|
// // Insert cells in grid
|
||||||
|
//
|
||||||
VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
|
// VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
|
||||||
aCellLocationsArray->SetNumberOfComponents( 1 );
|
// aCellLocationsArray->SetNumberOfComponents( 1 );
|
||||||
aCellLocationsArray->SetNumberOfTuples( aNbCells );
|
// aCellLocationsArray->SetNumberOfTuples( aNbCells );
|
||||||
|
//
|
||||||
SMDS_Mesh::CheckMemory(); // PAL16631
|
// SMDS_Mesh::CheckMemory(); // PAL16631
|
||||||
|
//
|
||||||
aConnectivity->InitTraversal();
|
// aConnectivity->InitTraversal();
|
||||||
for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
|
// for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
|
||||||
aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
|
// aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
|
||||||
|
//
|
||||||
myGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
|
// myGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
|
||||||
|
//
|
||||||
aCellLocationsArray->Delete();
|
// aCellLocationsArray->Delete();
|
||||||
aCellTypesArray->Delete();
|
// aCellTypesArray->Delete();
|
||||||
aConnectivity->Delete();
|
// aConnectivity->Delete();
|
||||||
anIdList->Delete();
|
// anIdList->Delete();
|
||||||
|
//
|
||||||
SMDS_Mesh::CheckMemory(); // PAL16631
|
// SMDS_Mesh::CheckMemory(); // PAL16631
|
||||||
}
|
//}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : GetEdgeNodes
|
// function : GetEdgeNodes
|
||||||
|
@ -85,17 +85,17 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void createPoints( vtkPoints* );
|
// void createPoints( vtkPoints* );
|
||||||
void buildPrs();
|
void buildPrs();
|
||||||
void buildNodePrs();
|
// void buildNodePrs();
|
||||||
void buildElemPrs();
|
// void buildElemPrs();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
TMapOfIds mySMDS2VTKNodes;
|
// TMapOfIds mySMDS2VTKNodes;
|
||||||
TMapOfIds myVTK2SMDSNodes;
|
// TMapOfIds myVTK2SMDSNodes;
|
||||||
TMapOfIds mySMDS2VTKElems;
|
// TMapOfIds mySMDS2VTKElems;
|
||||||
TMapOfIds myVTK2SMDSElems;
|
// TMapOfIds myVTK2SMDSElems;
|
||||||
|
|
||||||
vtkUnstructuredGrid* myGrid;
|
vtkUnstructuredGrid* myGrid;
|
||||||
};
|
};
|
||||||
|
@ -29,6 +29,7 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
|||||||
|
|
||||||
# header files
|
# header files
|
||||||
salomeinclude_HEADERS = \
|
salomeinclude_HEADERS = \
|
||||||
|
ObjectPool.hxx \
|
||||||
SMDS_TypeOfPosition.hxx \
|
SMDS_TypeOfPosition.hxx \
|
||||||
SMDSAbs_ElementType.hxx \
|
SMDSAbs_ElementType.hxx \
|
||||||
SMDS_EdgePosition.hxx \
|
SMDS_EdgePosition.hxx \
|
||||||
@ -36,10 +37,12 @@ salomeinclude_HEADERS = \
|
|||||||
SMDS_FacePosition.hxx \
|
SMDS_FacePosition.hxx \
|
||||||
SMDS_Mesh.hxx \
|
SMDS_Mesh.hxx \
|
||||||
SMDS_Mesh0DElement.hxx \
|
SMDS_Mesh0DElement.hxx \
|
||||||
|
SMDS_LinearEdge.hxx \
|
||||||
SMDS_MeshEdge.hxx \
|
SMDS_MeshEdge.hxx \
|
||||||
SMDS_MeshElement.hxx \
|
SMDS_MeshElement.hxx \
|
||||||
SMDS_MeshElement.cxx \
|
SMDS_MeshElement.cxx \
|
||||||
SMDS_MeshElementIDFactory.hxx \
|
SMDS_MeshElementIDFactory.hxx \
|
||||||
|
SMDS_MeshCell.hxx \
|
||||||
SMDS_MeshFace.hxx \
|
SMDS_MeshFace.hxx \
|
||||||
SMDS_MeshGroup.hxx \
|
SMDS_MeshGroup.hxx \
|
||||||
SMDS_MeshIDFactory.hxx \
|
SMDS_MeshIDFactory.hxx \
|
||||||
@ -54,6 +57,8 @@ salomeinclude_HEADERS = \
|
|||||||
SMDS_IteratorOfElements.hxx \
|
SMDS_IteratorOfElements.hxx \
|
||||||
SMDS_VolumeOfFaces.hxx \
|
SMDS_VolumeOfFaces.hxx \
|
||||||
SMDS_VolumeOfNodes.hxx \
|
SMDS_VolumeOfNodes.hxx \
|
||||||
|
SMDS_VtkEdge.hxx \
|
||||||
|
SMDS_VtkFace.hxx \
|
||||||
SMDS_VtkVolume.hxx \
|
SMDS_VtkVolume.hxx \
|
||||||
SMDS_VtkCellIterator.hxx \
|
SMDS_VtkCellIterator.hxx \
|
||||||
SMDS_PolyhedralVolumeOfNodes.hxx \
|
SMDS_PolyhedralVolumeOfNodes.hxx \
|
||||||
@ -83,6 +88,7 @@ dist_libSMDS_la_SOURCES = \
|
|||||||
SMDS_VertexPosition.cxx \
|
SMDS_VertexPosition.cxx \
|
||||||
SMDS_MeshNode.cxx \
|
SMDS_MeshNode.cxx \
|
||||||
SMDS_Mesh0DElement.cxx \
|
SMDS_Mesh0DElement.cxx \
|
||||||
|
SMDS_LinearEdge.cxx \
|
||||||
SMDS_MeshEdge.cxx \
|
SMDS_MeshEdge.cxx \
|
||||||
SMDS_MeshFace.cxx \
|
SMDS_MeshFace.cxx \
|
||||||
SMDS_MeshVolume.cxx \
|
SMDS_MeshVolume.cxx \
|
||||||
@ -94,6 +100,8 @@ dist_libSMDS_la_SOURCES = \
|
|||||||
SMDS_IteratorOfElements.cxx \
|
SMDS_IteratorOfElements.cxx \
|
||||||
SMDS_VolumeOfFaces.cxx \
|
SMDS_VolumeOfFaces.cxx \
|
||||||
SMDS_VolumeOfNodes.cxx \
|
SMDS_VolumeOfNodes.cxx \
|
||||||
|
SMDS_VtkEdge.cxx \
|
||||||
|
SMDS_VtkFace.cxx \
|
||||||
SMDS_VtkVolume.cxx \
|
SMDS_VtkVolume.cxx \
|
||||||
SMDS_VtkCellIterator.cxx \
|
SMDS_VtkCellIterator.cxx \
|
||||||
SMDS_PolyhedralVolumeOfNodes.cxx \
|
SMDS_PolyhedralVolumeOfNodes.cxx \
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
#ifndef _OBJECTPOOL_HXX_
|
#ifndef _OBJECTPOOL_HXX_
|
||||||
#define _OBJECTPOOL_HXX_
|
#define _OBJECTPOOL_HXX_
|
||||||
|
|
||||||
@ -6,7 +5,7 @@
|
|||||||
#include <stack>
|
#include <stack>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
template <class X> class ObjectPool
|
template<class X> class ObjectPool
|
||||||
{
|
{
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -18,20 +17,20 @@ private:
|
|||||||
|
|
||||||
int getNextFree()
|
int getNextFree()
|
||||||
{
|
{
|
||||||
for (int i=_nextFree; i< _maxAvail; i++)
|
for (int i = _nextFree; i < _maxAvail; i++)
|
||||||
if (_freeList[i] == true)
|
if (_freeList[i] == true)
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return _maxAvail;
|
return _maxAvail;
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkDelete(int chunkId)
|
void checkDelete(int chunkId)
|
||||||
{
|
{
|
||||||
int i0 = _chunkSize*chunkId;
|
int i0 = _chunkSize * chunkId;
|
||||||
int i1 =_chunkSize*(chunkId+1);
|
int i1 = _chunkSize * (chunkId + 1);
|
||||||
for (int i=i0; i < i1; i++)
|
for (int i = i0; i < i1; i++)
|
||||||
if (_freeList[i] == false)
|
if (_freeList[i] == false)
|
||||||
return;
|
return;
|
||||||
std::cerr << "a chunk to delete" << std::endl;
|
std::cerr << "a chunk to delete" << std::endl;
|
||||||
@ -52,8 +51,8 @@ public:
|
|||||||
|
|
||||||
virtual ~ObjectPool()
|
virtual ~ObjectPool()
|
||||||
{
|
{
|
||||||
for (int i=0; i<_chunkList.size(); i++)
|
for (int i = 0; i < _chunkList.size(); i++)
|
||||||
delete [] _chunkList[i];
|
delete[] _chunkList[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
X* getNew()
|
X* getNew()
|
||||||
@ -61,45 +60,56 @@ public:
|
|||||||
X *obj = 0;
|
X *obj = 0;
|
||||||
_nextFree = getNextFree();
|
_nextFree = getNextFree();
|
||||||
if (_nextFree == _maxAvail)
|
if (_nextFree == _maxAvail)
|
||||||
{
|
{
|
||||||
X* newChunk = new X[_chunkSize];
|
X* newChunk = new X[_chunkSize];
|
||||||
_chunkList.push_back(newChunk);
|
_chunkList.push_back(newChunk);
|
||||||
_freeList.insert(_freeList.end(), _chunkSize, true);
|
_freeList.insert(_freeList.end(), _chunkSize, true);
|
||||||
_maxAvail += _chunkSize;
|
_maxAvail += _chunkSize;
|
||||||
_freeList[_nextFree] = false;
|
_freeList[_nextFree] = false;
|
||||||
obj = newChunk; // &newChunk[0];
|
obj = newChunk; // &newChunk[0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int chunkId = _nextFree/_chunkSize;
|
int chunkId = _nextFree / _chunkSize;
|
||||||
int rank = _nextFree - chunkId*_chunkSize;
|
int rank = _nextFree - chunkId * _chunkSize;
|
||||||
_freeList[_nextFree] = false;
|
_freeList[_nextFree] = false;
|
||||||
obj = _chunkList[chunkId] + rank; // &_chunkList[chunkId][rank];
|
obj = _chunkList[chunkId] + rank; // &_chunkList[chunkId][rank];
|
||||||
}
|
}
|
||||||
//obj->init();
|
//obj->init();
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroy(X* obj)
|
void destroy(X* obj)
|
||||||
{
|
{
|
||||||
long adrobj = (long)(obj);
|
long adrobj = (long) (obj);
|
||||||
for (int i=0; i< _chunkList.size(); i++)
|
for (int i = 0; i < _chunkList.size(); i++)
|
||||||
{
|
{
|
||||||
X* chunk = _chunkList[i];
|
X* chunk = _chunkList[i];
|
||||||
long adrmin = (long)(chunk);
|
long adrmin = (long) (chunk);
|
||||||
if (adrobj < adrmin) continue;
|
if (adrobj < adrmin)
|
||||||
long adrmax = (long)(chunk + _chunkSize);
|
continue;
|
||||||
if (adrobj >= adrmax) continue;
|
long adrmax = (long) (chunk + _chunkSize);
|
||||||
int rank = (adrobj -adrmin)/sizeof(X);
|
if (adrobj >= adrmax)
|
||||||
int toFree = i*_chunkSize + rank;
|
continue;
|
||||||
|
int rank = (adrobj - adrmin) / sizeof(X);
|
||||||
|
int toFree = i * _chunkSize + rank;
|
||||||
_freeList[toFree] = true;
|
_freeList[toFree] = true;
|
||||||
if (toFree < _nextFree) _nextFree = toFree;
|
if (toFree < _nextFree)
|
||||||
|
_nextFree = toFree;
|
||||||
//obj->clean();
|
//obj->clean();
|
||||||
//checkDelete(i); compactage non fait
|
//checkDelete(i); compactage non fait
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// void destroy(int toFree)
|
||||||
|
// {
|
||||||
|
// // no control 0<= toFree < _freeList.size()
|
||||||
|
// _freeList[toFree] = true;
|
||||||
|
// if (toFree < _nextFree)
|
||||||
|
// _nextFree = toFree;
|
||||||
|
// }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -46,7 +46,7 @@ class SMDS_EXPORT SMDS_FaceOfEdges:public SMDS_MeshFace
|
|||||||
const SMDS_MeshEdge* edge4);
|
const SMDS_MeshEdge* edge4);
|
||||||
|
|
||||||
SMDSAbs_ElementType GetType() const;
|
SMDSAbs_ElementType GetType() const;
|
||||||
virtual SMDSAbs_EntityType GetEntityType() const;
|
virtual SMDSAbs_EntityType GetEntityType() const;
|
||||||
int NbNodes() const;
|
int NbNodes() const;
|
||||||
int NbEdges() const;
|
int NbEdges() const;
|
||||||
int NbFaces() const;
|
int NbFaces() const;
|
||||||
|
155
src/SMDS/SMDS_LinearEdge.cxx
Normal file
155
src/SMDS/SMDS_LinearEdge.cxx
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
// Copyright (C) 2007-2008 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
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
//
|
||||||
|
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||||
|
// File : SMDS_LinearEdge.cxx
|
||||||
|
// Author : Jean-Michel BOULCOURT
|
||||||
|
// Module : SMESH
|
||||||
|
//
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(disable:4786)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "SMDS_LinearEdge.hxx"
|
||||||
|
#include "SMDS_IteratorOfElements.hxx"
|
||||||
|
#include "SMDS_MeshNode.hxx"
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SMDS_LinearEdge
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
SMDS_LinearEdge::SMDS_LinearEdge(const SMDS_MeshNode * node1,
|
||||||
|
const SMDS_MeshNode * node2)
|
||||||
|
{
|
||||||
|
//MESSAGE("SMDS_LinearEdge " << GetID());
|
||||||
|
myNodes[0]=node1;
|
||||||
|
myNodes[1]=node2;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Print
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
void SMDS_LinearEdge::Print(ostream & OS) const
|
||||||
|
{
|
||||||
|
OS << "edge <" << GetID() << "> : (" << myNodes[0] << " , " << myNodes[1] <<
|
||||||
|
") " << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SMDS_LinearEdge::NbNodes() const
|
||||||
|
{
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SMDS_LinearEdge::NbEdges() const
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
class SMDS_LinearEdge_MyNodeIterator:public SMDS_ElemIterator
|
||||||
|
{
|
||||||
|
const SMDS_MeshNode *const* myNodes;
|
||||||
|
int myIndex;
|
||||||
|
public:
|
||||||
|
SMDS_LinearEdge_MyNodeIterator(const SMDS_MeshNode * const* nodes):
|
||||||
|
myNodes(nodes),myIndex(0) {}
|
||||||
|
|
||||||
|
bool more()
|
||||||
|
{
|
||||||
|
return myIndex<2;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SMDS_MeshElement* next()
|
||||||
|
{
|
||||||
|
myIndex++;
|
||||||
|
return myNodes[myIndex-1];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
SMDS_ElemIteratorPtr SMDS_LinearEdge::
|
||||||
|
elementsIterator(SMDSAbs_ElementType type) const
|
||||||
|
{
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case SMDSAbs_Edge:
|
||||||
|
return SMDS_MeshElement::elementsIterator(SMDSAbs_Edge);
|
||||||
|
case SMDSAbs_Node:
|
||||||
|
return SMDS_ElemIteratorPtr(new SMDS_LinearEdge_MyNodeIterator(myNodes));
|
||||||
|
default:
|
||||||
|
return SMDS_ElemIteratorPtr
|
||||||
|
(new SMDS_IteratorOfElements
|
||||||
|
(this,type, SMDS_ElemIteratorPtr(new SMDS_LinearEdge_MyNodeIterator(myNodes))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator<(const SMDS_LinearEdge & e1, const SMDS_LinearEdge & e2)
|
||||||
|
{
|
||||||
|
int id11=e1.myNodes[0]->GetID();
|
||||||
|
int id21=e2.myNodes[0]->GetID();
|
||||||
|
int id12=e1.myNodes[1]->GetID();
|
||||||
|
int id22=e2.myNodes[1]->GetID();
|
||||||
|
int tmp;
|
||||||
|
|
||||||
|
if(id11>=id12)
|
||||||
|
{
|
||||||
|
tmp=id11;
|
||||||
|
id11=id12;
|
||||||
|
id12=tmp;
|
||||||
|
}
|
||||||
|
if(id21>=id22)
|
||||||
|
{
|
||||||
|
tmp=id21;
|
||||||
|
id21=id22;
|
||||||
|
id22=tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(id11<id21) return true;
|
||||||
|
else if(id11==id21) return (id21<id22);
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*/
|
||||||
|
const SMDS_MeshNode* SMDS_LinearEdge::GetNode(const int ind) const
|
||||||
|
{
|
||||||
|
return myNodes[ ind ];
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : ChangeNodes
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
bool SMDS_LinearEdge::ChangeNodes(const SMDS_MeshNode * node1,
|
||||||
|
const SMDS_MeshNode * node2)
|
||||||
|
{
|
||||||
|
myNodes[0]=node1;
|
||||||
|
myNodes[1]=node2;
|
||||||
|
return true;
|
||||||
|
}
|
64
src/SMDS/SMDS_LinearEdge.hxx
Normal file
64
src/SMDS/SMDS_LinearEdge.hxx
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
// Copyright (C) 2007-2008 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
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
//
|
||||||
|
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||||
|
// File : SMDS_LinearEdge.hxx
|
||||||
|
// Module : SMESH
|
||||||
|
//
|
||||||
|
#ifndef _SMDS_LinearEdge_HeaderFile
|
||||||
|
#define _SMDS_LinearEdge_HeaderFile
|
||||||
|
|
||||||
|
#include "SMESH_SMDS.hxx"
|
||||||
|
|
||||||
|
#include "SMDS_MeshEdge.hxx"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
class SMDS_EXPORT SMDS_LinearEdge:public SMDS_MeshEdge
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
SMDS_LinearEdge(const SMDS_MeshNode * node1,
|
||||||
|
const SMDS_MeshNode * node2);
|
||||||
|
bool ChangeNodes(const SMDS_MeshNode * node1,
|
||||||
|
const SMDS_MeshNode * node2);
|
||||||
|
void Print(std::ostream & OS) const;
|
||||||
|
|
||||||
|
virtual SMDSAbs_EntityType GetEntityType() const { return SMDSEntity_Edge; }
|
||||||
|
int NbNodes() const;
|
||||||
|
int NbEdges() const;
|
||||||
|
friend bool operator<(const SMDS_LinearEdge& e1, const SMDS_LinearEdge& e2);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*/
|
||||||
|
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SMDS_ElemIteratorPtr
|
||||||
|
elementsIterator(SMDSAbs_ElementType type) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const SMDS_MeshNode* myNodes[3];
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
@ -48,7 +48,7 @@ using namespace std;
|
|||||||
#include <sys/sysinfo.h>
|
#include <sys/sysinfo.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// number of added entitis to check memory after
|
// number of added entities to check memory after
|
||||||
#define CHECKMEMORY_INTERVAL 1000
|
#define CHECKMEMORY_INTERVAL 1000
|
||||||
|
|
||||||
vector<SMDS_Mesh*> SMDS_Mesh::_meshList = vector<SMDS_Mesh*>();
|
vector<SMDS_Mesh*> SMDS_Mesh::_meshList = vector<SMDS_Mesh*>();
|
||||||
@ -116,7 +116,7 @@ SMDS_Mesh::SMDS_Mesh()
|
|||||||
myHasConstructionEdges(false), myHasConstructionFaces(false),
|
myHasConstructionEdges(false), myHasConstructionFaces(false),
|
||||||
myHasInverseElements(true),
|
myHasInverseElements(true),
|
||||||
myNodeMin(0), myNodeMax(0), myCellLinksSize(0),
|
myNodeMin(0), myNodeMax(0), myCellLinksSize(0),
|
||||||
myNodePool(0), myVolumePool(0)
|
myNodePool(0), myEdgePool(0), myFacePool(0), myVolumePool(0)
|
||||||
{
|
{
|
||||||
myMeshId = _meshList.size(); // --- index of the mesh to push back in the vector
|
myMeshId = _meshList.size(); // --- index of the mesh to push back in the vector
|
||||||
MESSAGE("myMeshId=" << myMeshId);
|
MESSAGE("myMeshId=" << myMeshId);
|
||||||
@ -130,6 +130,8 @@ SMDS_Mesh::SMDS_Mesh()
|
|||||||
myElementIDFactory->SetMesh(this);
|
myElementIDFactory->SetMesh(this);
|
||||||
_meshList.push_back(this);
|
_meshList.push_back(this);
|
||||||
myNodePool = new ObjectPool<SMDS_MeshNode>(SMDS_Mesh::chunkSize);
|
myNodePool = new ObjectPool<SMDS_MeshNode>(SMDS_Mesh::chunkSize);
|
||||||
|
myEdgePool = new ObjectPool<SMDS_VtkEdge>(SMDS_Mesh::chunkSize);
|
||||||
|
myFacePool = new ObjectPool<SMDS_VtkFace>(SMDS_Mesh::chunkSize);
|
||||||
myVolumePool = new ObjectPool<SMDS_VtkVolume>(SMDS_Mesh::chunkSize);
|
myVolumePool = new ObjectPool<SMDS_VtkVolume>(SMDS_Mesh::chunkSize);
|
||||||
|
|
||||||
myNodes.clear();
|
myNodes.clear();
|
||||||
@ -157,6 +159,8 @@ SMDS_Mesh::SMDS_Mesh(SMDS_Mesh * parent)
|
|||||||
myHasConstructionEdges(false), myHasConstructionFaces(false),
|
myHasConstructionEdges(false), myHasConstructionFaces(false),
|
||||||
myHasInverseElements(true),
|
myHasInverseElements(true),
|
||||||
myNodePool(parent->myNodePool),
|
myNodePool(parent->myNodePool),
|
||||||
|
myEdgePool(parent->myEdgePool),
|
||||||
|
myFacePool(parent->myFacePool),
|
||||||
myVolumePool(parent->myVolumePool)
|
myVolumePool(parent->myVolumePool)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -295,10 +299,17 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
|
|||||||
int ID)
|
int ID)
|
||||||
{
|
{
|
||||||
if ( !n1 || !n2 ) return 0;
|
if ( !n1 || !n2 ) return 0;
|
||||||
|
SMDS_MeshEdge * edge = 0;
|
||||||
|
|
||||||
//if ( myEdges.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
|
// --- retreive nodes ID
|
||||||
//MESSAGE("AddEdgeWithID " << ID)
|
vector<vtkIdType> nodeIds;
|
||||||
SMDS_MeshEdge * edge=new SMDS_MeshEdge(n1,n2);
|
nodeIds.clear();
|
||||||
|
nodeIds.push_back(n1->getId());
|
||||||
|
nodeIds.push_back(n2->getId());
|
||||||
|
|
||||||
|
SMDS_VtkEdge *edgevtk = myEdgePool->getNew();
|
||||||
|
edgevtk->init(nodeIds, this);
|
||||||
|
edge = edgevtk;
|
||||||
adjustmyCellsCapacity(ID);
|
adjustmyCellsCapacity(ID);
|
||||||
myCells[ID] = edge;
|
myCells[ID] = edge;
|
||||||
myInfo.myNbEdges++;
|
myInfo.myNbEdges++;
|
||||||
@ -346,7 +357,7 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
|
|||||||
int ID)
|
int ID)
|
||||||
{
|
{
|
||||||
//MESSAGE("AddFaceWithID " << ID)
|
//MESSAGE("AddFaceWithID " << ID)
|
||||||
SMDS_MeshFace * face=createTriangle(n1, n2, n3);
|
SMDS_MeshFace * face=createTriangle(n1, n2, n3, myElementIDFactory->GetFreeID());
|
||||||
|
|
||||||
if (face && !registerElement(ID, face)) {
|
if (face && !registerElement(ID, face)) {
|
||||||
RemoveElement(face, false);
|
RemoveElement(face, false);
|
||||||
@ -565,7 +576,17 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4);
|
// --- retrieve nodes ID
|
||||||
|
vector<vtkIdType> nodeIds;
|
||||||
|
nodeIds.clear();
|
||||||
|
nodeIds.push_back(n1->getId());
|
||||||
|
nodeIds.push_back(n3->getId()); // order SMDS-->VTK
|
||||||
|
nodeIds.push_back(n2->getId());
|
||||||
|
nodeIds.push_back(n4->getId());
|
||||||
|
|
||||||
|
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
||||||
|
volvtk->init(nodeIds, this);
|
||||||
|
volume = volvtk;
|
||||||
adjustmyCellsCapacity(ID);
|
adjustmyCellsCapacity(ID);
|
||||||
myCells[ID] = volume;
|
myCells[ID] = volume;
|
||||||
myInfo.myNbTetras++;
|
myInfo.myNbTetras++;
|
||||||
@ -656,7 +677,18 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4,n5);
|
// --- retrieve nodes ID
|
||||||
|
vector<vtkIdType> nodeIds;
|
||||||
|
nodeIds.clear();
|
||||||
|
nodeIds.push_back(n1->getId());
|
||||||
|
nodeIds.push_back(n4->getId());
|
||||||
|
nodeIds.push_back(n3->getId());
|
||||||
|
nodeIds.push_back(n2->getId());
|
||||||
|
nodeIds.push_back(n5->getId());
|
||||||
|
|
||||||
|
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
||||||
|
volvtk->init(nodeIds, this);
|
||||||
|
volume = volvtk;
|
||||||
adjustmyCellsCapacity(ID);
|
adjustmyCellsCapacity(ID);
|
||||||
myCells[ID] = volume;
|
myCells[ID] = volume;
|
||||||
myInfo.myNbPyramids++;
|
myInfo.myNbPyramids++;
|
||||||
@ -752,7 +784,19 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4,n5,n6);
|
// --- retrieve nodes ID
|
||||||
|
vector<vtkIdType> nodeIds;
|
||||||
|
nodeIds.clear();
|
||||||
|
nodeIds.push_back(n1->getId());
|
||||||
|
nodeIds.push_back(n3->getId());
|
||||||
|
nodeIds.push_back(n2->getId());
|
||||||
|
nodeIds.push_back(n4->getId());
|
||||||
|
nodeIds.push_back(n6->getId());
|
||||||
|
nodeIds.push_back(n5->getId());
|
||||||
|
|
||||||
|
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
||||||
|
volvtk->init(nodeIds, this);
|
||||||
|
volume = volvtk;
|
||||||
adjustmyCellsCapacity(ID);
|
adjustmyCellsCapacity(ID);
|
||||||
myCells[ID] = volume;
|
myCells[ID] = volume;
|
||||||
myInfo.myNbPrisms++;
|
myInfo.myNbPrisms++;
|
||||||
@ -860,17 +904,17 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// --- retreive nodes ID
|
// --- retrieve nodes ID
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
nodeIds.push_back(n1->getId());
|
nodeIds.push_back(n1->getId());
|
||||||
nodeIds.push_back(n2->getId());
|
|
||||||
nodeIds.push_back(n3->getId());
|
|
||||||
nodeIds.push_back(n4->getId());
|
nodeIds.push_back(n4->getId());
|
||||||
|
nodeIds.push_back(n3->getId());
|
||||||
|
nodeIds.push_back(n2->getId());
|
||||||
nodeIds.push_back(n5->getId());
|
nodeIds.push_back(n5->getId());
|
||||||
nodeIds.push_back(n6->getId());
|
|
||||||
nodeIds.push_back(n7->getId());
|
|
||||||
nodeIds.push_back(n8->getId());
|
nodeIds.push_back(n8->getId());
|
||||||
|
nodeIds.push_back(n7->getId());
|
||||||
|
nodeIds.push_back(n6->getId());
|
||||||
|
|
||||||
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
SMDS_VtkVolume *volvtk = myVolumePool->getNew();
|
||||||
volvtk->init(nodeIds, this);
|
volvtk->init(nodeIds, this);
|
||||||
@ -1174,7 +1218,7 @@ bool SMDS_Mesh::registerElement(int ID, SMDS_MeshElement* element)
|
|||||||
element->myMeshId = myMeshId;
|
element->myMeshId = myMeshId;
|
||||||
|
|
||||||
SMDS_MeshCell *cell = dynamic_cast<SMDS_MeshCell*>(element);
|
SMDS_MeshCell *cell = dynamic_cast<SMDS_MeshCell*>(element);
|
||||||
assert(cell);
|
MYASSERT(cell);
|
||||||
int vtkId = cell->getVtkId();
|
int vtkId = cell->getVtkId();
|
||||||
if (vtkId == -1)
|
if (vtkId == -1)
|
||||||
vtkId = myElementIDFactory->SetInVtkGrid(element);
|
vtkId = myElementIDFactory->SetInVtkGrid(element);
|
||||||
@ -1204,18 +1248,22 @@ bool SMDS_Mesh::registerElement(int ID, SMDS_MeshElement* element)
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
const SMDS_MeshNode * SMDS_Mesh::FindNode(int ID) const
|
const SMDS_MeshNode * SMDS_Mesh::FindNode(int ID) const
|
||||||
{
|
{
|
||||||
if (ID <0 || ID >= myNodes.size())
|
if (ID < 0 || ID >= myNodes.size())
|
||||||
return NULL;
|
{
|
||||||
|
MESSAGE("----------------------------------- bad ID " << ID << " " << myNodes.size());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return (const SMDS_MeshNode *)myNodes[ID];
|
return (const SMDS_MeshNode *)myNodes[ID];
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
///Create a triangle and add it to the current mesh. This methode do not bind a
|
///Create a triangle and add it to the current mesh. This method do not bind an
|
||||||
///ID to the create triangle.
|
///ID to the create triangle.
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
SMDS_MeshFace * SMDS_Mesh::createTriangle(const SMDS_MeshNode * node1,
|
SMDS_MeshFace * SMDS_Mesh::createTriangle(const SMDS_MeshNode * node1,
|
||||||
const SMDS_MeshNode * node2,
|
const SMDS_MeshNode * node2,
|
||||||
const SMDS_MeshNode * node3)
|
const SMDS_MeshNode * node3,
|
||||||
|
int ID)
|
||||||
{
|
{
|
||||||
if ( !node1 || !node2 || !node3) return 0;
|
if ( !node1 || !node2 || !node3) return 0;
|
||||||
// if ( myFaces.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
|
// if ( myFaces.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
|
||||||
@ -1226,7 +1274,7 @@ SMDS_MeshFace * SMDS_Mesh::createTriangle(const SMDS_MeshNode * node1,
|
|||||||
edge2=FindEdgeOrCreate(node2,node3);
|
edge2=FindEdgeOrCreate(node2,node3);
|
||||||
edge3=FindEdgeOrCreate(node3,node1);
|
edge3=FindEdgeOrCreate(node3,node1);
|
||||||
|
|
||||||
int ID = myElementIDFactory->GetFreeID(); // -PR- voir si on range cet element
|
//int ID = myElementIDFactory->GetFreeID(); // -PR- voir si on range cet element
|
||||||
SMDS_MeshFace * face = new SMDS_FaceOfEdges(edge1,edge2,edge3);
|
SMDS_MeshFace * face = new SMDS_FaceOfEdges(edge1,edge2,edge3);
|
||||||
adjustmyCellsCapacity(ID);
|
adjustmyCellsCapacity(ID);
|
||||||
myCells[ID] = face;
|
myCells[ID] = face;
|
||||||
@ -1235,8 +1283,17 @@ SMDS_MeshFace * SMDS_Mesh::createTriangle(const SMDS_MeshNode * node1,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int ID = myElementIDFactory->GetFreeID(); // -PR- voir si on range cet element
|
// --- retrieve nodes ID
|
||||||
SMDS_MeshFace * face = new SMDS_FaceOfNodes(node1,node2,node3);
|
vector<vtkIdType> nodeIds;
|
||||||
|
nodeIds.clear();
|
||||||
|
nodeIds.push_back(node1->getId());
|
||||||
|
nodeIds.push_back(node2->getId());
|
||||||
|
nodeIds.push_back(node3->getId());
|
||||||
|
|
||||||
|
SMDS_MeshFace * face = 0;
|
||||||
|
SMDS_VtkFace *facevtk = myFacePool->getNew();
|
||||||
|
facevtk->init(nodeIds, this);
|
||||||
|
face = facevtk;
|
||||||
adjustmyCellsCapacity(ID);
|
adjustmyCellsCapacity(ID);
|
||||||
myCells[ID] = face;
|
myCells[ID] = face;
|
||||||
myInfo.myNbTriangles++;
|
myInfo.myNbTriangles++;
|
||||||
@ -1273,8 +1330,18 @@ SMDS_MeshFace * SMDS_Mesh::createQuadrangle(const SMDS_MeshNode * node1,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//MESSAGE("createQuadrangle " << ID);
|
// --- retrieve nodes ID
|
||||||
SMDS_MeshFace * face = new SMDS_FaceOfNodes(node1,node2,node3,node4);
|
vector<vtkIdType> nodeIds;
|
||||||
|
nodeIds.clear();
|
||||||
|
nodeIds.push_back(node1->getId());
|
||||||
|
nodeIds.push_back(node2->getId());
|
||||||
|
nodeIds.push_back(node3->getId());
|
||||||
|
nodeIds.push_back(node4->getId());
|
||||||
|
|
||||||
|
SMDS_MeshFace * face = 0;
|
||||||
|
SMDS_VtkFace *facevtk = myFacePool->getNew();
|
||||||
|
facevtk->init(nodeIds, this);
|
||||||
|
face = facevtk;
|
||||||
adjustmyCellsCapacity(ID);
|
adjustmyCellsCapacity(ID);
|
||||||
myCells[ID] = face;
|
myCells[ID] = face;
|
||||||
myInfo.myNbQuadrangles++;
|
myInfo.myNbQuadrangles++;
|
||||||
@ -1375,6 +1442,7 @@ bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * element,
|
|||||||
const SMDS_MeshNode * nodes[],
|
const SMDS_MeshNode * nodes[],
|
||||||
const int nbnodes)
|
const int nbnodes)
|
||||||
{
|
{
|
||||||
|
MYASSERT(0); // REVOIR LES TYPES
|
||||||
// keep current nodes of elem
|
// keep current nodes of elem
|
||||||
set<const SMDS_MeshElement*> oldNodes;
|
set<const SMDS_MeshElement*> oldNodes;
|
||||||
SMDS_ElemIteratorPtr itn = element->nodesIterator();
|
SMDS_ElemIteratorPtr itn = element->nodesIterator();
|
||||||
@ -1396,7 +1464,7 @@ bool SMDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * element,
|
|||||||
}
|
}
|
||||||
case SMDSAbs_Edge: {
|
case SMDSAbs_Edge: {
|
||||||
if ( nbnodes == 2 ) {
|
if ( nbnodes == 2 ) {
|
||||||
if ( SMDS_MeshEdge* edge = dynamic_cast<SMDS_MeshEdge*>( elem ))
|
if ( SMDS_VtkEdge* edge = dynamic_cast<SMDS_VtkEdge*>( elem ))
|
||||||
Ok = edge->ChangeNodes( nodes[0], nodes[1] );
|
Ok = edge->ChangeNodes( nodes[0], nodes[1] );
|
||||||
}
|
}
|
||||||
else if ( nbnodes == 3 ) {
|
else if ( nbnodes == 3 ) {
|
||||||
@ -1610,7 +1678,14 @@ SMDS_MeshEdge* SMDS_Mesh::FindEdgeOrCreate(const SMDS_MeshNode * node1,
|
|||||||
//if ( myEdges.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
|
//if ( myEdges.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
|
||||||
int ID = myElementIDFactory->GetFreeID(); // -PR- voir si on range cet element
|
int ID = myElementIDFactory->GetFreeID(); // -PR- voir si on range cet element
|
||||||
adjustmyCellsCapacity(ID);
|
adjustmyCellsCapacity(ID);
|
||||||
toReturn=new SMDS_MeshEdge(node1,node2);
|
vector<vtkIdType> nodeIds;
|
||||||
|
nodeIds.clear();
|
||||||
|
nodeIds.push_back(node1->getId());
|
||||||
|
nodeIds.push_back(node2->getId());
|
||||||
|
|
||||||
|
SMDS_VtkEdge *edgevtk = myEdgePool->getNew();
|
||||||
|
edgevtk->init(nodeIds, this);
|
||||||
|
toReturn = edgevtk;
|
||||||
myCells[ID] = toReturn;
|
myCells[ID] = toReturn;
|
||||||
myInfo.myNbEdges++;
|
myInfo.myNbEdges++;
|
||||||
}
|
}
|
||||||
@ -1708,7 +1783,8 @@ SMDS_MeshFace* SMDS_Mesh::FindFaceOrCreate(const SMDS_MeshNode *node1,
|
|||||||
SMDS_MeshFace * toReturn=NULL;
|
SMDS_MeshFace * toReturn=NULL;
|
||||||
toReturn = const_cast<SMDS_MeshFace*>(FindFace(node1,node2,node3));
|
toReturn = const_cast<SMDS_MeshFace*>(FindFace(node1,node2,node3));
|
||||||
if(toReturn==NULL) {
|
if(toReturn==NULL) {
|
||||||
toReturn = createTriangle(node1,node2,node3);
|
int ID = myElementIDFactory->GetFreeID();
|
||||||
|
toReturn = createTriangle(node1,node2,node3, ID);
|
||||||
}
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
@ -1892,7 +1968,10 @@ const SMDS_MeshFace* SMDS_Mesh::FindFace(const SMDS_MeshNode *node1,
|
|||||||
const SMDS_MeshElement* SMDS_Mesh::FindElement(int IDelem) const
|
const SMDS_MeshElement* SMDS_Mesh::FindElement(int IDelem) const
|
||||||
{
|
{
|
||||||
if ((IDelem < 0) || IDelem >= myCells.size())
|
if ((IDelem < 0) || IDelem >= myCells.size())
|
||||||
return 0;
|
{
|
||||||
|
MESSAGE("----------------------------------- bad IDelem " << IDelem << " " << myCells.size());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return myCells[IDelem];
|
return myCells[IDelem];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2441,7 +2520,9 @@ static set<const SMDS_MeshElement*> * intersectionOfSets(
|
|||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
/// Return the list of finit elements owning the given element
|
/// Return the list of finite elements owning the given element: elements
|
||||||
|
/// containing all the nodes of the given element, for instance faces and
|
||||||
|
/// volumes containing a given edge.
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
static set<const SMDS_MeshElement*> * getFinitElements(const SMDS_MeshElement * element)
|
static set<const SMDS_MeshElement*> * getFinitElements(const SMDS_MeshElement * element)
|
||||||
{
|
{
|
||||||
@ -2453,16 +2534,24 @@ static set<const SMDS_MeshElement*> * getFinitElements(const SMDS_MeshElement *
|
|||||||
int i=0;
|
int i=0;
|
||||||
while(itNodes->more())
|
while(itNodes->more())
|
||||||
{
|
{
|
||||||
const SMDS_MeshNode * n=static_cast<const SMDS_MeshNode*>(itNodes->next());
|
const SMDS_MeshElement* node = itNodes->next();
|
||||||
|
MYASSERT(node);
|
||||||
|
const SMDS_MeshNode * n=static_cast<const SMDS_MeshNode*>(node);
|
||||||
SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
|
SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
|
||||||
|
|
||||||
//initSet[i]=set<const SMDS_MeshElement*>();
|
//initSet[i]=set<const SMDS_MeshElement*>();
|
||||||
while(itFe->more())
|
while(itFe->more())
|
||||||
initSet[i].insert(itFe->next());
|
{
|
||||||
|
const SMDS_MeshElement* elem = itFe->next();
|
||||||
|
MYASSERT(elem);
|
||||||
|
initSet[i].insert(elem);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
set<const SMDS_MeshElement*> *retSet=intersectionOfSets(initSet, numberOfSets);
|
set<const SMDS_MeshElement*> *retSet=intersectionOfSets(initSet, numberOfSets);
|
||||||
|
MESSAGE("nb elems " << i << " intersection " << retSet->size());
|
||||||
delete [] initSet;
|
delete [] initSet;
|
||||||
return retSet;
|
return retSet;
|
||||||
}
|
}
|
||||||
@ -2577,8 +2666,8 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
///@param elem The element to delete
|
///@param elem The element to delete
|
||||||
///@param removedElems contains all removed elements
|
///@param removedElems to be filled with all removed elements
|
||||||
///@param removedNodes contains all removed nodes
|
///@param removedNodes to be filled with all removed nodes
|
||||||
///@param removenodes if true remaining nodes will be removed
|
///@param removenodes if true remaining nodes will be removed
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
|
void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
|
||||||
@ -2586,6 +2675,7 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
|
|||||||
list<const SMDS_MeshElement *>& removedNodes,
|
list<const SMDS_MeshElement *>& removedNodes,
|
||||||
bool removenodes)
|
bool removenodes)
|
||||||
{
|
{
|
||||||
|
MESSAGE("SMDS_Mesh::RemoveElement " << elem->GetID() << " " << removenodes);
|
||||||
// get finite elements built on elem
|
// get finite elements built on elem
|
||||||
set<const SMDS_MeshElement*> * s1;
|
set<const SMDS_MeshElement*> * s1;
|
||||||
if (elem->GetType() == SMDSAbs_0DElement ||
|
if (elem->GetType() == SMDSAbs_0DElement ||
|
||||||
@ -2638,7 +2728,7 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
|
|||||||
switch((*it)->GetType())
|
switch((*it)->GetType())
|
||||||
{
|
{
|
||||||
case SMDSAbs_Node:
|
case SMDSAbs_Node:
|
||||||
MESSAGE("Internal Error: This should not happen");
|
MYASSERT("Internal Error: This should not happen");
|
||||||
break;
|
break;
|
||||||
case SMDSAbs_0DElement:
|
case SMDSAbs_0DElement:
|
||||||
myCells[(*it)->GetID()] = 0; // -PR- ici ou dans myElementIDFactory->ReleaseID ?
|
myCells[(*it)->GetID()] = 0; // -PR- ici ou dans myElementIDFactory->ReleaseID ?
|
||||||
@ -2660,6 +2750,7 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
|
|||||||
//MESSAGE( "SMDS: RM elem " << (*it)->GetID() );
|
//MESSAGE( "SMDS: RM elem " << (*it)->GetID() );
|
||||||
removedElems.push_back( (*it) );
|
removedElems.push_back( (*it) );
|
||||||
myElementIDFactory->ReleaseID((*it)->GetID());
|
myElementIDFactory->ReleaseID((*it)->GetID());
|
||||||
|
MYASSERT("problem delete elem")
|
||||||
delete (*it);
|
delete (*it);
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
@ -2675,6 +2766,7 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
|
|||||||
myInfo.myNbNodes--;
|
myInfo.myNbNodes--;
|
||||||
myNodeIDFactory->ReleaseID((*it)->GetID());
|
myNodeIDFactory->ReleaseID((*it)->GetID());
|
||||||
removedNodes.push_back( (*it) );
|
removedNodes.push_back( (*it) );
|
||||||
|
MYASSERT("problem delete node")
|
||||||
delete *it;
|
delete *it;
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
@ -2690,16 +2782,19 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
|
void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
|
||||||
{
|
{
|
||||||
|
int elemId = elem->GetID();
|
||||||
|
//MESSAGE("SMDS_Mesh::RemoveFreeElement " << elemId);
|
||||||
SMDSAbs_ElementType aType = elem->GetType();
|
SMDSAbs_ElementType aType = elem->GetType();
|
||||||
|
SMDS_MeshElement* todest = (SMDS_MeshElement*)(elem);
|
||||||
if (aType == SMDSAbs_Node) {
|
if (aType == SMDSAbs_Node) {
|
||||||
// only free node can be removed by this method
|
// only free node can be removed by this method
|
||||||
const SMDS_MeshNode* n = static_cast<const SMDS_MeshNode*>(elem);
|
const SMDS_MeshNode* n = static_cast<SMDS_MeshNode*>(todest);
|
||||||
SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
|
SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
|
||||||
if (!itFe->more()) { // free node
|
if (!itFe->more()) { // free node
|
||||||
myNodes[elem->GetID()] = 0;
|
myNodes[elemId] = 0;
|
||||||
myInfo.myNbNodes--;
|
myInfo.myNbNodes--;
|
||||||
myNodeIDFactory->ReleaseID(elem->GetID());
|
myNodePool->destroy(static_cast<SMDS_MeshNode*>(todest));
|
||||||
delete elem;
|
myNodeIDFactory->ReleaseID(elemId);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (hasConstructionEdges() || hasConstructionFaces())
|
if (hasConstructionEdges() || hasConstructionFaces())
|
||||||
@ -2715,28 +2810,31 @@ void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// in meshes without descendants elements are always free
|
// in meshes without descendants elements are always free
|
||||||
switch (aType) {
|
switch (aType) {
|
||||||
case SMDSAbs_0DElement:
|
case SMDSAbs_0DElement:
|
||||||
myCells[elem->GetID()] = 0;
|
myCells[elemId] = 0;
|
||||||
myInfo.remove(elem);
|
myInfo.remove(elem);
|
||||||
|
delete elem;
|
||||||
break;
|
break;
|
||||||
case SMDSAbs_Edge:
|
case SMDSAbs_Edge:
|
||||||
myCells[elem->GetID()] = 0;
|
myCells[elemId] = 0;
|
||||||
myInfo.RemoveEdge(elem);
|
myInfo.RemoveEdge(elem);
|
||||||
|
myEdgePool->destroy(static_cast<SMDS_VtkEdge*>(todest));
|
||||||
break;
|
break;
|
||||||
case SMDSAbs_Face:
|
case SMDSAbs_Face:
|
||||||
myCells[elem->GetID()] = 0;
|
myCells[elemId] = 0;
|
||||||
myInfo.RemoveFace(elem);
|
myInfo.RemoveFace(elem);
|
||||||
|
myFacePool->destroy(static_cast<SMDS_VtkFace*>(todest));
|
||||||
break;
|
break;
|
||||||
case SMDSAbs_Volume:
|
case SMDSAbs_Volume:
|
||||||
myCells[elem->GetID()] = 0;
|
myCells[elemId] = 0;
|
||||||
myInfo.RemoveVolume(elem);
|
myInfo.RemoveVolume(elem);
|
||||||
|
myVolumePool->destroy(static_cast<SMDS_VtkVolume*>(todest));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
myElementIDFactory->ReleaseID(elem->GetID());
|
myElementIDFactory->ReleaseID(elemId);
|
||||||
delete elem;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@
|
|||||||
#include "SMDS_MeshInfo.hxx"
|
#include "SMDS_MeshInfo.hxx"
|
||||||
#include "SMDS_ElemIterator.hxx"
|
#include "SMDS_ElemIterator.hxx"
|
||||||
#include "SMDS_VolumeOfNodes.hxx"
|
#include "SMDS_VolumeOfNodes.hxx"
|
||||||
|
#include "SMDS_VtkEdge.hxx"
|
||||||
|
#include "SMDS_VtkFace.hxx"
|
||||||
#include "SMDS_VtkVolume.hxx"
|
#include "SMDS_VtkVolume.hxx"
|
||||||
#include "ObjectPool.hxx"
|
#include "ObjectPool.hxx"
|
||||||
|
|
||||||
@ -48,6 +50,9 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <vtkSystemIncludes.h>
|
#include <vtkSystemIncludes.h>
|
||||||
|
|
||||||
|
#include "Utils_SALOME_Exception.hxx"
|
||||||
|
#define MYASSERT(val) if (!(val)) throw SALOME_Exception(LOCALIZED("assertion not verified"));
|
||||||
|
|
||||||
class vtkUnstructuredGrid;
|
class vtkUnstructuredGrid;
|
||||||
|
|
||||||
class SMDS_EXPORT SMDS_Mesh:public SMDS_MeshObject{
|
class SMDS_EXPORT SMDS_Mesh:public SMDS_MeshObject{
|
||||||
@ -558,7 +563,8 @@ public:
|
|||||||
typedef std::vector<SMDS_MeshCell *> SetOfCells;
|
typedef std::vector<SMDS_MeshCell *> SetOfCells;
|
||||||
|
|
||||||
void updateNodeMinMax();
|
void updateNodeMinMax();
|
||||||
inline int fromVtkToSmds(int vtkid) { return myVtkIndex[vtkid]; };
|
inline int fromVtkToSmds(int vtkid) { MYASSERT(vtkid>=0); return myVtkIndex[vtkid]; };
|
||||||
|
inline int fromSmdsToVtk(int smdsid) { MYASSERT(smdsid>=0); return myIDElements[smdsid]; };
|
||||||
|
|
||||||
void incrementNodesCapacity(int nbNodes);
|
void incrementNodesCapacity(int nbNodes);
|
||||||
void incrementCellsCapacity(int nbCells);
|
void incrementCellsCapacity(int nbCells);
|
||||||
@ -572,7 +578,8 @@ private:
|
|||||||
|
|
||||||
SMDS_MeshFace * createTriangle(const SMDS_MeshNode * node1,
|
SMDS_MeshFace * createTriangle(const SMDS_MeshNode * node1,
|
||||||
const SMDS_MeshNode * node2,
|
const SMDS_MeshNode * node2,
|
||||||
const SMDS_MeshNode * node3);
|
const SMDS_MeshNode * node3,
|
||||||
|
int ID);
|
||||||
SMDS_MeshFace * createQuadrangle(const SMDS_MeshNode * node1,
|
SMDS_MeshFace * createQuadrangle(const SMDS_MeshNode * node1,
|
||||||
const SMDS_MeshNode * node2,
|
const SMDS_MeshNode * node2,
|
||||||
const SMDS_MeshNode * node3,
|
const SMDS_MeshNode * node3,
|
||||||
@ -615,6 +622,8 @@ private:
|
|||||||
|
|
||||||
//! Small objects like SMDS_VtkVolume are allocated by chunks to limit memory costs of new
|
//! Small objects like SMDS_VtkVolume are allocated by chunks to limit memory costs of new
|
||||||
ObjectPool<SMDS_VtkVolume>* myVolumePool;
|
ObjectPool<SMDS_VtkVolume>* myVolumePool;
|
||||||
|
ObjectPool<SMDS_VtkFace>* myFacePool;
|
||||||
|
ObjectPool<SMDS_VtkEdge>* myEdgePool;
|
||||||
|
|
||||||
//! SMDS_MeshNodes refer to vtk nodes (vtk id = index in myNodes),store reference to this mesh, and subshape
|
//! SMDS_MeshNodes refer to vtk nodes (vtk id = index in myNodes),store reference to this mesh, and subshape
|
||||||
SetOfNodes myNodes;
|
SetOfNodes myNodes;
|
||||||
|
@ -81,6 +81,11 @@ SMDSAbs_ElementType SMDS_Mesh0DElement::GetType() const
|
|||||||
return SMDSAbs_0DElement;
|
return SMDSAbs_0DElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vtkIdType SMDS_Mesh0DElement::GetVtkType() const
|
||||||
|
{
|
||||||
|
return VTK_VERTEX;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : elementsIterator
|
//function : elementsIterator
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -40,6 +40,7 @@ class SMDS_EXPORT SMDS_Mesh0DElement: public SMDS_MeshCell
|
|||||||
void Print (std::ostream & OS) const;
|
void Print (std::ostream & OS) const;
|
||||||
|
|
||||||
SMDSAbs_ElementType GetType() const;
|
SMDSAbs_ElementType GetType() const;
|
||||||
|
virtual vtkIdType GetVtkType() const;
|
||||||
SMDSAbs_EntityType GetEntityType() const {return SMDSEntity_0D;}
|
SMDSAbs_EntityType GetEntityType() const {return SMDSEntity_0D;}
|
||||||
int NbNodes() const;
|
int NbNodes() const;
|
||||||
int NbEdges() const;
|
int NbEdges() const;
|
||||||
|
@ -1,160 +1,11 @@
|
|||||||
// Copyright (C) 2007-2008 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
|
|
||||||
//
|
|
||||||
// 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.
|
|
||||||
//
|
|
||||||
// This library is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
// Lesser General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Lesser General Public
|
|
||||||
// License along with this library; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
//
|
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
|
||||||
//
|
|
||||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
|
||||||
// File : SMDS_MeshEdge.cxx
|
|
||||||
// Author : Jean-Michel BOULCOURT
|
|
||||||
// Module : SMESH
|
|
||||||
//
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(disable:4786)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "SMDS_MeshEdge.hxx"
|
#include "SMDS_MeshEdge.hxx"
|
||||||
#include "SMDS_IteratorOfElements.hxx"
|
|
||||||
#include "SMDS_MeshNode.hxx"
|
|
||||||
#include "utilities.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : SMDS_MeshEdge
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
SMDS_MeshEdge::SMDS_MeshEdge(const SMDS_MeshNode * node1,
|
|
||||||
const SMDS_MeshNode * node2)
|
|
||||||
{
|
|
||||||
//MESSAGE("SMDS_MeshEdge " << GetID());
|
|
||||||
myNodes[0]=node1;
|
|
||||||
myNodes[1]=node2;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : Print
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
void SMDS_MeshEdge::Print(ostream & OS) const
|
|
||||||
{
|
|
||||||
OS << "edge <" << GetID() << "> : (" << myNodes[0] << " , " << myNodes[1] <<
|
|
||||||
") " << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
int SMDS_MeshEdge::NbNodes() const
|
|
||||||
{
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
int SMDS_MeshEdge::NbEdges() const
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
SMDSAbs_ElementType SMDS_MeshEdge::GetType() const
|
SMDSAbs_ElementType SMDS_MeshEdge::GetType() const
|
||||||
{
|
{
|
||||||
return SMDSAbs_Edge;
|
return SMDSAbs_Edge;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SMDS_MeshEdge_MyNodeIterator:public SMDS_ElemIterator
|
vtkIdType SMDS_MeshEdge::GetVtkType() const
|
||||||
{
|
{
|
||||||
const SMDS_MeshNode *const* myNodes;
|
return VTK_POLY_VERTEX; // --- must be reimplemented in derived classes
|
||||||
int myIndex;
|
|
||||||
public:
|
|
||||||
SMDS_MeshEdge_MyNodeIterator(const SMDS_MeshNode * const* nodes):
|
|
||||||
myNodes(nodes),myIndex(0) {}
|
|
||||||
|
|
||||||
bool more()
|
|
||||||
{
|
|
||||||
return myIndex<2;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SMDS_MeshElement* next()
|
|
||||||
{
|
|
||||||
myIndex++;
|
|
||||||
return myNodes[myIndex-1];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
SMDS_ElemIteratorPtr SMDS_MeshEdge::
|
|
||||||
elementsIterator(SMDSAbs_ElementType type) const
|
|
||||||
{
|
|
||||||
switch(type)
|
|
||||||
{
|
|
||||||
case SMDSAbs_Edge:
|
|
||||||
return SMDS_MeshElement::elementsIterator(SMDSAbs_Edge);
|
|
||||||
case SMDSAbs_Node:
|
|
||||||
return SMDS_ElemIteratorPtr(new SMDS_MeshEdge_MyNodeIterator(myNodes));
|
|
||||||
default:
|
|
||||||
return SMDS_ElemIteratorPtr
|
|
||||||
(new SMDS_IteratorOfElements
|
|
||||||
(this,type, SMDS_ElemIteratorPtr(new SMDS_MeshEdge_MyNodeIterator(myNodes))));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator<(const SMDS_MeshEdge & e1, const SMDS_MeshEdge & e2)
|
|
||||||
{
|
|
||||||
int id11=e1.myNodes[0]->GetID();
|
|
||||||
int id21=e2.myNodes[0]->GetID();
|
|
||||||
int id12=e1.myNodes[1]->GetID();
|
|
||||||
int id22=e2.myNodes[1]->GetID();
|
|
||||||
int tmp;
|
|
||||||
|
|
||||||
if(id11>=id12)
|
|
||||||
{
|
|
||||||
tmp=id11;
|
|
||||||
id11=id12;
|
|
||||||
id12=tmp;
|
|
||||||
}
|
|
||||||
if(id21>=id22)
|
|
||||||
{
|
|
||||||
tmp=id21;
|
|
||||||
id21=id22;
|
|
||||||
id22=tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(id11<id21) return true;
|
|
||||||
else if(id11==id21) return (id21<id22);
|
|
||||||
else return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Return node by its index
|
|
||||||
* \param ind - node index
|
|
||||||
* \retval const SMDS_MeshNode* - the node
|
|
||||||
*/
|
|
||||||
const SMDS_MeshNode* SMDS_MeshEdge::GetNode(const int ind) const
|
|
||||||
{
|
|
||||||
return myNodes[ ind ];
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : ChangeNodes
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
bool SMDS_MeshEdge::ChangeNodes(const SMDS_MeshNode * node1,
|
|
||||||
const SMDS_MeshNode * node2)
|
|
||||||
{
|
|
||||||
myNodes[0]=node1;
|
|
||||||
myNodes[1]=node2;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
@ -1,65 +1,15 @@
|
|||||||
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
|
#ifndef _SMDS_MESHEDGE_HXX_
|
||||||
//
|
#define _SMDS_MESHEDGE_HXX_
|
||||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
|
||||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
|
||||||
//
|
|
||||||
// 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.
|
|
||||||
//
|
|
||||||
// This library is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
// Lesser General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Lesser General Public
|
|
||||||
// License along with this library; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
//
|
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
|
||||||
//
|
|
||||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
|
||||||
// File : SMDS_MeshEdge.hxx
|
|
||||||
// Module : SMESH
|
|
||||||
//
|
|
||||||
#ifndef _SMDS_MeshEdge_HeaderFile
|
|
||||||
#define _SMDS_MeshEdge_HeaderFile
|
|
||||||
|
|
||||||
#include "SMESH_SMDS.hxx"
|
#include "SMESH_SMDS.hxx"
|
||||||
|
|
||||||
#include "SMDS_MeshCell.hxx"
|
#include "SMDS_MeshCell.hxx"
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
class SMDS_EXPORT SMDS_MeshEdge:public SMDS_MeshCell
|
class SMDS_EXPORT SMDS_MeshEdge:public SMDS_MeshCell
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SMDS_MeshEdge(const SMDS_MeshNode * node1,
|
SMDSAbs_ElementType GetType() const;
|
||||||
const SMDS_MeshNode * node2);
|
virtual vtkIdType GetVtkType() const;
|
||||||
bool ChangeNodes(const SMDS_MeshNode * node1,
|
|
||||||
const SMDS_MeshNode * node2);
|
|
||||||
void Print(std::ostream & OS) const;
|
|
||||||
|
|
||||||
virtual SMDSAbs_ElementType GetType() const;
|
|
||||||
virtual SMDSAbs_EntityType GetEntityType() const { return SMDSEntity_Edge; }
|
|
||||||
int NbNodes() const;
|
|
||||||
int NbEdges() const;
|
|
||||||
friend bool operator<(const SMDS_MeshEdge& e1, const SMDS_MeshEdge& e2);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Return node by its index
|
|
||||||
* \param ind - node index
|
|
||||||
* \retval const SMDS_MeshNode* - the node
|
|
||||||
*/
|
|
||||||
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
SMDS_ElemIteratorPtr
|
|
||||||
elementsIterator(SMDSAbs_ElementType type) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const SMDS_MeshNode* myNodes[3];
|
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -36,6 +36,9 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <vtkType.h>
|
||||||
|
#include <vtkCellType.h>
|
||||||
|
|
||||||
//typedef unsigned short UShortType;
|
//typedef unsigned short UShortType;
|
||||||
typedef short ShortType;
|
typedef short ShortType;
|
||||||
|
|
||||||
@ -50,6 +53,7 @@ class SMDS_Mesh;
|
|||||||
*/
|
*/
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
|
|
||||||
class SMDS_EXPORT SMDS_MeshElement:public SMDS_MeshObject
|
class SMDS_EXPORT SMDS_MeshElement:public SMDS_MeshObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -66,6 +70,7 @@ public:
|
|||||||
|
|
||||||
///Return the type of the current element
|
///Return the type of the current element
|
||||||
virtual SMDSAbs_ElementType GetType() const = 0;
|
virtual SMDSAbs_ElementType GetType() const = 0;
|
||||||
|
virtual vtkIdType GetVtkType() const = 0;
|
||||||
virtual bool IsPoly() const { return false; };
|
virtual bool IsPoly() const { return false; };
|
||||||
virtual bool IsQuadratic() const;
|
virtual bool IsQuadratic() const;
|
||||||
//! Return type of entity
|
//! Return type of entity
|
||||||
|
@ -127,7 +127,9 @@ SMDS_MeshElement* SMDS_MeshElementIDFactory::MeshElement(int ID)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SMDS_MeshElementIDFactory::ReleaseID(const int ID)
|
void SMDS_MeshElementIDFactory::ReleaseID(const int ID)
|
||||||
{
|
{
|
||||||
|
int vtkId = myMesh->myIDElements[ID];
|
||||||
myMesh->myIDElements[ID] = -1;
|
myMesh->myIDElements[ID] = -1;
|
||||||
|
myMesh->myVtkIndex[vtkId] = -1;
|
||||||
SMDS_MeshIDFactory::ReleaseID(ID);
|
SMDS_MeshIDFactory::ReleaseID(ID);
|
||||||
if (ID == myMax)
|
if (ID == myMax)
|
||||||
myMax = 0;
|
myMax = 0;
|
||||||
|
@ -27,3 +27,8 @@ SMDSAbs_ElementType SMDS_MeshFace::GetType() const
|
|||||||
{
|
{
|
||||||
return SMDSAbs_Face;
|
return SMDSAbs_Face;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vtkIdType SMDS_MeshFace::GetVtkType() const
|
||||||
|
{
|
||||||
|
return VTK_POLY_LINE; // --- must be reimplemented in derived classes
|
||||||
|
}
|
||||||
|
@ -34,6 +34,7 @@ class SMDS_EXPORT SMDS_MeshFace:public SMDS_MeshCell
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SMDSAbs_ElementType GetType() const;
|
SMDSAbs_ElementType GetType() const;
|
||||||
|
virtual vtkIdType GetVtkType() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -64,6 +64,7 @@ void SMDS_MeshNode::init(int id, int meshId, int shapeId, double x, double y, do
|
|||||||
myID = id;
|
myID = id;
|
||||||
myMeshId = meshId;
|
myMeshId = meshId;
|
||||||
myShapeId = shapeId;
|
myShapeId = shapeId;
|
||||||
|
myIdInShape = -1;
|
||||||
//MESSAGE("Node " << myID << " (" << x << ", " << y << ", " << z << ")");
|
//MESSAGE("Node " << myID << " (" << x << ", " << y << ", " << z << ")");
|
||||||
SMDS_Mesh* mesh = SMDS_Mesh::_meshList[myMeshId];
|
SMDS_Mesh* mesh = SMDS_Mesh::_meshList[myMeshId];
|
||||||
vtkUnstructuredGrid * grid = mesh->getGrid();
|
vtkUnstructuredGrid * grid = mesh->getGrid();
|
||||||
@ -118,8 +119,10 @@ SMDS_MeshNode::~SMDS_MeshNode()
|
|||||||
|
|
||||||
void SMDS_MeshNode::RemoveInverseElement(const SMDS_MeshElement * parent)
|
void SMDS_MeshNode::RemoveInverseElement(const SMDS_MeshElement * parent)
|
||||||
{
|
{
|
||||||
MESSAGE("RemoveInverseElement " << myID << " " << parent->GetID());
|
//MESSAGE("RemoveInverseElement " << myID << " " << parent->GetID());
|
||||||
SMDS_Mesh::_meshList[myMeshId]->getGrid()->RemoveReferenceToCell(myID, parent->GetID()); // -PR- GetVtkID ?
|
const SMDS_MeshCell* cell = dynamic_cast<const SMDS_MeshCell*>(parent);
|
||||||
|
MYASSERT(cell);
|
||||||
|
SMDS_Mesh::_meshList[myMeshId]->getGrid()->RemoveReferenceToCell(myID, cell->getVtkId());
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -299,6 +302,11 @@ SMDSAbs_ElementType SMDS_MeshNode::GetType() const
|
|||||||
return SMDSAbs_Node;
|
return SMDSAbs_Node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vtkIdType SMDS_MeshNode::GetVtkType() const
|
||||||
|
{
|
||||||
|
return VTK_VERTEX;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : AddInverseElement
|
//function : AddInverseElement
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -57,6 +57,7 @@ public:
|
|||||||
void SetPosition(const SMDS_PositionPtr& aPos);
|
void SetPosition(const SMDS_PositionPtr& aPos);
|
||||||
const SMDS_PositionPtr& GetPosition() const;
|
const SMDS_PositionPtr& GetPosition() const;
|
||||||
SMDSAbs_ElementType GetType() const;
|
SMDSAbs_ElementType GetType() const;
|
||||||
|
virtual vtkIdType GetVtkType() const;
|
||||||
SMDSAbs_EntityType GetEntityType() const {return SMDSEntity_Node;}
|
SMDSAbs_EntityType GetEntityType() const {return SMDSEntity_Node;}
|
||||||
int NbNodes() const;
|
int NbNodes() const;
|
||||||
void setXYZ(double x, double y, double z);
|
void setXYZ(double x, double y, double z);
|
||||||
|
@ -35,3 +35,7 @@ SMDSAbs_ElementType SMDS_MeshVolume::GetType() const
|
|||||||
return SMDSAbs_Volume;
|
return SMDSAbs_Volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vtkIdType SMDS_MeshVolume::GetVtkType() const
|
||||||
|
{
|
||||||
|
return VTK_CONVEX_POINT_SET; // --- must be reimplemented in derived classes
|
||||||
|
}
|
||||||
|
@ -35,5 +35,6 @@ class SMDS_EXPORT SMDS_MeshVolume:public SMDS_MeshCell
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SMDSAbs_ElementType GetType() const;
|
SMDSAbs_ElementType GetType() const;
|
||||||
|
virtual vtkIdType GetVtkType() const;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -40,7 +40,7 @@ using namespace std;
|
|||||||
SMDS_QuadraticEdge::SMDS_QuadraticEdge(const SMDS_MeshNode * node1,
|
SMDS_QuadraticEdge::SMDS_QuadraticEdge(const SMDS_MeshNode * node1,
|
||||||
const SMDS_MeshNode * node2,
|
const SMDS_MeshNode * node2,
|
||||||
const SMDS_MeshNode * node12)
|
const SMDS_MeshNode * node12)
|
||||||
:SMDS_MeshEdge(node1,node2)
|
:SMDS_LinearEdge(node1,node2)
|
||||||
{
|
{
|
||||||
myNodes[2]=node12;
|
myNodes[2]=node12;
|
||||||
}
|
}
|
||||||
|
@ -28,10 +28,10 @@
|
|||||||
|
|
||||||
#include "SMESH_SMDS.hxx"
|
#include "SMESH_SMDS.hxx"
|
||||||
|
|
||||||
#include "SMDS_MeshEdge.hxx"
|
#include "SMDS_LinearEdge.hxx"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
class SMDS_EXPORT SMDS_QuadraticEdge: public SMDS_MeshEdge
|
class SMDS_EXPORT SMDS_QuadraticEdge: public SMDS_LinearEdge
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -43,6 +43,9 @@ SMDS_CellLinks::~SMDS_CellLinks()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! initialize an SMDS_CellLinks instance instead of a vtkCellLinks instance
|
||||||
|
*
|
||||||
|
*/
|
||||||
void SMDS_UnstructuredGrid::BuildLinks()
|
void SMDS_UnstructuredGrid::BuildLinks()
|
||||||
{
|
{
|
||||||
// Remove the old links if they are already built
|
// Remove the old links if they are already built
|
||||||
|
@ -54,7 +54,7 @@ class SMDS_EXPORT SMDS_VolumeOfFaces:public SMDS_MeshVolume
|
|||||||
const SMDS_MeshFace * face5,
|
const SMDS_MeshFace * face5,
|
||||||
const SMDS_MeshFace * face6);
|
const SMDS_MeshFace * face6);
|
||||||
|
|
||||||
virtual SMDSAbs_EntityType GetEntityType() const;
|
virtual SMDSAbs_EntityType GetEntityType() const;
|
||||||
void Print(std::ostream & OS) const;
|
void Print(std::ostream & OS) const;
|
||||||
|
|
||||||
int NbFaces() const;
|
int NbFaces() const;
|
||||||
|
@ -1,12 +1,57 @@
|
|||||||
|
|
||||||
#include "SMDS_VtkCellIterator.hxx"
|
#include "SMDS_VtkCellIterator.hxx"
|
||||||
|
|
||||||
SMDS_VtkCellIterator::SMDS_VtkCellIterator(SMDS_Mesh* mesh, int vtkCellId):
|
SMDS_VtkCellIterator::SMDS_VtkCellIterator(SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType aType) :
|
||||||
_mesh(mesh), _cellId(vtkCellId), _index(0)
|
_mesh(mesh), _cellId(vtkCellId), _index(0), _type(aType)
|
||||||
{
|
{
|
||||||
vtkUnstructuredGrid* grid = _mesh->getGrid();
|
vtkUnstructuredGrid* grid = _mesh->getGrid();
|
||||||
_vtkIdList = grid->GetCell(_cellId)->GetPointIds();
|
_vtkIdList = vtkIdList::New();
|
||||||
|
grid->GetCellPoints(_cellId, _vtkIdList);
|
||||||
_nbNodes = _vtkIdList->GetNumberOfIds();
|
_nbNodes = _vtkIdList->GetNumberOfIds();
|
||||||
|
vtkIdType tempid;
|
||||||
|
switch (_type)
|
||||||
|
{
|
||||||
|
case SMDSEntity_Tetra:
|
||||||
|
{
|
||||||
|
tempid = _vtkIdList->GetId(1);
|
||||||
|
_vtkIdList->SetId(1, _vtkIdList->GetId(2));
|
||||||
|
_vtkIdList->SetId(2, tempid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SMDSEntity_Pyramid:
|
||||||
|
{
|
||||||
|
tempid = _vtkIdList->GetId(1);
|
||||||
|
_vtkIdList->SetId(1, _vtkIdList->GetId(3));
|
||||||
|
_vtkIdList->SetId(3, tempid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SMDSEntity_Penta:
|
||||||
|
{
|
||||||
|
tempid = _vtkIdList->GetId(1);
|
||||||
|
_vtkIdList->SetId(1, _vtkIdList->GetId(2));
|
||||||
|
_vtkIdList->SetId(2, tempid);
|
||||||
|
tempid = _vtkIdList->GetId(4);
|
||||||
|
_vtkIdList->SetId(4, _vtkIdList->GetId(5));
|
||||||
|
_vtkIdList->SetId(5, tempid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SMDSEntity_Hexa:
|
||||||
|
{
|
||||||
|
tempid = _vtkIdList->GetId(1);
|
||||||
|
_vtkIdList->SetId(1, _vtkIdList->GetId(3));
|
||||||
|
_vtkIdList->SetId(3, tempid);
|
||||||
|
tempid = _vtkIdList->GetId(5);
|
||||||
|
_vtkIdList->SetId(5, _vtkIdList->GetId(7));
|
||||||
|
_vtkIdList->SetId(7, tempid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SMDS_VtkCellIterator::~SMDS_VtkCellIterator()
|
||||||
|
{
|
||||||
|
_vtkIdList->Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SMDS_VtkCellIterator::more()
|
bool SMDS_VtkCellIterator::more()
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "SMDS_ElemIterator.hxx"
|
#include "SMDS_ElemIterator.hxx"
|
||||||
#include "SMDS_Mesh.hxx"
|
#include "SMDS_Mesh.hxx"
|
||||||
|
#include "SMDSAbs_ElementType.hxx"
|
||||||
|
|
||||||
#include <vtkCell.h>
|
#include <vtkCell.h>
|
||||||
#include <vtkIdList.h>
|
#include <vtkIdList.h>
|
||||||
@ -10,7 +11,8 @@
|
|||||||
class SMDS_VtkCellIterator : public SMDS_ElemIterator
|
class SMDS_VtkCellIterator : public SMDS_ElemIterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SMDS_VtkCellIterator(SMDS_Mesh* mesh, int vtkCellId);
|
SMDS_VtkCellIterator(SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType aType);
|
||||||
|
virtual ~SMDS_VtkCellIterator();
|
||||||
virtual bool more();
|
virtual bool more();
|
||||||
virtual const SMDS_MeshElement* next();
|
virtual const SMDS_MeshElement* next();
|
||||||
protected:
|
protected:
|
||||||
@ -18,6 +20,7 @@ protected:
|
|||||||
int _cellId;
|
int _cellId;
|
||||||
int _index;
|
int _index;
|
||||||
int _nbNodes;
|
int _nbNodes;
|
||||||
|
SMDSAbs_EntityType _type;
|
||||||
vtkIdList* _vtkIdList;
|
vtkIdList* _vtkIdList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
86
src/SMDS/SMDS_VtkEdge.cxx
Normal file
86
src/SMDS/SMDS_VtkEdge.cxx
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
#include "SMDS_VtkEdge.hxx"
|
||||||
|
#include "SMDS_MeshNode.hxx"
|
||||||
|
#include "SMDS_Mesh.hxx"
|
||||||
|
#include "SMDS_VtkCellIterator.hxx"
|
||||||
|
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
SMDS_VtkEdge::SMDS_VtkEdge()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
SMDS_VtkEdge::SMDS_VtkEdge(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
|
||||||
|
{
|
||||||
|
init(nodeIds, mesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
SMDS_VtkEdge::~SMDS_VtkEdge()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SMDS_VtkEdge::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
|
||||||
|
{
|
||||||
|
vtkUnstructuredGrid* grid = mesh->getGrid();
|
||||||
|
myIdInShape = -1;
|
||||||
|
myMeshId = mesh->getMeshId();
|
||||||
|
myVtkID = grid->InsertNextLinkedCell(VTK_LINE, nodeIds.size(), &nodeIds[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SMDS_VtkEdge::ChangeNodes(const SMDS_MeshNode * node1,
|
||||||
|
const SMDS_MeshNode * node2)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SMDS_VtkEdge::Print(std::ostream & OS) const
|
||||||
|
{
|
||||||
|
OS << "edge <" << GetID() << "> : ";
|
||||||
|
}
|
||||||
|
|
||||||
|
int SMDS_VtkEdge::NbNodes() const
|
||||||
|
{
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SMDS_VtkEdge::NbEdges() const
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SMDSAbs_EntityType SMDS_VtkEdge::GetEntityType() const
|
||||||
|
{
|
||||||
|
return SMDSEntity_Edge;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkIdType SMDS_VtkEdge::GetVtkType() const
|
||||||
|
{
|
||||||
|
return VTK_LINE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*/
|
||||||
|
const SMDS_MeshNode*
|
||||||
|
SMDS_VtkEdge::GetNode(const int ind) const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SMDS_ElemIteratorPtr SMDS_VtkEdge::elementsIterator(SMDSAbs_ElementType type) const
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case SMDSAbs_Node:
|
||||||
|
return SMDS_ElemIteratorPtr(new SMDS_VtkCellIterator(
|
||||||
|
SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
|
||||||
|
default:
|
||||||
|
MESSAGE("ERROR : Iterator not implemented");
|
||||||
|
return SMDS_ElemIteratorPtr((SMDS_ElemIterator*) NULL);
|
||||||
|
}
|
||||||
|
}
|
33
src/SMDS/SMDS_VtkEdge.hxx
Normal file
33
src/SMDS/SMDS_VtkEdge.hxx
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#ifndef _SMDS_VTKEDGE_HXX_
|
||||||
|
#define _SMDS_VTKEDGE_HXX_
|
||||||
|
|
||||||
|
#include "SMESH_SMDS.hxx"
|
||||||
|
|
||||||
|
#include "SMDS_MeshEdge.hxx"
|
||||||
|
#include <vtkUnstructuredGrid.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class SMDS_EXPORT SMDS_VtkEdge: public SMDS_MeshEdge
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
SMDS_VtkEdge();
|
||||||
|
SMDS_VtkEdge(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh);
|
||||||
|
~SMDS_VtkEdge();
|
||||||
|
void init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh);
|
||||||
|
bool ChangeNodes(const SMDS_MeshNode * node1, const SMDS_MeshNode * node2);
|
||||||
|
|
||||||
|
void Print(std::ostream & OS) const;
|
||||||
|
int NbNodes() const;
|
||||||
|
int NbEdges() const;
|
||||||
|
|
||||||
|
virtual vtkIdType GetVtkType() const;
|
||||||
|
virtual SMDSAbs_EntityType GetEntityType() const;
|
||||||
|
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SMDS_ElemIteratorPtr
|
||||||
|
elementsIterator(SMDSAbs_ElementType type) const;
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
104
src/SMDS/SMDS_VtkFace.cxx
Normal file
104
src/SMDS/SMDS_VtkFace.cxx
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
#include "SMDS_VtkFace.hxx"
|
||||||
|
#include "SMDS_MeshNode.hxx"
|
||||||
|
#include "SMDS_Mesh.hxx"
|
||||||
|
#include "SMDS_VtkCellIterator.hxx"
|
||||||
|
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
SMDS_VtkFace::SMDS_VtkFace()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
SMDS_VtkFace::SMDS_VtkFace(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
|
||||||
|
{
|
||||||
|
init(nodeIds, mesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
SMDS_VtkFace::~SMDS_VtkFace()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SMDS_VtkFace::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
|
||||||
|
{
|
||||||
|
vtkUnstructuredGrid* grid = mesh->getGrid();
|
||||||
|
myIdInShape = -1;
|
||||||
|
myMeshId = mesh->getMeshId();
|
||||||
|
vtkIdType aType = VTK_TRIANGLE;
|
||||||
|
if (nodeIds.size() == 4)
|
||||||
|
aType = VTK_QUAD;
|
||||||
|
myVtkID = grid->InsertNextLinkedCell(aType, nodeIds.size(), &nodeIds[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SMDS_VtkFace::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SMDS_VtkFace::Print(std::ostream & OS) const
|
||||||
|
{
|
||||||
|
OS << "edge <" << GetID() << "> : ";
|
||||||
|
}
|
||||||
|
|
||||||
|
int SMDS_VtkFace::NbEdges() const
|
||||||
|
{
|
||||||
|
return NbNodes();
|
||||||
|
}
|
||||||
|
|
||||||
|
int SMDS_VtkFace::NbFaces() const
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SMDS_VtkFace::NbNodes() const
|
||||||
|
{
|
||||||
|
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
|
||||||
|
int nbPoints = grid->GetCell(myVtkID)->GetNumberOfPoints();
|
||||||
|
return nbPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return node by its index
|
||||||
|
* \param ind - node index
|
||||||
|
* \retval const SMDS_MeshNode* - the node
|
||||||
|
*/
|
||||||
|
const SMDS_MeshNode*
|
||||||
|
SMDS_VtkFace::GetNode(const int ind) const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SMDSAbs_EntityType SMDS_VtkFace::GetEntityType() const
|
||||||
|
{
|
||||||
|
int nbNodes = NbNodes();
|
||||||
|
if (nbNodes == 3)
|
||||||
|
return SMDSEntity_Triangle;
|
||||||
|
else
|
||||||
|
return SMDSEntity_Quadrangle;
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkIdType SMDS_VtkFace::GetVtkType() const
|
||||||
|
{
|
||||||
|
int nbNodes = NbNodes();
|
||||||
|
if (nbNodes == 3)
|
||||||
|
return VTK_TRIANGLE;
|
||||||
|
else
|
||||||
|
return VTK_QUAD;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SMDS_ElemIteratorPtr SMDS_VtkFace::elementsIterator(SMDSAbs_ElementType type) const
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case SMDSAbs_Node:
|
||||||
|
return SMDS_ElemIteratorPtr(new SMDS_VtkCellIterator(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
|
||||||
|
default:
|
||||||
|
MESSAGE("ERROR : Iterator not implemented");
|
||||||
|
return SMDS_ElemIteratorPtr((SMDS_ElemIterator*) NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
33
src/SMDS/SMDS_VtkFace.hxx
Normal file
33
src/SMDS/SMDS_VtkFace.hxx
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#ifndef _SMDS_VTKFACE_HXX_
|
||||||
|
#define _SMDS_VTKFACE_HXX_
|
||||||
|
|
||||||
|
#include "SMESH_SMDS.hxx"
|
||||||
|
|
||||||
|
#include "SMDS_MeshFace.hxx"
|
||||||
|
#include <vtkUnstructuredGrid.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class SMDS_EXPORT SMDS_VtkFace: public SMDS_MeshFace
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SMDS_VtkFace();
|
||||||
|
SMDS_VtkFace(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh);
|
||||||
|
~SMDS_VtkFace();
|
||||||
|
void init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh);
|
||||||
|
bool ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes);
|
||||||
|
|
||||||
|
void Print(std::ostream & OS) const;
|
||||||
|
int NbEdges() const;
|
||||||
|
int NbFaces() const;
|
||||||
|
int NbNodes() const;
|
||||||
|
|
||||||
|
virtual vtkIdType GetVtkType() const;
|
||||||
|
virtual SMDSAbs_EntityType GetEntityType() const;
|
||||||
|
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SMDS_ElemIteratorPtr
|
||||||
|
elementsIterator(SMDSAbs_ElementType type) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -21,8 +21,18 @@ SMDS_VtkVolume::SMDS_VtkVolume(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
|
|||||||
void SMDS_VtkVolume::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
|
void SMDS_VtkVolume::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
|
||||||
{
|
{
|
||||||
vtkUnstructuredGrid* grid = mesh->getGrid();
|
vtkUnstructuredGrid* grid = mesh->getGrid();
|
||||||
|
myIdInShape = -1;
|
||||||
myMeshId = mesh->getMeshId();
|
myMeshId = mesh->getMeshId();
|
||||||
myVtkID = grid->InsertNextLinkedCell(GetType(), nodeIds.size(), &nodeIds[0]);
|
vtkIdType aType = VTK_TETRA;
|
||||||
|
switch(nodeIds.size())
|
||||||
|
{
|
||||||
|
case 4: aType = VTK_TETRA; break;
|
||||||
|
case 5: aType = VTK_PYRAMID; break;
|
||||||
|
case 6: aType = VTK_WEDGE; break;
|
||||||
|
case 8:
|
||||||
|
default: aType = VTK_HEXAHEDRON; break;
|
||||||
|
}
|
||||||
|
myVtkID = grid->InsertNextLinkedCell(aType, nodeIds.size(), &nodeIds[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SMDS_VtkVolume::ChangeNodes(const SMDS_MeshNode* nodes[],
|
bool SMDS_VtkVolume::ChangeNodes(const SMDS_MeshNode* nodes[],
|
||||||
@ -79,7 +89,7 @@ SMDS_ElemIteratorPtr SMDS_VtkVolume::elementsIterator(SMDSAbs_ElementType type)
|
|||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case SMDSAbs_Node:
|
case SMDSAbs_Node:
|
||||||
return SMDS_ElemIteratorPtr(new SMDS_VtkCellIterator(SMDS_Mesh::_meshList[myMeshId], myVtkID));
|
return SMDS_ElemIteratorPtr(new SMDS_VtkCellIterator(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
|
||||||
default:
|
default:
|
||||||
MESSAGE("ERROR : Iterator not implemented");
|
MESSAGE("ERROR : Iterator not implemented");
|
||||||
return SMDS_ElemIteratorPtr((SMDS_ElemIterator*)NULL);
|
return SMDS_ElemIteratorPtr((SMDS_ElemIterator*)NULL);
|
||||||
@ -110,7 +120,21 @@ SMDSAbs_EntityType SMDS_VtkVolume::GetEntityType() const
|
|||||||
case 5: aType = SMDSEntity_Pyramid; break;
|
case 5: aType = SMDSEntity_Pyramid; break;
|
||||||
case 6: aType = SMDSEntity_Penta; break;
|
case 6: aType = SMDSEntity_Penta; break;
|
||||||
case 8:
|
case 8:
|
||||||
default: aType = SMDSEntity_Hexa; break;
|
default: aType = SMDSEntity_Hexa; break;
|
||||||
}
|
}
|
||||||
return aType;
|
return aType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vtkIdType SMDS_VtkVolume::GetVtkType() const
|
||||||
|
{
|
||||||
|
vtkIdType aType = VTK_TETRA;
|
||||||
|
switch(NbNodes())
|
||||||
|
{
|
||||||
|
case 4: aType = VTK_TETRA; break;
|
||||||
|
case 5: aType = VTK_PYRAMID; break;
|
||||||
|
case 6: aType = VTK_WEDGE; break;
|
||||||
|
case 8:
|
||||||
|
default: aType = VTK_HEXAHEDRON; break;
|
||||||
|
}
|
||||||
|
return aType;
|
||||||
|
}
|
||||||
|
@ -21,14 +21,9 @@ public:
|
|||||||
int NbFaces() const;
|
int NbFaces() const;
|
||||||
int NbNodes() const;
|
int NbNodes() const;
|
||||||
int NbEdges() const;
|
int NbEdges() const;
|
||||||
virtual SMDSAbs_ElementType GetType() const;
|
virtual SMDSAbs_ElementType GetType() const;
|
||||||
|
virtual vtkIdType GetVtkType() const;
|
||||||
virtual SMDSAbs_EntityType GetEntityType() const;
|
virtual SMDSAbs_EntityType GetEntityType() const;
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Return node by its index
|
|
||||||
* \param ind - node index
|
|
||||||
* \retval const SMDS_MeshNode* - the node
|
|
||||||
*/
|
|
||||||
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -66,9 +66,10 @@ bool SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME, bool isElemDele
|
|||||||
{
|
{
|
||||||
// if ( !IsComplexSubmesh() && NbElements() ) {
|
// if ( !IsComplexSubmesh() && NbElements() ) {
|
||||||
|
|
||||||
if (!isElemDeleted) // alive element has valid ID and can be found
|
if (!isElemDeleted) // alive element has valid ID and can be found
|
||||||
{
|
{
|
||||||
int idInSubShape = ME->getIdInShape();
|
int idInSubShape = ME->getIdInShape();
|
||||||
|
//MESSAGE("SMESHDS_SubMesh::RemoveElement " << idInSubShape << " " << ME->GetID());
|
||||||
assert(idInSubShape >= 0);
|
assert(idInSubShape >= 0);
|
||||||
assert(idInSubShape < myElements.size());
|
assert(idInSubShape < myElements.size());
|
||||||
myElements[idInSubShape] = 0; // this vector entry is no more used
|
myElements[idInSubShape] = 0; // this vector entry is no more used
|
||||||
@ -117,6 +118,7 @@ bool SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N, bool isNodeDeleted)
|
|||||||
if (!isNodeDeleted) // alive node has valid ID and can be found
|
if (!isNodeDeleted) // alive node has valid ID and can be found
|
||||||
{
|
{
|
||||||
int idInSubShape = N->getIdInShape();
|
int idInSubShape = N->getIdInShape();
|
||||||
|
//MESSAGE("SMESHDS_SubMesh::RemoveNode " << idInSubShape << " " << N->GetID());
|
||||||
assert(idInSubShape >= 0);
|
assert(idInSubShape >= 0);
|
||||||
assert(idInSubShape < myNodes.size());
|
assert(idInSubShape < myNodes.size());
|
||||||
myNodes[idInSubShape] = 0; // this vector entry is no more used
|
myNodes[idInSubShape] = 0; // this vector entry is no more used
|
||||||
@ -175,14 +177,27 @@ int SMESHDS_SubMesh::NbNodes() const
|
|||||||
// class MySetIterator
|
// class MySetIterator
|
||||||
// =====================
|
// =====================
|
||||||
|
|
||||||
template<class ELEM, typename TSET> class MySetIterator:
|
template <class ELEM, typename TSET> class MySetIterator : public SMDS_Iterator<ELEM>
|
||||||
public SMDS_SetIterator<ELEM, typename TSET::const_iterator >
|
|
||||||
{
|
{
|
||||||
typedef SMDS_SetIterator<ELEM, typename TSET::const_iterator > TFather;
|
protected:
|
||||||
public:
|
typename TSET::const_iterator _it, _end;
|
||||||
MySetIterator(const TSET& s):TFather(s.begin(),s.end())
|
public:
|
||||||
{
|
MySetIterator(const TSET& table)
|
||||||
}
|
: _it(table.begin()), _end(table.end())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool more()
|
||||||
|
{
|
||||||
|
while((_it != _end) && (*_it == 0))
|
||||||
|
_it++;
|
||||||
|
return (_it != _end);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ELEM next()
|
||||||
|
{
|
||||||
|
return *_it++;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// =====================
|
// =====================
|
||||||
@ -258,7 +273,7 @@ SMDS_ElemIteratorPtr SMESHDS_SubMesh::GetElements() const
|
|||||||
if ( IsComplexSubmesh() )
|
if ( IsComplexSubmesh() )
|
||||||
return SMDS_ElemIteratorPtr( new MyElemIterator( mySubMeshes ));
|
return SMDS_ElemIteratorPtr( new MyElemIterator( mySubMeshes ));
|
||||||
|
|
||||||
return SMDS_ElemIteratorPtr(new MySetIterator<const SMDS_MeshElement*,TElemSet>(myElements));
|
return SMDS_ElemIteratorPtr(new MySetIterator<const SMDS_MeshElement*, std::vector<const SMDS_MeshElement*> >(myElements));
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -271,7 +286,7 @@ SMDS_NodeIteratorPtr SMESHDS_SubMesh::GetNodes() const
|
|||||||
if ( IsComplexSubmesh() )
|
if ( IsComplexSubmesh() )
|
||||||
return SMDS_NodeIteratorPtr( new MyNodeIterator( mySubMeshes ));
|
return SMDS_NodeIteratorPtr( new MyNodeIterator( mySubMeshes ));
|
||||||
|
|
||||||
return SMDS_NodeIteratorPtr(new MySetIterator<const SMDS_MeshNode*,TElemSet>(myNodes));
|
return SMDS_NodeIteratorPtr(new MySetIterator<const SMDS_MeshNode*, std::vector<const SMDS_MeshNode*> >(myNodes));
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -69,10 +69,8 @@ class SMESHDS_EXPORT SMESHDS_SubMesh
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
typedef std::vector<const SMDS_MeshElement*> TElemSet;
|
std::vector<const SMDS_MeshElement*> myElements;
|
||||||
|
std::vector<const SMDS_MeshNode*> myNodes;
|
||||||
TElemSet myElements;
|
|
||||||
TElemSet myNodes;
|
|
||||||
|
|
||||||
int myUnusedIdNodes;
|
int myUnusedIdNodes;
|
||||||
int myUnusedIdElements;
|
int myUnusedIdElements;
|
||||||
|
@ -350,24 +350,24 @@ namespace SMESH
|
|||||||
MESSAGE ( "SMESHGUI_VTKUtils::GetVisualObj(), freeMB=" << freeMB
|
MESSAGE ( "SMESHGUI_VTKUtils::GetVisualObj(), freeMB=" << freeMB
|
||||||
<< ", usedMB=" << usedMB );
|
<< ", usedMB=" << usedMB );
|
||||||
#endif
|
#endif
|
||||||
bool continu = false;
|
// bool continu = false;
|
||||||
if ( usedMB * 10 > freeMB )
|
// if ( usedMB * 10 > freeMB )
|
||||||
// even dont try to show
|
// // even dont try to show
|
||||||
SUIT_MessageBox::warning(SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"),
|
// SUIT_MessageBox::warning(SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"),
|
||||||
QObject::tr("SMESH_NO_MESH_VISUALIZATION"));
|
// QObject::tr("SMESH_NO_MESH_VISUALIZATION"));
|
||||||
else
|
// else
|
||||||
// there is a chance to succeed
|
// // there is a chance to succeed
|
||||||
continu = SUIT_MessageBox::warning
|
// continu = SUIT_MessageBox::warning
|
||||||
(SMESHGUI::desktop(),
|
// (SMESHGUI::desktop(),
|
||||||
QObject::tr("SMESH_WRN_WARNING"),
|
// QObject::tr("SMESH_WRN_WARNING"),
|
||||||
QObject::tr("SMESH_CONTINUE_MESH_VISUALIZATION"),
|
// QObject::tr("SMESH_CONTINUE_MESH_VISUALIZATION"),
|
||||||
SUIT_MessageBox::Yes | SUIT_MessageBox::No,
|
// SUIT_MessageBox::Yes | SUIT_MessageBox::No,
|
||||||
SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes;
|
// SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes;
|
||||||
if ( !continu ) {
|
// if ( !continu ) {
|
||||||
// remove the corresponding actors from all views
|
// // remove the corresponding actors from all views
|
||||||
RemoveVisualObjectWithActors( theEntry );
|
// RemoveVisualObjectWithActors( theEntry );
|
||||||
aVisualObj.reset();
|
// aVisualObj.reset();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "SMESH_MeshEditor_i.hxx"
|
#include "SMESH_MeshEditor_i.hxx"
|
||||||
|
|
||||||
#include "SMDS_Mesh0DElement.hxx"
|
#include "SMDS_Mesh0DElement.hxx"
|
||||||
#include "SMDS_MeshEdge.hxx"
|
#include "SMDS_LinearEdge.hxx"
|
||||||
#include "SMDS_MeshFace.hxx"
|
#include "SMDS_MeshFace.hxx"
|
||||||
#include "SMDS_MeshVolume.hxx"
|
#include "SMDS_MeshVolume.hxx"
|
||||||
#include "SMDS_PolyhedralVolumeOfNodes.hxx"
|
#include "SMDS_PolyhedralVolumeOfNodes.hxx"
|
||||||
@ -3663,7 +3663,7 @@ CORBA::Long SMESH_MeshEditor_i::MoveClosestNodeToPoint(CORBA::Double x,
|
|||||||
TIDSortedElemSet::iterator nIt = linkedNodes.begin();
|
TIDSortedElemSet::iterator nIt = linkedNodes.begin();
|
||||||
for ( ; nIt != linkedNodes.end(); ++nIt )
|
for ( ; nIt != linkedNodes.end(); ++nIt )
|
||||||
{
|
{
|
||||||
SMDS_MeshEdge edge( node, cast2Node( *nIt ));
|
SMDS_LinearEdge edge( node, cast2Node( *nIt ));
|
||||||
tmpMesh.Copy( &edge );
|
tmpMesh.Copy( &edge );
|
||||||
}
|
}
|
||||||
// move copied node
|
// move copied node
|
||||||
|
Loading…
Reference in New Issue
Block a user