OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
front_data_mgt_m.F
Go to the documentation of this file.
1C
2C This file is part of MUMPS 5.5.1, released
3C on Tue Jul 12 13:17:24 UTC 2022
4C
5C
6C Copyright 1991-2022 CERFACS, CNRS, ENS Lyon, INP Toulouse, Inria,
7C Mumps Technologies, University of Bordeaux.
8C
9C This version of MUMPS is provided to you free of charge. It is
10C released under the CeCILL-C license
11C (see doc/CeCILL-C_V1-en.txt, doc/CeCILL-C_V1-fr.txt, and
12C https://cecill.info/licences/Licence_CeCILL-C_V1-en.html)
13C
15 IMPLICIT NONE
16 PRIVATE
17C --------------------------------------------
18C This module contains routines to manage
19C handlers of various data associated to
20C active fronts *during the factorization*.
21C
22C It should be initialized at the beginning
23C of the factorization and terminated at the
24C end of the factorization.
25C
26C There are two types of data, see below.
27C
28C 'A' is for active type 2 fronts: list must
29C be empty at the end of the factorization
30C
31C 'F' will be for general fronts -- currently used
32C for BLR fronts, in three situations:
33C 1/ factorization of type 2 symmetric active fronts
34C (requires temporary storage of BLR panels)
35C 2/ LRSOLVE: BLR factors are kept until solution phase
36C (liberated in JOB=-2 or at the beginning of a new facto)
37C 3/ LRCB: CB is dynamically allocated and compressed
38C (liberated before the end of the factorization)
39C
40C Only handlers are managed in this module.
41C The data itself is in the module above using it.
42C For example, FAC_MAPROW_DATA_M manages MAPROW
43C messages that arrive too early. It handles an
44C array that contains all early MAPROW messages
45C and that is indexed with the handlers managed
46C by MUMPS_FRONT_DATA_MGT_M.
47C
48C --------------------------------------------
49C
50C ===============
51C Public routines
52C ===============
53 PUBLIC :: mumps_fdm_init,
60C STACK_FREE_IDX(1:NB_FREE_IDX) holds the NB_FREE_IDX indices
61C of free handlers
62C STACK_FREE_IDX(NB_FREE_IDX+1:size(STACK_FREE_IDX)) is trash data
64 INTEGER :: nb_free_idx
65 INTEGER, DIMENSION(:), POINTER :: stack_free_idx => null()
66 INTEGER, DIMENSION(:), POINTER :: count_access => null()
67 END TYPE fdm_struc_t
68 TYPE (fdm_struc_t), TARGET, SAVE :: fdm_a, fdm_f
69 CONTAINS
70C
71 SUBROUTINE mumps_fdm_init(WHAT, INITIAL_SIZE, INFO)
72C
73C Purpose:
74C =======
75C
76C Initialize handler data ('A' or 'F')
77C
78C Arguments:
79C =========
80C
81 INTEGER, INTENT(IN) :: initial_size
82 CHARACTER, INTENT(IN) :: what ! 'A' or 'F'
83 INTEGER, INTENT(INOUT) :: info(2)
84c
85C Local variables:
86C ===============
87c
88 INTEGER :: ierr
89 TYPE (fdm_struc_t), POINTER :: fdm_ptr
90C
91 CALL mumps_fdm_set_ptr(what, fdm_ptr)
92 ALLOCATE( fdm_ptr%STACK_FREE_IDX(initial_size),
93 & fdm_ptr%COUNT_ACCESS (initial_size), stat=ierr )
94 IF (ierr < 0) THEN
95 info(1) = -13
96 info(2) = initial_size * 2
97 RETURN
98 ENDIF
99 CALL mumps_fdm_set_all_free(fdm_ptr)
100 RETURN
101 END SUBROUTINE mumps_fdm_init
102C
103 SUBROUTINE mumps_fdm_end(WHAT)
104C
105C Purpose:
106C =======
107C Free module datastructures associated to "WHAT" at
108C the end of a phase (typically factorization).
109C
110 CHARACTER, INTENT(IN) :: what
111C
112C Local variables
113C ===============
114c
115 TYPE (fdm_struc_t), POINTER :: fdm_ptr
116C
117 CALL mumps_fdm_set_ptr(what, fdm_ptr)
118 IF (associated(fdm_ptr%STACK_FREE_IDX)) THEN
119 DEALLOCATE(fdm_ptr%STACK_FREE_IDX)
120 NULLIFY(fdm_ptr%STACK_FREE_IDX)
121 fdm_ptr%NB_FREE_IDX=0
122 ELSE
123C Should not be called twice or when array is unassociated
124 WRITE(*,*) "Internal error 1 in MUMPS_FDM_END", what
125 CALL mumps_abort()
126 ENDIF
127 IF (associated(fdm_ptr%COUNT_ACCESS)) THEN
128 DEALLOCATE(fdm_ptr%COUNT_ACCESS)
129 NULLIFY(fdm_ptr%COUNT_ACCESS)
130 ELSE
131C Should not be called twice or when array is unassociated
132 WRITE(*,*) "Internal error 2 in MUMPS_FDM_END", what
133 CALL mumps_abort()
134 ENDIF
135 RETURN
136 END SUBROUTINE mumps_fdm_end
137C
138 SUBROUTINE mumps_fdm_mod_to_struc(WHAT, id_FDM_ENCODING,INFO)
139C
140C Purpose:
141C =======
142C
143C Save module information in struture.
144C id_FDM_ENCODING corresponds to id%FDM_F_ENCODING
145C This version requires that WHAT is equal to 'F'.
146C
147C id_FDM_ENDODING takes responsibility of pointing to module
148C FDM_F information. This typically allows data from the module
149C to be passed from factorization to solve through the instance
150C and manage multiple instances.
151C
152 CHARACTER, INTENT(IN) :: what
153 INTEGER, INTENT(INOUT) :: info(2)
154#if defined(mumps_f2003)
155 CHARACTER, DIMENSION(:), POINTER, intent(inout) ::
156 & id_fdm_encoding
157#else
158 CHARACTER, DIMENSION(:), POINTER :: id_fdm_encoding
159#endif
160C
161C Local variables
162C ===============
163C
164C Character array of arbitrary dimension 1
165 CHARACTER :: char_array(1)
166 INTEGER :: char_length, ierr
167c
168 IF (what .NE. 'F') THEN
169 WRITE(*,*) "Internal error 1 in MUMPS_FDM_MOD_TO_STRUC"
170 CALL mumps_abort()
171 ENDIF
172 IF (associated(id_fdm_encoding)) THEN
173C Should be unassociated for this to work
174 WRITE(*,*) "Internal error 2 in MUMPS_FDM_MOD_TO_STRUC"
175 CALL mumps_abort()
176 ENDIF
177 char_length=size(transfer(fdm_f,char_array))
178 ALLOCATE(id_fdm_encoding(char_length), stat=ierr )
179 IF (ierr < 0) THEN
180 info(1) = -13
181 info(2) = char_length
182 RETURN
183 ENDIF
184C ------------------------------
185C Fill contents of pointer array
186C with FDM_F derived datatype
187C ------------------------------
188 id_fdm_encoding = transfer(fdm_f,char_array)
189C ----------------------------------------------
190C FDM_F is not to be used again before a call to
191C MUMPS_FDM_STRUC_TO_MOD, invalidate its content
192C ----------------------------------------------
193 fdm_f%NB_FREE_IDX=-9999999
194 NULLIFY(fdm_f%STACK_FREE_IDX)
195 NULLIFY(fdm_f%COUNT_ACCESS)
196 RETURN
197 END SUBROUTINE mumps_fdm_mod_to_struc
198C
199 SUBROUTINE mumps_fdm_struc_to_mod(WHAT, id_FDM_ENCODING)
200C
201C Purpose:
202C =======
203C
204C Set module pointer information from id_FDM_ENCODING) typically
205C at beginning of solve. Suppress from structure since
206C responsibility of pointing to module data is now inside
207C the module.
208C
209 CHARACTER, INTENT(IN) :: what
210#if defined(MUMPS_F2003)
211 CHARACTER, DIMENSION(:), POINTER, intent(inout)
212 & :: id_fdm_encoding
213#else
214 CHARACTER, DIMENSION(:), POINTER :: id_fdm_encoding
215#endif
216C
217C Local variables
218C ===============
219C
220 IF (.NOT.associated(id_fdm_encoding)) THEN
221 WRITE(*,*) "Internal error 1 in MUMPS_FDM_STRUC_TO_MOD"
222 ENDIF
223 fdm_f=transfer(id_fdm_encoding,fdm_f)
224C Module is now responsible for accessing data.
225 DEALLOCATE(id_fdm_encoding)
226 NULLIFY(id_fdm_encoding)
227 RETURN
228 END SUBROUTINE mumps_fdm_struc_to_mod
229C
230 SUBROUTINE mumps_fdm_start_idx(WHAT, FROM, IWHANDLER, INFO)
231C
232C Purpose:
233C =======
234C
235C Return a new free index/handler
236C (typically stored in IW)
237C
238 CHARACTER, INTENT(IN) :: what
239 CHARACTER(LEN=*), INTENT(IN) :: from !For debugging purposes only
240 INTEGER, INTENT(INOUT) :: iwhandler
241 INTEGER, INTENT(INOUT) :: info(2)
242c
243C Local variables
244C ===============
245C
246 INTEGER :: old_size, new_size, ierr
247 INTEGER :: i
248 INTEGER, DIMENSION(:), POINTER :: tmp_count_access
249 TYPE(fdm_struc_t), POINTER :: fdm_ptr
250 CALL mumps_fdm_set_ptr(what, fdm_ptr)
251C
252 IF (iwhandler .GT. 0) THEN
253C Already started, counter should at least be 1
254 IF (fdm_ptr%COUNT_ACCESS(iwhandler) .LT. 1) THEN
255 WRITE(*,*) "Internal error 1 in MUMPS_FDM_START_IDX",
256 & fdm_ptr%COUNT_ACCESS(iwhandler)
257 CALL mumps_abort()
258 ENDIF
259 GOTO 100
260 ENDIF
261C
262 IF (fdm_ptr%NB_FREE_IDX .EQ. 0) THEN
263 old_size = size(fdm_ptr%STACK_FREE_IDX)
264 new_size = (old_size * 3) / 2 + 1 ! or something else
265 fdm_ptr%NB_FREE_IDX = new_size - old_size
266 DEALLOCATE(fdm_ptr%STACK_FREE_IDX)
267 ALLOCATE(fdm_ptr%STACK_FREE_IDX(new_size),
268 & tmp_count_access(new_size), stat=ierr)
269 IF (ierr < 0) THEN
270 info(1) = -13
271 info(2) = new_size
272 RETURN
273 ENDIF
274C All new handlers indices are created
275 DO i=1, fdm_ptr%NB_FREE_IDX
276 fdm_ptr%STACK_FREE_IDX(i)=new_size-i+1
277 ENDDO
278C Count access: copy old ones
279 DO i=1, old_size
280 tmp_count_access(i)=fdm_ptr%COUNT_ACCESS(i)
281 ENDDO
282 DO i=old_size+1, new_size
283 tmp_count_access(i)=0
284 ENDDO
285 DEALLOCATE(fdm_ptr%COUNT_ACCESS)
286 fdm_ptr%COUNT_ACCESS=>tmp_count_access
287 ENDIF
288C
289 iwhandler = fdm_ptr%STACK_FREE_IDX(fdm_ptr%NB_FREE_IDX)
290 fdm_ptr%NB_FREE_IDX = fdm_ptr%NB_FREE_IDX - 1
291 100 CONTINUE
292C Number of modules accessing this handler
293 fdm_ptr%COUNT_ACCESS(iwhandler)=fdm_ptr%COUNT_ACCESS(iwhandler)+1
294 RETURN
295 END SUBROUTINE mumps_fdm_start_idx
296C
297 SUBROUTINE mumps_fdm_end_idx(WHAT, FROM, IWHANDLER)
298C
299C Purpose:
300C =======
301C
302C Notify than an index/handler has been freed.
303C Mark it free for future reuse.
304C
305 CHARACTER, INTENT(IN) :: what
306 CHARACTER(LEN=*), INTENT(IN) :: from ! for debug purposes only
307 INTEGER, INTENT(INOUT) :: iwhandler
308 TYPE(fdm_struc_t), POINTER :: fdm_ptr
309C
310 CALL mumps_fdm_set_ptr(what, fdm_ptr)
311 IF (iwhandler .LE.0) THEN
312C Already ended
313 WRITE(*,*) "Internal error 1 in MUMPS_FDM_END_IDX",iwhandler
314 CALL mumps_abort()
315 ENDIF
316 fdm_ptr%COUNT_ACCESS(iwhandler)=fdm_ptr%COUNT_ACCESS(iwhandler)-1
317 IF (fdm_ptr%COUNT_ACCESS(iwhandler) .LT. 0) THEN
318C Negative counter!
319 WRITE(*,*) "Internal error 2 in MUMPS_FDM_END_IDX",
320 & iwhandler, fdm_ptr%COUNT_ACCESS(iwhandler)
321 CALL mumps_abort()
322 ENDIF
323 IF (fdm_ptr%COUNT_ACCESS(iwhandler) .EQ.0 ) THEN
324 IF (fdm_ptr%NB_FREE_IDX .GE. size(fdm_ptr%STACK_FREE_IDX)) THEN
325 WRITE(*,*) "Internal error 3 in MUMPS_FDM_END_IDX"
326 CALL mumps_abort()
327 ENDIF
328 fdm_ptr%NB_FREE_IDX = fdm_ptr%NB_FREE_IDX + 1
329C Having incremented the nb of free handlers we
330C store the index (IWHANDLER) that has been
331C effectively released for future reuse.
332 fdm_ptr%STACK_FREE_IDX(fdm_ptr%NB_FREE_IDX) = iwhandler
333 iwhandler = -8888 ! has been used and is now free
334 ENDIF
335C
336 RETURN
337 END SUBROUTINE mumps_fdm_end_idx
338C ===================
339C Private subroutines
340C ===================
341 SUBROUTINE mumps_fdm_set_ptr(WHAT, FDM_PTR)
342 CHARACTER, INTENT(IN) :: WHAT
343#if defined(MUMPS_F2003)
344 TYPE(fdm_struc_t), POINTER, INTENT(OUT) :: FDM_PTR
345#else
346 TYPE(fdm_struc_t), POINTER :: FDM_PTR
347#endif
348C
349 IF ( what .EQ. 'A' ) THEN
350 fdm_ptr => fdm_a
351 ELSE IF ( what .EQ. 'F' ) THEN
352 fdm_ptr => fdm_f
353 ELSE
354C Should be called with either A or F
355 WRITE(*,*) "Internal error 1 in MUMPS_FDM_INIT"
356 WRITE(*,*) "Allowed arguments for WHAT are A or F"
357 CALL mumps_abort()
358 ENDIF
359 END SUBROUTINE mumps_fdm_set_ptr
360 SUBROUTINE mumps_fdm_set_all_free(FDM_PTR)
361C
362C Purpose:
363C =======
364C Initialize the stack of free elements for the first time
365C
366 TYPE(fdm_struc_t), POINTER :: FDM_PTR
367 INTEGER :: I
368 fdm_ptr%NB_FREE_IDX = size(fdm_ptr%STACK_FREE_IDX)
369 DO i = 1, fdm_ptr%NB_FREE_IDX
370 fdm_ptr%STACK_FREE_IDX(i)=fdm_ptr%NB_FREE_IDX-i+1
371 fdm_ptr%COUNT_ACCESS (i)=0
372 ENDDO
373 RETURN
374 END SUBROUTINE mumps_fdm_set_all_free
375C
376! ---------- MUMPS_SAVE_RESTORE_FRONT_DATA ----------------------- !
377 SUBROUTINE mumps_save_restore_front_data(id_FDM_F_ENCODING
378 & ,unit,MYID,mode
379 & ,SIZE_GEST,SIZE_VARIABLES
380 & ,SIZE_INT, TOTAL_FILE_SIZE,TOTAL_STRUC_SIZE
381 & ,size_read,size_allocated,size_written
382 & ,INFO)
383 IMPLICIT NONE
384C =======
385C Purpose
386C =======
387C
388C This routine is designed to manage a FDM_STRUC_T structure (save, restore, compute memory)
389C
390C ==========
391C Parameters
392C ==========
393C
394C FDM_STRUC : TYPE (FDM_STRUC_T) : the main structure
395C
396C unit : The unit of the file to be written or read
397C
398C mode : the type of operation to be performed by the routine
399C memory_save = compute the size of the save file and of the structure
400C save = save the instace
401C restore = restore the instace
402C
403C TOTAL_FILE_SIZE : size of the file to be written or read
404C
405C TOTAL_STRUC_SIZE : size of the structure to be saved or restored
406C
407C SIZE_INT : size of an integer
408C
409C INFO : copies of of INFO(1) and INFO(2) to allow save/restore of failled instaces
410C
411 CHARACTER, DIMENSION(:), POINTER :: id_fdm_f_encoding
412 INTEGER,intent(IN)::unit,myid
413 CHARACTER(len=*),intent(IN) :: mode
414 INTEGER,INTENT(OUT) :: size_gest
415 INTEGER(8),intent(OUT) :: size_variables
416 INTEGER(8),intent(IN) :: total_file_size,total_struc_size
417 INTEGER,intent(INOUT):: info(2)
418 INTEGER,intent(IN):: size_int
419 INTEGER(8),intent(INOUT):: size_read,size_allocated,size_written
420 INTEGER:: nbrecords,nbsubrecords
421 INTEGER:: size_gest_fdm_f
422 INTEGER(8):: size_variables_fdm_f
423 INTEGER(4) :: i4
424 nbrecords=0
425 size_gest_fdm_f=0
426 size_variables_fdm_f=0_8
427 size_gest=0
428 size_variables=0_8
429 if((trim(mode).EQ."memory_save").OR.(trim(mode).EQ."save")) then
430 call mumps_fdm_struc_to_mod("F",id_fdm_f_encoding)
431 endif
432 if(trim(mode).EQ."memory_save") then
434 & fdm_f
435 & ,unit,myid,"memory_save"
436 & ,size_gest_fdm_f
437 & ,size_variables_fdm_f
438 & ,size_int,total_file_size,total_struc_size
439 & ,size_read,size_allocated,size_written
440 & ,info)
441 elseif(trim(mode).EQ."save") then
443 & fdm_f
444 & ,unit,myid,"save"
445 & ,size_gest_fdm_f
446 & ,size_variables_fdm_f
447 & ,size_int,total_file_size,total_struc_size
448 & ,size_read,size_allocated,size_written
449 & ,info)
450 IF ( info(1) .LT. 0 ) GOTO 100
451 elseif(trim(mode).EQ."restore") then
453 & fdm_f
454 & ,unit,myid,"restore"
455 & ,size_gest_fdm_f
456 & ,size_variables_fdm_f
457 & ,size_int, total_file_size,total_struc_size
458 & ,size_read,size_allocated,size_written
459 & ,info)
460 IF ( info(1) .LT. 0 ) GOTO 100
461 endif
462 if(trim(mode).EQ."memory_save") then
463C If the size to write (SIZE_VARIABLES) is greater than 2^31
464C Subrecords are created which need to be taken into account in
465C the file size computation
466 nbsubrecords=int(size_variables/huge(i4))
467 IF(nbsubrecords.GT.0) then
468 nbrecords=nbrecords+nbsubrecords
469 ENDIF
470 elseif(trim(mode).EQ."save") then
471 size_written=size_written+size_variables
472 & +int(size_gest,kind=8)
473#if !defined(MUMPS_F2003)
474 size_written=size_written
475 & +int(2*size_int*nbrecords,kind=8)
476#endif
477 elseif(trim(mode).EQ."restore") then
478 size_allocated=size_allocated+size_variables
479 size_read=size_read+size_variables
480 & +int(size_gest,kind=8)
481#if !defined(MUMPS_F2003)
482 size_read=size_read
483 & +int(2*size_int*nbrecords,kind=8)
484#endif
485 endif
486 if(trim(mode).EQ."memory_save") then
487 size_variables=size_variables+size_variables_fdm_f
488 size_gest=size_gest+size_gest_fdm_f
489#if !defined(MUMPS_F2003)
490C If the file is not written with access="stream", which is only done in MUMPS_F2003,
491C the record length's is written at the beginning and at the end of each record
492C This is done using 2 INTEGERs so we use 2*SIZE_INT more space for each record
493 size_gest=size_gest+2*size_int*nbrecords
494#endif
495 endif
496 call mumps_fdm_mod_to_struc("F",id_fdm_f_encoding,info(1))
497 100 continue
498 RETURN
499 END SUBROUTINE mumps_save_restore_front_data
500! --------------------------------- MUMPS_SAVE_RESTORE_BLR_STRUC ----------------------------- !
501 SUBROUTINE mumps_save_restore_fdm_struc(FDM_STRUC
502 & ,unit,MYID,mode
503 & ,Local_SIZE_GEST,Local_SIZE_VARIABLES
504 & ,SIZE_INT ,TOTAL_FILE_SIZE,TOTAL_STRUC_SIZE
505 & ,size_read,size_allocated,size_written
506 & ,INFO)
507 IMPLICIT NONE
508C =======
509C Purpose
510C =======
511C
512C This routine is designed to manage a BLR_STRUC_T structure (save, restore, compute memory)
513C
514C ==========
515C Parameters
516C ==========
517C
518C BLR_STRUC : TYPE (BLR_STRUC_T) : the main structure
519C
520C unit : The unit of the file to be written or read
521C
522C mode : the type of operation to be performed by the routine
523C memory_save = compute the size of the save file and of the structure
524C save = save the instace
525C restore = restore the instace
526C
527C TOTAL_FILE_SIZE : size of the file to be written or read
528C
529C TOTAL_STRUC_SIZE : size of the structure to be saved or restored
530C
531C SIZE_INT : size of an integer
532C
533C INFO1/INFO2 : copies of of INFO(1) and INFO(2) to allow save/restore of failled instaces
534C
535 TYPE(fdm_struc_t) :: FDM_STRUC
536 INTEGER,intent(IN)::unit,MYID
537 CHARACTER(len=*),intent(IN) :: mode
538 INTEGER,INTENT(OUT) :: Local_SIZE_GEST
539 INTEGER(8),intent(OUT) :: Local_SIZE_VARIABLES
540 INTEGER,intent(INOUT):: INFO(2)
541 INTEGER,intent(IN):: SIZE_INT
542 INTEGER(8),intent(IN) :: TOTAL_FILE_SIZE,TOTAL_STRUC_SIZE
543 INTEGER(8),intent(INOUT):: size_read,size_allocated,size_written
544 INTEGER :: NBVARIABLES_FDM_STRUC_T
545 parameter(nbvariables_fdm_struc_t = 3)
546 CHARACTER(len=30), dimension(NBVARIABLES_FDM_STRUC_T)::
547 & variables_fdm_struc_t
548 CHARACTER(len=30) :: TMP_STRING
549 INTEGER(8),dimension(NBVARIABLES_FDM_STRUC_T)::
550 & size_variables_fdm_struc_t
551 INTEGER,dimension(NBVARIABLES_FDM_STRUC_T)::SIZE_GEST_FDM_STRUC_T
552 INTEGER,dimension(NBVARIABLES_FDM_STRUC_T)::NbRecords_FDM_STRUC_T
553 INTEGER:: size_array1,dummy,allocok
554 INTEGER:: err,i1,NbSubRecords,Local_NbRecords
555 INTEGER(4) :: I4
556 variables_fdm_struc_t(1)="NB_FREE_IDX"
557 variables_fdm_struc_t(2)="STACK_FREE_IDX"
558 variables_fdm_struc_t(3)="COUNT_ACCESS"
559 size_variables_fdm_struc_t(:)=0_8
560 size_gest_fdm_struc_t(:)=0
561 nbrecords_fdm_struc_t(:)=0
562C
563C BEGINNING OF THE MAIN LOOP ON ALL VARIABLES OF THE STRUCTURE
564C
565 DO i1=1,nbvariables_fdm_struc_t
566 tmp_string = variables_fdm_struc_t(i1)
567 SELECT CASE(tmp_string)
568 CASE("NB_FREE_IDX")
569 nbrecords_fdm_struc_t(i1)=1
570 if(trim(mode).EQ."memory_save") then
571 size_variables_fdm_struc_t(i1)=size_int
572 elseif(trim(mode).EQ."save") then
573 size_variables_fdm_struc_t(i1)=size_int
574 write(unit,iostat=err) fdm_struc%NB_FREE_IDX
575 if(err.ne.0) then
576 info(1) = -72
577 CALL mumps_seti8toi4(total_file_size-size_written,
578 & info(2))
579 endif
580 IF ( info(1) .LT. 0 ) GOTO 100
581 elseif(trim(mode).EQ."restore") then
582 size_variables_fdm_struc_t(i1)=size_int
583 read(unit,iostat=err) fdm_struc%NB_FREE_IDX
584 if(err.ne.0) THEN
585 info(1) = -75
586 CALL mumps_seti8toi4(total_file_size-size_read
587 & ,info(2))
588 endif
589 IF ( info(1) .LT. 0 ) GOTO 100
590 endif
591 CASE("STACK_FREE_IDX")
592 nbrecords_fdm_struc_t(i1)=2
593 if(trim(mode).EQ."memory_save") then
594 IF(associated(fdm_struc%STACK_FREE_IDX)) THEN
595 size_gest_fdm_struc_t(i1)=size_int
596 size_variables_fdm_struc_t(i1)=
597 & size(fdm_struc%STACK_FREE_IDX,1)*size_int
598 ELSE
599 size_gest_fdm_struc_t(i1)=size_int*2
600 size_variables_fdm_struc_t(i1)=0_8
601 ENDIF
602 elseif(trim(mode).EQ."save") then
603 IF(associated(fdm_struc%STACK_FREE_IDX)) THEN
604 size_gest_fdm_struc_t(i1)=size_int
605 size_variables_fdm_struc_t(i1)=
606 & size(fdm_struc%STACK_FREE_IDX,1)*size_int
607 write(unit,iostat=err)
608 & size(fdm_struc%STACK_FREE_IDX,1)
609 if(err.ne.0) then
610 info(1) = -72
611 CALL mumps_seti8toi4(total_file_size-size_written,
612 & info(2))
613 endif
614 IF ( info(1) .LT. 0 ) GOTO 100
615 write(unit,iostat=err) fdm_struc%STACK_FREE_IDX
616 ELSE
617 size_gest_fdm_struc_t(i1)=size_int*2
618 size_variables_fdm_struc_t(i1)=0_8
619 write(unit,iostat=err) -999
620 if(err.ne.0) then
621 info(1) = -72
622 CALL mumps_seti8toi4(total_file_size-size_written,
623 & info(2))
624 endif
625 IF ( info(1) .LT. 0 ) GOTO 100
626 write(unit,iostat=err) -999
627 ENDIF
628 if(err.ne.0) then
629 info(1) = -72
630 CALL mumps_seti8toi4(total_file_size-size_written,
631 & info(2))
632 endif
633 IF ( info(1) .LT. 0 ) GOTO 100
634 elseif(trim(mode).EQ."restore") then
635 nullify(fdm_struc%STACK_FREE_IDX)
636 read(unit,iostat=err) size_array1
637 if(err.ne.0) THEN
638 info(1) = -75
639 CALL mumps_seti8toi4(total_file_size-size_read
640 & ,info(2))
641 endif
642 IF ( info(1) .LT. 0 ) GOTO 100
643 if(size_array1.EQ.-999) then
644 size_gest_fdm_struc_t(i1)=size_int*2
645 size_variables_fdm_struc_t(i1)=0_8
646 read(unit,iostat=err) dummy
647 else
648 size_gest_fdm_struc_t(i1)=size_int
649 size_variables_fdm_struc_t(i1)=size_array1*size_int
650 allocate(fdm_struc%STACK_FREE_IDX(size_array1),
651 & stat=allocok)
652 if (allocok .GT. 0) THEN
653 info(1) = -78
654 CALL mumps_seti8toi4(
655 & total_struc_size-size_allocated
656 & ,info(2))
657 endif
658 read(unit,iostat=err) fdm_struc%STACK_FREE_IDX
659 endif
660 IF ( info(1) .LT. 0 ) GOTO 100
661 if(err.ne.0) THEN
662 info(1) = -75
663 CALL mumps_seti8toi4(total_file_size-size_read
664 & ,info(2))
665 endif
666 IF ( info(1) .LT. 0 ) GOTO 100
667 endif
668 CASE("COUNT_ACCESS")
669 nbrecords_fdm_struc_t(i1)=2
670 if(trim(mode).EQ."memory_save") then
671 IF(associated(fdm_struc%COUNT_ACCESS)) THEN
672 size_gest_fdm_struc_t(i1)=size_int
673 size_variables_fdm_struc_t(i1)=
674 & size(fdm_struc%COUNT_ACCESS,1)*size_int
675 ELSE
676 size_gest_fdm_struc_t(i1)=size_int*2
677 size_variables_fdm_struc_t(i1)=0_8
678 ENDIF
679 elseif(trim(mode).EQ."save") then
680 IF(associated(fdm_struc%COUNT_ACCESS)) THEN
681 size_gest_fdm_struc_t(i1)=size_int
682 size_variables_fdm_struc_t(i1)=
683 & size(fdm_struc%COUNT_ACCESS,1)*size_int
684 write(unit,iostat=err)
685 & size(fdm_struc%COUNT_ACCESS,1)
686 if(err.ne.0) then
687 info(1) = -72
688 CALL mumps_seti8toi4(total_file_size-size_written,
689 & info(2))
690 endif
691 IF ( info(1) .LT. 0 ) GOTO 100
692 write(unit,iostat=err) fdm_struc%COUNT_ACCESS
693 ELSE
694 size_gest_fdm_struc_t(i1)=size_int*2
695 size_variables_fdm_struc_t(i1)=0_8
696 write(unit,iostat=err) -999
697 if(err.ne.0) then
698 info(1) = -72
699 CALL mumps_seti8toi4(total_file_size-size_written,
700 & info(2))
701 endif
702 IF ( info(1) .LT. 0 ) GOTO 100
703 write(unit,iostat=err) -999
704 ENDIF
705 if(err.ne.0) then
706 info(1) = -72
707 CALL mumps_seti8toi4(total_file_size-size_written,
708 & info(2))
709 endif
710 IF ( info(1) .LT. 0 ) GOTO 100
711 elseif(trim(mode).EQ."restore") then
712 nullify(fdm_struc%COUNT_ACCESS)
713 read(unit,iostat=err) size_array1
714 if(err.ne.0) THEN
715 info(1) = -75
716 CALL mumps_seti8toi4(total_file_size-size_read
717 & ,info(2))
718 endif
719 IF ( info(1) .LT. 0 ) GOTO 100
720 if(size_array1.EQ.-999) then
721 size_gest_fdm_struc_t(i1)=size_int*2
722 size_variables_fdm_struc_t(i1)=0_8
723 read(unit,iostat=err) dummy
724 else
725 size_gest_fdm_struc_t(i1)=size_int
726 size_variables_fdm_struc_t(i1)=size_array1*size_int
727 allocate(fdm_struc%COUNT_ACCESS(size_array1),
728 & stat=allocok)
729 if (allocok .GT. 0) THEN
730 info(1) = -78
731 CALL mumps_seti8toi4(
732 & total_struc_size-size_allocated
733 & ,info(2))
734 endif
735 read(unit,iostat=err) fdm_struc%COUNT_ACCESS
736 endif
737 IF ( info(1) .LT. 0 ) GOTO 100
738 if(err.ne.0) THEN
739 info(1) = -75
740 CALL mumps_seti8toi4(total_file_size-size_read
741 & ,info(2))
742 endif
743 IF ( info(1) .LT. 0 ) GOTO 100
744 endif
745 CASE DEFAULT
746 END SELECT
747 if(trim(mode).EQ."memory_save") then
748C If the size to write (SIZE_VARIABLES_FDM_STRUC_T(i1)) is greater than 2^31
749C Subrecords are created which need to be taken into account in
750C the file size computation
751 nbsubrecords=int(size_variables_fdm_struc_t(i1)/huge(i4))
752 IF(nbsubrecords.GT.0) then
753 nbrecords_fdm_struc_t(i1)=nbrecords_fdm_struc_t(i1)
754 & +nbsubrecords
755 ENDIF
756 elseif(trim(mode).EQ."save") then
757 size_written=size_written+size_variables_fdm_struc_t(i1)
758 & +int(size_gest_fdm_struc_t(i1),kind=8)
759#if !defined(MUMPS_F2003)
760 size_written=size_written
761 & +int(2*size_int*nbrecords_fdm_struc_t(i1),kind=8)
762#endif
763 elseif(trim(mode).EQ."restore") then
764 size_allocated=size_allocated+
765 & size_variables_fdm_struc_t(i1)
766 size_read=size_read+size_variables_fdm_struc_t(i1)
767 & +int(size_gest_fdm_struc_t(i1),kind=8)
768#if !defined(MUMPS_F2003)
769 size_read=size_read
770 & +int(2*size_int*nbrecords_fdm_struc_t(i1),kind=8)
771#endif
772 endif
773 ENDDO
774 if(trim(mode).EQ."memory_save") then
775 local_size_variables=sum(size_variables_fdm_struc_t)
776 local_size_gest=sum(size_gest_fdm_struc_t)
777#if !defined(MUMPS_F2003)
778 local_nbrecords=sum(nbrecords_fdm_struc_t)
779 local_size_gest=local_size_gest+2*size_int*local_nbrecords
780#endif
781 endif
782 100 continue
783 RETURN
784 END SUBROUTINE mumps_save_restore_fdm_struc
785 END MODULE mumps_front_data_mgt_m
#define mumps_abort
Definition VE_Metis.h:25
if(complex_arithmetic) id
subroutine, public mumps_fdm_end_idx(what, from, iwhandler)
subroutine, public mumps_fdm_mod_to_struc(what, id_fdm_encoding, info)
subroutine, public mumps_save_restore_front_data(id_fdm_f_encoding, unit, myid, mode, size_gest, size_variables, size_int, total_file_size, total_struc_size, size_read, size_allocated, size_written, info)
subroutine, public mumps_fdm_start_idx(what, from, iwhandler, info)
subroutine, public mumps_fdm_struc_to_mod(what, id_fdm_encoding)
subroutine mumps_save_restore_fdm_struc(fdm_struc, unit, myid, mode, local_size_gest, local_size_variables, size_int, total_file_size, total_struc_size, size_read, size_allocated, size_written, info)
type(fdm_struc_t), target, save fdm_a
type(fdm_struc_t), target, save fdm_f
subroutine, public mumps_fdm_init(what, initial_size, info)
subroutine mumps_fdm_set_all_free(fdm_ptr)
subroutine mumps_fdm_set_ptr(what, fdm_ptr)
subroutine, public mumps_fdm_end(what)
subroutine mumps_seti8toi4(i8, i)