gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
dc_units::operator(+) Interface Reference

Public Member Functions

type(units) function dcunitsadd (u1, u2)

Detailed Description

Definition at line 107 of file dc_units.f90.

Member Function/Subroutine Documentation

◆ dcunitsadd()

type(units) function dc_units::operator(+)::dcunitsadd ( type(units), intent(in) u1,
type(units), intent(in) u2 )

2つの UNITS を加算 (次元互換性チェック付き)

加算は両単位が同じ次元を持つ場合のみ有効です. 次元が一致しない場合、resultoffset に "MISMATCH" が設定されます.

Parameters
[in]u11番目の UNITS 変数
[in]u22番目の UNITS 変数
Returns
2つの UNITS の和 (非互換の場合はエラー)

Definition at line 265 of file dc_units.f90.

266 type(UNITS), intent(in):: u1, u2
267 type(UNITS):: x
268 result%offset = u1%offset
269 result%nelems = u1%nelems
270 result%factor = u1%factor + u2%factor
271 x = u1 / u2
272 if (x%nelems == 0) then
273 nullify(result%name, result%power)
274 return
275 endif
276 if (all(abs(x%power(1:result%nelems)) < tiny(0.0_dp))) then
277 allocate(result%name(result%nelems), result%power(result%nelems))
278 result%name = u1%name
279 result%power = u1%power
280 return
281 endif
282 result%factor = 0.0
283 result%nelems = -1
284 result%offset = "MISMATCH"
285 nullify(result%name, result%power)

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