PAL13639 (EDF PAL 317 : SMESH : Create "0D Hypothesis")

PAL13615 (EDF PAL 315/31 GEOM SMESH : meshing of a "5 edges quadrangle")
   create new hypothesis
This commit is contained in:
eap 2007-02-20 07:06:16 +00:00
parent 4ce06bc8ac
commit 602d60e4d1
21 changed files with 2249 additions and 35 deletions

View File

@ -507,6 +507,32 @@ module StdMeshers
raises (SALOME::SALOME_Exception);
};
/*!
* interface of "SegmentLengthAroundVertex" hypothesis.
* This hypothesis specifies length of segments adjacent to the vertex the
* hypothesis is assigned to
*/
interface StdMeshers_SegmentLengthAroundVertex : SMESH::SMESH_Hypothesis
{
/*!
* Sets <length> parameter value
*/
void SetLength(in double length)
raises (SALOME::SALOME_Exception);
/*!
* Returns <length> parameter value
*/
double GetLength();
};
/*!
* StdMeshers_SegmentAroundVertex_0D: interface of "SegmentAroundVertex" algorithm
*/
interface StdMeshers_SegmentAroundVertex_0D : SMESH::SMESH_0D_Algo
{
};
/*!
* StdMeshers_Regular_1D: interface of "Wire discretisation" algorithm
*/
@ -514,6 +540,13 @@ module StdMeshers
{
};
/*!
* StdMeshers_CompositeSegment_1D: interface of "Composite side discretisation" algorithm
*/
interface StdMeshers_CompositeSegment_1D : SMESH::SMESH_1D_Algo
{
};
/*!
* StdMeshers_MEFISTO_2D: interface of "Triangle (Mefisto)" algorithm
*/

View File

@ -62,7 +62,10 @@ EXPORT_HEADERS = \
StdMeshers_Projection_3D.hxx \
StdMeshers_RadialPrism_3D.hxx \
StdMeshers_ProjectionUtils.hxx \
StdMeshers_LayerDistribution.hxx
StdMeshers_LayerDistribution.hxx \
StdMeshers_SegmentAroundVertex_0D.hxx \
StdMeshers_SegmentLengthAroundVertex.hxx \
StdMeshers_CompositeSegment_1D.hxx \
EXPORT_PYSCRIPTS =
@ -100,7 +103,11 @@ LIB_SRC = \
StdMeshers_Projection_3D.cxx \
StdMeshers_RadialPrism_3D.cxx \
StdMeshers_ProjectionUtils.cxx \
StdMeshers_LayerDistribution.cxx
StdMeshers_LayerDistribution.cxx \
StdMeshers_SegmentAroundVertex_0D.cxx \
StdMeshers_SegmentLengthAroundVertex.cxx \
StdMeshers_FaceSide.cxx \
StdMeshers_CompositeSegment_1D.cxx
LIB_SERVER_IDL =

View File

