File: VertexFacetTableArray.hh

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 (70 lines) | stat: -rw-r--r-- 1,927 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
////////////////////////////////////////////////////////////////////////////////
// 
// VertexFacetTable.hh 
//
//    produced: 27/02/98 jr
// last change: 27/02/98 jr
//
////////////////////////////////////////////////////////////////////////////////
#ifndef VERTEXFACETTABLE_HH
#define VERTEXFACETTABLE_HH

#include "PlainArray.hh"
#include "SimplicialComplex.hh"

#include "CommandlineOptions.hh"

typedef PlainArray<SimplicialComplex>   _VertexFacetTable;

class VertexFacetTable : public _VertexFacetTable {
private:
  VertexFacetTable();
  VertexFacetTable(const VertexFacetTable&);
  VertexFacetTable& operator=(const VertexFacetTable&);
public:
  VertexFacetTable(const SimplicialComplex& sc);
  const SimplicialComplex& facets(const size_type n) const;
  SimplicialComplex* facetsptr(const size_type n);
  friend std::ostream& operator<<(std::ostream& ost, const VertexFacetTable& vft);
};

inline VertexFacetTable::VertexFacetTable
(const SimplicialComplex& sc) {
#ifdef CONSTRUCTOR_DEBUG
  std::cout << "VertexFacetTable::VertexFacetTable(const SimplicialComplex&)" 
       << std::endl;
#endif
  Simplex support(sc.support());
  size_type init_size = 0;
  for (Simplex::iterator iter = support.begin();
       iter != support.end();
       ++iter)
    init_size = *iter;

  init_size++;
  resize(init_size);
  for (size_type i = 0; i < maxindex(); ++i) {
    for (SimplicialComplex::iterator iter = sc.begin();
         iter != sc.end();
         ++iter)
      if (iter->contains(i))
        (*this)[i] += *iter;

  }
}
inline SimplicialComplex* VertexFacetTable::facetsptr(const size_type n) {
  return &(*this)[n];
}

inline std::ostream& operator<<(std::ostream& ost, 
                           const VertexFacetTable& vft) {
  ost << "[";
  for (size_type i = 0; i < vft.maxindex(); ++i)
    ost << "[" << i << ":" << vft[i] << "]";
      
  ost << "]";
  return ost;
}

#endif
// eof VertexFacetTableArray.hh