diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index b7d1bd6192..48b1fed3b2 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -409,11 +409,11 @@ if(HDF5_SUPPORT) "${HDF5_LIBRARY_DIR}/libaec.lib") ELSE() SET(HDF5_LIBRARIES - "${HDF5_LIBRARY_DIR}/hdf5_cpp.lib" - "${HDF5_LIBRARY_DIR}/hdf5.lib" - "${HDF5_LIBRARY_DIR}/libzlib.lib" - "${HDF5_LIBRARY_DIR}/libsz.lib" - "${HDF5_LIBRARY_DIR}/libaec.lib" + "${HDF5_LIBRARY_DIR}/hdf5_cpp.a" + "${HDF5_LIBRARY_DIR}/hdf5.a" + "${HDF5_LIBRARY_DIR}/libzlib.a" + "${HDF5_LIBRARY_DIR}/libsz.a" + "${HDF5_LIBRARY_DIR}/libaec.a" zlib) ENDIF() endif() diff --git a/src/ifcconvert/IfcConvert.cpp b/src/ifcconvert/IfcConvert.cpp index a77c5364df..310261c24f 100644 --- a/src/ifcconvert/IfcConvert.cpp +++ b/src/ifcconvert/IfcConvert.cpp @@ -627,11 +627,11 @@ int main(int argc, char** argv) { path_t output_temp_filename = output_filename + IfcUtil::path::from_utf8(TEMP_FILE_EXTENSION); - std::vector tokens; + std::vector tokens; split(tokens, output_filename, boost::is_any_of(".")); - std::vector::iterator tok_iter; - std::wstring ext = *(tokens.end() - 1); - std::wstring dot; + std::vector::iterator tok_iter; + path_t ext = *(tokens.end() - 1); + path_t dot; dot = '.'; path_t output_extension = dot + ext; @@ -806,7 +806,6 @@ int main(int argc, char** argv) { serializer = boost::make_shared(IfcUtil::path::to_utf8(output_temp_filename), settings); } else if (output_extension == HDF) { - const path_t mtl_filename = change_extension(output_filename, MTL); settings.set(IfcGeom::IteratorSettings::DISABLE_TRIANGULATION, true); serializer = boost::make_shared(IfcUtil::path::to_utf8(output_temp_filename), settings); } diff --git a/src/serializers/HdfSerializer.cpp b/src/serializers/HdfSerializer.cpp index d9663cf8f4..b870ead846 100644 --- a/src/serializers/HdfSerializer.cpp +++ b/src/serializers/HdfSerializer.cpp @@ -28,14 +28,6 @@ #include -typedef struct s1_t { - int a, b, c; -} s1_t; - - -typedef struct s2_t { - double a, b, c; -} s2_t; HdfSerializer::HdfSerializer(const std::string& hdf_filename, const SerializerSettings& settings) : GeometrySerializer(settings) @@ -44,40 +36,9 @@ HdfSerializer::HdfSerializer(const std::string& hdf_filename, const SerializerSe , DATASET_NAME_NORMALS("Normals") , DATASET_NAME_INDICES("Indices") , DATASET_NAME_OCCT("OCCT Text") - , mtype1(sizeof(s1_t)) - , mtype2(sizeof(s2_t)) - , mtype3(sizeof(s1_t)) - { guids = {}; - - H5::IntType Intdatatype(H5::PredType::NATIVE_INT); - H5::FloatType datatype(H5::PredType::NATIVE_DOUBLE); - datatype.setOrder(H5T_ORDER_LE); - Intdatatype.setOrder(H5T_ORDER_LE); - - const H5std_string MEMBER1("V1"); - const H5std_string MEMBER2("V2"); - const H5std_string MEMBER3("V3"); - mtype1.insertMember(MEMBER1, HOFFSET(s1_t, a), H5::PredType::NATIVE_INT); - mtype1.insertMember(MEMBER2, HOFFSET(s1_t, c), H5::PredType::NATIVE_INT); - mtype1.insertMember(MEMBER3, HOFFSET(s1_t, b), H5::PredType::NATIVE_INT); - - const H5std_string POS1("X"); - const H5std_string POS2("Y"); - const H5std_string POS3("Z"); - mtype2.insertMember(POS1, HOFFSET(s2_t, a), datatype); - mtype2.insertMember(POS2, HOFFSET(s2_t, b), datatype); - mtype2.insertMember(POS3, HOFFSET(s2_t, c), datatype); - - const H5std_string NOR1("X"); - const H5std_string NOR2("Y"); - const H5std_string NOR3("Z"); - mtype3.insertMember(NOR1, HOFFSET(s1_t, a), Intdatatype); - mtype3.insertMember(NOR2, HOFFSET(s1_t, b), Intdatatype); - mtype3.insertMember(NOR3, HOFFSET(s1_t, c), Intdatatype); - } @@ -123,8 +84,8 @@ void HdfSerializer::write(const IfcGeom::BRepElement* o) { guids.insert(guid); elementGroup = file.createGroup(guid); - meshGroup = elementGroup.createGroup("Triangle Mesh"); + meshGroup = elementGroup.createGroup("Triangle Mesh"); OCCTGroup = elementGroup.createGroup("OCCT Data"); H5::StrType str_type(0, H5T_VARIABLE); @@ -135,12 +96,12 @@ void HdfSerializer::write(const IfcGeom::BRepElement* o) { const int RANK = 2; hsize_t dimsf[2]; dimsf[0] = vcount; - dimsf[1] = 1; + dimsf[1] = 3; H5::DataSpace dataspace(RANK, dimsf); hsize_t dimsfaces[2]; dimsfaces[0] = fcount; - dimsfaces[1] = 1; + dimsfaces[1] = 3; H5::DataSpace face_dataspace(RANK, dimsfaces); const int RANK_OCCT = 1; @@ -151,57 +112,14 @@ void HdfSerializer::write(const IfcGeom::BRepElement* o) { OCCTDataset = OCCTGroup.createDataSet(DATASET_NAME_OCCT, str_type, occt_dataspace); OCCTDataset.write(brep_data, str_type); - indicesDataset = meshGroup.createDataSet(DATASET_NAME_INDICES, mtype1, face_dataspace); - positionsDataset = meshGroup.createDataSet(DATASET_NAME_POSITIONS, mtype2, dataspace); - normalsDataset = meshGroup.createDataSet(DATASET_NAME_NORMALS, mtype3, dataspace); - - for (std::vector::const_iterator it = mesh.verts().begin(); it != mesh.verts().end(); ) { - const real_t x = *(it++); - const real_t y = *(it++); - const real_t z = *(it++); - - if (isyup) { - double_data_container.push_back(x); - double_data_container.push_back(z); - double_data_container.push_back(-y); - - } else { - double_data_container.push_back(x); - double_data_container.push_back(y); - double_data_container.push_back(z); - - } + indicesDataset = meshGroup.createDataSet(DATASET_NAME_INDICES, H5::PredType::NATIVE_INT, face_dataspace); + positionsDataset = meshGroup.createDataSet(DATASET_NAME_POSITIONS, H5::PredType::NATIVE_DOUBLE, dataspace); + normalsDataset = meshGroup.createDataSet(DATASET_NAME_NORMALS, H5::PredType::NATIVE_DOUBLE, dataspace); + positionsDataset.write(mesh.verts().data(), H5::PredType::NATIVE_DOUBLE); + normalsDataset.write(mesh.normals().data(), H5::PredType::NATIVE_DOUBLE); + indicesDataset.write(mesh.faces().data(), H5::PredType::NATIVE_INT); - } - positionsDataset.write(double_data_container.data(), mtype2); - double_data_container.clear(); - - - for (std::vector::const_iterator it = mesh.normals().begin(); it != mesh.normals().end(); ) { - const real_t x = *(it++); - const real_t y = *(it++); - const real_t z = *(it++); - int_data_container.push_back((int)x); - int_data_container.push_back((int)y); - int_data_container.push_back((int)z); - - } - normalsDataset.write(int_data_container.data(), mtype3); - int_data_container.clear(); - - - for (std::vector::const_iterator it = mesh.faces().begin(); it != mesh.faces().end(); ) { - const real_t x = *(it++); - const real_t y = *(it++); - const real_t z = *(it++); - int_data_container.push_back(x); - int_data_container.push_back(y); - int_data_container.push_back(z); - - } - indicesDataset.write(int_data_container.data(), mtype1); - int_data_container.clear(); diff --git a/src/serializers/HdfSerializer.h b/src/serializers/HdfSerializer.h index 03a1b08ceb..3bffcde799 100644 --- a/src/serializers/HdfSerializer.h +++ b/src/serializers/HdfSerializer.h @@ -28,22 +28,17 @@ #include "../serializers/GeometrySerializer.h" -// http://people.sc.fsu.edu/~jburkardt/txt/obj_format.txt + class HdfSerializer : public GeometrySerializer { private: const std::string hdf_filename; unsigned int vcount_total; H5::H5File file; std::set guids; - std::vector double_data_container; - std::vector int_data_container; const H5std_string DATASET_NAME_POSITIONS; const H5std_string DATASET_NAME_NORMALS; const H5std_string DATASET_NAME_INDICES; const H5std_string DATASET_NAME_OCCT; - H5::CompType mtype1; - H5::CompType mtype2; - H5::CompType mtype3; public: