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
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;
{
using namespace UNV2412;
TDataSet aDataSet2412;
- TConnect aConnect;
// Storing SMDS Edges
MESSAGE("Perform - myMesh->NbEdges() = "<<myMesh->NbEdges());
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;
{
public:
SMESH_PreviewActorsCollection();
- ~SMESH_PreviewActorsCollection();
+ virtual ~SMESH_PreviewActorsCollection();
virtual void AddToRender (vtkRenderer* theRenderer);
virtual void RemoveFromRender(vtkRenderer* theRenderer);
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;
// --- 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))
// 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)
}
// 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()));
"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 );
// -------------
TIDSortedElemSet biQuadQuas, biQuadTris, triQuadHexa;
- const SMDS_MeshElement *biQuadQua, *triQuadHex;
const bool toFixCentralNodes = ( myMesh->NbBiQuadQuadrangles() +
myMesh->NbBiQuadTriangles() +
myMesh->NbTriQuadraticHexas() );
// collect bi-quadratic elements
if ( toFixCentralNodes )
{
- biQuadQua = triQuadHex = 0;
SMDS_ElemIteratorPtr eIt = pLink->_mediumNode->GetInverseElementIterator();
while ( eIt->more() )
{
nCenterCoords.X(), nCenterCoords.Y(), nCenterCoords.Z());
}
}
+#ifdef _DEBUG_
+ // avoid warning: defined but not used operator<<()
+ SMESH_Comment() << *links.begin() << *faces.begin();
+#endif
}
//================================================================================
class SMESHCONTROLS_EXPORT Functor
{
public:
- ~Functor(){}
+ virtual ~Functor(){}
virtual void SetMesh( const SMDS_Mesh* theMesh ) = 0;
virtual SMDSAbs_ElementType GetType() const = 0;
};
};
// 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 ) {
}
- 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";
- }
-
- return RefType;
- }
+ // 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";
+ // }
+
+ // return RefType;
+ // }
uint randomize( uint size )
{
operator char*() const {
return (char*)c_str();
}
+
+ std::ostream& Stream() { return _s; }
};
}
}
#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
}
// -------------------------------------------------------------------------------------
virtual int FindNearPoint(const gp_Pnt& point,
const double tolerance,
std::vector< const SMDS_MeshNode* >& foundNodes) = 0;
+ virtual ~SMESH_NodeSearcher() {}
};
//=======================================================================
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")
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
}
}
#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;
// 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] );
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;}
// 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 )
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;
}
//================================================================================
StdMeshers_Prism_3D::~StdMeshers_Prism_3D()
-{}
+{
+ pointsToPython( std::vector<gp_XYZ>() ); // avoid warning: pointsToPython defined but not used
+}
//=======================================================================
//function : CheckHypothesis
/*!
* \brief Return number of faces sharing given edges
*/
- 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();
- }
+ // 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();
+ // }
}
//================================================================================
list< SMESH_subMesh* > meshedSubMesh;
int nbFaces = 0;
//
- SMESH_subMesh* anyFaceSM = 0;
SMESH_subMeshIteratorPtr smIt = mainSubMesh->getDependsOnIterator(false,true);
while ( smIt->more() )
{
if ( face.ShapeType() > TopAbs_FACE ) break;
else if ( face.ShapeType() < TopAbs_FACE ) continue;
nbFaces++;
- anyFaceSM = sm;
// is quadrangle FACE?
list< TopoDS_Edge > orderedEdges;
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;
}
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();
-
- 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
-
- 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 )
-
- 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) );
+ // 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
- SMESHDS_SubMesh* srcSubDS = srcMeshDS->MeshElements( srcFace );
- newFacesVec.resize( srcSubDS->NbElements() );
- int iFaceSrc = 0;
+ // // load EDGEs to SMESH_Block
- 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;
- }
- }
+ // 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 )
+
+ // 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) );
+
+ // 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++ ];
+
+ // 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(...)
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
}
//=============================================================================
/*!
- * \brief return PropagationMgrData found on a submesh
+ * \brief return PropagationMgrData found on a sub-mesh
*/
PropagationMgrData* findData(SMESH_subMesh* sm)
{
}
//=============================================================================
/*!
- * \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
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
}
{
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());
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 );
{
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 )
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++) {
}
}
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();
}
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
return true;
}
+
case BEG_END_LENGTH: {
// geometric progression: SUM(n) = ( a1 - an * q ) / ( 1 - q ) = theLength
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 )
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;
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 )
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 )
{
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] );
- }
- double par2, par1, lp;
- par1 = f;
- lp = l;
- double sign = 1.0;
- if ( theReverse ) {
- par1 = l;
- lp = f;
- sign = -1.0;
+ if ( !IsExist ) Params.InsertBefore( j, u );
}
- 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 );
- 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 );
- }
- if ( theReverse ) {
- compensateError( eltSize, eltSize, par2, par1, segmentSize, theC3d, tmpParams );
- tmpParams.reverse();
+ 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 {
- compensateError( eltSize, eltSize, par1, par2, segmentSize, theC3d, tmpParams );
+ else
+ {
+ 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 );
+ }
}
- 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;
}
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;
if (EFFECTIFS_TYPES[tm])
{
nTYPE = EFFECTIFS_TYPES[tm];
- tTYPE = Nnoeuds(tm);
+ //tTYPE = Nnoeuds(tm);
MGE = InstanceMGE(tm);
stype = TM2string(tm);
beginService("SPADDERPluginTester_i::testplugin");
Engines::SalomeLauncher_ptr salomeLauncher = KERNEL::getSalomeLauncher();
- salomeLauncher = NULL;
+ if ( salomeLauncher ) salomeLauncher = NULL;
endService("SPADDERPluginTester_i::testplugin");
return true;