MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / read

Method read

src/serializers/HdfSerializer.cpp:266–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266IfcGeom::Element* HdfSerializer::read(IfcParse::IfcFile& f, const std::string& guid, const std::string& representation_id_str, read_type rt) {
267 if (!H5Lexists(file.getId(), guid.c_str(), H5P_DEFAULT)) {
268 return nullptr;
269 }
270
271 auto element_group = file.openGroup(guid);
272 if (!H5Lexists(element_group.getId(), representation_id_str.c_str(), H5P_DEFAULT)) {
273 return nullptr;
274 }
275
276 int id = read_scalar_attribute<int>(element_group, "id");
277 int parent_id = read_scalar_attribute<int>(element_group, "parent_id");
278 std::string type = read_scalar_attribute<std::string>(element_group, "type");
279 std::string name = read_scalar_attribute<std::string>(element_group, "name");
280 std::string context = read_scalar_attribute<std::string>(element_group, "context");
281 std::string unique_id = read_scalar_attribute<std::string>(element_group, "unique_id");
282
283 auto trsf = ifcopenshell::geometry::taxonomy::make<ifcopenshell::geometry::taxonomy::matrix4>();
284 auto placeds = element_group.openDataSet(DATASET_NAME_PLACEMENT);
285 double m44[4][4];
286 placeds.read(m44, H5::PredType::NATIVE_DOUBLE);
287 // @todo check
288 trsf->components() << Eigen::Map<Eigen::Matrix4d>(&m44[0][0]);
289
290 auto representation_group = element_group.openGroup(representation_id_str);
291 std::string geom_id = read_scalar_attribute<std::string>(representation_group, "geom_id");
292
293 auto inst = f.instance_by_id(id)->as<IfcUtil::IfcBaseEntity>();
294
295 boost::shared_ptr<IfcGeom::Representation::BRep> brep_geometry;
296 boost::shared_ptr<IfcGeom::Representation::Triangulation> triangulation_geometry;
297
298 if (rt == READ_BREP) {
299 auto it = brep_cache_.find(representation_id_str);
300 if (it != brep_cache_.end()) {
301 brep_geometry = it->second;
302 }
303 } else {
304 auto it = triangulation_cache_.find(representation_id_str);
305 if (it != triangulation_cache_.end()) {
306 triangulation_geometry = it->second;
307 }
308 }
309
310 if (rt == READ_BREP && !brep_geometry) {
311 auto brepDataset = representation_group.openDataSet(DATASET_NAME_OCCT);
312
313 /*
314 // @todo
315
316 static const auto ignored_settings =
317 // Settings that do not affect storage of brep data
318 IfcGeom::IteratorSettings::DISABLE_TRIANGULATION | IfcGeom::IteratorSettings::USE_BREP_DATA |
319 // Settings that affect which representation is considered, but cache does not need to be complete
320 IfcGeom::IteratorSettings::INCLUDE_CURVES | IfcGeom::IteratorSettings::EXCLUDE_SOLIDS_AND_SURFACES |
321 // Only affects triangulation
322 IfcGeom::IteratorSettings::WELD_VERTICES | IfcGeom::IteratorSettings::NO_NORMALS |
323 IfcGeom::IteratorSettings::GENERATE_UVS | IfcGeom::IteratorSettings::EDGE_ARROWS |

Callers 2

do_readFunction · 0.45
read_datasetFunction · 0.45

Calls 10

ConversionResultFunction · 0.85
dataMethod · 0.80
resizeMethod · 0.80
push_backMethod · 0.80
ElementClass · 0.50
instance_by_idMethod · 0.45
findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected