File: VertexFacetTableArray.hh

package info (click to toggle)
topcom 1.1.2%2Bds-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 31,788 kB
  • sloc: cpp: 37,616; sh: 4,262; makefile: 497; ansic: 49
file content (74 lines) | stat: -rw-r--r-- 1,982 bytes parent folder | download | duplicates (2)
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
71
72
73
74
////////////////////////////////////////////////////////////////////////////////
// 
// 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"

namespace topcom {

  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 < size(); ++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.size(); ++i)
      ost << "[" << i << ":" << vft[i] << "]";
      
    ost << "]";
    return ost;
  }

}; // namespace topcom

#endif
// eof VertexFacetTableArray.hh