!   TITLE:  mat_library.mac (MANAGEMENT)
!
!
!   OBJECTIVE:
!
!   This macro assigns material constants, numbers and names to the material
!   arrays.
!
!
!   COMMAND SYNTAX:
!
!                          (1)
!           MAT_LIBRARY, mat_name
!
!
!   ARGUMENTS:
!
!           (1) mat_name = material name to be assigned.
!
!
!   DESCRIPTION:
!
!   The material arrays containing all pertinent material data are:
!
!       prop_lab = the 42 x 1 array containing the character names of the
!                  various material properties. There are 42 properties in
!                  all, therefore, each row element is a material property.
!
!       mat_name = the 1 x N character array containing the material
!                  names. Each column element of this array is a specific
!                  material name.
!
!       mat_prop = the 43 x N scalar array containing the material
!                  numbers and property values. The 1st row of this array
!                  contains the material numbers assigned to the material
!                  names, where each column corresponds to the columns of
!                  the array 'mat_name'; and the rows correspond to the
!                  the material property labels in array 'prop_lab'. The
!                  values of these material properties are stored in this
!                  array, where the row index is the material property
!                  label (e.g., EX, DENS, VISC, etc.) and the column is the
!                  material.
!
!           For example:
!
!           material name --->  al6061 = 1  <--- the material number, which
!                                                is column 1 of 'mat_name'.
!
!           material name --->  ti5057 = 2  <--- the material number, which
!                   .             .      .       is column 2 of 'mat_name'.
!                   .             .      .              .
!                   .             .      .              .
!                   .             .      .              .
!           material name --->  cres17 = N  <--- the material number, which
!                                                is column N of 'mat_name'.
!
!
!           N is the number of assigned materials.
!
!
!
*get,prkey_,active,0,prkey
/nopr
!
mat_=arg1
!
!
!
!
numprop_=42
!
*get,ptyp1_,parm,prop_lab,type
!
*if,ptyp1_,ne,4,then
    *dim,prop_lab,char,numprop_,1       ! create property label array
        !
        prop_lab(1,1)='EX'          ! Elastic (Young's) Moduli (X)
        prop_lab(2,1)='EY'          ! Elastic (Young's) Moduli (Y)
        prop_lab(3,1)='EZ'          ! Elastic (Young's) Moduli (Z)
        !
        prop_lab(4,1)='ALPX'        ! Coefficients of Thermal Expansion (X)
        prop_lab(5,1)='ALPY'        ! Coefficients of Thermal Expansion (Y)
        prop_lab(6,1)='ALPZ'        ! Coefficients of Thermal Expansion (Z)
        !
        prop_lab(7,1)='REFT'        ! Reference Temperature
        !
        prop_lab(8,1)='PRXY'        ! Major Poisson's Ratio (XY)
        prop_lab(9,1)='PRYZ'        ! Major Poisson's Ratio (YZ)
        prop_lab(10,1)='PRXZ'       ! Major Poisson's Ratio (XZ)
        !
        prop_lab(11,1)='NUXY'       ! Minor Poisson's Ratio (XY)
        prop_lab(12,1)='NUYZ'       ! Minor Poisson's Ratio (YZ)
        prop_lab(13,1)='NUXZ'       ! Minor Poisson's Ratio (XZ)
        !
        prop_lab(14,1)='GXY'        ! Shear Moduli (XY)
        prop_lab(15,1)='GYZ'        ! Shear Moduli (YZ)
        prop_lab(16,1)='GXZ'        ! Shear Moduli (XZ)
        !
        prop_lab(17,1)='DAMP'       ! Damping Matrix Multiplier
        !
        prop_lab(18,1)='MU'         ! Coefficient of Friction
        !
        prop_lab(19,1)='DENS'       ! Mass Density
        !
        prop_lab(20,1)='C'          ! Specific Heat
        !
        prop_lab(21,1)='ENTH'       ! Enthalpy
        !
        prop_lab(22,1)='KXX'        ! Thermal Conductivities (X)
        prop_lab(23,1)='KYY'        ! Thermal Conductivities (Y)
        prop_lab(24,1)='KZZ'        ! Thermal Conductivities (Z)
        !
        prop_lab(25,1)='HF'         ! Convection (Film) Coefficient
        !
        prop_lab(26,1)='EMIS'       ! Emissivity
        !
        prop_lab(27,1)='QRATE'      ! Heat Generation Rate
        !
        prop_lab(28,1)='VISC'       ! Viscosity
        !
        prop_lab(29,1)='SONC'       ! Sonic Velocity
        !
        prop_lab(30,1)='RSVX'       ! Electrical Resistivities (X)
        prop_lab(31,1)='RSVY'       ! Electrical Resistivities (Y)
        prop_lab(32,1)='RSVZ'       ! Electrical Resistivities (Z)
        !
        prop_lab(33,1)='PERX'       ! Electrical Permittivities (X)
        prop_lab(34,1)='PERY'       ! Electrical Permittivities (Y)
        prop_lab(35,1)='PERZ'       ! Electrical Permittivities (Z)
        !
        prop_lab(36,1)='MURX'       ! Magnetic Relative Permeabilities (X)
        prop_lab(37,1)='MURY'       ! Magnetic Relative Permeabilities (Y)
        prop_lab(38,1)='MURZ'       ! Magnetic Relative Permeabilities (Z)
        !
        prop_lab(39,1)='MGXX'       ! Magnetic Coercive Forces (X)
        prop_lab(40,1)='MGYY'       ! Magnetic Coercive Forces (Y)
        prop_lab(41,1)='MGZZ'       ! Magnetic Coercive Forces (Z)
        !
        prop_lab(42,1)='LSST'       ! Dielectric Loss Tangent
*endif
!
!
!
!
*get,ptyp2_,parm,mat_prop,type
!
*if,ptyp2_,ne,1,then                ! create material property array
    *dim,mat_prop,array,numprop_+1,1
*else
    *get,matpc_,parm,mat_prop,dim,y
    !
    *dim,matpbuf_,array,numprop_+1,matpc_
    !
    *do,bcd_,1,matpc_,1
        *do,cde_,2,numprop_+1,1
            matpbuf_(cde_,bcd_)=mat_prop(cde_,bcd_)
        *enddo
    *enddo
    !
    *set,mat_prop(1),
    !
    *dim,mat_prop,array,numprop_+1,matpc_+1
    !
    *do,bcd_,1,matpc_,1
        *do,cde_,2,numprop_+1,1
            mat_prop(cde_,bcd_)=matpbuf_(cde_,bcd_)
        *enddo
    *enddo
    !
    *get,matpc_,parm,mat_prop,dim,y
    !
    *set,matpbuf_(1),
*endif
!
!
!
!
mat_list
!
!
!
*do,ijk_,1,numprop_,1
    !
    prop_=prop_lab(ijk_,1)
    !
    *get,typ_,parm,%prop_%,type
    !
    *if,typ_,eq,0,then
        arry_search,'prop_lab','%prop_%'
        row_=hit(1,1)
        !
        arry_search,'mat_name','%mat_%'
        col_=hit(1,2)
        !
        mat_prop(row_+1,col_)=%prop_%
    *endif
    !
    *set,%prop_%
*enddo
!
!
*set,ijk_,
*set,prop_,
*set,row_,
*set,col_,
*set,mat_,
*set,matpc_,
*set,cde_,
*set,bcd_,
*set,numprop_,
*set,ptyp1_,
*set,ptyp2_,
*set,typ_,
!
*if,prkey_,eq,1,then
    /go
*endif