Deactivate ID mapping in all DeviceActor's except the pickable one.
The ID mapping needed to show IDs in the Viewer is computed when needed
via VTKViewer_ExtractUnstructuredGrid::BuildOut2InMap()
+ IPAL53796: Clipping related bugs
# create mesh
from SMESH_mechanic import *
-# get number of linear and quadratic edges
-filter_linear = smesh.GetFilter(SMESH.EDGE, SMESH.FT_LinearOrQuadratic)
+
+# get linear and quadratic edges
+filter_linear = smesh.GetFilter(SMESH.EDGE, SMESH.FT_LinearOrQuadratic)
filter_quadratic = smesh.GetFilter(SMESH.EDGE, SMESH.FT_LinearOrQuadratic, SMESH.FT_LogicalNOT)
-ids_linear = mesh.GetIdsFromFilter(filter_linear)
+ids_linear = mesh.GetIdsFromFilter(filter_linear)
ids_quadratic = mesh.GetIdsFromFilter(filter_quadratic)
print "Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic)
+
# convert mesh to quadratic
print "Convert to quadratic..."
-mesh.ConvertToQuadratic(True)
-# get number of linear and quadratic edges
-ids_linear = mesh.GetIdsFromFilter(filter_linear)
+mesh.ConvertToQuadratic()
+
+# get linear and quadratic edges
+ids_linear = mesh.GetIdsFromFilter(filter_linear)
ids_quadratic = mesh.GetIdsFromFilter(filter_quadratic)
print "Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic)
// majoration empirique du nombre de sommets de la triangulation
i = 4*nbarfr/10;
mxsomm = Max( 20000, 64*nbpti+i*i );
- MESSAGE( "APTRTE: Debut de la triangulation plane avec " );
- MESSAGE( "nutysu=" << nutysu << " aretmx=" << aretmx
- << " mxsomm=" << mxsomm );
- MESSAGE( nbarfr << " sommets sur la frontiere et " << nbpti << " points internes");
+ // MESSAGE( "APTRTE: Debut de la triangulation plane avec " );
+ // MESSAGE( "nutysu=" << nutysu << " aretmx=" << aretmx
+ // << " mxsomm=" << mxsomm );
+ // MESSAGE( nbarfr << " sommets sur la frontiere et " << nbpti << " points internes");
NEWDEPART:
//mnpxyd( 3, mxsomm ) les coordonnees UV des sommets et la taille d'arete aux sommets
//fin ajout 9/11/2006 .................................................
- MESSAGE("Sur le bord: arete min=" << aremin << " arete max=" << aremax );
- MESSAGE("Triangulation: arete mx=" << aretmx
- << " triangle aire mx=" << airemx );
+ // MESSAGE("Sur le bord: arete min=" << aremin << " arete max=" << aremax );
+ // MESSAGE("Triangulation: arete mx=" << aretmx
+ // << " triangle aire mx=" << airemx );
//chainage des aretes frontalieres : la derniere arete frontaliere
mnsoar[ mosoar * noar - mosoar + 5 ] = 0;
mxtree = 2 * mxsomm;
NEWTREE: //en cas de saturation de l'un des tableaux, on boucle
- MESSAGE( "Debut triangulation avec mxsomm=" << mxsomm );
+ //MESSAGE( "Debut triangulation avec mxsomm=" << mxsomm );
if( mntree != NULL ) delete [] mntree;
nbsomm = nbarpi;
mntree = new Z[motree*(1+mxtree)];
//saturation de letree => sa taille est augmentee et relance
mxtree = mxtree * 2;
ierr = 0;
- MESSAGE( "Nouvelle valeur de mxtree=" << mxtree );
+ //MESSAGE( "Nouvelle valeur de mxtree=" << mxtree );
goto NEWTREE;
}
deltacpu_( d );
tcpu += d;
- MESSAGE( "Temps de l'ajout arbre-4 des Triangles Equilateraux=" << d << " secondes" );
+ //MESSAGE( "Temps de l'ajout arbre-4 des Triangles Equilateraux=" << d << " secondes" );
if( ierr != 0 ) goto ERREUR;
//ici le tableau mnpxyd contient les sommets des te et les points frontaliers et internes
deltacpu_( d );
tcpu += d;
- MESSAGE("Temps de l'adaptation et l'homogeneisation de l'arbre-4 des TE="
- << d << " secondes");
+ //MESSAGE("Temps de l'adaptation et l'homogeneisation de l'arbre-4 des TE="
+ // << d << " secondes");
if( ierr != 0 )
{
//destruction du tableau auxiliaire et de l'arbre
{
//letree sature
mxtree = mxtree * 2;
- MESSAGE( "Redemarrage avec la valeur de mxtree=" << mxtree );
+ //MESSAGE( "Redemarrage avec la valeur de mxtree=" << mxtree );
ierr = 0;
goto NEWTREE;
}
//Temps calcul
deltacpu_( d );
tcpu += d;
- MESSAGE( "Temps de la triangulation des TE=" << d << " secondes" );
+//MESSAGE( "Temps de la triangulation des TE=" << d << " secondes" );
// ierr =0 si pas d'erreur
// =1 si le tableau mnsoar est sature
mosoar, mxsoar, n1soar, mnsoar, na,
moartr, mxartr, n1artr, mnartr, n );
- MESSAGE( "Nombre d'echanges des diagonales de 2 triangles=" << n );
+//MESSAGE( "Nombre d'echanges des diagonales de 2 triangles=" << n );
deltacpu_( d );
tcpu += d;
- MESSAGE("Temps de la triangulation Delaunay par echange des diagonales="
- << d << " secondes");
+ // MESSAGE("Temps de la triangulation Delaunay par echange des diagonales="
+ // << d << " secondes");
//qualites de la triangulation actuelle
qualitetrte( mnpxyd, mosoar, mxsoar, mnsoar, moartr, mxartr, mnartr,
mxarcf, mn1arcf, mnarcf, mnarcf1, mnarcf2,
n, ierr );
- MESSAGE( "Restauration de " << n << " aretes perdues de la frontiere ierr=" << ierr );
+//MESSAGE( "Restauration de " << n << " aretes perdues de la frontiere ierr=" << ierr );
deltacpu_( d );
tcpu += d;
- MESSAGE("Temps de la recuperation des aretes perdues de la frontiere="
- << d << " secondes");
+//MESSAGE("Temps de la recuperation des aretes perdues de la frontiere="
+// << d << " secondes");
if( ierr != 0 ) goto ERREUR;
deltacpu_( d );
tcpu += d;
- MESSAGE( "Temps de la suppression des triangles externes=" << d << "ierr=" << ierr );
+//MESSAGE( "Temps de la suppression des triangles externes=" << d << "ierr=" << ierr );
if( ierr != 0 ) goto ERREUR;
//qualites de la triangulation actuelle
deltacpu_( d );
tcpu += d;
- MESSAGE( "Temps de l'amelioration de la qualite de la triangulation=" << d );
+//MESSAGE( "Temps de l'amelioration de la qualite de la triangulation=" << d );
if( ierr == -13 ) ierr=0; //6/10/2006 arret de l'amelioration apres boucle infinie dans caetoi
if( ierr != 0 ) goto ERREUR;
}
}
nbt /= nbsttria; //le nombre final de triangles de la surface
- MESSAGE( "APTRTE: Fin de la triangulation plane avec "<<nbst<<" sommets et "
- << nbt << " triangles" );
+ // MESSAGE( "APTRTE: Fin de la triangulation plane avec "<<nbst<<" sommets et "
+ // << nbt << " triangles" );
deltacpu_( d );
tcpu += d;
- MESSAGE( "APTRTE: Temps total de la triangulation plane=" << tcpu << " secondes" );
+ // MESSAGE( "APTRTE: Temps total de la triangulation plane=" << tcpu << " secondes" );
// destruction des tableaux auxiliaires
// ------------------------------------
//les affichages
quamoy /= nbtria;
- MESSAGE("Qualite moyenne=" << quamoy
- << " Qualite minimale=" << quamin
- << " des " << nbtria << " triangles de surface plane totale="
- << aire);
+ // MESSAGE("Qualite moyenne=" << quamoy
+ // << " Qualite minimale=" << quamin
+ // << " des " << nbtria << " triangles de surface plane totale="
+ // << aire);
if( quamin<0.3 )
{
//le numero des 3 sommets du triangle ntqmin de qualite minimale
nusotr(ntqmin, mosoar, mnsoar, moartr, mnartr, nosotr );
- MESSAGE("Triangle de qualite minimale "<<quamin<<" de sommets:"
- <<nosotr[0]<<" "<<nosotr[1]<<" "<<nosotr[2]<<" ");
- for (int i=0;i<3;i++)
- MESSAGE("Sommet "<<nosotr[i]<<": x="<< mnpxyd[nosotr[i]-1].x
- <<" y="<< mnpxyd[nosotr[i]-1].y);
+ // MESSAGE("Triangle de qualite minimale "<<quamin<<" de sommets:"
+ // <<nosotr[0]<<" "<<nosotr[1]<<" "<<nosotr[2]<<" ");
+ // for (int i=0;i<3;i++)
+ // MESSAGE("Sommet "<<nosotr[i]<<": x="<< mnpxyd[nosotr[i]-1].x
+ // <<" y="<< mnpxyd[nosotr[i]-1].y);
}
if( nbtrianeg>0 )
myReversedVProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
my2DActor = SMESH_CellLabelActor::New();
- my2DActor->SetStoreGemetryMapping(true);
+ my2DActor->SetStoreClippingMapping(true);
my2DActor->SetUserMatrix(aMatrix);
my2DActor->PickableOff();
my2DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE);
my3DActor = SMESH_CellLabelActor::New();
- my3DActor->SetStoreGemetryMapping(true);
+ my3DActor->SetStoreClippingMapping(true);
my3DActor->SetUserMatrix(aMatrix);
my3DActor->PickableOff();
my3DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
myEdgeProp->SetLineWidth(aLineWidth);
my1DActor = SMESH_CellLabelActor::New();
- my1DActor->SetStoreGemetryMapping(true);
+ my1DActor->SetStoreClippingMapping(true);
my1DActor->SetUserMatrix(aMatrix);
my1DActor->PickableOff();
my1DActor->SetHighlited(true);
my0DActor = SMESH_CellLabelActor::New();
my0DActor->SetUserMatrix(aMatrix);
- my0DActor->SetStoreGemetryMapping(true);
+ my0DActor->SetStoreClippingMapping(true);
my0DActor->PickableOff();
my0DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
my0DActor->SetVisibility(false);
myBallActor = SMESH_CellLabelActor::New();
myBallActor->SetUserMatrix(aMatrix);
- myBallActor->SetStoreGemetryMapping(true);
+ myBallActor->SetStoreClippingMapping(true);
myBallActor->PickableOff();
myBallActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
myBallActor->SetVisibility(false);
//----------------------------------------------
myBaseActor->SetUserMatrix(aMatrix);
+ myBaseActor->SetStoreIDMapping(true);
+ myBaseActor->SetStoreClippingMapping(true);
myBaseActor->SetStoreGemetryMapping(true);
myBaseActor->GetProperty()->SetOpacity(0.0);
myPickableActor = myBaseActor;
{
myBaseActor->SetUnstructuredGrid( NULL );
myHighlitableActor->SetUnstructuredGrid( NULL );
- // theRenderer->AddActor(this);
- // cout << "SMESH_ActorDef " << this << endl;
}
theRenderer->AddActor(myBaseActor);
theRenderer->AddActor(myNodeExtActor);
{
if(MYDEBUG) MESSAGE("SMESH_ActorDef::Update");
+ myVisualObj->Update();
+
if(GetControlMode() != eNone) {
unsigned long aTime = myTimeStamp->GetMTime();
unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
//
#include "SMESH_CellLabelActor.h"
+#include "SMESH_ExtractGeometry.h"
+
#include <VTKViewer_TransformFilter.h>
#include <VTKViewer_CellCenters.h>
#include <VTKViewer_ExtractUnstructuredGrid.h>
/*!
Constructor.
*/
-SMESH_CellLabelActor::SMESH_CellLabelActor() {
- //Definition of cells numbering pipeline
+SMESH_CellLabelActor::SMESH_CellLabelActor()
+{
+ //Definition of cells numbering pipeline
//---------------------------------------
myCellsNumDataSet = vtkUnstructuredGrid::New();
myClsMaskPoints = vtkMaskPoints::New();
myClsMaskPoints->SetInputConnection(myCellCenters->GetOutputPort());
myClsMaskPoints->SetOnRatio(1);
-
+
myClsSelectVisiblePoints = vtkSelectVisiblePoints::New();
myClsSelectVisiblePoints->SetInputConnection(myClsMaskPoints->GetOutputPort());
myClsSelectVisiblePoints->SelectInvisibleOff();
myClsSelectVisiblePoints->SetTolerance(0.1);
-
+
myClsLabeledDataMapper = vtkLabeledDataMapper::New();
myClsLabeledDataMapper->SetInputConnection(myClsSelectVisiblePoints->GetOutputPort());
myClsLabeledDataMapper->SetLabelFormat("%d");
myClsLabeledDataMapper->SetLabelModeToLabelScalars();
-
+
myClsTextProp = vtkTextProperty::New();
myClsTextProp->SetFontFamilyToTimes();
myClsTextProp->SetFontSize(12);
/*!
Destructor.
*/
-SMESH_CellLabelActor::~SMESH_CellLabelActor() {
+SMESH_CellLabelActor::~SMESH_CellLabelActor()
+{
//Deleting of cells numbering pipeline
//---------------------------------------
myCellsNumDataSet->Delete();
myClsTextProp->SetColor( r, g, b );
}
-void SMESH_CellLabelActor::SetCellsLabeled(bool theIsCellsLabeled) {
+void SMESH_CellLabelActor::SetCellsLabeled(bool theIsCellsLabeled)
+{
myTransformFilter->Update();
vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::SafeDownCast(myTransformFilter->GetOutput());
- if(!aGrid)
+ if ( !aGrid )
return;
myIsCellsLabeled = theIsCellsLabeled && aGrid->GetNumberOfPoints();
- if(myIsCellsLabeled){
+ if ( myIsCellsLabeled )
+ {
myCellsNumDataSet->ShallowCopy(aGrid);
vtkUnstructuredGrid *aDataSet = myCellsNumDataSet;
int aNbElem = aDataSet->GetNumberOfCells();
vtkIntArray *anArray = vtkIntArray::New();
anArray->SetNumberOfValues(aNbElem);
- for(int anId = 0; anId < aNbElem; anId++){
- vtkIdType id = myExtractUnstructuredGrid->GetInputId(anId);
- id = (id >=0) ? id : anId;
+ myExtractUnstructuredGrid->BuildOut2InMap();
+ for(int anId = 0; anId < aNbElem; anId++)
+ {
+ vtkIdType id = anId;
+ if(IsImplicitFunctionUsed())
+ id = myExtractGeometry->GetElemObjId(id);
+ id = myExtractUnstructuredGrid->GetInputId(id);
+ id = (id >=0) ? id : anId;
int aSMDSId = myVisualObj->GetElemObjId(id);
anArray->SetValue(anId,aSMDSId);
}
if(MYDEBUG) MESSAGE("~SMESH_DeviceActor - "<<this);
myMapper->Delete();
- myPlaneCollection->Delete();
+ // myPlaneCollection->Delete(); -- it is vtkSmartPointer
myProperty->Delete();
myExtractGeometry->Delete();
::SetStoreGemetryMapping(bool theStoreMapping)
{
myGeomFilter->SetStoreMapping(theStoreMapping);
- SetStoreClippingMapping(theStoreMapping);
+ // for optimization, switch the mapping explicitly in each filter/algorithm
+ //SetStoreClippingMapping(theStoreMapping);
}
{
myStoreClippingMapping = theStoreMapping;
myExtractGeometry->SetStoreMapping(theStoreMapping && myIsImplicitFunctionUsed);
- SetStoreIDMapping(theStoreMapping);
+ // EAP, 23315
+ // Mapping in myExtractUnstructuredGrid and myGeomFilter is ON in the pickable DeviceActor only.
+ // To show labels, the mapping is computed explicitly via myExtractUnstructuredGrid->BuildOut2InMap();
+ //SetStoreIDMapping(theStoreMapping);
}
if(anIsInitialized){
vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
- SetStoreIDMapping(true);
- myExtractUnstructuredGrid->Update();
+ // SetStoreIDMapping(true);
+ // myExtractUnstructuredGrid->Update();
vtkUnstructuredGrid* aGrid = myExtractUnstructuredGrid->GetOutput();
aDataSet->ShallowCopy(aGrid);
using namespace SMESH::Controls;
if(NumericalFunctor* aNumericalFunctor = dynamic_cast<NumericalFunctor*>(theFunctor.get()))
{
- for(vtkIdType i = 0; i < aNbCells; i++){
+ myExtractUnstructuredGrid->BuildOut2InMap();
+ for(vtkIdType i = 0; i < aNbCells; i++)
+ {
vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
double aValue = aNumericalFunctor->GetValue(anObjId);
}
else if(Predicate* aPredicate = dynamic_cast<Predicate*>(theFunctor.get()))
{
- for(vtkIdType i = 0; i < aNbCells; i++){
+ myExtractUnstructuredGrid->BuildOut2InMap();
+ for(vtkIdType i = 0; i < aNbCells; i++)
+ {
vtkIdType anId = myExtractUnstructuredGrid->GetInputId(i);
vtkIdType anObjId = myVisualObj->GetElemObjId(anId);
bool aValue = aPredicate->IsSatisfy(anObjId);
void SMDS_Mesh::Clear()
{
if (myParent!=NULL)
- {
+ {
SMDS_ElemIteratorPtr eIt = elementsIterator();
while ( eIt->more() )
- {
- const SMDS_MeshElement *elem = eIt->next();
- myElementIDFactory->ReleaseID(elem->GetID(), elem->getVtkId());
- }
+ {
+ const SMDS_MeshElement *elem = eIt->next();
+ myElementIDFactory->ReleaseID(elem->GetID(), elem->getVtkId());
+ }
SMDS_NodeIteratorPtr itn = nodesIterator();
while (itn->more())
- {
- const SMDS_MeshNode *node = itn->next();
- myNodeIDFactory->ReleaseID(node->GetID(), node->getVtkId());
- }
+ {
+ const SMDS_MeshNode *node = itn->next();
+ myNodeIDFactory->ReleaseID(node->GetID(), node->getVtkId());
}
+ }
else
- {
+ {
myNodeIDFactory->Clear();
myElementIDFactory->Clear();
- }
+ }
- // SMDS_ElemIteratorPtr itv = elementsIterator();
- // while (itv->more())
- // {
- // SMDS_MeshElement* elem = (SMDS_MeshElement*)(itv->next());
- // SMDSAbs_ElementType aType = elem->GetType();
- // switch (aType)
- // {
- // case SMDSAbs_0DElement:
- // delete elem;
- // break;
- // case SMDSAbs_Edge:
- // myEdgePool->destroy(static_cast<SMDS_VtkEdge*>(elem));
- // break;
- // case SMDSAbs_Face:
- // myFacePool->destroy(static_cast<SMDS_VtkFace*>(elem));
- // break;
- // case SMDSAbs_Volume:
- // myVolumePool->destroy(static_cast<SMDS_VtkVolume*>(elem));
- // break;
- // case SMDSAbs_Ball:
- // myBallPool->destroy(static_cast<SMDS_BallElement*>(elem));
- // break;
- // default:
- // break;
- // }
- // }
myVolumePool->clear();
myFacePool->clear();
myEdgePool->clear();
SMDS_NodeIteratorPtr itn = nodesIterator();
while (itn->more())
- {
- SMDS_MeshNode *node = (SMDS_MeshNode*)(itn->next());
- node->SetPosition(SMDS_SpacePosition::originSpacePosition());
- //myNodePool->destroy(node);
- }
+ {
+ SMDS_MeshNode *node = (SMDS_MeshNode*)(itn->next());
+ node->SetPosition(SMDS_SpacePosition::originSpacePosition());
+ //myNodePool->destroy(node);
+ }
myNodePool->clear();
clearVector( myNodes );
// rnv: to fix bug "21125: EDF 1233 SMESH: Degrardation of precision in a test case for quadratic conversion"
// using double type for storing coordinates of nodes instead float.
points->SetDataType(VTK_DOUBLE);
- points->SetNumberOfPoints(0 /*SMDS_Mesh::chunkSize*/);
+ points->SetNumberOfPoints( 0 );
myGrid->SetPoints( points );
points->Delete();
myGrid->DeleteLinks();
///////////////////////////////////////////////////////////////////////////////
bool SMDS_Mesh::hasConstructionEdges()
{
- return myHasConstructionEdges;
+ return myHasConstructionEdges;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
bool SMDS_Mesh::hasConstructionFaces()
{
- return myHasConstructionFaces;
+ return myHasConstructionFaces;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
bool SMDS_Mesh::hasInverseElements()
{
- return myHasInverseElements;
+ return myHasInverseElements;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void SMDS_Mesh::setConstructionEdges(bool b)
{
- myHasConstructionEdges=b;
+ myHasConstructionEdges=b;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void SMDS_Mesh::setConstructionFaces(bool b)
{
- myHasConstructionFaces=b;
+ myHasConstructionFaces=b;
}
///////////////////////////////////////////////////////////////////////////////
sm->ComputeSubMeshStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
}
}
+ GetMeshDS()->Modified();
_isModified = false;
}
catch(SALOME_Exception & S_ex) {
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
}
- _impl->GetMeshDS()->Modified();
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".Clear()";
}
return self.mesh.GetElementShape(id)
## Returns the list of submesh elements IDs
- # @param Shape a geom object(sub-shape) IOR
+ # @param Shape a geom object(sub-shape)
# Shape must be the sub-shape of a ShapeToMesh()
# @return the list of integer values
# @ingroup l1_meshinfo
return self.mesh.GetSubMeshElementsId(ShapeID)
## Returns the list of submesh nodes IDs
- # @param Shape a geom object(sub-shape) IOR
+ # @param Shape a geom object(sub-shape)
# Shape must be the sub-shape of a ShapeToMesh()
# @param all If true, gives all nodes of submesh elements, otherwise gives only submesh nodes
# @return the list of integer values
return self.mesh.GetSubMeshNodesId(ShapeID, all)
## Returns type of elements on given shape
- # @param Shape a geom object(sub-shape) IOR
+ # @param Shape a geom object(sub-shape)
# Shape must be a sub-shape of a ShapeToMesh()
# @return element type
# @ingroup l1_meshinfo