Compiler Preprocessor (size)

Preprocessing: the preprocessor searches a set of sources files for a specific set of symbols, replace those symbols with other symbols or numbers, perform simple arithmetic, and write the result to a new set of files.

  • Predefine array dimensions
  • Turn on/off certain function calls
  • Include or exclude certain physical models
  • Include or exclude visualization capability
  • Include or exclude parallel communications
  • Include or exclude multiblock interface cal.
  • Example 1: predefine array dimensions
    • In a size control file, frame1.siz
    Replace_Symbols
    MXBLKS 3

    • In a source file, mcontrol.dh
    INTEGER blkmodel($MXBLKS)
    • In the target file after preprocessed, mcontrol.h
    INTEGER blkmodel(3)
  • Example 2: exclude physical models
    • In source file ipars.df
    $BLKCKI CALL ISTEP(KERR)
    $HYDROI CALL HSTEP(KERR)
    $TRCHEM CALL TRSTEP(KERR)

    • In the target file after preprocessed, ipars.f
    CALL ISTEP(KERR) (if blacki.siz is included)
    C CALL HSTEP(KERR)
    C CALL TRSTEP(KERR)
  • Example 3: exclude parallel communications
    • In source file istep.df
    $MANY CALL UPDATE(N_PWAT,1)
    • In the target file after preprocessed, istep.f
    C CALL UPDATE(N_PWAT,1) (if lnx.siz is included)
    CALL UPDATE(N_PWAT,1) (if beo.siz is included)
 

Written by Center for Subsurface Modeling