Refactored esamples/pdegen for PDE generator.

stopcriterion
Salvatore Filippone 8 years ago
parent ff402e413c
commit dee249b1ff

@ -6,10 +6,10 @@ MLD_LIBS=-L$(MLDLIBDIR) -lpsb_krylov -lmld_prec -lpsb_prec
FINCLUDES=$(FMFLAG). $(FMFLAG)$(MLDINCDIR) $(PSBLAS_INCLUDES) $(FIFLAG). FINCLUDES=$(FMFLAG). $(FMFLAG)$(MLDINCDIR) $(PSBLAS_INCLUDES) $(FIFLAG).
LINKOPT= LINKOPT=
DMOBJS=mld_dexample_ml.o data_input.o DMOBJS=mld_dexample_ml.o data_input.o mld_dpde_mod.o
D1OBJS=mld_dexample_1lev.o data_input.o D1OBJS=mld_dexample_1lev.o data_input.o mld_dpde_mod.o
SMOBJS=mld_sexample_ml.o data_input.o SMOBJS=mld_sexample_ml.o data_input.o mld_spde_mod.o
S1OBJS=mld_sexample_1lev.o data_input.o S1OBJS=mld_sexample_1lev.o data_input.o mld_spde_mod.o
EXEDIR=./runs EXEDIR=./runs
@ -26,8 +26,8 @@ mld_dexample_1lev: $(D1OBJS)
$(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
/bin/mv mld_dexample_1lev $(EXEDIR) /bin/mv mld_dexample_1lev $(EXEDIR)
mld_dexample_ml.o: data_input.o mld_dexample_ml.o: data_input.o mld_dpde_mod.o
mld_dexample_1lev.o: data_input.o mld_dexample_1lev.o: data_input.o mld_dpde_mod.o
mld_sexample_ml: $(SMOBJS) mld_sexample_ml: $(SMOBJS)
$(FLINK) $(LINKOPT) $(SMOBJS) -o mld_sexample_ml \ $(FLINK) $(LINKOPT) $(SMOBJS) -o mld_sexample_ml \
@ -39,8 +39,8 @@ mld_sexample_1lev: $(S1OBJS)
$(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS) $(MLD_LIBS) $(PSBLAS_LIBS) $(LDLIBS)
/bin/mv mld_sexample_1lev $(EXEDIR) /bin/mv mld_sexample_1lev $(EXEDIR)
mld_sexample_ml.o: data_input.o mld_sexample_ml.o: data_input.o mld_spde_mod.o
mld_sexample_1lev.o: data_input.o mld_sexample_1lev.o: data_input.o mld_spde_mod.o
clean: clean:
/bin/rm -f $(DMOBJS) $(D1OBJS) $(SMOBJS) $(S1OBJS) \ /bin/rm -f $(DMOBJS) $(D1OBJS) $(SMOBJS) $(S1OBJS) \

@ -59,73 +59,13 @@
! !
! Note that if b1=b2=b3=c=0., the PDE is the Laplace equation. ! Note that if b1=b2=b3=c=0., the PDE is the Laplace equation.
! !
module dpde_mod
contains
!
! functions parametrizing the differential equation
!
function b1(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: b1
real(psb_dpk_), intent(in) :: x,y,z
b1=dzero
end function b1
function b2(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: b2
real(psb_dpk_), intent(in) :: x,y,z
b2=dzero
end function b2
function b3(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: b3
real(psb_dpk_), intent(in) :: x,y,z
b3=dzero
end function b3
function c(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: c
real(psb_dpk_), intent(in) :: x,y,z
c=dzero
end function c
function a1(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: a1
real(psb_dpk_), intent(in) :: x,y,z
a1=done
end function a1
function a2(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: a2
real(psb_dpk_), intent(in) :: x,y,z
a2=done
end function a2
function a3(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: a3
real(psb_dpk_), intent(in) :: x,y,z
a3=done
end function a3
function g(x,y,z)
use psb_base_mod, only : psb_dpk_, done, dzero
real(psb_dpk_) :: g
real(psb_dpk_), intent(in) :: x,y,z
g = dzero
if (x == done) then
g = done
else if (x == dzero) then
g = exp(y**2-z**2)
end if
end function g
end module dpde_mod
program mld_dexample_1lev program mld_dexample_1lev
use psb_base_mod use psb_base_mod
use mld_prec_mod use mld_prec_mod
use psb_krylov_mod use psb_krylov_mod
use psb_util_mod use psb_util_mod
use data_input use data_input
use dpde_mod use mld_d_pde_mod
implicit none implicit none

@ -76,74 +76,13 @@
! then the corresponding vector is distributed according to a BLOCK ! then the corresponding vector is distributed according to a BLOCK
! data distribution. ! data distribution.
! !
module dpde_mod
contains
!
! functions parametrizing the differential equation
!
function b1(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: b1
real(psb_dpk_), intent(in) :: x,y,z
b1=dzero
end function b1
function b2(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: b2
real(psb_dpk_), intent(in) :: x,y,z
b2=dzero
end function b2
function b3(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: b3
real(psb_dpk_), intent(in) :: x,y,z
b3=dzero
end function b3
function c(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: c
real(psb_dpk_), intent(in) :: x,y,z
c=dzero
end function c
function a1(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: a1
real(psb_dpk_), intent(in) :: x,y,z
a1=done
end function a1
function a2(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: a2
real(psb_dpk_), intent(in) :: x,y,z
a2=done
end function a2
function a3(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: a3
real(psb_dpk_), intent(in) :: x,y,z
a3=done
end function a3
function g(x,y,z)
use psb_base_mod, only : psb_dpk_, done, dzero
real(psb_dpk_) :: g
real(psb_dpk_), intent(in) :: x,y,z
g = dzero
if (x == done) then
g = done
else if (x == dzero) then
g = exp(y**2-z**2)
end if
end function g
end module dpde_mod
program mld_dexample_ml program mld_dexample_ml
use psb_base_mod use psb_base_mod
use mld_prec_mod use mld_prec_mod
use psb_krylov_mod use psb_krylov_mod
use psb_util_mod use psb_util_mod
use data_input use data_input
use dpde_mod use mld_d_pde_mod
implicit none implicit none
! input parameters ! input parameters

@ -0,0 +1,60 @@
module mld_d_pde_mod
contains
!
! functions parametrizing the differential equation
!
function b1(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: b1
real(psb_dpk_), intent(in) :: x,y,z
b1=dzero
end function b1
function b2(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: b2
real(psb_dpk_), intent(in) :: x,y,z
b2=dzero
end function b2
function b3(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: b3
real(psb_dpk_), intent(in) :: x,y,z
b3=dzero
end function b3
function c(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: c
real(psb_dpk_), intent(in) :: x,y,z
c=dzero
end function c
function a1(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: a1
real(psb_dpk_), intent(in) :: x,y,z
a1=done
end function a1
function a2(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: a2
real(psb_dpk_), intent(in) :: x,y,z
a2=done
end function a2
function a3(x,y,z)
use psb_base_mod, only : psb_dpk_, done
real(psb_dpk_) :: a3
real(psb_dpk_), intent(in) :: x,y,z
a3=done
end function a3
function g(x,y,z)
use psb_base_mod, only : psb_dpk_, done, dzero
real(psb_dpk_) :: g
real(psb_dpk_), intent(in) :: x,y,z
g = dzero
if (x == done) then
g = done
else if (x == dzero) then
g = exp(y**2-z**2)
end if
end function g
end module mld_d_pde_mod

@ -59,73 +59,13 @@
! !
! Note that if b1=b2=b3=c=0., the PDE is the Laplace equation. ! Note that if b1=b2=b3=c=0., the PDE is the Laplace equation.
! !
module dpde_mod
contains
!
! functions parametrizing the differential equation
!
function b1(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: b1
real(psb_spk_), intent(in) :: x,y,z
b1=szero
end function b1
function b2(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: b2
real(psb_spk_), intent(in) :: x,y,z
b2=szero
end function b2
function b3(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: b3
real(psb_spk_), intent(in) :: x,y,z
b3=szero
end function b3
function c(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: c
real(psb_spk_), intent(in) :: x,y,z
c=szero
end function c
function a1(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: a1
real(psb_spk_), intent(in) :: x,y,z
a1=sone
end function a1
function a2(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: a2
real(psb_spk_), intent(in) :: x,y,z
a2=sone
end function a2
function a3(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: a3
real(psb_spk_), intent(in) :: x,y,z
a3=sone
end function a3
function g(x,y,z)
use psb_base_mod, only : psb_spk_, sone, szero
real(psb_spk_) :: g
real(psb_spk_), intent(in) :: x,y,z
g = szero
if (x == sone) then
g = sone
else if (x == szero) then
g = exp(y**2-z**2)
end if
end function g
end module dpde_mod
program mld_sexample_1lev program mld_sexample_1lev
use psb_base_mod use psb_base_mod
use mld_prec_mod use mld_prec_mod
use psb_krylov_mod use psb_krylov_mod
use psb_util_mod use psb_util_mod
use data_input use data_input
use dpde_mod use mld_s_pde_mod
implicit none implicit none

@ -54,7 +54,7 @@
! sweeps (with ILU(0) on the blocks) as coarsest-level solver(Sec. 5.1, Fig. 3) ! sweeps (with ILU(0) on the blocks) as coarsest-level solver(Sec. 5.1, Fig. 3)
! !
! - choice = 3, build a W-cycle preconditioner with 2 hybrid forward/backward ! - choice = 3, build a W-cycle preconditioner with 2 hybrid forward/backward
! GS sweeps pre/post-smoother, a distributed coarsest ! GS sweeps as pre/post-smoother, a distributed coarsest
! matrix, and MUMPS as coarsest-level solver (Sec. 5.1, Fig. 4) ! matrix, and MUMPS as coarsest-level solver (Sec. 5.1, Fig. 4)
! !
! The PDE is a general second order equation in 3d ! The PDE is a general second order equation in 3d
@ -76,74 +76,13 @@
! then the corresponding vector is distributed according to a BLOCK ! then the corresponding vector is distributed according to a BLOCK
! data distribution. ! data distribution.
! !
module dpde_mod
contains
!
! functions parametrizing the differential equation
!
function b1(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: b1
real(psb_spk_), intent(in) :: x,y,z
b1=szero
end function b1
function b2(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: b2
real(psb_spk_), intent(in) :: x,y,z
b2=szero
end function b2
function b3(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: b3
real(psb_spk_), intent(in) :: x,y,z
b3=szero
end function b3
function c(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: c
real(psb_spk_), intent(in) :: x,y,z
c=szero
end function c
function a1(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: a1
real(psb_spk_), intent(in) :: x,y,z
a1=sone
end function a1
function a2(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: a2
real(psb_spk_), intent(in) :: x,y,z
a2=sone
end function a2
function a3(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: a3
real(psb_spk_), intent(in) :: x,y,z
a3=sone
end function a3
function g(x,y,z)
use psb_base_mod, only : psb_spk_, sone, szero
real(psb_spk_) :: g
real(psb_spk_), intent(in) :: x,y,z
g = szero
if (x == sone) then
g = sone
else if (x == szero) then
g = exp(y**2-z**2)
end if
end function g
end module dpde_mod
program mld_sexample_ml program mld_sexample_ml
use psb_base_mod use psb_base_mod
use mld_prec_mod use mld_prec_mod
use psb_krylov_mod use psb_krylov_mod
use psb_util_mod use psb_util_mod
use data_input use data_input
use dpde_mod use mld_s_pde_mod
implicit none implicit none
! input parameters ! input parameters

@ -0,0 +1,60 @@
module mld_s_pde_mod
contains
!
! functions parametrizing the differential equation
!
function b1(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: b1
real(psb_spk_), intent(in) :: x,y,z
b1=szero
end function b1
function b2(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: b2
real(psb_spk_), intent(in) :: x,y,z
b2=szero
end function b2
function b3(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: b3
real(psb_spk_), intent(in) :: x,y,z
b3=szero
end function b3
function c(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: c
real(psb_spk_), intent(in) :: x,y,z
c=szero
end function c
function a1(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: a1
real(psb_spk_), intent(in) :: x,y,z
a1=sone
end function a1
function a2(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: a2
real(psb_spk_), intent(in) :: x,y,z
a2=sone
end function a2
function a3(x,y,z)
use psb_base_mod, only : psb_spk_, sone
real(psb_spk_) :: a3
real(psb_spk_), intent(in) :: x,y,z
a3=sone
end function a3
function g(x,y,z)
use psb_base_mod, only : psb_spk_, sone, szero
real(psb_spk_) :: g
real(psb_spk_), intent(in) :: x,y,z
g = szero
if (x == sone) then
g = sone
else if (x == szero) then
g = exp(y**2-z**2)
end if
end function g
end module mld_s_pde_mod
Loading…
Cancel
Save