all_faces_in.h
1 /* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
2  * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
3  * Author(s): Siargey Kachanovich
4  *
5  * Copyright (C) 2015 Inria
6  *
7  * Modification(s):
8  * - YYYY/MM Author: Description of the modification
9  */
10 
11 #ifndef WITNESS_COMPLEX_ALL_FACES_IN_H_
12 #define WITNESS_COMPLEX_ALL_FACES_IN_H_
13 
14 /* \brief Check if the facets of the k-dimensional simplex witnessed
15  * by witness witness_id are already in the complex.
16  * inserted_vertex is the handle of the (k+1)-th vertex witnessed by witness_id
17  */
18 template < typename SimplicialComplexForWitness,
19  typename Simplex >
20  bool all_faces_in(Simplex& simplex,
21  double* filtration_value,
22  SimplicialComplexForWitness& sc) {
23  typedef typename SimplicialComplexForWitness::Simplex_handle Simplex_handle;
24 
25  if (simplex.size() == 1)
26  return true; /* Add vertices unconditionally */
27 
28  Simplex facet;
29  for (typename Simplex::iterator not_it = simplex.begin(); not_it != simplex.end(); ++not_it) {
30  facet.clear();
31  for (typename Simplex::iterator it = simplex.begin(); it != simplex.end(); ++it)
32  if (it != not_it)
33  facet.push_back(*it);
34  Simplex_handle facet_sh = sc.find(facet);
35  if (facet_sh == sc.null_simplex())
36  return false;
37  else if (sc.filtration(facet_sh) > *filtration_value)
38  *filtration_value = sc.filtration(facet_sh);
39  }
40  return true;
41  }
42 
43 #endif // WITNESS_COMPLEX_ALL_FACES_IN_H_
GUDHI  Version 3.1.1  - C++ library for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.  - Copyright : MIT Generated on Fri Feb 7 2020 17:04:44 for GUDHI by Doxygen 1.8.16