[petsc-dev] PetscFindInt

Matthew Knepley knepley at gmail.com
Sat Sep 22 16:10:56 CDT 2012


On Sat, Sep 22, 2012 at 5:06 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> On Sat, Sep 22, 2012 at 3:56 PM, Matthew Knepley <knepley at gmail.com>wrote:
>
>> I was not sure that would work, but of course I tried it before pushing:
>>
>
> Try a C compiler or clang++. It's working for you due to a g++ bug.
>
> Don't bother fixing it. I'm going to inline this routine anyway because I
> want to be able to use it in MatSetValues where we don't want to have to
> save registers to do the search.
>
> To make it more useful, should we return the location that the new item
> would go?
>
> So if we search for 5 in [2,4,7,8], we return -3. The calling user code
> would look like
>
> PetscFindInt(...,&loc);
> if (loc < 0) insert_at = -(loc+1);
>
> Or a different routine for that purpose?
>

I am fine with overloading the return value. It won't change how I use it.

   Matt


>
>>   Compiling C files
>> ['/PETSc3/petsc/petsc-dev-pylith/src/sys/utils/sorti.c']
>>         Pushing language Cxx
>> /PETSc3/petsc/petsc-dev-pylith/arch-sieve-fdatatypes-debug/bin/mpicxx -c
>> -I/PETSc3/petsc/petsc-dev-pylith/arch-sieve-fdatatypes-debug/include
>> -I/PETSc3/petsc/petsc-dev-pylith/include
>> -I/PETSc3/petsc/petsc-dev-pylith/arch-sieve-fdatatypes-debug/include
>> -I/PETSc3/petsc/petsc-dev-pylith/include/sieve
>> -I/PETSc3/petsc/exodusii-4.98/include
>> -I/PETSc3/petsc/exodusii-4.98/cbind/include
>> -I/PETSc3/petsc/exodusii-4.98/forbind/include   -Wall -Wwrite-strings
>> -Wno-strict-aliasing -Wno-unknown-pragmas -g  -PIC      -MMD -D__INSDIR__=
>> /PETSc3/petsc/petsc-dev-pylith/src/sys/utils/sorti.c
>> sh: /PETSc3/petsc/petsc-dev-pylith/arch-sieve-fdatatypes-debug/bin/mpicxx
>> -c -I/PETSc3/petsc/petsc-dev-pylith/arch-sieve-fdatatypes-debug/include
>> -I/PETSc3/petsc/petsc-dev-pylith/include
>> -I/PETSc3/petsc/petsc-dev-pylith/arch-sieve-fdatatypes-debug/include
>> -I/PETSc3/petsc/petsc-dev-pylith/include/sieve
>> -I/PETSc3/petsc/exodusii-4.98/include
>> -I/PETSc3/petsc/exodusii-4.98/cbind/include
>> -I/PETSc3/petsc/exodusii-4.98/forbind/include   -Wall -Wwrite-strings
>> -Wno-strict-aliasing -Wno-unknown-pragmas -g  -PIC      -MMD -D__INSDIR__=
>> /PETSc3/petsc/petsc-dev-pylith/src/sys/utils/sorti.c
>> Executing:
>> /PETSc3/petsc/petsc-dev-pylith/arch-sieve-fdatatypes-debug/bin/mpicxx -c
>> -I/PETSc3/petsc/petsc-dev-pylith/arch-sieve-fdatatypes-debug/include
>> -I/PETSc3/petsc/petsc-dev-pylith/include
>> -I/PETSc3/petsc/petsc-dev-pylith/arch-sieve-fdatatypes-debug/include
>> -I/PETSc3/petsc/petsc-dev-pylith/include/sieve
>> -I/PETSc3/petsc/exodusii-4.98/include
>> -I/PETSc3/petsc/exodusii-4.98/cbind/include
>> -I/PETSc3/petsc/exodusii-4.98/forbind/include   -Wall -Wwrite-strings
>> -Wno-strict-aliasing -Wno-unknown-pragmas -g  -PIC      -MMD -D__INSDIR__=
>> /PETSc3/petsc/petsc-dev-pylith/src/sys/utils/sorti.c
>> sh:
>>         Popping language Cxx
>>         Moving sorti.o to
>> /PETSc3/petsc/petsc-dev-pylith/arch-sieve-fdatatypes-debug/lib/libpetsc-obj/sorti.o
>>         Moving sorti.d to
>> /PETSc3/petsc/petsc-dev-pylith/arch-sieve-fdatatypes-debug/lib/libpetsc-obj/sorti.d
>>
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120922/5ed6f838/attachment.html>


More information about the petsc-dev mailing list