Loading...
Searching...
No Matches
Public Member Functions | List of all members
dc_units::operator(/) Interface Reference

Public Member Functions

type(units) function dcunitsdiv (u1, u2)
 

Detailed Description

Definition at line 52 of file dc_units.f90.

Member Function/Subroutine Documentation

◆ dcunitsdiv()

type(units) function dc_units::operator(/)::dcunitsdiv ( type(units), intent(in)  u1,
type(units), intent(in)  u2 
)

Definition at line 117 of file dc_units.f90.

118 type(UNITS), intent(in):: u1, u2
119 integer:: n, n1
120 character(TOKEN), allocatable:: name(:)
121 real(DP), allocatable:: power(:)
122 if (abs(u2%factor) < tiny(u2%factor)) then
123 result%factor = sign(u1%factor, 1.0_dp) * &
124 & sign(u2%factor, 1.0_dp) * &
125 & huge(1.0_dp)
126 else
127 result%factor = u1%factor / u2%factor
128 endif
129 result%nelems = u1%nelems + u2%nelems
130 result%offset = ""
131 n = result%nelems
132 if (n == 0) then
133 nullify(result%name, result%power)
134 return
135 endif
136 allocate(name(n), power(n))
137 n1 = u1%nelems
138 if (n1 >= 1) then
139 name(1:n1) = u1%name(1:n1)
140 power(1:n1) = u1%power(1:n1)
141 endif
142 n1 = n1 + 1
143 if (n >= n1) then
144 name(n1:n) = u2%name(1:u2%nelems)
145 power(n1:n) = -u2%power(1:u2%nelems)
146 endif
147 call units_simplify(result, name, power)
148 deallocate(name, power)

The documentation for this interface was generated from the following file: