IPAL52980: Wire Discretization with Table density fails

fix this problem for all 1D hypotheses (StdMeshers_Regular_1D.cxx)
  Bug report: http://www.salome-platform.org/forum/forum_10/636759606

Fix compilation warnings:
  - unused function
  - missing virtual destructor
  - variable set but not used
This commit is contained in:
eap 2016-06-10 20:47:53 +03:00
parent 8d3d2084b7
commit ef3921b2af
24 changed files with 292 additions and 302 deletions

View File

@ -106,7 +106,8 @@ computations.
either should be or should not be constructed, depending on the either should be or should not be constructed, depending on the
value of the previous parameter (<b>Specified Faces/Edges are</b>). value of the previous parameter (<b>Specified Faces/Edges are</b>).
Faces (or edges) can be selected either in the Object Browser or in Faces (or edges) can be selected either in the Object Browser or in
the VTK Viewer. the VTK Viewer. \b Add button becomes active as soon as a suitable
sub-shape is selected.
\note A mesh shown in the 3D Viewer can prevent selection of faces \note A mesh shown in the 3D Viewer can prevent selection of faces
and edges, just hide the mesh to avoid this. If a face, which should be and edges, just hide the mesh to avoid this. If a face, which should be
selected, is hidden by other faces, consider creating a selected, is hidden by other faces, consider creating a

View File

@ -44,22 +44,6 @@
using namespace std; using namespace std;
using namespace UNV; using namespace UNV;
namespace{
typedef std::vector<size_t> TConnect;
int GetConnect(const SMDS_ElemIteratorPtr& theNodesIter,
TConnect& theConnect)
{
theConnect.clear();
for(; theNodesIter->more();){
const SMDS_MeshElement* anElem = theNodesIter->next();
theConnect.push_back(anElem->GetID());
}
return theConnect.size();
}
}
Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform() Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
{ {
Kernel_Utils::Localizer loc; Kernel_Utils::Localizer loc;
@ -93,7 +77,6 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
{ {
using namespace UNV2412; using namespace UNV2412;
TDataSet aDataSet2412; TDataSet aDataSet2412;
TConnect aConnect;
// Storing SMDS Edges // Storing SMDS Edges
MESSAGE("Perform - myMesh->NbEdges() = "<<myMesh->NbEdges()); MESSAGE("Perform - myMesh->NbEdges() = "<<myMesh->NbEdges());

View File

@ -57,6 +57,7 @@ class vtkUnstructuredGrid;
class SMESHOBJECT_EXPORT SMESH_VisualObj class SMESHOBJECT_EXPORT SMESH_VisualObj
{ {
public: public:
virtual ~SMESH_VisualObj() {}
virtual bool Update( int theIsClear = true ) = 0; virtual bool Update( int theIsClear = true ) = 0;
virtual bool NulData() = 0; virtual bool NulData() = 0;
virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0; virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0;

View File

@ -41,7 +41,7 @@ class SMESHOBJECT_EXPORT SMESH_PreviewActorsCollection
{ {
public: public:
SMESH_PreviewActorsCollection(); SMESH_PreviewActorsCollection();
~SMESH_PreviewActorsCollection(); virtual ~SMESH_PreviewActorsCollection();
virtual void AddToRender (vtkRenderer* theRenderer); virtual void AddToRender (vtkRenderer* theRenderer);
virtual void RemoveFromRender(vtkRenderer* theRenderer); virtual void RemoveFromRender(vtkRenderer* theRenderer);

View File

@ -90,7 +90,7 @@ public:
static int getCellDimension(unsigned char cellType); static int getCellDimension(unsigned char cellType);
protected: protected:
SMDS_Downward(SMDS_UnstructuredGrid *grid, int nbDownCells); SMDS_Downward(SMDS_UnstructuredGrid *grid, int nbDownCells);
~SMDS_Downward(); virtual ~SMDS_Downward();
int addCell(int vtkId = -1); int addCell(int vtkId = -1);
virtual void initCell(int cellId); virtual void initCell(int cellId);
virtual void allocate(int nbElems) = 0; virtual void allocate(int nbElems) = 0;

View File

@ -10751,8 +10751,7 @@ bool SMESH_MeshEditor::AffectedElemGroupsInRegion( const TIDSortedElemSet& theEl
// --- iterates on elements to be replicated and get elements by back references from their nodes // --- iterates on elements to be replicated and get elements by back references from their nodes
TIDSortedElemSet::const_iterator elemItr = theElems.begin(); TIDSortedElemSet::const_iterator elemItr = theElems.begin();
int ielem; for ( ; elemItr != theElems.end(); ++elemItr )
for ( ielem=1; elemItr != theElems.end(); ++elemItr )
{ {
SMDS_MeshElement* anElem = (SMDS_MeshElement*)*elemItr; SMDS_MeshElement* anElem = (SMDS_MeshElement*)*elemItr;
if (!anElem || (anElem->GetType() != SMDSAbs_Face)) if (!anElem || (anElem->GetType() != SMDSAbs_Face))
@ -10848,8 +10847,7 @@ bool SMESH_MeshEditor::AffectedElemGroupsInRegion( const TIDSortedElemSet& theEl
// iterates on indicated elements and get elements by back references from their nodes // iterates on indicated elements and get elements by back references from their nodes
TIDSortedElemSet::const_iterator elemItr = theElems.begin(); TIDSortedElemSet::const_iterator elemItr = theElems.begin();
int ielem; for ( ; elemItr != theElems.end(); ++elemItr )
for ( ielem = 1; elemItr != theElems.end(); ++elemItr )
{ {
SMDS_MeshElement* anElem = (SMDS_MeshElement*)*elemItr; SMDS_MeshElement* anElem = (SMDS_MeshElement*)*elemItr;
if (!anElem) if (!anElem)

View File

@ -4776,7 +4776,8 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
} }
// fix nodes on geom faces // fix nodes on geom faces
#ifdef _DEBUG_ #ifdef _DEBUG_
int nbfaces = faces.Extent(); /*avoid "unused varianbles": */ nbfaces++, nbfaces--; int nbfaces = nbSolids;
nbfaces = faces.Extent(); /*avoid "unused varianbles": */ nbfaces++, nbfaces--;
#endif #endif
for ( TopTools_MapIteratorOfMapOfShape fIt( faces ); fIt.More(); fIt.Next() ) { for ( TopTools_MapIteratorOfMapOfShape fIt( faces ); fIt.More(); fIt.Next() ) {
MSG("FIX FACE " << nbfaces-- << " #" << GetMeshDS()->ShapeToIndex(fIt.Key())); MSG("FIX FACE " << nbfaces-- << " #" << GetMeshDS()->ShapeToIndex(fIt.Key()));
@ -5117,6 +5118,7 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
"uv2: "<<uv2.X()<<", "<<uv2.Y()<<" \t" << "uv2: "<<uv2.X()<<", "<<uv2.Y()<<" \t" <<
"uvOld: "<<oldUV.X()<<", "<<oldUV.Y()<<" \t" << "uvOld: "<<oldUV.X()<<", "<<oldUV.Y()<<" \t" <<
"newUV: "<<newUV.X()<<", "<<newUV.Y()<<" \t"); "newUV: "<<newUV.X()<<", "<<newUV.Y()<<" \t");
uv0.SetX( uv2.X() ); // avoid warning: variable set but not used
} }
#endif #endif
(*link1)->Move( move, /*sum=*/false, /*is2dFixed=*/true ); (*link1)->Move( move, /*sum=*/false, /*is2dFixed=*/true );
@ -5135,7 +5137,6 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
// ------------- // -------------
TIDSortedElemSet biQuadQuas, biQuadTris, triQuadHexa; TIDSortedElemSet biQuadQuas, biQuadTris, triQuadHexa;
const SMDS_MeshElement *biQuadQua, *triQuadHex;
const bool toFixCentralNodes = ( myMesh->NbBiQuadQuadrangles() + const bool toFixCentralNodes = ( myMesh->NbBiQuadQuadrangles() +
myMesh->NbBiQuadTriangles() + myMesh->NbBiQuadTriangles() +
myMesh->NbTriQuadraticHexas() ); myMesh->NbTriQuadraticHexas() );
@ -5166,7 +5167,6 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
// collect bi-quadratic elements // collect bi-quadratic elements
if ( toFixCentralNodes ) if ( toFixCentralNodes )
{ {
biQuadQua = triQuadHex = 0;
SMDS_ElemIteratorPtr eIt = pLink->_mediumNode->GetInverseElementIterator(); SMDS_ElemIteratorPtr eIt = pLink->_mediumNode->GetInverseElementIterator();
while ( eIt->more() ) while ( eIt->more() )
{ {
@ -5325,6 +5325,10 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
nCenterCoords.X(), nCenterCoords.Y(), nCenterCoords.Z()); nCenterCoords.X(), nCenterCoords.Y(), nCenterCoords.Z());
} }
} }
#ifdef _DEBUG_
// avoid warning: defined but not used operator<<()
SMESH_Comment() << *links.begin() << *faces.begin();
#endif
} }
//================================================================================ //================================================================================

View File

@ -53,7 +53,7 @@ namespace SMESH{
class SMESHCONTROLS_EXPORT Functor class SMESHCONTROLS_EXPORT Functor
{ {
public: public:
~Functor(){} virtual ~Functor(){}
virtual void SetMesh( const SMDS_Mesh* theMesh ) = 0; virtual void SetMesh( const SMDS_Mesh* theMesh ) = 0;
virtual SMDSAbs_ElementType GetType() const = 0; virtual SMDSAbs_ElementType GetType() const = 0;
}; };

View File

@ -587,7 +587,7 @@ namespace
}; };
// is typeMsg complete? (compilation failure mains that enum SMDSAbs_EntityType changed) // is typeMsg complete? (compilation failure mains that enum SMDSAbs_EntityType changed)
const int nbTypes = sizeof( typeMsg ) / sizeof( const char* ); const int nbTypes = sizeof( typeMsg ) / sizeof( const char* );
int _assert[( nbTypes == SMESH::Entity_Last ) ? 1 : -1 ]; _assert[0]=1; int _assert[( nbTypes == SMESH::Entity_Last ) ? 2 : -1 ]; _assert[0]=_assert[1];
QString andStr = " " + QObject::tr("SMESH_AND") + " ", comma(", "); QString andStr = " " + QObject::tr("SMESH_AND") + " ", comma(", ");
for ( size_t iType = 0; iType < presentNotSupported.size(); ++iType ) { for ( size_t iType = 0; iType < presentNotSupported.size(); ++iType ) {
@ -1721,25 +1721,25 @@ namespace
} }
QString CheckHomogeneousSelection() // QString CheckHomogeneousSelection()
{ // {
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr(); // LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected; // SALOME_ListIO selected;
if ( aSel ) // if ( aSel )
aSel->selectedObjects( selected ); // aSel->selectedObjects( selected );
QString RefType = CheckTypeObject(selected.First()); // QString RefType = CheckTypeObject(selected.First());
SALOME_ListIteratorOfListIO It(selected); // SALOME_ListIteratorOfListIO It(selected);
for ( ; It.More(); It.Next()) // for ( ; It.More(); It.Next())
{ // {
Handle(SALOME_InteractiveObject) IObject = It.Value(); // Handle(SALOME_InteractiveObject) IObject = It.Value();
QString Type = CheckTypeObject(IObject); // QString Type = CheckTypeObject(IObject);
if ( Type.compare(RefType) != 0 ) // if ( Type.compare(RefType) != 0 )
return "Heterogeneous Selection"; // return "Heterogeneous Selection";
} // }
return RefType; // return RefType;
} // }
uint randomize( uint size ) uint randomize( uint size )
{ {

View File

@ -68,6 +68,8 @@ public :
operator char*() const { operator char*() const {
return (char*)c_str(); return (char*)c_str();
} }
std::ostream& Stream() { return _s; }
}; };

View File

@ -220,9 +220,9 @@ namespace
} }
} }
#else #else
void inSegmentsToFile( vector< InSegment>& inSegments) {} #define inSegmentsToFile(arg) {}
void dumpEdge( const TVDEdge* edge ) {} //void dumpEdge( const TVDEdge* edge ) {}
void dumpCell( const TVDCell* cell ) {} //void dumpCell( const TVDCell* cell ) {}
#endif #endif
} }
// ------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------

