mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-03-03 22:25:36 +05:00
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:
parent
8d3d2084b7
commit
ef3921b2af
@ -106,7 +106,8 @@ computations.
|
||||
either should be or should not be constructed, depending on the
|
||||
value of the previous parameter (<b>Specified Faces/Edges are</b>).
|
||||
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
|
||||
and edges, just hide the mesh to avoid this. If a face, which should be
|
||||
selected, is hidden by other faces, consider creating a
|
||||
|
@ -44,22 +44,6 @@
|
||||
using namespace std;
|
||||
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()
|
||||
{
|
||||
Kernel_Utils::Localizer loc;
|
||||
@ -93,7 +77,6 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
|
||||
{
|
||||
using namespace UNV2412;
|
||||
TDataSet aDataSet2412;
|
||||
TConnect aConnect;
|
||||
|
||||
// Storing SMDS Edges
|
||||
MESSAGE("Perform - myMesh->NbEdges() = "<<myMesh->NbEdges());
|
||||
|
@ -57,6 +57,7 @@ class vtkUnstructuredGrid;
|
||||
class SMESHOBJECT_EXPORT SMESH_VisualObj
|
||||
{
|
||||
public:
|
||||
virtual ~SMESH_VisualObj() {}
|
||||
virtual bool Update( int theIsClear = true ) = 0;
|
||||
virtual bool NulData() = 0;
|
||||
virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0;
|
||||
|
@ -41,7 +41,7 @@ class SMESHOBJECT_EXPORT SMESH_PreviewActorsCollection
|
||||
{
|
||||
public:
|
||||
SMESH_PreviewActorsCollection();
|
||||
~SMESH_PreviewActorsCollection();
|
||||
virtual ~SMESH_PreviewActorsCollection();
|
||||
|
||||
virtual void AddToRender (vtkRenderer* theRenderer);
|
||||
virtual void RemoveFromRender(vtkRenderer* theRenderer);
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
static int getCellDimension(unsigned char cellType);
|
||||
protected:
|
||||
SMDS_Downward(SMDS_UnstructuredGrid *grid, int nbDownCells);
|
||||
~SMDS_Downward();
|
||||
virtual ~SMDS_Downward();
|
||||
int addCell(int vtkId = -1);
|
||||
virtual void initCell(int cellId);
|
||||
virtual void allocate(int nbElems) = 0;
|
||||
|
@ -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
|
||||
|
||||
TIDSortedElemSet::const_iterator elemItr = theElems.begin();
|
||||
int ielem;
|
||||
for ( ielem=1; elemItr != theElems.end(); ++elemItr )
|
||||
for ( ; elemItr != theElems.end(); ++elemItr )
|
||||
{
|
||||
SMDS_MeshElement* anElem = (SMDS_MeshElement*)*elemItr;
|
||||
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
|
||||
TIDSortedElemSet::const_iterator elemItr = theElems.begin();
|
||||
int ielem;
|
||||
for ( ielem = 1; elemItr != theElems.end(); ++elemItr )
|
||||
for ( ; elemItr != theElems.end(); ++elemItr )
|
||||
{
|
||||
SMDS_MeshElement* anElem = (SMDS_MeshElement*)*elemItr;
|
||||
if (!anElem)
|
||||
|
@ -4776,7 +4776,8 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
|
||||
}
|
||||
// fix nodes on geom faces
|
||||
#ifdef _DEBUG_
|
||||
int nbfaces = faces.Extent(); /*avoid "unused varianbles": */ nbfaces++, nbfaces--;
|
||||
int nbfaces = nbSolids;
|
||||
nbfaces = faces.Extent(); /*avoid "unused varianbles": */ nbfaces++, nbfaces--;
|
||||
#endif
|
||||
for ( TopTools_MapIteratorOfMapOfShape fIt( faces ); fIt.More(); fIt.Next() ) {
|
||||
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" <<
|
||||
"uvOld: "<<oldUV.X()<<", "<<oldUV.Y()<<" \t" <<
|
||||
"newUV: "<<newUV.X()<<", "<<newUV.Y()<<" \t");
|
||||
uv0.SetX( uv2.X() ); // avoid warning: variable set but not used
|
||||
}
|
||||
#endif
|
||||
(*link1)->Move( move, /*sum=*/false, /*is2dFixed=*/true );
|
||||
@ -5135,7 +5137,6 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
|
||||
// -------------
|
||||
|
||||
TIDSortedElemSet biQuadQuas, biQuadTris, triQuadHexa;
|
||||
const SMDS_MeshElement *biQuadQua, *triQuadHex;
|
||||
const bool toFixCentralNodes = ( myMesh->NbBiQuadQuadrangles() +
|
||||
myMesh->NbBiQuadTriangles() +
|
||||
myMesh->NbTriQuadraticHexas() );
|
||||
@ -5166,7 +5167,6 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
|
||||
// collect bi-quadratic elements
|
||||
if ( toFixCentralNodes )
|
||||
{
|
||||
biQuadQua = triQuadHex = 0;
|
||||
SMDS_ElemIteratorPtr eIt = pLink->_mediumNode->GetInverseElementIterator();
|
||||
while ( eIt->more() )
|
||||
{
|
||||
@ -5325,6 +5325,10 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
|
||||
nCenterCoords.X(), nCenterCoords.Y(), nCenterCoords.Z());
|
||||
}
|
||||
}
|
||||
#ifdef _DEBUG_
|
||||
// avoid warning: defined but not used operator<<()
|
||||
SMESH_Comment() << *links.begin() << *faces.begin();
|
||||
#endif
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
|
@ -53,7 +53,7 @@ namespace SMESH{
|
||||
class SMESHCONTROLS_EXPORT Functor
|
||||
{
|
||||
public:
|
||||
~Functor(){}
|
||||
virtual ~Functor(){}
|
||||
virtual void SetMesh( const SMDS_Mesh* theMesh ) = 0;
|
||||
virtual SMDSAbs_ElementType GetType() const = 0;
|
||||
};
|
||||
|
@ -587,7 +587,7 @@ namespace
|
||||
};
|
||||
// is typeMsg complete? (compilation failure mains that enum SMDSAbs_EntityType changed)
|
||||
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(", ");
|
||||
for ( size_t iType = 0; iType < presentNotSupported.size(); ++iType ) {
|
||||
@ -1721,25 +1721,25 @@ namespace
|
||||
}
|
||||
|
||||
|
||||
QString CheckHomogeneousSelection()
|
||||
{
|
||||
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||
SALOME_ListIO selected;
|
||||
if ( aSel )
|
||||
aSel->selectedObjects( selected );
|
||||
// QString CheckHomogeneousSelection()
|
||||
// {
|
||||
// LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||
// SALOME_ListIO selected;
|
||||
// if ( aSel )
|
||||
// aSel->selectedObjects( selected );
|
||||
|
||||
QString RefType = CheckTypeObject(selected.First());
|
||||
SALOME_ListIteratorOfListIO It(selected);
|
||||
for ( ; It.More(); It.Next())
|
||||
{
|
||||
Handle(SALOME_InteractiveObject) IObject = It.Value();
|
||||
QString Type = CheckTypeObject(IObject);
|
||||
if ( Type.compare(RefType) != 0 )
|
||||
return "Heterogeneous Selection";
|
||||
}
|
||||
// QString RefType = CheckTypeObject(selected.First());
|
||||
// SALOME_ListIteratorOfListIO It(selected);
|
||||
// for ( ; It.More(); It.Next())
|
||||
// {
|
||||
// Handle(SALOME_InteractiveObject) IObject = It.Value();
|
||||
// QString Type = CheckTypeObject(IObject);
|
||||
// if ( Type.compare(RefType) != 0 )
|
||||
// return "Heterogeneous Selection";
|
||||
// }
|
||||
|
||||
return RefType;
|
||||
}
|
||||
// return RefType;
|
||||
// }
|
||||
|
||||
uint randomize( uint size )
|
||||
{
|
||||
|
@ -68,6 +68,8 @@ public :
|
||||
operator char*() const {
|
||||
return (char*)c_str();
|
||||
}
|
||||
|
||||
std::ostream& Stream() { return _s; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -220,9 +220,9 @@ namespace
|
||||
}
|
||||
}
|
||||
#else
|
||||
void inSegmentsToFile( vector< InSegment>& inSegments) {}
|
||||
void dumpEdge( const TVDEdge* edge ) {}
|
||||
void dumpCell( const TVDCell* cell ) {}
|
||||
#define inSegmentsToFile(arg) {}
|
||||
//void dumpEdge( const TVDEdge* edge ) {}
|
||||
//void dumpCell( const TVDCell* cell ) {}
|
||||
#endif
|
||||
}
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
@ -58,6 +58,7 @@ struct SMESHUtils_EXPORT SMESH_NodeSearcher
|
||||
virtual int FindNearPoint(const gp_Pnt& point,
|
||||
const double tolerance,
|
||||
std::vector< const SMDS_MeshNode* >& foundNodes) = 0;
|
||||
virtual ~SMESH_NodeSearcher() {}
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
|
@ -903,7 +903,7 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
|
||||
Threshold = SMESH + types[ iGeom ];
|
||||
#ifdef _DEBUG_
|
||||
// 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
|
||||
}
|
||||
if (Type == "SMESH.FT_EntityType")
|
||||
@ -922,8 +922,8 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
|
||||
if ( -1 < iGeom && iGeom < nbTypes )
|
||||
Threshold = SMESH + types[ iGeom ];
|
||||
#ifdef _DEBUG_
|
||||
// is types complete? (compilation failure mains that enum EntityType changed)
|
||||
int _assert[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 1 : -1 ]; _assert[0]=1;
|
||||
// is 'types' complete? (compilation failure mains that enum EntityType changed)
|
||||
int _asrt[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 2 : -1 ]; _asrt[0]=_asrt[1];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -4082,7 +4082,7 @@ static const char** getFunctNames()
|
||||
#ifdef _DEBUG_
|
||||
// check if functName is complete, compilation failure means that enum FunctorType changed
|
||||
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
|
||||
|
||||
return functName;
|
||||
|
@ -2543,9 +2543,9 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::ListOfIDSources& theMeshesArray,
|
||||
|
||||
// make a group name
|
||||
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*);
|
||||
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";
|
||||
SALOMEDS::SObject_wrap aMeshSObj = ObjectToSObject( myCurrentStudy, theMeshesArray[i] );
|
||||
|
@ -135,6 +135,8 @@ public:
|
||||
virtual SMESH_Hypothesis_i* Create(PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl) = 0;
|
||||
virtual ~GenericHypothesisCreator_i() {}
|
||||
|
||||
// return the name of IDL module
|
||||
virtual std::string GetModuleName() = 0;
|
||||
virtual bool IsApplicable( const TopoDS_Shape &S, bool toCheckAll ) {return true;}
|
||||
|
@ -3056,7 +3056,7 @@ namespace
|
||||
|
||||
// sort nodes accoring to the order of edges
|
||||
_Node* orderNodes [20];
|
||||
TGeomID orderShapeIDs[20];
|
||||
//TGeomID orderShapeIDs[20];
|
||||
size_t nbN = 0;
|
||||
TGeomID id, *pID = 0;
|
||||
for ( e = edges.begin(); e != edges.end(); ++e )
|
||||
@ -3064,14 +3064,14 @@ namespace
|
||||
if (( id = _grid->_shapes.FindIndex( SMESH_MesherHelper::IthVertex( 0, *e ))) &&
|
||||
(( pID = std::find( &nShapeIds[0], nShapeIdsEnd, id )) != nShapeIdsEnd ))
|
||||
{
|
||||
orderShapeIDs[ nbN ] = id;
|
||||
//orderShapeIDs[ nbN ] = id;
|
||||
orderNodes [ nbN++ ] = nodes[ pID - &nShapeIds[0] ];
|
||||
*pID = -1;
|
||||
}
|
||||
if (( id = _grid->_shapes.FindIndex( *e )) &&
|
||||
(( pID = std::find( &nShapeIds[0], nShapeIdsEnd, id )) != nShapeIdsEnd ))
|
||||
{
|
||||
orderShapeIDs[ nbN ] = id;
|
||||
//orderShapeIDs[ nbN ] = id;
|
||||
orderNodes [ nbN++ ] = nodes[ pID - &nShapeIds[0] ];
|
||||
*pID = -1;
|
||||
}
|
||||
|
@ -561,7 +561,9 @@ StdMeshers_Prism_3D::StdMeshers_Prism_3D(int hypId, int studyId, SMESH_Gen* gen)
|
||||
//================================================================================
|
||||
|
||||
StdMeshers_Prism_3D::~StdMeshers_Prism_3D()
|
||||
{}
|
||||
{
|
||||
pointsToPython( std::vector<gp_XYZ>() ); // avoid warning: pointsToPython defined but not used
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckHypothesis
|
||||
@ -2639,19 +2641,19 @@ namespace // utils used by StdMeshers_Prism_3D::IsApplicable()
|
||||
/*!
|
||||
* \brief Return number of faces sharing given edges
|
||||
*/
|
||||
int nbAdjacentFaces( const std::vector< EdgeWithNeighbors >& edges,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& facesOfEdge )
|
||||
{
|
||||
TopTools_MapOfShape adjFaces;
|
||||
// int nbAdjacentFaces( const std::vector< EdgeWithNeighbors >& edges,
|
||||
// const TopTools_IndexedDataMapOfShapeListOfShape& facesOfEdge )
|
||||
// {
|
||||
// TopTools_MapOfShape adjFaces;
|
||||
|
||||
for ( size_t i = 0; i < edges.size(); ++i )
|
||||
{
|
||||
TopTools_ListIteratorOfListOfShape faceIt( facesOfEdge.FindFromKey( edges[i]._edge ));
|
||||
for ( ; faceIt.More(); faceIt.Next() )
|
||||
adjFaces.Add( faceIt.Value() );
|
||||
}
|
||||
return adjFaces.Extent();
|
||||
}
|
||||
// for ( size_t i = 0; i < edges.size(); ++i )
|
||||
// {
|
||||
// TopTools_ListIteratorOfListOfShape faceIt( facesOfEdge.FindFromKey( edges[i]._edge ));
|
||||
// for ( ; faceIt.More(); faceIt.Next() )
|
||||
// adjFaces.Add( faceIt.Value() );
|
||||
// }
|
||||
// return adjFaces.Extent();
|
||||
// }
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -3016,7 +3018,6 @@ bool StdMeshers_Prism_3D::initPrism(Prism_3D::TPrismTopo& thePrism,
|
||||
list< SMESH_subMesh* > meshedSubMesh;
|
||||
int nbFaces = 0;
|
||||
//
|
||||
SMESH_subMesh* anyFaceSM = 0;
|
||||
SMESH_subMeshIteratorPtr smIt = mainSubMesh->getDependsOnIterator(false,true);
|
||||
while ( smIt->more() )
|
||||
{
|
||||
@ -3025,7 +3026,6 @@ bool StdMeshers_Prism_3D::initPrism(Prism_3D::TPrismTopo& thePrism,
|
||||
if ( face.ShapeType() > TopAbs_FACE ) break;
|
||||
else if ( face.ShapeType() < TopAbs_FACE ) continue;
|
||||
nbFaces++;
|
||||
anyFaceSM = sm;
|
||||
|
||||
// is quadrangle FACE?
|
||||
list< TopoDS_Edge > orderedEdges;
|
||||
|
@ -124,6 +124,10 @@ namespace {
|
||||
const char* type[] ={"COMPOUND","COMPSOLID","SOLID","SHELL","FACE","WIRE","EDGE","VERTEX"};
|
||||
BRepTools::Write( shape, SMESH_Comment("/tmp/") << type[shape.ShapeType()] << "_"
|
||||
<< 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
|
||||
return false;
|
||||
}
|
||||
|
@ -949,144 +949,144 @@ namespace {
|
||||
TAssocTool::TNodeNodeMap& src2tgtNodes,
|
||||
const bool is1DComputed)
|
||||
{
|
||||
SMESH_Mesh * tgtMesh = tgtWires[0]->GetMesh();
|
||||
SMESH_Mesh * srcMesh = srcWires[0]->GetMesh();
|
||||
//SMESHDS_Mesh * tgtMeshDS = tgtMesh->GetMeshDS();
|
||||
SMESHDS_Mesh * srcMeshDS = srcMesh->GetMeshDS();
|
||||
// SMESH_Mesh * tgtMesh = tgtWires[0]->GetMesh();
|
||||
// SMESH_Mesh * srcMesh = srcWires[0]->GetMesh();
|
||||
// //SMESHDS_Mesh * tgtMeshDS = tgtMesh->GetMeshDS();
|
||||
// SMESHDS_Mesh * srcMeshDS = srcMesh->GetMeshDS();
|
||||
|
||||
if ( srcWires[0]->NbEdges() != 4 )
|
||||
return false;
|
||||
if ( !is1DComputed )
|
||||
return false;
|
||||
for ( int iE = 0; iE < 4; ++iE )
|
||||
{
|
||||
SMESHDS_SubMesh* sm = srcMeshDS->MeshElements( srcWires[0]->Edge( iE ));
|
||||
if ( !sm ) return false;
|
||||
if ( sm->NbNodes() + sm->NbElements() == 0 ) return false;
|
||||
}
|
||||
if ( BRepAdaptor_Surface( tgtFace ).GetType() != GeomAbs_Plane )
|
||||
return false;
|
||||
// if ( BRepAdaptor_Surface( tgtFace ).GetType() == GeomAbs_Plane &&
|
||||
// BRepAdaptor_Surface( srcFace ).GetType() == GeomAbs_Plane )
|
||||
// return false; // too easy
|
||||
// if ( srcWires[0]->NbEdges() != 4 )
|
||||
// return false;
|
||||
// if ( !is1DComputed )
|
||||
// return false;
|
||||
// for ( int iE = 0; iE < 4; ++iE )
|
||||
// {
|
||||
// SMESHDS_SubMesh* sm = srcMeshDS->MeshElements( srcWires[0]->Edge( iE ));
|
||||
// if ( !sm ) return false;
|
||||
// if ( sm->NbNodes() + sm->NbElements() == 0 ) return false;
|
||||
// }
|
||||
// if ( BRepAdaptor_Surface( tgtFace ).GetType() != GeomAbs_Plane )
|
||||
// return false;
|
||||
// // if ( BRepAdaptor_Surface( tgtFace ).GetType() == GeomAbs_Plane &&
|
||||
// // BRepAdaptor_Surface( srcFace ).GetType() == GeomAbs_Plane )
|
||||
// // return false; // too easy
|
||||
|
||||
// load EDGEs to SMESH_Block
|
||||
// // load EDGEs to SMESH_Block
|
||||
|
||||
SMESH_Block block;
|
||||
TopTools_IndexedMapOfOrientedShape blockSubShapes;
|
||||
{
|
||||
const TopoDS_Solid& box = srcMesh->PseudoShape();
|
||||
TopoDS_Shell shell = TopoDS::Shell( TopExp_Explorer( box, TopAbs_SHELL ).Current() );
|
||||
TopoDS_Vertex v;
|
||||
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 tgtFaceBID = SMESH_Block::ID_Fxy1;
|
||||
vector< int > edgeBID;
|
||||
block.GetFaceEdgesIDs( srcFaceBID, edgeBID ); // u0, u1, 0v, 1v
|
||||
blockSubShapes.Substitute( edgeBID[0], srcWires[0]->Edge(0) );
|
||||
blockSubShapes.Substitute( edgeBID[1], srcWires[0]->Edge(2) );
|
||||
blockSubShapes.Substitute( edgeBID[2], srcWires[0]->Edge(3) );
|
||||
blockSubShapes.Substitute( edgeBID[3], srcWires[0]->Edge(1) );
|
||||
block.GetFaceEdgesIDs( tgtFaceBID, edgeBID ); // u0, u1, 0v, 1v
|
||||
blockSubShapes.Substitute( edgeBID[0], tgtWires[0]->Edge(0) );
|
||||
blockSubShapes.Substitute( edgeBID[1], tgtWires[0]->Edge(2) );
|
||||
blockSubShapes.Substitute( edgeBID[2], tgtWires[0]->Edge(3) );
|
||||
blockSubShapes.Substitute( edgeBID[3], tgtWires[0]->Edge(1) );
|
||||
block.LoadFace( srcFace, srcFaceBID, blockSubShapes );
|
||||
block.LoadFace( tgtFace, tgtFaceBID, blockSubShapes );
|
||||
// SMESH_Block block;
|
||||
// TopTools_IndexedMapOfOrientedShape blockSubShapes;
|
||||
// {
|
||||
// const TopoDS_Solid& box = srcMesh->PseudoShape();
|
||||
// TopoDS_Shell shell = TopoDS::Shell( TopExp_Explorer( box, TopAbs_SHELL ).Current() );
|
||||
// TopoDS_Vertex v;
|
||||
// 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 tgtFaceBID = SMESH_Block::ID_Fxy1;
|
||||
// vector< int > edgeBID;
|
||||
// block.GetFaceEdgesIDs( srcFaceBID, edgeBID ); // u0, u1, 0v, 1v
|
||||
// blockSubShapes.Substitute( edgeBID[0], srcWires[0]->Edge(0) );
|
||||
// blockSubShapes.Substitute( edgeBID[1], srcWires[0]->Edge(2) );
|
||||
// blockSubShapes.Substitute( edgeBID[2], srcWires[0]->Edge(3) );
|
||||
// blockSubShapes.Substitute( edgeBID[3], srcWires[0]->Edge(1) );
|
||||
// block.GetFaceEdgesIDs( tgtFaceBID, edgeBID ); // u0, u1, 0v, 1v
|
||||
// blockSubShapes.Substitute( edgeBID[0], tgtWires[0]->Edge(0) );
|
||||
// blockSubShapes.Substitute( edgeBID[1], tgtWires[0]->Edge(2) );
|
||||
// blockSubShapes.Substitute( edgeBID[2], tgtWires[0]->Edge(3) );
|
||||
// blockSubShapes.Substitute( edgeBID[3], tgtWires[0]->Edge(1) );
|
||||
// block.LoadFace( srcFace, srcFaceBID, 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::vector< TNodeOrXY* > TFaceConn; // face connectivity
|
||||
std::vector< TFaceConn > newFacesVec; // connectivity of all faces
|
||||
std::map< const SMDS_MeshNode*, TNodeOrXY > srcNode2tgtNXY; // src node -> node-or-XY
|
||||
// typedef std::pair< const SMDS_MeshNode*, gp_XYZ > TNodeOrXY; // node-or-XY
|
||||
// typedef std::vector< TNodeOrXY* > TFaceConn; // face connectivity
|
||||
// std::vector< TFaceConn > newFacesVec; // connectivity of all faces
|
||||
// std::map< const SMDS_MeshNode*, TNodeOrXY > srcNode2tgtNXY; // src node -> node-or-XY
|
||||
|
||||
TAssocTool::TNodeNodeMap::iterator srcN_tgtN;
|
||||
std::map< const SMDS_MeshNode*, TNodeOrXY >::iterator srcN_tgtNXY;
|
||||
std::pair< std::map< const SMDS_MeshNode*, TNodeOrXY >::iterator, bool > n2n_isNew;
|
||||
TNodeOrXY nullNXY( (SMDS_MeshNode*)NULL, gp_XYZ(0,0,0) );
|
||||
// TAssocTool::TNodeNodeMap::iterator srcN_tgtN;
|
||||
// std::map< const SMDS_MeshNode*, TNodeOrXY >::iterator srcN_tgtNXY;
|
||||
// std::pair< std::map< const SMDS_MeshNode*, TNodeOrXY >::iterator, bool > n2n_isNew;
|
||||
// TNodeOrXY nullNXY( (SMDS_MeshNode*)NULL, gp_XYZ(0,0,0) );
|
||||
|
||||
SMESHDS_SubMesh* srcSubDS = srcMeshDS->MeshElements( srcFace );
|
||||
newFacesVec.resize( srcSubDS->NbElements() );
|
||||
int iFaceSrc = 0;
|
||||
// SMESHDS_SubMesh* srcSubDS = srcMeshDS->MeshElements( srcFace );
|
||||
// newFacesVec.resize( srcSubDS->NbElements() );
|
||||
// int iFaceSrc = 0;
|
||||
|
||||
SMDS_ElemIteratorPtr elemIt = srcSubDS->GetElements();
|
||||
while ( elemIt->more() ) // loop on all mesh faces on srcFace
|
||||
{
|
||||
const SMDS_MeshElement* elem = elemIt->next();
|
||||
TFaceConn& tgtNodes = newFacesVec[ iFaceSrc++ ];
|
||||
// SMDS_ElemIteratorPtr elemIt = srcSubDS->GetElements();
|
||||
// while ( elemIt->more() ) // loop on all mesh faces on srcFace
|
||||
// {
|
||||
// const SMDS_MeshElement* elem = elemIt->next();
|
||||
// TFaceConn& tgtNodes = newFacesVec[ iFaceSrc++ ];
|
||||
|
||||
const int nbN = elem->NbCornerNodes();
|
||||
tgtNodes.resize( nbN );
|
||||
for ( int i = 0; i < nbN; ++i ) // loop on nodes of the source element
|
||||
{
|
||||
const SMDS_MeshNode* srcNode = elem->GetNode(i);
|
||||
n2n_isNew = srcNode2tgtNXY.insert( make_pair( srcNode, nullNXY ));
|
||||
TNodeOrXY & tgtNodeOrXY = n2n_isNew.first->second;
|
||||
if ( n2n_isNew.second ) // new src node encounters
|
||||
{
|
||||
srcN_tgtN = src2tgtNodes.find( srcNode );
|
||||
if ( srcN_tgtN != src2tgtNodes.end() )
|
||||
{
|
||||
tgtNodeOrXY.first = srcN_tgtN->second; // tgt node exists
|
||||
}
|
||||
else
|
||||
{
|
||||
// find XY of src node withing the quadrilateral srcFace
|
||||
if ( !block.ComputeParameters( SMESH_TNodeXYZ( srcNode ),
|
||||
tgtNodeOrXY.second, srcFaceBID ))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
tgtNodes[ i ] = & tgtNodeOrXY;
|
||||
}
|
||||
}
|
||||
// const int nbN = elem->NbCornerNodes();
|
||||
// tgtNodes.resize( nbN );
|
||||
// for ( int i = 0; i < nbN; ++i ) // loop on nodes of the source element
|
||||
// {
|
||||
// const SMDS_MeshNode* srcNode = elem->GetNode(i);
|
||||
// n2n_isNew = srcNode2tgtNXY.insert( make_pair( srcNode, nullNXY ));
|
||||
// TNodeOrXY & tgtNodeOrXY = n2n_isNew.first->second;
|
||||
// if ( n2n_isNew.second ) // new src node encounters
|
||||
// {
|
||||
// srcN_tgtN = src2tgtNodes.find( srcNode );
|
||||
// if ( srcN_tgtN != src2tgtNodes.end() )
|
||||
// {
|
||||
// tgtNodeOrXY.first = srcN_tgtN->second; // tgt node exists
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // find XY of src node withing the quadrilateral srcFace
|
||||
// if ( !block.ComputeParameters( SMESH_TNodeXYZ( srcNode ),
|
||||
// tgtNodeOrXY.second, srcFaceBID ))
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// 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 );
|
||||
helper.SetSubShape( tgtFace );
|
||||
if ( is1DComputed )
|
||||
helper.IsQuadraticSubMesh( tgtFace );
|
||||
else
|
||||
helper.SetIsQuadratic( srcSubDS->GetElements()->next()->IsQuadratic() );
|
||||
helper.SetElementsOnShape( true );
|
||||
Handle(Geom_Surface) tgtSurface = BRep_Tool::Surface( tgtFace );
|
||||
// SMESH_MesherHelper helper( *tgtMesh );
|
||||
// helper.SetSubShape( tgtFace );
|
||||
// if ( is1DComputed )
|
||||
// helper.IsQuadraticSubMesh( tgtFace );
|
||||
// else
|
||||
// helper.SetIsQuadratic( srcSubDS->GetElements()->next()->IsQuadratic() );
|
||||
// helper.SetElementsOnShape( true );
|
||||
// Handle(Geom_Surface) tgtSurface = BRep_Tool::Surface( tgtFace );
|
||||
|
||||
SMESH_MesherHelper srcHelper( *srcMesh );
|
||||
srcHelper.SetSubShape( srcFace );
|
||||
// SMESH_MesherHelper srcHelper( *srcMesh );
|
||||
// srcHelper.SetSubShape( srcFace );
|
||||
|
||||
vector< const SMDS_MeshNode* > tgtNodes;
|
||||
gp_XY uv;
|
||||
// vector< const SMDS_MeshNode* > tgtNodes;
|
||||
// gp_XY uv;
|
||||
|
||||
for ( size_t iFaceTgt = 0; iFaceTgt < newFacesVec.size(); ++iFaceTgt )
|
||||
{
|
||||
TFaceConn& tgtConn = newFacesVec[ iFaceTgt ];
|
||||
tgtNodes.resize( tgtConn.size() );
|
||||
for ( size_t iN = 0; iN < tgtConn.size(); ++iN )
|
||||
{
|
||||
const SMDS_MeshNode* & tgtN = tgtConn[ iN ]->first;
|
||||
if ( !tgtN ) // create a node
|
||||
{
|
||||
if ( !block.FaceUV( tgtFaceBID, tgtConn[iN]->second, uv ))
|
||||
return false;
|
||||
gp_Pnt p = tgtSurface->Value( 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
|
||||
}
|
||||
switch ( tgtNodes.size() )
|
||||
{
|
||||
case 3: helper.AddFace(tgtNodes[0], tgtNodes[1], tgtNodes[2]); break;
|
||||
case 4: helper.AddFace(tgtNodes[0], tgtNodes[1], tgtNodes[2], tgtNodes[3]); break;
|
||||
default:
|
||||
if ( tgtNodes.size() > 4 )
|
||||
helper.AddPolygonalFace( tgtNodes );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
// for ( size_t iFaceTgt = 0; iFaceTgt < newFacesVec.size(); ++iFaceTgt )
|
||||
// {
|
||||
// TFaceConn& tgtConn = newFacesVec[ iFaceTgt ];
|
||||
// tgtNodes.resize( tgtConn.size() );
|
||||
// for ( size_t iN = 0; iN < tgtConn.size(); ++iN )
|
||||
// {
|
||||
// const SMDS_MeshNode* & tgtN = tgtConn[ iN ]->first;
|
||||
// if ( !tgtN ) // create a node
|
||||
// {
|
||||
// if ( !block.FaceUV( tgtFaceBID, tgtConn[iN]->second, uv ))
|
||||
// return false;
|
||||
// gp_Pnt p = tgtSurface->Value( 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
|
||||
// }
|
||||
// switch ( tgtNodes.size() )
|
||||
// {
|
||||
// case 3: helper.AddFace(tgtNodes[0], tgtNodes[1], tgtNodes[2]); break;
|
||||
// case 4: helper.AddFace(tgtNodes[0], tgtNodes[1], tgtNodes[2], tgtNodes[3]); break;
|
||||
// default:
|
||||
// if ( tgtNodes.size() > 4 )
|
||||
// helper.AddPolygonalFace( tgtNodes );
|
||||
// }
|
||||
// }
|
||||
return false; //true;
|
||||
|
||||
} // bool projectQuads(...)
|
||||
|
||||
@ -1310,8 +1310,9 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
|
||||
if ( !projDone )
|
||||
{
|
||||
// projection in case of quadrilateral faces
|
||||
// projDone = projectQuads( tgtFace, srcFace, tgtWires, srcWires,
|
||||
// shape2ShapeMap, _src2tgtNodes, is1DComputed);
|
||||
// NOT IMPLEMENTED, returns false
|
||||
projDone = projectQuads( tgtFace, srcFace, tgtWires, srcWires,
|
||||
shape2ShapeMap, _src2tgtNodes, is1DComputed);
|
||||
}
|
||||
|
||||
// it will remove mesh built on edges and vertices in failure case
|
||||
|
@ -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)
|
||||
{
|
||||
@ -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)
|
||||
{
|
||||
if ( theEdge.ShapeType() == TopAbs_EDGE )
|
||||
return findData( theMesh.GetSubMeshContaining( theEdge ) );
|
||||
return 0;
|
||||
}
|
||||
// PropagationMgrData* findData(SMESH_Mesh& theMesh, const TopoDS_Shape& theEdge)
|
||||
// {
|
||||
// if ( theEdge.ShapeType() == TopAbs_EDGE )
|
||||
// return findData( theMesh.GetSubMeshContaining( theEdge ) );
|
||||
// return 0;
|
||||
// }
|
||||
//=============================================================================
|
||||
/*!
|
||||
* \brief return existing or a new PropagationMgrData
|
||||
|
@ -415,16 +415,17 @@ static void compensateError(double a1, double an,
|
||||
if ( a1 + an <= length && nPar > 1 )
|
||||
{
|
||||
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() )
|
||||
return;
|
||||
double Utgt = Discret.Parameter(); // target value of the last parameter
|
||||
list<double>::reverse_iterator itU = theParams.rbegin();
|
||||
double Ul = *itU++; // real value of the last parameter
|
||||
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
|
||||
if ( Abs(dUn) <= 1e-3 * dU )
|
||||
return;
|
||||
if ( adjustNeighbors2an || Abs(dUn) < 0.5 * dU ) { // last segment is a bit shorter than it should
|
||||
// move the last parameter to the edge beginning
|
||||
}
|
||||
@ -595,7 +596,8 @@ void StdMeshers_Regular_1D::redistributeNearVertices (SMESH_Mesh & theM
|
||||
{
|
||||
if ( !isEnd1 )
|
||||
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 ( nPar == 0 )
|
||||
theParameters.push_back( Discret.Parameter());
|
||||
@ -705,7 +707,8 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
|
||||
size_t nbParams = 0;
|
||||
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;
|
||||
param = Discret.Parameter();
|
||||
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
|
||||
if (nbseg <= 0)
|
||||
nbseg = 1; // degenerated edge
|
||||
eltSize = theLength / nbseg;
|
||||
nbseg = 1; // degenerated edge
|
||||
eltSize = theLength / nbseg * ( 1. - 1e-9 );
|
||||
nbSegments = (int) nbseg;
|
||||
}
|
||||
else if ( _hypType == LOCAL_LENGTH )
|
||||
@ -802,7 +805,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
|
||||
if ( theReverse )
|
||||
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));
|
||||
|
||||
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 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();
|
||||
for ( ; u != uEnd; ++u )
|
||||
{
|
||||
GCPnts_AbscissaPoint Discret( theC3d, ((*u)-f) * lenFactor, f );
|
||||
GCPnts_AbscissaPoint Discret( tol, theC3d, ((*u)-f) * lenFactor, f );
|
||||
if ( Discret.IsDone() )
|
||||
*u = Discret.Parameter();
|
||||
}
|
||||
@ -844,9 +849,13 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
|
||||
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() )
|
||||
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 );
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
case BEG_END_LENGTH: {
|
||||
|
||||
// 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<<") "<<
|
||||
"for an edge of length "<<theLength);
|
||||
|
||||
double U1 = theReverse ? l : f;
|
||||
double Un = theReverse ? f : l;
|
||||
double param = U1;
|
||||
double U1 = theReverse ? l : f;
|
||||
double Un = theReverse ? f : l;
|
||||
double param = U1;
|
||||
double eltSize = theReverse ? -a1 : a1;
|
||||
double tol = Min( Precision::Confusion(), 0.01 * Min( a1, an ));
|
||||
while ( 1 ) {
|
||||
// computes a point on a curve <theC3d> at the distance <eltSize>
|
||||
// from the point of parameter <param>.
|
||||
GCPnts_AbscissaPoint Discret( theC3d, eltSize, param );
|
||||
GCPnts_AbscissaPoint Discret( tol, theC3d, eltSize, param );
|
||||
if ( !Discret.IsDone() ) break;
|
||||
param = Discret.Parameter();
|
||||
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 );
|
||||
int n = int(fabs(q) > numeric_limits<double>::min() ? ( 1+( an-a1 )/q ) : ( 1+theLength/a1 ));
|
||||
|
||||
double U1 = theReverse ? l : f;
|
||||
double Un = theReverse ? f : l;
|
||||
double param = U1;
|
||||
double U1 = theReverse ? l : f;
|
||||
double Un = theReverse ? f : l;
|
||||
double param = U1;
|
||||
double eltSize = a1;
|
||||
double tol = Min( Precision::Confusion(), 0.01 * Min( a1, an ));
|
||||
if ( theReverse ) {
|
||||
eltSize = -eltSize;
|
||||
q = -q;
|
||||
@ -914,7 +926,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
|
||||
while ( n-- > 0 && eltSize * ( Un - U1 ) > 0 ) {
|
||||
// computes a point on a curve <theC3d> at the distance <eltSize>
|
||||
// from the point of parameter <param>.
|
||||
GCPnts_AbscissaPoint Discret( theC3d, eltSize, param );
|
||||
GCPnts_AbscissaPoint Discret( tol, theC3d, eltSize, param );
|
||||
if ( !Discret.IsDone() ) break;
|
||||
param = Discret.Parameter();
|
||||
if ( param > f && param < l )
|
||||
@ -945,7 +957,8 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
|
||||
while ( true ) {
|
||||
// computes a point on a curve <theC3d> at the distance <eltSize>
|
||||
// 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;
|
||||
param = Discret.Parameter();
|
||||
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<int>& nbsegs = _fpHyp->GetNbSegments();
|
||||
|
||||
// sort normalized params, taking into account theReverse
|
||||
TColStd_SequenceOfReal Params;
|
||||
double tol = 1e-7 / theLength; // GCPnts_UniformAbscissa allows u2-u1 > 1e-7
|
||||
for ( size_t i = 0; i < aPnts.size(); i++ )
|
||||
{
|
||||
if( aPnts[i]<0.0001 || aPnts[i]>0.9999 ) continue;
|
||||
int j=1;
|
||||
if( aPnts[i] < tol || aPnts[i] > 1 - tol )
|
||||
continue;
|
||||
double u = theReverse ? ( 1 - aPnts[i] ) : aPnts[i];
|
||||
int j = 1;
|
||||
bool IsExist = false;
|
||||
for ( ; j <= Params.Length(); j++ ) {
|
||||
if ( Abs( aPnts[i] - Params.Value(j) ) < 1e-4 ) {
|
||||
if ( Abs( u - Params.Value(j) ) < tol ) {
|
||||
IsExist = true;
|
||||
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;
|
||||
lp = l;
|
||||
double sign = 1.0;
|
||||
if ( theReverse ) {
|
||||
par1 = l;
|
||||
lp = f;
|
||||
sign = -1.0;
|
||||
}
|
||||
double eltSize, segmentSize = 0.;
|
||||
double currAbscissa = 0;
|
||||
for ( int i = 0; i < Params.Length(); i++ )
|
||||
|
||||
// transform normalized Params into real ones
|
||||
std::vector< double > uVec( Params.Length() + 2 );
|
||||
uVec[ 0 ] = theFirstU;
|
||||
double abscissa;
|
||||
for ( int i = 1; i <= Params.Length(); i++ )
|
||||
{
|
||||
int nbseg = ( i > (int)nbsegs.size()-1 ) ? nbsegs[0] : nbsegs[i];
|
||||
segmentSize = Params.Value( i+1 ) * theLength - currAbscissa;
|
||||
currAbscissa += segmentSize;
|
||||
GCPnts_AbscissaPoint APnt( theC3d, sign*segmentSize, par1 );
|
||||
abscissa = Params( i ) * theLength;
|
||||
tol = Min( Precision::Confusion(), 0.01 * abscissa );
|
||||
GCPnts_AbscissaPoint APnt( tol, theC3d, abscissa, theFirstU );
|
||||
if ( !APnt.IsDone() )
|
||||
return error( "GCPnts_AbscissaPoint failed");
|
||||
par2 = APnt.Parameter();
|
||||
eltSize = segmentSize/nbseg;
|
||||
GCPnts_UniformAbscissa Discret( theC3d, eltSize, par1, par2 );
|
||||
if ( theReverse )
|
||||
Discret.Initialize( theC3d, eltSize, par2, par1 );
|
||||
uVec[ i ] = APnt.Parameter();
|
||||
}
|
||||
uVec.back() = theLastU;
|
||||
|
||||
// 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
|
||||
Discret.Initialize( theC3d, eltSize, par1, par2 );
|
||||
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 );
|
||||
{
|
||||
segmentSize = ( Params( i+2 ) - Params( i+1 )) * theLength;
|
||||
eltSize = segmentSize / nbseg;
|
||||
tol = Min( Precision::Confusion(), 0.01 * eltSize );
|
||||
GCPnts_UniformAbscissa Discret( theC3d, eltSize, par1, par2, tol );
|
||||
if ( !Discret.IsDone() )
|
||||
return error( "GCPnts_UniformAbscissa failed");
|
||||
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
|
||||
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
|
||||
theParams.pop_back();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -934,7 +934,7 @@ void Maillage::acquisitionTYPE_inputMED(TYPE_MAILLE TYPE, int nTYPE, med_idt fid
|
||||
void Maillage::outputMED(std::string fichierMED)
|
||||
{
|
||||
// int i, j, k;
|
||||
int nTYPE, tTYPE;
|
||||
int nTYPE;//, tTYPE;
|
||||
string line, s, stype, nomnoeud;
|
||||
// med_err ret = 0; // Code retour
|
||||
// int ig, jg;
|
||||
@ -1457,7 +1457,7 @@ void Maillage::outputMED(std::string fichierMED)
|
||||
if (EFFECTIFS_TYPES[tm])
|
||||
{
|
||||
nTYPE = EFFECTIFS_TYPES[tm];
|
||||
tTYPE = Nnoeuds(tm);
|
||||
//tTYPE = Nnoeuds(tm);
|
||||
MGE = InstanceMGE(tm);
|
||||
stype = TM2string(tm);
|
||||
|
||||
|
@ -100,7 +100,7 @@ bool SPADDERPluginTester_i::testkernel()
|
||||
beginService("SPADDERPluginTester_i::testplugin");
|
||||
|
||||
Engines::SalomeLauncher_ptr salomeLauncher = KERNEL::getSalomeLauncher();
|
||||
salomeLauncher = NULL;
|
||||
if ( salomeLauncher ) salomeLauncher = NULL;
|
||||
|
||||
endService("SPADDERPluginTester_i::testplugin");
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user