@ -0,0 +1,413 @@
// SMESH SMESH : implementaion of SMESH idl descriptions
//
// Copyright (C) 2003 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.
//
// 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_Regular_1D.cxx
// Moved here from SMESH_Regular_1D.cxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
#include "StdMeshers_CompositeSegment_1D.hxx"
#include "StdMeshers_FaceSide.hxx"
#include "StdMeshers_AutomaticLength.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_HypoFilter.hxx"
#include "SMESH_subMesh.hxx"
#include "SMESH_subMeshEventListener.hxx"
#include "SMDS_MeshElement.hxx"
#include "SMDS_MeshNode.hxx"
#include "utilities.h"
#include <BRepAdaptor_CompCurve.hxx>
#include <BRep_Builder.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <gp_Pnt.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
using namespace std;
namespace {
//================================================================================
/*!
* \brief Search for an edge conjunct to the given one by the vertex
* Return NULL if more than 2 edges share the vertex or edges
* continuity is less than C1
*/
//================================================================================
TopoDS_Edge nextC1Edge(const TopoDS_Edge& edge,
SMESH_Mesh & aMesh,
const bool forward)
{
TopoDS_Edge eNext;
TopTools_MapOfShape edgeCounter;
edgeCounter.Add( edge );
TopoDS_Vertex v;
v = forward ? TopExp::LastVertex( edge,1 ) : TopExp::FirstVertex( edge,1 );
TopTools_ListIteratorOfListOfShape ancestIt = aMesh.GetAncestors( v );
for ( ; ancestIt.More(); ancestIt.Next() )
{
const TopoDS_Shape & ancestor = ancestIt.Value();
if ( ancestor.ShapeType() == TopAbs_EDGE && edgeCounter.Add( ancestor ))
eNext = TopoDS::Edge( ancestor );
}
if ( edgeCounter.Extent() < 3 && !eNext.IsNull() ) {
GeomAbs_Shape cont = SMESH_Algo::Continuity( edge, eNext );
if (cont >= GeomAbs_C1) {
// care of orientation
bool reverse;
if ( forward )
reverse = ( !v.IsSame( TopExp::FirstVertex( eNext, true )));
else
reverse = ( !v.IsSame( TopExp::LastVertex( eNext, true )));
if ( reverse )
eNext.Reverse();
return eNext;
}
}
return TopoDS_Edge();
}
//================================================================================
/*!
* \brief Update submeshes state for all edges and internal vertices,
* make them look computed even if none edge or node is set on them
*/
//================================================================================
void careOfSubMeshes( StdMeshers_FaceSide& side, EventListener* eListener)
{
if ( side.NbEdges() < 2)
return;
for ( int iE = 0; iE < side.NbEdges(); ++iE )
{
// set listener and its data
EventListenerData * listenerData = new EventListenerData(true);
const TopoDS_Edge& edge = side.Edge( iE );
SMESH_subMesh * sm = side.GetMesh()->GetSubMesh( edge );
sm->SetEventListener( eListener, listenerData, sm );
// add edge submesh to the data
sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
if ( !sm->GetComputeState() != SMESH_subMesh::COMPUTE_OK ) {
sm->SetIsAlwaysComputed( true );
listenerData->mySubMeshes.push_back( sm );
}
// add internal vertex submesh to the data
if ( iE )
{
TopoDS_Vertex V = side.FirstVertex( iE );
sm = side.GetMesh()->GetSubMesh( V );
sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
if ( !sm->GetComputeState() != SMESH_subMesh::COMPUTE_OK )
sm->SetIsAlwaysComputed( true );
listenerData->mySubMeshes.push_back( sm );
}
}
}
//================================================================================
/*!
* \brief Class used to restore nodes on internal vertices of a complex side
* when StdMeshers_CompositeSegment_1D algorithm is removed
*/
//================================================================================
struct VertexNodesRestoringListener : public SMESH_subMeshEventListener
{
VertexNodesRestoringListener():SMESH_subMeshEventListener(0) // won't be deleted by submesh
{}
/*!
* \brief Restore nodes on internal vertices of a complex side
* \param event - algo_event or compute_event itself (of SMESH_subMesh)
* \param eventType - ALGO_EVENT or COMPUTE_EVENT (of SMESH_subMesh)
* \param subMesh - the submesh where the event occures
* \param data - listener data stored in the subMesh
* \param hyp - hypothesis, if eventType is algo_event
*/
void ProcessEvent(const int event,
const int eventType,
SMESH_subMesh* subMesh,
EventListenerData* data,
SMESH_Hypothesis* /*hyp*/)
{
bool hypRemoved = ( eventType == SMESH_subMesh::ALGO_EVENT &&
subMesh->GetAlgoState() != SMESH_subMesh::HYP_OK );
if ( hypRemoved && data )
{
list<SMESH_subMesh*>::iterator smIt = data->mySubMeshes.begin();
for ( ; smIt != data->mySubMeshes.end(); ++smIt )
{
if ( SMESH_subMesh* sm = *smIt ) {
sm->SetIsAlwaysComputed( false );
if ( sm->GetSubShape().ShapeType() == TopAbs_VERTEX )
sm->GetFather()->GetGen()->Compute( *sm );
else // edge
sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
}
}
}
// at study restoration:
// check if edge submesh must have _alwaysComputed flag
else if ( eventType == SMESH_subMesh::COMPUTE_EVENT &&
event == SMESH_subMesh::SUBMESH_RESTORED )
{
if ( !subMesh->GetEventListenerData( this )) { // not yet checked
SMESHDS_Mesh * meshDS = subMesh->GetFather()->GetMeshDS();
TopoDS_Edge edge = TopoDS::Edge( subMesh->GetSubShape() );
TopoDS_Vertex V1, V2;
TopExp::Vertices( edge, V1, V2 );
bool noVertexNode1 = ( !SMESH_Algo::VertexNode( V1, meshDS ));
bool noVertexNode2 = ( !SMESH_Algo::VertexNode( V2, meshDS ));
if ( noVertexNode1 || noVertexNode2 ) {
TopoDS_Face face;
auto_ptr< StdMeshers_FaceSide > side
( StdMeshers_CompositeSegment_1D::GetFaceSide(*subMesh->GetFather(),
edge, face, false ));
if ( side->NbSegments() )
careOfSubMeshes( *side, this );
}
}
}
}
}; // struct VertexNodesRestoringListener
}
//=============================================================================
/*!
*
*/
//=============================================================================
StdMeshers_CompositeSegment_1D::StdMeshers_CompositeSegment_1D(int hypId,
int studyId,
SMESH_Gen * gen)
:StdMeshers_Regular_1D(hypId, studyId, gen)
{
MESSAGE("StdMeshers_CompositeSegment_1D::StdMeshers_CompositeSegment_1D");
_name = "CompositeSegment_1D";
_EventListener = new VertexNodesRestoringListener();
}
//=============================================================================
/*!
*
*/
//=============================================================================
StdMeshers_CompositeSegment_1D::~StdMeshers_CompositeSegment_1D()
{
delete _EventListener;
}
//=============================================================================
/*!
* \brief Sets event listener to submeshes if necessary
* \param subMesh - submesh where algo is set
*
* This method is called when a submesh gets HYP_OK algo_state.
* After being set, event listener is notified on each event of a submesh.
*/
//=============================================================================
void StdMeshers_CompositeSegment_1D::SetEventListener(SMESH_subMesh* subMesh)
{
subMesh->SetEventListener( _EventListener, 0, subMesh);
StdMeshers_Regular_1D::SetEventListener( subMesh );
}
//=============================================================================
/*!
* \brief Return a face side the edge belongs to
*/
//=============================================================================
StdMeshers_FaceSide *
StdMeshers_CompositeSegment_1D::GetFaceSide(SMESH_Mesh& aMesh,
const TopoDS_Edge& anEdge,
const TopoDS_Face& aFace,
const bool ignoreMeshed)
{
list< TopoDS_Edge > edges;
edges.push_back( anEdge );
list <const SMESHDS_Hypothesis *> hypList;
SMESH_Algo* theAlgo = aMesh.GetGen()->GetAlgo( aMesh, anEdge );
if ( theAlgo ) hypList = theAlgo->GetUsedHypothesis(aMesh, anEdge, false);
for ( int forward = 0; forward < 2; ++forward )
{
TopoDS_Edge eNext = nextC1Edge( anEdge, aMesh, forward );
while ( !eNext.IsNull() ) {
if ( ignoreMeshed ) {
// eNext must not have computed mesh
if ( SMESHDS_SubMesh* sm = aMesh.GetMeshDS()->MeshElements(eNext) )
if ( sm->NbNodes() || sm->NbElements() )
break;
}
// eNext must have same hypotheses
SMESH_Algo* algo = aMesh.GetGen()->GetAlgo( aMesh, eNext );
if ( !algo ||
string(theAlgo->GetName()) != algo->GetName() ||
hypList != algo->GetUsedHypothesis(aMesh, eNext, false))
break;
if ( forward )
edges.push_back( eNext );
else
edges.push_front( eNext );
eNext = nextC1Edge( eNext, aMesh, forward );
}
}
return new StdMeshers_FaceSide( aFace, edges, &aMesh, true );
}
//=============================================================================
/*!
*
*/
//=============================================================================
bool StdMeshers_CompositeSegment_1D::Compute(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape)
{
TopoDS_Edge edge = TopoDS::Edge( aShape );
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
// Get edges to be discretized as a whole
TopoDS_Face nullFace;
auto_ptr< StdMeshers_FaceSide > side( GetFaceSide(aMesh, edge, nullFace, true ));
//side->dump("IN COMPOSITE SEG");
if ( side->NbEdges() < 2 )
return StdMeshers_Regular_1D::Compute( aMesh, aShape );
// update segment lenght computed by StdMeshers_AutomaticLength
const list <const SMESHDS_Hypothesis * > & hyps = GetUsedHypothesis(aMesh, aShape);
if ( !hyps.empty() ) {
StdMeshers_AutomaticLength * autoLenHyp = const_cast<StdMeshers_AutomaticLength *>
(dynamic_cast <const StdMeshers_AutomaticLength * >(hyps.front()));
if ( autoLenHyp )
_value[ BEG_LENGTH_IND ]= autoLenHyp->GetLength( &aMesh, side->Length() );
}
// Compute node parameters
auto_ptr< BRepAdaptor_CompCurve > C3d ( side->GetCurve3d() );
double f = C3d->FirstParameter(), l = C3d->LastParameter();
list< double > params;
if ( !computeInternalParameters ( *C3d, side->Length(), f, l, params, false ))
return false;
// Redistribute parameters near ends
TopoDS_Vertex VFirst = side->FirstVertex();
TopoDS_Vertex VLast = side->LastVertex();
redistributeNearVertices( aMesh, *C3d, side->Length(), params, VFirst, VLast );
params.push_front(f);
params.push_back(l);
int nbNodes = params.size();
// Create mesh
const SMDS_MeshNode * nFirst = SMESH_Algo::VertexNode( VFirst, meshDS );
if (!nFirst) {
MESSAGE (" NO NODE BUILT ON VERTEX ");
return false;
}
const SMDS_MeshNode * nLast = SMESH_Algo::VertexNode( VLast, meshDS );
if (!nLast) {
MESSAGE (" NO NODE BUILT ON VERTEX ");
return false;
}
vector<const SMDS_MeshNode*> nodes( nbNodes, (const SMDS_MeshNode*)0 );
nodes.front() = nFirst;
nodes.back() = nLast;
// create internal nodes
list< double >::iterator parIt = params.begin();
double prevPar = *parIt;
Standard_Real u;
for ( int iN = 0; parIt != params.end(); ++iN, ++parIt)
{
if ( !nodes[ iN ] ) {
gp_Pnt p = C3d->Value( *parIt );
SMDS_MeshNode* n = meshDS->AddNode( p.X(), p.Y(), p.Z());
C3d->Edge( *parIt, edge, u );
meshDS->SetNodeOnEdge( n, edge, u );
// cout << "new NODE: par="<<*parIt<<" ePar="<<u<<" e="<<edge.TShape().operator->()
// << " " << n << endl;
nodes[ iN ] = n;
}
// create edges
if ( iN ) {
double mPar = ( prevPar + *parIt )/2;
if ( _quadraticMesh ) {
// create medium node
double segLen = GCPnts_AbscissaPoint::Length(*C3d, prevPar, *parIt);
GCPnts_AbscissaPoint ruler( *C3d, segLen/2., prevPar );
if ( ruler.IsDone() )
mPar = ruler.Parameter();
gp_Pnt p = C3d->Value( mPar );
SMDS_MeshNode* n = meshDS->AddNode( p.X(), p.Y(), p.Z());
//cout << "new NODE "<< n << endl;
meshDS->SetNodeOnEdge( n, edge, u );
SMDS_MeshEdge * seg = meshDS->AddEdge(nodes[ iN-1 ], nodes[ iN ], n);
meshDS->SetMeshElementOnShape(seg, edge);
}
else {
C3d->Edge( mPar, edge, u );
SMDS_MeshEdge * seg = meshDS->AddEdge(nodes[ iN-1 ], nodes[ iN ]);
meshDS->SetMeshElementOnShape(seg, edge);
}
}
prevPar = *parIt;
}
// remove nodes on internal vertices
for ( int iE = 0; iE < side->NbEdges()-1; ++iE )
{
TopoDS_Vertex V = side->LastVertex( iE );
while ( const SMDS_MeshNode * n = SMESH_Algo::VertexNode( V, meshDS ))
meshDS->RemoveNode( n );
}
// Update submeshes state for all edges and internal vertices,
// make them look computed even if none edge or node is set on them
careOfSubMeshes( *side, _EventListener );
return true;
}

