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 \
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
-#SUBDIRS = MeshCut padder
-SUBDIRS = MeshCut
+SUBDIRS = MeshCut padder
+#SUBDIRS = MeshCut
DIST_SUBDIRS = MeshCut
-SUBDIRS = meshjob spadderpy unittests resources
+SUBDIRS = meshjob spadderpy unittests resources doc
--- /dev/null
+# 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 ;
--- /dev/null
+# 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
--- /dev/null
+/*!
+
+\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
+
+*/
+
#
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)
--- /dev/null
+// 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_
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
+
#undef LOG
#define LOG STDLOG
-#include "testhelper.hxx"
-
//
// ====================================================================
// General purpose helper functions (to put elsewhere at least)
--- /dev/null
+// 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() ;
+ }
+}
--- /dev/null
+// 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
+
#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");
<component>
<component-name>MeshJobManager</component-name>
</component>
+ <component>
+ <component-name>SPADDERPluginTester</component-name>
+ </component>
</component-list>
</begin-catalog>
filename = getSpadderCatalogFilename()
catalog.ImportXmlCatalogFile(filename)
+
+ from salome.kernel import services
+ print "The list of SALOME components is now:"
+ print services.getComponentList()
# 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
import os
import salome
from salome.kernel import studyedit
+from salome.kernel.uiexception import AdminException
from omniORB import CORBA
import SMESH
the initialize step, by specifing the name of the resource to
be used.
'''
+ # We first
+
configReader = ConfigReader()
config = configReader.getLocalConfig()
configId = config.resname
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):
"""
# 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
-<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>
# - 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
# plugins and created in the root installation directory.
#
salomeplugins_PYTHON = \
- salome_plugins.py
+ smesh_plugins.py
salomeplugins_DATA = \
envPlugins.sh
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',
--- /dev/null
+# -*- 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)
+
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 = \
#
from salome.smesh import spadder
spadder.loadSpadderCatalog()
+
+salome.salome_init()
component = salome.lcc.FindOrLoadComponent("FactoryServer","MeshJobManager")
config = MESHJOB.ConfigParameter(resname="localhost",
binpath=pathpadderexe,
--- /dev/null
+# -*- 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"