[petsc-users] Question on re-coding ex29

Alan Wei zhenglun.wei at gmail.com
Fri Jul 29 14:51:18 CDT 2011


Problem resolved. Thank you so much, John.

best,
Alan

On Thu, Jul 28, 2011 at 1:42 PM, John Chludzinski <jchludzinski at gmail.com>wrote:

> In ComputeRHS.h use:
>
> #ifndef _COMPURERHS_H
> #define _COMPURERHS_H
>
> PetscErrorCode ComputeRHS(DMMG dmmg, Vec b);
>
> #endif
>
> ---John
>
>
> On Thu, Jul 28, 2011 at 11:22 AM, Alan Wei <zhenglun.wei at gmail.com> wrote:
>
>> Thanks, John. However, on my opinion, one of them has been commented out.
>> ^_^
>>
>> best,
>> Alan
>>
>>
>> On Thu, Jul 28, 2011 at 12:55 AM, John Chludzinski <
>> jchludzinski at gmail.com> wrote:
>>
>>> You have:
>>>
>>> *typedef enum {DIRICHLET, NEUMANN} BCType;*
>>>
>>> twice in your source: ex29.c
>>>
>>> ---John
>>>
>>>
>>> On Wed, Jul 27, 2011 at 3:46 PM, Alan Wei <zhenglun.wei at gmail.com>
>>> wrote:
>>> > Dear John,
>>> >     Thanks for your quick reply. I think the error message says that
>>> the
>>> > BCType has some problem. However, it is originally there and I have not
>>> > changed it at all. Is that because I define it in ComputeRHS again and
>>> let
>>> > ex29.c include ComputeRHS.h so the BCtype is duplicated?
>>> >
>>> > thanks,
>>> > Alan
>>> >
>>> > On Wed, Jul 27, 2011 at 2:04 PM, John Chludzinski <
>>> jchludzinski at gmail.com>
>>> > wrote:
>>> >>
>>> >> Without wading through the attached zip file, it looks like you're
>>> missing
>>> >> some typedef's that come from a missing include file.  ---John
>>> >>
>>> >> On Wed, Jul 27, 2011 at 2:38 PM, Alan Wei <zhenglun.wei at gmail.com>
>>> wrote:
>>> >>>
>>> >>> Dear Sir/Madam,
>>> >>>     I hope you're having a nice day.
>>> >>>     I asked several questions about
>>> src/ksp/ksp/example/tutorial/ex29.c
>>> >>> before, and learned some beginning staff of PETSc. Right now, I want
>>> to
>>> >>> start to use it to my own program. Firstly, I want to isolate the
>>> ComputeRHS
>>> >>> function in ex29, which means I want to put ComputeRHS to another c
>>> program
>>> >>> file. I did that; however, some problem pop up when I compile it.
>>> >>>
>>> >>> /home/zlwei/soft/mercurial/petsc-dev/arch-linux2-c-debug/bin/mpicc -o
>>> >>> ex29.o -c -Wall -Wwrite-strings -Wno-strict-aliasing
>>> -Wno-unknown-pragmas
>>> >>> -g3 -I/home/zlwei/soft/mercurial/petsc-dev/include
>>> >>> -I/home/zlwei/soft/mercurial/petsc-dev/arch-linux2-c-debug/include
>>> >>> -I/home/zlwei/soft/mercurial/petsc-dev/src/dm/mesh/sieve
>>> >>> -D__INSDIR__=src/ksp/ksp/examples/tutorials/ ex29.c
>>> >>> ex29.c: In function ComputeRHS:
>>> >>> ex29.c:39: error: storage class specified for parameter BCType
>>> >>> ex29.c:44: error: expected specifier-qualifier-list before BCType
>>> >>> ex29.c:61: error: expected =, ,, ;, asm or __attribute__ before {
>>> token
>>> >>> ex29.c:117: error: expected =, ,, ;, asm or __attribute__ before {
>>> token
>>> >>> ex29.c:130: error: expected =, ,, ;, asm or __attribute__ before {
>>> token
>>> >>> ex29.c:197: error: expected =, ,, ;, asm or __attribute__ before {
>>> token
>>> >>> ex29.c:220: error: old-style parameter declarations in prototyped
>>> >>> function definition
>>> >>> ex29.c:220: error: expected { at end of input
>>> >>> make: [ex29.o] Error 1 (ignored)
>>> >>> /home/zlwei/soft/mercurial/petsc-dev/arch-linux2-c-debug/bin/mpicc -o
>>> >>> ComputeRHS.o -c -Wall -Wwrite-strings -Wno-strict-aliasing
>>> >>> -Wno-unknown-pragmas -g3
>>> -I/home/zlwei/soft/mercurial/petsc-dev/include
>>> >>> -I/home/zlwei/soft/mercurial/petsc-dev/arch-linux2-c-debug/include
>>> >>> -I/home/zlwei/soft/mercurial/petsc-dev/src/dm/mesh/sieve
>>> >>> -D__INSDIR__=src/ksp/ksp/examples/tutorials/ ComputeRHS.c
>>> >>> /home/zlwei/soft/mercurial/petsc-dev/arch-linux2-c-debug/bin/mpicc
>>> -Wall
>>> >>> -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -g3  -o
>>> ex29
>>> >>> ex29.o ComputeRHS.o
>>> >>> -L/home/zlwei/soft/mercurial/petsc-dev/arch-linux2-c-debug/lib
>>> -lpetsc
>>> >>>
>>> -Wl,-rpath,/home/zlwei/soft/mercurial/petsc-dev/arch-linux2-c-debug/lib
>>> >>> -lflapack -lfblas -lm -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2 -ldl
>>> -lmpich
>>> >>> -lopa -lmpl -lrt -lpthread -lgcc_s -lmpichf90 -lgfortran -lm -lm -ldl
>>> >>> -lmpich -lopa -lmpl -lrt -lpthread -lgcc_s -ldl
>>> >>> gcc: ex29.o: No such file or directory
>>> >>> make: [ex29] Error 1 (ignored)
>>> >>>
>>> >>> The program and modified makefile are attached. Could you please take
>>> a
>>> >>> look and give me some suggestions.
>>> >>>
>>> >>> best,
>>> >>> Alan
>>> >>
>>> >
>>> >
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110729/217b65fa/attachment.htm>


More information about the petsc-users mailing list