複合型¶
定義方法¶
1<Item name="vegetation" caption="Vagetation">
2 <Definition valueType="complex" position="cell">
3 <Item name="type" caption="Type">
4 <Definition valueType="integer" option="true" default="1">
5 <Enumerations>
6 <Enumeration value="0" caption="No vegetation"/>
7 <Enumeration value="1" caption="Vegetation"/>
8 </Enumerations>
9 </Definition>
10 </Item>
11 <Item name="density" caption="Vegetation density">
12 <Definition valueType="real" default="0">
13 <Condition type="isEqual" target="type" value="1"/>
14 </Definition>
15 </Item>
16 </Definition>
17</Item>
条件の表示例¶
読み込み処理の記述方法¶
FORTRAN¶
1integer:: ier, cellcount, vegetation_groupcount
2integer, dimension(:), allocatable:: vegetation
3integer, dimension(:), allocatable:: vegetation_type
4double precision, dimension(:), allocatable:: vegetation_density
5integer:: i
6
7! セルの数を調べる
8call cg_iRIC_Read_Grid_CellCount(fid, cellcount, ier)
9! メモリを確保
10allocate(roughness(vegetation))
11! 確保したメモリに各セルの値を読み込む
12call cg_iRIC_Read_Grid_Complex_Cell(fid, "vegetation", vegetation, ier)
13
14! グループの数を調べる
15call cg_iRIC_Read_Complex_Count(fid, "vegetation", vegetation_groupcount, ier)
16! メモリを確保
17allocate(vegetation_type(vegetation_groupcount))
18allocate(vegetation_density(vegetation_groupcount))
19! 確保したメモリに値を読み込む
20do i = 1, vegetation_groupcount
21 call cg_iRIC_Read_Complex_Integer(fid, "vegetation", "type", vegetation_type(i), ier)
22 call cg_iRIC_Read_Complex_Real(fid, "vegetation", "density", vegetation_density(i), ier)
23end do
C/C++¶
1int ier, cellcount, vegetation_groupcount;
2std::vector<int> vegetation;
3std::vector<int> vegetation_type;
4std::vector<double> vegetation_density;
5
6// セルの数を調べる
7ier = cg_iRIC_Read_Grid_CellCount(fid, &cellcount);
8// メモリを確保
9vegetation.assign(cellcount, 0);
10// 確保したメモリに各セルの値を読み込む
11ier = cg_iRIC_Read_Grid_Complex_Cell(fid, "vegetation", vegetation.data());
12
13// グループの数を調べる
14ier = cg_iRIC_Read_Complex_Count(fid, "vegetation", &vegetation_groupcount);
15// メモリを確保
16vegetation_type.assign(vegetation_groupcount, 0);
17vegetation_density.assign(vegetation_groupcount, 0);
18// 確保したメモリに値を読み込む
19for (int i = 0; i < vegetation_groupcount; ++i) {
20 ier = cg_iRIC_Read_Complex_Integer(fid, "vegetation", "type", &vegetation_type[i]);
21 ier = cg_iRIC_Read_Complex_Real(fid, "vegetation", "density", &vegetation_density[i]);
22}
Python¶
1# 各セルの値を読み込む
2vegetation = cg_iRIC_Read_Grid_Complex_Cell(fid, "vegetation")
3
4# グループの数を調べる
5vegetation_groupcount = cg_iRIC_Read_Complex_Count(fid, "vegetation")
6# リストを用意
7vegetation_type = list()
8vegetation_density = list()
9
10for i in range(vegetation_groupcount):
11 vegetation_type.append(cg_iRIC_Read_Complex_Integer(fid, "vegetation", "type"))
12 vegetation_density.append(cg_iRIC_Read_Complex_Real(fid, "vegetation", "density"))