EIRAM
atomic and molecular data in form of polynomial fits
eiram_interfaces.f90
Go to the documentation of this file.
1 
5 
6 ! Copyright (c) 2016 Forschungszentrum Juelich GmbH
7 ! Markus Brenneis, Vladislav Kotov
8 !
9 ! This file is part of EIRAM.
10 !
11 ! EIRAM is free software: you can redistribute it and/or modify
12 ! it under the terms of the GNU General Public License as published by
13 ! the Free Software Foundation, either version 3 of the License, or
14 ! (at your option) any later version.
15 !
16 ! EIRAM is distributed in the hope that it will be useful,
17 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ! GNU General Public License for more details.
20 !
21 ! You should have received a copy of the GNU General Public License
22 ! along with EIRAM. If not, see <http://www.gnu.org/licenses/>.
23 !
24 
41 
43 subroutine eiram_load_wrapper(filePath, fileName, err)
44  use eiram
45  implicit none
46  character(*), intent(in) :: filePath, fileName
47  integer, intent(out) :: err
48  call eiram_load(filepath, filename, err)
49 end subroutine
50 
52 subroutine eiram_deallocate_wrapper(err)
53  use eiram
54  implicit none
55  integer, intent(out) :: err
56  call eiram_deallocate(err)
57 end subroutine
58 
60 subroutine eiram_get_id_wrapper(fileName, reactionType, reactionIndex, id, err)
61  use eiram
62  implicit none
63  character(*), intent(in) :: fileName, reactionType, reactionIndex
64  integer, intent(out) :: id, err
65  id = eiram_get_id(filename, reactiontype, reactionindex, err)
66 end subroutine
67 
69 subroutine eiram_get_order_wrapper(N,M,Id,err)
70  use eiram
71  implicit none
72  integer,intent(out) :: N,M
73  integer,intent(in) :: Id
74  integer,intent(out) :: err
75  call eiram_get_order(n,m,id,err)
76 end subroutine eiram_get_order_wrapper
77 
78 !no wrapper for eiram_create_imag because it uses data structure
79 !defined in a module
80 
81 !function eiram_fit is defined outside a module - should not need a wrapper
82 
84 function eiram_calc1_fast_wrapper(Id,lnX)
85  use eiram
86  implicit none
87  integer, intent(in) :: Id
88  real(eiram_dp), intent(in) :: lnX
89  real(eiram_dp) :: eiram_calc1_fast_wrapper
90  eiram_calc1_fast_wrapper=eiram_calc1_fast(id,lnx)
91 end function eiram_calc1_fast_wrapper
92 
94 subroutine eiram_calc1_wrapper(Y,Id,lnX,N,err)
95  use eiram
96  implicit none
97  real(eiram_dp), intent(out) :: Y(n)
98  integer, intent(in) :: Id
99  real(eiram_dp), intent(in) :: lnX(n)
100  integer, intent(out) :: err
101  integer,intent(in) :: N
102  call eiram_calc1(y,id,lnx,err)
103 end subroutine eiram_calc1_wrapper
104 
106 subroutine eiram_calc12_wrapper(B,Id,lnX,M,N,err)
107  use eiram
108  implicit none
109  real(eiram_dp), intent(out) :: B(m,n)
110  integer, intent(in) :: Id
111  real(eiram_dp), intent(in) :: lnX(n)
112  integer, intent(out) :: err
113  integer,intent(in) :: M,N
114  call eiram_calc12(b,id,lnx,err)
115 end subroutine eiram_calc12_wrapper
116 
118 subroutine eiram_calc2_wrapper(Y,Id,LnX1,LnX2,N,err)
119  use eiram
120  implicit none
121  real(eiram_dp), intent(out) :: Y(n)
122  integer, intent(in) :: Id
123  real(eiram_dp), intent(in) :: lnX1(n)
124  real(eiram_dp), intent(in) :: lnX2(n)
125  integer, intent(out) :: err
126  integer,intent(in) :: N
127  call eiram_calc2(y,id,lnx1,lnx2,err)
128 end subroutine eiram_calc2_wrapper
129 
132 subroutine eiram_matlab_calc1(Y, X, N, fileName, reactionType, reactionIndex, err)
133  use eiram
134  implicit none
135  real(eiram_dp),intent(out) :: Y(n)
136  real(eiram_dp), intent(in) :: X(n)
137  integer, intent(in) :: N
138  character(*), intent(in) :: fileName, reactionType, reactionIndex
139  integer, intent(out) :: err
140  integer :: Id
141  intrinsic all,log
142  id = eiram_get_id(filename, reactiontype, reactionindex, err)
143  if(err /= 0) return
144  if(.not. all(x>0.) ) then
145  err=11
146  return
147  end if
148  call eiram_calc1(y,id,log(x),err)
149 end subroutine eiram_matlab_calc1
150 
156 subroutine eiram_matlab_calc2(Y, X1, X2, M, N, fileName, reactionType, reactionIndex, err)
157  use eiram
158  implicit none
159  real(eiram_dp),intent(out) :: Y(n,m)
160  real(eiram_dp),intent(in) :: X1(m)
161  real(eiram_dp),intent(in) :: X2(n)
162  integer,intent(in) :: M,N
163  character(*),intent(in) :: fileName, reactionType, reactionIndex
164  integer,intent(out) :: err
165  integer :: Id,j
166  logical :: ldens
167  intrinsic all,log
168  id = eiram_get_id(filename, reactiontype, reactionindex, err)
169  if(err /= 0) return
170  if(.not. all(x1>0.) ) then
171  err=12
172  return
173  end if
174  if(.not. all(x2>0.) ) then
175  err=13
176  return
177  end if
178 
179  if((reactiontype.eq.'H.4').or.(reactiontype.eq.'H.10').or.(reactiontype.eq.'H.12')) then
180  ldens=.true. !1st parameter is particle density
181  else
182  ldens=.false.
183  end if
184 
185  if(ldens) then
186  do j=1,m
187  call eiram_calc2(y(:,j),id,(/log(x1(j)/1.0e8)/),log(x2),err)
188  end do
189  else
190  do j=1,m
191  call eiram_calc2(y(:,j),id,(/log(x1(j))/),log(x2),err)
192  end do
193  end if
194 
195 end subroutine eiram_matlab_calc2
subroutine eiram_calc1_wrapper(Y, Id, lnX, N, err)
module-less wrapper for eiram_calc1
subroutine eiram_get_id_wrapper(fileName, reactionType, reactionIndex, id, err)
module-less subroutine wrapper for eiram_getId
subroutine, public eiram_load(filePath, fileName, err)
Initialization of the module from input files (data sets)
Definition: eiram.f90:206
subroutine, public eiram_deallocate(err)
Deallocate dynamic arrays used by this module.
Definition: eiram.f90:585
subroutine, public eiram_get_order(N, M, Id, err)
Return order of the polynomial for both variables.
Definition: eiram.f90:895
subroutine eiram_calc12_wrapper(B, Id, lnX, M, N, err)
module-less wrapper for eiram_calc12
subroutine eiram_deallocate_wrapper(err)
module-less wrapper for eiram_deallocate
subroutine eiram_get_order_wrapper(N, M, Id, err)
subroutine wrapper for eiram_get_order
real(eiram_dp) function eiram_calc1_fast_wrapper(Id, lnX)
module-less wrapper for eiram_calc1_fast
integer function, public eiram_get_id(fileName, reactionType, reactionIndex, err)
Return the ID-index of the given reaction in the arrays of the module.
Definition: eiram.f90:857
subroutine, public eiram_calc12(B, Id, lnX, err)
Reduce double polynomial fit to single polynomials for given values of the second variable...
Definition: eiram.f90:1142
subroutine eiram_matlab_calc2(Y, X1, X2, M, N, fileName, reactionType, reactionIndex, err)
Binding for eiram_calc2 which has to be called from Matlab/Octave interface.
subroutine eiram_load_wrapper(filePath, fileName, err)
Wrappers are required for subroutines defined in a fortran module. See eiram_octave.hpp, eiram_octave.cpp as an example of how to call those subroutines in a C program.
subroutine, public eiram_calc2(Y, Id, LnX1, LnX2, err)
Calculate double polynomial fit.
Definition: eiram.f90:1219
subroutine eiram_calc2_wrapper(Y, Id, LnX1, LnX2, N, err)
module-less wrapper for eiram_calc2
real(eiram_dp) function, public eiram_calc1_fast(Id, lnX)
Calculate single polynomial fit: scalar version W/O CHECKS.
Definition: eiram.f90:1042
Definition: eiram.f90:96
subroutine, public eiram_calc1(Y, Id, lnX, err)
Calculate single polynomial fit.
Definition: eiram.f90:1060
subroutine eiram_matlab_calc1(Y, X, N, fileName, reactionType, reactionIndex, err)
Binding for eiram_calc1 which has to be called from Matlab/Octave interface.