Dear Lisandro, > I'm not completelly sure what are you actually trying to do. It seems > you know how to actually compute the local Schur complement in a > entry-by-entry basis. In that case, your way is semms to be OK.
What do you mean with entry-by-entry basis? Anyway, I have the local Schur complement explicitely, in form of a matrix (or C++ vector). > However, you get a error because of a inner implementation detail of > MATIS. Do de following: set the local-to-global mapping AFTER setting > the matrix type. This way, your code should now work. Unfortunately, changing the order of the Mat-commands gives me the same error. I guess I found the origin of the problem: I put it in the order below because I thought to avoid [2]PETSC ERROR: Sum of local lengths 3916 does not equal global length 1958 which is due to the fact that in the case of 2 Subdomains and 2 processors, e.g., it is NPb=NPb_tot in the Schur system, instead of NPb=NPb_tot/2. However, I realize just now that the order of the Mat-commands has no influence on this, and that the error mentioned below has probably its origin there. I have chosen MATIS because in the manual page of MatCreateIS() it is written "...m and n are NOT related to the size of the map", but maybe I understand this setence wrong? How can I choose m,n and M,N independently? > On 3/17/08, Kathrin Burckhardt <tribur at vision.ee.ethz.ch> wrote: >> Dear all, >> >> My problem, once again and more concrete: >> >> I have given the local Schur matrices Si and I would like to set-up the >> global matrix S without assembling the Si on one processor. >> >> I thought "MATIS" is the suitable matrix type, but I don't succeed in >> using it. My code is: >> >> IS is; >> ISCreateGeneral(PETSC_COMM_SELF, NPb, &uBId_global[0], &is); >> ISLocalToGlobalMapping mapping; >> ISLocalToGlobalMappingCreateIS(is, &mapping); >> Mat Stot; >> MatCreate(PETSC_COMM_WORLD,&Stot); >> MatSetLocalToGlobalMapping(Stot, mapping); >> MatSetSizes(Stot,NPb,NPb,NPb_tot,NPb_tot); >> MatSetType(Stot,MATIS); >> //or, alternatively >> //MatCreateIS(PETSC_COMM_WORLD,NPb,NPb,NPb_tot,NPb_tot,mapping,&Stot); >> for(int i=0; i<NPb; i++) >> for(int j=0; j<NPb; j++) >> MatSetValuesLocal(Stot, 1, &i, 1, &j, &S(i+1,j+1), ADD_VALUES); >> >> And I got the error >> >> [1]PETSC ERROR: MatSetValuesLocal() line 1471 in >> src/mat/interface/matrix.c >> [1]PETSC ERROR: --------------------- Error Message >> ------------------------------------ >> [1]PETSC ERROR: Object is in wrong state! >> [1]PETSC ERROR: Object Type not set: Argument # 1! >> >> Can you tell me what's wrong? >> >> >> > > >
