mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-27 18:00:34 +05:00
Debugging, changes to run C++ with Emscripten
This commit is contained in:
parent
4628396bfe
commit
2bebe506c3
@ -130,13 +130,14 @@ smIdType SMDS_ElementFactory::GetMaxID()
|
|||||||
{
|
{
|
||||||
smIdType id = 0;
|
smIdType id = 0;
|
||||||
TIndexRanges usedRanges;
|
TIndexRanges usedRanges;
|
||||||
for ( smIdType i = myChunks.size() - 1; i >= 0; --i )
|
for ( smIdType i = myChunks.size() - 1; i >= 0 && !myChunks.empty(); --i )
|
||||||
if ( myChunks[i].GetUsedRanges().GetIndices( true, usedRanges ))
|
if ( myChunks[i].GetUsedRanges().GetIndices( true, usedRanges ))
|
||||||
{
|
{
|
||||||
int index = usedRanges.back().second-1;
|
int index = usedRanges.back().second-1;
|
||||||
id = myChunks[i].Get1stID() + index;
|
id = myChunks[i].Get1stID() + index;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
std::cout << "Max id is " << id << std::endl;
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +152,7 @@ smIdType SMDS_ElementFactory::GetMinID()
|
|||||||
{
|
{
|
||||||
smIdType id = 0;
|
smIdType id = 0;
|
||||||
TIndexRanges usedRanges;
|
TIndexRanges usedRanges;
|
||||||
for ( size_t i = 0; i < myChunks.size(); ++i )
|
for ( size_t i = 0; i < myChunks.size() && !myChunks.empty(); ++i )
|
||||||
if ( myChunks[i].GetUsedRanges().GetIndices( true, usedRanges ))
|
if ( myChunks[i].GetUsedRanges().GetIndices( true, usedRanges ))
|
||||||
{
|
{
|
||||||
int index = usedRanges[0].first;
|
int index = usedRanges[0].first;
|
||||||
@ -171,6 +172,8 @@ smIdType SMDS_ElementFactory::GetMinID()
|
|||||||
|
|
||||||
SMDS_MeshElement* SMDS_ElementFactory::NewElement( const smIdType id )
|
SMDS_MeshElement* SMDS_ElementFactory::NewElement( const smIdType id )
|
||||||
{
|
{
|
||||||
|
// std::cout << "New element" << id << std::endl;
|
||||||
|
|
||||||
smIdType iChunk = ( id - 1 ) / theChunkSize;
|
smIdType iChunk = ( id - 1 ) / theChunkSize;
|
||||||
smIdType index = ( id - 1 ) % theChunkSize;
|
smIdType index = ( id - 1 ) % theChunkSize;
|
||||||
while ((smIdType) myChunks.size() <= iChunk )
|
while ((smIdType) myChunks.size() <= iChunk )
|
||||||
@ -202,6 +205,7 @@ SMDS_MeshElement* SMDS_ElementFactory::NewElement( const smIdType id )
|
|||||||
|
|
||||||
const SMDS_MeshElement* SMDS_ElementFactory::FindElement( const smIdType id ) const
|
const SMDS_MeshElement* SMDS_ElementFactory::FindElement( const smIdType id ) const
|
||||||
{
|
{
|
||||||
|
// std::cout << "Find element, # chunks: " << myChunks.size() << std::endl;
|
||||||
if ( id > 0 )
|
if ( id > 0 )
|
||||||
{
|
{
|
||||||
smIdType iChunk = ( id - 1 ) / theChunkSize;
|
smIdType iChunk = ( id - 1 ) / theChunkSize;
|
||||||
@ -212,7 +216,7 @@ const SMDS_MeshElement* SMDS_ElementFactory::FindElement( const smIdType id ) co
|
|||||||
return e->IsNull() ? 0 : e;
|
return e->IsNull() ? 0 : e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
@ -490,6 +494,7 @@ void SMDS_NodeFactory::Clear()
|
|||||||
|
|
||||||
void SMDS_NodeFactory::SetNbShapes( size_t nbShapes )
|
void SMDS_NodeFactory::SetNbShapes( size_t nbShapes )
|
||||||
{
|
{
|
||||||
|
std::cout << "Set Nb Shapes node" << nbShapes << std::endl;
|
||||||
clearVector( myShapeDim );
|
clearVector( myShapeDim );
|
||||||
myShapeDim.resize( nbShapes+1, theDefaultShapeDim );
|
myShapeDim.resize( nbShapes+1, theDefaultShapeDim );
|
||||||
}
|
}
|
||||||
@ -513,6 +518,8 @@ int SMDS_NodeFactory::GetShapeDim( int shapeID ) const
|
|||||||
|
|
||||||
void SMDS_NodeFactory::SetShapeDim( int shapeID, int dim )
|
void SMDS_NodeFactory::SetShapeDim( int shapeID, int dim )
|
||||||
{
|
{
|
||||||
|
// std::cout << "Set shape dim node" << shapeID << " " << dim << std::endl;
|
||||||
|
|
||||||
if ( shapeID >= (int)myShapeDim.size() )
|
if ( shapeID >= (int)myShapeDim.size() )
|
||||||
myShapeDim.resize( shapeID + 10, theDefaultShapeDim );
|
myShapeDim.resize( shapeID + 10, theDefaultShapeDim );
|
||||||
myShapeDim[ shapeID ] = dim;
|
myShapeDim[ shapeID ] = dim;
|
||||||
@ -689,6 +696,8 @@ int SMDS_ElementChunk::GetShapeID( const SMDS_MeshElement* e ) const
|
|||||||
|
|
||||||
void SMDS_ElementChunk::SetShapeID( const SMDS_MeshElement* e, int shapeID ) const
|
void SMDS_ElementChunk::SetShapeID( const SMDS_MeshElement* e, int shapeID ) const
|
||||||
{
|
{
|
||||||
|
// std::cout << "Set shape ID node" << shapeID << std::endl;
|
||||||
|
|
||||||
//const size_t nbRanges = mySubIDRanges.Size();
|
//const size_t nbRanges = mySubIDRanges.Size();
|
||||||
|
|
||||||
SMDS_ElementChunk* me = const_cast<SMDS_ElementChunk*>( this );
|
SMDS_ElementChunk* me = const_cast<SMDS_ElementChunk*>( this );
|
||||||
@ -794,6 +803,8 @@ SMDS_PositionPtr SMDS_ElementChunk::GetPosition( const SMDS_MeshNode* n ) const
|
|||||||
|
|
||||||
void SMDS_ElementChunk::SetPosition( const SMDS_MeshNode* n, const SMDS_PositionPtr& pos, int shapeID )
|
void SMDS_ElementChunk::SetPosition( const SMDS_MeshNode* n, const SMDS_PositionPtr& pos, int shapeID )
|
||||||
{
|
{
|
||||||
|
// std::cout << "Set node position" << shapeID << std::endl;
|
||||||
|
|
||||||
int shapeDim = pos ? pos->GetDim() : theDefaultShapeDim;
|
int shapeDim = pos ? pos->GetDim() : theDefaultShapeDim;
|
||||||
if ( shapeID < 1 )
|
if ( shapeID < 1 )
|
||||||
{
|
{
|
||||||
|
@ -2998,13 +2998,18 @@ void SMDS_Mesh::CompactMesh()
|
|||||||
{
|
{
|
||||||
this->myCompactTime = this->myModifTime;
|
this->myCompactTime = this->myModifTime;
|
||||||
|
|
||||||
|
std::cout << "Start has holes" << std::endl;
|
||||||
bool idsChange = HasNumerationHoles();
|
bool idsChange = HasNumerationHoles();
|
||||||
|
std::cout << "done holes" << std::endl;
|
||||||
|
|
||||||
if ( idsChange )
|
if ( idsChange )
|
||||||
{
|
{
|
||||||
std::set< SMDS_ElementHolder* >::iterator holder = myElemHolders.begin();
|
std::set< SMDS_ElementHolder* >::iterator holder = myElemHolders.begin();
|
||||||
for ( ; holder != myElemHolders.end(); ++holder )
|
for ( ; holder != myElemHolders.end(); ++holder )
|
||||||
(*holder)->beforeCompacting();
|
(*holder)->beforeCompacting();
|
||||||
}
|
}
|
||||||
|
std::cout << "OldCellSize" << std::endl;
|
||||||
|
|
||||||
smIdType oldCellSize = myCellFactory->GetMaxID();
|
smIdType oldCellSize = myCellFactory->GetMaxID();
|
||||||
|
|
||||||
// remove "holes" in SMDS numeration
|
// remove "holes" in SMDS numeration
|
||||||
@ -3012,6 +3017,8 @@ void SMDS_Mesh::CompactMesh()
|
|||||||
myNodeFactory->Compact( idNodesOldToNew );
|
myNodeFactory->Compact( idNodesOldToNew );
|
||||||
myCellFactory->Compact( idCellsNewToOld );
|
myCellFactory->Compact( idCellsNewToOld );
|
||||||
|
|
||||||
|
std::cout << "removed holes" << std::endl;
|
||||||
|
|
||||||
// make VTK IDs correspond to SMDS IDs
|
// make VTK IDs correspond to SMDS IDs
|
||||||
smIdType newNodeSize = myNodeFactory->NbUsedElements();
|
smIdType newNodeSize = myNodeFactory->NbUsedElements();
|
||||||
smIdType newCellSize = myCellFactory->NbUsedElements();
|
smIdType newCellSize = myCellFactory->NbUsedElements();
|
||||||
@ -3028,6 +3035,8 @@ void SMDS_Mesh::CompactMesh()
|
|||||||
idCellsOldToNew[ idCellsNewToOld[ iNew ]] = iNew;
|
idCellsOldToNew[ idCellsNewToOld[ iNew ]] = iNew;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
std::cout << "Restore elements" << std::endl;
|
||||||
|
|
||||||
|
|
||||||
std::set< SMDS_ElementHolder* >::iterator holder = myElemHolders.begin();
|
std::set< SMDS_ElementHolder* >::iterator holder = myElemHolders.begin();
|
||||||
for ( ; holder != myElemHolders.end(); ++holder )
|
for ( ; holder != myElemHolders.end(); ++holder )
|
||||||
@ -3084,5 +3093,6 @@ bool SMDS_Mesh::HasNumerationHoles()
|
|||||||
|
|
||||||
void SMDS_Mesh::setNbShapes( size_t nbShapes )
|
void SMDS_Mesh::setNbShapes( size_t nbShapes )
|
||||||
{
|
{
|
||||||
|
std::cout << "Set nb shapes to " << nbShapes << std::endl;
|
||||||
myNodeFactory->SetNbShapes( nbShapes );
|
myNodeFactory->SetNbShapes( nbShapes );
|
||||||
}
|
}
|
||||||
|
@ -757,11 +757,15 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cout << "Start compact" << std::endl;
|
||||||
if ( aCompactMesh )
|
if ( aCompactMesh )
|
||||||
{
|
{
|
||||||
aMesh.GetMeshDS()->Modified();
|
aMesh.GetMeshDS()->Modified();
|
||||||
|
std::cout << "Done modified compact" << std::endl;
|
||||||
aMesh.GetMeshDS()->CompactMesh();
|
aMesh.GetMeshDS()->CompactMesh();
|
||||||
}
|
}
|
||||||
|
std::cout << "Done compact" << std::endl;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -643,12 +643,19 @@ SMESH_Mesh::AddHypothesis(const TopoDS_Shape & aSubShape,
|
|||||||
anError->clear();
|
anError->clear();
|
||||||
|
|
||||||
SMESH_subMesh *subMesh = GetSubMesh(aSubShape);
|
SMESH_subMesh *subMesh = GetSubMesh(aSubShape);
|
||||||
if ( !subMesh || !subMesh->GetId())
|
if ( !subMesh || !subMesh->GetId()) {
|
||||||
|
// std::cout << "Could not get submesh" << std::endl;
|
||||||
return SMESH_Hypothesis::HYP_BAD_SUBSHAPE;
|
return SMESH_Hypothesis::HYP_BAD_SUBSHAPE;
|
||||||
|
}
|
||||||
|
|
||||||
SMESH_Hypothesis *anHyp = GetHypothesis( anHypId );
|
SMESH_Hypothesis *anHyp = GetHypothesis( anHypId );
|
||||||
if ( !anHyp )
|
if ( !anHyp ) {
|
||||||
|
// std::cout << "Could not get submesh" << std::endl;
|
||||||
throw SALOME_Exception(LOCALIZED("hypothesis does not exist"));
|
throw SALOME_Exception(LOCALIZED("hypothesis does not exist"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// std::cout << "All ok" << std::endl;
|
||||||
|
|
||||||
|
|
||||||
bool isGlobalHyp = IsMainShape( aSubShape );
|
bool isGlobalHyp = IsMainShape( aSubShape );
|
||||||
|
|
||||||
|
@ -548,6 +548,7 @@ namespace
|
|||||||
bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
||||||
const TopoDS_Shape & aShape)
|
const TopoDS_Shape & aShape)
|
||||||
{
|
{
|
||||||
|
std::cout << "Start compute Hexa 3D" << std::endl;
|
||||||
// PAL14921. Enable catching std::bad_alloc and Standard_OutOfMemory outside
|
// PAL14921. Enable catching std::bad_alloc and Standard_OutOfMemory outside
|
||||||
//Unexpect aCatch(SalomeException);
|
//Unexpect aCatch(SalomeException);
|
||||||
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
|
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
|
||||||
|
Loading…
Reference in New Issue
Block a user