diff --git a/Manuals/FDS_User_Guide/FDS_User_Guide.tex b/Manuals/FDS_User_Guide/FDS_User_Guide.tex index fcd0221a835..d60635c7b32 100644 --- a/Manuals/FDS_User_Guide/FDS_User_Guide.tex +++ b/Manuals/FDS_User_Guide/FDS_User_Guide.tex @@ -799,7 +799,7 @@ \section{Concatenating Input Files} \begin{lstlisting} &CATF OTHER_FILES='file_1.txt','file_2.txt' / \end{lstlisting} -adds the contents of the two listed files into the current input file. Up to 20 files can be listed on one {\ct CATF} line, and multiple {\ct CATF} lines can be included in the input file. After reading the input file, FDS creates a new input file, {\ct CHID\_cat.fds}, and then runs the case. +adds the contents of the two listed files into the current input file. The contents of the other files will be inserted at the location of each respective {\ct CATF} line in the input file. Up to 20 files can be listed on one {\ct CATF} line, and multiple {\ct CATF} lines can be included in the input file. After reading the input file, FDS creates a new input file, {\ct CHID\_cat.fds}, and then runs the case. When using this feature, limit the number of characters per line in both the original and added input files to 400. diff --git a/Source/read.f90 b/Source/read.f90 index 33d38e493a6..521ec0c7987 100644 --- a/Source/read.f90 +++ b/Source/read.f90 @@ -330,39 +330,33 @@ SUBROUTINE READ_CATF ENDIF ENDIF -! Load CHID file into LU_CATF: - -CALL COPY_FILE_TO_CAT(LU_INPUT,LU_CATF,0) - IF (N_MPI_PROCESSES > 1) CALL MPI_BARRIER(MPI_COMM_WORLD,IERR) ! One &CATF line by one add the corresponding OTHER_FILES into LU_CATF: REWIND(LU_INPUT) ; INPUT_FILE_LINE_NUMBER = 0 -TFI=0 -COPY_OFILES_LOOP: DO - CALL CHECKREAD('CATF',LU_INPUT,IOS) ; IF (STOP_STATUS==SETUP_STOP) RETURN - IF (IOS==1) EXIT COPY_OFILES_LOOP +COPY_OFILES_LOOP: DO TFI=1,N_CATF_LINES + CALL COPY_FILE_TO_CAT(LU_INPUT,LU_CATF,0) OTHER_FILES(:) = 'null' READ(LU_INPUT,NML=CATF,END=13,ERR=14,IOSTAT=IOS) 14 IF (IOS>0) THEN ; CALL SHUTDOWN('ERROR(101): Problem with CATF line.') ; RETURN ; ENDIF ! OPEN and copy other files into LU_CATF: OFI=0 CPY_LOOP: DO - TFI = TFI + 1 OFI = OFI + 1 IF(TRIM(OTHER_FILES(OFI))=='null') EXIT CPY_LOOP ! If it exists open it and copy its contents without the &HEAD line (if any) up to the first &TAIL / ! appearance or the EOF. OPEN(LU_CATF2,FILE=TRIM(OTHER_FILES(OFI)),ACTION='READ') IF (MY_RANK==0) THEN - IF (TFI>1) WRITE(LU_CATF,'(A)') + IF (OFI>1) WRITE(LU_CATF,'(A)') WRITE(LU_CATF,'(A)')'# Start of file '//TRIM(OTHER_FILES(OFI))//' :' ENDIF CALL COPY_FILE_TO_CAT(LU_CATF2,LU_CATF,OFI) CLOSE(LU_CATF2) ENDDO CPY_LOOP ENDDO COPY_OFILES_LOOP +CALL COPY_FILE_TO_CAT(LU_INPUT,LU_CATF,0) 13 REWIND(LU_INPUT) ; INPUT_FILE_LINE_NUMBER = 0 IF (N_MPI_PROCESSES > 1) CALL MPI_BARRIER(MPI_COMM_WORLD,IERR) @@ -422,9 +416,11 @@ SUBROUTINE COPY_FILE_TO_CAT(LU_INFILE,LU_OUTFILE,FILENUM) ! Advancing READ: 11 CONTINUE BACKSPACE(LU_INFILE); READ(LU_INFILE,'(A)') BUFFER2 - IF (BUFFER2(1:5)=='&HEAD') CYCLE COPY_IFILE_LOOP - IF (BUFFER2(1:5)=='&CATF') CYCLE COPY_IFILE_LOOP - IF (BUFFER2(1:5)=='&TAIL') EXIT COPY_IFILE_LOOP ! Do not copy the tail line to LU_CATF + IF (BUFFER2(1:6)=='&HEAD ') CYCLE COPY_IFILE_LOOP + IF (BUFFER2(1:6)=='&CATF ') THEN + BACKSPACE(LU_INFILE); EXIT COPY_IFILE_LOOP + ENDIF + IF (BUFFER2(1:6)=='&TAIL ') EXIT COPY_IFILE_LOOP ! Do not copy the tail line to LU_CATF IF(MY_RANK==0) WRITE(LU_OUTFILE,'(A)') TRIM(BUFFER2) ENDDO COPY_IFILE_LOOP 10 RETURN