Tatooine
edgeset.h
Go to the documentation of this file.
1#ifndef TATOOINE_EDGESET_H
2#define TATOOINE_EDGESET_H
3//==============================================================================
5//==============================================================================
6namespace tatooine {
7//==============================================================================
8template <floating_point Real, std::size_t NumDimensions>
9struct edgeset : unstructured_simplicial_grid<Real, NumDimensions, 1> {
13 using typename parent_type::vertex_handle;
15 template <typename... Handles>
16 auto insert_edge(vertex_handle const v0, vertex_handle const v1) {
17 return this->insert_simplex(v0, v1);
18 }
19 auto edge_at(edge_handle const h) { return this->simplex_at(h); }
20 auto edge_at(edge_handle const h) const { return this->simplex_at(h); }
21 auto edges() const { return this->simplices(); }
22 auto are_connected(vertex_handle const v0, vertex_handle const v1) const {
23 for (auto e : edges()) {
24 auto [ev0, ev1] = this->at(e);
25 if ((ev0 == v0 && ev1 == v1) || (ev0 == v1 && ev1 == v0)) {
26 return true;
27 }
28 }
29 return false;
30 }
31};
32//==============================================================================
33template <std::size_t NumDimensions>
35template <floating_point Real>
37template <floating_point Real>
39template <floating_point Real>
41template <floating_point Real>
47//==============================================================================
48template <typename T>
49struct is_edgeset_impl : std::false_type {};
50template <floating_point Real, std::size_t NumDimensions>
51struct is_edgeset_impl<edgeset<Real, NumDimensions>> : std::true_type {};
52template <typename T>
53static constexpr auto is_edgeset = is_edgeset_impl<T>::value;
54//==============================================================================
55} // namespace tatooine
56//==============================================================================
57//#include <tatooine/detail/edgeset/vtp_writer.h>
58//namespace tatooine {
60//static constexpr auto is_edgeset = is_edgeset_impl<T>::value;
61//auto write_vtk(range auto const& grids, std::filesystem::path const& path,
62// std::string const& title = "tatooine grids") requires
63// is_edgeset<typename std::decay_t<decltype(grids)>::value_type> {
64// detail::write_edgeset_container_to_vtk(grids, path, title);
65//}
67//auto write_vtp(range auto const& grids,
68// std::filesystem::path const& path) requires
69// is_edgeset<typename std::decay_t<decltype(grids)>::value_type> {
70// detail::write_edgeset_container_to_vtp(grids, path);
71//}
73//auto write(range auto const& grids, std::filesystem::path const& path) requires
74// is_edgeset<typename std::decay_t<decltype(grids)>::value_type> {
75// auto const ext = path.extension();
76// if (ext == ".vtp") {
77// detail::write_edgeset_container_to_vtp(grids, path);
78// } else if (ext == ".vtk") {
79// detail::write_edgeset_container_to_vtk(grids, path);
80// }
81//}
82//==============================================================================
83//} // namespace tatooine
84//==============================================================================
85#endif
Definition: algorithm.h:6
static constexpr auto is_edgeset
Definition: edgeset.h:53
Definition: edgeset.h:9
auto insert_edge(vertex_handle const v0, vertex_handle const v1)
Definition: edgeset.h:16
typename parent_type::simplex_handle edge_handle
Definition: edgeset.h:14
auto edge_at(edge_handle const h)
Definition: edgeset.h:19
auto edge_at(edge_handle const h) const
Definition: edgeset.h:20
auto are_connected(vertex_handle const v0, vertex_handle const v1) const
Definition: edgeset.h:22
auto edges() const
Definition: edgeset.h:21
Definition: edgeset.h:49
Definition: pointset.h:83
Definition: unstructured_simplicial_grid.h:87
Definition: unstructured_simplicial_grid.h:52
auto simplices() const
Definition: unstructured_simplicial_grid.h:515
auto simplex_at(simplex_handle t) const -> auto
Definition: unstructured_simplicial_grid.h:303
auto insert_simplex(Handles const ... handles)
Definition: unstructured_simplicial_grid.h:427
auto at(simplex_handle t) const -> auto
Definition: unstructured_simplicial_grid.h:300