22316: EDF 2719 SMESH: Split hexas into prisms

Make Python API be equal to IDL API
This commit is contained in:
eap 2014-01-21 16:37:16 +00:00
parent 0d8d658a46
commit c94d606fe3
6 changed files with 54 additions and 39 deletions

View File

@ -326,9 +326,10 @@ module SMESH
/*! /*!
* \brief Split hexahedra into triangular prisms * \brief Split hexahedra into triangular prisms
* \param elems - elements to split * \param elems - elements to split
* \param startHexPoint - a point used to find a hexahedron for which \a facetToSplitNormal
* gives a normal vector defining facets to split into triangles.
* \param facetToSplitNormal - normal used to find a facet of hexahedron * \param facetToSplitNormal - normal used to find a facet of hexahedron
* to split into triangles. Location of this vector is used to * to split into triangles.
* find a hexahedron whose facets are tested using direction of this vector.
* \param methodFlags - flags passing splitting method: * \param methodFlags - flags passing splitting method:
* 1 - split the hexahedron into 2 prisms * 1 - split the hexahedron into 2 prisms
* 2 - split the hexahedron into 4 prisms * 2 - split the hexahedron into 4 prisms
@ -336,10 +337,11 @@ module SMESH
* to \a facetToSplitNormal location are split, else \a facetToSplitNormal * to \a facetToSplitNormal location are split, else \a facetToSplitNormal
* is used to find the facet to split in all domains present in \a elems. * is used to find the facet to split in all domains present in \a elems.
*/ */
void SplitHexahedraIntoPrisms(in SMESH_IDSource elems, void SplitHexahedraIntoPrisms(in SMESH_IDSource elems,
in short methodFlags, in SMESH::PointStruct startHexPoint,
in SMESH::AxisStruct facetToSplitNormal, in SMESH::DirStruct facetToSplitNormal,
in boolean allDomains) in short methodFlags,
in boolean allDomains)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);

View File

@ -1635,16 +1635,18 @@ bool SMESHGUI_SplitVolumesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
aParameters << myDirSpin[2]->text(); aParameters << myDirSpin[2]->text();
myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
SMESH::AxisStruct_var axis = new SMESH::AxisStruct; SMESH::PointStruct_var point = new SMESH::PointStruct;
axis->x = myPointSpin[0]->GetValue(); point->x = myPointSpin[0]->GetValue();
axis->y = myPointSpin[1]->GetValue(); point->y = myPointSpin[1]->GetValue();
axis->z = myPointSpin[2]->GetValue(); point->z = myPointSpin[2]->GetValue();
axis->vx = myDirSpin[0]->GetValue(); SMESH::DirStruct_var norm = new SMESH::DirStruct;
axis->vy = myDirSpin[1]->GetValue(); norm->PS.x = myDirSpin[0]->GetValue();
axis->vz = myDirSpin[2]->GetValue(); norm->PS.y = myDirSpin[1]->GetValue();
norm->PS.z = myDirSpin[2]->GetValue();
theEditor->SplitHexahedraIntoPrisms( obj, myGroupChoice->checkedId()+1, theEditor->SplitHexahedraIntoPrisms( obj, point, norm,
axis, myAllDomainsChk->isChecked() ); myGroupChoice->checkedId()+1,
myAllDomainsChk->isChecked() );
} }
else else
{ {

View File

@ -386,7 +386,7 @@ namespace {
"ExtrusionSweepObject2D","ExtrusionSweepObject2DMakeGroups", "ExtrusionSweepObject2D","ExtrusionSweepObject2DMakeGroups",
"Translate","TranslateMakeGroups","TranslateMakeMesh", "Translate","TranslateMakeGroups","TranslateMakeMesh",
"TranslateObject","TranslateObjectMakeGroups", "TranslateObjectMakeMesh", "TranslateObject","TranslateObjectMakeGroups", "TranslateObjectMakeMesh",
"ExtrusionAlongPathX","ExtrusionAlongPathObjX" "ExtrusionAlongPathX","ExtrusionAlongPathObjX","SplitHexahedraIntoPrisms"
,"" }; // <- mark of the end ,"" }; // <- mark of the end
methodsAcceptingList.Insert( methodNames ); methodsAcceptingList.Insert( methodNames );
} }
@ -2376,7 +2376,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
"GetLastCreatedElems", "GetLastCreatedElems",
"MirrorMakeMesh","MirrorObjectMakeMesh","TranslateMakeMesh","TranslateObjectMakeMesh", "MirrorMakeMesh","MirrorObjectMakeMesh","TranslateMakeMesh","TranslateObjectMakeMesh",
"Scale","ScaleMakeMesh","RotateMakeMesh","RotateObjectMakeMesh","MakeBoundaryMesh", "Scale","ScaleMakeMesh","RotateMakeMesh","RotateObjectMakeMesh","MakeBoundaryMesh",
"MakeBoundaryElements", "SplitVolumesIntoTetra", "MakeBoundaryElements", "SplitVolumesIntoTetra","SplitHexahedraIntoPrisms",
"DoubleElements","DoubleNodes","DoubleNode","DoubleNodeGroup","DoubleNodeGroups", "DoubleElements","DoubleNodes","DoubleNode","DoubleNodeGroup","DoubleNodeGroups",
"DoubleNodeElem","DoubleNodeElemInRegion","DoubleNodeElemGroup", "DoubleNodeElem","DoubleNodeElemInRegion","DoubleNodeElemGroup",
"DoubleNodeElemGroupInRegion","DoubleNodeElemGroups","DoubleNodeElemGroupsInRegion", "DoubleNodeElemGroupInRegion","DoubleNodeElemGroups","DoubleNodeElemGroupsInRegion",

