Functions
in Class Matrix.MyMatrix
|
!
Matrix_MyMatrix.f
! - DLL routines for class <Reference>Matrix.MyMatrix
! DATE: Thursday, December 07, 2000 TIME: 03:27:25 PM
! The skeleton of this file is generated by SansGUI(tm)
!
Attribute indices in class version [1.0.alpha.3]
! 1: iCols - Number of Columns
! 2: iRows - Number of Rows
! 3: iSheets - Number of Sheets
! 4: fMatData - Matrix Data
!
======================================================================
! SG_xLoadSize - Resize for Load
! ----------------------------------------------------------------------
integer function
SG_xLoadSize_Matrix_MyMatrix(self,
&
&
simCtrl, chgChild,
&
&
pRefObjs, iRefObjs,
&
&
pAdjObjs, iAdjObjs,
&
&
pLnkObjs, iLnkObjs,
&
&
cMessage, cCommand, pOutFile )
!DEC$ IF DEFINED (_DLL)
!DEC$ ATTRIBUTES DLLEXPORT :: SG_xLoadSize_Matrix_MyMatrix
!DEC$ END IF
include "SGdllf.h"
! TODO: declare your local variables here |
integer, dimension(*) :: iCols
integer, dimension(*) :: iRows
POINTER(PTR_iCols, iCols)
POINTER(PTR_iRows, iRows)
integer, parameter :: SG_NDX_ICOLS = 1
integer, parameter :: SG_NDX_IROWS = 2 |
if (self%nSGobjSchema .ne. SG_OBJ_SCHEMA) then
SG_xLoadSize_Matrix_MyMatrix = SG_R_SCHM
return
end if
! TODO: put your simulator code here |
PTR_zValues = self%pzValues
PTR_iCols = zValues(SG_NDX_ICOLS)%vData
PTR_iRows = zValues(SG_NDX_IROWS)%vData
iCols(1) = 2
iRows(1) = 360 |
SG_xLoadSize_Matrix_MyMatrix = SG_R_OK
return
end
!
======================================================================
! SG_xLoad - Load Data
! ----------------------------------------------------------------------
integer function
SG_xLoad_Matrix_MyMatrix(self,
&
&
simCtrl, chgChild,
&
&
pRefObjs, iRefObjs,
&
&
pAdjObjs, iAdjObjs,
&
&
pLnkObjs, iLnkObjs,
&
&
cMessage, cCommand, pOutFile )
!DEC$ IF DEFINED (_DLL)
!DEC$ ATTRIBUTES DLLEXPORT :: SG_xLoad_Matrix_MyMatrix
!DEC$ END IF
include "SGdllf.h"
! TODO: declare your local variables here |
integer, dimension(*) :: iCols
integer, dimension(*) :: iRows
real*4, dimension(*) :: fMatData
real*4 :: fRadians
integer :: i
POINTER(PTR_iCols, iCols)
POINTER(PTR_iRows, iRows)
POINTER(PTR_fMatData, fMatData)
integer, parameter :: SG_NDX_ICOLS = 1
integer, parameter :: SG_NDX_IROWS = 2
integer, parameter :: SG_NDX_FMATDATA = 4 |
if (self%nSGobjSchema .ne. SG_OBJ_SCHEMA) then
SG_xLoad_Matrix_MyMatrix = SG_R_SCHM
return
end if
! TODO: put your simulator code here |
PTR_zValues = self%pzValues
PTR_iCols = zValues(SG_NDX_ICOLS)%vData
PTR_iRows = zValues(SG_NDX_IROWS)%vData
PTR_fMatData =
zValues(SG_NDX_FMATDATA)%vData
if (iCols(1) .lt. 2) then
cMessage = 'Error:
need to have at least 2 columns.'C
SG_xLoad_Matrix_MyMatrix = SG_R_STOP
return
end if
do i = 1, iRows(1)
fRadians = 3.14159
/ 180. * i
fMatData(i) =
SIN(fRadians)
fMatData(iRows(1) +
i) = COS(fRadians)
end do |
SG_xLoad_Matrix_MyMatrix = SG_R_OK
return
end
!
======================================================================
! SG_xEval - Evaluation
! ----------------------------------------------------------------------
integer function
SG_xEval_Matrix_MyMatrix(self,
&
&
simCtrl, chgChild,
&
&
pRefObjs, iRefObjs,
&
&
pAdjObjs, iAdjObjs,
&
&
pLnkObjs, iLnkObjs,
&
&
cMessage, cCommand, pOutFile )
!DEC$ IF DEFINED (_DLL)
!DEC$ ATTRIBUTES DLLEXPORT :: SG_xEval_Matrix_MyMatrix
!DEC$ END IF
include "SGdllf.h"
! TODO: declare your local variables here |
integer, dimension(*) :: iCols
integer, dimension(*) :: iRows
real*4, dimension(*) :: fMatData
integer, dimension(*) :: nCycle
real*4, dimension(*) :: fData1
real*4, dimension(*) :: fData2
real*4, dimension(*) :: fSum
integer :: iNdx
type (SG_VALU), dimension(*) :: simValues
POINTER(PTR_iCols, iCols)
POINTER(PTR_iRows, iRows)
POINTER(PTR_fMatData, fMatData)
POINTER(PTR_nCycle, nCycle)
POINTER(PTR_fData1, fData1)
POINTER(PTR_fData2, fData2)
POINTER(PTR_fSum, fSum)
POINTER(PTR_simValues, simValues)
! indices for Matrix.MyMatrix class
integer, parameter :: SG_NDX_ICOLS = 1
integer, parameter :: SG_NDX_IROWS = 2
integer, parameter :: SG_NDX_FMATDATA = 4
! indices for simControl.cycle.MyMatrix
class
integer, parameter :: SG_NDX_NCYCLE = 4
integer, parameter :: SG_NDX_FDATA1 = 10
integer, parameter :: SG_NDX_FDATA2 = 11
integer, parameter :: SG_NDX_FSUM = 12 |
if (self%nSGobjSchema .ne. SG_OBJ_SCHEMA) then
SG_xEval_Matrix_MyMatrix = SG_R_SCHM
return
end if
! TODO: put your simulator code here |
PTR_zValues = self%pzValues
PTR_iCols = zValues(SG_NDX_ICOLS)%vData
PTR_iRows = zValues(SG_NDX_IROWS)%vData
PTR_fMatData =
zValues(SG_NDX_FMATDATA)%vData
if (iCols(1) .lt. 2) then
cMessage = 'Error:
at least 2 columns in the matrix.'C
SG_xEval_Matrix_MyMatrix = SG_R_STOP
return
end if
if (iRows(1) .lt. 1) then
cMessage = 'Error:
at least 1 row in the matrix.'C
SG_xEval_Matrix_MyMatrix = SG_R_STOP
return
end if
PTR_simValues = simCtrl%pzValues
PTR_nCycle = simValues(SG_NDX_NCYCLE)%vData
PTR_fData1 = simValues(SG_NDX_FDATA1)%vData
PTR_fData2 = simValues(SG_NDX_FDATA2)%vData
PTR_fSum = simValues(SG_NDX_FSUM)%vData
iNdx = MOD(nCycle(1), iRows(1)) + 1
fData1(1) = fMatData(iNdx)
fData2(1) = fMatData(iRows(1) + iNdx)
fSum(1) = fData1(1) + fData2(1) |
SG_xEval_Matrix_MyMatrix = SG_R_OK
return
end |