Salome HOME
Increment version: 7.7.0
[samples/sierpinsky.git] / README
1 ============================================================
2 README for:
3 * Randomizer module : version 0.2
4 * Sierpinsky module : version 0.2
5 ============================================================
6
7 Contents of this file:
8
9 1. Introduction.
10 2. Prerequisites.
11 3. Installation.
12 4. Launching.
13 5. Functionality.
14 6. Testing.
15
16 =======================================================
17 1. Introduction.
18 =======================================================
19
20 Randomizer and Sierpinsky SALOME-based modules implement simple interface to calculate Sierpinsky fields.
21
22 =======================================================
23 2. Prerequisites.
24 =======================================================
25
26 SALOME platform.
27 All other products are those used by SALOME.
28
29 =======================================================
30 3. Installation.
31 =======================================================
32
33 The compilation procedure is exactly the same as for other SALOME modules:
34
35 3.1. install SALOME with all prerequisite products;
36 3.2. unpack Randomizer and Sierpinsky modules sources;
37 3.3  set environment:
38
39    source <salome_install_dir>/env_products.csh
40
41    where <salome_install_dir> is a directory where SALOME is installed to.
42
43 3.4 create build directory for Randomizer module:
44
45    mkdir RANDOMIZER_BUILD
46    cd RANDOMIZER_BUILD
47
48 3.5 make and install Randomizer module:
49
50    cmake -DCMAKE_BUILD_TYPE=<Mode> -DCMAKE_INSTALL_PREFIX=${RANDOMIZER_install_dir} ${RANDOMIZER_src_dir}
51    make
52    make install
53
54    where <Mode> is build mode (Release or Debug),
55    <RANDOMIZER_src_dir> is a Randomizer module sources directory and 
56    <RANDOMIZER_install_dir> is a directory where you want to install the Randomizer module.
57
58 3.6. Repeat 3.4, 3.5 steps for Sierpinsky module.
59
60 Launch 'cmake --help' command to learn more about configuration options.
61
62 =======================================================
63 4. Launching.
64 =======================================================
65
66 To launch SALOME application the following steps should be performed:
67
68 4.1. set environment:
69
70    source <salome_install_dir>/env_products.csh
71
72    where <salome_install_dir> is a directory where SALOME is installed to.
73
74 4.3. add Randomizer and Sierpinsky modules environment:
75
76    setenv RANDOMIZER_ROOT_DIR <RANDOMIZER_install_dir>
77    setenv SIERPINSKY_ROOT_DIR <SIERPINSKY_install_dir>
78
79    where <RANDOMIZER_install_dir> and <SIERPINSKY_install_dir> are the directories where
80    you have installed Randomizer and Sierpinsky modules correspondingly (see paragraph 3 above).
81
82 4.4. launch SALOME:
83
84    ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=SMESH,VISU,RANDOMIZER,SIERPINSKY
85    
86 =======================================================
87 5. Functionality.
88 =======================================================
89
90 5.1 Randomizer module
91
92 Randomizer module is implemented as pure Python module. It does not have any GUI.
93 The IDL interface includes two methods:
94
95 - void InitPoint( out double theX, out double theY );
96
97   to generate a random 2D point; X and Y coordinates are in [0,1) range;
98
99 - long NextIteration();
100
101   to calculate next random iteration step: the integer value in range {1,3}.
102
103   The functionality of this module is used by Sierpinsky module to calculate Sierpinsky fields.
104
105 5.2. Sierpinsky module.
106
107 The engine interface includes the following methods:
108
109 - void Init( in double X1, in double Y1, in double X2, in double Y2, in double X3, in double Y3 );
110
111   to initialize the engine with three points which will be used as reference points in the calculations;
112
113 - void Reset();
114
115   to initializes the engine with three default reference points: (0.5, 1), (0, 0), (1, 0);
116
117 - void NextPoint( in double X, in double Y, in long iter, out double nextX, out double nextY );
118
119   calculates next iteration point, basing on the previous one and the iteration step given from 
120   Randomizer engine; this method is called subsequently in the loop to generate the points cloud;
121
122 - boolean ExportToJPEG( in string fileName, in long size );
123
124   exports the collected points data to the JPEG file;
125
126 - boolean ExportToMED( in string fileName, in double size );
127
128   exports the collected points data to the MED file.
129
130   The Init() and Reset() methods clear the collected points data and prepare engine to the new calculations.
131   The JPEG file can be viewed with help of any image viewer supporting JPEG format.
132   The MED files created by ExportToMED() method can be then imported in the Post-Pro (VISU) module for the
133   visualization (see below).
134
135 =======================================================
136 6. Testing.
137 =======================================================
138
139 6.1. GUI mode.
140
141 Launch SALOME (see paragraph 4) and create a new study. To activate Sierpinsky module click the corresponding
142 button on the 'Components' toolbar or select it in the components combo-box.
143
144 The only action of the Sierpinsky module's GUI is available via 'Sierpinsky' main menu - it is a 'Run' command
145 (there is also corresponding button on the toolbar).
146 This command opens 'Run Sierpinsky Algo' dialog box which allows:
147
148 - to define a start point for the calculations; if 'Random' checkbox is turned on, the start point will
149 be generated automatically via Randomizer module functionality;
150
151 - to define three reference points for the algo; if 'Random' checkbox is turned on, the reference points
152 will be generated automatically via Randomizer module functionality; if 'Default' checkbox is turned on
153 the default values will be used;
154
155 - to enter the number of the points to be calculated;
156
157 - to create JPEG image after calculcations finishing; 'Image size' parameter defines the size of the image side
158 in pixels;
159
160 - to export results to the MED file after calculcations finishing; 'Mesh size' parameter defines the mesh range.
161
162 - to import generated MED file automatically to the Post-Pro (VISU) module for the further visualisation.
163
164 After pressing the 'Start' button the calculation begins. It is possible to stop the calculation by pressing 
165 'Stop' button. The progress bar in the lower part of the dialog box displays the calculation status.
166
167 6.2. Visualization.
168
169 Activate Post-Pro (VISU) module by clicking the corresponding button on the 'Components' toolbar.
170 Select 'File - Import from file' menu command. Select the MED file, click 'Open' button. The MED file is imported
171 to the study.
172 Note: the MED file can be automatically imported to the study after finishing of the calculations
173 (see previous paragraph).
174
175 Select 'Post-Pro/<med_file>.med/Sierpinsky/Families/onNodes' object in the Object Browser, invoke context popup
176 menu by mouse right-button click and select 'Display Only' command. The cloud of points is displayed in the viewer.
177 Note: the visualizaion of mesh is only possible in the VTK viewer.
178
179 6.3. Supervision.
180
181 Activate YACS module by clicking the corresponding button on the 'Components' toolbar.
182 There are two sample YACS schemas which allow to test the Randomizer and Sierpinsky modules
183 functionality. These files can be found in the <SIERPINSKY_install_dir>/share/salome/resources directory
184 where <SIERPINSKY_install_dir> is the directory where you have installed Sierpinsky module (see paragraph 3).
185
186 Call 'YACS - Import Schema' menu command, then browse to the 'schema1.xml' or 'schema2.xml' file and click 'Open' button.
187 To prepare the schema for execution, call 'YACS - Run Current Schema' menu command or just click the corresponding toolbar button.
188 Then launch the ready schema by calling 'YACS - Start/Resume execution' menu command.
189
190 The both schemas implement simple loop to perform calculations. The first schema uses default parameters and 
191 exports the generated data to the JPEG file after calculation finishing.
192
193 The second schema is some more complicated. It uses random start and reference points. After the calculations finishing
194 it exports the data to the JPEG file and to the MED file, then automatically imports the MED file to the Post-Pro
195 module and displays it in the new 3d viewer (the 'ImportToVisu' inline node performs the importation and visualizing).
196