--------------------- construct structure: nb of blocks per levels, and origin. Local origin is the min of all origins found: so we will get a Global Origin with a simple min reduction
| 67 | // Local origin is the min of all origins found: |
| 68 | // so we will get a Global Origin with a simple min reduction |
| 69 | void ConstructLocalInfo(const conduit_cpp::Node& node, LocalInfo& rankInfo) |
| 70 | { |
| 71 | double origin[3] = { 0, 0, 0 }; |
| 72 | |
| 73 | rankInfo.NbOfLeaves = node.number_of_children(); |
| 74 | |
| 75 | for (conduit_index_t cc = 0; cc < rankInfo.NbOfLeaves; ++cc) |
| 76 | { |
| 77 | const auto child = node.child(cc); |
| 78 | if (child.has_path("state")) |
| 79 | { |
| 80 | const int level = child["state/level"].to_int32(); |
| 81 | const int domain_id = child["state/domain_id"].to_int32(); |
| 82 | if (std::size_t(level) >= rankInfo.BlocksPerLevel.size()) |
| 83 | { |
| 84 | rankInfo.BlocksPerLevel.resize(level + 1); |
| 85 | rankInfo.BlocksPerLevel[level] = 0; |
| 86 | } |
| 87 | rankInfo.DomainBlockLevelIds[domain_id] = { level, rankInfo.BlocksPerLevel[level] }; |
| 88 | rankInfo.BlocksPerLevel[level]++; |
| 89 | |
| 90 | origin[0] = child["coordsets/coords/origin/x"].to_float64(); |
| 91 | origin[1] = child["coordsets/coords/origin/y"].to_float64(); |
| 92 | origin[2] = child["coordsets/coords/origin/z"].to_float64(); |
| 93 | // check global origin |
| 94 | if (origin[0] <= rankInfo.Origin[0] && origin[1] <= rankInfo.Origin[1] && |
| 95 | origin[2] <= rankInfo.Origin[2]) |
| 96 | { |
| 97 | rankInfo.Origin[0] = origin[0]; |
| 98 | rankInfo.Origin[1] = origin[1]; |
| 99 | rankInfo.Origin[2] = origin[2]; |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | // --------------------- |
| 106 | // MPI comm: reduce nb of levels, blocks and origin |
no test coverage detected