EBGeometry 1.0
Loading...
Searching...
No Matches
EBGeometry_Parser.hpp
Go to the documentation of this file.
1/* EBGeometry
2 * Copyright © 2022 Robert Marskar
3 * Please refer to Copyright.txt and LICENSE in the EBGeometry root directory.
4 */
5
13#ifndef EBGeometry_Parser
14#define EBGeometry_Parser
15
16// Std includes
17#include <vector>
18#include <memory>
19#include <map>
20
21// Our includes
26#include "EBGeometry_PLY.hpp"
27#include "EBGeometry_STL.hpp"
28#include "EBGeometry_VTK.hpp"
30
35namespace Parser {
36
40 enum class Encoding
41 {
42 ASCII,
43 Binary,
44 Unknown
45 };
46
50 enum class FileType
51 {
52 STL,
53 PLY,
54 VTK,
55 Unsupported
56 };
57
62 inline static Parser::FileType
63 getFileType(const std::string a_filename) noexcept;
64
69 inline static Parser::Encoding
70 getFileEncoding(const std::string a_filename) noexcept;
71
76 template <typename T>
77 PLY<T>
78 readPLY(const std::string& a_filename) noexcept;
79
84 template <typename T>
85 std::vector<PLY<T>>
86 readPLY(const std::vector<std::string>& a_filenames) noexcept;
87
94 template <typename T>
95 STL<T>
96 readSTL(const std::string& a_filename) noexcept;
97
104 template <typename T>
105 std::vector<STL<T>>
106 readSTL(const std::vector<std::string>& a_filenames) noexcept;
107
112 template <typename T>
113 VTK<T>
114 readVTK(const std::string& a_filename) noexcept;
115
120 template <typename T>
121 std::vector<VTK<T>>
122 readVTK(const std::vector<std::string>& a_filenames) noexcept;
123
128 template <typename T, typename Meta = DCEL::DefaultMetaData>
129 inline static std::shared_ptr<EBGeometry::DCEL::MeshT<T, Meta>>
130 readIntoDCEL(const std::string a_filename) noexcept;
131
136 template <typename T, typename Meta = DCEL::DefaultMetaData>
137 inline static std::vector<std::shared_ptr<EBGeometry::DCEL::MeshT<T, Meta>>>
138 readIntoDCEL(const std::vector<std::string> a_files) noexcept;
139
144 template <typename T, typename Meta = DCEL::DefaultMetaData>
145 inline static std::shared_ptr<MeshSDF<T, Meta>>
146 readIntoMesh(const std::string a_filename) noexcept;
147
152 template <typename T, typename Meta = DCEL::DefaultMetaData>
153 inline static std::vector<std::shared_ptr<MeshSDF<T, Meta>>>
154 readIntoMesh(const std::vector<std::string> a_files) noexcept;
155
160 template <typename T,
161 typename Meta = DCEL::DefaultMetaData,
162 typename BV = EBGeometry::BoundingVolumes::AABBT<T>,
163 size_t K = 4>
164 inline static std::shared_ptr<FastMeshSDF<T, Meta, BV, K>>
165 readIntoFullBVH(const std::string a_filename) noexcept;
166
171 template <typename T,
172 typename Meta = DCEL::DefaultMetaData,
173 typename BV = EBGeometry::BoundingVolumes::AABBT<T>,
174 size_t K = 4>
175 inline static std::vector<std::shared_ptr<FastMeshSDF<T, Meta, BV, K>>>
176 readIntoFullBVH(const std::vector<std::string> a_files) noexcept;
177
182 template <typename T,
183 typename Meta = DCEL::DefaultMetaData,
184 typename BV = EBGeometry::BoundingVolumes::AABBT<T>,
185 size_t K = 4>
186 inline static std::shared_ptr<FastCompactMeshSDF<T, Meta, BV, K>>
187 readIntoLinearBVH(const std::string a_filename) noexcept;
188
193 template <typename T,
194 typename Meta = DCEL::DefaultMetaData,
195 typename BV = EBGeometry::BoundingVolumes::AABBT<T>,
196 size_t K = 4>
197 inline static std::vector<std::shared_ptr<FastCompactMeshSDF<T, Meta, BV, K>>>
198 readIntoLinearBVH(const std::vector<std::string> a_files) noexcept;
199
204 template <typename T, typename Meta, typename BV = EBGeometry::BoundingVolumes::AABBT<T>, size_t K = 4>
205 inline static std::shared_ptr<FastTriMeshSDF<T, Meta, BV, K>>
206 readIntoTriangleBVH(const std::string a_filename) noexcept;
207
212 template <typename T,
213 typename Meta = DCEL::DefaultMetaData,
214 typename BV = EBGeometry::BoundingVolumes::AABBT<T>,
215 size_t K = 4>
216 inline static std::vector<std::shared_ptr<FastMeshSDF<T, Meta, BV, K>>>
217 readIntoTriangleBVH(const std::vector<std::string> a_files) noexcept;
218
223 template <typename T, typename Meta>
224 inline static std::vector<std::shared_ptr<Triangle<T, Meta>>>
225 readIntoTriangles(const std::string a_filename) noexcept;
226
231 template <typename T, typename Meta>
232 inline static std::vector<std::vector<std::shared_ptr<Triangle<T, Meta>>>>
233 readIntoTriangles(const std::vector<std::string> a_files) noexcept;
234} // namespace Parser
235
237
238#include "EBGeometry_ParserImplem.hpp"
239
240#endif
Declaration of a various bounding volumes used for bounding volume hierarchy.
Declaration of a mesh class which stores a DCEL mesh (with signed distance functions)
Declaration of signed distance functions for DCEL meshes.
Declaration of a triangle class with signed distance functionality.
Class for storing Stanford PLY meshes.
Definition EBGeometry_PLY.hpp:23
Class for storing contents of STL files.
Definition EBGeometry_STL.hpp:25
Class for storing VTK Polydata meshes.
Definition EBGeometry_VTK.hpp:24
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:218
short DefaultMetaData
Default meta-data type for the DCEL primitives.
Definition EBGeometry_DCEL.hpp:27
Namespace which encapsulates possible file parsers for building EBGeometry data structures.
Definition EBGeometry_Parser.hpp:35
Encoding
Simple enum for separating ASCII and binary files.
Definition EBGeometry_Parser.hpp:41
FileType
Various supported file types.
Definition EBGeometry_Parser.hpp:51
PLY< T > readPLY(const std::string &a_filename) noexcept
Read a single PLY file.
STL< T > readSTL(const std::string &a_filename) noexcept
Read a single STL file.
VTK< T > readVTK(const std::string &a_filename) noexcept
Read a single VTK file.