diff --git a/cainlib/CMakeLists.txt b/cainlib/CMakeLists.txt index 9307132..e569a40 100644 --- a/cainlib/CMakeLists.txt +++ b/cainlib/CMakeLists.txt @@ -8,6 +8,17 @@ set(CMAKE_BUILD_TYPE Release) set(CMAKE_CXX_FLAGS "-O3 -fPIC -fno-align-commons -fbounds-check -fbacktrace -ffixed-form") +if(NOT DEFINED ENV{CAIN_COEF_DIR}) + set(CAIN_COEF_DIR "${CMAKE_SOURCE_DIR}/src/") +else() + set(CAIN_COEF_DIR "$ENV{CAIN_COEF_DIR}") +endif() + +configure_file ( + "${CMAKE_SOURCE_DIR}/src/cain.f90.in" + "${CMAKE_SOURCE_DIR}/src/cain.f90" +) + file( GLOB source_files @@ -20,3 +31,6 @@ SET_TARGET_PROPERTIES(cainlib PROPERTIES LINKER_LANGUAGE CXX) install (TARGETS cainlib DESTINATION lib) install (FILES src/include/cainlib.hh DESTINATION include) +if(DEFINED ENV{CAIN_COEF_DIR}) + install (FILES src/FSU_mars90 DESTINATION ${CAIN_COEF_DIR}) +endif() diff --git a/cainlib/src/cain.f90.in b/cainlib/src/cain.f90.in new file mode 100644 index 0000000..ad5cfc1 --- /dev/null +++ b/cainlib/src/cain.f90.in @@ -0,0 +1,32 @@ +!---------------------------------------------------------------------------- +! compute bcain +! inputs: +! 2) position dlat,dlong,alt +! +! outputs: +! 1) Bcain in MSO and IAU and it's magnitude +! 2) index indacting calculation is ok +! +!----------------------------------------------------------------------------- + subroutine cain (dlat,dlong,alt,Btt,Bpp,Brr,Bx,By,Bz,B,ifail) +!------------------------------------------------------------- +! DECLARATION +!------------------------------------------------------------- + implicit real (kind=8) (a-h,o-z) + external cread, gfield + character(2000) :: coeffs_cain_file ="@CAIN_COEF_DIR@/FSU_mars90" + integer l + common /trace/rm, maxln + ! real dlat,dlong,alt,Btt,Bpp,Brr,Bx,By,Bz,B + integer ifail +!------------------------------------------------------------ +! END OF DECLARATION +!------------------------------------------------------------ + rm = 3396.2 + l = 1 + ty = 1999.6493 + open (unit=12,file =trim(coeffs_cain_file)) + call cread (12,ty,l,maxln,a) + call gfield(dlat,dlong,alt,maxln,rm,Btt, Bpp, Brr, Bx,By,Bz,B) + ifail = 1 + end diff --git a/cainlib/src/cain.in b/cainlib/src/cain.in deleted file mode 100644 index e60a9d5..0000000 --- a/cainlib/src/cain.in +++ /dev/null @@ -1,33 +0,0 @@ -!---------------------------------------------------------------------------- -! compute bcain -! inputs: -! 2) position dlat,dlong,alt -! -! outputs: -! 1) Bcain in MSO and IAU and it's magnitude -! 2) index indacting calculation is ok -! -!----------------------------------------------------------------------------- - subroutine cain (dlat,dlong,alt,Btt,Bpp,Brr,Bx,By,Bz,B,ifail) -!------------------------------------------------------------- -! DECLARATION -!------------------------------------------------------------- - implicit real (kind=8) (a-h,o-z) - external cread, gfield - character(2000) :: coeffs_cain_file ="_path_& - &/FSU_mars90" - integer l - common /trace/rm, maxln - ! real dlat,dlong,alt,Btt,Bpp,Brr,Bx,By,Bz,B - integer ifail -!------------------------------------------------------------ -! END OF DECLARATION -!------------------------------------------------------------ - rm = 3396.2 - l = 1 - ty = 1999.6493 - open (unit=12,file =trim(coeffs_cain_file)) - call cread (12,ty,l,maxln,a) - call gfield(dlat,dlong,alt,maxln,rm,Btt, Bpp, Brr, Bx,By,Bz,B) - ifail = 1 - end diff --git a/cainlib/src/postcompil.sh b/cainlib/src/postcompil.sh deleted file mode 100755 index b621850..0000000 --- a/cainlib/src/postcompil.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -FULL_PATH="$(realpath "${0}" | xargs dirname)" -rm -f $FULL_PATH/cain.f90 diff --git a/cainlib/src/precompil.sh b/cainlib/src/precompil.sh deleted file mode 100755 index 17178da..0000000 --- a/cainlib/src/precompil.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -FULL_PATH="$(realpath "${0}" | xargs dirname)" -currentPath=$(echo $FULL_PATH | sed 's_/_\\/_g') -cp $FULL_PATH/cain.in $FULL_PATH/cain.f90 -sed -i -e "s/_path_/${currentPath}/g" $FULL_PATH/cain.f90 -- libgit2 0.21.2