myLocalGrid = false;
if (!GetMesh()->isCompacted())
{
+ NulData(); // detach from the SMDS grid to allow immediate memory de-allocation in compactMesh()
if ( MYDEBUG ) MESSAGE("*** buildPrs ==> compactMesh!");
GetMesh()->compactMesh();
}
{
if ( !myLocalGrid && !GetMesh()->isCompacted() )
{
+ NulData(); // detach from the SMDS grid to allow immediate memory de-allocation in compactMesh()
GetMesh()->compactMesh();
updateEntitiesFlags();
vtkUnstructuredGrid *theGrid = GetMesh()->getGrid();
newPoints->SetDataType(VTK_DOUBLE);
newPoints->SetNumberOfPoints(newNodeSize);
if (newNodeSize)
- {
- // rnv: to fix bug "21125: EDF 1233 SMESH: Degradation of precision in a test case for quadratic conversion"
- // using double type for storing coordinates of nodes instead float.
- int oldNodeSize = idNodesOldToNew.size();
+ {
+ // rnv: to fix bug "21125: EDF 1233 SMESH: Degradation of precision in a test case for quadratic conversion"
+ // using double type for storing coordinates of nodes instead float.
+ int oldNodeSize = idNodesOldToNew.size();
- int i = 0;
- while ( i < oldNodeSize )
- {
- // skip a hole if any
- while ( i < oldNodeSize && idNodesOldToNew[i] < 0 )
- ++i;
- int startBloc = i;
- // look for a block end
- while ( i < oldNodeSize && idNodesOldToNew[i] >= 0 )
- ++i;
- int endBloc = i;
- copyNodes(newPoints, idNodesOldToNew, alreadyCopied, startBloc, endBloc);
- }
- newPoints->Squeeze();
+ int i = 0;
+ while ( i < oldNodeSize )
+ {
+ // skip a hole if any
+ while ( i < oldNodeSize && idNodesOldToNew[i] < 0 )
+ ++i;
+ int startBloc = i;
+ // look for a block end
+ while ( i < oldNodeSize && idNodesOldToNew[i] >= 0 )
+ ++i;
+ int endBloc = i;
+ copyNodes(newPoints, idNodesOldToNew, alreadyCopied, startBloc, endBloc);
}
+ newPoints->Squeeze();
+ }
+
+ if (1/*newNodeSize*/)
+ {
+ this->SetPoints(newPoints);
+ }
+ newPoints->Delete();
+
// --- create new compacted Connectivity, Locations and Types
}
newConnectivity->Squeeze();
- if (1/*newNodeSize*/)
- {
- this->SetPoints(newPoints);
- }
-
if (vtkDoubleArray* diameters =
vtkDoubleArray::SafeDownCast( vtkDataSet::CellData->GetScalars() )) // Balls
{
this->SetCells(newTypes, newLocations, newConnectivity, FaceLocations, Faces);
}
- newPoints->Delete();
newTypes->Delete();
newLocations->Delete();
newConnectivity->Delete();
fToler2 = BRep_Tool::Tolerance( face );
fToler2 *= fToler2 * 10.;
isUPeriodic = surface->IsUPeriodic();
- if ( isUPeriodic )
- surface->UPeriod();
+ // if ( isUPeriodic )
+ // surface->UPeriod();
isVPeriodic = surface->IsVPeriodic();
- if ( isVPeriodic )
- surface->VPeriod();
+ // if ( isVPeriodic )
+ // surface->VPeriod();
surface->Bounds( u1, u2, v1, v2 );
helper.SetSubShape( face );
}
{
// check if all faces around the node are on faceSubMesh
// because a node on edge may be bound to face
- SMDS_ElemIteratorPtr eIt = node->GetInverseElementIterator(SMDSAbs_Face);
bool all = true;
if ( faceSubMesh ) {
+ SMDS_ElemIteratorPtr eIt = node->GetInverseElementIterator(SMDSAbs_Face);
while ( eIt->more() && all ) {
const SMDS_MeshElement* e = eIt->next();
all = faceSubMesh->Contains( e );
//=======================================================================
int SMESHDS_Mesh::ShapeToIndex(const TopoDS_Shape & S) const
{
- if (myShape.IsNull())
- MESSAGE("myShape is NULL");
-
int index = myIndexToShape.FindIndex(S);
-
return index;
}
aSel->selectedObjects( selected );
if ( selected.Extent() >= 1 ) {
+ SUIT_OverrideCursor wc;
SALOME_ListIteratorOfListIO It( selected );
for( ; It.More(); It.Next()){
Handle(SALOME_InteractiveObject) IObject = It.Value();
return;
} // case SMESHOp::OpProperties:
} // switch(theCommandID)
+ SUIT_OverrideCursor wc;
SALOME_ListIteratorOfListIO It( selected );
for( ; It.More(); It.Next()){
Handle(SALOME_InteractiveObject) IObject = It.Value();
case SMESHOp::OpOrientationOnFaces:
{
+ SUIT_OverrideCursor wc;
LightApp_SelectionMgr* mgr = selectionMgr();
SALOME_ListIO selected; mgr->selectedObjects( selected );
{
return _src2tgtNodes;
}
+ void SetEventListener( SMESH_subMesh* tgtSubMesh )
+ {
+ NSProjUtils::SetEventListener( tgtSubMesh,
+ _sourceHypo->GetSourceFace(),
+ _sourceHypo->GetSourceMesh() );
+ }
};
//=======================================================================
/*!
Handle(Geom_Surface) surface = BRep_Tool::Surface( topFace, loc );
bool isPlanar = GeomLib_IsPlanarSurface( surface ).IsPlanar();
- bool isFixed = false;
set<const SMDS_MeshNode*> fixedNodes;
- for ( int iAttemp = 0; !isFixed && iAttemp < 10; ++iAttemp )
- {
- TIDSortedElemSet faces;
- for ( faceIt = topSMDS->GetElements(); faceIt->more(); )
- faces.insert( faces.end(), faceIt->next() );
+ TIDSortedElemSet faces;
+ for ( faceIt = topSMDS->GetElements(); faceIt->more(); )
+ faces.insert( faces.end(), faceIt->next() );
+ bool isOk = false;
+ for ( int isCentroidal = 0; isCentroidal < 2; ++isCentroidal )
+ {
SMESH_MeshEditor::SmoothMethod algo =
- iAttemp ? SMESH_MeshEditor::CENTROIDAL : SMESH_MeshEditor::LAPLACIAN;
+ isCentroidal ? SMESH_MeshEditor::CENTROIDAL : SMESH_MeshEditor::LAPLACIAN;
+
+ int nbAttempts = isCentroidal ? 1 : 10;
+ for ( int iAttemp = 0; iAttemp < nbAttempts; ++iAttemp )
+ {
+ TIDSortedElemSet workFaces = faces;
- // smoothing
- editor.Smooth( faces, fixedNodes, algo, /*nbIterations=*/ 10,
- /*theTgtAspectRatio=*/1.0, /*the2D=*/!isPlanar);
+ // smoothing
+ editor.Smooth( workFaces, fixedNodes, algo, /*nbIterations=*/ 10,
+ /*theTgtAspectRatio=*/1.0, /*the2D=*/!isPlanar);
- isFixed = !topHelper.IsDistorted2D( topSM, /*checkUV=*/true );
+ if (( isOk = !topHelper.IsDistorted2D( topSM, /*checkUV=*/true )) &&
+ ( !isCentroidal ))
+ break;
+ }
}
- if ( !isFixed )
+ if ( !isOk )
return toSM( error( TCom("Projection from face #") << botSM->GetId()
<< " to face #" << topSM->GetId()
<< " failed: inverted elements created"));
}
+ TProjction2dAlgo::instance( this )->SetEventListener( topSM );
+
return true;
}
tgtSM->ComputeStateEngine ( SMESH_subMesh::CHECK_COMPUTE_STATE );
tgtSM->ComputeSubMeshStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
+ projector2D->SetEventListener( tgtSM );
+
return ok;
}