23070: [CEA 1502] Create the 2D mesh from the 1D mesh with one mesh face for each geom face

This commit is contained in:
eap 2015-06-30 15:14:46 +03:00
parent 2295213e66
commit fe7d1d5767
28 changed files with 819 additions and 171 deletions

View File

@ -60,6 +60,9 @@ There is also a number of more specific algorithms:
<ul>
<li>\subpage prism_3d_algo_page "for meshing prismatic 3D shapes"</li>
<li>\subpage quad_from_ma_algo_page "for meshing faces with sinuous borders"</li>
<li> <em>Polygon per Face</em> meshing algorithm - generates one mesh
face (either a triangle, a quadrangle or a polygon) per a geometrical
face using all nodes from the face boundary.</li>
<li>\subpage projection_algos_page "for meshing by projection of another mesh"</li>
<li>\subpage import_algos_page "for meshing by importing elements from another mesh"</li>
<li>\subpage radial_prism_algo_page "for meshing geometrical objects with cavities"</li>

View File

@ -22,9 +22,9 @@ The Medial Axis is used in two ways:
Axis.</li>
<li> If there is no sub-meshes on the sinuous borders, then a part of
the Medial Axis that can be mapped to both borders is discretized
using a hypothesis assigned to the face or its ancestor shapes,
using a 1D hypothesis assigned to the face or its ancestor shapes,
and the division points are mapped from the Medial Axis to the both
borders.</li>
borders to find positions of nodes.</li>
</ol>
*/

View File

@ -1097,6 +1097,13 @@ module StdMeshers
{
};
/*!
* StdMeshers_PolygonPerFace_2D: interface of "Polygon Per Face" 2D algorithm
*/
interface StdMeshers_PolygonPerFace_2D : SMESH::SMESH_2D_Algo
{
};
/*!
* StdMeshers_Hexa_3D: interface of "Hexahedron (i,j,k)" algorithm
*/

View File

@ -98,6 +98,7 @@ SET(SMESH_RESOURCES_FILES
mesh_tetra.png
mesh_tree_algo_hexa.png
mesh_tree_algo_mefisto.png
mesh_tree_algo_polygon.png
mesh_tree_algo.png
mesh_tree_algo_0D.png
mesh_tree_algo_quad.png

View File

@ -324,6 +324,19 @@
</python-wrap>
</algorithm>
<algorithm type ="PolygonPerFace_2D"
label-id ="Polygon per Face"
icon-id ="mesh_algo_polygon.png"
opt-hypos="ViscousLayers2D"
input ="EDGE"
output ="POLYGON,QUAD,TRIA"
dim ="2">
<python-wrap>
<algo>PolygonPerFace_2D=Polygon()</algo>
<hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo>
</python-wrap>
</algorithm>
<algorithm type ="Hexa_3D"
label-id ="Hexahedron (i,j,k)"
icon-id ="mesh_algo_hexa.png"

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

View File

@ -179,10 +179,10 @@ class SMESH_EXPORT SMESH_Algo : public SMESH_Hypothesis
/*!
* \brief evaluates size of prospective mesh on a shape
* \param aMesh - the mesh
* \param aShape - the shape
* \param aNbElems - prospective number of elements by types
* \retval bool - is a success
* \param aMesh - the mesh
* \param aShape - the shape
* \param aResMap - prospective number of elements by SMDSAbs_ElementType by a sub-mesh
* \retval bool - is a success
*/
virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
MapShapeNbElems& aResMap) = 0;

View File

@ -258,12 +258,9 @@ public:
* quadratic elements will be created. Also fill myTLinkNodeMap
*/
bool IsQuadraticSubMesh(const TopoDS_Shape& theShape);
/*!
* \brief Set order of elements to create without calling IsQuadraticSubMesh()
*/
/*!
* \brief Set myCreateQuadratic flag
* \brief Set order of elements to create without calling IsQuadraticSubMesh()
*/
void SetIsQuadratic(const bool theBuildQuadratic)
{ myCreateQuadratic = theBuildQuadratic; }

View File

