Commit 8406adaf authored by Giacomo Mulas's avatar Giacomo Mulas
Browse files

Merge branch 'cluster' into 'master'

Cluster

See merge request giacomo.mulas/np_tmcode!7
parents 9c447a2d ef96e63f
Loading
Loading
Loading
Loading
+21 −9
Original line number Diff line number Diff line
@@ -12,36 +12,48 @@ This section describes the use of the pre-existing programs, once the binaries h

### cluster

1. cd to the `build/cluster` folder
2. run `edfb`
1. cd to the `build/cluster` folder.
2. Run `edfb`:
   
   > ./edfb
   
3. run `clu`
3. Run `clu`:
   
   > ./clu
   
*NOTE:* both `edfb` and `clu` expect an input which is assumed to be in a folder named `../../test_data/cluster/` (i.e. two levels above the current execution path)

*TODO:* set up a code variable to locate the input data (data file paths should not be hard-coded)
4. Run `np_cluster`:

   > ./np_cluster

*NOTE:* The C++ version does not need to run a configuration program because all configuration operations are handled by the code at run-time.

5. Check the consistency between the output files (the default output file for the FORTRAN code is named `OCLU`, while the corresponding C++ output has the default name of `c_OCLU`).

### sphere

1. cd to the `build/sphere` folder
2. run `edfb`
1. cd to the `build/sphere` folder.
2. Run `edfb`:

   > ./edfb
   
3. run `sph`
3. Run `sph`:

   > ./sph
   
*NOTE:* both `edfb` and `sph` expect an input which is assumed to be in a folder named `../../test_data/sphere/` (i.e. two levels above the current execution path)

*TODO:* set up a code variable to locate the input data (data file paths should not be hard-coded)
4. Run `np_sphere`:

   > ./np_sphere

*NOTE:* The C++ version does not need to run a configuration program because all configuration operations are handled by the code at run-time.

5. Check the consistency between the output files (the default output file for the FORTRAN code is named `OSPH`, while the corresponding C++ output has the default name of `c_OSPH`).

### trapping

The execution of trapping programs requires at least one of the previous programs to have produced a complete output set.

*TODO:* investigate which conditions allow `clu` or `sph` to write `TTMS` output files.
*TODO:* Define a common format for binary I/O operations on the TTMS file.
+2 −1
Original line number Diff line number Diff line
@@ -986,7 +986,8 @@ INPUT_FILE_ENCODING =
FILE_PATTERNS          = *.cpp \
		         *.f \
		         *.h \
			 *.md
			 *.md \
			 *.py

# The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well.
+15 −11
Original line number Diff line number Diff line
@@ -10,24 +10,28 @@ In all cases, build commands executed through `make` will output the object file

## FORTRAN code setup and execution (requires `gfortran` and GNU `make`)

1. cd to the `src` folder
2. run `make`
1. cd to the `src` folder.
2. Run `make` as:

   > make

3. cd to the `build/sphere` folder
4. run `sph` following the instructions given in `build\README.md`
3. cd to the `build/sphere` folder.
4. Run `sph` following the instructions given in `build\README.md`
5. cd to the `build/cluster` folder.
6. Run `clu` following the instructions given in `build\README.md`

## C++ code setup and execution (requires `g++` and GNU `make`)

1. cd to the `src` folder
2. run `make np_sphere`
1. Follow the FORTRAN code setup steps (this builds the C++ version too).
2. cd to the `build/sphere` folder.
3. Run `np_sphere`:

   > make np_sphere
   > ./np_sphere

3. cd to the `build/sphere` folder
4. run `np_sphere`
4. Check the consistency between the text files named `OSPH` and `c_OSPH`
5. cd to the `build/cluster` folder.
6. Run `np_cluster`:

   > ./np_sphere
   > ./np_cluster

5. check the consistency between the text files named `OSPH` and `c_OSPH`
7. Check the consistency between the text files named `OCLU` and `c_OCLU`
+26 −1
Original line number Diff line number Diff line
@@ -2,8 +2,12 @@ BUILDDIR=../../build/cluster
FC=gfortran
FCFLAGS=-std=legacy -O3
LFLAGS=
LFLAGS=
CXX=g++
CXXFLAGS=-O2 -ggdb -pg -coverage
CXXLFLAGS=

