mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-14 21:40:32 +05:00
PAL13330( When mesh generation does not success, trace where )
fix conversion to/from quadratic order
This commit is contained in:
parent
4ecc69b9b1
commit
f823b723b6
@ -6307,18 +6307,22 @@ void SMESH_MeshEditor::UpdateVolumes (const SMDS_MeshNode* theBetweenNode
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : ConvertElemToQuadratic
|
/*!
|
||||||
//purpose :
|
* \brief Convert elements contained in a submesh to quadratic
|
||||||
|
* \retval int - nb of checked elements
|
||||||
|
*/
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SMESH_MeshEditor::ConvertElemToQuadratic(SMESHDS_SubMesh * theSm,
|
|
||||||
|
int SMESH_MeshEditor::ConvertElemToQuadratic(SMESHDS_SubMesh * theSm,
|
||||||
SMESH_MesherHelper& theHelper,
|
SMESH_MesherHelper& theHelper,
|
||||||
const bool theForce3d)
|
const bool theForce3d)
|
||||||
{
|
{
|
||||||
if( !theSm ) return;
|
int nbElem = 0;
|
||||||
SMESHDS_Mesh* meshDS = GetMeshDS();
|
if( !theSm ) return nbElem;
|
||||||
SMDS_ElemIteratorPtr ElemItr = theSm->GetElements();
|
SMDS_ElemIteratorPtr ElemItr = theSm->GetElements();
|
||||||
while(ElemItr->more())
|
while(ElemItr->more())
|
||||||
{
|
{
|
||||||
|
nbElem++;
|
||||||
const SMDS_MeshElement* elem = ElemItr->next();
|
const SMDS_MeshElement* elem = ElemItr->next();
|
||||||
if( !elem || elem->IsQuadratic() ) continue;
|
if( !elem || elem->IsQuadratic() ) continue;
|
||||||
|
|
||||||
@ -6333,7 +6337,7 @@ void SMESH_MeshEditor::ConvertElemToQuadratic(SMESHDS_SubMesh * theSm,
|
|||||||
SMDSAbs_ElementType aType = elem->GetType();
|
SMDSAbs_ElementType aType = elem->GetType();
|
||||||
|
|
||||||
theSm->RemoveElement(elem);
|
theSm->RemoveElement(elem);
|
||||||
meshDS->SMDS_Mesh::RemoveFreeElement(elem);
|
GetMeshDS()->SMDS_Mesh::RemoveFreeElement(elem);
|
||||||
|
|
||||||
const SMDS_MeshElement* NewElem = 0;
|
const SMDS_MeshElement* NewElem = 0;
|
||||||
|
|
||||||
@ -6383,12 +6387,13 @@ void SMESH_MeshEditor::ConvertElemToQuadratic(SMESHDS_SubMesh * theSm,
|
|||||||
}
|
}
|
||||||
if( NewElem )
|
if( NewElem )
|
||||||
{
|
{
|
||||||
AddToSameGroups( NewElem, elem, meshDS);
|
AddToSameGroups( NewElem, elem, GetMeshDS());
|
||||||
theSm->AddElement( NewElem );
|
theSm->AddElement( NewElem );
|
||||||
}
|
}
|
||||||
if ( NewElem != elem )
|
if ( NewElem != elem )
|
||||||
RemoveElemFromGroups (elem, meshDS);
|
RemoveElemFromGroups (elem, GetMeshDS());
|
||||||
}
|
}
|
||||||
|
return nbElem;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -6402,21 +6407,23 @@ void SMESH_MeshEditor::ConvertToQuadratic(const bool theForce3d)
|
|||||||
SMESH_MesherHelper aHelper(*myMesh);
|
SMESH_MesherHelper aHelper(*myMesh);
|
||||||
aHelper.SetIsQuadratic( true );
|
aHelper.SetIsQuadratic( true );
|
||||||
|
|
||||||
|
int nbCheckedElems = 0;
|
||||||
if ( myMesh->HasShapeToMesh() )
|
if ( myMesh->HasShapeToMesh() )
|
||||||
{
|
{
|
||||||
SMESH_subMesh *aSubMesh = myMesh->GetSubMesh(myMesh->GetShapeToMesh());
|
if ( SMESH_subMesh *aSubMesh = myMesh->GetSubMeshContaining(myMesh->GetShapeToMesh()))
|
||||||
SMESH_subMeshIteratorPtr smIt = aSubMesh->getDependsOnIterator(false,false);
|
{
|
||||||
while ( smIt->more() ) {
|
SMESH_subMeshIteratorPtr smIt = aSubMesh->getDependsOnIterator(true,false);
|
||||||
SMESH_subMesh* sm = smIt->next();
|
while ( smIt->more() ) {
|
||||||
if ( SMESHDS_SubMesh *smDS = sm->GetSubMeshDS() ) {
|
SMESH_subMesh* sm = smIt->next();
|
||||||
aHelper.SetSubShape( sm->GetSubShape() );
|
if ( SMESHDS_SubMesh *smDS = sm->GetSubMeshDS() ) {
|
||||||
ConvertElemToQuadratic(smDS, aHelper, theForce3d);
|
aHelper.SetSubShape( sm->GetSubShape() );
|
||||||
|
nbCheckedElems += ConvertElemToQuadratic(smDS, aHelper, theForce3d);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aHelper.SetSubShape( aSubMesh->GetSubShape() );
|
|
||||||
ConvertElemToQuadratic(aSubMesh->GetSubMeshDS(), aHelper, theForce3d);
|
|
||||||
}
|
}
|
||||||
else
|
int totalNbElems = meshDS->NbEdges() + meshDS->NbFaces() + meshDS->NbVolumes();
|
||||||
|
if ( nbCheckedElems < totalNbElems ) // not all elements in submeshes
|
||||||
{
|
{
|
||||||
SMDS_EdgeIteratorPtr aEdgeItr = meshDS->edgesIterator();
|
SMDS_EdgeIteratorPtr aEdgeItr = meshDS->edgesIterator();
|
||||||
while(aEdgeItr->more())
|
while(aEdgeItr->more())
|
||||||
@ -6515,17 +6522,22 @@ void SMESH_MeshEditor::ConvertToQuadratic(const bool theForce3d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : RemoveQuadElem
|
/*!
|
||||||
//purpose :
|
* \brief Convert quadratic elements to linear ones and remove quadratic nodes
|
||||||
|
* \retval int - nb of checked elements
|
||||||
|
*/
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SMESH_MeshEditor::RemoveQuadElem(SMESHDS_SubMesh * theSm,
|
|
||||||
SMDS_ElemIteratorPtr theItr,
|
int SMESH_MeshEditor::RemoveQuadElem(SMESHDS_SubMesh * theSm,
|
||||||
const int theShapeID)
|
SMDS_ElemIteratorPtr theItr,
|
||||||
|
const int theShapeID)
|
||||||
{
|
{
|
||||||
|
int nbElem = 0;
|
||||||
SMESHDS_Mesh* meshDS = GetMeshDS();
|
SMESHDS_Mesh* meshDS = GetMeshDS();
|
||||||
while( theItr->more() )
|
while( theItr->more() )
|
||||||
{
|
{
|
||||||
const SMDS_MeshElement* elem = theItr->next();
|
const SMDS_MeshElement* elem = theItr->next();
|
||||||
|
nbElem++;
|
||||||
if( elem && elem->IsQuadratic())
|
if( elem && elem->IsQuadratic())
|
||||||
{
|
{
|
||||||
int id = elem->GetID();
|
int id = elem->GetID();
|
||||||
@ -6546,7 +6558,7 @@ void SMESH_MeshEditor::RemoveQuadElem(SMESHDS_SubMesh * theSm,
|
|||||||
if( aNds.empty() ) continue;
|
if( aNds.empty() ) continue;
|
||||||
SMDSAbs_ElementType aType = elem->GetType();
|
SMDSAbs_ElementType aType = elem->GetType();
|
||||||
|
|
||||||
//remove old quadratic elements
|
//remove old quadratic element
|
||||||
meshDS->SMDS_Mesh::RemoveFreeElement( elem );
|
meshDS->SMDS_Mesh::RemoveFreeElement( elem );
|
||||||
if ( theSm )
|
if ( theSm )
|
||||||
theSm->RemoveElement( elem );
|
theSm->RemoveElement( elem );
|
||||||
@ -6573,6 +6585,7 @@ void SMESH_MeshEditor::RemoveQuadElem(SMESHDS_SubMesh * theSm,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return nbElem;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -6581,17 +6594,23 @@ void SMESH_MeshEditor::RemoveQuadElem(SMESHDS_SubMesh * theSm,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool SMESH_MeshEditor::ConvertFromQuadratic()
|
bool SMESH_MeshEditor::ConvertFromQuadratic()
|
||||||
{
|
{
|
||||||
|
int nbCheckedElems = 0;
|
||||||
if ( myMesh->HasShapeToMesh() )
|
if ( myMesh->HasShapeToMesh() )
|
||||||
{
|
{
|
||||||
SMESH_subMesh *aSubMesh = myMesh->GetSubMesh(myMesh->GetShapeToMesh());
|
if ( SMESH_subMesh *aSubMesh = myMesh->GetSubMeshContaining(myMesh->GetShapeToMesh()))
|
||||||
SMESH_subMeshIteratorPtr smIt = aSubMesh->getDependsOnIterator(true,false);
|
{
|
||||||
while ( smIt->more() ) {
|
SMESH_subMeshIteratorPtr smIt = aSubMesh->getDependsOnIterator(true,false);
|
||||||
SMESH_subMesh* sm = smIt->next();
|
while ( smIt->more() ) {
|
||||||
if ( SMESHDS_SubMesh *smDS = sm->GetSubMeshDS() )
|
SMESH_subMesh* sm = smIt->next();
|
||||||
RemoveQuadElem( smDS, smDS->GetElements(), sm->GetId() );
|
if ( SMESHDS_SubMesh *smDS = sm->GetSubMeshDS() )
|
||||||
|
nbCheckedElems += RemoveQuadElem( smDS, smDS->GetElements(), sm->GetId() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
int totalNbElems =
|
||||||
|
GetMeshDS()->NbEdges() + GetMeshDS()->NbFaces() + GetMeshDS()->NbVolumes();
|
||||||
|
if ( nbCheckedElems < totalNbElems ) // not all elements in submeshes
|
||||||
{
|
{
|
||||||
SMESHDS_SubMesh *aSM = 0;
|
SMESHDS_SubMesh *aSM = 0;
|
||||||
RemoveQuadElem( aSM, GetMeshDS()->elementsIterator(), 0 );
|
RemoveQuadElem( aSM, GetMeshDS()->elementsIterator(), 0 );
|
||||||
|
@ -501,17 +501,22 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void ConvertElemToQuadratic(SMESHDS_SubMesh * theSm,
|
/*!
|
||||||
SMESH_MesherHelper& theHelper,
|
* \brief Convert elements contained in a submesh to quadratic
|
||||||
const bool theForce3d);
|
* \retval int - nb of checked elements
|
||||||
//Auxiliary function for "ConvertToQuadratic" is intended to convert
|
*/
|
||||||
//elements contained in submesh to quadratic
|
int ConvertElemToQuadratic(SMESHDS_SubMesh * theSm,
|
||||||
|
SMESH_MesherHelper& theHelper,
|
||||||
|
const bool theForce3d);
|
||||||
|
|
||||||
void RemoveQuadElem( SMESHDS_SubMesh * theSm,
|
/*!
|
||||||
SMDS_ElemIteratorPtr theItr,
|
* \brief Convert quadratic elements to linear ones and remove quadratic nodes
|
||||||
const int theShapeID);
|
* \retval int - nb of checked elements
|
||||||
//Auxiliary function for "ConvertFromQuadratic" is intended to convert quadratic
|
*/
|
||||||
//element to ordinary and for removing quadratic nodes
|
int RemoveQuadElem( SMESHDS_SubMesh * theSm,
|
||||||
|
SMDS_ElemIteratorPtr theItr,
|
||||||
|
const int theShapeID);
|
||||||
|
//Auxiliary function for "ConvertFromQuadratic" is intended to
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user