View File

@ -0,0 +1,68 @@
// SMESH SMESH : implementaion of SMESH idl descriptions
//
// Copyright (C) 2003 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.
//
// 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_CompositeSegment_1D.hxx
// Module : SMESH
// $Header$
#ifndef _SMESH_CompositeSegment_1D_HXX_
#define _SMESH_CompositeSegment_1D_HXX_
#include "StdMeshers_Regular_1D.hxx"
class SMESH_subMeshEventListener;
class SMESH_Mesh;
class StdMeshers_FaceSide;
class TopoDS_Edge;
class TopoDS_Face;
class StdMeshers_CompositeSegment_1D: public StdMeshers_Regular_1D
{
public:
StdMeshers_CompositeSegment_1D(int hypId, int studyId, SMESH_Gen* gen);
virtual ~StdMeshers_CompositeSegment_1D();
virtual bool Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape);
/*!
* \brief Sets event listener to submeshes if necessary
* \param subMesh - submesh where algo is set
*
* This method is called when a submesh gets HYP_OK algo_state.
* After being set, event listener is notified on each event of a submesh.
*/
virtual void SetEventListener(SMESH_subMesh* subMesh);
/*!
* \brief Return a face side the edge belongs to
*/
static StdMeshers_FaceSide * GetFaceSide(SMESH_Mesh& aMesh,
const TopoDS_Edge& anEdge,
const TopoDS_Face& aFace,
const bool ignoreMeshed);
protected:
SMESH_subMeshEventListener* _EventListener;
};
#endif

View File

