Giter Club home page Giter Club logo

Comments (5)

github-actions avatar github-actions commented on August 19, 2024

Stale issue message

from seacas.

bourdin avatar bourdin commented on August 19, 2024

I need these functions as well, so I will write the fortran wrappers. Do I understand correctly that they are located in packages/seacas/libraries/exodus_for/src/*.c Is there a preferred choice for the fortran names?

from seacas.

gsjaardema avatar gsjaardema commented on August 19, 2024

No preferred choice... At the time they were originally written there was some perhaps unjustified need / desire to keep them around 6 or 8 characters or less which gives some very strange names; especially since they all start with ex

from seacas.

gsjaardema avatar gsjaardema commented on August 19, 2024

OK, the reason for this is historical. A long time ago, we had regular fortran code with 4-byte ints and 4-byte reals. We decided that an "easy" way to increase the precision/capacity of the codes was to use a compiler directive that would change all of the fortran ints and reals to 8-byte quantities. This is -fdefault-real-8 and -fdefault-integer-8 for gfortran.

This worked very nicely until we needed to link Fortran and C since the C had default 4-byte ints and 4/8-byte reals. So, we came up with the addrwrap.F concept. If Build64 is defined, then we compile the routines in addrwrap.F (so exppv will be resolved in addrwrap.o). The exppv in addrwrap will convert the integers from 8-bytes to 4-bytes and then call through to the routine exppv4 in exo_jack.c which then calls through to the actual ex_put_partial_var in the C API.

If Build64 is not defined, then addrwrap.o contains nothing and the exppv is resolved from exo_jack.c...

So, the routine in addrwrap "just" needs to convert 8-byte ints to 4-byte ints on the call and 4-byte returned ints to 8-byte ints on the return (typically ierr).

This was all working fine and then we decided to support 8-byte integers for some values in the C API... These are indicated by the void_int* in the exo_jack.c and C API. They are actually easier to handle since they don't need to be converted 8byte-4byte-8byte...

There is a similar discussion at https://github.com/sandialabs/seacas/wiki/Exodus-Fortran-Strangeness.

Hopefully this helps... Basically, I always write the exo_jack version first and then the addrwap version handles the integers 4-8-4 conversions. There are macros F2C which take care of adding the 4 and the _ to the names in exo_jack if needed.

from seacas.

gsjaardema avatar gsjaardema commented on August 19, 2024

This should be closed via #321

from seacas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.