Subject: Pest models damage code processing restructured
Name: Lance R. David
Date: August 2, 2007
Variants affected: ALL western variants with I&D extensions 

Description:

Restructured FVS pest extension damage/severity code processing to occur at
end of keyword set to elliminate keyword order dependencies. Damage codes 
are stored in new array, DAMSEV(6,MAXTRE) in ARRAYS.F77 common, during input
of tree data and a new subroutine dampro.f was added to fvs\base to control 
extensions damage code processing. Dampro.f is call from initre.f in the
"Process" keyword section.

An existing error in the LPMPB model was corrected, dead LP with dam/sev 
code 2/3 were not properly reported as dead in the LPMPB damage code table 
associated with the InvMort keyword.

Obsolete pest model subdirectories to obj (for PN_WC and CR) were deleted 
as well as the CR-specific mpbincr.f source file that use to address varying
tree specie sets for the different model types. This deletions also involved
makefile updates to remove the obsolete folder references which were not 
actively utilized in any of the pest model links.


Impact on users:

1) Insect and pathogen model keywords no longer need to exist prior to input
   tree data processing in order to utilize their relevent damage/severity codes. 
2) An error in the Lodgepole Mountain Pine Beetle model in processing and
   reporting of dam/sev codes for dead trees was found and corrected. Users 
   will get different results for simulations that use the LPMPB keyword InvMort.

Files:

makefiles - added compile instructions for new subroutine dampro.f
            added PRGPRM.F77 and ARRAYS.F77 to damcds.f dependency list
            removed references to deleted obsolete pest directories
            added dampro to link lists

ARRAY.F77 : Added array DAMSEV(6,MAXTRE) to store damage and severity codes.

INTREE.F : Reduced argument list on call to DAMCDS.
           Added initialization of DAMSEV array.
           Added code to relocate DAMSEV values when moving dead tree to
           ends of arrays.

DAMCDS.F : Added code to store damage and severity codes in new array
           DAMSEV(6,MAXTRE) for later processing by pest extensions. Added
           includes of PRGPRM.F77 and ARRAYS.F77.

           With damage code processing moved to later point in time, tree
           variables that were originally passed to this subroutine for
           the pest extension processing will be available from the common
           blocks.

           Argument list reduced to:
            (II,ICODES)
           from:
            (II,IITH,IDD,ICODES,PROBB,HHT,DDBH,IISPI,ITREII,TTHT,IREC2,LDELTR)
           
           Removed calls to pest extension damage code processing routines:
             MISDAM (II,ICODES)
             RDDAM  (II,IITH,IDD,ICODES,PROBB,HHT,DDBH,IISPI,ITREII,TTHT)
             TMDAM  (II,IDD,ICODES)
             MPBDAM (II,IDD,ICODES,IITH,IREC2,IISPI,LDELTR)
             DFBDAM (II,ICODES,IITH,IREC2,LDELTR)
             BRDAM  (II,ICODES)
             BMDAM  (II,IITH,ICODES)

DAMPRO.F : New subroutine called from INITRE at the "PROCESS" keyword section.
           Controls the processing of damage/severity codes and calls each pest
           extention damage code processor.
             MISDAM (II,ICODES)
             RDDAM  (II,ICODES)
             TMDAM  (II,ICODES)
             MPBDAM (II,ICODES)
             DFBDAM (II,ICODES)
             BRDAM  (II,ICODES)
             BMDAM  (II,ICODES)

INITRE.F : Added call to new subroutine (DAMPRO) to process damage codes in the
           "OPTION NUMBER 1: PROCESS" section.

MISDAM.F : Items addressed in each of these damage code processing routines include:
RDDAM.F      - conditionals on tree history codes 6,7,8,9 change to management
TMDAM.F        codes (IMC) 7,9.
MPBDAM.F     - no need to handle trees that "will be deleted" (LDELTR), already gone.
DFBDAM.F     - speacial handling of dead tree index values no longer necessary, all
BRDAM.F        values of dead trees already in proper locations at end of arrays.
BMDAM.F      - all tree variables accessed directly from common area instead
               of being passed as arguments.

MPBIN.F : Improved the text written for InvMort keyword

Deleted obsolete folders fvs\annosus, fvs\root, fvs\wsbw.
Deleted obolete lpmpb\src\mpbincr.f

Updated pest model stubs in base\src for change of argument list of damage code
processing subroutines:

base\src\exbm.f   - ENTRY BMDAM (I1,I2)
base\src\exdfb.f  - ENTRY DFBDAM (II,ICODES)
base\src\exdftm.f - ENTRY TMDAM (II,ICODES)
base\src\exmpb.f  - ENTRY MPBDAM (II,ICODES)
base\src\exrd.f   - ENTRY RDDAM  (II,ICODES)