| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // Copyright (C) 2026 Tiago V. L. Amorim (@tiagovla) | ||
| 2 | // | ||
| 3 | // This file is part of oiseau (https://github.com/tiagovla/oiseau) | ||
| 4 | // | ||
| 5 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 6 | |||
| 7 | #include "oiseau/plotting/triplot.hpp" | ||
| 8 | |||
| 9 | #include <cstddef> | ||
| 10 | #include <limits> | ||
| 11 | #include <vector> | ||
| 12 | |||
| 13 | #include "oiseau/mesh/mesh.hpp" | ||
| 14 | |||
| 15 | namespace oiseau::plotting { | ||
| 16 | |||
| 17 | ✗ | void triplot(plt::AxesSubPlot& ax, oiseau::mesh::Mesh& mesh) { | |
| 18 | ✗ | const auto& topology = mesh.topology(); | |
| 19 | ✗ | const auto& geometry = mesh.geometry(); | |
| 20 | ✗ | const auto connectivity = topology.conn(); | |
| 21 | ✗ | const auto coordinates = geometry.x(); | |
| 22 | ✗ | const auto dimension = geometry.dim(); | |
| 23 | ✗ | const auto cell_types = topology.cell_types(); | |
| 24 | ✗ | std::vector<double> x, y; | |
| 25 | ✗ | constexpr auto separator = std::numeric_limits<double>::quiet_NaN(); | |
| 26 | |||
| 27 | ✗ | for (std::size_t i = 0; i < connectivity.size(); ++i) { | |
| 28 | ✗ | const auto& vertices = connectivity[i]; | |
| 29 | ✗ | for (const auto& face_vertices : cell_types[i]->get_entity_vertices(1)) { | |
| 30 | ✗ | for (const auto local_vertex : face_vertices) { | |
| 31 | ✗ | const auto vertex = vertices[local_vertex]; | |
| 32 | ✗ | x.push_back(coordinates[vertex * dimension]); | |
| 33 | ✗ | y.push_back(coordinates[vertex * dimension + 1]); | |
| 34 | } | ||
| 35 | ✗ | x.push_back(separator); | |
| 36 | ✗ | y.push_back(separator); | |
| 37 | ✗ | } | |
| 38 | } | ||
| 39 | |||
| 40 | ✗ | ax.plot(x, y, "color"_a = "k"); | |
| 41 | ✗ | } | |
| 42 | |||
| 43 | } // namespace oiseau::plotting | ||
| 44 |