mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 09:20:34 +05:00
23395: EDF 13855 - Crash SALOME when creating a mesh
+ sort objects in Clipping plane dlg
This commit is contained in:
parent
e64112ab22
commit
831b40eb01
@ -3,9 +3,6 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get faces with warping angle = 2.0e-13 with tolerance 5.0e-14
|
||||
criterion = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Warping, SMESH.FT_EqualTo, 2.0e-13)
|
||||
criterion.Tolerance = 5.0e-14
|
||||
filter = smesh.CreateFilterManager().CreateFilter()
|
||||
filter.SetCriteria([criterion])
|
||||
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Warping, "=", 2.0e-13, Tolerance=5.0e-14)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of faces with warping angle = 2.0e-13 (tolerance 5.0e-14):", len(ids)
|
||||
|
@ -3,10 +3,8 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get faces with area > 60 and < 90
|
||||
criterion1 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 60,\
|
||||
SMESH.FT_Undefined, SMESH.FT_LogicalAND)
|
||||
criterion1 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 60)
|
||||
criterion2 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 90)
|
||||
filter = smesh.CreateFilterManager().CreateFilter()
|
||||
filter.SetCriteria([criterion1,criterion2])
|
||||
filter = smesh.GetFilterFromCriteria([criterion1,criterion2], SMESH.FT_LogicalAND)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of faces with area in range (60,90):", len(ids)
|
||||
|
@ -9,8 +9,7 @@ from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# create mesh
|
||||
face = geompy.MakeFaceHW(100, 100, 1)
|
||||
geompy.addToStudy( face, "quadrangle" )
|
||||
face = geompy.MakeFaceHW(100, 100, 1, theName="quadrangle")
|
||||
mesh = smesh.Mesh(face)
|
||||
mesh.Segment().NumberOfSegments(10)
|
||||
mesh.Triangle().MaxElementArea(25)
|
||||
|
@ -2570,6 +2570,13 @@ int SMDS_Mesh::NbNodes() const
|
||||
return myInfo.NbNodes();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Return the number of elements
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
int SMDS_Mesh::NbElements() const
|
||||
{
|
||||
return myInfo.NbElements();
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Return the number of 0D elements
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -3322,14 +3329,14 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
|
||||
void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
|
||||
{
|
||||
int elemId = elem->GetID();
|
||||
int vtkId = elem->getVtkId();
|
||||
int vtkId = elem->getVtkId();
|
||||
SMDSAbs_ElementType aType = elem->GetType();
|
||||
SMDS_MeshElement* todest = (SMDS_MeshElement*)(elem);
|
||||
if (aType == SMDSAbs_Node) {
|
||||
SMDS_MeshElement* todest = (SMDS_MeshElement*)(elem);
|
||||
if ( aType == SMDSAbs_Node )
|
||||
{
|
||||
// only free node can be removed by this method
|
||||
const SMDS_MeshNode* n = static_cast<SMDS_MeshNode*>(todest);
|
||||
SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
|
||||
if (!itFe->more()) { // free node
|
||||
if ( n->NbInverseElements() == 0 ) { // free node
|
||||
myNodes[elemId] = 0;
|
||||
myInfo.myNbNodes--;
|
||||
((SMDS_MeshNode*) n)->SetPosition(SMDS_SpacePosition::originSpacePosition());
|
||||
@ -3337,7 +3344,9 @@ void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
|
||||
myNodePool->destroy(static_cast<SMDS_MeshNode*>(todest));
|
||||
myNodeIDFactory->ReleaseID(elemId, vtkId);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hasConstructionEdges() || hasConstructionFaces())
|
||||
// this methods is only for meshes without descendants
|
||||
return;
|
||||
|
@ -705,6 +705,7 @@ public:
|
||||
const SMDS_MeshInfo& GetMeshInfo() const { return myInfo; }
|
||||
|
||||
virtual int NbNodes() const;
|
||||
virtual int NbElements() const;
|
||||
virtual int Nb0DElements() const;
|
||||
virtual int NbBalls() const;
|
||||
virtual int NbEdges() const;
|
||||
|
@ -143,22 +143,29 @@ public:
|
||||
SMDS_MeshNode_MyInvIterator(SMDS_Mesh *mesh, vtkIdType* cells, int ncells, SMDSAbs_ElementType type) :
|
||||
myMesh(mesh), myCells(cells), myNcells(ncells), myType(type), iter(0)
|
||||
{
|
||||
cellList.reserve( ncells );
|
||||
if (type == SMDSAbs_All)
|
||||
cellList.assign( cells, cells + ncells );
|
||||
else
|
||||
for (int i = 0; i < ncells; i++)
|
||||
if ( ncells )
|
||||
{
|
||||
cellList.reserve( ncells );
|
||||
if (type == SMDSAbs_All)
|
||||
{
|
||||
int vtkId = cells[i];
|
||||
int smdsId = myMesh->fromVtkToSmds(vtkId);
|
||||
const SMDS_MeshElement* elem = myMesh->FindElement(smdsId);
|
||||
if (elem->GetType() == type)
|
||||
{
|
||||
cellList.push_back(vtkId);
|
||||
}
|
||||
cellList.assign( cells, cells + ncells );
|
||||
}
|
||||
myCells = cellList.empty() ? 0 : &cellList[0];
|
||||
myNcells = cellList.size();
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ncells; i++)
|
||||
{
|
||||
int vtkId = cells[i];
|
||||
int smdsId = myMesh->fromVtkToSmds(vtkId);
|
||||
const SMDS_MeshElement* elem = myMesh->FindElement(smdsId);
|
||||
if (elem->GetType() == type)
|
||||
{
|
||||
cellList.push_back(vtkId);
|
||||
}
|
||||
}
|
||||
myCells = cellList.empty() ? 0 : &cellList[0];
|
||||
myNcells = cellList.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool more()
|
||||
@ -183,66 +190,25 @@ public:
|
||||
|
||||
SMDS_ElemIteratorPtr SMDS_MeshNode::GetInverseElementIterator(SMDSAbs_ElementType type) const
|
||||
{
|
||||
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks()->GetLink(myVtkID);
|
||||
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
|
||||
}
|
||||
|
||||
// Same as GetInverseElementIterator but the created iterator only returns
|
||||
// wanted type elements.
|
||||
class SMDS_MeshNode_MyIterator:public SMDS_ElemIterator
|
||||
{
|
||||
private:
|
||||
SMDS_Mesh* myMesh;
|
||||
vtkIdType* myCells;
|
||||
int myNcells;
|
||||
SMDSAbs_ElementType myType;
|
||||
int iter;
|
||||
vector<SMDS_MeshElement*> myFiltCells;
|
||||
|
||||
public:
|
||||
SMDS_MeshNode_MyIterator(SMDS_Mesh *mesh,
|
||||
vtkIdType* cells,
|
||||
int ncells,
|
||||
SMDSAbs_ElementType type):
|
||||
myMesh(mesh), myCells(cells), myNcells(ncells), myType(type), iter(0)
|
||||
if ( SMDS_Mesh::_meshList[myMeshId]->NbElements() > 0 ) // avoid building links
|
||||
{
|
||||
for (; iter<ncells; iter++)
|
||||
{
|
||||
int vtkId = myCells[iter];
|
||||
int smdsId = myMesh->fromVtkToSmds(vtkId);
|
||||
const SMDS_MeshElement* elem = myMesh->FindElement(smdsId);
|
||||
if (elem->GetType() == type)
|
||||
myFiltCells.push_back((SMDS_MeshElement*)elem);
|
||||
}
|
||||
myNcells = myFiltCells.size();
|
||||
iter = 0;
|
||||
vtkCellLinks::Link& l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks()->GetLink(myVtkID);
|
||||
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
|
||||
}
|
||||
|
||||
bool more()
|
||||
{
|
||||
return (iter< myNcells);
|
||||
}
|
||||
|
||||
const SMDS_MeshElement* next()
|
||||
{
|
||||
const SMDS_MeshElement* elem = myFiltCells[iter];
|
||||
iter++;
|
||||
return elem;
|
||||
}
|
||||
};
|
||||
|
||||
SMDS_ElemIteratorPtr SMDS_MeshNode::
|
||||
elementsIterator(SMDSAbs_ElementType type) const
|
||||
{
|
||||
if(type==SMDSAbs_Node)
|
||||
return SMDS_MeshElement::elementsIterator(SMDSAbs_Node);
|
||||
else
|
||||
{
|
||||
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks()->GetLink(myVtkID);
|
||||
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
|
||||
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], 0, 0, type));
|
||||
}
|
||||
}
|
||||
|
||||
SMDS_ElemIteratorPtr SMDS_MeshNode::elementsIterator(SMDSAbs_ElementType type) const
|
||||
{
|
||||
if ( type == SMDSAbs_Node )
|
||||
return SMDS_MeshElement::elementsIterator( SMDSAbs_Node );
|
||||
else
|
||||
return GetInverseElementIterator( type );
|
||||
}
|
||||
|
||||
int SMDS_MeshNode::NbNodes() const
|
||||
{
|
||||
return 1;
|
||||
@ -275,12 +241,14 @@ double SMDS_MeshNode::Z() const
|
||||
/*!
|
||||
* \brief thread safe getting coords
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void SMDS_MeshNode::GetXYZ(double xyz[3]) const
|
||||
{
|
||||
return SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetPoint(myVtkID,xyz);
|
||||
}
|
||||
|
||||
//* resize the vtkPoints structure every SMDS_Mesh::chunkSize points
|
||||
//================================================================================
|
||||
void SMDS_MeshNode::setXYZ(double x, double y, double z)
|
||||
{
|
||||
SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
|
||||
@ -321,12 +289,6 @@ void SMDS_MeshNode::ClearInverseElements()
|
||||
SMDS_Mesh::_meshList[myMeshId]->getGrid()->ResizeCellList(myVtkID, 0);
|
||||
}
|
||||
|
||||
bool SMDS_MeshNode::emptyInverseElements()
|
||||
{
|
||||
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks()->GetLink(myVtkID);
|
||||
return (l.ncells == 0);
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Count inverse elements of given type
|
||||
@ -335,35 +297,20 @@ bool SMDS_MeshNode::emptyInverseElements()
|
||||
|
||||
int SMDS_MeshNode::NbInverseElements(SMDSAbs_ElementType type) const
|
||||
{
|
||||
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks()->GetLink(myVtkID);
|
||||
|
||||
if ( type == SMDSAbs_All )
|
||||
return l.ncells;
|
||||
|
||||
int nb = 0;
|
||||
SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
|
||||
for (int i=0; i<l.ncells; i++)
|
||||
if ( SMDS_Mesh::_meshList[myMeshId]->NbElements() > 0 ) // avoid building links
|
||||
{
|
||||
const SMDS_MeshElement* elem = mesh->FindElement(mesh->fromVtkToSmds(l.cells[i]));
|
||||
if (elem->GetType() == type)
|
||||
nb++;
|
||||
vtkCellLinks::Link& l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetLinks()->GetLink(myVtkID);
|
||||
|
||||
if ( type == SMDSAbs_All )
|
||||
return l.ncells;
|
||||
|
||||
SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
|
||||
for ( int i = 0; i < l.ncells; i++ )
|
||||
{
|
||||
const SMDS_MeshElement* elem = mesh->FindElement( mesh->fromVtkToSmds( l.cells[i] ));
|
||||
nb += ( elem->GetType() == type );
|
||||
}
|
||||
}
|
||||
return nb;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// To be used with STL set
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2)
|
||||
{
|
||||
return e1.getVtkId()<e2.getVtkId();
|
||||
/*if(e1.myX<e2.myX) return true;
|
||||
else if(e1.myX==e2.myX)
|
||||
{
|
||||
if(e1.myY<e2.myY) return true;
|
||||
else if(e1.myY==e2.myY) return (e1.myZ<e2.myZ);
|
||||
else return false;
|
||||
}
|
||||
else return false;*/
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,6 @@ protected:
|
||||
void AddInverseElement(const SMDS_MeshElement * ME);
|
||||
void RemoveInverseElement(const SMDS_MeshElement * parent);
|
||||
void ClearInverseElements();
|
||||
bool emptyInverseElements();
|
||||
|
||||
SMDS_ElemIteratorPtr
|
||||
elementsIterator(SMDSAbs_ElementType type) const;
|
||||
|
@ -4635,7 +4635,7 @@ namespace { // Structures used by FixQuadraticElements()
|
||||
SMDS_ElemIteratorPtr faceIter( new TIterOnIter( faceIterVec ));
|
||||
|
||||
// a seacher to check if a volume is close to a concave face
|
||||
std::auto_ptr< SMESH_ElementSearcher > faceSearcher
|
||||
SMESHUtils::Deleter< SMESH_ElementSearcher > faceSearcher
|
||||
( SMESH_MeshAlgos::GetElementSearcher( *theHelper.GetMeshDS(), faceIter ));
|
||||
|
||||
// classifier
|
||||
@ -4737,7 +4737,7 @@ namespace { // Structures used by FixQuadraticElements()
|
||||
gp_Pnt pMedium = SMESH_TNodeXYZ( linkIt->second );
|
||||
double hMedium = faceNorm * gp_Vec( pOnFace0, pMedium ).XYZ();
|
||||
double hVol = faceNorm * gp_Vec( pOnFace0, pInSolid ).XYZ();
|
||||
isDistorted = ( Abs( hMedium ) > Abs( hVol * 0.5 ));
|
||||
isDistorted = ( Abs( hMedium ) > Abs( hVol * 0.75 ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -794,7 +794,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
|
||||
double u = epos->GetUParameter();
|
||||
paramNodeMap.insert( make_pair( u, node ));
|
||||
}
|
||||
if ((int) paramNodeMap.size() != eSubMesh->NbNodes() ) {
|
||||
if ((int) paramNodeMap.size() != eSubMesh->NbNodes() - nbMeduimNodes ) {
|
||||
// wrong U on edge, project
|
||||
Extrema_ExtPC proj;
|
||||
BRepAdaptor_Curve aCurve( edge );
|
||||
|
@ -1086,6 +1086,8 @@ void SMESHGUI_ClippingDlg::updateActorList()
|
||||
std::for_each( myPlanes.begin(),myPlanes.end(), TSetVisibility( PreviewCheckBox->isChecked() ) );
|
||||
aPlaneData.Plane.GetPointer()->myActor->SetVisibility( false );
|
||||
|
||||
std::map< std::string, QListWidgetItem* > itemMap; // used to sort items by entry
|
||||
|
||||
VTK::ActorCollectionCopy aCopy( myViewWindow->getRenderer()->GetActors() );
|
||||
vtkActorCollection* anAllActors = aCopy.GetActors();
|
||||
anAllActors->InitTraversal();
|
||||
@ -1111,13 +1113,20 @@ void SMESHGUI_ClippingDlg::updateActorList()
|
||||
if ( !aFatherName.isEmpty() )
|
||||
aName = aFatherName + " / " + aName;
|
||||
aName += QString(" (%1)").arg( aSObj->GetID().c_str() );
|
||||
QListWidgetItem* anItem = new ActorItem( anActor, aName, ActorList );
|
||||
QListWidgetItem* anItem = new ActorItem( anActor, aName, 0 );
|
||||
anItem->setCheckState( anIsChecked ? Qt::Checked : Qt::Unchecked );
|
||||
updateActorItem( anItem, true, false );
|
||||
itemMap.insert( std::make_pair( aSObj->GetID(), anItem ));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
std::map< std::string, QListWidgetItem* >::iterator s2i = itemMap.begin();
|
||||
for ( ; s2i != itemMap.end(); ++s2i )
|
||||
{
|
||||
QListWidgetItem* anItem = s2i->second;
|
||||
ActorList->addItem( anItem );
|
||||
}
|
||||
updateActorItem( 0, true, false );
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1258,16 +1267,19 @@ void SMESHGUI_ClippingDlg::ClickOnNew()
|
||||
SMESH::OrientedPlane* aPlane = SMESH::OrientedPlane::New(myViewWindow);
|
||||
SMESH::TPlane aTPlane(aPlane);
|
||||
aPlane->PlaneMode = CurrentMode;
|
||||
SMESH::TActorList anActorList;
|
||||
SMESH::TActorList anActorList, aVisibleActorList;
|
||||
VTK::ActorCollectionCopy aCopy( myViewWindow->getRenderer()->GetActors() );
|
||||
vtkActorCollection* anAllActors = aCopy.GetActors();
|
||||
anAllActors->InitTraversal();
|
||||
while( vtkActor* aVTKActor = anAllActors->GetNextActor() )
|
||||
if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) )
|
||||
{
|
||||
anActorList.push_back( anActor );
|
||||
|
||||
SMESH::TPlaneData aPlaneData(aTPlane, anActorList);
|
||||
|
||||
if ( anActor->GetVisibility() )
|
||||
aVisibleActorList.push_back( anActor );
|
||||
}
|
||||
SMESH::TPlaneData aPlaneData(aTPlane,
|
||||
aVisibleActorList.empty() ? anActorList : aVisibleActorList);
|
||||
myPlanes.push_back(aPlaneData);
|
||||
|
||||
|
||||
|
@ -203,9 +203,9 @@ QWidget* SMESHGUI_ReorientFacesDlg::createMainFrame (QWidget* theParent)
|
||||
myDY->SetValue(0);
|
||||
myDZ->SetValue(0);
|
||||
|
||||
myDX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
|
||||
myDY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
|
||||
myDZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
|
||||
myDX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 1.0, "length_precision");
|
||||
myDY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 1.0, "length_precision");
|
||||
myDZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 1.0, "length_precision");
|
||||
|
||||
width = Max( aFaceBut->fontMetrics().width( tr("SMESH_X")),
|
||||
aFaceBut->fontMetrics().width( tr("SMESH_DX")));
|
||||
|
@ -1163,8 +1163,8 @@ bool SMESH_MeshAlgos::IsOut( const SMDS_MeshElement* element, const gp_Pnt& poin
|
||||
gp_Vec edge2( xyz[i+1], xyz[(i+2)%nbNodes] );
|
||||
faceNorm += edge1 ^ edge2;
|
||||
}
|
||||
double normSize = faceNorm.Magnitude();
|
||||
if ( normSize <= tol )
|
||||
double fNormSize = faceNorm.Magnitude();
|
||||
if ( fNormSize <= tol )
|
||||
{
|
||||
// degenerated face: point is out if it is out of all face edges
|
||||
for ( i = 0; i < nbNodes; ++i )
|
||||
@ -1175,7 +1175,7 @@ bool SMESH_MeshAlgos::IsOut( const SMDS_MeshElement* element, const gp_Pnt& poin
|
||||
}
|
||||
return true;
|
||||
}
|
||||
faceNorm /= normSize;
|
||||
faceNorm /= fNormSize;
|
||||
|
||||
// check if the point lays on face plane
|
||||
gp_Vec n2p( xyz[0], point );
|
||||
@ -1204,9 +1204,10 @@ bool SMESH_MeshAlgos::IsOut( const SMDS_MeshElement* element, const gp_Pnt& poin
|
||||
// to find intersections of the ray with the boundary.
|
||||
gp_Vec ray = n2p;
|
||||
gp_Vec plnNorm = ray ^ faceNorm;
|
||||
normSize = plnNorm.Magnitude();
|
||||
if ( normSize <= tol ) return false; // point coincides with the first node
|
||||
plnNorm /= normSize;
|
||||
double n2pSize = plnNorm.Magnitude();
|
||||
if ( n2pSize <= tol ) return false; // point coincides with the first node
|
||||
if ( n2pSize * n2pSize > fNormSize * 100 ) return true; // point is very far
|
||||
plnNorm /= n2pSize;
|
||||
// for each node of the face, compute its signed distance to the cutting plane
|
||||
vector<double> dist( nbNodes + 1);
|
||||
for ( i = 0; i < nbNodes; ++i )
|
||||
@ -1252,7 +1253,7 @@ bool SMESH_MeshAlgos::IsOut( const SMDS_MeshElement* element, const gp_Pnt& poin
|
||||
if ( rClosest > 0. && rClosest < 1. ) // not node intersection
|
||||
return out;
|
||||
|
||||
// ray pass through a face node; analyze transition through an adjacent edge
|
||||
// the ray passes through a face node; analyze transition through an adjacent edge
|
||||
gp_Pnt p1 = xyz[ (rClosest == 0.) ? ((iClosest+nbNodes-1) % nbNodes) : (iClosest+1) ];
|
||||
gp_Pnt p2 = xyz[ (rClosest == 0.) ? iClosest : ((iClosest+2) % nbNodes) ];
|
||||
gp_Vec edgeAdjacent( p1, p2 );
|
||||
|
@ -3606,6 +3606,7 @@ class Mesh:
|
||||
# 1 - the medium node lies at the middle of the line segments connecting two nodes of a mesh element
|
||||
# @param theSubMesh a group or a sub-mesh to convert; WARNING: in this case the mesh can become not conformal
|
||||
# @param theToBiQuad If True, converts the mesh to bi-quadratic
|
||||
# @return SMESH.ComputeError which can hold a warning
|
||||
# @ingroup l2_modif_tofromqu
|
||||
def ConvertToQuadratic(self, theForce3d=False, theSubMesh=None, theToBiQuad=False):
|
||||
if isinstance( theSubMesh, Mesh ):
|
||||
@ -3620,6 +3621,7 @@ class Mesh:
|
||||
error = self.editor.GetLastError()
|
||||
if error and error.comment:
|
||||
print error.comment
|
||||
return error
|
||||
|
||||
## Converts the mesh from quadratic to ordinary,
|
||||
# deletes old quadratic elements, \n replacing
|
||||
|
@ -183,7 +183,7 @@ class Mesh_Algorithm:
|
||||
## Private method.
|
||||
def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"):
|
||||
if geom is None and mesh.mesh.HasShapeToMesh():
|
||||
raise RuntimeError, "Attemp to create " + hypo + " algoritm on None shape"
|
||||
raise RuntimeError, "Attemp to create " + hypo + " algorithm on None shape"
|
||||
algo = self.FindAlgorithm(hypo, mesh.smeshpyD)
|
||||
if algo is None:
|
||||
algo = mesh.smeshpyD.CreateHypothesis(hypo, so)
|
||||
@ -195,7 +195,7 @@ class Mesh_Algorithm:
|
||||
def Assign(self, algo, mesh, geom):
|
||||
from salome.smesh.smeshBuilder import AssureGeomPublished, TreatHypoStatus, GetName
|
||||
if geom is None and mesh.mesh.HasShapeToMesh():
|
||||
raise RuntimeError, "Attemp to create " + algo + " algoritm on None shape"
|
||||
raise RuntimeError, "Attemp to create " + algo + " algorithm on None shape"
|
||||
self.mesh = mesh
|
||||
if not geom or geom.IsSame( mesh.geom ):
|
||||
self.geom = mesh.geom
|
||||
|
@ -72,6 +72,10 @@
|
||||
using namespace std;
|
||||
|
||||
#define RETURN_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); return false; }
|
||||
#ifdef _DEBUG_
|
||||
// enable printing algo + projection shapes while meshing
|
||||
//#define PRINT_WHO_COMPUTE_WHAT
|
||||
#endif
|
||||
|
||||
namespace TAssocTool = StdMeshers_ProjectionUtils;
|
||||
//typedef StdMeshers_ProjectionUtils TAssocTool;
|
||||
@ -436,7 +440,11 @@ namespace {
|
||||
if (( err && !err->IsOK() ) ||
|
||||
( srcWires.empty() ))
|
||||
return err;
|
||||
|
||||
#ifdef PRINT_WHO_COMPUTE_WHAT
|
||||
cout << "Projection_2D" << " F "
|
||||
<< tgtMesh->GetMeshDS()->ShapeToIndex( tgtFace ) << " <- "
|
||||
<< srcMesh->GetMeshDS()->ShapeToIndex( srcFace ) << endl;
|
||||
#endif
|
||||
SMESH_MesherHelper srcHelper( *srcMesh );
|
||||
srcHelper.SetSubShape( srcFace );
|
||||
|
||||
@ -492,6 +500,11 @@ namespace {
|
||||
|
||||
for ( int iE = 0; iE < srcWire->NbEdges(); ++iE )
|
||||
{
|
||||
#ifdef PRINT_WHO_COMPUTE_WHAT
|
||||
if ( tgtMesh->GetSubMesh( tgtWire->Edge(iE) )->IsEmpty() )
|
||||
cout << "Projection_2D" << " E "
|
||||
<< tgtWire->EdgeID(iE) << " <- " << srcWire->EdgeID(iE) << endl;
|
||||
#endif
|
||||
if ( srcMesh->GetSubMesh( srcWire->Edge(iE) )->IsEmpty() ||
|
||||
tgtMesh->GetSubMesh( tgtWire->Edge(iE) )->IsEmpty() )
|
||||
{
|
||||
|
@ -485,9 +485,6 @@ static bool HasIntersection3(const gp_Pnt& P, const gp_Pnt& PC, gp_Pnt& Pint,
|
||||
gp_XYZ vert1 = P2.XYZ();
|
||||
gp_XYZ vert2 = P3.XYZ();
|
||||
|
||||
/* calculate distance from vert0 to ray origin */
|
||||
gp_XYZ tvec = orig - vert0;
|
||||
|
||||
gp_XYZ edge1 = vert1 - vert0;
|
||||
gp_XYZ edge2 = vert2 - vert0;
|
||||
|
||||
@ -497,9 +494,13 @@ static bool HasIntersection3(const gp_Pnt& P, const gp_Pnt& PC, gp_Pnt& Pint,
|
||||
/* if determinant is near zero, ray lies in plane of triangle */
|
||||
double det = edge1 * pvec;
|
||||
|
||||
if (det > -EPSILON && det < EPSILON)
|
||||
const double ANGL_EPSILON = 1e-12;
|
||||
if ( det > -ANGL_EPSILON && det < ANGL_EPSILON )
|
||||
return false;
|
||||
|
||||
/* calculate distance from vert0 to ray origin */
|
||||
gp_XYZ tvec = orig - vert0;
|
||||
|
||||
/* calculate U parameter and test bounds */
|
||||
double u = ( tvec * pvec ) / det;
|
||||
//if (u < 0.0 || u > 1.0)
|
||||
|
@ -135,6 +135,10 @@
|
||||
<source>ICON_SMESH_TREE_ALGO_Projection_2D</source>
|
||||
<translation>mesh_tree_algo_projection_2d.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_SMESH_TREE_ALGO_Projection_1D2D</source>
|
||||
<translation>mesh_tree_algo_projection_2d.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_SMESH_TREE_ALGO_Projection_3D</source>
|
||||
<translation>mesh_tree_hypo_projection_3d.png</translation>
|
||||
@ -251,6 +255,10 @@
|
||||
<source>ICON_SMESH_TREE_HYPO_QuadranglePreference</source>
|
||||
<translation>mesh_tree_algo_quad.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_SMESH_TREE_HYPO_QuadrangleParams</source>
|
||||
<translation>mesh_tree_algo_quad.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_SMESH_TREE_HYPO_TrianglePreference</source>
|
||||
<translation>mesh_tree_algo_mefisto.png</translation>
|
||||
|
@ -52,7 +52,6 @@ StdMeshers_AutomaticLength_i::StdMeshers_AutomaticLength_i( PortableServer::POA_
|
||||
: SALOME::GenericObj_i( thePOA ),
|
||||
SMESH_Hypothesis_i( thePOA )
|
||||
{
|
||||
MESSAGE( "StdMeshers_AutomaticLength_i::StdMeshers_AutomaticLength_i" );
|
||||
myBaseImpl = new ::StdMeshers_AutomaticLength( theGenImpl->GetANewId(),
|
||||
theStudyId,
|
||||
theGenImpl );
|
||||
@ -68,7 +67,6 @@ StdMeshers_AutomaticLength_i::StdMeshers_AutomaticLength_i( PortableServer::POA_
|
||||
|
||||
StdMeshers_AutomaticLength_i::~StdMeshers_AutomaticLength_i()
|
||||
{
|
||||
MESSAGE( "StdMeshers_AutomaticLength_i::~StdMeshers_AutomaticLength_i" );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -50,7 +50,6 @@ StdMeshers_SegmentLengthAroundVertex_i::StdMeshers_SegmentLengthAroundVertex_i
|
||||
: SALOME::GenericObj_i( thePOA ),
|
||||
SMESH_Hypothesis_i( thePOA )
|
||||
{
|
||||
MESSAGE( "StdMeshers_SegmentLengthAroundVertex_i::StdMeshers_SegmentLengthAroundVertex_i" );
|
||||
myBaseImpl = new ::StdMeshers_SegmentLengthAroundVertex( theGenImpl->GetANewId(),
|
||||
theStudyId,
|
||||
theGenImpl );
|
||||
@ -66,7 +65,6 @@ StdMeshers_SegmentLengthAroundVertex_i::StdMeshers_SegmentLengthAroundVertex_i
|
||||
|
||||
StdMeshers_SegmentLengthAroundVertex_i::~StdMeshers_SegmentLengthAroundVertex_i()
|
||||
{
|
||||
MESSAGE( "StdMeshers_SegmentLengthAroundVertex_i::~StdMeshers_SegmentLengthAroundVertex_i" );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -80,7 +78,6 @@ StdMeshers_SegmentLengthAroundVertex_i::~StdMeshers_SegmentLengthAroundVertex_i(
|
||||
void StdMeshers_SegmentLengthAroundVertex_i::SetLength( CORBA::Double theLength )
|
||||
throw ( SALOME::SALOME_Exception )
|
||||
{
|
||||
MESSAGE( "StdMeshers_SegmentLengthAroundVertex_i::SetLength" );
|
||||
ASSERT( myBaseImpl );
|
||||
try {
|
||||
this->GetImpl()->SetLength( theLength );
|
||||
@ -103,7 +100,6 @@ void StdMeshers_SegmentLengthAroundVertex_i::SetLength( CORBA::Double theLength
|
||||
|
||||
CORBA::Double StdMeshers_SegmentLengthAroundVertex_i::GetLength()
|
||||
{
|
||||
MESSAGE( "StdMeshers_SegmentLengthAroundVertex_i::GetLength" );
|
||||
ASSERT( myBaseImpl );
|
||||
return this->GetImpl()->GetLength();
|
||||
}
|
||||
@ -118,7 +114,6 @@ CORBA::Double StdMeshers_SegmentLengthAroundVertex_i::GetLength()
|
||||
|
||||
::StdMeshers_SegmentLengthAroundVertex* StdMeshers_SegmentLengthAroundVertex_i::GetImpl()
|
||||
{
|
||||
MESSAGE( "StdMeshers_SegmentLengthAroundVertex_i::GetImpl" );
|
||||
return ( ::StdMeshers_SegmentLengthAroundVertex* )myBaseImpl;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user