mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-02 21:00:34 +05:00
NPAL16198: EDF462: Submeshes creation duplicate algorithms and hypotheses. Refix.
This commit is contained in:
parent
32032d4d58
commit
415771a7d5
@ -43,6 +43,35 @@ module SMESH
|
|||||||
interface FilterManager;
|
interface FilterManager;
|
||||||
interface SMESH_Pattern;
|
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
|
* Hypothesis definintion error
|
||||||
*/
|
*/
|
||||||
@ -246,6 +275,12 @@ module SMESH
|
|||||||
in double theMergeTolerance)
|
in double theMergeTolerance)
|
||||||
raises ( SALOME::SALOME_Exception );
|
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -71,8 +71,8 @@ using namespace std;
|
|||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
SMESH_Algo::SMESH_Algo(int hypId, int studyId,
|
SMESH_Algo::SMESH_Algo (int hypId, int studyId, SMESH_Gen * gen)
|
||||||
SMESH_Gen * gen):SMESH_Hypothesis(hypId, studyId, gen)
|
: SMESH_Hypothesis(hypId, studyId, gen)
|
||||||
{
|
{
|
||||||
gen->_mapAlgo[hypId] = this;
|
gen->_mapAlgo[hypId] = this;
|
||||||
|
|
||||||
|
@ -149,6 +149,7 @@ bool SMESHDS_GroupBase::Contains (const SMDS_MeshElement* elem)
|
|||||||
{
|
{
|
||||||
if ( elem )
|
if ( elem )
|
||||||
return Contains( elem->GetID() );
|
return Contains( elem->GetID() );
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -48,14 +48,15 @@ dist_libSMESHFiltersSelection_la_SOURCES = \
|
|||||||
|
|
||||||
# additionnal information to compil and link file
|
# additionnal information to compil and link file
|
||||||
libSMESHFiltersSelection_la_CPPFLAGS = \
|
libSMESHFiltersSelection_la_CPPFLAGS = \
|
||||||
$(KERNEL_CXXFLAGS) \
|
|
||||||
$(GUI_CXXFLAGS) \
|
|
||||||
$(GEOM_CXXFLAGS) \
|
|
||||||
$(CAS_CPPFLAGS) \
|
$(CAS_CPPFLAGS) \
|
||||||
$(QT_INCLUDES) \
|
$(QT_INCLUDES) \
|
||||||
$(PYTHON_INCLUDES) \
|
$(PYTHON_INCLUDES) \
|
||||||
$(VTK_INCLUDES) \
|
$(VTK_INCLUDES) \
|
||||||
${BOOST_CPPFLAGS} \
|
$(KERNEL_CXXFLAGS) \
|
||||||
|
$(GUI_CXXFLAGS) \
|
||||||
|
$(GEOM_CXXFLAGS) \
|
||||||
|
$(MED_CXXFLAGS) \
|
||||||
|
$(BOOST_CPPFLAGS) \
|
||||||
$(CORBA_CXXFLAGS) \
|
$(CORBA_CXXFLAGS) \
|
||||||
$(CORBA_INCLUDES) \
|
$(CORBA_INCLUDES) \
|
||||||
-I$(top_builddir)/idl \
|
-I$(top_builddir)/idl \
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "SMESH_TypeFilter.hxx"
|
#include "SMESH_TypeFilter.hxx"
|
||||||
|
|
||||||
#include <SUIT_Session.h>
|
#include <SUIT_Session.h>
|
||||||
@ -24,6 +25,9 @@
|
|||||||
#include <SalomeApp_Study.h>
|
#include <SalomeApp_Study.h>
|
||||||
#include <LightApp_DataOwner.h>
|
#include <LightApp_DataOwner.h>
|
||||||
|
|
||||||
|
#include <SALOMEconfig.h>
|
||||||
|
#include CORBA_CLIENT_HEADER(SMESH_Gen)
|
||||||
|
|
||||||
SMESH_TypeFilter::SMESH_TypeFilter (MeshObjectType theType)
|
SMESH_TypeFilter::SMESH_TypeFilter (MeshObjectType theType)
|
||||||
{
|
{
|
||||||
myType = theType;
|
myType = theType;
|
||||||
@ -83,78 +87,86 @@ bool SMESH_TypeFilter::isOk (const SUIT_DataOwner* theDataOwner) const
|
|||||||
{
|
{
|
||||||
case HYPOTHESIS:
|
case HYPOTHESIS:
|
||||||
{
|
{
|
||||||
if ( aLevel == 2 && ( objFather->Tag() == 1 )) // hypo definition
|
if (aLevel == 2 && (objFather->Tag() == SMESH::Tag_HypothesisRoot))
|
||||||
|
// hypo definition
|
||||||
Ok = true;
|
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;
|
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;
|
Ok = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ALGORITHM:
|
case ALGORITHM:
|
||||||
{
|
{
|
||||||
if ( aLevel == 2 && ( objFather->Tag() == 2 )) // algo definition
|
if (aLevel == 2 && (objFather->Tag() == SMESH::Tag_AlgorithmsRoot))
|
||||||
|
// algo definition
|
||||||
Ok = true;
|
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;
|
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;
|
Ok = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MESH:
|
case MESH:
|
||||||
{
|
{
|
||||||
if ( aLevel == 1 && ( obj->Tag() >= 3 ))
|
if (aLevel == 1 && (obj->Tag() >= SMESH::Tag_FirstMeshRoot))
|
||||||
Ok = true;
|
Ok = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SUBMESH:
|
case SUBMESH:
|
||||||
{
|
{
|
||||||
// see SMESH_Gen_i.cxx for tag numbers
|
// 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;
|
Ok = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MESHorSUBMESH:
|
case MESHorSUBMESH:
|
||||||
{
|
{
|
||||||
if ( aLevel == 1 && ( obj->Tag() >= 3 ))
|
if (aLevel == 1 && (obj->Tag() >= SMESH::Tag_FirstMeshRoot))
|
||||||
Ok = true; // mesh
|
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;
|
Ok = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SUBMESH_VERTEX: // Label "SubMeshes on vertexes"
|
case SUBMESH_VERTEX: // Label "SubMeshes on vertexes"
|
||||||
{
|
{
|
||||||
if ( aLevel == 3 && ( objFather->Tag() == 4 ))
|
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnVertex))
|
||||||
Ok = true;
|
Ok = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SUBMESH_EDGE:
|
case SUBMESH_EDGE:
|
||||||
{
|
{
|
||||||
if ( aLevel == 3 && ( objFather->Tag() == 5 ))
|
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnEdge))
|
||||||
Ok = true;
|
Ok = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SUBMESH_FACE:
|
case SUBMESH_FACE:
|
||||||
{
|
{
|
||||||
if ( aLevel == 3 && ( objFather->Tag() == 7 ))
|
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnFace))
|
||||||
Ok = true;
|
Ok = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SUBMESH_SOLID:
|
case SUBMESH_SOLID:
|
||||||
{
|
{
|
||||||
if ( aLevel == 3 && ( objFather->Tag() == 9 ))
|
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnSolid))
|
||||||
Ok = true;
|
Ok = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SUBMESH_COMPOUND:
|
case SUBMESH_COMPOUND:
|
||||||
{
|
{
|
||||||
if ( aLevel == 3 && ( objFather->Tag() == 10 ))
|
if (aLevel == 3 && (objFather->Tag() == SMESH::Tag_SubMeshOnCompound))
|
||||||
Ok = true;
|
Ok = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GROUP:
|
case GROUP:
|
||||||
{
|
{
|
||||||
if ( aLevel == 3 && ( objFather->Tag() > 10 ))
|
if (aLevel == 3 && (objFather->Tag() >= SMESH::Tag_FirstGroup))
|
||||||
Ok = true;
|
Ok = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,8 @@
|
|||||||
#include "SMESH_TypeFilter.hxx"
|
#include "SMESH_TypeFilter.hxx"
|
||||||
#include "SMESH_NumberFilter.hxx"
|
#include "SMESH_NumberFilter.hxx"
|
||||||
|
|
||||||
|
#include CORBA_CLIENT_HEADER(SMESH_Gen)
|
||||||
|
|
||||||
#include "GEOM_SelectionFilter.h"
|
#include "GEOM_SelectionFilter.h"
|
||||||
#include "GEOMBase.h"
|
#include "GEOMBase.h"
|
||||||
#include "GeometryGUI.h"
|
#include "GeometryGUI.h"
|
||||||
@ -72,18 +74,6 @@
|
|||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
#include <TopExp_Explorer.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
|
* \brief Constructor
|
||||||
@ -368,13 +358,13 @@ _PTR(SObject) SMESHGUI_MeshOp::getSubmeshByGeom() const
|
|||||||
if ( !geom->_is_nil() ) {
|
if ( !geom->_is_nil() ) {
|
||||||
int tag = -1;
|
int tag = -1;
|
||||||
switch ( geom->GetShapeType() ) {
|
switch ( geom->GetShapeType() ) {
|
||||||
case GEOM::VERTEX: tag = SUBMESH_ON_VERTEX_TAG ; break;
|
case GEOM::VERTEX: tag = SMESH::Tag_SubMeshOnVertex ; break;
|
||||||
case GEOM::EDGE: tag = SUBMESH_ON_EDGE_TAG ; break;
|
case GEOM::EDGE: tag = SMESH::Tag_SubMeshOnEdge ; break;
|
||||||
case GEOM::WIRE: tag = SUBMESH_ON_WIRE_TAG ; break;
|
case GEOM::WIRE: tag = SMESH::Tag_SubMeshOnWire ; break;
|
||||||
case GEOM::FACE: tag = SUBMESH_ON_FACE_TAG ; break;
|
case GEOM::FACE: tag = SMESH::Tag_SubMeshOnFace ; break;
|
||||||
case GEOM::SHELL: tag = SUBMESH_ON_SHELL_TAG ; break;
|
case GEOM::SHELL: tag = SMESH::Tag_SubMeshOnShell ; break;
|
||||||
case GEOM::SOLID: tag = SUBMESH_ON_SOLID_TAG ; break;
|
case GEOM::SOLID: tag = SMESH::Tag_SubMeshOnSolid ; break;
|
||||||
case GEOM::COMPOUND: tag = SUBMESH_ON_COMPOUND_TAG; break;
|
case GEOM::COMPOUND: tag = SMESH::Tag_SubMeshOnCompound; break;
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
_PTR(GenericAttribute) anAttr;
|
_PTR(GenericAttribute) anAttr;
|
||||||
@ -760,9 +750,9 @@ void SMESHGUI_MeshOp::existingHyps( const int theDim,
|
|||||||
bool isMesh = !_CAST( SComponent, theFather );
|
bool isMesh = !_CAST( SComponent, theFather );
|
||||||
int aPart = -1;
|
int aPart = -1;
|
||||||
if ( isMesh )
|
if ( isMesh )
|
||||||
aPart = theHypType == Algo ? GLOBAL_ALGO_TAG : GLOBAL_HYPO_TAG;
|
aPart = theHypType == Algo ? SMESH::Tag_RefOnAppliedAlgorithms : SMESH::Tag_RefOnAppliedHypothesis;
|
||||||
else
|
else
|
||||||
aPart = theHypType == Algo ? LOCAL_ALGO_TAG : LOCAL_HYPO_TAG;
|
aPart = theHypType == Algo ? SMESH::Tag_AlgorithmsRoot : SMESH::Tag_HypothesisRoot;
|
||||||
|
|
||||||
if ( theFather->FindSubObject( aPart, aHypRoot ) )
|
if ( theFather->FindSubObject( aPart, aHypRoot ) )
|
||||||
{
|
{
|
||||||
|
@ -37,8 +37,8 @@
|
|||||||
#include "SMESHGUI_SelectionOp.h"
|
#include "SMESHGUI_SelectionOp.h"
|
||||||
|
|
||||||
#include <SALOMEconfig.h>
|
#include <SALOMEconfig.h>
|
||||||
#include CORBA_SERVER_HEADER(GEOM_Gen)
|
#include CORBA_CLIENT_HEADER(GEOM_Gen)
|
||||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
#include CORBA_CLIENT_HEADER(SMESH_Mesh)
|
||||||
|
|
||||||
#include <qstringlist.h>
|
#include <qstringlist.h>
|
||||||
|
|
||||||
|
@ -36,8 +36,9 @@
|
|||||||
#include "SVTK_RenderWindowInteractor.h"
|
#include "SVTK_RenderWindowInteractor.h"
|
||||||
#include "SVTK_ViewWindow.h"
|
#include "SVTK_ViewWindow.h"
|
||||||
|
|
||||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
#include CORBA_CLIENT_HEADER(SMESH_Gen)
|
||||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
#include CORBA_CLIENT_HEADER(SMESH_Mesh)
|
||||||
|
#include CORBA_CLIENT_HEADER(SMESH_Group)
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : SMESHGUI_Selection
|
//function : SMESHGUI_Selection
|
||||||
@ -313,7 +314,7 @@ QVariant SMESHGUI_Selection::isComputable( int ind ) const
|
|||||||
/* Handle(SALOME_InteractiveObject) io =
|
/* Handle(SALOME_InteractiveObject) io =
|
||||||
static_cast<LightApp_DataOwner*>( myDataOwners[ ind ].get() )->IO();
|
static_cast<LightApp_DataOwner*>( myDataOwners[ ind ].get() )->IO();
|
||||||
if ( !io.IsNull() ) {
|
if ( !io.IsNull() ) {
|
||||||
SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO(io) ; // m,sm,gr->m
|
SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO(io); // m,sm,gr->m
|
||||||
if ( !mesh->_is_nil() ) {*/
|
if ( !mesh->_is_nil() ) {*/
|
||||||
_PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).latin1() );
|
_PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).latin1() );
|
||||||
//FindSObject( mesh );
|
//FindSObject( mesh );
|
||||||
@ -402,47 +403,47 @@ int SMESHGUI_Selection::type( const QString& entry, _PTR(Study) study )
|
|||||||
anOTag = obj->Tag(),
|
anOTag = obj->Tag(),
|
||||||
res = -1;
|
res = -1;
|
||||||
|
|
||||||
switch( aLevel )
|
switch (aLevel)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
if( anOTag>=3 )
|
if (anOTag >= SMESH::Tag_FirstMeshRoot)
|
||||||
res = MESH;
|
res = MESH;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
switch( aFTag )
|
switch (aFTag)
|
||||||
{
|
{
|
||||||
case 1:
|
case SMESH::Tag_HypothesisRoot:
|
||||||
res = HYPOTHESIS;
|
res = HYPOTHESIS;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case SMESH::Tag_AlgorithmsRoot:
|
||||||
res = ALGORITHM;
|
res = ALGORITHM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
switch( aFTag )
|
switch (aFTag)
|
||||||
{
|
{
|
||||||
case 4:
|
case SMESH::Tag_SubMeshOnVertex:
|
||||||
res = SUBMESH_VERTEX;
|
res = SUBMESH_VERTEX;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case SMESH::Tag_SubMeshOnEdge:
|
||||||
res = SUBMESH_EDGE;
|
res = SUBMESH_EDGE;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case SMESH::Tag_SubMeshOnFace:
|
||||||
res = SUBMESH_FACE;
|
res = SUBMESH_FACE;
|
||||||
break;
|
break;
|
||||||
case 9:
|
case SMESH::Tag_SubMeshOnSolid:
|
||||||
res = SUBMESH_SOLID;
|
res = SUBMESH_SOLID;
|
||||||
break;
|
break;
|
||||||
case 10:
|
case SMESH::Tag_SubMeshOnCompound:
|
||||||
res = SUBMESH_COMPOUND;
|
res = SUBMESH_COMPOUND;
|
||||||
break;
|
break;
|
||||||
}
|
default:
|
||||||
if( aFTag>10 )
|
if (aFTag >= SMESH::Tag_FirstGroup)
|
||||||
res = GROUP;
|
res = GROUP;
|
||||||
else
|
else
|
||||||
res = SUBMESH;
|
res = SUBMESH;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include "SMESHGUI_Utils.h"
|
#include "SMESHGUI_Utils.h"
|
||||||
#include "SMESHGUI_MeshUtils.h"
|
#include "SMESHGUI_MeshUtils.h"
|
||||||
|
|
||||||
#include "SMESH.hxx"
|
|
||||||
#include "SMESH_TypeFilter.hxx"
|
#include "SMESH_TypeFilter.hxx"
|
||||||
|
|
||||||
#include "SALOMEDSClient_Study.hxx"
|
#include "SALOMEDSClient_Study.hxx"
|
||||||
@ -251,7 +250,7 @@ void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos()
|
|||||||
bool hasGroup = false;
|
bool hasGroup = false;
|
||||||
|
|
||||||
// info about groups on nodes
|
// info about groups on nodes
|
||||||
aMeshSO->FindSubObject(Tag_NodeGroups, anObj);
|
aMeshSO->FindSubObject(SMESH::Tag_NodeGroups, anObj);
|
||||||
if (anObj) {
|
if (anObj) {
|
||||||
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
|
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
|
||||||
if (it->More()) {
|
if (it->More()) {
|
||||||
@ -284,7 +283,7 @@ void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos()
|
|||||||
|
|
||||||
// info about groups on edges
|
// info about groups on edges
|
||||||
anObj.reset();
|
anObj.reset();
|
||||||
aMeshSO->FindSubObject(Tag_EdgeGroups, anObj);
|
aMeshSO->FindSubObject(SMESH::Tag_EdgeGroups, anObj);
|
||||||
if (anObj) {
|
if (anObj) {
|
||||||
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
|
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
|
||||||
if (!hasGroup && it->More()) {
|
if (!hasGroup && it->More()) {
|
||||||
@ -317,7 +316,7 @@ void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos()
|
|||||||
|
|
||||||
// info about groups on faces
|
// info about groups on faces
|
||||||
anObj.reset();
|
anObj.reset();
|
||||||
aMeshSO->FindSubObject(Tag_FaceGroups , anObj);
|
aMeshSO->FindSubObject(SMESH::Tag_FaceGroups , anObj);
|
||||||
if (anObj) {
|
if (anObj) {
|
||||||
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
|
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
|
||||||
if (!hasGroup && it->More()) {
|
if (!hasGroup && it->More()) {
|
||||||
@ -350,7 +349,7 @@ void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos()
|
|||||||
|
|
||||||
// info about groups on volumes
|
// info about groups on volumes
|
||||||
anObj.reset();
|
anObj.reset();
|
||||||
aMeshSO->FindSubObject(Tag_VolumeGroups, anObj);
|
aMeshSO->FindSubObject(SMESH::Tag_VolumeGroups, anObj);
|
||||||
if (anObj) {
|
if (anObj) {
|
||||||
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
|
_PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
|
||||||
if (!hasGroup && it->More())
|
if (!hasGroup && it->More())
|
||||||
|
@ -65,20 +65,6 @@ using namespace std;
|
|||||||
|
|
||||||
static CORBA::ORB_var anORB;
|
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
|
namespace
|
||||||
{
|
{
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
@ -125,7 +111,7 @@ namespace
|
|||||||
{
|
{
|
||||||
return GetDomainRoot(theSComponentMesh,
|
return GetDomainRoot(theSComponentMesh,
|
||||||
theStudyBuilder,
|
theStudyBuilder,
|
||||||
Tag_HypothesisRoot,
|
SMESH::Tag_HypothesisRoot,
|
||||||
QObject::tr("SMESH_MEN_HYPOTHESIS"),
|
QObject::tr("SMESH_MEN_HYPOTHESIS"),
|
||||||
"ICON_SMESH_TREE_HYPO");
|
"ICON_SMESH_TREE_HYPO");
|
||||||
}
|
}
|
||||||
@ -139,7 +125,7 @@ namespace
|
|||||||
{
|
{
|
||||||
return GetDomainRoot(theSComponentMesh,
|
return GetDomainRoot(theSComponentMesh,
|
||||||
theStudyBuilder,
|
theStudyBuilder,
|
||||||
Tag_AlgorithmsRoot,
|
SMESH::Tag_AlgorithmsRoot,
|
||||||
QObject::tr("SMESH_MEN_ALGORITHMS"),
|
QObject::tr("SMESH_MEN_ALGORITHMS"),
|
||||||
"ICON_SMESH_TREE_ALGO");
|
"ICON_SMESH_TREE_ALGO");
|
||||||
}
|
}
|
||||||
@ -157,7 +143,7 @@ namespace
|
|||||||
{
|
{
|
||||||
SALOMEDS::SObject_var aDomain = GetDomainRoot(theSComponentMesh,
|
SALOMEDS::SObject_var aDomain = GetDomainRoot(theSComponentMesh,
|
||||||
theStudyBuilder,
|
theStudyBuilder,
|
||||||
Tag_AlgorithmsRoot,
|
SMESH::Tag_AlgorithmsRoot,
|
||||||
theDomainName,
|
theDomainName,
|
||||||
theDomainPixmap);
|
theDomainPixmap);
|
||||||
// Add New Hypothesis
|
// Add New Hypothesis
|
||||||
@ -186,7 +172,7 @@ namespace
|
|||||||
return AddToDomain(theIOR,
|
return AddToDomain(theIOR,
|
||||||
theSComponentMesh,
|
theSComponentMesh,
|
||||||
theStudyBuilder,
|
theStudyBuilder,
|
||||||
Tag_HypothesisRoot,
|
SMESH::Tag_HypothesisRoot,
|
||||||
QObject::tr("SMESH_MEN_HYPOTHESIS"),
|
QObject::tr("SMESH_MEN_HYPOTHESIS"),
|
||||||
"ICON_SMESH_TREE_HYPO");
|
"ICON_SMESH_TREE_HYPO");
|
||||||
}
|
}
|
||||||
@ -201,7 +187,7 @@ namespace
|
|||||||
return AddToDomain(theIOR,
|
return AddToDomain(theIOR,
|
||||||
theSComponentMesh,
|
theSComponentMesh,
|
||||||
theStudyBuilder,
|
theStudyBuilder,
|
||||||
Tag_AlgorithmsRoot,
|
SMESH::Tag_AlgorithmsRoot,
|
||||||
QObject::tr("SMESH_MEN_ALGORITHMS"),
|
QObject::tr("SMESH_MEN_ALGORITHMS"),
|
||||||
"ICON_SMESH_TREE_ALGO");
|
"ICON_SMESH_TREE_ALGO");
|
||||||
}
|
}
|
||||||
@ -253,7 +239,7 @@ namespace
|
|||||||
theDomainEntry,
|
theDomainEntry,
|
||||||
theStudy,
|
theStudy,
|
||||||
theStudyBuilder,
|
theStudyBuilder,
|
||||||
Tag_RefOnAppliedHypothesis,
|
SMESH::Tag_RefOnAppliedHypothesis,
|
||||||
QObject::tr("SMESH_MEN_APPLIED_HYPOTHESIS"),
|
QObject::tr("SMESH_MEN_APPLIED_HYPOTHESIS"),
|
||||||
"ICON_SMESH_TREE_HYPO");
|
"ICON_SMESH_TREE_HYPO");
|
||||||
}
|
}
|
||||||
@ -270,7 +256,7 @@ namespace
|
|||||||
theDomainEntry,
|
theDomainEntry,
|
||||||
theStudy,
|
theStudy,
|
||||||
theStudyBuilder,
|
theStudyBuilder,
|
||||||
Tag_RefOnAppliedAlgorithms,
|
SMESH::Tag_RefOnAppliedAlgorithms,
|
||||||
QObject::tr("SMESH_MEN_APPLIED_ALGORIHTMS"),
|
QObject::tr("SMESH_MEN_APPLIED_ALGORIHTMS"),
|
||||||
"ICON_SMESH_TREE_ALGO");
|
"ICON_SMESH_TREE_ALGO");
|
||||||
}
|
}
|
||||||
@ -366,7 +352,7 @@ SMESH_Swig::Init(int theStudyID)
|
|||||||
aName = SALOMEDS::AttributeName::_narrow(anAttr);
|
aName = SALOMEDS::AttributeName::_narrow(anAttr);
|
||||||
|
|
||||||
SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI(); //SRN: BugID IPAL9186, load a SMESH gui if it hasn't been loaded
|
SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI(); //SRN: BugID IPAL9186, load a SMESH gui if it hasn't been loaded
|
||||||
if(!aSMESHGUI){
|
if (!aSMESHGUI){
|
||||||
CAM_Module* aModule = anApp->module("Mesh");
|
CAM_Module* aModule = anApp->module("Mesh");
|
||||||
if(!aModule)
|
if(!aModule)
|
||||||
aModule = anApp->loadModule("Mesh");
|
aModule = anApp->loadModule("Mesh");
|
||||||
@ -377,7 +363,7 @@ SMESH_Swig::Init(int theStudyID)
|
|||||||
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" );
|
aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" );
|
||||||
myStudyBuilder->DefineComponentInstance(aSComponent,aSMESHGen);
|
myStudyBuilder->DefineComponentInstance(aSComponent,aSMESHGen);
|
||||||
if(aLocked)
|
if (aLocked)
|
||||||
myStudy->GetProperties()->SetLocked(true);
|
myStudy->GetProperties()->SetLocked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,14 +390,13 @@ SMESH_Swig::~SMESH_Swig()
|
|||||||
|
|
||||||
|
|
||||||
//===============================================================
|
//===============================================================
|
||||||
const char*
|
const char* SMESH_Swig::AddNewMesh(const char* theIOR)
|
||||||
SMESH_Swig::AddNewMesh(const char* theIOR)
|
|
||||||
{
|
{
|
||||||
MESSAGE("AddNewMesh");
|
MESSAGE("AddNewMesh");
|
||||||
|
|
||||||
// VSR: added temporarily - to be removed - objects are published automatically by engine
|
// VSR: added temporarily - to be removed - objects are published automatically by engine
|
||||||
SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(theIOR);
|
SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(theIOR);
|
||||||
if(aSObject->_is_nil()){
|
if (aSObject->_is_nil()){
|
||||||
//Find or Create Hypothesis root
|
//Find or Create Hypothesis root
|
||||||
GetHypothesisRoot(mySComponentMesh,myStudyBuilder);
|
GetHypothesisRoot(mySComponentMesh,myStudyBuilder);
|
||||||
GetAlgorithmsRoot(mySComponentMesh,myStudyBuilder);
|
GetAlgorithmsRoot(mySComponentMesh,myStudyBuilder);
|
||||||
@ -433,10 +418,8 @@ SMESH_Swig::AddNewMesh(const char* theIOR)
|
|||||||
|
|
||||||
|
|
||||||
//===============================================================
|
//===============================================================
|
||||||
const char*
|
const char* SMESH_Swig::AddNewHypothesis(const char* theIOR)
|
||||||
SMESH_Swig::AddNewHypothesis(const char* theIOR)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
MESSAGE("AddNewHypothesis");
|
MESSAGE("AddNewHypothesis");
|
||||||
|
|
||||||
SALOMEDS::SObject_var aSObject = ::AddHypothesis(theIOR,
|
SALOMEDS::SObject_var aSObject = ::AddHypothesis(theIOR,
|
||||||
@ -448,8 +431,7 @@ SMESH_Swig::AddNewHypothesis(const char* theIOR)
|
|||||||
|
|
||||||
|
|
||||||
//===============================================================
|
//===============================================================
|
||||||
const char*
|
const char* SMESH_Swig::AddNewAlgorithms(const char* theIOR)
|
||||||
SMESH_Swig::AddNewAlgorithms(const char* theIOR)
|
|
||||||
{
|
{
|
||||||
MESSAGE("AddNewAlgorithms");
|
MESSAGE("AddNewAlgorithms");
|
||||||
|
|
||||||
@ -462,23 +444,21 @@ SMESH_Swig::AddNewAlgorithms(const char* theIOR)
|
|||||||
|
|
||||||
|
|
||||||
//===============================================================
|
//===============================================================
|
||||||
void
|
void SMESH_Swig::SetShape(const char* theShapeEntry,
|
||||||
SMESH_Swig::SetShape(const char* theShapeEntry,
|
|
||||||
const char* theMeshEntry)
|
const char* theMeshEntry)
|
||||||
{
|
{
|
||||||
SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID( theMeshEntry );
|
SALOMEDS::SObject_var aMeshSO = myStudy->FindObjectID( theMeshEntry );
|
||||||
SALOMEDS::SObject_var aGeomShapeSO = myStudy->FindObjectID( theShapeEntry );
|
SALOMEDS::SObject_var aGeomShapeSO = myStudy->FindObjectID( theShapeEntry );
|
||||||
|
|
||||||
if(!aMeshSO->_is_nil() && !aGeomShapeSO->_is_nil()){
|
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);
|
myStudyBuilder->Addreference(aSObject,aGeomShapeSO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//===============================================================
|
//===============================================================
|
||||||
void
|
void SMESH_Swig::SetHypothesis(const char* theMeshOrSubMeshEntry,
|
||||||
SMESH_Swig::SetHypothesis(const char* theMeshOrSubMeshEntry,
|
|
||||||
const char* theDomainEntry)
|
const char* theDomainEntry)
|
||||||
{
|
{
|
||||||
::SetHypothesis(theMeshOrSubMeshEntry,
|
::SetHypothesis(theMeshOrSubMeshEntry,
|
||||||
@ -489,8 +469,7 @@ SMESH_Swig::SetHypothesis(const char* theMeshOrSubMeshEntry,
|
|||||||
|
|
||||||
|
|
||||||
//===============================================================
|
//===============================================================
|
||||||
void
|
void SMESH_Swig::SetAlgorithms(const char* theMeshOrSubMeshEntry,
|
||||||
SMESH_Swig::SetAlgorithms(const char* theMeshOrSubMeshEntry,
|
|
||||||
const char* theDomainEntry)
|
const char* theDomainEntry)
|
||||||
{
|
{
|
||||||
::SetAlgorithms(theMeshOrSubMeshEntry,
|
::SetAlgorithms(theMeshOrSubMeshEntry,
|
||||||
@ -509,8 +488,7 @@ SMESH_Swig::UnSetHypothesis(const char* theDomainEntry)
|
|||||||
myStudyBuilder->RemoveObject(aDomainSO);
|
myStudyBuilder->RemoveObject(aDomainSO);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char*
|
const char* SMESH_Swig::AddSubMesh(const char* theMeshEntry,
|
||||||
SMESH_Swig::AddSubMesh(const char* theMeshEntry,
|
|
||||||
const char* theSubMeshIOR,
|
const char* theSubMeshIOR,
|
||||||
int theShapeType)
|
int theShapeType)
|
||||||
{
|
{
|
||||||
@ -520,23 +498,23 @@ SMESH_Swig::AddSubMesh(const char* theMeshEntry,
|
|||||||
QString aSubMeshName;
|
QString aSubMeshName;
|
||||||
switch(theShapeType){
|
switch(theShapeType){
|
||||||
case TopAbs_SOLID:
|
case TopAbs_SOLID:
|
||||||
aShapeTag = Tag_SubMeshOnSolid;
|
aShapeTag = SMESH::Tag_SubMeshOnSolid;
|
||||||
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnSolid");
|
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnSolid");
|
||||||
break;
|
break;
|
||||||
case TopAbs_FACE:
|
case TopAbs_FACE:
|
||||||
aShapeTag = Tag_SubMeshOnFace;
|
aShapeTag = SMESH::Tag_SubMeshOnFace;
|
||||||
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnFace");
|
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnFace");
|
||||||
break;
|
break;
|
||||||
case TopAbs_EDGE:
|
case TopAbs_EDGE:
|
||||||
aShapeTag = Tag_SubMeshOnEdge;
|
aShapeTag = SMESH::Tag_SubMeshOnEdge;
|
||||||
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnEdge");
|
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnEdge");
|
||||||
break;
|
break;
|
||||||
case TopAbs_VERTEX:
|
case TopAbs_VERTEX:
|
||||||
aShapeTag = Tag_SubMeshOnVertex;
|
aShapeTag = SMESH::Tag_SubMeshOnVertex;
|
||||||
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnVertex");
|
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnVertex");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
aShapeTag = Tag_SubMeshOnCompound;
|
aShapeTag = SMESH::Tag_SubMeshOnCompound;
|
||||||
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnCompound");
|
aSubMeshName = QObject::tr("SMESH_MEN_SubMeshesOnCompound");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -564,8 +542,7 @@ SMESH_Swig::AddSubMesh(const char* theMeshEntry,
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char*
|
const char* SMESH_Swig::AddSubMeshOnShape(const char* theMeshEntry,
|
||||||
SMESH_Swig::AddSubMeshOnShape(const char* theMeshEntry,
|
|
||||||
const char* theGeomShapeEntry,
|
const char* theGeomShapeEntry,
|
||||||
const char* theSubMeshIOR,
|
const char* theSubMeshIOR,
|
||||||
int ShapeType)
|
int ShapeType)
|
||||||
@ -607,11 +584,9 @@ void SMESH_Swig::CreateAndDisplayActor( const char* Mesh_Entry )
|
|||||||
};
|
};
|
||||||
|
|
||||||
ProcessVoidEvent(new TEvent(Mesh_Entry));
|
ProcessVoidEvent(new TEvent(Mesh_Entry));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void SMESH_Swig::SetName(const char* theEntry,
|
||||||
SMESH_Swig::SetName(const char* theEntry,
|
|
||||||
const char* theName)
|
const char* theName)
|
||||||
{
|
{
|
||||||
SALOMEDS::SObject_var aSObject = myStudy->FindObjectID(theEntry);
|
SALOMEDS::SObject_var aSObject = myStudy->FindObjectID(theEntry);
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
// File : SMESH.hxx
|
// File : SMESH.hxx
|
||||||
// Author : Michael ZORIN
|
// Author : Michael ZORIN
|
||||||
// Module : SMESH
|
// Module : SMESH
|
||||||
// $Header:
|
// $Header$
|
||||||
|
|
||||||
#ifndef _SMESH_I_SMESH_HXX_
|
#ifndef _SMESH_I_SMESH_HXX_
|
||||||
#define _SMESH_I_SMESH_HXX_
|
#define _SMESH_I_SMESH_HXX_
|
||||||
@ -39,28 +39,4 @@
|
|||||||
#define SMESH_I_EXPORT
|
#define SMESH_I_EXPORT
|
||||||
#endif
|
#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
|
#endif
|
||||||
|
|
||||||
|
@ -327,9 +327,9 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
|
|||||||
{
|
{
|
||||||
int libNameLen = strlen(theLibName);
|
int libNameLen = strlen(theLibName);
|
||||||
//check for old format "libXXXXXXX.so"
|
//check for old format "libXXXXXXX.so"
|
||||||
if( libNameLen > 7 &&
|
if (libNameLen > 7 &&
|
||||||
!strncmp( theLibName, "lib", 3 ) &&
|
!strncmp( theLibName, "lib", 3 ) &&
|
||||||
!strcmp( theLibName+libNameLen-3, ".so" ) )
|
!strcmp( theLibName+libNameLen-3, ".so" ))
|
||||||
{
|
{
|
||||||
//the old format
|
//the old format
|
||||||
#ifdef WNT
|
#ifdef WNT
|
||||||
@ -344,7 +344,6 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
|
|||||||
aPlatformLibName = strcat( aPlatformLibName, theLibName );
|
aPlatformLibName = strcat( aPlatformLibName, theLibName );
|
||||||
aPlatformLibName[libNameLen] = '\0';
|
aPlatformLibName[libNameLen] = '\0';
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -365,7 +364,6 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Unexpect aCatch(SALOME_SalomeException);
|
Unexpect aCatch(SALOME_SalomeException);
|
||||||
if(MYDEBUG) MESSAGE( "Create Hypothesis <" << theHypName << "> from " << aPlatformLibName/*theLibName*/);
|
if(MYDEBUG) MESSAGE( "Create Hypothesis <" << theHypName << "> from " << aPlatformLibName/*theLibName*/);
|
||||||
|
|
||||||
@ -418,7 +416,7 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
|
|||||||
// create a new hypothesis object, store its ref. in studyContext
|
// create a new hypothesis object, store its ref. in studyContext
|
||||||
if(MYDEBUG) MESSAGE("Create Hypothesis " << theHypName);
|
if(MYDEBUG) MESSAGE("Create Hypothesis " << theHypName);
|
||||||
myHypothesis_i =
|
myHypothesis_i =
|
||||||
myHypCreatorMap[string(theHypName)]->Create (myPoa, GetCurrentStudyID(), &myGen);
|
myHypCreatorMap[string(theHypName)]->Create(myPoa, GetCurrentStudyID(), &myGen);
|
||||||
myHypothesis_i->SetLibName(aPlatformLibName/*theLibName*/); // for persistency assurance
|
myHypothesis_i->SetLibName(aPlatformLibName/*theLibName*/); // for persistency assurance
|
||||||
}
|
}
|
||||||
catch (SALOME_Exception& S_ex)
|
catch (SALOME_Exception& S_ex)
|
||||||
@ -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();
|
StudyContext* myStudyContext = GetCurrentStudyContext();
|
||||||
if ( myStudyContext && !CORBA::is_nil( theObject )) {
|
if ( myStudyContext && !CORBA::is_nil( theObject )) {
|
||||||
|
@ -427,7 +427,7 @@ public:
|
|||||||
int RegisterObject(CORBA::Object_ptr theObject);
|
int RegisterObject(CORBA::Object_ptr theObject);
|
||||||
|
|
||||||
// Return id of registered object
|
// 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
|
// Return an object that previously had an oldID
|
||||||
template<class TInterface>
|
template<class TInterface>
|
||||||
|
@ -34,8 +34,6 @@
|
|||||||
#include "SMESH_Group_i.hxx"
|
#include "SMESH_Group_i.hxx"
|
||||||
#include "SMESH_subMesh_i.hxx"
|
#include "SMESH_subMesh_i.hxx"
|
||||||
|
|
||||||
#include "SMESH.hxx"
|
|
||||||
|
|
||||||
#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
|
#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
|
||||||
|
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
@ -59,82 +57,82 @@ static int MYDEBUG = 0;
|
|||||||
|
|
||||||
long SMESH_Gen_i::GetHypothesisRootTag()
|
long SMESH_Gen_i::GetHypothesisRootTag()
|
||||||
{
|
{
|
||||||
return Tag_HypothesisRoot;
|
return SMESH::Tag_HypothesisRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SMESH_Gen_i::GetAlgorithmsRootTag()
|
long SMESH_Gen_i::GetAlgorithmsRootTag()
|
||||||
{
|
{
|
||||||
return Tag_AlgorithmsRoot;
|
return SMESH::Tag_AlgorithmsRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SMESH_Gen_i::GetRefOnShapeTag()
|
long SMESH_Gen_i::GetRefOnShapeTag()
|
||||||
{
|
{
|
||||||
return Tag_RefOnShape;
|
return SMESH::Tag_RefOnShape;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SMESH_Gen_i::GetRefOnAppliedHypothesisTag()
|
long SMESH_Gen_i::GetRefOnAppliedHypothesisTag()
|
||||||
{
|
{
|
||||||
return Tag_RefOnAppliedHypothesis;
|
return SMESH::Tag_RefOnAppliedHypothesis;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SMESH_Gen_i::GetRefOnAppliedAlgorithmsTag()
|
long SMESH_Gen_i::GetRefOnAppliedAlgorithmsTag()
|
||||||
{
|
{
|
||||||
return Tag_RefOnAppliedAlgorithms;
|
return SMESH::Tag_RefOnAppliedAlgorithms;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SMESH_Gen_i::GetSubMeshOnVertexTag()
|
long SMESH_Gen_i::GetSubMeshOnVertexTag()
|
||||||
{
|
{
|
||||||
return Tag_SubMeshOnVertex;
|
return SMESH::Tag_SubMeshOnVertex;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SMESH_Gen_i::GetSubMeshOnEdgeTag()
|
long SMESH_Gen_i::GetSubMeshOnEdgeTag()
|
||||||
{
|
{
|
||||||
return Tag_SubMeshOnEdge;
|
return SMESH::Tag_SubMeshOnEdge;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SMESH_Gen_i::GetSubMeshOnFaceTag()
|
long SMESH_Gen_i::GetSubMeshOnFaceTag()
|
||||||
{
|
{
|
||||||
return Tag_SubMeshOnFace;
|
return SMESH::Tag_SubMeshOnFace;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SMESH_Gen_i::GetSubMeshOnSolidTag()
|
long SMESH_Gen_i::GetSubMeshOnSolidTag()
|
||||||
{
|
{
|
||||||
return Tag_SubMeshOnSolid;
|
return SMESH::Tag_SubMeshOnSolid;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SMESH_Gen_i::GetSubMeshOnCompoundTag()
|
long SMESH_Gen_i::GetSubMeshOnCompoundTag()
|
||||||
{
|
{
|
||||||
return Tag_SubMeshOnCompound;
|
return SMESH::Tag_SubMeshOnCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SMESH_Gen_i::GetSubMeshOnWireTag()
|
long SMESH_Gen_i::GetSubMeshOnWireTag()
|
||||||
{
|
{
|
||||||
return Tag_SubMeshOnWire;
|
return SMESH::Tag_SubMeshOnWire;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SMESH_Gen_i::GetSubMeshOnShellTag()
|
long SMESH_Gen_i::GetSubMeshOnShellTag()
|
||||||
{
|
{
|
||||||
return Tag_SubMeshOnShell;
|
return SMESH::Tag_SubMeshOnShell;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SMESH_Gen_i::GetNodeGroupsTag()
|
long SMESH_Gen_i::GetNodeGroupsTag()
|
||||||
{
|
{
|
||||||
return Tag_NodeGroups;
|
return SMESH::Tag_NodeGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SMESH_Gen_i::GetEdgeGroupsTag()
|
long SMESH_Gen_i::GetEdgeGroupsTag()
|
||||||
{
|
{
|
||||||
return Tag_EdgeGroups;
|
return SMESH::Tag_EdgeGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SMESH_Gen_i::GetFaceGroupsTag()
|
long SMESH_Gen_i::GetFaceGroupsTag()
|
||||||
{
|
{
|
||||||
return Tag_FaceGroups;
|
return SMESH::Tag_FaceGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
long SMESH_Gen_i::GetVolumeGroupsTag()
|
long SMESH_Gen_i::GetVolumeGroupsTag()
|
||||||
{
|
{
|
||||||
return Tag_VolumeGroups;
|
return SMESH::Tag_VolumeGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -78,6 +78,12 @@ Fine = 3
|
|||||||
VeryFine = 4
|
VeryFine = 4
|
||||||
Custom = 5
|
Custom = 5
|
||||||
|
|
||||||
|
PrecisionConfusion = 1e-07
|
||||||
|
|
||||||
|
def IsEqual(val1, val2, tol=PrecisionConfusion):
|
||||||
|
if abs(val1 - val2) < tol:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
NO_NAME = "NoName"
|
NO_NAME = "NoName"
|
||||||
|
|
||||||
@ -422,8 +428,6 @@ class Mesh_Algorithm:
|
|||||||
# @class Mesh_Algorithm
|
# @class Mesh_Algorithm
|
||||||
# @brief Class Mesh_Algorithm
|
# @brief Class Mesh_Algorithm
|
||||||
|
|
||||||
#17908#hypos = {}
|
|
||||||
|
|
||||||
#def __init__(self,smesh):
|
#def __init__(self,smesh):
|
||||||
# self.smesh=smesh
|
# self.smesh=smesh
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -432,11 +436,84 @@ class Mesh_Algorithm:
|
|||||||
self.subm = None
|
self.subm = None
|
||||||
self.algo = None
|
self.algo = None
|
||||||
|
|
||||||
#17908#def FindHypothesis(self,hypname, args):
|
## Find hypothesis in study by its type name and parameters.
|
||||||
#17908# key = "%s %s %s" % (self.__class__.__name__, hypname, args)
|
# Find only those hypothesis, which was created in smeshpyD engine.
|
||||||
#17908# if Mesh_Algorithm.hypos.has_key( key ):
|
def FindHypothesis (self, hypname, args, CompareMethod, smeshpyD):
|
||||||
#17908# return Mesh_Algorithm.hypos[ key ]
|
study = smeshpyD.GetCurrentStudy()
|
||||||
#17908# return None
|
#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
|
## If the algorithm is global, return 0; \n
|
||||||
# else return the submesh associated to this algorithm.
|
# else return the submesh associated to this algorithm.
|
||||||
@ -470,14 +547,17 @@ class Mesh_Algorithm:
|
|||||||
def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"):
|
def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"):
|
||||||
if geom is None:
|
if geom is None:
|
||||||
raise RuntimeError, "Attemp to create " + hypo + " algoritm on None shape"
|
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)
|
algo = mesh.smeshpyD.CreateHypothesis(hypo, so)
|
||||||
|
pass
|
||||||
self.Assign(algo, mesh, geom)
|
self.Assign(algo, mesh, geom)
|
||||||
return self.algo
|
return self.algo
|
||||||
|
|
||||||
## Private method
|
## Private method
|
||||||
def Assign(self, algo, mesh, geom):
|
def Assign(self, algo, mesh, geom):
|
||||||
if geom is None:
|
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
|
self.mesh = mesh
|
||||||
piece = mesh.geom
|
piece = mesh.geom
|
||||||
if not geom:
|
if not geom:
|
||||||
@ -494,17 +574,23 @@ class Mesh_Algorithm:
|
|||||||
status = mesh.mesh.AddHypothesis(self.geom, self.algo)
|
status = mesh.mesh.AddHypothesis(self.geom, self.algo)
|
||||||
TreatHypoStatus( status, algo.GetName(), GetName(self.geom), True )
|
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
|
## Private method
|
||||||
def Hypothesis(self, hyp, args=[], so="libStdMeshersEngine.so", UseExisting=0):
|
def Hypothesis (self, hyp, args=[], so="libStdMeshersEngine.so",
|
||||||
CreateNew = 1
|
UseExisting=0, CompareMethod=""):
|
||||||
#17908#if UseExisting:
|
hypo = None
|
||||||
#17908# hypo = self.FindHypothesis(hyp, args)
|
if UseExisting:
|
||||||
#17908# if hypo: CreateNew = 0
|
if CompareMethod == "": CompareMethod = self.CompareHyp
|
||||||
#17908# pass
|
hypo = self.FindHypothesis(hyp, args, CompareMethod, self.mesh.smeshpyD)
|
||||||
if CreateNew:
|
pass
|
||||||
|
if hypo is None:
|
||||||
hypo = self.mesh.smeshpyD.CreateHypothesis(hyp, so)
|
hypo = self.mesh.smeshpyD.CreateHypothesis(hyp, so)
|
||||||
key = "%s %s %s" % (self.__class__.__name__, hyp, args)
|
|
||||||
#17908#Mesh_Algorithm.hypos[key] = hypo
|
|
||||||
a = ""
|
a = ""
|
||||||
s = "="
|
s = "="
|
||||||
i = 0
|
i = 0
|
||||||
@ -513,8 +599,7 @@ class Mesh_Algorithm:
|
|||||||
a = a + s + str(args[i])
|
a = a + s + str(args[i])
|
||||||
s = ","
|
s = ","
|
||||||
i = i + 1
|
i = i + 1
|
||||||
name = GetName(self.geom)
|
pass
|
||||||
#SetName(hypo, name + "/" + hyp + a) - NPAL16198
|
|
||||||
SetName(hypo, hyp + a)
|
SetName(hypo, hyp + a)
|
||||||
pass
|
pass
|
||||||
status = self.mesh.mesh.AddHypothesis(self.geom, hypo)
|
status = self.mesh.mesh.AddHypothesis(self.geom, hypo)
|
||||||
@ -530,17 +615,9 @@ class Mesh_Algorithm:
|
|||||||
# More details.
|
# More details.
|
||||||
class Mesh_Segment(Mesh_Algorithm):
|
class Mesh_Segment(Mesh_Algorithm):
|
||||||
|
|
||||||
#17908#algo = 0 # algorithm object common for all Mesh_Segments
|
|
||||||
|
|
||||||
## Private constructor.
|
## Private constructor.
|
||||||
def __init__(self, mesh, geom=0):
|
def __init__(self, mesh, geom=0):
|
||||||
Mesh_Algorithm.__init__(self)
|
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")
|
self.Create(mesh, geom, "Regular_1D")
|
||||||
|
|
||||||
## Define "LocalLength" hypothesis to cut an edge in several segments with the same length
|
## 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
|
# @param UseExisting if ==true - search existing hypothesis created with
|
||||||
# same parameters, else (default) - create new
|
# same parameters, else (default) - create new
|
||||||
def LocalLength(self, l, UseExisting=0):
|
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)
|
hyp.SetLength(l)
|
||||||
return hyp
|
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
|
## 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 n for the number of segments that cut an edge
|
||||||
# @param s for the scale factor (optional)
|
# @param s for the scale factor (optional)
|
||||||
@ -559,79 +641,142 @@ class Mesh_Segment(Mesh_Algorithm):
|
|||||||
# same parameters, else (default) - create new
|
# same parameters, else (default) - create new
|
||||||
def NumberOfSegments(self, n, s=[], UseExisting=0):
|
def NumberOfSegments(self, n, s=[], UseExisting=0):
|
||||||
if s == []:
|
if s == []:
|
||||||
hyp = self.Hypothesis("NumberOfSegments", [n], UseExisting=UseExisting)
|
hyp = self.Hypothesis("NumberOfSegments", [n], UseExisting=UseExisting,
|
||||||
|
CompareMethod=self.CompareNumberOfSegments)
|
||||||
else:
|
else:
|
||||||
hyp = self.Hypothesis("NumberOfSegments", [n,s], UseExisting=UseExisting)
|
hyp = self.Hypothesis("NumberOfSegments", [n,s], UseExisting=UseExisting,
|
||||||
|
CompareMethod=self.CompareNumberOfSegments)
|
||||||
hyp.SetDistrType( 1 )
|
hyp.SetDistrType( 1 )
|
||||||
hyp.SetScaleFactor(s)
|
hyp.SetScaleFactor(s)
|
||||||
hyp.SetNumberOfSegments(n)
|
hyp.SetNumberOfSegments(n)
|
||||||
return hyp
|
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
|
## Define "Arithmetic1D" hypothesis to cut an edge in several segments with arithmetic length increasing
|
||||||
# @param start for the length of the first segment
|
# @param start for the length of the first segment
|
||||||
# @param end for the length of the last segment
|
# @param end for the length of the last segment
|
||||||
# @param UseExisting if ==true - search existing hypothesis created with
|
# @param UseExisting if ==true - search existing hypothesis created with
|
||||||
# same parameters, else (default) - create new
|
# same parameters, else (default) - create new
|
||||||
def Arithmetic1D(self, start, end, UseExisting=0):
|
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(start, 1)
|
||||||
hyp.SetLength(end , 0)
|
hyp.SetLength(end , 0)
|
||||||
return hyp
|
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
|
## Define "StartEndLength" hypothesis to cut an edge in several segments with geometric length increasing
|
||||||
# @param start for the length of the first segment
|
# @param start for the length of the first segment
|
||||||
# @param end for the length of the last segment
|
# @param end for the length of the last segment
|
||||||
# @param UseExisting if ==true - search existing hypothesis created with
|
# @param UseExisting if ==true - search existing hypothesis created with
|
||||||
# same parameters, else (default) - create new
|
# same parameters, else (default) - create new
|
||||||
def StartEndLength(self, start, end, UseExisting=0):
|
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(start, 1)
|
||||||
hyp.SetLength(end , 0)
|
hyp.SetLength(end , 0)
|
||||||
return hyp
|
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
|
## Define "Deflection1D" hypothesis
|
||||||
# @param d for the deflection
|
# @param d for the deflection
|
||||||
# @param UseExisting if ==true - search existing hypothesis created with
|
# @param UseExisting if ==true - search existing hypothesis created with
|
||||||
# same parameters, else (default) - create new
|
# same parameters, else (default) - create new
|
||||||
def Deflection1D(self, d, UseExisting=0):
|
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)
|
hyp.SetDeflection(d)
|
||||||
return hyp
|
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
|
## Define "Propagation" hypothesis that propagate all other hypothesis on all others edges that are in
|
||||||
# the opposite side in the case of quadrangular faces
|
# the opposite side in the case of quadrangular faces
|
||||||
def Propagation(self):
|
def Propagation(self):
|
||||||
return self.Hypothesis("Propagation", UseExisting=1)
|
return self.Hypothesis("Propagation", UseExisting=1, CompareMethod=self.CompareEqualHyp)
|
||||||
|
|
||||||
## Define "AutomaticLength" hypothesis
|
## Define "AutomaticLength" hypothesis
|
||||||
# @param fineness for the fineness [0-1]
|
# @param fineness for the fineness [0-1]
|
||||||
# @param UseExisting if ==true - search existing hypothesis created with
|
# @param UseExisting if ==true - search existing hypothesis created with
|
||||||
# same parameters, else (default) - create new
|
# same parameters, else (default) - create new
|
||||||
def AutomaticLength(self, fineness=0, UseExisting=0):
|
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 )
|
hyp.SetFineness( fineness )
|
||||||
return hyp
|
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
|
## Define "SegmentLengthAroundVertex" hypothesis
|
||||||
# @param length for the segment length
|
# @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
|
# @param UseExisting if ==true - search existing hypothesis created with
|
||||||
# same parameters, else (default) - create new
|
# same parameters, else (default) - create new
|
||||||
def LengthNearVertex(self, length, vertex=0, UseExisting=0):
|
def LengthNearVertex(self, length, vertex=0, UseExisting=0):
|
||||||
import types
|
import types
|
||||||
store_geom = self.geom
|
store_geom = self.geom
|
||||||
if vertex:
|
|
||||||
if type(vertex) is types.IntType:
|
if type(vertex) is types.IntType:
|
||||||
|
if vertex == 0 or vertex == 1:
|
||||||
vertex = self.mesh.geompyD.SubShapeAllSorted(self.geom, geompyDC.ShapeType["VERTEX"])[vertex]
|
vertex = self.mesh.geompyD.SubShapeAllSorted(self.geom, geompyDC.ShapeType["VERTEX"])[vertex]
|
||||||
pass
|
|
||||||
self.geom = vertex
|
self.geom = vertex
|
||||||
pass
|
pass
|
||||||
hyp = self.Hypothesis("SegmentAroundVertex_0D",[length],UseExisting=UseExisting)
|
pass
|
||||||
hyp = self.Hypothesis("SegmentLengthAroundVertex",[length],UseExisting=UseExisting)
|
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
|
self.geom = store_geom
|
||||||
hyp.SetLength( length )
|
hyp.SetLength( length )
|
||||||
return hyp
|
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.
|
## Define "QuadraticMesh" hypothesis, forcing construction of quadratic edges.
|
||||||
# If the 2D mesher sees that all boundary edges are quadratic ones,
|
# If the 2D mesher sees that all boundary edges are quadratic ones,
|
||||||
# it generates quadratic faces, else it generates linear faces using
|
# 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
|
# The 3D mesher generates quadratic volumes only if all boundary faces
|
||||||
# are quadratic ones, else it fails.
|
# are quadratic ones, else it fails.
|
||||||
def QuadraticMesh(self):
|
def QuadraticMesh(self):
|
||||||
hyp = self.Hypothesis("QuadraticMesh", UseExisting=1)
|
hyp = self.Hypothesis("QuadraticMesh", UseExisting=1, CompareMethod=self.CompareEqualHyp)
|
||||||
return hyp
|
return hyp
|
||||||
|
|
||||||
# Public class: Mesh_CompositeSegment
|
# Public class: Mesh_CompositeSegment
|
||||||
@ -650,15 +795,8 @@ class Mesh_Segment(Mesh_Algorithm):
|
|||||||
# More details.
|
# More details.
|
||||||
class Mesh_CompositeSegment(Mesh_Segment):
|
class Mesh_CompositeSegment(Mesh_Segment):
|
||||||
|
|
||||||
#17908#algo = 0 # algorithm object common for all Mesh_CompositeSegments
|
|
||||||
|
|
||||||
## Private constructor.
|
## Private constructor.
|
||||||
def __init__(self, mesh, geom=0):
|
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")
|
self.Create(mesh, geom, "CompositeSegment_1D")
|
||||||
|
|
||||||
|
|
||||||
@ -670,16 +808,9 @@ class Mesh_CompositeSegment(Mesh_Segment):
|
|||||||
# More details.
|
# More details.
|
||||||
class Mesh_Segment_Python(Mesh_Segment):
|
class Mesh_Segment_Python(Mesh_Segment):
|
||||||
|
|
||||||
#17908#algo = 0 # algorithm object common for all Mesh_Segment_Pythons
|
|
||||||
|
|
||||||
## Private constructor.
|
## Private constructor.
|
||||||
def __init__(self, mesh, geom=0):
|
def __init__(self, mesh, geom=0):
|
||||||
import Python1dPlugin
|
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")
|
self.Create(mesh, geom, "Python_1D", "libPython1dEngine.so")
|
||||||
|
|
||||||
## Define "PythonSplit1D" hypothesis based on the Erwan Adam patch, awaiting equivalent SALOME functionality
|
## 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
|
# @param UseExisting if ==true - search existing hypothesis created with
|
||||||
# same parameters, else (default) - create new
|
# same parameters, else (default) - create new
|
||||||
def PythonSplit1D(self, n, func, UseExisting=0):
|
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.SetNumberOfSegments(n)
|
||||||
hyp.SetPythonLog10RatioFunction(func)
|
hyp.SetPythonLog10RatioFunction(func)
|
||||||
return hyp
|
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
|
# Public class: Mesh_Triangle
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
|
|
||||||
@ -708,22 +847,12 @@ class Mesh_Triangle(Mesh_Algorithm):
|
|||||||
_angleMeshS = 8
|
_angleMeshS = 8
|
||||||
_gradation = 1.1
|
_gradation = 1.1
|
||||||
|
|
||||||
# algorithm objects common for all instances of Mesh_Triangle
|
|
||||||
#17908#algoMEF = 0
|
|
||||||
#17908#algoNET = 0
|
|
||||||
#17908#algoNET_2D = 0
|
|
||||||
|
|
||||||
## Private constructor.
|
## Private constructor.
|
||||||
def __init__(self, mesh, algoType, geom=0):
|
def __init__(self, mesh, algoType, geom=0):
|
||||||
Mesh_Algorithm.__init__(self)
|
Mesh_Algorithm.__init__(self)
|
||||||
|
|
||||||
self.algoType = algoType
|
self.algoType = algoType
|
||||||
if algoType == MEFISTO:
|
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")
|
self.Create(mesh, geom, "MEFISTO_2D")
|
||||||
pass
|
pass
|
||||||
elif algoType == BLSURF:
|
elif algoType == BLSURF:
|
||||||
@ -734,47 +863,42 @@ class Mesh_Triangle(Mesh_Algorithm):
|
|||||||
if noNETGENPlugin:
|
if noNETGENPlugin:
|
||||||
print "Warning: NETGENPlugin module unavailable"
|
print "Warning: NETGENPlugin module unavailable"
|
||||||
pass
|
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")
|
self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
|
||||||
pass
|
pass
|
||||||
elif algoType == NETGEN_2D:
|
elif algoType == NETGEN_2D:
|
||||||
if noNETGENPlugin:
|
if noNETGENPlugin:
|
||||||
print "Warning: NETGENPlugin module unavailable"
|
print "Warning: NETGENPlugin module unavailable"
|
||||||
pass
|
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")
|
self.Create(mesh, geom, "NETGEN_2D_ONLY", "libNETGENEngine.so")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
## Define "MaxElementArea" hypothesis to give the maximun area of each triangles
|
## Define "MaxElementArea" hypothesis to give the maximum area of each triangle
|
||||||
# @param area for the maximum area of each triangles
|
# @param area for the maximum area of each triangle
|
||||||
# @param UseExisting if ==true - search existing hypothesis created with
|
# @param UseExisting if ==true - search existing hypothesis created with
|
||||||
# same parameters, else (default) - create new
|
# same parameters, else (default) - create new
|
||||||
#
|
#
|
||||||
# Only for algoType == MEFISTO || NETGEN_2D
|
# Only for algoType == MEFISTO || NETGEN_2D
|
||||||
def MaxElementArea(self, area, UseExisting=0):
|
def MaxElementArea(self, area, UseExisting=0):
|
||||||
if self.algoType == MEFISTO or self.algoType == NETGEN_2D:
|
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)
|
hyp.SetMaxElementArea(area)
|
||||||
return hyp
|
return hyp
|
||||||
elif self.algoType == NETGEN:
|
elif self.algoType == NETGEN:
|
||||||
print "Netgen 1D-2D algo doesn't support this hypothesis"
|
print "Netgen 1D-2D algo doesn't support this hypothesis"
|
||||||
return None
|
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
|
# Only for algoType == MEFISTO || NETGEN_2D
|
||||||
def LengthFromEdges(self):
|
def LengthFromEdges(self):
|
||||||
if self.algoType == MEFISTO or self.algoType == NETGEN_2D:
|
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
|
return hyp
|
||||||
elif self.algoType == NETGEN:
|
elif self.algoType == NETGEN:
|
||||||
print "Netgen 1D-2D algo doesn't support this hypothesis"
|
print "Netgen 1D-2D algo doesn't support this hypothesis"
|
||||||
@ -823,7 +947,7 @@ class Mesh_Triangle(Mesh_Algorithm):
|
|||||||
def SetQuadAllowed(self, toAllow=True):
|
def SetQuadAllowed(self, toAllow=True):
|
||||||
if self.algoType == NETGEN_2D:
|
if self.algoType == NETGEN_2D:
|
||||||
if toAllow: # add QuadranglePreference
|
if toAllow: # add QuadranglePreference
|
||||||
self.Hypothesis("QuadranglePreference", UseExisting=1)
|
self.Hypothesis("QuadranglePreference", UseExisting=1, CompareMethod=self.CompareEqualHyp)
|
||||||
else: # remove QuadranglePreference
|
else: # remove QuadranglePreference
|
||||||
for hyp in self.mesh.GetHypothesisList( self.geom ):
|
for hyp in self.mesh.GetHypothesisList( self.geom ):
|
||||||
if hyp.GetName() == "QuadranglePreference":
|
if hyp.GetName() == "QuadranglePreference":
|
||||||
@ -832,7 +956,9 @@ class Mesh_Triangle(Mesh_Algorithm):
|
|||||||
pass
|
pass
|
||||||
pass
|
pass
|
||||||
return
|
return
|
||||||
if self.params == 0 and self.Parameters():
|
if self.params == 0:
|
||||||
|
self.Parameters()
|
||||||
|
if self.params:
|
||||||
self.params.SetQuadAllowed(toAllow)
|
self.params.SetQuadAllowed(toAllow)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -852,7 +978,8 @@ class Mesh_Triangle(Mesh_Algorithm):
|
|||||||
print "NETGEN_2D_ONLY uses 'MaxElementArea' and 'LengthFromEdges' ones"
|
print "NETGEN_2D_ONLY uses 'MaxElementArea' and 'LengthFromEdges' ones"
|
||||||
return None
|
return None
|
||||||
elif self.algoType == BLSURF:
|
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 self.params
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -938,24 +1065,17 @@ class Mesh_Triangle(Mesh_Algorithm):
|
|||||||
# More details.
|
# More details.
|
||||||
class Mesh_Quadrangle(Mesh_Algorithm):
|
class Mesh_Quadrangle(Mesh_Algorithm):
|
||||||
|
|
||||||
#17908#algo = 0 # algorithm object common for all Mesh_Quadrangles
|
|
||||||
|
|
||||||
## Private constructor.
|
## Private constructor.
|
||||||
def __init__(self, mesh, geom=0):
|
def __init__(self, mesh, geom=0):
|
||||||
Mesh_Algorithm.__init__(self)
|
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")
|
self.Create(mesh, geom, "Quadrangle_2D")
|
||||||
|
|
||||||
## Define "QuadranglePreference" hypothesis, forcing construction
|
## Define "QuadranglePreference" hypothesis, forcing construction
|
||||||
# of quadrangles if the number of nodes on opposite edges is not the same
|
# 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
|
# in the case where the global number of nodes on edges is even
|
||||||
def QuadranglePreference(self):
|
def QuadranglePreference(self):
|
||||||
hyp = self.Hypothesis("QuadranglePreference", UseExisting=1)
|
hyp = self.Hypothesis("QuadranglePreference", UseExisting=1,
|
||||||
|
CompareMethod=self.CompareEqualHyp)
|
||||||
return hyp
|
return hyp
|
||||||
|
|
||||||
# Public class: Mesh_Tetrahedron
|
# Public class: Mesh_Tetrahedron
|
||||||
@ -969,30 +1089,15 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
|
|||||||
params = 0
|
params = 0
|
||||||
algoType = 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.
|
## Private constructor.
|
||||||
def __init__(self, mesh, algoType, geom=0):
|
def __init__(self, mesh, algoType, geom=0):
|
||||||
Mesh_Algorithm.__init__(self)
|
Mesh_Algorithm.__init__(self)
|
||||||
|
|
||||||
if algoType == NETGEN:
|
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")
|
self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
elif algoType == GHS3D:
|
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
|
import GHS3DPlugin
|
||||||
self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so")
|
self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so")
|
||||||
pass
|
pass
|
||||||
@ -1000,11 +1105,6 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
|
|||||||
elif algoType == FULL_NETGEN:
|
elif algoType == FULL_NETGEN:
|
||||||
if noNETGENPlugin:
|
if noNETGENPlugin:
|
||||||
print "Warning: NETGENPlugin module has not been imported."
|
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")
|
self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -1015,10 +1115,15 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
|
|||||||
# @param UseExisting if ==true - search existing hypothesis created with
|
# @param UseExisting if ==true - search existing hypothesis created with
|
||||||
# same parameters, else (default) - create new
|
# same parameters, else (default) - create new
|
||||||
def MaxElementVolume(self, vol, UseExisting=0):
|
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)
|
hyp.SetMaxElementVolume(vol)
|
||||||
return hyp
|
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
|
## Define "Netgen 3D Parameters" hypothesis
|
||||||
def Parameters(self):
|
def Parameters(self):
|
||||||
if (self.algoType == FULL_NETGEN):
|
if (self.algoType == FULL_NETGEN):
|
||||||
@ -1081,61 +1186,32 @@ class Mesh_Tetrahedron(Mesh_Algorithm):
|
|||||||
# More details.
|
# More details.
|
||||||
class Mesh_Hexahedron(Mesh_Algorithm):
|
class Mesh_Hexahedron(Mesh_Algorithm):
|
||||||
|
|
||||||
# #17908#algo = 0 # algorithm object common for all Mesh_Hexahedrons
|
params = 0
|
||||||
#
|
algoType = 0
|
||||||
# ## 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
|
|
||||||
|
|
||||||
## Private constructor.
|
## Private constructor.
|
||||||
def __init__(self, mesh, algoType=Hexa, geom=0):
|
def __init__(self, mesh, algoType=Hexa, geom=0):
|
||||||
Mesh_Algorithm.__init__(self)
|
Mesh_Algorithm.__init__(self)
|
||||||
|
|
||||||
|
self.algoType = algoType
|
||||||
|
|
||||||
if algoType == Hexa:
|
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")
|
self.Create(mesh, geom, "Hexa_3D")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
elif algoType == Hexotic:
|
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
|
import HexoticPlugin
|
||||||
self.Create(mesh, geom, "Hexotic_3D", "libHexoticEngine.so")
|
self.Create(mesh, geom, "Hexotic_3D", "libHexoticEngine.so")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
## Define "MinMaxQuad" hypothesis to give the three hexotic parameters
|
## Define "MinMaxQuad" hypothesis to give the three hexotic parameters
|
||||||
def MinMaxQuad(self, min=3, max=8, quad=True):
|
def MinMaxQuad(self, min=3, max=8, quad=True):
|
||||||
#17908#self.params = self.Hypothesis("Hexotic_Parameters", [], "libHexoticEngine.so")
|
self.params = self.Hypothesis("Hexotic_Parameters", [], "libHexoticEngine.so",
|
||||||
#17908#self.params.SetHexesMinLevel(min)
|
UseExisting=0)
|
||||||
#17908#self.params.SetHexesMaxLevel(max)
|
self.params.SetHexesMinLevel(min)
|
||||||
#17908#self.params.SetHexoticQuadrangles(quad)
|
self.params.SetHexesMaxLevel(max)
|
||||||
#17908#return self.params
|
self.params.SetHexoticQuadrangles(quad)
|
||||||
params = self.Hypothesis("Hexotic_Parameters", [], "libHexoticEngine.so")
|
return self.params
|
||||||
params.SetHexesMinLevel(min)
|
|
||||||
params.SetHexesMaxLevel(max)
|
|
||||||
params.SetHexoticQuadrangles(quad)
|
|
||||||
return params
|
|
||||||
|
|
||||||
# Deprecated, only for compatibility!
|
# Deprecated, only for compatibility!
|
||||||
# Public class: Mesh_Netgen
|
# Public class: Mesh_Netgen
|
||||||
@ -1151,9 +1227,6 @@ class Mesh_Netgen(Mesh_Algorithm):
|
|||||||
|
|
||||||
is3D = 0
|
is3D = 0
|
||||||
|
|
||||||
#17908#algoNET23 = 0 # algorithm object common for all Mesh_Netgens
|
|
||||||
#17908#algoNET2 = 0 # algorithm object common for all Mesh_Netgens
|
|
||||||
|
|
||||||
## Private constructor.
|
## Private constructor.
|
||||||
def __init__(self, mesh, is3D, geom=0):
|
def __init__(self, mesh, is3D, geom=0):
|
||||||
Mesh_Algorithm.__init__(self)
|
Mesh_Algorithm.__init__(self)
|
||||||
@ -1163,20 +1236,10 @@ class Mesh_Netgen(Mesh_Algorithm):
|
|||||||
|
|
||||||
self.is3D = is3D
|
self.is3D = is3D
|
||||||
if 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")
|
self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
else:
|
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")
|
self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -1198,17 +1261,9 @@ class Mesh_Netgen(Mesh_Algorithm):
|
|||||||
# More details.
|
# More details.
|
||||||
class Mesh_Projection1D(Mesh_Algorithm):
|
class Mesh_Projection1D(Mesh_Algorithm):
|
||||||
|
|
||||||
#17908#algo = 0 # algorithm object common for all Mesh_Projection1Ds
|
|
||||||
|
|
||||||
## Private constructor.
|
## Private constructor.
|
||||||
def __init__(self, mesh, geom=0):
|
def __init__(self, mesh, geom=0):
|
||||||
Mesh_Algorithm.__init__(self)
|
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")
|
self.Create(mesh, geom, "Projection_1D")
|
||||||
|
|
||||||
## Define "Source Edge" hypothesis, specifying a meshed edge to
|
## 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
|
# @param UseExisting if ==true - search existing hypothesis created with
|
||||||
# same parameters, else (default) - create new
|
# same parameters, else (default) - create new
|
||||||
def SourceEdge(self, edge, mesh=None, srcV=None, tgtV=None, UseExisting=0):
|
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 )
|
hyp.SetSourceEdge( edge )
|
||||||
if not mesh is None and isinstance(mesh, Mesh):
|
if not mesh is None and isinstance(mesh, Mesh):
|
||||||
mesh = mesh.GetMesh()
|
mesh = mesh.GetMesh()
|
||||||
@ -1230,6 +1287,11 @@ class Mesh_Projection1D(Mesh_Algorithm):
|
|||||||
hyp.SetVertexAssociation( srcV, tgtV )
|
hyp.SetVertexAssociation( srcV, tgtV )
|
||||||
return hyp
|
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
|
# Public class: Mesh_Projection2D
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
@ -1239,17 +1301,9 @@ class Mesh_Projection1D(Mesh_Algorithm):
|
|||||||
# More details.
|
# More details.
|
||||||
class Mesh_Projection2D(Mesh_Algorithm):
|
class Mesh_Projection2D(Mesh_Algorithm):
|
||||||
|
|
||||||
#17908#algo = 0 # algorithm object common for all Mesh_Projection2Ds
|
|
||||||
|
|
||||||
## Private constructor.
|
## Private constructor.
|
||||||
def __init__(self, mesh, geom=0):
|
def __init__(self, mesh, geom=0):
|
||||||
Mesh_Algorithm.__init__(self)
|
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")
|
self.Create(mesh, geom, "Projection_2D")
|
||||||
|
|
||||||
## Define "Source Face" hypothesis, specifying a meshed face to
|
## 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,
|
def SourceFace(self, face, mesh=None, srcV1=None, tgtV1=None,
|
||||||
srcV2=None, tgtV2=None, UseExisting=0):
|
srcV2=None, tgtV2=None, UseExisting=0):
|
||||||
hyp = self.Hypothesis("ProjectionSource2D", [face,mesh,srcV1,tgtV1,srcV2,tgtV2],
|
hyp = self.Hypothesis("ProjectionSource2D", [face,mesh,srcV1,tgtV1,srcV2,tgtV2],
|
||||||
UseExisting=UseExisting)
|
UseExisting=0)
|
||||||
|
#UseExisting=UseExisting, CompareMethod=self.CompareSourceFace)
|
||||||
hyp.SetSourceFace( face )
|
hyp.SetSourceFace( face )
|
||||||
if not mesh is None and isinstance(mesh, Mesh):
|
if not mesh is None and isinstance(mesh, Mesh):
|
||||||
mesh = mesh.GetMesh()
|
mesh = mesh.GetMesh()
|
||||||
@ -1278,6 +1333,11 @@ class Mesh_Projection2D(Mesh_Algorithm):
|
|||||||
hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 )
|
hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 )
|
||||||
return hyp
|
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
|
# Public class: Mesh_Projection3D
|
||||||
# ------------------------------
|
# ------------------------------
|
||||||
|
|
||||||
@ -1286,17 +1346,9 @@ class Mesh_Projection2D(Mesh_Algorithm):
|
|||||||
# More details.
|
# More details.
|
||||||
class Mesh_Projection3D(Mesh_Algorithm):
|
class Mesh_Projection3D(Mesh_Algorithm):
|
||||||
|
|
||||||
#17908#algo = 0 # algorithm object common for all Mesh_Projection3Ds
|
|
||||||
|
|
||||||
## Private constructor.
|
## Private constructor.
|
||||||
def __init__(self, mesh, geom=0):
|
def __init__(self, mesh, geom=0):
|
||||||
Mesh_Algorithm.__init__(self)
|
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")
|
self.Create(mesh, geom, "Projection_3D")
|
||||||
|
|
||||||
## Define "Source Shape 3D" hypothesis, specifying a meshed solid to
|
## 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):
|
srcV2=0, tgtV2=0, UseExisting=0):
|
||||||
hyp = self.Hypothesis("ProjectionSource3D",
|
hyp = self.Hypothesis("ProjectionSource3D",
|
||||||
[solid,mesh,srcV1,tgtV1,srcV2,tgtV2],
|
[solid,mesh,srcV1,tgtV1,srcV2,tgtV2],
|
||||||
UseExisting=UseExisting)
|
UseExisting=0)
|
||||||
|
#UseExisting=UseExisting, CompareMethod=self.CompareSourceShape3D)
|
||||||
hyp.SetSource3DShape( solid )
|
hyp.SetSource3DShape( solid )
|
||||||
if not mesh is None and isinstance(mesh, Mesh):
|
if not mesh is None and isinstance(mesh, Mesh):
|
||||||
mesh = mesh.GetMesh()
|
mesh = mesh.GetMesh()
|
||||||
@ -1326,6 +1379,11 @@ class Mesh_Projection3D(Mesh_Algorithm):
|
|||||||
hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 )
|
hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 )
|
||||||
return hyp
|
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
|
# Public class: Mesh_Prism
|
||||||
# ------------------------
|
# ------------------------
|
||||||
@ -1335,17 +1393,9 @@ class Mesh_Projection3D(Mesh_Algorithm):
|
|||||||
# More details.
|
# More details.
|
||||||
class Mesh_Prism3D(Mesh_Algorithm):
|
class Mesh_Prism3D(Mesh_Algorithm):
|
||||||
|
|
||||||
#17908#algo = 0 # algorithm object common for all Mesh_Prism3Ds
|
|
||||||
|
|
||||||
## Private constructor.
|
## Private constructor.
|
||||||
def __init__(self, mesh, geom=0):
|
def __init__(self, mesh, geom=0):
|
||||||
Mesh_Algorithm.__init__(self)
|
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")
|
self.Create(mesh, geom, "Prism_3D")
|
||||||
|
|
||||||
# Public class: Mesh_RadialPrism
|
# Public class: Mesh_RadialPrism
|
||||||
@ -1356,20 +1406,12 @@ class Mesh_Prism3D(Mesh_Algorithm):
|
|||||||
# More details.
|
# More details.
|
||||||
class Mesh_RadialPrism3D(Mesh_Algorithm):
|
class Mesh_RadialPrism3D(Mesh_Algorithm):
|
||||||
|
|
||||||
#17908#algo = 0 # algorithm object common for all Mesh_RadialPrism3Ds
|
|
||||||
|
|
||||||
## Private constructor.
|
## Private constructor.
|
||||||
def __init__(self, mesh, geom=0):
|
def __init__(self, mesh, geom=0):
|
||||||
Mesh_Algorithm.__init__(self)
|
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.Create(mesh, geom, "RadialPrism_3D")
|
||||||
|
|
||||||
self.distribHyp = self.Hypothesis( "LayerDistribution", UseExisting=0)
|
self.distribHyp = self.Hypothesis("LayerDistribution", UseExisting=0)
|
||||||
self.nbLayers = None
|
self.nbLayers = None
|
||||||
|
|
||||||
## Return 3D hypothesis holding the 1D one
|
## Return 3D hypothesis holding the 1D one
|
||||||
@ -1395,15 +1437,20 @@ class Mesh_RadialPrism3D(Mesh_Algorithm):
|
|||||||
# same parameters, else (default) - create new
|
# same parameters, else (default) - create new
|
||||||
def NumberOfLayers(self, n, UseExisting=0):
|
def NumberOfLayers(self, n, UseExisting=0):
|
||||||
self.mesh.GetMesh().RemoveHypothesis( self.geom, self.distribHyp )
|
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 )
|
self.nbLayers.SetNumberOfLayers( n )
|
||||||
return self.nbLayers
|
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
|
## Define "LocalLength" hypothesis, specifying segment length
|
||||||
# to build between the inner and outer shells
|
# to build between the inner and outer shells
|
||||||
# @param l for the length of segments
|
# @param l for the length of segments
|
||||||
def LocalLength(self, l):
|
def LocalLength(self, l):
|
||||||
hyp = self.OwnHypothesis("LocalLength", [l] )
|
hyp = self.OwnHypothesis("LocalLength", [l])
|
||||||
hyp.SetLength(l)
|
hyp.SetLength(l)
|
||||||
return hyp
|
return hyp
|
||||||
|
|
||||||
@ -1413,7 +1460,7 @@ class Mesh_RadialPrism3D(Mesh_Algorithm):
|
|||||||
# @param s for the scale factor (optional)
|
# @param s for the scale factor (optional)
|
||||||
def NumberOfSegments(self, n, s=[]):
|
def NumberOfSegments(self, n, s=[]):
|
||||||
if s == []:
|
if s == []:
|
||||||
hyp = self.OwnHypothesis("NumberOfSegments", [n] )
|
hyp = self.OwnHypothesis("NumberOfSegments", [n])
|
||||||
else:
|
else:
|
||||||
hyp = self.OwnHypothesis("NumberOfSegments", [n,s])
|
hyp = self.OwnHypothesis("NumberOfSegments", [n,s])
|
||||||
hyp.SetDistrType( 1 )
|
hyp.SetDistrType( 1 )
|
||||||
@ -1453,23 +1500,10 @@ class Mesh_RadialPrism3D(Mesh_Algorithm):
|
|||||||
# -------------------------------
|
# -------------------------------
|
||||||
class Mesh_UseExisting(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):
|
def __init__(self, dim, mesh, geom=0):
|
||||||
if dim == 1:
|
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")
|
self.Create(mesh, geom, "UseExisting_1D")
|
||||||
else:
|
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")
|
self.Create(mesh, geom, "UseExisting_2D")
|
||||||
|
|
||||||
# Public class: Mesh
|
# Public class: Mesh
|
||||||
@ -1814,7 +1848,7 @@ class Mesh:
|
|||||||
## Assign hypothesis
|
## Assign hypothesis
|
||||||
# @param hyp is a hypothesis to assign
|
# @param hyp is a hypothesis to assign
|
||||||
# @param geom is subhape of mesh geometry
|
# @param geom is subhape of mesh geometry
|
||||||
def AddHypothesis(self, hyp, geom=0 ):
|
def AddHypothesis(self, hyp, geom=0):
|
||||||
if isinstance( hyp, Mesh_Algorithm ):
|
if isinstance( hyp, Mesh_Algorithm ):
|
||||||
hyp = hyp.GetAlgorithm()
|
hyp = hyp.GetAlgorithm()
|
||||||
pass
|
pass
|
||||||
@ -1829,7 +1863,7 @@ class Mesh:
|
|||||||
## Unassign hypothesis
|
## Unassign hypothesis
|
||||||
# @param hyp is a hypothesis to unassign
|
# @param hyp is a hypothesis to unassign
|
||||||
# @param geom is subhape of mesh geometry
|
# @param geom is subhape of mesh geometry
|
||||||
def RemoveHypothesis(self, hyp, geom=0 ):
|
def RemoveHypothesis(self, hyp, geom=0):
|
||||||
if isinstance( hyp, Mesh_Algorithm ):
|
if isinstance( hyp, Mesh_Algorithm ):
|
||||||
hyp = hyp.GetAlgorithm()
|
hyp = hyp.GetAlgorithm()
|
||||||
pass
|
pass
|
||||||
@ -3068,7 +3102,7 @@ class Mesh:
|
|||||||
def MirrorObjectMakeMesh (self, theObject, Mirror, theMirrorType,MakeGroups=0, NewMeshName=""):
|
def MirrorObjectMakeMesh (self, theObject, Mirror, theMirrorType,MakeGroups=0, NewMeshName=""):
|
||||||
if ( isinstance( theObject, Mesh )):
|
if ( isinstance( theObject, Mesh )):
|
||||||
theObject = theObject.GetMesh()
|
theObject = theObject.GetMesh()
|
||||||
if ( isinstance( Mirror, geompyDC.GEOM._objref_GEOM_Object)):
|
if (isinstance(Mirror, geompyDC.GEOM._objref_GEOM_Object)):
|
||||||
Mirror = GetAxisStruct(Mirror)
|
Mirror = GetAxisStruct(Mirror)
|
||||||
mesh = self.editor.MirrorObjectMakeMesh(theObject, Mirror, theMirrorType,
|
mesh = self.editor.MirrorObjectMakeMesh(theObject, Mirror, theMirrorType,
|
||||||
MakeGroups, NewMeshName)
|
MakeGroups, NewMeshName)
|
||||||
@ -3123,9 +3157,9 @@ class Mesh:
|
|||||||
# @param MakeGroups to generate new groups from existing ones
|
# @param MakeGroups to generate new groups from existing ones
|
||||||
# @param NewMeshName is a name of new mesh to create
|
# @param NewMeshName is a name of new mesh to create
|
||||||
def TranslateObjectMakeMesh(self, theObject, Vector, MakeGroups=False, NewMeshName=""):
|
def TranslateObjectMakeMesh(self, theObject, Vector, MakeGroups=False, NewMeshName=""):
|
||||||
if ( isinstance( theObject, Mesh )):
|
if (isinstance(theObject, Mesh)):
|
||||||
theObject = theObject.GetMesh()
|
theObject = theObject.GetMesh()
|
||||||
if ( isinstance( Vector, geompyDC.GEOM._objref_GEOM_Object)):
|
if (isinstance(Vector, geompyDC.GEOM._objref_GEOM_Object)):
|
||||||
Vector = self.smeshpyD.GetDirStruct(Vector)
|
Vector = self.smeshpyD.GetDirStruct(Vector)
|
||||||
mesh = self.editor.TranslateObjectMakeMesh(theObject, Vector, MakeGroups, NewMeshName)
|
mesh = self.editor.TranslateObjectMakeMesh(theObject, Vector, MakeGroups, NewMeshName)
|
||||||
return Mesh( self.smeshpyD, self.geompyD, mesh )
|
return Mesh( self.smeshpyD, self.geompyD, mesh )
|
||||||
@ -3168,9 +3202,9 @@ class Mesh:
|
|||||||
# @param Copy allows to copy the rotated elements
|
# @param Copy allows to copy the rotated elements
|
||||||
# @param MakeGroups to generate new groups from existing ones (if Copy)
|
# @param MakeGroups to generate new groups from existing ones (if Copy)
|
||||||
def RotateObject (self, theObject, Axis, AngleInRadians, Copy, MakeGroups=False):
|
def RotateObject (self, theObject, Axis, AngleInRadians, Copy, MakeGroups=False):
|
||||||
if ( isinstance( theObject, Mesh )):
|
if (isinstance(theObject, Mesh)):
|
||||||
theObject = theObject.GetMesh()
|
theObject = theObject.GetMesh()
|
||||||
if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
|
if (isinstance(Axis, geompyDC.GEOM._objref_GEOM_Object)):
|
||||||
Axis = self.smeshpyD.GetAxisStruct(Axis)
|
Axis = self.smeshpyD.GetAxisStruct(Axis)
|
||||||
if Copy and MakeGroups:
|
if Copy and MakeGroups:
|
||||||
return self.editor.RotateObjectMakeGroups(theObject, Axis, AngleInRadians)
|
return self.editor.RotateObjectMakeGroups(theObject, Axis, AngleInRadians)
|
||||||
@ -3184,9 +3218,9 @@ class Mesh:
|
|||||||
# @param MakeGroups to generate new groups from existing ones
|
# @param MakeGroups to generate new groups from existing ones
|
||||||
# @param NewMeshName is a name of new mesh to create
|
# @param NewMeshName is a name of new mesh to create
|
||||||
def RotateObjectMakeMesh(self, theObject, Axis, AngleInRadians, MakeGroups=0,NewMeshName=""):
|
def RotateObjectMakeMesh(self, theObject, Axis, AngleInRadians, MakeGroups=0,NewMeshName=""):
|
||||||
if ( isinstance( theObject, Mesh )):
|
if (isinstance( theObject, Mesh )):
|
||||||
theObject = theObject.GetMesh()
|
theObject = theObject.GetMesh()
|
||||||
if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
|
if (isinstance(Axis, geompyDC.GEOM._objref_GEOM_Object)):
|
||||||
Axis = self.smeshpyD.GetAxisStruct(Axis)
|
Axis = self.smeshpyD.GetAxisStruct(Axis)
|
||||||
mesh = self.editor.RotateObjectMakeMesh(theObject, Axis, AngleInRadians,
|
mesh = self.editor.RotateObjectMakeMesh(theObject, Axis, AngleInRadians,
|
||||||
MakeGroups, NewMeshName)
|
MakeGroups, NewMeshName)
|
||||||
|
Loading…
Reference in New Issue
Block a user