View File

@ -2028,22 +2028,23 @@ void SMESH_MeshEditor_i::SplitVolumesIntoTetra (SMESH::SMESH_IDSource_ptr elems,
*/ */
//================================================================================ //================================================================================
void SMESH_MeshEditor_i::SplitHexahedraIntoPrisms (SMESH::SMESH_IDSource_ptr elems, void SMESH_MeshEditor_i::SplitHexahedraIntoPrisms (SMESH::SMESH_IDSource_ptr elems,
CORBA::Short methodFlags, const SMESH::PointStruct & startHexPoint,
const SMESH::AxisStruct & facetToSplitNormal, const SMESH::DirStruct& facetToSplitNormal,
CORBA::Boolean allDomains) CORBA::Short methodFlags,
CORBA::Boolean allDomains)
throw (SALOME::SALOME_Exception) throw (SALOME::SALOME_Exception)
{ {
SMESH_TRY; SMESH_TRY;
initData(); initData();
prepareIdSource( elems ); prepareIdSource( elems );
gp_Ax1 facetNorm( gp_Pnt( facetToSplitNormal.x, gp_Ax1 facetNorm( gp_Pnt( startHexPoint.x,
facetToSplitNormal.y, startHexPoint.y,
facetToSplitNormal.z ), startHexPoint.z ),
gp_Dir( facetToSplitNormal.vx, gp_Dir( facetToSplitNormal.PS.x,
facetToSplitNormal.vy, facetToSplitNormal.PS.y,
facetToSplitNormal.vz )); facetToSplitNormal.PS.z ));
TIDSortedElemSet elemSet; TIDSortedElemSet elemSet;
SMESH::long_array_var anElementsId = elems->GetIDs(); SMESH::long_array_var anElementsId = elems->GetIDs();
SMDS_MeshElement::GeomFilter filter( SMDSGeom_HEXA ); SMDS_MeshElement::GeomFilter filter( SMDSGeom_HEXA );
@ -2070,8 +2071,11 @@ void SMESH_MeshEditor_i::SplitHexahedraIntoPrisms (SMESH::SMESH_IDSource_ptr ele
declareMeshModified( /*isReComputeSafe=*/true ); // it does not influence Compute() declareMeshModified( /*isReComputeSafe=*/true ); // it does not influence Compute()
TPythonDump() << this << ".SplitHexahedraIntoPrisms( " TPythonDump() << this << ".SplitHexahedraIntoPrisms( "
<< elems << ", " << methodFlags<< ", " << elems << ", "
<< facetToSplitNormal<< ", " << allDomains << " )"; << startHexPoint << ", "
<< facetToSplitNormal<< ", "
<< methodFlags<< ", "
<< allDomains << " )";
SMESH_CATCH( SMESH::throwCorbaException ); SMESH_CATCH( SMESH::throwCorbaException );
} }

View File

@ -233,10 +233,11 @@ public:
void SplitVolumesIntoTetra(SMESH::SMESH_IDSource_ptr elems, void SplitVolumesIntoTetra(SMESH::SMESH_IDSource_ptr elems,
CORBA::Short methodFlags) CORBA::Short methodFlags)
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
void SplitHexahedraIntoPrisms(SMESH::SMESH_IDSource_ptr elems, void SplitHexahedraIntoPrisms(SMESH::SMESH_IDSource_ptr elems,
CORBA::Short methodFlags, const SMESH::PointStruct & startHexPoint,
const SMESH::AxisStruct & facetToSplitNormal, const SMESH::DirStruct& facetToSplitNormal,
CORBA::Boolean allDomains) CORBA::Short methodFlags,
CORBA::Boolean allDomains)
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
CORBA::Boolean Smooth(const SMESH::long_array & IDsOfElements, CORBA::Boolean Smooth(const SMESH::long_array & IDsOfElements,

View File

@ -3076,14 +3076,20 @@ class Mesh:
pass pass
# axis # axis
if isinstance( startHexPoint, geomBuilder.GEOM._objref_GEOM_Object): if isinstance( startHexPoint, geomBuilder.GEOM._objref_GEOM_Object):
startHexPoint = self.geompyD.PointCoordinates( startHexPoint ) startHexPoint = self.smeshpyD.GetPointStruct( startHexPoint )
elif isinstance( startHexPoint, list ):
startHexPoint = SMESH.PointStruct( startHexPoint[0],
startHexPoint[1],
startHexPoint[2])
if isinstance( facetNormal, geomBuilder.GEOM._objref_GEOM_Object): if isinstance( facetNormal, geomBuilder.GEOM._objref_GEOM_Object):
facetNormal = self.geompyD.VectorCoordinates( facetNormal ) facetNormal = self.smeshpyD.GetDirStruct( facetNormal )
axis = SMESH.AxisStruct( startHexPoint[0], startHexPoint[1], startHexPoint[2], elif isinstance( facetNormal, list ):
facetNormal[0], facetNormal[1], facetNormal[2]) facetNormal = self.smeshpyD.MakeDirStruct( facetNormal[0],
self.mesh.SetParameters( axis.parameters ) facetNormal[1],
facetNormal[2])
self.mesh.SetParameters( startHexPoint.parameters + facetNormal.PS.parameters )
self.editor.SplitHexahedraIntoPrisms(elems, method, axis, allDomains) self.editor.SplitHexahedraIntoPrisms(elems, startHexPoint, facetNormal, method, allDomains)
## Splits quadrangle faces near triangular facets of volumes ## Splits quadrangle faces near triangular facets of volumes
# #