MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / write_node_file

Method write_node_file

src/IO/NodeWriter.cpp:49–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49void NodeWriter::write_node_file(const std::string& filename, Mesh& mesh) {
50 const size_t num_vertices = mesh.get_num_vertices();
51 const size_t dim = mesh.get_dim();
52 std::ofstream fout(filename.c_str());
53 fout.precision(16);
54 if (!is_anonymous()) {
55 fout << "# Generated with PyMesh" << std::endl;
56 }
57 VectorF bd_marker;
58 if (m_with_node_bd_marker) {
59 if (!mesh.has_attribute("node_boundary_marker")) {
60 throw IOError("Attribute \"node_boundary_marker\" does not exist.");
61 } else {
62 bd_marker = mesh.get_attribute("node_boundary_marker");
63 assert(num_vertices == bd_marker.size());
64 }
65 }
66 const VectorF& vertices = mesh.get_vertices();
67 fout << num_vertices << " " << dim << " 0 " << m_with_node_bd_marker
68 << std::endl;
69 for (size_t i=0; i<num_vertices; i++) {
70 fout << i;
71 for (size_t j=0; j<dim; j++) {
72 fout << " " << vertices[i*dim + j];
73 }
74 if (m_with_node_bd_marker) {
75 fout << " " << bd_marker[i];
76 }
77 fout << std::endl;
78 }
79}
80
81void NodeWriter::write_face_file(const std::string& filename, Mesh& mesh) {
82 const size_t num_faces = mesh.get_num_faces();

Callers

nothing calls this directly

Calls 7

IOErrorClass · 0.85
get_num_verticesMethod · 0.45
get_dimMethod · 0.45
has_attributeMethod · 0.45
get_attributeMethod · 0.45
sizeMethod · 0.45
get_verticesMethod · 0.45

Tested by

no test coverage detected