Salome HOME
Finalize SMESH/padder integration (with tests and documentation)
authorboulant <boulant>
Tue, 8 Nov 2011 10:13:50 +0000 (10:13 +0000)
committerboulant <boulant>
Tue, 8 Nov 2011 10:13:50 +0000 (10:13 +0000)
35 files changed:
configure.ac
src/Tools/Makefile.am
src/Tools/padder/Makefile.am
src/Tools/padder/doc/Makefile.am [new file with mode: 0755]
src/Tools/padder/doc/doxyfile.in [new file with mode: 0755]
src/Tools/padder/doc/images/SMESH_spadder_end.png [new file with mode: 0644]
src/Tools/padder/doc/images/SMESH_spadder_inputdialog_concrete.png [new file with mode: 0644]
src/Tools/padder/doc/images/SMESH_spadder_inputdialog_start.png [new file with mode: 0644]
src/Tools/padder/doc/images/SMESH_spadder_inputdialog_steelbar.png [new file with mode: 0644]
src/Tools/padder/doc/images/SMESH_spadder_menu.png [new file with mode: 0644]
src/Tools/padder/doc/images/SMESH_spadder_plugindialog_compute_finished.png [new file with mode: 0644]
src/Tools/padder/doc/images/SMESH_spadder_plugindialog_compute_ready.png [new file with mode: 0644]
src/Tools/padder/doc/images/SMESH_spadder_plugindialog_compute_running.png [new file with mode: 0644]
src/Tools/padder/doc/images/SMESH_spadder_plugindialog_published.png [new file with mode: 0644]
src/Tools/padder/doc/images/SMESH_spadder_plugindialog_start.png [new file with mode: 0644]
src/Tools/padder/doc/images/SMESH_spadder_start.png [new file with mode: 0644]
src/Tools/padder/doc/input/padder_userguide.doc [new file with mode: 0644]
src/Tools/padder/meshjob/idl/Makefile.am
src/Tools/padder/meshjob/idl/SPADDERPluginTest.idl [new file with mode: 0644]
src/Tools/padder/meshjob/impl/Makefile.am
src/Tools/padder/meshjob/impl/MeshJobManager_i.cxx
src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.cxx [new file with mode: 0644]
src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.hxx [new file with mode: 0644]
src/Tools/padder/meshjob/impl/testhelper.hxx
src/Tools/padder/resources/SPADDERCatalog.xml
src/Tools/padder/spadderpy/__init__.py
src/Tools/padder/spadderpy/gui/plugindialog.py
src/Tools/padder/spadderpy/gui/plugindialog.ui
src/Tools/padder/spadderpy/padder.cfg.in
src/Tools/padder/spadderpy/plugin/Makefile.am
src/Tools/padder/spadderpy/plugin/salome_plugins.py
src/Tools/padder/spadderpy/plugin/smesh_plugins.py [new file with mode: 0755]
src/Tools/padder/unittests/Makefile.am
src/Tools/padder/unittests/usecase_meshJobManager.py
src/Tools/padder/unittests/usecase_spadderPluginTester.py [new file with mode: 0644]

