Enhance mesh_tester application so it can write STL.#1592
Conversation
kennyweiss
left a comment
There was a problem hiding this comment.
Thanks @BradWhitlock for this great addition!
| - The `primal::BoundingBox` class' `expand()` and `shift()` methods were modified so they do | ||
| nothing when called on invalid bounding boxes. | ||
| - Updates to [MFEM version 4.8.0][https://github.com/mfem/mfem/releases/tag/v4.8] | ||
| - Readers in Quest were moved from a `quest/readers` directory to `quest/io`. |
| /*! | ||
| * \class STLWriter | ||
| * | ||
| * \brief A simple STL writer for the faces of Mint meshes. |
There was a problem hiding this comment.
Future leaning suggestion: I think we'll want to update the readers/writers to work with blueprint/BUMP.
Should we emphasize that this works on collections of triangles (or perhaps planar polygons) rather than the input representation (mint)?
| * \brief A simple STL writer for the faces of Mint meshes. | |
| * \brief A simple STL writer for a collection of triangular faces with limited support for planar polygons |
Obviously, we can change this in the future, so feel free to ignore this suggestion in this PR.
There was a problem hiding this comment.
I agree that the readers/writers can eventually provide Conduit interfaces and use Bump internally for accessing those meshes. Future PR.
// Future
struct STLWriter {
//...
#if defined(AXOM_USE_CONDUIT)
void write(const conduit::Node &mesh);
#endif
//...
};
| * \brief Determines whether the input mesh looks topologically 2D since | ||
| * the mesh dimension seems to reflect the number of coordinate components. |
There was a problem hiding this comment.
Minor: I'm confused by this comment. Could you please update it?
Specifically, the word "looks" and the reference to "coordinate components" made me think we were going to check if the mesh was (geometrically) planar.
The check in the implementation is about topological cell types (triangle and quad), not about geometric coordinates, which is in line with the function name.
There was a problem hiding this comment.
I changed the comments. This functionality was needed when I started using the writer in the mesh_tester. The surface mesh has 3D coordinates. mint::Mesh::getDimension() returns 3 (like the coordinates) but there are no faces, just cells, so we have to iterate over the cells rather than using mint::for_all_faces.
| for(int comp = 0; comp < 3; comp++) | ||
| { | ||
| n32[comp] = static_cast<float32>(N[comp]); | ||
| coords32[0][comp] = static_cast<float32>(coords[0][comp]); |
There was a problem hiding this comment.
Aside: I didn't appreciate until now that binary STLs use floats for the geometry and normals
Arlie-Capps
left a comment
There was a problem hiding this comment.
Thank you, Brad! Much appreciated.
This PR resolves #262 by enhancing the mesh_tester application so it can write STL files.
STLWriterclass - in quest since the STLReader is there.STLWriterclass can write ascii or binary STL files.write_stlfunction was added that calls theSTLWriterclass for those who prefer a function interface.readersdirectory renamed toiosince there is a writer in there now.--formatand--binarycommand line arguments allow STL output (optionally binary).