@ -0,0 +1,477 @@
// SMESH SMESH : implementaion of SMESH idl descriptions
//
// Copyright (C) 2003 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.
//
// 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_FaceSide.hxx
// Created : Wed Jan 31 18:41:25 2007
// Author : Edward AGAPOV (eap)
// Module : SMESH
#include "StdMeshers_FaceSide.hxx"
#include "SMDS_EdgePosition.hxx"
#include "SMDS_MeshNode.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESHDS_SubMesh.hxx"
#include "SMESH_Algo.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_MeshEditor.hxx"
#include <Adaptor2d_Curve2d.hxx>
#include <BRepAdaptor_CompCurve.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <TopExp.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <map>
#include "utilities.h"
//================================================================================
/*!
* \brief Constructor of a side of one edge
* \param theFace - the face
* \param theEdge - the edge
*/
//================================================================================
StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace,
const TopoDS_Edge& theEdge,
SMESH_Mesh* theMesh,
const bool theIsForward)
{
list<TopoDS_Edge> edges(1,theEdge);
*this = StdMeshers_FaceSide( theFace, edges, theMesh, theIsForward );
}
//================================================================================
/*!
* \brief Constructor of a side of several edges
* \param theFace - the face
* \param theEdge - the edge
*/
//================================================================================
StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace,
list<TopoDS_Edge>& theEdges,
SMESH_Mesh* theMesh,
const bool theIsForward)
{
int nbEdges = theEdges.size();
myEdge.resize( nbEdges );
myC2d.resize( nbEdges );
myFirst.resize( nbEdges );
myLast.resize( nbEdges );
myNormPar.resize( nbEdges );
myLength = 0;
myNbPonits = myNbSegments = 0;
myMesh = theMesh;
myMissingVertexNodes = false;
if ( nbEdges == 0 ) return;
SMESHDS_Mesh* meshDS = theMesh->GetMeshDS();
vector<double> len( nbEdges );
list<TopoDS_Edge>::iterator edge = theEdges.begin();
for ( int index = 0; edge != theEdges.end(); ++index, ++edge )
{
int i = theIsForward ? index : nbEdges - index - 1;
len[i] = SMESH_Algo::EdgeLength( *edge );
myLength += len[i];
myEdge[i] = *edge;
if ( !theIsForward ) myEdge[i].Reverse();
if ( theFace.IsNull() )
BRep_Tool::Range( *edge, myFirst[i], myLast[i] );
else
myC2d[i] = BRep_Tool::CurveOnSurface( *edge, theFace, myFirst[i], myLast[i] );
if ( myEdge[i].Orientation() == TopAbs_REVERSED )
std::swap( myFirst[i], myLast[i] );
if ( SMESHDS_SubMesh* sm = meshDS->MeshElements( *edge )) {
int nbN = sm->NbNodes();
SMDS_ElemIteratorPtr elemIt = sm->GetElements();
if ( elemIt->more() && elemIt->next()->IsQuadratic() )
nbN -= sm->NbElements();
myNbPonits += nbN;
myNbSegments += sm->NbElements();
}
if ( SMESH_Algo::VertexNode( TopExp::FirstVertex( *edge, 1), meshDS ))
myNbPonits += 1; // for the first end
else
myMissingVertexNodes = true;
}
if ( SMESH_Algo::VertexNode( TopExp::LastVertex( theEdges.back(), 1), meshDS ))
myNbPonits++; // for the last end
else
myMissingVertexNodes = true;
if ( nbEdges > 1 && myLength > DBL_MIN ) {
for ( int i = 0; i < nbEdges; ++i ) {
myNormPar[ i ] = len[i]/myLength;
if ( i > 0 )
myNormPar[ i ] += myNormPar[ i-1 ];
}
}
myNormPar[nbEdges-1] = 1.;
//dump();
}
//================================================================================
/*!
* \brief First curve parameter
* \retval double - parameter value
*/
//================================================================================
// double StdMeshers_FaceSide::First() const
// {
// return 0;
// }
// //================================================================================
// /*!
// * \brief Last curve parameter
// * \retval double - parameter value
// */
// //================================================================================
// double StdMeshers_FaceSide::Last() const
// {
// return 1;
// }
// //================================================================================
// /*!
// * \brief
// * \retval bool -
// */
// //================================================================================
// bool StdMeshers_FaceSide::IsForward() const
// {
// return myIsForward;
// }
//================================================================================
/*!
* \brief Return info on nodes on the side
* \retval UVPtStruct* - array of data structures
*/
//================================================================================
const vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst,
double constValue) const
{
if ( myPoints.empty() ) {
if ( NbEdges() == 0 ) return myPoints;
SMESHDS_Mesh* meshDS = myMesh->GetMeshDS();
// sort nodes of all edges putting them into a map
map< double, const SMDS_MeshNode*> u2node;
for ( int i = 0; i < myEdge.size(); ++i )
{
// put 1st vertex node
TopoDS_Vertex VFirst, VLast;
TopExp::Vertices( myEdge[i], VFirst, VLast, true);
const SMDS_MeshNode* node = SMESH_Algo::VertexNode( VFirst, meshDS );
double prevNormPar = ( i == 0 ? 0 : myNormPar[ i-1 ]); // normalized param
if ( node ) { // internal nodes may be missing
u2node.insert( make_pair( prevNormPar, node ));
} else if ( i == 0 ) {
MESSAGE(" NO NODE on VERTEX" );
return myPoints;
}
// put 2nd vertex node for a last edge
if ( i+1 == myEdge.size() ) {
node = SMESH_Algo::VertexNode( VLast, meshDS );
if ( !node ) {
MESSAGE(" NO NODE on VERTEX" );
return myPoints;
}
u2node.insert( make_pair( 1., node ));
}
// put internal nodes
SMESHDS_SubMesh* sm = meshDS->MeshElements( myEdge[i] );
if ( !sm ) continue;
SMDS_NodeIteratorPtr nItr = sm->GetNodes();
double paramSize = myLast[i] - myFirst[i], r = myNormPar[i] - prevNormPar;
while ( nItr->more() ) {
const SMDS_MeshNode* node = nItr->next();
if ( SMESH_MeshEditor::IsMedium( node, SMDSAbs_Edge ))
continue;
const SMDS_EdgePosition* epos =
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
double u = epos->GetUParameter();
// paramSize is signed so orientation is taken into account
double normPar = prevNormPar + r * ( u - myFirst[i] ) / paramSize;
#ifdef _DEBUG_
if ( normPar > 1 || normPar < 0) {
dump("DEBUG");
cout << "WRONG normPar: "<<normPar<< " prevNormPar="<<prevNormPar
<< " u="<<u << " myFirst[i]="<<myFirst[i]<< " myLast[i]="<<myLast[i]
<< " paramSize="<<paramSize<<endl;
}
#endif
u2node.insert( make_pair( normPar, node ));
}
}
if ( u2node.size() != myNbPonits ) {
MESSAGE("Wrong node parameters on edges");
return myPoints;
}
// fill array of UVPtStruct
vector<uvPtStruct>* points = const_cast<vector<uvPtStruct>*>( &myPoints );
points->resize( myNbPonits );
int EdgeIndex = 0;
double prevNormPar = 0, paramSize = myNormPar[ EdgeIndex ];
map< double, const SMDS_MeshNode*>::iterator u_node = u2node.begin();
for (int i = 0 ; u_node != u2node.end(); ++u_node, ++i ) {
UVPtStruct & uvPt = (*points)[i];
uvPt.node = u_node->second;
uvPt.x = uvPt.y = uvPt.normParam = u_node->first;
if ( isXConst ) uvPt.x = constValue;
else uvPt.y = constValue;
if ( myNormPar[ EdgeIndex ] < uvPt.normParam ) {
prevNormPar = myNormPar[ EdgeIndex ];
++EdgeIndex;
#ifdef _DEBUG_
if ( EdgeIndex >= myEdge.size() ) {
dump("DEBUG");
cout << "WRONg EdgeIndex " << 1+EdgeIndex
<< " myNormPar.size()="<<myNormPar.size()
<< " myNormPar["<< EdgeIndex<<"]="<< myNormPar[ EdgeIndex ]
<< " uvPt.normParam="<<uvPt.normParam <<endl;
}
#endif
paramSize = myNormPar[ EdgeIndex ] - prevNormPar;
}
double r = ( uvPt.normParam - prevNormPar )/ paramSize;
uvPt.param = myFirst[EdgeIndex] * ( 1 - r ) + myLast[EdgeIndex] * r;
if ( !myC2d[ EdgeIndex ].IsNull() ) {
gp_Pnt2d p = myC2d[ EdgeIndex ]->Value( uvPt.param );
uvPt.u = p.X();
uvPt.v = p.Y();
}
else {
uvPt.u = uvPt.v = 1e+100;
}
}
}
return myPoints;
}
//================================================================================
/*!
* \brief Falsificate info on nodes
* \param nbSeg - nb of segments on the side
* \retval UVPtStruct* - array of data structures
*/
//================================================================================
const vector<UVPtStruct>& StdMeshers_FaceSide::SimulateUVPtStruct(int nbSeg,
bool isXConst,
double constValue) const
{
if ( myFalsePoints.empty() ) {
if ( NbEdges() == 0 ) return myFalsePoints;
vector<uvPtStruct>* points = const_cast<vector<uvPtStruct>*>( &myFalsePoints );
points->resize( nbSeg+1 );
int EdgeIndex = 0;
double prevNormPar = 0, paramSize = myNormPar[ EdgeIndex ];
for (int i = 0 ; i < myFalsePoints.size(); ++i ) {
double normPar = double(i) / double(nbSeg);
UVPtStruct & uvPt = (*points)[i];
uvPt.node = 0;
uvPt.x = uvPt.y = uvPt.param = uvPt.normParam = normPar;
if ( isXConst ) uvPt.x = constValue;
else uvPt.y = constValue;
if ( myNormPar[ EdgeIndex ] < normPar ) {
prevNormPar = myNormPar[ EdgeIndex ];
++EdgeIndex;
paramSize = myNormPar[ EdgeIndex ] - prevNormPar;
}
double r = ( normPar - prevNormPar )/ paramSize;
uvPt.param = myFirst[EdgeIndex] * ( 1 - r ) + myLast[EdgeIndex] * r;
if ( !myC2d[ EdgeIndex ].IsNull() ) {
gp_Pnt2d p = myC2d[ EdgeIndex ]->Value( uvPt.param );
uvPt.u = p.X();
uvPt.v = p.Y();
}
else {
uvPt.u = uvPt.v = 1e+100;
}
}
}
return myFalsePoints;
}
// gp_Pnt StdMeshers_FaceSide::Value(double U) const
// {
// }
//================================================================================
/*!
* \brief reverse order of vector elements
* \param vec - vector to reverse
*/
//================================================================================
template <typename T > void reverse(vector<T> & vec)
{
for ( int f=0, r=vec.size()-1; f < r; ++f, --r )
std::swap( vec[f], vec[r] );
}
//================================================================================
/*!
* \brief Change orientation of side geometry
*/
//================================================================================
void StdMeshers_FaceSide::Reverse()
{
int nbEdges = myEdge.size();
for ( int i = nbEdges-1; i >= 0; --i ) {
std::swap( myFirst[i], myLast[i] );
// at the first loop 1. is overwritten
myNormPar[i] = 1 - myNormPar[i-1];
myEdge[i].Reverse();
}
if ( nbEdges > 1 ) {
reverse( myEdge );
reverse( myC2d );
reverse( myFirst );
reverse( myLast );
reverse( myNormPar );
}
myNormPar[nbEdges-1]=1.;
myPoints.clear();
myFalsePoints.clear();
}
//================================================================================
/*!
* \brief Show side features
*/
//================================================================================
void StdMeshers_FaceSide::dump(const char* msg) const
{
#ifdef _DEBUG_
cout << endl;
if (msg) cout << msg <<endl;
cout<<"NB EDGES: "<< myEdge.size() <<endl;
cout << "nbPoints: "<<myNbPonits<<" vecSize: " << myPoints.size()<<" "<<myFalsePoints.size() <<endl;
for ( int i=0; i<myEdge.size(); ++i)
{
cout << "\t"<<i+1<<endl;
cout << "\tEDGE: ";
if (myEdge[i].IsNull())
cout<<"NULL"<<endl;
else {
TopAbs::Print(myEdge[i].Orientation(),cout)<<" "<<myEdge[i].TShape().operator->()<<endl;
cout << "\tV1: " << TopExp::FirstVertex( myEdge[i], 1).TShape().operator->()
<< " V2: " << TopExp::LastVertex( myEdge[i], 1).TShape().operator->() << endl;
}
cout << "\tC2d: ";
if (myC2d[i].IsNull()) cout<<"NULL"<<endl;
else cout << myC2d[i].operator->()<<endl;
cout << "\tF: "<<myFirst[i]<< " L: "<< myLast[i]<<endl;
cout << "\tnormPar: "<<myNormPar[i]<<endl;
}
#endif
}
//================================================================================
/*!
* \brief Creates a Adaptor2d_Curve2d to be used in SMESH_Block
* \retval Adaptor2d_Curve2d* -
*/
//================================================================================
struct Adaptor2dCurve2d : public Adaptor2d_Curve2d
{
const StdMeshers_FaceSide* mySide;
Adaptor2dCurve2d(const StdMeshers_FaceSide* faceSide):mySide(faceSide) {}
gp_Pnt2d Value(const Standard_Real U) const { return mySide->Value2d( U ); }
Standard_Real FirstParameter() const { return 0; }
Standard_Real LastParameter() const { return 1; }
};
Adaptor2d_Curve2d* StdMeshers_FaceSide::GetCurve2d() const
{
return new Adaptor2dCurve2d( this );
}
//================================================================================
/*!
* \brief Creates a fully functional Adaptor_Curve
*/
//================================================================================
BRepAdaptor_CompCurve* StdMeshers_FaceSide::GetCurve3d() const
{
if ( myEdge.empty() )
return 0;
// if ( myEdge.size() == 1 )
// return new BRepAdaptor_Curve( myEdge[0] );
TopoDS_Wire aWire;
BRep_Builder aBuilder;
aBuilder.MakeWire(aWire);
for ( int i=0; i<myEdge.size(); ++i )
aBuilder.Add( aWire, myEdge[i] );
return new BRepAdaptor_CompCurve( aWire );
}
//================================================================================
/*!
* \brief Return 2D point by normalized parameter
* \param U - normalized parameter value
* \retval gp_Pnt2d - point
*/
//================================================================================
gp_Pnt2d StdMeshers_FaceSide::Value2d(double U) const
{
if ( !myC2d[0].IsNull() ) {
int i = EdgeIndex( U );
double prevU = i ? myNormPar[ i-1 ] : 0;
double r = ( U - prevU )/ ( myNormPar[ i ] - prevU );
return myC2d[ i ]->Value( myFirst[i] * ( 1 - r ) + myLast[i] * r );
}
return gp_Pnt2d( 1e+100, 1e+100 );
}

