NPAL16198: EDF462: Submeshes creation duplicate algorithms and hypotheses. Refix.

This commit is contained in:
jfa 2007-12-27 09:37:46 +00:00
parent 32032d4d58
commit 415771a7d5
15 changed files with 564 additions and 544 deletions

View File

@ -43,6 +43,35 @@ module SMESH
interface FilterManager;
interface SMESH_Pattern;
/*!
* Tags definition
*/
// Top level
const long Tag_HypothesisRoot = 1; // hypotheses root
const long Tag_AlgorithmsRoot = 2; // algorithms root
const long Tag_FirstMeshRoot = 3; // first mesh root
// Mesh/Submesh
const long Tag_RefOnShape = 1; // references to shape
const long Tag_RefOnAppliedHypothesis = 2; // applied hypotheses root
const long Tag_RefOnAppliedAlgorithms = 3; // applied algorithms root
// Mesh only: sub-meshes roots by type
const long Tag_FirstSubMesh = 4;
const long Tag_SubMeshOnVertex = 4;
const long Tag_SubMeshOnEdge = 5;
const long Tag_SubMeshOnWire = 6;
const long Tag_SubMeshOnFace = 7;
const long Tag_SubMeshOnShell = 8;
const long Tag_SubMeshOnSolid = 9;
const long Tag_SubMeshOnCompound = 10;
const long Tag_LastSubMesh = 10;
// Mesh only: group roots by type
const long Tag_FirstGroup = 11;
const long Tag_NodeGroups = 11;
const long Tag_EdgeGroups = 12;
const long Tag_FaceGroups = 13;
const long Tag_VolumeGroups = 14;
const long Tag_LastGroup = 14;
/*!
* Hypothesis definintion error
*/
@ -246,6 +275,12 @@ module SMESH
in double theMergeTolerance)
raises ( SALOME::SALOME_Exception );
/*!
* \brief Return id of object, registered in current study context
*
* Can be used to check if the object was created in the same container, as this engine.
*/
long GetObjectId(in Object theObject);
};
};

View File

@ -71,8 +71,8 @@ using namespace std;
*/
//=============================================================================
SMESH_Algo::SMESH_Algo(int hypId, int studyId,
SMESH_Gen * gen):SMESH_Hypothesis(hypId, studyId, gen)
SMESH_Algo::SMESH_Algo (int hypId, int studyId, SMESH_Gen * gen)
: SMESH_Hypothesis(hypId, studyId, gen)
{
gen->_mapAlgo[hypId] = this;

View File

@ -149,6 +149,7 @@ bool SMESHDS_GroupBase::Contains (const SMDS_MeshElement* elem)
{
if ( elem )
return Contains( elem->GetID() );
return false;
}
//=======================================================================

View File

@ -48,14 +48,15 @@ dist_libSMESHFiltersSelection_la_SOURCES = \
# additionnal information to compil and link file
libSMESHFiltersSelection_la_CPPFLAGS = \
$(KERNEL_CXXFLAGS) \
$(GUI_CXXFLAGS) \
$(GEOM_CXXFLAGS) \
$(CAS_CPPFLAGS) \
$(QT_INCLUDES) \
$(PYTHON_INCLUDES) \
$(VTK_INCLUDES) \
${BOOST_CPPFLAGS} \
$(KERNEL_CXXFLAGS) \
$(GUI_CXXFLAGS) \
$(GEOM_CXXFLAGS) \
$(MED_CXXFLAGS) \
$(BOOST_CPPFLAGS) \
$(CORBA_CXXFLAGS) \
$(CORBA_INCLUDES) \
-I$(top_builddir)/idl \

View File

@ -17,6 +17,7 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SMESH_TypeFilter.hxx"
#include <SUIT_Session.h>
@ -24,6 +25,9 @@
#include <SalomeApp_Study.h>
#include <LightApp_DataOwner.h>
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SMESH_Gen)
SMESH_TypeFilter::SMESH_TypeFilter (MeshObjectType theType)
{
myType = theType;
@ -83,78 +87,86 @@ bool SMESH_TypeFilter::isOk (const SUIT_DataOwner* theDataOwner) const
{
case HYPOTHESIS:
{
if ( aLevel == 2 && ( objFather->Tag() == 1 )) // hypo definition
if (aLevel == 2 && (objFather->Tag() == SMESH::Tag_HypothesisRoot))
// hypo definition
Ok = true;
else if ( aLevel == 3 && ( objFather->Tag() == 2 )) // applied global hypo
else if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_RefOnAppliedHypothesis))
// applied global hypo
Ok = true;
else if ( aLevel == 5 && ( objFather->Tag() == 2 )) // applied local hypo
else if (aLevel == 5 && (objFather->Tag() == SMESH::Tag_RefOnAppliedHypothesis))
// applied local hypo
Ok = true;
break;
}
case ALGORITHM:
{
if ( aLevel == 2 && ( objFather->Tag() == 2 )) // algo definition
if (aLevel == 2 && (objFather->Tag() == SMESH::Tag_AlgorithmsRoot))
// algo definition
Ok = true;
else if ( aLevel == 3 && ( objFather->Tag() == 3 )) // applied global algo
else if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_RefOnAppliedAlgorithms))
// applied global algo
Ok = true;
else if ( aLevel == 5 && ( objFather->Tag() == 3 )) // applied local algo
else if (aLevel == 5 && (objFather->Tag() == SMESH::Tag_RefOnAppliedAlgorithms))
// applied local algo
Ok = true;
break;
}
case MESH:
{
if ( aLevel == 1 && ( obj->Tag() >= 3 ))
if (aLevel == 1 && (obj->Tag() >= SMESH::Tag_FirstMeshRoot))
Ok = true;
break;
}
case SUBMESH:
{
// see SMESH_Gen_i.cxx for tag numbers
if ( aLevel == 3 && ( objFather->Tag() >= 4 && objFather->Tag() <= 10 ))
if (aLevel == 3 && (objFather->Tag() >= SMESH::Tag_FirstSubMesh &&
objFather->Tag() <= SMESH::Tag_LastSubMesh))
Ok = true;
break;
}
case MESHorSUBMESH:
{
if ( aLevel == 1 && ( obj->Tag() >= 3 ))
if (aLevel == 1 && (obj->Tag() >= SMESH::Tag_FirstMeshRoot))
Ok = true; // mesh
else if ( aLevel == 3 && ( objFather->Tag() >= 4 && objFather->Tag() <= 10 ))
else if (aLevel == 3 && (objFather->Tag() >= SMESH::Tag_FirstSubMesh &&
objFather->Tag() <= SMESH::Tag_LastSubMesh))
Ok = true;
break;
}
case SUBMESH_VERTEX: // Label "SubMeshes on vertexes"
{
if ( aLevel == 3 && ( objFather->Tag() == 4 ))
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnVertex))
Ok = true;
break;
}
case SUBMESH_EDGE:
{
if ( aLevel == 3 && ( objFather->Tag() == 5 ))
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnEdge))
Ok = true;
break;
}
case SUBMESH_FACE:
{
if ( aLevel == 3 && ( objFather->Tag() == 7 ))
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnFace))
Ok = true;
break;
}
case SUBMESH_SOLID:
{
if ( aLevel == 3 && ( objFather->Tag() == 9 ))
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnSolid))
Ok = true;
break;
}
case SUBMESH_COMPOUND:
{
if ( aLevel == 3 && ( objFather->Tag() == 10 ))
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnCompound))
Ok = true;
break;
}
case GROUP:
{
if ( aLevel == 3 && ( objFather->Tag() > 10 ))
if (aLevel == 3 && (objFather->Tag() >= SMESH::Tag_FirstGroup))
Ok = true;
break;
}

View File

