Neko 1.99.3
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-2026, 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 num_types, only : rp
36 use field, only : field_t
37 use vector, only : vector_t
38 use matrix, only : matrix_t
40 use dofmap, only : dofmap_t
41 use utils, only : neko_error
42 use json_module, only : json_file
44 implicit none
45 private
46
47 type, public :: registry_t
49 type(registry_entry_t), private, allocatable :: entries(:)
51 type(json_file), private :: aliases
53 integer, private :: n_entries_ = 0
55 integer, private :: n_aliases_ = 0
57 integer, private :: expansion_size_ = 5
58 contains
60 procedure, pass(this) :: init => registry_init
62 procedure, pass(this) :: free => registry_free
64 procedure, private, pass(this) :: expand => registry_expand
65
67 procedure, pass(this) :: add_field => registry_add_field
69 procedure, pass(this) :: add_vector => registry_add_vector
71 procedure, pass(this) :: add_matrix => registry_add_matrix
73 procedure, pass(this) :: add_real_scalar => registry_add_real_scalar
75 procedure, pass(this) :: add_integer_scalar => registry_add_integer_scalar
77 procedure, pass(this) :: add_alias => registry_add_alias
78
80 procedure, pass(this) :: get_field_by_name => registry_get_field_by_name
82 procedure, pass(this) :: get_vector_by_name => registry_get_vector_by_name
84 procedure, pass(this) :: get_matrix_by_name => registry_get_matrix_by_name
86 procedure, pass(this) :: get_real_scalar_by_name => &
89 procedure, pass(this) :: get_integer_scalar_by_name => &
91
93 generic :: get_field => get_field_by_name
95 generic :: get_vector => get_vector_by_name
97 generic :: get_matrix => get_matrix_by_name
99 generic :: get_real_scalar => get_real_scalar_by_name
101 generic :: get_integer_scalar => get_integer_scalar_by_name
102
104 procedure, pass(this) :: entry_exists => registry_entry_exists
106 procedure, pass(this) :: field_exists => registry_field_exists
108 procedure, pass(this) :: vector_exists => registry_vector_exists
110 procedure, pass(this) :: matrix_exists => registry_matrix_exists
112 procedure, pass(this) :: real_scalar_exists => registry_real_scalar_exists
114 procedure, pass(this) :: integer_scalar_exists => &
117 procedure, pass(this) :: scalar_exists => registry_real_scalar_exists
118
120 procedure, pass(this) :: get_size => registry_get_size
122 procedure, pass(this) :: n_entries => registry_n_entries
124 procedure, pass(this) :: n_fields => registry_n_fields
126 procedure, pass(this) :: n_vectors => registry_n_vectors
128 procedure, pass(this) :: n_matrices => registry_n_matrices
130 procedure, pass(this) :: n_real_scalars => registry_n_real_scalars
132 procedure, pass(this) :: n_integer_scalars => registry_n_integer_scalars
134 procedure, pass(this) :: n_scalars => registry_n_real_scalars
136 procedure, pass(this) :: n_aliases => registry_n_aliases
138 procedure, pass(this) :: get_expansion_size => registry_get_expansion_size
140 procedure, pass(this) :: print_contents => registry_print_contents
141 end type registry_t
142
144 type(registry_t), public, target :: neko_registry
145
150 type(registry_t), public, target :: neko_const_registry
151
152
153contains
154 ! ========================================================================== !
155 ! Constructors/Destructors
156
161 subroutine registry_init(this, size, expansion_size)
162 class(registry_t), intent(inout):: this
163 integer, optional, intent(in) :: size
164 integer, optional, intent(in) :: expansion_size
165
166 call this%free()
167
168 if (present(size)) then
169 allocate(this%entries(size))
170 else
171 allocate(this%entries(25))
172 end if
173
174 call this%aliases%initialize()
175
176 if (present(expansion_size)) then
177 this%expansion_size_ = expansion_size
178 end if
179
180 end subroutine registry_init
181
183 subroutine registry_free(this)
184 class(registry_t), intent(inout):: this
185 integer :: i
186
187 if (allocated(this%entries)) then
188 do i = 1, this%n_entries()
189 call this%entries(i)%free()
190 end do
191 deallocate(this%entries)
192 end if
193
194 call this%aliases%destroy()
195
196 this%n_entries_ = 0
197 this%n_aliases_ = 0
198 this%expansion_size_ = 5
199 end subroutine registry_free
200
202 subroutine registry_expand(this)
203 class(registry_t), intent(inout) :: this
204 type(registry_entry_t), allocatable :: temp(:)
205 integer :: n, i
206
207 n = this%get_size()
208
209 if (n .gt. 0) then
210 call move_alloc(this%entries, temp)
211 end if
212
213 allocate(this%entries(n + this%expansion_size_))
214
215 if (n .gt. 0) then
216 do i = 1, n
217 call this%entries(i)%move_from(temp(i))
218 call temp(i)%free()
219 end do
220 end if
221
222 if (allocated(temp)) deallocate(temp)
223 end subroutine registry_expand
224
225 ! ========================================================================== !
226 ! Methods for adding objects to the registry
227
233 subroutine registry_add_field(this, dof, name, ignore_existing)
234 class(registry_t), intent(inout) :: this
235 type(dofmap_t), target, intent(in) :: dof
236 character(len=*), target, intent(in) :: name
237 logical, optional, intent(in) :: ignore_existing
238 logical :: ignore_existing_
239
240 ignore_existing_ = .false.
241 if (present(ignore_existing)) then
242 ignore_existing_ = ignore_existing
243 end if
244
245 if (this%field_exists(name)) then
246 if (ignore_existing_) then
247 return
248 else
249 call neko_error("Field with name " // name // &
250 " is already registered")
251 end if
252 end if
253
254 if (this%n_entries() .eq. this%get_size()) then
255 call this%expand()
256 end if
257
258 this%n_entries_ = this%n_entries_ + 1
259
260 ! initialize the field at the appropriate index
261 call this%entries(this%n_entries_)%init_field(dof, name)
262
263 call neko_log%message("Field " // trim(name) // " added to the registry", &
264 lvl=neko_log_debug)
265
266 end subroutine registry_add_field
267
273 subroutine registry_add_vector(this, n, name, ignore_existing)
274 class(registry_t), intent(inout) :: this
275 integer, intent(in) :: n
276 character(len=*), target, intent(in) :: name
277 logical, optional, intent(in) :: ignore_existing
278 logical :: ignore_existing_
279
280 ignore_existing_ = .false.
281 if (present(ignore_existing)) then
282 ignore_existing_ = ignore_existing
283 end if
284
285 if (this%vector_exists(name)) then
286 if (ignore_existing_) then
287 return
288 else
289 call neko_error("Vector with name " // name // &
290 " is already registered")
291 end if
292 end if
293
294 if (this%n_entries() .eq. this%get_size()) then
295 call this%expand()
296 end if
297
298 this%n_entries_ = this%n_entries_ + 1
299
300 ! Initialize the named vector at the appropriate index
301 call this%entries(this%n_entries_)%init_vector(n, name)
302
303 call neko_log%message("Vector " // trim(name) // " added to the registry", &
304 lvl=neko_log_debug)
305
306 end subroutine registry_add_vector
307
313 subroutine registry_add_matrix(this, nrows, ncols, name, ignore_existing)
314 class(registry_t), intent(inout) :: this
315 integer, intent(in) :: nrows, ncols
316 character(len=*), target, intent(in) :: name
317 logical, optional, intent(in) :: ignore_existing
318 logical :: ignore_existing_
319
320 ignore_existing_ = .false.
321 if (present(ignore_existing)) then
322 ignore_existing_ = ignore_existing
323 end if
324
325 if (this%matrix_exists(name)) then
326 if (ignore_existing_) then
327 return
328 else
329 call neko_error("Vector with name " // name // &
330 " is already registered")
331 end if
332 end if
333
334 if (this%n_entries() .eq. this%get_size()) then
335 call this%expand()
336 end if
337
338 this%n_entries_ = this%n_entries_ + 1
339
340 ! Initialize the named matrix at the appropriate index
341 call this%entries(this%n_entries_)%init_matrix(nrows, ncols, name)
342
343 call neko_log%message("Matrix " // trim(name) // " added to the registry", &
344 lvl=neko_log_debug)
345
346 end subroutine registry_add_matrix
347
352 subroutine registry_add_real_scalar(this, value, name, ignore_existing)
353 class(registry_t), intent(inout) :: this
354 real(kind=rp), intent(in) :: value
355 character(len=*), target, intent(in) :: name
356 logical, optional, intent(in) :: ignore_existing
357 logical :: ignore_existing_
358
359 ignore_existing_ = .false.
360 if (present(ignore_existing)) then
361 ignore_existing_ = ignore_existing
362 end if
363
364 if (this%real_scalar_exists(name)) then
365 if (ignore_existing_) then
366 return
367 else
368 call neko_error("Scalar with name " // name // &
369 " is already registered")
370 end if
371 end if
372
373 if (this%n_entries() .eq. this%get_size()) then
374 call this%expand()
375 end if
376
377 this%n_entries_ = this%n_entries_ + 1
378
379 ! Initialize the named scalar at the appropriate index
380 call this%entries(this%n_entries_)%init_real_scalar(value, name)
381
382 end subroutine registry_add_real_scalar
383
388 subroutine registry_add_integer_scalar(this, value, name, ignore_existing)
389 class(registry_t), intent(inout) :: this
390 integer, intent(in) :: value
391 character(len=*), target, intent(in) :: name
392 logical, optional, intent(in) :: ignore_existing
393 logical :: ignore_existing_
394
395 ignore_existing_ = .false.
396 if (present(ignore_existing)) then
397 ignore_existing_ = ignore_existing
398 end if
399
400 if (this%integer_scalar_exists(name)) then
401 if (ignore_existing_) then
402 return
403 else
404 call neko_error("Scalar with name " // name // &
405 " is already registered")
406 end if
407 end if
408
409 if (this%n_entries() .eq. this%get_size()) then
410 call this%expand()
411 end if
412
413 this%n_entries_ = this%n_entries_ + 1
414
415 ! Initialize the named scalar at the appropriate index
416 call this%entries(this%n_entries_)%init_integer_scalar(value, name)
417
418 end subroutine registry_add_integer_scalar
419
423 subroutine registry_add_alias(this, alias, name)
424 class(registry_t), intent(inout) :: this
425 character(len=*), intent(in) :: alias
426 character(len=*), intent(in) :: name
427
428 if (this%entry_exists(alias)) then
429 call neko_error("Cannot create alias. Entry " // alias // &
430 " already exists in the registry")
431 end if
432
433 if (this%entry_exists(name)) then
434 this%n_aliases_ = this%n_aliases_ + 1
435 call this%aliases%add(trim(alias), trim(name))
436 else
437 call neko_error("Cannot create alias. Entry " // name // &
438 " could not be found in the registry")
439 end if
440 end subroutine registry_add_alias
441
442 ! ========================================================================== !
443 ! Methods for retrieving objects from the registry by name
444
446 recursive function registry_get_field_by_name(this, name) result(f)
447 class(registry_t), target, intent(inout) :: this
448 character(len=*), intent(in) :: name
449 character(len=:), allocatable :: alias_target
450 type(field_t), pointer :: f
451 logical :: found
452 integer :: i
453
454 do i = 1, this%n_entries()
455 if (this%entries(i)%get_type() .eq. 'field' .and. &
456 this%entries(i)%get_name() .eq. trim(name)) then
457 f => this%entries(i)%get_field()
458 return
459 end if
460 end do
461
462 call this%aliases%get(name, alias_target, found)
463 if (found) then
464 f => this%get_field_by_name(alias_target)
465 return
466 end if
467
468 call this%print_contents()
469 call neko_error("Field " // name // " could not be found in the registry")
470
471 end function registry_get_field_by_name
472
473
475 recursive function registry_get_vector_by_name(this, name) result(f)
476 class(registry_t), target, intent(inout) :: this
477 character(len=*), intent(in) :: name
478 character(len=:), allocatable :: alias_target
479 type(vector_t), pointer :: f
480 logical :: found
481 integer :: i
482
483 found = .false.
484
485 do i = 1, this%n_entries()
486 if (this%entries(i)%get_type() .eq. 'vector' .and. &
487 this%entries(i)%get_name() .eq. trim(name)) then
488 f => this%entries(i)%get_vector()
489 return
490 end if
491 end do
492
493 call this%aliases%get(name, alias_target, found)
494 if (found) then
495 f => this%get_vector_by_name(alias_target)
496 return
497 end if
498
499 call this%print_contents()
500 call neko_error("Vector " // name // " could not be found in the registry")
501
502 end function registry_get_vector_by_name
503
505 recursive function registry_get_matrix_by_name(this, name) result(f)
506 class(registry_t), target, intent(inout) :: this
507 character(len=*), intent(in) :: name
508 character(len=:), allocatable :: alias_target
509 type(matrix_t), pointer :: f
510 logical :: found
511 integer :: i
512
513 found = .false.
514
515 do i = 1, this%n_entries()
516 if (this%entries(i)%get_type() .eq. 'matrix' .and. &
517 this%entries(i)%get_name() .eq. trim(name)) then
518 f => this%entries(i)%get_matrix()
519 return
520 end if
521 end do
522
523 call this%aliases%get(name, alias_target, found)
524 if (found) then
525 f => this%get_matrix_by_name(alias_target)
526 return
527 end if
528
529 call this%print_contents()
530 call neko_error("Matrix " // name // " could not be found in the registry")
531
532 end function registry_get_matrix_by_name
533
535 recursive function registry_get_real_scalar_by_name(this, name) result(s)
536 class(registry_t), target, intent(inout) :: this
537 character(len=*), intent(in) :: name
538 character(len=:), allocatable :: alias_target
539 real(kind=rp), pointer :: s
540 logical :: found
541 integer :: i
542
543 found = .false.
544
545 do i = 1, this%n_entries()
546 if (this%entries(i)%get_type() .eq. 'real_scalar' .and. &
547 this%entries(i)%get_name() .eq. trim(name)) then
548 s => this%entries(i)%get_real_scalar()
549 return
550 end if
551 end do
552
553 call this%aliases%get(name, alias_target, found)
554 if (found) then
555 s => this%get_real_scalar_by_name(alias_target)
556 return
557 end if
558
559 call this%print_contents()
560 call neko_error("Scalar " // name // " could not be found in the registry")
561
563
565 recursive function registry_get_integer_scalar_by_name(this, name) result(s)
566 class(registry_t), target, intent(inout) :: this
567 character(len=*), intent(in) :: name
568 character(len=:), allocatable :: alias_target
569 integer, pointer :: s
570 logical :: found
571 integer :: i
572
573 found = .false.
574
575 do i = 1, this%n_entries()
576 if (this%entries(i)%get_type() .eq. 'integer_scalar' .and. &
577 this%entries(i)%get_name() .eq. trim(name)) then
578 s => this%entries(i)%get_integer_scalar()
579 return
580 end if
581 end do
582
583 call this%aliases%get(name, alias_target, found)
584 if (found) then
585 s => this%get_integer_scalar_by_name(alias_target)
586 return
587 end if
588
589 call this%print_contents()
590 call neko_error("Integer scalar " // name // &
591 " could not be found in the registry")
592
594
595 ! ========================================================================== !
596 ! Methods for checking existence of objects in the registry
597
599 function registry_entry_exists(this, name) result(found)
600 class(registry_t), target, intent(inout) :: this
601 character(len=*), intent(in) :: name
602 logical :: found
603 integer :: i
604
605 found = .false.
606 do i = 1, this%n_entries()
607 if (trim(this%entries(i)%get_name()) .eq. trim(name)) then
608 found = .true.
609 return
610 end if
611 end do
612
613 found = this%aliases%valid_path(name)
614 end function registry_entry_exists
615
617 function registry_field_exists(this, name) result(found)
618 class(registry_t), target, intent(inout) :: this
619 character(len=*), intent(in) :: name
620 logical :: found
621 integer :: i
622
623 found = .false.
624 do i = 1, this%n_entries()
625 if (this%entries(i)%get_type() .eq. 'field' .and. &
626 this%entries(i)%get_name() .eq. trim(name)) then
627 found = .true.
628 return
629 end if
630 end do
631
632 found = this%aliases%valid_path(name)
633 end function registry_field_exists
634
636 function registry_vector_exists(this, name) result(found)
637 class(registry_t), target, intent(inout) :: this
638 character(len=*), intent(in) :: name
639 logical :: found
640 integer :: i
641
642 found = .false.
643 do i = 1, this%n_entries()
644 if (this%entries(i)%get_type() .eq. 'vector' .and. &
645 this%entries(i)%get_name() .eq. trim(name)) then
646 found = .true.
647 return
648 end if
649 end do
650
651 found = this%aliases%valid_path(name)
652 end function registry_vector_exists
653
655 function registry_matrix_exists(this, name) result(found)
656 class(registry_t), target, intent(inout) :: this
657 character(len=*), intent(in) :: name
658 logical :: found
659 integer :: i
660
661 found = .false.
662 do i = 1, this%n_entries()
663 if (this%entries(i)%get_type() .eq. 'matrix' .and. &
664 this%entries(i)%get_name() .eq. trim(name)) then
665 found = .true.
666 return
667 end if
668 end do
669
670 found = this%aliases%valid_path(name)
671 end function registry_matrix_exists
672
674 function registry_real_scalar_exists(this, name) result(found)
675 class(registry_t), target, intent(inout) :: this
676 character(len=*), intent(in) :: name
677 logical :: found
678 integer :: i
679
680 found = .false.
681 do i = 1, this%n_entries()
682 if (this%entries(i)%get_type() .eq. 'real_scalar' .and. &
683 this%entries(i)%get_name() .eq. trim(name)) then
684 found = .true.
685 return
686 end if
687 end do
688
689 found = this%aliases%valid_path(name)
690 end function registry_real_scalar_exists
691
693 function registry_integer_scalar_exists(this, name) result(found)
694 class(registry_t), target, intent(inout) :: this
695 character(len=*), intent(in) :: name
696 logical :: found
697 integer :: i
698
699 found = .false.
700 do i = 1, this%n_entries()
701 if (this%entries(i)%get_type() .eq. 'integer_scalar' .and. &
702 this%entries(i)%get_name() .eq. trim(name)) then
703 found = .true.
704 return
705 end if
706 end do
707
708 found = this%aliases%valid_path(name)
710
711 ! ========================================================================== !
712 ! Generic component accessor methods
713
715 pure function registry_n_entries(this) result(n)
716 class(registry_t), intent(in) :: this
717 integer :: n
718
719 n = this%n_entries_
720 end function registry_n_entries
721
723 pure function registry_n_fields(this) result(n)
724 class(registry_t), intent(in) :: this
725 integer :: n, i
726
727 n = 0
728 do i = 1, this%n_entries()
729 if (this%entries(i)%get_type() .eq. 'field') then
730 n = n + 1
731 end if
732 end do
733 end function registry_n_fields
734
736 pure function registry_n_vectors(this) result(n)
737 class(registry_t), intent(in) :: this
738 integer :: n, i
739
740 n = 0
741 do i = 1, this%n_entries()
742 if (this%entries(i)%get_type() .eq. 'vector') then
743 n = n + 1
744 end if
745 end do
746 end function registry_n_vectors
747
749 pure function registry_n_matrices(this) result(n)
750 class(registry_t), intent(in) :: this
751 integer :: n, i
752
753 n = 0
754 do i = 1, this%n_entries()
755 if (this%entries(i)%get_type() .eq. 'matrix') then
756 n = n + 1
757 end if
758 end do
759 end function registry_n_matrices
760
762 pure function registry_n_real_scalars(this) result(n)
763 class(registry_t), intent(in) :: this
764 integer :: n, i
765
766 n = 0
767 do i = 1, this%n_entries()
768 if (this%entries(i)%get_type() .eq. 'real_scalar') then
769 n = n + 1
770 end if
771 end do
772 end function registry_n_real_scalars
773
775 pure function registry_n_integer_scalars(this) result(n)
776 class(registry_t), intent(in) :: this
777 integer :: n, i
778
779 n = 0
780 do i = 1, this%n_entries()
781 if (this%entries(i)%get_type() .eq. 'integer_scalar') then
782 n = n + 1
783 end if
784 end do
785 end function registry_n_integer_scalars
786
788 pure function registry_n_aliases(this) result(n)
789 class(registry_t), intent(in) :: this
790 integer :: n
791
792 n = this%n_aliases_
793 end function registry_n_aliases
794
796 pure function registry_get_size(this) result(n)
797 class(registry_t), intent(in) :: this
798 integer :: n
799
800 if (allocated(this%entries)) then
801 n = size(this%entries)
802 else
803 n = 0
804 end if
805 end function registry_get_size
806
808 pure function registry_get_expansion_size(this) result(n)
809 class(registry_t), intent(in) :: this
810 integer :: n
811
812 n = this%expansion_size_
813 end function registry_get_expansion_size
814
816 subroutine registry_print(this)
817 class(registry_t), intent(in) :: this
818 character(len=LOG_SIZE), allocatable :: buffer
819 integer :: i
820
821 call neko_log%section("Field Registry Contents")
822 do i = 1, this%n_entries()
823 write(buffer, '(A,I4,A,A)') "- [", i, "] ", &
824 this%entries(i)%get_type(), ": ", this%entries(i)%get_name()
825 call neko_log%message(trim(buffer))
826 end do
827
828 call neko_log%end_section()
829 end subroutine registry_print
830
832 subroutine registry_print_contents(this, type)
833 class(registry_t), intent(in) :: this
834 character(len=*), optional, intent(in) :: type
835 character(len=:), allocatable :: filter_type
836 character(len=14), parameter :: types(5) = (/ &
837 'field ', &
838 'vector ', &
839 'matrix ', &
840 'real_scalar ', &
841 'integer_scalar' /)
842 logical :: filter_active
843 integer :: i
844 logical :: known_type
845
846 filter_active = .false.
847 if (present(type)) then
848 filter_type = trim(type)
849 filter_active = .true.
850 known_type = .false.
851 do i = 1, size(types)
852 if (filter_type == types(i)) then
853 known_type = .true.
854 exit
855 end if
856 end do
857 if (.not. known_type) then
858 call neko_error("registry::print_contents: Unsupported type " &
859 // trim(filter_type))
860 end if
861 end if
862
863 call neko_log%section("Registry Contents")
864 do i = 1, size(types)
865 if (filter_active .and. (filter_type .ne. types(i))) cycle
866 call registry_print_section(this, types(i))
867 end do
868 call neko_log%end_section()
869 end subroutine registry_print_contents
870
872 subroutine registry_print_section(this, entity_type)
873 class(registry_t), intent(in) :: this
874 character(len=*), intent(in) :: entity_type
875 integer :: i
876 logical :: found
877 character(len=LOG_SIZE) :: buffer
878
879 call neko_log%message(" "//trim(entity_type)//" entries:")
880 found = .false.
881 do i = 1, this%n_entries()
882 if (this%entries(i)%get_type() .eq. entity_type) then
883 found = .true.
884 write(buffer, '(A,I4,A,A)') " [", i, "] ", &
885 trim(this%entries(i)%get_name())
886 call neko_log%message(trim(buffer))
887 end if
888 end do
889 if (.not. found) then
890 call neko_log%message(" <none>")
891 end if
892 end subroutine registry_print_section
893
894end module registry
Generic buffer that is extended with buffers of varying rank.
Definition buffer.F90:34
Defines a mapping of the degrees of freedom.
Definition dofmap.f90:35
Defines a field.
Definition field.f90:34
Logging routines.
Definition log.f90:34
integer, parameter, public neko_log_debug
Debug log level.
Definition log.f90:86
type(log_t), public neko_log
Global log stream.
Definition log.f90:76
integer, parameter, public log_size
Definition log.f90:45
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:144
subroutine registry_free(this)
Destructor.
Definition registry.f90:184
recursive type(vector_t) function, pointer registry_get_vector_by_name(this, name)
Get pointer to a stored vector by name.
Definition registry.f90:476
subroutine registry_add_integer_scalar(this, value, name, ignore_existing)
Add an integer scalar to the registry.
Definition registry.f90:389
pure integer function registry_get_size(this)
Get the size of the fields array.
Definition registry.f90:797
subroutine registry_print(this)
Print the contents of the registry to standard output.
Definition registry.f90:817
subroutine registry_add_matrix(this, nrows, ncols, name, ignore_existing)
Add a matrix to the registry.
Definition registry.f90:314
subroutine registry_print_contents(this, type)
Print the registry contents grouped by entity type.
Definition registry.f90:833
subroutine registry_init(this, size, expansion_size)
Constructor.
Definition registry.f90:162
subroutine registry_add_real_scalar(this, value, name, ignore_existing)
Add a real scalar to the registry.
Definition registry.f90:353
pure integer function registry_get_expansion_size(this)
Get the expansion size.
Definition registry.f90:809
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:150
pure integer function registry_n_real_scalars(this)
Get the number of real scalars stored in the registry.
Definition registry.f90:763
pure integer function registry_n_vectors(this)
Get the number of vector stored in the registry.
Definition registry.f90:737
pure integer function registry_n_aliases(this)
Get the number of aliases stored in the registry.
Definition registry.f90:789
logical function registry_matrix_exists(this, name)
Check if a matrix with a given name is already in the registry.
Definition registry.f90:656
pure integer function registry_n_fields(this)
Get the number of fields stored in the registry.
Definition registry.f90:724
subroutine registry_add_alias(this, alias, name)
Add an alias for an existing entry in the registry.
Definition registry.f90:424
subroutine registry_add_field(this, dof, name, ignore_existing)
Add a field to the registry.
Definition registry.f90:234
recursive type(matrix_t) function, pointer registry_get_matrix_by_name(this, name)
Get pointer to a stored matrix by name.
Definition registry.f90:506
subroutine registry_print_section(this, entity_type)
Print a single section of the registry for the given type.
Definition registry.f90:873
pure integer function registry_n_integer_scalars(this)
Get the number of integer scalars stored in the registry.
Definition registry.f90:776
logical function registry_entry_exists(this, name)
Check if a field with a given name is already in the registry.
Definition registry.f90:600
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:694
pure integer function registry_n_entries(this)
Get number of registered entries.
Definition registry.f90:716
subroutine registry_expand(this)
Expand the fields array so as to accommodate more fields.
Definition registry.f90:203
pure integer function registry_n_matrices(this)
Get the number of matrix stored in the registry.
Definition registry.f90:750
logical function registry_vector_exists(this, name)
Check if a vector with a given name is already in the registry.
Definition registry.f90:637
recursive integer function, pointer registry_get_integer_scalar_by_name(this, name)
Get pointer to a stored integer scalar by name.
Definition registry.f90:566
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:447
subroutine registry_add_vector(this, n, name, ignore_existing)
Add a vector to the registry.
Definition registry.f90:274
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:675
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:536
logical function registry_field_exists(this, name)
Check if a field with a given name is already in the registry.
Definition registry.f90:618
Utilities.
Definition utils.f90:35
Defines a vector.
Definition vector.f90:34