#include "SMDS_SetIterator.hxx"
#include "SMESHDS_Group.hxx"
#include "SMESHDS_Hypothesis.hxx"
+#include "SMESHDS_Mesh.hxx"
#include "SMESH_Algo.hxx"
#include "SMESH_ComputeError.hxx"
#include "SMESH_ControlsDef.hxx"
// Proxy sub-mesh of an EDGE. It contains nodes in _uvPtStructVec.
struct _EdgeSubMesh : public SMESH_ProxyMesh::SubMesh
{
- _EdgeSubMesh(int index=0): SubMesh(index) {}
+ _EdgeSubMesh(const SMDS_Mesh* mesh, int index=0): SubMesh(mesh,index) {}
//virtual int NbElements() const { return _elements.size()+1; }
virtual int NbNodes() const { return Max( 0, _uvPtStructVec.size()-2 ); }
void SetUVPtStructVec(UVPtStructVec& vec) { _uvPtStructVec.swap( vec ); }
};
_ProxyMeshOfFace(const SMESH_Mesh& mesh): SMESH_ProxyMesh(mesh) {}
_EdgeSubMesh* GetEdgeSubMesh(int ID) { return (_EdgeSubMesh*) getProxySubMesh(ID); }
- virtual SubMesh* newSubmesh(int index=0) const { return new _EdgeSubMesh(index); }
+ virtual SubMesh* newSubmesh(int index=0) const { return new _EdgeSubMesh( GetMeshDS(), index); }
};
//--------------------------------------------------------------------------------
/*!
*/
struct _Segment
{
- const gp_XY* _uv[2]; // poiter to _LayerEdge::_uvIn
+ const gp_XY* _uv[2]; // pointer to _LayerEdge::_uvIn
int _indexInLine; // position in _PolyLine
_Segment() {}
double _D; // _vec1.Crossed( _vec2 )
double _param1, _param2; // intersection param on _seg1 and _seg2
- _SegmentIntersection(): _param1(0), _param2(0), _D(0) {}
+ _SegmentIntersection(): _D(0), _param1(0), _param2(0) {}
bool Compute(const _Segment& seg1, const _Segment& seg2, bool seg2IsRay = false )
{
//================================================================================
// StdMeshers_ViscousLayers hypothesis
//
-StdMeshers_ViscousLayers2D::StdMeshers_ViscousLayers2D(int hypId, int studyId, SMESH_Gen* gen)
- :StdMeshers_ViscousLayers(hypId, studyId, gen)
+StdMeshers_ViscousLayers2D::StdMeshers_ViscousLayers2D(int hypId, SMESH_Gen* gen)
+ :StdMeshers_ViscousLayers(hypId, gen)
{
_name = StdMeshers_ViscousLayers2D::GetHypType();
_param_algo_dim = -2; // auxiliary hyp used by 2D algos
// --------------------------------------------------------------------------------
bool StdMeshers_ViscousLayers2D::HasProxyMesh( const TopoDS_Face& face, SMESH_Mesh& mesh )
{
- return VISCOUS_2D::_ProxyMeshHolder::FindProxyMeshOfFace( face, mesh );
+ return VISCOUS_2D::_ProxyMeshHolder::FindProxyMeshOfFace( face, mesh ).get();
}
// --------------------------------------------------------------------------------
SMESH_ComputeErrorPtr
VISCOUS_2D::_ViscousBuilder2D builder( theMesh, face, hyps, hypShapes );
builder._faceSideVec =
StdMeshers_FaceSide::GetFaceWires( face, theMesh, true, error,
- SMESH_ProxyMesh::Ptr(),
+ NULL, SMESH_ProxyMesh::Ptr(),
/*theCheckVertexNodes=*/false);
if ( error->IsOK() && !builder.findEdgesWithLayers())
{
// --------------------------------------------------------------------------------
void StdMeshers_ViscousLayers2D::RestoreListeners() const
{
- StudyContextStruct* sc = _gen->GetStudyContext( _studyId );
+ StudyContextStruct* sc = _gen->GetStudyContext();
std::map < int, SMESH_Mesh * >::iterator i_smesh = sc->mapMesh.begin();
for ( ; i_smesh != sc->mapMesh.end(); ++i_smesh )
{
SMESH_ProxyMesh::Ptr _ViscousBuilder2D::Compute()
{
- _faceSideVec = StdMeshers_FaceSide::GetFaceWires( _face, *_mesh, true, _error);
+ _faceSideVec = StdMeshers_FaceSide::GetFaceWires( _face, *_mesh, true, _error, &_helper );
if ( !_error->IsOK() )
return _proxyMesh;
if ( isR )
LR._lEdges.erase( LR._lEdges.begin()+1, eIt );
else
- LL._lEdges.erase( eIt, --LL._lEdges.end() );
+ LL._lEdges.erase( eIt+1, --LL._lEdges.end() );
// eIt = isR ? L._lEdges.begin()+1 : L._lEdges.end()-2;
// for ( size_t i = 1; i < iLE; ++i, eIt += dIt )
// eIt->_isBlocked = true;
faceProj->Perform( p );
if ( !faceProj->IsDone() || faceProj->NbPoints() < 1 )
return setLayerEdgeData( lEdge, u, pcurve, curve, p, reverse, NULL );
- Quantity_Parameter U,V;
+ Standard_Real U,V;
faceProj->LowerDistanceParameters(U,V);
lEdge._normal2D.SetCoord( U - uv.X(), V - uv.Y() );
lEdge._normal2D.Normalize();
}
} // loop on FACEs sharing E
+ // Check if L is an already shrinked seam
+ if ( adjFace.IsNull() && _helper.IsRealSeam( edgeID ))
+ if ( L._wire->Edge( L._edgeInd ).Orientation() == TopAbs_FORWARD )
+ continue;
// Commented as a case with a seam EDGE (issue 0052461) is hard to support
// because SMESH_ProxyMesh can't hold different sub-meshes for two
// 2D representations of the seam. But such a case is not a real practice one.
- // Check if L is an already shrinked seam
- // if ( adjFace.IsNull() && _helper.IsRealSeam( edgeID ))
// {
// for ( int iL2 = iL1-1; iL2 > -1; --iL2 )
// {
throw SALOME_Exception(SMESH_Comment("ViscousBuilder2D: not SMDS_TOP_EDGE node position: ")
<< oldNode->GetPosition()->GetTypeOfPosition()
<< " of node " << oldNode->GetID());
- SMDS_EdgePosition* pos = static_cast<SMDS_EdgePosition*>( oldNode->GetPosition() );
+ SMDS_EdgePositionPtr pos = oldNode->GetPosition();
pos->SetUParameter( nodeDataVec[iP].param );
gp_Pnt newP = curve.Value( nodeDataVec[iP].param );
vector< double > segLen( L._lEdges.size() );
segLen[0] = 0.0;
- // check if length modification is usefull: look for _LayerEdge's
+ // check if length modification is useful: look for _LayerEdge's
// with length limited due to collisions
bool lenLimited = false;
for ( size_t iLE = 1; ( iLE < L._lEdges.size()-1 && !lenLimited ); ++iLE )
nodeDataVec.front().param = L._wire->FirstU( L._edgeInd );
nodeDataVec.back() .param = L._wire->LastU ( L._edgeInd );
+ if (( nodeDataVec[0].node == nodeDataVec.back().node ) &&
+ ( _helper.GetPeriodicIndex() == 1 || _helper.GetPeriodicIndex() == 2 )) // closed EDGE
+ {
+ const int iCoord = _helper.GetPeriodicIndex();
+ gp_XY uv = nodeDataVec[0].UV();
+ uv.SetCoord( iCoord, L._lEdges[0]._uvOut.Coord( iCoord ));
+ nodeDataVec[0].SetUV( uv );
+
+ uv = nodeDataVec.back().UV();
+ uv.SetCoord( iCoord, L._lEdges.back()._uvOut.Coord( iCoord ));
+ nodeDataVec.back().SetUV( uv );
+ }
+
_ProxyMeshOfFace::_EdgeSubMesh* edgeSM
= getProxyMesh()->GetEdgeSubMesh( L._wire->EdgeID( L._edgeInd ));
edgeSM->SetUVPtStructVec( nodeDataVec );