C INCLUDE 'val.inc' C ------------------------------------------------------------------ INTEGER NPAR PARAMETER (NPAR=500000) INTEGER IPAR(0:NPAR) REAL RPAR(0:NPAR) EQUIVALENCE (IPAR,RPAR) COMMON/VALC/IPAR SAVE /VALC/ C ------------------------------------------------------------------ C Common block /VALC/ is included in subroutines VAL1 and VAL2. C The parameters are stored sequentially in one array regardless of C the fact whether they are of type INTEGER or REAL. The individual C numeric storage units of the array are indexed starting from 0 and C are named IPAR(I) or RPAR(I) depending on the type of a parameter. C The index of the last allocated numeric storage unit is NPAR (see C (f) below). If NPAR is changed (see the third statement of the C above block data subroutine VALB), it must be adjusted in C subroutines VAL1 and VAL2, too. C C Common block /VALC/ can be divided into two parts. The first part C (see (a)-(d) below) of the common block /VALC/ contains integers. C The number of these integers in the first part equals to C 1+MCLASS+NG+NF, where MCLASS is the total number of classes, NG is C the total number of all groups of all classes, NF is the total C number of all functions of all groups of all classes. The first C part of the common block specifies the division of the common C block /VALC/ into parameters describing individual functions. C The second part (see (e) below) of the common block /VALC/ C contains the parameters describing individual functions, stored C successively for the first, second, ..., last function of the c first group of the first class, for the first, second, ..., last c function of the second group of the first class, ..., for the c first, second, ..., last function of the first group of the second c class, ..., for the first, second, ..., last function of the last C group of the last class. The second part of the common block C /VALC/ contains both integer and real parameters. C For an example refer to the sample input data for the model. C C (a) Numeric storage unit IPAR(0) contains the number MCLASS of C classes. C C (b) Classes: C Subsequent numeric storage units (IPAR(I),I=1,MCLASS) correspond C to the individual classes. One numeric storage unit corresponds C to one class. The numeric storage unit corresponding to a class C contains the index of the numeric storage unit corresponding to C the last group of the class. C C (c) Groups: C Subsequent numeric storage units (IPAR(I),I=MCLASS+1,MCLASS+NG) C correspond to the individual groups. The total number of these C storage units is NG. One numeric storage unit corresponds to one C group. The numeric storage unit corresponding to a group contains C the index of the numeric storage unit corresponding to the last C function of the group. C C (d) Functions: C Subsequent numeric storage units (IPAR(I),I=MCLASS+NG+1, C MCLASS+NG+NF) correspond to the individual functions. The total C number of these storage units is NF. One numeric storage unit C corresponds to one function. The numeric storage unit C corresponding to a function contains the index of the numeric C storage unit corresponding to the last parameter that describes C the function. The functions are stored in the order in which they C have been specified by the input data. Since the number of C functions in the input data corresponding to one group may be less C than their maximum number NFUNCT (input parameter of subroutine C VAL1), some numeric storage units relevant to functions may not C correspond to the functions specified by the input data. Each C such numeric storage unit contains the same address as the C previous numeric storage unit (i.e. the corresponding function is C specified by no parameter) and has no influence on the function C evaluation. C C (e) Parameters of functions: C Subsequent numeric storage units (IPAR(I),I=MCLASS+NG+NF+1, C MCLASS+NG+NF+NP) contain the parameters describing individual C functions. Here we have denoted by NP the total number of these C storage units. Any number of numeric storage units may correspond C to the parameters of one function. The first numeric storage unit C corresponding to a function contains the integer that identifies C the physical meaning of the function, e.g. its values may C identify P-wave velocity, S-wave velocity, density, etc. The C second numeric storage unit contains the power of the physical C quantity, see 'Input data for one function' (1). If item (1) of C 'Input data for one function' is omitted, the two first numeric C storage units corresponding to the parameters of the function C contain 1 (the first INTEGER, the second REAL). The subsequent C numeric storage units contain 'Input data for one function' (2), C (3), (4), (5) and (6), stored in the same amount as read from the C input data. Data (4), (5), (6) and (7) are reordered to render C the grid coordinates in ascending order. Instead of the grid C values (7), the coefficients describing the function in terms of a C B-spline under tension basis are stored (only if subroutine CURVN1 C (Hermite representation) is used, the grid values (7) are stored). C These parameters are followed by arrays of length 5*NX(1), ..., C 5*NX(NVAR) respectively, containing the B-spline under tension C basis data computed for the projections of the grid onto the axes C of individual independent variables (only if subroutine CURVN1 C (Hermite representation) is used, the first NX(1) numeric storage C units contain the second derivatives and the following 4*NX(1) C numeric storage units are undefined. C C (f) Undefined part of the common block: C Subsequent numeric storage units (IPAR(I),I=MCLASS+NG+NF+NP+1, C NPAR) are undefined. C C Memory model of the common block /VALC/: C ------------------------------------------------------------------ C Address: 0 JCLASS-1 JCLASS JGROUP-1 JGROUP JFUNCT-1 JFUNCT C Value: MCLASS LGROUP-1 MGROUP LFUNCT-1 MFUNCT LADR-1 MADR C .................................................................. C For the meaning of individual items in this table see below. C ------------------------------------------------------------------ C The way of access to IFUNCT-th function of IGROUP-th group of the C ICLASS-th class: C Address of last class..................... MCLASS=IPAR(0) C Address of ICLASS-th class................ JCLASS=ICLASS C (It must be: 1.LE.JCLASS.LE.MCLASS) C Address of first group of the class....... LGROUP=IPAR(JCLASS-1)+1 C Address of last group of the class........ MGROUP=IPAR(JCLASS) C Address of IGROUP-th group of the class... JGROUP=LGROUP-1+IGROUP C (it must be: LGROUP.LE.JGROUP.LE.MGROUP) C Address of first function of the group.... LFUNCT=IPAR(JGROUP-1)+1 C Address of last function of the group..... MFUNCT=IPAR(JGROUP) C Address of IFUNCT-th function of the group JFUNCT=LFUNCT-1+IFUNCT C (it must be: LFUNCT.LE.JFUNCT.LE.MFUNCT) C Address of first function parameter....... LADR=IPAR(JFUNCT-1)+1 C Address of last function parameter........ MADR=IPAR(JFUNCT) C The parameters of the function are stored in IPAR(LADR) to C IPAR(MADR). C C Common block /VALC/ is included in FORTRAN 77 source code file C 'val.for', and also in source code files 'invsoft.for' and C 'invtt.for' of package CRT. C C Date: 1999, September 15 C Coded by Ludek Klimes C C======================================================================= C