This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Use functions "getitem" and "setitem" for parallel computing

0 votes

Hi!

I modify the matrix and vector. For this purpose the functions "setitem" and "getitem" is used:

std::pair<dolfin::la_index, dolfin::la_index> ij;

assemble(A, a);
assemble(b, L);

ij.first = dof1; ij.second = dof2;

double g1 = n1 + b.getitem(dof1);
b.setitem(dof1, g1);
b.apply("insert");

double g2 = n2 + A.getitem(ij);
A.setitem(ij, g2);
A.apply("insert");

But while solving the problem parallel an "error" message is thrown. How can I use the functions in other way? Or is there any alternative for the functions?

Error:

*** -------------------------------------------------------------------------
*** Error:   Unable to successfully call PETSc function 'MatGetValues'.
*** Reason:  PETSc error code is: 56.
*** Where:   This error was encountered inside /build/dolfin-MrPRLD/dolfin-1.6.0/dolfin /la/PETScMatrix.cpp.
*** Process: 1
*** 
*** DOLFIN version: 1.6.0
*** Git changeset:  unknown
*** -------------------------------------------------------------------------

Please help!

Thank you!

asked Oct 11, 2016 by djulustan FEniCS Novice (120 points)
...