Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

problem with select type

flowster
Beginner
451 Views
hi,
the following code,
[fortran]subroutine init_material( this, lMin, nlMin ) class( material ), intent(inout) :: this class( gumLinMaterial ), intent(in) :: lMin class( gumNonlinMaterial ), intent(in) :: nlMin
! gumLinMat, gumNonLinMat are abstract derived types,
! both extending another abstract derived types linearMaterial and nonLinMaterial this%isNonLin = .true. allocate( this%gumLinMat, source=lMin )
! material%gumLinMat variable definition is:
! class( gumLinMaterial ), allocatable :: gumLinMat allocate( this%gumNonLinMat, source=nlMin) allocate( this%gumNonLinMat%hardening, source=nlMin%hardening ) select type( linM => this%gumLinMat )
! class is( linearMaterial ), fortran recogizes that this is not viable during compiling... class is( gumLinMaterial ) write(*,*) 'gumlin' end select end subroutine init_material[/fortran]compiles. but gives some unexpected results (for my opinion).
select type will tell me that this%gumLinMat is not a class(gumLinMaterial), so the type specific write will not be executed.
how could this be? both the allocated type and declaration type is gumLinMaterial?


p.s.: the whole code is quite a few thousand lines so it is difficult to post it
0 Kudos
0 Replies
Reply