mirror of
https://gitlab.com/scemama/eplf
synced 2024-12-22 12:23:50 +01:00
Introduced templates
This commit is contained in:
parent
f0689c031a
commit
b0556c4f98
@ -82,7 +82,7 @@ case $FC in
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
gfortran*)
|
gfortran*)
|
||||||
FCFLAGS="O3 -ffast-math"
|
FCFLAGS="-O3 -ffast-math"
|
||||||
if test $STATIC == 0 ; then
|
if test $STATIC == 0 ; then
|
||||||
FCFLAGS="$FCFLAGS -static-libgcc -static"
|
FCFLAGS="$FCFLAGS -static-libgcc -static"
|
||||||
fi
|
fi
|
||||||
|
@ -1,29 +1,23 @@
|
|||||||
BEGIN_SHELL [ /usr/bin/python ]
|
BEGIN_TEMPLATE
|
||||||
|
|
||||||
to_compute = [\
|
|
||||||
"eplf",
|
|
||||||
"eplf_grad",
|
|
||||||
"eplf_lapl",
|
|
||||||
"elf",
|
|
||||||
"elf_grad",
|
|
||||||
"elf_lapl",
|
|
||||||
"density",
|
|
||||||
"density_grad",
|
|
||||||
"density_lapl",
|
|
||||||
]
|
|
||||||
|
|
||||||
template = """
|
|
||||||
BEGIN_PROVIDER [ logical, comp_$X ]
|
BEGIN_PROVIDER [ logical, comp_$X ]
|
||||||
implicit none
|
implicit none
|
||||||
BEGIN_DOC
|
BEGIN_DOC
|
||||||
! If true, $X
|
! If true, compute $X
|
||||||
END_DOC
|
END_DOC
|
||||||
comp_$X = .False.
|
comp_$X = .False.
|
||||||
call get_compute_$X(comp_$X)
|
call get_compute_$X(comp_$X)
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
"""
|
|
||||||
|
|
||||||
for t in to_compute:
|
SUBST [ X ]
|
||||||
print template.replace("$X",t)
|
eplf;;
|
||||||
|
eplf_grad;;
|
||||||
|
eplf_lapl;;
|
||||||
|
elf;;
|
||||||
|
elf_grad;;
|
||||||
|
elf_lapl;;
|
||||||
|
density;;
|
||||||
|
density_grad;;
|
||||||
|
density_lapl;;
|
||||||
|
|
||||||
END_SHELL
|
END_TEMPLATE
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
BEGIN_SHELL [ /usr/bin/python ]
|
BEGIN_TEMPLATE
|
||||||
|
|
||||||
values = [\
|
|
||||||
"eplf",
|
|
||||||
"elf",
|
|
||||||
]
|
|
||||||
|
|
||||||
template = """
|
|
||||||
BEGIN_PROVIDER [ real, $X_grad_p, (3) ]
|
BEGIN_PROVIDER [ real, $X_grad_p, (3) ]
|
||||||
&BEGIN_PROVIDER [ real, $X_lapl_p ]
|
&BEGIN_PROVIDER [ real, $X_lapl_p ]
|
||||||
implicit none
|
implicit none
|
||||||
@ -33,9 +27,9 @@ template = """
|
|||||||
TOUCH point
|
TOUCH point
|
||||||
|
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
"""
|
|
||||||
|
|
||||||
for value in values:
|
SUBST [ X ]
|
||||||
print template.replace("$X",value)
|
eplf;;
|
||||||
|
elf;;
|
||||||
|
|
||||||
END_SHELL
|
END_TEMPLATE
|
||||||
|
@ -67,15 +67,8 @@
|
|||||||
|
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
|
|
||||||
BEGIN_SHELL [ /usr/bin/python ]
|
BEGIN_TEMPLATE
|
||||||
|
|
||||||
grids = [ \
|
|
||||||
"eplf",
|
|
||||||
"elf",
|
|
||||||
"density",
|
|
||||||
]
|
|
||||||
|
|
||||||
template = """
|
|
||||||
BEGIN_PROVIDER [ real, grid_$X, (grid_x_num,grid_y_num,grid_z_num) ]
|
BEGIN_PROVIDER [ real, grid_$X, (grid_x_num,grid_y_num,grid_z_num) ]
|
||||||
implicit none
|
implicit none
|
||||||
BEGIN_DOC
|
BEGIN_DOC
|
||||||
@ -247,9 +240,10 @@ subroutine set_grid_data_$X_lapl(buffer)
|
|||||||
call ezfio_set_grid_data_$X_lapl(buffer)
|
call ezfio_set_grid_data_$X_lapl(buffer)
|
||||||
endif
|
endif
|
||||||
end
|
end
|
||||||
"""
|
|
||||||
|
|
||||||
for grid in grids:
|
SUBST [ X ]
|
||||||
print template.replace("$X",grid)
|
eplf;;
|
||||||
|
elf;;
|
||||||
|
density;;
|
||||||
|
|
||||||
END_SHELL
|
END_TEMPLATE
|
||||||
|
@ -1,37 +1,39 @@
|
|||||||
BEGIN_SHELL [ /usr/bin/python ]
|
BEGIN_TEMPLATE
|
||||||
|
|
||||||
for i in [('r' ,'real'), \
|
subroutine $Xinfo (here,token,value)
|
||||||
('d','double precision'), \
|
implicit none
|
||||||
('l','logical'), \
|
character*(*), intent(in) :: here
|
||||||
('i','integer'), \
|
character*(*), intent(in) :: token
|
||||||
('c','character*(*)'), \
|
$Y, intent(in) :: value
|
||||||
]:
|
if (mpi_master) then
|
||||||
print "subroutine "+i[0]+"info (here,token,value)"
|
print *, trim(here)//':'
|
||||||
print " implicit none"
|
$Z
|
||||||
print " character*(*) :: here"
|
endif
|
||||||
print " character*(*) :: token"
|
end
|
||||||
print " "+i[1]+" :: value"
|
|
||||||
print " if (mpi_master) then"
|
|
||||||
print " print *, trim(here)//':'"
|
|
||||||
if i[0] == 'l':
|
|
||||||
print " if (value) then"
|
|
||||||
print " print *, ' -> ', trim(token), '= True' "
|
|
||||||
print " else"
|
|
||||||
print " print *, ' -> ', trim(token), '= False' "
|
|
||||||
print " endif"
|
|
||||||
else:
|
|
||||||
print " print *, ' -> ', trim(token), '=', value"
|
|
||||||
print " endif"
|
|
||||||
print "end"
|
|
||||||
|
|
||||||
END_SHELL
|
SUBST [ X, Y, Z ]
|
||||||
|
r; real;
|
||||||
|
print *, ' -> ', trim(token), '=', value;;
|
||||||
|
d; double precision;
|
||||||
|
print *, ' -> ', trim(token), '=', value;;
|
||||||
|
i; integer;
|
||||||
|
print *, ' -> ', trim(token), '=', value;;
|
||||||
|
c; character*(*);
|
||||||
|
print *, ' -> ', trim(token), '=', value;;
|
||||||
|
l; logical;
|
||||||
|
if (value) then
|
||||||
|
print *, ' -> ', trim(token), '= True'
|
||||||
|
else
|
||||||
|
print *, ' -> ', trim(token), '= False'
|
||||||
|
endif;;
|
||||||
|
END_TEMPLATE
|
||||||
|
|
||||||
subroutine info(here,message)
|
subroutine info(here,message)
|
||||||
implicit none
|
implicit none
|
||||||
character*(*) :: here, message
|
character*(*), intent(in) :: here, message
|
||||||
if (mpi_master) then
|
if (mpi_master) then
|
||||||
print *, trim(here)//':'
|
print *, trim(here)//':'
|
||||||
print *, ' -> ', trim(message)
|
print *, ' -> ', trim(message)
|
||||||
endif
|
endif
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,10 +1,19 @@
|
|||||||
program write_cube
|
program to_cube
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer :: i
|
integer :: i
|
||||||
integer :: l
|
integer :: l
|
||||||
integer :: ix, iy, iz
|
integer :: ix, iy, iz
|
||||||
|
integer :: iargc
|
||||||
|
character*(32) :: filename
|
||||||
|
character*(32) :: grid_type
|
||||||
|
|
||||||
|
if (iragc() /= 2) then
|
||||||
|
print *, 'usage: to_cube ',trim(filename), trim(grid_type)
|
||||||
|
stop 1
|
||||||
|
endif
|
||||||
|
call getarg(1,filename)
|
||||||
|
call getarg(2,grid_type)
|
||||||
if (.not.mpi_master) then
|
if (.not.mpi_master) then
|
||||||
return
|
return
|
||||||
endif
|
endif
|
Loading…
Reference in New Issue
Block a user