(j3.2006) Chaining type-bound procedure references

Damian Rouson sourcery
Thu May 1 14:38:43 EDT 2014


On Apr 30, 2014, at 4:37 PM, Malcolm Cohen <malcolm at nag-j.co.jp> wrote:

> 
> And it does seem like a pretty big feature that does little more than provide 
> alternative syntax for something we can do easily already.

I disagree.  In the use case I?ve been describing (user-defined operators), this feature is a key component in a whole programming paradigm developed by people like my collaborator Magne Haveraaen at the University of Bergen.  He refers to it as ?coordinate-free programming,? wherein one writes PDE solvers in a form at like

type(tensor) :: u, du_dt
real :: nu=1.
du_dt = nu*(.laplacian. u) - (u .dot. (.grad. u)) 

Magne and I are working on a framework that supports such a syntax with parallel algorithms operating on derived types containing coarray components.  (The operators produce function results with non-coarray components.)

There are lots of places where I want to expand operators such as .laplacian. into second-order partial derivatives, which, at least in a first implementation, might might be most easily implemented as the repeated application of a first derivative.  In cartesian coordinates, Laplacian result might be

laplacian_u = u%x()%x() + u%y()%y() + u%z()%z()

Fortran?s expressiveness for this style of programming is one of the main reasons I use the language and is the main reason Magne and I are collaborating.  Tom?s original suggestion would be very helpful in this regard.  Breaking this line up makes the code a lot less clear and this is especially true In more complicated coordinate systems. 

Damian



More information about the J3 mailing list