| 1 |
// Copyright(C) 1999-2023 National Technology & Engineering Solutions |
| 2 |
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 3 |
// NTESS, the U.S. Government retains certain rights in this software. |
| 4 |
// |
| 5 |
// See packages/seacas/LICENSE for details |
| 6 |
|
| 7 |
#include "exonull/Ioexnl_Internals.h" // for Internals, ElemBlock, etc |
| 8 |
#include "exonull/Ioexnl_Utils.h" |
| 9 |
|
| 10 |
extern "C" { |
| 11 |
} |
| 12 |
|
| 13 |
#include <cassert> // for assert |
| 14 |
#include <cstring> // for strlen |
| 15 |
#include <string> // for string, operator==, etc |
| 16 |
#include <vector> // for vector |
| 17 |
|
| 18 |
#include "Ioss_Assembly.h" |
| 19 |
#include "Ioss_Blob.h" |
| 20 |
#include "Ioss_EdgeBlock.h" |
| 21 |
#include "Ioss_EdgeSet.h" |
| 22 |
#include "Ioss_ElementBlock.h" |
| 23 |
#include "Ioss_ElementSet.h" |
| 24 |
#include "Ioss_ElementTopology.h" |
| 25 |
#include "Ioss_FaceBlock.h" |
| 26 |
#include "Ioss_FaceSet.h" |
| 27 |
#include "Ioss_Field.h" |
| 28 |
#include "Ioss_GroupingEntity.h" |
| 29 |
#include "Ioss_NodeBlock.h" |
| 30 |
#include "Ioss_NodeSet.h" |
| 31 |
#include "Ioss_Property.h" |
| 32 |
#include "Ioss_Region.h" |
| 33 |
#include "Ioss_SideBlock.h" |
| 34 |
#include "Ioss_SideSet.h" |
| 35 |
#include "Ioss_Utils.h" |
| 36 |
#include "Ioss_VariableType.h" |
| 37 |
|
| 38 |
using namespace Ioexnl; |
| 39 |
|
| 40 |
namespace { |
| 41 |
template <typename T> int get_max_name_length(const std::vector<T> &entities, int old_max); |
| 42 |
} // namespace |
| 43 |
|
| 44 |
Assembly::Assembly(const Ioss::Assembly &other) |
| 45 |
{ |
| 46 |
if (other.property_exists("db_name")) { |
| 47 |
name = other.get_property("db_name").get_string(); |
| 48 |
} |
| 49 |
else { |
| 50 |
name = other.name(); |
| 51 |
} |
| 52 |
|
| 53 |
id = other.get_optional_property("id", 1); |
| 54 |
entityCount = other.member_count(); |
| 55 |
attributeCount = other.get_property("attribute_count").get_int(); |
| 56 |
type = Ioexnl::map_exodus_type(other.get_member_type()); |
| 57 |
|
| 58 |
const auto &members = other.get_members(); |
| 59 |
for (const auto &member : members) { |
| 60 |
assert(member->property_exists("id")); |
| 61 |
memberIdList.push_back(member->get_property("id").get_int()); |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
Blob::Blob(const Ioss::Blob &other) |
| 66 |
{ |
| 67 |
if (other.property_exists("db_name")) { |
| 68 |
name = other.get_property("db_name").get_string(); |
| 69 |
} |
| 70 |
else { |
| 71 |
name = other.name(); |
| 72 |
} |
| 73 |
|
| 74 |
id = other.get_optional_property("id", 1); |
| 75 |
entityCount = other.entity_count(); |
| 76 |
attributeCount = other.get_property("attribute_count").get_int(); |
| 77 |
} |
| 78 |
|
| 79 |
NodeBlock::NodeBlock(const Ioss::NodeBlock &other) |
| 80 |
{ |
| 81 |
if (other.property_exists("db_name")) { |
| 82 |
name = other.get_property("db_name").get_string(); |
| 83 |
} |
| 84 |
else { |
| 85 |
name = other.name(); |
| 86 |
} |
| 87 |
|
| 88 |
id = other.get_optional_property("id", 1); |
| 89 |
entityCount = other.entity_count(); |
| 90 |
localOwnedCount = other.get_optional_property("locally_owned_count", entityCount); |
| 91 |
attributeCount = other.get_property("attribute_count").get_int(); |
| 92 |
procOffset = 0; |
| 93 |
} |
| 94 |
|
| 95 |
EdgeBlock::EdgeBlock(const Ioss::EdgeBlock &other) |
| 96 |
{ |
| 97 |
if (other.property_exists("db_name")) { |
| 98 |
name = other.get_property("db_name").get_string(); |
| 99 |
} |
| 100 |
else { |
| 101 |
name = other.name(); |
| 102 |
} |
| 103 |
|
| 104 |
id = other.get_property("id").get_int(); |
| 105 |
entityCount = other.entity_count(); |
| 106 |
nodesPerEntity = other.topology()->number_nodes(); |
| 107 |
attributeCount = other.get_property("attribute_count").get_int(); |
| 108 |
|
| 109 |
std::string el_type = other.topology()->name(); |
| 110 |
if (other.property_exists("original_topology_type")) { |
| 111 |
el_type = other.get_property("original_topology_type").get_string(); |
| 112 |
} |
| 113 |
|
| 114 |
Ioss::Utils::copy_string(elType, el_type); |
| 115 |
procOffset = 0; |
| 116 |
} |
| 117 |
|
| 118 |
FaceBlock::FaceBlock(const Ioss::FaceBlock &other) |
| 119 |
{ |
| 120 |
if (other.property_exists("db_name")) { |
| 121 |
name = other.get_property("db_name").get_string(); |
| 122 |
} |
| 123 |
else { |
| 124 |
name = other.name(); |
| 125 |
} |
| 126 |
|
| 127 |
id = other.get_property("id").get_int(); |
| 128 |
entityCount = other.entity_count(); |
| 129 |
nodesPerEntity = other.topology()->number_nodes(); |
| 130 |
if (other.field_exists("connectivty_edge")) { |
| 131 |
edgesPerEntity = other.get_field("connectivity_edge").raw_storage()->component_count(); |
| 132 |
} |
| 133 |
else { |
| 134 |
edgesPerEntity = 0; |
| 135 |
} |
| 136 |
attributeCount = other.get_property("attribute_count").get_int(); |
| 137 |
|
| 138 |
std::string el_type = other.topology()->name(); |
| 139 |
if (other.property_exists("original_topology_type")) { |
| 140 |
el_type = other.get_property("original_topology_type").get_string(); |
| 141 |
} |
| 142 |
|
| 143 |
Ioss::Utils::copy_string(elType, el_type); |
| 144 |
procOffset = 0; |
| 145 |
} |
| 146 |
|
| 147 |
ElemBlock::ElemBlock(const Ioss::ElementBlock &other) |
| 148 |
{ |
| 149 |
if (other.property_exists("db_name")) { |
| 150 |
name = other.get_property("db_name").get_string(); |
| 151 |
} |
| 152 |
else { |
| 153 |
name = other.name(); |
| 154 |
} |
| 155 |
|
| 156 |
id = other.get_property("id").get_int(); |
| 157 |
entityCount = other.entity_count(); |
| 158 |
globalEntityCount = other.get_optional_property("global_entity_count", 0); |
| 159 |
nodesPerEntity = other.topology()->number_nodes(); |
| 160 |
|
| 161 |
if (other.field_exists("connectivity_edge")) { |
| 162 |
edgesPerEntity = other.get_field("connectivity_edge").raw_storage()->component_count(); |
| 163 |
} |
| 164 |
else { |
| 165 |
edgesPerEntity = 0; |
| 166 |
} |
| 167 |
|
| 168 |
if (other.field_exists("connectivity_face")) { |
| 169 |
facesPerEntity = other.get_field("connectivity_face").raw_storage()->component_count(); |
| 170 |
} |
| 171 |
else { |
| 172 |
facesPerEntity = 0; |
| 173 |
} |
| 174 |
|
| 175 |
attributeCount = other.get_property("attribute_count").get_int(); |
| 176 |
offset_ = other.get_offset(); |
| 177 |
std::string el_type = |
| 178 |
other.get_optional_property("original_topology_type", other.topology()->name()); |
| 179 |
|
| 180 |
Ioss::Utils::copy_string(elType, el_type); |
| 181 |
|
| 182 |
// Fixup an exodusII kluge. For triangular elements, the same |
| 183 |
// name is used for 2D elements and 3D shell elements. Convert |
| 184 |
// to unambiguous names for the IO Subsystem. The 2D name |
| 185 |
// stays the same, the 3D name becomes 'trishell#' |
| 186 |
// Here, we need to map back to the 'triangle' name... |
| 187 |
if (std::strncmp(elType, "trishell", 8) == 0) { |
| 188 |
Ioss::Utils::copy_string(elType, "triangle"); |
| 189 |
} |
| 190 |
procOffset = 0; |
| 191 |
} |
| 192 |
|
| 193 |
NodeSet::NodeSet(const Ioss::NodeSet &other) |
| 194 |
{ |
| 195 |
if (other.property_exists("db_name")) { |
| 196 |
name = other.get_property("db_name").get_string(); |
| 197 |
} |
| 198 |
else { |
| 199 |
name = other.name(); |
| 200 |
} |
| 201 |
|
| 202 |
id = other.get_property("id").get_int(); |
| 203 |
entityCount = other.entity_count(); |
| 204 |
globalEntityCount = other.get_optional_property("global_entity_count", 0); |
| 205 |
localOwnedCount = other.get_optional_property("locally_owned_count", entityCount); |
| 206 |
attributeCount = other.get_property("attribute_count").get_int(); |
| 207 |
dfCount = other.get_property("distribution_factor_count").get_int(); |
| 208 |
if (dfCount > 0 && dfCount != entityCount) { |
| 209 |
dfCount = entityCount; |
| 210 |
} |
| 211 |
procOffset = 0; |
| 212 |
} |
| 213 |
|
| 214 |
EdgeSet::EdgeSet(const Ioss::EdgeSet &other) |
| 215 |
{ |
| 216 |
if (other.property_exists("db_name")) { |
| 217 |
name = other.get_property("db_name").get_string(); |
| 218 |
} |
| 219 |
else { |
| 220 |
name = other.name(); |
| 221 |
} |
| 222 |
|
| 223 |
id = other.get_property("id").get_int(); |
| 224 |
entityCount = other.entity_count(); |
| 225 |
attributeCount = other.get_property("attribute_count").get_int(); |
| 226 |
dfCount = other.get_property("distribution_factor_count").get_int(); |
| 227 |
procOffset = 0; |
| 228 |
} |
| 229 |
|
| 230 |
FaceSet::FaceSet(const Ioss::FaceSet &other) |
| 231 |
{ |
| 232 |
if (other.property_exists("db_name")) { |
| 233 |
name = other.get_property("db_name").get_string(); |
| 234 |
} |
| 235 |
else { |
| 236 |
name = other.name(); |
| 237 |
} |
| 238 |
|
| 239 |
id = other.get_property("id").get_int(); |
| 240 |
entityCount = other.entity_count(); |
| 241 |
attributeCount = other.get_property("attribute_count").get_int(); |
| 242 |
dfCount = other.get_property("distribution_factor_count").get_int(); |
| 243 |
procOffset = 0; |
| 244 |
} |
| 245 |
|
| 246 |
ElemSet::ElemSet(const Ioss::ElementSet &other) |
| 247 |
{ |
| 248 |
if (other.property_exists("db_name")) { |
| 249 |
name = other.get_property("db_name").get_string(); |
| 250 |
} |
| 251 |
else { |
| 252 |
name = other.name(); |
| 253 |
} |
| 254 |
|
| 255 |
id = other.get_property("id").get_int(); |
| 256 |
entityCount = other.entity_count(); |
| 257 |
attributeCount = other.get_property("attribute_count").get_int(); |
| 258 |
dfCount = other.get_property("distribution_factor_count").get_int(); |
| 259 |
procOffset = 0; |
| 260 |
} |
| 261 |
|
| 262 |
SideSet::SideSet(const Ioss::SideBlock &other) |
| 263 |
{ |
| 264 |
if (other.property_exists("db_name")) { |
| 265 |
name = other.get_property("db_name").get_string(); |
| 266 |
} |
| 267 |
else { |
| 268 |
name = other.name(); |
| 269 |
} |
| 270 |
|
| 271 |
id = other.get_property("id").get_int(); |
| 272 |
entityCount = other.entity_count(); |
| 273 |
globalEntityCount = other.get_optional_property("global_entity_count", 0); |
| 274 |
dfCount = other.get_property("distribution_factor_count").get_int(); |
| 275 |
const std::string &io_name = other.name(); |
| 276 |
|
| 277 |
// KLUGE: universal_sideset has side dfCount... |
| 278 |
if (io_name == "universal_sideset") { |
| 279 |
dfCount = entityCount; |
| 280 |
} |
| 281 |
procOffset = 0; |
| 282 |
dfProcOffset = 0; |
| 283 |
} |
| 284 |
|
| 285 |
SideSet::SideSet(const Ioss::SideSet &other) |
| 286 |
{ |
| 287 |
if (other.property_exists("db_name")) { |
| 288 |
name = other.get_property("db_name").get_string(); |
| 289 |
} |
| 290 |
else { |
| 291 |
name = other.name(); |
| 292 |
} |
| 293 |
|
| 294 |
id = other.get_property("id").get_int(); |
| 295 |
entityCount = other.entity_count(); |
| 296 |
globalEntityCount = other.get_optional_property("global_entity_count", 0); |
| 297 |
dfCount = other.get_property("distribution_factor_count").get_int(); |
| 298 |
const std::string &io_name = other.name(); |
| 299 |
|
| 300 |
// KLUGE: universal_sideset has side dfCount... |
| 301 |
if (io_name == "universal_sideset") { |
| 302 |
dfCount = entityCount; |
| 303 |
} |
| 304 |
procOffset = 0; |
| 305 |
dfProcOffset = 0; |
| 306 |
} |
| 307 |
|
| 308 |
void Mesh::populate(Ioss::Region *region) |
| 309 |
{ |
| 310 |
{ |
| 311 |
const auto &node_blocks = region->get_node_blocks(); |
| 312 |
if (!node_blocks.empty()) { |
| 313 |
Ioexnl::NodeBlock N(*node_blocks[0]); |
| 314 |
nodeblocks.push_back(N); |
| 315 |
} |
| 316 |
} |
| 317 |
|
| 318 |
// Assemblies -- |
| 319 |
{ |
| 320 |
const auto &assem = region->get_assemblies(); |
| 321 |
for (const auto &assembly : assem) { |
| 322 |
Ioexnl::Assembly T(*(assembly)); |
| 323 |
assemblies.push_back(T); |
| 324 |
} |
| 325 |
} |
| 326 |
|
| 327 |
// Blobs -- |
| 328 |
{ |
| 329 |
const auto &blbs = region->get_blobs(); |
| 330 |
for (const auto &blob : blbs) { |
| 331 |
Ioexnl::Blob T(*(blob)); |
| 332 |
blobs.push_back(T); |
| 333 |
} |
| 334 |
} |
| 335 |
|
| 336 |
// Edge Blocks -- |
| 337 |
{ |
| 338 |
const Ioss::EdgeBlockContainer &edge_blocks = region->get_edge_blocks(); |
| 339 |
for (const auto &edge_block : edge_blocks) { |
| 340 |
Ioexnl::EdgeBlock T(*(edge_block)); |
| 341 |
edgeblocks.push_back(T); |
| 342 |
} |
| 343 |
} |
| 344 |
|
| 345 |
// Face Blocks -- |
| 346 |
{ |
| 347 |
const Ioss::FaceBlockContainer &face_blocks = region->get_face_blocks(); |
| 348 |
for (const auto &face_block : face_blocks) { |
| 349 |
Ioexnl::FaceBlock T(*(face_block)); |
| 350 |
faceblocks.push_back(T); |
| 351 |
} |
| 352 |
} |
| 353 |
|
| 354 |
// Element Blocks -- |
| 355 |
{ |
| 356 |
const Ioss::ElementBlockContainer &element_blocks = region->get_element_blocks(); |
| 357 |
for (const auto &element_block : element_blocks) { |
| 358 |
Ioexnl::ElemBlock T(*(element_block)); |
| 359 |
elemblocks.push_back(T); |
| 360 |
} |
| 361 |
} |
| 362 |
|
| 363 |
// NodeSets ... |
| 364 |
{ |
| 365 |
const Ioss::NodeSetContainer &node_sets = region->get_nodesets(); |
| 366 |
for (const auto &set : node_sets) { |
| 367 |
const Ioexnl::NodeSet T(*(set)); |
| 368 |
nodesets.push_back(T); |
| 369 |
} |
| 370 |
} |
| 371 |
|
| 372 |
// EdgeSets ... |
| 373 |
{ |
| 374 |
const Ioss::EdgeSetContainer &edge_sets = region->get_edgesets(); |
| 375 |
for (const auto &set : edge_sets) { |
| 376 |
const Ioexnl::EdgeSet T(*(set)); |
| 377 |
edgesets.push_back(T); |
| 378 |
} |
| 379 |
} |
| 380 |
|
| 381 |
// FaceSets ... |
| 382 |
{ |
| 383 |
const Ioss::FaceSetContainer &face_sets = region->get_facesets(); |
| 384 |
for (const auto &set : face_sets) { |
| 385 |
const Ioexnl::FaceSet T(*(set)); |
| 386 |
facesets.push_back(T); |
| 387 |
} |
| 388 |
} |
| 389 |
|
| 390 |
// ElementSets ... |
| 391 |
{ |
| 392 |
const Ioss::ElementSetContainer &element_sets = region->get_elementsets(); |
| 393 |
for (const auto &set : element_sets) { |
| 394 |
const Ioexnl::ElemSet T(*(set)); |
| 395 |
elemsets.push_back(T); |
| 396 |
} |
| 397 |
} |
| 398 |
|
| 399 |
// SideSets ... |
| 400 |
{ |
| 401 |
const Ioss::SideSetContainer &ssets = region->get_sidesets(); |
| 402 |
for (const auto &set : ssets) { |
| 403 |
// Add a SideSet corresponding to this SideSet/SideBlock |
| 404 |
Ioexnl::SideSet T(*set); |
| 405 |
sidesets.push_back(T); |
| 406 |
} |
| 407 |
} |
| 408 |
|
| 409 |
// Determine global counts... |
| 410 |
if (!file_per_processor) { |
| 411 |
get_global_counts(); |
| 412 |
} |
| 413 |
} |
| 414 |
|
| 415 |
void Mesh::get_global_counts() |
| 416 |
{ |
| 417 |
#if defined(SEACAS_HAVE_MPI) |
| 418 |
std::vector<int64_t> counts; |
| 419 |
std::vector<int64_t> global_counts; |
| 420 |
|
| 421 |
for (const auto &nodeblock : nodeblocks) { |
| 422 |
counts.push_back(nodeblock.localOwnedCount); |
| 423 |
} |
| 424 |
for (const auto &edgeblock : edgeblocks) { |
| 425 |
counts.push_back(edgeblock.entityCount); |
| 426 |
} |
| 427 |
for (const auto &faceblock : faceblocks) { |
| 428 |
counts.push_back(faceblock.entityCount); |
| 429 |
} |
| 430 |
for (const auto &elemblock : elemblocks) { |
| 431 |
counts.push_back(elemblock.entityCount); |
| 432 |
} |
| 433 |
for (const auto &nodeset : nodesets) { |
| 434 |
counts.push_back(nodeset.localOwnedCount); |
| 435 |
counts.push_back(nodeset.dfCount); |
| 436 |
} |
| 437 |
for (const auto &edgeset : edgesets) { |
| 438 |
counts.push_back(edgeset.entityCount); |
| 439 |
counts.push_back(edgeset.dfCount); |
| 440 |
} |
| 441 |
for (const auto &faceset : facesets) { |
| 442 |
counts.push_back(faceset.entityCount); |
| 443 |
counts.push_back(faceset.dfCount); |
| 444 |
} |
| 445 |
for (const auto &elemset : elemsets) { |
| 446 |
counts.push_back(elemset.entityCount); |
| 447 |
counts.push_back(elemset.dfCount); |
| 448 |
} |
| 449 |
for (const auto &sideset : sidesets) { |
| 450 |
counts.push_back(sideset.entityCount); |
| 451 |
counts.push_back(sideset.dfCount); |
| 452 |
} |
| 453 |
for (const auto &blob : blobs) { |
| 454 |
counts.push_back(blob.entityCount); |
| 455 |
} |
| 456 |
|
| 457 |
// Now gather this information on each processor so |
| 458 |
// they can determine the offsets and totals... |
| 459 |
global_counts.resize(counts.size() * parallelUtil.parallel_size()); |
| 460 |
|
| 461 |
MPI_Allgather(Data(counts), counts.size(), MPI_LONG_LONG_INT, Data(global_counts), counts.size(), |
| 462 |
MPI_LONG_LONG_INT, parallelUtil.communicator()); |
| 463 |
|
| 464 |
std::vector<int64_t> offsets(counts.size()); |
| 465 |
|
| 466 |
size_t my_proc = parallelUtil.parallel_rank(); |
| 467 |
size_t proc_count = parallelUtil.parallel_size(); |
| 468 |
|
| 469 |
// Calculate offsets for each entity on each processor |
| 470 |
for (size_t j = 0; j < offsets.size(); j++) { |
| 471 |
for (size_t i = 0; i < my_proc; i++) { |
| 472 |
offsets[j] += global_counts[i * offsets.size() + j]; |
| 473 |
} |
| 474 |
} |
| 475 |
|
| 476 |
// Now calculate the total count of entities over all processors |
| 477 |
for (size_t j = 0; j < offsets.size(); j++) { |
| 478 |
for (size_t i = 1; i < proc_count; i++) { |
| 479 |
global_counts[j] += global_counts[i * offsets.size() + j]; |
| 480 |
} |
| 481 |
} |
| 482 |
|
| 483 |
size_t j = 0; |
| 484 |
for (auto &nodeblock : nodeblocks) { |
| 485 |
nodeblock.procOffset = offsets[j]; |
| 486 |
nodeblock.entityCount = global_counts[j++]; |
| 487 |
} |
| 488 |
for (auto &edgeblock : edgeblocks) { |
| 489 |
edgeblock.procOffset = offsets[j]; |
| 490 |
edgeblock.entityCount = global_counts[j++]; |
| 491 |
} |
| 492 |
for (auto &faceblock : faceblocks) { |
| 493 |
faceblock.procOffset = offsets[j]; |
| 494 |
faceblock.entityCount = global_counts[j++]; |
| 495 |
} |
| 496 |
for (auto &elemblock : elemblocks) { |
| 497 |
elemblock.procOffset = offsets[j]; |
| 498 |
elemblock.entityCount = global_counts[j++]; |
| 499 |
} |
| 500 |
for (auto &nodeset : nodesets) { |
| 501 |
nodeset.procOffset = offsets[j]; |
| 502 |
nodeset.entityCount = global_counts[j++]; |
| 503 |
nodeset.dfCount = global_counts[j++]; |
| 504 |
if (nodeset.dfCount != 0) { |
| 505 |
// Need to adjust for locally-owned only in the auto-join output. |
| 506 |
nodeset.dfCount = nodeset.entityCount; |
| 507 |
} |
| 508 |
} |
| 509 |
for (auto &edgeset : edgesets) { |
| 510 |
edgeset.procOffset = offsets[j]; |
| 511 |
edgeset.entityCount = global_counts[j++]; |
| 512 |
edgeset.dfCount = global_counts[j++]; |
| 513 |
} |
| 514 |
for (auto &faceset : facesets) { |
| 515 |
faceset.procOffset = offsets[j]; |
| 516 |
faceset.entityCount = global_counts[j++]; |
| 517 |
faceset.dfCount = global_counts[j++]; |
| 518 |
} |
| 519 |
for (auto &elemset : elemsets) { |
| 520 |
elemset.procOffset = offsets[j]; |
| 521 |
elemset.entityCount = global_counts[j++]; |
| 522 |
elemset.dfCount = global_counts[j++]; |
| 523 |
} |
| 524 |
for (auto &sideset : sidesets) { |
| 525 |
sideset.procOffset = offsets[j]; |
| 526 |
sideset.entityCount = global_counts[j++]; |
| 527 |
sideset.dfProcOffset = offsets[j]; |
| 528 |
sideset.dfCount = global_counts[j++]; |
| 529 |
} |
| 530 |
for (auto &blob : blobs) { |
| 531 |
blob.procOffset = offsets[j]; |
| 532 |
blob.entityCount = global_counts[j++]; |
| 533 |
} |
| 534 |
#endif |
| 535 |
} |
| 536 |
|
| 537 |
namespace { |
| 538 |
template <typename T> int get_max_name_length(const std::vector<T> &entities, int old_max) |
| 539 |
{ |
| 540 |
for (const auto &entity : entities) { |
| 541 |
old_max = std::max(old_max, static_cast<int>(entity.name.size())); |
| 542 |
} |
| 543 |
return (old_max); |
| 544 |
} |
| 545 |
} // namespace |