gmap0.h 3.69 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-2012, 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.unistra.fr/                                           *
Pierre Kraemer's avatar
Pierre Kraemer committed
21 22 23 24 25 26 27
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#ifndef __GMAP0_H__
#define __GMAP0_H__

Pierre Kraemer's avatar
Pierre Kraemer committed
28
#include "Topology/generic/mapCommon.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
29 30 31 32 33 34 35 36 37 38
#include "Topology/generic/dartmarker.h"
#include "Topology/generic/cellmarker.h"

namespace CGoGN
{

/**
* The class of 0-GMap
* Warning here we use beta instead of classic alpha
*/
Pierre Kraemer's avatar
Pierre Kraemer committed
39 40
template <typename MAP_IMPL>
class GMap0 : public MapCommon<MAP_IMPL>
Pierre Kraemer's avatar
Pierre Kraemer committed
41 42
{
protected:
43 44
	void init() ;

Pierre Kraemer's avatar
Pierre Kraemer committed
45
public:
Pierre Kraemer's avatar
Pierre Kraemer committed
46 47
	typedef MAP_IMPL IMPL;

Pierre Kraemer's avatar
Pierre Kraemer committed
48
	GMap0();
Pierre Kraemer's avatar
Pierre Kraemer committed
49

50
	static const unsigned int DIMENSION = 0 ;
Pierre Kraemer's avatar
Pierre Kraemer committed
51

52
	virtual std::string mapTypeName() const;
Pierre Kraemer's avatar
Pierre Kraemer committed
53

54
	virtual unsigned int dimension() const;
Pierre Kraemer's avatar
Pierre Kraemer committed
55

56 57
	virtual void clear(bool removeAttrib);

Pierre Kraemer's avatar
Pierre Kraemer committed
58 59
	virtual unsigned int getNbInvolutions() const;
	virtual unsigned int getNbPermutations() const;
Sylvain Thery's avatar
Sylvain Thery committed
60

Pierre Kraemer's avatar
Pierre Kraemer committed
61 62 63 64
	/*! @name Basic Topological Operators
	 * Access and Modification
	 *************************************************************************/

Sylvain Thery's avatar
Sylvain Thery committed
65
	Dart beta0(const Dart d) const;
Pierre Kraemer's avatar
Pierre Kraemer committed
66 67 68 69 70 71 72 73 74

	void beta0sew(Dart d, Dart e);

	void beta0unsew(Dart d);

	/*! @name Constructors and Destructors
	 *  To generate or delete cells in a 0-G-map
	 *************************************************************************/

75
	//@{
Pierre Kraemer's avatar
Pierre Kraemer committed
76 77 78 79 80 81 82 83 84 85 86
	/**
	* create an edge
	* @return a dart of the edge
	*/
	Dart newEdge();

	/**
	* delete an edge
	* @param d a dart of the edge
	*/
	void deleteEdge(Dart d);
87
	//@}
Pierre Kraemer's avatar
Pierre Kraemer committed
88 89 90 91 92 93 94 95 96 97

	/*! @name Cell Functors
	 *  Apply functors to all darts of a cell
	 *************************************************************************/

	//@{
	//! Apply a functor on every dart of a vertex
	/*! @param d a dart of the vertex
	 *  @param f the functor to apply
	 */
98
	void foreach_dart_of_vertex(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const;
Pierre Kraemer's avatar
Pierre Kraemer committed
99 100 101 102 103

	//! Apply a functor on every dart of an edge
	/*! @param d a dart of the edge
	 *  @param f the functor to apply
	 */
104
	void foreach_dart_of_edge(Dart d, std::function<void (Dart)> f, unsigned int thread = 0) const;
Pierre Kraemer's avatar
Pierre Kraemer committed
105 106 107 108 109 110 111 112
	//@}
};

} // namespace CGoGN

#include "Topology/gmap/gmap0.hpp"

#endif