106 use iso_c_binding, only: c_loc, c_ptr, c_null_ptr, c_f_pointer
107 class(MemoryType) :: this
108 integer(I4B) :: n
109 type(c_ptr) :: cptr
110
111 character(len=1), dimension(:), pointer :: astr1d
112
113 if (associated(this%strsclr)) then
114 if (this%master) deallocate (this%strsclr)
115 nullify (this%strsclr)
116 end if
117
118 if (associated(this%logicalsclr)) then
119 if (this%master) deallocate (this%logicalsclr)
120 nullify (this%logicalsclr)
121 end if
122
123 if (associated(this%intsclr)) then
124 if (this%master) deallocate (this%intsclr)
125 nullify (this%intsclr)
126 end if
127
128 if (associated(this%dblsclr)) then
129 if (this%master) deallocate (this%dblsclr)
130 nullify (this%dblsclr)
131 end if
132
133
134
135
136
137
138
139
140
141 if (associated(this%astr1d)) then
142 select type (item => this%astr1d)
143 type is (character(*))
144 cptr = c_loc(item)
145 class default
146 cptr = c_null_ptr
147 end select
148
149 call c_f_pointer(cptr, astr1d, [this%isize * this%element_size])
150
151#if __GFORTRAN__ && ((__GNUC__ < 13) || (__GNUC__ == 13 && __GNUC_MINOR__ < 3))
152 if (this%master) deallocate (astr1d)
153#else
154 if (this%master) deallocate (this%astr1d)
155#endif
156
157 nullify (this%astr1d)
158 end if
159
160 if (associated(this%alogical1d)) then
161 if (this%master) deallocate (this%alogical1d)
162 nullify (this%alogical1d)
163 end if
164
165 if (associated(this%aint1d)) then
166 if (this%master) deallocate (this%aint1d)
167 nullify (this%aint1d)
168 end if
169
170 if (associated(this%aint2d)) then
171 if (this%master) deallocate (this%aint2d)
172 nullify (this%aint2d)
173 end if
174
175 if (associated(this%aint3d)) then
176 if (this%master) deallocate (this%aint3d)
177 nullify (this%aint3d)
178 end if
179
180 if (associated(this%adbl1d)) then
181 if (this%master) deallocate (this%adbl1d)
182 nullify (this%adbl1d)
183 end if
184
185 if (associated(this%adbl2d)) then
186 if (this%master) deallocate (this%adbl2d)
187 nullify (this%adbl2d)
188 end if
189
190 if (associated(this%adbl3d)) then
191 if (this%master) deallocate (this%adbl3d)
192 nullify (this%adbl3d)
193 end if
194
195 if (associated(this%acharstr1d)) then
196 if (this%master) then
197 do n = 1, size(this%acharstr1d)
198 call this%acharstr1d(n)%destroy()
199 end do
200 deallocate (this%acharstr1d)
201 end if
202 nullify (this%acharstr1d)
203 end if