gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
Data Types | Functions/Subroutines
dc_units Module Reference

Unit system processing module. More...

Data Types

interface  clear
 
interface  deallocate
 
interface  operator(*)
 
interface  operator(+)
 
interface  operator(/)
 
type  units
 

Functions/Subroutines

logical function, public add_okay (u1, u2)
 

Detailed Description

Unit system processing module.

Author
Youhei SASAKI, Eizi TOYODA, Yasuhiro MORIKAWA

Function/Subroutine Documentation

◆ add_okay()

logical function, public dc_units::add_okay ( type(units), intent(in)  u1,
type(units), intent(in)  u2 
)

Check if two UNITS are compatible for addition

Two units are compatible if they have the same dimensions (i.e., the same unit elements with the same powers).

Parameters
[in]u1First UNITS variable
[in]u2Second UNITS variable
Returns
.true. if compatible, .false. otherwise

Definition at line 307 of file dc_units.f90.

308 type(UNITS), intent(in):: u1, u2
309 type(UNITS):: x
310 character(STRING):: debug
311 call clear(x)
312 x = u1 / u2
313 debug = u1
314 debug = u2
315 debug = x
316 if (x%nelems == 0) then
317 result = .true.
318 else if (all(abs(x%power(1:x%nelems)) < tiny(0.0_dp))) then
319 result = .true.
320 else
321 result = .false.
322 endif
323 call deallocate(x)