all: clu edfb
all: clu edfb np_cluster

clu: clu.o
	$(FC) $(FCFLAGS) -o $(BUILDDIR)/clu $(BUILDDIR)/clu.o $(LFLAGS)
@@ -11,6 +15,27 @@ clu: clu.o
edfb: edfb.o
	$(FC) $(FCFLAGS) -o $(BUILDDIR)/edfb $(BUILDDIR)/edfb.o $(LFLAGS)

np_cluster: $(BUILDDIR)/np_cluster.o $(BUILDDIR)/Commons.o $(BUILDDIR)/Configuration.o $(BUILDDIR)/Parsers.o $(BUILDDIR)/sphere.o $(BUILDDIR)/cluster.o
	$(CXX) $(CXXFLAGS) $(CXXLFLAGS) -o $(BUILDDIR)/np_cluster $(BUILDDIR)/np_cluster.o $(BUILDDIR)/Commons.o $(BUILDDIR)/Configuration.o $(BUILDDIR)/Parsers.o $(BUILDDIR)/sphere.o $(BUILDDIR)/cluster.o

$(BUILDDIR)/np_cluster.o:
	$(CXX) $(CXXFLAGS) -c np_cluster.cpp -o $(BUILDDIR)/np_cluster.o

$(BUILDDIR)/Commons.o:
	$(CXX) $(CXXFLAGS) -c ../libnptm/Commons.cpp -o $(BUILDDIR)/Commons.o

$(BUILDDIR)/Configuration.o:
	$(CXX) $(CXXFLAGS) -c ../libnptm/Configuration.cpp -o $(BUILDDIR)/Configuration.o

$(BUILDDIR)/Parsers.o:
	$(CXX) $(CXXFLAGS) -c ../libnptm/Parsers.cpp -o $(BUILDDIR)/Parsers.o

$(BUILDDIR)/cluster.o:
	$(CXX) $(CXXFLAGS) -c cluster.cpp -o $(BUILDDIR)/cluster.o

$(BUILDDIR)/sphere.o:
	$(CXX) $(CXXFLAGS) -c ../sphere/sphere.cpp -o $(BUILDDIR)/sphere.o

