...
CHEAT SHEET | ||
ITM | IMAS | |
---|---|---|
use euitm_schemas | use ids_schemas | |
use euitm_routines | use ids_routines | |
type (type_<cpo_name>) :: cpo | type (ids_<ids_name>) :: ids | |
type (type_<cpo_name>), pointer :: cpoArray(:) ! <= ArrayARRAY !!! | type (ids_<ids_name>) :: ids <== SINGLE OBJ !!! | |
eval-pkg-config | pkg-config | |
eval-pkg-config --cflags --libs ual-ifort | pkg-config --cflags --libs imas-ifort | |
eval-pkg-config --cflags --libs ual-gfortran | pkg-config --cflags --libs imas-gfortran | |
type(type_param) :: XML_params | type(ids_parameters_input ) :: XML_params | |
type ids_parameters_input ! Code parameters block passed from the wrapper to the subroutine. Does not appear as such in the data structure. This is inserted i1366 character(len=132), dimension(:), pointer ::parameters_value => null() ! /parameters_input/parameters_value - Actual value of the code parameters (instance of Code_Parameters/Parameters in XML format) 1367 character(len=132), dimension(:), pointer ::parameters_default => null() ! /parameters_input/parameters_default - Default value of the code parameters (instance of Code_Parameters/Parameters in XML format) 1368 character(len=132), dimension(:), pointer ::schema => null() ! /parameters_input/schema - Code parameters schema 1369 endtype
| type_param ... :: default_param ... :: schema | type ids_parameters_input ... :: parameters_value ... :: parameters_default ... :: schema endtype |
eval-pkg-config | pkg-config | |
eval-pkg-config --cflags ual-ifort | pkg-config --cflags imas-ifort | |
eval-pkg-config --cflags ual-gfortran | pkg-config --cflags imas-gfortran |
4.2.2 Examples
Examples of interface between wrapper and user code | |||||
---|---|---|---|---|---|
ITM
| IMAS
|
...
The user code should be delivered as a static library.
Please find examples of the simple "Makefile" below:
2.1 Subroutine syntax
subroutine name ( <in/out arguments list> [,code_parameters] [,diagnostic_info] )
...
2.2. Arguments list
- A mandatory position
- A list of input and output subroutine arguments including:
- Fortran intrisic data types, eg:
integer :: input
character(50) :: charstring
integer,dimension(4) :: tabint
- IDSes, eg:
type (type_equilibrium),pointer :: equilibriumin(:)
type (type_distsource),pointer :: distsourceout(:)
- Fortran intrisic data types, eg:
Warning |
---|
|
2.3. Code parameters
...
Argument of type: type_param
Code Block |
---|
type type_param !
character(len=132), dimension(:), pointer ::parameters
character(len=132), dimension(:), pointer ::default_param
character(len=132), dimension(:), pointer ::schema
endtype |
...
parameters
- Actual value of the code parameters (instance of coparam/parameters in XML format).default_param
- Default value of the code parameters (instance of coparam/parameters in XML format).schema
- Code parameters schema.
...
:
...
(type_param) :: codeparam
{{
2.5. Examples
...
Code Block | title | Example 3 Usage of
---|
Code Block |
subroutine teststring(coreprof,equi,tabint,tabchar,codeparam)
use imas_schemas
implicit none
!input
type(type_coreprof),pointer,dimension(:) :: coreprof
integer, dimension(4), intent(in) :: tabint
!output
type(type_equilibrium),pointer,dimension(:) :: equi
character(50), intent(out) :: tabchar
!code parameters
type(type_param), intent(in) :: codeparam |
4. Delivery of the user code
The user code should be delivered as a static library.
Please find examples of the simple "makefiles" below:
Code Block | ||||
---|---|---|---|---|
| ||||
F90 = $(ITM_INTEL_FC)ifort COPTS = -g -O0 -assume no2underscore -fPIC -shared-intel INCLUDES = $(shell eval-pkg-config --cflags ual-$(ITM_INTEL_OBJECTCODE)imas-ifort) all: equilibrium2distsource.o libequilibrium2distsource libequilibrium2distsource: equilibrium2distsource.o ar -rvs libequilibrium2distsource.a equilibrium2distsource.o equilibrium2distsource.o: equilibrium2distsource.f90 $(F90) $(COPTS) -c -o $@ $^ ${INCLUDES} clean: rm -f *.o *.a |
Tip |
---|
Recomendations
|
...