mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 17:30:35 +05:00
22360: EDF SMESH: Body Fitting algorithm: incorporate edges
This commit is contained in:
parent
0689c0955d
commit
b0d030f73d
@ -952,7 +952,7 @@ module StdMeshers
|
||||
/*!
|
||||
* Set size threshold. A polyhedral cell got by cutting an initial
|
||||
* hexahedron by geometry boundary is considered small and is removed if
|
||||
* it's size is \athreshold times less than the size of the initial hexahedron.
|
||||
* it's size is \a threshold times less than the size of the initial hexahedron.
|
||||
* threshold must be > 1.0
|
||||
*/
|
||||
void SetSizeThreshold(in double threshold) raises (SALOME::SALOME_Exception);
|
||||
@ -987,6 +987,13 @@ module StdMeshers
|
||||
void GetGridSpacing(out SMESH::string_array spaceFunctions,
|
||||
out SMESH::double_array internalPoints,
|
||||
in short axis) raises (SALOME::SALOME_Exception);
|
||||
/*!
|
||||
* Enables implementation of geometrical edges into the mesh. If this feature
|
||||
* is disabled, sharp edges of the shape are lost ("smoothed") in the mesh if
|
||||
* they don't coincide with the grid lines
|
||||
*/
|
||||
void SetToAddEdges(in boolean toAdd);
|
||||
boolean GetToAddEdges();
|
||||
|
||||
/*!
|
||||
* \brief Computes node coordinates by spacing functions
|
||||
@ -994,13 +1001,15 @@ module StdMeshers
|
||||
* \param x1 - upper coordinate
|
||||
* \param spaceFuns - space functions
|
||||
* \param points - internal points
|
||||
* \param coords - the computed coordinates
|
||||
* \param axisName - e.g. "X"
|
||||
* \return the computed coordinates
|
||||
*/
|
||||
SMESH::double_array ComputeCoordinates(in double x0,
|
||||
in double x1,
|
||||
in SMESH::string_array spaceFuns,
|
||||
in SMESH::double_array points,
|
||||
in string axisName ) raises (SALOME::SALOME_Exception);
|
||||
in string axisName )
|
||||
raises (SALOME::SALOME_Exception);
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -32,11 +32,12 @@
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=======================================================================
|
||||
@ -48,10 +49,23 @@ StdMeshers_CartesianParameters3D::StdMeshers_CartesianParameters3D(int h
|
||||
int studyId,
|
||||
SMESH_Gen * gen)
|
||||
: SMESH_Hypothesis(hypId, studyId, gen),
|
||||
_sizeThreshold( 4.0 ) // default according to the customer specification
|
||||
_sizeThreshold( 4.0 ), // default according to the customer specification
|
||||
_toAddEdges( false )
|
||||
{
|
||||
_name = "CartesianParameters3D"; // used by "Cartesian_3D"
|
||||
_param_algo_dim = 3; // 3D
|
||||
|
||||
_axisDirs[0] = 1.;
|
||||
_axisDirs[1] = 0.;
|
||||
_axisDirs[2] = 0.;
|
||||
|
||||
_axisDirs[3] = 0.;
|
||||
_axisDirs[4] = 1.;
|
||||
_axisDirs[5] = 0.;
|
||||
|
||||
_axisDirs[6] = 0.;
|
||||
_axisDirs[7] = 0.;
|
||||
_axisDirs[8] = 1.;
|
||||
}
|
||||
|
||||
|
||||
@ -308,6 +322,44 @@ void StdMeshers_CartesianParameters3D::GetCoordinates(std::vector<double>& xNode
|
||||
zNodes = _coords[2];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetAxisDirs
|
||||
//purpose : Sets directions of axes
|
||||
//=======================================================================
|
||||
|
||||
void StdMeshers_CartesianParameters3D::SetAxisDirs(const double* the9DirComps)
|
||||
throw ( SALOME_Exception )
|
||||
{
|
||||
gp_Vec x( the9DirComps[0],
|
||||
the9DirComps[1],
|
||||
the9DirComps[2] );
|
||||
gp_Vec y( the9DirComps[3],
|
||||
the9DirComps[4],
|
||||
the9DirComps[5] );
|
||||
gp_Vec z( the9DirComps[6],
|
||||
the9DirComps[7],
|
||||
the9DirComps[8] );
|
||||
if ( x.Magnitude() < RealSmall() ||
|
||||
y.Magnitude() < RealSmall() ||
|
||||
z.Magnitude() < RealSmall() )
|
||||
throw SALOME_Exception("Zero magnitude of axis direction");
|
||||
|
||||
if ( x.IsParallel( y, M_PI / 180. ) ||
|
||||
x.IsParallel( z, M_PI / 180. ) ||
|
||||
y.IsParallel( z, M_PI / 180. ))
|
||||
throw SALOME_Exception("Parallel axis directions");
|
||||
|
||||
bool isChanged = false;
|
||||
for ( int i = 0; i < 9; ++i )
|
||||
{
|
||||
if ( Abs( _axisDirs[i] - the9DirComps[i] ) > 1e-7 )
|
||||
isChanged = true;
|
||||
_axisDirs[i] = the9DirComps[i];
|
||||
}
|
||||
if ( isChanged )
|
||||
NotifySubMeshesHypothesisModification();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetGrid
|
||||
//purpose : Return coordinates of node positions along the three axes
|
||||
@ -332,6 +384,33 @@ double StdMeshers_CartesianParameters3D::GetSizeThreshold() const
|
||||
return _sizeThreshold;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetToAddEdges
|
||||
//purpose : Enables implementation of geometrical edges into the mesh. If this feature
|
||||
// is disabled, sharp edges of the shape are lost ("smoothed") in the mesh if
|
||||
// they don't coincide with the grid lines
|
||||
//=======================================================================
|
||||
|
||||
void StdMeshers_CartesianParameters3D::SetToAddEdges(bool toAdd)
|
||||
{
|
||||
if ( _toAddEdges != toAdd )
|
||||
{
|
||||
_toAddEdges = toAdd;
|
||||
NotifySubMeshesHypothesisModification();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetToAddEdges
|
||||
//purpose : Returns true if implementation of geometrical edges into the
|
||||
// mesh is enabled
|
||||
//=======================================================================
|
||||
|
||||
bool StdMeshers_CartesianParameters3D::GetToAddEdges() const
|
||||
{
|
||||
return _toAddEdges;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDefined
|
||||
//purpose : Return true if parameters are well defined
|
||||
@ -369,6 +448,7 @@ std::ostream & StdMeshers_CartesianParameters3D::SaveTo(std::ostream & save)
|
||||
for ( size_t j = 0; j < _spaceFunctions[i].size(); ++j )
|
||||
save << _spaceFunctions[i][j] << " ";
|
||||
}
|
||||
save << _toAddEdges << " ";
|
||||
|
||||
return save;
|
||||
}
|
||||
@ -382,7 +462,7 @@ std::istream & StdMeshers_CartesianParameters3D::LoadFrom(std::istream & load)
|
||||
{
|
||||
bool ok;
|
||||
|
||||
ok = (load >> _sizeThreshold );
|
||||
ok = ( load >> _sizeThreshold );
|
||||
for ( int ax = 0; ax < 3; ++ax )
|
||||
{
|
||||
if (ok)
|
||||
@ -419,6 +499,9 @@ std::istream & StdMeshers_CartesianParameters3D::LoadFrom(std::istream & load)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
load >> _toAddEdges;
|
||||
|
||||
return load;
|
||||
}
|
||||
|
||||
|
@ -100,6 +100,10 @@ public:
|
||||
std::vector<double>& yNodes,
|
||||
std::vector<double>& zNodes,
|
||||
const Bnd_Box& bndBox) const throw ( SALOME_Exception );
|
||||
|
||||
void SetAxisDirs(const double* the9DirComps) throw ( SALOME_Exception );
|
||||
const double* GetAxisDirs() const { return _axisDirs; }
|
||||
|
||||
/*!
|
||||
* Set size threshold. A polyhedral cell got by cutting an initial
|
||||
* hexahedron by geometry boundary is considered small and is removed if
|
||||
@ -111,6 +115,14 @@ public:
|
||||
*/
|
||||
double GetSizeThreshold() const;
|
||||
|
||||
/*!
|
||||
* \brief Enables implementation of geometrical edges into the mesh. If this feature
|
||||
* is disabled, sharp edges of the shape are lost ("smoothed") in the mesh if
|
||||
* they don't coincide with the grid lines
|
||||
*/
|
||||
void SetToAddEdges(bool toAdd);
|
||||
bool GetToAddEdges() const;
|
||||
|
||||
/*!
|
||||
* \brief Return true if parameters are well defined
|
||||
*/
|
||||
@ -138,7 +150,10 @@ public:
|
||||
std::vector<std::string> _spaceFunctions[3];
|
||||
std::vector<double> _internalPoints[3];
|
||||
|
||||
double _axisDirs[9];
|
||||
|
||||
double _sizeThreshold;
|
||||
bool _toAddEdges;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -42,6 +42,7 @@
|
||||
#include <QAbstractItemModel>
|
||||
#include <QApplication>
|
||||
#include <QButtonGroup>
|
||||
#include <QCheckBox>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
@ -49,14 +50,14 @@
|
||||
#include <QLineEdit>
|
||||
#include <QListWidget>
|
||||
#include <QModelIndex>
|
||||
#include <QPushButton>
|
||||
#include <QRadioButton>
|
||||
#include <QString>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QTabWidget>
|
||||
#include <QTreeWidget>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QVBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QTabWidget>
|
||||
|
||||
#define SPACING 6
|
||||
#define MARGIN 11
|
||||
@ -162,7 +163,7 @@ namespace StdMeshersGUI
|
||||
myStepSpin->SetValue( myStep = 1. );
|
||||
|
||||
// 3) Coodrinates/Spacing group
|
||||
QFrame* csFrame = new QFrame( this );
|
||||
QFrame* csFrame = new QFrame( this );
|
||||
QVBoxLayout* scLay = new QVBoxLayout( csFrame );
|
||||
scLay->setMargin( 0 );
|
||||
scLay->setSpacing( SPACING );
|
||||
@ -610,7 +611,12 @@ QFrame* StdMeshersGUI_CartesianParamCreator::buildFrame()
|
||||
argGroupLayout->addWidget( myThreshold, row, 1 );
|
||||
row++;
|
||||
|
||||
// 2) Grid definition
|
||||
// 2) "Implement edges"
|
||||
myAddEdges = new QCheckBox( tr("ADD_EDGES"), GroupC1 );
|
||||
argGroupLayout->addWidget( myAddEdges, row, 0, 1, 2 );
|
||||
row++;
|
||||
|
||||
// 3) Grid definition
|
||||
QTabWidget* tabWdg = new QTabWidget( fr );
|
||||
myAxisTabs[ 0 ] = new StdMeshersGUI::GridAxisTab( tabWdg, 0 );
|
||||
myAxisTabs[ 1 ] = new StdMeshersGUI::GridAxisTab( tabWdg, 1 );
|
||||
@ -637,6 +643,8 @@ void StdMeshersGUI_CartesianParamCreator::retrieveParams() const
|
||||
else
|
||||
myThreshold->setText( varName );
|
||||
|
||||
myAddEdges->setChecked( h->GetToAddEdges() );
|
||||
|
||||
for ( int ax = 0; ax < 3; ++ax )
|
||||
{
|
||||
if ( h->IsGridBySpacing( ax ))
|
||||
@ -653,7 +661,8 @@ void StdMeshersGUI_CartesianParamCreator::retrieveParams() const
|
||||
}
|
||||
}
|
||||
if ( dlg() )
|
||||
dlg()->setMinimumSize( dlg()->minimumSizeHint().width(), dlg()->minimumSizeHint().height() );
|
||||
dlg()->setMinimumSize( dlg()->minimumSizeHint().width(),
|
||||
dlg()->minimumSizeHint().height() );
|
||||
}
|
||||
|
||||
QString StdMeshersGUI_CartesianParamCreator::storeParams() const
|
||||
@ -668,6 +677,7 @@ QString StdMeshersGUI_CartesianParamCreator::storeParams() const
|
||||
|
||||
h->SetVarParameter( myThreshold->text().toLatin1().constData(), "SetSizeThreshold" );
|
||||
h->SetSizeThreshold( myThreshold->text().toDouble() );
|
||||
h->SetToAddEdges( myAddEdges->isChecked() );
|
||||
|
||||
for ( int ax = 0; ax < 3; ++ax )
|
||||
{
|
||||
|
@ -39,18 +39,19 @@
|
||||
#include <QFrame>
|
||||
#include <QItemDelegate>
|
||||
|
||||
class SMESHGUI_SpinBox;
|
||||
class QLineEdit;
|
||||
class QButtonGroup;
|
||||
class QTreeWidgetItem;
|
||||
class QString;
|
||||
class QWidget;
|
||||
class QTreeWidget;
|
||||
class QListWidget;
|
||||
class QStyleOptionViewItem;
|
||||
class QModelIndex;
|
||||
class QAbstractItemModel;
|
||||
class QButtonGroup;
|
||||
class QCheckBox;
|
||||
class QLineEdit;
|
||||
class QListWidget;
|
||||
class QListWidgetItem;
|
||||
class QModelIndex;
|
||||
class QString;
|
||||
class QStyleOptionViewItem;
|
||||
class QTreeWidget;
|
||||
class QTreeWidgetItem;
|
||||
class QWidget;
|
||||
class SMESHGUI_SpinBox;
|
||||
|
||||
namespace StdMeshersGUI
|
||||
{
|
||||
@ -136,6 +137,7 @@ protected:
|
||||
private:
|
||||
QLineEdit* myName;
|
||||
SMESHGUI_SpinBox* myThreshold;
|
||||
QCheckBox* myAddEdges;
|
||||
StdMeshersGUI::GridAxisTab* myAxisTabs[3];
|
||||
};
|
||||
|
||||
|
@ -493,6 +493,10 @@
|
||||
<source>THRESHOLD</source>
|
||||
<translation>Threshold</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADD_EDGES</source>
|
||||
<translation>Implement Edges</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AXIS_X</source>
|
||||
<translation>Axis X</translation>
|
||||
|
@ -3,6 +3,31 @@
|
||||
<TS version="2.0" language="fr_FR">
|
||||
<context>
|
||||
<name>@default</name>
|
||||
<message>
|
||||
<source>SMESH_EDGES_WITH_LAYERS</source>
|
||||
<translation type="unfinished">Edges with layers</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_FACES_WITH_LAYERS</source>
|
||||
<translation type="unfinished">Faces with layers
|
||||
(walls)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_ADAPTIVE1D_TITLE</source>
|
||||
<translation type="unfinished">Hypothesis Construction</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_MAX_SIZE</source>
|
||||
<translation type="unfinished">Max size</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_MIN_SIZE</source>
|
||||
<translation type="unfinished">Min size</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_ADAPTIVE1D_HYPOTHESIS</source>
|
||||
<translation type="unfinished">Adaptive</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_ARITHMETIC_1D_HYPOTHESIS</source>
|
||||
<translation>Arithmétique 1D</translation>
|
||||
@ -450,6 +475,10 @@
|
||||
</context>
|
||||
<context>
|
||||
<name>StdMeshersGUI_CartesianParamCreator</name>
|
||||
<message>
|
||||
<source>ADD_EDGES</source>
|
||||
<translation type="unfinished">Implement Edges</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>THRESHOLD</source>
|
||||
<translation>Seuil</translation>
|
||||
@ -486,4 +515,19 @@
|
||||
<translation>Pas</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>StdMeshersGUI_StdHypothesisCreator</name>
|
||||
<message>
|
||||
<source>TO_IGNORE_EDGES</source>
|
||||
<translation type="unfinished">Edges without layers (inlets and oulets)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NOT_TO_IGNORE_EDGES</source>
|
||||
<translation type="unfinished">Edges with layers (walls)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TO_IGNORE_EDGES_OR_NOT</source>
|
||||
<translation type="unfinished">Specified edges are</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -224,6 +224,28 @@ void StdMeshers_CartesianParameters3D_i::GetGridSpacing(SMESH::string_array_out
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetToAddEdges
|
||||
//purpose : Enables implementation of geometrical edges into the mesh.
|
||||
//=======================================================================
|
||||
|
||||
void StdMeshers_CartesianParameters3D_i::SetToAddEdges(CORBA::Boolean toAdd)
|
||||
{
|
||||
GetImpl()->SetToAddEdges( toAdd );
|
||||
SMESH::TPythonDump() << _this() << ".SetToAddEdges( " << toAdd << " )";
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetToAddEdges
|
||||
//purpose : Returns true if implementation of geometrical edges into the
|
||||
// mesh is enabled
|
||||
//=======================================================================
|
||||
|
||||
CORBA::Boolean StdMeshers_CartesianParameters3D_i::GetToAddEdges()
|
||||
{
|
||||
return GetImpl()->GetToAddEdges();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsGridBySpacing
|
||||
//purpose : Return true if the grid is defined by spacing functions and
|
||||
|
@ -84,6 +84,14 @@ class STDMESHERS_I_EXPORT StdMeshers_CartesianParameters3D_i:
|
||||
SMESH::double_array_out xInternalPoints,
|
||||
CORBA::Short axis) throw (SALOME::SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* \brief Enables implementation of geometrical edges into the mesh. If this feature
|
||||
* is disabled, sharp edges of the shape are lost ("smoothed") in the mesh if
|
||||
* they don't coincide with the grid lines
|
||||
*/
|
||||
void SetToAddEdges(CORBA::Boolean toAdd);
|
||||
CORBA::Boolean GetToAddEdges();
|
||||
|
||||
/*!
|
||||
* \brief Return true if the grid is defined by spacing functions and
|
||||
* not by node coordinates
|
||||
|
Loading…
Reference in New Issue
Block a user