FreeFem / FreeFem-sources

FreeFEM source code
https://freefem.org/
Other
796 stars 193 forks source link

Split s=2 result in runtime error in macro build() in macro_ddm.idp #229

Closed abaikin closed 2 years ago

abaikin commented 2 years ago

Dear Pierre @prj- , in early versions of macro_ddm.idp script there was a good feature that enabled to split mesh during partitioning.

In ver. 4.11 build script generates an error for s > 1. See below

load "PETSc"                       

/* PETSc Prerequisites */
macro dimension()2// EOM            // 2D or 3D

include "macro_ddm.idp"             // additional DDM functions

mesh Th = square(20, 10);

int[int][int] intersection;
real[int] D;
int split = 2;
build(Th, split, intersection, D, P1, mpiCommWorld);

plot(Th);

Console output

Out of Bound x=y(I)  :  0 <= 4 < 959< 400
 or I.N() 880 > 880
  current line = 216 mpirank 1 / 2
Exec error : Out of Bound error
   -- number :1
 err code 8 ,  mpirank 1
 Out of Bound x=y(I)  :  0 <= 0 < 963< 400
 or I.N() 888 > 888
  current line = 216 mpirank 0 / 2
Exec error : Out of Bound error
   -- number :1
Exec error : Out of Bound error
   -- number :1
 err code 8 ,  mpirank 0

Is there a way to fix it?

prj- commented 2 years ago

Thanks for reporting this. Could you try https://github.com/FreeFem/FreeFem-sources/commit/c7b2f62a5eb9d431798a15eb23f51cce4cda721a and let me know if this solves your problem? Again, you really shouldn't use these low-level functions anymore, best to use createMat, buildDmesh, and co.

abaikin commented 2 years ago

@prj- Thank you. It solves the problem.

Yes, I tried the new interface. And it is really convinient and common. Could you please also add buildDmesh , createMat and createPartition with split parameter? For huge problems it helps to save computational resources during the mesh creation.

Also, just a feature request: in some cases for a debug purpose it would be useful to access intersection array generated in createMat or createPartition.