View File

@ -58,6 +58,7 @@ struct SMESHUtils_EXPORT SMESH_NodeSearcher
virtual int FindNearPoint(const gp_Pnt& point, virtual int FindNearPoint(const gp_Pnt& point,
const double tolerance, const double tolerance,
std::vector< const SMDS_MeshNode* >& foundNodes) = 0; std::vector< const SMDS_MeshNode* >& foundNodes) = 0;
virtual ~SMESH_NodeSearcher() {}
}; };
//======================================================================= //=======================================================================

View File

@ -903,7 +903,7 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
Threshold = SMESH + types[ iGeom ]; Threshold = SMESH + types[ iGeom ];
#ifdef _DEBUG_ #ifdef _DEBUG_
// is types complete? (compilation failure mains that enum GeometryType changed) // is types complete? (compilation failure mains that enum GeometryType changed)
int _assert[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 1 : -1 ]; _assert[0]=1; int _asrt[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 2 : -1 ]; _asrt[0]=_asrt[1];
#endif #endif
} }
if (Type == "SMESH.FT_EntityType") if (Type == "SMESH.FT_EntityType")
@ -922,8 +922,8 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
if ( -1 < iGeom && iGeom < nbTypes ) if ( -1 < iGeom && iGeom < nbTypes )
Threshold = SMESH + types[ iGeom ]; Threshold = SMESH + types[ iGeom ];
#ifdef _DEBUG_ #ifdef _DEBUG_
// is types complete? (compilation failure mains that enum EntityType changed) // is 'types' complete? (compilation failure mains that enum EntityType changed)
int _assert[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 1 : -1 ]; _assert[0]=1; int _asrt[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 2 : -1 ]; _asrt[0]=_asrt[1];
#endif #endif
} }
} }

View File

@ -4082,7 +4082,7 @@ static const char** getFunctNames()
#ifdef _DEBUG_ #ifdef _DEBUG_
// check if functName is complete, compilation failure means that enum FunctorType changed // check if functName is complete, compilation failure means that enum FunctorType changed
const int nbFunctors = sizeof(functName) / sizeof(const char*); const int nbFunctors = sizeof(functName) / sizeof(const char*);
int _assert[( nbFunctors == SMESH::FT_Undefined + 1 ) ? 1 : -1 ]; _assert[0]=1; int _assert[( nbFunctors == SMESH::FT_Undefined + 1 ) ? 2 : -1 ]; _assert[0]=_assert[1];
#endif #endif
return functName; return functName;

View File

@ -2543,9 +2543,9 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::ListOfIDSources& theMeshesArray,
// make a group name // make a group name
const char* typeNames[] = { "All","Nodes","Edges","Faces","Volumes","0DElems","Balls" }; const char* typeNames[] = { "All","Nodes","Edges","Faces","Volumes","0DElems","Balls" };
{ // check of typeNames, compilation failure mains that NB_ELEMENT_TYPES changed: { // check of typeNames: compilation failure mains that NB_ELEMENT_TYPES changed:
const int nbNames = sizeof(typeNames) / sizeof(const char*); const int nbNames = sizeof(typeNames) / sizeof(const char*);
int _assert[( nbNames == SMESH::NB_ELEMENT_TYPES ) ? 1 : -1 ]; _assert[0]=0; int _assert[( nbNames == SMESH::NB_ELEMENT_TYPES ) ? 2 : -1 ]; _assert[0]=_assert[1];
} }
string groupName = "Gr"; string groupName = "Gr";
SALOMEDS::SObject_wrap aMeshSObj = ObjectToSObject( myCurrentStudy, theMeshesArray[i] ); SALOMEDS::SObject_wrap aMeshSObj = ObjectToSObject( myCurrentStudy, theMeshesArray[i] );

View File

@ -135,6 +135,8 @@ public:
virtual SMESH_Hypothesis_i* Create(PortableServer::POA_ptr thePOA, virtual SMESH_Hypothesis_i* Create(PortableServer::POA_ptr thePOA,
int theStudyId, int theStudyId,
::SMESH_Gen* theGenImpl) = 0; ::SMESH_Gen* theGenImpl) = 0;
virtual ~GenericHypothesisCreator_i() {}
// return the name of IDL module // return the name of IDL module
virtual std::string GetModuleName() = 0; virtual std::string GetModuleName() = 0;
virtual bool IsApplicable( const TopoDS_Shape &S, bool toCheckAll ) {return true;} virtual bool IsApplicable( const TopoDS_Shape &S, bool toCheckAll ) {return true;}

View File

@ -3056,7 +3056,7 @@ namespace
// sort nodes accoring to the order of edges // sort nodes accoring to the order of edges
_Node* orderNodes [20]; _Node* orderNodes [20];
TGeomID orderShapeIDs[20]; //TGeomID orderShapeIDs[20];
size_t nbN = 0; size_t nbN = 0;
TGeomID id, *pID = 0; TGeomID id, *pID = 0;
for ( e = edges.begin(); e != edges.end(); ++e ) for ( e = edges.begin(); e != edges.end(); ++e )
@ -3064,14 +3064,14 @@ namespace
if (( id = _grid->_shapes.FindIndex( SMESH_MesherHelper::IthVertex( 0, *e ))) && if (( id = _grid->_shapes.FindIndex( SMESH_MesherHelper::IthVertex( 0, *e ))) &&
(( pID = std::find( &nShapeIds[0], nShapeIdsEnd, id )) != nShapeIdsEnd )) (( pID = std::find( &nShapeIds[0], nShapeIdsEnd, id )) != nShapeIdsEnd ))
{ {
orderShapeIDs[ nbN ] = id; //orderShapeIDs[ nbN ] = id;
orderNodes [ nbN++ ] = nodes[ pID - &nShapeIds[0] ]; orderNodes [ nbN++ ] = nodes[ pID - &nShapeIds[0] ];
*pID = -1; *pID = -1;
} }
if (( id = _grid->_shapes.FindIndex( *e )) && if (( id = _grid->_shapes.FindIndex( *e )) &&
(( pID = std::find( &nShapeIds[0], nShapeIdsEnd, id )) != nShapeIdsEnd )) (( pID = std::find( &nShapeIds[0], nShapeIdsEnd, id )) != nShapeIdsEnd ))
{ {
orderShapeIDs[ nbN ] = id; //orderShapeIDs[ nbN ] = id;
orderNodes [ nbN++ ] = nodes[ pID - &nShapeIds[0] ]; orderNodes [ nbN++ ] = nodes[ pID - &nShapeIds[0] ];
*pID = -1; *pID = -1;
} }

View File

