Hi all,
First, I have to apologize for I lack some experience on this subject, I have
tried looking around to solve my issue without much success.
I am assembling a 3D Laplacian matrix on a DMDA using MatSetValuesStencil. The
following code, which inserts one row at a time, works as expected:
for (PetscInt iz = info.zs; iz < info.zs + info.zm; ++iz) {
for (PetscInt iy = info.ys; iy < info.ys + info.ym; ++iy) {
for (PetscInt ix = info.xs; ix < info.xs + info.xm; ++ix) {
const std::array<MatStencil, 1> rows{MatStencil{iz, iy, ix, 0}};
const std::array<MatStencil, 7> cols{{
{iz, iy, ix, 0},
{iz, iy, ix - 1, 0},
{iz, iy, ix + 1, 0},
{iz, iy - 1, ix, 0},
{iz, iy + 1, ix, 0},
{iz - 1, iy, ix, 0},
{iz + 1, iy, ix, 0}
}};
CHKERRQ(MatSetValuesStencil(matrix_A,
rows.size(), rows.data(),
cols.size(), cols.data(),
laplacian.data(), INSERT_VALUES));
}
}
}
How would you batch the whole x dimension as a single MatSetValuesStencil call
?
Each time I try, I endup getting errors such as:
Inserting a new nonzero at global row/column (..., ...) into matrix
Regards,
--
Etienne Malaboeuf
Ingénieur de recherche HPC, Département Calcul Intensif (DCI)
Centre Informatique National de l'Enseignement Supérieur (CINES)
950 rue de Saint Priest, 34097 Montpellier
tel : (334) 67 14 14 02
web :
https://urldefense.us/v3/__https://www.cines.fr__;!!G_uCfscf7eWS!dEs8i8p3qAHap5UIsgKxq7Nfj5KU_Mvp9mYj2fNWI5QwZEW8qEuMqPCDekMeZYZHxKcIdmfpIl-BxaWBE-6j-BIpOA$
|
https://urldefense.us/v3/__https://dci.dci-gitlab.cines.fr/webextranet__;!!G_uCfscf7eWS!dEs8i8p3qAHap5UIsgKxq7Nfj5KU_Mvp9mYj2fNWI5QwZEW8qEuMqPCDekMeZYZHxKcIdmfpIl-BxaWBE-6NNu-h_Q$