@ -403,13 +403,7 @@ int SMESH_subMesh::computeCost() const
//=============================================================================
/*!
* Construct dependence on first level subMeshes. complex shapes (compsolid,
* shell, wire) are not analysed the same way as simple shapes (solid, face,
* edge).
* For collection shapes (compsolid, shell, wire) prepare a list of submeshes
* with possible multiples occurences. Multiples occurences corresponds to
* internal frontiers within shapes of the collection and must not be keeped.
* See FinalizeDependence.
* Returns all sub-meshes this one depend on
*/
//=============================================================================
@ -474,7 +468,7 @@ namespace {
//=============================================================================
/*!
* For simple Shapes (solid, face, edge): add subMesh into dependence list.
* Add sub-meshes on sub-shapes of a given type into the dependence map.
*/
//=============================================================================

View File

@ -23,22 +23,20 @@
//
#include "SMESHGUI_ComputeDlg.h"
#include "SMDS_Mesh.hxx"
#include "SMDS_SetIterator.hxx"
#include "SMESHGUI.h"
#include "SMESHGUI_GEOMGenUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_MeshInfosBox.h"
#include "SMESHGUI_HypothesesUtils.h"
#include "SMESHGUI_MeshEditPreview.h"
#include "SMESHGUI_MeshOrderOp.h"
#include "SMESHGUI_MeshInfosBox.h"
#include "SMESHGUI_MeshOrderDlg.h"
#include "SMESHGUI_MeshOrderOp.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_VTKUtils.h"
#include "SMESH_Actor.h"
#include "SMESH_ActorUtils.h"
#include <SMDS_SetIterator.hxx>
#include <SMDS_Mesh.hxx>
// SALOME GEOM includes
#include <GEOMBase.h>
#include <GEOM_Actor.h>
@ -67,17 +65,16 @@
#include CORBA_SERVER_HEADER(SMESH_Group)
// OCCT includes
#include <BRep_Tool.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopoDS.hxx>
#include <TopLoc_Location.hxx>
#include <Poly_Triangulation.hxx>
#include <Bnd_Box.hxx>
#include <BRepBndLib.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
#include <BRep_Tool.hxx>
#include <Bnd_Box.hxx>
#include <Poly_Triangulation.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopLoc_Location.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopoDS.hxx>
#include <Standard_ErrorHandler.hxx>

View File

@ -160,18 +160,17 @@ protected slots:
virtual void reject();
void onHelp();
private:
private:
SMESHGUI_GenericHypothesisCreator* myCreator;
QLabel *myIconLabel, *myTypeLabel;
QString myHelpFileName;
};
/*!
* \brief Class containing information about hypothesis
*/
class HypothesisData
* \brief Information about a hypothesis
*/
struct HypothesisData
{
public:
HypothesisData( const QString&, const QString&, const QString&,
const QString&, const QString&, const QString&,
const QString&, const QList<int>&, const bool,

View File

@ -66,7 +66,7 @@ SMESHGUI_MeshInfosBox::SMESHGUI_MeshInfosBox(const bool full, QWidget* theParent
myNbTrai(0), myNbLinTrai(0), myNbQuadTrai(0), myNbBiQuadTrai(0),
myNbQuad(0), myNbLinQuad(0), myNbQuadQuad(0), myNbBiQuadQuad(0),
myNbFace(0), myNbLinFace(0), myNbQuadFace(0), myNbBiQuadFace(0),
myNbPolyg(0),
myNbPolyg(0), myNbQuadPolyg(0),
myNbHexa(0), myNbLinHexa(0), myNbQuadHexa(0), myNbBiQuadHexa(0),
myNbTetra(0),myNbLinTetra(0),myNbQuadTetra(0),
myNbPyra(0), myNbLinPyra(0), myNbQuadPyra(0),
@ -219,8 +219,15 @@ SMESHGUI_MeshInfosBox::SMESHGUI_MeshInfosBox(const bool full, QWidget* theParent
// ... poligones
lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_POLYGONES")), this );
l->addWidget( lab, row, 0 );
// --
myNbPolyg = new QLabel( this );
l->addWidget( myNbPolyg, row, 1 );
// --
myNbLinPolyg = new QLabel( this );
l->addWidget( myNbLinPolyg, row, 2 );
// --
myNbQuadPolyg = new QLabel( this );
l->addWidget( myNbQuadPolyg, row, 3 );
addSeparator(this); // add separator
@ -432,12 +439,14 @@ void SMESHGUI_MeshInfosBox::SetMeshInfo(const SMESH::long_array& theInfo)
theInfo[SMDSEntity_Quadrangle] +
theInfo[SMDSEntity_Quad_Quadrangle] +
theInfo[SMDSEntity_BiQuad_Quadrangle] +
theInfo[SMDSEntity_Polygon] ));
theInfo[SMDSEntity_Polygon] +
theInfo[SMDSEntity_Quad_Polygon]));
myNbLinFace ->setText( QString("%1").arg( theInfo[SMDSEntity_Triangle] +
theInfo[SMDSEntity_Quadrangle] +
theInfo[SMDSEntity_Polygon] ));
myNbQuadFace ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Triangle] +
theInfo[SMDSEntity_Quad_Quadrangle] ));
theInfo[SMDSEntity_Quad_Quadrangle] +
theInfo[SMDSEntity_Quad_Polygon] ));
myNbBiQuadFace ->setText( QString("%1").arg( theInfo[SMDSEntity_BiQuad_Triangle] +
theInfo[SMDSEntity_BiQuad_Quadrangle] ));
@ -481,7 +490,10 @@ void SMESHGUI_MeshInfosBox::SetMeshInfo(const SMESH::long_array& theInfo)
myNbQuadQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Quadrangle] ));
myNbBiQuadQuad ->setText( QString("%1").arg( theInfo[SMDSEntity_BiQuad_Quadrangle]));
// poligones
myNbPolyg ->setText( QString("%1").arg( theInfo[SMDSEntity_Polygon] ));
myNbPolyg ->setText( QString("%1").arg( theInfo[SMDSEntity_Polygon] +
theInfo[SMDSEntity_Quad_Polygon] ));
myNbLinPolyg ->setText( QString("%1").arg( theInfo[SMDSEntity_Polygon] ));
myNbQuadPolyg ->setText( QString("%1").arg( theInfo[SMDSEntity_Quad_Polygon] ));
// tetras
myNbTetra ->setText( QString("%1").arg( theInfo[SMDSEntity_Tetra] +

View File

@ -69,6 +69,8 @@ private:
QLabel* myNbQuadFace;
QLabel* myNbBiQuadFace;
QLabel* myNbPolyg;
QLabel* myNbLinPolyg;
QLabel* myNbQuadPolyg;
QLabel* myNbHexa;
QLabel* myNbLinHexa;
QLabel* myNbQuadHexa;

View File

@ -459,24 +459,25 @@ namespace
gp_Pnt p, pPrev;
if ( !c3d.IsNull() )
pPrev = c3d->Value( f );
for ( int i = 2; i <= discret.NbPoints(); i++ ) // skip the 1st point
{
double u = discret.Parameter(i);
if ( !c3d.IsNull() )
if ( discret.NbPoints() > 2 )
for ( int i = 2; i <= discret.NbPoints(); i++ ) // skip the 1st point
{
p = c3d->Value( u );
int nbDiv = int( p.Distance( pPrev ) / minSegLen / theDiscrCoef );
double dU = ( u - points.back()._u ) / nbDiv;
for ( int iD = 1; iD < nbDiv; ++iD )
double u = discret.Parameter(i);
if ( !c3d.IsNull() )
{
double uD = points.back()._u + dU;
points.push_back( UVU( c2d->Value( uD ), uD ));
p = c3d->Value( u );
int nbDiv = int( p.Distance( pPrev ) / minSegLen / theDiscrCoef );
double dU = ( u - points.back()._u ) / nbDiv;
for ( int iD = 1; iD < nbDiv; ++iD )
{
double uD = points.back()._u + dU;
points.push_back( UVU( c2d->Value( uD ), uD ));
}
pPrev = p;
}
pPrev = p;
points.push_back( UVU( c2d->Value( u ), u ));
uvBox.Add( points.back()._uv );
}
points.push_back( UVU( c2d->Value( u ), u ));
uvBox.Add( points.back()._uv );
}
// if ( !c3d.IsNull() )
// {
// vector<double> params;
@ -595,6 +596,45 @@ namespace
return true;
}
//================================================================================
/*!
* \brief Update a branch joined to another one
*/
//================================================================================
void updateJoinedBranch( vector< const TVDEdge* > & branchEdges,
const size_t newID,
vector< BndSeg > & bndSegs,
const bool reverse)
{
if ( reverse )
{
for ( size_t i = 0; i < branchEdges.size(); ++i )
{
size_t seg1 = SMESH_MAT2d::Branch::getBndSegment( branchEdges[i] );
size_t seg2 = SMESH_MAT2d::Branch::getBndSegment( branchEdges[i]->twin() );
bndSegs[ seg1 ]._branchID /= bndSegs[ seg1 ].branchID();
bndSegs[ seg2 ]._branchID /= bndSegs[ seg2 ].branchID();
bndSegs[ seg1 ]._branchID *= -newID;
bndSegs[ seg2 ]._branchID *= -newID;
branchEdges[i] = branchEdges[i]->twin();
}
std::reverse( branchEdges.begin(), branchEdges.end() );
}
else
{
for ( size_t i = 0; i < branchEdges.size(); ++i )
{
size_t seg1 = SMESH_MAT2d::Branch::getBndSegment( branchEdges[i] );
size_t seg2 = SMESH_MAT2d::Branch::getBndSegment( branchEdges[i]->twin() );
bndSegs[ seg1 ]._branchID /= bndSegs[ seg1 ].branchID();
bndSegs[ seg2 ]._branchID /= bndSegs[ seg2 ].branchID();
bndSegs[ seg1 ]._branchID *= newID;
bndSegs[ seg2 ]._branchID *= newID;
}
}
}
//================================================================================
/*!
* \brief Create MA branches and FACE boundary data
@ -608,6 +648,7 @@ namespace
//================================================================================
void makeMA( const TVD& vd,
const bool ignoreCorners,
vector< InPoint >& inPoints,
vector< InSegment > & inSegments,
vector< SMESH_MAT2d::Branch >& branch,
@ -797,7 +838,7 @@ namespace
size_t i1st = 0;
while ( i1st < bndSegs.size() && !bndSegs[i1st].hasOppositeEdge( noEdgeID ))
++i1st;
bndSegs[i1st].setBranch( branchID, bndSegs ); // set to i-th and the opposite bndSeg
bndSegs[i1st].setBranch( branchID, bndSegs ); // set to the i-th and the opposite bndSeg
branchEdges[ branchID ].push_back( bndSegs[i1st]._edge );
for ( size_t i = i1st+1; i < bndSegs.size(); ++i )
@ -858,17 +899,92 @@ namespace
br2.clear();
}
// remove branches ending at BE_ON_VERTEX
vector<bool> isBranchRemoved( branchEdges.size(), false );
if ( ignoreCorners && branchEdges.size() > 2 && !branchEdges[2].empty() )
{
// find branches to remove
map< const TVDVertex*, SMESH_MAT2d::BranchEndType >::iterator v2et;
for ( size_t iB = 1; iB < branchEdges.size(); ++iB )
{
if ( branchEdges[iB].empty() )
continue;
const TVDVertex* v0 = branchEdges[iB][0]->vertex1();
const TVDVertex* v1 = branchEdges[iB].back()->vertex0();
v2et = endType.find( v0 );
if ( v2et != endType.end() && v2et->second == SMESH_MAT2d::BE_ON_VERTEX )
isBranchRemoved[ iB ] = true;
v2et = endType.find( v1 );
if ( v2et != endType.end() && v2et->second == SMESH_MAT2d::BE_ON_VERTEX )
isBranchRemoved[ iB ] = true;
}
// try to join not removed branches into one
for ( size_t iB = 1; iB < branchEdges.size(); ++iB )
{
if ( branchEdges[iB].empty() || isBranchRemoved[iB] )
continue;
const TVDVertex* v0 = branchEdges[iB][0]->vertex1();
const TVDVertex* v1 = branchEdges[iB].back()->vertex0();
v2et = endType.find( v0 );
if ( v2et == endType.end() || v2et->second != SMESH_MAT2d::BE_BRANCH_POINT )
v0 = 0;
v2et = endType.find( v1 );
if ( v2et == endType.end() || v2et->second != SMESH_MAT2d::BE_BRANCH_POINT )
v1 = 0;
if ( !v0 && !v1 )
continue;
size_t iBrToJoin = 0;
for ( size_t iB2 = 1; iB2 < branchEdges.size(); ++iB2 )
{
if ( branchEdges[iB2].empty() || isBranchRemoved[iB2] || iB == iB2 )
continue;
const TVDVertex* v02 = branchEdges[iB2][0]->vertex1();
const TVDVertex* v12 = branchEdges[iB2].back()->vertex0();
if ( v0 == v02 || v0 == v12 || v1 == v02 || v1 == v12 )
{
if ( iBrToJoin > 0 )
{
iBrToJoin = 0;
break; // more than 2 not removed branches meat at a TVDVertex
}
iBrToJoin = iB2;
}
}
if ( iBrToJoin > 0 )
{
vector<const TVDEdge*>& branch = branchEdges[ iBrToJoin ];
const TVDVertex* v02 = branch[0]->vertex1();
const TVDVertex* v12 = branch.back()->vertex0();
updateJoinedBranch( branch, iB, bndSegs, /*reverse=*/(v0 == v02 || v1 == v12 ));
if ( v0 == v02 || v0 == v12 )
branchEdges[iB].insert( branchEdges[iB].begin(), branch.begin(), branch.end() );
else
branchEdges[iB].insert( branchEdges[iB].end(), branch.begin(), branch.end() );
branch.clear();
}
} // loop on branchEdges
} // if ( ignoreCorners )
// associate branchIDs and the input branch vector (arg)
vector< const SMESH_MAT2d::Branch* > branchByID( branchEdges.size(), 0 );
vector< SMESH_MAT2d::Branch* > branchByID( branchEdges.size(), 0 );
int nbBranches = 0;
for ( size_t i = 0; i < branchEdges.size(); ++i )
{
nbBranches += ( !branchEdges[i].empty() );
}
branch.resize( nbBranches );
for ( size_t iBr = 0, brID = 0; brID < branchEdges.size(); ++brID )
size_t iBr = 0;
for ( size_t brID = 1; brID < branchEdges.size(); ++brID ) // 1st - not removed
{
if ( !branchEdges[ brID ].empty() )
if ( !branchEdges[ brID ].empty() && !isBranchRemoved[ brID ])
branchByID[ brID ] = & branch[ iBr++ ];
}
for ( size_t brID = 1; brID < branchEdges.size(); ++brID ) // then - removed
{
if ( !branchEdges[ brID ].empty() && isBranchRemoved[ brID ])
branchByID[ brID ] = & branch[ iBr++ ];
}
@ -956,17 +1072,38 @@ namespace
} // loop on all bndSegs
// Initialize branches
// find a not removed branch
size_t iBrNorRemoved = 0;
for ( size_t brID = 1; brID < branchEdges.size(); ++brID )
if ( !branchEdges[brID].empty() && !isBranchRemoved[brID] )
{
iBrNorRemoved = brID;
break;
}
// fill the branches with MA edges
for ( size_t iBr = 0, brID = 0; brID < branchEdges.size(); ++brID )
for ( size_t brID = 1; brID < branchEdges.size(); ++brID )
if ( !branchEdges[brID].empty() )
{
branch[ iBr ].init( branchEdges[brID], & boundary, endType );
iBr++;
branchByID[ brID ]->init( branchEdges[brID], & boundary, endType );
}
// mark removed branches
for ( size_t brID = 1; brID < branchEdges.size(); ++brID )
if ( isBranchRemoved[brID] && iBrNorRemoved > 0 )
{
SMESH_MAT2d::Branch* branch = branchByID[ brID ];
SMESH_MAT2d::Branch* mainBranch = branchByID[ iBrNorRemoved ];
bool is1stBrPnt = ( branch->getEnd(0)->_type == SMESH_MAT2d::BE_BRANCH_POINT );
const TVDVertex* branchVextex =
is1stBrPnt ? branch->getEnd(0)->_vertex : branch->getEnd(1)->_vertex;
SMESH_MAT2d::BranchPoint bp = mainBranch->getPoint( branchVextex );
branch->setRemoved( bp );
}
// set branches to branch ends
for ( size_t i = 0; i < branch.size(); ++i )
branch[i].setBranchesToEnds( branch );
if ( !branch[i].isRemoved() )
branch[i].setBranchesToEnds( branch );
// fill branchPnt arg
map< const TVDVertex*, const SMESH_MAT2d::BranchEnd* > v2end;
@ -1009,13 +1146,30 @@ SMESH_MAT2d::MedialAxis::MedialAxis(const TopoDS_Face& face,
if ( !makeInputData( face, edges, minSegLen, inPoints, inSegments, _scale ))
return;
//inSegmentsToFile( inSegments );
inSegmentsToFile( inSegments );
// build voronoi diagram
construct_voronoi( inSegments.begin(), inSegments.end(), &_vd );
// make MA data
makeMA( _vd, inPoints, inSegments, _branch, _branchPnt, _boundary );
makeMA( _vd, ignoreCorners, inPoints, inSegments, _branch, _branchPnt, _boundary );
// count valid branches
_nbBranches = _branch.size();
for ( size_t i = 0; i < _branch.size(); ++i )
if ( _branch[i].isRemoved() )
--_nbBranches;
}
//================================================================================
/*!
* \brief Returns the i-th branch
*/
//================================================================================
const SMESH_MAT2d::Branch* SMESH_MAT2d::MedialAxis::getBranch(size_t i) const
{
return i < _nbBranches ? &_branch[i] : 0;
}
//================================================================================
@ -1024,10 +1178,10 @@ SMESH_MAT2d::MedialAxis::MedialAxis(const TopoDS_Face& face,
*/
//================================================================================
void SMESH_MAT2d::MedialAxis::getPoints( const Branch& branch,
void SMESH_MAT2d::MedialAxis::getPoints( const Branch* branch,
std::vector< gp_XY >& points) const
{
branch.getPoints( points, _scale );
branch->getPoints( points, _scale );
}
//================================================================================
@ -1070,7 +1224,7 @@ bool SMESH_MAT2d::Boundary::getBranchPoint( const std::size_t iEdge,
double edgeParam = ( u - points._params[i] ) / ( points._params[i+1] - points._params[i] );
if ( !points._maEdges[ i ].second ) // no branch at the EDGE end
if ( !points._maEdges[ i ].second ) // no branch at the EDGE end, look for a closest branch
{
if ( i < points._maEdges.size() / 2 ) // near 1st point
{
@ -1105,16 +1259,36 @@ bool SMESH_MAT2d::Boundary::getBranchPoint( const std::size_t iEdge,
*/
//================================================================================
bool SMESH_MAT2d::Boundary::IsConcaveSegment( std::size_t iEdge, std::size_t iSeg ) const
bool SMESH_MAT2d::Boundary::isConcaveSegment( std::size_t iEdge, std::size_t iSeg ) const
{
if ( iEdge >= _pointsPerEdge.size() || _pointsPerEdge[iEdge]._params.empty() )
return false;
const BndPoints& points = _pointsPerEdge[ iEdge ];
if ( points._params.size() >= iSeg+1 )
if ( points._params.size() <= iSeg+1 )
return false;
return Abs( points._params[ iEdge ] - points._params[ iEdge+1 ]) < 1e-20;
return Abs( points._params[ iSeg ] - points._params[ iSeg+1 ]) < 1e-20;
}
//================================================================================
/*!
* \brief Moves (changes _param) a given BoundaryPoint to a closest EDGE end
*/
//================================================================================
bool SMESH_MAT2d::Boundary::moveToClosestEdgeEnd( BoundaryPoint& bp ) const
{
if ( bp._edgeIndex >= _pointsPerEdge.size() )
return false;
const BndPoints& points = _pointsPerEdge[ bp._edgeIndex ];
if ( bp._param - points._params[0] < points._params.back() - bp._param )
bp._param = points._params[0];
else
bp._param = points._params.back();
return true;
}
//================================================================================
@ -1191,7 +1365,7 @@ void SMESH_MAT2d::Branch::init( vector<const TVDEdge*>& maEdges,
//================================================================================
/*!
* \brief fill BranchEnd::_branches of its ends
* \brief fills BranchEnd::_branches of its ends
*/
//================================================================================
@ -1209,6 +1383,47 @@ void SMESH_MAT2d::Branch::setBranchesToEnds( const vector< Branch >& branches )
}
}
//================================================================================
/*!
* \brief returns a BranchPoint corresponding to a TVDVertex
*/
//================================================================================
SMESH_MAT2d::BranchPoint SMESH_MAT2d::Branch::getPoint( const TVDVertex* vertex ) const
{
BranchPoint p;
p._branch = this;
p._iEdge = 0;
if ( vertex == _maEdges[0]->vertex1() )
{
p._edgeParam = 0;
}
else
{
for ( ; p._iEdge < _maEdges.size(); ++p._iEdge )
if ( vertex == _maEdges[ p._iEdge ]->vertex0() )
{
p._edgeParam = _params[ p._iEdge ];
break;
}
}
return p;
}
//================================================================================
/*!
* \brief Sets a proxy point for a removed branch
* \param [in] proxyPoint - a point of another branch to which all points of this
* branch are mapped
*/
//================================================================================
void SMESH_MAT2d::Branch::setRemoved( const BranchPoint& proxyPoint )
{
_proxyPoint = proxyPoint;
}
//================================================================================
/*!
* \brief Returns points on two EDGEs, equidistant from a given point of this Branch
@ -1254,6 +1469,9 @@ bool SMESH_MAT2d::Branch::getBoundaryPoints(std::size_t iMAEdge,
BoundaryPoint& bp1,
BoundaryPoint& bp2 ) const
{
if ( isRemoved() )
return _proxyPoint._branch->getBoundaryPoints( _proxyPoint, bp1, bp2 );
if ( iMAEdge > _maEdges.size() )
return false;
if ( iMAEdge == _maEdges.size() )
@ -1382,8 +1600,8 @@ bool SMESH_MAT2d::Branch::addDivPntForConcaVertex( std::vector< std::size_t >&
size_t iSeg1 = getBndSegment( maEdges[ i-1 ] );
size_t iSeg2 = getBndSegment( maEdges[ i ] );
bool isConcaPrev = _boundary->IsConcaveSegment( edgeIDs1.back(), iSeg1 );
bool isConcaNext = _boundary->IsConcaveSegment( ie1, iSeg2 );
bool isConcaPrev = _boundary->isConcaveSegment( edgeIDs1.back(), iSeg1 );
bool isConcaNext = _boundary->isConcaveSegment( ie1, iSeg2 );
if ( !isConcaNext && !isConcaPrev )
return false;
@ -1397,7 +1615,7 @@ bool SMESH_MAT2d::Branch::addDivPntForConcaVertex( std::vector< std::size_t >&
while ( iNext < maEdges.size() )
{
iSeg2 = getBndSegment( maEdges[ iNext ] );
if ( _boundary->IsConcaveSegment( ie1, iSeg2 ))
if ( _boundary->isConcaveSegment( ie1, iSeg2 ))
++iNext;
else
break;
@ -1419,7 +1637,7 @@ bool SMESH_MAT2d::Branch::addDivPntForConcaVertex( std::vector< std::size_t >&
}
if ( vertexFound )
{
i = --iNext;
iPrev = i = --iNext; // not to add a BP in the moddle
isConcaveV = true;
}
}
@ -1429,7 +1647,7 @@ bool SMESH_MAT2d::Branch::addDivPntForConcaVertex( std::vector< std::size_t >&
while ( iPrev-1 >= 0 )
{
iSeg1 = getBndSegment( maEdges[ iPrev-1 ] );
if ( _boundary->IsConcaveSegment( edgeIDs1.back(), iSeg1 ))
if ( _boundary->isConcaveSegment( edgeIDs1.back(), iSeg1 ))
--iPrev;
else
break;
@ -1439,7 +1657,7 @@ bool SMESH_MAT2d::Branch::addDivPntForConcaVertex( std::vector< std::size_t >&
if ( iPrev < i-1 || iNext > i )
{
// no VERTEX on the opposite EDGE, put the Branch Point in the middle
double par1 = _params[ iPrev ], par2 = _params[ iNext ];
double par1 = _params[ iPrev+1 ], par2 = _params[ iNext ];
double midPar = 0.5 * ( par1 + par2 );
divisionPnt._iEdge = iPrev;
while ( _params[ divisionPnt._iEdge + 1 ] < midPar )

View File

@ -88,6 +88,7 @@ namespace SMESH_MAT2d
/*!
* \brief Branch is a set of MA edges enclosed between branch points and/or MA ends.
* It's main feature is to return two BoundaryPoint's per a point on it.
* Points on a Branch are defined by [0,1] parameter
*/
class SMESHUtils_EXPORT Branch
{
@ -114,15 +115,20 @@ namespace SMESH_MAT2d
std::vector< std::size_t >& edgeIDs2,
std::vector< BranchPoint >& divPoints) const;
// construction
bool isRemoved() const { return _proxyPoint._branch; }
public: // internal: construction
void init( std::vector<const TVDEdge*>& maEdges,
const Boundary* boundary,
std::map< const TVDVertex*, BranchEndType > endType);
void setBranchesToEnds( const std::vector< Branch >& branches);
BranchPoint getPoint( const TVDVertex* vertex ) const;
void setRemoved( const BranchPoint& proxyPoint );
static void setGeomEdge( std::size_t geomIndex, const TVDEdge* maEdge );
static std::size_t getGeomEdge( const TVDEdge* maEdge );
static void setBndSegment( std::size_t segIndex, const TVDEdge* maEdge );
static void setGeomEdge ( std::size_t geomIndex, const TVDEdge* maEdge );
static std::size_t getGeomEdge ( const TVDEdge* maEdge );
static void setBndSegment( std::size_t segIndex, const TVDEdge* maEdge );
static std::size_t getBndSegment( const TVDEdge* maEdge );
private:
@ -142,6 +148,7 @@ namespace SMESH_MAT2d
const Boundary* _boundary; // face boundary
BranchEnd _endPoint1;
BranchEnd _endPoint2;
BranchPoint _proxyPoint;
};
//-------------------------------------------------------------------------------------
@ -173,7 +180,9 @@ namespace SMESH_MAT2d
bool getBranchPoint( const std::size_t iEdge, double u, BranchPoint& p ) const;
bool IsConcaveSegment( std::size_t iEdge, std::size_t iSeg ) const;
bool isConcaveSegment( std::size_t iEdge, std::size_t iSeg ) const;
bool moveToClosestEdgeEnd( BoundaryPoint& bp ) const;
private:
std::vector< BndPoints > _pointsPerEdge;
@ -201,11 +210,12 @@ namespace SMESH_MAT2d
const std::vector< TopoDS_Edge >& edges,
const double minSegLen,
const bool ignoreCorners = false );
const Boundary& getBoundary() const { return _boundary; }
const std::vector< Branch >& getBranches() const { return _branch; }
std::size_t nbBranches() const { return _nbBranches; }
const Branch* getBranch(size_t i) const;
const std::vector< const BranchEnd* >& getBranchPoints() const { return _branchPnt; }
const Boundary& getBoundary() const { return _boundary; }
void getPoints( const Branch& branch, std::vector< gp_XY >& points) const;
void getPoints( const Branch* branch, std::vector< gp_XY >& points) const;
Adaptor3d_Curve* make3DCurve(const Branch& branch) const;
private:
@ -214,6 +224,7 @@ namespace SMESH_MAT2d
TopoDS_Face _face;
TVD _vd;
std::vector< Branch > _branch;
std::size_t _nbBranches; // removed branches ignored
std::vector< const BranchEnd* > _branchPnt;
Boundary _boundary;
double _scale[2];

View File

@ -44,6 +44,8 @@ QUADRANGLE = "Quadrangle_2D"
RADIAL_QUAD = "RadialQuadrangle_1D2D"
## Algorithm type: Quadrangle (Medial Axis Projection) 1D-2D algorithm, see StdMeshersBuilder_QuadMA_1D2D
QUAD_MA_PROJ = "QuadFromMedialAxis_1D2D"
## Algorithm type: Polygon Per Face 2D algorithm, see StdMeshersBuilder_PolygonPerFace
POLYGON = "PolygonPerFace_2D"
# import items of enums
for e in StdMeshers.QuadType._items: exec('%s = StdMeshers.%s'%(e,e))
@ -66,7 +68,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
## type of algorithm used with helper function in smeshBuilder.Mesh class
# @internal
algoType = REGULAR
## flag pointing either this algorithm should be used by default in dynamic method
## flag pointing whether this algorithm should be used by default in dynamic method
# of smeshBuilder.Mesh class
# @internal
isDefault = True
@ -424,7 +426,7 @@ class StdMeshersBuilder_CompositeSegment(StdMeshersBuilder_Segment):
## type of algorithm used with helper function in smeshBuilder.Mesh class
# @internal
algoType = COMPOSITE
## flag pointing either this algorithm should be used by default in dynamic method
## flag pointing whether this algorithm should be used by default in dynamic method
# of smeshBuilder.Mesh class
# @internal
isDefault = False
@ -497,7 +499,7 @@ class StdMeshersBuilder_Triangle_MEFISTO(Mesh_Algorithm):
## type of algorithm used with helper function in smeshBuilder.Mesh class
# @internal
algoType = MEFISTO
## flag pointing either this algorithm should be used by default in dynamic method
## flag pointing whether this algorithm should be used by default in dynamic method
# of smeshBuilder.Mesh class
# @internal
isDefault = True
@ -551,7 +553,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
## type of algorithm used with helper function in smeshBuilder.Mesh class
# @internal
algoType = QUADRANGLE
## flag pointing either this algorithm should be used by default in dynamic method
## flag pointing whether this algorithm should be used by default in dynamic method
# of smeshBuilder.Mesh class
# @internal
isDefault = True
@ -698,7 +700,7 @@ class StdMeshersBuilder_Hexahedron(Mesh_Algorithm):
## type of algorithm used with helper function in smeshBuilder.Mesh class
# @internal
algoType = Hexa
## flag pointing either this algorithm should be used by default in dynamic method
## flag pointing whether this algorithm should be used by default in dynamic method
# of smeshBuilder.Mesh class
# @internal
isDefault = True
@ -730,7 +732,7 @@ class StdMeshersBuilder_Projection1D(Mesh_Algorithm):
## type of algorithm used with helper function in smeshBuilder.Mesh class
# @internal
algoType = "Projection_1D"
## flag pointing either this algorithm should be used by default in dynamic method
## flag pointing whether this algorithm should be used by default in dynamic method
# of smeshBuilder.Mesh class
# @internal
isDefault = True
@ -788,7 +790,7 @@ class StdMeshersBuilder_Projection2D(Mesh_Algorithm):
## type of algorithm used with helper function in smeshBuilder.Mesh class
# @internal
algoType = "Projection_2D"
## flag pointing either this algorithm should be used by default in dynamic method
## flag pointing whether this algorithm should be used by default in dynamic method
# of smeshBuilder.Mesh class
# @internal
isDefault = True
@ -1285,6 +1287,37 @@ class StdMeshersBuilder_QuadMA_1D2D(Mesh_Algorithm):
pass
## Defines a Polygon Per Face 2D algorithm
#
# It is created by calling smeshBuilder.Mesh.Polygon(geom=0)
#
# @ingroup l2_algos_quad_ma
class StdMeshersBuilder_PolygonPerFace(Mesh_Algorithm):
## name of the dynamic method in smeshBuilder.Mesh class
# @internal
meshMethod = "Polygon"
## type of algorithm used with helper function in smeshBuilder.Mesh class
# @internal
algoType = POLYGON
## flag pointing whether this algorithm should be used by default in dynamic method
# of smeshBuilder.Mesh class
# @internal
isDefault = True
## doc string of the method
# @internal
docHelper = "Creates polygon 2D algorithm for faces"
## Private constructor.
# @param mesh parent mesh object algorithm is assigned to
# @param geom geometry (shape/sub-shape) algorithm is assigned to;
# if it is @c 0 (default), the algorithm is assigned to the main shape
def __init__(self, mesh, geom=0):
Mesh_Algorithm.__init__(self)
self.Create(mesh, geom, self.algoType)
pass
pass
## Defines a Use Existing Elements 1D algorithm
#
@ -1299,7 +1332,7 @@ class StdMeshersBuilder_UseExistingElements_1D(Mesh_Algorithm):
## type of algorithm used with helper function in smeshBuilder.Mesh class
# @internal
algoType = "Import_1D"
## flag pointing either this algorithm should be used by default in dynamic method
## flag pointing whether this algorithm should be used by default in dynamic method
# of smeshBuilder.Mesh class
# @internal
isDefault = True
@ -1349,7 +1382,7 @@ class StdMeshersBuilder_UseExistingElements_1D2D(Mesh_Algorithm):
## type of algorithm used with helper function in smeshBuilder.Mesh class
# @internal
algoType = "Import_1D2D"
## flag pointing either this algorithm should be used by default in dynamic method
## flag pointing whether this algorithm should be used by default in dynamic method
# of smeshBuilder.Mesh class
# @internal
isDefault = True
@ -1397,7 +1430,7 @@ class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm):
## type of algorithm used with helper function in smeshBuilder.Mesh class
# @internal
algoType = "Cartesian_3D"
## flag pointing either this algorithm should be used by default in dynamic method
## flag pointing whether this algorithm should be used by default in dynamic method
# of smeshBuilder.Mesh class
# @internal
isDefault = True

View File

@ -131,6 +131,7 @@ SET(StdMeshers_HEADERS
StdMeshers_CartesianParameters3D.hxx
StdMeshers_Cartesian_3D.hxx
StdMeshers_QuadFromMedialAxis_1D2D.hxx
StdMeshers_PolygonPerFace_2D.hxx
)
IF(SALOME_SMESH_ENABLE_MEFISTO)
@ -195,6 +196,7 @@ SET(StdMeshers_SOURCES
StdMeshers_Cartesian_3D.cxx
StdMeshers_Adaptive1D.cxx
StdMeshers_QuadFromMedialAxis_1D2D.cxx
StdMeshers_PolygonPerFace_2D.cxx
)
IF(SALOME_SMESH_ENABLE_MEFISTO)

View File

@ -1188,7 +1188,7 @@ bool _QuadFaceGrid::needContinuationAtSide( int iSide,
// check presence of corners at other sides
nbCorners = mySides.NbCommonVertices( cornerVertices );
return ( 0 < nbCorners && nbCorners <= 2 ); // if nbCorners == 2 additional check is needed!!!
return ( 0 < nbCorners && nbCorners <= 3 ); // if nbCorners == 2 additional check is needed!!!
}
//================================================================================

View File

@ -0,0 +1,158 @@
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 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, or (at your option) any later version.
//
// 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_PolygonPerFace_2D.cxx
// Module : SMESH
// Created : Fri Oct 20 11:37:07 2006
// Author : Edward AGAPOV (eap)
//
#include "StdMeshers_PolygonPerFace_2D.hxx"
#include "SMESH_Comment.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_MesherHelper.hxx"
#include "SMESH_ProxyMesh.hxx"
#include "SMESH_subMesh.hxx"
#include "StdMeshers_FaceSide.hxx"
#include "StdMeshers_ViscousLayers2D.hxx"
#include <TopExp_Explorer.hxx>
#include <TopoDS_Face.hxx>
#include <vector>
#include <TopoDS.hxx>
using namespace std;
//=======================================================================
//function : StdMeshers_PolygonPerFace_2D
//purpose :
//=======================================================================
StdMeshers_PolygonPerFace_2D::StdMeshers_PolygonPerFace_2D(int hypId,
int studyId,
SMESH_Gen* gen)
:SMESH_2D_Algo(hypId, studyId, gen)
{
_name = "PolygonPerFace_2D";
}
//=======================================================================
//function : CheckHypothesis
//purpose :
//=======================================================================
bool StdMeshers_PolygonPerFace_2D::CheckHypothesis(SMESH_Mesh& theMesh,
const TopoDS_Shape& theShape,
SMESH_Hypothesis::Hypothesis_Status& theStatus)
{
theStatus = HYP_OK;
return true;
}
//=======================================================================
//function : Compute
//purpose :
//=======================================================================
bool StdMeshers_PolygonPerFace_2D::Compute(SMESH_Mesh& theMesh,
const TopoDS_Shape& theShape)
{
const TopoDS_Face& face = TopoDS::Face( theShape );
SMESH_MesherHelper helper( theMesh );
helper.SetElementsOnShape( true );
_quadraticMesh = helper.IsQuadraticSubMesh( face );
SMESH_ProxyMesh::Ptr proxyMesh = StdMeshers_ViscousLayers2D::Compute( theMesh, face );
if ( !proxyMesh )
return false;
TError erorr;
TSideVector wires = StdMeshers_FaceSide::GetFaceWires(face, theMesh,
/*skipMediumNodes=*/_quadraticMesh,
erorr, proxyMesh,
/*checkVertexNodes=*/false);
if ( wires.size() != 1 )
return error( COMPERR_BAD_SHAPE, SMESH_Comment("One wire required, not ") << wires.size() );
vector<const SMDS_MeshNode*> nodes = wires[0]->GetOrderedNodes();
int nbNodes = int( nodes.size() ) - 1; // 1st node is repeated at end
switch ( nbNodes ) {
case 3:
helper.AddFace( nodes[0], nodes[1], nodes[2] );
break;
case 4:
helper.AddFace( nodes[0], nodes[1], nodes[2], nodes[3] );
break;
default:
if ( nbNodes < 3 )
return error( COMPERR_BAD_INPUT_MESH, "Less that 3 nodes on the wire" );
nodes.resize( nodes.size() - 1 );
helper.AddPolygonalFace ( nodes );
}
return true;
}
//=======================================================================
//function : Evaluate
//purpose :
//=======================================================================
bool StdMeshers_PolygonPerFace_2D::Evaluate(SMESH_Mesh& theMesh,
const TopoDS_Shape& theShape,
MapShapeNbElems& theResMap)
{
// count nb segments
int nbLinSegs = 0, nbQuadSegs = 0;
TopExp_Explorer edge( theShape, TopAbs_EDGE );
for ( ; edge.More(); edge.Next() )
{
SMESH_subMesh* sm = theMesh.GetSubMesh( edge.Current() );
MapShapeNbElems::iterator sm2vec = theResMap.find( sm );
if ( sm2vec == theResMap.end() )
continue;
nbLinSegs += sm2vec->second.at( SMDSEntity_Edge );
nbQuadSegs += sm2vec->second.at( SMDSEntity_Quad_Edge );
}
std::vector<int> aVec( SMDSEntity_Last, 0 );
switch ( nbLinSegs + nbQuadSegs ) {
case 3:
aVec[ nbQuadSegs ? SMDSEntity_Quad_Triangle : SMDSEntity_Triangle ] = 1;
break;
case 4:
aVec[ nbQuadSegs ? SMDSEntity_Quad_Quadrangle : SMDSEntity_Quadrangle ] = 1;
break;
default:
if ( nbLinSegs + nbQuadSegs < 3 )
return error( COMPERR_BAD_INPUT_MESH, "Less that 3 nodes on the wire" );
aVec[ nbQuadSegs ? SMDSEntity_Quad_Polygon : SMDSEntity_Polygon ] = 1;
}
SMESH_subMesh * sm = theMesh.GetSubMesh(theShape);
theResMap.insert(std::make_pair(sm,aVec));
return true;
}

View File

@ -0,0 +1,47 @@
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 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, or (at your option) any later version.
//
// 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_PolygonPerFace_2D.hxx
// Module : SMESH
//
#ifndef _SMESH_PolygonPerFace_2D_HXX_
#define _SMESH_PolygonPerFace_2D_HXX_
#include "SMESH_StdMeshers.hxx"
#include "SMESH_Algo.hxx"
class STDMESHERS_EXPORT StdMeshers_PolygonPerFace_2D: public SMESH_2D_Algo
{
public:
StdMeshers_PolygonPerFace_2D(int hypId, int studyId, SMESH_Gen* gen);
virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
SMESH_Hypothesis::Hypothesis_Status& aStatus);
virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
MapShapeNbElems& aResMap);
};
#endif

