@@ -127,11 +127,22 @@ namespace paxs {
127
127
language_ofs = std::ofstream (str + " /Language.txt" );
128
128
live_ofs = std::ofstream (str + " /HabitableLand.txt" );
129
129
130
+ pop_region_ofs = std::ofstream (str + " /Region_Population.txt" );
131
+ mtdna_region_ofs = std::ofstream (str + " /Region_mtDNA.txt" );
132
+ snp_region_ofs = std::ofstream (str + " /Region_SNP.txt" );
133
+ language_region_ofs = std::ofstream (str + " /Region_Language.txt" );
134
+ live_region_ofs = std::ofstream (str + " /Region_HabitableLand.txt" );
135
+
130
136
outputResultString (pop_ofs);
131
137
outputResultString (mtdna_ofs);
132
138
outputResultString (snp_ofs);
133
139
outputResultString (language_ofs);
134
- for (std::size_t i = 0 ; i < max_number_of_districts; ++i) {
140
+
141
+ outputResultString (pop_region_ofs);
142
+ outputResultString (mtdna_region_ofs);
143
+ outputResultString (snp_region_ofs);
144
+ outputResultString (language_region_ofs);
145
+ for (std::size_t i = 0 ; i < max_number_of_districts - 1 ; ++i) {
135
146
outputResultDistrictName (pop_ofs, i);
136
147
outputResultDistrictName (mtdna_ofs, i);
137
148
outputResultDistrictName (snp_ofs, i);
@@ -141,6 +152,11 @@ namespace paxs {
141
152
outputResultLastString (mtdna_ofs);
142
153
outputResultLastString (snp_ofs);
143
154
outputResultLastString (language_ofs);
155
+
156
+ outputResultLastString (pop_region_ofs);
157
+ outputResultLastString (mtdna_region_ofs);
158
+ outputResultLastString (snp_region_ofs);
159
+ outputResultLastString (language_region_ofs);
144
160
}
145
161
146
162
// / @brief Initialize the simulator.
@@ -165,7 +181,7 @@ namespace paxs {
165
181
166
182
// 可住地の数を出力
167
183
live_ofs << " district\t habitable_land\n " ;
168
- for (std::size_t i = 0 ; i < max_number_of_districts; ++i) {
184
+ for (std::size_t i = 1 ; i < max_number_of_districts; ++i) {
169
185
live_ofs << japan_provinces->cgetDistrictList ()[i].name << ' \t ' << (*live_list)[i + 1 ].habitable_land_positions .size () << ' \n ' ;
170
186
}
171
187
}
@@ -214,6 +230,12 @@ namespace paxs {
214
230
double ryosnp[max_number_of_districts]{};
215
231
double ryolanguage[max_number_of_districts]{};
216
232
233
+ std::array<std::uint_least32_t , 10 > region_pop{};
234
+ std::array<std::uint_least32_t , 10 > region_set{};
235
+ std::array<std::uint_least32_t , 10 > region_snp{};
236
+ std::array<std::uint_least32_t , 10 > region_language{};
237
+ std::vector<std::vector<int >> mtdna_region_num (10 , std::vector<int >(256 , 0 )); // mtDNA 数
238
+
217
239
// 地名を描画
218
240
for (const auto & agent : getSettlementGrids ()) {
219
241
for (const auto & settlement : agent.second .cgetSettlements ()) {
@@ -227,9 +249,14 @@ namespace paxs {
227
249
ryolanguage[ryo_id]+= settlement.getLanguage (); // 地区ごとに言語を増加させる
228
250
++(ryoset[ryo_id]);
229
251
252
+ // 地域区分
253
+ const std::uint_least8_t region_id = japan_provinces->getJapanRegionId (ryo_id);
254
+
230
255
// mtDNA ごとにカウント
231
256
for (int popi = 0 ; popi < settlement.cgetAgents ().size (); ++popi) {
232
- mtdna_num[ryo_id][settlement.cgetAgents ()[popi].cgetGenome ().getMtDNA ()] += 1 ;
257
+ const auto get_mtdna = settlement.cgetAgents ()[popi].cgetGenome ().getMtDNA ();
258
+ mtdna_num[ryo_id][get_mtdna] += 1 ;
259
+ if (region_id < 10 ) mtdna_region_num[region_id][get_mtdna] += 1 ;
233
260
}
234
261
}
235
262
}
@@ -238,7 +265,21 @@ namespace paxs {
238
265
mtdna_ofs << step_count << ' \t ' << sat_num << ' \t ' << pop_num << ' \t ' ;
239
266
snp_ofs << step_count << ' \t ' << sat_num << ' \t ' << pop_num << ' \t ' ;
240
267
language_ofs << step_count << ' \t ' << sat_num << ' \t ' << pop_num << ' \t ' ;
241
- for (std::size_t i = 0 ; i < max_number_of_districts; ++i) {
268
+
269
+ pop_region_ofs << step_count << ' \t ' << sat_num << ' \t ' << pop_num << ' \t ' ;
270
+ mtdna_region_ofs << step_count << ' \t ' << sat_num << ' \t ' << pop_num << ' \t ' ;
271
+ snp_region_ofs << step_count << ' \t ' << sat_num << ' \t ' << pop_num << ' \t ' ;
272
+ language_region_ofs << step_count << ' \t ' << sat_num << ' \t ' << pop_num << ' \t ' ;
273
+
274
+ for (std::size_t i = 1 ; i < max_number_of_districts; ++i) {
275
+ // 地域区分
276
+ const std::uint_least8_t region_id = japan_provinces->getJapanRegionId (i);
277
+ if (region_id < 10 ) {
278
+ region_pop[region_id] += static_cast <std::uint_least32_t >(ryopop[i]);
279
+ region_set[region_id] += static_cast <std::uint_least32_t >(ryoset[i]);
280
+ region_snp[region_id] += static_cast <std::uint_least32_t >(ryosnp[i]);
281
+ region_language[region_id] += static_cast <std::uint_least32_t >(ryolanguage[i]);
282
+ }
242
283
ryosnp[i] /= static_cast <double >(ryoset[i]);
243
284
ryolanguage[i] /= static_cast <double >(ryoset[i]);
244
285
pop_ofs << ryopop[i] << ' \t ' ;
@@ -250,10 +291,26 @@ namespace paxs {
250
291
}
251
292
mtdna_ofs << ' \t ' ;
252
293
}
294
+ // Region
295
+ for (std::size_t region_id = 0 ; region_id < 10 ; ++region_id) {
296
+ pop_region_ofs << region_pop[region_id] << ' \t ' ;
297
+ snp_region_ofs << static_cast <double >(region_snp[region_id]) / static_cast <double >(region_set[region_id]) << ' \t ' ;
298
+ language_region_ofs << static_cast <double >(region_language[region_id]) / static_cast <double >(region_set[region_id]) << ' \t ' ;
299
+ for (std::size_t j = 0 ; j < japan_provinces->getSizeMtDNA (); ++j) {
300
+ if (int (mtdna_region_num[region_id][j]) == 0 ) continue ;
301
+ mtdna_region_ofs << japan_provinces->getMtDNA_Name (static_cast <std::uint_least8_t >(j)) << ' :' << int (mtdna_region_num[region_id][j]) << ' /' ;
302
+ }
303
+ mtdna_region_ofs << ' \t ' ;
304
+ }
253
305
pop_ofs << step_count << ' \n ' ;
254
306
mtdna_ofs << step_count << ' \n ' ;
255
307
snp_ofs << step_count << ' \n ' ;
256
308
language_ofs << step_count << ' \n ' ;
309
+
310
+ pop_region_ofs << step_count << ' \n ' ;
311
+ mtdna_region_ofs << step_count << ' \n ' ;
312
+ snp_region_ofs << step_count << ' \n ' ;
313
+ language_region_ofs << step_count << ' \n ' ;
257
314
}
258
315
259
316
std::vector<std::tuple<std::uint_least32_t , Vector2, Vector2>> move_list;
@@ -429,6 +486,13 @@ namespace paxs {
429
486
std::ofstream snp_ofs;
430
487
std::ofstream language_ofs;
431
488
std::ofstream live_ofs;
489
+
490
+ std::ofstream pop_region_ofs;
491
+ std::ofstream mtdna_region_ofs;
492
+ std::ofstream snp_region_ofs;
493
+ std::ofstream language_region_ofs;
494
+ std::ofstream live_region_ofs;
495
+
432
496
// 婚姻時に移動前の位置と移動後の位置を記録
433
497
std::vector<GridType4> marriage_pos_list{};
434
498
0 commit comments