103 integer,
parameter :: IDX_I_ITER = 1
104 integer,
parameter :: IDX_I_METHOD = 2
105 integer,
parameter :: IDX_I_PRECOND = 3
106 integer,
parameter :: IDX_I_NSET = 4
107 integer,
parameter :: IDX_I_ITERPREMAX = 5
108 integer,
parameter :: IDX_I_NREST = 6
109 integer,
parameter :: IDX_I_NBFGS = 60
110 integer,
parameter :: IDX_I_SCALING = 7
111 integer,
parameter :: IDX_I_PENALIZED = 11
112 integer,
parameter :: IDX_I_PENALIZED_B = 12
113 integer,
parameter :: IDX_I_MPC_METHOD = 13
114 integer,
parameter :: IDX_I_ESTCOND = 14
115 integer,
parameter :: IDX_I_CONTACT_ELIM = 15
116 integer,
parameter :: IDX_I_ITERLOG = 21
117 integer,
parameter :: IDX_I_TIMELOG = 22
118 integer,
parameter :: IDX_I_DUMP = 31
119 integer,
parameter :: IDX_I_DUMP_EXIT = 32
120 integer,
parameter :: IDX_I_USEJAD = 33
121 integer,
parameter :: IDX_I_NCOLOR_IN = 34
122 integer,
parameter :: IDX_I_MAXRECYCLE_PRECOND = 35
123 integer,
parameter :: IDX_I_NRECYCLE_PRECOND = 96
124 integer,
parameter :: IDX_I_FLAG_NUMFACT = 97
125 integer,
parameter :: IDX_I_FLAG_SYMBFACT = 98
126 integer,
parameter :: IDX_I_SOLVER_TYPE = 99
128 integer,
parameter :: IDX_I_METHOD2 = 8
129 integer,
parameter :: IDX_I_FLAG_CONVERGED = 81
130 integer,
parameter :: IDX_I_FLAG_DIVERGED = 82
131 integer,
parameter :: IDX_I_FLAG_MPCMATVEC = 83
133 integer,
parameter :: IDX_I_SOLVER_OPT_S = 41
134 integer,
parameter :: IDX_I_SOLVER_OPT_E = 50
136 integer,
parameter :: IDX_R_RESID = 1
137 integer,
parameter :: IDX_R_SIGMA_DIAG = 2
138 integer,
parameter :: IDX_R_SIGMA = 3
139 integer,
parameter :: IDX_R_THRESH = 4
140 integer,
parameter :: IDX_R_FILTER = 5
141 integer,
parameter :: IDX_R_PENALTY = 11
142 integer,
parameter :: IDX_R_PENALTY_ALPHA = 12
207 if (
associated(hecmat%D))
deallocate(hecmat%D)
208 if (
associated(hecmat%B))
deallocate(hecmat%B)
209 if (
associated(hecmat%X))
deallocate(hecmat%X)
210 if (
associated(hecmat%AL))
deallocate(hecmat%AL)
211 if (
associated(hecmat%AU))
deallocate(hecmat%AU)
212 if (
associated(hecmat%indexL))
deallocate(hecmat%indexL)
213 if (
associated(hecmat%indexU))
deallocate(hecmat%indexU)
214 if (
associated(hecmat%itemL))
deallocate(hecmat%itemL)
215 if (
associated(hecmat%itemU))
deallocate(hecmat%itemU)
217 if (
associated(hecmat%A))
deallocate(hecmat%A)
218 if (
associated(hecmat%indexA))
deallocate(hecmat%indexA)
219 if (
associated(hecmat%itemA))
deallocate(hecmat%itemA)
226 hecmat%N = hecmatorg%N
227 hecmat%NP = hecmatorg%NP
228 hecmat%NDOF = hecmatorg%NDOF
229 hecmat%NPL = hecmatorg%NPL
230 hecmat%NPU = hecmatorg%NPU
231 allocate(hecmat%indexL(0:
size(hecmatorg%indexL)-1))
232 allocate(hecmat%indexU(0:
size(hecmatorg%indexU)-1))
233 allocate(hecmat%itemL (
size(hecmatorg%itemL )))
234 allocate(hecmat%itemU (
size(hecmatorg%itemU )))
235 allocate(hecmat%D (
size(hecmatorg%D )))
236 allocate(hecmat%AL(
size(hecmatorg%AL)))
237 allocate(hecmat%AU(
size(hecmatorg%AU)))
238 allocate(hecmat%B (
size(hecmatorg%B )))
239 allocate(hecmat%X (
size(hecmatorg%X )))
240 hecmat%indexL = hecmatorg%indexL
241 hecmat%indexU = hecmatorg%indexU
242 hecmat%itemL = hecmatorg%itemL
243 hecmat%itemU = hecmatorg%itemU
254 integer(kind=kint) :: ierr
255 integer(kind=kint) :: i
257 if (hecmat%N /= hecmatorg%N) ierr = 1
258 if (hecmat%NP /= hecmatorg%NP) ierr = 1
259 if (hecmat%NDOF /= hecmatorg%NDOF) ierr = 1
260 if (hecmat%NPL /= hecmatorg%NPL) ierr = 1
261 if (hecmat%NPU /= hecmatorg%NPU) ierr = 1
263 write(0,*)
'ERROR: hecmw_mat_copy_val: different profile'
266 do i = 1,
size(hecmat%D)
267 hecmat%D(i) = hecmatorg%D(i)
269 do i = 1,
size(hecmat%AL)
270 hecmat%AL(i) = hecmatorg%AL(i)
272 do i = 1,
size(hecmat%AU)
273 hecmat%AU(i) = hecmatorg%AU(i)
279 integer(kind=kint) :: iter
281 hecmat%Iarray(idx_i_iter) = iter
293 integer(kind=kint) :: method
295 hecmat%Iarray(idx_i_method) = method
307 integer(kind=kint) :: method2
309 hecmat%Iarray(idx_i_method2) = method2
321 integer(kind=kint) :: precond
323 hecmat%Iarray(idx_i_precond) = precond
335 integer(kind=kint) :: nset
337 hecmat%Iarray(idx_i_nset) = nset
349 integer(kind=kint) :: iterpremax
351 if (iterpremax.lt.0) iterpremax= 0
352 if (iterpremax.gt.4) iterpremax= 4
354 hecmat%Iarray(idx_i_iterpremax) = iterpremax
366 integer(kind=kint) :: nrest
368 hecmat%Iarray(idx_i_nrest) = nrest
380 integer(kind=kint) :: nbfgs
382 hecmat%Iarray(idx_i_nbfgs) = nbfgs
394 integer(kind=kint) :: scaling
396 hecmat%Iarray(idx_i_scaling) = scaling
408 integer(kind=kint) :: penalized
410 hecmat%Iarray(idx_i_penalized) = penalized
422 integer(kind=kint) :: penalized_b
424 hecmat%Iarray(idx_i_penalized_b) = penalized_b
436 integer(kind=kint) :: mpc_method
438 hecmat%Iarray(idx_i_mpc_method) = mpc_method
456 integer(kind=kint) :: estcond
457 hecmat%Iarray(idx_i_estcond) = estcond
468 integer(kind=kint) :: contact_elim
469 hecmat%Iarray(idx_i_contact_elim) = contact_elim
474 integer(kind=kint) :: iterlog
476 hecmat%Iarray(idx_i_iterlog) = iterlog
488 integer(kind=kint) :: timelog
490 hecmat%Iarray(idx_i_timelog) = timelog
508 integer(kind=kint) :: dump_type
509 hecmat%Iarray(idx_i_dump) = dump_type
520 integer(kind=kint) :: dump_exit
521 hecmat%Iarray(idx_i_dump_exit) = dump_exit
532 integer(kind=kint) :: usejad
533 hecmat%Iarray(idx_i_usejad) = usejad
544 integer(kind=kint) :: ncolor_in
545 hecmat%Iarray(idx_i_ncolor_in) = ncolor_in
556 integer(kind=kint) :: maxrecycle_precond
557 if (maxrecycle_precond > 100) maxrecycle_precond = 100
558 hecmat%Iarray(idx_i_maxrecycle_precond) = maxrecycle_precond
569 hecmat%Iarray(idx_i_nrecycle_precond) = 0
574 hecmat%Iarray(idx_i_nrecycle_precond) = hecmat%Iarray(idx_i_nrecycle_precond) + 1
585 integer(kind=kint) :: flag_numfact
586 hecmat%Iarray(idx_i_flag_numfact) = flag_numfact
597 integer(kind=kint) :: flag_symbfact
598 hecmat%Iarray(idx_i_flag_symbfact) = flag_symbfact
603 hecmat%Iarray(idx_i_flag_symbfact) = 0
614 integer(kind=kint) :: solver_type
615 hecmat%Iarray(idx_i_solver_type) = solver_type
620 integer(kind=kint) :: flag_converged
621 hecmat%Iarray(idx_i_flag_converged) = flag_converged
632 integer(kind=kint) :: flag_diverged
633 hecmat%Iarray(idx_i_flag_diverged) = flag_diverged
644 integer(kind=kint) :: flag_mpcmatvec
645 hecmat%Iarray(idx_i_flag_mpcmatvec) = flag_mpcmatvec
656 integer(kind=kint) :: solver_opt(:)
657 integer(kind=kint) :: nopt
658 nopt = idx_i_solver_opt_e - idx_i_solver_opt_s + 1
659 hecmat%Iarray(idx_i_solver_opt_s:idx_i_solver_opt_e) = solver_opt(1:nopt)
664 integer(kind=kint) :: solver_opt(:)
665 integer(kind=kint) :: nopt
666 nopt = idx_i_solver_opt_e - idx_i_solver_opt_s + 1
667 solver_opt(1:nopt) = hecmat%Iarray(idx_i_solver_opt_s:idx_i_solver_opt_e)
672 real(kind=
kreal) :: resid
674 hecmat%Rarray(idx_r_resid) = resid
686 real(kind=
kreal) :: sigma_diag
688 if( sigma_diag < 0.d0 )
then
689 hecmat%Rarray(idx_r_sigma_diag) = -1.d0
690 elseif( sigma_diag < 1.d0 )
then
691 hecmat%Rarray(idx_r_sigma_diag) = 1.d0
692 elseif( sigma_diag > 2.d0 )
then
693 hecmat%Rarray(idx_r_sigma_diag) = 2.d0
695 hecmat%Rarray(idx_r_sigma_diag) = sigma_diag
708 real(kind=
kreal) :: sigma
710 if (sigma < 0.d0)
then
711 hecmat%Rarray(idx_r_sigma) = 0.d0
712 elseif (sigma > 1.d0)
then
713 hecmat%Rarray(idx_r_sigma) = 1.d0
715 hecmat%Rarray(idx_r_sigma) = sigma
728 real(kind=
kreal) :: thresh
730 hecmat%Rarray(idx_r_thresh) = thresh
742 real(kind=
kreal) :: filter
744 hecmat%Rarray(idx_r_filter) = filter
756 real(kind=
kreal) :: penalty
758 hecmat%Rarray(idx_r_penalty) = penalty
770 real(kind=
kreal) :: alpha
772 hecmat%Rarray(idx_r_penalty_alpha) = alpha
786 integer(kind=kint) :: ndiag, i
789 ndiag = hecmat%NDOF**2 * hecmat%NP
801 real(kind=
kreal),
pointer :: diag(:)
802 integer(kind=kint) :: i, k, idx, ndof, np
806 allocate(diag(ndof * np))
810 idx = ndof * ndof * (i - 1) + (k-1) * ndof + k
811 diag(ndof * (i - 1) + k) = hecmat%D(idx)
818 integer(kind=kint) :: nrecycle, maxrecycle
819 if (hecmat%Iarray(idx_i_flag_symbfact) >= 1)
then
820 hecmat%Iarray(idx_i_flag_numfact)=1
822 elseif (hecmat%Iarray(idx_i_flag_numfact) > 1)
then
824 hecmat%Iarray(idx_i_flag_numfact) = 1
825 elseif (hecmat%Iarray(idx_i_flag_numfact) == 1)
then
828 if ( nrecycle < maxrecycle )
then
829 hecmat%Iarray(idx_i_flag_numfact) = 0
845 if (
associated(src%D)) dest%D => src%D
846 if (
associated(src%B)) dest%B => src%B
847 if (
associated(src%X)) dest%X => src%X
848 if (
associated(src%AL)) dest%AL => src%AL
849 if (
associated(src%AU)) dest%AU => src%AU
850 if (
associated(src%indexL)) dest%indexL => src%indexL
851 if (
associated(src%indexU)) dest%indexU => src%indexU
852 if (
associated(src%itemL)) dest%itemL => src%itemL
853 if (
associated(src%itemU)) dest%itemU => src%itemU
854 dest%Iarray(:) = src%Iarray(:)
855 dest%Rarray(:) = src%Rarray(:)
873 integer(kind=kint) :: i, j, k, nn, pre, pp, js, je
875 nn = hecmat%NDOF * hecmat%NDOF
876 hecmat%NPA = hecmat%NP + hecmat%NPL + hecmat%NPU
877 if (
associated(hecmat%A))
deallocate(hecmat%A)
878 if (
associated(hecmat%indexA))
deallocate(hecmat%indexA)
879 if (
associated(hecmat%itemA))
deallocate(hecmat%itemA)
880 allocate (hecmat%A(nn * hecmat%NPA))
881 allocate (hecmat%indexA(0:hecmat%NP))
882 allocate (hecmat%itemA(hecmat%NPA))
889 hecmat%indexA(i) = i + hecmat%indexL(i) + hecmat%indexU(i)
891 pre = i - 1 + hecmat%indexU(i - 1)
892 js= hecmat%indexL(i - 1) + 1
893 je= hecmat%indexL(i )
896 hecmat%itemA(pp) = hecmat%itemL(j)
898 hecmat%A(nn * pp + k) = hecmat%AL(nn * j + k)
902 pp = i + hecmat%indexU(i - 1) + hecmat%indexL(i)
905 hecmat%A(nn * pp + k) = hecmat%D(nn * i + k)
908 pre = i + hecmat%indexL(i)
909 js= hecmat%indexU(i - 1) + 1
910 je= hecmat%indexU(i )
913 hecmat%itemA(pp) = hecmat%itemU(j)
915 hecmat%A(nn * pp + k) = hecmat%AU(nn * j + k)
integer(kind=kint) function, public hecmw_mat_get_solver_type(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_flag_mpcmatvec(hecMAT)
subroutine, public hecmw_mat_set_usejad(hecMAT, usejad)
real(kind=kreal) function, dimension(:), pointer, public hecmw_mat_diag(hecMAT)
Extract diagonal components from matrix D into a 1D vector Returns: diag(i) = D(ndof*ndof*(node-1) + ...
subroutine, public hecmw_mat_set_ncolor_in(hecMAT, ncolor_in)
integer(kind=kint) function, public hecmw_mat_get_flag_diverged(hecMAT)
subroutine, public hecmw_mat_integrate(hecMAT)
Integrate matrix components into a single array for efficient access.
subroutine, public hecmw_mat_clear_flag_symbfact(hecMAT)
real(kind=kreal) function, public hecmw_mat_get_sigma_diag(hecMAT)
real(kind=kreal) function, public hecmw_mat_diag_max(hecMAT, hecMESH)
integer(kind=kint) function, public hecmw_mat_get_iterpremax(hecMAT)
subroutine, public hecmw_mat_set_sigma(hecMAT, sigma)
subroutine, public hecmw_mat_set_contact_elim(hecMAT, contact_elim)
integer(kind=kint) function, public hecmw_mat_get_dump_exit(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_nrest(hecMAT)
subroutine, public hecmw_mat_init(hecMAT)
subroutine, public hecmw_mat_set_iter(hecMAT, iter)
subroutine, public hecmw_mat_set_iterlog(hecMAT, iterlog)
subroutine, public hecmw_mat_finalize(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_nrecycle_precond(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_penalized(hecMAT)
subroutine, public hecmw_mat_copy_val(hecMATorg, hecMAT)
subroutine, public hecmw_mat_set_flag_diverged(hecMAT, flag_diverged)
subroutine, public hecmw_mat_set_penalized_b(hecMAT, penalized_b)
real(kind=kreal) function, public hecmw_mat_get_resid(hecMAT)
subroutine, public hecmw_mat_set_estcond(hecMAT, estcond)
integer(kind=kint) function, public hecmw_mat_get_maxrecycle_precond(hecMAT)
subroutine, public hecmw_mat_set_thresh(hecMAT, thresh)
subroutine, public hecmw_mat_set_flag_converged(hecMAT, flag_converged)
integer(kind=kint) function, public hecmw_mat_get_flag_converged(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_penalized_b(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_dump(hecMAT)
real(kind=kreal) function, public hecmw_mat_get_penalty_alpha(hecMAT)
subroutine, public hecmw_mat_get_solver_opt(hecMAT, solver_opt)
integer(kind=kint) function, public hecmw_mat_get_nbfgs(hecMAT)
subroutine, public hecmw_mat_substitute(dest, src)
real(kind=kreal) function, public hecmw_mat_get_penalty(hecMAT)
subroutine, public hecmw_mat_recycle_precond_setting(hecMAT)
subroutine, public hecmw_mat_incr_nrecycle_precond(hecMAT)
subroutine, public hecmw_mat_set_sigma_diag(hecMAT, sigma_diag)
subroutine, public hecmw_mat_set_penalty_alpha(hecMAT, alpha)
subroutine, public hecmw_mat_clear_b(hecMAT)
subroutine, public hecmw_mat_set_dump_exit(hecMAT, dump_exit)
integer(kind=kint) function, public hecmw_mat_get_iterlog(hecMAT)
subroutine, public hecmw_mat_set_flag_symbfact(hecMAT, flag_symbfact)
integer(kind=kint) function, public hecmw_mat_get_timelog(hecMAT)
subroutine, public hecmw_mat_set_nset(hecMAT, nset)
subroutine, public hecmw_mat_set_flag_numfact(hecMAT, flag_numfact)
subroutine, public hecmw_mat_copy_profile(hecMATorg, hecMAT)
subroutine, public hecmw_mat_set_method(hecMAT, method)
subroutine, public hecmw_mat_set_filter(hecMAT, filter)
integer(kind=kint) function, public hecmw_mat_get_method2(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_flag_numfact(hecMAT)
subroutine, public hecmw_mat_set_penalized(hecMAT, penalized)
subroutine, public hecmw_mat_set_penalty(hecMAT, penalty)
subroutine, public hecmw_mat_set_maxrecycle_precond(hecMAT, maxrecycle_precond)
subroutine, public hecmw_mat_clear(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_contact_elim(hecMAT)
subroutine, public hecmw_mat_set_timelog(hecMAT, timelog)
subroutine, public hecmw_mat_set_resid(hecMAT, resid)
real(kind=kreal) function, public hecmw_mat_get_thresh(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_flag_symbfact(hecMAT)
subroutine, public hecmw_mat_set_flag_mpcmatvec(hecMAT, flag_mpcmatvec)
integer(kind=kint) function, public hecmw_mat_get_method(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_precond(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_nset(hecMAT)
subroutine, public hecmw_mat_set_iterpremax(hecMAT, iterpremax)
real(kind=kreal) function, public hecmw_mat_get_filter(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_estcond(hecMAT)
subroutine, public hecmw_mat_set_nrest(hecMAT, nrest)
integer(kind=kint) function, public hecmw_mat_get_usejad(hecMAT)
subroutine, public hecmw_mat_set_solver_type(hecMAT, solver_type)
subroutine, public hecmw_mat_set_method2(hecMAT, method2)
integer(kind=kint) function, public hecmw_mat_get_mpc_method(hecMAT)
integer(kind=kint) function, public hecmw_mat_get_ncolor_in(hecMAT)
real(kind=kreal) function, public hecmw_mat_get_sigma(hecMAT)
subroutine, public hecmw_mat_set_nbfgs(hecMAT, nbfgs)
integer(kind=kint) function, public hecmw_mat_get_iter(hecMAT)
subroutine, public hecmw_mat_set_precond(hecMAT, precond)
subroutine, public hecmw_mat_set_solver_opt(hecMAT, solver_opt)
integer(kind=kint) function, public hecmw_mat_get_scaling(hecMAT)
subroutine, public hecmw_mat_reset_nrecycle_precond(hecMAT)
subroutine, public hecmw_mat_set_scaling(hecMAT, scaling)
subroutine, public hecmw_mat_set_mpc_method(hecMAT, mpc_method)
subroutine, public hecmw_mat_set_dump(hecMAT, dump_type)
integer(kind=kint), parameter hecmw_max
integer(kind=4), parameter kreal
subroutine hecmw_nullify_matrix(P)
subroutine hecmw_allreduce_r1(hecMESH, s, ntag)