C-Fortran Interoperability Test Repo
jhamman / c-fortran-tests Goto Github PK
View Code? Open in Web Editor NEWC-Fortran Interoperability Test Repo
License: GNU General Public License v2.0
C-Fortran Interoperability Test Repo
License: GNU General Public License v2.0
@bartnijssen, @mabrunke, and @apcraig -
I have a first attempt at using the Standard Fortran and C Interoperability on the master branch of this repo. It is working on my local machine using the newest versions gcc
and gfortran
but is failing on the HPC machines that use the Intel or older versions of the GNU compilers. I'll explain why I think that is later and hopefully one of you will have an idea of why that is.
The code I have essentially tracks the desired workflow for what we want to see in the VIC/CN coupling (see UW-Hydro/VIC#174 for more information).
cn_data_struct
.cn_data_struct
as an argumentcn_data_struct
without a copy.Looking at the code in this example, here where each of those 3 steps are done:
make_cn_struct
creates and initializes an array of cn_data_struct
s.use_cn_data_struct
defines a derived type vic_cn_data_type
that matches the cn_data_struct
. The variable is defined as intent(inout)
so any changes are applied to the original memory location of cn_data_struct
.use_cn_data_struct
modifies the values of all members of the structure.Outside of this example, it would probably make sense to put the definition of vic_cn_data_type
in a MODULE
so it would be available to other subroutines.
The cn
is defined as an array of cn_data_struct
s, one for each elevation band. It seems like there is a problem passing arrays like this through the C-Fortran interoperability when you are using an assumed size
or shape
. This is the relevant line:
type(vic_cn_data_type), DIMENSION(:), intent(inout) :: cn_data
I'm sure there is a way to do this without assuming either the shape
or the size
but I wasn't able to get it to work. @mabrunke or @apcraig may have a better idea of how that could work. After all, I am passing all the relavent dimensions as arguments to the subroutine.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.