From c75ee14b6205de68c6f5a9a2cdffb1328b3a53dd Mon Sep 17 00:00:00 2001 From: Sam Jenkins <s.jenkins@stfc.ac.uk> Date: Tue, 16 Oct 2018 17:07:52 +0100 Subject: [PATCH] Re #23807 Updated Mesh and loadstl to allow larger files --- .../inc/MantidDataHandling/LoadStl.h | 11 +++--- Framework/DataHandling/src/LoadBinaryStl.cpp | 20 +++++++++-- .../src/LoadSampleEnvironment.cpp | 6 ++-- .../DataHandling/src/LoadSampleShape.cpp | 34 +++++++++---------- Framework/DataHandling/src/LoadStl.cpp | 7 ++-- .../inc/MantidGeometry/Objects/MeshObject.h | 6 ++-- .../inc/MantidGeometry/Objects/MeshObject2D.h | 6 ++-- Framework/Geometry/src/Objects/MeshObject.cpp | 4 +-- .../Geometry/src/Objects/MeshObject2D.cpp | 4 +-- .../Geometry/src/Objects/MeshObjectCommon.cpp | 4 +-- .../MantidNexusGeometry/NexusShapeFactory.h | 10 +++--- .../NexusGeometry/src/NexusGeometryParser.cpp | 34 +++++++++---------- .../NexusGeometry/src/NexusShapeFactory.cpp | 26 +++++++------- 13 files changed, 95 insertions(+), 77 deletions(-) diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadStl.h b/Framework/DataHandling/inc/MantidDataHandling/LoadStl.h index ee78eafd159..2310c6ec5eb 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadStl.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadStl.h @@ -1,8 +1,11 @@ #ifndef MANTID_DATAHANDLING_LOADSTL_H_ #define MANTID_DATAHANDLING_LOADSTL_H_ #include "MantidGeometry/Objects/MeshObject.h" -#include <MantidKernel/V3D.h> - +#include "MantidKernel/V3D.h" +#include "MantidKernel/Logger.h" +namespace{ + Mantid::Kernel::Logger g_logstl("LoadStl"); +} namespace Mantid { namespace DataHandling { @@ -12,10 +15,10 @@ public: virtual std::unique_ptr<Geometry::MeshObject> readStl() = 0; protected: - uint16_t addSTLVertex(Kernel::V3D &vertex); + size_t addSTLVertex(Kernel::V3D &vertex); bool areEqualVertices(Kernel::V3D const &v1, Kernel::V3D const &v2); std::string m_filename; - std::vector<uint16_t> m_triangle; + std::vector<uint32_t> m_triangle; std::vector<Kernel::V3D> m_verticies; }; diff --git a/Framework/DataHandling/src/LoadBinaryStl.cpp b/Framework/DataHandling/src/LoadBinaryStl.cpp index 36992f6f12b..06063ae2ec0 100644 --- a/Framework/DataHandling/src/LoadBinaryStl.cpp +++ b/Framework/DataHandling/src/LoadBinaryStl.cpp @@ -1,7 +1,8 @@ #include "MantidDataHandling/LoadBinaryStl.h" #include <Poco/File.h> #include <fstream> - +#include <string> +#include "MantidKernel/MultiThreaded.h" namespace Mantid { namespace DataHandling { @@ -46,13 +47,18 @@ std::unique_ptr<Geometry::MeshObject> LoadBinaryStl::readStl() { uint32_t nextToRead = HEADER_SIZE + TRIANGLE_COUNT_DATA_SIZE + VECTOR_DATA_SIZE; // now read in all the triangles - + m_triangle.reserve(3*numberTrianglesLong); + m_verticies.reserve(3*numberTrianglesLong); for (uint32_t i = 0; i < numberTrianglesLong; i++) { + g_logstl.debug(std::to_string(i+1)); // find next triangle, skipping the normal and attribute streamReader.moveStreamToPosition(nextToRead); readTriangle(streamReader); nextToRead += TRIANGLE_DATA_SIZE; } + m_verticies.shrink_to_fit(); + m_triangle.shrink_to_fit(); + g_logstl.debug("Read All"); myFile.close(); std::unique_ptr<Geometry::MeshObject> retVal = std::unique_ptr<Geometry::MeshObject>(new Geometry::MeshObject( @@ -63,16 +69,24 @@ std::unique_ptr<Geometry::MeshObject> LoadBinaryStl::readStl() { void LoadBinaryStl::readTriangle(Kernel::BinaryStreamReader streamReader) { // read in the verticies + //g_logstl.debug(std::to_string(m_triangle.size())); + //g_logstl.debug(std::to_string(m_triangle.capacity())); + //g_logstl.debug(std::to_string(m_verticies.capacity())); for (int i = 0; i < 3; i++) { float xVal; float yVal; float zVal; streamReader >> xVal; + //g_logstl.debug("Read V1"); streamReader >> yVal; + //g_logstl.debug("Read V2"); streamReader >> zVal; + //g_logstl.debug("Read V3"); Kernel::V3D vec = Kernel::V3D(double(xVal), double(yVal), double(zVal)); // add index of new vertex to triangle - m_triangle.push_back(addSTLVertex(vec)); + m_triangle.emplace_back(addSTLVertex(vec)); + //g_logstl.debug("Add"); + } } diff --git a/Framework/DataHandling/src/LoadSampleEnvironment.cpp b/Framework/DataHandling/src/LoadSampleEnvironment.cpp index c622b6efd1e..4836c88c37f 100644 --- a/Framework/DataHandling/src/LoadSampleEnvironment.cpp +++ b/Framework/DataHandling/src/LoadSampleEnvironment.cpp @@ -86,10 +86,10 @@ void LoadSampleEnvironment::exec() { auto asciiStlReader = LoadAsciiStl(filename); auto binaryStlReader = LoadBinaryStl(filename); - if (asciiStlReader.isAsciiSTL()) { - environmentMesh = asciiStlReader.readStl(); - } else if (binaryStlReader.isBinarySTL()) { + if (binaryStlReader.isBinarySTL()) { environmentMesh = binaryStlReader.readStl(); + } else if (asciiStlReader.isAsciiSTL()) { + environmentMesh = asciiStlReader.readStl(); } else { throw Kernel::Exception::ParseError( "Could not read file, did not match either STL Format", filename, 0); diff --git a/Framework/DataHandling/src/LoadSampleShape.cpp b/Framework/DataHandling/src/LoadSampleShape.cpp index 22e65d11435..302d9212d01 100644 --- a/Framework/DataHandling/src/LoadSampleShape.cpp +++ b/Framework/DataHandling/src/LoadSampleShape.cpp @@ -50,10 +50,10 @@ bool getOFFline(std::ifstream &file, std::string &line) { return true; } -void readOFFVertices(std::ifstream &file, uint16_t nVertices, +void readOFFVertices(std::ifstream &file, uint32_t nVertices, std::vector<V3D> &vertices) { std::string line; - for (uint16_t i = 0; i < nVertices; i++) { + for (uint32_t i = 0; i < nVertices; i++) { if (getOFFline(file, line)) { std::vector<std::string> tokens; boost::split(tokens, line, boost::is_any_of(" "), @@ -72,12 +72,12 @@ void readOFFVertices(std::ifstream &file, uint16_t nVertices, } } -void readOFFTriangles(std::ifstream &file, uint16_t nTriangles, - std::vector<uint16_t> &triangleIndices) { +void readOFFTriangles(std::ifstream &file, uint32_t nTriangles, + std::vector<uint32_t> &triangleIndices) { std::string line; - uint16_t t1, t2, t3; + uint32_t t1, t2, t3; size_t nFaceVertices; - for (uint16_t i = 0; i < nTriangles; i++) { + for (uint32_t i = 0; i < nTriangles; i++) { if (getOFFline(file, line)) { std::vector<std::string> tokens; boost::split(tokens, line, boost::is_any_of(" "), @@ -85,9 +85,9 @@ void readOFFTriangles(std::ifstream &file, uint16_t nTriangles, if (tokens.size() >= 4) { nFaceVertices = boost::lexical_cast<size_t>(tokens[0]); if (nFaceVertices == 3) { - t1 = boost::lexical_cast<uint16_t>(tokens[1]); - t2 = boost::lexical_cast<uint16_t>(tokens[2]); - t3 = boost::lexical_cast<uint16_t>(tokens[3]); + t1 = boost::lexical_cast<uint32_t>(tokens[1]); + t2 = boost::lexical_cast<uint32_t>(tokens[2]); + t3 = boost::lexical_cast<uint32_t>(tokens[3]); } else { throw std::runtime_error("OFF face is not a triangle."); } @@ -105,10 +105,10 @@ void readOFFTriangles(std::ifstream &file, uint16_t nTriangles, } std::unique_ptr<MeshObject> readOFFMeshObject(std::ifstream &file) { - std::vector<uint16_t> triangleIndices; + std::vector<uint32_t> triangleIndices; std::vector<V3D> vertices; - uint16_t nVertices; - uint16_t nTriangles; + uint32_t nVertices; + uint32_t nTriangles; std::string line; // Get number of vetrtices and faces @@ -117,8 +117,8 @@ std::unique_ptr<MeshObject> readOFFMeshObject(std::ifstream &file) { boost::split(tokens, line, boost::is_any_of(" "), boost::token_compress_on); if (tokens.size() == 3) { try { - nVertices = boost::lexical_cast<uint16_t>(tokens[0]); - nTriangles = boost::lexical_cast<uint16_t>(tokens[1]); + nVertices = boost::lexical_cast<uint32_t>(tokens[0]); + nTriangles = boost::lexical_cast<uint32_t>(tokens[1]); } catch (...) { throw std::runtime_error("Error in reading numbers of OFF vertices and " "triangles, which may be too large"); @@ -203,10 +203,10 @@ void LoadSampleShape::exec() { } else /* stl */ { auto asciiStlReader = LoadAsciiStl(filename); auto binaryStlReader = LoadBinaryStl(filename); - if (asciiStlReader.isAsciiSTL()) { - shape = asciiStlReader.readStl(); - } else if (binaryStlReader.isBinarySTL()) { + if (binaryStlReader.isBinarySTL()) { shape = binaryStlReader.readStl(); + } else if (asciiStlReader.isAsciiSTL()) { + shape = asciiStlReader.readStl(); } else { throw Kernel::Exception::ParseError( "Could not read file, did not match either STL Format", filename, 0); diff --git a/Framework/DataHandling/src/LoadStl.cpp b/Framework/DataHandling/src/LoadStl.cpp index f075134197b..2a60e8e57fe 100644 --- a/Framework/DataHandling/src/LoadStl.cpp +++ b/Framework/DataHandling/src/LoadStl.cpp @@ -5,15 +5,16 @@ namespace Mantid { namespace DataHandling { // Adds vertex to list if distinct and returns index to vertex added or equal -uint16_t LoadStl::addSTLVertex(Kernel::V3D &vertex) { - for (uint16_t i = 0; i < m_verticies.size(); ++i) { +size_t LoadStl::addSTLVertex(Kernel::V3D &vertex) { + for (size_t i = 0; i < m_verticies.size(); ++i) { if (areEqualVertices(vertex, m_verticies[i])) { return i; } } m_verticies.emplace_back(vertex); - uint16_t index = static_cast<uint16_t>(m_verticies.size() - 1); + size_t index = (m_verticies.size() - 1); if (index != m_verticies.size() - 1) { + throw std::runtime_error("Too many vertices in solid"); } return index; diff --git a/Framework/Geometry/inc/MantidGeometry/Objects/MeshObject.h b/Framework/Geometry/inc/MantidGeometry/Objects/MeshObject.h index e57513c99a6..fad67dc62c2 100644 --- a/Framework/Geometry/inc/MantidGeometry/Objects/MeshObject.h +++ b/Framework/Geometry/inc/MantidGeometry/Objects/MeshObject.h @@ -49,11 +49,11 @@ Mesh2DObject class MANTID_GEOMETRY_DLL MeshObject : public IObject { public: /// Constructor - MeshObject(const std::vector<uint16_t> &faces, + MeshObject(const std::vector<uint32_t> &faces, const std::vector<Kernel::V3D> &vertices, const Kernel::Material &material); /// Constructor - MeshObject(std::vector<uint16_t> &&faces, std::vector<Kernel::V3D> &&vertices, + MeshObject(std::vector<uint32_t> &&faces, std::vector<Kernel::V3D> &&vertices, const Kernel::Material &&material); /// Copy constructor @@ -170,7 +170,7 @@ private: /// Contents /// Triangles are specified by indices into a list of vertices. - std::vector<uint16_t> m_triangles; + std::vector<uint32_t> m_triangles; std::vector<Kernel::V3D> m_vertices; /// material composition Kernel::Material m_material; diff --git a/Framework/Geometry/inc/MantidGeometry/Objects/MeshObject2D.h b/Framework/Geometry/inc/MantidGeometry/Objects/MeshObject2D.h index e1374a0994e..19392be677a 100644 --- a/Framework/Geometry/inc/MantidGeometry/Objects/MeshObject2D.h +++ b/Framework/Geometry/inc/MantidGeometry/Objects/MeshObject2D.h @@ -31,11 +31,11 @@ class GeometryHandler; class MANTID_GEOMETRY_DLL MeshObject2D : public IObject { public: /// Constructor - MeshObject2D(const std::vector<uint16_t> &faces, + MeshObject2D(const std::vector<uint32_t> &faces, const std::vector<Kernel::V3D> &vertices, const Kernel::Material &material); /// Constructor - MeshObject2D(std::vector<uint16_t> &&faces, + MeshObject2D(std::vector<uint32_t> &&faces, std::vector<Kernel::V3D> &&vertices, const Kernel::Material &&material); @@ -97,7 +97,7 @@ private: void initialize(); /// Triangles are specified by indices into a list of vertices. Offset is /// always 3. - std::vector<uint16_t> m_triangles; + std::vector<uint32_t> m_triangles; /// Vertices std::vector<Kernel::V3D> m_vertices; /// Material composition diff --git a/Framework/Geometry/src/Objects/MeshObject.cpp b/Framework/Geometry/src/Objects/MeshObject.cpp index 138d52abb85..0f67e20ba12 100644 --- a/Framework/Geometry/src/Objects/MeshObject.cpp +++ b/Framework/Geometry/src/Objects/MeshObject.cpp @@ -20,7 +20,7 @@ namespace Mantid { namespace Geometry { -MeshObject::MeshObject(const std::vector<uint16_t> &faces, +MeshObject::MeshObject(const std::vector<uint32_t> &faces, const std::vector<Kernel::V3D> &vertices, const Kernel::Material &material) : m_boundingBox(), m_id("MeshObject"), m_triangles(faces), @@ -29,7 +29,7 @@ MeshObject::MeshObject(const std::vector<uint16_t> &faces, initialize(); } -MeshObject::MeshObject(std::vector<uint16_t> &&faces, +MeshObject::MeshObject(std::vector<uint32_t> &&faces, std::vector<Kernel::V3D> &&vertices, const Kernel::Material &&material) : m_boundingBox(), m_id("MeshObject"), m_triangles(std::move(faces)), diff --git a/Framework/Geometry/src/Objects/MeshObject2D.cpp b/Framework/Geometry/src/Objects/MeshObject2D.cpp index b0d255cd028..55026b16ba2 100644 --- a/Framework/Geometry/src/Objects/MeshObject2D.cpp +++ b/Framework/Geometry/src/Objects/MeshObject2D.cpp @@ -146,7 +146,7 @@ bool MeshObject2D::pointsCoplanar(const std::vector<Kernel::V3D> &vertices) { /** * Constructor */ -MeshObject2D::MeshObject2D(const std::vector<uint16_t> &faces, +MeshObject2D::MeshObject2D(const std::vector<uint32_t> &faces, const std::vector<Kernel::V3D> &vertices, const Kernel::Material &material) : m_triangles(faces), m_vertices(vertices), m_material(material) { @@ -156,7 +156,7 @@ MeshObject2D::MeshObject2D(const std::vector<uint16_t> &faces, /** * Move constructor */ -MeshObject2D::MeshObject2D(std::vector<uint16_t> &&faces, +MeshObject2D::MeshObject2D(std::vector<uint32_t> &&faces, std::vector<Kernel::V3D> &&vertices, const Kernel::Material &&material) : m_triangles(std::move(faces)), m_vertices(std::move(vertices)), diff --git a/Framework/Geometry/src/Objects/MeshObjectCommon.cpp b/Framework/Geometry/src/Objects/MeshObjectCommon.cpp index 368cff0fa34..292848a8a01 100644 --- a/Framework/Geometry/src/Objects/MeshObjectCommon.cpp +++ b/Framework/Geometry/src/Objects/MeshObjectCommon.cpp @@ -190,10 +190,10 @@ bool rayIntersectsTriangle(const Kernel::V3D &start, } void checkVertexLimit(size_t nVertices) { - if (nVertices > std::numeric_limits<uint16_t>::max()) { + if (nVertices > std::numeric_limits<uint32_t>::max()) { throw std::invalid_argument( "Too many vertices (" + std::to_string(nVertices) + - "). MeshObject cannot have more than 65535 vertices."); + "). MeshObject cannot have more than 2^32 vertices."); } } diff --git a/Framework/NexusGeometry/inc/MantidNexusGeometry/NexusShapeFactory.h b/Framework/NexusGeometry/inc/MantidNexusGeometry/NexusShapeFactory.h index b584d3c1233..485a544591c 100644 --- a/Framework/NexusGeometry/inc/MantidNexusGeometry/NexusShapeFactory.h +++ b/Framework/NexusGeometry/inc/MantidNexusGeometry/NexusShapeFactory.h @@ -35,19 +35,19 @@ createCylinder(const Eigen::Matrix<double, 3, 3> &pointsDef); /// Creates a triangular mesh shape based on ready triangulated polygons DLLExport std::unique_ptr<const Geometry::IObject> -createMesh(std::vector<uint16_t> &&triangularFaces, +createMesh(std::vector<uint32_t> &&triangularFaces, std::vector<Mantid::Kernel::V3D> &&vertices); /// Creates a triangular mesh shape based on OFF (Object File Format) polygon /// inputs https://en.wikipedia.org/wiki/OFF_(file_format) DLLExport std::unique_ptr<const Geometry::IObject> -createFromOFFMesh(const std::vector<uint16_t> &faceIndices, - const std::vector<uint16_t> &windingOrder, +createFromOFFMesh(const std::vector<uint32_t> &faceIndices, + const std::vector<uint32_t> &windingOrder, const std::vector<float> &nexusVertices); DLLExport std::unique_ptr<const Geometry::IObject> -createFromOFFMesh(const std::vector<uint16_t> &faceIndices, - const std::vector<uint16_t> &windingOrder, +createFromOFFMesh(const std::vector<uint32_t> &faceIndices, + const std::vector<uint32_t> &windingOrder, const std::vector<Eigen::Vector3d> &nexusVertices); } // namespace NexusShapeFactory } // namespace NexusGeometry diff --git a/Framework/NexusGeometry/src/NexusGeometryParser.cpp b/Framework/NexusGeometry/src/NexusGeometryParser.cpp index dd6bd9208e6..7496c6403cf 100644 --- a/Framework/NexusGeometry/src/NexusGeometryParser.cpp +++ b/Framework/NexusGeometry/src/NexusGeometryParser.cpp @@ -418,28 +418,28 @@ parseNexusCylinder(const Group &shapeGroup) { // Parse OFF (mesh) nexus geometry boost::shared_ptr<const Geometry::IObject> parseNexusMesh(const Group &shapeGroup) { - const std::vector<uint16_t> faceIndices = convertVector<int32_t, uint16_t>( + const std::vector<uint32_t> faceIndices = convertVector<int32_t, uint32_t>( get1DDataset<int32_t>("faces", shapeGroup)); - const std::vector<uint16_t> windingOrder = convertVector<int32_t, uint16_t>( + const std::vector<uint32_t> windingOrder = convertVector<int32_t, uint32_t>( get1DDataset<int32_t>("winding_order", shapeGroup)); const auto vertices = get1DDataset<float>("vertices", shapeGroup); return NexusShapeFactory::createFromOFFMesh(faceIndices, windingOrder, vertices); } -void extractFacesAndIDs(const std::vector<uint16_t> &detFaces, - const std::vector<uint16_t> &windingOrder, +void extractFacesAndIDs(const std::vector<uint32_t> &detFaces, + const std::vector<uint32_t> &windingOrder, const std::vector<float> &vertices, const std::unordered_map<int, uint32_t> &detIdToIndex, const size_t vertsPerFace, std::vector<std::vector<Eigen::Vector3d>> &detFaceVerts, - std::vector<std::vector<uint16_t>> &detFaceIndices, - std::vector<std::vector<uint16_t>> &detWindingOrder, + std::vector<std::vector<uint32_t>> &detFaceIndices, + std::vector<std::vector<uint32_t>> &detWindingOrder, std::vector<int32_t> &detIds) { const size_t vertStride = 3; size_t detFaceIndex = 1; std::fill(detFaceIndices.begin(), detFaceIndices.end(), - std::vector<uint16_t>(1, 0)); + std::vector<uint32_t>(1, 0)); for (size_t i = 0; i < windingOrder.size(); i += vertsPerFace) { auto detFaceId = detFaces[detFaceIndex]; // Id -> Index @@ -452,27 +452,27 @@ void extractFacesAndIDs(const std::vector<uint16_t> &detFaces, for (size_t v = 0; v < vertsPerFace; ++v) { const auto vi = windingOrder[i + v] * vertStride; detVerts.emplace_back(vertices[vi], vertices[vi + 1], vertices[vi + 2]); - detWinding.push_back(static_cast<uint16_t>(detWinding.size())); + detWinding.push_back(static_cast<uint32_t>(detWinding.size())); } // Index -> Id detIds[detIndex] = detFaceId; - detIndices.push_back(static_cast<uint16_t>(detVerts.size())); + detIndices.push_back(static_cast<uint32_t>(detVerts.size())); // Detector faces is 2N detectors detFaceIndex += 2; } } void parseNexusMeshAndAddDetectors( - const std::vector<uint16_t> &detFaces, - const std::vector<uint16_t> &faceIndices, - const std::vector<uint16_t> &windingOrder, + const std::vector<uint32_t> &detFaces, + const std::vector<uint32_t> &faceIndices, + const std::vector<uint32_t> &windingOrder, const std::vector<float> &vertices, const size_t numDets, const std::unordered_map<int, uint32_t> &detIdToIndex, const std::string &name, InstrumentBuilder &builder) { auto vertsPerFace = windingOrder.size() / faceIndices.size(); std::vector<std::vector<Eigen::Vector3d>> detFaceVerts(numDets); - std::vector<std::vector<uint16_t>> detFaceIndices(numDets); - std::vector<std::vector<uint16_t>> detWindingOrder(numDets); + std::vector<std::vector<uint32_t>> detFaceIndices(numDets); + std::vector<std::vector<uint32_t>> detWindingOrder(numDets); std::vector<int> detIds(numDets); extractFacesAndIDs(detFaces, windingOrder, vertices, detIdToIndex, @@ -504,11 +504,11 @@ void parseAndAddBank(const Group &shapeGroup, InstrumentBuilder &builder, const std::string &bankName) { // Load mapping between detector IDs and faces, winding order of vertices for // faces, and face corner vertices. - const std::vector<uint16_t> detFaces = convertVector<int32_t, uint16_t>( + const std::vector<uint32_t> detFaces = convertVector<int32_t, uint32_t>( get1DDataset<int32_t>("detector_faces", shapeGroup)); - const std::vector<uint16_t> faceIndices = convertVector<int32_t, uint16_t>( + const std::vector<uint32_t> faceIndices = convertVector<int32_t, uint32_t>( get1DDataset<int32_t>("faces", shapeGroup)); - const std::vector<uint16_t> windingOrder = convertVector<int32_t, uint16_t>( + const std::vector<uint32_t> windingOrder = convertVector<int32_t, uint32_t>( get1DDataset<int32_t>("winding_order", shapeGroup)); const auto vertices = get1DDataset<float>("vertices", shapeGroup); diff --git a/Framework/NexusGeometry/src/NexusShapeFactory.cpp b/Framework/NexusGeometry/src/NexusShapeFactory.cpp index 911b6ddd9e1..d498c295eea 100644 --- a/Framework/NexusGeometry/src/NexusShapeFactory.cpp +++ b/Framework/NexusGeometry/src/NexusShapeFactory.cpp @@ -47,8 +47,8 @@ std::unique_ptr<const Geometry::IObject> createCylinderShape( return std::unique_ptr<const Geometry::IObject>(shape.release()); } -void createTrianglesFromPolygon(const std::vector<uint16_t> &windingOrder, - std::vector<uint16_t> &triangularFaces, +void createTrianglesFromPolygon(const std::vector<uint32_t> &windingOrder, + std::vector<uint32_t> &triangularFaces, int &startOfFace, int &endOfFace) { int polygonOrder = endOfFace - startOfFace; auto first = windingOrder.begin() + startOfFace; @@ -63,16 +63,16 @@ void createTrianglesFromPolygon(const std::vector<uint16_t> &windingOrder, startOfFace = endOfFace; // start of the next face } -std::vector<uint16_t> -createTriangularFaces(const std::vector<uint16_t> &faceIndices, - const std::vector<uint16_t> &windingOrder) { +std::vector<uint32_t> +createTriangularFaces(const std::vector<uint32_t> &faceIndices, + const std::vector<uint32_t> &windingOrder) { // Elements 0 to 2 are the indices of the vertices vector corresponding to the // vertices of the first triangle. // Elements 3 to 5 are for the second triangle, and so on. // The order of the vertices is the winding order of the triangle, determining // the face normal by right-hand rule - std::vector<uint16_t> triangularFaces; + std::vector<uint32_t> triangularFaces; int startOfFace = 0; int endOfFace = 0; @@ -156,10 +156,10 @@ createCylinder(const Eigen::Matrix<double, 3, 3> &pointsDef) { } std::unique_ptr<const Geometry::IObject> -createFromOFFMesh(const std::vector<uint16_t> &faceIndices, - const std::vector<uint16_t> &windingOrder, +createFromOFFMesh(const std::vector<uint32_t> &faceIndices, + const std::vector<uint32_t> &windingOrder, const std::vector<float> &nexusVertices) { - std::vector<uint16_t> triangularFaces = + std::vector<uint32_t> triangularFaces = createTriangularFaces(faceIndices, windingOrder); std::vector<Mantid::Kernel::V3D> vertices; @@ -190,10 +190,10 @@ toVectorV3D(const std::vector<Eigen::Vector3d> &nexusVertices) { } std::unique_ptr<const Geometry::IObject> -createFromOFFMesh(const std::vector<uint16_t> &faceIndices, - const std::vector<uint16_t> &windingOrder, +createFromOFFMesh(const std::vector<uint32_t> &faceIndices, + const std::vector<uint32_t> &windingOrder, const std::vector<Eigen::Vector3d> &nexusVertices) { - std::vector<uint16_t> triangularFaces = + std::vector<uint32_t> triangularFaces = createTriangularFaces(faceIndices, windingOrder); return NexusShapeFactory::createMesh(std::move(triangularFaces), @@ -201,7 +201,7 @@ createFromOFFMesh(const std::vector<uint16_t> &faceIndices, } std::unique_ptr<const Geometry::IObject> -createMesh(std::vector<uint16_t> &&triangularFaces, +createMesh(std::vector<uint32_t> &&triangularFaces, std::vector<Mantid::Kernel::V3D> &&vertices) { if (Geometry::MeshObject2D::pointsCoplanar(vertices)) -- GitLab