dart.h 3.98 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1 2 3
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
4
* Copyright (C) 2009-2011, IGG Team, LSIIT, University of Strasbourg           *
Pierre Kraemer's avatar
Pierre Kraemer committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
*                                                                              *
* This library is free software; you can redistribute it and/or modify it      *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your     *
* option) any later version.                                                   *
*                                                                              *
* This library is distributed in the hope that it will be useful, but WITHOUT  *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or        *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License  *
* for more details.                                                            *
*                                                                              *
* You should have received a copy of the GNU Lesser General Public License     *
* along with this library; if not, write to the Free Software Foundation,      *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.           *
*                                                                              *
20
* Web site: http://cgogn.u-strasbg.fr/                                         *
Pierre Kraemer's avatar
Pierre Kraemer committed
21 22 23 24 25 26 27 28 29 30 31 32
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#ifndef DART_H_
#define DART_H_

#include <iostream>

namespace CGoGN
{

CGoGN GIT Supervisor's avatar
CGoGN GIT Supervisor committed
33 34 35
const unsigned int EMBNULL = 0xffffffff;
const unsigned int NB_THREAD = 16;

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
//const unsigned int NB_ORBITS = 6;

//const unsigned int VERTEX			= 0;
//const unsigned int EDGE				= 1;
//const unsigned int ORIENTED_FACE	= 2;
//const unsigned int FACE				= 3;
//const unsigned int VOLUME			= 4;
//const unsigned int DART				= 5;
//


const unsigned int NB_ORBITS	= 11;

const unsigned int DART			= 0;
const unsigned int VERTEX		= 1;
const unsigned int EDGE			= 2;
const unsigned int FACE			= 3;
const unsigned int VOLUME		= 4;
const unsigned int CC			= 5;

const unsigned int VERTEX1		= 6;
const unsigned int EDGE1		= 7;

const unsigned int VERTEX2		= 8;
const unsigned int EDGE2		= 9;
const unsigned int FACE2		= 10;


CGoGN GIT Supervisor's avatar
CGoGN GIT Supervisor committed
64

Pierre Kraemer's avatar
Pierre Kraemer committed
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
struct Dart
{
	unsigned int index;

	Dart(): index(0xffffffff) {}

	static Dart nil() { Dart d; d.index = 0xffffffff; return d; }

	static Dart create(unsigned int i) { Dart d; d.index = i; return d; }

	Dart(unsigned int v): index(v) {}

	bool isNil() { return index == 0xffffffff ; }

	/**
	 * affectation operator
	 * @param d the dart to store in this
	 */
	Dart operator=(Dart d) { index = d.index; return *this; }

	/**
	 * equality operator
	 * @param d the dart to compare with
	 */
89
	bool operator==(Dart d) const { return d.index == index; }
Pierre Kraemer's avatar
Pierre Kraemer committed
90 91 92 93 94

	/**
	 * different operator
	 * @param d the dart to compare with
	 */
95
	bool operator!=(Dart d) const { return d.index != index; }
Pierre Kraemer's avatar
Pierre Kraemer committed
96 97 98 99 100

	/**
	 * less operator, can be used for sorting
	 * @param d the dart to compare with
	 */
101
	bool operator<(Dart d) const { return index < d.index; }
Pierre Kraemer's avatar
Pierre Kraemer committed
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126

	friend std::ostream& operator<<( std::ostream &out, const Dart& fa ) { return out << fa.index; }
	friend std::istream& operator>>( std::istream &in, Dart& fa ) { in >> fa.index; return in; }

	void operator += (const Dart& fa) {}
	void operator -= (const Dart& fa) {}
	void operator *= (double v) {}
	void operator /= (double v) {}

	/**
	 * CGoGN name
	 */
	static std::string CGoGNnameOfType() { return "Dart"; }

	/**
	 * label is the index (cleaner that use d.index outside of maps
	 */
	unsigned int label() { return index; }
};

const Dart NIL = Dart::nil();

}

#endif /* DART_H_ */