double estimate_volume(const mesh& mesh) { const auto& nodes = mesh.get_structure().get_condensed_nodes(); const auto num_inside = std::count_if(cbegin(nodes), cend(nodes), [](const auto& i) { return is_inside(i); }); const auto spacing = mesh.get_descriptor().spacing; const auto node_volume = spacing * spacing * spacing; return node_volume * num_inside; }
bool is_inside(const mesh& m, size_t node_index) { return is_inside(m.get_structure().get_condensed_nodes()[node_index]); }