@ -44,6 +44,8 @@
#include "SMESH_TypeFilter.hxx"
#include "SMESH_NumberFilter.hxx"
#include CORBA_CLIENT_HEADER(SMESH_Gen)
#include "GEOM_SelectionFilter.h"
#include "GEOMBase.h"
#include "GeometryGUI.h"
@ -72,18 +74,6 @@
#include <TopoDS_Shape.hxx>
#include <TopExp_Explorer.hxx>
enum { GLOBAL_ALGO_TAG =3,
GLOBAL_HYPO_TAG =2,
LOCAL_ALGO_TAG =2,
LOCAL_HYPO_TAG =1,
SUBMESH_ON_VERTEX_TAG =4,
SUBMESH_ON_EDGE_TAG =5,
SUBMESH_ON_WIRE_TAG =6,
SUBMESH_ON_FACE_TAG =7,
SUBMESH_ON_SHELL_TAG =8,
SUBMESH_ON_SOLID_TAG =9,
SUBMESH_ON_COMPOUND_TAG=10 };
//================================================================================
/*!
* \brief Constructor
@ -368,13 +358,13 @@ _PTR(SObject) SMESHGUI_MeshOp::getSubmeshByGeom() const
if ( !geom->_is_nil() ) {
int tag = -1;
switch ( geom->GetShapeType() ) {
case GEOM::VERTEX: tag = SUBMESH_ON_VERTEX_TAG ; break;
case GEOM::EDGE: tag = SUBMESH_ON_EDGE_TAG ; break;
case GEOM::WIRE: tag = SUBMESH_ON_WIRE_TAG ; break;
case GEOM::FACE: tag = SUBMESH_ON_FACE_TAG ; break;
case GEOM::SHELL: tag = SUBMESH_ON_SHELL_TAG ; break;
case GEOM::SOLID: tag = SUBMESH_ON_SOLID_TAG ; break;
case GEOM::COMPOUND: tag = SUBMESH_ON_COMPOUND_TAG; break;
case GEOM::VERTEX: tag = SMESH::Tag_SubMeshOnVertex ; break;
case GEOM::EDGE: tag = SMESH::Tag_SubMeshOnEdge ; break;
case GEOM::WIRE: tag = SMESH::Tag_SubMeshOnWire ; break;
case GEOM::FACE: tag = SMESH::Tag_SubMeshOnFace ; break;
case GEOM::SHELL: tag = SMESH::Tag_SubMeshOnShell ; break;
case GEOM::SOLID: tag = SMESH::Tag_SubMeshOnSolid ; break;
case GEOM::COMPOUND: tag = SMESH::Tag_SubMeshOnCompound; break;
default:;
}
_PTR(GenericAttribute) anAttr;
@ -760,9 +750,9 @@ void SMESHGUI_MeshOp::existingHyps( const int theDim,
bool isMesh = !_CAST( SComponent, theFather );
int aPart = -1;
if ( isMesh )
aPart = theHypType == Algo ? GLOBAL_ALGO_TAG : GLOBAL_HYPO_TAG;
aPart = theHypType == Algo ? SMESH::Tag_RefOnAppliedAlgorithms : SMESH::Tag_RefOnAppliedHypothesis;
else
aPart = theHypType == Algo ? LOCAL_ALGO_TAG : LOCAL_HYPO_TAG;
aPart = theHypType == Algo ? SMESH::Tag_AlgorithmsRoot : SMESH::Tag_HypothesisRoot;
if ( theFather->FindSubObject( aPart, aHypRoot ) )
{

View File

@ -37,8 +37,8 @@
#include "SMESHGUI_SelectionOp.h"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(GEOM_Gen)
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_CLIENT_HEADER(GEOM_Gen)
#include CORBA_CLIENT_HEADER(SMESH_Mesh)
#include <qstringlist.h>

View File

@ -36,8 +36,9 @@
#include "SVTK_RenderWindowInteractor.h"
#include "SVTK_ViewWindow.h"
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_Group)
#include CORBA_CLIENT_HEADER(SMESH_Gen)
#include CORBA_CLIENT_HEADER(SMESH_Mesh)
#include CORBA_CLIENT_HEADER(SMESH_Group)
//=======================================================================
//function : SMESHGUI_Selection
@ -405,16 +406,16 @@ int SMESHGUI_Selection::type( const QString& entry, _PTR(Study) study )
switch (aLevel)
{
case 1:
if( anOTag>=3 )
if (anOTag >= SMESH::Tag_FirstMeshRoot)
res = MESH;
break;
case 2:
switch (aFTag)
{
case 1:
case SMESH::Tag_HypothesisRoot:
res = HYPOTHESIS;
break;
case 2:
case SMESH::Tag_AlgorithmsRoot:
res = ALGORITHM;
break;
}
@ -422,27 +423,27 @@ int SMESHGUI_Selection::type( const QString& entry, _PTR(Study) study )
case 3:
switch (aFTag)
{
case 4:
case SMESH::Tag_SubMeshOnVertex:
res = SUBMESH_VERTEX;
break;
case 5:
case SMESH::Tag_SubMeshOnEdge:
res = SUBMESH_EDGE;
break;
case 7:
case SMESH::Tag_SubMeshOnFace:
res = SUBMESH_FACE;
break;
case 9:
case SMESH::Tag_SubMeshOnSolid:
res = SUBMESH_SOLID;
break;
case 10:
case SMESH::Tag_SubMeshOnCompound:
res = SUBMESH_COMPOUND;
break;
}
if( aFTag>10 )
default:
if (aFTag >= SMESH::Tag_FirstGroup)
res = GROUP;
else
res = SUBMESH;
}
break;
}

View File

@ -32,7 +32,6 @@
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESH.hxx"
#include "SMESH_TypeFilter.hxx"
#include "SALOMEDSClient_Study.hxx"
@ -251,7 +250,7 @@ void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos()
bool hasGroup = false;
// info about groups on nodes
aMeshSO->FindSubObject(Tag_NodeGroups, anObj);
aMeshSO->FindSubObject(SMESH::Tag_NodeGroups, anObj);
if (anObj) {
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
if (it->More()) {
@ -284,7 +283,7 @@ void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos()
// info about groups on edges
anObj.reset();
aMeshSO->FindSubObject(Tag_EdgeGroups, anObj);
aMeshSO->FindSubObject(SMESH::Tag_EdgeGroups, anObj);
if (anObj) {
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
if (!hasGroup && it->More()) {
@ -317,7 +316,7 @@ void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos()
// info about groups on faces
anObj.reset();
aMeshSO->FindSubObject(Tag_FaceGroups , anObj);
aMeshSO->FindSubObject(SMESH::Tag_FaceGroups , anObj);
if (anObj) {
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
if (!hasGroup && it->More()) {
@ -350,7 +349,7 @@ void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos()
// info about groups on volumes
anObj.reset();
aMeshSO->FindSubObject(Tag_VolumeGroups, anObj);
aMeshSO->FindSubObject(SMESH::Tag_VolumeGroups, anObj);
if (anObj) {
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
if (!hasGroup && it->More())

View File

@ -65,20 +65,6 @@ using namespace std;
static CORBA::ORB_var anORB;
// Tags definition
static long Tag_HypothesisRoot = 1;
static long Tag_AlgorithmsRoot = 2;
static long Tag_RefOnShape = 1;
static long Tag_RefOnAppliedHypothesis = 2;
static long Tag_RefOnAppliedAlgorithms = 3;
static long Tag_SubMeshOnVertex = 4;
static long Tag_SubMeshOnEdge = 5;
static long Tag_SubMeshOnFace = 6;
static long Tag_SubMeshOnSolid = 7;
static long Tag_SubMeshOnCompound = 8;
namespace
{
//---------------------------------------------------------------
@ -125,7 +111,7 @@ namespace
{
return GetDomainRoot(theSComponentMesh,
theStudyBuilder,
Tag_HypothesisRoot,
SMESH::Tag_HypothesisRoot,
QObject::tr("SMESH_MEN_HYPOTHESIS"),
"ICON_SMESH_TREE_HYPO");
}
@ -139,7 +125,7 @@ namespace
{
return GetDomainRoot(theSComponentMesh,
theStudyBuilder,
Tag_AlgorithmsRoot,
SMESH::Tag_AlgorithmsRoot,
QObject::tr("SMESH_MEN_ALGORITHMS"),
"ICON_SMESH_TREE_ALGO");
}
@ -157,7 +143,7 @@ namespace
{
SALOMEDS::SObject_var aDomain = GetDomainRoot(theSComponentMesh,
theStudyBuilder,
Tag_AlgorithmsRoot,
SMESH::Tag_AlgorithmsRoot,
theDomainName,
theDomainPixmap);
// Add New Hypothesis
@ -186,7 +172,7 @@ namespace
return AddToDomain(theIOR,
theSComponentMesh,
theStudyBuilder,
Tag_HypothesisRoot,
SMESH::Tag_HypothesisRoot,
QObject::tr("SMESH_MEN_HYPOTHESIS"),
"ICON_SMESH_TREE_HYPO");
}
@ -201,7 +187,7 @@ namespace
return AddToDomain(theIOR,
theSComponentMesh,
theStudyBuilder,
Tag_AlgorithmsRoot,
SMESH::Tag_AlgorithmsRoot,
QObject::tr("SMESH_MEN_ALGORITHMS"),
"ICON_SMESH_TREE_ALGO");
}
@ -253,7 +239,7 @@ namespace
theDomainEntry,
theStudy,
theStudyBuilder,
Tag_RefOnAppliedHypothesis,
SMESH::Tag_RefOnAppliedHypothesis,
QObject::tr("SMESH_MEN_APPLIED_HYPOTHESIS"),
"ICON_SMESH_TREE_HYPO");
}
@ -270,7 +256,7 @@ namespace
theDomainEntry,
theStudy,
theStudyBuilder,
Tag_RefOnAppliedAlgorithms,
SMESH::Tag_RefOnAppliedAlgorithms,
QObject::tr("SMESH_MEN_APPLIED_ALGORIHTMS"),
"ICON_SMESH_TREE_ALGO");
}
@ -404,8 +390,7 @@ SMESH_Swig::~SMESH_Swig()
//===============================================================
const char*
SMESH_Swig::AddNewMesh(const char* theIOR)
const char* SMESH_Swig::AddNewMesh(const char* theIOR)
{
MESSAGE("AddNewMesh");
@ -433,10 +418,8 @@ SMESH_Swig::AddNewMesh(const char* theIOR)
//===============================================================
const char*
SMESH_Swig::AddNewHypothesis(const char* theIOR)
const char* SMESH_Swig::AddNewHypothesis(const char* theIOR)
{
MESSAGE("AddNewHypothesis");
SALOMEDS::SObject_var aSObject = ::AddHypothesis(theIOR,
@ -448,8 +431,7 @@ SMESH_Swig::AddNewHypothesis(const char* theIOR)
//===============================================================
const char*
SMESH_Swig::AddNewAlgorithms(const char* theIOR)
const char* SMESH_Swig::AddNewAlgorithms(const char* theIOR)
{
MESSAGE("AddNewAlgorithms");
@ -462,23 +444,21 @@ SMESH_Swig::AddNewAlgorithms(const char* theIOR)
//===============================================================
void
SMESH_Swig::SetShape(const char* theShapeEntry,
void SMESH_Swig::SetShape(const char* theShapeEntry,
const char* theMeshEntry)
{
SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID( theMeshEntry );
SALOMEDS::SObject_var aGeomShapeSO = myStudy->FindObjectID( theShapeEntry );
if(!aMeshSO->_is_nil() && !aGeomShapeSO->_is_nil()){
SALOMEDS::SObject_var aSObject = myStudyBuilder->NewObjectToTag(aMeshSO,Tag_RefOnShape);
SALOMEDS::SObject_var aSObject = myStudyBuilder->NewObjectToTag(aMeshSO, SMESH::Tag_RefOnShape);
myStudyBuilder->Addreference(aSObject,aGeomShapeSO);
}
}
//===============================================================
void
SMESH_Swig::SetHypothesis(const char* theMeshOrSubMeshEntry,
void SMESH_Swig::SetHypothesis(const char* theMeshOrSubMeshEntry,
const char* theDomainEntry)
{
::SetHypothesis(theMeshOrSubMeshEntry,
@ -489,8 +469,7 @@ SMESH_Swig::SetHypothesis(const char* theMeshOrSubMeshEntry,
//===============================================================
void
SMESH_Swig::SetAlgorithms(const char* theMeshOrSubMeshEntry,
void SMESH_Swig::SetAlgorithms(const char* theMeshOrSubMeshEntry,
const char* theDomainEntry)
{
::SetAlgorithms(theMeshOrSubMeshEntry,
@ -509,8 +488,7 @@ SMESH_Swig::UnSetHypothesis(const char* theDomainEntry)
myStudyBuilder->RemoveObject(aDomainSO);
}
const char*
SMESH_Swig::AddSubMesh(const char* theMeshEntry,
const char* SMESH_Swig::AddSubMesh(const char* theMeshEntry,
const char* theSubMeshIOR,
int theShapeType)
{
@ -520,23 +498,23 @@ SMESH_Swig::AddSubMesh(const char* theMeshEntry,
QString aSubMeshName;
switch(theShapeType){
case TopAbs_SOLID:
aShapeTag = Tag_SubMeshOnSolid;
aShapeTag = SMESH::Tag_SubMeshOnSolid;
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnSolid");
break;
case TopAbs_FACE:
aShapeTag = Tag_SubMeshOnFace;
aShapeTag = SMESH::Tag_SubMeshOnFace;
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnFace");
break;
case TopAbs_EDGE:
aShapeTag = Tag_SubMeshOnEdge;
aShapeTag = SMESH::Tag_SubMeshOnEdge;
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnEdge");
break;
case TopAbs_VERTEX:
aShapeTag = Tag_SubMeshOnVertex;
aShapeTag = SMESH::Tag_SubMeshOnVertex;
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnVertex");
break;
default:
aShapeTag = Tag_SubMeshOnCompound;
aShapeTag = SMESH::Tag_SubMeshOnCompound;
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnCompound");
}
@ -564,8 +542,7 @@ SMESH_Swig::AddSubMesh(const char* theMeshEntry,
return "";
}
const char*
SMESH_Swig::AddSubMeshOnShape(const char* theMeshEntry,
const char* SMESH_Swig::AddSubMeshOnShape(const char* theMeshEntry,
const char* theGeomShapeEntry,
const char* theSubMeshIOR,
int ShapeType)
@ -607,11 +584,9 @@ void SMESH_Swig::CreateAndDisplayActor( const char* Mesh_Entry )
};
ProcessVoidEvent(new TEvent(Mesh_Entry));
}
void
SMESH_Swig::SetName(const char* theEntry,
void SMESH_Swig::SetName(const char* theEntry,
const char* theName)
{
SALOMEDS::SObject_var aSObject = myStudy->FindObjectID(theEntry);

View File

@ -24,7 +24,7 @@
// File : SMESH.hxx
// Author : Michael ZORIN
// Module : SMESH
// $Header:
// $Header$
#ifndef _SMESH_I_SMESH_HXX_
#define _SMESH_I_SMESH_HXX_
@ -39,28 +39,4 @@
#define SMESH_I_EXPORT
#endif
// Tags definition
enum {
// Top level
Tag_HypothesisRoot = 1, // hypotheses root
Tag_AlgorithmsRoot = 2, // algorithms root
// Mesh/Submesh
Tag_RefOnShape = 1, // references to shape
Tag_RefOnAppliedHypothesis = 2, // applied hypotheses root
Tag_RefOnAppliedAlgorithms = 3, // applied algorithms root
// Mesh only
Tag_SubMeshOnVertex = 4, // sub-meshes roots by type
Tag_SubMeshOnEdge = 5, // ...
Tag_SubMeshOnWire = 6, // ...
Tag_SubMeshOnFace = 7, // ...
Tag_SubMeshOnShell = 8, // ...
Tag_SubMeshOnSolid = 9, // ...
Tag_SubMeshOnCompound = 10, // ...
Tag_NodeGroups = 11, // Group roots by type
Tag_EdgeGroups = 12, // ...
Tag_FaceGroups = 13, // ...
Tag_VolumeGroups = 14 // ...
};
#endif

View File

@ -344,7 +344,6 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
aPlatformLibName = strcat( aPlatformLibName, theLibName );
aPlatformLibName[libNameLen] = '\0';
#endif
}
else
{
@ -365,7 +364,6 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
}
Unexpect aCatch(SALOME_SalomeException);
if(MYDEBUG) MESSAGE( "Create Hypothesis <" << theHypName << "> from " << aPlatformLibName/*theLibName*/);
@ -3708,7 +3706,7 @@ int SMESH_Gen_i::RegisterObject(CORBA::Object_ptr theObject)
*/
//================================================================================
int SMESH_Gen_i::GetObjectId(CORBA::Object_ptr theObject)
CORBA::Long SMESH_Gen_i::GetObjectId(CORBA::Object_ptr theObject)
{
StudyContext* myStudyContext = GetCurrentStudyContext();
if ( myStudyContext && !CORBA::is_nil( theObject )) {

View File

@ -427,7 +427,7 @@ public:
int RegisterObject(CORBA::Object_ptr theObject);
// Return id of registered object
int GetObjectId(CORBA::Object_ptr theObject);
CORBA::Long GetObjectId(CORBA::Object_ptr theObject);
// Return an object that previously had an oldID
template<class TInterface>

View File

@ -34,8 +34,6 @@
#include "SMESH_Group_i.hxx"
#include "SMESH_subMesh_i.hxx"
#include "SMESH.hxx"
#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
#include "utilities.h"
@ -59,82 +57,82 @@ static int MYDEBUG = 0;
long SMESH_Gen_i::GetHypothesisRootTag()
{
return Tag_HypothesisRoot;
return SMESH::Tag_HypothesisRoot;
}
long SMESH_Gen_i::GetAlgorithmsRootTag()
{
return Tag_AlgorithmsRoot;
return SMESH::Tag_AlgorithmsRoot;
}
long SMESH_Gen_i::GetRefOnShapeTag()
{
return Tag_RefOnShape;
return SMESH::Tag_RefOnShape;
}
long SMESH_Gen_i::GetRefOnAppliedHypothesisTag()
{
return Tag_RefOnAppliedHypothesis;
return SMESH::Tag_RefOnAppliedHypothesis;
}
long SMESH_Gen_i::GetRefOnAppliedAlgorithmsTag()
{
return Tag_RefOnAppliedAlgorithms;
return SMESH::Tag_RefOnAppliedAlgorithms;
}
long SMESH_Gen_i::GetSubMeshOnVertexTag()
{
return Tag_SubMeshOnVertex;
return SMESH::Tag_SubMeshOnVertex;
}
long SMESH_Gen_i::GetSubMeshOnEdgeTag()
{
return Tag_SubMeshOnEdge;
return SMESH::Tag_SubMeshOnEdge;
}
long SMESH_Gen_i::GetSubMeshOnFaceTag()
{
return Tag_SubMeshOnFace;
return SMESH::Tag_SubMeshOnFace;
}
long SMESH_Gen_i::GetSubMeshOnSolidTag()
{
return Tag_SubMeshOnSolid;
return SMESH::Tag_SubMeshOnSolid;
}
long SMESH_Gen_i::GetSubMeshOnCompoundTag()
{
return Tag_SubMeshOnCompound;
return SMESH::Tag_SubMeshOnCompound;
}
long SMESH_Gen_i::GetSubMeshOnWireTag()
{
return Tag_SubMeshOnWire;
return SMESH::Tag_SubMeshOnWire;
}
long SMESH_Gen_i::GetSubMeshOnShellTag()
{
return Tag_SubMeshOnShell;
return SMESH::Tag_SubMeshOnShell;
}
long SMESH_Gen_i::GetNodeGroupsTag()
{
return Tag_NodeGroups;
return SMESH::Tag_NodeGroups;
}
long SMESH_Gen_i::GetEdgeGroupsTag()
{
return Tag_EdgeGroups;
return SMESH::Tag_EdgeGroups;
}
long SMESH_Gen_i::GetFaceGroupsTag()
{
return Tag_FaceGroups;
return SMESH::Tag_FaceGroups;
}
long SMESH_Gen_i::GetVolumeGroupsTag()
{
return Tag_VolumeGroups;
return SMESH::Tag_VolumeGroups;
}
//=============================================================================

View File

@ -78,6 +78,12 @@ Fine = 3
VeryFine = 4
Custom = 5
PrecisionConfusion = 1e-07
def IsEqual(val1, val2, tol=PrecisionConfusion):
if abs(val1 - val2) < tol:
return True
return False
NO_NAME = "NoName"
@ -422,8 +428,6 @@ class Mesh_Algorithm:
# @class Mesh_Algorithm
# @brief Class Mesh_Algorithm
#17908#hypos = {}
#def __init__(self,smesh):
# self.smesh=smesh
def __init__(self):
@ -432,11 +436,84 @@ class Mesh_Algorithm:
self.subm = None
self.algo = None
#17908#def FindHypothesis(self,hypname, args):
#17908# key = "%s %s %s" % (self.__class__.__name__, hypname, args)
#17908# if Mesh_Algorithm.hypos.has_key( key ):
#17908# return Mesh_Algorithm.hypos[ key ]
#17908# return None
## Find hypothesis in study by its type name and parameters.
# Find only those hypothesis, which was created in smeshpyD engine.
def FindHypothesis (self, hypname, args, CompareMethod, smeshpyD):
study = smeshpyD.GetCurrentStudy()
#to do: find component by smeshpyD object, not by its data type
scomp = study.FindComponent(smeshpyD.ComponentDataType())
if scomp is not None:
res,hypRoot = scomp.FindSubObject(SMESH.Tag_HypothesisRoot)
# is hypotheses root label exists?
if res and hypRoot is not None:
iter = study.NewChildIterator(hypRoot)
# check all published hypotheses
while iter.More():
hypo_so_i = iter.Value()
attr = hypo_so_i.FindAttribute("AttributeIOR")[1]
if attr is not None:
anIOR = attr.Value()
hypo_o_i = salome.orb.string_to_object(anIOR)
if hypo_o_i is not None:
# is hypothesis?
hypo_i = hypo_o_i._narrow(SMESH.SMESH_Hypothesis)
if hypo_i is not None:
# belongs to this engine?
if smeshpyD.GetObjectId(hypo_i) > 0:
# is it the needed hypothesis?
if hypo_i.GetName() == hypname:
# check args
if CompareMethod(hypo_i, args):
# found!!!
return hypo_i
pass
pass
pass
pass
pass
iter.Next()
pass
pass
pass
return None
## Find algorithm in study by its type name.
# Find only those algorithm, which was created in smeshpyD engine.
def FindAlgorithm (self, algoname, smeshpyD):
study = smeshpyD.GetCurrentStudy()
#to do: find component by smeshpyD object, not by its data type
scomp = study.FindComponent(smeshpyD.ComponentDataType())
if scomp is not None:
res,hypRoot = scomp.FindSubObject(SMESH.Tag_AlgorithmsRoot)
# is algorithms root label exists?
if res and hypRoot is not None:
iter = study.NewChildIterator(hypRoot)
# check all published algorithms
while iter.More():
algo_so_i = iter.Value()
attr = algo_so_i.FindAttribute("AttributeIOR")[1]
if attr is not None:
anIOR = attr.Value()
algo_o_i = salome.orb.string_to_object(anIOR)
if algo_o_i is not None:
# is algorithm?
algo_i = algo_o_i._narrow(SMESH.SMESH_Algo)
if algo_i is not None:
# belongs to this engine?
if smeshpyD.GetObjectId(algo_i) > 0:
# is it the needed algorithm?
if algo_i.GetName() == algoname:
# found!!!
return algo_i
pass
pass
pass
pass
iter.Next()
pass
pass
pass
return None
## If the algorithm is global, return 0; \n
# else return the submesh associated to this algorithm.
@ -470,14 +547,17 @@ class Mesh_Algorithm:
def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"):
if geom is None:
raise RuntimeError, "Attemp to create " + hypo + " algoritm on None shape"
algo = self.FindAlgorithm(hypo, mesh.smeshpyD)
if algo is None:
algo = mesh.smeshpyD.CreateHypothesis(hypo, so)
pass
self.Assign(algo, mesh, geom)
return self.algo
## Private method
def Assign(self, algo, mesh, geom):
if geom is None:
raise RuntimeError, "Attemp to create " + hypo + " algoritm on None shape"
raise RuntimeError, "Attemp to create " + algo + " algoritm on None shape"
self.mesh = mesh
piece = mesh.geom
if not geom:
@ -494,17 +574,23 @@ class Mesh_Algorithm:
status = mesh.mesh.AddHypothesis(self.geom, self.algo)
TreatHypoStatus( status, algo.GetName(), GetName(self.geom), True )
def CompareHyp (self, hyp, args):
print "CompareHyp is not implemented for ", self.__class__.__name__, ":", hyp.GetName()
return False
def CompareEqualHyp (self, hyp, args):
return True
## Private method
def Hypothesis(self, hyp, args=[], so="libStdMeshersEngine.so", UseExisting=0):
CreateNew = 1
#17908#if UseExisting:
#17908# hypo = self.FindHypothesis(hyp, args)
#17908# if hypo: CreateNew = 0
#17908# pass
if CreateNew:
def Hypothesis (self, hyp, args=[], so="libStdMeshersEngine.so",
UseExisting=0, CompareMethod=""):
hypo = None
if UseExisting:
if CompareMethod == "": CompareMethod = self.CompareHyp
hypo = self.FindHypothesis(hyp, args, CompareMethod, self.mesh.smeshpyD)
pass
if hypo is None:
hypo = self.mesh.smeshpyD.CreateHypothesis(hyp, so)
key = "%s %s %s" % (self.__class__.__name__, hyp, args)
#17908#Mesh_Algorithm.hypos[key] = hypo
a = ""
s = "="
i = 0
@ -513,8 +599,7 @@ class Mesh_Algorithm:
a = a + s + str(args[i])
s = ","
i = i + 1
name = GetName(self.geom)
#SetName(hypo, name + "/" + hyp + a) - NPAL16198
pass
SetName(hypo, hyp + a)
pass
status = self.mesh.mesh.AddHypothesis(self.geom, hypo)
@ -530,17 +615,9 @@ class Mesh_Algorithm:
# More details.
class Mesh_Segment(Mesh_Algorithm):
#17908#algo = 0 # algorithm object common for all Mesh_Segments
## Private constructor.
def __init__(self, mesh, geom=0):
Mesh_Algorithm.__init__(self)
#17908#if not Mesh_Segment.algo:
#17908# Mesh_Segment.algo = self.Create(mesh, geom, "Regular_1D")
#17908#else:
#17908# self.Assign( Mesh_Segment.algo, mesh, geom)
#17908# pass
self.Create(mesh, geom, "Regular_1D")
## Define "LocalLength" hypothesis to cut an edge in several segments with the same length
@ -548,10 +625,15 @@ class Mesh_Segment(Mesh_Algorithm):
# @param UseExisting if ==true - search existing hypothesis created with
# same parameters, else (default) - create new
def LocalLength(self, l, UseExisting=0):
hyp = self.Hypothesis("LocalLength", [l], UseExisting=UseExisting)
hyp = self.Hypothesis("LocalLength", [l], UseExisting=UseExisting,
CompareMethod=self.CompareLocalLength)
hyp.SetLength(l)
return hyp
## Check if the given "LocalLength" hypothesis has the same parameters as given arguments
def CompareLocalLength(self, hyp, args):
return IsEqual(hyp.GetLength(), args[0])
## Define "NumberOfSegments" hypothesis to cut an edge in several fixed number of segments
# @param n for the number of segments that cut an edge
# @param s for the scale factor (optional)
@ -559,79 +641,142 @@ class Mesh_Segment(Mesh_Algorithm):
# same parameters, else (default) - create new
def NumberOfSegments(self, n, s=[], UseExisting=0):
if s == []:
hyp = self.Hypothesis("NumberOfSegments", [n], UseExisting=UseExisting)
hyp = self.Hypothesis("NumberOfSegments", [n], UseExisting=UseExisting,
CompareMethod=self.CompareNumberOfSegments)
else:
hyp = self.Hypothesis("NumberOfSegments", [n,s], UseExisting=UseExisting)
hyp = self.Hypothesis("NumberOfSegments", [n,s], UseExisting=UseExisting,
CompareMethod=self.CompareNumberOfSegments)
hyp.SetDistrType( 1 )
hyp.SetScaleFactor(s)
hyp.SetNumberOfSegments(n)
return hyp
## Check if the given "NumberOfSegments" hypothesis has the same parameters as given arguments
def CompareNumberOfSegments(self, hyp, args):
if hyp.GetNumberOfSegments() == args[0]:
if len(args) == 1:
return True
else:
if hyp.GetDistrType() == 1:
if IsEqual(hyp.GetScaleFactor(), args[1]):
return True
return False
## Define "Arithmetic1D" hypothesis to cut an edge in several segments with arithmetic length increasing
# @param start for the length of the first segment
# @param end for the length of the last segment
# @param UseExisting if ==true - search existing hypothesis created with
# same parameters, else (default) - create new
def Arithmetic1D(self, start, end, UseExisting=0):
hyp = self.Hypothesis("Arithmetic1D", [start, end], UseExisting=UseExisting)
hyp = self.Hypothesis("Arithmetic1D", [start, end], UseExisting=UseExisting,
CompareMethod=self.CompareArithmetic1D)
hyp.SetLength(start, 1)
hyp.SetLength(end , 0)
return hyp
## Check if the given "Arithmetic1D" hypothesis has the same parameters as given arguments
def CompareArithmetic1D(self, hyp, args):
if IsEqual(hyp.GetLength(1), args[0]):
if IsEqual(hyp.GetLength(0), args[1]):
return True
return False
## Define "StartEndLength" hypothesis to cut an edge in several segments with geometric length increasing
# @param start for the length of the first segment
# @param end for the length of the last segment
# @param UseExisting if ==true - search existing hypothesis created with
# same parameters, else (default) - create new
def StartEndLength(self, start, end, UseExisting=0):
hyp = self.Hypothesis("StartEndLength", [start, end], UseExisting=UseExisting)
hyp = self.Hypothesis("StartEndLength", [start, end], UseExisting=UseExisting,
CompareMethod=self.CompareStartEndLength)
hyp.SetLength(start, 1)
hyp.SetLength(end , 0)
return hyp
## Check if the given "StartEndLength" hypothesis has the same parameters as given arguments
def CompareStartEndLength(self, hyp, args):
if IsEqual(hyp.GetLength(1), args[0]):
if IsEqual(hyp.GetLength(0), args[1]):
return True
return False
## Define "Deflection1D" hypothesis
# @param d for the deflection
# @param UseExisting if ==true - search existing hypothesis created with
# same parameters, else (default) - create new
def Deflection1D(self, d, UseExisting=0):
hyp = self.Hypothesis("Deflection1D", [d], UseExisting=UseExisting)
hyp = self.Hypothesis("Deflection1D", [d], UseExisting=UseExisting,
CompareMethod=self.CompareDeflection1D)
hyp.SetDeflection(d)
return hyp
## Check if the given "Deflection1D" hypothesis has the same parameters as given arguments
def CompareDeflection1D(self, hyp, args):
return IsEqual(hyp.GetDeflection(), args[0])
## Define "Propagation" hypothesis that propagate all other hypothesis on all others edges that are in
# the opposite side in the case of quadrangular faces
def Propagation(self):
return self.Hypothesis("Propagation", UseExisting=1)
return self.Hypothesis("Propagation", UseExisting=1, CompareMethod=self.CompareEqualHyp)
## Define "AutomaticLength" hypothesis
# @param fineness for the fineness [0-1]
# @param UseExisting if ==true - search existing hypothesis created with
# same parameters, else (default) - create new
def AutomaticLength(self, fineness=0, UseExisting=0):
hyp = self.Hypothesis("AutomaticLength",[fineness],UseExisting=UseExisting)
hyp = self.Hypothesis("AutomaticLength",[fineness],UseExisting=UseExisting,
CompareMethod=self.CompareAutomaticLength)
hyp.SetFineness( fineness )
return hyp
## Check if the given "AutomaticLength" hypothesis has the same parameters as given arguments
def CompareAutomaticLength(self, hyp, args):
return IsEqual(hyp.GetFineness(), args[0])
## Define "SegmentLengthAroundVertex" hypothesis
# @param length for the segment length
# @param vertex for the length localization: vertex index [0,1] | verext object
# @param vertex for the length localization: vertex index [0,1] | vertex object.
# Any other integer value means what hypo will be set on the
# whole 1D shape, where Mesh_Segment algorithm is assigned.
# @param UseExisting if ==true - search existing hypothesis created with
# same parameters, else (default) - create new
def LengthNearVertex(self, length, vertex=0, UseExisting=0):
import types
store_geom = self.geom
if vertex:
if type(vertex) is types.IntType:
if vertex == 0 or vertex == 1:
vertex = self.mesh.geompyD.SubShapeAllSorted(self.geom, geompyDC.ShapeType["VERTEX"])[vertex]
pass
self.geom = vertex
pass
hyp = self.Hypothesis("SegmentAroundVertex_0D",[length],UseExisting=UseExisting)
hyp = self.Hypothesis("SegmentLengthAroundVertex",[length],UseExisting=UseExisting)
pass
else:
self.geom = vertex
pass
### 0D algorithm
if self.geom is None:
raise RuntimeError, "Attemp to create SegmentAroundVertex_0D algoritm on None shape"
name = GetName(self.geom)
if name == NO_NAME:
piece = self.mesh.geom
name = self.mesh.geompyD.SubShapeName(self.geom, piece)
self.mesh.geompyD.addToStudyInFather(piece, self.geom, name)
algo = self.FindAlgorithm("SegmentAroundVertex_0D", self.mesh.smeshpyD)
if algo is None:
algo = self.mesh.smeshpyD.CreateHypothesis("SegmentAroundVertex_0D", "libStdMeshersEngine.so")
pass
status = self.mesh.mesh.AddHypothesis(self.geom, algo)
TreatHypoStatus(status, "SegmentAroundVertex_0D", name, True)
###
hyp = self.Hypothesis("SegmentLengthAroundVertex", [length], UseExisting=UseExisting,
CompareMethod=self.CompareLengthNearVertex)
self.geom = store_geom
hyp.SetLength( length )
return hyp
## Check if the given "LengthNearVertex" hypothesis has the same parameters as given arguments
def CompareLengthNearVertex(self, hyp, args):
return IsEqual(hyp.GetLength(), args[0])
## Define "QuadraticMesh" hypothesis, forcing construction of quadratic edges.
# If the 2D mesher sees that all boundary edges are quadratic ones,
# it generates quadratic faces, else it generates linear faces using
@ -639,7 +784,7 @@ class Mesh_Segment(Mesh_Algorithm):
# The 3D mesher generates quadratic volumes only if all boundary faces
# are quadratic ones, else it fails.
def QuadraticMesh(self):
hyp = self.Hypothesis("QuadraticMesh", UseExisting=1)
hyp = self.Hypothesis("QuadraticMesh", UseExisting=1, CompareMethod=self.CompareEqualHyp)
return hyp
# Public class: Mesh_CompositeSegment
@ -650,15 +795,8 @@ class Mesh_Segment(Mesh_Algorithm):
# More details.
class Mesh_CompositeSegment(Mesh_Segment):
#17908#algo = 0 # algorithm object common for all Mesh_CompositeSegments
## Private constructor.
def __init__(self, mesh, geom=0):
#17908#if not Mesh_CompositeSegment.algo:
#17908# Mesh_CompositeSegment.algo = self.Create(mesh, geom, "CompositeSegment_1D")
#17908#else:
#17908# self.Assign( Mesh_CompositeSegment.algo, mesh, geom)
#17908# pass
self.Create(mesh, geom, "CompositeSegment_1D")
@ -670,16 +808,9 @@ class Mesh_CompositeSegment(Mesh_Segment):
# More details.
class Mesh_Segment_Python(Mesh_Segment):
#17908#algo = 0 # algorithm object common for all Mesh_Segment_Pythons
## Private constructor.
def __init__(self, mesh, geom=0):
import Python1dPlugin
#17908#if not Mesh_Segment_Python.algo:
#17908# Mesh_Segment_Python.algo = self.Create(mesh, geom, "Python_1D", "libPython1dEngine.so")
#17908#else:
#17908# self.Assign( Mesh_Segment_Python.algo, mesh, geom)
#17908# pass
self.Create(mesh, geom, "Python_1D", "libPython1dEngine.so")
## Define "PythonSplit1D" hypothesis based on the Erwan Adam patch, awaiting equivalent SALOME functionality
@ -688,11 +819,19 @@ class Mesh_Segment_Python(Mesh_Segment):
# @param UseExisting if ==true - search existing hypothesis created with
# same parameters, else (default) - create new
def PythonSplit1D(self, n, func, UseExisting=0):
hyp = self.Hypothesis("PythonSplit1D", [n], "libPython1dEngine.so", UseExisting=UseExisting)
hyp = self.Hypothesis("PythonSplit1D", [n], "libPython1dEngine.so",
UseExisting=UseExisting, CompareMethod=self.ComparePythonSplit1D)
hyp.SetNumberOfSegments(n)
hyp.SetPythonLog10RatioFunction(func)
return hyp
## Check if the given "PythonSplit1D" hypothesis has the same parameters as given arguments
def ComparePythonSplit1D(self, hyp, args):
#if hyp.GetNumberOfSegments() == args[0]:
# if hyp.GetPythonLog10RatioFunction() == args[1]:
# return True
return False
# Public class: Mesh_Triangle
# ---------------------------
@ -708,22 +847,12 @@ class Mesh_Triangle(Mesh_Algorithm):
_angleMeshS = 8
_gradation = 1.1
# algorithm objects common for all instances of Mesh_Triangle
#17908#algoMEF = 0
#17908#algoNET = 0
#17908#algoNET_2D = 0
## Private constructor.
def __init__(self, mesh, algoType, geom=0):
Mesh_Algorithm.__init__(self)
self.algoType = algoType
if algoType == MEFISTO:
#17908#if not Mesh_Triangle.algoMEF:
#17908# Mesh_Triangle.algoMEF = self.Create(mesh, geom, "MEFISTO_2D")
#17908#else:
#17908# self.Assign( Mesh_Triangle.algoMEF, mesh, geom)
#17908# pass
self.Create(mesh, geom, "MEFISTO_2D")
pass
elif algoType == BLSURF:
@ -734,47 +863,42 @@ class Mesh_Triangle(Mesh_Algorithm):
if noNETGENPlugin:
print "Warning: NETGENPlugin module unavailable"
pass
#17908#if not Mesh_Triangle.algoNET:
#17908# Mesh_Triangle.algoNET = self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
#17908#else:
#17908# self.Assign( Mesh_Triangle.algoNET, mesh, geom)
#17908# pass
self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
pass
elif algoType == NETGEN_2D:
if noNETGENPlugin:
print "Warning: NETGENPlugin module unavailable"
pass
#17908#if not Mesh_Triangle.algoNET_2D:
#17908# Mesh_Triangle.algoNET_2D = self.Create(mesh, geom,
#17908# "NETGEN_2D_ONLY", "libNETGENEngine.so")
#17908#else:
#17908# self.Assign( Mesh_Triangle.algoNET_2D, mesh, geom)
#17908# pass
self.Create(mesh, geom, "NETGEN_2D_ONLY", "libNETGENEngine.so")
pass
## Define "MaxElementArea" hypothesis to give the maximun area of each triangles
# @param area for the maximum area of each triangles
## Define "MaxElementArea" hypothesis to give the maximum area of each triangle
# @param area for the maximum area of each triangle
# @param UseExisting if ==true - search existing hypothesis created with
# same parameters, else (default) - create new
#
# Only for algoType == MEFISTO || NETGEN_2D
def MaxElementArea(self, area, UseExisting=0):
if self.algoType == MEFISTO or self.algoType == NETGEN_2D:
hyp = self.Hypothesis("MaxElementArea", [area], UseExisting=UseExisting)
hyp = self.Hypothesis("MaxElementArea", [area], UseExisting=UseExisting,
CompareMethod=self.CompareMaxElementArea)
hyp.SetMaxElementArea(area)
return hyp
elif self.algoType == NETGEN:
print "Netgen 1D-2D algo doesn't support this hypothesis"
return None
## Define "LengthFromEdges" hypothesis to build triangles based on the length of the edges taken from the wire
## Check if the given "MaxElementArea" hypothesis has the same parameters as given arguments
def CompareMaxElementArea(self, hyp, args):
return IsEqual(hyp.GetMaxElementArea(), args[0])
## Define "LengthFromEdges" hypothesis to build triangles
# based on the length of the edges taken from the wire
#
# Only for algoType == MEFISTO || NETGEN_2D
def LengthFromEdges(self):
if self.algoType == MEFISTO or self.algoType == NETGEN_2D:
hyp = self.Hypothesis("LengthFromEdges", UseExisting=1)
hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp)
return hyp
elif self.algoType == NETGEN:
print "Netgen 1D-2D algo doesn't support this hypothesis"
@ -823,7 +947,7 @@ class Mesh_Triangle(Mesh_Algorithm):
def SetQuadAllowed(self, toAllow=True):
if self.algoType == NETGEN_2D:
if toAllow: # add QuadranglePreference
self.Hypothesis("QuadranglePreference", UseExisting=1)
self.Hypothesis("QuadranglePreference", UseExisting=1, CompareMethod=self.CompareEqualHyp)
else: # remove QuadranglePreference
for hyp in self.mesh.GetHypothesisList( self.geom ):
if hyp.GetName() == "QuadranglePreference":
@ -832,7 +956,9 @@ class Mesh_Triangle(Mesh_Algorithm):
pass
pass
return
if self.params == 0 and self.Parameters():
if self.params == 0:
self.Parameters()
if self.params:
self.params.SetQuadAllowed(toAllow)
return
@ -852,7 +978,8 @@ class Mesh_Triangle(Mesh_Algorithm):
print "NETGEN_2D_ONLY uses 'MaxElementArea' and 'LengthFromEdges' ones"
return None
elif self.algoType == BLSURF:
self.params = self.Hypothesis("BLSURF_Parameters", [], "libBLSURFEngine.so")
self.params = self.Hypothesis("BLSURF_Parameters", [],
"libBLSURFEngine.so", UseExisting=0)
return self.params
return None
@ -938,24 +1065,17 @@ class Mesh_Triangle(Mesh_Algorithm):
# More details.
class Mesh_Quadrangle(Mesh_Algorithm):
#17908#algo = 0 # algorithm object common for all Mesh_Quadrangles
## Private constructor.
def __init__(self, mesh, geom=0):
Mesh_Algorithm.__init__(self)
#17908#if not Mesh_Quadrangle.algo:
#17908# Mesh_Quadrangle.algo = self.Create(mesh, geom, "Quadrangle_2D")
#17908#else:
#17908# self.Assign( Mesh_Quadrangle.algo, mesh, geom)
#17908# pass
self.Create(mesh, geom, "Quadrangle_2D")
## Define "QuadranglePreference" hypothesis, forcing construction
# of quadrangles if the number of nodes on opposite edges is not the same
# in the case where the global number of nodes on edges is even
def QuadranglePreference(self):
hyp = self.Hypothesis("QuadranglePreference", UseExisting=1)
hyp = self.Hypothesis("QuadranglePreference", UseExisting=1,
CompareMethod=self.CompareEqualHyp)
return hyp
# Public class: Mesh_Tetrahedron
@ -969,30 +1089,15 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
params = 0
algoType = 0
#17908#algoNET = 0 # algorithm object common for all Mesh_Tetrahedrons
#17908#algoGHS = 0 # algorithm object common for all Mesh_Tetrahedrons
#17908#algoFNET = 0 # algorithm object common for all Mesh_Tetrahedrons
## Private constructor.
def __init__(self, mesh, algoType, geom=0):
Mesh_Algorithm.__init__(self)
if algoType == NETGEN:
#17908#if not Mesh_Tetrahedron.algoNET:
#17908# Mesh_Tetrahedron.algoNET = self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so")
#17908#else:
#17908# self.Assign( Mesh_Tetrahedron.algoNET, mesh, geom)
#17908# pass
self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so")
pass
elif algoType == GHS3D:
#17908#if not Mesh_Tetrahedron.algoGHS:
#17908# import GHS3DPlugin
#17908# Mesh_Tetrahedron.algoGHS = self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so")
#17908#else:
#17908# self.Assign( Mesh_Tetrahedron.algoGHS, mesh, geom)
#17908# pass
import GHS3DPlugin
self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so")
pass
@ -1000,11 +1105,6 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
elif algoType == FULL_NETGEN:
if noNETGENPlugin:
print "Warning: NETGENPlugin module has not been imported."
#17908#if not Mesh_Tetrahedron.algoFNET:
#17908# Mesh_Tetrahedron.algoFNET = self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
#17908#else:
#17908# self.Assign( Mesh_Tetrahedron.algoFNET, mesh, geom)
#17908# pass
self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
pass
@ -1015,10 +1115,15 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
# @param UseExisting if ==true - search existing hypothesis created with
# same parameters, else (default) - create new
def MaxElementVolume(self, vol, UseExisting=0):
hyp = self.Hypothesis("MaxElementVolume", [vol], UseExisting=UseExisting)
hyp = self.Hypothesis("MaxElementVolume", [vol], UseExisting=UseExisting,
CompareMethod=self.CompareMaxElementVolume)
hyp.SetMaxElementVolume(vol)
return hyp
## Check if the given "MaxElementVolume" hypothesis has the same parameters as given arguments
def CompareMaxElementVolume(self, hyp, args):
return IsEqual(hyp.GetMaxElementVolume(), args[0])
## Define "Netgen 3D Parameters" hypothesis
def Parameters(self):
if (self.algoType == FULL_NETGEN):
@ -1081,61 +1186,32 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
# More details.
class Mesh_Hexahedron(Mesh_Algorithm):
# #17908#algo = 0 # algorithm object common for all Mesh_Hexahedrons
#
# ## Private constructor.
# def __init__(self, mesh, geom=0):
# Mesh_Algorithm.__init__(self)
#
# #17908#if not Mesh_Hexahedron.algo:
# #17908# Mesh_Hexahedron.algo = self.Create(mesh, geom, "Hexa_3D")
# #17908#else:
# #17908# self.Assign( Mesh_Hexahedron.algo, mesh, geom)
# #17908# pass
# self.Create(mesh, geom, "Hexa_3D")
#17908#params = 0
#17908#algoType = 0
#17908#algoHEXA = 0 # algorithm object common for all Mesh_Hexahedron's
#17908#algoHEXO = 0 # algorithm object common for all Mesh_Hexahedron's
params = 0
algoType = 0
## Private constructor.
def __init__(self, mesh, algoType=Hexa, geom=0):
Mesh_Algorithm.__init__(self)
self.algoType = algoType
if algoType == Hexa:
#17908#if not Mesh_Hexahedron.algoHEXA:
#17908# Mesh_Hexahedron.algoHEXA = self.Create(mesh, geom, "Hexa_3D")
#17908#else:
#17908# self.Assign(Mesh_Hexahedron.algoHEXA, mesh, geom)
#17908# pass
self.Create(mesh, geom, "Hexa_3D")
pass
elif algoType == Hexotic:
#17908#if not Mesh_Hexahedron.algoHEXO:
#17908# import HexoticPlugin
#17908# Mesh_Hexahedron.algoHEXO = self.Create(mesh, geom, "Hexotic_3D", "libHexoticEngine.so")
#17908#else:
#17908# self.Assign(Mesh_Hexahedron.algoHEXO, mesh, geom)
#17908# pass
import HexoticPlugin
self.Create(mesh, geom, "Hexotic_3D", "libHexoticEngine.so")
pass
## Define "MinMaxQuad" hypothesis to give the three hexotic parameters
def MinMaxQuad(self, min=3, max=8, quad=True):
#17908#self.params = self.Hypothesis("Hexotic_Parameters", [], "libHexoticEngine.so")
#17908#self.params.SetHexesMinLevel(min)
#17908#self.params.SetHexesMaxLevel(max)
#17908#self.params.SetHexoticQuadrangles(quad)
#17908#return self.params
params = self.Hypothesis("Hexotic_Parameters", [], "libHexoticEngine.so")
params.SetHexesMinLevel(min)
params.SetHexesMaxLevel(max)
params.SetHexoticQuadrangles(quad)
return params
self.params = self.Hypothesis("Hexotic_Parameters", [], "libHexoticEngine.so",
UseExisting=0)
self.params.SetHexesMinLevel(min)
self.params.SetHexesMaxLevel(max)
self.params.SetHexoticQuadrangles(quad)
return self.params
# Deprecated, only for compatibility!
# Public class: Mesh_Netgen
@ -1151,9 +1227,6 @@ class Mesh_Netgen(Mesh_Algorithm):
is3D = 0
#17908#algoNET23 = 0 # algorithm object common for all Mesh_Netgens
#17908#algoNET2 = 0 # algorithm object common for all Mesh_Netgens
## Private constructor.
def __init__(self, mesh, is3D, geom=0):
Mesh_Algorithm.__init__(self)
@ -1163,20 +1236,10 @@ class Mesh_Netgen(Mesh_Algorithm):
self.is3D = is3D
if is3D:
#17908#if not Mesh_Netgen.algoNET23:
#17908# Mesh_Netgen.algoNET23 = self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
#17908#else:
#17908# self.Assign( Mesh_Netgen.algoNET23, mesh, geom)
#17908# pass
self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
pass
else:
#17908#if not Mesh_Netgen.algoNET2:
#17908# Mesh_Netgen.algoNET2 = self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
#17908#else:
#17908# self.Assign( Mesh_Netgen.algoNET2, mesh, geom)
#17908# pass
self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
pass
@ -1198,17 +1261,9 @@ class Mesh_Netgen(Mesh_Algorithm):
# More details.
class Mesh_Projection1D(Mesh_Algorithm):
#17908#algo = 0 # algorithm object common for all Mesh_Projection1Ds
## Private constructor.
def __init__(self, mesh, geom=0):
Mesh_Algorithm.__init__(self)
#17908#if not Mesh_Projection1D.algo:
#17908# Mesh_Projection1D.algo = self.Create(mesh, geom, "Projection_1D")
#17908#else:
#17908# self.Assign( Mesh_Projection1D.algo, mesh, geom)
#17908# pass
self.Create(mesh, geom, "Projection_1D")
## Define "Source Edge" hypothesis, specifying a meshed edge to
@ -1222,7 +1277,9 @@ class Mesh_Projection1D(Mesh_Algorithm):
# @param UseExisting if ==true - search existing hypothesis created with
# same parameters, else (default) - create new
def SourceEdge(self, edge, mesh=None, srcV=None, tgtV=None, UseExisting=0):
hyp = self.Hypothesis("ProjectionSource1D", [edge,mesh,srcV,tgtV], UseExisting=UseExisting)
hyp = self.Hypothesis("ProjectionSource1D", [edge,mesh,srcV,tgtV],
UseExisting=0)
#UseExisting=UseExisting, CompareMethod=self.CompareSourceEdge)
hyp.SetSourceEdge( edge )
if not mesh is None and isinstance(mesh, Mesh):
mesh = mesh.GetMesh()
@ -1230,6 +1287,11 @@ class Mesh_Projection1D(Mesh_Algorithm):
hyp.SetVertexAssociation( srcV, tgtV )
return hyp
## Check if the given "SourceEdge" hypothesis has the same parameters as given arguments
#def CompareSourceEdge(self, hyp, args):
# # seems to be not really useful to reuse existing "SourceEdge" hypothesis
# return False
# Public class: Mesh_Projection2D
# ------------------------------
@ -1239,17 +1301,9 @@ class Mesh_Projection1D(Mesh_Algorithm):
# More details.
class Mesh_Projection2D(Mesh_Algorithm):
#17908#algo = 0 # algorithm object common for all Mesh_Projection2Ds
## Private constructor.
def __init__(self, mesh, geom=0):
Mesh_Algorithm.__init__(self)
#17908#if not Mesh_Projection2D.algo:
#17908# Mesh_Projection2D.algo = self.Create(mesh, geom, "Projection_2D")
#17908#else:
#17908# self.Assign( Mesh_Projection2D.algo, mesh, geom)
#17908# pass
self.Create(mesh, geom, "Projection_2D")
## Define "Source Face" hypothesis, specifying a meshed face to
@ -1270,7 +1324,8 @@ class Mesh_Projection2D(Mesh_Algorithm):
def SourceFace(self, face, mesh=None, srcV1=None, tgtV1=None,
srcV2=None, tgtV2=None, UseExisting=0):
hyp = self.Hypothesis("ProjectionSource2D", [face,mesh,srcV1,tgtV1,srcV2,tgtV2],
UseExisting=UseExisting)
UseExisting=0)
#UseExisting=UseExisting, CompareMethod=self.CompareSourceFace)
hyp.SetSourceFace( face )
if not mesh is None and isinstance(mesh, Mesh):
mesh = mesh.GetMesh()
@ -1278,6 +1333,11 @@ class Mesh_Projection2D(Mesh_Algorithm):
hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 )
return hyp
## Check if the given "SourceFace" hypothesis has the same parameters as given arguments
#def CompareSourceFace(self, hyp, args):
# # seems to be not really useful to reuse existing "SourceFace" hypothesis
# return False
# Public class: Mesh_Projection3D
# ------------------------------
@ -1286,17 +1346,9 @@ class Mesh_Projection2D(Mesh_Algorithm):
# More details.
class Mesh_Projection3D(Mesh_Algorithm):
#17908#algo = 0 # algorithm object common for all Mesh_Projection3Ds
## Private constructor.
def __init__(self, mesh, geom=0):
Mesh_Algorithm.__init__(self)
#17908#if not Mesh_Projection3D.algo:
#17908# Mesh_Projection3D.algo = self.Create(mesh, geom, "Projection_3D")
#17908#else:
#17908# self.Assign( Mesh_Projection3D.algo, mesh, geom)
#17908# pass
self.Create(mesh, geom, "Projection_3D")
## Define "Source Shape 3D" hypothesis, specifying a meshed solid to
@ -1318,7 +1370,8 @@ class Mesh_Projection3D(Mesh_Algorithm):
srcV2=0, tgtV2=0, UseExisting=0):
hyp = self.Hypothesis("ProjectionSource3D",
[solid,mesh,srcV1,tgtV1,srcV2,tgtV2],
UseExisting=UseExisting)
UseExisting=0)
#UseExisting=UseExisting, CompareMethod=self.CompareSourceShape3D)
hyp.SetSource3DShape( solid )
if not mesh is None and isinstance(mesh, Mesh):
mesh = mesh.GetMesh()
@ -1326,6 +1379,11 @@ class Mesh_Projection3D(Mesh_Algorithm):
hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 )
return hyp
## Check if the given "SourceShape3D" hypothesis has the same parameters as given arguments
#def CompareSourceShape3D(self, hyp, args):
# # seems to be not really useful to reuse existing "SourceShape3D" hypothesis
# return False
# Public class: Mesh_Prism
# ------------------------
@ -1335,17 +1393,9 @@ class Mesh_Projection3D(Mesh_Algorithm):
# More details.
class Mesh_Prism3D(Mesh_Algorithm):
#17908#algo = 0 # algorithm object common for all Mesh_Prism3Ds
## Private constructor.
def __init__(self, mesh, geom=0):
Mesh_Algorithm.__init__(self)
#17908#if not Mesh_Prism3D.algo:
#17908# Mesh_Prism3D.algo = self.Create(mesh, geom, "Prism_3D")
#17908#else:
#17908# self.Assign( Mesh_Prism3D.algo, mesh, geom)
#17908# pass
self.Create(mesh, geom, "Prism_3D")
# Public class: Mesh_RadialPrism
@ -1356,17 +1406,9 @@ class Mesh_Prism3D(Mesh_Algorithm):
# More details.
class Mesh_RadialPrism3D(Mesh_Algorithm):
#17908#algo = 0 # algorithm object common for all Mesh_RadialPrism3Ds
## Private constructor.
def __init__(self, mesh, geom=0):
Mesh_Algorithm.__init__(self)
#17908#if not Mesh_RadialPrism3D.algo:
#17908# Mesh_RadialPrism3D.algo = self.Create(mesh, geom, "RadialPrism_3D")
#17908#else:
#17908# self.Assign( Mesh_RadialPrism3D.algo, mesh, geom)
#17908# pass
self.Create(mesh, geom, "RadialPrism_3D")
self.distribHyp = self.Hypothesis("LayerDistribution", UseExisting=0)
@ -1395,10 +1437,15 @@ class Mesh_RadialPrism3D(Mesh_Algorithm):
# same parameters, else (default) - create new
def NumberOfLayers(self, n, UseExisting=0):
self.mesh.GetMesh().RemoveHypothesis( self.geom, self.distribHyp )
self.nbLayers = self.Hypothesis("NumberOfLayers", [n], UseExisting=UseExisting)
self.nbLayers = self.Hypothesis("NumberOfLayers", [n], UseExisting=UseExisting,
CompareMethod=self.CompareNumberOfLayers)
self.nbLayers.SetNumberOfLayers( n )
return self.nbLayers
## Check if the given "NumberOfLayers" hypothesis has the same parameters as given arguments
def CompareNumberOfLayers(self, hyp, args):
return IsEqual(hyp.GetNumberOfLayers(), args[0])
## Define "LocalLength" hypothesis, specifying segment length
# to build between the inner and outer shells
# @param l for the length of segments
@ -1453,23 +1500,10 @@ class Mesh_RadialPrism3D(Mesh_Algorithm):
# -------------------------------
class Mesh_UseExisting(Mesh_Algorithm):
#17908#algo1D = 0 # StdMeshers_UseExisting_1D object common for all Mesh_UseExisting
#17908#algo2D = 0 # StdMeshers_UseExisting_2D object common for all Mesh_UseExisting
def __init__(self, dim, mesh, geom=0):
if dim == 1:
#17908#if not Mesh_UseExisting.algo1D:
#17908# Mesh_UseExisting.algo1D= self.Create(mesh, geom, "UseExisting_1D")
#17908#else:
#17908# self.Assign( Mesh_UseExisting.algo1D, mesh, geom)
#17908# pass
self.Create(mesh, geom, "UseExisting_1D")
else:
#17908#if not Mesh_UseExisting.algo2D:
#17908# Mesh_UseExisting.algo2D= self.Create(mesh, geom, "UseExisting_2D")
#17908#else:
#17908# self.Assign( Mesh_UseExisting.algo2D, mesh, geom)
#17908# pass
self.Create(mesh, geom, "UseExisting_2D")
# Public class: Mesh