Commit 14af65f9b3fc3cf62bd45ab61c65d30ef10be45b
1 parent
c121b914
Exists in
master
lib ok validation ko
Showing
9 changed files
with
51 additions
and
119 deletions
Show diff stats
cain/lib/spicelib.a deleted
No preview for this file type
cain/lib/support.a deleted
No preview for this file type
cain/src/cain.f90 deleted
... | ... | @@ -1,104 +0,0 @@ |
1 | -!---------------------------------------------------------------------------- | |
2 | -! compute bcain | |
3 | -! inputs: | |
4 | -! 1) date string UTC, JD or any standard time format see: | |
5 | -! https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/str2et.html | |
6 | -! 2) position in MSO | |
7 | -! | |
8 | -! outputs: | |
9 | -! 1) Bcain in MSO and IAU and it's magnitude | |
10 | -! 2) index indacting calculation is ok | |
11 | -! | |
12 | -!----------------------------------------------------------------------------- | |
13 | - | |
14 | - subroutine cain(str_time, px, py, pz, Btt, Bpp, Brr, Bx, By, Bz, B, ifail) | |
15 | - implicit real (kind=8) (a-h,o-z) | |
16 | - | |
17 | - external cread, gfield,trace_line | |
18 | -! spicelib routines | |
19 | - external pgrrec,recpgr, georec,recgeo,furnsh,bodvrd, rpd, dpr | |
20 | - external str2et, pxform, mxv, rotget | |
21 | - common /trace/ f,radii1,ds3,rm, maxln | |
22 | - | |
23 | -! real (kind=8):: l | |
24 | - real (kind=8):: dlong,dlongr | |
25 | - real (kind=8):: dlat, dlatr | |
26 | - real (kind=8):: alt,a,px,py,pz | |
27 | - real (kind=8):: radii(3),radii1 | |
28 | - real (kind=8):: f | |
29 | - ! to write end parameters | |
30 | - real (kind=8):: vec0(3), vec(3) | |
31 | - ! to convert IAU/MSO values | |
32 | - real (kind=8):: rot_mat(3,3), rot_matt(3,3), et | |
33 | -! logical :: found | |
34 | - | |
35 | - integer n | |
36 | - | |
37 | - real (kind=8):: rm ,rpd, dpr | |
38 | - | |
39 | - real (kind=8):: Bx, By, Bz, B, Btt, Bpp, Brr | |
40 | - character(2000) :: coeffs_cain_file = "FSU_mars90" | |
41 | - character(23) :: str_time | |
42 | -!------------------------------------------------------------- | |
43 | - | |
44 | - open (unit=12,file =trim(coeffs_cain_file)) | |
45 | - call bodvrd( 'MARS', 'RADII', 3, n, radii ) | |
46 | -! flattening coefficient = (RE-RP) / RE, where RP is the polar radius | |
47 | - f = (radii(1)-radii(3))/radii(1) | |
48 | - | |
49 | - radii1=radii(1) | |
50 | - | |
51 | -! ty intervient dans le calcul de coeffs tg | |
52 | -! t = ty - tzero | |
53 | -! tg(n,m) = g(n,m) + t*(gt(n,m)+t*gtt(n,m)) | |
54 | - ty=1999.6493 !date (JD?) | |
55 | - | |
56 | -! l en entree doit etre > 0 | |
57 | -! l en sortie de cread est mis a 0 si ty > tl (temps | |
58 | -! final) ou ty <tf (temps initial) : ty outside limits | |
59 | -! tf et tl sont lus dans le fichier des coeffs | |
60 | - | |
61 | -! gfield prend en entree dlat dlong en degres | |
62 | - l=1 | |
63 | -! | |
64 | - | |
65 | - call cread (12,ty,l,maxln,a) | |
66 | -! call cread (12,13,ty,l,maxln,a) ! cain version | |
67 | - | |
68 | -! print*, 'ty,l,maxln,a : ', ty,l,maxln,a | |
69 | - str_time=trim(str_time) | |
70 | - vec0(1)=px | |
71 | - vec0(2)=py | |
72 | - vec0(3)=pz | |
73 | - | |
74 | -! MSO to IAU_MARS | |
75 | - call str2et ( trim(str_time), et ) | |
76 | -!print*,'trim(str_time), et: ', trim(str_time),et | |
77 | - call pxform ( 'MSO', 'IAU_MARS', et, rot_mat ) | |
78 | - call pxform ( 'IAU_MARS', 'MSO', et, rot_matt ) | |
79 | -! call pxfrm2 ( 'MSO', 'IAU_MARS', et, et, rot_mat ) | |
80 | -! call refchg ( 1601499 , 1600499, et, rot_mat ) | |
81 | -! call rotget ( 1601499, et, rot_mat, 1600499, found ) | |
82 | - | |
83 | -!print*,'rot_mat: ', rot_mat(1,1), rot_mat(1,2), rot_mat(1,3) | |
84 | -!print*,'rot_mat: ', rot_mat(2,1), rot_mat(2,2), rot_mat(2,3) | |
85 | -!print*,'rot_mat: ', rot_mat(3,1), rot_mat(3,2), rot_mat(3,3) | |
86 | -!print* | |
87 | - call mxv ( rot_mat, vec0, vec ) | |
88 | -!print*, 'vec0:', vec0(1), vec0(2), vec0(3) | |
89 | -!print*, 'vec:', vec(1), vec(2), vec(3) | |
90 | -!print* | |
91 | - | |
92 | - | |
93 | -! body fixed to planetographic | |
94 | - call recpgr ( 'MARS', vec, radii1, f, dlongr, dlatr, alt ) | |
95 | - | |
96 | - dlong=dlongr*dpr() | |
97 | - dlat= dlatr*dpr() | |
98 | - | |
99 | -! print*, 'av gfield dlat, dlong, alt maxln rm: | |
100 | -! ',dlat,dlong,alt,maxln,rm | |
101 | -! call gfield(dlat,dlong,alt,maxln,rm,Bx,By,Bz,B) | |
102 | - call gfield(dlat,dlong,alt,maxln,rm,Btt, Bpp, Brr, Bx,By,Bz,B) | |
103 | - ifail = 1 | |
104 | - end |
cain/CMakeLists.txt renamed to cainlib/CMakeLists.txt
1 | 1 | cmake_minimum_required(VERSION 2.6) |
2 | 2 | |
3 | -PROJECT(cain CXX Fortran) | |
3 | +PROJECT(cainlib CXX Fortran) | |
4 | 4 | |
5 | 5 | add_definitions( -DLINUX ) |
6 | 6 | |
... | ... | @@ -11,13 +11,18 @@ set(CMAKE_CXX_FLAGS "-O3 -fPIC -fno-align-commons -fbounds-check -fbacktrace -ff |
11 | 11 | file( |
12 | 12 | GLOB |
13 | 13 | source_files |
14 | - src/*.for | |
15 | - lib/spicelib.a | |
14 | + src/*.f90 | |
16 | 15 | ) |
17 | 16 | |
18 | -add_library(cain SHARED ${source_files}) | |
17 | +add_library(cainlib SHARED ${source_files}) | |
19 | 18 | |
20 | -SET_TARGET_PROPERTIES(cain PROPERTIES LINKER_LANGUAGE CXX) | |
19 | +add_custom_command( TARGET cainlib | |
20 | + POST_BUILD | |
21 | + COMMAND ${CMAKE_COMMAND} -E echo "Copying unit test data.." | |
22 | + sOMMAND ${CMAKE_COMMAND} -E copy_directory src/FSU_mars90 cainlib | |
23 | + ) | |
21 | 24 | |
22 | -install (TARGETS cain DESTINATION lib) | |
23 | -install (FILES src/include/cainLib.hh DESTINATION include) | |
25 | +SET_TARGET_PROPERTIES(cainlib PROPERTIES LINKER_LANGUAGE CXX) | |
26 | + | |
27 | +install (TARGETS cainlib DESTINATION lib) | |
28 | +install (FILES src/include/cainlib.hh DESTINATION include) | ... | ... |
cain/src/FSU_mars90 renamed to cainlib/src/FSU_mars90
100644 โ 100755
... | ... | @@ -0,0 +1,34 @@ |
1 | +!---------------------------------------------------------------------------- | |
2 | +! compute bcain | |
3 | +! inputs: | |
4 | +! 2) position dlat,dlong,alt | |
5 | +! | |
6 | +! outputs: | |
7 | +! 1) Bcain in MSO and IAU and it's magnitude | |
8 | +! 2) index indacting calculation is ok | |
9 | +! | |
10 | +!----------------------------------------------------------------------------- | |
11 | + subroutine cain (dlat,dlong,alt,Btt,Bpp,Brr,Bx,By,Bz,B,ifail) | |
12 | +!------------------------------------------------------------- | |
13 | +! DECLARATION | |
14 | +!------------------------------------------------------------- | |
15 | + implicit real (kind=8) (a-h,o-z) | |
16 | + external cread, gfield | |
17 | + character(2000) :: coeffs_cain_file ="/home/hacene/amda/AMDA_COTS/& | |
18 | + &cainlib/src/FSU_mars90" | |
19 | + integer l | |
20 | + common /trace/rm, maxln | |
21 | + ! real dlat,dlong,alt,Btt,Bpp,Brr,Bx,By,Bz,B | |
22 | + integer ifail | |
23 | +!------------------------------------------------------------ | |
24 | +! END OF DECLARATION | |
25 | +!------------------------------------------------------------ | |
26 | + rm = 3396.2 | |
27 | + l = 1 | |
28 | + ty = 1999.6493 | |
29 | + open (unit=12,file =trim(coeffs_cain_file)) | |
30 | + call cread (12,ty,l,maxln,a) | |
31 | + write(*,*) "inputs", dlat,dlong,alt | |
32 | + call gfield(dlat,dlong,alt,maxln,rm,Btt, Bpp, Brr, Bx,By,Bz,B) | |
33 | + ifail = 1 | |
34 | + end | ... | ... |
cain/src/include/cainLib.hh renamed to cainlib/src/include/cainlib.hh
... | ... | @@ -5,14 +5,10 @@ |
5 | 5 | extern "C" { |
6 | 6 | #endif |
7 | 7 | |
8 | - void cain_(char* str_time, | |
9 | - float* px, float* py, float* pz, | |
10 | - float* Btt, float* Bpp, float* Brr, | |
11 | - float* Bx, float* By, float* Bz, | |
12 | - float* B, int* ifail); | |
13 | - | |
14 | - | |
15 | - | |
8 | + void cain_(double* dlat, double* dlong, double* alt, | |
9 | + double* Btt, double* Bpp, double* Brr, | |
10 | + double* Bx, double* By, double* Bz, | |
11 | + double* B, int* ifail); | |
16 | 12 | #ifdef __cplusplus |
17 | 13 | } |
18 | 14 | #endif | ... | ... |
cain/src/mflpgms4_dpo.f90 renamed to cainlib/src/mflpgms4_dpo.f90
cain/src/steprk4.f90 renamed to cainlib/src/steprk4.f90