gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
Data Types | Functions/Subroutines
dc_units Module Reference

単位系処理用モジュール 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

単位系処理用モジュール

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 
)

2つの UNITS が加算互換かチェック

2つの単位は同じ次元を持つ場合(すなわち、同じ単位要素と 同じべき乗を持つ場合)に互換となります.

Parameters
[in]u11番目の UNITS 変数
[in]u22番目の UNITS 変数
Returns
互換なら .true., そうでなければ .false.

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)