mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-03-15 23:41:27 +05:00
PAL11544. optimize a little
This commit is contained in:
parent
f026832e5a
commit
399e3a050c
@ -702,37 +702,20 @@ void SMESH_Gen::Close(int studyId)
|
|||||||
|
|
||||||
int SMESH_Gen::GetShapeDim(const TopAbs_ShapeEnum & aShapeType)
|
int SMESH_Gen::GetShapeDim(const TopAbs_ShapeEnum & aShapeType)
|
||||||
{
|
{
|
||||||
int shapeDim = -1; // Shape dimension: 0D, 1D, 2D, 3D
|
static vector<int> dim;
|
||||||
int type = aShapeType;//.ShapeType();
|
if ( dim.empty() )
|
||||||
switch (type)
|
{
|
||||||
{
|
dim.resize( TopAbs_SHAPE, -1 );
|
||||||
case TopAbs_COMPOUND:
|
dim[ TopAbs_COMPOUND ] = 3;
|
||||||
case TopAbs_COMPSOLID:
|
dim[ TopAbs_COMPSOLID ] = 3;
|
||||||
case TopAbs_SOLID:
|
dim[ TopAbs_SOLID ] = 3;
|
||||||
case TopAbs_SHELL:
|
dim[ TopAbs_SHELL ] = 3;
|
||||||
{
|
dim[ TopAbs_FACE ] = 2;
|
||||||
shapeDim = 3;
|
dim[ TopAbs_WIRE ] = 1;
|
||||||
break;
|
dim[ TopAbs_EDGE ] = 1;
|
||||||
}
|
dim[ TopAbs_VERTEX ] = 0;
|
||||||
// case TopAbs_SHELL:
|
}
|
||||||
case TopAbs_FACE:
|
return dim[ aShapeType ];
|
||||||
{
|
|
||||||
shapeDim = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TopAbs_WIRE:
|
|
||||||
case TopAbs_EDGE:
|
|
||||||
{
|
|
||||||
shapeDim = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TopAbs_VERTEX:
|
|
||||||
{
|
|
||||||
shapeDim = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return shapeDim;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -149,7 +149,7 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
|
|||||||
// fill _mapAncestors
|
// fill _mapAncestors
|
||||||
_mapAncestors.Clear();
|
_mapAncestors.Clear();
|
||||||
int desType, ancType;
|
int desType, ancType;
|
||||||
for ( desType = TopAbs_EDGE; desType > TopAbs_COMPOUND; desType-- )
|
for ( desType = TopAbs_VERTEX; desType > TopAbs_COMPOUND; desType-- )
|
||||||
for ( ancType = desType - 1; ancType >= TopAbs_COMPOUND; ancType-- )
|
for ( ancType = desType - 1; ancType >= TopAbs_COMPOUND; ancType-- )
|
||||||
TopExp::MapShapesAndAncestors ( aShape,
|
TopExp::MapShapesAndAncestors ( aShape,
|
||||||
(TopAbs_ShapeEnum) desType,
|
(TopAbs_ShapeEnum) desType,
|
||||||
@ -616,7 +616,7 @@ SMESH_Gen *SMESH_Mesh::GetGen()
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
SMESH_subMesh *SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape)
|
SMESH_subMesh *SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape)
|
||||||
throw(SALOME_Exception)
|
throw(SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SalomeException);
|
Unexpect aCatch(SalomeException);
|
||||||
SMESH_subMesh *aSubMesh;
|
SMESH_subMesh *aSubMesh;
|
||||||
@ -629,15 +629,16 @@ throw(SALOME_Exception)
|
|||||||
index = _myMeshDS->AddCompoundSubmesh( aSubShape, it.Value().ShapeType() );
|
index = _myMeshDS->AddCompoundSubmesh( aSubShape, it.Value().ShapeType() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_mapSubMesh.find(index) != _mapSubMesh.end())
|
map <int, SMESH_subMesh *>::iterator i_sm = _mapSubMesh.find(index);
|
||||||
{
|
if ( i_sm != _mapSubMesh.end())
|
||||||
aSubMesh = _mapSubMesh[index];
|
{
|
||||||
}
|
aSubMesh = i_sm->second;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aSubMesh = new SMESH_subMesh(index, this, _myMeshDS, aSubShape);
|
aSubMesh = new SMESH_subMesh(index, this, _myMeshDS, aSubShape);
|
||||||
_mapSubMesh[index] = aSubMesh;
|
_mapSubMesh[index] = aSubMesh;
|
||||||
}
|
}
|
||||||
return aSubMesh;
|
return aSubMesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -649,20 +650,17 @@ throw(SALOME_Exception)
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const TopoDS_Shape & aSubShape)
|
SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const TopoDS_Shape & aSubShape)
|
||||||
throw(SALOME_Exception)
|
throw(SALOME_Exception)
|
||||||
{
|
{
|
||||||
Unexpect aCatch(SalomeException);
|
Unexpect aCatch(SalomeException);
|
||||||
bool isFound = false;
|
|
||||||
SMESH_subMesh *aSubMesh = NULL;
|
SMESH_subMesh *aSubMesh = NULL;
|
||||||
|
|
||||||
int index = _myMeshDS->ShapeToIndex(aSubShape);
|
int index = _myMeshDS->ShapeToIndex(aSubShape);
|
||||||
if (_mapSubMesh.find(index) != _mapSubMesh.end())
|
|
||||||
{
|
map <int, SMESH_subMesh *>::iterator i_sm = _mapSubMesh.find(index);
|
||||||
aSubMesh = _mapSubMesh[index];
|
if ( i_sm != _mapSubMesh.end())
|
||||||
isFound = true;
|
aSubMesh = i_sm->second;
|
||||||
}
|
|
||||||
if (!isFound)
|
|
||||||
aSubMesh = NULL;
|
|
||||||
return aSubMesh;
|
return aSubMesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1152,7 +1150,7 @@ void SMESH_Mesh::CleanMeshOnPropagationChain (const TopoDS_Shape& theMainEdge)
|
|||||||
SMESH_subMesh *subMesh = GetSubMesh(anEdge);
|
SMESH_subMesh *subMesh = GetSubMesh(anEdge);
|
||||||
SMESHDS_SubMesh *subMeshDS = subMesh->GetSubMeshDS();
|
SMESHDS_SubMesh *subMeshDS = subMesh->GetSubMeshDS();
|
||||||
if (subMeshDS && subMeshDS->NbElements() > 0) {
|
if (subMeshDS && subMeshDS->NbElements() > 0) {
|
||||||
subMesh->ComputeStateEngine(SMESH_subMesh::CLEANDEP);
|
subMesh->ComputeStateEngine(SMESH_subMesh::CLEAN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user