Comments (3)
OK, I have found the solution for the ATLAS State that I am finally using:
- in C++ :
- declare a State pointer:
State * state = new State(...)
- pass it to the Fortran function:
my_fortran_subroutine_f90(state, ...)
- in the C interface: pass the State pointer
extern "C" {
void my_fortran_subroutine_f90(State * state, ...);
}
- in Fortran: get the State pointer as a
type(c_ptr)
and use it to initialize atype(atlas_state)
:
subroutine my_fortran_subroutine_c(state_ptr,...) bind (c,name='my_fortran_function_f90')
type(c_ptr),intent(in),value :: state_ptr
type(atlas_state) :: state
state = atlas_state(state_ptr)
end subroutine my_fortran_subroutine_c
Maybe it would be worth adding an example in the documentation. Not a top priority though...
from atlas.
Hi @benjaminmenetrier I'm happy you figured it out.
Perhaps I could advise to you to use atlas_FieldSet instead of atlas_State?
The State
is more of an experimental tryout I once did to show Yannick Tremolet what is possible.
Conceptually it is the same as a FieldSet
with the difference that it could be constructed from a configuration as shown experimentally here:
https://github.com/ecmwf/atlas/blob/0.19.0/src/tests/grid/test_state.cc#L137
If you don't need that, then you could probably use FieldSet
instead, as that is more widespread used in API's, and maintained.
from atlas.
Thank you for the tip! I'll switch to FieldSet now, before the use of State is too widespread in the code...
from atlas.
Related Issues (20)
- Regional matching mesh partitioning HOT 2
- Set UnstructuredGrid in meshes built by MeshBuilder HOT 9
- Ctest failure in atlas_fctest_trans HOT 1
- Adding robust vector-field interpolation functionality (current PR and further work). HOT 1
- `Field.levels()` is expensive HOT 3
- Interpolation::NonLinear datatype incompatible with atlas::Fieldsets of heterogeneous types HOT 1
- StructuredColumns `FixupHaloForVectors` method interferes with `SphericalVector` interpolation HOT 7
- Cannot find ectrans header HOT 4
- Improve performance of missing-values-containing field interpolation
- Outermost mpi::Scope does not restore prior communicator HOT 8
- Using serial Partitioner on multiple ranks leads to unexpected duplication of FunctionSpace HOT 3
- Failed to find nvcc. HOT 2
- Compile failure with NAG HOT 1
- Risk of surprising behavior when adding multiple Fields of same name into FieldSet HOT 10
- Missing halos after calling build_halo on a "structured" mesh HOT 2
- Failure in atlas_test_trans HOT 1
- Some interpolators fail with zero-sized target functionspace.
- Some issues with NAG compiler
- The test "atlas_fctest_field_host" fails with "ENABLE_CUDA" build option HOT 2
- Allow vector interpolation methods to pack and unpack vector fields.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atlas.