LECAS Dimitri dimitri.lecas at
Wed Aug 6 03:54:07 CDT 2008

Quoting Matthew Knepley <knepley at>:

> 2008/7/22 LECAS Dimitri <dimitri.lecas at>:
>> Hi
>> I'am building a matrice (MPISBAIJ) in two steps, the first one i add many
>> contributions with MatSetValue and the flag ADD_VALUES, and the last step i
>> put boundary conditions using the flag INSERT_VALUES.
>> I want to understand how to use MatAssemblyBegin and MatAssemblyEnd. Do I
>> have to put between the two steps call to MatAssemblyBegin and
>> MatAssemblyEnd with MAT_FLUSH_ASSEMBLY flag and after the last step call to
>> MatAssemblyBegin and MatAssemblyEnd with MAT_FINAL_ASSEMBLY flag ?
> 1) FLUSH allows you to change the insertion mode, and flushes the   
> communication
>     buffers. FINAL does the same and compresses the matrix, etc. What
> you propose
>     should work.

Yes it's work.

> 2) If you are just setting some rows to the identity, you might
> consider MatZeroRows().

Yes, i'am just setting one in diagonal and zero for others  
extradiagonals values.
I try to use MatZero, but i have got an error saying that it's not  
possible to call this with MPISBAIJ matrix.

I use MatSetValue to do this but it add all zero value in the matrix  

So now, i have to build my matrix in csr, and give it to Petsc via  
MatSetValues call.

Dimitri Lecas


Ce message electronique et tous les fichiers joints qu'il contient  
(ci-apres "le message") sont confidentiels et destines exclusivement a  
l'usage des destinataires indiques ou des personnes dument habilitees  
a les recevoir a leur place.

Si vous recevez ce message par erreur, merci de bien vouloir le  
detruire et d'en avertir l'emetteur.

Toute utilisation de ce message non conforme a sa destination, toute  
diffusion ou toute publication totale ou partielle est interdite sauf  
autorisation expresse de l'emetteur.

Les idees et opinions exprimees dans ce message sont celles de son  
auteur et ne representent pas necessairement celles de CS  
Communication & Systemes ou de ses filiales.

Malgre toutes les dispositions prises par CS Communication & Systemes  
et ses filiales pour minimiser les risques de virus, les fichiers  
joints a ce message peuvent contenir des virus qui pourraient  
endommager votre systeme informatique. Il vous appartient d'effectuer  
vos propres controles anti-virus avant d'ouvrir les fichiers joints.  
CS Communication & Systemes et ses filiales declinent toute  
responsabilite pour toute perte ou dommage resultant de l'utilisation  
de ce message et/ou des fichiers joints.

This e-mail and any file attached hereto (hereinafter 'the e-mail')  
are confidential and intended solely for the use of the adressees  
indicated below or the persons duly entitled to receive them in their  

If you receive this e-mail in error, please delete it and notify the sender.

Any use of this e-mail not in accordance with its purpose, any  
dissemination or disclosure, either whole or partial, is prohibited,  
unless formally approved by the sender.

The ideas or opinions expressed in this e-mail are solely those of its  
author and do not necessarily represent those of CS Communication &  
Systeme or its affiliates.

Despite all the measures taken by CS Communication & Systeme and its  
affiliates in order to minimize the risks of virus, the files attached  
to this e-mail may contain virus which could damage your information  
system. You are responsible for processing your own anti-virus  
checking before opening any file attached hereto. Neither CS  
Communication & Systemes, nor its affiliates, shall be held liable for  
any loss or damage due to the use of this e-mail or any file attached  

More information about the petsc-users mailing list