double GetPrecision();
};
+ /*!
+ * StdMeshers_MaxLength: interface of "Max length" hypothesis
+ */
+ interface StdMeshers_MaxLength : SMESH::SMESH_Hypothesis
+ {
+ /*!
+ * Sets <length> parameter value
+ */
+ void SetLength(in double length)
+ raises (SALOME::SALOME_Exception);
+ /*!
+ * Returns <length> parameter value
+ */
+ double GetLength();
+ /*!
+ * Returns true if preestemated length is defined
+ */
+ boolean HavePreestimatedLength();
+ /*!
+ * Returns preestemated length
+ */
+ double GetPreestimatedLength();
+ /*!
+ * Sets preestemated length
+ */
+ void SetPreestimatedLength(in double length);
+ /*!
+ * Sets boolean parameter enabling/desabling usage of length computed
+ * basing on size of bounding box of shape to mesh
+ */
+ void SetUsePreestimatedLength(in boolean toUse);
+ /*!
+ * Returns value of boolean parameter enabling/desabling usage of length computed
+ * basing on size of bounding box of shape to mesh
+ */
+ boolean GetUsePreestimatedLength();
+ };
+
/*!
* StdMeshers_AutomaticLength: interface of "Automatic length" hypothesis
*/
icon-id="mesh_hypo_length.png"
dim="1"/>
+ <hypothesis type="MaxLength"
+ label-id="Max Size"
+ icon-id="mesh_hypo_length.png"
+ dim="1"/>
+
<hypothesis type="Arithmetic1D"
label-id="Arithmetic 1D"
icon-id="mesh_hypo_length.png"
<algorithm type="Regular_1D"
label-id="Wire discretisation"
icon-id="mesh_algo_regular.png"
- hypos="LocalLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength"
+ hypos="LocalLength,MaxLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength"
opt-hypos="Propagation,QuadraticMesh"
input="VERTEX"
output="EDGE"
<algorithm type="CompositeSegment_1D"
label-id="Composite side discretisation"
icon-id="mesh_algo_regular.png"
- hypos="LocalLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength"
+ hypos="LocalLength,MaxLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength"
opt-hypos="Propagation,QuadraticMesh"
input="VERTEX"
output="EDGE"
<hypotheses-set-group>
<hypotheses-set name="Automatic Tetrahedralization"
- hypos="AutomaticLength"
+ hypos="MaxLength"
algos="Regular_1D, MEFISTO_2D, NETGEN_3D"/>
<hypotheses-set name="Automatic Hexahedralization"
- hypos="AutomaticLength"
+ hypos="NumberOfSegments"
algos="Regular_1D, Quadrangle_2D, Hexa_3D"/>
</hypotheses-set-group>
// i.e. convertion result will be "locallength = regular1d.LocalLength(<arg of SetLength()>)"
hyp->AddArgMethod( "SetLength" );
}
+ else if ( hypType == "MaxLength" ) {
+ // set algo's method creating hyp, and algo type
+ hyp->SetConvMethodAndType( "MaxSize", "Regular_1D");
+ // set method whose 1 arg will become the 1-st arg of hyp creation command
+ // i.e. convertion result will be "maxsize = regular1d.MaxSize(<arg of SetLength()>)"
+ hyp->AddArgMethod( "SetLength" );
+ }
else if ( hypType == "NumberOfSegments" ) {
hyp = new _pyNumberOfSegmentsHyp( theCreationCmd );
hyp->SetConvMethodAndType( "NumberOfSegments", "Regular_1D");
return IsEqual(hyp.GetPrecision(), args[1])
return False
+ ## Defines "MaxSize" hypothesis to cut an edge into segments not longer than given value
+ # @param length is optional maximal allowed length of segment, if it is omitted
+ # the preestimated length is used that depends on geometry size
+ # @param UseExisting if ==true - searches for an existing hypothesis created with
+ # the same parameters, else (default) - create a new one
+ # @return an instance of StdMeshers_MaxLength hypothesis
+ # @ingroup l3_hypos_1dhyps
+ def MaxSize(self, length=0.0, UseExisting=0):
+ hyp = self.Hypothesis("MaxLength", [length], UseExisting=UseExisting)
+ if length > 0.0:
+ # set given length
+ hyp.SetLength(length)
+ if not UseExisting:
+ # set preestimated length
+ gen = self.mesh.smeshpyD
+ initHyp = gen.GetHypothesisParameterValues("MaxLength", "libStdMeshersEngine.so",
+ self.mesh.GetMesh(), self.mesh.GetShape(),
+ False) # <- byMesh
+ preHyp = initHyp._narrow(StdMeshers.StdMeshers_MaxLength)
+ if preHyp:
+ hyp.SetPreestimatedLength( preHyp.GetPreestimatedLength() )
+ pass
+ pass
+ hyp.SetUsePreestimatedLength( length == 0.0 )
+ return hyp
+
## Defines "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
# @param n for the number of segments that cut an edge
# @param s for the scale factor (optional)
StdMeshers_QuadToTriaAdaptor.hxx \
SMESH_StdMeshers.hxx \
StdMeshers_TrianglePreference.hxx \
- StdMeshers_CompositeHexa_3D.hxx
+ StdMeshers_CompositeHexa_3D.hxx \
+ StdMeshers_MaxLength.hxx
# Libraries targets
StdMeshers_UseExisting_1D2D.cxx \
StdMeshers_QuadToTriaAdaptor.cxx \
StdMeshers_TrianglePreference.cxx \
- StdMeshers_CompositeHexa_3D.cxx
+ StdMeshers_CompositeHexa_3D.cxx \
+ StdMeshers_MaxLength.cxx
# additionnal information to compil and link file
--- /dev/null
+// SMESH SMESH : implementaion of SMESH idl descriptions
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : StdMeshers_MaxLength.cxx
+// Module : SMESH
+
+#include "StdMeshers_MaxLength.hxx"
+
+#include "SMESH_Mesh.hxx"
+#include "SMESH_Algo.hxx"
+
+#include "utilities.h"
+
+#include <BRep_Tool.hxx>
+#include <GCPnts_AbscissaPoint.hxx>
+#include <GeomAdaptor_Curve.hxx>
+#include <Geom_Curve.hxx>
+#include <TopExp.hxx>
+#include <TopLoc_Location.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <Precision.hxx>
+
+using namespace std;
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+StdMeshers_MaxLength::StdMeshers_MaxLength(int hypId, int studyId, SMESH_Gen * gen)
+ :SMESH_Hypothesis(hypId, studyId, gen)
+{
+ _length = 1.;
+ _preestimated = 0.;
+ _preestimation = false;
+ _name = "MaxLength";
+ _param_algo_dim = 1; // is used by SMESH_Regular_1D
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+StdMeshers_MaxLength::~StdMeshers_MaxLength()
+{
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+void StdMeshers_MaxLength::SetLength(double length) throw(SALOME_Exception)
+{
+ if (length <= 0)
+ throw SALOME_Exception(LOCALIZED("length must be positive"));
+ if ( _length != length ) {
+ _length = length;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+double StdMeshers_MaxLength::GetLength() const
+{
+ return ( _preestimation && _preestimated > 0. ) ? _preestimated : _length;
+}
+
+//================================================================================
+/*!
+ * \brief Sets boolean parameter enabling/desabling usage of length computed
+ * basing on size of bounding box of shape to mesh
+ */
+//================================================================================
+
+void StdMeshers_MaxLength::SetUsePreestimatedLength(bool toUse)
+{
+ if ( toUse != _preestimation )
+ {
+ _preestimation = toUse;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//================================================================================
+/*!
+ * \brief Store preestemated length
+ */
+//================================================================================
+
+void StdMeshers_MaxLength::SetPreestimatedLength(double length)
+{
+ if ( length > 0 )
+ _preestimated = length;
+}
+
+//================================================================================
+/*!
+ * \brief Returns value of boolean parameter enabling/desabling usage of length computed
+ * basing on size of bounding box of shape to mesh
+ */
+//================================================================================
+
+bool StdMeshers_MaxLength::GetUsePreestimatedLength() const
+{
+ return _preestimation;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+ostream & StdMeshers_MaxLength::SaveTo(ostream & save)
+{
+ save << _length << " " << _preestimated << " " << _preestimation;
+ return save;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+istream & StdMeshers_MaxLength::LoadFrom(istream & load)
+{
+ bool isOK = true;
+ double a;
+
+ isOK = (load >> a);
+ if (isOK)
+ _length = a;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> a);
+ if (isOK)
+ _preestimated = a;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ bool pre;
+ isOK = (load >> pre);
+ if ( isOK )
+ _preestimation = pre;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ return load;
+}
+
+//================================================================================
+/*!
+ * \brief Initialize segment length by the mesh built on the geometry
+ * \param theMesh - the built mesh
+ * \param theShape - the geometry of interest
+ * \retval bool - true if parameter values have been successfully defined
+ */
+//================================================================================
+
+bool StdMeshers_MaxLength::SetParametersByMesh(const SMESH_Mesh* theMesh,
+ const TopoDS_Shape& theShape)
+{
+ if ( !theMesh || theShape.IsNull() )
+ return false;
+
+ _length = 0.;
+
+ Standard_Real UMin, UMax;
+ TopLoc_Location L;
+
+ int nbEdges = 0;
+ TopTools_IndexedMapOfShape edgeMap;
+ TopExp::MapShapes( theShape, TopAbs_EDGE, edgeMap );
+ for ( int iE = 1; iE <= edgeMap.Extent(); ++iE )
+ {
+ const TopoDS_Edge& edge = TopoDS::Edge( edgeMap( iE ));
+ Handle(Geom_Curve) C = BRep_Tool::Curve( edge, L, UMin, UMax );
+ GeomAdaptor_Curve AdaptCurve(C);
+
+ vector< double > params;
+ SMESHDS_Mesh* aMeshDS = const_cast< SMESH_Mesh* >( theMesh )->GetMeshDS();
+ if ( SMESH_Algo::GetNodeParamOnEdge( aMeshDS, edge, params ))
+ {
+ for ( int i = 1; i < params.size(); ++i )
+ _length += GCPnts_AbscissaPoint::Length( AdaptCurve, params[ i-1 ], params[ i ]);
+ nbEdges += params.size() - 1;
+ }
+ }
+ if ( nbEdges )
+ _length /= nbEdges;
+
+ return nbEdges;
+}
+//================================================================================
+/*!
+ * \brief Initialize my parameter values by linear size of mesh element.
+ * \retval bool - true if parameter values have been successfully defined
+ */
+//================================================================================
+
+bool StdMeshers_MaxLength::SetParametersByElementSize(double elemLenght,
+ const SMESH_Mesh* /*theMesh*/)
+{
+ _preestimation = ( elemLenght > 0.);
+ if ( _preestimation )
+ _preestimated = elemLenght;
+ return bool( _length = elemLenght );
+}
+
--- /dev/null
+// SMESH SMESH : implementaion of SMESH idl descriptions
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+// File : StdMeshers_MaxLength.hxx
+// Module : SMESH
+
+#ifndef _SMESH_MaxLength_HXX_
+#define _SMESH_MaxLength_HXX_
+
+#include "SMESH_StdMeshers.hxx"
+
+#include "SMESH_Hypothesis.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+class STDMESHERS_EXPORT StdMeshers_MaxLength: public SMESH_Hypothesis
+{
+ public:
+ StdMeshers_MaxLength(int hypId, int studyId, SMESH_Gen * gen);
+ virtual ~ StdMeshers_MaxLength();
+
+ void SetLength(double length) throw(SALOME_Exception);
+ double GetLength() const;
+
+ bool HavePreestimatedLength() const { return _preestimated > 0.; }
+ double GetPreestimatedLength() const { return _preestimated; }
+ void SetPreestimatedLength(double length);
+
+ void SetUsePreestimatedLength(bool toUse);
+ bool GetUsePreestimatedLength() const;
+
+ virtual std::ostream & SaveTo(std::ostream & save);
+ virtual std::istream & LoadFrom(std::istream & load);
+
+ /*!
+ * \brief Initialize segment length by the mesh built on the geometry
+ * \param theMesh - the built mesh
+ * \param theShape - the geometry of interest
+ * \retval bool - true if parameter values have been successfully defined
+ */
+ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
+
+ /*!
+ * \brief Initialize my parameter values by linear size of mesh element.
+ * \retval bool - true if parameter values have been successfully defined
+ */
+ virtual bool SetParametersByElementSize( double elemLenght, const SMESH_Mesh* theMesh=0);
+
+ protected:
+ double _length, _preestimated;
+ bool _preestimation;
+};
+
+#endif
#include <QHBoxLayout>
#include <QSlider>
#include <QLabel>
+#include <QCheckBox>
const double VALUE_MAX = 1.0e+15, // COORD_MAX
VALUE_MAX_2 = VALUE_MAX * VALUE_MAX,
if ( i < myCustomWidgets.count() ) {
QList<QWidget*>::const_iterator anIt = myCustomWidgets.begin();
QList<QWidget*>::const_iterator aLast = myCustomWidgets.end();
- for ( int j = 0 ; !w && anIt != aLast; ++anIt )
+ for ( int j = 0 ; !w && anIt != aLast; ++anIt, ++j )
if ( i == j )
w = *anIt;
}
h->SetLength( params[0].myValue.toDouble() );
h->SetPrecision( params[1].myValue.toDouble() );
}
+ else if( hypType()=="MaxLength" )
+ {
+ StdMeshers::StdMeshers_MaxLength_var h =
+ StdMeshers::StdMeshers_MaxLength::_narrow( hypothesis() );
+
+ h->SetLength( params[0].myValue.toDouble() );
+ h->SetUsePreestimatedLength( widget< QCheckBox >( 1 )->isChecked() );
+ if ( !h->HavePreestimatedLength() && !h->_is_equivalent( initParamsHypothesis() )) {
+ StdMeshers::StdMeshers_MaxLength_var hInit =
+ StdMeshers::StdMeshers_MaxLength::_narrow( initParamsHypothesis() );
+ h->SetPreestimatedLength( hInit->GetPreestimatedLength() );
+ }
+ }
else if( hypType()=="SegmentLengthAroundVertex" )
{
StdMeshers::StdMeshers_SegmentLengthAroundVertex_var h =
item.myValue = h->GetPrecision();
p.append( item );
}
+ if( hypType()=="MaxLength" )
+ {
+ StdMeshers::StdMeshers_MaxLength_var h =
+ StdMeshers::StdMeshers_MaxLength::_narrow( hyp );
+
+ item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
+ item.myValue = h->GetLength();
+ p.append( item );
+ customWidgets()->append(0);
+
+ item.myName = tr("SMESH_USE_PREESTIMATED_LENGTH");
+ p.append( item );
+ QCheckBox* aQCheckBox = new QCheckBox(dlg());
+ if ( h->HavePreestimatedLength() ) {
+ aQCheckBox->setChecked( h->GetUsePreestimatedLength() );
+ connect( aQCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( onValueChanged() ) );
+ }
+ else {
+ aQCheckBox->setChecked( false );
+ aQCheckBox->setEnabled( false );
+ }
+ customWidgets()->append( aQCheckBox );
+ }
else if( hypType()=="SegmentLengthAroundVertex" )
{
StdMeshers::StdMeshers_SegmentLengthAroundVertex_var h =
{
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 );
}
+ else if( hypType()=="MaxLength" && sb )
+ {
+ sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 );
+ sb->setEnabled( !widget< QCheckBox >( 1 )->isChecked() );
+ }
else if( hypType()=="MaxElementArea" && sb )
{
sb->RangeStepAndValidator( VALUE_SMALL_2, VALUE_MAX_2, 1.0, 6 );
types.insert( "NumberOfLayers", "NUMBER_OF_LAYERS" );
types.insert( "LayerDistribution", "LAYER_DISTRIBUTION" );
types.insert( "SegmentLengthAroundVertex", "SEGMENT_LENGTH_AROUND_VERTEX" );
+ types.insert( "MaxLength", "MAX_LENGTH" );
}
QString res;
return true;
}
}
+ if ( hypType() == "MaxLength" ) {
+ param.myValue = "";
+ return true;
+ }
if ( widget->inherits( "StdMeshersGUI_ObjectReferenceParamWdg" ))
{
// show only 1st reference value
deactivateObjRefParamWdg( customWidgets() );
}
}
+
+//================================================================================
+/*!
+ * \brief
+ */
+//================================================================================
+
+void StdMeshersGUI_StdHypothesisCreator::valueChanged( QWidget* paramWidget)
+{
+ if ( hypType() == "MaxLength" && paramWidget == getWidgetForParam(1) ) {
+ getWidgetForParam(0)->setEnabled( !widget< QCheckBox >( 1 )->isChecked() );
+ if ( !getWidgetForParam(0)->isEnabled() ) {
+ StdMeshers::StdMeshers_MaxLength_var h =
+ StdMeshers::StdMeshers_MaxLength::_narrow( initParamsHypothesis() );
+ widget< QtxDoubleSpinBox >( 0 )->setValue( h->GetPreestimatedLength() );
+ }
+ }
+}
virtual ListOfWidgets* customWidgets() const;
virtual void onReject();
+ virtual void valueChanged( QWidget* );
+
template<class T>
T* widget(int i) const {
return dynamic_cast< T* >( getWidgetForParam( i ));
<source>ICON_DLG_LOCAL_LENGTH</source>
<translation>mesh_hypo_length.png</translation>
</message>
+ <message>
+ <source>ICON_DLG_MAX_LENGTH</source>
+ <translation>mesh_hypo_length.png</translation>
+ </message>
<message>
<source>ICON_DLG_MAX_ELEMENT_AREA</source>
<translation>mesh_hypo_area.png</translation>
<source>ICON_SMESH_TREE_HYPO_LocalLength</source>
<translation>mesh_tree_hypo_length.png</translation>
</message>
+ <message>
+ <source>ICON_SMESH_TREE_HYPO_MaxLength</source>
+ <translation>mesh_tree_hypo_length.png</translation>
+ </message>
<message>
<source>ICON_SMESH_TREE_HYPO_MaxElementArea</source>
<translation>mesh_tree_hypo_area.png</translation>
<source>SMESH_LOCAL_LENGTH_TITLE</source>
<translation>Hypothesis Construction</translation>
</message>
+ <message>
+ <source>SMESH_MAX_LENGTH_HYPOTHESIS</source>
+ <translation>Max Length</translation>
+ </message>
+ <message>
+ <source>SMESH_USE_PREESTIMATED_LENGTH</source>
+ <translation>Use preestimated length</translation>
+ </message>
+ <message>
+ <source>SMESH_MAX_LENGTH_TITLE</source>
+ <translation>Hypothesis Construction</translation>
+ </message>
<message>
<source>SMESH_MAX_ELEMENT_AREA_HYPOTHESIS</source>
<translation>Max. Element Area</translation>
StdMeshers_SegmentLengthAroundVertex_i.hxx \
StdMeshers_UseExisting_1D2D_i.hxx \
StdMeshers_TrianglePreference_i.hxx \
+ StdMeshers_MaxLength_i.hxx \
SMESH_StdMeshers_I.hxx
# Libraries targets
StdMeshers_SegmentAroundVertex_0D_i.cxx \
StdMeshers_SegmentLengthAroundVertex_i.cxx \
StdMeshers_UseExisting_1D2D_i.cxx \
- StdMeshers_TrianglePreference_i.cxx
+ StdMeshers_TrianglePreference_i.cxx \
+ StdMeshers_MaxLength_i.cxx
# additionnal information to compil and link file
libStdMeshersEngine_la_CPPFLAGS = \
--- /dev/null
+// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : StdMeshers_MaxLength_i.cxx
+// Module : SMESH
+
+#include "StdMeshers_MaxLength_i.hxx"
+#include "SMESH_Gen_i.hxx"
+#include "SMESH_Gen.hxx"
+#include "SMESH_PythonDump.hxx"
+
+#include "Utils_CorbaException.hxx"
+#include "utilities.h"
+
+#include <TCollection_AsciiString.hxx>
+
+using namespace std;
+
+//=============================================================================
+/*!
+ * StdMeshers_MaxLength_i::StdMeshers_MaxLength_i
+ *
+ * Constructor
+ */
+//=============================================================================
+
+StdMeshers_MaxLength_i::StdMeshers_MaxLength_i( PortableServer::POA_ptr thePOA,
+ int theStudyId,
+ ::SMESH_Gen* theGenImpl )
+ : SALOME::GenericObj_i( thePOA ),
+ SMESH_Hypothesis_i( thePOA )
+{
+ myBaseImpl = new ::StdMeshers_MaxLength( theGenImpl->GetANewId(),
+ theStudyId,
+ theGenImpl );
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_MaxLength_i::~StdMeshers_MaxLength_i
+ *
+ * Destructor
+ */
+//=============================================================================
+
+StdMeshers_MaxLength_i::~StdMeshers_MaxLength_i()
+{
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_MaxLength_i::SetLength
+ *
+ * Set length
+ */
+//=============================================================================
+void StdMeshers_MaxLength_i::SetLength( CORBA::Double theLength )
+ throw ( SALOME::SALOME_Exception )
+{
+ ASSERT( myBaseImpl );
+ try {
+ this->GetImpl()->SetLength( theLength );
+ }
+ catch ( SALOME_Exception& S_ex ) {
+ THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
+ SALOME::BAD_PARAM );
+ }
+
+ // Update Python script
+ SMESH::TPythonDump() << _this() << ".SetLength( " << theLength << " )";
+}
+
+//=============================================================================
+/*!
+ * Sets preestimation flag
+ */
+//=============================================================================
+void StdMeshers_MaxLength_i::SetUsePreestimatedLength( CORBA::Boolean toUse )
+ throw ( SALOME::SALOME_Exception )
+{
+ ASSERT( myBaseImpl );
+ try {
+ this->GetImpl()->SetUsePreestimatedLength( toUse );
+ }
+ catch ( SALOME_Exception& S_ex ) {
+ THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
+ SALOME::BAD_PARAM );
+ }
+
+ // this is an internal kitchen call - no Python dump
+ // Update Python script
+ //SMESH::TPythonDump() << _this() << ".SetUsePreestimatedLength( " << toUse << " )";
+}
+
+//=============================================================================
+/*!
+ * Sets preestimation length
+ */
+//=============================================================================
+void StdMeshers_MaxLength_i::SetPreestimatedLength( CORBA::Double theLength )
+{
+ ASSERT( myBaseImpl );
+ try {
+ this->GetImpl()->SetPreestimatedLength( theLength );
+ }
+ catch ( SALOME_Exception& S_ex ) {
+ THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
+ SALOME::BAD_PARAM );
+ }
+ // this is an internal kitchen call - no Python dump
+ // Update Python script
+ //SMESH::TPythonDump() << _this() << ".SetPreestimatedLength( " << toUse << " )";
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_MaxLength_i::GetLength
+ *
+ * Get length
+ */
+//=============================================================================
+CORBA::Double StdMeshers_MaxLength_i::GetLength()
+{
+ ASSERT( myBaseImpl );
+ return this->GetImpl()->GetLength();
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_MaxLength_i::GetPreestimatedLength
+ */
+//=============================================================================
+CORBA::Double StdMeshers_MaxLength_i::GetPreestimatedLength()
+{
+ ASSERT( myBaseImpl );
+ return this->GetImpl()->GetPreestimatedLength();
+}
+
+//=============================================================================
+/*!
+ * Returns preestimation flag
+ */
+//=============================================================================
+CORBA::Boolean StdMeshers_MaxLength_i::GetUsePreestimatedLength()
+{
+ ASSERT( myBaseImpl );
+ return this->GetImpl()->GetUsePreestimatedLength();
+}
+
+//================================================================================
+/*!
+ * \brief Returns true if preestemated length is defined
+ */
+//================================================================================
+
+CORBA::Boolean StdMeshers_MaxLength_i::HavePreestimatedLength()
+{
+ ASSERT( myBaseImpl );
+ return this->GetImpl()->HavePreestimatedLength();
+}
+
+//=============================================================================
+/*!
+ * StdMeshers_MaxLength_i::GetImpl
+ *
+ * Get implementation
+ */
+//=============================================================================
+::StdMeshers_MaxLength* StdMeshers_MaxLength_i::GetImpl()
+{
+ return ( ::StdMeshers_MaxLength* )myBaseImpl;
+}
+
+//================================================================================
+/*!
+ * \brief Verify whether hypothesis supports given entity type
+ * \param type - dimension (see SMESH::Dimension enumeration)
+ * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
+ *
+ * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
+ */
+//================================================================================
+CORBA::Boolean StdMeshers_MaxLength_i::IsDimSupported( SMESH::Dimension type )
+{
+ return type == SMESH::DIM_1D;
+}
--- /dev/null
+// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : StdMeshers_MaxLength_i.hxx
+// Module : SMESH
+
+#ifndef _SMESH_MaxLength_I_HXX_
+#define _SMESH_MaxLength_I_HXX_
+
+#include "SMESH_StdMeshers_I.hxx"
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
+#include "SMESH_Hypothesis_i.hxx"
+#include "StdMeshers_MaxLength.hxx"
+
+class SMESH_Gen;
+
+// ======================================================
+// Local Length hypothesis
+// ======================================================
+class STDMESHERS_I_EXPORT StdMeshers_MaxLength_i:
+ public virtual POA_StdMeshers::StdMeshers_MaxLength,
+ public virtual SMESH_Hypothesis_i
+{
+public:
+ // Constructor
+ StdMeshers_MaxLength_i( PortableServer::POA_ptr thePOA,
+ int theStudyId,
+ ::SMESH_Gen* theGenImpl );
+ // Destructor
+ virtual ~StdMeshers_MaxLength_i();
+
+ // Set length
+ void SetLength( CORBA::Double theLength )
+ throw ( SALOME::SALOME_Exception );
+ // Set precision
+
+ // Sets preestimation flag
+ void SetUsePreestimatedLength( CORBA::Boolean toUse)
+ throw ( SALOME::SALOME_Exception );
+
+ // Get length
+ CORBA::Double GetLength();
+
+ // Returns true if preestemated length is defined
+ CORBA::Boolean HavePreestimatedLength();
+
+ CORBA::Double GetPreestimatedLength();
+
+ // Sets preestemated length
+ void SetPreestimatedLength(CORBA::Double theLength);
+
+ // Returns preestimation flag
+ CORBA::Boolean GetUsePreestimatedLength();
+
+ // Get implementation
+ ::StdMeshers_MaxLength* GetImpl();
+
+ // Verify whether hypothesis supports given entity type
+ CORBA::Boolean IsDimSupported( SMESH::Dimension type );
+};
+
+#endif
+
#include "StdMeshers_NumberOfLayers_i.hxx"
#include "StdMeshers_LayerDistribution_i.hxx"
#include "StdMeshers_SegmentLengthAroundVertex_i.hxx"
+#include "StdMeshers_MaxLength_i.hxx"
#include "StdMeshers_Regular_1D_i.hxx"
#include "StdMeshers_MEFISTO_2D_i.hxx"
// Hypotheses
if (strcmp(aHypName, "LocalLength") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_LocalLength_i>;
+ else if (strcmp(aHypName, "MaxLength") == 0)
+ aCreator = new StdHypothesisCreator_i<StdMeshers_MaxLength_i>;
else if (strcmp(aHypName, "NumberOfSegments") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_NumberOfSegments_i>;
else if (strcmp(aHypName, "LengthFromEdges") == 0)