| 47 | } |
| 48 | |
| 49 | void 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 | |
| 81 | void NodeWriter::write_face_file(const std::string& filename, Mesh& mesh) { |
| 82 | const size_t num_faces = mesh.get_num_faces(); |
nothing calls this directly
no test coverage detected