View File

@ -70,7 +70,7 @@ public:
void SetSegmentLength( double len )
{
_value[ BEG_LENGTH_IND ] = len;
_value[ PRECISION_IND ] = 1e-7;
_value[ PRECISION_IND ] = 1e-7;
_hypType = LOCAL_LENGTH;
}
};
@ -95,7 +95,7 @@ StdMeshers_QuadFromMedialAxis_1D2D::StdMeshers_QuadFromMedialAxis_1D2D(int
_neededLowerHyps[ 1 ] = true; // suppress warning on hiding a global 1D algo
_neededLowerHyps[ 2 ] = true; // suppress warning on hiding a global 2D algo
_compatibleHypothesis.clear();
//_compatibleHypothesis.push_back("ViscousLayers2D");
_compatibleHypothesis.push_back("ViscousLayers2D");
}
//================================================================================
@ -120,6 +120,7 @@ bool StdMeshers_QuadFromMedialAxis_1D2D::CheckHypothesis(SMESH_Mesh& aMe
const TopoDS_Shape& aShape,
Hypothesis_Status& aStatus)
{
aStatus = HYP_OK;
return true; // does not require hypothesis
}
@ -593,11 +594,11 @@ namespace
TopoDS_Edge makeEdgeFromMA( SMESH_MesherHelper& theHelper,
const SMESH_MAT2d::MedialAxis& theMA )
{
if ( theMA.getBranches().size() != 1 )
if ( theMA.nbBranches() != 1 )
return TopoDS_Edge();
vector< gp_XY > uv;
theMA.getPoints( theMA.getBranches()[0], uv );
theMA.getPoints( theMA.getBranch(0), uv );
if ( uv.size() < 2 )
return TopoDS_Edge();
@ -812,6 +813,8 @@ namespace
bool findVertex( NodePoint& theNodePnt,
const vector<TopoDS_Edge>& theSinuEdges,
size_t theEdgeIndPrev,
size_t theEdgeIndNext,
SMESHDS_Mesh* theMeshDS)
{
if ( theNodePnt._edgeInd >= theSinuEdges.size() )
@ -826,6 +829,8 @@ namespace
V = SMESH_MesherHelper::IthVertex( 0, theSinuEdges[ theNodePnt._edgeInd ], /*CumOri=*/false);
else if ( Abs( l - theNodePnt._u ) < tol )
V = SMESH_MesherHelper::IthVertex( 1, theSinuEdges[ theNodePnt._edgeInd ], /*CumOri=*/false);
else if ( theEdgeIndPrev != theEdgeIndNext )
TopExp::CommonVertex( theSinuEdges[theEdgeIndPrev], theSinuEdges[theEdgeIndNext], V );
if ( !V.IsNull() )
{
@ -860,6 +865,8 @@ namespace
//const double theMinSegLen,
const SMESH_MAT2d::MedialAxis& theMA,
const vector< SMESH_MAT2d::BranchPoint >& theDivPoints,
const vector< std::size_t > & theEdgeIDs1,
const vector< std::size_t > & theEdgeIDs2,
const vector<TopoDS_Edge>& theSinuEdges,
const vector< Handle(Geom_Curve) >& theCurves,
const vector< bool >& theIsEdgeComputed,
@ -873,8 +880,23 @@ namespace
double uMA;
SMESH_MAT2d::BoundaryPoint bp[2];
const SMESH_MAT2d::Branch& branch = theMA.getBranches()[0];
const SMESH_MAT2d::Branch& branch = *theMA.getBranch(0);
// fill a map holding NodePoint's of ends of theSinuEdges
map< double, pair< NodePoint, NodePoint > > extremaNP;
map< double, pair< NodePoint, NodePoint > >::iterator u2NP0, u2NP1;
if ( !branch.getBoundaryPoints( 0., bp[0], bp[1] ) ||
!theMA.getBoundary().moveToClosestEdgeEnd( bp[0] ) ||
!theMA.getBoundary().moveToClosestEdgeEnd( bp[1] )) return false;
u2NP0 = extremaNP.insert
( make_pair( 0., make_pair( NodePoint( bp[0]), NodePoint( bp[1])))).first;
if ( !branch.getBoundaryPoints( 1., bp[0], bp[1] ) ||
!theMA.getBoundary().moveToClosestEdgeEnd( bp[0] ) ||
!theMA.getBoundary().moveToClosestEdgeEnd( bp[1] )) return false;
u2NP1 = extremaNP.insert
( make_pair( 1., make_pair( NodePoint( bp[0]), NodePoint( bp[1])))).first;
// project theDivPoints
for ( size_t i = 0; i < theDivPoints.size(); ++i )
{
if ( !branch.getParameter( theDivPoints[i], uMA ))
@ -882,10 +904,14 @@ namespace
if ( !branch.getBoundaryPoints( theDivPoints[i], bp[0], bp[1] ))
return false;
NodePoint np[2] = { NodePoint( bp[0] ),
NodePoint( bp[1] )};
bool isVertex[2] = { findVertex( np[0], theSinuEdges, meshDS ),
findVertex( np[1], theSinuEdges, meshDS )};
NodePoint np[2] = {
NodePoint( bp[0] ),
NodePoint( bp[1] )
};
bool isVertex[2] = {
findVertex( np[0], theSinuEdges, theEdgeIDs1[i], theEdgeIDs1[i+1], meshDS ),
findVertex( np[1], theSinuEdges, theEdgeIDs2[i], theEdgeIDs2[i+1], meshDS )
};
map< double, pair< NodePoint, NodePoint > >::iterator u2NP =
thePointsOnE.insert( make_pair( uMA, make_pair( np[0], np[1]))).first;
@ -893,8 +919,8 @@ namespace
if ( !isVertex[0] && !isVertex[1] ) return false; // error
if ( isVertex[0] && isVertex[1] )
continue;
const size_t iVertex = isVertex[0] ? 0 : 1;
const size_t iNode = 1 - iVertex;
const size_t iVert = isVertex[0] ? 0 : 1;
const size_t iNode = 1 - iVert;
bool isOppComputed = theIsEdgeComputed[ np[ iNode ]._edgeInd ];
if ( !isOppComputed )
@ -912,6 +938,10 @@ namespace
bool isShortPrev[2], isShortNext[2];
map< double, pair< NodePoint, NodePoint > >::iterator u2NPPrev = u2NP, u2NPNext = u2NP;
--u2NPPrev; ++u2NPNext;
bool hasPrev = ( u2NP != thePointsOnE.begin() );
bool hasNext = ( u2NPNext != thePointsOnE.end() );
if ( !hasPrev ) u2NPPrev = u2NP0;
if ( !hasNext ) u2NPNext = u2NP1;
for ( int iS = 0; iS < 2; ++iS ) // side with Vertex and side with Nodes
{
NodePoint np = get( u2NP->second, iS );
@ -926,6 +956,8 @@ namespace
isShortPrev[iS] = ( r < rShort );
isShortNext[iS] = (( 1 - r ) > ( 1 - rShort ));
}
// if ( !hasPrev ) isShortPrev[0] = isShortPrev[1] = false;
// if ( !hasNext ) isShortNext[0] = isShortNext[1] = false;
map< double, pair< NodePoint, NodePoint > >::iterator u2NPClose;
@ -933,9 +965,9 @@ namespace
( isShortNext[0] && isShortNext[1] ))
{
u2NPClose = isShortPrev[0] ? u2NPPrev : u2NPNext;
NodePoint& npProj = get( u2NP->second, iNode ); // NP of VERTEX projection
NodePoint npCloseN = get( u2NPClose->second, iNode); // NP close to npProj
NodePoint npCloseV = get( u2NPClose->second, iVertex); // NP close to VERTEX
NodePoint& npProj = get( u2NP->second, iNode ); // NP of VERTEX projection
NodePoint npCloseN = get( u2NPClose->second, iNode ); // NP close to npProj
NodePoint npCloseV = get( u2NPClose->second, iVert ); // NP close to VERTEX
if ( !npCloseV._node )
{
npProj = npCloseN;
@ -947,11 +979,11 @@ namespace
// can't remove the neighbor projection as it is also from VERTEX, -> option 1)
}
}
// else option 1) - wide enough -> "duplicate" existing node
// else: option 1) - wide enough -> "duplicate" existing node
{
u2NPClose = isShortPrev[ iNode ] ? u2NPPrev : u2NPNext;
NodePoint& npProj = get( u2NP->second, iNode ); // NP of VERTEX projection
NodePoint& npCloseN = get( u2NPClose->second, iNode ); // NP close to npProj
NodePoint& npProj = get( u2NP->second, iNode ); // NP of VERTEX projection
NodePoint& npCloseN = get( u2NPClose->second, iNode ); // NP close to npProj
// npProj._edgeInd = npCloseN._edgeInd;
// npProj._u = npCloseN._u + 1e-3 * Abs( get( u2NPPrev->second, iNode )._u -
// get( u2NPNext->second, iNode )._u );
@ -985,7 +1017,7 @@ namespace
vector<double>& theMAParams,
SinuousFace& theSinuFace)
{
if ( theMA.getBranches().size() != 1 )
if ( theMA.nbBranches() != 1 )
return false;
// normalize theMAParams
@ -1029,7 +1061,7 @@ namespace
}
}
const SMESH_MAT2d::Branch& branch = theMA.getBranches()[0];
const SMESH_MAT2d::Branch& branch = *theMA.getBranch(0);
SMESH_MAT2d::BoundaryPoint bp[2];
vector< std::size_t > edgeIDs1, edgeIDs2;
@ -1121,8 +1153,8 @@ namespace
++iEdgePair;
}
if ( !projectVertices( theHelper, theMA, divPoints, theSinuEdges, curves,
isComputed, pointsOnE, theSinuFace._nodesToMerge ))
if ( !projectVertices( theHelper, theMA, divPoints, edgeIDs1, edgeIDs2, theSinuEdges,
curves, isComputed, pointsOnE, theSinuFace._nodesToMerge ))
return false;
// create nodes

View File

@ -123,6 +123,10 @@
<source>ICON_SMESH_TREE_ALGO_MEFISTO_2D</source>
<translation>mesh_tree_algo_mefisto.png</translation>
</message>
<message>
<source>ICON_SMESH_TREE_ALGO_PolygonPerFace_2D</source>
<translation>mesh_tree_algo_polygon.png</translation>
</message>
<message>
<source>ICON_SMESH_TREE_ALGO_Projection_1D</source>
<translation>mesh_tree_algo_regular.png</translation>

View File

@ -119,6 +119,7 @@ SET(StdMeshersEngine_HEADERS
StdMeshers_ViscousLayers2D_i.hxx
StdMeshers_CartesianParameters3D_i.hxx
StdMeshers_Cartesian_3D_i.hxx
StdMeshers_PolygonPerFace_2D_i.hxx
)
IF(SALOME_SMESH_ENABLE_MEFISTO)
SET(StdMeshersEngine_HEADERS ${StdMeshersEngine_HEADERS} StdMeshers_MEFISTO_2D_i.hxx)
@ -173,6 +174,7 @@ SET(StdMeshersEngine_SOURCES
StdMeshers_CartesianParameters3D_i.cxx
StdMeshers_Cartesian_3D_i.cxx
StdMeshers_Adaptive1D_i.cxx
StdMeshers_PolygonPerFace_2D_i.cxx
)
IF(SALOME_SMESH_ENABLE_MEFISTO)

View File

@ -0,0 +1,61 @@
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 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, or (at your option) any later version.
//
// 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_PolygonPerFace_2D_i.cxx
// Module : SMESH
//
#include "StdMeshers_PolygonPerFace_2D_i.hxx"
#include "SMESH_Gen.hxx"
#include "StdMeshers_PolygonPerFace_2D.hxx"
//=============================================================================
/*!
* Constructor
*/
//=============================================================================
StdMeshers_PolygonPerFace_2D_i::StdMeshers_PolygonPerFace_2D_i( PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl )
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA ),
SMESH_Algo_i( thePOA ),
SMESH_2D_Algo_i( thePOA )
{
//MESSAGE( "StdMeshers_PolygonPerFace_2D_i::StdMeshers_PolygonPerFace_2D_i" );
myBaseImpl = new ::StdMeshers_PolygonPerFace_2D( theGenImpl->GetANewId(),
theStudyId,
theGenImpl );
}
//=============================================================================
/*!
* Destructor
*/
//=============================================================================
StdMeshers_PolygonPerFace_2D_i::~StdMeshers_PolygonPerFace_2D_i()
{
//MESSAGE( "StdMeshers_PolygonPerFace_2D_i::~StdMeshers_PolygonPerFace_2D_i" );
}

