File: FineTriang.cc

package info (click to toggle)
topcom 0.17.8%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 78,572 kB
  • sloc: cpp: 16,640; sh: 975; makefile: 345; ansic: 40
file content (53 lines) | stat: -rw-r--r-- 1,715 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//////////////////////////////////////////////////////////////////////////
// FineTriang.cc
// produced: 01 Oct 1999 jr
// last change: 01 Oct 1999 jr
/////////////////////////////////////////////////////////////////////////

#include <assert.h>

#include "Circuits.hh"

#include "FineTriang.hh"

void FineTriang::_flip_in() {
  IntegerSet not_used(IntegerSet(0, _chiroptr->no()));
  not_used -= support();
  while (!not_used.is_empty()) {
    const size_type flip_vertex(*not_used.begin());
    _flip_in(not_used, flip_vertex);
    not_used -= flip_vertex;
  }
}

void FineTriang::_flip_in(IntegerSet& not_used, const size_type i) {
  // search for all simplices that geometrically contain i:
  for (SimplicialComplex::const_iterator iter1 = begin();
       iter1 != end();
       ++iter1) {
    dependent_set_type dependent_set = *iter1;
    assert (!dependent_set.contains(i));
    dependent_set += i;
    const Circuit circuit(*_chiroptr, dependent_set);
    const SimplicialComplex upper = circuit.upper_facets();
    const SimplicialComplex lower = circuit.lower_facets();
    const IntegerSet usupport = upper.support();
    const IntegerSet lsupport = lower.support();
    if (usupport.contains(i) && !lsupport.contains(i)) {
      assert(!lower.is_empty());
      const SimplicialComplex common_link(link(*lower.begin()));
      *this -= lower.join(common_link);
      *this += upper.join(common_link);
      break;
    }
    if (!usupport.contains(i) && lsupport.contains(i)) {
      assert(!upper.is_empty());
      const SimplicialComplex common_link(link(*upper.begin()));
      *this -= upper.join(common_link);
      *this += lower.join(common_link);
      break;
    }
  }
}
  
// eof FineTriang.cc