]> SALOME platform Git repositories - modules/med.git/blob - doc/doxygen/medcouplingexamples.doxy
Salome HOME
Correction #2
[modules/med.git] / doc / doxygen / medcouplingexamples.doxy
1 /*!
2 \page medcouplingcppexamples MEDCoupling C++ examples
3
4
5
6 \anchor cpp_mcmesh_
7 <br><h2>  </h2>
8
9 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells.
10 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_
11 \snippet MEDCouplingExamplesTest.py PySnippet_MEDCouplingUMesh_
12 \snippet MEDCouplingExamplesTest.py Snippet_MEDCouplingUMesh_
13
14
15 \anchor cpp_mcmesh_fillFromAnalytic3
16 <br><h2> Creating a field using a formular </h2>
17
18 First, we create a 2D Cartesian mesh constituted by 2 cells.
19 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingMesh_fillFromAnalytic3_1
20 Now we use
21 \ref ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic3 "fillFromAnalytic3()"
22 to get a \ref ParaMEDMEM::MEDCouplingFieldDouble "MEDCouplingFieldDouble" on cells filled
23 with values computed using a formular \b func. This formular is applied to coordinates of
24 each point (barycenter) for which the field value is computed. We want to get the
25 field on cells, with 3 components computed as follows. (In \b func, we refer to the
26 first component of a point using the variable "a", and to the second component, using
27 the variable "b").
28 - Component #0 = the second coordinate of the point; hence "IVec * b" in \b func.
29 - Component #1 = the first coordinate of the point; hence "JVec * a".
30 - Component #2 = distance between the point and SC origin (0.,0.); hence 
31 "KVec * sqrt( a*a + b*b )".
32
33 In addition we want to add 10.0 to each component computed as described above, hence
34 "10" in \b func.
35 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingMesh_fillFromAnalytic3_2
36 Now we ascertain that the result field is as we expect. We check the second tuple of
37 the \b field. We get barycenter of the cell #1 and checks that values of the second
38 tuple are computed as we want.
39 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingMesh_fillFromAnalytic3_3
40
41
42
43 \anchor cpp_mcmesh_fillFromAnalytic2
44 <br><h2> Creating a field using a formular </h2>
45
46 First, we create a 2D Cartesian mesh constituted by 2 cells.
47 Note that we set names to coordinates arrays ("a" and "b" ) which will be used to refer to
48 corresponding coordinates within a function.
49 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingMesh_fillFromAnalytic2_1
50 Now we use
51 \ref ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic2 "fillFromAnalytic2()"
52 to get a \ref ParaMEDMEM::MEDCouplingFieldDouble "MEDCouplingFieldDouble" on cells filled
53 with values computed using a formular \b func. This formular is applied to coordinates of
54 each point (barycenter) for which the field value is computed. We want to get the
55 field on cells, with 3 components computed as follows. (In \b func, we refer to the
56 first component of a point using the variable "a", and to the second component, using
57 the variable "b").
58 - Component #0 = the second coordinate of the point; hence "IVec * b" in \b func.
59 - Component #1 = the first coordinate of the point; hence "JVec * a".
60 - Component #2 = distance between the point and SC origin (0.,0.); hence 
61 "KVec * sqrt( a*a + b*b )".
62
63 In addition we want to add 10.0 to each component computed as described above, hence
64 "10" in \b func.
65 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingMesh_fillFromAnalytic2_2
66 Now we ascertain that the result field is as we expect. We check the second tuple of
67 the \b field. We get barycenter of the cell #1 and checks that values of the second
68 tuple are computed as we want.
69 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingMesh_fillFromAnalytic2_3
70
71
72 \anchor cpp_mcmesh_fillFromAnalytic
73 <br><h2> Creating a field using a formular </h2>
74
75 First, we create a 2D Cartesian mesh constituted by 2 cells.
76 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingMesh_fillFromAnalytic_1
77 Now we use
78 \ref ParaMEDMEM::MEDCouplingMesh::fillFromAnalytic "fillFromAnalytic()"
79 to get a \ref ParaMEDMEM::MEDCouplingFieldDouble "MEDCouplingFieldDouble" on cells filled 
80 with values computed using a formular \b func. This formular is applied to coordinates of
81 each point (barycenter) for which the field value is computed. We want to get the
82 field on cells, with 3 components computed as follows. (In \b func, we refer to the
83 first component of a point using the variable "a", and to the second component, using
84 the variable "b").
85 - Component #0 = the second coordinate of the point; hence "IVec * b" in \b func.
86 - Component #1 = the first coordinate of the point; hence "JVec * a".
87 - Component #2 = distance between the point and SC origin (0.,0.); hence 
88 "KVec * sqrt( a*a + b*b )".
89
90 In addition we want to add 10.0 to each component computed as described above, hence
91 "10" in \b func.
92 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingMesh_fillFromAnalytic_2
93 Now we ascertain that the result field is as we expect. We check the second tuple of
94 the \b field. We get barycenter of the cell #1 and checks that values of the second
95 tuple are computed as we want.
96 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingMesh_fillFromAnalytic_3
97
98
99 \anchor cpp_mccmesh_getCoordsAt
100 <br><h2> Getting node coordinates </h2>
101
102 We create an 1D Cartesian mesh and retrieves node coordinates using
103 \ref ParaMEDMEM::MEDCouplingCMesh::getCoordsAt "getCoordsAt()".
104 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingCMesh_getCoordsAt_1
105
106
107
108 \anchor cpp_mcumesh_areCellsIncludedIn
109 <br><h2> Cells correspondence in two meshes </h2>
110
111 First, we create a 2D \b mesh1 with 3 QUAD4 and 2 TRI3 cells.
112 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_1
113 Then we create a \b mesh2 which includes cells #4, #2 and #0 of \b mesh1. The two meshes
114 share the same node coordinates array.
115 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_2
116 Now we ascertain that
117 - \ref ParaMEDMEM::MEDCouplingUMesh::areCellsIncludedIn "areCellsIncludedIn()"
118 detects that all cells of \b mesh2 are present in \b mesh1,
119 -  the correspondence array \b corr2to1, which gives cell ids of \b mesh2 within
120 \b mesh1, is equal to the array \b cells2 which selected cells from \b mesh1 for creation
121 of \b mesh2.
122
123 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_3
124 Now we apply
125 \ref ParaMEDMEM::MEDCouplingUMesh::areCellsIncludedIn "areCellsIncludedIn()"
126 in a reverse direction and ascertain that it returns \c false. 
127 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_4
128 The contents of the correspondence
129 array \b corr1to2 [2, 3, 1, 4, 0] means the following.
130 - The cell #0 of \b mesh1 is equal to the cell #2 (== \b corr1to2[ 0 ]) of \b mesh2.
131 - The cell #1 of \b mesh1 is missing from \b mesh2 (as \b corr1to2[ 1 ] >= \b mesh2->getNumberOfCells()).
132 - The cell #2 of \b mesh1 is equal to the cell #1 (== \b corr1to2[ 2 ]) of \b mesh2.
133 - The cell #3 of \b mesh1 is missing from \b mesh2 (as \b corr1to2[ 3 ] >= \b mesh2->getNumberOfCells()).
134 - The cell #4 of \b mesh1 is equal to the cell #0 (== \b corr1to2[ 4 ]) of \b mesh2.
135
136
137 \anchor cpp_mcumesh_checkDeepEquivalWith
138 <br><h2> Deep comparison of meshes </h2>
139
140 First, we create two 2D meshes with two triangles, so that 
141 - their nodes are almost same but permuted,
142 - the first triangle is based exactly on the same nodes (taking the permutation into account),
143 - an order of nodes in the second triangle is changed.
144
145 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_checkDeepEquivalWith_1
146 Then we check that 
147 - \ref ParaMEDMEM::MEDCouplingUMesh::checkDeepEquivalWith "checkDeepEquivalWith()"
148 considers the meshes equal (i.e. it does not throw any exception) if it is called with a cell
149 comparison policy \b cellCompPol == 1
150 -  mapping from \b mesh1 to \b mesh2 for both nodes and cells is as expected.
151
152 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_checkDeepEquivalWith_2
153 Next we ascertain that 
154 \ref ParaMEDMEM::MEDCouplingUMesh::checkDeepEquivalOnSameNodesWith "checkDeepEquivalOnSameNodesWith()"
155 consider \b mesh1 and \b mesh2 different as they do not share the same nodal connectivity
156 array. <br>
157 After that we make the meshes share the node coordinates array and insert new
158 triangles based on the same nodes but in different order. This is to ascertain that
159 \ref ParaMEDMEM::MEDCouplingUMesh::checkDeepEquivalOnSameNodesWith "checkDeepEquivalOnSameNodesWith()"
160 called with the weakest cell comparison policy considers the meshes equal.
161 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_checkDeepEquivalWith_3
162
163
164
165 \anchor cpp_mcumesh_getPartBarycenterAndOwner
166 <br><h2> Getting barycenters of cells </h2>
167
168 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells.
169 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getPartMeasureField_1
170 Now we use
171 \ref ParaMEDMEM::MEDCouplingUMesh::getPartBarycenterAndOwner "getPartBarycenterAndOwner()" to get
172 barycenters of all but the first cell.
173 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getPartMeasureField_3
174 The returned array contains 4 tuples per 2 components.
175
176
177 \anchor cpp_mcumesh_findAndCorrectBadOriented3DExtrudedCells
178 <br><h2> Fixing orientation of "extruded" volumes </h2>
179
180 First, we create a mesh with 2 incorrectly oriented "extruded" volumes.
181 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_findAndCorrectBadOriented3DExtrudedCells_1
182 Now we check that
183 \ref ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells "findAndCorrectBadOriented3DExtrudedCells()"
184 finds and fixes the reversed cells.
185 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_findAndCorrectBadOriented3DExtrudedCells_2
186
187
188 \anchor cpp_mcumesh_arePolyhedronsNotCorrectlyOriented
189 <br><h2> Fixing orientation of polyhedra </h2>
190
191 First, we create a mesh with 2 polyhedra, one of which is incorrectly oriented. We create
192 two "extruded" polyhedra and then convert them to correctly defined polyhedra.
193 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_arePolyhedronsNotCorrectlyOriented_1
194 Now we check that
195 \ref ParaMEDMEM::MEDCouplingUMesh::arePolyhedronsNotCorrectlyOriented "arePolyhedronsNotCorrectlyOriented()"
196 finds one reversed cell. After that we fix it using
197 \ref ParaMEDMEM::MEDCouplingUMesh::orientCorrectlyPolyhedrons "orientCorrectlyPolyhedrons()" and
198 re-check the orientation of polyhedra.
199 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_arePolyhedronsNotCorrectlyOriented_2
200
201
202 \anchor cpp_mcumesh_are2DCellsNotCorrectlyOriented
203 <br><h2> Fixing orientation of faces </h2>
204
205 First, we create a 2D mesh in 3D space with 3 QUAD4 and 2 TRI3 cells. Orientation of the cell #1 is
206 reversed comparing with others.
207 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_are2DCellsNotCorrectlyOriented_1
208 Now we check that
209 \ref ParaMEDMEM::MEDCouplingUMesh::are2DCellsNotCorrectlyOriented "are2DCellsNotCorrectlyOriented()"
210 finds one reversed face. After that we fix the incorrectly oriented cell using
211 \ref ParaMEDMEM::MEDCouplingUMesh::orientCorrectly2DCells "orientCorrectly2DCells()" and
212 re-check the orientation of cells.
213 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_are2DCellsNotCorrectlyOriented_2
214
215
216 \anchor cpp_mcumesh_getCellsContainingPoints
217 <br><h2> Finding cells containing a point (multi-point case) </h2>
218
219 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells.
220 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getCellsContainingPoints_1
221 Then we use 
222 \ref ParaMEDMEM::MEDCouplingUMesh::getCellsContainingPoints "getCellsContainingPoints()" to
223 get cells in contact with tree points. Two of them are in contact with some cells and one is not.
224 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getCellsContainingPoints_2
225 The contents of the result arrays \b cells ([4, 0, 1]) and \b cellsIndex ([0, 0, 1, 3])
226 mean the following.
227 - Point #0 is in contact with none (== \b cellsIndx[1] - \b cellsIndx[0]) cell.
228 - Point #1 is in contact with 1 (== \b cellsIndx[2] - \b cellsIndx[1]) cell whose id is #4
229   (== \b cells[ \b cellsIndx[ 1 ]]).
230 - Point #2 is in contact with 2 (== \b cellsIndx[3] - \b cellsIndx[2]) cells whose ids are #0 
231   (== \b cells[ \b cellsIndx[ 2 ]]) and #1 (== \b cells[ \b cellsIndx[ 2 ] + 1 ]).
232
233
234 \anchor cpp_mcumesh_getCellsContainingPoint
235 <br><h2> Finding cells containing a point </h2>
236
237 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells.
238 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getCellsContainingPoint_1
239 Then we use 
240 \ref ParaMEDMEM::MEDCouplingUMesh::getCellsContainingPoint "getCellsContainingPoint()" to
241 get cells in contact with a small ball (point with precision) located near the node #4 and
242 shifted from this node by its radius \b eps.
243 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getCellsContainingPoint_2
244 Since the node #4 is shared by all cells, size of the vector \b cellIds must be equal to
245 the number of cells in \b mesh.
246
247 \anchor cpp_mcumesh_buildPartOrthogonalField
248 <br><h2> Getting normals of cells </h2>
249
250 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells. Orientation of the cell #1 is
251 reversed.
252 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_buildPartOrthogonalField_1
253 Now we use
254 \ref ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField "buildPartOrthogonalField()" to get
255 normal vectors to the cells.
256 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_buildPartOrthogonalField_2
257
258
259
260 \anchor cpp_mcumesh_getPartMeasureField
261 <br><h2> Getting volumes of cells </h2>
262
263 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells. Orientation of the cell #1 is
264 reversed.
265 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getPartMeasureField_1
266 Now we use
267 \ref ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField "getPartMeasureField()" to get
268 volumes of all but the first cell. If we call
269 \ref ParaMEDMEM::MEDCouplingUMesh::getPartMeasureField "getPartMeasureField()" with \b
270 isAbs == \c true, the area of the cell #1 is returned positive, else, negative that
271 reflects its inverse orientation.
272 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getPartMeasureField_2
273
274
275
276 \anchor cpp_mcumesh_getCellsInBoundingBox
277 <br><h2> Getting cells using the bounding box </h2>
278
279 First, we create a 2D mesh with 1 TRI3 cell. Bounding box of this cell is [0.,0., 1.,1].
280 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getCellsInBoundingBox_1
281 Now we check how 
282 \ref ParaMEDMEM::MEDCouplingUMesh::getCellsInBoundingBox "getCellsInBoundingBox()"
283 searches for cells using the bounding box. We use a bounding box touching the bounding box
284 of the sole cell at one point (1.,1.).
285 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getCellsInBoundingBox_2
286 If \ref ParaMEDMEM::MEDCouplingUMesh::getCellsInBoundingBox "getCellsInBoundingBox()" is
287 called with parameter \b eps == 0.0, the cell is not found because the two bounding boxes
288 (one of the cell and the one passed as parameter) do not overlap. <br>
289 If \ref ParaMEDMEM::MEDCouplingUMesh::getCellsInBoundingBox "getCellsInBoundingBox()" is
290 called with parameter \b eps == 0.1, the cell is found because \b eps is used to increase
291 the bounding box of the cell and thus the two bounding boxes intersect each other. <br>
292
293 \anchor cpp_mcumesh_renumberNodesInConn
294 <br><h2> Renumbering nodes in the connectivity array </h2>
295
296 First, we create a 2D mesh with 1 QUAD4 cell and with undefined coordinates of nodes.
297 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_renumberNodesInConn_1
298 Now we use
299 \ref ParaMEDMEM::MEDCouplingUMesh::renumberNodesInConn "renumberNodesInConn()"
300 to get the following nodal connectivity of a sole cell: 0,1,2,3.
301 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_renumberNodesInConn_2
302 \b old2newIds array defines how node ids are changed:
303 - new id of node #0 is -1,
304 - new id of node #1 is 3,
305 - new id of node #2 is 4,
306 - new id of node #3 is 1,
307 - new id of node #4 is 0.
308
309 \anchor cpp_mcumesh_renumberNodes
310 <br><h2> Renumbering nodes </h2>
311
312 First, we create a 2D mesh with 4 nodes and no cells.
313 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_renumberNodes_1
314 Next, we use 
315 \ref ParaMEDMEM::MEDCouplingUMesh::renumberNodes "renumberNodes()"
316 to permute nodes so that
317 - old node #0 becomes #2,
318 - old node #1 remains #1,
319 - old node #2 becomes #0,
320 - old node #3 is removed.
321
322 Number of nodes becomes 3.
323 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_renumberNodes_2
324
325 Next we compare behavior of 
326 \ref ParaMEDMEM::MEDCouplingUMesh::renumberNodes "renumberNodes()" and that of
327 \ref ParaMEDMEM::MEDCouplingUMesh::renumberNodes2 "renumberNodes2()" which, in contrast to
328 \ref ParaMEDMEM::MEDCouplingUMesh::renumberNodes "renumberNodes()",
329 moves merged nodes to their barycenter.<br> 
330 We set #2 as new id of old node #3 and expect that 
331 \ref ParaMEDMEM::MEDCouplingUMesh::renumberNodes2 "renumberNodes2()" moves old nodes #0
332 and #3 to their barycenter (-0.3,0.0) which becomes position of node #2.<br>
333 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_renumberNodes_3
334
335
336 \anchor cpp_mcumesh_findBoundaryNodes
337 <br><h2> Getting boundary nodes </h2>
338
339 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells.
340 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_findBoundaryNodes_1
341 Now we use 
342 \ref ParaMEDMEM::MEDCouplingUMesh::findBoundaryNodes "findBoundaryNodes()" to get ids
343 of boundary nodes.
344 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_findBoundaryNodes_2
345 \ref ParaMEDMEM::MEDCouplingUMesh::findBoundaryNodes "findBoundaryNodes()" returns all
346 node ids except the node #4 which is in the middle of \b mesh.
347
348
349 \anchor cpp_mcumesh_buildBoundaryMesh
350 <br><h2> Getting a bounding mesh </h2>
351
352 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells.
353 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_buildBoundaryMesh_1
354 Now we use 
355 \ref ParaMEDMEM::MEDCouplingUMesh::buildBoundaryMesh "buildBoundaryMesh()" to get a mesh
356 of lower dimension bounding \b mesh.
357 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_buildBoundaryMesh_2
358 Depending on the value of a parameter,
359 \ref ParaMEDMEM::MEDCouplingUMesh::buildBoundaryMesh "buildBoundaryMesh()"
360 creates the mesh sharing the node coordinates array with \b mesh or not.
361
362
363 \anchor cpp_mcumesh_buildFacePartOfMySelfNode
364 <br><h2> Retrieving a lower dimension mesh based on given nodes </h2>
365
366 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells.
367 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_buildFacePartOfMySelfNode_1
368 In the following code we retrieve nodes of the cell #0 an then we call
369 \ref ParaMEDMEM::MEDCouplingUMesh::buildFacePartOfMySelfNode "buildFacePartOfMySelfNode()" 
370 twice with these nodes and with varying last parameter \b allNodes as input.
371 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_buildFacePartOfMySelfNode_2
372 <br>If the last parameter is \c true 
373 \ref ParaMEDMEM::MEDCouplingUMesh::buildFacePartOfMySelfNode "buildFacePartOfMySelfNode()" looks
374 for segements whose all nodes are given to it, hence it finds segments bounding the cell #0 only.
375 <br>If the last parameter is \c false
376 \ref ParaMEDMEM::MEDCouplingUMesh::buildFacePartOfMySelfNode "buildFacePartOfMySelfNode()" looks
377 for any segment whose nodes are given to it, hence it adds more segments to \b mesh2.
378
379
380 \anchor cpp_mcumesh_buildPartOfMySelfNode
381 <br><h2> Copying cells selected by nodes </h2>
382
383 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells.
384 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_buildPartOfMySelfNode_1
385 In the following code we retrieve nodes of the cell #0 an then we call
386 \ref ParaMEDMEM::MEDCouplingUMesh::buildPartOfMySelfNode "buildPartOfMySelfNode()" 
387 twice with these nodes and with varying last parameter \b allNodes as input.
388 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_buildPartOfMySelfNode_2
389 <br>If the last parameter is \c true 
390 \ref ParaMEDMEM::MEDCouplingUMesh::buildPartOfMySelfNode "buildPartOfMySelfNode()" looks
391 for cells whose all nodes are given to it, hence it finds the cell #0 only.
392 <br>If the last parameter is \c false
393 \ref ParaMEDMEM::MEDCouplingUMesh::buildPartOfMySelfNode "buildPartOfMySelfNode()" looks
394 for any cell whose nodes are given to it, hence it finds all cells of \b mesh because all
395 cells share the node #4.
396
397
398 \anchor cpp_mcumesh_getCellIdsLyingOnNodes
399 <br><h2> Getting cells by nodes </h2>
400
401 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells.
402 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getCellIdsLyingOnNodes_1
403 In the following code we retrieve nodes of the cell #0 an then we call
404 \ref ParaMEDMEM::MEDCouplingUMesh::getCellIdsLyingOnNodes "getCellIdsLyingOnNodes()" 
405 twice with these nodes and with varying last parameter \b allNodes as input.
406 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getCellIdsLyingOnNodes_2
407 <br>If the last parameter is \c true 
408 \ref ParaMEDMEM::MEDCouplingUMesh::getCellIdsLyingOnNodes "getCellIdsLyingOnNodes()" looks
409 for cells whose all nodes are given to it, hence it finds the cell #0 only.
410 <br>If the last parameter is \c false
411 \ref ParaMEDMEM::MEDCouplingUMesh::getCellIdsLyingOnNodes "getCellIdsLyingOnNodes()" looks
412 for any cell whose nodes are given to it, hence it finds all cells of \b mesh because all
413 cells share the node #4.
414
415
416
417 \anchor cpp_mcumesh_getCellIdsFullyIncludedInNodeIds
418 <br><h2> Getting cells by nodes </h2>
419
420 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells.
421 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getCellIdsFullyIncludedInNodeIds_1
422 In the following code we retrieve nodes of two cells an then we use 
423 \ref ParaMEDMEM::MEDCouplingUMesh::getCellIdsFullyIncludedInNodeIds
424 "getCellIdsFullyIncludedInNodeIds()" to find these cells by their nodes.
425 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getCellIdsFullyIncludedInNodeIds_2
426
427
428 \anchor cpp_mcumesh_buildPartOfMySelf
429 <br><h2> Getting a part of mesh </h2>
430
431 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells.
432 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_buildPartOfMySelf_1
433 Now we use 
434 \ref ParaMEDMEM::MEDCouplingUMesh::buildPartOfMySelf "buildPartOfMySelf()" to get a mesh
435 containing only two cells of \b mesh. 
436 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_buildPartOfMySelf_2
437
438
439 \anchor cpp_mcumesh_mergeNodes
440 <br><h2> Merging equal nodes </h2>
441
442 First, we create a 2D mesh with 1 QUAD4 and 2 TRI3 cells. The cells are based on 6 nodes
443 of which 2 nodes fully coincide (#3 and #4) and 3 nodes are equal with precision 0.003.
444 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_mergeNodes_1
445 Now we merge node duplicates using
446 \ref ParaMEDMEM::MEDCouplingUMesh::mergeNodes "mergeNodes()" and check values it returns.
447 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_mergeNodes_2
448 Contents of \b arr shows ids of old nodes after the merging. The nodes considered equal
449 one to the other have the same id in \b arr.
450
451 Next we compare behavior of 
452 \ref ParaMEDMEM::MEDCouplingUMesh::mergeNodes "mergeNodes()" and that of
453 \ref ParaMEDMEM::MEDCouplingUMesh::mergeNodes2 "mergeNodes2()" which, in contrast to
454 \ref ParaMEDMEM::MEDCouplingUMesh::mergeNodes "mergeNodes()",
455 moves merged nodes to their barycenter.<br> We expect that 
456 \ref ParaMEDMEM::MEDCouplingUMesh::mergeNodes2 "mergeNodes2()" moves old nodes #0, #2 
457 and #5 to their barycenter equal to position of node #2.<br>
458 First we check that 
459 \ref ParaMEDMEM::MEDCouplingUMesh::mergeNodes "mergeNodes()" does not move nodes
460 coincident with the node #2 to the position of node #2, and then we check that 
461 \ref ParaMEDMEM::MEDCouplingUMesh::mergeNodes "mergeNodes2()" does move.
462 (We check only the second (Y) component of node coordinates since the first component of
463 these nodes is exactly same.)
464 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_mergeNodes_3
465
466
467
468 \anchor cpp_mcumesh_zipConnectivityTraducer
469 <br><h2> Removing cell duplicates </h2>
470
471 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells, so that
472 - the cell #2 has the same nodal connectivity as the cell #1 does,
473 - the cell #3 has the same nodal connectivity as the cell #0 does,
474 - the cell #4 is based on the same nodes as the cell #0 but nodes order is different.
475
476 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_zipConnectivityTraducer_1
477 Now we use 
478 \ref ParaMEDMEM::MEDCouplingUMesh::zipConnectivityTraducer "zipConnectivityTraducer()" 
479 to remove duplicate cells. Then we check that two cells, having exactly same nodal
480 connectivity with other cells, have been removed.
481 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_zipConnectivityTraducer_2
482 Contents of \b arr shows ids of cells after duplicates removal. If a value (cell id)
483 equals to its index in \b arr, this means that the cell is not a duplicate of any cell
484 with lower id. Else, the value gives a cell id to which this cell is equal. <br>
485 Thus, the cells #0 and #1 have no preceding equal cell since \b arr[i] == i.<br>
486 The cell #2 equals to the cell #1 (== \b arr[2] ).<br>
487 The cell #3 equals to the cell #0 (== \b arr[3] ).<br>
488 The cell #4 has no equal cell. This is because the cell comparison technique specified
489 when we called 
490 \ref ParaMEDMEM::MEDCouplingUMesh::zipConnectivityTraducer "zipConnectivityTraducer()" 
491 was 0 ("exact"), if we had used the technique 2 ("nodal"), \b arr[4] would be 0.
492
493
494
495 \anchor cpp_mcumesh_zipCoordsTraducer
496 <br><h2> Removing unused nodes </h2>
497
498 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells.
499 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_zipCoordsTraducer_1
500 Now we create \b mesh2 including all nodes but only two cells of \b mesh, and we use \ref
501 ParaMEDMEM::MEDCouplingUMesh::zipCoordsTraducer "zipCoordsTraducer()" to remove unused
502 nodes from \b mesh2. 
503 \ref ParaMEDMEM::MEDCouplingUMesh::zipCoordsTraducer "zipCoordsTraducer()" returns an array
504 with -1 for unused nodes and new ids for used ones.
505 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_zipCoordsTraducer_2
506
507
508
509 \anchor cpp_mcumesh_getNodeIdsInUse
510 <br><h2> Retrieving unused nodes </h2>
511
512 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells.
513 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_1
514 Now we create \b mesh2 including all nodes but only two cells of \b mesh, and we use \ref
515 ParaMEDMEM::MEDCouplingUMesh::getNodeIdsInUse "getNodeIdsInUse()" to get nodes of \b mesh2
516 used in its two cells. 
517 \ref ParaMEDMEM::MEDCouplingUMesh::getNodeIdsInUse "getNodeIdsInUse()" returns an array
518 with -1 for unused nodes and new ids for used ones.
519 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_2
520 Now we use \b newNbOfNodes returned by 
521 \ref ParaMEDMEM::MEDCouplingUMesh::getNodeIdsInUse "getNodeIdsInUse()" to convert \b arr
522 to "New to Old" mode.
523 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_3
524
525
526 \anchor cpp_mcumesh_convertToPolyTypes
527 <br><h2> Conversion of cells to "poly" types </h2>
528
529 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells.
530 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_convertToPolyTypes_1
531 Now we convert cells #1 and #3 to type POLYGON and check the result
532 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_convertToPolyTypes_2
533
534
535 \anchor cpp_mcumesh_buildDescendingConnectivity2
536 <br><h2> Retrieving the descending connectivity with orientation </h2>
537
538 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells.
539 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity2_1
540 Now we get and check the descending connectivity.
541 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity2_2
542 Here we get connectivity of the cell #2 (#3 in FORTRAN mode) of \b mesh2 to see how
543 mutual orientation of cells in \b mesh and \b mesh2 is defined.
544 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity2_3
545 The contents of the result arrays \b desc and \b descIndx mean the following.
546 - The cell #0 of \b mesh (QUAD4) is bound by 4 (== \b descIndx[1] - \b descIndx[0])
547   segments (SEG2) of \b mesh2 whose ids in FORTRAN mode are
548   - #1 (== \b desc[ \b descIndx[ 0 ]]),
549   - #2 (== \b desc[ \b descIndx[ 0 ] + 1 ]), 
550   - #3 (== \b desc[ \b descIndx[ 0 ] + 2 ]) and 
551   - #4 (== \b desc[ \b descIndx[ 0 ] + 3 ]).
552   <br>Ids are positive since order of nodes in the corresponding cells of \b mesh and \b mesh2
553   are same. For example nodes of SEG2 #3 are [4,1] and nodes of QUAD4 #0 are [0,3,\b 4,\b 1].
554 - The cell #1 of \b mesh (TRI3) is bound by 3 (== \b descIndx[2] - \b descIndx[1]) segements of
555   \b mesh2 whose ids in FORTRAN mode are: 
556   - #-3 (== \b desc[ \b descIndx[ 1 ]]),
557   - #5 (== \b desc[ \b descIndx[ 1 ] + 1 ]) and 
558   - #6 (== \b desc[ \b descIndx[ 1 ] + 2 ]).
559   <br>The id -3 means that order of nodes in SEG2 #3 ([4,1]) is different from the order of
560   these nodes in TRI3 #1: [\b 1,\b 4,2].
561 - etc.
562
563 The contents of the result arrays \b revDesc and \b revDescIndx mean the following.
564 - The cell #0 of \b mesh2 (SEG2) bounds 1 (== \b revDescIndx[1] - \b revDescIndx[0]) cell of \b
565   mesh whose id is:
566   - # 0 (== \b revDesc[ \b revDescIndx[ 0 ]]).
567 - The cell #1 of \b mesh2 bounds 2 (== \b revDescIndx[2] - \b revDescIndx[1]) cells of \b
568   mesh whose ids are:
569   - # 0 (== \b revDesc[ \b revDescIndx[ 1 ]]) and
570   - # 1 (== \b revDesc[ \b revDescIndx[ 1 ] + 1 ]).
571 - etc.
572
573
574
575 \anchor cpp_mcumesh_buildDescendingConnectivity
576 <br><h2> Retrieving the descending connectivity </h2>
577
578 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells.
579 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity_1
580 Now we get and check the descending connectivity.
581 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity_2
582 The contents of the result arrays \b desc and \b descIndx mean the following.
583 - The cell #0 of \b mesh (QUAD4) is bound by 4 (== \b descIndx[1] - \b descIndx[0])
584   segments (SEG2) of \b mesh2 whose ids are 
585   - #0 (== \b desc[ \b descIndx[ 0 ]]), 
586   - #1 (== \b desc[ \b descIndx[ 0 ] + 1 ]), 
587   - #2 (== \b desc[ \b descIndx[ 0 ] + 2 ]) and 
588   - #3 (== \b desc[ \b descIndx[ 0 ] + 3 ]).
589 - The cell #1 of \b mesh (TRI3) is bound by 3 (== \b descIndx[2] - \b descIndx[1]) segements of
590   \b mesh2 whose ids are: 
591   - #2 (== \b desc[ \b descIndx[ 1 ]]), 
592   - #4 (== \b desc[ \b descIndx[ 1 ] + 1 ]) and 
593   - #5 (== \b desc[ \b descIndx[ 1 ] + 2 ]).
594 - etc.
595
596 The contents of the result arrays \b revDesc and \b revDescIndx mean the following.
597 - The cell #0 of \b mesh2 (SEG2) bounds 1 (== \b revDescIndx[1] - \b revDescIndx[0]) cell of \b
598   mesh whose id is:
599   - # 0 (== \b revDesc[ \b revDescIndx[ 0 ]]).
600 - The cell #1 of \b mesh2 bounds 2 (== \b revDescIndx[2] - \b revDescIndx[1]) cells of \b
601   mesh whose ids are:
602   - # 0 (== \b revDesc[ \b revDescIndx[ 1 ]]) and
603   - # 1 (== \b revDesc[ \b revDescIndx[ 1 ] + 1 ]).
604 - etc.
605
606
607 \anchor cpp_mcumesh_getReverseNodalConnectivity
608 <br><h2> Getting the reverse nodal connectivity </h2>
609
610 First, we create a 2D mesh with 3 QUAD4 and 2 TRI3 cells.
611 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getReverseNodalConnectivity_1
612 Now we get and check its reverse nodal connectivity.
613 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingUMesh_getReverseNodalConnectivity_2
614 The contents of the result arrays mean the following.
615 - Node #0 is shared by 1 (== \b revNodalIndx[1] - \b revNodalIndx[0]) cell whose id is #0 
616   (== \b revNodal[ \b revNodalIndx[ 0 ]]).
617 - Node #1 is shared by 2 (== \b revNodalIndx[2] - \b revNodalIndx[1]) cells whose ids are #0 
618   (== \b revNodal[ \b revNodalIndx[ 1 ]]) and #1 (== \b revNodal[ \b revNodalIndx[ 1 ] + 1 ]).
619 - etc.
620
621 \anchor cpp_mcpointset_scale
622 <br><h2> Scaling the mesh </h2>
623
624 First, we create a 2D mesh with 4 nodes and no cells.
625 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_scale_1
626 Then we scale it by a factor of 2 with a center (0.,0.).
627 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_scale_2
628 Finally we check that all node coordinates have changed by more than 0.9.
629 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_scale_3
630
631
632
633
634 \anchor cpp_mcpointset_translate
635 <br><h2> Translating the mesh </h2>
636
637 First, we create a 2D mesh with 4 nodes and no cells.
638 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_translate_1
639 Then we translate it by a vector (1.,1.).
640 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_translate_2
641 Finally we check that all node coordinates have changed by more than 0.9.
642 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_translate_3
643
644
645
646 \anchor cpp_mcpointset_rotate
647 <br><h2> Rotating the mesh </h2>
648
649 First, we create a 2D mesh with 4 nodes and no cells.
650 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_rotate_1
651 Then we rotate it around a point (0.,0.) by 90 degrees clockwise.
652 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_rotate_2
653 Next, we make a 3D mesh from the 2D one and rotate it around the Z axis by 90 degrees
654 counter-clockwise. 
655 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_rotate_3
656 Finally we transform the mesh back to 2D space and check that all nodes get back to the
657 initial location.
658 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_rotate_4
659
660 \anchor cpp_mcpointset_getBoundingBox
661 <br><h2> Getting a minimum box bounding nodes </h2>
662
663 First, we create a 3D mesh with 2 nodes, so that the first one has minimal coordinates and
664 the second one has maximal coordinates.
665 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_getBoundingBox_1
666 Now we get a bounding box enclosing these nodes. This bounding box should contain
667 coordinates of our two nodes (but in "no interlace" mode), as the nodes coincide with
668 points returned by the bounding box.
669 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_getBoundingBox_2
670
671
672 \anchor cpp_mcpointset_getnodeidsnearpoint
673 <br><h2> Getting nodes close to a point </h2>
674
675 The following code creates a 2D \ref ParaMEDMEM::MEDCouplingUMesh
676 "MEDCouplingUMesh" with 5 nodes and no cells.
677 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoint_1
678 Now we define an array of coordinates of a point close to nodes #0, #2 and #4.
679
680 Thus we expect that 
681 \ref ParaMEDMEM::MEDCouplingPointSet::getNodeIdsNearPoint "getNodeIdsNearPoint()" that
682 we are going to use,
683 if called with \b eps = 0.003, would return ids of nodes #0, #2 and #4.
684 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoint_2
685
686
687 \anchor cpp_mcpointset_getnodeidsnearpoints
688 <br><h2> Getting nodes close to some points </h2>
689
690 The following code creates a 2D \ref ParaMEDMEM::MEDCouplingUMesh
691 "MEDCouplingUMesh" with 7 nodes and no cells.
692 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoints_1
693 Now we define an array of coordinates of 3 points near which we want to find nodes of the mesh.
694 - Point #0 is at distance 0.001 from the node #1.
695 - Point #1 is rather far from all nodes.
696 - Point #2 is close to nodes #3, #4 and #5.
697
698 Thus we expect that 
699 \ref ParaMEDMEM::MEDCouplingPointSet::getNodeIdsNearPoints "getNodeIdsNearPoints()" that
700 we are going to use,
701 if called with \b eps = 0.003, would return ids of close nodes #1, #3, #4 and #5.
702 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoints_2
703 \b idsIndex returns [0, 1, 1, 4] which means that:
704 - Point #0 is close to 1 (== \b idsIndex[1] - \b idsIndex[0]) node whose id is 
705 \b ids[ \b idsIndex[ 0 ]].
706 - Point #1 is close to 0 (== \b idsIndex[2] - \b idsIndex[1]) nodes.
707 - Point #2 is close to 3 (== \b idsIndex[3] - \b idsIndex[2]) nodes whose ids are
708 \b ids[ \b idsIndex[ 2 ]], \b ids[ \b idsIndex[ 2 ] + 1 ] and \b ids[ \b idsIndex[ 2 ] + 2 ].
709
710
711 \anchor cpp_mcpointset_findcommonnodes
712 <br><h2> Finding coincident nodes </h2>
713
714 First, we create a mesh with 6 nodes, of which two nodes (#3 and #4) are fully coincident
715 and 3 nodes (#0, #2 and #5) have distance less than 0.004 between them.
716 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_findCommonNodes_1
717 Then, we use \ref ParaMEDMEM::MEDCouplingPointSet::findCommonNodes() "findCommonNodes()" to find
718 coincident nodes, and check that (1) calling 
719 \ref ParaMEDMEM::MEDCouplingPointSet::findCommonNodes() "findCommonNodes()" with \b prec
720 == 1e-13 finds the two fully coincident nodes only and (2)
721 \ref ParaMEDMEM::MEDCouplingPointSet::findCommonNodes() "findCommonNodes"(0.004) finds 5
722 equal nodes.
723 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_findCommonNodes_2
724
725 \anchor cpp_mcpointset_getcoordinatesofnode
726 <br><h2> Getting coordinates of a node </h2>
727
728 The following code creates a 2D \ref ParaMEDMEM::MEDCouplingUMesh
729 "MEDCouplingUMesh" with 3 nodes and no cells.
730 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_getCoordinatesOfNode_1
731 Here we get coordinates of the second node and check its two coordinates.
732 \snippet MEDCouplingExamplesTest.cxx CppSnippet_MEDCouplingPointSet_getCoordinatesOfNode_2
733
734 \anchor cpp_mcdataarrayint_getTuple
735 <br><h2> Getting a tuple of DataArrayInt </h2>
736
737 In this simple example we create an array of integers arranged into 3
738 tuples per 2 components, and finally print the second tuple.
739 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_getTuple_1
740 The output is
741 <pre> [9, 10] </pre>
742 Note that we can traverse all tuples in the array by simply iterating
743 over it as the code below does.
744 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_getTuple_2
745 Its output follows.
746 <pre>
747 (7, 8)
748 (9, 10)
749 (11, 12)
750 </pre>
751
752 \anchor cpp_mcdataarrayint_buildpermutationarr
753 <br><h2> Building a permutation array </h2>
754
755 Here we create two arrays containing same values but in different order and then we use
756 \ref ParaMEDMEM::DataArrayInt::buildPermutationArr "DataArrayInt::buildPermutationArr()" to get
757 an array showing in what places the values of \b b array are located in \b a array.
758 \snippet MEDCouplingExamplesTest.cxx CppSnippet_DataArrayInt_buildPermutationArr_1
759 The result array \b c contains [1,0,4,2,3].
760
761 <br><h2> Inverting renumbering maps </h2>
762 \anchor cpp_mcdataarrayint_invertarrayo2n2n2o
763 <h3> invertArrayO2N2N2O() </h3>
764
765 In this example we create a DataArrayInt containing a renumbering map in 
766 "Old to New" mode, convert it into the renumbering map in "New to Old" mode and check the
767 result.
768 \snippet MEDCouplingExamplesTest.cxx CppSnippet_DataArrayInt_invertArrayO2N2N2O_1
769
770 \anchor cpp_mcdataarrayint_invertarrayn2o2o2n
771 <br><h3> invertArrayN2O2O2N() </h3>
772
773 In this example we create a DataArrayInt containing a renumbering map in 
774 "New to Old" mode, convert it into the renumbering map in "Old to New" mode and check the
775 result.
776 \snippet MEDCouplingExamplesTest.cxx CppSnippet_DataArrayInt_invertArrayN2O2O2N_1
777
778
779
780 \anchor cpp_mcdataarraydouble_getidsinrange
781 <br><h2> Finding values in range in  DataArrayDouble</h2>
782
783 In this example we create an array \b da containing same values as ones returned by
784 \c range( \c 10 ). Then we get an array of indices of values of \b da being in
785 range [ 2.5, 6 ].
786 \snippet MEDCouplingExamplesTest.cxx CppSnippet_DataArrayDouble_getIdsInRange_1
787 As result contents of the array \b da2 are as follows.
788 <pre>
789     Tuple #0 : 3
790     Tuple #1 : 4
791     Tuple #2 : 5
792     Tuple #3 : 6
793 </pre>
794
795
796 \anchor cpp_mcdataarraydouble_setselectedcomponents
797 <br><h2> Set part of values of DataArrayDouble </h2>
798 <h3> setSelectedComponents() </h3>
799 First, we create a 'source' array.
800 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setSelectedComponents1
801 Now we create a larger zero array and assign the array \b da into it.
802 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setSelectedComponents2
803 As result contents of the array \b dv are as follows.
804 <pre>
805 Info of components : "a2"   "a1"   "v3"   "v4"   
806     Tuple #0 : 2 1 0 0 
807     Tuple #1 : 4 3 0 0 
808     Tuple #2 : 6 5 0 0 
809     Tuple #3 : 0 0 0 0 
810 </pre>
811 The same result can be achieved other way (except that component info
812 is not copied):
813 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setSelectedComponents3
814
815 \anchor cpp_mcdataarraydouble_setpartofvalues1
816 <br><h3> setPartOfValues1() </h3>
817 We create two arrays: 
818 - a "large" (4x4) zero array \b da to assign to and
819 - a smaller (2x2) array \b dv filled with values [7.,8.,9.,10].
820
821 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValues1_1
822 Now we copy \b dv to the middle of \b da.
823 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValues1_2
824 As result contents of the array \b da are as follows.
825 <pre>
826     Info of components :"v1"   "v2"   "v3"   "v4"
827     Tuple #0 : 0 0 0 0 
828     Tuple #1 : 0 7 8 0 
829     Tuple #2 : 0 9 10 0 
830     Tuple #3 : 0 0 0 0 
831 </pre>
832
833 Here we re-fill \b da with zeros and copy \b dv into a component of \b da.
834
835 Note that the last parameter \b strictCompoCompare should be \c False
836 in this case, else \ref ParaMEDMEM::DataArrayDouble::setPartOfValues1() 
837 throws an exception because \b da has 2 components but only one target
838 component is specified.
839 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValues1_3
840 <pre>
841     Tuple #0 : 0 7 0 0 
842     Tuple #1 : 0 8 0 0 
843     Tuple #2 : 0 9 0 0 
844     Tuple #3 : 0 10 0 0 
845 </pre>
846 Below more two variants of location of target values are shown.
847 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValues1_4
848 <pre>
849     Tuple #0 : 0 0 0 0 
850     Tuple #1 : 7 8 9 10 
851     Tuple #2 : 0 0 0 0 
852     Tuple #3 : 0 0 0 0 
853 </pre>
854
855 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValues1_5
856 <pre>
857     Tuple #0 : 0 7 0 8 
858     Tuple #1 : 0 0 0 0 
859     Tuple #2 : 0 9 0 10 
860     Tuple #3 : 0 0 0 0 
861 </pre>
862 The same result can be achieved other way:
863 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValues1_6
864
865
866
867 \anchor cpp_mcdataarraydouble_setpartofvaluessimple1
868 <br><h3> setPartOfValuesSimple1() </h3>
869 We create an array (4x4) \b da to assign to and define a value \b dv to assign.
870 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple1_1
871 Now we assign \b dv to the middle of \b da.
872 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple1_2
873 As result contents of the array \b da are as follows.
874 <pre>
875     Tuple #0 : 0 0 0 0 
876     Tuple #1 : 0 7 7 0 
877     Tuple #2 : 0 7 7 0 
878     Tuple #3 : 0 0 0 0 
879 </pre>
880
881 Here we re-fill \b da with zeros and assign \b dv to a component of \b da.
882 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple1_3
883 <pre>
884     Tuple #0 : 0 7 0 0 
885     Tuple #1 : 0 7 0 0 
886     Tuple #2 : 0 7 0 0 
887     Tuple #3 : 0 7 0 0 
888 </pre>
889 Below more two variants of location of target values are shown.
890 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple1_4
891 <pre>
892     Tuple #0 : 0 0 0 0 
893     Tuple #1 : 7 7 7 7 
894     Tuple #2 : 0 0 0 0 
895     Tuple #3 : 0 0 0 0 
896 </pre>
897
898 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple1_5
899 <pre>
900     Tuple #0 : 0 7 0 7 
901     Tuple #1 : 0 0 0 0 
902     Tuple #2 : 0 7 0 7 
903     Tuple #3 : 0 0 0 0 
904 </pre>
905 The same result can be achieved other way:
906 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple1_6
907
908
909 \anchor cpp_mcdataarraydouble_setpartofvaluessimple2
910 <br><h3> setPartOfValuesSimple2() </h3>
911 We create an array (4x4) \b da to assign to and define a value \b dv to assign.
912 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple2_1
913 Now we assign \b dv to the middle of \b da.
914 We explicitly specify tuples and component to assign to by a list [1,2].
915 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple2_2
916 As result contents of the array \b da are as follows.
917 <pre>
918     Tuple #0 : 0 0 0 0 
919     Tuple #1 : 0 7 7 0 
920     Tuple #2 : 0 7 7 0 
921     Tuple #3 : 0 0 0 0 
922 </pre>
923
924 Here we re-fill \b da with zeros and assign \b dv to a component of \b da.
925 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple2_3
926 <pre>
927     Tuple #0 : 0 7 0 0 
928     Tuple #1 : 0 7 0 0 
929     Tuple #2 : 0 7 0 0 
930     Tuple #3 : 0 7 0 0 
931 </pre>
932 Below more two variants of location of target values are shown.
933 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple2_4
934 <pre>
935     Tuple #0 : 0 0 0 0 
936     Tuple #1 : 7 7 7 7 
937     Tuple #2 : 0 0 0 0 
938     Tuple #3 : 0 0 0 0 
939 </pre>
940
941 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple2_5
942 <pre>
943     Tuple #0 : 0 7 0 7 
944     Tuple #1 : 0 0 0 0 
945     Tuple #2 : 0 7 0 7 
946     Tuple #3 : 0 0 0 0 
947 </pre>
948 \note \ref ParaMEDMEM::DataArrayDouble::setPartOfValuesSimple2() can't
949 be explicitly called in Python.
950
951
952 \anchor cpp_mcdataarraydouble_setpartofvaluessimple3
953 <br><h3> setPartOfValuesSimple3() </h3>
954 We create an array (4x4) \b da to assign to and define a value \b dv to assign.
955 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple3_1
956 Now we assign \b dv to the middle of \b da.
957 We explicitly specify tuples to assign to by a list [1,2]. And we specify
958 components to assign to using slicing: 1:3.
959 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple3_2
960 As result contents of the array \b da are as follows.
961 <pre>
962     Tuple #0 : 0 0 0 0 
963     Tuple #1 : 0 7 7 0 
964     Tuple #2 : 0 7 7 0 
965     Tuple #3 : 0 0 0 0 
966 </pre>
967
968 Here we re-fill \b da with zeros and assign \b dv to a component of \b da.
969 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple3_3
970 <pre>
971     Tuple #0 : 0 7 0 0 
972     Tuple #1 : 0 7 0 0 
973     Tuple #2 : 0 7 0 0 
974     Tuple #3 : 0 7 0 0 
975 </pre>
976 Below more two variants of location of target values are shown.
977 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple3_4
978 <pre>
979     Tuple #0 : 0 0 0 0 
980     Tuple #1 : 7 7 7 7 
981     Tuple #2 : 0 0 0 0 
982     Tuple #3 : 0 0 0 0 
983 </pre>
984
985 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValuesSimple3_5
986 <pre>
987     Tuple #0 : 0 7 0 7 
988     Tuple #1 : 0 0 0 0 
989     Tuple #2 : 0 7 0 7 
990     Tuple #3 : 0 0 0 0 
991 </pre>
992 \note \ref ParaMEDMEM::DataArrayDouble::setPartOfValuesSimple3() can't
993 be explicitly called in Python.
994
995
996 \anchor cpp_mcdataarraydouble_setpartofvalues2
997 <br><h3> setPartOfValues2() </h3>
998 We create two arrays: 
999 - a "large" (4x7) zero array \b da to assign to,
1000 - a smaller (3x2) array \b dv filled with values [7.,8.,9.,10.,11.,12.].
1001
1002 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValues2_1
1003 Now we assign the two components of \b dv to the components of \b da
1004 with indices [1,3], and the 3 tuples of \b dv to the 3 tuples of \b da with
1005   indices [0,1,2]. This is the first mode of usage.
1006 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValues2_2
1007 As result contents of the array \b da are as follows.
1008 <pre>
1009     Tuple #0 : 0  7  0  8  0  0  0  
1010     Tuple #1 : 0  9  0 10  0  0  0 
1011     Tuple #2 : 0 11  0 12  0  0  0 
1012     Tuple #3 : 0  0  0  0  0  0  0
1013 </pre>
1014 Every value of \b dv has been assigned to its own location within \b da.
1015
1016 Now we re-fill \b da with zeros and rearrange \b dv to have 6 components.
1017 And we assign \b dv to the tuples of \b da with indices [0,2,3] .
1018 This is the second mode of usage.
1019 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValues2_3
1020 The contents of \b dv have been assigned to each of specified tuples of \b da.
1021 Every value of \b dv is repeated in the 3 specified tuples within \b da.
1022 <pre>
1023     Tuple #0 : 7  0  8  9 10 11 12
1024     Tuple #1 : 0  0  0  0  0  0  0   
1025     Tuple #2 : 7  0  8  9 10 11 12
1026     Tuple #3 : 7  0  8  9 10 11 12
1027 </pre>
1028 \note \ref ParaMEDMEM::DataArrayDouble::setPartOfValues2() can't
1029 be explicitly called in Python.
1030
1031
1032 \anchor cpp_mcdataarraydouble_setpartofvalues3
1033 <br><h3> setPartOfValues3() </h3>
1034 We create two arrays: 
1035 - a "large" (4x7) zero array \b da to assign to,
1036 - a smaller (3x2) array \b dv filled with values [7.,8.,9.,10.,11.,12.].
1037
1038 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValues3_1
1039 Now we assign the two components of \b dv to the components of \b da
1040 with indices [1,3], and the 3 tuples of \b dv to the 3 tuples of \b da with
1041 indices [0,1,2] which are specified using slicing: "0:3". 
1042 This is the first mode of usage.
1043 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValues3_2
1044 As result contents of the array \b da are as follows.
1045 <pre>
1046     Tuple #0 : 0  7  0  8  0  0  0  
1047     Tuple #1 : 0  9  0 10  0  0  0 
1048     Tuple #2 : 0 11  0 12  0  0  0 
1049     Tuple #3 : 0  0  0  0  0  0  0
1050 </pre>
1051 Every value of \b dv has been assigned to its own location within \b da.
1052
1053 Now we re-fill \b da with zeros and rearrange \b dv to have 6 components.
1054 And we assign \b dv to the tuples of \b da with indices [0,2] using \a
1055 slice notation "0:4:2". This is the second mode of usage.
1056 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_setPartOfValues3_3
1057 The contents of \b dv have been assigned to each of specified tuples of \b da.
1058 Every value of \b dv is repeated in the 3 specified tuples within \b da.
1059 <pre>
1060     Tuple #0 : 7  0  8  9 10 11 12
1061     Tuple #1 : 0  0  0  0  0  0  0   
1062     Tuple #2 : 7  0  8  9 10 11 12
1063     Tuple #3 : 0  0  0  0  0  0  0   
1064 </pre>
1065 \note \ref ParaMEDMEM::DataArrayDouble::setPartOfValues3() can't
1066 be explicitly called in Python.
1067
1068
1069 \anchor cpp_mcdataarrayint_setselectedcomponents
1070 <br><h2> Set part of values of DataArrayInt </h2>
1071 <h3> setSelectedComponents() </h3>
1072 First, we create a 'source' array.
1073 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setSelectedComponents1
1074 Now we create a larger zero array and assign the array \b da to it.
1075 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setSelectedComponents2
1076 As result contents of the array \b dv are as follows.
1077 <pre>
1078 Info of components : "a2"   "a1"   "v3"   "v4"   
1079     Tuple #0 : 2 1 0 0 
1080     Tuple #1 : 4 3 0 0 
1081     Tuple #2 : 6 5 0 0 
1082     Tuple #3 : 0 0 0 0 
1083 </pre>
1084 The same result can be achieved other way (except that component info
1085 is not copied):
1086 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setSelectedComponents3
1087
1088 \anchor cpp_mcdataarrayint_setpartofvalues1
1089 <br><h3> setPartOfValues1() </h3>
1090 We create two arrays: 
1091 - a "large" (4x4) zero array \b da to assign to and
1092 - a smaller (2x2) array \b dv filled with values [7,8,9,10].
1093
1094 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValues1_1
1095 Now we copy \b dv to the middle of \b da.
1096 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValues1_2
1097 As result contents of the array \b da are as follows.
1098 <pre>
1099     Info of components :"v1"   "v2"   "v3"   "v4"
1100     Tuple #0 : 0 0 0 0 
1101     Tuple #1 : 0 7 8 0 
1102     Tuple #2 : 0 9 10 0 
1103     Tuple #3 : 0 0 0 0 
1104 </pre>
1105
1106 Here we re-fill \b da with zeros and copy \b dv into a component of \b da.
1107
1108 Note that the last parameter \b strictCompoCompare should be \c False
1109 in this case, else \ref ParaMEDMEM::DataArrayInt::setPartOfValues1() 
1110 throws an exception because \b da has 2 components but only one target
1111 component is specified.
1112 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValues1_3
1113 <pre>
1114     Tuple #0 : 0 7 0 0 
1115     Tuple #1 : 0 8 0 0 
1116     Tuple #2 : 0 9 0 0 
1117     Tuple #3 : 0 10 0 0 
1118 </pre>
1119 Below more two variants of location of target values are shown.
1120 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValues1_4
1121 <pre>
1122     Tuple #0 : 0 0 0 0 
1123     Tuple #1 : 7 8 9 10 
1124     Tuple #2 : 0 0 0 0 
1125     Tuple #3 : 0 0 0 0 
1126 </pre>
1127
1128 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValues1_5
1129 <pre>
1130     Tuple #0 : 0 7 0 8 
1131     Tuple #1 : 0 0 0 0 
1132     Tuple #2 : 0 9 0 10 
1133     Tuple #3 : 0 0 0 0 
1134 </pre>
1135 The same result can be achieved other way:
1136 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValues1_6
1137
1138
1139
1140 \anchor cpp_mcdataarrayint_setpartofvaluessimple1
1141 <br><h3> setPartOfValuesSimple1() </h3>
1142 We create an array (4x4) \b da to assign to and define a value \b dv to assign.
1143 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple1_1
1144 Now we assign \b dv to the middle of \b da.
1145 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple1_2
1146 As result contents of the array \b da are as follows.
1147 <pre>
1148     Tuple #0 : 0 0 0 0 
1149     Tuple #1 : 0 7 7 0 
1150     Tuple #2 : 0 7 7 0 
1151     Tuple #3 : 0 0 0 0 
1152 </pre>
1153
1154 Here we re-fill \b da with zeros and assign \b dv to a component of \b da.
1155 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple1_3
1156 <pre>
1157     Tuple #0 : 0 7 0 0 
1158     Tuple #1 : 0 7 0 0 
1159     Tuple #2 : 0 7 0 0 
1160     Tuple #3 : 0 7 0 0 
1161 </pre>
1162 Below more two variants of location of target values are shown.
1163 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple1_4
1164 <pre>
1165     Tuple #0 : 0 0 0 0 
1166     Tuple #1 : 7 7 7 7 
1167     Tuple #2 : 0 0 0 0 
1168     Tuple #3 : 0 0 0 0 
1169 </pre>
1170
1171 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple1_5
1172 <pre>
1173     Tuple #0 : 0 7 0 7 
1174     Tuple #1 : 0 0 0 0 
1175     Tuple #2 : 0 7 0 7 
1176     Tuple #3 : 0 0 0 0 
1177 </pre>
1178 The same result can be achieved other way:
1179 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple1_6
1180
1181
1182 \anchor cpp_mcdataarrayint_setpartofvaluessimple2
1183 <br><h3> setPartOfValuesSimple2() </h3>
1184 We create an array (4x4) \b da to assign to and define a value \b dv to assign.
1185 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple2_1
1186 Now we assign \b dv to the middle of \b da.
1187 We explicitly specify tuples and component to assign to by a list [1,2].
1188 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple2_2
1189 As result contents of the array \b da are as follows.
1190 <pre>
1191     Tuple #0 : 0 0 0 0 
1192     Tuple #1 : 0 7 7 0 
1193     Tuple #2 : 0 7 7 0 
1194     Tuple #3 : 0 0 0 0 
1195 </pre>
1196
1197 Here we re-fill \b da with zeros and assign \b dv to a component of \b da.
1198 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple2_3
1199 <pre>
1200     Tuple #0 : 0 7 0 0 
1201     Tuple #1 : 0 7 0 0 
1202     Tuple #2 : 0 7 0 0 
1203     Tuple #3 : 0 7 0 0 
1204 </pre>
1205 Below more two variants of location of target values are shown.
1206 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple2_4
1207 <pre>
1208     Tuple #0 : 0 0 0 0 
1209     Tuple #1 : 7 7 7 7 
1210     Tuple #2 : 0 0 0 0 
1211     Tuple #3 : 0 0 0 0 
1212 </pre>
1213
1214 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple2_5
1215 <pre>
1216     Tuple #0 : 0 7 0 7 
1217     Tuple #1 : 0 0 0 0 
1218     Tuple #2 : 0 7 0 7 
1219     Tuple #3 : 0 0 0 0 
1220 </pre>
1221 \note \ref ParaMEDMEM::DataArrayInt::setPartOfValuesSimple2() can't
1222 be explicitly called in Python.
1223
1224
1225 \anchor cpp_mcdataarrayint_setpartofvaluessimple3
1226 <br><h3> setPartOfValuesSimple3() </h3>
1227 We create an array (4x4) \b da to assign to and define a value \b dv to assign.
1228 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple3_1
1229 Now we assign \b dv to the middle of \b da.
1230 We explicitly specify tuples to assign to by a list [1,2]. And we specify
1231 components to assign to using slicing: 1:3.
1232 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple3_2
1233 As result contents of the array \b da are as follows.
1234 <pre>
1235     Tuple #0 : 0 0 0 0 
1236     Tuple #1 : 0 7 7 0 
1237     Tuple #2 : 0 7 7 0 
1238     Tuple #3 : 0 0 0 0 
1239 </pre>
1240
1241 Here we re-fill \b da with zeros and assign \b dv to a component of \b da.
1242 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple3_3
1243 <pre>
1244     Tuple #0 : 0 7 0 0 
1245     Tuple #1 : 0 7 0 0 
1246     Tuple #2 : 0 7 0 0 
1247     Tuple #3 : 0 7 0 0 
1248 </pre>
1249 Below more two variants of location of target values are shown.
1250 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple3_4
1251 <pre>
1252     Tuple #0 : 0 0 0 0 
1253     Tuple #1 : 7 7 7 7 
1254     Tuple #2 : 0 0 0 0 
1255     Tuple #3 : 0 0 0 0 
1256 </pre>
1257
1258 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValuesSimple3_5
1259 <pre>
1260     Tuple #0 : 0 7 0 7 
1261     Tuple #1 : 0 0 0 0 
1262     Tuple #2 : 0 7 0 7 
1263     Tuple #3 : 0 0 0 0 
1264 </pre>
1265 \note \ref ParaMEDMEM::DataArrayInt::setPartOfValuesSimple3() can't
1266 be explicitly called in Python.
1267
1268
1269 \anchor cpp_mcdataarrayint_setpartofvalues2
1270 <br><h3> setPartOfValues2() </h3>
1271 We create two arrays: 
1272 - a "large" (4x7) zero array \b da to assign to,
1273 - a smaller (3x2) array \b dv filled with values [7,8,9,10,11,12].
1274
1275 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValues2_1
1276 Now we assign the two components of \b dv to the components of \b da
1277 with indices [1,3], and the 3 tuples of \b dv to the 3 tuples of \b da with
1278   indices [0,1,2]. This is the first mode of usage.
1279 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValues2_2
1280 As result contents of the array \b da are as follows.
1281 <pre>
1282     Tuple #0 : 0  7  0  8  0  0  0  
1283     Tuple #1 : 0  9  0 10  0  0  0 
1284     Tuple #2 : 0 11  0 12  0  0  0 
1285     Tuple #3 : 0  0  0  0  0  0  0
1286 </pre>
1287 Every value of \b dv has been assigned to its own location within \b da.
1288
1289 Now we re-fill \b da with zeros and rearrange \b dv to have 6 components.
1290 And we assign \b dv to the tuples of \b da with indices [0,2,3] .
1291 This is the second mode of usage.
1292 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValues2_3
1293 The contents of \b dv have been assigned to each of specified tuples of \b da.
1294 Every value of \b dv is repeated in the 3 specified tuples within \b da.
1295 <pre>
1296     Tuple #0 : 7  0  8  9 10 11 12
1297     Tuple #1 : 0  0  0  0  0  0  0   
1298     Tuple #2 : 7  0  8  9 10 11 12
1299     Tuple #3 : 7  0  8  9 10 11 12
1300 </pre>
1301 \note \ref ParaMEDMEM::DataArrayInt::setPartOfValues2() can't
1302 be explicitly called in Python.
1303
1304
1305 \anchor cpp_mcdataarrayint_setpartofvalues3
1306 <br><h3> setPartOfValues3() </h3>
1307 We create two arrays: 
1308 - a "large" (4x7) zero array \b da to assign to,
1309 - a smaller (3x2) array \b dv filled with values [7,8,9,10,11,12].
1310
1311 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValues3_1
1312 Now we assign the two components of \b dv to the components of \b da
1313 with indices [1,3], and the 3 tuples of \b dv to the 3 tuples of \b da with
1314 indices [0,1,2] which are specified using slicing: "0:3". 
1315 This is the first mode of usage.
1316 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValues3_2
1317 As result contents of the array \b da are as follows.
1318 <pre>
1319     Tuple #0 : 0  7  0  8  0  0  0  
1320     Tuple #1 : 0  9  0 10  0  0  0 
1321     Tuple #2 : 0 11  0 12  0  0  0 
1322     Tuple #3 : 0  0  0  0  0  0  0
1323 </pre>
1324 Every value of \b dv has been assigned to its own location within \b da.
1325
1326 Now we re-fill \b da with zeros and rearrange \b dv to have 6 components.
1327 And we assign \b dv to the tuples of \b da with indices [0,2] using \a
1328 slice notation "0:4:2". This is the second mode of usage.
1329 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayInt_setPartOfValues3_3
1330 The contents of \b dv have been assigned to each of specified tuples of \b da.
1331 Every value of \b dv is repeated in the 3 specified tuples within \b da.
1332 <pre>
1333     Tuple #0 : 7  0  8  9 10 11 12
1334     Tuple #1 : 0  0  0  0  0  0  0   
1335     Tuple #2 : 7  0  8  9 10 11 12
1336     Tuple #3 : 0  0  0  0  0  0  0   
1337 </pre>
1338 \note \ref ParaMEDMEM::DataArrayInt::setPartOfValues3() can't
1339 be explicitly called in Python.
1340
1341
1342 \anchor cpp_mcdataarraydouble_getdifferentvalues
1343 <br><h2> Excluding coincident tuples from DataArrayDouble</h2>
1344
1345 The code below creates an array of real values and than an array of
1346   unique values, not closer one to another than 0.2, is retrieved from it.
1347 \snippet MEDCouplingExamplesTest.py Snippet_DataArrayDouble_getDifferentValues1
1348
1349
1350 \anchor cpp_mcdataarraydouble_findcommontuples
1351 <br><h2> Finding coincident tuples in DataArrayDouble</h2>
1352
1353 Let's create an array of 6 tuples and 2 components that can be
1354   considered as coordinates of 6 points in 2D space.
1355 \snippet MEDCouplingExamplesTest.cxx CppSnippet_DataArrayDouble_findCommonTuples1
1356 Now we find points that are not far each from other than 1e-1.
1357 \snippet MEDCouplingExamplesTest.cxx CppSnippet_DataArrayDouble_findCommonTuples2
1358 As we can realize from the above code, a hardcoded array \b expected3 is equal
1359   to the raw data of a DataArrayInt \b c and a hardcoded array \b expected4 is equal
1360   to the raw data of the DataArrayInt \b cI.
1361
1362 The array \b c contains indices of 5 coincident points. The array \b
1363   cI shows us boundaries of (cI->getNumberOfTuples()-1) = 2 groups of coincident points: 
1364 - The first group starts at index 0 and includes (3 - 0) = 3 points: 0,3,4.
1365 - The second group starts at index 3 and includes (5 - 3) = 2 points: 1,2.
1366
1367 \anchor cpp_mcdataarraydouble_meldwith
1368 <br><h2> Concatenating DataArrayDouble's by appending components </h2>
1369
1370 In this example we create two data arrays including \b same number of
1371 tuples and then we concatenate them using \ref
1372 ParaMEDMEM::DataArrayDouble::meldWith "meldWith()".
1373 \snippet MEDCouplingExamplesTest.cxx CppSnippet_DataArrayDouble_Meld1_1
1374 Now the array \b da1 includes 7 tuples (as before) of 3 components
1375 each. Its components are: "c0da1","c1da1","c0da2".
1376
1377
1378 \anchor cpp_mcdataarrayint_meldwith
1379 <br><h2> Concatenating DataArrayInt's by appending components </h2>
1380
1381 In this example we create two data arrays including \b same number of
1382 tuples and then we concatenate them using \ref
1383 ParaMEDMEM::DataArrayInt::meldWith "meldWith()".
1384 \snippet MEDCouplingExamplesTest.cxx CppSnippet_DataArrayInt_Meld1_1
1385 Now the array \b da1 includes 7 tuples (as before) of 3 components
1386 each. Its components are: "c0da1","c1da1","c0da2".
1387
1388
1389 \anchor cpp_mcdataarraydouble_KeepSelectedComponents
1390
1391 <br><h2>Creation of a sub-part of the DataArrayDouble by selecting components</h2>
1392
1393 \snippet MEDCouplingExamplesTest.py SnippeDataArrayDoubleKeepSelectedComponents1_1
1394 We created an array \b a1 containing 5 tuples of 4 components each (20
1395 values). Now we are going to create an array \b a2 containing some
1396 components of \b a1.
1397 \snippet MEDCouplingExamplesTest.py SnippeDataArrayDoubleKeepSelectedComponents1_2
1398 Now each tuple of \b a2 includes components named "b","c","b","c","a","a". Thus
1399 the result array \b a2 includes 30 elements (5 tuples per 6 components).
1400
1401 \anchor cpp_mcfielddouble_subpart1
1402
1403 \anchor cpp_mcdataarrayint_keepselectedcomponents
1404
1405 <br><h2>Creation of a sub-part of the DataArrayInt by selecting components</h2>
1406
1407 \snippet MEDCouplingExamplesTest.py SnippeDataArrayIntKeepSelectedComponents1_1
1408 We created an array \b a1 containing 5 tuples of 4 components each (20
1409 values). Now we are going to create an array \b a2 containing some
1410 components of \b a1.
1411 \snippet MEDCouplingExamplesTest.py SnippeDataArrayIntKeepSelectedComponents1_2
1412 Now each tuple of \b a2 includes components named "b","c","b","c","a","a". Thus
1413 the result array \b a2 includes 30 elements (5 tuples per 6 components).
1414
1415 Note that
1416 \ref ParaMEDMEM::DataArrayInt::keepSelectedComponents() "DataArrayInt::keepSelectedComponents()" 
1417 is called, providing the same result, by the following python code:
1418 \snippet MEDCouplingExamplesTest.py SnippeDataArrayIntKeepSelectedComponents1_3
1419
1420 \anchor cpp_mcfielddouble_subpart1
1421
1422
1423 <br><h2>Creation of a sub part of a field</h2>
1424 <br><h3>Creation of a sub part of a field on cells</h3>
1425 \snippet MEDCouplingExamplesTest.cxx CppSnippetFieldDoubleBuildSubPart1_1
1426 The field on cells \b f1 lies on a mesh containing 5 cells and 9 nodes.         
1427 So this field \b f1 contains 5 tuples of 2 components each (10 values).
1428 Now let's create a subfield on cells \b f2 from \b f1.
1429 \snippet MEDCouplingExamplesTest.cxx CppSnippetFieldDoubleBuildSubPart1_2
1430
1431 \b f1 is a field on cells, \ref ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart "buildSubPart" method performs an extraction on cells too.
1432
1433 So the array \b part1 lists ids on cells.
1434
1435 - cell #0 of \b f2 is the same cell of cell #2 of \b f1
1436 - cell #1 of \b f2 is the same cell of cell #1 of \b f1
1437 - cell #2 of \b f2 is the same cell of cell #4 of \b f1
1438
1439 So \b f2 contains 3 tuples with 2 components.
1440
1441 The underlying mesh of \b f2 contains a newly created mesh with 3 cells (not as \b mesh1 in \b f1) and 9 nodes (as \b mesh1 in \b f1).
1442 \n For fields on cells the number of tuples of the returned field is always equal to the number of ids given in input (here \b part1).
1443 \nOnly fields on cells have this particular behaviour.
1444
1445 <br><h3>Creation of a sub part of a field on nodes</h3>
1446 \snippet MEDCouplingExamplesTest.cxx CppSnippetFieldDoubleBuildSubPart1_3
1447 The field on nodes \b f1 lies on a mesh containing 5 cells and 9 nodes.
1448 So this field \b f1 contains 9 tuples of 2 components each (18 values).
1449 Now let's create a subfield on nodes \b f2 from \b f1.
1450 \snippet MEDCouplingExamplesTest.cxx CppSnippetFieldDoubleBuildSubPart1_4
1451
1452 \b f1 is a field on nodes, but \ref ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart "buildSubPart" method performs an extraction on \b cells.
1453
1454 After the call of \ref ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart "buildSubPart" on node field \b f1, \b f1 will be reduced on a
1455 submesh of \b mesh1 containing cells whoses ids are in \b part2. So here the number of cells of \b f2 is 2 and the number of nodes is 4.
1456 \nSo contrary to fields on cells, it is normal for fields on nodes that number of tuples of the returned field of \ref ParaMEDMEM::MEDCouplingFieldDouble::buildSubPart "buildSubPart" 
1457 method does not match the size of the input array (here \b part2).
1458
1459 */
1460
1461 /*!
1462 \page medcouplingcppexamplesUmeshStdBuild1 <br><h1> Example of standard build of an unstructured mesh from scratch in C++ </h1>
1463
1464 Firstly retrieve basic data in full interlace mode for coordinates, and nodal connectivity cell per cell.
1465 \snippet MEDCouplingExamplesTest.cxx CppSnippetUMeshStdBuild1_1
1466
1467 Then create ParaMEDMEM::MEDCouplingUMesh instance giving its meshdimension (2 here) and a name.
1468
1469 \snippet MEDCouplingExamplesTest.cxx CppSnippetUMeshStdBuild1_2
1470
1471 Gives an upper bound of the number of cells to be inserted into the unstructured mesh.
1472 \n Then enter nodal connectivity of all cells, cell per cell using ParaMEDMEM::MEDCouplingUMesh::insertNextCell method.
1473 \n When the nodal connectivity cell per cell has been finished, call ParaMEDMEM::MEDCouplingUMesh::finishInsertingCells method in order to restore \b mesh instance.
1474
1475 \snippet MEDCouplingExamplesTest.cxx CppSnippetUMeshStdBuild1_3
1476
1477 At this level the connectivity part of the mesh \b mesh as been defined. Now let's set the coordinates using array \b coords defined above.
1478
1479 \snippet MEDCouplingExamplesTest.cxx CppSnippetUMeshStdBuild1_4
1480
1481 At this level mesh is usable. When this mesh is no more needed simply call decrRef to decrement its reference counter.
1482
1483 \snippet MEDCouplingExamplesTest.cxx CppSnippetUMeshStdBuild1_5
1484
1485 */
1486
1487 /*!
1488 \page medcouplingcppexamplesUmeshAdvBuild1 <br><h1> Example of advanced build of an unstructured mesh from scratch in C++ </h1>
1489
1490 Firstly retrieve basic data in full interlace mode for coordinates, and nodal connectivity cell per cell, cell type \b included (3 for INTERP_KERNEL::NORM_TRI3 and 4 for INTERP_KERNEL::QUAD4).
1491 \snippet MEDCouplingExamplesTest.cxx CppSnippetUMeshAdvBuild1_1
1492
1493 Then create ParaMEDMEM::MEDCouplingUMesh instance giving its meshdimension (2 here) and a name.
1494
1495 \snippet MEDCouplingExamplesTest.cxx CppSnippetUMeshAdvBuild1_2
1496
1497 Then enter nodal connectivity at once.
1498
1499 \snippet MEDCouplingExamplesTest.cxx CppSnippetUMeshAdvBuild1_3
1500
1501 At this level the connectivity part of the mesh \b mesh as been defined. Now let's set the coordinates using array \b coords defined above.
1502
1503 \snippet MEDCouplingExamplesTest.cxx CppSnippetUMeshAdvBuild1_4
1504
1505 At this level mesh is usable. When this mesh is no more needed simply call decrRef() to decrement its reference counter.
1506
1507 \snippet MEDCouplingExamplesTest.cxx CppSnippetUMeshAdvBuild1_5
1508
1509 */
1510
1511 /*!
1512 \page medcouplingcppexamplesCmeshStdBuild1 <br><h1> Example of standard build of an cartesian mesh from scratch in C++ </h1>
1513
1514 We are going to build a 2D cartesian mesh, constituted from 9 nodes along X axis, and 7 nodes along Y axis.
1515
1516 Firstly retrieve for each direction the discretization and build a \ref ParaMEDMEM::DataArrayDouble "DataArrayDouble instance" on the corresponding direction.
1517
1518 \snippet MEDCouplingExamplesTest.cxx CppSnippetCMeshStdBuild1_1
1519
1520 Then create ParaMEDMEM::MEDCouplingCMesh instance giving the 2 instances of \ref ParaMEDMEM::DataArrayDouble "DataArrayDouble" obtained above.
1521
1522 There are 2 techniques to get it.
1523
1524 Either :
1525
1526 \snippet MEDCouplingExamplesTest.cxx CppSnippetCMeshStdBuild1_2
1527
1528 Or :
1529
1530 \snippet MEDCouplingExamplesTest.cxx CppSnippetCMeshStdBuild1_2bis
1531
1532 \c mesh is now available for use :
1533
1534 \snippet MEDCouplingExamplesTest.cxx CppSnippetCMeshStdBuild1_3
1535
1536 When this mesh is no more needed simply call decrRef to decrement its reference counter.
1537
1538 \snippet MEDCouplingExamplesTest.cxx CppSnippetCMeshStdBuild1_4
1539
1540 */
1541
1542 /*!
1543 \page medcouplingcppexamplesFieldDoubleBuild1 <br><h1> Examples in C++ of standard build of a tensor field on cells with no time attached  </h1>
1544
1545 \snippet MEDCouplingExamplesTest.cxx CppSnippetFieldDoubleBuild1_1
1546
1547 */
1548
1549 /*!
1550 \page medcouplingcppexamplesFieldDoubleBuild2 <br><h1> Examples in C++ of standard build of a scalar field on nodes with no time attached </h1>
1551
1552 \snippet MEDCouplingExamplesTest.cxx CppSnippetFieldDoubleBuild2_1
1553
1554 */
1555
1556 /*!
1557 \page medcouplingcppexamplesFieldDoubleBuild3 <br><h1> Examples in C++ of standard build of a vector field on cells with with one time attached and no time interval </h1>
1558
1559 \snippet MEDCouplingExamplesTest.cxx CppSnippetFieldDoubleBuild3_1
1560
1561 */
1562
1563 /*!
1564 \page medcouplingcppexamplesFieldDoubleBuild4 <br><h1> Examples in C++ of standard build of a vector field on nodes defined on a time interval with a constant value during this interval </h1>
1565
1566 \snippet MEDCouplingExamplesTest.cxx CppSnippetFieldDoubleBuild4_1
1567
1568 */
1569
1570 /*!
1571 \page medcouplingcppexamplesFieldDoubleBuild5 <br><h1> Examples in C++ of operation that can be carried out on fields on cells </h1>
1572
1573 \snippet MEDCouplingExamplesTest.cxx CppSnippetFieldDoubleBuild1_2
1574
1575 The decrementation of ref counter should be carried out in CPlusPlus only ...
1576
1577 \snippet MEDCouplingExamplesTest.cxx CppSnippetFieldDoubleBuild1_3
1578
1579 */