Salome HOME
Further fix for CaseReader Py3 ...
[tools/medcoupling.git] / doc / user / input / data_optimization.rst
1 Data optimization for numerical codes
2 =====================================
3
4 .. _renumbering:
5
6 Renumbering to improve locality
7 -------------------------------
8
9 A mesher (like SMESH) often generates a scattered cell distribution in output unstructured mesh.
10 So a common task for simulation codes is the reordering for a better locality.
11
12 medcoupling can do that simply by doing
13
14 .. literalinclude:: ../../../src/MEDCoupling_Swig/UsersGuideExamplesTest.py
15    :start-after: UG_Optimization_0
16    :end-before:  UG_Optimization_0
17
18 .. figure:: ../images/medrenumber.png
19    :align: center
20
21    Numbering by MEFISTO mesher (to the left) and the same mesh after renumbering (to the right)
22
23 RenumberingFactory method creates a renumbering algorithm of a specified type: either "Boost" or "Metis".
24
25 Partitionning for multi procs
26 -----------------------------
27
28 For simulation codes following the SPMD paradigm, the partitionning is a key step.
29 medcoupling can perform this partition. Here is an example of partitioning mesh *m* into 4 parts and retrieving the first part:
30
31 .. literalinclude:: ../../../src/MEDCoupling_Swig/UsersGuideExamplesTest.py
32    :start-after: UG_Optimization_1
33    :end-before:  UG_Optimization_1
34
35 .. figure:: ../images/partition.png
36    :align: center
37
38    A whole mesh *m* (to the left) and one fourth of it *part0* (to the right) got using the above code
39
40 It's then possible to add a layer or more of cells.
41
42 .. literalinclude:: ../../../src/MEDCoupling_Swig/UsersGuideExamplesTest.py
43    :start-after: UG_Optimization_2
44    :end-before:  UG_Optimization_2
45
46 .. figure:: ../images/partition_with_layer.png
47    :align: center
48
49    *part0* (to the left) and *part0_with_layer* (to the right)