From bc108308caf321389fd123b63f9543af08ae764d Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 12 May 2005 08:03:34 +0000 Subject: [PATCH] PAL8581. Add SmoothParametric[Object]() instead of IsParametric parameter addition --- idl/SMESH_Mesh.idl | 18 +++++-- src/SMESH_I/SMESH_MeshEditor_i.cxx | 80 +++++++++++++++++++++++++++--- src/SMESH_I/SMESH_MeshEditor_i.hxx | 26 ++++++++-- 3 files changed, 110 insertions(+), 14 deletions(-) diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl index 0fc7456c5..c8be4aaca 100644 --- a/idl/SMESH_Mesh.idl +++ b/idl/SMESH_Mesh.idl @@ -541,15 +541,25 @@ module SMESH in long_array IDsOfFixedNodes, in long MaxNbOfIterations, in double MaxAspectRatio, - in Smooth_Method Method, - in boolean IsParametric); + in Smooth_Method Method); boolean SmoothObject(in SMESH_IDSource theObject, in long_array IDsOfFixedNodes, in long MaxNbOfIterations, in double MaxAspectRatio, - in Smooth_Method Method, - in boolean IsParametric); + in Smooth_Method Method); + + boolean SmoothParametric(in long_array IDsOfElements, + in long_array IDsOfFixedNodes, + in long MaxNbOfIterations, + in double MaxAspectRatio, + in Smooth_Method Method); + + boolean SmoothParametricObject(in SMESH_IDSource theObject, + in long_array IDsOfFixedNodes, + in long MaxNbOfIterations, + in double MaxAspectRatio, + in Smooth_Method Method); void RenumberNodes(); diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index 776fd0c37..deb18da44 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -614,6 +614,70 @@ CORBA::Boolean return isDone; } +//======================================================================= +//function : Smooth +//purpose : +//======================================================================= + +CORBA::Boolean + SMESH_MeshEditor_i::Smooth(const SMESH::long_array & IDsOfElements, + const SMESH::long_array & IDsOfFixedNodes, + CORBA::Long MaxNbOfIterations, + CORBA::Double MaxAspectRatio, + SMESH::SMESH_MeshEditor::Smooth_Method Method) +{ + return smooth( IDsOfElements, IDsOfFixedNodes, MaxNbOfIterations, + MaxAspectRatio, Method, false ); +} + +//======================================================================= +//function : SmoothParametric +//purpose : +//======================================================================= + +CORBA::Boolean + SMESH_MeshEditor_i::SmoothParametric(const SMESH::long_array & IDsOfElements, + const SMESH::long_array & IDsOfFixedNodes, + CORBA::Long MaxNbOfIterations, + CORBA::Double MaxAspectRatio, + SMESH::SMESH_MeshEditor::Smooth_Method Method) +{ + return smooth( IDsOfElements, IDsOfFixedNodes, MaxNbOfIterations, + MaxAspectRatio, Method, true ); +} + +//======================================================================= +//function : SmoothObject +//purpose : +//======================================================================= + +CORBA::Boolean + SMESH_MeshEditor_i::SmoothObject(SMESH::SMESH_IDSource_ptr theObject, + const SMESH::long_array & IDsOfFixedNodes, + CORBA::Long MaxNbOfIterations, + CORBA::Double MaxAspectRatio, + SMESH::SMESH_MeshEditor::Smooth_Method Method) +{ + return smoothObject (theObject, IDsOfFixedNodes, MaxNbOfIterations, + MaxAspectRatio, Method, false); +} + +//======================================================================= +//function : SmoothParametricObject +//purpose : +//======================================================================= + +CORBA::Boolean + SMESH_MeshEditor_i::SmoothParametricObject(SMESH::SMESH_IDSource_ptr theObject, + const SMESH::long_array & IDsOfFixedNodes, + CORBA::Long MaxNbOfIterations, + CORBA::Double MaxAspectRatio, + SMESH::SMESH_MeshEditor::Smooth_Method Method) +{ + return smoothObject (theObject, IDsOfFixedNodes, MaxNbOfIterations, + MaxAspectRatio, Method, true); +} + //============================================================================= /*! * @@ -621,12 +685,12 @@ CORBA::Boolean //============================================================================= CORBA::Boolean - SMESH_MeshEditor_i::Smooth(const SMESH::long_array & IDsOfElements, + SMESH_MeshEditor_i::smooth(const SMESH::long_array & IDsOfElements, const SMESH::long_array & IDsOfFixedNodes, CORBA::Long MaxNbOfIterations, CORBA::Double MaxAspectRatio, SMESH::SMESH_MeshEditor::Smooth_Method Method, - CORBA::Boolean IsParametric) + bool IsParametric) { SMESHDS_Mesh* aMesh = GetMeshDS(); @@ -656,7 +720,8 @@ CORBA::Boolean MaxNbOfIterations, MaxAspectRatio, IsParametric ); // Update Python script - TCollection_AsciiString str ("isDone = mesh_editor.Smooth("); + TCollection_AsciiString str ("isDone = mesh_editor."); + str += (char*) (IsParametric ? "SmoothParametric( " : "Smooth( "); SMESH_Gen_i::AddArray( str, IDsOfElements ) += ", "; SMESH_Gen_i::AddArray( str, IDsOfFixedNodes ) += ", "; str += (Standard_Integer) MaxNbOfIterations; @@ -683,15 +748,15 @@ CORBA::Boolean //============================================================================= CORBA::Boolean - SMESH_MeshEditor_i::SmoothObject(SMESH::SMESH_IDSource_ptr theObject, + SMESH_MeshEditor_i::smoothObject(SMESH::SMESH_IDSource_ptr theObject, const SMESH::long_array & IDsOfFixedNodes, CORBA::Long MaxNbOfIterations, CORBA::Double MaxAspectRatio, SMESH::SMESH_MeshEditor::Smooth_Method Method, - CORBA::Boolean IsParametric) + bool IsParametric) { SMESH::long_array_var anElementsId = theObject->GetIDs(); - CORBA::Boolean isDone = Smooth (anElementsId, IDsOfFixedNodes, MaxNbOfIterations, + CORBA::Boolean isDone = smooth (anElementsId, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method, IsParametric); // Clear python line(s), created by Smooth() @@ -702,7 +767,8 @@ CORBA::Boolean #endif // Update Python script - TCollection_AsciiString str ("isDone = mesh_editor.SmoothObject("); + TCollection_AsciiString str ("isDone = mesh_editor."); + str += (char*) (IsParametric ? "SmoothParametricObject( " : "SmoothObject( "); SMESH_Gen_i::AddObject( str, theObject ) += ", "; SMESH_Gen_i::AddArray( str, IDsOfFixedNodes ) += ", "; str += (Standard_Integer) MaxNbOfIterations; diff --git a/src/SMESH_I/SMESH_MeshEditor_i.hxx b/src/SMESH_I/SMESH_MeshEditor_i.hxx index 3ee4fe514..2c6e18e09 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.hxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.hxx @@ -81,14 +81,34 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor const SMESH::long_array & IDsOfFixedNodes, CORBA::Long MaxNbOfIterations, CORBA::Double MaxAspectRatio, - SMESH::SMESH_MeshEditor::Smooth_Method Method, - CORBA::Boolean IsParametric); + SMESH::SMESH_MeshEditor::Smooth_Method Method); CORBA::Boolean SmoothObject(SMESH::SMESH_IDSource_ptr theObject, + const SMESH::long_array & IDsOfFixedNodes, + CORBA::Long MaxNbOfIterations, + CORBA::Double MaxAspectRatio, + SMESH::SMESH_MeshEditor::Smooth_Method Method); + CORBA::Boolean SmoothParametric(const SMESH::long_array & IDsOfElements, + const SMESH::long_array & IDsOfFixedNodes, + CORBA::Long MaxNbOfIterations, + CORBA::Double MaxAspectRatio, + SMESH::SMESH_MeshEditor::Smooth_Method Method); + CORBA::Boolean SmoothParametricObject(SMESH::SMESH_IDSource_ptr theObject, + const SMESH::long_array & IDsOfFixedNodes, + CORBA::Long MaxNbOfIterations, + CORBA::Double MaxAspectRatio, + SMESH::SMESH_MeshEditor::Smooth_Method Method); + CORBA::Boolean smooth(const SMESH::long_array & IDsOfElements, + const SMESH::long_array & IDsOfFixedNodes, + CORBA::Long MaxNbOfIterations, + CORBA::Double MaxAspectRatio, + SMESH::SMESH_MeshEditor::Smooth_Method Method, + bool IsParametric); + CORBA::Boolean smoothObject(SMESH::SMESH_IDSource_ptr theObject, const SMESH::long_array & IDsOfFixedNodes, CORBA::Long MaxNbOfIterations, CORBA::Double MaxAspectRatio, SMESH::SMESH_MeshEditor::Smooth_Method Method, - CORBA::Boolean IsParametric); + bool IsParametric); void RenumberNodes(); void RenumberElements(); -- 2.39.2