View File

@ -0,0 +1,269 @@
// SMESH SMESH : implementaion of SMESH idl descriptions
//
// Copyright (C) 2003 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.
//
// 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_FaceSide.hxx
// Created : Wed Jan 31 18:41:25 2007
// Author : Edward AGAPOV (eap)
// Module : SMESH
#ifndef StdMeshers_FaceSide_HeaderFile
#define StdMeshers_FaceSide_HeaderFile
#include <gp_Pnt2d.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <Geom2d_Curve.hxx>
#include <TopExp.hxx>
#include <vector>
#include <list>
#include <boost/shared_ptr.hpp>
class SMDS_MeshNode;
class SMESH_Mesh;
class Adaptor2d_Curve2d;
class Adaptor3d_Curve;
class BRepAdaptor_CompCurve;
class TopoDS_Face;
typedef struct uvPtStruct
{
double param;
//int curvIndex;
double normParam;
double u; // original 2d parameter
double v;
double x; // 2d parameter, normalized [0,1]
double y;
const SMDS_MeshNode * node;
} UVPtStruct;
class StdMeshers_FaceSide;
typedef boost::shared_ptr< StdMeshers_FaceSide > StdMeshers_FaceSidePtr;
typedef boost::shared_ptr< uvPtStruct > UVPtStructPtr;
//================================================================================
/*!
* \brief Represents a side of a quasi quadrilateral face.
* It can be composed of several edges. Gives access to geometry and 1D mesh of a side.
*/
//================================================================================
class StdMeshers_FaceSide
{
public:
/*!
* \brief Wrap one edge
*/
StdMeshers_FaceSide(const TopoDS_Face& theFace,
const TopoDS_Edge& theEdge,
SMESH_Mesh* theMesh,
const bool theIsForward);
/*!
* \brief Wrap several edges. Edges must be properly ordered and oriented.
*/
StdMeshers_FaceSide(const TopoDS_Face& theFace,
list<TopoDS_Edge>& theEdges,
SMESH_Mesh* theMesh,
const bool theIsForward);
/*!
* \brief Change orientation of side geometry
*/
void Reverse();
/*!
* \brief Return nb nodes on edges including ones on vertices
*/
int NbPoints() const { return myNbPonits; }
/*!
* \brief Return nb nodes on edges including ones on vertices
*/
int NbSegments() const { return myNbSegments; }
/*!
* \brief Return mesh
*/
SMESH_Mesh* GetMesh() const { return myMesh; }
/*!
* \brief Return true if there vertices without nodes
*/
bool MissVertexNode() const { return myMissingVertexNodes; }
/*!
* \brief Return detailed data on nodes
* \param isXConst - true if normalized parameter X is constant
* \param constValue - constant parameter value
*
* Missing nodes are allowed only on internal vertices
*/
const vector<UVPtStruct>& GetUVPtStruct(bool isXConst, double constValue) const;
/*!
* \brief Simulates detailed data on nodes
* \param isXConst - true if normalized parameter X is constant
* \param constValue - constant parameter value
*/
const vector<UVPtStruct>& SimulateUVPtStruct(int nbSeg,
bool isXConst,
double constValue) const;
/*!
* \brief Return edge and parameter on edge by normalized parameter
*/
inline double Parameter(double U, TopoDS_Edge & edge) const;
/*!
* \brief Return UV by normalized parameter
*/
gp_Pnt2d Value2d(double U) const;
/*!
* \brief Creates a Adaptor2d_Curve2d to be used in SMESH_Block
*/
Adaptor2d_Curve2d* GetCurve2d() const;
/*!
* \brief Creates a fully functional Adaptor_Curve
*/
BRepAdaptor_CompCurve* GetCurve3d() const;
/*!
* \brief Return nb of wrapped edges
*/
int NbEdges() const { return myEdge.size(); }
/*!
* \brief Return i-th wrapped edge (count starts from zero)
*/
const TopoDS_Edge& Edge(int i) const { return myEdge[i]; }
/*!
* \brief Return 1st vertex of the i-the edge (count starts from zero)
*/
inline TopoDS_Vertex FirstVertex(int i=0) const;
/*!
* \brief Return last vertex of the i-the edge (count starts from zero)
*/
inline TopoDS_Vertex LastVertex(int i=-1) const;
/*!
* \brief Return first normalized parameter of the i-the edge (count starts from zero)
*/
inline double FirstParameter(int i) const;
/*!
* \brief Return ast normalized parameter of the i-the edge (count starts from zero)
*/
inline double LastParameter(int i) const;
/*!
* \brief Return side length
*/
double Length() const { return myLength; }
/*!
* \brief Return edge index corresponding to normalized parameter
*/
inline int EdgeIndex( double U ) const;
//virtual gp_Pnt Value(double U) const;
void dump(const char* msg=0) const;
protected:
vector<uvPtStruct> myPoints, myFalsePoints;
vector<TopoDS_Edge> myEdge;
vector<Handle(Geom2d_Curve)> myC2d;
vector<double> myFirst;
vector<double> myLast;
vector<double> myNormPar;
double myLength;
int myNbPonits, myNbSegments;
SMESH_Mesh* myMesh;
bool myMissingVertexNodes;
};
//================================================================================
/*!
* \brief Return edge index corresponding to normalized parameter
* \param U - the parameter
* \retval int - index
*/
//================================================================================
inline int StdMeshers_FaceSide::EdgeIndex( double U ) const
{
int i = myNormPar.size() - 1;
while ( i > 0 && U < myNormPar[ i-1 ] ) --i;
return i;
}
//================================================================================
/*!
* \brief Return edge and parameter on edge by normalized parameter
* \param U - the parameter
* \retval double - pameter on a curve
*/
//================================================================================
inline double StdMeshers_FaceSide::Parameter(double U, TopoDS_Edge & edge) const
{
int i = EdgeIndex( U );
edge = myEdge[ i ];
double prevU = i ? myNormPar[ i-1 ] : 0;
double r = ( U - prevU )/ ( myNormPar[ i ] - prevU );
return myFirst[i] * ( 1 - r ) + myLast[i] * r;
}
//================================================================================
/*!
* \brief Return 1st vertex of the i-the edge
*/
//================================================================================
inline TopoDS_Vertex StdMeshers_FaceSide::FirstVertex(int i) const
{
return i < myEdge.size() ? TopExp::FirstVertex( myEdge[i], 1 ) : TopoDS_Vertex();
}
//================================================================================
/*!
* \brief Return last vertex of the i-the edge
*/
//================================================================================
inline TopoDS_Vertex StdMeshers_FaceSide::LastVertex(int i) const
{
return i<0 ? TopExp::LastVertex( myEdge.back(), 1) : i<myEdge.size() ? TopExp::LastVertex( myEdge[i], 1 ) : TopoDS_Vertex();
}
//================================================================================
/*!
* \brief Return first normalized parameter of the i-the edge
*/
//================================================================================
inline double StdMeshers_FaceSide::FirstParameter(int i) const
{
return i==0 ? 0. : i<myNormPar.size() ? myNormPar[i-1] : 1.;
}
//================================================================================
/*!
* \brief Return ast normalized parameter of the i-the edge
*/
//================================================================================
inline double StdMeshers_FaceSide::LastParameter(int i) const
{
return i<myNormPar.size() ? myNormPar[i] : 1;
}
#endif

View File

