This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
prokop_hapala [2012/10/08 10:13] prokop |
prokop_hapala [2012/11/30 13:01] (current) |
||
|---|---|---|---|
| Line 4: | Line 4: | ||
| http://www.pgroup.com/lit/articles/insider/v3n1a3.htm | http://www.pgroup.com/lit/articles/insider/v3n1a3.htm | ||
| - | [code] | + | module myModule |
| - | module myModule | + | implicit none |
| - | implicit none | + | |
| - | + | type myType | |
| - | type myType | + | integer :: n |
| - | integer :: n | + | real, dimension (:, :), allocatable :: Rs |
| - | real, dimension (:, :), allocatable :: Rs ! positions of atoms | + | |
| contains | contains | ||
| - | procedure :: myMethod | + | procedure :: myMethod |
| - | end type subSystem | + | end type subSystem |
| - | + | ||
| - | type (myType) :: myInstance | + | type (myType) :: myInstance |
| - | + | ||
| - | contains | + | contains |
| - | subroutine myMethod ( this, myVar) | + | |
| - | class (subSystem) :: this | + | subroutine myMethod ( this, myVar) |
| - | real :: myVar | + | class (subSystem) :: this |
| - | integer i | + | real :: myVar |
| - | allocate (this%Rs(3,this%n)) | + | integer i |
| - | do i = 1, this%n | + | allocate (this%Rs(3,this%n)) |
| - | this%Rs(:,i) = myVar | + | do i = 1, this%n |
| - | end do | + | this%Rs(:,i) = myVar |
| - | end subroutine myMethod | + | end do |
| - | end module glob_vars | + | end subroutine myMethod |
| - | + | ||
| - | call myInstance%myMethod(myVar) | + | end module glob_vars |
| - | + | ||
| - | [code] | + | call myInstance%myMethod(myVar) |
| Line 103: | Line 101: | ||
| [[BrainSorm]] | [[BrainSorm]] | ||
| + | |||
| + | === OTHER === | ||
| + | |||
| + | [[Wiki Playground]] | ||