[petsc-dev] About PCFieldSplitGetSubKSP

Barry Smith bsmith at mcs.anl.gov
Sat May 7 22:34:39 CDT 2011


On May 7, 2011, at 9:12 PM, Ryan Yan wrote:

> Dear All, 
> I have a question about the function call PCFieldSplitSetFields() in the developer version.
> 
> I would like to name of each field separately, and using some
> rule based on the count of i.
> 
> For instance, I would try:
>  for (i = 0; i < m/3; i++) {
>     ierr = PCFieldSplitSetFields(pc,"0",xxx,xxx);  
>     ierr = PCFieldSplitSetFields(pc,"1",xxx,xxx);  
>   }
> 
> When m=3 this is fine, since there is only one pass, namely, '0' and '1' is fine
> When m=6, I want 4 fields. But how can I set up the name as '3' and '4' after the first pass in the loop.
> 
> I think the question is how to fill up an char[] dynamically as a integer array?

   The standard C function scanf().

  Barry

> 
> This might be a naive question, but I did not come up any way of doing it.
> 
> Many thanks,
> 
> Yan




More information about the petsc-dev mailing list