@ -0,0 +1,96 @@
// SMESH SMESH : implementaion of SMESH idl descriptions
//
// Copyright (C) 2003 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.
//
// 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_SegmentAroundVertex_0D.cxx
// Module : SMESH
// Created : Fri Oct 20 11:37:07 2006
// Author : Edward AGAPOV (eap)
#include "StdMeshers_SegmentAroundVertex_0D.hxx"
//=======================================================================
//function : StdMeshers_SegmentAroundVertex_0D
//purpose :
//=======================================================================
StdMeshers_SegmentAroundVertex_0D::StdMeshers_SegmentAroundVertex_0D
(int hypId, int studyId, SMESH_Gen* gen)
:SMESH_0D_Algo(hypId, studyId, gen)
{
_name = "SegmentAroundVertex_0D";
// it is assigned to vertices but influence a state of EDGE submeshes
_shapeType = (1 << TopAbs_VERTEX); // 1 bit per shape type
_compatibleHypothesis.push_back("SegmentLengthAroundVertex");
}
//================================================================================
/*!
* \brief Destructor
*/
//================================================================================
StdMeshers_SegmentAroundVertex_0D::~StdMeshers_SegmentAroundVertex_0D()
{}
//=======================================================================
//function : CheckHypothesis
//purpose :
//=======================================================================
bool StdMeshers_SegmentAroundVertex_0D::CheckHypothesis(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
SMESH_Hypothesis::Hypothesis_Status& aStatus)
{
list <const SMESHDS_Hypothesis * >::const_iterator itl;
const list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape);
if ( hyps.size() == 0 )
{
aStatus = SMESH_Hypothesis::HYP_MISSING;
return false; // can't work with no hypothesis
}
if ( hyps.size() > 1 )
{
aStatus = SMESH_Hypothesis::HYP_ALREADY_EXIST;
}
else
{
aStatus = SMESH_Hypothesis::HYP_OK;
}
return ( aStatus == HYP_OK );
}
//=======================================================================
//function : Compute
//purpose :
//=======================================================================
bool StdMeshers_SegmentAroundVertex_0D::Compute(SMESH_Mesh&, const TopoDS_Shape&)
{
// This algorithm exists in order just to enable assignation of
// StdMeshers_SegmentLengthAroundVertex hypothesis
return true;
}

View File

@ -0,0 +1,50 @@
// SMESH SMESH : implementaion of SMESH idl descriptions
//
// Copyright (C) 2003 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.
//
// 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_SegmentAroundVertex_0D.hxx
// Module : SMESH
#ifndef _SMESH_SegmentAroundVertex_0D_HXX_
#define _SMESH_SegmentAroundVertex_0D_HXX_
#include "SMESH_0D_Algo.hxx"
/*!
* \brief Algorithm existing in order just to enable assignation of
* StdMeshers_SegmentLengthAroundVertex hypothesis
*/
class StdMeshers_SegmentAroundVertex_0D: public SMESH_0D_Algo
{
public:
StdMeshers_SegmentAroundVertex_0D(int hypId, int studyId, SMESH_Gen* gen);
virtual ~StdMeshers_SegmentAroundVertex_0D();
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);
};
#endif

View File

@ -0,0 +1,204 @@
// SMESH SMESH : implementaion of SMESH idl descriptions
//
// Copyright (C) 2003 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.
//
// 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_SegmentLengthAroundVertex.cxx
// Module : SMESH
// $Header$
#include "StdMeshers_SegmentLengthAroundVertex.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_Algo.hxx"
#include "SMDS_MeshNode.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESHDS_SubMesh.hxx"
#include "SMESH_MeshEditor.hxx"
#include "SMESH_MesherHelper.hxx"
#include "utilities.h"
#include <BRepAdaptor_Curve.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
using namespace std;
//=============================================================================
/*!
*
*/
//=============================================================================
StdMeshers_SegmentLengthAroundVertex::StdMeshers_SegmentLengthAroundVertex
(int hypId, int studyId, SMESH_Gen * gen)
:SMESH_Hypothesis(hypId, studyId, gen)
{
_length = 1.;
_name = "SegmentLengthAroundVertex";
_param_algo_dim = 0; // is used by StdMeshers_SegmentAroundVertex_0D
}
//=============================================================================
/*!
*
*/
//=============================================================================
StdMeshers_SegmentLengthAroundVertex::~StdMeshers_SegmentLengthAroundVertex()
{
}
//=============================================================================
/*!
*
*/
//=============================================================================
void StdMeshers_SegmentLengthAroundVertex::SetLength(double length) throw(SALOME_Exception)
{
if (length <= 0)
throw SALOME_Exception(LOCALIZED("length must be positive"));
if (_length != length) {
_length = length;
NotifySubMeshesHypothesisModification();
}
}
//=============================================================================
/*!
*
*/
//=============================================================================
double StdMeshers_SegmentLengthAroundVertex::GetLength() const
{
return _length;
}
//=============================================================================
/*!
*
*/
//=============================================================================
ostream & StdMeshers_SegmentLengthAroundVertex::SaveTo(ostream & save)
{
save << this->_length;
return save;
}
//=============================================================================
/*!
*
*/
//=============================================================================
istream & StdMeshers_SegmentLengthAroundVertex::LoadFrom(istream & load)
{
bool isOK = true;
double a;
isOK = (load >> a);
if (isOK)
this->_length = a;
else
load.clear(ios::badbit | load.rdstate());
return load;
}
//=============================================================================
/*!
*
*/
//=============================================================================
ostream & operator <<(ostream & save, StdMeshers_SegmentLengthAroundVertex & hyp)
{
return hyp.SaveTo( save );
}
//=============================================================================
/*!
*
*/
//=============================================================================
istream & operator >>(istream & load, StdMeshers_SegmentLengthAroundVertex & hyp)
{
return hyp.LoadFrom( load );
}
//================================================================================
/*!
* \brief Initialize segment length by the mesh built on the geometry
* \param theMesh - the built mesh
* \param theShape - the geometry of interest
* \retval bool - true if parameter values have been successfully defined
*/
//================================================================================
bool StdMeshers_SegmentLengthAroundVertex::SetParametersByMesh(const SMESH_Mesh* theMesh,
const TopoDS_Shape& theShape)
{
if ( !theMesh || theShape.IsNull() || theShape.ShapeType() != TopAbs_VERTEX )
return false;
SMESH_MeshEditor editor( const_cast<SMESH_Mesh*>( theMesh ) );
SMESH_MesherHelper helper( *editor.GetMesh() );
// get node built on theShape vertex
SMESHDS_Mesh* meshDS = editor.GetMeshDS();
SMESHDS_SubMesh* smV = meshDS->MeshElements( theShape );
if ( !smV || smV->NbNodes() == 0 )
return false;
const SMDS_MeshNode* vNode = smV->GetNodes()->next();
// calculate average length of segments sharing vNode
_length = 0.;
int nbSegs = 0;
SMDS_ElemIteratorPtr segIt = vNode->GetInverseElementIterator(SMDSAbs_Edge);
while ( segIt->more() ) {
const SMDS_MeshElement* seg = segIt->next();
// get geom edge
int shapeID = editor.FindShape( seg );
if (!shapeID) continue;
const TopoDS_Shape& s = meshDS->IndexToShape( shapeID );
if ( s.IsNull() || s.ShapeType() != TopAbs_EDGE ) continue;
const TopoDS_Edge& edge = TopoDS::Edge( s );
// params of edge ends
double u0 = helper.GetNodeU( edge, seg->GetNode(0) );
double u1 = helper.GetNodeU( edge, seg->GetNode(1) );
// length
BRepAdaptor_Curve AdaptCurve( edge );
_length += GCPnts_AbscissaPoint::Length( AdaptCurve, u0, u1);
nbSegs++;
}
if ( nbSegs > 1 )
_length /= nbSegs;
return nbSegs;
}

View File

@ -0,0 +1,66 @@
// SMESH SMESH : implementaion of SMESH idl descriptions
//
// Copyright (C) 2003 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.
//
// 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_SegmentLengthAroundVertex.hxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
#ifndef _SMESH_SegmentLengthAroundVertex_HXX_
#define _SMESH_SegmentLengthAroundVertex_HXX_
#include "SMESH_Hypothesis.hxx"
#include "Utils_SALOME_Exception.hxx"
/*!
* \brief This hypothesis specifies length of segments adjacent to the vertex the
* hypothesis is assigned to
*/
class StdMeshers_SegmentLengthAroundVertex:public SMESH_Hypothesis
{
public:
StdMeshers_SegmentLengthAroundVertex(int hypId, int studyId, SMESH_Gen * gen);
virtual ~ StdMeshers_SegmentLengthAroundVertex();
void SetLength(double length) throw(SALOME_Exception);
double GetLength() const;
virtual std::ostream & SaveTo(std::ostream & save);
virtual std::istream & LoadFrom(std::istream & load);
friend std::ostream & operator <<(std::ostream & save, StdMeshers_SegmentLengthAroundVertex & hyp);
friend std::istream & operator >>(std::istream & load, StdMeshers_SegmentLengthAroundVertex & hyp);
/*!
* \brief Initialize segment length by the mesh built on the geometry
* \param theMesh - the built mesh
* \param theShape - the geometry of interest
* \retval bool - true if parameter values have been successfully defined
*/
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
protected:
double _length;
};
#endif

