[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PETSc-FUN3D Code
- To: petsc-dev@xxxxxxxxxxx
- Subject: Re: PETSc-FUN3D Code
- From: "Matthew Knepley" <knepley@xxxxxxxxx>
- Date: Sun, 21 Oct 2007 07:55:27 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=bKrW1m+oRn4JZMHkykxQm7rhqxs+YX1prqiRA3BMxdw=; b=JXxM9tvJBAJ5a0oi/93G59ZbTkypVSUwBu9Eho9QW6/rFdzxhOcYwH6lqySyTOVbz64W24I3snS9FaJm3MzYgXIxCcf73QM/6ktBQCA4HJC4rjqAVzXJ2sXjMZWYs//mmOG/V1gcOHNeYfVFyn905Ovl7zEAaNYyLcgi0eWOmqg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=PTz96rnYuL98/hRMhFJGW/H70RfbLY4RXEl9MSrv4QI7qDShnWDozpmPn0JpPTeCjbXOwfmfl87slHjZZFEiqB69P6YF5stV4PKfXG4mVuyGxi/hwvzIrSeqhAE+kizOTl8W/aMRm7aIrl2Zq5yfkA0CXUhoJOExeKqnmCehNBs=
- In-reply-to: <Pine.LNX.4.64.0710201928420.6402@asterix>
- References: <4718B5F6.3040301@mcs.anl.gov> <Pine.LNX.4.64.0710191328580.3920@asterix> <Pine.LNX.4.64.0710191359050.3920@asterix> <Pine.LNX.4.64.0710191422350.3920@asterix> <Pine.LNX.4.64.0710191438470.3920@asterix> <47193D94.5020600@mcs.anl.gov> <Pine.LNX.4.64.0710201047000.3920@asterix> <Pine.OSX.4.64.0710201647200.14706@bsmith.mcs.anl.gov> <a9f269830710201500i65c0085p40b5d3d4ee7eca37@mail.gmail.com> <Pine.LNX.4.64.0710201928420.6402@asterix>
- Reply-to: petsc-dev@xxxxxxxxxxx
- Sender: owner-petsc-dev@xxxxxxxxxxx
On 10/20/07, Satish Balay <balay@xxxxxxxxxxx> wrote:
> Matt,
>
> The primary problem here is:
>
> we have size_t in prototypes - for eg:
>
> PetscErrorCode PetscMemzero(void *a,size_t n);
>
> So, when this routine is called from fortran - what datatype should
> user-fortran-code use? Currently there is no equivalent for size_t.
> [integer and size_t don't match on 64bit machines]
>
> My proposal is to have PetscSizeT [atleast on the fortran side - that
> is set properly - simlar to PetscFortranAddr].
>
> And we normally have types match on both fortran & c - so should we
> use it for C-side aswell?
I would rather run the logic backwards. In my opinion, typedefing size_t in
C is the correct solution and leaves you with sane looking code. Fortran is
the problem here. So define a type size_t in Fortran as well.
Matt
> PetscErrorCode PetscMemzero(void *a,PetscSizeT n);
>
> BTW: This requires configure to set PETSC_SIZEOF_SIZE_T. [I've added
> in this check]. But as you say - if size_t is not in system include
> files - configure typedefs it. But I'm not sure if PETSC_SIZEOF_SIZE_T
> test will compile in this case. [typdefs set by configure don't appear
> to be used in checkSizeof() test.
>
> Satish
>
>
> On Sat, 20 Oct 2007, Matthew Knepley wrote:
>
> > I actually like the autoconf solution. If the type is not found (size_t)
> > then just typedef it as something.
> >
> > Matt
> >
> > On 10/20/07, Barry Smith <bsmith@xxxxxxxxxxx> wrote:
> > >
> > > Satish,
> > >
> > > I don't know; there are pros and cons to the two
> > > approaches.
> > >
> > > Why not PetscSize_T? I admit both look stupid, but the
> > > _ at least matches the standard C style.
> > >
> > > Any comments from the community?
> > >
> > > Barry
> > >
> > >
> > >
> > > I would like to keep size_t as the argument
> > >
> > > On Sat, 20 Oct 2007, Satish Balay wrote:
> > >
> > > > On Fri, 19 Oct 2007, Dinesh Kaushik wrote:
> > > >
> > > > > > > Perhaps need a PetscSizeT or some new datatype for this purpose that
> > > > > > > gets set correct for both C & fortran side..
> > > >
> > > > Barry,
> > > >
> > > > Is it ok to do this change? The prototypes of the following functions
> > > > will need to be changed to use PetscSizeT instead of size_t;
> > > >
> > > > [alternative is to use size_t on the C side - but PetscSizeT on the
> > > > fortran side - but this is inconsistant]
> > > >
> > > > thanks,
> > > > Satish
> > > >
> > > > -------------------
> > > > PetscBagCreate
> > > > PetscFileRetrieve
> > > > PetscGetArchType
> > > > PetscGetDate
> > > > PetscGetDisplay
> > > > PetscGetFullPath
> > > > PetscGetHomeDirectory
> > > > PetscGetHostName
> > > > PetscGetProgramName
> > > > PetscGetRelativePath
> > > > PetscGetTmp
> > > > PetscGetUserName
> > > > PetscGetWorkingDirectory
> > > > PetscLs
> > > > PetscMalloc
> > > > PetscMalloc2
> > > > PetscMalloc3
> > > > PetscMalloc4
> > > > PetscMalloc5
> > > > PetscMalloc6
> > > > PetscMalloc7
> > > > PetscMemcmp
> > > > PetscMemcpy
> > > > PetscMemmove
> > > > PetscMemzero
> > > > PetscOptionsGetenv
> > > > PetscOptionsGetString
> > > > PetscOptionsString
> > > > PetscSetMalloc
> > > > PetscSNPrintf
> > > > PetscStrlen
> > > > PetscStrncat
> > > > PetscStrncmp
> > > > PetscStrncpy
> > > > PetscStrreplace
> > > > PetscSynchronizedFGets
> > > > PetscVSNPrintf
> > > >
> > > >
> > >
> > >
> >
> >
> >
>
>
--
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