View File

@ -0,0 +1,54 @@
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 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, or (at your option) any later version.
//
// 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_PolygonPerFace_2D_i.hxx
// Module : SMESH
//
#ifndef _SMESH_PolygonPerFace_2D_I_HXX_
#define _SMESH_PolygonPerFace_2D_I_HXX_
#include "SMESH_StdMeshers_I.hxx"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include "SMESH_2D_Algo_i.hxx"
class SMESH_Gen;
// ======================================================
// Polygon Per Face 2d algorithm
// ======================================================
class STDMESHERS_I_EXPORT StdMeshers_PolygonPerFace_2D_i:
public virtual POA_StdMeshers::StdMeshers_PolygonPerFace_2D,
public virtual SMESH_2D_Algo_i
{
public:
// Constructor
StdMeshers_PolygonPerFace_2D_i( PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl );
// Destructor
virtual ~StdMeshers_PolygonPerFace_2D_i();
};
#endif

View File

@ -78,9 +78,6 @@ class STDMESHERS_I_EXPORT StdMeshers_QuadFromMedialAxis_1D2D_i:
// Destructor
virtual ~StdMeshers_QuadFromMedialAxis_1D2D_i();
// Get implementation
//::StdMeshers_Quadrangle_2D* GetImpl();
// Return true if the algorithm is applicable to a shape
//static CORBA::Boolean IsApplicable(const TopoDS_Shape &S, CORBA::Boolean toCheckAll);
};

