mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 17:30:35 +05:00
0019941: EDF 766 SMESH : Max length hypothesis
+ interface StdMeshers_MaxLength : SMESH::SMESH_Hypothesis
This commit is contained in:
parent
1873788543
commit
f35204c6bd
@ -72,6 +72,44 @@ module StdMeshers
|
||||
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
|
||||
*/
|
||||
|
@ -21,6 +21,11 @@
|
||||
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"
|
||||
@ -130,7 +135,7 @@
|
||||
<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"
|
||||
@ -139,7 +144,7 @@
|
||||
<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"
|
||||
@ -242,11 +247,11 @@
|
||||
<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>
|
||||
|
@ -1187,6 +1187,13 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th
|
||||
// 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");
|
||||
|
@ -3040,6 +3040,32 @@ class Mesh_Segment(Mesh_Algorithm):
|
||||
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)
|
||||
|
@ -67,7 +67,8 @@ salomeinclude_HEADERS = \
|
||||
StdMeshers_QuadToTriaAdaptor.hxx \
|
||||
SMESH_StdMeshers.hxx \
|
||||
StdMeshers_TrianglePreference.hxx \
|
||||
StdMeshers_CompositeHexa_3D.hxx
|
||||
StdMeshers_CompositeHexa_3D.hxx \
|
||||
StdMeshers_MaxLength.hxx
|
||||
|
||||
# Libraries targets
|
||||
|
||||
@ -111,7 +112,8 @@ dist_libStdMeshers_la_SOURCES = \
|
||||
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
|
||||
|
241
src/StdMeshers/StdMeshers_MaxLength.cxx
Normal file
241
src/StdMeshers/StdMeshers_MaxLength.cxx
Normal file
@ -0,0 +1,241 @@
|
||||
// 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 );
|
||||
}
|
||||
|
71
src/StdMeshers/StdMeshers_MaxLength.hxx
Normal file
71
src/StdMeshers/StdMeshers_MaxLength.hxx
Normal file
@ -0,0 +1,71 @@
|
||||
// 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
|
@ -45,6 +45,7 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <QSlider>
|
||||
#include <QLabel>
|
||||
#include <QCheckBox>
|
||||
|
||||
const double VALUE_MAX = 1.0e+15, // COORD_MAX
|
||||
VALUE_MAX_2 = VALUE_MAX * VALUE_MAX,
|
||||
@ -91,7 +92,7 @@ QWidget* StdMeshersGUI_StdHypothesisCreator::getWidgetForParam( int i ) const
|
||||
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;
|
||||
}
|
||||
@ -408,6 +409,19 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
||||
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 =
|
||||
@ -558,6 +572,29 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
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 =
|
||||
@ -740,6 +777,11 @@ void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int)
|
||||
{
|
||||
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 );
|
||||
@ -827,6 +869,7 @@ QString StdMeshersGUI_StdHypothesisCreator::hypTypeName( const QString& t ) cons
|
||||
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;
|
||||
@ -878,6 +921,10 @@ bool StdMeshersGUI_StdHypothesisCreator::getParamFromCustomWidget( StdParam & pa
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ( hypType() == "MaxLength" ) {
|
||||
param.myValue = "";
|
||||
return true;
|
||||
}
|
||||
if ( widget->inherits( "StdMeshersGUI_ObjectReferenceParamWdg" ))
|
||||
{
|
||||
// show only 1st reference value
|
||||
@ -912,3 +959,21 @@ void StdMeshersGUI_StdHypothesisCreator::onReject()
|
||||
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() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,8 @@ protected:
|
||||
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 ));
|
||||
|
@ -26,6 +26,10 @@
|
||||
<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>
|
||||
@ -130,6 +134,10 @@
|
||||
<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>
|
||||
|
@ -126,6 +126,18 @@
|
||||
<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>
|
||||
|
@ -60,6 +60,7 @@ salomeinclude_HEADERS = \
|
||||
StdMeshers_SegmentLengthAroundVertex_i.hxx \
|
||||
StdMeshers_UseExisting_1D2D_i.hxx \
|
||||
StdMeshers_TrianglePreference_i.hxx \
|
||||
StdMeshers_MaxLength_i.hxx \
|
||||
SMESH_StdMeshers_I.hxx
|
||||
|
||||
# Libraries targets
|
||||
@ -96,7 +97,8 @@ dist_libStdMeshersEngine_la_SOURCES = \
|
||||
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 = \
|
||||
|
204
src/StdMeshers_I/StdMeshers_MaxLength_i.cxx
Normal file
204
src/StdMeshers_I/StdMeshers_MaxLength_i.cxx
Normal file
@ -0,0 +1,204 @@
|
||||
// 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;
|
||||
}
|
84
src/StdMeshers_I/StdMeshers_MaxLength_i.hxx
Normal file
84
src/StdMeshers_I/StdMeshers_MaxLength_i.hxx
Normal file
@ -0,0 +1,84 @@
|
||||
// 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
|
||||
|
@ -51,6 +51,7 @@
|
||||
#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"
|
||||
@ -87,6 +88,8 @@ STDMESHERS_I_EXPORT
|
||||
// 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)
|
||||
|
Loading…
Reference in New Issue
Block a user