get_sph_ptr Function

public function get_sph_ptr(self, region_id) result(sph_ptr)

Type Bound

type_material_manager

Arguments

Type IntentOptional Attributes Name
class(type_material_manager), intent(in), target :: self
integer(kind=int32), intent(in) :: region_id

Return Value class(abst_sph), pointer


Called by

proc~~get_sph_ptr~~CalledByGraph proc~get_sph_ptr type_material_manager%get_sph_ptr proc~get_phase_sphs type_properties_manager%get_phase_sphs proc~get_phase_sphs->proc~get_sph_ptr

Source Code

    function get_sph_ptr(self, region_id) result(sph_ptr)
        implicit none
        class(type_material_manager), intent(in), target :: self
        integer(int32), intent(in) :: region_id
        class(abst_sph), pointer :: sph_ptr

        integer(int32) :: model_index

#ifdef USE_DEBUG
        if (region_id < 1 .or. region_id > size(self%region_id_map)) then
            print *, "Error: Invalid region_id in get_sph_ptr:", region_id
            nullify (sph_ptr)
            stop 1
        end if
#endif

        model_index = self%region_id_map(region_id)

#ifdef USE_DEBUG
        if (model_index == 0) then
            print *, "Error: region_id not mapped in get_sph_ptr:", region_id
            nullify (sph_ptr)
            stop 1
        end if
#endif

        sph_ptr => self%sph(model_index)%p
    end function get_sph_ptr