Neko 1.99.2
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
registry.f90
Go to the documentation of this file.
1! Copyright (c) 2018-2025, The Neko Authors
2! All rights reserved.
3!
4! Redistribution and use in source and binary forms, with or without
5! modification, are permitted provided that the following conditions
6! are met:
7!
8! * Redistributions of source code must retain the above copyright
9! notice, this list of conditions and the following disclaimer.
10!
11! * Redistributions in binary form must reproduce the above
12! copyright notice, this list of conditions and the following
13! disclaimer in the documentation and/or other materials provided
14! with the distribution.
15!
16! * Neither the name of the authors nor the names of its
17! contributors may be used to endorse or promote products derived
18! from this software without specific prior written permission.
19!
20! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24! COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26! BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30! ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31! POSSIBILITY OF SUCH DAMAGE.
32!
35 use, intrinsic :: iso_fortran_env, only: error_unit
36 use num_types, only : rp
37 use field, only : field_t
38 use vector, only : vector_t
39 use matrix, only : matrix_t
41 use dofmap, only : dofmap_t
42 use utils, only : neko_error
43 use htable, only : h_cptr_t
44 use utils, only: neko_error
45 use comm, only : pe_rank
46 use json_module, only : json_file
47 use json_utils, only : json_get
49 implicit none
50 private
51
52 type, public :: registry_t
54 type(registry_entry_t), private, allocatable :: entries(:)
56 type(json_file), private :: aliases
58 integer, private :: n_entries_ = 0
60 integer, private :: n_aliases_ = 0
62 integer, private :: expansion_size_ = 5
63 contains
65 procedure, pass(this) :: init => registry_init
67 procedure, pass(this) :: free => registry_free
69 procedure, private, pass(this) :: expand => registry_expand
70
72 procedure, pass(this) :: add_field => registry_add_field
74 procedure, pass(this) :: add_vector => registry_add_vector
76 procedure, pass(this) :: add_matrix => registry_add_matrix
78 procedure, pass(this) :: add_real_scalar => registry_add_real_scalar
80 procedure, pass(this) :: add_integer_scalar => registry_add_integer_scalar
82 procedure, pass(this) :: add_alias => registry_add_alias
83
85 procedure, pass(this) :: get_field_by_name => registry_get_field_by_name
87 procedure, pass(this) :: get_vector_by_name => registry_get_vector_by_name
89 procedure, pass(this) :: get_matrix_by_name => registry_get_matrix_by_name
91 procedure, pass(this) :: get_real_scalar_by_name => &
94 procedure, pass(this) :: get_integer_scalar_by_name => &
96
98 generic :: get_field => get_field_by_name
100 generic :: get_vector => get_vector_by_name
102 generic :: get_matrix => get_matrix_by_name
104 generic :: get_real_scalar => get_real_scalar_by_name
106 generic :: get_integer_scalar => get_integer_scalar_by_name
107
109 procedure, pass(this) :: entry_exists => registry_entry_exists
111 procedure, pass(this) :: field_exists => registry_field_exists
113 procedure, pass(this) :: vector_exists => registry_vector_exists
115 procedure, pass(this) :: matrix_exists => registry_matrix_exists
117 procedure, pass(this) :: real_scalar_exists => registry_real_scalar_exists
119 procedure, pass(this) :: integer_scalar_exists => &
122 procedure, pass(this) :: scalar_exists => registry_real_scalar_exists
123
125 procedure, pass(this) :: get_size => registry_get_size
127 procedure, pass(this) :: n_entries => registry_n_entries
129 procedure, pass(this) :: n_fields => registry_n_fields
131 procedure, pass(this) :: n_vectors => registry_n_vectors
133 procedure, pass(this) :: n_matrices => registry_n_matrices
135 procedure, pass(this) :: n_real_scalars => registry_n_real_scalars
137 procedure, pass(this) :: n_integer_scalars => registry_n_integer_scalars
139 procedure, pass(this) :: n_scalars => registry_n_real_scalars
141 procedure, pass(this) :: n_aliases => registry_n_aliases
143 procedure, pass(this) :: get_expansion_size => registry_get_expansion_size
145 procedure, pass(this) :: print_contents => registry_print_contents
146 end type registry_t
147
149 type(registry_t), public, target :: neko_registry
150
155 type(registry_t), public, target :: neko_const_registry
156
157
158contains
159 ! ========================================================================== !
160 ! Constructors/Destructors
161
166 subroutine registry_init(this, size, expansion_size)
167 class(registry_t), intent(inout):: this
168 integer, optional, intent(in) :: size
169 integer, optional, intent(in) :: expansion_size
170
171 call this%free()
172
173 if (present(size)) then
174 allocate(this%entries(size))
175 else
176 allocate(this%entries(25))
177 end if
178
179 call this%aliases%initialize()
180
181 if (present(expansion_size)) then
182 this%expansion_size_ = expansion_size
183 end if
184
185 end subroutine registry_init
186
188 subroutine registry_free(this)
189 class(registry_t), intent(inout):: this
190 integer :: i
191
192 if (allocated(this%entries)) then
193 do i = 1, this%n_entries()
194 call this%entries(i)%free()
195 end do
196 deallocate(this%entries)
197 end if
198
199 call this%aliases%destroy()
200
201 this%n_entries_ = 0
202 this%n_aliases_ = 0
203 this%expansion_size_ = 5
204 end subroutine registry_free
205
207 subroutine registry_expand(this)
208 class(registry_t), intent(inout) :: this
209 type(registry_entry_t), allocatable :: temp(:)
210
211 allocate(temp(this%n_entries_ + this%expansion_size_))
212 temp(1:this%n_entries_) = this%entries(1:this%n_entries_)
213 call move_alloc(temp, this%entries)
214 end subroutine registry_expand
215
216 ! ========================================================================== !
217 ! Methods for adding objects to the registry
218
224 subroutine registry_add_field(this, dof, name, ignore_existing)
225 class(registry_t), intent(inout) :: this
226 type(dofmap_t), target, intent(in) :: dof
227 character(len=*), target, intent(in) :: name
228 logical, optional, intent(in) :: ignore_existing
229 logical :: ignore_existing_
230
231 ignore_existing_ = .false.
232 if (present(ignore_existing)) then
233 ignore_existing_ = ignore_existing
234 end if
235
236 if (this%field_exists(name)) then
237 if (ignore_existing_) then
238 return
239 else
240 call neko_error("Field with name " // name // &
241 " is already registered")
242 end if
243 end if
244
245 if (this%n_entries() .eq. this%get_size()) then
246 call this%expand()
247 end if
248
249 this%n_entries_ = this%n_entries_ + 1
250
251 ! initialize the field at the appropriate index
252 call this%entries(this%n_entries_)%init_field(dof, name)
253
254 call neko_log%message("Field " // trim(name) // " added to the registry", &
255 lvl=neko_log_debug)
256
257 end subroutine registry_add_field
258
264 subroutine registry_add_vector(this, n, name, ignore_existing)
265 class(registry_t), intent(inout) :: this
266 integer, intent(in) :: n
267 character(len=*), target, intent(in) :: name
268 logical, optional, intent(in) :: ignore_existing
269 logical :: ignore_existing_
270
271 ignore_existing_ = .false.
272 if (present(ignore_existing)) then
273 ignore_existing_ = ignore_existing
274 end if
275
276 if (this%vector_exists(name)) then
277 if (ignore_existing_) then
278 return
279 else
280 call neko_error("Vector with name " // name // &
281 " is already registered")
282 end if
283 end if
284
285 if (this%n_entries() .eq. this%get_size()) then
286 call this%expand()
287 end if
288
289 this%n_entries_ = this%n_entries_ + 1
290
291 ! Initialize the named vector at the appropriate index
292 call this%entries(this%n_entries_)%init_vector(n, name)
293
294 call neko_log%message("Vector " // trim(name) // " added to the registry", &
295 lvl=neko_log_debug)
296
297 end subroutine registry_add_vector
298
304 subroutine registry_add_matrix(this, nrows, ncols, name, ignore_existing)
305 class(registry_t), intent(inout) :: this
306 integer, intent(in) :: nrows, ncols
307 character(len=*), target, intent(in) :: name
308 logical, optional, intent(in) :: ignore_existing
309 logical :: ignore_existing_
310
311 ignore_existing_ = .false.
312 if (present(ignore_existing)) then
313 ignore_existing_ = ignore_existing
314 end if
315
316 if (this%matrix_exists(name)) then
317 if (ignore_existing_) then
318 return
319 else
320 call neko_error("Vector with name " // name // &
321 " is already registered")
322 end if
323 end if
324
325 if (this%n_entries() .eq. this%get_size()) then
326 call this%expand()
327 end if
328
329 this%n_entries_ = this%n_entries_ + 1
330
331 ! Initialize the named matrix at the appropriate index
332 call this%entries(this%n_entries_)%init_matrix(nrows, ncols, name)
333
334 call neko_log%message("Matrix " // trim(name) // " added to the registry", &
335 lvl=neko_log_debug)
336
337 end subroutine registry_add_matrix
338
343 subroutine registry_add_real_scalar(this, value, name, ignore_existing)
344 class(registry_t), intent(inout) :: this
345 real(kind=rp), intent(in) :: value
346 character(len=*), target, intent(in) :: name
347 logical, optional, intent(in) :: ignore_existing
348 logical :: ignore_existing_
349
350 ignore_existing_ = .false.
351 if (present(ignore_existing)) then
352 ignore_existing_ = ignore_existing
353 end if
354
355 if (this%real_scalar_exists(name)) then
356 if (ignore_existing_) then
357 return
358 else
359 call neko_error("Scalar with name " // name // &
360 " is already registered")
361 end if
362 end if
363
364 if (this%n_entries() .eq. this%get_size()) then
365 call this%expand()
366 end if
367
368 this%n_entries_ = this%n_entries_ + 1
369
370 ! Initialize the named scalar at the appropriate index
371 call this%entries(this%n_entries_)%init_real_scalar(value, name)
372
373 end subroutine registry_add_real_scalar
374
379 subroutine registry_add_integer_scalar(this, value, name, ignore_existing)
380 class(registry_t), intent(inout) :: this
381 integer, intent(in) :: value
382 character(len=*), target, intent(in) :: name
383 logical, optional, intent(in) :: ignore_existing
384 logical :: ignore_existing_
385
386 ignore_existing_ = .false.
387 if (present(ignore_existing)) then
388 ignore_existing_ = ignore_existing
389 end if
390
391 if (this%integer_scalar_exists(name)) then
392 if (ignore_existing_) then
393 return
394 else
395 call neko_error("Scalar with name " // name // &
396 " is already registered")
397 end if
398 end if
399
400 if (this%n_entries() .eq. this%get_size()) then
401 call this%expand()
402 end if
403
404 this%n_entries_ = this%n_entries_ + 1
405
406 ! Initialize the named scalar at the appropriate index
407 call this%entries(this%n_entries_)%init_integer_scalar(value, name)
408
409 end subroutine registry_add_integer_scalar
410
414 subroutine registry_add_alias(this, alias, name)
415 class(registry_t), intent(inout) :: this
416 character(len=*), intent(in) :: alias
417 character(len=*), intent(in) :: name
418
419 if (this%entry_exists(alias)) then
420 call neko_error("Cannot create alias. Entry " // alias // &
421 " already exists in the registry")
422 end if
423
424 if (this%entry_exists(name)) then
425 this%n_aliases_ = this%n_aliases_ + 1
426 call this%aliases%add(trim(alias), trim(name))
427 else
428 call neko_error("Cannot create alias. Entry " // name // &
429 " could not be found in the registry")
430 end if
431 end subroutine registry_add_alias
432
433 ! ========================================================================== !
434 ! Methods for retrieving objects from the registry by name
435
437 recursive function registry_get_field_by_name(this, name) result(f)
438 class(registry_t), target, intent(inout) :: this
439 character(len=*), intent(in) :: name
440 character(len=:), allocatable :: alias_target
441 type(field_t), pointer :: f
442 logical :: found
443 integer :: i
444
445 do i = 1, this%n_entries()
446 if (this%entries(i)%get_type() .eq. 'field' .and. &
447 this%entries(i)%get_name() .eq. trim(name)) then
448 f => this%entries(i)%get_field()
449 return
450 end if
451 end do
452
453 call this%aliases%get(name, alias_target, found)
454 if (found) then
455 f => this%get_field_by_name(alias_target)
456 return
457 end if
458
459 call this%print_contents()
460 call neko_error("Field " // name // " could not be found in the registry")
461
462 end function registry_get_field_by_name
463
464
466 recursive function registry_get_vector_by_name(this, name) result(f)
467 class(registry_t), target, intent(inout) :: this
468 character(len=*), intent(in) :: name
469 character(len=:), allocatable :: alias_target
470 type(vector_t), pointer :: f
471 logical :: found
472 integer :: i
473
474 found = .false.
475
476 do i = 1, this%n_entries()
477 if (this%entries(i)%get_type() .eq. 'vector' .and. &
478 this%entries(i)%get_name() .eq. trim(name)) then
479 f => this%entries(i)%get_vector()
480 return
481 end if
482 end do
483
484 call this%aliases%get(name, alias_target, found)
485 if (found) then
486 f => this%get_vector_by_name(alias_target)
487 return
488 end if
489
490 call this%print_contents()
491 call neko_error("Vector " // name // " could not be found in the registry")
492
493 end function registry_get_vector_by_name
494
496 recursive function registry_get_matrix_by_name(this, name) result(f)
497 class(registry_t), target, intent(inout) :: this
498 character(len=*), intent(in) :: name
499 character(len=:), allocatable :: alias_target
500 type(matrix_t), pointer :: f
501 logical :: found
502 integer :: i
503
504 found = .false.
505
506 do i = 1, this%n_entries()
507 if (this%entries(i)%get_type() .eq. 'matrix' .and. &
508 this%entries(i)%get_name() .eq. trim(name)) then
509 f => this%entries(i)%get_matrix()
510 return
511 end if
512 end do
513
514 call this%aliases%get(name, alias_target, found)
515 if (found) then
516 f => this%get_matrix_by_name(alias_target)
517 return
518 end if
519
520 call this%print_contents()
521 call neko_error("Matrix " // name // " could not be found in the registry")
522
523 end function registry_get_matrix_by_name
524
526 recursive function registry_get_real_scalar_by_name(this, name) result(s)
527 class(registry_t), target, intent(inout) :: this
528 character(len=*), intent(in) :: name
529 character(len=:), allocatable :: alias_target
530 real(kind=rp), pointer :: s
531 logical :: found
532 integer :: i
533
534 found = .false.
535
536 do i = 1, this%n_entries()
537 if (this%entries(i)%get_type() .eq. 'real_scalar' .and. &
538 this%entries(i)%get_name() .eq. trim(name)) then
539 s => this%entries(i)%get_real_scalar()
540 return
541 end if
542 end do
543
544 call this%aliases%get(name, alias_target, found)
545 if (found) then
546 s => this%get_real_scalar_by_name(alias_target)
547 return
548 end if
549
550 call this%print_contents()
551 call neko_error("Scalar " // name // " could not be found in the registry")
552
554
556 recursive function registry_get_integer_scalar_by_name(this, name) result(s)
557 class(registry_t), target, intent(inout) :: this
558 character(len=*), intent(in) :: name
559 character(len=:), allocatable :: alias_target
560 integer, pointer :: s
561 logical :: found
562 integer :: i
563
564 found = .false.
565
566 do i = 1, this%n_entries()
567 if (this%entries(i)%get_type() .eq. 'integer_scalar' .and. &
568 this%entries(i)%get_name() .eq. trim(name)) then
569 s => this%entries(i)%get_integer_scalar()
570 return
571 end if
572 end do
573
574 call this%aliases%get(name, alias_target, found)
575 if (found) then
576 s => this%get_integer_scalar_by_name(alias_target)
577 return
578 end if
579
580 call this%print_contents()
581 call neko_error("Integer scalar " // name // &
582 " could not be found in the registry")
583
585
586 ! ========================================================================== !
587 ! Methods for checking existence of objects in the registry
588
590 function registry_entry_exists(this, name) result(found)
591 class(registry_t), target, intent(inout) :: this
592 character(len=*), intent(in) :: name
593 logical :: found
594 integer :: i
595
596 found = .false.
597 do i = 1, this%n_entries()
598 if (trim(this%entries(i)%get_name()) .eq. trim(name)) then
599 found = .true.
600 return
601 end if
602 end do
603
604 found = this%aliases%valid_path(name)
605 end function registry_entry_exists
606
608 function registry_field_exists(this, name) result(found)
609 class(registry_t), target, intent(inout) :: this
610 character(len=*), intent(in) :: name
611 logical :: found
612 integer :: i
613
614 found = .false.
615 do i = 1, this%n_entries()
616 if (this%entries(i)%get_type() .eq. 'field' .and. &
617 this%entries(i)%get_name() .eq. trim(name)) then
618 found = .true.
619 return
620 end if
621 end do
622
623 found = this%aliases%valid_path(name)
624 end function registry_field_exists
625
627 function registry_vector_exists(this, name) result(found)
628 class(registry_t), target, intent(inout) :: this
629 character(len=*), intent(in) :: name
630 logical :: found
631 integer :: i
632
633 found = .false.
634 do i = 1, this%n_entries()
635 if (this%entries(i)%get_type() .eq. 'vector' .and. &
636 this%entries(i)%get_name() .eq. trim(name)) then
637 found = .true.
638 return
639 end if
640 end do
641
642 found = this%aliases%valid_path(name)
643 end function registry_vector_exists
644
646 function registry_matrix_exists(this, name) result(found)
647 class(registry_t), target, intent(inout) :: this
648 character(len=*), intent(in) :: name
649 logical :: found
650 integer :: i
651
652 found = .false.
653 do i = 1, this%n_entries()
654 if (this%entries(i)%get_type() .eq. 'matrix' .and. &
655 this%entries(i)%get_name() .eq. trim(name)) then
656 found = .true.
657 return
658 end if
659 end do
660
661 found = this%aliases%valid_path(name)
662 end function registry_matrix_exists
663
665 function registry_real_scalar_exists(this, name) result(found)
666 class(registry_t), target, intent(inout) :: this
667 character(len=*), intent(in) :: name
668 logical :: found
669 integer :: i
670
671 found = .false.
672 do i = 1, this%n_entries()
673 if (this%entries(i)%get_type() .eq. 'real_scalar' .and. &
674 this%entries(i)%get_name() .eq. trim(name)) then
675 found = .true.
676 return
677 end if
678 end do
679
680 found = this%aliases%valid_path(name)
681 end function registry_real_scalar_exists
682
684 function registry_integer_scalar_exists(this, name) result(found)
685 class(registry_t), target, intent(inout) :: this
686 character(len=*), intent(in) :: name
687 logical :: found
688 integer :: i
689
690 found = .false.
691 do i = 1, this%n_entries()
692 if (this%entries(i)%get_type() .eq. 'integer_scalar' .and. &
693 this%entries(i)%get_name() .eq. trim(name)) then
694 found = .true.
695 return
696 end if
697 end do
698
699 found = this%aliases%valid_path(name)
701
702 ! ========================================================================== !
703 ! Generic component accessor methods
704
706 pure function registry_n_entries(this) result(n)
707 class(registry_t), intent(in) :: this
708 integer :: n
709
710 n = this%n_entries_
711 end function registry_n_entries
712
714 pure function registry_n_fields(this) result(n)
715 class(registry_t), intent(in) :: this
716 integer :: n, i
717
718 n = 0
719 do i = 1, this%n_entries()
720 if (this%entries(i)%get_type() .eq. 'field') then
721 n = n + 1
722 end if
723 end do
724 end function registry_n_fields
725
727 pure function registry_n_vectors(this) result(n)
728 class(registry_t), intent(in) :: this
729 integer :: n, i
730
731 n = 0
732 do i = 1, this%n_entries()
733 if (this%entries(i)%get_type() .eq. 'vector') then
734 n = n + 1
735 end if
736 end do
737 end function registry_n_vectors
738
740 pure function registry_n_matrices(this) result(n)
741 class(registry_t), intent(in) :: this
742 integer :: n, i
743
744 n = 0
745 do i = 1, this%n_entries()
746 if (this%entries(i)%get_type() .eq. 'matrix') then
747 n = n + 1
748 end if
749 end do
750 end function registry_n_matrices
751
753 pure function registry_n_real_scalars(this) result(n)
754 class(registry_t), intent(in) :: this
755 integer :: n, i
756
757 n = 0
758 do i = 1, this%n_entries()
759 if (this%entries(i)%get_type() .eq. 'real_scalar') then
760 n = n + 1
761 end if
762 end do
763 end function registry_n_real_scalars
764
766 pure function registry_n_integer_scalars(this) result(n)
767 class(registry_t), intent(in) :: this
768 integer :: n, i
769
770 n = 0
771 do i = 1, this%n_entries()
772 if (this%entries(i)%get_type() .eq. 'integer_scalar') then
773 n = n + 1
774 end if
775 end do
776 end function registry_n_integer_scalars
777
779 pure function registry_n_aliases(this) result(n)
780 class(registry_t), intent(in) :: this
781 integer :: n
782
783 n = this%n_aliases_
784 end function registry_n_aliases
785
787 pure function registry_get_size(this) result(n)
788 class(registry_t), intent(in) :: this
789 integer :: n
790
791 if (allocated(this%entries)) then
792 n = size(this%entries)
793 else
794 n = 0
795 end if
796 end function registry_get_size
797
799 pure function registry_get_expansion_size(this) result(n)
800 class(registry_t), intent(in) :: this
801 integer :: n
802
803 n = this%expansion_size_
804 end function registry_get_expansion_size
805
807 subroutine registry_print(this)
808 class(registry_t), intent(in) :: this
809 character(len=LOG_SIZE), allocatable :: buffer
810 integer :: i
811
812 call neko_log%section("Field Registry Contents")
813 do i = 1, this%n_entries()
814 write(buffer, '(A,I4,A,A)') "- [", i, "] ", &
815 this%entries(i)%get_type(), ": ", this%entries(i)%get_name()
816 call neko_log%message(trim(buffer))
817 end do
818
819 call neko_log%end_section()
820 end subroutine registry_print
821
823 subroutine registry_print_contents(this, type)
824 class(registry_t), intent(in) :: this
825 character(len=*), optional, intent(in) :: type
826 character(len=:), allocatable :: filter_type
827 character(len=14), parameter :: types(5) = (/ &
828 'field ', &
829 'vector ', &
830 'matrix ', &
831 'real_scalar ', &
832 'integer_scalar' /)
833 logical :: filter_active
834 integer :: i
835 logical :: known_type
836
837 filter_active = .false.
838 if (present(type)) then
839 filter_type = trim(type)
840 filter_active = .true.
841 known_type = .false.
842 do i = 1, size(types)
843 if (filter_type == types(i)) then
844 known_type = .true.
845 exit
846 end if
847 end do
848 if (.not. known_type) then
849 call neko_error("registry::print_contents: Unsupported type " &
850 // trim(filter_type))
851 end if
852 end if
853
854 call neko_log%section("Registry Contents")
855 do i = 1, size(types)
856 if (filter_active .and. (filter_type .ne. types(i))) cycle
857 call registry_print_section(this, types(i))
858 end do
859 call neko_log%end_section()
860 end subroutine registry_print_contents
861
863 subroutine registry_print_section(this, entity_type)
864 class(registry_t), intent(in) :: this
865 character(len=*), intent(in) :: entity_type
866 integer :: i
867 logical :: found
868 character(len=LOG_SIZE) :: buffer
869
870 call neko_log%message(" "//trim(entity_type)//" entries:")
871 found = .false.
872 do i = 1, this%n_entries()
873 if (this%entries(i)%get_type() .eq. entity_type) then
874 found = .true.
875 write(buffer, '(A,I4,A,A)') " [", i, "] ", &
876 trim(this%entries(i)%get_name())
877 call neko_log%message(trim(buffer))
878 end if
879 end do
880 if (.not. found) then
881 call neko_log%message(" <none>")
882 end if
883 end subroutine registry_print_section
884
885end module registry
Retrieves a parameter by name or throws an error.
Generic buffer that is extended with buffers of varying rank.
Definition buffer.F90:34
Definition comm.F90:1
integer, public pe_rank
MPI rank.
Definition comm.F90:56
Defines a mapping of the degrees of freedom.
Definition dofmap.f90:35
Defines a field.
Definition field.f90:34
Implements a hash table ADT.
Definition htable.f90:36
Utilities for retrieving parameters from the case files.
Logging routines.
Definition log.f90:34
integer, parameter, public neko_log_debug
Debug log level.
Definition log.f90:87
type(log_t), public neko_log
Global log stream.
Definition log.f90:77
integer, parameter, public log_size
Definition log.f90:46
Defines a matrix.
Definition matrix.f90:34
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Defines a registry entry for storing and requesting temporary objects This is used in the registries ...
real(kind=rp) function, pointer get_real_scalar(this)
Get the real scalar pointer of the registry entry.
type(field_t) function, pointer get_field(this)
Get the field pointer of the registry entry.
type(vector_t) function, pointer get_vector(this)
Get the vector pointer of the registry entry.
type(matrix_t) function, pointer get_matrix(this)
Get the matrix pointer of the registry entry.
integer function, pointer get_integer_scalar(this)
Get the integer scalar pointer of the registry entry.
Defines a registry for storing solution fields.
Definition registry.f90:34
type(registry_t), target, public neko_registry
Global field registry.
Definition registry.f90:149
subroutine registry_free(this)
Destructor.
Definition registry.f90:189
recursive type(vector_t) function, pointer registry_get_vector_by_name(this, name)
Get pointer to a stored vector by name.
Definition registry.f90:467
subroutine registry_add_integer_scalar(this, value, name, ignore_existing)
Add an integer scalar to the registry.
Definition registry.f90:380
pure integer function registry_get_size(this)
Get the size of the fields array.
Definition registry.f90:788
subroutine registry_print(this)
Print the contents of the registry to standard output.
Definition registry.f90:808
subroutine registry_add_matrix(this, nrows, ncols, name, ignore_existing)
Add a matrix to the registry.
Definition registry.f90:305
subroutine registry_print_contents(this, type)
Print the registry contents grouped by entity type.
Definition registry.f90:824
subroutine registry_init(this, size, expansion_size)
Constructor.
Definition registry.f90:167
subroutine registry_add_real_scalar(this, value, name, ignore_existing)
Add a real scalar to the registry.
Definition registry.f90:344
pure integer function registry_get_expansion_size(this)
Get the expansion size.
Definition registry.f90:800
type(registry_t), target, public neko_const_registry
This registry is used to store user-defined scalars and vectors, provided under the constants section...
Definition registry.f90:155
pure integer function registry_n_real_scalars(this)
Get the number of real scalars stored in the registry.
Definition registry.f90:754
pure integer function registry_n_vectors(this)
Get the number of vector stored in the registry.
Definition registry.f90:728
pure integer function registry_n_aliases(this)
Get the number of aliases stored in the registry.
Definition registry.f90:780
logical function registry_matrix_exists(this, name)
Check if a matrix with a given name is already in the registry.
Definition registry.f90:647
pure integer function registry_n_fields(this)
Get the number of fields stored in the registry.
Definition registry.f90:715
subroutine registry_add_alias(this, alias, name)
Add an alias for an existing entry in the registry.
Definition registry.f90:415
subroutine registry_add_field(this, dof, name, ignore_existing)
Add a field to the registry.
Definition registry.f90:225
recursive type(matrix_t) function, pointer registry_get_matrix_by_name(this, name)
Get pointer to a stored matrix by name.
Definition registry.f90:497
subroutine registry_print_section(this, entity_type)
Print a single section of the registry for the given type.
Definition registry.f90:864
pure integer function registry_n_integer_scalars(this)
Get the number of integer scalars stored in the registry.
Definition registry.f90:767
logical function registry_entry_exists(this, name)
Check if a field with a given name is already in the registry.
Definition registry.f90:591
logical function registry_integer_scalar_exists(this, name)
Check if an integer scalar with a given name is already in the registry.
Definition registry.f90:685
pure integer function registry_n_entries(this)
Get number of registered entries.
Definition registry.f90:707
subroutine registry_expand(this)
Expand the fields array so as to accommodate more fields.
Definition registry.f90:208
pure integer function registry_n_matrices(this)
Get the number of matrix stored in the registry.
Definition registry.f90:741
logical function registry_vector_exists(this, name)
Check if a vector with a given name is already in the registry.
Definition registry.f90:628
recursive integer function, pointer registry_get_integer_scalar_by_name(this, name)
Get pointer to a stored integer scalar by name.
Definition registry.f90:557
recursive type(field_t) function, pointer registry_get_field_by_name(this, name)
Get pointer to a stored field by field name.
Definition registry.f90:438
subroutine registry_add_vector(this, n, name, ignore_existing)
Add a vector to the registry.
Definition registry.f90:265
logical function registry_real_scalar_exists(this, name)
Check if a real scalar with a given name is already in the registry.
Definition registry.f90:666
recursive real(kind=rp) function, pointer registry_get_real_scalar_by_name(this, name)
Get pointer to a stored real scalar by name.
Definition registry.f90:527
logical function registry_field_exists(this, name)
Check if a field with a given name is already in the registry.
Definition registry.f90:609
Utilities.
Definition utils.f90:35
Defines a vector.
Definition vector.f90:34