# Include "macro\_ddm.idp"

**URL:** https://community.freefem.org/t/include-macro-ddm-idp/1571
**Category:** FreeFEM installation
**Created:** [March 4, 2022, 2:38am UTC](https://community.freefem.org/t/include-macro-ddm-idp/1571 "2022-03-04T02:38:06Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![Qianrui](https://avatars.discourse-cdn.com/v4/letter/q/9fc348/32.png) [@Qianrui](https://community.freefem.org/u/Qianrui)
#### Post date: [March 4, 2022, 2:38am UTC](https://community.freefem.org/t/include-macro-ddm-idp/1571/1 "2022-03-04T02:38:06Z")

</div>

How do I query these commands? Not quite understanding the meaning of these commands, the guide to FreeFEM Documentation  
Release 4.8 did not find the meaning of these commands. For example ，

> include “macro\_ddm.idp”  
> or

> getARGV(“-global”, 40) and so on.

---

<div class="post-metadata">

### Author: ![mojtaba.barzegari](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/mojtaba.barzegari/32/20_2.png) [@mojtaba.barzegari](https://community.freefem.org/u/mojtaba.barzegari)
#### Post date: [March 4, 2022, 12:55pm UTC](https://community.freefem.org/t/include-macro-ddm-idp/1571/2 "2022-03-04T12:55:24Z")

</div>

`include “macro_ddm.idp”` loads the domain decomposition subroutines of FreeFEM, the source of which can be found in the GitHub repo or the “idp” directory in your local installation. It’s always crucial to call it after loading the PETSc module (`load "PETSc"`) and defining the “dimension” macro (like `macro dimension()3// EOM` for 3D cases). you may have a look at the “macro\_ddm.idp” file to check what else it can do and what parameters it brings to the code.

generally speaking, `getARGV("-global", 40)` does nothing but looking for the `-global` flag in the execution command of FF, returning the provided value if it exists or 40 otherwise. as an example, for a variable definition like `int X = getARGV("-global", 40)`, executing `FreeFem++ test.edp -global 10` results to `X` being 10, while executing ``FreeFem++ test.edp` initializes X to the provided default value, which is 40 in this case. seeing this in lots of HPDDM/PETSc examples in FF is to let the users define the number of mesh partitions via command line arguments, which can be controlled by changing the number of MPI processes as well.

---

<div class="post-metadata">

### Author: ![Qianrui](https://avatars.discourse-cdn.com/v4/letter/q/9fc348/32.png) [@Qianrui](https://community.freefem.org/u/Qianrui)
#### Post date: [March 5, 2022, 12:39pm UTC](https://community.freefem.org/t/include-macro-ddm-idp/1571/3 "2022-03-05T12:39:49Z")

</div>

If I define a grid partition, do the following two commands yield the same partition?

> mesh Th = square(4,4,[-8+16_x,-8+16_y]);  
> or

> mesh Th = square(getARGV(“-global”, 4), getARGV(“-global”, 4),[-8+16_x,-8+16_y]);

---

<div class="post-metadata">

### Author: ![mojtaba.barzegari](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/mojtaba.barzegari/32/20_2.png) [@mojtaba.barzegari](https://community.freefem.org/u/mojtaba.barzegari)
#### Post date: [March 7, 2022, 12:41pm UTC](https://community.freefem.org/t/include-macro-ddm-idp/1571/4 "2022-03-07T12:41:38Z")

</div>

this doesn’t create any partition, but the result of both scripts is the same mesh, yes, if no `-global` flag is passed to FF.

---

<div class="post-metadata">

### Author: ![Qianrui](https://avatars.discourse-cdn.com/v4/letter/q/9fc348/32.png) [@Qianrui](https://community.freefem.org/u/Qianrui)
#### Post date: [March 8, 2022, 7:27am UTC](https://community.freefem.org/t/include-macro-ddm-idp/1571/5 "2022-03-08T07:27:31Z")

</div>

Thanks for your answer. Is there reference book for this parallel version of FreeFem ++ -mpi ?

---

<div class="post-metadata">

### Author: ![mojtaba.barzegari](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/mojtaba.barzegari/32/20_2.png) [@mojtaba.barzegari](https://community.freefem.org/u/mojtaba.barzegari)
#### Post date: [March 11, 2022, 10:38am UTC](https://community.freefem.org/t/include-macro-ddm-idp/1571/6 "2022-03-11T10:38:11Z")

</div>

there are some explanations for ffddm in the documentation, but if you mean HPDDM, the best reference to refer to at this moment is Pierre’s tutorials on parallel FF, [here](http://jolivet.perso.enseeiht.fr/FreeFem-tutorial/) and [here](http://jolivet.perso.enseeiht.fr/FreeFem-tutorial/main.html).

---

<div class="post-metadata">

### Author: ![Qianrui](https://avatars.discourse-cdn.com/v4/letter/q/9fc348/32.png) [@Qianrui](https://community.freefem.org/u/Qianrui)
#### Post date: [June 27, 2022, 7:35am UTC](https://community.freefem.org/t/include-macro-ddm-idp/1571/7 "2022-06-27T07:35:59Z")

</div>

> buildMat(Th, getARGV(“-split”, 1), A, Pk, mpiCommWorld)

Hello, what do the second and last parameters mean? What is the purpose of this command?

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [June 27, 2022, 7:42am UTC](https://community.freefem.org/t/include-macro-ddm-idp/1571/8 "2022-06-27T07:42:00Z")

</div>

Do not use this macro, it’s deprecated. Use `createMat` instead.

---

<div class="post-metadata">

### Author: ![Qianrui](https://avatars.discourse-cdn.com/v4/letter/q/9fc348/32.png) [@Qianrui](https://community.freefem.org/u/Qianrui)
#### Post date: [June 27, 2022, 7:47am UTC](https://community.freefem.org/t/include-macro-ddm-idp/1571/9 "2022-06-27T07:47:52Z")

</div>

OK, thank you. In fact, I downloaded the latest version of freefem++4.11, and the examples it provides are still using this command.

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [June 27, 2022, 7:48am UTC](https://community.freefem.org/t/include-macro-ddm-idp/1571/10 "2022-06-27T07:48:58Z")

</div>

Yes, but you should not use it.

---

<div class="post-metadata">

### Author: ![Qianrui](https://avatars.discourse-cdn.com/v4/letter/q/9fc348/32.png) [@Qianrui](https://community.freefem.org/u/Qianrui)
#### Post date: [June 27, 2022, 7:51am UTC](https://community.freefem.org/t/include-macro-ddm-idp/1571/11 "2022-06-27T07:51:16Z")

</div>

Yes, thank you. What is the meaning of the createmat command? My understanding of it is not very clear. Could you please explain it?

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [June 27, 2022, 7:53am UTC](https://community.freefem.org/t/include-macro-ddm-idp/1571/12 "2022-06-27T07:53:31Z")

</div>

I already told you to look at [Pierre Jolivet introduction to parallel FreeFEM part 1 - YouTube](https://www.youtube.com/watch?v=-Aw2O46V2bo) which explains the command extensively.

---

<div class="post-metadata">

### Author: ![Qianrui](https://avatars.discourse-cdn.com/v4/letter/q/9fc348/32.png) [@Qianrui](https://community.freefem.org/u/Qianrui)
#### Post date: [June 27, 2022, 7:55am UTC](https://community.freefem.org/t/include-macro-ddm-idp/1571/13 "2022-06-27T07:55:21Z")

</div>

OK, thanks. Maybe it’s because the video is in French. I’m not very clear. I suggest you write a guide to parallel versions. thank you very much indeed

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [June 27, 2022, 7:59am UTC](https://community.freefem.org/t/include-macro-ddm-idp/1571/14 "2022-06-27T07:59:57Z")

</div>

The video is in English. This is proof that you didn’t even open it.

---

<div class="post-metadata">

### Author: ![Qianrui](https://avatars.discourse-cdn.com/v4/letter/q/9fc348/32.png) [@Qianrui](https://community.freefem.org/u/Qianrui)
#### Post date: [September 2, 2022, 1:50pm UTC](https://community.freefem.org/t/include-macro-ddm-idp/1571/15 "2022-09-02T13:50:20Z")

</div>

> mesh Th = square(getARGV(“-global”, 30), getARGV(“-global”, 30));  
> bool adaptation = usedARGV(“-adaptation”) != -1;  
> macro Pk() [P2, P2, P1, P1]；  
> real[int] D;  
> int[int][int] intersection;  
> mesh ThBackup;  
> {  
> if(adaptation)  
> ThBackup = Th;  
> int s = getARGV(“-split”, 1);  
> build(Th, s, intersection, D, Pk, mpiCommWorld)  
> }

Hello, is this command  
**build(Th, s, intersection, D, Pk, mpiCommWorld)**  
mainly for grid construction?
