mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-15 01:58:35 +05:00
345 lines
14 KiB
HTML
Executable File
345 lines
14 KiB
HTML
Executable File
<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
|
|
<html>
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Type"
|
|
content="text/html; charset=iso-8859-1">
|
|
|
|
<meta name="GENERATOR"
|
|
content="Mozilla/4.79 [en] (X11; U; SunOS 5.6 sun4u) [Netscape]">
|
|
<title>Main Page</title>
|
|
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
|
</head>
|
|
<body>
|
|
|
|
<center>
|
|
<table width="96%">
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
<h1> <a href="http://www.opencascade.com"><img
|
|
src="sources/logocorp.gif" border="0" height="46" width="122"
|
|
align="left">
|
|
</a></h1>
|
|
</td>
|
|
<td>
|
|
<div align="right"><a href="http://www.opencascade.org/SALOME/"><img
|
|
src="sources/application.gif" border="0" height="46" width="108"
|
|
align="right">
|
|
</a></div>
|
|
</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
</center>
|
|
|
|
<center>
|
|
<h1> <a name="page2"></a>How to add your own mesher</h1>
|
|
</center>
|
|
|
|
<center>
|
|
<h1> (as a set of hypotheses and algorithms)</h1>
|
|
</center>
|
|
|
|
<center>
|
|
<h1> to the application.</h1>
|
|
</center>
|
|
|
|
<h2> <a name="cont"></a>Table of contents</h2>
|
|
|
|
<ul>
|
|
<li> <b><i><a href="#1">1. Introduction</a></i></b></li>
|
|
<li> <b><i><a href="#2">2. Implementation steps</a></i></b></li>
|
|
|
|
<ul>
|
|
<li> <b><i><a href="#2_1">2.1. Mesher plugin package</a></i></b></li>
|
|
<li> <b><i><a href="#2_2">2.2. List of available hypotheses and algorithms</a></i></b></li>
|
|
<li> <b><i><a href="#2_3">2.3. Build server plugin library</a></i></b></li>
|
|
|
|
<ul>
|
|
<li> <b><i><a href="#2_3_1">2.3.1. Define interface to your hypotheses and
|
|
algorithms</a></i></b></li>
|
|
<li> <b><i><a href="#2_3_2">2.3.2. Implement functionality of your hypotheses
|
|
and algorithms</a></i></b></li>
|
|
<li> <b><i><a href="#2_3_3">2.3.3. Implement interface to your hypotheses
|
|
and algorithms</a></i></b></li>
|
|
<li> <b><i><a href="#2_3_4">2.3.4. Implement being exported method</a></i></b></li>
|
|
|
|
</ul>
|
|
<li> <b><i><a href="#2_4">2.4. Build client (GUI) plugin library</a></i></b></li>
|
|
|
|
<ul>
|
|
<li> <b><i><a href="#2_4_1">2.4.1. Implement the required GUI</a></i></b></li>
|
|
<li> <b><i><a href="#2_4_2">2.4.2. Provide icons and messages for your
|
|
GUI</a></i></b></li>
|
|
<li> <b><i><a href="#2_4_3">2.4.3. Implement your hypotheses creator and
|
|
being exported method</a></i></b></li>
|
|
|
|
</ul>
|
|
<li> <b><i><a href="#2_5">2.5. Provide icons for Object Browser</a></i></b></li>
|
|
<li> <b><i><a href="#2_6">2.6. Setup SALOME environment</a></i></b></li>
|
|
<ul type="square">
|
|
<li><b><i><a href="#2_6_1">2.6.1. Set LD_LIBRARY_PATH, PYTHONPATH,
|
|
PATH environment variables</a></i></b></li>
|
|
<li><b><i><a href="#2_6_2">2.6.2. Set mesher plugin resources environment
|
|
variable</a><br>
|
|
</i></b></li>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
<h2> <a name="1"></a>1. Introduction</h2>
|
|
All hypotheses and algorithms are available in SMESH module via plugin mechanism.
|
|
Such approach allows easily to introduce new hypotheses and algorithms types
|
|
to the application. Also, it makes possible the customization of available
|
|
hypotheses and algorithms list for different users without recompilation
|
|
of sources.<br>
|
|
The goal of this document is to describe the process of creation external
|
|
mesher plugins.
|
|
<p><i><a href="#cont">Back to the contents</a></i> </p>
|
|
<h2> <a name="2"></a>2. Implementation steps</h2>
|
|
|
|
<h3>
|
|
<h3> <a name="2_1"></a>2.1. <small>Mesher plugin package</small></h3>
|
|
</h3>
|
|
Create your mesher plugin package which will contain the sources files, e.g.
|
|
MyMesherPlugin.<br>
|
|
<br>
|
|
<i><a
|
|
href="file:///home/vsr-local/work/SALOME/SALOME2/SMESH_SRC/doc/salome/tui/SMESH/sources/static/PluginMeshers.html#cont">Back
|
|
to the contents</a></i><br>
|
|
<h3><a name="2_2"></a>2.2. List of available hypotheses and algorithms</h3>
|
|
Create XML file to describe all algorithms and hypotheses, provided by your
|
|
plugin package (see SMESH_SRC/resources/SMESH_Meshers.xml for example).<br>
|
|
<blockquote><small><tt><big><meshers-group name="MyName"<br>
|
|
resources="MyResourceKey"<br>
|
|
|
|
server-lib="libMyServerLib.so"<br>
|
|
gui-lib="libMyClientLib.so"><br>
|
|
<hypotheses><br>
|
|
<hypothesis type="MyHypType1"<br>
|
|
|
|
label-id="My beautiful hypothesis name"<br>
|
|
|
|
icon-id="my_hypo_1_icon.png"/><br>
|
|
</hypotheses><br>
|
|
<algorithms><br>
|
|
<algorithm type="MyAlgType1"<br>
|
|
|
|
label-id="My beautiful algorithm name"<br>
|
|
|
|
icon-id="my_algo_1_icon.png"/><br>
|
|
</algorithms><br>
|
|
</meshers-group><br>
|
|
</big></tt></small><br>
|
|
|
|
<ul>
|
|
<li>Attributes of <meshers-group> tag:</li>
|
|
</ul>
|
|
<blockquote>
|
|
<ul type="circle">
|
|
<li>value of <name> attribute is used to collect hypotheses/algoritms
|
|
in groups; you can also use this attribute for short description of your
|
|
mesher plugin.</li>
|
|
<li>value of <resources> attribute (MyResourceKey) is used to
|
|
access resources (messages and icons) from GUI (see paragraphs <a
|
|
href="#2_4_2">2.4.2</a> and <a href="#2_5">2.5</a>); in the current implementation
|
|
it should coincide with the name of plugin package; this limitation will
|
|
be eliminated in the further development.</li>
|
|
<li>value of <server-lib> attribute describes the name of your
|
|
mesher's server plugin library (See paragraph <a href="#2_3">2.3</a>)</li>
|
|
<li>value of <gui-lib> attribute describes the name of your mesher's
|
|
client plugin library (See paragraph <a href="#2_4">2.4</a>)</li>
|
|
</ul>
|
|
</blockquote>
|
|
<ul>
|
|
<li>Attributes of <hypothesis/algorithm> tag:</li>
|
|
</ul>
|
|
<blockquote>
|
|
<ul type="circle">
|
|
<li>value of <type> attribute is an unique name of the hypothesis/algorithm</li>
|
|
</ul>
|
|
<ul type="circle">
|
|
<ul type="square">
|
|
<li>It is a value of _name field of your hypothesis class (see paragraph
|
|
<a href="#2_3">2.3</a>, implementation of constructor of StdMeshers_LocalLength
|
|
class: _name = "LocalLength")</li>
|
|
<li>It is a key to each certain hypothesis class (see paragraph <a
|
|
href="#2_3">2.3</a>, implementation of "GetHypothesisCreator()" method in
|
|
StdMeshers_i.cxx)</li>
|
|
<li>It is a key to each certain hypothesis GUI (see paragraph <a
|
|
href="#2_4">2.4</a>, implementation of "StdMeshersGUI_HypothesisCreator::CreateHypothesis()"
|
|
and "StdMeshersGUI_HypothesisCreator::EditHypothesis()" methods in StdMeshersGUI.cxx)</li>
|
|
<li>It is a key to each certain hypothesis icon in Object Browser
|
|
(see paragraph <a href="#2_4_2_1">2.4.2.1</a>)</li>
|
|
</ul>
|
|
</ul>
|
|
</blockquote>
|
|
<blockquote>
|
|
<ul type="circle">
|
|
<li>value of <label-id> attribute is displayed in the GUI in
|
|
the list of available hypotheses/algorithms ("Create Hypothesis/Algorithm"
|
|
dialog)</li>
|
|
<li>value of <icon-id> attribute is a name of icon file, which
|
|
is displayed in GUI in the list of available hypotheses/algorithms ("Create
|
|
Hypothesis/Algorithm" dialog)</li>
|
|
</ul>
|
|
</blockquote>
|
|
Note: All attributes values are accessible in your GUI via HypothesisData
|
|
class (see paragraph <a href="#2_4_1">2.4.1</a>)<br>
|
|
<br>
|
|
Note: The environment variable SMESH_MeshersList contains the list of plugins
|
|
names, separated by colon (":") symbol, e.g.:<br>
|
|
<br>
|
|
<tt> setenv SMESH_MeshersList StdMeshers:NETGENPlugin</tt><br>
|
|
<br>
|
|
Please, pay attention that StdMeshers should also be included into this environment
|
|
variable, if you want to use standard hypotheses/algorithms, provided with
|
|
SMESH module.<br>
|
|
<br>
|
|
The SALOME automatically locates XML files, searching them in the following
|
|
directories:<br>
|
|
<tt><br>
|
|
${<PLUGINNAME>_ROOT_DIR}/share/salome/resources/<pluginname><br>
|
|
${SALOME_<PluginName>Resources}<br>
|
|
${HOME}/.salome/resources<br>
|
|
${KERNEL_ROOT_DIR}/share/salome/resources/kernel</tt><br>
|
|
<br>
|
|
where <PluginName> is a name of each mesher plugin package<br>
|
|
</blockquote>
|
|
<i><a href="#cont">Back to the contents</a></i>
|
|
<h3> <a name="2_3"></a>2.3. Build server plugin library <libMyServerLib.so>.</h3>
|
|
|
|
<h4> <a name="2_3_1"></a>2.3.1. Define interface to your hypotheses and algorithms.</h4>
|
|
|
|
<blockquote><tt>Example: SMESH_SRC/idl/SMESH_BasicHypothesis.idl<br>
|
|
NETGENPLUGIN_SRC/src/NETGENPlugin_Algorithm.idl<br>
|
|
</tt><tt></tt></blockquote>
|
|
|
|
<h4> <a name="2_3_2"></a>2.3.2. Implement functionality of your hypotheses
|
|
and algorithms.</h4>
|
|
|
|
<blockquote>Inherit corresponding classes from SMESH.
|
|
<p><tt>Example: SMESH_SRC/src/StdMeshers/StdMeshers_*<br>
|
|
NETGENPLUGIN_SRC/src/NETGENPlugin_NETGEN_3D<br>
|
|
</tt><tt></tt></p>
|
|
</blockquote>
|
|
|
|
<h4> <a name="2_3_3"></a>2.3.3.Implement interface to your hypotheses and
|
|
algorithms.</h4>
|
|
|
|
<blockquote><tt>Inherit corresponding classes from SMESH_I.</tt>
|
|
<p><tt>Example: SMESH_SRC/src/StdMeshers_I/SMESH_*_i<br>
|
|
NETGENPLUGIN_SRC/src/NETGENPlugin_NETGEN_3D_i<br>
|
|
</tt><tt></tt></p>
|
|
</blockquote>
|
|
|
|
<h4> <a name="2_3_4"></a>2.3.4. Implement being exported method.</h4>
|
|
|
|
<blockquote><tt>GenericHypothesisCreator_i* GetHypothesisCreator (const char*
|
|
aHypType)</tt>
|
|
<p><aHypType> is a value of <type> attribute in the XML-description
|
|
file</p>
|
|
</blockquote>
|
|
|
|
<blockquote><tt>Example: SMESH_SRC/src/StdMeshers_I/StdMeshers_i.cxx<br>
|
|
NETGENPLUGIN_SRC/src/NETGENPlugin_i.cxx<br>
|
|
</tt><tt></tt></blockquote>
|
|
<i><a href="#cont">Back to the contents</a></i>
|
|
<h3> <a name="2_4"></a>2.4. Build client (GUI) plugin library <libMyClientLib.so>.</h3>
|
|
|
|
<blockquote>This step is required only if your hypotheses/algorithms need
|
|
specific GUI for their construction.</blockquote>
|
|
|
|
<h4> <a name="2_4_1"></a>2.4.1. Implement the required GUI (e.g. construction
|
|
dialog boxes).</h4>
|
|
|
|
<blockquote><tt>Example: SMESH_SRC/src/StdMeshersGUI/StdMeshersGUI_*Dlg</tt>
|
|
<p>Note: all data from XML-description files is accessible in your GUI
|
|
via HypothesisData class (mySMESHGUI->GetHypothesisData (aHypType),
|
|
see SMESHGUI_Hypotheses.h for HypothesisData definition)</p>
|
|
</blockquote>
|
|
|
|
<h4> <a name="2_4_2"></a>2.4.2. Provide icons and messages for your GUI.</h4>
|
|
|
|
<h5> <a name="2_4_2_1"></a>2.4.2.1. Implement resource files</h5>
|
|
|
|
<blockquote><tt>MyResourceKey_icons.po and MyResourceKey_msg_en.po</tt>
|
|
<p><tt>Example: SMESH_SRC/src/StdMeshersGUI/StdMeshers_*.po<br>
|
|
NETGENPLUGIN_SRC/src/NETGENPlugin_icons.po<br>
|
|
</tt><br>
|
|
Note: ICON_SMESH_TREE_HYPO_MyHypType1 is ID of icon for Object Browser for
|
|
hypothesis with type="MyHypType1"; ICON_SMESH_TREE_ALGO_MyAlgType1 is ID
|
|
of icon for Object Browser for algorithm with type="MyAlgType1".<br>
|
|
See paragraph 2 for definition of MyResourceKey, MyHypType1, MyAlgType1.<tt><br>
|
|
</tt></p>
|
|
</blockquote>
|
|
|
|
<h5> <a name="2_4_2_2"></a>2.4.2.2. Define environment variable SALOME_<MyResourceKey>Resources</h5>
|
|
<blockquote>It should point to the directory where resources are situated.</blockquote>
|
|
|
|
<blockquote><tt>Example: setenv SALOME_StdMeshersResources ${SMESH_ROOT_DIR}/share/salome/resources/smesh</tt></blockquote>
|
|
|
|
<h4> <a name="2_4_3"></a>2.4.3. Implement your Hypothesis Creator and being
|
|
exported method</h4>
|
|
|
|
<blockquote><tt>SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator</tt>
|
|
<br>
|
|
<tt> (QString aHypType, QString aServerLibName, SMESHGUI* aSMESHGUI)</tt>
|
|
<p><aHypType> is to pass a value of <type> attribute in XML-description
|
|
file;<br>
|
|
<aServerLibName> is to pass a value of <server-lib> attribute
|
|
in XML-description file. </p>
|
|
<p><tt>Example: SMESH_SRC/src/StdMeshersGUI/StdMeshersGUI.cxx</tt></p>
|
|
</blockquote>
|
|
<i><a href="#cont">Back to the contents</a></i>
|
|
<h3> <a name="2_5"></a>2.5. Provide icons for object browser.</h3>
|
|
|
|
<blockquote>If your hypotheses/algorithms do not need specific GUI, but you
|
|
want to provide icons for object browser, see <a href="#2_4_2">2.4.2</a> paragrath.<br>
|
|
</blockquote>
|
|
<div align="left">
|
|
<p><i><a
|
|
href="file:///home/vsr-local/work/SALOME/SALOME2/SMESH_SRC/doc/salome/tui/SMESH/sources/static/PluginMeshers.html#cont">Back
|
|
to the contents</a></i> </p>
|
|
</div>
|
|
|
|
<h3> <a name="2_6"></a>2.6. Setup your SALOME environment.</h3>
|
|
|
|
<h4> <a name="2_6_1"></a>2.6.1. Add your plugin to the LD_LIBRARY_PATH,
|
|
PYTHONPATH (and maybe PATH) environment variables.<br>
|
|
</h4>
|
|
<blockquote><tt>setenv PATH <path-to-my-plugin>/bin/salome:${PATH}<br>
|
|
setenv LD_LIBRARY_PATH <path-to-my-plugin>/lib/salome:${LD_LIBRARY_PATH}<br>
|
|
Setenv PYTHONPATH <path-to-my-plugin>/lib/python2.2/site-packages/salome:${PYTHONPATH}<br>
|
|
</tt> <br>
|
|
</blockquote>
|
|
<h4> <a name="2_6_2"></a>2.6.2. Set mesher plugin resources environment
|
|
variable</h4>
|
|
<blockquote> This enviroment variable is used to set meshers plugins
|
|
which should be loaded by SMESH module (see <a href="#2_4_2_2">2.4.2.2</a>
|
|
paragraph). Add your plugin to this variable. All plugins are separated by
|
|
colon (":") symbol.<br>
|
|
<br>
|
|
Note: If you use runSalome.py script from KERNEL package to launch SALOME,
|
|
you may not to set environment variables, because this script sets them itself.
|
|
All what you should do is to add <plugin> section to your ${HOME}/.salome/salome.launch
|
|
file for SMESH module section:<br>
|
|
<tt><br>
|
|
...<br>
|
|
<modules-list><br>
|
|
...<br>
|
|
<module name="SMESH"><br>
|
|
<plugin name="MyMesher"/><br>
|
|
</module><br>
|
|
...<br>
|
|
</modules-list><br>
|
|
...</tt><br>
|
|
</blockquote>
|
|
<i><a href="#cont">Back to the contents</a></i> <br>
|
|
<br>
|
|
</body>
|
|
</html>
|