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

単位系処理用モジュール More...

Data Types

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

Functions/Subroutines

logical function, public add_okay (u1, u2)

Detailed Description

単位系処理用モジュール

Author
Youhei SASAKI, Eizi TOYODA, Yasuhiro MORIKAWA

このモジュールは単位系処理のためのプログラム群を提供します. 物理単位を表現する派生型 UNITS と、単位の算術演算 (乗算、除算、加算) のための演算子を含みます.

演算子・手続一覧

演算子/手続 説明
assignment(=) 文字列から UNITS を構築または文字列へ変換
operator(*) 2つの UNITS を乗算
operator(/) 2つの UNITS を除算
operator(+) 2つの UNITS を加算 (互換性チェック付き)
clear UNITS 変数の初期化
deallocate UNITS 変数の解放
add_okay 2つの UNITS が加算互換かチェック

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)