libsim Versione 7.2.6
|
◆ currentmix()
get class(*) pointed by iterator Definizione alla linea 115 del file list_mix.F03. 116!> \brief class to use lists in fortran 2003.
117!!
118!! Linked data structure is a data structure which
119!! consists of a set of data records (nodes) linked together and organized by references .
120!!
121!! A doubly-linked list is a linked data structure that consists of a set
122!! of sequentially linked records called nodes. Each node contains two
123!! fields, called links, that are references to the previous and to the
124!! next node in the sequence of nodes. The beginning and ending nodes'
125!! previous and next links, respectively, point to some kind of
126!! terminator.
127!!
128!! The program example is the better starting point:
129!!\include example_list.F03
130!!\ingroup base
131!!
135private
136!> Non type specific implementation of doubly-linked list
137!!
138!! extend list_abstract::list
140#ifdef DOXYGEN
141 integer::none ! doxigen workaround: if missed do not show procedure
142#endif
143 contains
144 procedure :: current => currentmix !< get integer pointed by iterator
145 procedure :: display => displaymix !< print the integer list
147
148contains
149
150!> Print the list
151subroutine displaymix(this)
152class(mixList),intent(inout) :: this
153class(*), pointer :: curr
154logical :: found
155
156call this%rewind()
157do while(this%element())
158 curr => this%Currentpoli()
159 found=.false.
160 select type(curr)
161 type is (integer)
162 print *,curr
163 found=.true.
164 type is (real)
165 print *,curr
166 found=.true.
167 type is (doubleprecision)
168 print *,curr
169 found=.true.
170 type is (integer(kind=int_b))
171 print *,curr
172 found=.true.
173 type is (character(*))
174 print *,curr
175 found=.true.
176 end select
177
178 if (.not. found) then
179 print *, "not supported type for display"
180 end if
181
182 call this%next()
183end do
184call this%rewind()
185end subroutine displaymix
186
187
188!> get class(*) pointed by iterator
189function currentmix(this)
190class(mixlist),intent(inout) :: this
191class(*), pointer :: Currentmix
192currentmix => this%currentpoli()
193end function currentmix
194
195
197
198!>\example example_list.F03
199!!\brief Sample program to demostrate the list* module.
200!!
201!! This modules port lists to fortran 2003.
Definition of constants to be used for declaring variables of a desired type. Definition kinds.F90:245 |