Giter Site home page Giter Site logo

Comments (3)

wsmorgan avatar wsmorgan commented on July 25, 2024

Getting the input and outputs into a single file would be very nice except for the fact that if we went that way the only way we would be able to build input files for our unit tests would be to use fortpy. This would be inconvenient when we use things like mathematica to develop unit tests (which I have been doing for some of subroutines I've been testing). So even if it's less convenient I think the more generally accessible option is to use the first option and save/read the array's in slices.

Another possible option would be to have fortpy support either format, HDF5 or slices and have the user add a modifier to the input/output tag that would tell it which of the two it needed to use.

from fortpy.

rosenbrockc avatar rosenbrockc commented on July 25, 2024

For the short term, we are going to just handle the arrays in plain text and leave the HDF5 for now. We will reserve the double pound symbol ## as the indicator for array shaping information. This is how it will work:

## 3 2 2
## 1,:,:
0 1
1 0
## 2,:,:
-1 1
1 -1
## 3,:,:
2 3
4 5
  • The first line specifies the total shape of the array that can be used for allocating it in memory. It is just a list of the dimensions in the order that they would be entered in Fortran directly.
  • The multi-dimensional array is specified in blocks of 2D arrays. Each 2D array block should be preceded by the index specifying where its data should be copied. Fortpy will splice the exact form of the index into the variable name on the left of the assignment. variable(3,:,:) = read(values).

This file format should be able to handle arrays of any dimension. In order to implement this, we will need:

  1. Additions to the interfaces fpy_read, fpy_read_p and fpy_read_f that accept variables of dimensions 3 through 7 (which is the maximum supported dimensionality in fortran).
  2. Additions to the fpy_save interface for dimensions 3 through 7 that writes out in this format.
  3. A new file template for integer.xml and float.xml that handle the multi-D format.

At this point, it may be worthwhile to write a python module that can create the fortpy.f90 file without making errors. Then we will have uniformity across the implementation when the only differences are adding/removing allocatable or pointer modifiers. This will also allow the problem with logical not being supported to be addressed easily as well as complex types in the future, where the values have to be separated in real and imaginary parts.

from fortpy.

rosenbrockc avatar rosenbrockc commented on July 25, 2024

Support available from Revision 1.6.0

from fortpy.

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.