libsim Versione 7.2.6

◆ displayreal()

subroutine displayreal ( class(reallist), intent(inout) this)

Print the real list.

Definizione alla linea 79 del file list_real.F03.

80!> \brief class to use lists in fortran 2003.
81!!
82!! Linked data structure is a data structure which
83!! consists of a set of data records (nodes) linked together and organized by references .
84!!
85!! A doubly-linked list is a linked data structure that consists of a set
86!! of sequentially linked records called nodes. Each node contains two
87!! fields, called links, that are references to the previous and to the
88!! next node in the sequence of nodes. The beginning and ending nodes'
89!! previous and next links, respectively, point to some kind of
90!! terminator.
91!!
92!! The program example is the better starting point:
93!!\include example_list.F03
94!!\ingroup base
95!!
96module list_real
98 private
99 public :: reallist
100!> Real specific implementation of doubly-linked list
101!!
102!! extend list_abstract::list
103 type, extends(list) :: reallist
104#ifdef DOXYGEN
105 integer::none ! doxigen workaround: if missed do not show procedure
106#endif
107 contains
108! procedure :: addReal !< add real in list
109 procedure :: current => currentreal !< get real pointed by iterator
110 procedure :: display => displayreal !< print the real list
111! generic :: add => addReal
112 end type reallist
113
114contains
115
116!> Print the real list
117subroutine displayreal(this)
118class(realList),intent(inout) :: this
119
120call this%rewind()
121do while(this%element())
122 print *,"index:",this%currentindex()," value:", this%current()
123 call this%next()
124end do
125end subroutine displayreal
126
127!!$ subroutine addReal(this, value)
128!!$ class(realList) :: this
129!!$ real value
130!!$ class(*), allocatable :: v
131!!$
132!!$ allocate(v,source=value)
133!!$ call this%addvalue(v)
134!!$
135!!$ end subroutine addReal
136
137
138!> get real pointed by iterator
139real function currentreal(this)
140class(realList) :: this
141class(*), pointer :: v
142
143v => this%currentpoli()
144select type(v)
145type is (real)
146 currentreal = v
147end select
148end function currentreal
149
150end module list_real
abstract class to use lists in fortran 2003.
class to use lists in fortran 2003.
Definition list_real.F03:58
Abstract implementation of doubly-linked list.
Real specific implementation of doubly-linked list.
Definition list_real.F03:65

Generated with Doxygen.