updating or adding when merging with the main trunk version !!

This commit is contained in:
nadir 2003-12-08 14:30:11 +00:00
parent 253e7b1764
commit a8d551aae8
16 changed files with 357 additions and 251 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 792 B

View File

@ -1,3 +1,28 @@
c MEFISTO : library to compute 2D triangulation from segmented boundaries
c
c Copyright (C) 2003 Laboratoire J.-L. Lions UPMC Paris
c
c This library is free software; you can redistribute it and/or
c modify it under the terms of the GNU Lesser General Public
c License as published by the Free Software Foundation; either
c version 2.1 of the License.
c
c This library is distributed in the hope that it will be useful,
c but WITHOUT ANY WARRANTY; without even the implied warranty of
c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c Lesser General Public License for more details.
c
c You should have received a copy of the GNU Lesser General Public
c License along with this library; if not, write to the Free Software
c Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
c
c See http://www.ann.jussieu.fr/~perronne or email Perronnet@ann.jussieu.fr
c
c
c File : areteideale.f
c Module : SMESH
c Author: Alain PERRONNET
double precision function areteideale( xyz, direction ) double precision function areteideale( xyz, direction )
double precision xyz(3), direction(3) double precision xyz(3), direction(3)
areteideale = 10 areteideale = 10

View File

@ -1,3 +1,28 @@
c MEFISTO : library to compute 2D triangulation from segmented boundaries
c
c Copyright (C) 2003 Laboratoire J.-L. Lions UPMC Paris
c
c This library is free software; you can redistribute it and/or
c modify it under the terms of the GNU Lesser General Public
c License as published by the Free Software Foundation; either
c version 2.1 of the License.
c
c This library is distributed in the hope that it will be useful,
c but WITHOUT ANY WARRANTY; without even the implied warranty of
c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c Lesser General Public License for more details.
c
c You should have received a copy of the GNU Lesser General Public
c License along with this library; if not, write to the Free Software
c Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
c
c See http://www.ann.jussieu.fr/~perronne or email Perronnet@ann.jussieu.fr
c
c
c File : trte.f
c Module : SMESH
c Author: Alain PERRONNET
subroutine qutr2d( p1, p2, p3, qualite ) subroutine qutr2d( p1, p2, p3, qualite )
c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
c but : calculer la qualite d'un triangle de r**2 c but : calculer la qualite d'un triangle de r**2
@ -2957,7 +2982,6 @@ c une arete de sommet ns
if( narete .le. 0 ) then if( narete .le. 0 ) then
c erreur: le point appartient a aucune arete c erreur: le point appartient a aucune arete
write(imprim,*) 'sommet ',ns,' dans aucune arete' write(imprim,*) 'sommet ',ns,' dans aucune arete'
pause
ierr = 11 ierr = 11
return return
endif endif
@ -4369,7 +4393,6 @@ c ----------------------------------
c c
else if( nbar .le. 2 ) then else if( nbar .le. 2 ) then
write(imprim,*) 'erreur trchtd: cf<3 aretes' write(imprim,*) 'erreur trchtd: cf<3 aretes'
pause
namin = 0 namin = 0
namin0 = 0 namin0 = 0
return return
@ -5447,7 +5470,6 @@ c l'arete appartient a 2 triangles differents de nt0
c anomalie. chainage des triangles des aretes defectueux c anomalie. chainage des triangles des aretes defectueux
c a corriger c a corriger
write(imprim,*) 'pause dans tridcf' write(imprim,*) 'pause dans tridcf'
pause
ierr = 5 ierr = 5
return return
endif endif
@ -5983,7 +6005,6 @@ c recherche du numero de l'arete noaret dans le triangle nt1
10 continue 10 continue
c impossible d'arriver ici sans bogue! c impossible d'arriver ici sans bogue!
write(imprim,*) 'pause dans te2t2t 1' write(imprim,*) 'pause dans te2t2t 1'
pause
c c
c l'arete de sommets 2 et 3 c l'arete de sommets 2 et 3
15 if( n1 .lt. 3 ) then 15 if( n1 .lt. 3 ) then
@ -6008,7 +6029,6 @@ c recherche du numero de l'arete noaret dans le triangle nt2
20 continue 20 continue
c impossible d'arriver ici sans bogue! c impossible d'arriver ici sans bogue!
write(imprim,*) 'pause dans te2t2t 2' write(imprim,*) 'pause dans te2t2t 2'
pause
c c
c l'arete de sommets 1 et 4 c l'arete de sommets 1 et 4
25 if( n1 .lt. 3 ) then 25 if( n1 .lt. 3 ) then
@ -7078,7 +7098,6 @@ c
c c
c erreur: le point np n'est pas dans l'un des nbtr triangles c erreur: le point np n'est pas dans l'un des nbtr triangles
write(imprim,10010) np write(imprim,10010) np
pause
ierr = 3 ierr = 3
return return
c c
@ -7165,7 +7184,6 @@ c l'arete noar n'a pas ete retrouvee dans le chainage => erreur
% ' st2=',nosoar(2,noar),' ligne=',nosoar(3,noar), % ' st2=',nosoar(2,noar),' ligne=',nosoar(3,noar),
% ' tr1=',nosoar(4,noar),' tr2=',nosoar(5,noar) % ' tr1=',nosoar(4,noar),' tr2=',nosoar(5,noar)
write(imprim,*) 'chainages=',(nosoar(i,noar),i=6,mosoar) write(imprim,*) 'chainages=',(nosoar(i,noar),i=6,mosoar)
pause
c l'arete n'est pas detruite c l'arete n'est pas detruite
return return
c c
@ -7802,7 +7820,6 @@ c les sens ns1->ns2 et ns2->ns1 ne donne pas de solution!
write(imprim,*)'tefoar:arete ',ns1,' - ',ns2,' a imposer' write(imprim,*)'tefoar:arete ',ns1,' - ',ns2,' a imposer'
write(imprim,*)'tefoar:anomalie sommet ',ns1, write(imprim,*)'tefoar:anomalie sommet ',ns1,
% 'non dans le triangle de sommets ',(nosotr(i),i=1,3) % 'non dans le triangle de sommets ',(nosotr(i),i=1,3)
pause
ierr = 11 ierr = 11
return return
endif endif
@ -7934,7 +7951,6 @@ c ici le sommet nsp est trop proche de l'arete perdue ns1-ns2
c point utilisateur ou frontalier non supprimable c point utilisateur ou frontalier non supprimable
ierr = 11 ierr = 11
write(imprim,*) 'pause dans tefoar 1', d, d3, d4, d12 write(imprim,*) 'pause dans tefoar 1', d, d3, d4, d12
pause
return return
endif endif
c c
@ -7958,7 +7974,6 @@ ccc % ncroug, ncblan )
ccc tratri = .false. ccc tratri = .false.
ierr = 11 ierr = 11
write(imprim,*) 'pause dans tefoar 2' write(imprim,*) 'pause dans tefoar 2'
pause
return return
endif endif
c c
@ -8030,7 +8045,6 @@ c redemarrage avec le triangle nt0 et l'arete na0
c c
write(imprim,*) 'tefoar: algorithme defaillant' write(imprim,*) 'tefoar: algorithme defaillant'
ierr = 11 ierr = 11
pause
return return
endif endif
50 continue 50 continue
@ -8042,7 +8056,6 @@ c rotation autour du sommet par l'arete suivant na1
write(imprim,*) 'les lignes fermees doivent etre disjointes' write(imprim,*) 'les lignes fermees doivent etre disjointes'
write(imprim,*) 'verifiez si elles ne se coupent pas' write(imprim,*) 'verifiez si elles ne se coupent pas'
ierr = 13 ierr = 13
pause
return return
c c
c cas sans probleme : intersection differente de celle initiale c cas sans probleme : intersection differente de celle initiale

View File

@ -72,6 +72,8 @@ SMESH_Actor::SMESH_Actor()
EdgeShrinkDevice->VisibilityOff(); EdgeShrinkDevice->VisibilityOff();
EdgeShrinkDevice->PickableOff(); EdgeShrinkDevice->PickableOff();
DataSource = NULL;
myIO = NULL; myIO = NULL;
myName = ""; myName = "";
myDisplayMode = 0; myDisplayMode = 0;

View File

@ -214,7 +214,7 @@ SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n3, const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4) const SMDS_MeshNode * n4)
{ {
return AddFaceWithID(n1,n2,n3, myElementIDFactory->GetFreeID()); return AddFaceWithID(n1,n2,n3, n4, myElementIDFactory->GetFreeID());
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -731,11 +731,7 @@ SMDS_MeshFace * SMDS_Mesh::createQuadrangle(SMDS_MeshNode * node1,
void SMDS_Mesh::RemoveNode(const SMDS_MeshNode * node) void SMDS_Mesh::RemoveNode(const SMDS_MeshNode * node)
{ {
SMDS_Iterator<const SMDS_MeshElement *> * it= RemoveElement(node, true);
node->GetInverseElementIterator();
while(it->more()) RemoveElement(it->next(),true);
myNodeIDFactory->ReleaseID(node->GetID());
myNodes.erase(const_cast<SMDS_MeshNode*>(node));
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -744,10 +740,7 @@ void SMDS_Mesh::RemoveNode(const SMDS_MeshNode * node)
void SMDS_Mesh::RemoveEdge(const SMDS_MeshEdge * edge) void SMDS_Mesh::RemoveEdge(const SMDS_MeshEdge * edge)
{ {
/** @todo to be fix */ RemoveElement(edge,true);
myEdges.erase(const_cast<SMDS_MeshEdge*>(edge));
//removeElementDependencies(edge);
delete edge;
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -756,10 +749,7 @@ void SMDS_Mesh::RemoveEdge(const SMDS_MeshEdge * edge)
void SMDS_Mesh::RemoveFace(const SMDS_MeshFace * face) void SMDS_Mesh::RemoveFace(const SMDS_MeshFace * face)
{ {
/** @todo to be fix */ RemoveElement(face, true);
myFaces.erase(const_cast<SMDS_MeshFace*>(face));
//removeElementDependencies(face);
delete face;
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -768,64 +758,7 @@ void SMDS_Mesh::RemoveFace(const SMDS_MeshFace * face)
void SMDS_Mesh::RemoveVolume(const SMDS_MeshVolume * volume) void SMDS_Mesh::RemoveVolume(const SMDS_MeshVolume * volume)
{ {
/** @todo to be fix */ RemoveElement(volume, true);
myVolumes.erase(const_cast<SMDS_MeshVolume*>(volume));
//removeElementDependencies(volume);
delete volume;
}
///////////////////////////////////////////////////////////////////////////////
/// Remove no longer used sub element of an element. Unbind the element ID
///////////////////////////////////////////////////////////////////////////////
void SMDS_Mesh::removeElementDependencies(SMDS_MeshElement * element)
{
/** @todo to be fix */
myElementIDFactory->ReleaseID(element->GetID());
SMDS_Iterator<const SMDS_MeshElement*> * it=element->nodesIterator();
while(it->more())
{
SMDS_MeshNode * node=static_cast<SMDS_MeshNode*>(
const_cast<SMDS_MeshElement*>(it->next()));
node->RemoveInverseElement(element);
if(node->emptyInverseElements()) RemoveNode(node);
}
}
//=======================================================================
//function : RemoveElement
//purpose :
//=======================================================================
void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
const bool removenodes)
{
/** @todo to be fix */
switch(elem->GetType())
{
case SMDSAbs_Node:
RemoveNode((const SMDS_MeshNode*)elem);
return;
case SMDSAbs_Edge:
RemoveEdge((const SMDS_MeshEdge*)elem);
break;
case SMDSAbs_Face:
RemoveFace((const SMDS_MeshFace*)elem);
break;
case SMDSAbs_Volume:
RemoveVolume((const SMDS_MeshVolume*)elem);
break;
default :
MESSAGE("remove function : unknown type");
return;
}
/*
SMDS_Iterator<const SMDS_MeshNode*> * it=elem->nodesIterator();
while(it->more())
{
const SMDS_MeshNode * node=it->next();
}*/
} }
//======================================================================= //=======================================================================
@ -1440,3 +1373,201 @@ SMDS_Iterator<const SMDS_MeshVolume *> * SMDS_Mesh::volumesIterator() const
return new MyIterator(myVolumes); return new MyIterator(myVolumes);
} }
///////////////////////////////////////////////////////////////////////////////
/// Do intersection of sets (more than 2)
///////////////////////////////////////////////////////////////////////////////
set<const SMDS_MeshElement*> * intersectionOfSets(
set<const SMDS_MeshElement*> vs[], int numberOfSets)
{
set<const SMDS_MeshElement*>* rsetA=new set<const SMDS_MeshElement*>(vs[0]);
set<const SMDS_MeshElement*>* rsetB;
for(int i=0; i<numberOfSets-1; i++)
{
rsetB=new set<const SMDS_MeshElement*>();
set_intersection(
rsetA->begin(), rsetA->end(),
vs[i+1].begin(), vs[i+1].end(),
inserter(*rsetB, rsetB->begin()));
delete rsetA;
rsetA=rsetB;
}
return rsetA;
}
///////////////////////////////////////////////////////////////////////////////
/// Return the list of finit elements owning the given element
///////////////////////////////////////////////////////////////////////////////
set<const SMDS_MeshElement*> * getFinitElements(const SMDS_MeshElement * element)
{
int numberOfSets=element->NbNodes();
set<const SMDS_MeshElement*> initSet[numberOfSets];
SMDS_Iterator<const SMDS_MeshElement*> * itNodes=element->nodesIterator();
int i=0;
while(itNodes->more())
{
const SMDS_MeshNode * n=static_cast<const SMDS_MeshNode*>(itNodes->next());
SMDS_Iterator<const SMDS_MeshElement*> * itFe = n->GetInverseElementIterator();
//initSet[i]=set<const SMDS_MeshElement*>();
while(itFe->more()) initSet[i].insert(itFe->next());
i++;
delete itFe;
}
delete itNodes;
return intersectionOfSets(initSet, numberOfSets);
}
///////////////////////////////////////////////////////////////////////////////
/// Return the list of nodes used only by the given elements
///////////////////////////////////////////////////////////////////////////////
set<const SMDS_MeshElement*> * getExclusiveNodes(
set<const SMDS_MeshElement*>& elements)
{
set<const SMDS_MeshElement*> * toReturn=new set<const SMDS_MeshElement*>();
set<const SMDS_MeshElement*>::iterator itElements=elements.begin();
while(itElements!=elements.end())
{
SMDS_Iterator<const SMDS_MeshElement*> * itNodes=
(*itElements)->nodesIterator();
itElements++;
while(itNodes->more())
{
const SMDS_MeshNode * n=static_cast<const SMDS_MeshNode*>(itNodes->next());
SMDS_Iterator<const SMDS_MeshElement*> * itFe = n->GetInverseElementIterator();
set<const SMDS_MeshElement*> s;
while(itFe->more()) s.insert(itFe->next());
delete itFe;
if(s==elements) toReturn->insert(n);
}
delete itNodes;
}
return toReturn;
}
///////////////////////////////////////////////////////////////////////////////
///Find the children of an element that are made of given nodes
///@param setOfChildren The set in which matching children will be inserted
///@param element The element were to search matching children
///@param nodes The nodes that the children must have to be selected
///////////////////////////////////////////////////////////////////////////////
void SMDS_Mesh::addChildrenWithNodes(set<const SMDS_MeshElement*>& setOfChildren,
const SMDS_MeshElement * element, set<const SMDS_MeshElement*>& nodes)
{
switch(element->GetType())
{
case SMDSAbs_Node:
MESSAGE("Internal Error: This should not append");
break;
case SMDSAbs_Edge:
{
SMDS_Iterator<const SMDS_MeshElement*> * itn=element->nodesIterator();
while(itn->more())
{
const SMDS_MeshElement * e=itn->next();
if(nodes.find(e)!=nodes.end()) setOfChildren.insert(element);
}
delete itn;
} break;
case SMDSAbs_Face:
{
SMDS_Iterator<const SMDS_MeshElement*> * itn=element->nodesIterator();
while(itn->more())
{
const SMDS_MeshElement * e=itn->next();
if(nodes.find(e)!=nodes.end()) setOfChildren.insert(element);
}
delete itn;
if(hasConstructionEdges())
{
SMDS_Iterator<const SMDS_MeshElement*>* ite=element->edgesIterator();
while(ite->more())
addChildrenWithNodes(setOfChildren, ite->next(), nodes);
delete ite;
}
} break;
case SMDSAbs_Volume:
{
if(hasConstructionFaces())
{
SMDS_Iterator<const SMDS_MeshElement*> * ite=element->facesIterator();
while(ite->more())
addChildrenWithNodes(setOfChildren, ite->next(), nodes);
delete ite;
}
else if(hasConstructionEdges())
{
SMDS_Iterator<const SMDS_MeshElement*> * ite=element->edgesIterator();
while(ite->more())
addChildrenWithNodes(setOfChildren, ite->next(), nodes);
delete ite;
}
}
}
}
///////////////////////////////////////////////////////////////////////////////
///@param elem The element to delete
///@param removenodes if true remaining nodes will be removed
///////////////////////////////////////////////////////////////////////////////
void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
const bool removenodes)
{
set<const SMDS_MeshElement*> * s1=getFinitElements(elem);
set<const SMDS_MeshElement*> * s2=getExclusiveNodes(*s1);
set<const SMDS_MeshElement*> s3;
set<const SMDS_MeshElement*>::iterator it=s1->begin();
while(it!=s1->end())
{
addChildrenWithNodes(s3, *it ,*s2);
s3.insert(*it);
it++;
}
if(elem->GetType()!=SMDSAbs_Node) s3.insert(elem);
it=s3.begin();
while(it!=s3.end())
{
switch((*it)->GetType())
{
case SMDSAbs_Node:
MESSAGE("Internal Error: This should not happen");
break;
case SMDSAbs_Edge:
myEdges.erase(static_cast<SMDS_MeshEdge*>(
const_cast<SMDS_MeshElement*>(*it)));
break;
case SMDSAbs_Face:
myFaces.erase(static_cast<SMDS_MeshFace*>(
const_cast<SMDS_MeshElement*>(*it)));
break;
case SMDSAbs_Volume:
myVolumes.erase(static_cast<SMDS_MeshVolume*>(
const_cast<SMDS_MeshElement*>(*it)));
break;
}
delete (*it);
it++;
}
if(removenodes)
{
it=s2->begin();
while(it!=s2->end())
{
myNodes.erase(static_cast<SMDS_MeshNode*>(
const_cast<SMDS_MeshElement*>(*it)));
delete *it;
it++;
}
}
delete s2;
delete s1;
}

View File

@ -190,7 +190,6 @@ class SMDS_Mesh:public SMDS_MeshObject
SMDS_MeshNode * node2, SMDS_MeshNode * node3); SMDS_MeshNode * node2, SMDS_MeshNode * node3);
SMDS_MeshFace * createQuadrangle(SMDS_MeshNode * node1, SMDS_MeshFace * createQuadrangle(SMDS_MeshNode * node1,
SMDS_MeshNode * node2, SMDS_MeshNode * node3, SMDS_MeshNode * node4); SMDS_MeshNode * node2, SMDS_MeshNode * node3, SMDS_MeshNode * node4);
void removeElementDependencies(SMDS_MeshElement * element);
const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1, const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2) const; const SMDS_MeshNode * n2) const;
SMDS_MeshEdge* FindEdgeOrCreate(const SMDS_MeshNode * n1, SMDS_MeshEdge* FindEdgeOrCreate(const SMDS_MeshNode * n1,
@ -209,6 +208,8 @@ class SMDS_Mesh:public SMDS_MeshObject
const SMDS_MeshNode *n2, const SMDS_MeshNode *n2,
const SMDS_MeshNode *n3, const SMDS_MeshNode *n3,
const SMDS_MeshNode *n4); const SMDS_MeshNode *n4);
void addChildrenWithNodes(set<const SMDS_MeshElement*>& setOfChildren,
const SMDS_MeshElement * element, set<const SMDS_MeshElement*>& nodes);
// Fields PRIVATE // Fields PRIVATE
typedef set<SMDS_MeshNode *> SetOfNodes; typedef set<SMDS_MeshNode *> SetOfNodes;

View File

@ -130,6 +130,7 @@ using namespace std;
#include "VTKViewer_ViewFrame.h" #include "VTKViewer_ViewFrame.h"
#include <vtkLegendBoxActor.h> #include <vtkLegendBoxActor.h>
#include <vtkFeatureEdges.h> #include <vtkFeatureEdges.h>
#include <vtkDoubleArray.h>
// Open CASCADE Includes // Open CASCADE Includes
@ -400,6 +401,7 @@ void SMESHGUI::activeStudyChanged( QAD_Desktop* parent )
bool SMESHGUI::DefineDlgPosition(QWidget* aDlg, int& x, int& y) bool SMESHGUI::DefineDlgPosition(QWidget* aDlg, int& x, int& y)
{ {
/* Here the position is on the bottom right corner - 10 */ /* Here the position is on the bottom right corner - 10 */
aDlg->resize(QSize().expandedTo(aDlg->minimumSizeHint()));
QAD_Desktop* PP = QAD_Application::getDesktop() ; QAD_Desktop* PP = QAD_Application::getDesktop() ;
x = abs ( PP->x() + PP->size().width() - aDlg->size().width() - 10 ) ; x = abs ( PP->x() + PP->size().width() - aDlg->size().width() - 10 ) ;
y = abs ( PP->y() + PP->size().height() - aDlg->size().height() - 10 ) ; y = abs ( PP->y() + PP->size().height() - aDlg->size().height() - 10 ) ;
@ -1318,8 +1320,10 @@ void SMESHGUI::ChangeRepresentation( SMESH_Actor* ac, int type )
case 0 : { case 0 : {
QApplication::setOverrideCursor( Qt::waitCursor ); QApplication::setOverrideCursor( Qt::waitCursor );
if (ac->getDisplayMode()==2) { if (ac->getDisplayMode()==2) {
bool isColored = ac->getMapper()->GetScalarVisibility(); //SAL3899
vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper()); vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper());
meshMapper->SetInput(ac->DataSource); meshMapper->SetInput(ac->DataSource);
meshMapper->SetScalarVisibility(isColored); //SAL3899
} }
ac->setDisplayMode(0); ac->setDisplayMode(0);
ac->GetProperty()->SetRepresentationToWireframe(); ac->GetProperty()->SetRepresentationToWireframe();
@ -1330,8 +1334,10 @@ void SMESHGUI::ChangeRepresentation( SMESH_Actor* ac, int type )
case 1 : { case 1 : {
QApplication::setOverrideCursor( Qt::waitCursor ); QApplication::setOverrideCursor( Qt::waitCursor );
if (ac->getDisplayMode()==2) { if (ac->getDisplayMode()==2) {
bool isColored = ac->getMapper()->GetScalarVisibility(); //SAL3899
vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper()); vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper());
meshMapper->SetInput(ac->DataSource); meshMapper->SetInput(ac->DataSource);
meshMapper->SetScalarVisibility(isColored); //SAL3899
} }
ac->setDisplayMode(1); ac->setDisplayMode(1);
ac->GetProperty()->SetRepresentationToSurface(); ac->GetProperty()->SetRepresentationToSurface();
@ -1344,13 +1350,14 @@ void SMESHGUI::ChangeRepresentation( SMESH_Actor* ac, int type )
// ChangeRepresentation(ac, 1); // ChangeRepresentation(ac, 1);
QApplication::setOverrideCursor( Qt::waitCursor ); QApplication::setOverrideCursor( Qt::waitCursor );
ac->setDisplayMode(2); ac->setDisplayMode(2);
bool isColored = ac->getMapper()->GetScalarVisibility(); //SAL3899
vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper()); vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper());
meshMapper->SetInput(ac->DataSource);
vtkShrinkFilter *shrink = vtkShrinkFilter::New(); vtkShrinkFilter *shrink = vtkShrinkFilter::New();
shrink->SetInput(meshMapper->GetInput()); shrink->SetInput(ac->DataSource);
shrink->SetShrinkFactor(ac->GetShrinkFactor()); shrink->SetShrinkFactor(ac->GetShrinkFactor());
meshMapper->SetInput( shrink->GetOutput() ); meshMapper->SetInput( shrink->GetOutput() );
meshMapper->SetScalarVisibility(isColored); //SAL3899
ac->SetMapper( meshMapper ); ac->SetMapper( meshMapper );
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
// } // }
@ -1436,6 +1443,7 @@ void SMESHGUI::ChangeRepresentation( SMESH_Actor* ac, int type )
ac->SetNodeSize(aDlg->GetIntValue(2)) ; ac->SetNodeSize(aDlg->GetIntValue(2)) ;
if (ac->getDisplayMode()==2) { if (ac->getDisplayMode()==2) {
bool isColored = ac->getMapper()->GetScalarVisibility(); //SAL3899
vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper()); vtkDataSetMapper* meshMapper = (vtkDataSetMapper*) (ac->getMapper());
meshMapper->SetInput(ac->DataSource); meshMapper->SetInput(ac->DataSource);
vtkShrinkFilter *shrink = vtkShrinkFilter::New(); vtkShrinkFilter *shrink = vtkShrinkFilter::New();
@ -1443,6 +1451,7 @@ void SMESHGUI::ChangeRepresentation( SMESH_Actor* ac, int type )
shrink->SetShrinkFactor(ac->GetShrinkFactor()); shrink->SetShrinkFactor(ac->GetShrinkFactor());
meshMapper->SetInput( shrink->GetOutput() ); meshMapper->SetInput( shrink->GetOutput() );
meshMapper->SetScalarVisibility(isColored); //SAL3899
ac->SetMapper( meshMapper ); ac->SetMapper( meshMapper );
} }
} }
@ -2505,12 +2514,12 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
} }
case 5020: case 5020:
{ {
smeshGUI->CreateAlgorithm("Hexa_3D","Hexahedral (i,j,k)"); smeshGUI->CreateAlgorithm("Hexa_3D","Hexahedron (i,j,k)");
break; break;
} }
case 5021: case 5021:
{ {
smeshGUI->CreateAlgorithm("NETGEN_3D","Tetrahedral (Netgen)"); smeshGUI->CreateAlgorithm("NETGEN_3D","Tetrahedron (Netgen)");
break; break;
} }
@ -4558,9 +4567,7 @@ void SMESHGUI::Control(int theCommandID)
QApplication::setOverrideCursor( Qt::waitCursor ); QApplication::setOverrideCursor( Qt::waitCursor );
DisplayScalarBar( false ); DisplayScalarBar( false );
// mpv porting vtk 4.2.2 vtkDoubleArray *scalars = vtkDoubleArray::New();
// vtkScalars *scalars = vtkScalars::New();
vtkIntArray *scalars = vtkIntArray::New();
scalars->SetNumberOfComponents(1); scalars->SetNumberOfComponents(1);
vtkDataSetMapper* meshMapper = 0; vtkDataSetMapper* meshMapper = 0;
@ -4576,140 +4583,60 @@ void SMESHGUI::Control(int theCommandID)
return; return;
} }
bool ValidateScalars = false; vtkDataSet* aDataSet = MeshActor->DataSource;
if ( result ) { typedef double (*TScalarFun)(vtkCell* theCell);
TScalarFun aScalarFun;
if(result){
QString type; QString type;
switch (theCommandID) switch (theCommandID){
{ case 6001: {
case 6001: //Length Edges type = tr( "SMESH_CONTROL_LENGTH_EDGES");
{ aDataSet = MeshActor->EdgeDevice->GetMapper()->GetInput();
type = tr( "SMESH_CONTROL_LENGTH_EDGES"); aScalarFun = &(SMESHGUI_ComputeScalarValue::LengthEdges);
meshMapper = (vtkDataSetMapper*)MeshActor->EdgeDevice->GetMapper(); MESSAGE ( " init minimum length " << aDataSet->GetNumberOfCells() );
vtkUnstructuredGrid* grid = (vtkUnstructuredGrid*)meshMapper->GetInput(); if(MeshActor->getDisplayMode() != 0)
MESSAGE ( " init minimum length " << grid->GetNumberOfCells() ) ChangeRepresentation( MeshActor, 1);// limitation; in Wireframe, colored edges are not visible
for (int i=0; i<grid->GetNumberOfCells(); i++ ) { break;
vtkCell* cell = grid->GetCell(i); }
float len = SMESHGUI_ComputeScalarValue::LengthEdges(cell); case 6011: {
if (len == 0) continue; type = tr( "SMESH_CONTROL_AREA_ELEMENTS");
else { aScalarFun = &(SMESHGUI_ComputeScalarValue::AreaElements);
ValidateScalars = true; if(MeshActor->getDisplayMode() != 1)
// mpv porting vtk 4.2.2 ChangeRepresentation( MeshActor, 1 );
// scalars->InsertScalar(i,len); break;
scalars->InsertTuple1(i,len);
}
}
if (ValidateScalars && (MeshActor->getDisplayMode()!=0))
ChangeRepresentation( MeshActor, 1 );// limitation; in Wireframe, colored edges are not visible
break;
}
case 6011: // Area Elements
{
type = tr( "SMESH_CONTROL_AREA_ELEMENTS");
for (int i=0; i< MeshActor->GetMapper()->GetInput()->GetNumberOfCells(); i++ ) {
vtkCell* cell = MeshActor->GetMapper()->GetInput()->GetCell(i);
float area = SMESHGUI_ComputeScalarValue::AreaElements(cell);
if (area == 0) continue;
else {
ValidateScalars = true;
// mpv porting vtk 4.2.2
// scalars->InsertScalar(i,area);
scalars->InsertTuple1(i,area);
}
}
if (ValidateScalars && (MeshActor->getDisplayMode()!=1))
ChangeRepresentation( MeshActor, 1 );
break;
}
case 6012: // Taper
{
type = tr( "SMESH_CONTROL_TAPER_ELEMENTS");
for (int i=0; i< MeshActor->DataSource->GetNumberOfCells(); i++ ) {
vtkCell* cell = MeshActor->DataSource->GetCell(i);
float taper = SMESHGUI_ComputeScalarValue::Taper(cell);
if (taper == 0) continue;
else {
ValidateScalars = true;
// mpv porting vtk 4.2.2
// scalars->InsertScalar(i,taper);
scalars->InsertTuple1(i,taper);
}
}
break;
}
case 6013: // Aspect ratio
{
type = tr( "SMESH_CONTROL_ASPECTRATIO_ELEMENTS");
for (int i=0; i<MeshActor->DataSource->GetNumberOfCells(); i++ ) {
vtkCell* cell = MeshActor->DataSource->GetCell(i);
float aspect = SMESHGUI_ComputeScalarValue::AspectRatio(cell);
if (aspect == 0) continue;
else {
ValidateScalars = true;
// mpv porting vtk 4.2.2
// scalars->InsertScalar(i,aspect);
scalars->InsertTuple1(i,aspect);
}
}
if (ValidateScalars && (MeshActor->getDisplayMode()!=1))
ChangeRepresentation( MeshActor, 1 );
break;
}
case 6014: // Minimum angle
{
type = tr( "SMESH_CONTROL_MINIMUMANGLE_ELEMENTS");
for (int i=0; i<MeshActor->DataSource->GetNumberOfCells(); i++ ) {
vtkCell* cell = MeshActor->DataSource->GetCell(i);
float angle = SMESHGUI_ComputeScalarValue::MinimumAngle(cell);
if (angle == 0) continue;
else {
ValidateScalars = true;
// mpv porting vtk 4.2.2
// scalars->InsertScalar(i,angle);
scalars->InsertTuple1(i,angle);
}
}
if (ValidateScalars && (MeshActor->getDisplayMode()!=1))
ChangeRepresentation( MeshActor, 1 );
break;
}
case 6015: // Warp
{
type = tr( "SMESH_CONTROL_WARP_ELEMENTS");
for (int i=0; i<MeshActor->DataSource->GetNumberOfCells(); i++ ) {
vtkCell* cell = MeshActor->DataSource->GetCell(i);
float Warp = SMESHGUI_ComputeScalarValue::Warp(cell);
if (Warp == 0) continue;
else {
ValidateScalars = true;
// mpv porting vtk 4.2.2
// scalars->InsertScalar(i,Warp);
scalars->InsertTuple1(i,Warp);
}
}
break;
}
case 6016: // Skew
{
type = tr( "SMESH_CONTROL_SKEW_ELEMENTS");
for (int i=0; i<MeshActor->DataSource->GetNumberOfCells(); i++ ) {
vtkCell* cell = MeshActor->DataSource->GetCell(i);
float angle = SMESHGUI_ComputeScalarValue::Skew(cell);
if (angle == 0) continue;
else {
ValidateScalars = true;
// mpv porting vtk 4.2.2
// scalars->InsertScalar(i,angle);
scalars->InsertTuple1(i,angle);
}
}
break;
}
}
if ( !ValidateScalars ) {
QApplication::restoreOverrideCursor();
return;
} }
case 6012: {
type = tr( "SMESH_CONTROL_TAPER_ELEMENTS");
aScalarFun = &(SMESHGUI_ComputeScalarValue::Taper);
break;
}
case 6013: {
type = tr( "SMESH_CONTROL_ASPECTRATIO_ELEMENTS");
aScalarFun = &(SMESHGUI_ComputeScalarValue::AspectRatio);
if(MeshActor->getDisplayMode() != 1)
ChangeRepresentation( MeshActor, 1 );
break;
}
case 6014: {
type = tr( "SMESH_CONTROL_MINIMUMANGLE_ELEMENTS");
aScalarFun = &(SMESHGUI_ComputeScalarValue::MinimumAngle);
if(MeshActor->getDisplayMode() != 1)
ChangeRepresentation( MeshActor, 1 );
break;
}
case 6015: {
type = tr( "SMESH_CONTROL_WARP_ELEMENTS");
aScalarFun = &(SMESHGUI_ComputeScalarValue::Warp);
break;
}
case 6016: {
type = tr( "SMESH_CONTROL_SKEW_ELEMENTS");
aScalarFun = &(SMESHGUI_ComputeScalarValue::Skew);
break;
}}
for(int i = 0, iEnd = aDataSet->GetNumberOfCells(); i < iEnd; i++)
scalars->InsertTuple1(i,aScalarFun(aDataSet->GetCell(i)));
float range[2]; float range[2];
scalars->GetRange(range); scalars->GetRange(range);
@ -4722,7 +4649,7 @@ void SMESHGUI::Control(int theCommandID)
if (!meshMapper) meshMapper = (vtkDataSetMapper*) (MeshActor->getMapper()); if (!meshMapper) meshMapper = (vtkDataSetMapper*) (MeshActor->getMapper());
meshMapper->SetScalarModeToUseCellData(); meshMapper->SetScalarModeToUseCellData();
meshMapper->GetInput()->GetCellData()->SetScalars(scalars); MeshActor->DataSource->GetCellData()->SetScalars(scalars);
meshMapper->SetScalarRange( range ); meshMapper->SetScalarRange( range );
meshMapper->ScalarVisibilityOn(); meshMapper->ScalarVisibilityOn();

View File

@ -298,5 +298,3 @@ SALOME_MED::string_array* SMESH_MEDFamily_i::getGroupsNames()
THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
return NULL; return NULL;
} }

