Code for the F90ArrayOp component is in $TUTORIAL_SRC/components/arrayOps.F90ArrayOp, in the Impl files arrayOps_F90ArrayOp_Impl.F90 and arrayOps_F90ArrayOp_Mod.F90. Private component state is represented by the type arrayOps_F90ArrayOp_priv in the file arrayOps_F90ArrayOp_Mod.F90
type arrayOps_F90ArrayOp_priv sequence ! DO-NOT-DELETE splicer.begin(arrayOps.F90ArrayOp.private_data) ! Bocca generated code. bocca.protected.begin(arrayOps.F90ArrayOp.private_data) ! Handle to framework Services object type(gov_cca_Services_t) :: d_services ! Bocca generated code. bocca.protected.end(arrayOps.F90ArrayOp.private_data) real (selected_real_kind(15, 307)), dimension(:), pointer :: myVectorP integer (selected_int_kind(9)) :: myVecLen ! DO-NOT-DELETE splicer.end(arrayOps.F90ArrayOp.private_data) end type arrayOps_F90ArrayOp_privThe constructor subroutine arrayOps_F90ArrayOp__ctor_mi contains the Bocca -generated code for the allocation and initialization of the private data associated with this component instance
type(arrayOps_F90ArrayOp_wrap) :: dp ! Allocate memory and initialize allocate(dp%d_private_data) call set_null(dp%d_private_data%d_services) dp%d_private_data%myVectorP => NULL() call arrayOps_F90ArrayOp__set_data_m(self, dp)The call to the built-in method arrayOps_F90ArrayOp__set_data_m associates the newly created structure pointed to via dp with this instance of the component. The corresponding method arrayOps_F90ArrayOp__get_data_m is used to retrieve this private data for further processing.
The subroutine that implements the mulMatVec method uses SIDL raw arrays (note that the name of this subroutine is altered by Babel to accomodate F90 identifier length restrictions ). SIDL raw arrays manifest themselves in F90 implementations as regular F90 arrays that use zero-based indexing.
real (selected_real_kind(15, 307)), dimension(0:m-1, 0:n-1) :: A ! in real (selected_real_kind(15, 307)), dimension(0:n-1) :: x ! in real (selected_real_kind(15, 307)), dimension(0:m-1) :: y ! inout
The subroutine that implements the addVec method uses SIDL normal arrays. SIDL normal arrays are represented as user defined types, with a pointer data member (d_datathat points to an F90 array built on top of the underlying SIDL array memory. While access to SIDL normal array entries can be achieved via accessor subroutines (set and get - defined for all native SIDL types and user defined classes and interfaces), it is more convenient (and efficient) to access those entries directly via the d_data pointer.
vdata => v%d_data rdata => r%d_data rdata = pd%myVectorP + beta * vdata pd%myVectorP = rdata
When implementing a method that has SIDL normal arrays as arguments, it should not be assumed that the array is contiguous in memory (stride=1). SIDL normal arrays allow for different strides in all dimensions. The Babel runtime build the correct F90 array descriptor (dope vector) that correctly reflects the strides used to create the SIDL array.
David E. Bernholdt [bek] 574-3147 2009-08-21