View File

@ -31,70 +31,72 @@
#include "utilities.h"
#include "StdMeshers_LocalLength_i.hxx"
#include "StdMeshers_AutomaticLength_i.hxx"
#include "StdMeshers_StartEndLength_i.hxx"
#include "StdMeshers_Arithmetic1D_i.hxx"
#include "StdMeshers_Geometric1D_i.hxx"
#include "StdMeshers_FixedPoints1D_i.hxx"
#include "StdMeshers_NumberOfSegments_i.hxx"
#include "StdMeshers_Deflection1D_i.hxx"
#include "StdMeshers_Adaptive1D_i.hxx"
#include "StdMeshers_Propagation_i.hxx"
#include "StdMeshers_LengthFromEdges_i.hxx"
#include "StdMeshers_QuadranglePreference_i.hxx"
//#include "StdMeshers_TrianglePreference_i.hxx"
#include "StdMeshers_QuadraticMesh_i.hxx"
#include "StdMeshers_MaxElementArea_i.hxx"
#include "StdMeshers_MaxElementVolume_i.hxx"
#include "StdMeshers_NotConformAllowed_i.hxx"
#include "StdMeshers_ProjectionSource3D_i.hxx"
#include "StdMeshers_ProjectionSource2D_i.hxx"
#include "StdMeshers_ProjectionSource1D_i.hxx"
#include "StdMeshers_NumberOfLayers_i.hxx"
#include "StdMeshers_LayerDistribution_i.hxx"
#include "StdMeshers_NumberOfLayers2D_i.hxx"
#include "StdMeshers_LayerDistribution2D_i.hxx"
#include "StdMeshers_SegmentLengthAroundVertex_i.hxx"
#include "StdMeshers_MaxLength_i.hxx"
#include "StdMeshers_QuadrangleParams_i.hxx"
#include "StdMeshers_Arithmetic1D_i.hxx"
#include "StdMeshers_AutomaticLength_i.hxx"
#include "StdMeshers_CartesianParameters3D_i.hxx"
#include "StdMeshers_Cartesian_3D_i.hxx"
#include "StdMeshers_CompositeSegment_1D_i.hxx"
#include "StdMeshers_Deflection1D_i.hxx"
#include "StdMeshers_FixedPoints1D_i.hxx"
#include "StdMeshers_Geometric1D_i.hxx"
#include "StdMeshers_Hexa_3D_i.hxx"
#include "StdMeshers_ImportSource1D_i.hxx"
#include "StdMeshers_ImportSource2D_i.hxx"
#include "StdMeshers_Cartesian_3D_i.hxx"
#include "StdMeshers_Import_1D2D_i.hxx"
#include "StdMeshers_Import_1D_i.hxx"
#include "StdMeshers_LayerDistribution2D_i.hxx"
#include "StdMeshers_LayerDistribution_i.hxx"
#include "StdMeshers_LengthFromEdges_i.hxx"
#include "StdMeshers_LocalLength_i.hxx"
#include "StdMeshers_MaxElementArea_i.hxx"
#include "StdMeshers_MaxElementVolume_i.hxx"
#include "StdMeshers_MaxLength_i.hxx"
#include "StdMeshers_NotConformAllowed_i.hxx"
#include "StdMeshers_NumberOfLayers2D_i.hxx"
#include "StdMeshers_NumberOfLayers_i.hxx"
#include "StdMeshers_NumberOfSegments_i.hxx"
#include "StdMeshers_PolygonPerFace_2D_i.hxx"
#include "StdMeshers_Prism_3D_i.hxx"
#include "StdMeshers_ProjectionSource1D_i.hxx"
#include "StdMeshers_ProjectionSource2D_i.hxx"
#include "StdMeshers_ProjectionSource3D_i.hxx"
#include "StdMeshers_Projection_1D_2D_3D_i.hxx"
#include "StdMeshers_Propagation_i.hxx"
#include "StdMeshers_QuadrangleParams_i.hxx"
#include "StdMeshers_QuadranglePreference_i.hxx"
#include "StdMeshers_Quadrangle_2D_i.hxx"
#include "StdMeshers_QuadraticMesh_i.hxx"
#include "StdMeshers_RadialQuadrangle_1D2D_i.hxx"
#include "StdMeshers_Regular_1D_i.hxx"
#include "StdMeshers_SegmentAroundVertex_0D_i.hxx"
#include "StdMeshers_SegmentLengthAroundVertex_i.hxx"
#include "StdMeshers_StartEndLength_i.hxx"
#include "StdMeshers_UseExisting_1D2D_i.hxx"
#include "StdMeshers_ViscousLayers2D_i.hxx"
#include "StdMeshers_ViscousLayers_i.hxx"
#ifdef ENABLE_MEFISTO
#include "StdMeshers_MEFISTO_2D_i.hxx"
#endif
#include "StdMeshers_Quadrangle_2D_i.hxx"
#include "StdMeshers_Hexa_3D_i.hxx"
#include "StdMeshers_Projection_1D_2D_3D_i.hxx"
#include "StdMeshers_Prism_3D_i.hxx"
#include "StdMeshers_SegmentAroundVertex_0D_i.hxx"
#include "StdMeshers_CompositeSegment_1D_i.hxx"
#include "StdMeshers_UseExisting_1D2D_i.hxx"
#include "StdMeshers_RadialQuadrangle_1D2D_i.hxx"
#include "StdMeshers_Import_1D_i.hxx"
#include "StdMeshers_Import_1D2D_i.hxx"
#include "StdMeshers_ViscousLayers_i.hxx"
#include "StdMeshers_ViscousLayers2D_i.hxx"
#include "StdMeshers_CartesianParameters3D_i.hxx"
namespace SMESH {
class ApplicableToAny
{
public:
static CORBA::Boolean IsApplicable( const TopoDS_Shape &S, CORBA::Boolean toCheckAll ) {
static CORBA::Boolean IsApplicable( const TopoDS_Shape &S, CORBA::Boolean toCheckAll )
{
return true;
}
};
};
template <class T, class TIsApplicable = SMESH::ApplicableToAny> class StdHypothesisCreator_i:public HypothesisCreator_i<T>
template <class T, class TIsApplicable = SMESH::ApplicableToAny>
class StdHypothesisCreator_i : public HypothesisCreator_i< T >
{
public:
// as we have 'module StdMeshers' in SMESH_BasicHypothesis.idl
virtual std::string GetModuleName() { return "StdMeshers"; }
virtual CORBA::Boolean IsApplicable( const TopoDS_Shape & S, CORBA::Boolean toCheckAll ) {
virtual CORBA::Boolean IsApplicable( const TopoDS_Shape & S, CORBA::Boolean toCheckAll )
{
return TIsApplicable::IsApplicable( S, toCheckAll );
}
};
@ -248,6 +250,8 @@ STDMESHERS_I_EXPORT
aCreator = new StdHypothesisCreator_i<StdMeshers_Import_1D2D_i>;
else if (strcmp(aHypName, "Cartesian_3D") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_Cartesian_3D_i>;
else if (strcmp(aHypName, "PolygonPerFace_2D") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_PolygonPerFace_2D_i>;
else ;
return aCreator;

View File

@ -50,7 +50,7 @@ all_states = run_states+end_states;
# The SALOME launcher resource is specified by its name as defined in
# the file CatalogResources.xml (see root directory of the
# application). We could have a check box in the dialog to specify
# wether we want a local execution or a remote one.
# whether we want a local execution or a remote one.
resource_name = "localhost"
from salome.smesh.spadder.configreader import ConfigReader