index e3d0d097c47fda708f11379d8aa3776b66925d0f..e1922bfe9702e3f31f778463ed7d353099c45261 100644 (file)
@@ -549,6 +549,8 @@ AC_OUTPUT([ \
   src/Tools/padder/resources/padderexe/envPadder.sh \
   src/Tools/padder/unittests/Makefile \
   src/Tools/padder/unittests/autotest.sh \
+  src/Tools/padder/doc/Makefile \
+  src/Tools/padder/doc/doxyfile \
   resources/Makefile \
   resources/SMESHCatalog.xml \
   resources/SalomeApp.xml \
index 08a35c7c4835675206e33792804fd43a87ff73a5..8191cf8a9b37233042a01da4fa374fe5f73cdd15 100644 (file)
@@ -25,7 +25,7 @@
 #
 include $(top_srcdir)/adm_local/unix/make_common_starter.am
 
-#SUBDIRS = MeshCut padder
-SUBDIRS = MeshCut
+SUBDIRS = MeshCut padder
+#SUBDIRS = MeshCut
 
 DIST_SUBDIRS =         MeshCut
index 95b82b7cf29d0debd57bf321ae1cfb86de37df3d..9cf8a0a4e59aa6a88d9fd94d531f13131d391f27 100644 (file)
@@ -1 +1 @@
-SUBDIRS = meshjob spadderpy unittests resources
+SUBDIRS = meshjob spadderpy unittests resources doc
diff --git a/src/Tools/padder/doc/Makefile.am b/src/Tools/padder/doc/Makefile.am
new file mode 100755 (executable)
index 0000000..d5c4468
--- /dev/null
@@ -0,0 +1,92 @@
+# Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+#  Author : Guillaume Boulant (EDF/R&D)
+
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+EXTRA_DIST += images input
+
+#
+# The simplest way to extends the documentation of SMESH with the
+# documentation for PADDER is to copy the local source files (*.doc
+# and *.png) in the source directory of SMESH documentation. Theses
+# pages will be automagically included in the SMESH documentation
+# generating process (make usr_docs executed at installation step) and
+# will be inserted in the page pages.html that lists the "Related
+# pages". 
+#
+
+DOC_FILES = \
+       padder_userguide.doc
+
+DOCDIR=$(top_srcdir)/doc/salome/gui/SMESH/input
+
+IMG_FILES = \
+       SMESH_spadder_end.png                            \
+       SMESH_spadder_inputdialog_concrete.png           \
+       SMESH_spadder_inputdialog_start.png              \
+       SMESH_spadder_inputdialog_steelbar.png           \
+       SMESH_spadder_menu.png                           \
+       SMESH_spadder_plugindialog_compute_finished.png  \
+       SMESH_spadder_plugindialog_compute_ready.png     \
+       SMESH_spadder_plugindialog_compute_running.png   \
+       SMESH_spadder_plugindialog_published.png         \
+       SMESH_spadder_plugindialog_start.png             \
+       SMESH_spadder_start.png
+
+
+IMGDIR=$(top_srcdir)/doc/salome/gui/SMESH/images
+
+
+all:
+       @mkdir -p $(DOCDIR); \
+       for docfile in $(DOC_FILES); do  \
+           if [ ! -h $(DOCDIR)/$${docfile} ]; then \
+               echo "Linking file $${docfile} to $(DOCDIR)/$${docfile}"; \
+               ln -s ../$(srcdir)/input/$${docfile} $(DOCDIR)/$${docfile}; \
+           fi; \
+       done; \
+       for imgfile in $(IMG_FILES); do  \
+           if [ ! -h $(IMGDIR)/$${imgfile} ]; then \
+               echo "Linking file $${imgfile} to $(IMGDIR)/$${imgfile}"; \
+               ln -s ../$(srcdir)/images/$${imgfile} $(IMGDIR)/$${imgfile}; \
+           fi; \
+       done;
+
+clean-local:
+       @ls | grep -v -e Makefile -e doxyfile | xargs rm -rf; \
+       for docfile in $(DOC_FILES); do  \
+           echo "Removing file $${docfile} from $(DOCDIR)"; \
+           rm $(DOCDIR)/$${docfile}; \
+       done; \
+       for imgfile in $(IMG_FILES); do  \
+           echo "Removing file $${imgfile} from $(IMGDIR)"; \
+           rm $(IMGDIR)/$${imgfile}; \
+       done;
+
+#
+# For test purpose, we let the user generate a local dosygen
+# documentation including only the local pages  
+#
+test_docs: doxyfile 
+       echo "===========================================" ; \
+       echo "Generating PADDER documentation" ;             \
+       echo "===========================================" ; \
+       $(DOXYGEN) doxyfile ;
diff --git a/src/Tools/padder/doc/doxyfile.in b/src/Tools/padder/doc/doxyfile.in
new file mode 100755 (executable)
index 0000000..8f2aa2a
--- /dev/null
@@ -0,0 +1,77 @@
+# Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME      = "SALOME Mesh User's Guide"
+OUTPUT_DIRECTORY  = .
+CREATE_SUBDIRS   = NO
+OUTPUT_LANGUAGE   = English
+TAB_SIZE          = 5
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET             = NO
+WARNINGS          = YES
+
+#---------------------------------------------------------------------------
+#Input related options
+#---------------------------------------------------------------------------
+INPUT             = @srcdir@/input               
+FILE_PATTERNS     = *.doc
+EXCLUDE           = 
+IMAGE_PATH        = @srcdir@/images
+EXAMPLE_PATH      = @top_srcdir@/src/SMESH_SWIG
+
+#---------------------------------------------------------------------------
+#HTML related options
+#---------------------------------------------------------------------------
+GENERATE_HTML     = YES
+HTML_OUTPUT       = .
+HTML_HEADER       = @top_builddir@/doc/salome/gui/SMESH/static/header.html
+HTML_FOOTER       = @top_srcdir@/doc/salome/gui/SMESH/static/footer.html
+HTML_STYLESHEET   = @top_srcdir@/doc/salome/gui/SMESH/static/doxygen.css
+TOC_EXPAND        = YES
+DISABLE_INDEX     = NO
+GENERATE_TREEVIEW = YES
+TREEVIEW_WIDTH    = 300
+
+#---------------------------------------------------------------------------
+#SORT related options
+#---------------------------------------------------------------------------
+SORT_GROUP_NAMES = NO
+
+
+#---------------------------------------------------------------------------
+#LaTeX related option
+#---------------------------------------------------------------------------
+GENERATE_LATEX    = NO
+EXTRA_PACKAGES    = amsmath
+
+#---------------------------------------------------------------------------
+#RTF related options
+#---------------------------------------------------------------------------
+GENERATE_RTF      = NO
+
+SEARCHENGINE      = YES
diff --git a/src/Tools/padder/doc/images/SMESH_spadder_end.png b/src/Tools/padder/doc/images/SMESH_spadder_end.png
new file mode 100644 (file)
index 0000000..12e2b7c
Binary files /dev/null and b/src/Tools/padder/doc/images/SMESH_spadder_end.png differ
diff --git a/src/Tools/padder/doc/images/SMESH_spadder_inputdialog_concrete.png b/src/Tools/padder/doc/images/SMESH_spadder_inputdialog_concrete.png
new file mode 100644 (file)
index 0000000..ed0a8a7
Binary files /dev/null and b/src/Tools/padder/doc/images/SMESH_spadder_inputdialog_concrete.png differ
diff --git a/src/Tools/padder/doc/images/SMESH_spadder_inputdialog_start.png b/src/Tools/padder/doc/images/SMESH_spadder_inputdialog_start.png
new file mode 100644 (file)
index 0000000..8725d71
Binary files /dev/null and b/src/Tools/padder/doc/images/SMESH_spadder_inputdialog_start.png differ
diff --git a/src/Tools/padder/doc/images/SMESH_spadder_inputdialog_steelbar.png b/src/Tools/padder/doc/images/SMESH_spadder_inputdialog_steelbar.png
new file mode 100644 (file)
index 0000000..8e692dc
Binary files /dev/null and b/src/Tools/padder/doc/images/SMESH_spadder_inputdialog_steelbar.png differ
diff --git a/src/Tools/padder/doc/images/SMESH_spadder_menu.png b/src/Tools/padder/doc/images/SMESH_spadder_menu.png
new file mode 100644 (file)
index 0000000..e891406
Binary files /dev/null and b/src/Tools/padder/doc/images/SMESH_spadder_menu.png differ
diff --git a/src/Tools/padder/doc/images/SMESH_spadder_plugindialog_compute_finished.png b/src/Tools/padder/doc/images/SMESH_spadder_plugindialog_compute_finished.png
new file mode 100644 (file)
index 0000000..e29cf56
Binary files /dev/null and b/src/Tools/padder/doc/images/SMESH_spadder_plugindialog_compute_finished.png differ
diff --git a/src/Tools/padder/doc/images/SMESH_spadder_plugindialog_compute_ready.png b/src/Tools/padder/doc/images/SMESH_spadder_plugindialog_compute_ready.png
new file mode 100644 (file)
index 0000000..f86790b
Binary files /dev/null and b/src/Tools/padder/doc/images/SMESH_spadder_plugindialog_compute_ready.png differ
diff --git a/src/Tools/padder/doc/images/SMESH_spadder_plugindialog_compute_running.png b/src/Tools/padder/doc/images/SMESH_spadder_plugindialog_compute_running.png
new file mode 100644 (file)
index 0000000..b3c9ef1
Binary files /dev/null and b/src/Tools/padder/doc/images/SMESH_spadder_plugindialog_compute_running.png differ
diff --git a/src/Tools/padder/doc/images/SMESH_spadder_plugindialog_published.png b/src/Tools/padder/doc/images/SMESH_spadder_plugindialog_published.png
new file mode 100644 (file)
index 0000000..19e1ae7
Binary files /dev/null and b/src/Tools/padder/doc/images/SMESH_spadder_plugindialog_published.png differ
diff --git a/src/Tools/padder/doc/images/SMESH_spadder_plugindialog_start.png b/src/Tools/padder/doc/images/SMESH_spadder_plugindialog_start.png
new file mode 100644 (file)
index 0000000..45ba1a0
Binary files /dev/null and b/src/Tools/padder/doc/images/SMESH_spadder_plugindialog_start.png differ
diff --git a/src/Tools/padder/doc/images/SMESH_spadder_start.png b/src/Tools/padder/doc/images/SMESH_spadder_start.png
new file mode 100644 (file)
index 0000000..160da9d
Binary files /dev/null and b/src/Tools/padder/doc/images/SMESH_spadder_start.png differ
diff --git a/src/Tools/padder/doc/input/padder_userguide.doc b/src/Tools/padder/doc/input/padder_userguide.doc
new file mode 100644 (file)
index 0000000..d92f85e
--- /dev/null
@@ -0,0 +1,139 @@
+/*!
+
+\page padder_userguide_page Use the padder SMESH Plugin
+
+-# \ref S1_PADDER
+-# \ref S2_PADDER
+-# \ref S3_PADDER
+
+\section S1_PADDER The PADDER Algorithm
+
+PADDER is an algorithm that creates a set of particules called a "discrete mesh".
+The particules are characterized by a location in space and a weight that can be considered
+as the radius of a sphere whose center is the location of the particule.
+
+Discrete meshes are typically used to modelize civil components in rapid dynamic
+computation problems (seisms, chocs). These components consists in concrete parts
+embedding steal bares for reinforcement. These parts are input to the algorithm
+as standard finite elements meshes. The cells of theses meshes drive the location
+and sizing of particules.
+
+In the med representation, a discrete mesh is described as MED_BALL elements.
+A MED_BALL element is defined by a location and a radius.
+
+\section S2_PADDER The PADDER SALOME plugin
+
+The PADDER algoritm is integrated in the module SMESH as a SALOME
+plugin. This section illustrates how to use this plugin to create a
+discrete mesh.
+
+In this example, we suppose that two standard meshes (Finite Elements
+Meshes) have been created and publish in the study to modelize the
+concrete part (here with the name "concrete") and the steal bars part
+(here with the name "ferrail"):
+
+\image html SMESH_spadder_start.png
+
+The PADDER plugin can be invoked from the SMESH plugins menu, as
+illustrated on the figure below:
+
+\image html SMESH_spadder_menu.png
+
+When you clic on the "PADDER mesher" item, the graphical interface of
+the PADDER plugin appears:
+
+\image html SMESH_spadder_plugindialog_start.png
+
+This interface invites you to specify input data by pressing the button
+"Input". This command opens the Input dialog box to specify the list
+of meshes and the type of the selected meshes (to be choosen between
+"concrete" or "steelbar" using the combobox on the right side of the
+input line):
+
+\image html SMESH_spadder_inputdialog_start.png
+
+In the figure below, the mesh with name "concrete" has been selected
+in the study and added in the list of input file as a "concrete
+mesh". You have to input the mesh in the dialog using the rounded
+arrow icon, then specify a group name (the name of the group of
+MED_BALL created for this mesh in the resulting mesh), and finnaly
+clic on the "Add" icon:
+
+\image html SMESH_spadder_inputdialog_concrete.png
+
+Then, the mesh with name "ferrail" is selected and added to the list
+as a "steelbar mesh":
+
+\image html SMESH_spadder_inputdialog_steelbar.png
+
+The input dialog box can be validated toreturn to the main plugin
+interface. The "Compute" button is now enable, indicating that the
+problem is ready to be computed:
+
+\image html SMESH_spadder_plugindialog_compute_ready.png
+
+The command "Compute" start the job. The progression can be requested
+using the command "Refresh". In the figure below, the job is still
+running:
+
+\image html SMESH_spadder_plugindialog_compute_running.png
+
+Finally, the job is finished and the result is ready to be published
+in the SALOME study:
+
+\image html SMESH_spadder_plugindialog_compute_finished.png
+
+Clic on the command "Publish" to explicitly import the resulting med
+file in SMESH and published the resulting mesh in the SALOME study:
+
+\image html SMESH_spadder_plugindialog_published.png
+
+Note that this mesh contains one group for each of the input mesh. A
+group with the name specified in the input dialog has been defined for
+the set of MED_BALL created from the corresponding input mesh:
+
+\image html SMESH_spadder_end.png
+
+\section S3_PADDER Configuring the plugin
+
+The configuration of the plugin consists in specifying the location of
+the padder executable program for each of the SALOME resource (at
+least for the localhost resource). This specification is done in the
+file padder.cfg, located in the plugin installation folder
+(i.e. <SMESH_ROOT_DIR>/plugins):
+
+\code
+# This section specify the configurations to be used respectively for
+# the local execution and the remote execution. The value for 'local'
+# and 'remote' keys must be the name of a configuration section in
+# this file. The default key must specify a value between "local" or
+# "remote" to indicate the user preference. 
+[resources]
+local   = localhost
+remote  = nepal
+
+[preferences]
+defaultres = local
+
+# The following sections defines the available configurations.
+# The name of the section can be choosen arbitrary. But the value of
+# the resname key MUST be the name of a SALOME resource defined in the
+# catalog of resources (CatalogResources.xml).
+
+# For each section:
+# - resname : the name of the SALOME resource to be used in this configuration
+# - binpath : the path to the padder executable program on this resource
+# - envpath : the path to the environment file on this resource
+[localhost]
+resname = localhost
+binpath = /home/.programs/salome/workspace/V6_4_BR/SMESH/install/share/salome/resources/smesh/padderexe/padder.exe
+envpath = /home/.programs/salome/workspace/V6_4_BR/SMESH/install/share/salome/resources/smesh/padderexe/envPadder.sh
+
+[nepal]
+resname = nepal@nepal
+binpath = /usr/local/bin/padder.exe
+envpath = /usr/local/share/envPadder.sh
+\endcode
+
+*/
+
index 3c2ebc7d59b84aa8346d030a8488074f272d71d8..1f6ae9af2ca37a7439323d74ed5e513f9de33621 100644 (file)
 #
 include $(top_srcdir)/adm_local/unix/make_common_starter.am
 
-BUILT_SOURCES = \
-       MESHJOBSK.cc
+BUILT_SOURCES = MESHJOBSK.cc
+IDL_FILES = MESHJOB.idl
 
-IDL_FILES = \
-       MESHJOB.idl
+# For test purpose, we add a little component:
+BUILT_SOURCES += SPADDERPluginTestSK.cc
+IDL_FILES += SPADDERPluginTest.idl
 
 salomeidl_DATA = $(IDL_FILES) 
 
diff --git a/src/Tools/padder/meshjob/idl/SPADDERPluginTest.idl b/src/Tools/padder/meshjob/idl/SPADDERPluginTest.idl
new file mode 100644 (file)
index 0000000..6f04f01
--- /dev/null
@@ -0,0 +1,46 @@
+//  Copyright (C) 2011  CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Authors : Guillaume Boulant (EDF) - 31/01/2011
+
+#ifndef _SPADDERPLUGINTEST_IDL_
+#define _SPADDERPLUGINTEST_IDL_
+
+#include "SALOME_Exception.idl"
+#include "SALOME_Component.idl"
+
+module SPADDERPluginTest {
+
+  //
+  // ========================================================================
+  // Thi module defines an interface provided for testing the usage
+  // of SPADDERPlugin components and underlying classes from within a
+  // C++ unit test running in a SALOME container (easy to run from a
+  // python client)..
+  // ========================================================================
+  //
+
+  interface SPADDERPluginTester: Engines::EngineComponent
+  {
+    void demo(in double a,in double b,out double c) raises (SALOME::SALOME_Exception);
+    boolean testkernel() raises (SALOME::SALOME_Exception);
+    boolean testsmesh(in long studyId) raises (SALOME::SALOME_Exception);
+  };
+};
+
+#endif // _SPADDERPLUGINTEST_IDL_
index 7ef6c2e40b426d3ece21560297139085bd7983a4..065882b3edf50a8f967aca5ffb4d90813a43686c 100644 (file)
@@ -15,26 +15,56 @@ salomeinclude_HEADERS= \
 libMeshJobManagerEngine_la_SOURCES  = \
        MeshJobManager_i.cxx
 
-
-LIBXML_INCLUDES=@LIBXML_INCLUDES@
 LIBXML_LIBS=@LIBXML_LIBS@
 KERNEL_CXXFLAGS=@KERNEL_CXXFLAGS@
-#KERNEL_LIBS=@KERNEL_LDFLAGS@ -lSalomeContainer -lOpUtil -lSalomeDSCContainer -lSalomeDSCSuperv -lSalomeDatastream -lSalomeDSCSupervBasic -lCalciumC -lSalomeKernelHelpers
-KERNEL_LIBS = \
-       @KERNEL_LDFLAGS@ \
-       -lSalomeContainer
-
-# -lSalomeLauncher -lSalomeKernelHelpers \
-#      -lSalomeGenericObj -lSalomeIDLKernel
-
-OMNIORB_CXXFLAGS=
 
 libMeshJobManagerEngine_la_CXXFLAGS = \
        -I$(builddir)/../idl $(KERNEL_CXXFLAGS) \
-       @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \
-       $(LIBXML_INCLUDES)
+       @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @LIBXML_INCLUDES@
 
+libMeshJobManagerEngine_la_FFLAGS = -fexceptions
 libMeshJobManagerEngine_la_LDFLAGS   = \
        $(builddir)/../idl/libSalomeIDLSPADDER.la \
-       $(KERNEL_LIBS) \
-       $(LIBXML_LIBS)
+       @KERNEL_LDFLAGS@ -lSalomeContainer -lSalomeKernelHelpers \
+       @LIBXML_LIBS@
+
+# =============================================================
+# Definition of the SPADDERPluginTester engine construction
+# =============================================================
+lib_LTLIBRARIES += libSPADDERPluginTesterEngine.la
+
+libSPADDERPluginTesterEngine_la_SOURCES  = \
+        SPADDERPluginTester_i.cxx
+
+nodist_libSPADDERPluginTesterEngine_la_SOURCES =
+
+libSPADDERPluginTesterEngine_la_CXXFLAGS = \
+       -I$(builddir)/../idl $(KERNEL_CXXFLAGS) \
+       @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @LIBXML_INCLUDES@
+
+libSPADDERPluginTesterEngine_la_FFLAGS = -fexceptions
+libSPADDERPluginTesterEngine_la_LIBADD = \
+       $(builddir)/../idl/libSalomeIDLSPADDER.la \
+       @KERNEL_LDFLAGS@ -lSalomeContainer -lSalomeKernelHelpers \
+       @LIBXML_LIBS@
+
+
+# For testing SMESH
+#
+libSPADDERPluginTesterEngine_la_CXXFLAGS += \
+       @GEOM_CXXFLAGS@ @MED_CXXFLAGS@ \
+       -I$(top_builddir)/idl \
+       -I$(top_srcdir)/src/SMESH \
+       -I$(top_srcdir)/src/SMESH_I \
+       -I$(top_srcdir)/src/SMESHDS \
+       -I$(top_srcdir)/src/SMDS \
+       -I$(top_srcdir)/src/SMESHUtils \
+       $(VTK_INCLUDES) $(CAS_CPPFLAGS)
+
+libSPADDERPluginTesterEngine_la_LIBADD += \
+       $(top_builddir)/src/SMESH/libSMESHimpl.la \
+       $(top_builddir)/src/SMESH_I/libSMESHEngine.la \
+       $(top_builddir)/src/SMESHDS/libSMESHDS.la \
+       $(top_builddir)/src/SMDS/libSMDS.la \
+       $(top_builddir)/src/SMESHUtils/libSMESHUtils.la
+
index b2917df824b463e1076dabf453fecba94df5f34c..4825d8f3d558e27f2cf71983b51fc79cff6977ed 100644 (file)
@@ -28,8 +28,6 @@
 #undef LOG
 #define LOG STDLOG
 
-#include "testhelper.hxx"
-
 //
 // ====================================================================
 // General purpose helper functions (to put elsewhere at least)
diff --git a/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.cxx b/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.cxx
new file mode 100644 (file)
index 0000000..ae4f8cd
--- /dev/null
@@ -0,0 +1,151 @@
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#include "SPADDERPluginTester_i.hxx"
+
+#include <SALOME_NamingService.hxx>
+#include <Utils_SALOME_Exception.hxx>
+
+// For standard logging
+#include "Basics_Utils.hxx"
+
+//
+// ==========================================================================
+// Implementation of the SPADDER component interface
+// ==========================================================================
+//
+using namespace std;
+
+/*!
+ * Constructor for component "SPADDER" instance
+ */
+SPADDERPluginTester_i::SPADDERPluginTester_i(CORBA::ORB_ptr orb,
+                                            PortableServer::POA_ptr poa,
+                                            PortableServer::ObjectId * contId,
+                                            const char *instanceName,
+                                            const char *interfaceName)
+  : Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
+{
+  LOG("Activating SPADDERPluginTester_i::SPADDERPluginTester object");
+  _thisObj = this ;
+  _id = _poa->activate_object(_thisObj);
+}
+
+//! Destructor for component "SPADDER" instance
+SPADDERPluginTester_i::~SPADDERPluginTester_i()
+{
+  std::cerr << "SPADDERPluginTester destruction" << std::endl;
+}
+
+/*!
+ * This test is just to check the component SPADDER.
+ */
+void SPADDERPluginTester_i::demo(CORBA::Double a,CORBA::Double b,CORBA::Double& c)
+{
+  beginService("SPADDERPluginTester_i::demo");
+  try {
+    //BODY
+    
+    std::cerr << "a: " << a << std::endl;
+    std::cerr << "b: " << b << std::endl;
+    c=a+b;
+    std::cerr << "c: " << c << std::endl;
+    
+  }
+  catch ( const SALOME_Exception & ex) {
+    SALOME::ExceptionStruct es;
+    es.text=CORBA::string_dup(ex.what());
+    es.type=SALOME::INTERNAL_ERROR;
+    throw SALOME::SALOME_Exception(es);
+  }
+  catch ( const SALOME::SALOME_Exception & ex) {
+    throw;
+  }
+  catch (...) {
+    std::cerr << "unknown exception" << std::endl;
+    SALOME::ExceptionStruct es;
+    es.text=CORBA::string_dup(" unknown exception");
+    es.type=SALOME::INTERNAL_ERROR;
+    throw SALOME::SALOME_Exception(es);
+  }
+  endService("SPADDERPluginTester_i::demo");
+}
+
+#include <SALOME_KernelServices.hxx>
+#include "SALOME_Launcher.hxx"
+bool SPADDERPluginTester_i::testkernel()
+{
+  beginService("SPADDERPluginTester_i::testplugin");
+
+  Engines::SalomeLauncher_ptr salomeLauncher = KERNEL::getSalomeLauncher();
+
+  endService("SPADDERPluginTester_i::testplugin");
+  return true;
+}
+
+
+#include <SMESH_Gen_i.hxx>
+#include <SMESH_Gen.hxx>
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOMEDS)
+
+#include <utilities.h>
+
+/*!
+ * This test checks the constructor of the basic classes of the SMESH
+ * plugin for PADDER.
+ */
+bool SPADDERPluginTester_i::testsmesh(CORBA::Long studyId)
+{
+  beginService("SPADDERPluginTester_i::testsmesh");
+
+  // Resolve the SMESH engine and the SALOME study
+  // _WARN_ The SMESH engine should have been loaded first
+  SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
+  CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/myStudyManager");
+  SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject);
+  SALOMEDS::Study_var myStudy = aStudyMgr->GetStudyByID(studyId);
+
+  //
+  // _MEM_ CAUTION: SMESH_Gen define a data structure for local usage
+  // while SMESH_Gen_i is the implementation of the SMESH_Gen IDL
+  // interface.
+  //
+
+  endService("SPADDERPluginTester_i::testsmesh");
+  return true;
+}
+
+//
+// ==========================================================================
+// Factory services
+// ==========================================================================
+//
+extern "C"
+{
+  PortableServer::ObjectId * SPADDERPluginTesterEngine_factory( CORBA::ORB_ptr orb,
+                                                               PortableServer::POA_ptr poa,
+                                                               PortableServer::ObjectId * contId,
+                                                               const char *instanceName,
+                                                               const char *interfaceName)
+  {
+    MESSAGE("PortableServer::ObjectId * SPADDERPluginTesterEngine_factory()");
+    SPADDERPluginTester_i * myEngine = new SPADDERPluginTester_i(orb, poa, contId, instanceName, interfaceName);
+    return myEngine->getId() ;
+  }
+}
diff --git a/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.hxx b/src/Tools/padder/meshjob/impl/SPADDERPluginTester_i.hxx
new file mode 100644 (file)
index 0000000..85a02a9
--- /dev/null
@@ -0,0 +1,47 @@
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Authors : Guillaume Boulant (EDF) - 01/02/2011
+
+#ifndef _SPADDER_PLUGINTESTER_HXX_
+#define _SPADDER_PLUGINTESTER_HXX_
+
+// include the stubs generating from SPADDERPluginTest.idl
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SPADDERPluginTest)
+#include <SALOME_Component.hh>
+#include "SALOME_Component_i.hxx"
+
+class SPADDERPluginTester_i:
+  public virtual POA_SPADDERPluginTest::SPADDERPluginTester,
+  public Engines_Component_i
+{
+public:
+  SPADDERPluginTester_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa,
+                       PortableServer::ObjectId * contId,
+                       const char *instanceName, const char *interfaceName);
+  virtual ~SPADDERPluginTester_i();
+  
+  void demo(CORBA::Double a,CORBA::Double b,CORBA::Double& c);
+  bool testkernel();
+  bool testsmesh(CORBA::Long studyId);
+
+};
+
+#endif
+
index 7ce0646a5f52c283602584fa716927e282ffebf4..76e233258d7c76e63ead137def5ace8b637c519a 100644 (file)
@@ -1,27 +1,38 @@
 #ifndef __TESTHELPER_HXX__
 #define __TESTHELPER_HXX__
 
