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
* \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
* to split into triangles. Location of this vector is used to
* find a hexahedron whose facets are tested using direction of this vector.
* to split into triangles.
* \param methodFlags - flags passing splitting method:
* 1 - split the hexahedron into 2 prisms
* 2 - split the hexahedron into 4 prisms
@ -336,10 +337,11 @@ module SMESH
* to \a facetToSplitNormal location are split, else \a facetToSplitNormal
* is used to find the facet to split in all domains present in \a elems.
*/
void SplitHexahedraIntoPrisms(in SMESH_IDSource elems,
in short methodFlags,
in SMESH::AxisStruct facetToSplitNormal,
in boolean allDomains)
void SplitHexahedraIntoPrisms(in SMESH_IDSource elems,
in SMESH::PointStruct startHexPoint,
in SMESH::DirStruct facetToSplitNormal,
in short methodFlags,
in boolean allDomains)
raises (SALOME::SALOME_Exception);

View File

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

View File

@ -386,7 +386,7 @@ namespace {
"ExtrusionSweepObject2D","ExtrusionSweepObject2DMakeGroups",
"Translate","TranslateMakeGroups","TranslateMakeMesh",
"TranslateObject","TranslateObjectMakeGroups", "TranslateObjectMakeMesh",
"ExtrusionAlongPathX","ExtrusionAlongPathObjX"
"ExtrusionAlongPathX","ExtrusionAlongPathObjX","SplitHexahedraIntoPrisms"
,"" }; // <- mark of the end
methodsAcceptingList.Insert( methodNames );
}
@ -2376,7 +2376,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
"GetLastCreatedElems",
"MirrorMakeMesh","MirrorObjectMakeMesh","TranslateMakeMesh","TranslateObjectMakeMesh",
"Scale","ScaleMakeMesh","RotateMakeMesh","RotateObjectMakeMesh","MakeBoundaryMesh",
"MakeBoundaryElements", "SplitVolumesIntoTetra",
"MakeBoundaryElements", "SplitVolumesIntoTetra","SplitHexahedraIntoPrisms",
"DoubleElements","DoubleNodes","DoubleNode","DoubleNodeGroup","DoubleNodeGroups",
"DoubleNodeElem","DoubleNodeElemInRegion","DoubleNodeElemGroup",
"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,
CORBA::Short methodFlags,
const SMESH::AxisStruct & facetToSplitNormal,
CORBA::Boolean allDomains)
void SMESH_MeshEditor_i::SplitHexahedraIntoPrisms (SMESH::SMESH_IDSource_ptr elems,
const SMESH::PointStruct & startHexPoint,
const SMESH::DirStruct& facetToSplitNormal,
CORBA::Short methodFlags,
CORBA::Boolean allDomains)
throw (SALOME::SALOME_Exception)
{
SMESH_TRY;
initData();
prepareIdSource( elems );
gp_Ax1 facetNorm( gp_Pnt( facetToSplitNormal.x,
facetToSplitNormal.y,
facetToSplitNormal.z ),
gp_Dir( facetToSplitNormal.vx,
facetToSplitNormal.vy,
facetToSplitNormal.vz ));
gp_Ax1 facetNorm( gp_Pnt( startHexPoint.x,
startHexPoint.y,
startHexPoint.z ),
gp_Dir( facetToSplitNormal.PS.x,
facetToSplitNormal.PS.y,
facetToSplitNormal.PS.z ));
TIDSortedElemSet elemSet;
SMESH::long_array_var anElementsId = elems->GetIDs();
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()
TPythonDump() << this << ".SplitHexahedraIntoPrisms( "
<< elems << ", " << methodFlags<< ", "
<< facetToSplitNormal<< ", " << allDomains << " )";
<< elems << ", "
<< startHexPoint << ", "
<< facetToSplitNormal<< ", "
<< methodFlags<< ", "
<< allDomains << " )";
SMESH_CATCH( SMESH::throwCorbaException );
}

View File

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

View File

@ -3076,14 +3076,20 @@ class Mesh:
pass
# axis
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):
facetNormal = self.geompyD.VectorCoordinates( facetNormal )
axis = SMESH.AxisStruct( startHexPoint[0], startHexPoint[1], startHexPoint[2],
facetNormal[0], facetNormal[1], facetNormal[2])
self.mesh.SetParameters( axis.parameters )
facetNormal = self.smeshpyD.GetDirStruct( facetNormal )
elif isinstance( facetNormal, list ):
facetNormal = self.smeshpyD.MakeDirStruct( facetNormal[0],
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
#