mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-19 00:20:36 +05:00
+ CORBA::Long Reorient2D(SMESH::SMESH_IDSource_ptr the2Dgroup,
+ const SMESH::DirStruct& theDirection, + CORBA::Long theFace, + const SMESH::PointStruct& thePoint) throw (SALOME::SALOME_Exception);
This commit is contained in:
parent
c6bde687aa
commit
95a77fcb02
@ -296,6 +296,7 @@ namespace {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
arrayToSet( anIDs, theMeshDS, theElemSet, theType);
|
arrayToSet( anIDs, theMeshDS, theElemSet, theType);
|
||||||
|
return bool(anIDs->length()) == bool(theElemSet.size());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -378,6 +379,24 @@ namespace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Return a string used to detect change of mesh part on which theElementSearcher
|
||||||
|
* is going to be used
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
string getPartIOR( SMESH::SMESH_IDSource_ptr theMeshPart, SMESH::ElementType type)
|
||||||
|
{
|
||||||
|
string partIOR = SMESH_Gen_i::GetORB()->object_to_string( theMeshPart );
|
||||||
|
if ( SMESH_Group_i* group_i = SMESH::DownCast<SMESH_Group_i*>( theMeshPart ))
|
||||||
|
// take into account passible group modification
|
||||||
|
partIOR += SMESH_Comment( ((SMESHDS_Group*)group_i->GetGroupDS())->SMDSGroup().Tic() );
|
||||||
|
partIOR += SMESH_Comment( type );
|
||||||
|
return partIOR;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -1129,6 +1148,94 @@ CORBA::Boolean SMESH_MeshEditor_i::ReorientObject(SMESH::SMESH_IDSource_ptr theO
|
|||||||
return isDone;
|
return isDone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Reorient2D
|
||||||
|
//purpose : Reorient faces contained in \a the2Dgroup.
|
||||||
|
// the2Dgroup - the mesh or its part to reorient
|
||||||
|
// theDirection - desired direction of normal of \a theFace
|
||||||
|
// theFace - ID of face whose orientation is checked.
|
||||||
|
// It can be < 1 then \a thePoint is used to find a face.
|
||||||
|
// thePoint - is used to find a face if \a theFace < 1.
|
||||||
|
// return number of reoriented elements.
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
CORBA::Long SMESH_MeshEditor_i::Reorient2D(SMESH::SMESH_IDSource_ptr the2Dgroup,
|
||||||
|
const SMESH::DirStruct& theDirection,
|
||||||
|
CORBA::Long theFace,
|
||||||
|
const SMESH::PointStruct& thePoint)
|
||||||
|
throw (SALOME::SALOME_Exception)
|
||||||
|
{
|
||||||
|
Unexpect aCatch(SALOME_SalomeException);
|
||||||
|
|
||||||
|
initData(/*deleteSearchers=*/false);
|
||||||
|
|
||||||
|
TIDSortedElemSet elements;
|
||||||
|
if ( !idSourceToSet( the2Dgroup, GetMeshDS(), elements, SMDSAbs_Face, /*emptyIfIsMesh=*/1))
|
||||||
|
THROW_SALOME_CORBA_EXCEPTION("No faces in given group", SALOME::BAD_PARAM);
|
||||||
|
|
||||||
|
::SMESH_MeshEditor anEditor( myMesh );
|
||||||
|
|
||||||
|
const SMDS_MeshElement* face = 0;
|
||||||
|
if ( theFace > 0 )
|
||||||
|
{
|
||||||
|
face = GetMeshDS()->FindElement( theFace );
|
||||||
|
if ( !face )
|
||||||
|
THROW_SALOME_CORBA_EXCEPTION("Inexistent face given", SALOME::BAD_PARAM);
|
||||||
|
if ( face->GetType() != SMDSAbs_Face )
|
||||||
|
THROW_SALOME_CORBA_EXCEPTION("Wrong element type", SALOME::BAD_PARAM);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// create theElementSearcher if needed
|
||||||
|
theSearchersDeleter.Set( myMesh, getPartIOR( the2Dgroup, SMESH::FACE ));
|
||||||
|
if ( !theElementSearcher )
|
||||||
|
{
|
||||||
|
if ( elements.empty() ) // search in the whole mesh
|
||||||
|
{
|
||||||
|
if ( myMesh->NbFaces() == 0 )
|
||||||
|
THROW_SALOME_CORBA_EXCEPTION("No faces in the mesh", SALOME::BAD_PARAM);
|
||||||
|
|
||||||
|
theElementSearcher = anEditor.GetElementSearcher();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
typedef SMDS_SetIterator<const SMDS_MeshElement*, TIDSortedElemSet::const_iterator > TIter;
|
||||||
|
SMDS_ElemIteratorPtr elemsIt( new TIter( elements.begin(), elements.end() ));
|
||||||
|
|
||||||
|
theElementSearcher = anEditor.GetElementSearcher(elemsIt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// find a face
|
||||||
|
gp_Pnt p( thePoint.x, thePoint.y, thePoint.z );
|
||||||
|
face = theElementSearcher->FindClosestTo( p, SMDSAbs_Face );
|
||||||
|
|
||||||
|
if ( !face )
|
||||||
|
THROW_SALOME_CORBA_EXCEPTION("No face found by point", SALOME::INTERNAL_ERROR );
|
||||||
|
if ( !elements.empty() && !elements.count( face ))
|
||||||
|
THROW_SALOME_CORBA_EXCEPTION("Found face is not in the group", SALOME::BAD_PARAM );
|
||||||
|
}
|
||||||
|
|
||||||
|
const SMESH::PointStruct * P = &theDirection.PS;
|
||||||
|
gp_Vec dirVec( P->x, P->y, P->z );
|
||||||
|
if ( dirVec.Magnitude() < std::numeric_limits< double >::min() )
|
||||||
|
THROW_SALOME_CORBA_EXCEPTION("Zero size vector", SALOME::BAD_PARAM);
|
||||||
|
|
||||||
|
int nbReori = anEditor.Reorient2D( elements, dirVec, face );
|
||||||
|
storeResult(anEditor);
|
||||||
|
|
||||||
|
if ( nbReori ) {
|
||||||
|
myMesh->SetIsModified( true );
|
||||||
|
myMesh->GetMeshDS()->Modified();
|
||||||
|
}
|
||||||
|
TPythonDump() << this << ".Reorient2D( "
|
||||||
|
<< the2Dgroup << ", "
|
||||||
|
<< theDirection << ", "
|
||||||
|
<< theFace << ", "
|
||||||
|
<< thePoint << " )";
|
||||||
|
|
||||||
|
return nbReori;
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
*
|
*
|
||||||
@ -4466,15 +4573,9 @@ SMESH_MeshEditor_i::FindAmongElementsByPoint(SMESH::SMESH_IDSource_ptr elementID
|
|||||||
if ( SMESH::DownCast<SMESH_Mesh_i*>( elementIDs )) // elementIDs is the whole mesh
|
if ( SMESH::DownCast<SMESH_Mesh_i*>( elementIDs )) // elementIDs is the whole mesh
|
||||||
return FindElementsByPoint( x,y,z, type );
|
return FindElementsByPoint( x,y,z, type );
|
||||||
|
|
||||||
string partIOR = SMESH_Gen_i::GetORB()->object_to_string( elementIDs );
|
|
||||||
if ( SMESH_Group_i* group_i = SMESH::DownCast<SMESH_Group_i*>( elementIDs ))
|
|
||||||
// take into account passible group modification
|
|
||||||
partIOR += SMESH_Comment( ((SMESHDS_Group*)group_i->GetGroupDS())->SMDSGroup().Tic() );
|
|
||||||
partIOR += SMESH_Comment( type );
|
|
||||||
|
|
||||||
TIDSortedElemSet elements; // elems should live until FindElementsByPoint() finishes
|
TIDSortedElemSet elements; // elems should live until FindElementsByPoint() finishes
|
||||||
|
|
||||||
theSearchersDeleter.Set( myMesh, partIOR );
|
theSearchersDeleter.Set( myMesh, getPartIOR( elementIDs, type ));
|
||||||
if ( !theElementSearcher )
|
if ( !theElementSearcher )
|
||||||
{
|
{
|
||||||
// create a searcher from elementIDs
|
// create a searcher from elementIDs
|
||||||
|
@ -122,6 +122,19 @@ public:
|
|||||||
CORBA::Boolean DeleteDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
|
CORBA::Boolean DeleteDiag(CORBA::Long NodeID1, CORBA::Long NodeID2);
|
||||||
CORBA::Boolean Reorient(const SMESH::long_array & IDsOfElements);
|
CORBA::Boolean Reorient(const SMESH::long_array & IDsOfElements);
|
||||||
CORBA::Boolean ReorientObject(SMESH::SMESH_IDSource_ptr theObject);
|
CORBA::Boolean ReorientObject(SMESH::SMESH_IDSource_ptr theObject);
|
||||||
|
/*!
|
||||||
|
* \brief Reorient faces contained in \a the2Dgroup.
|
||||||
|
* \param the2Dgroup - the mesh or its part to reorient
|
||||||
|
* \param theDirection - desired direction of normal of \a theFace
|
||||||
|
* \param theFace - ID of face whose orientation is checked.
|
||||||
|
* It can be < 1 then \a thePoint is used to find a face.
|
||||||
|
* \param thePoint - is used to find a face if \a theFace < 1.
|
||||||
|
* \return number of reoriented elements.
|
||||||
|
*/
|
||||||
|
CORBA::Long Reorient2D(SMESH::SMESH_IDSource_ptr the2Dgroup,
|
||||||
|
const SMESH::DirStruct& theDirection,
|
||||||
|
CORBA::Long theFace,
|
||||||
|
const SMESH::PointStruct& thePoint) throw (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
// Split/Join faces
|
// Split/Join faces
|
||||||
CORBA::Boolean TriToQuad (const SMESH::long_array & IDsOfElements,
|
CORBA::Boolean TriToQuad (const SMESH::long_array & IDsOfElements,
|
||||||
|
Loading…
Reference in New Issue
Block a user