AGA V1
Asexual Genetic Algorithm Version 1.0
main.f90
Go to the documentation of this file.
00001 !=======================================================================
00002 !> @file main.f90
00003 !> @brief Interface with the AGAv1 implementation
00004 !> @details This is an example of the interface, the user must
00005 !! write/modify his/her own to use the AGAv1 program.
00006 !> @authors Ary Rodriguez-Gonzalez & Alejandro Esquivel
00007 !> @date 23/Jun/2011
00008 !
00009 ! Copyright (c) 2011 Ary Rodriguez-Gonzalez & Alejandro Esquivel
00010 !
00011 ! This file is part of AGA-V1.
00012 !
00013 ! AGA-V1 is free software; you can redistribute it and/or modify
00014 ! it under the terms of the GNU General Public License as published by
00015 ! the Free Software Foundation; either version 3 of the License, or
00016 ! (at your option) any later version.
00017 !
00018 ! This program is distributed in the hope that it will be useful,
00019 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
00020 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00021 ! GNU General Public License for more details.
00022 ! You should have received a copy of the GNU General Public License
00023 ! along with this program.  If not, see http://www.gnu.org/licenses/.
00024 !=======================================================================
00025 !> @brief Main program/interface with AGAv1
00026 !> @details This is a test example of a main program that initializes
00027 !! MPI (if enabled in makefile), reads data from (ObsData.dat), and
00028 !! calls AGAv1 to find the solution to....
00029 !>@ todo Terminar descripcion del main program.
00030 program test
00031   !
00032   ! -------------------------------------------------------------------------
00033   !
00034   use agav1                     ! located in aga-v1.f90 file
00035   use numgaus       ! located in extfunc.f90
00036   use input                     ! located in extfunc.f90
00037   use exfunc            ! located in extfunc.f90
00038   use func                      ! located in modules.f90
00039   use mpi_module        ! located in modules.f90
00040   !
00041   implicit none
00042   real, dimension(:), allocatable :: xobs,yobs,ysigma
00043   real, dimension(:), allocatable :: q,delta
00044 !  real, dimension(:), allocatable :: yfit,gfit
00045 !  real, dimension(:), allocatable :: cold,dold
00046 !  real,dimension(:),allocatable :: cc,dd
00047 !  real :: sigman,sigfit,fluxm,gmed,noise,nflux
00048   integer :: npar,ndata,i
00049   !
00050   !*********************************************************************
00051 #ifdef MPIP
00052   ! MPI initialization (only if MPI defined in makefile)
00053   call mpi_init(err)
00054   call mpi_comm_rank (mpi_comm_world,rank,err)
00055   call mpi_comm_size (mpi_comm_world,np,err)
00056   if(rank.eq.master) then
00057      print * ,'*****************************************'
00058      print '(a,i3,a)',' *  running using mpi on ', np , ' processors  *'
00059      print * ,'*****************************************'
00060   endif
00061 #endif
00062   !*********************************************************************
00063   !
00064   !
00065 #ifdef MPIP
00066   do i=0,np-1
00067      if (rank.eq.i) then
00068 #endif
00069         call ReadData(xobs,yobs,ysigma,ndata)
00070 #ifdef MPIP
00071      endif
00072      call mpi_barrier (mpi_comm_world, err)
00073   enddo
00074 #endif
00075   !  
00076   !
00077   call Algorithm(xobs,yobs,ysigma,q,delta,npar,ndata)
00078   !
00079   if (rank .eq. master) then
00080      print*,'-------------- Final Fit ------------------'
00081      !
00082      do i=1,2
00083         print*,'q(',i,'):',q(i),'delta(',i,'):',delta(i)
00084      enddo
00085      !
00086   endif
00087   !*********************************************************************
00088 #ifdef MPIP
00089   call mpi_finalize(err)
00090 #endif
00091   !*********************************************************************
00092   ! -------------------------------------------------------------------------
00093   !
00094 end program test
 All Namespaces Files Functions Variables