View File

@ -62,7 +62,6 @@ public :
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
CORBA::Long getNumberOfAttributes() CORBA::Long getNumberOfAttributes()
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
// Engines::long_array* getAttributesIdentifiers()
SALOME_MED::long_array* getAttributesIdentifiers() SALOME_MED::long_array* getAttributesIdentifiers()
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
CORBA::Long getAttributeIdentifier(CORBA::Long i) CORBA::Long getAttributeIdentifier(CORBA::Long i)
@ -80,6 +79,6 @@ public :
char * getGroupName( CORBA::Long i) char * getGroupName( CORBA::Long i)
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
SALOME_MED::string_array* getGroupsNames() SALOME_MED::string_array* getGroupsNames()
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
}; };
#endif /* MED_FAMILY_I_HXX_ */ #endif /* MED_FAMILY_I_HXX_ */

View File

@ -489,7 +489,7 @@ CORBA::Long SMESH_MEDMesh_i::getNumberOfElements(SALOME_MED::
} }
catch(...) catch(...)
{ {
MESSAGE("Exception en accedant au nombre d élements"); MESSAGE("Exception en accedant au nombre d élements");
THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
SALOME::INTERNAL_ERROR); SALOME::INTERNAL_ERROR);
} }
@ -547,10 +547,11 @@ SMESH_MEDMesh_i::getConnectivityIndex(SALOME_MED::medConnectivity mode,
* CORBA: Find an element corresponding to the given connectivity * CORBA: Find an element corresponding to the given connectivity
*/ */
//============================================================================= //=============================================================================
CORBA::Long SMESH_MEDMesh_i::getElementNumber(SALOME_MED::medConnectivity mode, CORBA::Long
SALOME_MED::medEntityMesh entity, SMESH_MEDMesh_i::getElementNumber(SALOME_MED::medConnectivity mode,
SALOME_MED::medGeometryElement type, SALOME_MED::medEntityMesh entity,
const SALOME_MED::long_array & connectivity) SALOME_MED::medGeometryElement type,
const SALOME_MED::long_array & connectivity)
throw(SALOME::SALOME_Exception) throw(SALOME::SALOME_Exception)
{ {
const char *LOC = "getElementNumber "; const char *LOC = "getElementNumber ";
@ -1053,7 +1054,7 @@ void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
SCRUTE(index); SCRUTE(index);
// Traitement de la face // Traitement de la face
// Attention La numérotation des noeuds Med commence a 1 // Attention La numérotation des noeuds Med commence a 1
int longueur = _seq_elemId[index]->length(); int longueur = _seq_elemId[index]->length();
_seq_elemId[index]->length(longueur + nb_of_nodes); _seq_elemId[index]->length(longueur + nb_of_nodes);

View File

@ -88,17 +88,18 @@ class SMESH_MEDMesh_i:
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
char *getCoordinatesSystem() throw(SALOME::SALOME_Exception); char *getCoordinatesSystem() throw(SALOME::SALOME_Exception);
SALOME_MED::double_array * getCoordinates(SALOME_MED::medModeSwitch typeSwitch)
throw(SALOME::SALOME_Exception);
CORBA::Double getCoordinate(CORBA::Long Number, CORBA::Long Axis) CORBA::Double getCoordinate(CORBA::Long Number, CORBA::Long Axis)
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
SALOME_MED::double_array * getCoordinates(SALOME_MED::medModeSwitch typeSwitch)
throw(SALOME::SALOME_Exception);
SALOME_MED::string_array * getCoordinatesNames() SALOME_MED::string_array * getCoordinatesNames()
throw(SALOME::SALOME_Exception); throw(SALOME::SALOME_Exception);
SALOME_MED::string_array * getCoordinatesUnits() SALOME_MED::string_array * getCoordinatesUnits()
throw(SALOME::SALOME_Exception); throw(SALOME::SALOME_Exception);
CORBA::Long getNumberOfNodes() throw(SALOME::SALOME_Exception); CORBA::Long getNumberOfNodes() throw(SALOME::SALOME_Exception);
@ -114,7 +115,7 @@ class SMESH_MEDMesh_i:
CORBA::Long number) CORBA::Long number)
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
CORBA::Long getNumberOfElements(SALOME_MED::medEntityMesh entity, CORBA::Long getNumberOfElements(SALOME_MED::medEntityMesh entity,
SALOME_MED::medGeometryElement geomElement) SALOME_MED::medGeometryElement geomElement)
throw(SALOME::SALOME_Exception); throw(SALOME::SALOME_Exception);
@ -141,8 +142,8 @@ class SMESH_MEDMesh_i:
throw(SALOME::SALOME_Exception); throw(SALOME::SALOME_Exception);
SALOME_MED::long_array * SALOME_MED::long_array *
getReverseConnectivity(SALOME_MED::medConnectivity mode) throw(SALOME:: getReverseConnectivity(SALOME_MED::medConnectivity mode)
SALOME_Exception); throw(SALOME::SALOME_Exception);
SALOME_MED::long_array * SALOME_MED::long_array *
getReverseConnectivityIndex(SALOME_MED:: getReverseConnectivityIndex(SALOME_MED::
@ -155,13 +156,12 @@ class SMESH_MEDMesh_i:
CORBA::Long getNumberOfGroups(SALOME_MED::medEntityMesh entity) CORBA::Long getNumberOfGroups(SALOME_MED::medEntityMesh entity)
throw(SALOME::SALOME_Exception); throw(SALOME::SALOME_Exception);
SALOME_MED::Family_array * SALOME_MED::Family_array *
getFamilies(SALOME_MED::medEntityMesh entity) getFamilies(SALOME_MED::medEntityMesh entity)
throw(SALOME::SALOME_Exception); throw(SALOME::SALOME_Exception);
SALOME_MED::FAMILY_ptr SALOME_MED::FAMILY_ptr getFamily(SALOME_MED::medEntityMesh entity,
getFamily(SALOME_MED::medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception);
CORBA::Long i) throw(SALOME::SALOME_Exception);
SALOME_MED::Group_array * getGroups(SALOME_MED::medEntityMesh entity) SALOME_MED::Group_array * getGroups(SALOME_MED::medEntityMesh entity)
throw(SALOME::SALOME_Exception); throw(SALOME::SALOME_Exception);

View File

@ -329,6 +329,7 @@ SALOME_MED::long_array * SMESH_MEDSupport_i::getNumber(
* CORBA: ?????????????????????????????? * CORBA: ??????????????????????????????
*/ */
//============================================================================= //=============================================================================
SALOME_MED::long_array * SALOME_MED::long_array *
SMESH_MEDSupport_i::getNumberIndex()throw(SALOME::SALOME_Exception) SMESH_MEDSupport_i::getNumberIndex()throw(SALOME::SALOME_Exception)
{ {
@ -341,6 +342,7 @@ SALOME_MED::long_array *
* CORBA: Array containing indexes for elements included in the support * CORBA: Array containing indexes for elements included in the support
*/ */
//============================================================================= //=============================================================================
CORBA::Long SMESH_MEDSupport_i::getNumberOfGaussPoint(SALOME_MED:: CORBA::Long SMESH_MEDSupport_i::getNumberOfGaussPoint(SALOME_MED::
medGeometryElement geomElement) throw(SALOME::SALOME_Exception) medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
{ {

View File

@ -56,9 +56,12 @@ class SMESH_MEDSupport_i:
SALOME_MED::MESH_ptr getMesh() throw(SALOME::SALOME_Exception); SALOME_MED::MESH_ptr getMesh() throw(SALOME::SALOME_Exception);
CORBA::Boolean isOnAllElements() throw(SALOME::SALOME_Exception); CORBA::Boolean isOnAllElements() throw(SALOME::SALOME_Exception);
SALOME_MED::medEntityMesh getEntity() throw(SALOME::SALOME_Exception); SALOME_MED::medEntityMesh getEntity() throw(SALOME::SALOME_Exception);
CORBA::Long getNumberOfElements(SALOME_MED::medGeometryElement geomElement) CORBA::Long
throw(SALOME::SALOME_Exception); getNumberOfElements(SALOME_MED::medGeometryElement geomElement)
throw(SALOME::SALOME_Exception);
CORBA::Long getNumberOfTypes() throw (SALOME::SALOME_Exception); CORBA::Long getNumberOfTypes() throw (SALOME::SALOME_Exception);
SALOME_MED::long_array * SALOME_MED::long_array *
getNumber(SALOME_MED::medGeometryElement geomElement) getNumber(SALOME_MED::medGeometryElement geomElement)
throw(SALOME::SALOME_Exception); throw(SALOME::SALOME_Exception);
@ -66,19 +69,23 @@ class SMESH_MEDSupport_i:
SALOME_MED::long_array * getNumberIndex() SALOME_MED::long_array * getNumberIndex()
throw(SALOME::SALOME_Exception); throw(SALOME::SALOME_Exception);
CORBA::Long getNumberOfGaussPoint(SALOME_MED:: CORBA::Long
medGeometryElement geomElement) throw(SALOME::SALOME_Exception); getNumberOfGaussPoint(SALOME_MED::medGeometryElement geomElement)
throw(SALOME::SALOME_Exception);
SALOME_MED::long_array* getNumbersOfGaussPoint() SALOME_MED::long_array* getNumbersOfGaussPoint()
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
SALOME_MED::medGeometryElement_array * SALOME_MED::medGeometryElement_array *getTypes()
getTypes() throw(SALOME::SALOME_Exception); throw(SALOME::SALOME_Exception);
void getBoundaryElements() throw (SALOME::SALOME_Exception); void getBoundaryElements() throw (SALOME::SALOME_Exception);
CORBA::Long getCorbaIndex() throw(SALOME::SALOME_Exception); CORBA::Long getCorbaIndex() throw(SALOME::SALOME_Exception);
SALOME_MED::SUPPORT::supportInfos * getSupportGlobal() SALOME_MED::SUPPORT::supportInfos * getSupportGlobal()
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
void createSeq() throw(SALOME::SALOME_Exception); void createSeq() throw(SALOME::SALOME_Exception);
public: //public field public: //public field