+// >>>
+// WARN: this file is DEPRECATED and/or should be used for test
+// purpose only. The PADDER configuration is now read in a
+// configuration file (padder.cfg).
+// <<<
+
 #include <stdlib.h> // Standard C include (for getenv)
 #include <unistd.h>
 #include <string>
 
 /*!
- * This function returns the module SPADDER installation root
- * directory as a string.
+ * This function returns the module SMESH installation root directory
+ * as a string.
  */
-static std::string SPADDER_ROOT_DIR() {
-  static std::string * spadder_root_dir;
-  if ( spadder_root_dir == NULL ) {
-    char * SPADDER_ROOT_DIR = getenv("SPADDER_ROOT_DIR");
-    spadder_root_dir = new std::string(SPADDER_ROOT_DIR);
+static std::string SMESH_ROOT_DIR() {
+  static std::string * smesh_root_dir;
+  if ( smesh_root_dir == NULL ) {
+    char * SMESH_ROOT_DIR = getenv("SMESH_ROOT_DIR");
+    if ( SMESH_ROOT_DIR == NULL ) {
+      smesh_root_dir = new std::string("<path_undefined>");
+    }
+    else {
+      smesh_root_dir = new std::string(SMESH_ROOT_DIR);
+    }
   }
-  return *spadder_root_dir;
+  return *smesh_root_dir;
 }
 
 /*! Relative path of the directory containing data and exe for tests */
-static std::string PADDEREXE_RPATH("/share/salome/resources/spadder/padderexe");
+static std::string PADDEREXE_RPATH("/share/salome/resources/smesh/padderexe");
 /*! Absolute path of the directory containing data and exe for tests */
-static std::string PADDEREXE_APATH(SPADDER_ROOT_DIR()+PADDEREXE_RPATH);
+static std::string PADDEREXE_APATH(SMESH_ROOT_DIR()+PADDEREXE_RPATH);
 /*! Absolute path of the exe shell script for tests */
 static std::string PADDEREXE_SCRIPT_FILENAME(PADDEREXE_APATH+"/padder.sh");
 
index 756375666148c6462ca4c3b6e4af2514c7bcad2b..4e4cafe42b3e5083988fb6a9e0f2a6da523650f9 100644 (file)
@@ -9,5 +9,8 @@
         <component>
             <component-name>MeshJobManager</component-name>
         </component>
+        <component>
+            <component-name>SPADDERPluginTester</component-name>
+        </component>
     </component-list>
 </begin-catalog>
index 1a2c26a6ac241662b992b8f072ee16cfbc1afe0d..a134daf95e145bc65ff569eaf33d73d05e876b74 100644 (file)
@@ -87,3 +87,7 @@ def loadSpadderCatalog():
 
     filename = getSpadderCatalogFilename()
     catalog.ImportXmlCatalogFile(filename)
+
+    from salome.kernel import services
+    print "The list of SALOME components is now:" 
+    print services.getComponentList()
index 51902be6634b89b5d605574e5fc2dc5980fe01bf..26a2d7ca807d55036998b92db46ca34091785bc6 100644 (file)
@@ -22,7 +22,7 @@
 # Author : Guillaume Boulant (EDF)
 #
 
-from PyQt4.QtGui import QDialog, QMessageBox, QIcon
+from PyQt4.QtGui import QDialog, QIcon
 from PyQt4.QtCore import QObject, SIGNAL, SLOT, Qt
 
 from plugindialog_ui import Ui_PluginDialog
@@ -35,6 +35,7 @@ from inputdata import InputData
 import os
 import salome
 from salome.kernel import studyedit
+from salome.kernel.uiexception import AdminException
 
 from omniORB import CORBA
 import SMESH
@@ -106,6 +107,8 @@ class PluginDialog(QDialog):
         the initialize step, by specifing the name of the resource to
         be used.
         '''
+        # We first 
+        
         configReader = ConfigReader()
         config = configReader.getLocalConfig()
         configId = config.resname
@@ -173,12 +176,28 @@ class PluginDialog(QDialog):
 
     def __getJobManager(self):
         """
-        This function requests a pointer to the MeshJobManager servant.
+        This function requests a pointer to the MeshJobManager
+        servant. Note that the component is loaded on first demand,
+        and then the reference is recycled.
         """
+        if self.__dict__.has_key("__jobManager") and self.__jobManager is not None:
+            return self.__jobManager
+
+        # WARN: we first have to update the SALOME components catalog
+        # with the SPADDER components (because they are not defined in
+        # the SMESH catalog, and then they are not in the default
+        # catalog)
+        from salome.smesh import spadder
+        spadder.loadSpadderCatalog()
+        # Then we can load the MeshJobManager component
         component=salome.lcc.FindOrLoadComponent("FactoryServer","MeshJobManager")
         if component is None:
-            self.__log("ERR: the SALOME component MeshJobManager can't be reached")
-        return component
+            msg="ERR: the SALOME component MeshJobManager can't be reached"
+            self.__log(msg)
+            raise AdminException(msg)
+
+        self.__jobManager = component
+        return self.__jobManager
 
     def __log(self, message):
         """
@@ -237,9 +256,9 @@ class PluginDialog(QDialog):
         # from the dialog window.
         self.__listInputData = self.__inputDialog.getData()
         self.__ui.lblStatusBar.setText("Input data OK")
+        self.__log("INF: Press \"Compute\" to start the job")
         self.__setGuiState(["CAN_SELECT", "CAN_COMPUTE"])
         
-
     def onCompute(self):
         '''
         This function is the slot connected to the Compute button. It
index 69b65f65d777a64681d62ab06bab550b2bd72dc6..c6af08f680fbf504b2ba47f0e870e91e444e46bc 100644 (file)
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
  <class>PluginDialog</class>
- <widget class="QDialog" name="PluginDialog" >
-  <property name="geometry" >
+ <widget class="QDialog" name="PluginDialog">
+  <property name="enabled">
+   <bool>true</bool>
+  </property>
+  <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>417</width>
+    <width>649</width>
     <height>367</height>
    </rect>
   </property>
-  <property name="windowTitle" >
+  <property name="windowTitle">
    <string>Create a mesh with PADDER</string>
   </property>
-  <layout class="QHBoxLayout" >
-   <property name="margin" >
-    <number>9</number>
-   </property>
-   <property name="spacing" >
+  <layout class="QHBoxLayout">
+   <property name="spacing">
     <number>6</number>
    </property>
+   <property name="margin">
+    <number>9</number>
+   </property>
    <item>
-    <layout class="QVBoxLayout" >
-     <property name="margin" >
-      <number>0</number>
-     </property>
-     <property name="spacing" >
+    <layout class="QVBoxLayout">
+     <property name="spacing">
       <number>6</number>
      </property>
+     <property name="margin">
+      <number>0</number>
+     </property>
      <item>
-      <widget class="QFrame" name="frameInput" >
-       <property name="frameShadow" >
+      <widget class="QFrame" name="frameInput">
+       <property name="frameShadow">
         <enum>QFrame::Raised</enum>
        </property>
-       <property name="lineWidth" >
+       <property name="lineWidth">
         <number>1</number>
        </property>
-       <property name="midLineWidth" >
+       <property name="midLineWidth">
         <number>0</number>
        </property>
-       <layout class="QHBoxLayout" >
-        <property name="margin" >
-         <number>9</number>
-        </property>
-        <property name="spacing" >
+       <layout class="QHBoxLayout">
+        <property name="spacing">
          <number>6</number>
         </property>
+        <property name="margin">
+         <number>9</number>
+        </property>
        </layout>
       </widget>
      </item>
      <item>
-      <layout class="QHBoxLayout" >
-       <property name="margin" >
-        <number>0</number>
-       </property>
-       <property name="spacing" >
+      <layout class="QHBoxLayout">
+       <property name="spacing">
         <number>6</number>
        </property>
+       <property name="margin">
+        <number>0</number>
+       </property>
        <item>
-        <widget class="QTextEdit" name="txtLog" />
+        <widget class="QTextEdit" name="txtLog"/>
        </item>
        <item>
-        <layout class="QVBoxLayout" >
-         <property name="margin" >
-          <number>0</number>
-         </property>
-         <property name="spacing" >
+        <layout class="QVBoxLayout">
+         <property name="spacing">
           <number>6</number>
          </property>
+         <property name="margin">
+          <number>0</number>
+         </property>
          <item>
-          <widget class="QPushButton" name="btnInput" >
-           <property name="text" >
+          <widget class="QPushButton" name="btnInput">
+           <property name="text">
             <string>Input</string>
            </property>
-           <property name="icon" >
-            <iconset>parameters.png</iconset>
+           <property name="icon">
+            <iconset>
+             <normaloff>parameters.png</normaloff>parameters.png</iconset>
            </property>
           </widget>
          </item>
          <item>
-          <widget class="QPushButton" name="btnCompute" >
-           <property name="text" >
+          <widget class="QPushButton" name="btnCompute">
+           <property name="text">
             <string>Compute</string>
            </property>
-           <property name="icon" >
-            <iconset>compute.png</iconset>
+           <property name="icon">
+            <iconset>
+             <normaloff>compute.png</normaloff>compute.png</iconset>
            </property>
           </widget>
          </item>
          <item>
-          <widget class="QPushButton" name="btnRefresh" >
-           <property name="text" >
+          <widget class="QPushButton" name="btnRefresh">
+           <property name="text">
             <string>Refresh</string>
            </property>
-           <property name="icon" >
-            <iconset>refresh.png</iconset>
+           <property name="icon">
+            <iconset>
+             <normaloff>refresh.png</normaloff>refresh.png</iconset>
            </property>
           </widget>
          </item>
          <item>
-          <widget class="QPushButton" name="btnPublish" >
-           <property name="text" >
+          <widget class="QPushButton" name="btnPublish">
+           <property name="text">
             <string>Publish</string>
            </property>
-           <property name="icon" >
-            <iconset>publish.png</iconset>
+           <property name="icon">
+            <iconset>
+             <normaloff>publish.png</normaloff>publish.png</iconset>
            </property>
           </widget>
          </item>
          <item>
           <spacer>
-           <property name="orientation" >
+           <property name="orientation">
             <enum>Qt::Vertical</enum>
            </property>
-           <property name="sizeHint" >
+           <property name="sizeHint" stdset="0">
             <size>
              <width>75</width>
              <height>101</height>
           </spacer>
          </item>
          <item>
-          <widget class="QPushButton" name="btnClear" >
-           <property name="text" >
+          <widget class="QPushButton" name="btnClear">
+           <property name="text">
             <string>Clear</string>
            </property>
-           <property name="icon" >
-            <iconset>clear.png</iconset>
+           <property name="icon">
+            <iconset>
+             <normaloff>clear.png</normaloff>clear.png</iconset>
            </property>
           </widget>
          </item>
       </layout>
      </item>
      <item>
-      <widget class="QLabel" name="lblStatusBar" >
-       <property name="enabled" >
+      <widget class="QLabel" name="lblStatusBar">
+       <property name="enabled">
         <bool>true</bool>
        </property>
-       <property name="frameShape" >
+       <property name="frameShape">
         <enum>QFrame::StyledPanel</enum>
        </property>
-       <property name="frameShadow" >
+       <property name="frameShadow">
         <enum>QFrame::Sunken</enum>
        </property>
-       <property name="text" >
+       <property name="text">
         <string/>
        </property>
       </widget>
index d1ef795b4fa1c74270aefa745a156b737f3eb629..9a8f5e1dd92a083ae2247fb43e61ac6d4a9dfed1 100644 (file)
@@ -21,8 +21,8 @@ defaultres = local
 # - envpath : the path to the environment file on this resource
 [localhost]
 resname = localhost
-binpath = @prefix@/share/salome/resources/spadder/padderexe/padder.exe
-envpath = @prefix@/share/salome/resources/spadder/padderexe/envPadder.sh
+binpath = @prefix@/share/salome/resources/smesh/padderexe/padder.exe
+envpath = @prefix@/share/salome/resources/smesh/padderexe/envPadder.sh
 
 [venus]
 resname = gboulant@venus
index 3fbef14d3fc6a6eb2a3e9554ef32828a1d88a387..871ef1323bcd730439154d61d8f665c5efc9126a 100644 (file)
@@ -6,7 +6,7 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am
 # plugins and created in the root installation directory.
 #
 salomeplugins_PYTHON = \
-       salome_plugins.py
+       smesh_plugins.py
 
 salomeplugins_DATA = \
        envPlugins.sh
index 62ad634d765e873d18dde80b2cf0319e7c7e6c34..cff8607259b9f045fc65ebee9020ee9742fe55a1 100755 (executable)
@@ -26,8 +26,17 @@ import salome_pluginsmanager
 
 def runSpadderPlugin(context):
     from salome.smesh.spadder.gui import plugindialog
-    dialog=plugindialog.getDialog()
-    dialog.update()
+    from salome.kernel.uiexception import UiException
+    try:
+        dialog=plugindialog.getDialog()
+    except UiException, err:
+        from PyQt4.QtGui import QMessageBox
+        QMessageBox.critical(None,
+                             "An error occurs during PADDER configuration",
+                             err.getUIMessage())
+        return
+    
+    dialog.update()    
     dialog.show()
 
 salome_pluginsmanager.AddFunction('PADDER mesher',
diff --git a/src/Tools/padder/spadderpy/plugin/smesh_plugins.py b/src/Tools/padder/spadderpy/plugin/smesh_plugins.py
new file mode 100755 (executable)
index 0000000..cff8607
--- /dev/null
@@ -0,0 +1,45 @@
+# -*- coding: iso-8859-1 -*-
+#  Copyright (C) 2011 EDF R&D
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# -* Makefile *- 
+#
+# Author : Guillaume Boulant (EDF) 
+#
+import salome_pluginsmanager
+
+
+def runSpadderPlugin(context):
+    from salome.smesh.spadder.gui import plugindialog
+    from salome.kernel.uiexception import UiException
+    try:
+        dialog=plugindialog.getDialog()
+    except UiException, err:
+        from PyQt4.QtGui import QMessageBox
+        QMessageBox.critical(None,
+                             "An error occurs during PADDER configuration",
+                             err.getUIMessage())
+        return
+    
+    dialog.update()    
+    dialog.show()
+
+salome_pluginsmanager.AddFunction('PADDER mesher',
+                                  'Create a mesh with PADDER',
+                                  runSpadderPlugin)
+
index 33d0b590060f27e880bd57fc8d6d4287730fafa7..af904826dcc8a9f53e85f8d46e37e9fc47bff203 100644 (file)
@@ -2,9 +2,10 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am
 
 spadderpydir=$(smeshpypkgdir)/spadder/unittests
 
-spadderpy_PYTHON = \
-       __init__.py            \
-       usecase_meshJobManager.py
+spadderpy_PYTHON =                     \
+       __init__.py                    \
+       usecase_meshJobManager.py      \
+       usecase_spadderPluginTester.py
 
 spadderbindir=$(bindir)/spadder
 spadderbin_SCRIPTS = \
index e9e4a33ea9c14ce882564e4057c23f7e8bdbae83..9b6011babc5bda2a44abd26c13352995bba4bac5 100644 (file)
@@ -44,6 +44,8 @@ import MESHJOB
 #
 from salome.smesh import spadder
 spadder.loadSpadderCatalog()
+
+salome.salome_init()
 component = salome.lcc.FindOrLoadComponent("FactoryServer","MeshJobManager")
 config = MESHJOB.ConfigParameter(resname="localhost",
                                  binpath=pathpadderexe,
diff --git a/src/Tools/padder/unittests/usecase_spadderPluginTester.py b/src/Tools/padder/unittests/usecase_spadderPluginTester.py
new file mode 100644 (file)
index 0000000..f21348d
--- /dev/null
@@ -0,0 +1,51 @@
+# -*- coding: iso-8859-1 -*-
+#  Copyright (C) 2011 EDF R&D
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# Author(s): Guillaume Boulant (23/03/2011)
+#
+
+# This script illustrates the standard use case of the component
+# SPADDERPluginTester from within a SALOME script. This component is
+# dedicated to test purpose only
+
+import salome
+import SPADDERPluginTest
+
+# We first have to update the SALOME components list by loading the
+# SPADDER catalog (load on demand only) 
+from salome.smesh import spadder
+spadder.loadSpadderCatalog()
+
+# Basic test
+print "Basic tests"
+c=salome.lcc.FindOrLoadComponent("FactoryServer","SPADDERPluginTester")
+z=c.demo(2.,3.)
+
+# Test of usage of KERNEL services from the test component
+print "Test of usage of KERNEL services from the test component"
+c.testkernel()
+
+# Test of usage of SMESH engine from the test component
+# WARN: the SMESH engine must be loaded first
+print "Test of usage of SMESH engine from the test component"
+import SMESH
+salome.lcc.FindOrLoadComponent("FactoryServer","SMESH")
+c.testsmesh(salome.myStudyId)
+
+print "Test completed : OK"