Nodes of different colours represent the following:
Solid arrows point from a parent (sub)module to the submodule which is descended from it. Dashed arrows point from a module being used to the module or program unit using it. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
SUBROUTINE GetMatrixInput
! SUBROUTINE INFORMATION:
! AUTHOR B. Griffith
! DATE WRITTEN June 2010
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! get input for Matrix objects
! METHODOLOGY EMPLOYED:
! <description>
! REFERENCES:
! na
! USE STATEMENTS:
USE InputProcessor, ONLY: GetNumObjectsFound, GetObjectItem, VerifyName
USE DataIPShortCuts ! Data for field names, blank numerics
USE General, ONLY: RoundSigDigits
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
! na
! SUBROUTINE PARAMETER DEFINITIONS:
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: NumTwoDimMatrix ! count of Matrix:TwoDimension objects
INTEGER :: MatIndex ! do loop counter
INTEGER :: MatNum ! index management
INTEGER :: NumAlphas ! Number of Alphas for each GetObjectItem call
INTEGER :: NumNumbers ! Number of Numbers for each GetObjectItem call
INTEGER :: IOStatus ! Used in GetObjectItem
LOGICAL :: ErrorsFound=.false. ! Set to true if errors in input, fatal at end of routine
LOGICAL :: IsNotOK ! Flag to verify name
LOGICAL :: IsBlank ! Flag for blank name
INTEGER :: NumRows
INTEGER :: NumCols
INTEGER :: NumElements
INTEGER :: ElementNum
INTEGER :: RowIndex
INTEGER :: ColIndex
cCurrentModuleObject = 'Matrix:TwoDimension'
NumTwoDimMatrix = GetNumObjectsFound(cCurrentModuleObject)
NumMats = NumTwoDimMatrix
ALLOCATE(MatData(NumMats))
MatNum = 0
DO MatIndex=1, NumTwoDimMatrix
CALL GetObjectItem(cCurrentModuleObject, MatIndex, cAlphaArgs, NumAlphas, rNumericArgs,NumNumbers, IOStatus, &
NumBlank=lNumericFieldBlanks,AlphaFieldnames=cAlphaFieldNames,NumericFieldNames=cNumericFieldNames)
MatNum = MatNum + 1
IsNotOK=.FALSE.
IsBlank=.FALSE.
CALL VerifyName(cAlphaArgs(1), MatData%Name, MatNum - 1, IsNotOK, IsBlank, TRIM(cCurrentModuleObject)//' Name')
IF (IsNotOK) THEN
ErrorsFound=.true.
IF (IsBlank) cAlphaArgs(1)='xxxxx'
ENDIF
MatData(MatNum)%Name = cAlphaArgs(1)
NumRows = Floor(rNumericArgs(1))
NumCols = Floor(rNumericArgs(2))
NumElements = NumRows * NumCols
! test
IF (NumElements < 1) THEN
CALL ShowSevereError('GetMatrixInput: for '//TRIM(cCurrentModuleObject)//': '//TRIM(cAlphaArgs(1)))
CALL ShowContinueError('Check '//TRIM(cNumericFieldNames(1))//' and '//TRIM(cNumericFieldNames(2))// &
' total number of elements in matrix must be 1 or more')
ErrorsFound=.true.
ENDIF
IF ((NumNumbers - 2) < NumElements) THEN
CALL ShowSevereError('GetMatrixInput: for '//TRIM(cCurrentModuleObject)//': '//TRIM(cAlphaArgs(1)))
CALL ShowContinueError('Check input, total number of elements does not agree with '&
//TRIM(cNumericFieldNames(1))//' and '//TRIM(cNumericFieldNames(2)))
ErrorsFound=.true.
ENDIF
ALLOCATE(MatData(MatNum)%Mat2D(NumRows, NumCols)) ! This is standard order for a NumRows X NumCols matrix
ALLOCATE(MatData(MatNum)%Dim(2))
MatData(MatNum)%MatrixType = TwoDimensional
MatData(MatNum)%Dim(1) = NumRows
MatData(MatNum)%Dim(2) = NumCols
RowIndex = 1
ColIndex = 1
DO ElementNum=1, NumElements
RowIndex = (ElementNum -1)/NumCols + 1
ColIndex = Mod((ElementNum -1), NumCols) + 1
MatData(MatNum)%Mat2D(RowIndex, ColIndex) = rNumericArgs(ElementNum + 2) !Matrix is read in row-by-row
!Note: this is opposite to usual FORTRAN array storage
ENDDO
ENDDO
IF (ErrorsFound) THEN
CALL ShowFatalError('GetMatrixInput: Errors found in Matrix objects. Preceding condition(s) cause termination.')
ENDIF
RETURN
END SUBROUTINE GetMatrixInput