mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-27 21:40:33 +05:00
23189: EDF 11603 - Dyssymetry in meshing
(fix StdMeshers_CompositeHexa_3D.cxx, StdMeshers_Hexa_3D.cxx) + Doc update + Optimize dump of NumberOfSegments
This commit is contained in:
parent
d4c5851320
commit
8301b1e71a
@ -25,3 +25,10 @@ crit = [ smesh.GetCriterion( SMESH.FACE, SMESH.FT_AspectRatio, '<', 1.5, BinaryO
|
|||||||
triaGroup = mesh.MakeGroupByCriteria( "Tria AR < 1.5", crit )
|
triaGroup = mesh.MakeGroupByCriteria( "Tria AR < 1.5", crit )
|
||||||
print "Number of triangles with aspect ratio < 1.5:", triaGroup.Size()
|
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]
|
||||||
|
@ -344,16 +344,24 @@ geometrical model in the 3D Viewer, which can help to understand the
|
|||||||
location of a set of edges within the model.
|
location of a set of edges within the model.
|
||||||
|
|
||||||
<b>Propagation chains</b> group allows defining <b>Reversed Edges</b>
|
<b>Propagation chains</b> group allows defining <b>Reversed Edges</b>
|
||||||
for splitting opposite edges of quadrilateral faces
|
for splitting opposite edges of quadrilateral faces in a logically
|
||||||
in a logically uniform direction. When this group is
|
uniform direction. When this group is activated, the list is filled
|
||||||
activated, the list is filled with propagation chains found within the
|
with propagation chains found within the shape on which a hypothesis
|
||||||
model. When a chain is selected in the list its edges are
|
is assigned. When a chain is selected in the list its edges are shown
|
||||||
shown in the Viewer with arrows, which enables choosing a common
|
in the Viewer with arrows, which enables choosing a common direction
|
||||||
direction for all chain edges. \b Reverse button inverts the common
|
for all chain edges. \b Reverse button inverts the common direction of
|
||||||
direction of chain edges. If \b Add button is active, some
|
chain edges. \b Add button is active if some edges of a chain have a
|
||||||
edges of a chain have a different direction, so you can click \b Add
|
different direction, so you can click \b Add button to add them
|
||||||
button to add them to <b>Reversed Edges</b> list.
|
to <b>Reversed Edges</b> list.
|
||||||
|
|
||||||
\image html propagation_chain.png "The whole geometry and a propagation chain"
|
\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.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
@ -20,7 +20,7 @@ filter. By default it is prefixed with the corresponding entity type.
|
|||||||
|
|
||||||
\anchor filtering_elements
|
\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
|
clicking <b>Set Filter</b> button in the corresponding dialog), the
|
||||||
dialog for setting filters looks as shown below.
|
dialog for setting filters looks as shown below.
|
||||||
|
|
||||||
@ -29,7 +29,10 @@ dialog for setting filters looks as shown below.
|
|||||||
The \b Add button creates a new criterion at the end of the list of
|
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
|
criteria. The \b Insert button creates a new criterion before the
|
||||||
selected criterion. The \b Remove button deletes the selected
|
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
|
\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
|
filters have common syntax. The <b>Threshold Value</b> should be specified
|
||||||
for most criteria. For numerical criteria it is necessary to indicate if
|
for most criteria. For numerical criteria it is necessary to indicate if
|
||||||
|
@ -13,7 +13,7 @@ Several filtering criteria can be combined together by using logical
|
|||||||
operators \a AND and \a OR. In addition, applied filter criterion can
|
operators \a AND and \a OR. In addition, applied filter criterion can
|
||||||
be reverted using logical operator \a NOT.
|
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).
|
mesh nodes / elements by a specific characteristic (Area, Length, etc).
|
||||||
|
|
||||||
This page provides a short description of the existing mesh filters,
|
This page provides a short description of the existing mesh filters,
|
||||||
|
@ -62,7 +62,9 @@
|
|||||||
#ifdef _DEBUG_
|
#ifdef _DEBUG_
|
||||||
// #define DEB_FACES
|
// #define DEB_FACES
|
||||||
// #define DEB_GRID
|
// #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
|
#endif
|
||||||
|
|
||||||
#ifndef DUMP_VERT
|
#ifndef DUMP_VERT
|
||||||
@ -78,6 +80,8 @@ enum EQuadSides{ Q_BOTTOM=0, Q_RIGHT, Q_TOP, Q_LEFT, Q_CHILD, Q_PARENT };
|
|||||||
|
|
||||||
enum EBoxSides{ B_BOTTOM=0, B_RIGHT, B_TOP, B_LEFT, B_FRONT, B_BACK, B_UNDEFINED };
|
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
|
* \brief Convertor of a pair of integers to a sole index
|
||||||
@ -157,7 +161,7 @@ public: //** Methods to find and orient faces of 6 sides of the box **//
|
|||||||
_QuadFaceGrid* FindAdjacentForSide(int i, list<_QuadFaceGrid>& faces, EBoxSides id) const;
|
_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
|
//!< 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(); }
|
bool IsComplex() const { return !myChildren.empty(); }
|
||||||
|
|
||||||
@ -177,6 +181,9 @@ public: //** Loading and access to mesh **//
|
|||||||
//!< Load nodes of a mesh
|
//!< Load nodes of a mesh
|
||||||
bool LoadGrid( SMESH_Mesh& 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
|
//!< Return number of segments on the hirizontal sides
|
||||||
int GetNbHoriSegments(SMESH_Mesh& mesh, bool withBrothers=false) const;
|
int GetNbHoriSegments(SMESH_Mesh& mesh, bool withBrothers=false) const;
|
||||||
|
|
||||||
@ -192,6 +199,9 @@ public: //** Loading and access to mesh **//
|
|||||||
//!< Return node coordinates by its position
|
//!< Return node coordinates by its position
|
||||||
gp_XYZ GetXYZ(int iHori, int iVert) const;
|
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 **//
|
public: //** Access to member fields **//
|
||||||
|
|
||||||
//!< Return i-th face side (0<i<4)
|
//!< Return i-th face side (0<i<4)
|
||||||
@ -243,6 +253,7 @@ private:
|
|||||||
|
|
||||||
_Indexer myIndexer;
|
_Indexer myIndexer;
|
||||||
vector<const SMDS_MeshNode*> myGrid;
|
vector<const SMDS_MeshNode*> myGrid;
|
||||||
|
vector<gp_XYZ> myIJK; // normalized parameters of nodes
|
||||||
|
|
||||||
SMESH_ComputeErrorPtr myError;
|
SMESH_ComputeErrorPtr myError;
|
||||||
|
|
||||||
@ -590,6 +601,14 @@ bool StdMeshers_CompositeHexa_3D::Compute(SMESH_Mesh& theMesh,
|
|||||||
if ( !fRight ->LoadGrid( theMesh )) return error( fRight ->GetError() );
|
if ( !fRight ->LoadGrid( theMesh )) return error( fRight ->GetError() );
|
||||||
if ( !fTop ->LoadGrid( theMesh )) return error( fTop ->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 x, xSize = fBottom->GetNbHoriSegments(theMesh) + 1, X = xSize - 1;
|
||||||
int y, ySize = fBottom->GetNbVertSegments(theMesh) + 1, Y = ySize - 1;
|
int y, ySize = fBottom->GetNbVertSegments(theMesh) + 1, Y = ySize - 1;
|
||||||
int z, zSize = fFront ->GetNbVertSegments(theMesh) + 1, Z = zSize - 1;
|
int z, zSize = fFront ->GetNbVertSegments(theMesh) + 1, Z = zSize - 1;
|
||||||
@ -645,13 +664,14 @@ bool StdMeshers_CompositeHexa_3D::Compute(SMESH_Mesh& theMesh,
|
|||||||
pointsOnShapes[ SMESH_Block::ID_V011 ] = fTop->GetXYZ( 0, Y );
|
pointsOnShapes[ SMESH_Block::ID_V011 ] = fTop->GetXYZ( 0, Y );
|
||||||
pointsOnShapes[ SMESH_Block::ID_V111 ] = fTop->GetXYZ( X, 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 )
|
for ( x = 1; x < xSize-1; ++x )
|
||||||
{
|
{
|
||||||
gp_XYZ params; // normalized parameters of internal node within a unit box
|
const double rX = x / double(X);
|
||||||
params.SetCoord( 1, x / double(X) );
|
|
||||||
for ( y = 1; y < ySize-1; ++y )
|
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
|
// column to fill during z loop
|
||||||
vector< const SMDS_MeshNode* >& column = columns[ colIndex( x, y )];
|
vector< const SMDS_MeshNode* >& column = columns[ colIndex( x, y )];
|
||||||
// points projections on horizontal edges
|
// points projections on horizontal edges
|
||||||
@ -668,7 +688,21 @@ bool StdMeshers_CompositeHexa_3D::Compute(SMESH_Mesh& theMesh,
|
|||||||
pointsOnShapes[ SMESH_Block::ID_Fxy1 ] = fTop ->GetXYZ( x, y );
|
pointsOnShapes[ SMESH_Block::ID_Fxy1 ] = fTop ->GetXYZ( x, y );
|
||||||
for ( z = 1; z < zSize-1; ++z ) // z loop
|
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
|
// point projections on vertical edges
|
||||||
pointsOnShapes[ SMESH_Block::ID_E00z ] = fFront->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_E10z ] = fFront->GetXYZ( X, z );
|
||||||
@ -1117,7 +1151,7 @@ bool _QuadFaceGrid::LoadGrid( SMESH_Mesh& mesh )
|
|||||||
const SMDS_MeshElement* firstQuad = 0; // most left face above the last row of found nodes
|
const SMDS_MeshElement* firstQuad = 0; // most left face above the last row of found nodes
|
||||||
|
|
||||||
int nbFoundNodes = myIndexer._xSize;
|
int nbFoundNodes = myIndexer._xSize;
|
||||||
while ( nbFoundNodes != (int) myGrid.size() )
|
while ( nbFoundNodes != myGrid.size() )
|
||||||
{
|
{
|
||||||
// first and last nodes of the last filled row of nodes
|
// first and last nodes of the last filled row of nodes
|
||||||
const SMDS_MeshNode* n1down = myGrid[ nbFoundNodes - myIndexer._xSize ];
|
const SMDS_MeshNode* n1down = myGrid[ nbFoundNodes - myIndexer._xSize ];
|
||||||
@ -1185,6 +1219,53 @@ bool _QuadFaceGrid::LoadGrid( SMESH_Mesh& mesh )
|
|||||||
return true;
|
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
|
* \brief Find out mutual location of children: find their right and up brothers
|
||||||
@ -1441,8 +1522,8 @@ const SMDS_MeshNode* _QuadFaceGrid::GetNode(int iHori, int iVert) const
|
|||||||
|
|
||||||
gp_XYZ _QuadFaceGrid::GetXYZ(int iHori, int iVert) const
|
gp_XYZ _QuadFaceGrid::GetXYZ(int iHori, int iVert) const
|
||||||
{
|
{
|
||||||
const SMDS_MeshNode* n = myGrid[ myIndexer( iHori, iVert )];
|
SMESH_TNodeXYZ xyz = myGrid[ myIndexer( iHori, iVert )];
|
||||||
return gp_XYZ( n->X(), n->Y(), n->Z() );
|
return xyz;
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
@ -144,6 +144,7 @@ namespace
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
typedef boost::shared_ptr< FaceQuadStruct > FaceQuadStructPtr;
|
typedef boost::shared_ptr< FaceQuadStruct > FaceQuadStructPtr;
|
||||||
|
typedef std::vector<gp_XYZ> TXYZColumn;
|
||||||
|
|
||||||
// symbolic names of box sides
|
// symbolic names of box sides
|
||||||
enum EBoxSides{ B_BOTTOM=0, B_RIGHT, B_TOP, B_LEFT, B_FRONT, B_BACK, B_NB_SIDES };
|
enum EBoxSides{ B_BOTTOM=0, B_RIGHT, B_TOP, B_LEFT, B_FRONT, B_BACK, B_NB_SIDES };
|
||||||
@ -151,6 +152,8 @@ namespace
|
|||||||
// symbolic names of sides of quadrangle
|
// symbolic names of sides of quadrangle
|
||||||
enum EQuadSides{ Q_BOTTOM=0, Q_RIGHT, Q_TOP, Q_LEFT, Q_NB_SIDES };
|
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
|
* \brief Container of nodes of structured mesh on a qudrangular geom FACE
|
||||||
@ -166,6 +169,9 @@ namespace
|
|||||||
// node column's taken form _u2nodesMap taking into account sub-shape orientation
|
// node column's taken form _u2nodesMap taking into account sub-shape orientation
|
||||||
vector<TNodeColumn> _columns;
|
vector<TNodeColumn> _columns;
|
||||||
|
|
||||||
|
// columns of normalized parameters of nodes within the unitary cube
|
||||||
|
vector<TXYZColumn> _ijkColumns;
|
||||||
|
|
||||||
// geometry of a cube side
|
// geometry of a cube side
|
||||||
TopoDS_Face _sideF;
|
TopoDS_Face _sideF;
|
||||||
|
|
||||||
@ -177,6 +183,10 @@ namespace
|
|||||||
{
|
{
|
||||||
return SMESH_TNodeXYZ( GetNode( iCol, iRow ));
|
return SMESH_TNodeXYZ( GetNode( iCol, iRow ));
|
||||||
}
|
}
|
||||||
|
gp_XYZ& GetIJK(int iCol, int iRow)
|
||||||
|
{
|
||||||
|
return _ijkColumns[iCol][iRow];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
@ -276,6 +286,56 @@ namespace
|
|||||||
}
|
}
|
||||||
return ( n == n00 || n == n01 || n == n10 || n == n11 );
|
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() );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -444,8 +504,8 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
{
|
{
|
||||||
aCubeSide[i]._columns.resize( aCubeSide[i]._u2nodesMap.size() );
|
aCubeSide[i]._columns.resize( aCubeSide[i]._u2nodesMap.size() );
|
||||||
|
|
||||||
size_t iFwd = 0, iRev = aCubeSide[i]._columns.size()-1;
|
int iFwd = 0, iRev = aCubeSide[i]._columns.size()-1;
|
||||||
size_t* pi = isReverse[i] ? &iRev : &iFwd;
|
int* pi = isReverse[i] ? &iRev : &iFwd;
|
||||||
TParam2ColumnMap::iterator u2nn = aCubeSide[i]._u2nodesMap.begin();
|
TParam2ColumnMap::iterator u2nn = aCubeSide[i]._u2nodesMap.begin();
|
||||||
for ( ; iFwd < aCubeSide[i]._columns.size(); --iRev, ++iFwd, ++u2nn )
|
for ( ; iFwd < aCubeSide[i]._columns.size(); --iRev, ++iFwd, ++u2nn )
|
||||||
aCubeSide[i]._columns[ *pi ].swap( u2nn->second );
|
aCubeSide[i]._columns[ *pi ].swap( u2nn->second );
|
||||||
@ -476,6 +536,14 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
_FaceGrid* fFront = & aCubeSide[ B_FRONT ];
|
_FaceGrid* fFront = & aCubeSide[ B_FRONT ];
|
||||||
_FaceGrid* fBack = & aCubeSide[ B_BACK ];
|
_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
|
// cube size measured in nb of nodes
|
||||||
int x, xSize = fBottom->_columns.size() , X = xSize - 1;
|
int x, xSize = fBottom->_columns.size() , X = xSize - 1;
|
||||||
int y, ySize = fLeft->_columns.size() , Y = ySize - 1;
|
int y, ySize = fLeft->_columns.size() , Y = ySize - 1;
|
||||||
@ -531,13 +599,14 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
pointsOnShapes[ SMESH_Block::ID_V011 ] = fTop->GetXYZ( 0, Y );
|
pointsOnShapes[ SMESH_Block::ID_V011 ] = fTop->GetXYZ( 0, Y );
|
||||||
pointsOnShapes[ SMESH_Block::ID_V111 ] = fTop->GetXYZ( X, 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 )
|
for ( x = 1; x < xSize-1; ++x )
|
||||||
{
|
{
|
||||||
gp_XYZ params; // normalized parameters of internal node within a unit box
|
const double rX = x / double(X);
|
||||||
params.SetCoord( 1, x / double(X) );
|
|
||||||
for ( y = 1; y < ySize-1; ++y )
|
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
|
// a column to fill in during z loop
|
||||||
vector< const SMDS_MeshNode* >& column = columns[ colIndex( x, y )];
|
vector< const SMDS_MeshNode* >& column = columns[ colIndex( x, y )];
|
||||||
// projection points on horizontal edges
|
// projection points on horizontal edges
|
||||||
@ -554,7 +623,21 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
pointsOnShapes[ SMESH_Block::ID_Fxy1 ] = fTop ->GetXYZ( x, y );
|
pointsOnShapes[ SMESH_Block::ID_Fxy1 ] = fTop ->GetXYZ( x, y );
|
||||||
for ( z = 1; z < zSize-1; ++z ) // z loop
|
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
|
// projection points on vertical edges
|
||||||
pointsOnShapes[ SMESH_Block::ID_E00z ] = fFront->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_E10z ] = fFront->GetXYZ( X, z );
|
||||||
@ -570,7 +653,6 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
|||||||
gp_XYZ coords;
|
gp_XYZ coords;
|
||||||
SMESH_Block::ShellPoint( params, pointsOnShapes, coords );
|
SMESH_Block::ShellPoint( params, pointsOnShapes, coords );
|
||||||
column[ z ] = helper.AddNode( coords.X(), coords.Y(), coords.Z() );
|
column[ z ] = helper.AddNode( coords.X(), coords.Y(), coords.Z() );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,11 +180,12 @@ StdMeshers_NumberOfSegments::DistrType StdMeshers_NumberOfSegments::GetDistrType
|
|||||||
void StdMeshers_NumberOfSegments::SetScaleFactor(double scaleFactor)
|
void StdMeshers_NumberOfSegments::SetScaleFactor(double scaleFactor)
|
||||||
throw(SALOME_Exception)
|
throw(SALOME_Exception)
|
||||||
{
|
{
|
||||||
if (_distrType != DT_Scale)
|
|
||||||
_distrType = DT_Scale;
|
|
||||||
//throw SALOME_Exception(LOCALIZED("not a scale distribution"));
|
|
||||||
if (scaleFactor < PRECISION)
|
if (scaleFactor < PRECISION)
|
||||||
throw SALOME_Exception(LOCALIZED("scale factor must be positive"));
|
throw SALOME_Exception(LOCALIZED("scale factor must be positive"));
|
||||||
|
|
||||||
|
if (_distrType != DT_Scale)
|
||||||
|
_distrType = DT_Scale;
|
||||||
|
|
||||||
if ( fabs(scaleFactor - 1.0) < PRECISION )
|
if ( fabs(scaleFactor - 1.0) < PRECISION )
|
||||||
_distrType = DT_Regular;
|
_distrType = DT_Regular;
|
||||||
|
|
||||||
@ -224,12 +225,12 @@ void StdMeshers_NumberOfSegments::SetTableFunction(const vector<double>& table)
|
|||||||
if ( (table.size() % 2) != 0 )
|
if ( (table.size() % 2) != 0 )
|
||||||
throw SALOME_Exception(LOCALIZED("odd size of vector of table function"));
|
throw SALOME_Exception(LOCALIZED("odd size of vector of table function"));
|
||||||
|
|
||||||
int i;
|
|
||||||
double prev = -PRECISION;
|
double prev = -PRECISION;
|
||||||
bool isSame = table.size() == _table.size();
|
bool isSame = table.size() == _table.size();
|
||||||
|
|
||||||
bool pos = false;
|
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 par = table[i*2];
|
||||||
double val = table[i*2+1];
|
double val = table[i*2+1];
|
||||||
if( _convMode==0 )
|
if( _convMode==0 )
|
||||||
@ -239,7 +240,8 @@ void StdMeshers_NumberOfSegments::SetTableFunction(const vector<double>& table)
|
|||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
#endif
|
#endif
|
||||||
val = pow( 10.0, val );
|
val = pow( 10.0, val );
|
||||||
} catch(Standard_Failure) {
|
}
|
||||||
|
catch(Standard_Failure) {
|
||||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||||
throw SALOME_Exception( LOCALIZED( "invalid value"));
|
throw SALOME_Exception( LOCALIZED( "invalid value"));
|
||||||
return;
|
return;
|
||||||
@ -394,7 +396,6 @@ void StdMeshers_NumberOfSegments::SetExpressionFunction(const char* expr)
|
|||||||
{
|
{
|
||||||
if (_distrType != DT_ExprFunc)
|
if (_distrType != DT_ExprFunc)
|
||||||
_distrType = DT_ExprFunc;
|
_distrType = DT_ExprFunc;
|
||||||
//throw SALOME_Exception(LOCALIZED("not an expression function distribution"));
|
|
||||||
|
|
||||||
string func = CheckExpressionFunction( expr, _convMode );
|
string func = CheckExpressionFunction( expr, _convMode );
|
||||||
if( _func != func )
|
if( _func != func )
|
||||||
@ -509,9 +510,8 @@ ostream & StdMeshers_NumberOfSegments::SaveTo(ostream & save)
|
|||||||
save << " " << _scaleFactor;
|
save << " " << _scaleFactor;
|
||||||
break;
|
break;
|
||||||
case DT_TabFunc:
|
case DT_TabFunc:
|
||||||
int i;
|
|
||||||
save << " " << _table.size();
|
save << " " << _table.size();
|
||||||
for (i=0; i < _table.size(); i++)
|
for ( size_t i = 0; i < _table.size(); i++ )
|
||||||
save << " " << _table[i];
|
save << " " << _table[i];
|
||||||
break;
|
break;
|
||||||
case DT_ExprFunc:
|
case DT_ExprFunc:
|
||||||
@ -599,8 +599,7 @@ istream & StdMeshers_NumberOfSegments::LoadFrom(istream & load)
|
|||||||
if (isOK)
|
if (isOK)
|
||||||
{
|
{
|
||||||
_table.resize(a, 0.);
|
_table.resize(a, 0.);
|
||||||
int i;
|
for ( size_t i=0; i < _table.size(); i++ )
|
||||||
for (i=0; i < _table.size(); i++)
|
|
||||||
{
|
{
|
||||||
isOK = (load >> b);
|
isOK = (load >> b);
|
||||||
if (isOK)
|
if (isOK)
|
||||||
@ -652,7 +651,7 @@ istream & StdMeshers_NumberOfSegments::LoadFrom(istream & load)
|
|||||||
isOK = (load >> intVal);
|
isOK = (load >> intVal);
|
||||||
if ( isOK && _distrType != DT_Regular && intVal > 0 ) {
|
if ( isOK && _distrType != DT_Regular && intVal > 0 ) {
|
||||||
_edgeIDs.reserve( intVal );
|
_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);
|
isOK = (load >> intVal);
|
||||||
if ( isOK ) _edgeIDs.push_back( intVal );
|
if ( isOK ) _edgeIDs.push_back( intVal );
|
||||||
}
|
}
|
||||||
|
@ -94,9 +94,10 @@ bool StdMeshersGUI_NbSegmentsCreator::checkParams( QString& msg ) const
|
|||||||
readParamsFromHypo( data_old );
|
readParamsFromHypo( data_old );
|
||||||
readParamsFromWidgets( data_new );
|
readParamsFromWidgets( data_new );
|
||||||
bool res = storeParamsToHypo( data_new );
|
bool res = storeParamsToHypo( data_new );
|
||||||
storeParamsToHypo( data_old );
|
|
||||||
res = myNbSeg->isValid( msg, true ) && res;
|
res = myNbSeg->isValid( msg, true ) && res;
|
||||||
res = myScale->isValid( msg, true ) && res;
|
res = myScale->isValid( msg, true ) && res;
|
||||||
|
if ( !res )
|
||||||
|
storeParamsToHypo( data_old );
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,7 +301,7 @@ QString StdMeshersGUI_NbSegmentsCreator::storeParams() const
|
|||||||
case TabFunc : {
|
case TabFunc : {
|
||||||
//valStr += tr("SMESH_TAB_FUNC");
|
//valStr += tr("SMESH_TAB_FUNC");
|
||||||
bool param = true;
|
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 )
|
if ( param )
|
||||||
valStr += "[";
|
valStr += "[";
|
||||||
valStr += QString::number( data.myTable[ i ]);
|
valStr += QString::number( data.myTable[ i ]);
|
||||||
@ -382,9 +383,10 @@ bool StdMeshersGUI_NbSegmentsCreator::storeParamsToHypo( const NbSegmentsHypothe
|
|||||||
|
|
||||||
h->SetVarParameter( h_data.myNbSegVarName.toLatin1().constData(), "SetNumberOfSegments" );
|
h->SetVarParameter( h_data.myNbSegVarName.toLatin1().constData(), "SetNumberOfSegments" );
|
||||||
h->SetNumberOfSegments( h_data.myNbSeg );
|
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 ) {
|
if( distr==1 ) {
|
||||||
h->SetVarParameter( h_data.myScaleVarName.toLatin1().constData(), "SetScaleFactor" );
|
h->SetVarParameter( h_data.myScaleVarName.toLatin1().constData(), "SetScaleFactor" );
|
||||||
h->SetScaleFactor( h_data.myScale );
|
h->SetScaleFactor( h_data.myScale );
|
||||||
|
@ -267,9 +267,12 @@ void StdMeshers_NumberOfSegments_i::SetDistrType(CORBA::Long typ)
|
|||||||
{
|
{
|
||||||
ASSERT( myBaseImpl );
|
ASSERT( myBaseImpl );
|
||||||
try {
|
try {
|
||||||
|
CORBA::Long oldType = (CORBA::Long) this->GetImpl()->GetDistrType();
|
||||||
|
|
||||||
this->GetImpl()->SetDistrType( (::StdMeshers_NumberOfSegments::DistrType) typ );
|
this->GetImpl()->SetDistrType( (::StdMeshers_NumberOfSegments::DistrType) typ );
|
||||||
|
|
||||||
// Update Python script
|
// Update Python script
|
||||||
|
if ( oldType != typ )
|
||||||
SMESH::TPythonDump() << _this() << ".SetDistrType( " << typ << " )";
|
SMESH::TPythonDump() << _this() << ".SetDistrType( " << typ << " )";
|
||||||
}
|
}
|
||||||
catch ( SALOME_Exception& S_ex ) {
|
catch ( SALOME_Exception& S_ex ) {
|
||||||
@ -397,7 +400,8 @@ void StdMeshers_NumberOfSegments_i::SetExpressionFunction(const char* expr)
|
|||||||
SMESH::TPythonDump() << _this() << ".SetExpressionFunction( '" << expr << "' )";
|
SMESH::TPythonDump() << _this() << ".SetExpressionFunction( '" << expr << "' )";
|
||||||
}
|
}
|
||||||
catch ( SALOME_Exception& S_ex ) {
|
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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user