1 <!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
5 <meta http-equiv="Content-Type"
6 content="text/html; charset=iso-8859-1">
9 content="Mozilla/4.79 [en] (X11; U; SunOS 5.6 sun4u) [Netscape]">
10 <title>Main Page</title>
12 <link href="doxygen.css" rel="stylesheet" type="text/css">
21 <h1> <a href="http://www.opencascade.com"><img
22 src="sources/logocorp.gif" border="0" height="46" width="122"
27 <div align="right"><a href="http://www.opencascade.org/SALOME/"><img
28 src="sources/application.gif" border="0" height="46" width="108"
39 <h1> <a name="page2"></a>How to add your own mesher</h1>
43 <h1> (as a set of hypotheses and algorithms)</h1>
47 <h1> to the application.</h1>
50 <h2> <a name="cont"></a>Table of contents</h2>
53 <li> <b><i><a href="#1">1. Introduction</a></i></b></li>
54 <li> <b><i><a href="#2">2. Implementation steps</a></i></b></li>
57 <li> <b><i><a href="#2_1">2.1. Mesher plugin package</a></i></b></li>
58 <li> <b><i><a href="#2_2">2.2. List of available hypotheses and algorithms</a></i></b></li>
59 <li> <b><i><a href="#2_3">2.3. Build server plugin library</a></i></b></li>
62 <li> <b><i><a href="#2_3_1">2.3.1. Define interface to your hypotheses and
63 algorithms</a></i></b></li>
64 <li> <b><i><a href="#2_3_2">2.3.2. Implement functionality of your hypotheses
65 and algorithms</a></i></b></li>
66 <li> <b><i><a href="#2_3_3">2.3.3. Implement interface to your hypotheses
67 and algorithms</a></i></b></li>
68 <li> <b><i><a href="#2_3_4">2.3.4. Implement being exported method</a></i></b></li>
71 <li> <b><i><a href="#2_4">2.4. Build client (GUI) plugin library</a></i></b></li>
74 <li> <b><i><a href="#2_4_1">2.4.1. Implement the required GUI</a></i></b></li>
75 <li> <b><i><a href="#2_4_2">2.4.2. Provide icons and messages for your
77 <li> <b><i><a href="#2_4_3">2.4.3. Implement your hypotheses creator and
78 being exported method</a></i></b></li>
81 <li> <b><i><a href="#2_5">2.5. Provide icons for Object Browser</a></i></b></li>
82 <li> <b><i><a href="#2_6">2.6. Setup SALOME environment</a></i></b></li>
84 <li><b><i><a href="#2_6_1">2.6.1. Set LD_LIBRARY_PATH, PYTHONPATH,
85 PATH environment variables</a></i></b></li>
86 <li><b><i><a href="#2_6_2">2.6.2. Set mesher plugin resources environment
93 <h2> <a name="1"></a>1. Introduction</h2>
94 All hypotheses and algorithms are available in SMESH module via plugin mechanism.
95 Such approach allows easily to introduce new hypotheses and algorithms types
96 to the application. Also, it makes possible the customization of available
97 hypotheses and algorithms list for different users without recompilation
99 The goal of this document is to describe the process of creation external
101 <p><i><a href="#cont">Back to the contents</a></i> </p>
102 <h2> <a name="2"></a>2. Implementation steps</h2>
105 <h3> <a name="2_1"></a>2.1. <small>Mesher plugin package</small></h3>
107 Create your mesher plugin package which will contain the sources files, e.g.
108 MyMesherPlugin.<br>
111 href="file:///home/vsr-local/work/SALOME/SALOME2/SMESH_SRC/doc/salome/tui/SMESH/sources/static/PluginMeshers.html#cont">Back
112 to the contents</a></i><br>
113 <h3><a name="2_2"></a>2.2. List of available hypotheses and algorithms</h3>
114 Create XML file to describe all algorithms and hypotheses, provided by your
115 plugin package (see SMESH_SRC/resources/SMESH_Meshers.xml for example).<br>
116 <blockquote><small><tt><big><meshers-group name="MyName"<br>
117 resources="MyResourceKey"<br>
118
119 server-lib="libMyServerLib.so"<br>
120 gui-lib="libMyClientLib.so"><br>
121 <hypotheses><br>
122 <hypothesis type="MyHypType1"<br>
123
124 label-id="My beautiful hypothesis name"<br>
125
126 icon-id="my_hypo_1_icon.png"/><br>
127 </hypotheses><br>
128 <algorithms><br>
129 <algorithm type="MyAlgType1"<br>
130
131 label-id="My beautiful algorithm name"<br>
132
133 icon-id="my_algo_1_icon.png"/><br>
134 </algorithms><br>
135 </meshers-group><br>
136 </big></tt></small><br>
139 <li>Attributes of <meshers-group> tag:</li>
143 <li>value of <name> attribute is used to collect hypotheses/algoritms
144 in groups; you can also use this attribute for short description of your
146 <li>value of <resources> attribute (MyResourceKey) is used to
147 access resources (messages and icons) from GUI (see paragraphs <a
148 href="#2_4_2">2.4.2</a> and <a href="#2_5">2.5</a>); in the current implementation
149 it should coincide with the name of plugin package; this limitation will
150 be eliminated in the further development.</li>
151 <li>value of <server-lib> attribute describes the name of your
152 mesher's server plugin library (See paragraph <a href="#2_3">2.3</a>)</li>
153 <li>value of <gui-lib> attribute describes the name of your mesher's
154 client plugin library (See paragraph <a href="#2_4">2.4</a>)</li>
158 <li>Attributes of <hypothesis/algorithm> tag:</li>
162 <li>value of <type> attribute is an unique name of the hypothesis/algorithm</li>
166 <li>It is a value of _name field of your hypothesis class (see paragraph
167 <a href="#2_3">2.3</a>, implementation of constructor of StdMeshers_LocalLength
168 class: _name = "LocalLength")</li>
169 <li>It is a key to each certain hypothesis class (see paragraph <a
170 href="#2_3">2.3</a>, implementation of "GetHypothesisCreator()" method in
171 StdMeshers_i.cxx)</li>
172 <li>It is a key to each certain hypothesis GUI (see paragraph <a
173 href="#2_4">2.4</a>, implementation of "StdMeshersGUI_HypothesisCreator::CreateHypothesis()"
174 and "StdMeshersGUI_HypothesisCreator::EditHypothesis()" methods in StdMeshersGUI.cxx)</li>
175 <li>It is a key to each certain hypothesis icon in Object Browser
176 (see paragraph <a href="#2_4_2_1">2.4.2.1</a>)</li>
182 <li>value of <label-id> attribute is displayed in the GUI in
183 the list of available hypotheses/algorithms ("Create Hypothesis/Algorithm"
185 <li>value of <icon-id> attribute is a name of icon file, which
186 is displayed in GUI in the list of available hypotheses/algorithms ("Create
187 Hypothesis/Algorithm" dialog)</li>
190 Note: All attributes values are accessible in your GUI via HypothesisData
191 class (see paragraph <a href="#2_4_1">2.4.1</a>)<br>
193 Note: The environment variable SMESH_MeshersList contains the list of plugins
194 names, separated by colon (":") symbol, e.g.:<br>
196 <tt> setenv SMESH_MeshersList StdMeshers:NETGENPlugin</tt><br>
198 Please, pay attention that StdMeshers should also be included into this environment
199 variable, if you want to use standard hypotheses/algorithms, provided with
202 The SALOME automatically locates XML files, searching them in the following
205 ${<PLUGINNAME>_ROOT_DIR}/share/salome/resources<br>
206 ${SALOME_<PluginName>Resources}<br>
207 ${HOME}/.salome/resources<br>
208 ${KERNEL_ROOT_DIR}/share/salome/resources</tt><br>
210 where <PluginName> is a name of each mesher plugin package<br>
212 <i><a href="#cont">Back to the contents</a></i>
213 <h3> <a name="2_3"></a>2.3. Build server plugin library <libMyServerLib.so>.</h3>
215 <h4> <a name="2_3_1"></a>2.3.1. Define interface to your hypotheses and algorithms.</h4>
217 <blockquote><tt>Example: SMESH_SRC/idl/SMESH_BasicHypothesis.idl<br>
218 NETGENPLUGIN_SRC/src/NETGENPlugin_Algorithm.idl<br>
219 </tt><tt></tt></blockquote>
221 <h4> <a name="2_3_2"></a>2.3.2. Implement functionality of your hypotheses
224 <blockquote>Inherit corresponding classes from SMESH.
225 <p><tt>Example: SMESH_SRC/src/StdMeshers/StdMeshers_*<br>
226 NETGENPLUGIN_SRC/src/NETGENPlugin_NETGEN_3D<br>
230 <h4> <a name="2_3_3"></a>2.3.3.Implement interface to your hypotheses and
233 <blockquote><tt>Inherit corresponding classes from SMESH_I.</tt>
234 <p><tt>Example: SMESH_SRC/src/StdMeshers_I/SMESH_*_i<br>
235 NETGENPLUGIN_SRC/src/NETGENPlugin_NETGEN_3D_i<br>
239 <h4> <a name="2_3_4"></a>2.3.4. Implement being exported method.</h4>
241 <blockquote><tt>GenericHypothesisCreator_i* GetHypothesisCreator (const char*
243 <p><aHypType> is a value of <type> attribute in the XML-description
247 <blockquote><tt>Example: SMESH_SRC/src/StdMeshers_I/StdMeshers_i.cxx<br>
248 NETGENPLUGIN_SRC/src/NETGENPlugin_i.cxx<br>
249 </tt><tt></tt></blockquote>
250 <i><a href="#cont">Back to the contents</a></i>
251 <h3> <a name="2_4"></a>2.4. Build client (GUI) plugin library <libMyClientLib.so>.</h3>
253 <blockquote>This step is required only if your hypotheses/algorithms need
254 specific GUI for their construction.</blockquote>
256 <h4> <a name="2_4_1"></a>2.4.1. Implement the required GUI (e.g. construction
259 <blockquote><tt>Example: SMESH_SRC/src/StdMeshersGUI/StdMeshersGUI_*Dlg</tt>
260 <p>Note: all data from XML-description files is accessible in your GUI
261 via HypothesisData class (mySMESHGUI->GetHypothesisData (aHypType),
262 see SMESHGUI_Hypotheses.h for HypothesisData definition)</p>
265 <h4> <a name="2_4_2"></a>2.4.2. Provide icons and messages for your GUI.</h4>
267 <h5> <a name="2_4_2_1"></a>2.4.2.1. Implement resource files</h5>
269 <blockquote><tt>MyResourceKey_icons.po and MyResourceKey_msg_en.po</tt>
270 <p><tt>Example: SMESH_SRC/src/StdMeshersGUI/StdMeshers_*.po<br>
271 NETGENPLUGIN_SRC/src/NETGENPlugin_icons.po<br>
273 Note: ICON_SMESH_TREE_HYPO_MyHypType1 is ID of icon for Object Browser for
274 hypothesis with type="MyHypType1"; ICON_SMESH_TREE_ALGO_MyAlgType1 is ID
275 of icon for Object Browser for algorithm with type="MyAlgType1".<br>
276 See paragraph 2 for definition of MyResourceKey, MyHypType1, MyAlgType1.<tt><br>
280 <h5> <a name="2_4_2_2"></a>2.4.2.2. Define environment variable SALOME_<MyResourceKey>Resources</h5>
281 <blockquote>It should point to the directory where resources are situated.</blockquote>
283 <blockquote><tt>Example: setenv SALOME_StdMeshersResources ${SMESH_ROOT_DIR}/share/salome/resources</tt></blockquote>
285 <h4> <a name="2_4_3"></a>2.4.3. Implement your Hypothesis Creator and being
288 <blockquote><tt>SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator</tt>
290 <tt> (QString aHypType, QString aServerLibName, SMESHGUI* aSMESHGUI)</tt>
291 <p><aHypType> is to pass a value of <type> attribute in XML-description
293 <aServerLibName> is to pass a value of <server-lib> attribute
294 in XML-description file. </p>
295 <p><tt>Example: SMESH_SRC/src/StdMeshersGUI/StdMeshersGUI.cxx</tt></p>
297 <i><a href="#cont">Back to the contents</a></i>
298 <h3> <a name="2_5"></a>2.5. Provide icons for object browser.</h3>
300 <blockquote>If your hypotheses/algorithms do not need specific GUI, but you
301 want to provide icons for object browser, see <a href="#2_4_2">2.4.2</a> paragrath.<br>
305 href="file:///home/vsr-local/work/SALOME/SALOME2/SMESH_SRC/doc/salome/tui/SMESH/sources/static/PluginMeshers.html#cont">Back
306 to the contents</a></i> </p>
309 <h3> <a name="2_6"></a>2.6. Setup your SALOME environment.</h3>
311 <h4> <a name="2_6_1"></a>2.6.1. Add your plugin to the LD_LIBRARY_PATH,
312 PYTHONPATH (and maybe PATH) environment variables.<br>
314 <blockquote><tt>setenv PATH <path-to-my-plugin>/bin/salome:${PATH}<br>
315 setenv LD_LIBRARY_PATH <path-to-my-plugin>/lib/salome:${LD_LIBRARY_PATH}<br>
316 Setenv PYTHONPATH <path-to-my-plugin>/lib/python2.2/site-packages/salome:${PYTHONPATH}<br>
317 </tt> <br>
319 <h4> <a name="2_6_2"></a>2.6.2. Set mesher plugin resources environment
321 <blockquote> This enviroment variable is used to set meshers plugins
322 which should be loaded by SMESH module (see <a href="#2_4_2_2">2.4.2.2</a>
323 paragraph). Add your plugin to this variable. All plugins are separated by
324 colon (":") symbol.<br>
326 Note: If you use runSalome.py script from KERNEL package to launch SALOME,
327 you may not to set environment variables, because this script sets them itself.
328 All what you should do is to add <plugin> section to your ${HOME}/.salome/salome.launch
329 file for SMESH module section:<br>
332 <modules-list><br>
333 ...<br>
334 <module name="SMESH"><br>
335 <plugin name="MyMesher"/><br>
336 </module><br>
337 ...<br>
338 </modules-list><br>
341 <i><a href="#cont">Back to the contents</a></i> <br>