From 2b6939e90594ab78512f017ee025a80774826122 Mon Sep 17 00:00:00 2001 From: gdd Date: Tue, 22 Mar 2011 17:20:22 +0000 Subject: [PATCH] - Merge from V6_main_20110302 - Bug fix - Small imps --- adm_local/unix/config_files/check_BLSURF.m4 | 5 ++++ configure.ac | 3 ++ src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx | 28 +++++++++++++++++-- src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx | 9 ++++++ .../BLSURFPlugin_Hypothesis_i.cxx | 1 - 5 files changed, 43 insertions(+), 3 deletions(-) diff --git a/adm_local/unix/config_files/check_BLSURF.m4 b/adm_local/unix/config_files/check_BLSURF.m4 index 98e4f05..42dbe79 100644 --- a/adm_local/unix/config_files/check_BLSURF.m4 +++ b/adm_local/unix/config_files/check_BLSURF.m4 @@ -61,6 +61,11 @@ if test "$with_blsurf" != "no" ; then BLSURF_INCLUDES="-I$BLSURF_HOME/include" BLSURF_LIBS="-L$BLSURF_HOME/lib -lBLSurf" + if test $(/bin/arch) = x86_64 ; then + if test -f $BLSURF_HOME/lib/Linux_64/libBLSurf.so ; then + BLSURF_LIBS="-L$BLSURF_HOME/lib/Linux_64 -lBLSurf" + fi + fi CPPFLAGS_old="$CPPFLAGS" CXXFLAGS_old="$CXXFLAGS" diff --git a/configure.ac b/configure.ac index fe01836..fcc7640 100644 --- a/configure.ac +++ b/configure.ac @@ -391,6 +391,9 @@ else AC_SUBST(SETX) SETX="set -x" fi +dnl Build with SMESH cancel compute feature +AC_DEFINE(WITH_SMESH_CANCEL_COMPUTE) + dnl copy shells and utilities contained in the bin directory dnl excluding .in files (treated in AC-OUTPUT below) and CVS dnl directory diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx index 6ddda40..0ddcb93 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx @@ -287,6 +287,10 @@ BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF(int hypId, int studyId, FaceId2EnforcedVertexCoords.clear(); EnfVertexCoords2ProjVertex.clear(); EnfVertexCoords2EnfVertexList.clear(); + +#ifdef WITH_SMESH_CANCEL_COMPUTE + _compute_canceled = false; +#endif } //============================================================================= @@ -1001,7 +1005,12 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) /* Set the message callback in the working context */ context_set_message_callback(ctx, message_cb, &_comment); +#ifdef WITH_SMESH_CANCEL_COMPUTE + _compute_canceled = false; + context_set_interrupt_callback(ctx, interrupt_cb, this); +#else context_set_interrupt_callback(ctx, interrupt_cb, NULL); +#endif /* create the CAD object we will work on. It is associated to the context ctx. */ cad_t *c = cad_new(ctx); @@ -1592,6 +1601,13 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) return true; } +#ifdef WITH_SMESH_CANCEL_COMPUTE +void BLSURFPlugin_BLSURF::CancelCompute() +{ + _compute_canceled = true; +} +#endif + //============================================================================= /*! * SetNodeOnEdge @@ -1925,13 +1941,21 @@ status_t message_cb(message_t *msg, void *user_data) status_t interrupt_cb(integer *interrupt_status, void *user_data) { integer you_want_to_continue = 1; +#ifdef WITH_SMESH_CANCEL_COMPUTE + BLSURFPlugin_BLSURF* tmp = (BLSURFPlugin_BLSURF*)user_data; + you_want_to_continue = !tmp->computeCanceled(); +#endif if(you_want_to_continue) + { *interrupt_status = INTERRUPT_CONTINUE; + return STATUS_OK; + } else /* you want to stop BLSurf */ + { *interrupt_status = INTERRUPT_STOP; - - return STATUS_OK; + return STATUS_ERROR; + } } //============================================================================= diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx index 70ebef1..c8c34bc 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx @@ -74,6 +74,11 @@ class BLSURFPlugin_BLSURF: public SMESH_2D_Algo { virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); +#ifdef WITH_SMESH_CANCEL_COMPUTE + virtual void CancelCompute(); + bool computeCanceled() { return _compute_canceled;}; +#endif + virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape, MapShapeNbElems& aResMap); @@ -96,6 +101,10 @@ class BLSURFPlugin_BLSURF: public SMESH_2D_Algo { PyObject * main_dict; SALOMEDS::Study_var myStudy; SMESH_Gen_i* smeshGen_i; + +#ifdef WITH_SMESH_CANCEL_COMPUTE + volatile bool _compute_canceled; +#endif }; #endif diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx index a482a60..281230c 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx @@ -1764,7 +1764,6 @@ BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntr enfVertex->faceEntries = faceEntryList; vertexList[i] = enfVertex; - MESSAGE("Enforced vertex #" << i << ": " << enfVertex->name << " = " << coords[0] << ", " << coords[1] << ", " << coords[2]); } MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry); return vertexList._retn(); -- 2.39.2