[petsc-dev] Patch for ksp tutorial ex56

Sascha Schnepp mail at saschaschnepp.net
Tue Mar 10 18:08:39 CDT 2015


Hong,
I do not have an immediate explanation for this. In particular, I wonder why
there is no line break after 'sp=/' in this line:
> file = 0x0, sp=/,fname=/Users/Hong/soft/petsc/
but line breaks in the file path.

On my machine I tested with make runex56, too. I will look at this again tomorrow.
Can anyone else confirm this issue?

Sascha



On 10 Mar 2015, at 22:22, Hong <hzhang at mcs.anl.gov> wrote:

> Sascha:
> I prepared a patch regarding the reading of the data file in ksp tutorial ex56.
> It sets the path to the data file required for running the example relative to PETSC_DIR
> instead of relative to the tutorials folder to allow running the example from any folder.
> 
> Also, I used PETSC_DIR_SEPARATOR instead of the currently hard coded ‘/‘
> so that the code would also run on a windows machine … if anyone cared.
> This fails on my MacPro by running 'make runex56':
> 
> file = 0x0, sp=/,fname=/Users/Hong/soft/petsc/
> src/
> ksp/
> ksp/
> examples/
> tutorials/
> data/
> elem_3d_elast_v_25.txt
>         main failed to open input file '/Users/Hong/soft/petsc/
> 
> I added 
> file = fopen(fname, "r");
>       printf("file = %p, sp=%s,fname=%s\n",file,sp,fname);
>       if (file == 0) {
> 
> as you see, 'sp=/' is followed by a 'new line'.
> I do not see this behavior on other machines, e.g., linux or an old iMac.
> Any suggestion?
> 
> Hong
>  
> 
> Please discard the patch if you do not want to change the current behavior.
> 
> Best,
> Sascha
> 
> 




More information about the petsc-dev mailing list