clean:
	rm -f $(BUILDDIR)/*.o

+79 −17
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ CCC DIMENSION TQSE(2,NSPH),TQSPE(2,NSPH),TQSS(2,NSPH),TQSPS(2,NSPH)
CCC   DIMENSION DC0M(NSPH,NSHL-NTL),XIV(NXI)
      DIMENSION DC0M(6,4),XIV(200)
      COMPLEX*16 DC0M
      COMPLEX*16 ARG,S0,S0M
      COMPLEX*16 ARG,S0,S0M,CCSAM
 8010 FORMAT(1H ,16I5)
 8015 FORMAT(1H ,
     1'READ(IR,*)NSPH,LI,LE,MXNDM,INPOL,NPNT,NPNTTS,IAVM,ISAM')
@@ -140,9 +140,9 @@ CCC DIMENSION DC0M(NSPH,NSHL-NTL),XIV(NXI)
 6991 FORMAT('========== JXI =',I3,' ====================')
 6992 FORMAT('********** JTH =',I3,', JPH =',I3,
     1', JTHS =',I3,', JPHS =',I3,' ********************')
      IR=5
      IW=6
      IT=7
      IR=25
      IW=26
      IT=27
      ITIN=17
CCC
CCC   OTHER COMMENTS IN FILE GLOBALCOMS
@@ -294,6 +294,12 @@ C
      SQSFI=1.0D0/(XI*XI)
      WRITE(IW,6716)XI
 120  CALL HJV(EXRI,VKARG,JER,LCALC,ARG)
C     DEBUG CODE
C     IF(JXI.NE.1)GOTO 199
C     PRINT *,"DEBUG: witing VJ0"
C     CALL LOGMAT(VJ0)
C 199 PRINT *,"DEBUG: already wrote VJ0"
C     END DEBUG
      IF(JER.EQ.0)GO TO 122
      WRITE(IW,6650)
      GO TO 490
@@ -314,13 +320,22 @@ C
  128 DC0(IC)=DC0M(I,IC)
  130 IF(MOD(NSH,2).EQ.0)DC0(ICI+1)=EXDC
      CALL DME(LI,I,NPNT,NPNTTS,VKARG,EXDC,EXRI,JER,LCALC,ARG)
C      DO 199 IDL=1,8
C      PRINT *,"DEBUG: RMI(",IDL,",",I,") =",RMI(IDL,I)
C     199  PRINT *,"DEBUG: REI(",IDL,",",I,") =",REI(IDL,I)
C      PRINT *,"DEBUG: DME - jer =",JER,", lcalc =",LCALC,
C     1", arg =",ARG
      IF(JER.EQ.0)GO TO 132
      WRITE(IW,6750)
      GO TO 490
 132  CONTINUE
      CALL CMS(AM)
      CALL SUMMAT(AM,CCSAM)
      PRINT *,"DEBUG: after CMS CCSAM =",CCSAM
      NDIT=2*NSPH*NLIM
      CALL LUCIN(AM,MXNDM,NDIT,JER)
      CALL SUMMAT(AM,CCSAM)
      PRINT *,"DEBUG: after LUCIN CCSAM =",CCSAM
      IF(JER.EQ.1)GO TO 495
      CALL ZTM(AM)

@@ -343,6 +358,7 @@ C
  158 WRITE(IW,6061)
  160 CS0=0.25D0*VK*VK*VK/DACOS(C0)
      CALL SCR0(VK,EXRI)
      PRINT *,"DEBUG: after SCR0 TFSAS =",TFSAS
      SQK=VK*VK*EXDC
      CALL APS(ZPV,LI,NSPH,IOG,RMI,REI,SQK,GAPS)
      CALL RABAS(INPOL,LI,NSPH,IOG,RMI,REI,TQSE,TQSPE,TQSS,TQSPS)
@@ -1605,6 +1621,7 @@ CCC DIMENSION SVW(LE,3,2,2),SVS(LE,3,2,2)
CCC   DIMENSION ZPV(LM,3,2,2)
      DIMENSION ZPV(8,3,2,2)
      C0=0.0D0
C     SZPV=C0
      DO 10 L=1,LM
      DO 10 ILMP=1,3
      ZPV(L,ILMP,1,1)=C0
@@ -1617,6 +1634,7 @@ CCC DIMENSION ZPV(LM,3,2,2)
      ZP=-1.0D0/DSQRT(XD)
      ZPV(L,2,1,2)=ZP
      ZPV(L,2,2,1)=ZP
C     SZPV=SZPV+2.0D0*ZP
   15 CONTINUE
      IF(LM.EQ.1)GO TO 30
      DO 20 L=2,LM
@@ -1625,6 +1643,7 @@ CCC DIMENSION ZPV(LM,3,2,2)
      ZP=DSQRT(XN/XD)
      ZPV(L,1,1,1)=ZP
      ZPV(L,1,2,2)=ZP
C     SZPV=SZPV+2.0D0*ZP
   20 CONTINUE
      LMMO=LM-1
      DO 25 L=1,LMMO
@@ -1633,8 +1652,10 @@ CCC DIMENSION ZPV(LM,3,2,2)
      ZP=-DSQRT(XN/XD)
      ZPV(L,3,1,1)=ZP
      ZPV(L,3,2,2)=ZP
C     SZPV=SZPV+2.0D0*ZP
   25 CONTINUE
 30   CONTINUE
C     PRINT *,"DEBUG: szpv =",SZPV
      RETURN
      END
      REAL*8 FUNCTION CG1(LMPML,MU,L,M)
@@ -1853,7 +1874,7 @@ CCC NSPEF=1 CALLING WITH IDOT=0, NSPEF=NSPH OTHERWISE
      IMPLICIT REAL*8(A-H,O-Z)
CCC   DIMENSION RCF(NSPH,NSHL),YLM(MAX0(LITPOS,LMTPOS))
      DIMENSION RCF(6,8),YLM(289)
      COMPLEX*16 YLM
      COMPLEX*16 YLM,SVYHJ
      COMMON/C1/VH(255),VJ0(102),VYHJ(4335),VYJ0(1734),VJ(1),
     1RMI(8,6),REI(8,6),W(160,4),AM0M(160,160),
     2FSAS(6),SAS(6,2,2),VINTS(6,16),VINTT(16),
@@ -1916,6 +1937,10 @@ CCC DIMENSION RCF(NSPH,NSHL),YLM(MAX0(LITPOS,LMTPOS))
      CALL SPHAR(CRTH,SRTH,CRPH,SRPH,LIT,YLM)
      DO 38 IV=1,LITPOS
   38 VYHJ(IV+IVY)=DCONJG(YLM(IV))
C      SVYHJ=(0.0D0,0.0D0)
C      DO 995 IDI=1,4335
C 995  SVYHJ=SVYHJ+VYHJ(IDI)
C      PRINT *,"DEBUG: in STR svyhj =",SVYHJ
   40 IVY=IVY+LITPOS
      LMT=LI+LE
      IVY=0
@@ -2098,6 +2123,7 @@ CCC NDIT.LE.MXNDM
      DIMENSION AM(960,960)
      COMPLEX*16 AM
      COMPLEX*16 DM,DE,CGH,CGK,GHIT,CC0
      COMMON/C6/RAC3J(17)
      CC0=(0.0D0,0.0D0)
      NDI=NSPH*NLIM
      NBL=0
@@ -2185,7 +2211,7 @@ CCC NDIT.LE.MXNDM
     1VINTS,VINTT,FSAC,SAC,FSACM,VINT,VINTM,SCSCP,ECSCP,SCSCPM,ECSCPM
      COMMON/C4/LITPO,LITPOS,LMTPO,LMTPOS,LI,NLIM,LE,NLEM,NSPH
      COMMON/C9/GIS(480,80),GLS(480,80),SAM(960,160)
      COMPLEX*16 GIS,GLS,SAM
      COMPLEX*16 GIS,GLS,SAM,DBGTST
CCC   DIMENSION AM(MXNDM,MXNDM)
CCC   NDIT.LE.MXNDM
      DIMENSION AM(960,960)
@@ -2211,6 +2237,18 @@ CCC NDIT.LE.MXNDM
      I3=I3+1
      GIS(I2,I3)=GHIT(2,0,N2,L2,M2,L3,M3)
 15   GLS(I2,I3)=GHIT(2,1,N2,L2,M2,L3,M3)
C     DEBUG CODE
C      DBGTST=CC0
C      DO 990 DI=1,NDI
C         DO 990 DJ=1,NLEM
C 990        DBGTST=DBGTST+GIS(DI,DJ)
C      PRINT *,"DEBUG: in ZTM init sgis =",DBGTST
C      DBGTST=CC0
C      DO 991 DI=1,NDI
C         DO 991 DJ=1,NLEM
C 991        DBGTST=DBGTST+GLS(DI,DJ)
C      PRINT *,"DEBUG: in ZTM init sgls =",DBGTST
C     END DEBUG
      DO 25 I1=1,NDI
      I1E=I1+NDI
      DO 25 I3=1,NLEM
@@ -3466,4 +3504,28 @@ CCC DIMENSION AV(NDDMST*NDDMST)
 3    CDTP=CDTP+AV((J-1)*ISTEP+I)*AV(J+IR)
      RETURN
      END
      SUBROUTINE SUMMAT(AM,RSLT)
      DIMENSION AM(921600)
      COMPLEX*16 AM,CC0,RSLT
      CC0=(0.0D0,0.0D0)
      RSLT=CC0
      DO 4 I=1,921600
 4    RSLT=RSLT+AM(I)
      RETURN
      END
      SUBROUTINE LOGMAT(AM)
      DIMENSION AM(960,960)
      COMPLEX*16 AM
      IL=36
      OPEN(IL,FILE="matrix.log",STATUS="UNKNOWN")
      DO 5 I=1,960
      DO 6 J=1,960
      WRITE(IL,9901)I,J,DREAL(AM(I,J))
 6    WRITE(IL,9902)I,J,DIMAG(AM(I,J))
 5    CONTINUE
      CLOSE(IL)
 9901 FORMAT("R:",1I3,",",1I3,",",1D15.7)
 9902 FORMAT("I:",1I3,",",1I3,",",1D15.7)
      RETURN
      END
CCC
Loading