My Project
Data Types | Functions/Subroutines
geometrical_objects Module Reference

Data Types

interface  get_shape_area
 
type  rectangle
 
type  shape
 
type  square
 

Functions/Subroutines

real function get_rectangle_area (this)
 
subroutine rectangle_size (this, width, height)
 
subroutine square_size (this, width, height)
 
real function get_square_area (this)
 

Function/Subroutine Documentation

◆ get_rectangle_area()

real function geometrical_objects::get_rectangle_area ( class(rectangle), intent(in)  this)

Definition at line 60 of file mod_geometry.f90.

60  class(rectangle), intent(in) :: this
61 
62  get_rectangle_area = this%width * this%height
63 

◆ get_square_area()

real function geometrical_objects::get_square_area ( class(square), intent(in)  this)

Definition at line 91 of file mod_geometry.f90.

91  class(square), intent(in) :: this
92 
93  get_square_area = this%width ** 2
94 

◆ rectangle_size()

subroutine geometrical_objects::rectangle_size ( class(rectangle), intent(inout)  this,
real, intent(in)  width,
real, intent(in), optional  height 
)

Definition at line 67 of file mod_geometry.f90.

67  class(rectangle), intent(inout) :: this
68  real, intent(in) :: width
69  real, intent(in), optional :: height
70 
71  this%width = width
72  if ( present(height) ) then
73  this%height = height
74  else
75  this%height = width
76  endif
77 

◆ square_size()

subroutine geometrical_objects::square_size ( class(square), intent(inout)  this,
real, intent(in)  width,
real, intent(in), optional  height 
)

Definition at line 81 of file mod_geometry.f90.

81  class(square), intent(inout) :: this
82  real, intent(in) :: width
83  real, intent(in), optional :: height ! Ignored
84 
85  this%width = width
86  this%height = 0.0
87