triaGroup = mesh.MakeGroupByCriteria( "Tria AR < 1.5", crit )
print "Number of triangles with aspect ratio < 1.5:", triaGroup.Size()
+# get range of values of Aspect Ratio of all faces in the mesh
+aspects = mesh.GetMinMax( SMESH.FT_AspectRatio )
+print "MESH: Min aspect = %s, Max aspect = %s" % ( aspects[0], aspects[1] )
+
+# get max value of Aspect Ratio of faces in triaGroup
+grAspects = mesh.GetMinMax( SMESH.FT_AspectRatio, triaGroup )
+print "GROUP: Max aspect = %s" % grAspects[1]
distribution as blue crosses. The node distribution is computed in the
same way as for
\ref analyticdensity_anchor "Distribution with Analytic Density". You
-can select the <b>Conversion mode</b> from\b Exponent and <b>Cut
+can select the <b>Conversion mode</b> from \b Exponent and <b>Cut
negative</b>.
\image html distributionwithtabledensity.png
location of a set of edges within the model.
<b>Propagation chains</b> group allows defining <b>Reversed Edges</b>
-for splitting opposite edges of quadrilateral faces
-in a logically uniform direction. When this group is
-activated, the list is filled with propagation chains found within the
-model. When a chain is selected in the list its edges are
-shown in the Viewer with arrows, which enables choosing a common
-direction for all chain edges. \b Reverse button inverts the common
-direction of chain edges. If \b Add button is active, some
-edges of a chain have a different direction, so you can click \b Add
-button to add them to <b>Reversed Edges</b> list.
+for splitting opposite edges of quadrilateral faces in a logically
+uniform direction. When this group is activated, the list is filled
+with propagation chains found within the shape on which a hypothesis
+is assigned. When a chain is selected in the list its edges are shown
+in the Viewer with arrows, which enables choosing a common direction
+for all chain edges. \b Reverse button inverts the common direction of
+chain edges. \b Add button is active if some edges of a chain have a
+different direction, so you can click \b Add button to add them
+to <b>Reversed Edges</b> list.
\image html propagation_chain.png "The whole geometry and a propagation chain"
+\note Alternatively, uniform direction of edges of one propagation
+chain can be achieved by
+\ref constructing_submeshes_page "definition of a sub-mesh" on one
+edge of the chain and assigning a
+\ref propagation_anchor "Propagation" additional hypothesis.
+Orientation of this edge (and hence of all the rest edges of the chain) can be
+controlled by using <b>Reversed Edges</b> field.
+
*/
\anchor filtering_elements
-When we use filters during a group creation or another operation (by
+When we use filters during group creation or another operation (by
clicking <b>Set Filter</b> button in the corresponding dialog), the
dialog for setting filters looks as shown below.
The \b Add button creates a new criterion at the end of the list of
criteria. The \b Insert button creates a new criterion before the
selected criterion. The \b Remove button deletes the selected
-criterion. The \b Clear button deletes all criteria.
+criterion. The \b Clear button deletes all criteria.\n
+If there is a choice of <b>Entity type</b> in the dialog, only
+criteria of currently selected type are used to create or change a
+filter, and criteria of hidden types (if were specified) are ignored.
\n Each <b>Entity type</b> has its specific list of criteria, however all
filters have common syntax. The <b>Threshold Value</b> should be specified
for most criteria. For numerical criteria it is necessary to indicate if
operators \a AND and \a OR. In addition, applied filter criterion can
be reverted using logical operator \a NOT.
-Mesh filters use the functionality of mesh quality controls to filter
+Mesh filters can use the functionality of mesh quality controls to filter
mesh nodes / elements by a specific characteristic (Area, Length, etc).
This page provides a short description of the existing mesh filters,
#ifdef _DEBUG_
// #define DEB_FACES
// #define DEB_GRID
-// #define DUMP_VERT(msg,V) { TopoDS_Vertex v = V; gp_Pnt p = BRep_Tool::Pnt(v); cout << msg << "( "<< p.X()<<", "<<p.Y()<<", "<<p.Z()<<" )"<<endl; }
+// #define DUMP_VERT(msg,V) \
+// { TopoDS_Vertex v = V; gp_Pnt p = BRep_Tool::Pnt(v); \
+// cout << msg << "( "<< p.X()<<", "<<p.Y()<<", "<<p.Z()<<" )"<<endl;}
#endif
#ifndef DUMP_VERT
enum EBoxSides{ B_BOTTOM=0, B_RIGHT, B_TOP, B_LEFT, B_FRONT, B_BACK, B_UNDEFINED };
+enum EAxes{ COO_X=1, COO_Y, COO_Z };
+
//================================================================================
/*!
* \brief Convertor of a pair of integers to a sole index
_QuadFaceGrid* FindAdjacentForSide(int i, list<_QuadFaceGrid>& faces, EBoxSides id) const;
//!< Reverse edges in order to have the bottom edge going along axes of the unit box
- void ReverseEdges(/*int e1, int e2*/);
+ void ReverseEdges();
bool IsComplex() const { return !myChildren.empty(); }
//!< Load nodes of a mesh
bool LoadGrid( SMESH_Mesh& mesh );
+ //!< Computes normalized parameters of nodes of myGrid
+ void ComputeIJK( int i1, int i2, double v3 );
+
//!< Return number of segments on the hirizontal sides
int GetNbHoriSegments(SMESH_Mesh& mesh, bool withBrothers=false) const;
//!< Return node coordinates by its position
gp_XYZ GetXYZ(int iHori, int iVert) const;
+ //!< Return normalized parameters of nodes within the unitary cube
+ gp_XYZ& GetIJK(int iCol, int iRow) { return myIJK[ myIndexer( iCol, iRow )]; }
+
public: //** Access to member fields **//
//!< Return i-th face side (0<i<4)
_QuadFaceGrid* myRightBrother;
_QuadFaceGrid* myUpBrother;
- _Indexer myIndexer;
+ _Indexer myIndexer;
vector<const SMDS_MeshNode*> myGrid;
+ vector<gp_XYZ> myIJK; // normalized parameters of nodes
SMESH_ComputeErrorPtr myError;
if ( !fRight ->LoadGrid( theMesh )) return error( fRight ->GetError() );
if ( !fTop ->LoadGrid( theMesh )) return error( fTop ->GetError() );
+ // compute normalized parameters of nodes on sides (PAL23189)
+ fBottom->ComputeIJK( COO_X, COO_Y, /*z=*/0. );
+ fBack ->ComputeIJK( COO_X, COO_Z, /*y=*/1. );
+ fLeft ->ComputeIJK( COO_Y, COO_Z, /*x=*/0. );
+ fFront ->ComputeIJK( COO_X, COO_Z, /*y=*/0. );
+ fRight ->ComputeIJK( COO_Y, COO_Z, /*x=*/1. );
+ fTop ->ComputeIJK( COO_X, COO_Y, /*z=*/1. );
+
int x, xSize = fBottom->GetNbHoriSegments(theMesh) + 1, X = xSize - 1;
int y, ySize = fBottom->GetNbVertSegments(theMesh) + 1, Y = ySize - 1;
int z, zSize = fFront ->GetNbVertSegments(theMesh) + 1, Z = zSize - 1;
pointsOnShapes[ SMESH_Block::ID_V011 ] = fTop->GetXYZ( 0, Y );
pointsOnShapes[ SMESH_Block::ID_V111 ] = fTop->GetXYZ( X, Y );
+ gp_XYZ params; // normalized parameters of an internal node within the unit box
+
for ( x = 1; x < xSize-1; ++x )
{
- gp_XYZ params; // normalized parameters of internal node within a unit box
- params.SetCoord( 1, x / double(X) );
+ const double rX = x / double(X);
for ( y = 1; y < ySize-1; ++y )
{
- params.SetCoord( 2, y / double(Y) );
+ const double rY = y / double(Y);
// column to fill during z loop
vector< const SMDS_MeshNode* >& column = columns[ colIndex( x, y )];
// points projections on horizontal edges
pointsOnShapes[ SMESH_Block::ID_Fxy1 ] = fTop ->GetXYZ( x, y );
for ( z = 1; z < zSize-1; ++z ) // z loop
{
- params.SetCoord( 3, z / double(Z) );
+ // compute normalized parameters of an internal node within the unit box
+ const double rZ = z / double(Z);
+ const gp_XYZ& pBo = fBottom->GetIJK( x, y );
+ const gp_XYZ& pTo = fTop ->GetIJK( x, y );
+ const gp_XYZ& pFr = fFront ->GetIJK( x, z );
+ const gp_XYZ& pBa = fBack ->GetIJK( x, z );
+ const gp_XYZ& pLe = fLeft ->GetIJK( y, z );
+ const gp_XYZ& pRi = fRight ->GetIJK( y, z );
+ params.SetCoord( 1, 0.5 * ( pBo.X() * ( 1. - rZ ) + pTo.X() * rZ +
+ pFr.X() * ( 1. - rY ) + pBa.X() * rY ));
+ params.SetCoord( 2, 0.5 * ( pBo.Y() * ( 1. - rZ ) + pTo.Y() * rZ +
+ pLe.Y() * ( 1. - rX ) + pRi.Y() * rX ));
+ params.SetCoord( 3, 0.5 * ( pFr.Z() * ( 1. - rY ) + pBa.Z() * rY +
+ pLe.Z() * ( 1. - rX ) + pRi.Z() * rX ));
+
// point projections on vertical edges
- pointsOnShapes[ SMESH_Block::ID_E00z ] = fFront->GetXYZ( 0, z );
- pointsOnShapes[ SMESH_Block::ID_E10z ] = fFront->GetXYZ( X, z );
- pointsOnShapes[ SMESH_Block::ID_E01z ] = fBack->GetXYZ( 0, z );
+ pointsOnShapes[ SMESH_Block::ID_E00z ] = fFront->GetXYZ( 0, z );
+ pointsOnShapes[ SMESH_Block::ID_E10z ] = fFront->GetXYZ( X, z );
+ pointsOnShapes[ SMESH_Block::ID_E01z ] = fBack->GetXYZ( 0, z );
pointsOnShapes[ SMESH_Block::ID_E11z ] = fBack->GetXYZ( X, z );
// point projections on vertical faces
- pointsOnShapes[ SMESH_Block::ID_Fx0z ] = fFront->GetXYZ( x, z );
+ pointsOnShapes[ SMESH_Block::ID_Fx0z ] = fFront->GetXYZ( x, z );
pointsOnShapes[ SMESH_Block::ID_Fx1z ] = fBack ->GetXYZ( x, z );
pointsOnShapes[ SMESH_Block::ID_F0yz ] = fLeft ->GetXYZ( y, z );
pointsOnShapes[ SMESH_Block::ID_F1yz ] = fRight->GetXYZ( y, z );
const SMDS_MeshElement* firstQuad = 0; // most left face above the last row of found nodes
int nbFoundNodes = myIndexer._xSize;
- while ( nbFoundNodes != (int) myGrid.size() )
+ while ( nbFoundNodes != myGrid.size() )
{
// first and last nodes of the last filled row of nodes
const SMDS_MeshNode* n1down = myGrid[ nbFoundNodes - myIndexer._xSize ];
return true;
}
+//================================================================================
+/*!
+ * \brief Fill myIJK with normalized parameters of nodes in myGrid
+ * \param [in] i1 - coordinate index along rows of myGrid
+ * \param [in] i2 - coordinate index along columns of myGrid
+ * \param [in] v3 - value of the constant parameter
+ */
+//================================================================================
+
+void _QuadFaceGrid::ComputeIJK( int i1, int i2, double v3 )
+{
+ gp_XYZ ijk( v3, v3, v3 );
+ myIJK.resize( myIndexer.size(), ijk );
+
+ const size_t nbCol = myIndexer._xSize;
+ const size_t nbRow = myIndexer._ySize;
+
+ vector< double > len( nbRow );
+ len[0] = 0;
+ for ( size_t i = 0; i < nbCol; ++i )
+ {
+ gp_Pnt pPrev = GetXYZ( i, 0 );
+ for ( size_t j = 1; j < nbRow; ++j )
+ {
+ gp_Pnt p = GetXYZ( i, j );
+ len[ j ] = len[ j-1 ] + p.Distance( pPrev );
+ pPrev = p;
+ }
+ for ( size_t j = 0; j < nbRow; ++j )
+ GetIJK( i, j ).SetCoord( i2, len[ j ]/len.back() );
+ }
+
+ len.resize( nbCol );
+ for ( size_t j = 0; j < nbRow; ++j )
+ {
+ gp_Pnt pPrev = GetXYZ( 0, j );
+ for ( size_t i = 1; i < nbCol; ++i )
+ {
+ gp_Pnt p = GetXYZ( i, j );
+ len[ i ] = len[ i-1 ] + p.Distance( pPrev );
+ pPrev = p;
+ }
+ for ( size_t i = 0; i < nbCol; ++i )
+ GetIJK( i, j ).SetCoord( i1, len[ i ]/len.back() );
+ }
+}
+
//================================================================================
/*!
* \brief Find out mutual location of children: find their right and up brothers
gp_XYZ _QuadFaceGrid::GetXYZ(int iHori, int iVert) const
{
- const SMDS_MeshNode* n = myGrid[ myIndexer( iHori, iVert )];
- return gp_XYZ( n->X(), n->Y(), n->Z() );
+ SMESH_TNodeXYZ xyz = myGrid[ myIndexer( iHori, iVert )];
+ return xyz;
}
//================================================================================
//=============================================================================
typedef boost::shared_ptr< FaceQuadStruct > FaceQuadStructPtr;
+ typedef std::vector<gp_XYZ> TXYZColumn;
// symbolic names of box sides
enum EBoxSides{ B_BOTTOM=0, B_RIGHT, B_TOP, B_LEFT, B_FRONT, B_BACK, B_NB_SIDES };
// symbolic names of sides of quadrangle
enum EQuadSides{ Q_BOTTOM=0, Q_RIGHT, Q_TOP, Q_LEFT, Q_NB_SIDES };
+ enum EAxes{ COO_X=1, COO_Y, COO_Z };
+
//=============================================================================
/*!
* \brief Container of nodes of structured mesh on a qudrangular geom FACE
// node column's taken form _u2nodesMap taking into account sub-shape orientation
vector<TNodeColumn> _columns;
+ // columns of normalized parameters of nodes within the unitary cube
+ vector<TXYZColumn> _ijkColumns;
+
// geometry of a cube side
TopoDS_Face _sideF;
{
return SMESH_TNodeXYZ( GetNode( iCol, iRow ));
}
+ gp_XYZ& GetIJK(int iCol, int iRow)
+ {
+ return _ijkColumns[iCol][iRow];
+ }
};
//================================================================================
}
return ( n == n00 || n == n01 || n == n10 || n == n11 );
}
+
+ //================================================================================
+ /*!
+ * \brief Fill in _FaceGrid::_ijkColumns
+ * \param [in,out] fg - a _FaceGrid
+ * \param [in] i1 - coordinate index along _columns
+ * \param [in] i2 - coordinate index along _columns[i]
+ * \param [in] v3 - value of the constant parameter
+ */
+ //================================================================================
+
+ void computeIJK( _FaceGrid& fg, int i1, int i2, double v3 )
+ {
+ gp_XYZ ijk( v3, v3, v3 );
+ const size_t nbCol = fg._columns.size();
+ const size_t nbRow = fg._columns[0].size();
+
+ fg._ijkColumns.resize( nbCol );
+ for ( size_t i = 0; i < nbCol; ++i )
+ fg._ijkColumns[ i ].resize( nbRow, ijk );
+
+ vector< double > len( nbRow );
+ len[0] = 0;
+ for ( size_t i = 0; i < nbCol; ++i )
+ {
+ gp_Pnt pPrev = fg.GetXYZ( i, 0 );
+ for ( size_t j = 1; j < nbRow; ++j )
+ {
+ gp_Pnt p = fg.GetXYZ( i, j );
+ len[ j ] = len[ j-1 ] + p.Distance( pPrev );
+ pPrev = p;
+ }
+ for ( size_t j = 0; j < nbRow; ++j )
+ fg.GetIJK( i, j ).SetCoord( i2, len[ j ]/len.back() );
+ }
+
+ len.resize( nbCol );
+ for ( size_t j = 0; j < nbRow; ++j )
+ {
+ gp_Pnt pPrev = fg.GetXYZ( 0, j );
+ for ( size_t i = 1; i < nbCol; ++i )
+ {
+ gp_Pnt p = fg.GetXYZ( i, j );
+ len[ i ] = len[ i-1 ] + p.Distance( pPrev );
+ pPrev = p;
+ }
+ for ( size_t i = 0; i < nbCol; ++i )
+ fg.GetIJK( i, j ).SetCoord( i1, len[ i ]/len.back() );
+ }
+ }
}
//=============================================================================
{
aCubeSide[i]._columns.resize( aCubeSide[i]._u2nodesMap.size() );
- size_t iFwd = 0, iRev = aCubeSide[i]._columns.size()-1;
- size_t* pi = isReverse[i] ? &iRev : &iFwd;
+ int iFwd = 0, iRev = aCubeSide[i]._columns.size()-1;
+ int* pi = isReverse[i] ? &iRev : &iFwd;
TParam2ColumnMap::iterator u2nn = aCubeSide[i]._u2nodesMap.begin();
for ( ; iFwd < aCubeSide[i]._columns.size(); --iRev, ++iFwd, ++u2nn )
aCubeSide[i]._columns[ *pi ].swap( u2nn->second );
aCubeSide[i]._u2nodesMap.clear();
}
-
+
if ( proxymesh )
for ( int i = 0; i < 6; ++i )
for ( unsigned j = 0; j < aCubeSide[i]._columns.size(); ++j)
_FaceGrid* fFront = & aCubeSide[ B_FRONT ];
_FaceGrid* fBack = & aCubeSide[ B_BACK ];
+ // compute normalized parameters of nodes on sides (PAL23189)
+ computeIJK( *fBottom, COO_X, COO_Y, /*z=*/0. );
+ computeIJK( *fRight, COO_Y, COO_Z, /*x=*/1. );
+ computeIJK( *fTop, COO_X, COO_Y, /*z=*/1. );
+ computeIJK( *fLeft, COO_Y, COO_Z, /*x=*/0. );
+ computeIJK( *fFront, COO_X, COO_Z, /*y=*/0. );
+ computeIJK( *fBack, COO_X, COO_Z, /*y=*/1. );
+
// cube size measured in nb of nodes
int x, xSize = fBottom->_columns.size() , X = xSize - 1;
int y, ySize = fLeft->_columns.size() , Y = ySize - 1;
pointsOnShapes[ SMESH_Block::ID_V011 ] = fTop->GetXYZ( 0, Y );
pointsOnShapes[ SMESH_Block::ID_V111 ] = fTop->GetXYZ( X, Y );
+ gp_XYZ params; // normalized parameters of an internal node within the unit box
for ( x = 1; x < xSize-1; ++x )
{
- gp_XYZ params; // normalized parameters of internal node within a unit box
- params.SetCoord( 1, x / double(X) );
+ const double rX = x / double(X);
for ( y = 1; y < ySize-1; ++y )
{
- params.SetCoord( 2, y / double(Y) );
+ const double rY = y / double(Y);
+
// a column to fill in during z loop
vector< const SMDS_MeshNode* >& column = columns[ colIndex( x, y )];
// projection points on horizontal edges
pointsOnShapes[ SMESH_Block::ID_Fxy1 ] = fTop ->GetXYZ( x, y );
for ( z = 1; z < zSize-1; ++z ) // z loop
{
- params.SetCoord( 3, z / double(Z) );
+ const double rZ = z / double(Z);
+
+ const gp_XYZ& pBo = fBottom->GetIJK( x, y );
+ const gp_XYZ& pTo = fTop ->GetIJK( x, y );
+ const gp_XYZ& pFr = fFront ->GetIJK( x, z );
+ const gp_XYZ& pBa = fBack ->GetIJK( x, z );
+ const gp_XYZ& pLe = fLeft ->GetIJK( y, z );
+ const gp_XYZ& pRi = fRight ->GetIJK( y, z );
+ params.SetCoord( 1, 0.5 * ( pBo.X() * ( 1. - rZ ) + pTo.X() * rZ +
+ pFr.X() * ( 1. - rY ) + pBa.X() * rY ));
+ params.SetCoord( 2, 0.5 * ( pBo.Y() * ( 1. - rZ ) + pTo.Y() * rZ +
+ pLe.Y() * ( 1. - rX ) + pRi.Y() * rX ));
+ params.SetCoord( 3, 0.5 * ( pFr.Z() * ( 1. - rY ) + pBa.Z() * rY +
+ pLe.Z() * ( 1. - rX ) + pRi.Z() * rX ));
+
// projection points on vertical edges
- pointsOnShapes[ SMESH_Block::ID_E00z ] = fFront->GetXYZ( 0, z );
- pointsOnShapes[ SMESH_Block::ID_E10z ] = fFront->GetXYZ( X, z );
- pointsOnShapes[ SMESH_Block::ID_E01z ] = fBack->GetXYZ( 0, z );
+ pointsOnShapes[ SMESH_Block::ID_E00z ] = fFront->GetXYZ( 0, z );
+ pointsOnShapes[ SMESH_Block::ID_E10z ] = fFront->GetXYZ( X, z );
+ pointsOnShapes[ SMESH_Block::ID_E01z ] = fBack->GetXYZ( 0, z );
pointsOnShapes[ SMESH_Block::ID_E11z ] = fBack->GetXYZ( X, z );
// projection points on vertical faces
- pointsOnShapes[ SMESH_Block::ID_Fx0z ] = fFront->GetXYZ( x, z );
- pointsOnShapes[ SMESH_Block::ID_Fx1z ] = fBack ->GetXYZ( x, z );
- pointsOnShapes[ SMESH_Block::ID_F0yz ] = fLeft ->GetXYZ( y, z );
+ pointsOnShapes[ SMESH_Block::ID_Fx0z ] = fFront->GetXYZ( x, z );
+ pointsOnShapes[ SMESH_Block::ID_Fx1z ] = fBack ->GetXYZ( x, z );
+ pointsOnShapes[ SMESH_Block::ID_F0yz ] = fLeft ->GetXYZ( y, z );
pointsOnShapes[ SMESH_Block::ID_F1yz ] = fRight->GetXYZ( y, z );
// compute internal node coordinates
gp_XYZ coords;
SMESH_Block::ShellPoint( params, pointsOnShapes, coords );
column[ z ] = helper.AddNode( coords.X(), coords.Y(), coords.Z() );
-
}
}
}
void StdMeshers_NumberOfSegments::SetScaleFactor(double scaleFactor)
throw(SALOME_Exception)
{
- if (_distrType != DT_Scale)
- _distrType = DT_Scale;
- //throw SALOME_Exception(LOCALIZED("not a scale distribution"));
if (scaleFactor < PRECISION)
throw SALOME_Exception(LOCALIZED("scale factor must be positive"));
- if (fabs(scaleFactor - 1.0) < PRECISION)
+
+ if (_distrType != DT_Scale)
+ _distrType = DT_Scale;
+
+ if ( fabs(scaleFactor - 1.0) < PRECISION )
_distrType = DT_Regular;
- if (fabs(_scaleFactor - scaleFactor) > PRECISION)
+ if ( fabs(_scaleFactor - scaleFactor) > PRECISION )
{
_scaleFactor = scaleFactor;
NotifySubMeshesHypothesisModification();
//================================================================================
/*!
- *
+ *
*/
//================================================================================
//================================================================================
/*!
- *
+ *
*/
//================================================================================
if ( (table.size() % 2) != 0 )
throw SALOME_Exception(LOCALIZED("odd size of vector of table function"));
- int i;
double prev = -PRECISION;
bool isSame = table.size() == _table.size();
bool pos = false;
- for (i=0; i < table.size()/2; i++) {
+ for ( size_t i = 0; i < table.size() / 2; i++ )
+ {
double par = table[i*2];
double val = table[i*2+1];
if( _convMode==0 )
OCC_CATCH_SIGNALS;
#endif
val = pow( 10.0, val );
- } catch(Standard_Failure) {
+ }
+ catch(Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
throw SALOME_Exception( LOCALIZED( "invalid value"));
return;
else if( _convMode==1 && val<0.0 )
val = 0.0;
- if ( par<0 || par > 1)
+ if ( par < 0 || par > 1)
throw SALOME_Exception(LOCALIZED("parameter of table function is out of range [0,1]"));
- if ( fabs(par-prev)<PRECISION )
+ if ( fabs(par-prev) < PRECISION )
throw SALOME_Exception(LOCALIZED("two parameters are the same"));
if ( val < 0 )
throw SALOME_Exception(LOCALIZED("value of table function is not positive"));
- if( val>PRECISION )
+ if( val > PRECISION )
pos = true;
if (isSame)
{
double oldpar = _table[i*2];
double oldval = _table[i*2+1];
- if (fabs(par - oldpar) > PRECISION || fabs(val - oldval) > PRECISION)
+ if ( fabs(par - oldpar) > PRECISION || fabs(val - oldval) > PRECISION )
isSame = false;
}
prev = par;
if( !pos )
throw SALOME_Exception(LOCALIZED("value of table function is not positive"));
- if( pos && !isSame )
+ if ( pos && !isSame )
{
_table = table;
NotifySubMeshesHypothesisModification();
//================================================================================
/*!
- *
+ *
*/
//================================================================================
{
if (_distrType != DT_ExprFunc)
_distrType = DT_ExprFunc;
- //throw SALOME_Exception(LOCALIZED("not an expression function distribution"));
string func = CheckExpressionFunction( expr, _convMode );
if( _func != func )
save << " " << _scaleFactor;
break;
case DT_TabFunc:
- int i;
save << " " << _table.size();
- for (i=0; i < _table.size(); i++)
+ for ( size_t i = 0; i < _table.size(); i++ )
save << " " << _table[i];
break;
case DT_ExprFunc:
if (isOK)
{
_table.resize(a, 0.);
- int i;
- for (i=0; i < _table.size(); i++)
+ for ( size_t i=0; i < _table.size(); i++ )
{
isOK = (load >> b);
if (isOK)
isOK = (load >> intVal);
if ( isOK && _distrType != DT_Regular && intVal > 0 ) {
_edgeIDs.reserve( intVal );
- for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) {
+ for ( size_t i = 0; i < _edgeIDs.capacity() && isOK; i++) {
isOK = (load >> intVal);
if ( isOK ) _edgeIDs.push_back( intVal );
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
readParamsFromHypo( data_old );
readParamsFromWidgets( data_new );
bool res = storeParamsToHypo( data_new );
- storeParamsToHypo( data_old );
res = myNbSeg->isValid( msg, true ) && res;
res = myScale->isValid( msg, true ) && res;
+ if ( !res )
+ storeParamsToHypo( data_old );
return res;
}
case TabFunc : {
//valStr += tr("SMESH_TAB_FUNC");
bool param = true;
- for( size_t i=0; i < data.myTable.length(); i++, param = !param ) {
+ for( int i=0; i < data.myTable.length(); i++, param = !param ) {
if ( param )
valStr += "[";
valStr += QString::number( data.myTable[ i ]);
h->SetVarParameter( h_data.myNbSegVarName.toLatin1().constData(), "SetNumberOfSegments" );
h->SetNumberOfSegments( h_data.myNbSeg );
- int distr = h_data.myDistrType;
- h->SetDistrType( distr );
+ int distr = h_data.myDistrType;
+ if ( distr == 0 )
+ h->SetDistrType( distr ); // this is actually needed at non-uniform -> uniform switch
if( distr==1 ) {
h->SetVarParameter( h_data.myScaleVarName.toLatin1().constData(), "SetScaleFactor" );
h->SetScaleFactor( h_data.myScale );
{
ASSERT( myBaseImpl );
try {
+ CORBA::Long oldType = (CORBA::Long) this->GetImpl()->GetDistrType();
+
this->GetImpl()->SetDistrType( (::StdMeshers_NumberOfSegments::DistrType) typ );
// Update Python script
- SMESH::TPythonDump() << _this() << ".SetDistrType( " << typ << " )";
+ if ( oldType != typ )
+ SMESH::TPythonDump() << _this() << ".SetDistrType( " << typ << " )";
}
catch ( SALOME_Exception& S_ex ) {
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
SMESH::TPythonDump() << _this() << ".SetExpressionFunction( '" << expr << "' )";
}
catch ( SALOME_Exception& S_ex ) {
- THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
+ THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
+ SALOME::BAD_PARAM );
}
}