Welcome to mirror list, hosted at ThFree Co, Russian Federation.

adjacent-matrix.hpp « src « quadriflow « extern - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e3eb2e12a47aea5f68d5646b8e7f7eaccd5d52d2 (plain)
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
#ifndef ADJACENT_MATRIX_H_
#define ADJACENT_MATRIX_H_

#include <vector>

namespace qflow {

struct Link
{
	Link(){}
	Link(int _id, double _w = 1)
		: id(_id), weight(_w)
	{}
	inline bool operator<(const Link &link) const { return id < link.id; }
	int id;
	double weight;
};

struct TaggedLink {
	int id;
	unsigned char flag;
	TaggedLink(){}
	TaggedLink(int id) : id(id), flag(0) { }
	bool used() const { return flag & 1; }
	void markUsed() { flag |= 1; }
	TaggedLink& operator=(const Link& l) {
		flag = 0;
		id = l.id;
		return *this;
	}
};

typedef std::vector<std::vector<Link> > AdjacentMatrix;

} // namespace qflow

#endif