@ -561,7 +561,9 @@ StdMeshers_Prism_3D::StdMeshers_Prism_3D(int hypId, int studyId, SMESH_Gen* gen)
//================================================================================ //================================================================================
StdMeshers_Prism_3D::~StdMeshers_Prism_3D() StdMeshers_Prism_3D::~StdMeshers_Prism_3D()
{} {
pointsToPython( std::vector<gp_XYZ>() ); // avoid warning: pointsToPython defined but not used
}
//======================================================================= //=======================================================================
//function : CheckHypothesis //function : CheckHypothesis
@ -2639,19 +2641,19 @@ namespace // utils used by StdMeshers_Prism_3D::IsApplicable()
/*! /*!
* \brief Return number of faces sharing given edges * \brief Return number of faces sharing given edges
*/ */
int nbAdjacentFaces( const std::vector< EdgeWithNeighbors >& edges, // int nbAdjacentFaces( const std::vector< EdgeWithNeighbors >& edges,
const TopTools_IndexedDataMapOfShapeListOfShape& facesOfEdge ) // const TopTools_IndexedDataMapOfShapeListOfShape& facesOfEdge )
{ // {
TopTools_MapOfShape adjFaces; // TopTools_MapOfShape adjFaces;
for ( size_t i = 0; i < edges.size(); ++i ) // for ( size_t i = 0; i < edges.size(); ++i )
{ // {
TopTools_ListIteratorOfListOfShape faceIt( facesOfEdge.FindFromKey( edges[i]._edge )); // TopTools_ListIteratorOfListOfShape faceIt( facesOfEdge.FindFromKey( edges[i]._edge ));
for ( ; faceIt.More(); faceIt.Next() ) // for ( ; faceIt.More(); faceIt.Next() )
adjFaces.Add( faceIt.Value() ); // adjFaces.Add( faceIt.Value() );
} // }
return adjFaces.Extent(); // return adjFaces.Extent();
} // }
} }
//================================================================================ //================================================================================
@ -3016,7 +3018,6 @@ bool StdMeshers_Prism_3D::initPrism(Prism_3D::TPrismTopo& thePrism,
list< SMESH_subMesh* > meshedSubMesh; list< SMESH_subMesh* > meshedSubMesh;
int nbFaces = 0; int nbFaces = 0;
// //
SMESH_subMesh* anyFaceSM = 0;
SMESH_subMeshIteratorPtr smIt = mainSubMesh->getDependsOnIterator(false,true); SMESH_subMeshIteratorPtr smIt = mainSubMesh->getDependsOnIterator(false,true);
while ( smIt->more() ) while ( smIt->more() )
{ {
@ -3025,7 +3026,6 @@ bool StdMeshers_Prism_3D::initPrism(Prism_3D::TPrismTopo& thePrism,
if ( face.ShapeType() > TopAbs_FACE ) break; if ( face.ShapeType() > TopAbs_FACE ) break;
else if ( face.ShapeType() < TopAbs_FACE ) continue; else if ( face.ShapeType() < TopAbs_FACE ) continue;
nbFaces++; nbFaces++;
anyFaceSM = sm;
// is quadrangle FACE? // is quadrangle FACE?
list< TopoDS_Edge > orderedEdges; list< TopoDS_Edge > orderedEdges;

View File

@ -124,6 +124,10 @@ namespace {
const char* type[] ={"COMPOUND","COMPSOLID","SOLID","SHELL","FACE","WIRE","EDGE","VERTEX"}; const char* type[] ={"COMPOUND","COMPSOLID","SOLID","SHELL","FACE","WIRE","EDGE","VERTEX"};
BRepTools::Write( shape, SMESH_Comment("/tmp/") << type[shape.ShapeType()] << "_" BRepTools::Write( shape, SMESH_Comment("/tmp/") << type[shape.ShapeType()] << "_"
<< shape.TShape().operator->() << ".brep"); << shape.TShape().operator->() << ".brep");
if ( !theMeshDS[0] ) {
show_shape( TopoDS_Shape(), "avoid warning: show_shape() defined but not used");
show_list( "avoid warning: show_list() defined but not used", list< TopoDS_Edge >() );
}
#endif #endif
return false; return false;
} }

View File

@ -949,144 +949,144 @@ namespace {
TAssocTool::TNodeNodeMap& src2tgtNodes, TAssocTool::TNodeNodeMap& src2tgtNodes,
const bool is1DComputed) const bool is1DComputed)
{ {
SMESH_Mesh * tgtMesh = tgtWires[0]->GetMesh(); // SMESH_Mesh * tgtMesh = tgtWires[0]->GetMesh();
SMESH_Mesh * srcMesh = srcWires[0]->GetMesh(); // SMESH_Mesh * srcMesh = srcWires[0]->GetMesh();
//SMESHDS_Mesh * tgtMeshDS = tgtMesh->GetMeshDS(); // //SMESHDS_Mesh * tgtMeshDS = tgtMesh->GetMeshDS();
SMESHDS_Mesh * srcMeshDS = srcMesh->GetMeshDS(); // SMESHDS_Mesh * srcMeshDS = srcMesh->GetMeshDS();
if ( srcWires[0]->NbEdges() != 4 ) // if ( srcWires[0]->NbEdges() != 4 )
return false; // return false;
if ( !is1DComputed ) // if ( !is1DComputed )
return false; // return false;
for ( int iE = 0; iE < 4; ++iE ) // for ( int iE = 0; iE < 4; ++iE )
{ // {
SMESHDS_SubMesh* sm = srcMeshDS->MeshElements( srcWires[0]->Edge( iE )); // SMESHDS_SubMesh* sm = srcMeshDS->MeshElements( srcWires[0]->Edge( iE ));
if ( !sm ) return false; // if ( !sm ) return false;
if ( sm->NbNodes() + sm->NbElements() == 0 ) return false; // if ( sm->NbNodes() + sm->NbElements() == 0 ) return false;
} // }
if ( BRepAdaptor_Surface( tgtFace ).GetType() != GeomAbs_Plane ) // if ( BRepAdaptor_Surface( tgtFace ).GetType() != GeomAbs_Plane )
return false; // return false;
// if ( BRepAdaptor_Surface( tgtFace ).GetType() == GeomAbs_Plane && // // if ( BRepAdaptor_Surface( tgtFace ).GetType() == GeomAbs_Plane &&
// BRepAdaptor_Surface( srcFace ).GetType() == GeomAbs_Plane ) // // BRepAdaptor_Surface( srcFace ).GetType() == GeomAbs_Plane )
// return false; // too easy // // return false; // too easy
// load EDGEs to SMESH_Block // // load EDGEs to SMESH_Block
SMESH_Block block; // SMESH_Block block;
TopTools_IndexedMapOfOrientedShape blockSubShapes; // TopTools_IndexedMapOfOrientedShape blockSubShapes;
{ // {
const TopoDS_Solid& box = srcMesh->PseudoShape(); // const TopoDS_Solid& box = srcMesh->PseudoShape();
TopoDS_Shell shell = TopoDS::Shell( TopExp_Explorer( box, TopAbs_SHELL ).Current() ); // TopoDS_Shell shell = TopoDS::Shell( TopExp_Explorer( box, TopAbs_SHELL ).Current() );
TopoDS_Vertex v; // TopoDS_Vertex v;
block.LoadBlockShapes( shell, v, v, blockSubShapes ); // fill all since operator[] is missing // block.LoadBlockShapes( shell, v, v, blockSubShapes ); // fill all since operator[] is missing
} // }
const SMESH_Block::TShapeID srcFaceBID = SMESH_Block::ID_Fxy0; // const SMESH_Block::TShapeID srcFaceBID = SMESH_Block::ID_Fxy0;
const SMESH_Block::TShapeID tgtFaceBID = SMESH_Block::ID_Fxy1; // const SMESH_Block::TShapeID tgtFaceBID = SMESH_Block::ID_Fxy1;
vector< int > edgeBID; // vector< int > edgeBID;
block.GetFaceEdgesIDs( srcFaceBID, edgeBID ); // u0, u1, 0v, 1v // block.GetFaceEdgesIDs( srcFaceBID, edgeBID ); // u0, u1, 0v, 1v
blockSubShapes.Substitute( edgeBID[0], srcWires[0]->Edge(0) ); // blockSubShapes.Substitute( edgeBID[0], srcWires[0]->Edge(0) );
blockSubShapes.Substitute( edgeBID[1], srcWires[0]->Edge(2) ); // blockSubShapes.Substitute( edgeBID[1], srcWires[0]->Edge(2) );
blockSubShapes.Substitute( edgeBID[2], srcWires[0]->Edge(3) ); // blockSubShapes.Substitute( edgeBID[2], srcWires[0]->Edge(3) );
blockSubShapes.Substitute( edgeBID[3], srcWires[0]->Edge(1) ); // blockSubShapes.Substitute( edgeBID[3], srcWires[0]->Edge(1) );
block.GetFaceEdgesIDs( tgtFaceBID, edgeBID ); // u0, u1, 0v, 1v // block.GetFaceEdgesIDs( tgtFaceBID, edgeBID ); // u0, u1, 0v, 1v
blockSubShapes.Substitute( edgeBID[0], tgtWires[0]->Edge(0) ); // blockSubShapes.Substitute( edgeBID[0], tgtWires[0]->Edge(0) );
blockSubShapes.Substitute( edgeBID[1], tgtWires[0]->Edge(2) ); // blockSubShapes.Substitute( edgeBID[1], tgtWires[0]->Edge(2) );
blockSubShapes.Substitute( edgeBID[2], tgtWires[0]->Edge(3) ); // blockSubShapes.Substitute( edgeBID[2], tgtWires[0]->Edge(3) );
blockSubShapes.Substitute( edgeBID[3], tgtWires[0]->Edge(1) ); // blockSubShapes.Substitute( edgeBID[3], tgtWires[0]->Edge(1) );
block.LoadFace( srcFace, srcFaceBID, blockSubShapes ); // block.LoadFace( srcFace, srcFaceBID, blockSubShapes );
block.LoadFace( tgtFace, tgtFaceBID, blockSubShapes ); // block.LoadFace( tgtFace, tgtFaceBID, blockSubShapes );
// remember connectivity of new faces in terms of ( node-or-XY ) // // remember connectivity of new faces in terms of ( node-or-XY )
typedef std::pair< const SMDS_MeshNode*, gp_XYZ > TNodeOrXY; // node-or-XY // typedef std::pair< const SMDS_MeshNode*, gp_XYZ > TNodeOrXY; // node-or-XY
typedef std::vector< TNodeOrXY* > TFaceConn; // face connectivity // typedef std::vector< TNodeOrXY* > TFaceConn; // face connectivity
std::vector< TFaceConn > newFacesVec; // connectivity of all faces // std::vector< TFaceConn > newFacesVec; // connectivity of all faces
std::map< const SMDS_MeshNode*, TNodeOrXY > srcNode2tgtNXY; // src node -> node-or-XY // std::map< const SMDS_MeshNode*, TNodeOrXY > srcNode2tgtNXY; // src node -> node-or-XY
TAssocTool::TNodeNodeMap::iterator srcN_tgtN; // TAssocTool::TNodeNodeMap::iterator srcN_tgtN;
std::map< const SMDS_MeshNode*, TNodeOrXY >::iterator srcN_tgtNXY; // std::map< const SMDS_MeshNode*, TNodeOrXY >::iterator srcN_tgtNXY;
std::pair< std::map< const SMDS_MeshNode*, TNodeOrXY >::iterator, bool > n2n_isNew; // std::pair< std::map< const SMDS_MeshNode*, TNodeOrXY >::iterator, bool > n2n_isNew;
TNodeOrXY nullNXY( (SMDS_MeshNode*)NULL, gp_XYZ(0,0,0) ); // TNodeOrXY nullNXY( (SMDS_MeshNode*)NULL, gp_XYZ(0,0,0) );
SMESHDS_SubMesh* srcSubDS = srcMeshDS->MeshElements( srcFace ); // SMESHDS_SubMesh* srcSubDS = srcMeshDS->MeshElements( srcFace );
newFacesVec.resize( srcSubDS->NbElements() ); // newFacesVec.resize( srcSubDS->NbElements() );
int iFaceSrc = 0; // int iFaceSrc = 0;
SMDS_ElemIteratorPtr elemIt = srcSubDS->GetElements(); // SMDS_ElemIteratorPtr elemIt = srcSubDS->GetElements();
while ( elemIt->more() ) // loop on all mesh faces on srcFace // while ( elemIt->more() ) // loop on all mesh faces on srcFace
{ // {
const SMDS_MeshElement* elem = elemIt->next(); // const SMDS_MeshElement* elem = elemIt->next();
TFaceConn& tgtNodes = newFacesVec[ iFaceSrc++ ]; // TFaceConn& tgtNodes = newFacesVec[ iFaceSrc++ ];
const int nbN = elem->NbCornerNodes(); // const int nbN = elem->NbCornerNodes();
tgtNodes.resize( nbN ); // tgtNodes.resize( nbN );
for ( int i = 0; i < nbN; ++i ) // loop on nodes of the source element // for ( int i = 0; i < nbN; ++i ) // loop on nodes of the source element
{ // {
const SMDS_MeshNode* srcNode = elem->GetNode(i); // const SMDS_MeshNode* srcNode = elem->GetNode(i);
n2n_isNew = srcNode2tgtNXY.insert( make_pair( srcNode, nullNXY )); // n2n_isNew = srcNode2tgtNXY.insert( make_pair( srcNode, nullNXY ));
TNodeOrXY & tgtNodeOrXY = n2n_isNew.first->second; // TNodeOrXY & tgtNodeOrXY = n2n_isNew.first->second;
if ( n2n_isNew.second ) // new src node encounters // if ( n2n_isNew.second ) // new src node encounters
{ // {
srcN_tgtN = src2tgtNodes.find( srcNode ); // srcN_tgtN = src2tgtNodes.find( srcNode );
if ( srcN_tgtN != src2tgtNodes.end() ) // if ( srcN_tgtN != src2tgtNodes.end() )
{ // {
tgtNodeOrXY.first = srcN_tgtN->second; // tgt node exists // tgtNodeOrXY.first = srcN_tgtN->second; // tgt node exists
} // }
else // else
{ // {
// find XY of src node withing the quadrilateral srcFace // // find XY of src node withing the quadrilateral srcFace
if ( !block.ComputeParameters( SMESH_TNodeXYZ( srcNode ), // if ( !block.ComputeParameters( SMESH_TNodeXYZ( srcNode ),
tgtNodeOrXY.second, srcFaceBID )) // tgtNodeOrXY.second, srcFaceBID ))
return false; // return false;
} // }
} // }
tgtNodes[ i ] = & tgtNodeOrXY; // tgtNodes[ i ] = & tgtNodeOrXY;
} // }
} // }
// as all XY are computed, create tgt nodes and faces // // as all XY are computed, create tgt nodes and faces
SMESH_MesherHelper helper( *tgtMesh ); // SMESH_MesherHelper helper( *tgtMesh );
helper.SetSubShape( tgtFace ); // helper.SetSubShape( tgtFace );
if ( is1DComputed ) // if ( is1DComputed )
helper.IsQuadraticSubMesh( tgtFace ); // helper.IsQuadraticSubMesh( tgtFace );
else // else
helper.SetIsQuadratic( srcSubDS->GetElements()->next()->IsQuadratic() ); // helper.SetIsQuadratic( srcSubDS->GetElements()->next()->IsQuadratic() );
helper.SetElementsOnShape( true ); // helper.SetElementsOnShape( true );
Handle(Geom_Surface) tgtSurface = BRep_Tool::Surface( tgtFace ); // Handle(Geom_Surface) tgtSurface = BRep_Tool::Surface( tgtFace );
SMESH_MesherHelper srcHelper( *srcMesh ); // SMESH_MesherHelper srcHelper( *srcMesh );
srcHelper.SetSubShape( srcFace ); // srcHelper.SetSubShape( srcFace );
vector< const SMDS_MeshNode* > tgtNodes; // vector< const SMDS_MeshNode* > tgtNodes;
gp_XY uv; // gp_XY uv;
for ( size_t iFaceTgt = 0; iFaceTgt < newFacesVec.size(); ++iFaceTgt ) // for ( size_t iFaceTgt = 0; iFaceTgt < newFacesVec.size(); ++iFaceTgt )
{ // {
TFaceConn& tgtConn = newFacesVec[ iFaceTgt ]; // TFaceConn& tgtConn = newFacesVec[ iFaceTgt ];
tgtNodes.resize( tgtConn.size() ); // tgtNodes.resize( tgtConn.size() );
for ( size_t iN = 0; iN < tgtConn.size(); ++iN ) // for ( size_t iN = 0; iN < tgtConn.size(); ++iN )
{ // {
const SMDS_MeshNode* & tgtN = tgtConn[ iN ]->first; // const SMDS_MeshNode* & tgtN = tgtConn[ iN ]->first;
if ( !tgtN ) // create a node // if ( !tgtN ) // create a node
{ // {
if ( !block.FaceUV( tgtFaceBID, tgtConn[iN]->second, uv )) // if ( !block.FaceUV( tgtFaceBID, tgtConn[iN]->second, uv ))
return false; // return false;
gp_Pnt p = tgtSurface->Value( uv.X(), uv.Y() ); // gp_Pnt p = tgtSurface->Value( uv.X(), uv.Y() );
tgtN = helper.AddNode( p.X(), p.Y(), p.Z(), uv.X(), uv.Y() ); // tgtN = helper.AddNode( p.X(), p.Y(), p.Z(), uv.X(), uv.Y() );
} // }
tgtNodes[ tgtNodes.size() - iN - 1] = tgtN; // reversed orientation // tgtNodes[ tgtNodes.size() - iN - 1] = tgtN; // reversed orientation
} // }
switch ( tgtNodes.size() ) // switch ( tgtNodes.size() )
{ // {
case 3: helper.AddFace(tgtNodes[0], tgtNodes[1], tgtNodes[2]); break; // case 3: helper.AddFace(tgtNodes[0], tgtNodes[1], tgtNodes[2]); break;
case 4: helper.AddFace(tgtNodes[0], tgtNodes[1], tgtNodes[2], tgtNodes[3]); break; // case 4: helper.AddFace(tgtNodes[0], tgtNodes[1], tgtNodes[2], tgtNodes[3]); break;
default: // default:
if ( tgtNodes.size() > 4 ) // if ( tgtNodes.size() > 4 )
helper.AddPolygonalFace( tgtNodes ); // helper.AddPolygonalFace( tgtNodes );
} // }
} // }
return true; return false; //true;
} // bool projectQuads(...) } // bool projectQuads(...)
@ -1310,8 +1310,9 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
if ( !projDone ) if ( !projDone )
{ {
// projection in case of quadrilateral faces // projection in case of quadrilateral faces
// projDone = projectQuads( tgtFace, srcFace, tgtWires, srcWires, // NOT IMPLEMENTED, returns false
// shape2ShapeMap, _src2tgtNodes, is1DComputed); projDone = projectQuads( tgtFace, srcFace, tgtWires, srcWires,
shape2ShapeMap, _src2tgtNodes, is1DComputed);
} }
// it will remove mesh built on edges and vertices in failure case // it will remove mesh built on edges and vertices in failure case

View File

@ -184,7 +184,7 @@ namespace {
} }
//============================================================================= //=============================================================================
/*! /*!
* \brief return PropagationMgrData found on a submesh * \brief return PropagationMgrData found on a sub-mesh
*/ */
PropagationMgrData* findData(SMESH_subMesh* sm) PropagationMgrData* findData(SMESH_subMesh* sm)
{ {
@ -194,14 +194,14 @@ namespace {
} }
//============================================================================= //=============================================================================
/*! /*!
* \brief return PropagationMgrData found on theEdge submesh * \brief return PropagationMgrData found on theEdge sub-mesh
*/ */
PropagationMgrData* findData(SMESH_Mesh& theMesh, const TopoDS_Shape& theEdge) // PropagationMgrData* findData(SMESH_Mesh& theMesh, const TopoDS_Shape& theEdge)
{ // {
if ( theEdge.ShapeType() == TopAbs_EDGE ) // if ( theEdge.ShapeType() == TopAbs_EDGE )
return findData( theMesh.GetSubMeshContaining( theEdge ) ); // return findData( theMesh.GetSubMeshContaining( theEdge ) );
return 0; // return 0;
} // }
//============================================================================= //=============================================================================
/*! /*!
* \brief return existing or a new PropagationMgrData * \brief return existing or a new PropagationMgrData

View File

@ -415,16 +415,17 @@ static void compensateError(double a1, double an,
if ( a1 + an <= length && nPar > 1 ) if ( a1 + an <= length && nPar > 1 )
{ {
bool reverse = ( U1 > Un ); bool reverse = ( U1 > Un );
GCPnts_AbscissaPoint Discret(C3d, reverse ? an : -an, Un); double tol = Min( Precision::Confusion(), 0.01 * an );
GCPnts_AbscissaPoint Discret( tol, C3d, reverse ? an : -an, Un );
if ( !Discret.IsDone() ) if ( !Discret.IsDone() )
return; return;
double Utgt = Discret.Parameter(); // target value of the last parameter double Utgt = Discret.Parameter(); // target value of the last parameter
list<double>::reverse_iterator itU = theParams.rbegin(); list<double>::reverse_iterator itU = theParams.rbegin();
double Ul = *itU++; // real value of the last parameter double Ul = *itU++; // real value of the last parameter
double dUn = Utgt - Ul; // parametric error of <an> double dUn = Utgt - Ul; // parametric error of <an>
if ( Abs(dUn) <= Precision::Confusion() )
return;
double dU = Abs( Ul - *itU ); // parametric length of the last but one segment double dU = Abs( Ul - *itU ); // parametric length of the last but one segment
if ( Abs(dUn) <= 1e-3 * dU )
return;
if ( adjustNeighbors2an || Abs(dUn) < 0.5 * dU ) { // last segment is a bit shorter than it should if ( adjustNeighbors2an || Abs(dUn) < 0.5 * dU ) { // last segment is a bit shorter than it should
// move the last parameter to the edge beginning // move the last parameter to the edge beginning
} }
@ -595,7 +596,8 @@ void StdMeshers_Regular_1D::redistributeNearVertices (SMESH_Mesh & theM
{ {
if ( !isEnd1 ) if ( !isEnd1 )
vertexLength = -vertexLength; vertexLength = -vertexLength;
GCPnts_AbscissaPoint Discret(theC3d, vertexLength, l); double tol = Min( Precision::Confusion(), 0.01 * vertexLength );
GCPnts_AbscissaPoint Discret( tol, theC3d, vertexLength, l );
if ( Discret.IsDone() ) { if ( Discret.IsDone() ) {
if ( nPar == 0 ) if ( nPar == 0 )
theParameters.push_back( Discret.Parameter()); theParameters.push_back( Discret.Parameter());
@ -705,7 +707,8 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
size_t nbParams = 0; size_t nbParams = 0;
for ( int i = 0, nb = segLen.size()-1; i < nb; ++i, iSeg += dSeg ) for ( int i = 0, nb = segLen.size()-1; i < nb; ++i, iSeg += dSeg )
{ {
GCPnts_AbscissaPoint Discret( theC3d, segLen[ iSeg ], param ); double tol = Min( Precision::Confusion(), 0.01 * segLen[ iSeg ]);
GCPnts_AbscissaPoint Discret( tol, theC3d, segLen[ iSeg ], param );
if ( !Discret.IsDone() ) break; if ( !Discret.IsDone() ) break;
param = Discret.Parameter(); param = Discret.Parameter();
theParams.push_back( param ); theParams.push_back( param );
@ -733,8 +736,8 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
{ {
double nbseg = ceil(theLength / _value[ BEG_LENGTH_IND ]); // integer sup double nbseg = ceil(theLength / _value[ BEG_LENGTH_IND ]); // integer sup
if (nbseg <= 0) if (nbseg <= 0)
nbseg = 1; // degenerated edge nbseg = 1; // degenerated edge
eltSize = theLength / nbseg; eltSize = theLength / nbseg * ( 1. - 1e-9 );
nbSegments = (int) nbseg; nbSegments = (int) nbseg;
} }
else if ( _hypType == LOCAL_LENGTH ) else if ( _hypType == LOCAL_LENGTH )
@ -802,7 +805,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
if ( theReverse ) if ( theReverse )
scale = 1.0 / scale; scale = 1.0 / scale;
double alpha = pow(scale, 1.0 / (nbSegments - 1)); double alpha = pow(scale, 1.0 / (nbSegments - 1));
double factor = (l - f) / (1.0 - pow(alpha, nbSegments)); double factor = (l - f) / (1.0 - pow(alpha, nbSegments));
for (int i = 1; i < nbSegments; i++) { for (int i = 1; i < nbSegments; i++) {
@ -811,10 +814,12 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
} }
} }
const double lenFactor = theLength/(l-f); const double lenFactor = theLength/(l-f);
const double minSegLen = Min( theParams.front() - f, l - theParams.back() );
const double tol = Min( Precision::Confusion(), 0.01 * minSegLen );
list<double>::iterator u = theParams.begin(), uEnd = theParams.end(); list<double>::iterator u = theParams.begin(), uEnd = theParams.end();
for ( ; u != uEnd; ++u ) for ( ; u != uEnd; ++u )
{ {
GCPnts_AbscissaPoint Discret( theC3d, ((*u)-f) * lenFactor, f ); GCPnts_AbscissaPoint Discret( tol, theC3d, ((*u)-f) * lenFactor, f );
if ( Discret.IsDone() ) if ( Discret.IsDone() )
*u = Discret.Parameter(); *u = Discret.Parameter();
} }
@ -844,9 +849,13 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
return false; return false;
} }
} }
GCPnts_UniformAbscissa Discret(theC3d, eltSize, f, l);
double tol = Min( Precision::Confusion(), 0.01 * eltSize );
GCPnts_UniformAbscissa Discret(theC3d, nbSegments + 1, f, l, tol );
if ( !Discret.IsDone() ) if ( !Discret.IsDone() )
return error( "GCPnts_UniformAbscissa failed"); return error( "GCPnts_UniformAbscissa failed");
if ( Discret.NbPoints() < nbSegments + 1 )
Discret.Initialize(theC3d, nbSegments + 2, f, l, tol );
int NbPoints = Min( Discret.NbPoints(), nbSegments + 1 ); int NbPoints = Min( Discret.NbPoints(), nbSegments + 1 );
for ( int i = 2; i < NbPoints; i++ ) // skip 1st and last points for ( int i = 2; i < NbPoints; i++ ) // skip 1st and last points
@ -858,6 +867,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
return true; return true;
} }
case BEG_END_LENGTH: { case BEG_END_LENGTH: {
// geometric progression: SUM(n) = ( a1 - an * q ) / ( 1 - q ) = theLength // geometric progression: SUM(n) = ( a1 - an * q ) / ( 1 - q ) = theLength
@ -869,14 +879,15 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
return error ( SMESH_Comment("Invalid segment lengths (")<<a1<<" and "<<an<<") "<< return error ( SMESH_Comment("Invalid segment lengths (")<<a1<<" and "<<an<<") "<<
"for an edge of length "<<theLength); "for an edge of length "<<theLength);
double U1 = theReverse ? l : f; double U1 = theReverse ? l : f;
double Un = theReverse ? f : l; double Un = theReverse ? f : l;
double param = U1; double param = U1;
double eltSize = theReverse ? -a1 : a1; double eltSize = theReverse ? -a1 : a1;
double tol = Min( Precision::Confusion(), 0.01 * Min( a1, an ));
while ( 1 ) { while ( 1 ) {
// computes a point on a curve <theC3d> at the distance <eltSize> // computes a point on a curve <theC3d> at the distance <eltSize>
// from the point of parameter <param>. // from the point of parameter <param>.
GCPnts_AbscissaPoint Discret( theC3d, eltSize, param ); GCPnts_AbscissaPoint Discret( tol, theC3d, eltSize, param );
if ( !Discret.IsDone() ) break; if ( !Discret.IsDone() ) break;
param = Discret.Parameter(); param = Discret.Parameter();
if ( f < param && param < l ) if ( f < param && param < l )
@ -903,10 +914,11 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
double q = ( an - a1 ) / ( 2 *theLength/( a1 + an ) - 1 ); double q = ( an - a1 ) / ( 2 *theLength/( a1 + an ) - 1 );
int n = int(fabs(q) > numeric_limits<double>::min() ? ( 1+( an-a1 )/q ) : ( 1+theLength/a1 )); int n = int(fabs(q) > numeric_limits<double>::min() ? ( 1+( an-a1 )/q ) : ( 1+theLength/a1 ));
double U1 = theReverse ? l : f; double U1 = theReverse ? l : f;
double Un = theReverse ? f : l; double Un = theReverse ? f : l;
double param = U1; double param = U1;
double eltSize = a1; double eltSize = a1;
double tol = Min( Precision::Confusion(), 0.01 * Min( a1, an ));
if ( theReverse ) { if ( theReverse ) {
eltSize = -eltSize; eltSize = -eltSize;
q = -q; q = -q;
@ -914,7 +926,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
while ( n-- > 0 && eltSize * ( Un - U1 ) > 0 ) { while ( n-- > 0 && eltSize * ( Un - U1 ) > 0 ) {
// computes a point on a curve <theC3d> at the distance <eltSize> // computes a point on a curve <theC3d> at the distance <eltSize>
// from the point of parameter <param>. // from the point of parameter <param>.
GCPnts_AbscissaPoint Discret( theC3d, eltSize, param ); GCPnts_AbscissaPoint Discret( tol, theC3d, eltSize, param );
if ( !Discret.IsDone() ) break; if ( !Discret.IsDone() ) break;
param = Discret.Parameter(); param = Discret.Parameter();
if ( param > f && param < l ) if ( param > f && param < l )
@ -945,7 +957,8 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
while ( true ) { while ( true ) {
// computes a point on a curve <theC3d> at the distance <eltSize> // computes a point on a curve <theC3d> at the distance <eltSize>
// from the point of parameter <param>. // from the point of parameter <param>.
GCPnts_AbscissaPoint Discret( theC3d, eltSize, param ); double tol = Min( Precision::Confusion(), 0.01 * eltSize );
GCPnts_AbscissaPoint Discret( tol, theC3d, eltSize, param );
if ( !Discret.IsDone() ) break; if ( !Discret.IsDone() ) break;
param = Discret.Parameter(); param = Discret.Parameter();
if ( f < param && param < l ) if ( f < param && param < l )
@ -978,95 +991,75 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
{ {
const std::vector<double>& aPnts = _fpHyp->GetPoints(); const std::vector<double>& aPnts = _fpHyp->GetPoints();
const std::vector<int>& nbsegs = _fpHyp->GetNbSegments(); const std::vector<int>& nbsegs = _fpHyp->GetNbSegments();
// sort normalized params, taking into account theReverse
TColStd_SequenceOfReal Params; TColStd_SequenceOfReal Params;
double tol = 1e-7 / theLength; // GCPnts_UniformAbscissa allows u2-u1 > 1e-7
for ( size_t i = 0; i < aPnts.size(); i++ ) for ( size_t i = 0; i < aPnts.size(); i++ )
{ {
if( aPnts[i]<0.0001 || aPnts[i]>0.9999 ) continue; if( aPnts[i] < tol || aPnts[i] > 1 - tol )
int j=1; continue;
double u = theReverse ? ( 1 - aPnts[i] ) : aPnts[i];
int j = 1;
bool IsExist = false; bool IsExist = false;
for ( ; j <= Params.Length(); j++ ) { for ( ; j <= Params.Length(); j++ ) {
if ( Abs( aPnts[i] - Params.Value(j) ) < 1e-4 ) { if ( Abs( u - Params.Value(j) ) < tol ) {
IsExist = true; IsExist = true;
break; break;
} }
if ( aPnts[i]<Params.Value(j) ) break; if ( u < Params.Value(j) ) break;
} }
if ( !IsExist ) Params.InsertBefore( j, aPnts[i] ); if ( !IsExist ) Params.InsertBefore( j, u );
} }
double par2, par1, lp;
par1 = f; // transform normalized Params into real ones
lp = l; std::vector< double > uVec( Params.Length() + 2 );
double sign = 1.0; uVec[ 0 ] = theFirstU;
if ( theReverse ) { double abscissa;
par1 = l; for ( int i = 1; i <= Params.Length(); i++ )
lp = f;
sign = -1.0;
}
double eltSize, segmentSize = 0.;
double currAbscissa = 0;
for ( int i = 0; i < Params.Length(); i++ )
{ {
int nbseg = ( i > (int)nbsegs.size()-1 ) ? nbsegs[0] : nbsegs[i]; abscissa = Params( i ) * theLength;
segmentSize = Params.Value( i+1 ) * theLength - currAbscissa; tol = Min( Precision::Confusion(), 0.01 * abscissa );
currAbscissa += segmentSize; GCPnts_AbscissaPoint APnt( tol, theC3d, abscissa, theFirstU );
GCPnts_AbscissaPoint APnt( theC3d, sign*segmentSize, par1 );
if ( !APnt.IsDone() ) if ( !APnt.IsDone() )
return error( "GCPnts_AbscissaPoint failed"); return error( "GCPnts_AbscissaPoint failed");
par2 = APnt.Parameter(); uVec[ i ] = APnt.Parameter();
eltSize = segmentSize/nbseg; }
GCPnts_UniformAbscissa Discret( theC3d, eltSize, par1, par2 ); uVec.back() = theLastU;
if ( theReverse )
Discret.Initialize( theC3d, eltSize, par2, par1 ); // divide segments
Params.InsertBefore( 1, 0.0 );
Params.Append( 1.0 );
double eltSize, segmentSize, par1, par2;
for ( size_t i = 0; i < uVec.size()-1; i++ )
{
par1 = uVec[ i ];
par2 = uVec[ i+1 ];
int nbseg = ( i < nbsegs.size() ) ? nbsegs[i] : nbsegs[0];
if ( nbseg == 1 )
{
theParams.push_back( par2 );
}
else else
Discret.Initialize( theC3d, eltSize, par1, par2 ); {
if ( !Discret.IsDone() ) segmentSize = ( Params( i+2 ) - Params( i+1 )) * theLength;
return error( "GCPnts_UniformAbscissa failed"); eltSize = segmentSize / nbseg;
int NbPoints = Discret.NbPoints(); tol = Min( Precision::Confusion(), 0.01 * eltSize );
list<double> tmpParams; GCPnts_UniformAbscissa Discret( theC3d, eltSize, par1, par2, tol );
for ( int i = 2; i < NbPoints; i++ ) { if ( !Discret.IsDone() )
double param = Discret.Parameter(i); return error( "GCPnts_UniformAbscissa failed");
tmpParams.push_back( param ); if ( Discret.NbPoints() < nbseg + 1 ) {
eltSize = segmentSize / ( nbseg + 0.5 );
Discret.Initialize( theC3d, eltSize, par1, par2, tol );
}
int NbPoints = Discret.NbPoints();
for ( int i = 2; i <= NbPoints; i++ ) {
double param = Discret.Parameter(i);
theParams.push_back( param );
}
} }
if ( theReverse ) {
compensateError( eltSize, eltSize, par2, par1, segmentSize, theC3d, tmpParams );
tmpParams.reverse();
}
else {
compensateError( eltSize, eltSize, par1, par2, segmentSize, theC3d, tmpParams );
}
theParams.splice( theParams.end(), tmpParams );
theParams.push_back( par2 );
par1 = par2;
} }
// add for last theParams.pop_back();
int nbseg = ( (int)nbsegs.size() > Params.Length() ) ? nbsegs[Params.Length()] : nbsegs[0];
segmentSize = theLength - currAbscissa;
eltSize = segmentSize/nbseg;
GCPnts_UniformAbscissa Discret;
if ( theReverse )
Discret.Initialize( theC3d, eltSize, par1, lp );
else
Discret.Initialize( theC3d, eltSize, lp, par1 );
if ( !Discret.IsDone() )
return error( "GCPnts_UniformAbscissa failed");
int NbPoints = Discret.NbPoints();
list<double> tmpParams;
for ( int i = 2; i < NbPoints; i++ ) {
double param = Discret.Parameter(i);
tmpParams.push_back( param );
}
if ( theReverse ) {
compensateError( eltSize, eltSize, lp, par1, segmentSize, theC3d, tmpParams );
tmpParams.reverse();
}
else {
compensateError( eltSize, eltSize, par1, lp, segmentSize, theC3d, tmpParams );
}
theParams.splice( theParams.end(), tmpParams );
if ( theReverse )
theParams.reverse(); // NPAL18025
return true; return true;
} }

View File

@ -934,7 +934,7 @@ void Maillage::acquisitionTYPE_inputMED(TYPE_MAILLE TYPE, int nTYPE, med_idt fid
void Maillage::outputMED(std::string fichierMED) void Maillage::outputMED(std::string fichierMED)
{ {
// int i, j, k; // int i, j, k;
int nTYPE, tTYPE; int nTYPE;//, tTYPE;
string line, s, stype, nomnoeud; string line, s, stype, nomnoeud;
// med_err ret = 0; // Code retour // med_err ret = 0; // Code retour
// int ig, jg; // int ig, jg;
@ -1457,7 +1457,7 @@ void Maillage::outputMED(std::string fichierMED)
if (EFFECTIFS_TYPES[tm]) if (EFFECTIFS_TYPES[tm])
{ {
nTYPE = EFFECTIFS_TYPES[tm]; nTYPE = EFFECTIFS_TYPES[tm];
tTYPE = Nnoeuds(tm); //tTYPE = Nnoeuds(tm);
MGE = InstanceMGE(tm); MGE = InstanceMGE(tm);
stype = TM2string(tm); stype = TM2string(tm);

View File

@ -100,7 +100,7 @@ bool SPADDERPluginTester_i::testkernel()
beginService("SPADDERPluginTester_i::testplugin"); beginService("SPADDERPluginTester_i::testplugin");
Engines::SalomeLauncher_ptr salomeLauncher = KERNEL::getSalomeLauncher(); Engines::SalomeLauncher_ptr salomeLauncher = KERNEL::getSalomeLauncher();
salomeLauncher = NULL; if ( salomeLauncher ) salomeLauncher = NULL;
endService("SPADDERPluginTester_i::testplugin"); endService("SPADDERPluginTester_i::testplugin");
return true; return true;