View File

@ -172,6 +172,8 @@ void StdMeshersGUI_StdHypothesisCreator::retrieveParams() const
}
}
namespace {
//================================================================================
/*!
* \brief Widget: slider with left and right labels
@ -201,8 +203,6 @@ private:
QSlider * _slider;
};
namespace {
//================================================================================
/*!
* \brief Retrieve GEOM_Object held by widget
@ -381,6 +381,13 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
h->SetLength( params[0].myValue.toDouble() );
}
else if( hypType()=="SegmentLengthAroundVertex" )
{
StdMeshers::StdMeshers_SegmentLengthAroundVertex_var h =
StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hypothesis() );
h->SetLength( params[0].myValue.toDouble() );
}
else if( hypType()=="Arithmetic1D" )
{
StdMeshers::StdMeshers_Arithmetic1D_var h =
@ -521,6 +528,15 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
item.myValue = h->GetLength();
p.append( item );
}
else if( hypType()=="SegmentLengthAroundVertex" )
{
StdMeshers::StdMeshers_SegmentLengthAroundVertex_var h =
StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hyp );
item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
item.myValue = h->GetLength();
p.append( item );
}
else if( hypType()=="Arithmetic1D" )
{
StdMeshers::StdMeshers_Arithmetic1D_var h =
@ -777,6 +793,7 @@ QString StdMeshersGUI_StdHypothesisCreator::hypTypeName( const QString& t ) cons
types.insert( "ProjectionSource3D", "PROJECTION_SOURCE_3D" );
types.insert( "NumberOfLayers", "NUMBER_OF_LAYERS" );
types.insert( "LayerDistribution", "LAYER_DISTRIBUTION" );
types.insert( "SegmentLengthAroundVertex", "SEGMENT_LENGTH_AROUND_VERTEX" );
}
QString res;

View File

@ -41,6 +41,9 @@ msgstr "select1.png"
msgid "ICON_DLG_LOCAL_LENGTH"
msgstr "mesh_hypo_length.png"
msgid "ICON_DLG_SEGMENT_LENGTH_AROUND_VERTEX"
msgstr "mesh_hypo_length.png"
msgid "ICON_DLG_NB_SEGMENTS"
msgstr "mesh_hypo_segment.png"
@ -88,6 +91,9 @@ msgstr "mesh_hypo_source_3d.png"
msgid "ICON_SMESH_TREE_ALGO_Regular_1D"
msgstr "mesh_tree_algo_regular.png"
msgid "ICON_SMESH_TREE_ALGO_CompositeSegment_1D"
msgstr "mesh_tree_algo_regular.png"
msgid "ICON_SMESH_TREE_ALGO_Hexa_3D"
msgstr "mesh_tree_algo_hexa.png"
@ -166,3 +172,9 @@ msgstr "mesh_tree_hypo_source_face.png"
msgid "ICON_SMESH_TREE_HYPO_ProjectionSource3D"
msgstr "mesh_tree_hypo_source_3d_shape.png"
msgid "ICON_SMESH_TREE_ALGO_SegmentAroundVertex_0D"
msgstr "mesh_tree_algo_regular.png"
msgid "ICON_SMESH_TREE_HYPO_SegmentLengthAroundVertex"
msgstr "mesh_tree_hypo_length.png"

View File

@ -256,3 +256,15 @@ msgstr "Create"
msgid "StdMeshersGUI_LayerDistributionParamWdg::EDIT"
msgstr "Edit"
# -------------- Segment Length Around Vertex --------------
msgid "SMESH_SEGMENT_LENGTH_AROUND_VERTEX_HYPOTHESIS"
msgstr "Segment Length Around Vertex"
msgid "SMESH_SEGMENT_LENGTH_AROUND_VERTEX_PARAM"
msgstr "Length"
msgid "SMESH_SEGMENT_LENGTH_AROUND_VERTEX_TITLE"
msgstr "Hypothesis Construction"

View File

@ -61,7 +61,8 @@ EXPORT_HEADERS = \
StdMeshers_ProjectionSource3D_i.hxx \
StdMeshers_Projection_1D_2D_3D_i.hxx \
StdMeshers_ObjRefUlils.hxx \
StdMeshers_LayerDistribution_i.hxx
StdMeshers_LayerDistribution_i.hxx \
StdMeshers_CompositeSegment_1D_i.hxx
# Libraries targets
@ -93,7 +94,10 @@ LIB_SRC = \
StdMeshers_ProjectionSource3D_i.cxx \
StdMeshers_Projection_1D_2D_3D_i.cxx \
StdMeshers_ObjRefUlils.cxx \
StdMeshers_LayerDistribution_i.cxx
StdMeshers_LayerDistribution_i.cxx \
StdMeshers_SegmentAroundVertex_0D_i.cxx \
StdMeshers_SegmentLengthAroundVertex_i.cxx \
StdMeshers_CompositeSegment_1D_i.cxx
LIB_SERVER_IDL = SMESH_BasicHypothesis.idl

View File

@ -0,0 +1,85 @@
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
//
// Copyright (C) 2003 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.
//
// 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_CompositeSegment_1D_i.cxx
// Module : SMESH
// $Header$
#include "StdMeshers_CompositeSegment_1D_i.hxx"
#include "SMESH_Gen.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
using namespace std;
//=============================================================================
/*!
* StdMeshers_CompositeSegment_1D_i::StdMeshers_CompositeSegment_1D_i
*
* Constructor
*/
//=============================================================================
StdMeshers_CompositeSegment_1D_i::StdMeshers_CompositeSegment_1D_i
( PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl )
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA ),
SMESH_Algo_i( thePOA ),
SMESH_1D_Algo_i( thePOA )
{
MESSAGE( "StdMeshers_CompositeSegment_1D_i::StdMeshers_CompositeSegment_1D_i" );
myBaseImpl = new ::StdMeshers_CompositeSegment_1D( theGenImpl->GetANewId(),
theStudyId,
theGenImpl );
}
//=============================================================================
/*!
* StdMeshers_CompositeSegment_1D_i::~StdMeshers_CompositeSegment_1D_i
*
* Destructor
*/
//=============================================================================
StdMeshers_CompositeSegment_1D_i::~StdMeshers_CompositeSegment_1D_i()
{
MESSAGE( "StdMeshers_CompositeSegment_1D_i::~StdMeshers_CompositeSegment_1D_i" );
}
//=============================================================================
/*!
* StdMeshers_CompositeSegment_1D_i::GetImpl
*
* Get implementation
*/
//=============================================================================
::StdMeshers_CompositeSegment_1D* StdMeshers_CompositeSegment_1D_i::GetImpl()
{
MESSAGE( "StdMeshers_CompositeSegment_1D_i::GetImpl" );
return ( ::StdMeshers_CompositeSegment_1D* )myBaseImpl;
}

View File

@ -0,0 +1,56 @@
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
//
// Copyright (C) 2003 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.
//
// 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_CompositeSegment_1D_i.hxx
// Module : SMESH
// $Header$
#ifndef _SMESH_CompositeSegment_1D_I_HXX_
#define _SMESH_CompositeSegment_1D_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include "SMESH_1D_Algo_i.hxx"
#include "StdMeshers_CompositeSegment_1D.hxx"
// ======================================================
// Wire Discretization 1d algorithm
// ======================================================
class StdMeshers_CompositeSegment_1D_i:
public virtual POA_StdMeshers::StdMeshers_CompositeSegment_1D,
public virtual SMESH_1D_Algo_i
{
public:
// Constructor
StdMeshers_CompositeSegment_1D_i( PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl );
// Destructor
virtual ~StdMeshers_CompositeSegment_1D_i();
// Get implementation
::StdMeshers_CompositeSegment_1D* GetImpl();
};
#endif

View File

