Code for the F77ArrayOp component is in $TUTORIAL_SRC/components/arrayOps.F77ArrayOp/, in Impl file arrayOps_f77ArrayOp_Impl.f. Private component state is represented by entries an an array of SIDL opaque types. It is the responsibility of the programmer to ensure consistency of the treatment of entries in this array across method calls (this is similar to the way entries into common blocks are manipulated). Code for the creation and initialization of the private component state is in the component constructor method arrayOps_F77ArrayOp__ctor_fi.
tmp = 0 itmp = 0 call sidl_int__array_create1d_f(1, intArray) if (intArray .ne. 0) then call sidl_opaque__array_set1_f(stateArray, 0, tmp) call sidl_int__array_set1_f(intArray, 0, itmp) call sidl_opaque__array_set1_f(stateArray, 1, intArray) call sidl_opaque__array_set1_f(stateArray, 2, tmp) else . . .The SIDL built-in method arrayOps_F77ArrayOp__set_data_f is used to associate the newly created SIDL opaque array with this instance of the component. The method arrayOps_F77ArrayOp__get_data_f is used to retrieve this private data for further manipulation.
The method arrayOps_F77ArrayOp_mulMatVec_fi uses SIDL raw arrays arguments. In F77 implementation, SIDL raw arrays appear as regular F77 arrays, with zero-based indexing. The component uses the SIDL normal array accVector to store the running sum of the linear matrix operations. Note that this enables the dynamic sizing of this vector at runtime to match the dimensions of the array and vector arguments. Direct access to the underlying memory for SIDL normal arrays is done through the sidl_double__array_access_f method (for arrays of SIDL type double). This method computes uses a reference array (nativeVec) of size one, and computes the offset (refindex) that needs to be added to indices into nativeVec to access memory associated with SIDL normal array accVector.
call sidl_double__array_access_f(accVector, nativeVec, \$ lower, upper, stride, refindex) do i = 0, m-1 y(i) = nativeVec(refindex + i) do j = 0, n-1 y(i) = y(i) + alpha * A(i, j) * x(j) end do y(i) = y(i) + nativeVec(refindex + i) nativeVec(refindex + i) = y(i) end do
Accessing entries in a normal SIDL array can also be done through accessor subroutine calls. In the case of arrays of SIDL type double, the accessor subroutines are sidl_opaque__array_set1_f and sidl_opaque__array_get1_f (for single dimensional arrays).
if (accVector .eq. 0) then call sidl_double__array_create1d_f(m, accVector) call sidl_int__array_set1_f(intArray, 0, m) call sidl_opaque__array_set1_f(stateArray, 2, accVector) dblTmp = 0.0 do i = 0, m-1 call sidl_double__array_set1_f(accVector, i, dblTmp) end do else . . .
David E. Bernholdt [bek] 574-3147 2009-08-21