mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-03-03 15:35:36 +05:00
IMP23369: [CEA 1513] compute a mesh using an already existing mesh with MG-CADSurf
Enable computing a mesh w/o geom with 2 algos
This commit is contained in:
parent
d2c9aaf03a
commit
cf7328b78f
@ -3,8 +3,7 @@
|
|||||||
\page about_meshes_page About meshes
|
\page about_meshes_page About meshes
|
||||||
|
|
||||||
\n \b MESH represents a discrete approximation of a subset of the
|
\n \b MESH represents a discrete approximation of a subset of the
|
||||||
three-dimensional space by \ref mesh_entities "elementary geometrical
|
three-dimensional space by \ref mesh_entities "elementary geometrical elements".
|
||||||
elements".
|
|
||||||
|
|
||||||
A SALOME study can contain multiple meshes, but they do not
|
A SALOME study can contain multiple meshes, but they do not
|
||||||
implicitly compose one super-mesh, and finally each of them
|
implicitly compose one super-mesh, and finally each of them
|
||||||
|
@ -148,6 +148,8 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
|
|||||||
// one face only.
|
// one face only.
|
||||||
SMESH_subMesh::compute_event computeEvent =
|
SMESH_subMesh::compute_event computeEvent =
|
||||||
aShapeOnly ? SMESH_subMesh::COMPUTE_SUBMESH : SMESH_subMesh::COMPUTE;
|
aShapeOnly ? SMESH_subMesh::COMPUTE_SUBMESH : SMESH_subMesh::COMPUTE;
|
||||||
|
if ( !aMesh.HasShapeToMesh() )
|
||||||
|
computeEvent = SMESH_subMesh::COMPUTE_NOGEOM; // if several algos and no geometry
|
||||||
|
|
||||||
if ( anUpward ) // is called from the below code in this method
|
if ( anUpward ) // is called from the below code in this method
|
||||||
{
|
{
|
||||||
@ -1058,6 +1060,7 @@ SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_subMesh * aSubMesh,
|
|||||||
SMESH_Mesh& aMesh = *aSubMesh->GetFather();
|
SMESH_Mesh& aMesh = *aSubMesh->GetFather();
|
||||||
|
|
||||||
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
|
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
|
||||||
|
if ( aMesh.HasShapeToMesh() )
|
||||||
filter.And( filter.IsApplicableTo( aShape ));
|
filter.And( filter.IsApplicableTo( aShape ));
|
||||||
|
|
||||||
typedef SMESH_Algo::Features AlgoData;
|
typedef SMESH_Algo::Features AlgoData;
|
||||||
|
@ -63,6 +63,11 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
#ifdef _DEBUG_
|
||||||
|
// enable printing algo + shape id + hypo used while meshing
|
||||||
|
//#define PRINT_WHO_COMPUTE_WHAT
|
||||||
|
#endif
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Allocate some memory at construction and release it at destruction.
|
* \brief Allocate some memory at construction and release it at destruction.
|
||||||
@ -510,7 +515,20 @@ bool SMESH_subMesh::CanAddHypothesis(const SMESH_Hypothesis* theHypothesis) cons
|
|||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : IsApplicableHypotesis
|
//function : IsApplicableHypotesis
|
||||||
//purpose :
|
//purpose : check if this sub-mesh can be computed using a hypothesis
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
bool SMESH_subMesh::IsApplicableHypotesis(const SMESH_Hypothesis* theHypothesis) const
|
||||||
|
{
|
||||||
|
if ( !_father->HasShapeToMesh() && _subShape.ShapeType() == TopAbs_SOLID )
|
||||||
|
return true; // true for the PseudoShape
|
||||||
|
|
||||||
|
return IsApplicableHypotesis( theHypothesis, _subShape.ShapeType() );
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : IsApplicableHypotesis
|
||||||
|
//purpose : compare shape type and hypothesis type
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
bool SMESH_subMesh::IsApplicableHypotesis(const SMESH_Hypothesis* theHypothesis,
|
bool SMESH_subMesh::IsApplicableHypotesis(const SMESH_Hypothesis* theHypothesis,
|
||||||
@ -1436,6 +1454,31 @@ bool SMESH_subMesh::ComputeStateEngine(compute_event event)
|
|||||||
_computeState = READY_TO_COMPUTE;
|
_computeState = READY_TO_COMPUTE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case COMPUTE_NOGEOM: // no geometry; can be several algos
|
||||||
|
if ( !_father->HasShapeToMesh() )
|
||||||
|
{
|
||||||
|
algo = GetAlgo(); // current algo
|
||||||
|
if ( algo )
|
||||||
|
{
|
||||||
|
// apply algos in the order of increasing dimension
|
||||||
|
std::list< const SMESHDS_Hypothesis * > algos = _father->GetHypothesisList( _subShape );
|
||||||
|
for ( int t = SMESHDS_Hypothesis::ALGO_1D; t <= SMESHDS_Hypothesis::ALGO_3D; ++t )
|
||||||
|
{
|
||||||
|
std::list<const SMESHDS_Hypothesis *>::iterator al = algos.begin();
|
||||||
|
for ( ; al != algos.end(); ++al )
|
||||||
|
if ( (*al)->GetType() == t )
|
||||||
|
{
|
||||||
|
_algo = (SMESH_Algo*) *al;
|
||||||
|
_computeState = READY_TO_COMPUTE;
|
||||||
|
if ( !ComputeStateEngine( COMPUTE ))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_algo = algo; // restore
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case COMPUTE:
|
case COMPUTE:
|
||||||
case COMPUTE_SUBMESH:
|
case COMPUTE_SUBMESH:
|
||||||
{
|
{
|
||||||
@ -1575,6 +1618,23 @@ bool SMESH_subMesh::ComputeStateEngine(compute_event event)
|
|||||||
!algo->isDegenerated( TopoDS::Edge( subS.Current() ))))
|
!algo->isDegenerated( TopoDS::Edge( subS.Current() ))))
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
|
#ifdef PRINT_WHO_COMPUTE_WHAT
|
||||||
|
for (subS.ReInit(); subS.More(); subS.Next())
|
||||||
|
{
|
||||||
|
const std::list <const SMESHDS_Hypothesis *> & hyps =
|
||||||
|
_algo->GetUsedHypothesis( *_father, _subShape );
|
||||||
|
SMESH_Comment hypStr;
|
||||||
|
if ( !hyps.empty() )
|
||||||
|
{
|
||||||
|
hypStr << hyps.front()->GetName() << " ";
|
||||||
|
((SMESHDS_Hypothesis*)hyps.front())->SaveTo( hypStr.Stream() );
|
||||||
|
hypStr << " ";
|
||||||
|
}
|
||||||
|
cout << _algo->GetName()
|
||||||
|
<< " " << _father->GetSubMesh( subS.Current() )->GetId()
|
||||||
|
<< " " << hypStr << endl;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
// Set _computeError
|
// Set _computeError
|
||||||
if ( !ret && !isComputeErrorSet )
|
if ( !ret && !isComputeErrorSet )
|
||||||
{
|
{
|
||||||
@ -2157,8 +2217,6 @@ const SMESH_Hypothesis* SMESH_subMesh::getSimilarAttached(const TopoDS_Shape&
|
|||||||
SMESH_Hypothesis::Hypothesis_Status
|
SMESH_Hypothesis::Hypothesis_Status
|
||||||
SMESH_subMesh::CheckConcurentHypothesis (const int theHypType)
|
SMESH_subMesh::CheckConcurentHypothesis (const int theHypType)
|
||||||
{
|
{
|
||||||
MESSAGE ("SMESH_subMesh::CheckConcurentHypothesis");
|
|
||||||
|
|
||||||
// is there local hypothesis on me?
|
// is there local hypothesis on me?
|
||||||
if ( getSimilarAttached( _subShape, 0, theHypType ) )
|
if ( getSimilarAttached( _subShape, 0, theHypType ) )
|
||||||
return SMESH_Hypothesis::HYP_OK;
|
return SMESH_Hypothesis::HYP_OK;
|
||||||
|
@ -112,7 +112,7 @@ class SMESH_EXPORT SMESH_subMesh
|
|||||||
};
|
};
|
||||||
enum compute_event
|
enum compute_event
|
||||||
{
|
{
|
||||||
MODIF_ALGO_STATE, COMPUTE, COMPUTE_SUBMESH, COMPUTE_CANCELED,
|
MODIF_ALGO_STATE, COMPUTE, COMPUTE_SUBMESH, COMPUTE_NOGEOM, COMPUTE_CANCELED,
|
||||||
CLEAN, SUBMESH_COMPUTED, SUBMESH_RESTORED, SUBMESH_LOADED,
|
CLEAN, SUBMESH_COMPUTED, SUBMESH_RESTORED, SUBMESH_LOADED,
|
||||||
MESH_ENTITY_REMOVED, CHECK_COMPUTE_STATE
|
MESH_ENTITY_REMOVED, CHECK_COMPUTE_STATE
|
||||||
};
|
};
|
||||||
@ -241,8 +241,7 @@ public:
|
|||||||
static bool IsApplicableHypotesis(const SMESH_Hypothesis* theHypothesis,
|
static bool IsApplicableHypotesis(const SMESH_Hypothesis* theHypothesis,
|
||||||
const TopAbs_ShapeEnum theShapeType);
|
const TopAbs_ShapeEnum theShapeType);
|
||||||
|
|
||||||
bool IsApplicableHypotesis(const SMESH_Hypothesis* theHypothesis) const
|
bool IsApplicableHypotesis(const SMESH_Hypothesis* theHypothesis) const;
|
||||||
{ return IsApplicableHypotesis( theHypothesis, _subShape.ShapeType() ); }
|
|
||||||
// return true if theHypothesis can be used to mesh me:
|
// return true if theHypothesis can be used to mesh me:
|
||||||
// its shape type is checked
|
// its shape type is checked
|
||||||
|
|
||||||
|
@ -709,15 +709,14 @@ void SMESHGUI_MeshOp::selectionDone()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // no geometry defined
|
else { // no geometry defined
|
||||||
myDlg->enableTab( SMESH::DIM_3D );
|
|
||||||
QStringList hypList;
|
|
||||||
availableHyps( SMESH::DIM_3D, Algo, hypList,
|
|
||||||
myAvailableHypData[SMESH::DIM_3D][Algo]);
|
|
||||||
|
|
||||||
SMESHGUI_MeshTab* aTab = myDlg->tab( SMESH::DIM_3D );
|
QStringList hypList;
|
||||||
aTab->setAvailableHyps( Algo, hypList );
|
for ( int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++ )
|
||||||
for (int i = SMESH::DIM_0D;i < SMESH::DIM_3D; ++i) {
|
{
|
||||||
myDlg->disableTab(i);
|
availableHyps( dim, Algo, hypList, myAvailableHypData[dim][Algo]);
|
||||||
|
myDlg->tab( dim )->setAvailableHyps( Algo, hypList );
|
||||||
|
if ( hypList.empty() ) myDlg->disableTab( dim );
|
||||||
|
else myDlg->enableTab( dim );
|
||||||
}
|
}
|
||||||
myMaxShapeDim = -1;
|
myMaxShapeDim = -1;
|
||||||
//Hide labels and fields (Mesh and Geometry)
|
//Hide labels and fields (Mesh and Geometry)
|
||||||
@ -1505,7 +1504,8 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
|
|||||||
if ( myIgnoreAlgoSelection )
|
if ( myIgnoreAlgoSelection )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int aDim = theDim < 0 ? getTabDim( sender(), myDlg ): theDim;
|
int curDim = getTabDim( sender(), myDlg );
|
||||||
|
int aDim = theDim < 0 ? curDim : theDim;
|
||||||
if (aDim == -1)
|
if (aDim == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1587,7 +1587,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
|
|||||||
myDlg->tab( dim )->setAvailableHyps( Algo, anAvailable );
|
myDlg->tab( dim )->setAvailableHyps( Algo, anAvailable );
|
||||||
noCompatible = anAvailable.isEmpty();
|
noCompatible = anAvailable.isEmpty();
|
||||||
algoIndex = myAvailableHypData[dim][Algo].indexOf( curAlgo );
|
algoIndex = myAvailableHypData[dim][Algo].indexOf( curAlgo );
|
||||||
if ( !isSubmesh && algoIndex < 0 && soleCompatible && !forward && dim != SMESH::DIM_0D) {
|
if ( !isSubmesh && algoIndex < 0 && soleCompatible && !forward && dim == curDim ) {
|
||||||
// select the sole compatible algo
|
// select the sole compatible algo
|
||||||
algoIndex = 0;
|
algoIndex = 0;
|
||||||
}
|
}
|
||||||
@ -1682,7 +1682,8 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
|
|||||||
hypIndex = this->find( curHyp, myExistingHyps[ dim ][ type ]);
|
hypIndex = this->find( curHyp, myExistingHyps[ dim ][ type ]);
|
||||||
else
|
else
|
||||||
hypIndex = -1;
|
hypIndex = -1;
|
||||||
if ( !isSubmesh && myToCreate && hypIndex < 0 && anExisting.count() == 1 ) {
|
if ( !isSubmesh && myToCreate && hypIndex < 0 && anExisting.count() == 1 && dim == curDim )
|
||||||
|
{
|
||||||
// none is yet selected => select the sole existing if it is not optional
|
// none is yet selected => select the sole existing if it is not optional
|
||||||
CORBA::String_var hypTypeName = myExistingHyps[ dim ][ type ].first().first->GetName();
|
CORBA::String_var hypTypeName = myExistingHyps[ dim ][ type ].first().first->GetName();
|
||||||
bool isOptional = true;
|
bool isOptional = true;
|
||||||
@ -2184,7 +2185,7 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
|
|||||||
{
|
{
|
||||||
// Call hypothesis creation server method (without GUI)
|
// Call hypothesis creation server method (without GUI)
|
||||||
SMESH::SMESH_Hypothesis_var aHyp =
|
SMESH::SMESH_Hypothesis_var aHyp =
|
||||||
SMESH::CreateHypothesis(aHypName, aHypName, true);
|
SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
|
||||||
aHyp.out();
|
aHyp.out();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2197,7 +2198,7 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
|
|||||||
aCreator->create( true, aHypName, myDlg, 0, QString::null );
|
aCreator->create( true, aHypName, myDlg, 0, QString::null );
|
||||||
else {
|
else {
|
||||||
SMESH::SMESH_Hypothesis_var aHyp =
|
SMESH::SMESH_Hypothesis_var aHyp =
|
||||||
SMESH::CreateHypothesis(aHypName, aHypName, true);
|
SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
|
||||||
aHyp.out();
|
aHyp.out();
|
||||||
}
|
}
|
||||||
delete aCreator;
|
delete aCreator;
|
||||||
@ -2260,7 +2261,7 @@ void SMESHGUI_MeshOp::readMesh()
|
|||||||
|
|
||||||
// Get hypotheses and algorithms assigned to the mesh/sub-mesh
|
// Get hypotheses and algorithms assigned to the mesh/sub-mesh
|
||||||
QStringList anExisting;
|
QStringList anExisting;
|
||||||
const int lastDim = ( myIsOnGeometry ) ? SMESH::DIM_0D : SMESH::DIM_3D;
|
const int lastDim = ( myIsOnGeometry ) ? SMESH::DIM_0D : SMESH::DIM_2D;
|
||||||
bool algoFound = false;
|
bool algoFound = false;
|
||||||
for ( int dim = SMESH::DIM_3D; dim >= lastDim; --dim )
|
for ( int dim = SMESH::DIM_3D; dim >= lastDim; --dim )
|
||||||
{
|
{
|
||||||
@ -2407,7 +2408,7 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess )
|
|||||||
// Set new name
|
// Set new name
|
||||||
QString aName = myDlg->objectText( SMESHGUI_MeshDlg::Obj );
|
QString aName = myDlg->objectText( SMESHGUI_MeshDlg::Obj );
|
||||||
SMESH::SetName( pObj, aName );
|
SMESH::SetName( pObj, aName );
|
||||||
int aDim = ( myIsOnGeometry ) ? SMESH::DIM_0D : SMESH::DIM_3D;
|
int aDim = ( myIsOnGeometry ) ? SMESH::DIM_0D : SMESH::DIM_2D;
|
||||||
|
|
||||||
// First, remove old algos in order to avoid messages on algorithm hiding
|
// First, remove old algos in order to avoid messages on algorithm hiding
|
||||||
for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ )
|
for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ )
|
||||||
@ -2743,7 +2744,8 @@ void SMESHGUI_MeshOp::setFilteredAlgoData( const int theTabIndex, const int theI
|
|||||||
}
|
}
|
||||||
if ( !myIsOnGeometry )
|
if ( !myIsOnGeometry )
|
||||||
for ( int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++ ) {
|
for ( int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++ ) {
|
||||||
if ( i < SMESH::DIM_3D ) myDlg->disableTab( i );
|
bool disable = myAvailableHypData[i][Algo].isEmpty();
|
||||||
|
if ( disable ) myDlg->disableTab( i );
|
||||||
else myDlg->enableTab( i );
|
else myDlg->enableTab( i );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -322,7 +322,7 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr theStudy,
|
|||||||
{
|
{
|
||||||
// define the next tag after given one in the data tree to insert SObject
|
// define the next tag after given one in the data tree to insert SObject
|
||||||
SALOMEDS::SObject_wrap curObj, objAfter;
|
SALOMEDS::SObject_wrap curObj, objAfter;
|
||||||
if ( theFatherObject->GetLastChildTag() > theTag )
|
if ( theFatherObject->GetLastChildTag() > theTag && theTag > 0 )
|
||||||
{
|
{
|
||||||
SALOMEDS::UseCaseIterator_wrap
|
SALOMEDS::UseCaseIterator_wrap
|
||||||
anUseCaseIter = useCaseBuilder->GetUseCaseIterator(theFatherObject);
|
anUseCaseIter = useCaseBuilder->GetUseCaseIterator(theFatherObject);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -95,7 +95,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#ifdef _DEBUG_
|
#ifdef _DEBUG_
|
||||||
//#define __myDEBUG
|
#define __myDEBUG
|
||||||
//#define __NOT_INVALIDATE_BAD_SMOOTH
|
//#define __NOT_INVALIDATE_BAD_SMOOTH
|
||||||
//#define __NODES_AT_POS
|
//#define __NODES_AT_POS
|
||||||
#endif
|
#endif
|
||||||
@ -7546,7 +7546,7 @@ bool _LayerEdge::SegTriaInter( const gp_Ax1& lastSegment,
|
|||||||
const gp_Dir& dir = lastSegment.Direction();
|
const gp_Dir& dir = lastSegment.Direction();
|
||||||
|
|
||||||
/* calculate distance from vert0 to ray origin */
|
/* calculate distance from vert0 to ray origin */
|
||||||
gp_XYZ tvec = orig.XYZ() - vert0;
|
//gp_XYZ tvec = orig.XYZ() - vert0;
|
||||||
|
|
||||||
//if ( tvec * dir > EPSILON )
|
//if ( tvec * dir > EPSILON )
|
||||||
// intersected face is at back side of the temporary face this _LayerEdge belongs to
|
// intersected face is at back side of the temporary face this _LayerEdge belongs to
|
||||||
@ -7565,6 +7565,9 @@ bool _LayerEdge::SegTriaInter( const gp_Ax1& lastSegment,
|
|||||||
if ( det > -ANGL_EPSILON && det < ANGL_EPSILON )
|
if ( det > -ANGL_EPSILON && det < ANGL_EPSILON )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
/* calculate distance from vert0 to ray origin */
|
||||||
|
gp_XYZ tvec = orig.XYZ() - vert0;
|
||||||
|
|
||||||
/* calculate U parameter and test bounds */
|
/* calculate U parameter and test bounds */
|
||||||
double u = ( tvec * pvec ) / det;
|
double u = ( tvec * pvec ) / det;
|
||||||
//if (u < 0.0 || u > 1.0)
|
//if (u < 0.0 || u > 1.0)
|
||||||
|
Loading…
Reference in New Issue
Block a user