@ -0,0 +1,71 @@
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
//
// Copyright (C) 2003 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.
//
// 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_Projection_3D_i.cxx
// Moved here from SMESH_Projection_3D_i.cxx
// Author : Paul RASCLE, EDF
// Module : SMESH
// $Header$
#include "StdMeshers_SegmentAroundVertex_0D_i.hxx"
#include "SMESH_Gen.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
using namespace std;
//=============================================================================
/*!
* StdMeshers_SegmentAroundVertex_0D_i::StdMeshers_SegmentAroundVertex_0D_i
*/
//=============================================================================
StdMeshers_SegmentAroundVertex_0D_i::StdMeshers_SegmentAroundVertex_0D_i
( PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl )
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA ),
SMESH_Algo_i( thePOA ),
SMESH_0D_Algo_i( thePOA )
{
MESSAGE( "StdMeshers_SegmentAroundVertex_0D_i::StdMeshers_SegmentAroundVertex_0D_i" );
myBaseImpl = new ::StdMeshers_SegmentAroundVertex_0D( theGenImpl->GetANewId(),
theStudyId,
theGenImpl );
}
//-----------------------------------------------------------------------------
StdMeshers_SegmentAroundVertex_0D_i::~StdMeshers_SegmentAroundVertex_0D_i()
{
MESSAGE( "StdMeshers_SegmentAroundVertex_0D_i::~StdMeshers_SegmentAroundVertex_0D_i" );
}
//-----------------------------------------------------------------------------
::StdMeshers_SegmentAroundVertex_0D* StdMeshers_SegmentAroundVertex_0D_i::GetImpl()
{
MESSAGE( "StdMeshers_SegmentAroundVertex_0D_i::GetImpl" );
return ( ::StdMeshers_SegmentAroundVertex_0D* )myBaseImpl;
}

View File

@ -0,0 +1,57 @@
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
//
// Copyright (C) 2003 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.
//
// 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_SegmentAroundVertex_0D.hxx
// Module : SMESH
// $Header$
#ifndef _SMESH_SegmentAroundVertex_0D_I_HXX_
#define _SMESH_SegmentAroundVertex_0D_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include "SMESH_0D_Algo_i.hxx"
#include "StdMeshers_SegmentAroundVertex_0D.hxx"
class SMESH_Gen;
class StdMeshers_SegmentAroundVertex_0D_i:
public virtual POA_StdMeshers::StdMeshers_SegmentAroundVertex_0D,
public virtual SMESH_0D_Algo_i
{
public:
// Constructor
StdMeshers_SegmentAroundVertex_0D_i( PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl );
// Destructor
virtual ~StdMeshers_SegmentAroundVertex_0D_i();
// Get implementation
::StdMeshers_SegmentAroundVertex_0D* GetImpl();
};
#endif

View File

@ -0,0 +1,140 @@
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
//
// Copyright (C) 2003 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.
//
// 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_SegmentLengthAroundVertex_i.cxx
// Module : SMESH
// $Header$
#include "StdMeshers_SegmentLengthAroundVertex_i.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_PythonDump.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
#include <TCollection_AsciiString.hxx>
using namespace std;
//=============================================================================
/*!
* StdMeshers_SegmentLengthAroundVertex_i::StdMeshers_SegmentLengthAroundVertex_i
*
* Constructor
*/
//=============================================================================
StdMeshers_SegmentLengthAroundVertex_i::StdMeshers_SegmentLengthAroundVertex_i
( PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl )
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA )
{
MESSAGE( "StdMeshers_SegmentLengthAroundVertex_i::StdMeshers_SegmentLengthAroundVertex_i" );
myBaseImpl = new ::StdMeshers_SegmentLengthAroundVertex( theGenImpl->GetANewId(),
theStudyId,
theGenImpl );
}
//=============================================================================
/*!
* StdMeshers_SegmentLengthAroundVertex_i::~StdMeshers_SegmentLengthAroundVertex_i
*
* Destructor
*/
//=============================================================================
StdMeshers_SegmentLengthAroundVertex_i::~StdMeshers_SegmentLengthAroundVertex_i()
{
MESSAGE( "StdMeshers_SegmentLengthAroundVertex_i::~StdMeshers_SegmentLengthAroundVertex_i" );
}
//=============================================================================
/*!
* StdMeshers_SegmentLengthAroundVertex_i::SetLength
*
* Set length
*/
//=============================================================================
void StdMeshers_SegmentLengthAroundVertex_i::SetLength( CORBA::Double theLength )
throw ( SALOME::SALOME_Exception )
{
MESSAGE( "StdMeshers_SegmentLengthAroundVertex_i::SetLength" );
ASSERT( myBaseImpl );
try {
this->GetImpl()->SetLength( theLength );
}
catch ( SALOME_Exception& S_ex ) {
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),SALOME::BAD_PARAM );
}
// Update Python script
SMESH::TPythonDump() << _this() << ".SetLength( " << theLength << " )";
}
//=============================================================================
/*!
* StdMeshers_SegmentLengthAroundVertex_i::GetLength
*
* Get length
*/
//=============================================================================
CORBA::Double StdMeshers_SegmentLengthAroundVertex_i::GetLength()
{
MESSAGE( "StdMeshers_SegmentLengthAroundVertex_i::GetLength" );
ASSERT( myBaseImpl );
return this->GetImpl()->GetLength();
}
//=============================================================================
/*!
* StdMeshers_SegmentLengthAroundVertex_i::GetImpl
*
* Get implementation
*/
//=============================================================================
::StdMeshers_SegmentLengthAroundVertex* StdMeshers_SegmentLengthAroundVertex_i::GetImpl()
{
MESSAGE( "StdMeshers_SegmentLengthAroundVertex_i::GetImpl" );
return ( ::StdMeshers_SegmentLengthAroundVertex* )myBaseImpl;
}
//================================================================================
/*!
* \brief Verify whether hypothesis supports given entity type
* \param type - dimension (see SMESH::Dimension enumeration)
* \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
*
* Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
*/
//================================================================================
CORBA::Boolean StdMeshers_SegmentLengthAroundVertex_i::IsDimSupported( SMESH::Dimension type )
{
return type == SMESH::DIM_1D;
}

View File

@ -0,0 +1,70 @@
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
//
// Copyright (C) 2003 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.
//
// 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_SegmentLengthAroundVertex_i.hxx
// Module : SMESH
// $Header$
#ifndef _SMESH_SegmentLengthAroundVertex_I_HXX_
#define _SMESH_SegmentLengthAroundVertex_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include "SMESH_Hypothesis_i.hxx"
#include "StdMeshers_SegmentLengthAroundVertex.hxx"
class SMESH_Gen;
/*!
* \brief This hypothesis specifies length of segments adjacent to the vertex the
* hypothesis is assigned to
*/
class StdMeshers_SegmentLengthAroundVertex_i:
public virtual POA_StdMeshers::StdMeshers_SegmentLengthAroundVertex,
public virtual SMESH_Hypothesis_i
{
public:
// Constructor
StdMeshers_SegmentLengthAroundVertex_i( PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl );
// Destructor
virtual ~StdMeshers_SegmentLengthAroundVertex_i();
// Set length
void SetLength( CORBA::Double theLength )
throw ( SALOME::SALOME_Exception );
// Get length
CORBA::Double GetLength();
// Get implementation
::StdMeshers_SegmentLengthAroundVertex* GetImpl();
// Verify whether hypothesis supports given entity type
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
};
#endif

View File

@ -43,20 +43,21 @@ using namespace std;
#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_SegmentLengthAroundVertex_i.hxx"
#include "StdMeshers_Regular_1D_i.hxx"
#include "StdMeshers_MEFISTO_2D_i.hxx"
#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"
template <class T> class StdHypothesisCreator_i:public HypothesisCreator_i<T>
@ -116,6 +117,8 @@ extern "C"
aCreator = new StdHypothesisCreator_i<StdMeshers_NumberOfLayers_i>;
else if (strcmp(aHypName, "LayerDistribution") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_LayerDistribution_i>;
else if (strcmp(aHypName, "SegmentLengthAroundVertex") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_SegmentLengthAroundVertex_i>;
// Algorithms
else if (strcmp(aHypName, "Regular_1D") == 0)
@ -136,6 +139,10 @@ extern "C"
aCreator = new StdHypothesisCreator_i<StdMeshers_Prism_3D_i>;
else if (strcmp(aHypName, "RadialPrism_3D") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_RadialPrism_3D_i>;
else if (strcmp(aHypName, "SegmentAroundVertex_0D") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_SegmentAroundVertex_0D_i>;
else if (strcmp(aHypName, "CompositeSegment_1D") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_CompositeSegment_1D_i>;
else ;
return aCreator;