--------------------- Fill local data
| 187 | // --------------------- |
| 188 | // Fill local data |
| 189 | void FillLocalData(const conduit_cpp::Node& child, const LocalInfo& rankInfo, |
| 190 | const GlobalInfo& globalInfo, vtkOverlappingAMR* amr) |
| 191 | { |
| 192 | double origin[3]; |
| 193 | double spacing[3]; |
| 194 | |
| 195 | if (!child.has_path("state")) |
| 196 | { |
| 197 | return; |
| 198 | } |
| 199 | |
| 200 | int pdims[3] = { 0, 0, 0 }; |
| 201 | const int domain_id = child["state/domain_id"].to_int32(); |
| 202 | const int level = child["state/level"].to_int32(); |
| 203 | |
| 204 | origin[0] = child["coordsets/coords/origin/x"].to_float64(); |
| 205 | origin[1] = child["coordsets/coords/origin/y"].to_float64(); |
| 206 | origin[2] = child["coordsets/coords/origin/z"].to_float64(); |
| 207 | spacing[0] = child["coordsets/coords/spacing/dx"].to_float64(); |
| 208 | spacing[1] = child["coordsets/coords/spacing/dy"].to_float64(); |
| 209 | spacing[2] = child["coordsets/coords/spacing/dz"].to_float64(); |
| 210 | pdims[0] = child["coordsets/coords/dims/i"].to_int32(); |
| 211 | pdims[1] = child["coordsets/coords/dims/j"].to_int32(); |
| 212 | pdims[2] = child["coordsets/coords/dims/k"].to_int32(); |
| 213 | |
| 214 | vtkNew<vtkUniformGrid> ug; |
| 215 | ug->Initialize(); |
| 216 | ug->SetOrigin(origin); |
| 217 | ug->SetSpacing(spacing); |
| 218 | ug->SetDimensions(pdims); |
| 219 | |
| 220 | if (child.has_path("fields")) |
| 221 | { |
| 222 | const auto fields = child["fields"]; |
| 223 | vtkConduitToDataObject::AddFieldData(ug, fields, true); |
| 224 | } |
| 225 | |
| 226 | vtkAMRBox box(origin, pdims, spacing, globalInfo.Origin, amr->GetGridDescription()); |
| 227 | // set level spacing |
| 228 | amr->SetSpacing(level, spacing); |
| 229 | amr->SetAMRBox( |
| 230 | level, rankInfo.DomainBlockLevelIds.at(domain_id).second + rankInfo.BlockOffsets[level], box); |
| 231 | amr->SetDataSet( |
| 232 | level, rankInfo.DomainBlockLevelIds.at(domain_id).second + rankInfo.BlockOffsets[level], ug); |
| 233 | |
| 234 | if (child.has_path("nestsets/nest/windows")) |
| 235 | { |
| 236 | const auto& windows = child["nestsets/nest/windows"]; |
| 237 | const auto window_count = windows.number_of_children(); |
| 238 | for (int i = 0; i < window_count; ++i) |
| 239 | { |
| 240 | const auto& window = windows.child(i); |
| 241 | if (window.has_path("ratio") && window.has_path("domain_type")) |
| 242 | { |
| 243 | amr->SetRefinementRatio(level, window["ratio/i"].to_int32()); |
| 244 | break; |
| 245 | } |
| 246 | } |
no test coverage detected