mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 17:30:35 +05:00
Fix some tests regressions
+ time optimization of ex12_grid17partition.py
This commit is contained in:
parent
5c79b298da
commit
aa574473cf
@ -142,8 +142,20 @@ bool SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * elem )
|
|||||||
|
|
||||||
const SMDS_MeshElement* & elem1st = my1stElemNode[ ind1st( elem->GetType() )];
|
const SMDS_MeshElement* & elem1st = my1stElemNode[ ind1st( elem->GetType() )];
|
||||||
if ( elem1st == elem )
|
if ( elem1st == elem )
|
||||||
elem1st = 0;
|
{
|
||||||
|
if ( myNbElements > 0 )
|
||||||
|
{
|
||||||
|
SMDS_ElemIteratorPtr it = myParent->shapeElementsIterator( myIndex, 1, elem1st );
|
||||||
|
if ( it->more() )
|
||||||
|
elem1st = it->next();
|
||||||
|
else
|
||||||
|
throw SALOME_Exception(LOCALIZED("invalid myNbElements"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
elem1st = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -192,8 +204,21 @@ bool SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N)
|
|||||||
|
|
||||||
const SMDS_MeshElement* & node1st = my1stElemNode[ ind1st( SMDSAbs_Node )];
|
const SMDS_MeshElement* & node1st = my1stElemNode[ ind1st( SMDSAbs_Node )];
|
||||||
if ( node1st == N )
|
if ( node1st == N )
|
||||||
node1st = 0;
|
{
|
||||||
|
if ( myNbNodes > 0 )
|
||||||
|
{
|
||||||
|
SMDS_NodeIteratorPtr it =
|
||||||
|
myParent->shapeNodesIterator( myIndex, 1, static_cast< PNode >( node1st ));
|
||||||
|
if ( it->more() )
|
||||||
|
node1st = it->next();
|
||||||
|
else
|
||||||
|
throw SALOME_Exception(LOCALIZED("invalid myNbNodes"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
node1st = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -309,9 +334,9 @@ SMDS_ElemIteratorPtr SMESHDS_SubMesh::GetElements() const
|
|||||||
return SMDS_ElemIteratorPtr( new MyElemIterator( mySubMeshes ));
|
return SMDS_ElemIteratorPtr( new MyElemIterator( mySubMeshes ));
|
||||||
|
|
||||||
const SMDS_MeshElement* const * elem1st = & my1stElemNode[ ind1st( SMDSAbs_All )];
|
const SMDS_MeshElement* const * elem1st = & my1stElemNode[ ind1st( SMDSAbs_All )];
|
||||||
if ( myNbElements == 1 )
|
if ( myNbElements < 2 )
|
||||||
{
|
{
|
||||||
return boost::make_shared< EArrayIterator >( elem1st, elem1st+1 );
|
return boost::make_shared< EArrayIterator >( elem1st, elem1st + myNbElements );
|
||||||
}
|
}
|
||||||
|
|
||||||
return myParent->shapeElementsIterator( myIndex, myNbElements, *elem1st );
|
return myParent->shapeElementsIterator( myIndex, myNbElements, *elem1st );
|
||||||
@ -329,9 +354,9 @@ SMDS_NodeIteratorPtr SMESHDS_SubMesh::GetNodes() const
|
|||||||
|
|
||||||
PNode const * node1st =
|
PNode const * node1st =
|
||||||
reinterpret_cast< PNode const* >( & my1stElemNode[ ind1st( SMDSAbs_Node )] );
|
reinterpret_cast< PNode const* >( & my1stElemNode[ ind1st( SMDSAbs_Node )] );
|
||||||
if ( myNbNodes == 1 )
|
if ( myNbNodes < 2 )
|
||||||
{
|
{
|
||||||
return boost::make_shared< NArrayIterator >( node1st, node1st+1 );
|
return boost::make_shared< NArrayIterator >( node1st, node1st + myNbNodes );
|
||||||
}
|
}
|
||||||
|
|
||||||
return myParent->shapeNodesIterator( myIndex, myNbNodes, *node1st );
|
return myParent->shapeNodesIterator( myIndex, myNbNodes, *node1st );
|
||||||
@ -459,6 +484,7 @@ void SMESHDS_SubMesh::Clear()
|
|||||||
myNbElements = 0;
|
myNbElements = 0;
|
||||||
myNbNodes = 0;
|
myNbNodes = 0;
|
||||||
my1stElemNode[0] = my1stElemNode[1] = 0;
|
my1stElemNode[0] = my1stElemNode[1] = 0;
|
||||||
|
|
||||||
if ( NbSubMeshes() > 0 )
|
if ( NbSubMeshes() > 0 )
|
||||||
{
|
{
|
||||||
SMESHDS_SubMeshIteratorPtr sub = GetSubMeshIterator();
|
SMESHDS_SubMeshIteratorPtr sub = GetSubMeshIterator();
|
||||||
|
@ -4965,8 +4965,7 @@ void SMESH_Gen_i::Close( SALOMEDS::SComponent_ptr theComponent )
|
|||||||
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Close" );
|
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Close" );
|
||||||
|
|
||||||
// Clear study contexts data
|
// Clear study contexts data
|
||||||
delete myStudyContext;
|
myStudyContext->Clear();
|
||||||
myStudyContext = 0;
|
|
||||||
|
|
||||||
// remove the tmp files meshes are loaded from
|
// remove the tmp files meshes are loaded from
|
||||||
SMESH_PreMeshInfo::RemoveStudyFiles_TMP_METHOD( theComponent );
|
SMESH_PreMeshInfo::RemoveStudyFiles_TMP_METHOD( theComponent );
|
||||||
|
@ -79,6 +79,8 @@ public:
|
|||||||
void mapOldToNew( const int oldId, const int newId );
|
void mapOldToNew( const int oldId, const int newId );
|
||||||
// get old id by a new one
|
// get old id by a new one
|
||||||
int getOldId( const int newId );
|
int getOldId( const int newId );
|
||||||
|
// clear data
|
||||||
|
void Clear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// get next free object identifier
|
// get next free object identifier
|
||||||
|
@ -1401,3 +1401,14 @@ int StudyContext::getOldId( const int newId )
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Clear
|
||||||
|
//purpose : clear data
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
void StudyContext::Clear()
|
||||||
|
{
|
||||||
|
mapIdToIOR.Clear();
|
||||||
|
mapIdToId.Clear();
|
||||||
|
}
|
||||||
|
@ -458,7 +458,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
|
|||||||
hyp.SetFineness( fineness )
|
hyp.SetFineness( fineness )
|
||||||
return hyp
|
return hyp
|
||||||
|
|
||||||
def LengthNearVertex(self, length, vertex=0, UseExisting=0):
|
def LengthNearVertex(self, length, vertex=-1, UseExisting=0):
|
||||||
"""
|
"""
|
||||||
Defines "SegmentLengthAroundVertex" hypothesis
|
Defines "SegmentLengthAroundVertex" hypothesis
|
||||||
|
|
||||||
|
@ -33,10 +33,13 @@ import SMESH, SALOMEDS
|
|||||||
from salome.smesh import smeshBuilder
|
from salome.smesh import smeshBuilder
|
||||||
smesh = smeshBuilder.New()
|
smesh = smeshBuilder.New()
|
||||||
|
|
||||||
|
import time
|
||||||
|
t1= time.time()
|
||||||
|
|
||||||
# Geometry
|
# Geometry
|
||||||
# ========
|
# ========
|
||||||
|
|
||||||
# grid compound of 17 x 17 elements
|
# grid compound of 3 x 3 elements
|
||||||
# an element is compound of 3 concentric cylinders
|
# an element is compound of 3 concentric cylinders
|
||||||
# an element is centered in a square of the grid
|
# an element is centered in a square of the grid
|
||||||
|
|
||||||
@ -56,7 +59,7 @@ g_rayon1 = 20
|
|||||||
g_rayon2 = 30
|
g_rayon2 = 30
|
||||||
g_rayon3 = 40
|
g_rayon3 = 40
|
||||||
|
|
||||||
g_grid = 17
|
g_grid = 3
|
||||||
|
|
||||||
g_trim = 1000
|
g_trim = 1000
|
||||||
|
|
||||||
@ -120,6 +123,8 @@ piece = geompy.MakeMultiTranslation2D(c_element, geompy.MakeVectorDXDYDZ(1, 0, 0
|
|||||||
|
|
||||||
piece_id = geompy.addToStudy(piece, "ex12_grid17partition")
|
piece_id = geompy.addToStudy(piece, "ex12_grid17partition")
|
||||||
|
|
||||||
|
t2= time.time()
|
||||||
|
|
||||||
# Meshing
|
# Meshing
|
||||||
# =======
|
# =======
|
||||||
|
|
||||||
@ -140,6 +145,11 @@ hexa.Hexahedron()
|
|||||||
|
|
||||||
hexa.Compute()
|
hexa.Compute()
|
||||||
|
|
||||||
|
t3= time.time()
|
||||||
|
|
||||||
|
print ("time geom",t2-t1)
|
||||||
|
print ("time mesh",t3-t2 )
|
||||||
|
|
||||||
# Update object browser
|
# Update object browser
|
||||||
# ---------------------
|
# ---------------------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user