Wildmeshing Toolkit
Loading...
Searching...
No Matches
mesh_info.cpp
Go to the documentation of this file.
1#include "mesh_info.hpp"
2
3
5
6#include <wmtk/Mesh.hpp>
8
9namespace wmtk::components {
10
11void mesh_info(const utils::Paths& paths, const nlohmann::json& j, io::Cache& cache)
12{
13 using namespace internal;
14
15 MeshInfoOptions options = j.get<MeshInfoOptions>();
16
17 std::shared_ptr<Mesh> mesh_in = cache.read_mesh(options.input);
18
19 Mesh& mesh = *mesh_in;
20
21 wmtk::logger().info("The information given in this component is very limited for now. Sorry.");
22
23 const auto v_tuples = mesh.get_all(PrimitiveType::Vertex);
24 const auto f_tuples = mesh.get_all(PrimitiveType::Triangle);
25
26 wmtk::logger().info("Mesh: {}", options.input);
27 wmtk::logger().info("Vertices: {}", v_tuples.size());
28 wmtk::logger().info("Faces: {}", f_tuples.size());
29}
30
31} // namespace wmtk::components
std::vector< Tuple > get_all(PrimitiveType type) const
Generate a vector of Tuples from global vertex/edge/triangle/tetrahedron index.
Definition Mesh.cpp:18
std::shared_ptr< Mesh > read_mesh(const std::string &name) const
Load a mesh from cache.
Definition Cache.cpp:171
void mesh_info(const utils::Paths &paths, const nlohmann::json &j, io::Cache &cache)
Definition mesh_info.cpp:11
spdlog::logger & logger()
Retrieves the current logger.
Definition Logger.cpp:58