[petsc-dev] code duplication in snes ex12.c

Geoffrey Irving irving at naml.us
Thu Nov 14 16:01:52 CST 2013


On Thu, Nov 14, 2013 at 1:03 PM, Matthew Knepley <knepley at gmail.com> wrote:
> On Thu, Nov 14, 2013 at 2:01 PM, Geoffrey Irving <irving at naml.us> wrote:
>>
>> The SetupElement, SetupMaterialElement, and SetupBdElement functions
>> are almost entirely duplicates of each other:
>>
>>     ./src/snes/examples/tutorials/ex12.c
>>
>> This makes it a bit difficult to understand what's going on: I'm new
>> the code, so I had to run a diff to confirm that the boundary spaces
>> are allocated identically to the interior spaces (I naively expected a
>> difference, but it's apparently elsewhere in the code).
>>
>> Are there any objections to me refactoring the code a bit to avoid the
>> duplication?
>
>
> No, however it would be nice to verify that the current tests run:
>
>   ./config/builder2.py check src/snes/examples/tutorials/ex12.c

They don't, but I haven't started changing anything yet.  mpiexec
fails with a exceedingly unhelpful usage message (below).  The test
seems to run fine if I use mpirun directory.  I'm on openmpi 1.4.5.
The problem appears to be the "-hosts" option: it also runs fine with
mpiexec if I remove "-hosts localhost".

Geoffrey

---------------------------------

cayley:petsc% mpiexec -hosts localhost -n 1 --
/home/irving/petsc/debug/lib/ex12-obj/ex12 -run_type test
-refinement_limit 0.0    -bc_type dirichlet -interpolate 0
-petscspace_order 1 -show_initial -dm_plex_print_fem 1
mpiexec (OpenRTE) 1.4.5

Usage: mpiexec [OPTION]...  [PROGRAM]...
...



More information about the petsc-dev mailing list