V3FIT
v3fit_context.f
Go to the documentation of this file.
1 !*******************************************************************************
4 !
5 ! Note separating the Doxygen comment block here so detailed decription is
6 ! found in the Module not the file.
7 !
10 !*******************************************************************************
11 
13  USE v3fit_input
14  USE v3fit_params
16  USE reconstruction
17  USE ezcdf
18 
19  IMPLICIT NONE
20 
21 !*******************************************************************************
22 ! DERIVED-TYPE DECLARATIONS
23 ! 1) v3fit context
24 !
25 !*******************************************************************************
26 !-------------------------------------------------------------------------------
29 !-------------------------------------------------------------------------------
32  REAL (rprec) :: recon_stop
33 
36  INTEGER :: runlog_iou
39  INTEGER :: recout_iou
40 
42  TYPE (commandline_parser_class), POINTER :: cl_parser => null()
44  TYPE (model_class), POINTER :: model => null()
46  TYPE (gaussp_class_pointer), DIMENSION(:), POINTER :: &
47  & gp => null()
50  TYPE (signal_pointer), DIMENSION(:), POINTER :: &
51  & signals => null()
54  TYPE (param_pointer), DIMENSION(:), POINTER :: &
55  & derived_params => null()
58  TYPE (param_pointer), DIMENSION(:), POINTER :: params => null()
60  TYPE (param_pointer), DIMENSION(:), POINTER :: locks => null()
62  TYPE (reconstruction_class), POINTER :: recon => null()
63 
64 ! The default for the following index is -1 indicating that this signal hasn't
65 ! been created.
68  INTEGER :: magnetic_index = -1
71  INTEGER :: sxrem_index = -1
74  INTEGER :: intpol_index = -1
77  INTEGER :: thomson_index = -1
80  INTEGER :: extcurz_index = -1
83  INTEGER :: mse_index = -1
86  INTEGER :: ece_index = -1
89  INTEGER :: limiter_index = -1
92  INTEGER :: prior_gaussian_index = -1
95  INTEGER :: sxrem_ratio_index = -1
98  INTEGER :: combination_index = -1
99 
101  INTEGER :: result_ncid
102 
103 !--- MPI -----------------------------------------------------------------------
104 #if defined (mpi_opt)
106  INTEGER :: global_comm = mpi_comm_null
108  INTEGER :: equilibrium_comm = mpi_comm_null
110  INTEGER :: reconstruction_comm = mpi_comm_null
111 #endif
112  END TYPE
113 
114  CONTAINS
115 !*******************************************************************************
116 ! CONSTRUCTION SUBROUTINES
117 !*******************************************************************************
118 !-------------------------------------------------------------------------------
128 !-------------------------------------------------------------------------------
129  FUNCTION v3fit_context_construct(cl_parser)
130 
131  IMPLICIT NONE
132 
133 ! Declare Arguments
135  TYPE (commandline_parser_class), POINTER :: cl_parser
136 
137 ! local variables
138  REAL (rprec) :: start_time
139 
140 ! Start of executable code
141  start_time = profiler_get_start_time()
142 
143  ALLOCATE(v3fit_context_construct)
144 
145  v3fit_context_construct%cl_parser => cl_parser
146 
147  CALL profiler_set_stop_time('v3fit_context_construct', start_time)
148 
149  END FUNCTION
150 
151 !*******************************************************************************
152 ! DESTRUCTION SUBROUTINES
153 !*******************************************************************************
154 !-------------------------------------------------------------------------------
161 !-------------------------------------------------------------------------------
162  SUBROUTINE v3fit_context_destruct(this)
163 
164  IMPLICIT NONE
165 
166 ! Declare Arguments
167  TYPE (v3fit_context_class), POINTER :: this
168 
169 ! local variables
170  INTEGER :: i
171 
172 ! Start of executable code
173  IF (ASSOCIATED(this%cl_parser)) THEN
174  CALL commandline_parser_destruct(this%cl_parser)
175  this%cl_parser => null()
176  END IF
177 
178  IF (ASSOCIATED(this%model)) THEN
179  CALL model_destruct(this%model)
180  this%model => null()
181  END IF
182 
183 ! Deconstruct and deallocate all the signals.
184  IF (ASSOCIATED(this%gp)) THEN
185  DO i = 1, SIZE(this%gp)
186  IF (ASSOCIATED(this%gp(i)%p)) THEN
187  CALL gaussp_destruct(this%gp(i)%p)
188  this%gp(i)%p => null()
189  END IF
190  END DO
191  DEALLOCATE(this%gp)
192  this%signals => null()
193  END IF
194 
195 ! Deconstruct and deallocate all the signals.
196  IF (ASSOCIATED(this%signals)) THEN
197  DO i = 1, SIZE(this%signals)
198  IF (ASSOCIATED(this%signals(i)%p)) THEN
199  DEALLOCATE(this%signals(i)%p)
200  this%signals(i)%p => null()
201  END IF
202  END DO
203  DEALLOCATE(this%signals)
204  this%signals => null()
205  END IF
206 
207 ! Deconstruct and deallocate all the derived parameters.
208  IF (ASSOCIATED(this%derived_params)) THEN
209  DO i = 1, SIZE(this%derived_params)
210  IF (ASSOCIATED(this%derived_params(i)%p)) THEN
211  CALL param_destruct(this%derived_params(i)%p)
212  this%derived_params(i)%p => null()
213  END IF
214  END DO
215  DEALLOCATE(this%derived_params)
216  this%derived_params => null()
217  END IF
218 
219 ! Deconstruct and deallocate all the parameters.
220  IF (ASSOCIATED(this%params)) THEN
221  DO i = 1, SIZE(this%params)
222  IF (ASSOCIATED(this%params(i)%p)) THEN
223  CALL param_destruct(this%params(i)%p)
224  this%params(i)%p => null()
225  END IF
226  END DO
227  DEALLOCATE(this%params)
228  this%params => null()
229  END IF
230 
231 ! Deconstruct and deallocate all the parameters.
232  IF (ASSOCIATED(this%params)) THEN
233  DO i = 1, SIZE(this%locks)
234  IF (ASSOCIATED(this%locks(i)%p)) THEN
235  CALL param_destruct(this%locks(i)%p)
236  this%locks(i)%p => null()
237  END IF
238  END DO
239  DEALLOCATE(this%locks)
240  this%locks => null()
241  END IF
242 
243  IF (ASSOCIATED(this%recon)) THEN
244  CALL reconstruction_destruct(this%recon)
245  this%recon => null()
246  END IF
247 
248 ! Reset the signal index
249  this%prior_gaussian_index = -1
250  this%magnetic_index = -1
251  this%sxrem_index = -1
252  this%intpol_index = -1
253  this%thomson_index = -1
254  this%extcurz_index = -1
255  this%mse_index = -1
256  this%ece_index = -1
257  this%limiter_index = -1
258  this%sxrem_ratio_index = -1
259  this%combination_index = -1
260 
261  DEALLOCATE(this)
262 
263  END SUBROUTINE
264 
265 !*******************************************************************************
266 ! UTILITY SUBROUTINES
267 !*******************************************************************************
268 !-------------------------------------------------------------------------------
275 !-------------------------------------------------------------------------------
276  SUBROUTINE v3fit_context_resize(this)
277 
278  IMPLICIT NONE
279 
280 ! Declare Arguments
281  TYPE (v3fit_context_class), INTENT(inout) :: this
282 
283 ! local variables
284  INTEGER :: i
285  INTEGER :: minsize
286  TYPE (signal_pointer), DIMENSION(:), POINTER :: temp_signal
287  REAL (rprec) :: start_time
288 
289 ! Start of executable code
290  start_time = profiler_get_start_time()
291 
292  WRITE (*,*) ' *** Resizing context arrays'
293  WRITE (this%runlog_iou,*) ' *** Resizing context arrays'
294 
295 ! Search an array for the first instance of a null pointer.
296  IF (ASSOCIATED(this%signals)) THEN
297  minsize = SIZE(this%signals)
298  DO i = 1, SIZE(this%signals)
299  IF (.not.ASSOCIATED(this%signals(i)%p)) THEN
300  minsize = i - 1
301  EXIT
302  END IF
303  END DO
304 
305 ! Deallocate the array if no signals are used. Reallocate the array if it is
306 ! smaller.
307  IF (minsize .eq. 0) THEN
308  DEALLOCATE(this%signals)
309  this%signals => null()
310 
311  CALL profiler_set_stop_time('v3fit_context_resize', &
312  & start_time)
313 
314  RETURN
315  ELSE IF (minsize .lt. SIZE(this%signals)) THEN
316  ALLOCATE(temp_signal(minsize))
317  DO i = 1, minsize
318  temp_signal(i)%p => this%signals(i)%p
319  END DO
320 
321  DEALLOCATE(this%signals)
322  this%signals => temp_signal
323  END IF
324 
325  END IF
326 
327  CALL profiler_set_stop_time('v3fit_context_resize', start_time)
328 
329  END SUBROUTINE
330 
331 !-------------------------------------------------------------------------------
337 !-------------------------------------------------------------------------------
338  SUBROUTINE v3fit_context_create_files(this)
339  USE safe_open_mod
340 
341  IMPLICIT NONE
342 
343 ! Declare Arguments
344  TYPE (v3fit_context_class), INTENT(inout) :: this
345 
346 ! local variables
347  CHARACTER (len=path_length) :: filename
348  INTEGER :: status
349  INTEGER :: recon_rank
350  REAL (rprec) :: start_time
351 
352 ! Start of executable code
353  start_time = profiler_get_start_time()
354 
355 #if defined(MPI_OPT)
356  CALL mpi_comm_rank(this%reconstruction_comm, recon_rank, status)
357 #else
358  recon_rank = 0
359 #endif
360 
361  filename = commandline_parser_get_string(this%cl_parser, '-file')
362 
363 ! Setup the runlog file.
364 ! Initalize a default value of the I\O unit. V3FIT increments from there.
365  this%runlog_iou = 0
366  CALL safe_open(this%runlog_iou, status, &
367  & trim('runlog.' // filename_base(filename)), &
368  & 'replace', 'formatted', delim_in='none')
369  CALL assert_eq(0, status, 'v3fit_context_construct: ' // &
370  & 'Safe_open of runlog. ' // &
371  & trim(filename_base(filename)) // 'failed')
372 
373 ! Setup the recout file.
374 ! Initalize a default value of the I\O unit. V3FIT increments from there.
375  this%recout_iou = 0
376  CALL safe_open(this%recout_iou, status, &
377  & trim('recout.' // filename_base(filename)), &
378  & 'replace', 'formatted', delim_in='none')
379  CALL assert_eq(0, status, 'v3fit_context_construct: ' // &
380  & 'Safe_open of recout. ' // &
381  & trim(filename_base(filename)) // 'failed')
382 
383  IF (commandline_parser_is_flag_set(this%cl_parser, &
384  & '-restart') .and. &
385  & recon_rank .eq. 0) THEN
386  filename = commandline_parser_get_string(this%cl_parser, &
387  & '-restart')
388  status = nf_open(filename, nf_write, this%result_ncid)
389  CALL assert_eq(status, nf_noerr, nf_strerror(status))
390  ELSE
391 ! Create a result file.
392  status = nf_create('result.' // trim(filename_base(filename)) &
393  & // '.nc', nf_clobber, &
394  & this%result_ncid)
395  CALL assert_eq(status, nf_noerr, nf_strerror(status))
396  END IF
397 
398  WRITE (this%runlog_iou, *) 'V3FITA RUN'
399  WRITE (this%runlog_iou, *) ' Namelist Input from file ', &
400  & trim(filename)
401 
402  WRITE (this%recout_iou, *) 'V3FITA RUN'
403  WRITE (this%recout_iou, *) ' Namelist Input from file ', &
404  & trim(filename)
405 
406  CALL profiler_set_stop_time('v3fit_context_create_files', &
407  & start_time)
408 
409  END SUBROUTINE
410 
411 !-------------------------------------------------------------------------------
417 !-------------------------------------------------------------------------------
418  SUBROUTINE v3fit_context_close_files(this)
419 
420  IMPLICIT NONE
421 
422 
423 ! Declare Arguments
424  TYPE (v3fit_context_class), INTENT(inout) :: this
425 
426 ! local variables
427  INTEGER :: status
428  REAL (rprec) :: start_time
429 
430 ! Start of executable code
431  start_time = profiler_get_start_time()
432 
433  CLOSE(this%runlog_iou)
434  CLOSE(this%recout_iou)
435 
436  status = nf_close(this%result_ncid)
437  CALL assert_eq(status, nf_noerr, nf_strerror(status))
438 
439  CALL profiler_set_stop_time('v3fit_context_close_files', &
440  & start_time)
441 
442  END SUBROUTINE
443 
444 !-------------------------------------------------------------------------------
453 !-------------------------------------------------------------------------------
454  SUBROUTINE v3fit_context_write(this)
455 
456  IMPLICIT NONE
457 
458 ! Declare Arguments
459  TYPE (v3fit_context_class), INTENT(inout) :: this
460 
461 ! local variables
462  INTEGER :: i, j
463  REAL (rprec), DIMENSION(:), ALLOCATABLE :: sem_row
464  INTEGER :: sem_offset
465 ! Fortran 95 doesn't allow allocatable strings. Need to allocate a string large
466 ! enough to hold every possible parameter. Fortran 95 doesn't allow allocatable
467 ! scalar types so make this a pointer. This large string needs to be allocated
468 ! to avoid a stack overflow.
469  CHARACTER (len=26 + 14*v3fit_max_parameters), POINTER :: &
470  & sem_header
471  INTEGER, DIMENSION(:), ALLOCATABLE :: indices
472  class(signal_class), POINTER :: temp_signal
473  REAL (rprec) :: start_time
474 
475 ! local parameters
476  CHARACTER (len=12), PARAMETER :: prefix = ' '
477 
478 ! Start of executable code
479  start_time = profiler_get_start_time()
480 
481  WRITE (*,*) ' *** Writing context to disk'
482  WRITE (this%runlog_iou,*) ' *** Writing context to disk'
483 
484 ! Make the sem_header null so it may be allocated and deallocated.
485  sem_header => null()
486 
487 ! Write out the reconstruction
488  IF (ASSOCIATED(this%recon)) THEN
489  CALL reconstruction_write(this%recon, this%recout_iou)
490  END IF
491 
492 ! Write out the derived parameters
493  IF (ASSOCIATED(this%derived_params)) THEN
494  CALL param_write_header_short(this%recout_iou)
495  DO j = 1, SIZE(this%derived_params)
496  CALL param_write_short(this%derived_params(j)%p, &
497  & this%recout_iou, j, this%model)
498  END DO
499 
500 ! Write out the derived parameter correlation matrix.
501  IF (SIZE(this%derived_params) .gt. 0 .and. &
502  & ASSOCIATED(this%derived_params(1)%p%correlation)) THEN
504  & this%derived_params, &
505  & prefix, &
506  & ' *** Derived ' // &
507  & 'parameter ' // &
508  & 'covariance ' // &
509  & 'matrix')
510 
511  DO j = 1, SIZE(this%derived_params)
512  CALL param_write_correlation(this%derived_params(j)%p, &
513  & this%recout_iou, this%model)
514  END DO
515  END IF
516  END IF
517 
518 ! Write out the parameters
519  IF (ASSOCIATED(this%params)) THEN
520  CALL param_write_header(this%recout_iou)
521  DO j = 1, SIZE(this%params)
522  CALL param_write(this%params(j)%p, this%recout_iou, j, &
523  & this%model)
524  END DO
525 
526 ! Write out the reconstruction parameter correlation matrix.
527  IF (SIZE(this%params) .gt. 0 .and. &
528  & ASSOCIATED(this%params(1)%p%correlation)) THEN
529  CALL v3fit_context_write_param_header(this, this%params, &
530  & prefix, &
531  & ' *** Reconstruction ' &
532  & // 'parameter ' // &
533  & 'covariance ' // &
534  & 'matrix')
535 
536  DO j = 1, SIZE(this%params)
537  CALL param_write_correlation(this%params(j)%p, &
538  & this%recout_iou, this%model)
539  END DO
540  END IF
541 
542 ! Only need to write out the signal effectiveness matrix if signals exist.
543  IF (ASSOCIATED(this%signals)) THEN
544 
545 ! Write out the signal effectiveness matrix. This matrix will be written out
546 ! so that each parameter is one a column and each row is a a signal. Start by
547 ! generating the header.
548  CALL v3fit_context_write_param_header(this, this%params, &
549  & ' # s_name ' // &
550  & ' ', &
551  & ' *** Signal ' // &
552  & 'Effectiveness ' // &
553  & 'Matrix')
554 
555 ! Write out each row of the sem matrix.
556 ! Reuse the sem_header string to generate the format string. The format string
557 ! will be
558 !
559 ! i4,2x,a20,<num_params>(2x,es12.5)
560  ALLOCATE(sem_row(SIZE(this%params)))
561  ALLOCATE(sem_header)
562  WRITE (sem_header, 1002) SIZE(this%params)
563 
564  DO i = 1, SIZE(this%signals)
565  temp_signal => this%signals(i)%p
566 
567  DO j = 1, SIZE(this%params)
568  sem_row(j) = this%params(j)%p%recon%sem(i)
569  END DO
570 
571  WRITE (this%recout_iou, sem_header(1:26)) &
572  & i, temp_signal%s_name, sem_row
573  END DO
574 
575 ! Write out the total for each column. Sum over all the signals for a single
576 ! parameter. This should be 1.0.
577  WRITE (sem_header, 1003) SIZE(this%params)
578  DO j = 1, SIZE(this%params)
579  sem_row(j) = sum(this%params(j)%p%recon%sem)
580  END DO
581 
582  WRITE (this%recout_iou, *)
583  WRITE (this%recout_iou, sem_header) sem_row
584 
585 ! Write out the most effective signal.
586  ALLOCATE(indices(SIZE(this%params)))
587 
588  WRITE (sem_header, 1001) ' Most Effective Signal:'
589  sem_offset = 26
590  DO j = 1, SIZE(this%params)
591  indices(j) = maxloc(this%params(j)%p%recon%sem, 1)
592  sem_row(j) = this%params(j)%p%recon%sem(indices(j))
593 
594  WRITE (sem_header, 1000) &
595  & sem_header(1:sem_offset), &
596  & trim(this%signals(indices(j))%p%s_name)
597  sem_offset = sem_offset + 14
598  END DO
599  WRITE (this%recout_iou, 1001) &
600  & sem_header(1:26 + 14*SIZE(this%params))
601 
602  WRITE (sem_header, 1005) SIZE(this%params)
603  WRITE (this%recout_iou, sem_header) indices
604 
605  WRITE (sem_header, 1006) SIZE(this%params)
606  WRITE (this%recout_iou, sem_header) sem_row
607 
608  DEALLOCATE(indices)
609  DEALLOCATE(sem_header)
610  DEALLOCATE(sem_row)
611  END IF
612 
613 1000 FORMAT (a,2x,a12)
614 1001 FORMAT (a)
615 1002 FORMAT ('(i4,2x,a20,',i3,'(2x,es12.5))')
616 1003 FORMAT ('(20x,''Total:''',i3,'(2x,es12.5))')
617 1005 FORMAT ('(13x,''Signal Index:''',i3,'(2x,i12))')
618 1006 FORMAT ('(16x,''Max Value:''',i3,'(2x,es12.5))')
619  END IF
620 
621 ! Write out the model.
622  IF (ASSOCIATED(this%model)) THEN
623  CALL model_write(this%model, this%recout_iou)
624  END IF
625 
626 ! Write out the signals
627  IF (ASSOCIATED(this%signals)) THEN
628  WRITE (this%recout_iou, *)
629  WRITE (this%recout_iou, *) ' *** Signals'
630 
631  DO i = 1, SIZE(this%signals)
632  temp_signal => this%signals(i)%p
633 
634 ! Check if the index has reached a new signal type
635  IF ((1 .eq. i) .or. &
636  & (this%magnetic_index .eq. i) .or. &
637  & (this%sxrem_index .eq. i) .or. &
638  & (this%intpol_index .eq. i) .or. &
639  & (this%thomson_index .eq. i) .or. &
640  & (this%extcurz_index .eq. i) .or. &
641  & (this%mse_index .eq. i) .or. &
642  & (this%ece_index .eq. i) .or. &
643  & (this%limiter_index .eq. i) .or. &
644  & (this%prior_gaussian_index .eq. i) .or. &
645  & (this%sxrem_ratio_index .eq. i) .or. &
646  & (this%combination_index .eq. i)) THEN
647 
648  CALL temp_signal%write_header(this%recout_iou)
649  END IF
650 
651  CALL temp_signal%write(this%recout_iou, i, this%model)
652  END DO
653 
654 ! All the signals should be written out before auxiliary information.
655  DO i = 1, SIZE(this%signals)
656  temp_signal => this%signals(i)%p
657  CALL temp_signal%write_auxiliary(this%recout_iou, i, &
658  & this%model)
659  END DO
660  END IF
661 
662  CALL profiler_set_stop_time('v3fit_context_write', start_time)
663 
664  END SUBROUTINE
665 
666 !-------------------------------------------------------------------------------
682 !-------------------------------------------------------------------------------
683  SUBROUTINE v3fit_context_write_param_header(this, params, prefix, &
684  & type_name)
685 
686  IMPLICIT NONE
687 
688 ! Declare Arguments
689  TYPE (v3fit_context_class), INTENT(inout) :: this
690  TYPE (param_pointer), DIMENSION(:) :: params
691  CHARACTER (len=*) :: prefix
692  CHARACTER (len=*) :: type_name
693 
694 ! local variables
695 ! Fortran 95 doesn't allow allocatable strings. Need to allocate a string large
696 ! enough to hold every possible parameter. Fortran 95 doesn't allow allocatable
697 ! scalar types so make this a pointer. This large string needs to be allocated
698 ! to avoid a stack overflow. The longest header generate will be the signal
699 ! effectiveness matrix. Make the start of this string at least 26 characters.
700  CHARACTER (len=26 + 14*v3fit_max_parameters), POINTER :: header
701  INTEGER :: offset, j
702  REAL (rprec) :: start_time
703 
704 ! Start of executable code
705  start_time = profiler_get_start_time()
706 
707  WRITE (this%recout_iou, *)
708  WRITE (this%recout_iou, *) type_name
709 
710 ! The header is formatted as
711 !
712 ! <prefix> (param_name[12]) ...
713 !
714 ! Start by allocating a string large enough to hold the entire header. The
715 ! length of this string needs to be the size of the prefix plus an additional
716 ! 14 for each parameter. The prefix string must be an exact length.
717  header => null()
718  ALLOCATE(header)
719 
720  WRITE (header, 1000) prefix
721  offset = len(prefix)
722  DO j = 1, SIZE(params)
723  WRITE (header, 1001) header(1:offset), &
724  & param_get_name(params(j)%p, this%model)
725  offset = offset + 14
726  END DO
727 
728  WRITE (this%recout_iou, 1000) header(1:offset)
729 
730  DEALLOCATE(header)
731 
732  CALL profiler_set_stop_time('v3fit_context_write_param_header', &
733  & start_time)
734 
735 1000 FORMAT (a)
736 1001 FORMAT (a,2x,a12)
737 
738  END SUBROUTINE
739 
740 !*******************************************************************************
741 ! NETCDF SUBROUTINES
742 !*******************************************************************************
797 !-------------------------------------------------------------------------------
806 !-------------------------------------------------------------------------------
807  SUBROUTINE v3fit_context_init_data(this, eq_steps)
808 
809  IMPLICIT NONE
810 
811 ! Declare Arguments
812  TYPE (v3fit_context_class), INTENT(inout) :: this
813  INTEGER, INTENT(in) :: eq_steps
814 
815 ! local variables
816  INTEGER :: i, status
817  INTEGER :: maxnsteps_dim_id
818  INTEGER :: ndparam_dim_id
819  INTEGER :: nparam_dim_id
820  INTEGER :: nparamindex_dim_id
821  INTEGER :: nsignal_dim_id
822  INTEGER :: n_sig_models_dim_id
823  INTEGER :: string_len_dim_id
824  INTEGER :: nsteps_id
825  INTEGER :: eq_steps_id
826  INTEGER :: g2_id
827  INTEGER :: derived_param_name_id
828  INTEGER :: derived_param_index_id
829  INTEGER :: derived_param_value_id
830  INTEGER :: derived_param_sigma_id
831  INTEGER :: derived_param_corr_id
832  INTEGER :: param_name_id
833  INTEGER :: param_index_id
834  INTEGER :: param_value_id
835  INTEGER :: param_sigma_id
836  INTEGER :: param_corr_id
837  INTEGER :: param_sem_id
838  INTEGER :: signal_name_id
839  INTEGER :: signal_type_id
840  INTEGER :: signal_weight_id
841  INTEGER :: signal_observed_value_id
842  INTEGER :: signal_model_value_id
843  INTEGER :: signal_sigma_value_id
844 
845  class(signal_class), POINTER :: temp_signal
846  REAL (rprec) :: start_time
847 
848 ! Start of executable code
849  start_time = profiler_get_start_time()
850 
851 ! Define dimensions
852  status = nf_noerr
853 
854  IF (ASSOCIATED(this%recon)) THEN
855  status = nf_def_dim(this%result_ncid, 'maxnsteps', &
856  & nf_unlimited, maxnsteps_dim_id)
857  ELSE
858  status = nf_def_dim(this%result_ncid, 'maxnsteps', &
859  & 1, maxnsteps_dim_id)
860  END IF
861  CALL assert_eq(status, nf_noerr, nf_strerror(status))
862 
863  IF (ASSOCIATED(this%params) .or. &
864  & ASSOCIATED(this%signals) .or. &
865  & ASSOCIATED(this%model)) THEN
866  status = nf_def_dim(this%result_ncid, 'string_len', &
867  & data_name_length, string_len_dim_id)
868  CALL assert_eq(status, nf_noerr, nf_strerror(status))
869  END IF
870 
871  IF (ASSOCIATED(this%derived_params) .and. &
872  & SIZE(this%derived_params) .gt. 0) THEN
873  status = nf_def_dim(this%result_ncid, 'ndparam', &
874  & SIZE(this%derived_params), &
875  & ndparam_dim_id)
876  CALL assert_eq(status, nf_noerr, nf_strerror(status))
877  END IF
878 
879  IF (ASSOCIATED(this%params)) THEN
880  status = nf_def_dim(this%result_ncid, 'nparam', &
881  & SIZE(this%params), nparam_dim_id)
882  CALL assert_eq(status, nf_noerr, nf_strerror(status))
883 
884  status = nf_def_dim(this%result_ncid, 'nparamindex', &
885  & 2, nparamindex_dim_id)
886  CALL assert_eq(status, nf_noerr, nf_strerror(status))
887  END IF
888 
889  IF (ASSOCIATED(this%signals)) THEN
890  status = nf_def_dim(this%result_ncid, 'nsignal', &
891  & SIZE(this%signals), nsignal_dim_id)
892  CALL assert_eq(status, nf_noerr, nf_strerror(status))
893  END IF
894 
895  IF (ASSOCIATED(this%signals)) THEN
896  status = nf_def_dim(this%result_ncid, 'n_sig_models', 4, &
897  & n_sig_models_dim_id)
898  CALL assert_eq(status, nf_noerr, nf_strerror(status))
899  END IF
900 
901 ! Define variables
902  status = nf_def_var(this%result_ncid, 'nsteps', nf_int, 0, 0, &
903  & nsteps_id)
904  CALL assert_eq(status, nf_noerr, nf_strerror(status))
905 
906  status = nf_def_var(this%result_ncid, 'eq_steps', nf_int, 0, 0, &
907  & eq_steps_id)
908  CALL assert_eq(status, nf_noerr, nf_strerror(status))
909 
910  IF (ASSOCIATED(this%recon)) THEN
911  status = nf_def_var(this%result_ncid, 'g2', nf_double, 1, &
912  & (/ maxnsteps_dim_id /), g2_id)
913  CALL assert_eq(status, nf_noerr, nf_strerror(status))
914  END IF
915 
916 ! Define derived parameter variables.
917  IF (ASSOCIATED(this%derived_params) .and. &
918  & SIZE(this%derived_params) .gt. 0) THEN
919  status = nf_def_var(this%result_ncid, 'derived_param_name', &
920  & nf_char, 2, (/ string_len_dim_id, &
921  & ndparam_dim_id /), &
922  & derived_param_name_id)
923  CALL assert_eq(status, nf_noerr, nf_strerror(status))
924 
925  status = nf_def_var(this%result_ncid, 'derived_param_index', &
926  & nf_int, 2, (/ nparamindex_dim_id, &
927  & ndparam_dim_id /), &
928  & derived_param_index_id)
929  CALL assert_eq(status, nf_noerr, nf_strerror(status))
930 
931  status = nf_def_var(this%result_ncid, 'derived_param_value', &
932  & nf_double, 2, (/ ndparam_dim_id, &
933  & maxnsteps_dim_id /), &
934  & derived_param_value_id)
935  CALL assert_eq(status, nf_noerr, nf_strerror(status))
936 
937  status = nf_def_var(this%result_ncid, 'derived_param_sigma', &
938  & nf_double, 2, (/ ndparam_dim_id, &
939  & maxnsteps_dim_id /), &
940  & derived_param_sigma_id)
941  CALL assert_eq(status, nf_noerr, nf_strerror(status))
942 
943  status = nf_def_var(this%result_ncid, 'derived_param_corr', &
944  & nf_double, 3, (/ ndparam_dim_id, &
945  & ndparam_dim_id, &
946  & maxnsteps_dim_id /), &
947  & derived_param_corr_id)
948  CALL assert_eq(status, nf_noerr, nf_strerror(status))
949  END IF
950 
951 ! Define reconstruction parameter variables.
952  IF (ASSOCIATED(this%params)) THEN
953  status = nf_def_var(this%result_ncid, 'param_name', nf_char, &
954  & 2, (/ string_len_dim_id, &
955  & nparam_dim_id /), param_name_id)
956  CALL assert_eq(status, nf_noerr, nf_strerror(status))
957 
958  status = nf_def_var(this%result_ncid, 'param_index', nf_int, &
959  & 2, (/ nparamindex_dim_id, &
960  & nparam_dim_id /), param_index_id)
961  CALL assert_eq(status, nf_noerr, nf_strerror(status))
962 
963  status = nf_def_var(this%result_ncid, 'param_value', nf_double, &
964  & 2, (/ nparam_dim_id, &
965  & maxnsteps_dim_id /), &
966  & param_value_id)
967  CALL assert_eq(status, nf_noerr, nf_strerror(status))
968 
969  status = nf_def_var(this%result_ncid, 'param_sigma', nf_double, &
970  & 2, (/ nparam_dim_id, &
971  & maxnsteps_dim_id /), &
972  & param_sigma_id)
973  CALL assert_eq(status, nf_noerr, nf_strerror(status))
974 
975  status = nf_def_var(this%result_ncid, 'param_corr', &
976  & nf_double, 3, (/ nparam_dim_id, &
977  & nparam_dim_id, &
978  & maxnsteps_dim_id /), &
979  & param_corr_id)
980  CALL assert_eq(status, nf_noerr, nf_strerror(status))
981 
982  status = nf_def_var(this%result_ncid, 'signal_eff_matrix', &
983  & nf_double, 3, (/ nsignal_dim_id, &
984  & nparam_dim_id, &
985  & maxnsteps_dim_id /), &
986  & param_sem_id)
987  CALL assert_eq(status, nf_noerr, nf_strerror(status))
988  END IF
989 
990 ! Define signal variables.
991  IF (ASSOCIATED(this%signals)) THEN
992  status = nf_def_var(this%result_ncid, 'signal_name', nf_char, &
993  & 2, (/ string_len_dim_id, &
994  & nsignal_dim_id /), signal_name_id)
995  CALL assert_eq(status, nf_noerr, nf_strerror(status))
996 
997  status = nf_def_var(this%result_ncid, 'signal_type', nf_char, &
998  & 2, (/ string_len_dim_id, &
999  & nsignal_dim_id /), signal_type_id)
1000  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1001 
1002  status = nf_def_var(this%result_ncid, 'signal_weight', &
1003  & nf_double, 1, (/ nsignal_dim_id /), &
1004  & signal_weight_id)
1005  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1006 
1007  status = nf_def_var(this%result_ncid, 'signal_observed_value', &
1008  & nf_double, 1, (/ nsignal_dim_id /), &
1009  & signal_observed_value_id)
1010  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1011 
1012  status = nf_def_var(this%result_ncid, 'signal_model_value', &
1013  & nf_double, 3, (/ n_sig_models_dim_id, &
1014  & nsignal_dim_id, &
1015  & maxnsteps_dim_id /), &
1016  & signal_model_value_id)
1017  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1018 
1019  status = nf_def_var(this%result_ncid, 'signal_sigma', &
1020  & nf_double, 2, (/ nsignal_dim_id, &
1021  & maxnsteps_dim_id /), &
1022  & signal_sigma_value_id)
1023  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1024  END IF
1025 
1026  IF (ASSOCIATED(this%model)) THEN
1027  CALL model_def_result(this%model, this%result_ncid, &
1028  & maxnsteps_dim_id, string_len_dim_id)
1029  END IF
1030 
1031 ! Finished defining netcdf file. Exit out of define mode.
1032  status = nf_enddef(this%result_ncid)
1033  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1034 
1035  IF (ASSOCIATED(this%derived_params)) THEN
1036  DO i = 1, SIZE(this%derived_params)
1037  status = nf_put_vara_text(this%result_ncid, &
1038  & derived_param_name_id, (/ 1, i /), &
1039  & (/ data_name_length, 1 /), &
1040  & param_get_name(this%derived_params(i)%p, &
1041  & this%model))
1042  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1043 
1044  status = nf_put_vara_int(this%result_ncid, &
1045  & derived_param_index_id, &
1046  & (/ 1, i /), (/ 2, 1 /), &
1047  & this%derived_params(i)%p%indices)
1048  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1049  END DO
1050  END IF
1051 
1052  IF (ASSOCIATED(this%params)) THEN
1053  DO i = 1, SIZE(this%params)
1054  status = nf_put_vara_text(this%result_ncid, param_name_id, &
1055  & (/ 1, i /), &
1056  & (/ data_name_length, 1 /), &
1057  & param_get_name(this%params(i)%p, &
1058  & this%model))
1059  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1060 
1061  status = nf_put_vara_int(this%result_ncid, &
1062  & param_index_id, &
1063  & (/ 1, i /), (/ 2, 1 /), &
1064  & this%params(i)%p%indices)
1065  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1066  END DO
1067  END IF
1068 
1069  IF (ASSOCIATED(this%signals)) THEN
1070  DO i = 1, SIZE(this%signals)
1071  temp_signal => this%signals(i)%p
1072 
1073  status = nf_put_vara_text(this%result_ncid, signal_name_id, &
1074  & (/ 1, i /), &
1075  & (/ data_name_length, 1 /), &
1076  & this%signals(i)%p%s_name)
1077  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1078 
1079  status = nf_put_vara_text(this%result_ncid, signal_type_id, &
1080  & (/ 1, i /), &
1081  & (/ data_name_length, 1 /), &
1082  & temp_signal%get_type())
1083  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1084 
1085  status = nf_put_var1_double(this%result_ncid, &
1086  & signal_weight_id, i, &
1087  & this%signals(i)%p%weight)
1088  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1089 
1090  status = nf_put_var1_double(this%result_ncid, &
1091  & signal_observed_value_id, i, &
1092  & this%signals(i)%p%observed)
1093  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1094  END DO
1095  END IF
1096 
1097  IF (ASSOCIATED(this%model)) THEN
1098  CALL model_write_init_data(this%model, this%result_ncid)
1099  END IF
1100 
1101  CALL v3fit_context_write_step_data(this, .true., eq_steps)
1102 
1103  CALL profiler_set_stop_time('v3fit_context_init_data', start_time)
1104 
1105  END SUBROUTINE
1106 
1107 !-------------------------------------------------------------------------------
1120 !-------------------------------------------------------------------------------
1121  SUBROUTINE v3fit_context_write_step_data(this, first_step, &
1122  & eq_steps)
1124  IMPLICIT NONE
1125 
1126 ! Declare Arguments
1127  TYPE (v3fit_context_class), INTENT(inout) :: this
1128  LOGICAL, INTENT(in) :: first_step
1129  INTEGER, INTENT(in) :: eq_steps
1130 
1131 ! local variables
1132  INTEGER :: i, status
1133  INTEGER :: current_step
1134  INTEGER :: nsteps_id
1135  INTEGER :: eq_steps_id
1136  INTEGER :: g2_id
1137  INTEGER :: derived_param_value_id
1138  INTEGER :: derived_param_sigma_id
1139  INTEGER :: derived_param_corr_id
1140  INTEGER :: param_value_id
1141  INTEGER :: param_sigma_id
1142  INTEGER :: param_corr_id
1143  INTEGER :: param_sem_id
1144  INTEGER :: signal_model_value_id
1145  INTEGER :: signal_sigma_value_id
1146 
1147  class(signal_class), POINTER :: temp_signal
1148  REAL (rprec) :: start_time
1149 
1150 ! Start of executable code
1151  start_time = profiler_get_start_time()
1152 
1153 ! Update number of steps taken.
1154  status = nf_inq_varid(this%result_ncid, 'nsteps', nsteps_id)
1155  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1156  IF (first_step) THEN
1157  status = nf_put_var_int(this%result_ncid, nsteps_id, 0)
1158  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1159  current_step = 1
1160  ELSE
1161  status = nf_get_var_int(this%result_ncid, nsteps_id, &
1162  & current_step)
1163  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1164  current_step = current_step + 1
1165  status = nf_put_var_int(this%result_ncid, nsteps_id, &
1166  & current_step)
1167  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1168 
1169 ! Use current_step as an array index. The Netcdf arrays start at 1 so this
1170 ! needs to be incremented to point to the correct index.
1171  current_step = current_step + 1
1172  END IF
1173 
1174  status = nf_inq_varid(this%result_ncid, 'eq_steps', eq_steps_id)
1175  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1176  status = nf_put_var_int(this%result_ncid, eq_steps_id, eq_steps)
1177  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1178 
1179  CALL model_write_step_data(this%model, this%result_ncid, &
1180  & current_step)
1181 
1182  IF (ASSOCIATED(this%recon)) THEN
1183  status = nf_inq_varid(this%result_ncid, 'g2', g2_id)
1184  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1185  status = nf_put_var1_double(this%result_ncid, g2_id, &
1186  & current_step, &
1187  & reconstruction_get_g2(this%recon))
1188  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1189  END IF
1190 
1191  IF (ASSOCIATED(this%derived_params) .and. &
1192  & SIZE(this%derived_params) .gt. 0) THEN
1193  status = nf_inq_varid(this%result_ncid, &
1194  & 'derived_param_value', &
1195  & derived_param_value_id)
1196  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1197 
1198  status = nf_inq_varid(this%result_ncid, &
1199  & 'derived_param_sigma', &
1200  & derived_param_sigma_id)
1201  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1202 
1203  status = nf_inq_varid(this%result_ncid, &
1204  & 'derived_param_corr', &
1205  & derived_param_corr_id)
1206  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1207 
1208  DO i = 1, SIZE(this%derived_params)
1209  CALL param_write_step_data(this%derived_params(i)%p, &
1210  & this%model, this%result_ncid, &
1211  & current_step, i, &
1212  & derived_param_value_id, &
1213  & derived_param_sigma_id, &
1214  & derived_param_corr_id)
1215  END DO
1216  END IF
1217 
1218  IF (ASSOCIATED(this%params)) THEN
1219  status = nf_inq_varid(this%result_ncid, 'param_value', &
1220  & param_value_id)
1221  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1222 
1223  status = nf_inq_varid(this%result_ncid, 'param_sigma', &
1224  & param_sigma_id)
1225  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1226 
1227  status = nf_inq_varid(this%result_ncid, 'param_corr', &
1228  & param_corr_id)
1229  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1230 
1231  status = nf_inq_varid(this%result_ncid, 'signal_eff_matrix', &
1232  & param_sem_id)
1233  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1234 
1235  DO i = 1, SIZE(this%params)
1236  CALL param_write_step_data(this%params(i)%p, this%model, &
1237  & this%result_ncid, current_step, &
1238  & i, param_value_id, &
1239  & param_sigma_id, &
1240  & param_corr_id, &
1241  & param_sem_id)
1242  END DO
1243  END IF
1244 
1245  IF (ASSOCIATED(this%signals)) THEN
1246  status = nf_inq_varid(this%result_ncid, 'signal_model_value', &
1247  & signal_model_value_id)
1248  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1249 
1250  status = nf_inq_varid(this%result_ncid, 'signal_sigma', &
1251  & signal_sigma_value_id)
1252  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1253 
1254  DO i = 1, SIZE(this%signals)
1255  temp_signal => this%signals(i)%p
1256 
1257  CALL temp_signal%write_step_data(this%model, &
1258  & this%result_ncid, &
1259  & current_step, i, &
1260  & signal_model_value_id, &
1261  & signal_sigma_value_id)
1262  END DO
1263  END IF
1264 
1265 ! Flush the step data to disk. This ensures that data is recorded in the event
1266 ! of a fatal error that stops v3fit execution.
1267  status = nf_sync(this%result_ncid)
1268  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1269 
1270  CALL profiler_set_stop_time('v3fit_context_write_step_data', &
1271  & start_time)
1272 
1273  END SUBROUTINE
1274 
1275 !-------------------------------------------------------------------------------
1283 !-------------------------------------------------------------------------------
1284  FUNCTION v3fit_context_restart(this, current_step)
1286  IMPLICIT NONE
1287 
1288 ! Declare Arguments
1289  INTEGER :: v3fit_context_restart
1290  TYPE (v3fit_context_class), INTENT(inout) :: this
1291  INTEGER, INTENT(inout) :: current_step
1292 
1293 ! local variables
1294  INTEGER :: i
1295  INTEGER :: status
1296  INTEGER :: nsteps_id
1297  INTEGER :: eq_steps_id
1298  INTEGER :: param_value_id
1299  INTEGER :: param_sigma_id
1300  INTEGER :: param_corr_id
1301  REAL (rprec) :: start_time
1302 
1303 ! Start of executable code
1304  start_time = profiler_get_start_time()
1305 
1306 ! The current step starts at zero but the NetCDF file starts at 1. Increment
1307 ! the current step when passing it into subroutines.
1308  status = nf_inq_varid(this%result_ncid, 'nsteps', nsteps_id)
1309  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1310  status = nf_get_var_int(this%result_ncid, nsteps_id, &
1311  & current_step)
1312  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1313  current_step = current_step + 1
1314 
1315  IF (ASSOCIATED(this%params)) THEN
1316  status = nf_inq_varid(this%result_ncid, 'param_value', &
1317  & param_value_id)
1318  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1319 
1320  status = nf_inq_varid(this%result_ncid, 'param_sigma', &
1321  & param_sigma_id)
1322  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1323 
1324  status = nf_inq_varid(this%result_ncid, 'param_corr', &
1325  & param_corr_id)
1326  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1327 
1328  DO i = 1, SIZE(this%params)
1329  CALL param_restart(this%params(i)%p, this%model, &
1330  & this%result_ncid, &
1331  & current_step, &
1332  & i, param_value_id, param_sigma_id, &
1333  & param_corr_id, this%equilibrium_comm, &
1334  & this%recon%use_central)
1335  END DO
1336 
1337  CALL model_restart(this%model, this%result_ncid, &
1338  & current_step)
1339 
1340  CALL reconstruction_restart(this%recon, this%result_ncid, &
1341  & current_step, &
1342  & this%signals, this%derived_params, &
1343  & this%model)
1344 
1345  END IF
1346 
1347  status = nf_inq_varid(this%result_ncid, 'eq_steps', eq_steps_id)
1348  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1349  status = nf_get_var_int(this%result_ncid, eq_steps_id, &
1351  CALL assert_eq(status, nf_noerr, nf_strerror(status))
1352 
1353  CALL profiler_set_stop_time('v3fit_context_restart', start_time)
1354 
1355  END FUNCTION
1356 
1357  END MODULE
v3fit_context::v3fit_context_close_files
subroutine v3fit_context_close_files(this)
Close output files.
Definition: v3fit_context.f:419
reconstruction::reconstruction_write
subroutine reconstruction_write(this, iou)
Write out a reconstruction.
Definition: reconstruction.f:2373
commandline_parser::commandline_parser_class
Base class containing a parsed commandline.
Definition: commandline_parser.f:96
v3fit_params::param_write_correlation
subroutine param_write_correlation(this, iou, a_model)
Writes out a parameter covariance matrix row.
Definition: v3fit_params.f:1275
v3fit_input
This file contains all the variables and maximum sizes of the inputs for a v3fit namelist input file....
Definition: v3fit_input.f:570
v3fit_context
Defines a v3fit_context_class object to contain all the memory for running v3fit. Contains methods to...
Definition: v3fit_context.f:12
model
Defines the base class of the type model_class. The model contains information not specific to the eq...
Definition: model.f:59
v3fit_params::param_pointer
Pointer to a parameter object. Used for creating arrays of signal pointers. This is needed because fo...
Definition: v3fit_params.f:122
commandline_parser
Defines the base class of the type commandline_parser_class.
Definition: commandline_parser.f:65
reconstruction::reconstruction_get_g2
real(rprec) function reconstruction_get_g2(this)
Get the current g^2.
Definition: reconstruction.f:570
v3fit_context::v3fit_context_restart
integer function v3fit_context_restart(this, current_step)
Restart the reconstruction.
Definition: v3fit_context.f:1285
reconstruction
Defines the base class of the type reconstruction_class. This class contains the minimization algorit...
Definition: reconstruction.f:12
reconstruction::reconstruction_restart
subroutine reconstruction_restart(this, result_ncid, current_step, signals, derived_params, a_model)
Restart from result file.
Definition: reconstruction.f:2555
v3fit_context::v3fit_context_create_files
subroutine v3fit_context_create_files(this)
Create output files.
Definition: v3fit_context.f:339
commandline_parser::commandline_parser_is_flag_set
logical function commandline_parser_is_flag_set(this, arg)
Check if a command line argument was set.
Definition: commandline_parser.f:397
v3fit_params::param_write_header_short
subroutine param_write_header_short(iou)
Writes out parameter header information to an output file.
Definition: v3fit_params.f:1239
reconstruction::reconstruction_class
Base class containing all the data needed to reconstruct a model.
Definition: reconstruction.f:42
commandline_parser::commandline_parser_destruct
subroutine commandline_parser_destruct(this)
Deconstruct a commandline_parser_class object.
Definition: commandline_parser.f:202
reconstruction::reconstruction_destruct
subroutine reconstruction_destruct(this)
Deconstruct a reconstruction_class object.
Definition: reconstruction.f:280
commandline_parser::commandline_parser_get_string
character(len=path_length) function commandline_parser_get_string(this, arg)
Get the value of an argument as a string.
Definition: commandline_parser.f:238
v3fit_params::param_destruct
subroutine param_destruct(this)
Deconstruct a param_class object.
Definition: v3fit_params.f:420
v3fit_context::v3fit_context_write
subroutine v3fit_context_write(this)
Write the v3fit_context_class out to disk.
Definition: v3fit_context.f:455
v3fit_context::v3fit_context_resize
subroutine v3fit_context_resize(this)
Resize the arrays.
Definition: v3fit_context.f:277
v3fit_context::v3fit_context_destruct
subroutine v3fit_context_destruct(this)
Deconstruct a v3fit_context_class object.
Definition: v3fit_context.f:163
v3fit_params::param_write
subroutine param_write(this, iou, index, a_model)
Writes out a parameter to an output file.
Definition: v3fit_params.f:1122
v3fit_context::v3fit_context_write_param_header
subroutine v3fit_context_write_param_header(this, params, prefix, type_name)
Write the param_class::correlation header out to disk.
Definition: v3fit_context.f:685
v3fit_context::v3fit_context_init_data
subroutine v3fit_context_init_data(this, eq_steps)
Initialize the dimensions and variables of the result file.
Definition: v3fit_context.f:808
v3fit_params::param_write_header
subroutine param_write_header(iou)
Writes out parameter header information to an output file.
Definition: v3fit_params.f:1203
v3fit_params::param_restart
subroutine param_restart(this, a_model, result_ncid, current_step, index, param_value_id, param_sigma_id, param_corr_id, eq_comm, is_central)
Restart the parameter.
Definition: v3fit_params.f:1456
v3fit_params::param_get_name
character(len=data_name_length) function param_get_name(this, a_model)
Gets the parameter name.
Definition: v3fit_params.f:686
v3fit_params
Defines the base class of the type param_class.
Definition: v3fit_params.f:11
v3fit_context::v3fit_context_class
Base class representing a v3fit context. This contains all memory needed to operate v3fit.
Definition: v3fit_context.f:30
v3fit_context::v3fit_context_construct
type(v3fit_context_class) function, pointer v3fit_context_construct(cl_parser)
Construct a v3fit_context_class object.
Definition: v3fit_context.f:130
v3fit_context::v3fit_context_write_step_data
subroutine v3fit_context_write_step_data(this, first_step, eq_steps)
Write step data to the defined variables.
Definition: v3fit_context.f:1123
v3fit_params::param_write_short
subroutine param_write_short(this, iou, index, a_model)
Writes out a parameter to an output file.
Definition: v3fit_params.f:1167
v3fit_params::param_write_step_data
Interface for the writting of param_class data to the result file using param_write_step_data_1 or pa...
Definition: v3fit_params.f:145