Start to reintroduce last master modifications

This commit is contained in:
Guillaume Damiand 2023-04-26 10:17:58 +02:00
parent 57f0b8908d
commit c9a683bf54
39 changed files with 337 additions and 117 deletions

View File

@ -115,7 +115,7 @@ To answer this need, a combinatorial map allows to create <I>attributes</I> whic
<LI>an <I>i</I>-cell may have no associated <I>i</I>-attribute.
</UL>
Since <I>i</I>-cells are not explicitely represented in combinatorial maps, the association between <I>i</I>-cells and <I>i</I>-attributes is transferred to darts: if attribute <I>a</I> is associated to <I>i</I>-cell <I>c</I>, all the darts belonging to <I>c</I> are associated to <I>a</I>.
Since <I>i</I>-cells are not explicitly represented in combinatorial maps, the association between <I>i</I>-cells and <I>i</I>-attributes is transferred to darts: if attribute <I>a</I> is associated to <I>i</I>-cell <I>c</I>, all the darts belonging to <I>c</I> are associated to <I>a</I>.
We can see two examples of combinatorial maps having some attributes in \cgalFigureRef{fig_cmap_with_attribs}. In the first example (Left), a 2D combinatorial map has 1-attributes containing a float, for example corresponding to the length of the associated 1-cell, and 2-attributes containing a color in RGB format. In the second example (Right), a 3D combinatorial map has 2-attributes containing a color in RGB format.
@ -280,7 +280,7 @@ There are also two different classes of ranges containing one dart per <I>i</I>-
The iterators of the \link GenericMap::Dart_range `Dart_range`\endlink are bidirectional iterators, while the iterators of the other four ranges are forward iterators. The value type of all these iterators is `Dart` thus all these iterators can be directly used as \link GenericMap::Dart_descriptor `Dart_descriptor`\endlink.
Additionally, there is a range over non void <I>i</I>-attributes: \link GenericMap::Attribute_range `Attribute_range<i>::type`\endlink, having a bidirectional iterator with value type \link GenericMap::Attribute_type Attribute_type<i>::type`\endlink.
Additionally, there is a range over non void <I>i</I>-attributes: \link GenericMap::Attribute_range `Attribute_range<i>::type`\endlink, having a bidirectional iterator with value type \link GenericMap::Attribute_type `Attribute_type<i>::type`\endlink.
For each range, there is an associated const range, a model of the `ConstRange` concept. You can find some examples of ranges in Section \ref ssecexample3DCM "A 3D Combinatorial Map".

View File

@ -4,7 +4,7 @@
The concept `CombinatorialMap` defines a <I>d</I>-dimensional combinatorial map.
\cgalRefines `GenericMap`
\cgalRefines{GenericMap}
\cgalHasModel \link CGAL::Combinatorial_map `CGAL::Combinatorial_map<d,Items,Alloc>`\endlink

View File

@ -4,7 +4,7 @@
The concept `GenericMap` defines a <I>d</I>-dimensional generic map. This concept is defined only to factorize the common notions between \link CombinatorialMap `CombinatorialMap`\endlink and \link GeneralizedMap `GeneralizedMap`\endlink concepts.
\cgalRefines DefaultConstructible
\cgalRefines{DefaultConstructible}
A generic map has a set of darts <I>D</I>, and functions \f$ f_0\f$,\f$ \ldots\f$,\f$ f_{d}\f$ that link these darts between them.
@ -450,28 +450,28 @@ template <unsigned int i>
const Attribute_type<i>::type::Info& info_of_attribute(typename Attribute_const_descriptor<i>::type ah) const;
/*!
A shorcut for \link GenericMap::info_of_attribute `info_of_attribute<i>`\endlink`(`\link GenericMap::attribute `attribute<i>`\endlink`(adart))`.
A shortcut for \link GenericMap::info_of_attribute `info_of_attribute<i>`\endlink`(`\link GenericMap::attribute `attribute<i>`\endlink`(adart))`.
\pre \link GenericMap::attribute `attribute<i>`\endlink`(adart)!=nullptr`.
*/
template<unsigned int i>
typename Attribute_type<i>::type::Info & info(Dart_descriptor adart);
/*!
A shorcut for \link GenericMap::info_of_attribute(typename Attribute_const_descriptor<i>::type)const `info_of_attribute<i>`\endlink`(`\link GenericMap::attribute(Dart_const_descriptor)const `attribute<i>`\endlink`(adart))` for const descriptor.
A shortcut for \link GenericMap::info_of_attribute(typename Attribute_const_descriptor<i>::type)const `info_of_attribute<i>`\endlink`(`\link GenericMap::attribute(Dart_const_descriptor)const `attribute<i>`\endlink`(adart))` for const descriptor.
\pre \link GenericMap::attribute(Dart_const_descriptor)const `attribute<i>`\endlink`(adart)!=nullptr`.
*/
template<unsigned int i>
const typename Attribute_type<i>::type::Info & info(Dart_const_descriptor adart) const;
/*!
A shorcut for \link GenericMap::dart_of_attribute `dart_of_attribute<i>`\endlink`(`\link GenericMap::attribute `attribute<i>`\endlink`(adart))`.
A shortcut for \link GenericMap::dart_of_attribute `dart_of_attribute<i>`\endlink`(`\link GenericMap::attribute `attribute<i>`\endlink`(adart))`.
\pre `attribute<i>(adart)!=nullptr`.
*/
template<unsigned int i>
Dart_descriptor & dart(Dart_descriptor adart);
/*!
A shorcut for \link GenericMap::dart_of_attribute(typename Attribute_const_descriptor<i>::type)const `dart_of_attribute<i>`\endlink`(`\link GenericMap::attribute(Dart_const_descriptor)const `attribute<i>`\endlink`(adart))` for const descriptor.
A shortcut for \link GenericMap::dart_of_attribute(typename Attribute_const_descriptor<i>::type)const `dart_of_attribute<i>`\endlink`(`\link GenericMap::attribute(Dart_const_descriptor)const `attribute<i>`\endlink`(adart))` for const descriptor.
\pre `attribute<i>(adart)!=nullptr`.
*/
template<unsigned int i>
@ -679,7 +679,7 @@ Returns the status of the management of the attributes of the generic map. <code
bool are_attributes_automatically_managed() const;
/*!
Set the status of the managment of the attributes of the generic map.
Set the status of the management of the attributes of the generic map.
\cgalAdvancedBegin
After calling `set_automatic_attributes_management(false)`, all high level operations will not update non void attributes, until the call of `set_automatic_attributes_management(true)`. The call of `set_automatic_attributes_management(true)` call the \link GenericMap::correct_invalid_attributes `correct_invalid_attributes()`\endlink function.

View File

@ -40,7 +40,7 @@ struct Split_functor
// operator() automatically called after a split.
void operator()(Face_attribute& ca1, Face_attribute& ca2)
{
// We need to reinitalize the weight of the two faces
// We need to reinitialize the weight of the two faces
CMap_3::size_type nb1=mmap.darts_of_cell<2>(ca1.dart()).size();
CMap_3::size_type nb2=mmap.darts_of_cell<2>(ca2.dart()).size();
mmap.info<2>(ca1.dart())*=(double(nb1)/(nb1+nb2));

View File

@ -176,11 +176,11 @@ struct Init_id;
{ return !operator==(other); }
protected:
/// Contructor without parameter.
/// Constructor without parameter.
Cell_attribute_without_info(): mrefcounting(0), m_for_cc(Refs::null_descriptor)
{}
/// Copy contructor.
/// Copy constructor.
Cell_attribute_without_info(const Cell_attribute_without_info& acell):
mrefcounting(acell.mrefcounting)
{}
@ -301,12 +301,12 @@ struct Init_id;
{ return !operator==(other); }
protected:
/// Contructor without parameter.
/// Constructor without parameter.
Cell_attribute_without_info() : mdart(Refs::null_descriptor),
mrefcounting(0)
{}
/// Copy contructor.
/// Copy constructor.
Cell_attribute_without_info(const Cell_attribute_without_info& acell):
mdart(acell.mdart),
mrefcounting(acell.mrefcounting)
@ -398,7 +398,7 @@ struct Init_id;
typedef void Info;
protected:
/// Default contructor.
/// Default constructor.
Cell_attribute()
{}
};
@ -461,11 +461,11 @@ struct Init_id;
{ return !operator==(other); }
protected:
/// Default contructor.
/// Default constructor.
Cell_attribute()
{}
/// Contructor with an info in parameter.
/// Constructor with an info in parameter.
Cell_attribute(const Info_& ainfo) :
Info_for_cell_attribute<Info_>(ainfo)
{}

View File

@ -42,11 +42,11 @@ namespace CGAL {
friend class Concurrent_compact_container;
protected:
/// Default contructor.
/// Default constructor.
Cell_attribute_with_id()
{}
/// Contructor with an info in parameter.
/// Constructor with an info in parameter.
Cell_attribute_with_id(const Info_& ainfo) :
Cell_attribute<Refs, Info_, Tag_, OnMerge, OnSplit, Tag_true>(ainfo)
{}
@ -64,7 +64,7 @@ namespace CGAL {
friend class Concurrent_compact_container;
protected:
/// Default contructor.
/// Default constructor.
Cell_attribute_with_id()
{}
};

View File

@ -219,7 +219,7 @@ namespace CGAL {
* @param dartinfoconverter functor to transform original information of darts into information of copies
* @param pointconverter functor to transform points in original map into points of copies.
* @param copy_perforated_darts true to copy also darts marked perforated (if any)
* @param mark_perforated_darts true to mark darts wich are copies of perforated darts (if any)
* @param mark_perforated_darts true to mark darts which are copies of perforated darts (if any)
* @post *this is valid.
*/
template <typename CMap2, typename Dart_descriptor_2,
@ -1590,7 +1590,7 @@ namespace CGAL {
std::get<Helper::template Dimension_index<i>::value>
(mattribute_containers).emplace(args...);
// Reinitialize the ref counting of the new attribute. This is normally
// not required except if create_attribute is used as "copy contructor".
// not required except if create_attribute is used as "copy constructor".
this->template init_attribute_ref_counting<i>(res);
internal::Init_id<typename Attribute_range<i>::type>::run
(this->template attributes<i>(), res);
@ -1639,8 +1639,8 @@ namespace CGAL {
CGAL_static_assertion(i<=dimension);
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
"set_attribute<i> but i-attributes are disabled");
for (typename Dart_of_cell_range<i>::iterator it(*this, dh); it.cont(); ++it)
for (typename Dart_of_cell_range<i>::iterator it(*this, dh);
it.cont(); ++it)
{
this->template set_dart_attribute<i>(it, ah);
}
@ -3543,7 +3543,7 @@ namespace CGAL {
<Self, Map2, 0>::run(*this, map2, current, other);
}
// We test if the injection is valid with its neighboors.
// We test if the injection is valid with its neighbors.
// We go out as soon as it is not satisfied.
for (i=0; match && i<=dimension; ++i)
{
@ -3772,7 +3772,7 @@ namespace CGAL {
/** Test if a face is a combinatorial polygon of length alg
* (a cycle of alg darts beta1 links together).
* @param adart an intial dart
* @param adart an initial dart
* @return true iff the face containing adart is a polygon of length alg.
*/
bool is_face_combinatorial_polygon(Dart_const_descriptor adart,
@ -3858,7 +3858,7 @@ namespace CGAL {
}
/** Test if a volume is a combinatorial tetrahedron.
* @param adart an intial dart
* @param adart an initial dart
* @return true iff the volume containing adart is a combinatorial tetrahedron.
*/
bool is_volume_combinatorial_tetrahedron(Dart_const_descriptor d1) const
@ -3951,7 +3951,7 @@ namespace CGAL {
}
/** Test if a volume is a combinatorial hexahedron.
* @param adart an intial dart
* @param adart an initial dart
* @return true iff the volume containing adart is a combinatorial hexahedron.
*/
bool is_volume_combinatorial_hexahedron(Dart_const_descriptor d1) const
@ -4145,7 +4145,7 @@ namespace CGAL {
}
/** Insert a vertex in the given 2-cell which is split in triangles,
* once for each inital edge of the facet.
* once for each initial edge of the facet.
* @param adart a dart of the facet to triangulate.
* @param update_attributes a boolean to update the enabled attributes
* (deprecated, now we use are_attributes_automatically_managed())

View File

@ -41,7 +41,7 @@ namespace internal
// ****************************************************************************
// Map1 is the existing map, to convert into map2.
// Functor called only when both i-attributes have non void info.
// General cases when both info are differents.
// General cases when both info are different.
template< typename Map1, typename Map2, unsigned int i,
typename Info1=typename Map1::template
Attribute_type<i>::type::Info,
@ -439,7 +439,7 @@ struct Default_converter_cmap_attributes
};
// ****************************************************************************
// Cast converter always copy attributes, doing a cast. This can work only
// if both types are convertible and this is user responsability
// if both types are convertible and this is user responsibility
// to use it only in this case.
template< typename Map1, typename Map2, unsigned int i>
struct Cast_converter_cmap_attributes
@ -480,7 +480,7 @@ struct Default_converter_dart_info<Map1, Map2, Info, Info>
};
// ****************************************************************************
// Cast converter of dart info. This can work only if both types are
// convertible and this is user responsability to use it only in this case.
// convertible and this is user responsibility to use it only in this case.
template< typename Map1, typename Map2>
struct Cast_converter_dart_info
{

View File

@ -33,7 +33,7 @@
* Group_attribute_functor<CMap> to group the <i>-attributes of two
* given i-cells (except for j-adim). If one i-attribute is nullptr, we set the
* darts of its i-cell to the second attribute. If both i-attributes are
* non nullptr, we overide all the i-attribute of the second i-cell to the
* non nullptr, we override all the i-attribute of the second i-cell to the
* first i-attribute.
*
* Group_neighboor_attribute to group the <i>-attributes of beta_i(d1) and
@ -609,6 +609,15 @@ void test_split_attribute_functor_one_dart
Attribute_descriptor_i a1 = amap.template attribute<i>(adart);
if ( found_attributes.is_defined(a1) )
{ // Here the attribute was already present in the hash_map
// We need to call reserve for the cc with index case. Indeed, if the vector
// is reallocated, the reference returned by get_attribute<i>(a1) will be
// invalidated, and the copy will be wrong. Note that there is no overhead
// since the creation of the attribute need one allocation.
amap.template attributes<i>().reserve(amap.template attributes<i>().size()+1);
// Now we are sure that the creation of a new attribute will not imply
// a realloc.
Attribute_descriptor_i a2 = amap.template
create_attribute<i>(amap.template get_attribute<i>(a1));

View File

@ -39,7 +39,7 @@
* valid (all its darts are linked to the same attribute, no other dart is
* linked with this attribute).
*
* internal::Count_cell_functor<CMap> to count the nuber of i-cells.
* internal::Count_cell_functor<CMap> to count the number of i-cells.
*
* internal::Count_bytes_one_attribute_functor<CMap> to count the memory
* occupied by i-attributes.
@ -66,7 +66,7 @@
* internal::Test_is_same_attribute_functor<Map1, Map2> to test if two
* i-attributes of two darts are isomorphic (ie they have the same info).
*
* inernal::Test_is_same_attribute_point_functor<Map1, Map2, i> to test if
* internal::Test_is_same_attribute_point_functor<Map1, Map2, i> to test if
* the point of two i-attributes are equal.
*
* internal::Reverse_orientation_of_map_functor<CMap> to reverse the

View File

@ -533,7 +533,7 @@ namespace CGAL
struct Attribute_type<d,0>
{ typedef Void type; };
// Helper class allowing to retreive the d-cell-descriptor attribute
// Helper class allowing to retrieve the d-cell-descriptor attribute
template<int d, class Type=typename Attribute_type<d>::type,
typename WithIndex=typename CMap::Use_index>
struct Attribute_descriptor
@ -550,7 +550,7 @@ namespace CGAL
struct Attribute_descriptor<d, CGAL::Void, CGAL::Tag_true>
{ typedef typename CMap::Dart_index type; };
// Helper class allowing to retreive the d-cell-const descriptor attribute
// Helper class allowing to retrieve the d-cell-const descriptor attribute
template<int d, class Type=typename Attribute_type<d>::type>
struct Attribute_const_descriptor
{
@ -562,7 +562,7 @@ namespace CGAL
struct Attribute_const_descriptor<d, CGAL::Void>
{ typedef CGAL::Void* type; };
// Helper class allowing to retreive the d-cell-iterator attribute
// Helper class allowing to retrieve the d-cell-iterator attribute
template<int d, class Type=typename Attribute_type<d>::type>
struct Attribute_iterator
{
@ -574,7 +574,7 @@ namespace CGAL
struct Attribute_iterator<d, CGAL::Void>
{ typedef CGAL::Void* type; };
// Helper class allowing to retreive the d-cell-const descriptor attribute
// Helper class allowing to retrieve the d-cell-const descriptor attribute
template<int d, class Type=typename Attribute_type<d>::type>
struct Attribute_const_iterator
{
@ -586,7 +586,7 @@ namespace CGAL
struct Attribute_const_iterator<d, CGAL::Void>
{ typedef CGAL::Void* type; };
// Helper class allowing to retreive the d-cell-attribute range
// Helper class allowing to retrieve the d-cell-attribute range
template<int d, class Type=typename Attribute_type<d>::type>
struct Attribute_range
{

View File

@ -28,7 +28,7 @@ namespace CGAL {
* Basic classes that serve as tools for definition of iterators.
There are 3 classes:
* - CMap_dart_iterator<Map,Const> is the basic generic class defining
* what is an interator on darts.
* what is an iterator on darts.
* - CMap_extend_iterator<Map,Ite,Bi> to extend the given iterator by adding
* the involution Bi.
* - CMap_non_basic_iterator<Map_,Ite> to transform the basic iterator Ite

View File

@ -347,7 +347,7 @@ namespace CGAL {
using boost::property_tree::ptree;
ptree pt;
// update pt adding nodes containing attributes informations
// update pt adding nodes containing attributes information
CMap::Helper::template Foreach_enabled_attributes
<My_functor_cmap_save_attrib<CMap> >::run(const_cast<CMap&>(amap), pt, myDarts);
@ -371,7 +371,7 @@ namespace CGAL {
tree.put("data", "");
/** First we save general information of the map (by default nothing,
the fuction can be specialized by users). */
the function can be specialized by users). */
f(tree);
// map dart => number
@ -818,7 +818,7 @@ namespace CGAL {
read_xml(input, pt);
/** First we load general information of the map (by default nothing,
the fuction can be specialized by users). */
the function can be specialized by users). */
f(pt);
// Then we load darts and attributes.

View File

@ -146,6 +146,8 @@ namespace CGAL {
{ return cit; }
bool is_used(size_type i) const
{ return mmap.mdarts.is_used(i); }
bool owns(size_type i) const
{ return mmap.mdarts.owns(i); }
private:
Self & mmap;
};
@ -286,6 +288,13 @@ namespace CGAL {
{
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
"copy_attribute<i> called but i-attributes are disabled.");
// We need to do a reserve before the emplace in order to avoid a bug of
// invalid reference when the container is reallocated.
std::get<Helper::template Dimension_index<i>::value>
(mattribute_containers).reserve
(std::get<Helper::template Dimension_index<i>::value>
(mattribute_containers).size()+1);
typename Attribute_descriptor<i>::type res=
std::get<Helper::template Dimension_index<i>::value>
(mattribute_containers).emplace(get_attribute<i>(ah));

View File

@ -755,16 +755,21 @@ public:
return false;
}
bool owns_dereferencable(const_iterator cit) const
bool owns(size_type i) const
{ return i<capacity() && is_used(i); }
bool owns_dereferenceable(const_iterator cit) const
{ return cit!=end() && owns(cit); }
CGAL_DEPRECATED bool owns_dereferencable(const_iterator cit) const
{ return owns_dereferenceable(cit); }
/** Reserve method to ensure that the capacity of the Compact_container be
* greater or equal than a given value n.
*/
void reserve(size_type n)
{
if(capacity_>=n) return;
capacity_=n;
increase_size();
}

View File

@ -241,7 +241,7 @@ namespace CGAL {
}
protected:
/// Neighboors for each dimension +1 (from 0 to dimension).
/// Neighbors for each dimension +1 (from 0 to dimension).
Dart_descriptor mf[dimension+1];
/// Values of Boolean marks.

View File

@ -19,10 +19,10 @@ namespace CGAL {
class Info_for_cell_attribute
{
public:
/// Contructor without parameter.
/// Constructor without parameter.
Info_for_cell_attribute()=default; // default => zero-initializing built-in types
/// Contructor with an info in parameter.
/// Constructor with an info in parameter.
Info_for_cell_attribute(const Info& ainfo) : minfo(ainfo)
{}

View File

@ -24,9 +24,17 @@ target_compile_definitions(Combinatorial_map_copy_test_index PUBLIC USE_COMPACT_
target_link_libraries(Combinatorial_map_copy_test_index PUBLIC CGAL CGAL::Data)
cgal_add_compilation_test(Combinatorial_map_copy_test_index)
create_single_source_cgal_program(cmap_test_split_attribute.cpp)
# Link with OpenMesh if possible
find_package(OpenMesh QUIET)
if(TARGET OpenMesh::OpenMesh)
message(STATUS "Found OpenMesh")
target_link_libraries(Combinatorial_map_copy_test PRIVATE OpenMesh::OpenMesh)
target_compile_definitions(Combinatorial_map_copy_test PRIVATE -DCGAL_USE_OPENMESH)
target_link_libraries(Combinatorial_map_copy_test_index PRIVATE OpenMesh::OpenMesh)
target_compile_definitions(Combinatorial_map_copy_test_index PRIVATE -DCGAL_USE_OPENMESH)
else()
message(STATUS "NOTICE: Tests will not use OpenMesh.")
endif()

View File

@ -0,0 +1,92 @@
#include <CGAL/Combinatorial_map.h>
#include <CGAL/Cell_attribute.h>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdlib>
struct MyInfo
{
MyInfo() :data(1)
{}
MyInfo(int i) :data(i)
{}
int data;
};
struct Myitem1
{
using Use_index=CGAL::Tag_true; // use indices
using Index_type=std::uint16_t; // 16 bits
template<class CMap>
struct Dart_wrapper
{
typedef CGAL::Cell_attribute<CMap, MyInfo> attrib;
typedef std::tuple<void, void, attrib> Attributes;
};
};
struct Myitem2
{
template<class CMap>
struct Dart_wrapper
{
typedef CGAL::Cell_attribute<CMap, MyInfo> attrib;
typedef std::tuple<void, void, attrib> Attributes;
};
};
using CMap1=CGAL::Combinatorial_map<3,Myitem1>;
using CMap2=CGAL::Combinatorial_map<3,Myitem2>;
#define NB 1000
template<typename CMap>
bool test(const std::string& s)
{
bool res=true;
CMap m;
// 1) create a face and one attribute.
typename CMap::Dart_descriptor dd=m.make_combinatorial_polygon(4);
m.template set_attribute<2>(dd, m.template create_attribute<2>(2));
// 2) Split this face NB times => will create new 2-attributes for new faces
for(std::size_t i=0; i<NB; ++i)
{
typename CMap::Dart_descriptor
newd=m.insert_cell_1_in_cell_2(dd, m.next(m.next(dd)));
if(m.template attribute<2>(newd)==CMap::null_descriptor)
{
std::cout<<"ERROR1: "<<s<<": "
<<"attribute<2>(newd)==CMap::null_descriptor"<<std::endl;
res=false;
}
else if(m.template info<2>(newd).data!=2)
{
std::cout<<"ERROR2: "<<s<<": "<<m.template info<2>(newd).data<<std::endl;
res=false;
}
newd=m.template opposite<2>(newd);
if(m.template attribute<2>(newd)==CMap::null_descriptor)
{
std::cout<<"ERROR3: "<<s<<": "
<<"attribute<2>(newd)==CMap::null_descriptor"<<std::endl;
res=false;
}
else if(m.template info<2>(newd).data!=2)
{
std::cout<<"ERROR4: "<<s<<": "<<m.template info<2>(newd).data<<std::endl;
res=false;
}
}
return res;
}
int main()
{
if(!test<CMap1>("CMap1") || !test<CMap2>("CMap2"))
{ return EXIT_FAILURE; }
return EXIT_SUCCESS;
}

View File

@ -4,7 +4,7 @@
The concept `GeneralizedMap` defines a <I>d</I>-dimensional generalized map.
\cgalRefines `GenericMap`
\cgalRefines{GenericMap}
\cgalHasModel \link CGAL::Generalized_map `CGAL::Generalized_map<d,Items,Alloc>`\endlink

View File

@ -117,7 +117,7 @@ To answer this need, a generalized map allows to create <I>attributes</I> which
<LI>an <I>i</I>-cell may have no associated <I>i</I>-attribute.
</UL>
Since <I>i</I>-cells are not explicitely represented in generalized maps, the association between <I>i</I>-cells and <I>i</I>-attributes is transferred to darts: if attribute <I>a</I> is associated to <I>i</I>-cell <I>c</I>, all the darts belonging to <I>c</I> are associated to <I>a</I>.
Since <I>i</I>-cells are not explicitly represented in generalized maps, the association between <I>i</I>-cells and <I>i</I>-attributes is transferred to darts: if attribute <I>a</I> is associated to <I>i</I>-cell <I>c</I>, all the darts belonging to <I>c</I> are associated to <I>a</I>.
We can see two examples of generalized maps having some attributes in \cgalFigureRef{fig_gmap_with_attribs}. In the first example (Left), a 2D generalized map has 1-attributes containing a float, for example corresponding to the length of the associated 1-cell, and 2-attributes containing a color in RGB format. In the second example (Right), a 3D generalized map has 2-attributes containing a color in RGB format.
@ -279,7 +279,7 @@ There are also two different classes of ranges containing one dart per <I>i</I>-
The iterators of the \link GenericMap::Dart_range `Dart_range`\endlink are bidirectional iterators, while the iterators of the other four ranges are forward iterators. The value type of all these iterators is `Dart` thus all these iterators can be directly used as \link GenericMap::Dart_descriptor `Dart_descriptor`\endlink.
Additionally, there is a range over non void <I>i</I>-attributes: \link GenericMap::Attribute_range `Attribute_range<i>::type`\endlink, having a bidirectional iterator with value type \link GenericMap::Attribute_type Attribute_type<i>::type`\endlink.
Additionally, there is a range over non void <I>i</I>-attributes: \link GenericMap::Attribute_range `Attribute_range<i>::type`\endlink, having a bidirectional iterator with value type \link GenericMap::Attribute_type `Attribute_type<i>::type`\endlink.
For each range, there is an associated const range, a model of the `ConstRange` concept. You can find some examples of ranges in Section \ref ssecexample3DGM "A 3D Generalized Map".

View File

@ -40,7 +40,7 @@ struct Split_functor
// operator() automatically called after a split.
void operator()(Face_attribute& ca1, Face_attribute& ca2)
{
// We need to reinitalize the weight of the two faces
// We need to reinitialize the weight of the two faces
GMap_3::size_type nb1=mmap.darts_of_cell<2>(ca1.dart()).size();
GMap_3::size_type nb2=mmap.darts_of_cell<2>(ca2.dart()).size();
mmap.info<2>(ca1.dart())*=(double(nb1)/(nb1+nb2));

View File

@ -193,7 +193,7 @@ namespace CGAL {
* @param dartinfoconverter functor to transform original information of darts into information of copies
* @param pointconverter functor to transform points in original map into points of copies.
* @param copy_perforated_darts true to copy also darts marked perforated (if any)
* @param mark_perforated_darts true to mark darts wich are copies of perforated darts (if any)
* @param mark_perforated_darts true to mark darts which are copies of perforated darts (if any)
* @post *this is valid.
*/
template <typename GMap2, typename Dart_descriptor_2,
@ -1415,7 +1415,7 @@ namespace CGAL {
std::get<Helper::template Dimension_index<i>::value>
(mattribute_containers).emplace(args...);
// Reinitialize the ref counting of the new attribute. This is normally
// not required except if create_attribute is used as "copy contructor".
// not required except if create_attribute is used as "copy constructor".
this->template init_attribute_ref_counting<i>(res);
internal::Init_id<typename Attribute_range<i>::type>::run
(this->template attributes<i>(), res);
@ -2635,7 +2635,7 @@ namespace CGAL {
<Self, Map2, 0>::run(*this, map2, current, other);
}
// We test if the injection is valid with its neighboors.
// We test if the injection is valid with its neighbors.
// We go out as soon as it is not satisfied.
for (i = 0; match && i <= dimension; ++i)
{
@ -3024,7 +3024,7 @@ namespace CGAL {
/** Test if a face is a combinatorial polygon of length alg
* (a cycle of alg edges alpha1 links together).
* @param adart an intial dart
* @param adart an initial dart
* @return true iff the face containing adart is a polygon of length alg.
*/
bool is_face_combinatorial_polygon(Dart_const_descriptor adart,
@ -3118,7 +3118,7 @@ namespace CGAL {
}
/** Test if a volume is a combinatorial tetrahedron.
* @param adart an intial dart
* @param adart an initial dart
* @return true iff the volume containing adart is a combinatorial tetrahedron.
*/
bool is_volume_combinatorial_tetrahedron(Dart_const_descriptor d1) const
@ -3195,7 +3195,7 @@ namespace CGAL {
}
/** Test if a volume is a combinatorial hexahedron.
* @param adart an intial dart
* @param adart an initial dart
* @return true iff the volume containing adart is a combinatorial hexahedron.
*/
bool is_volume_combinatorial_hexahedron(Dart_const_descriptor d1) const
@ -3388,7 +3388,7 @@ namespace CGAL {
}
/** Insert a vertex in the given 2-cell which is split in triangles,
* once for each inital edge of the facet.
* once for each initial edge of the facet.
* @param adart a dart of the facet to triangulate.
* @return A dart incident to the new vertex.
*/
@ -3643,10 +3643,13 @@ namespace CGAL {
d2 = create_dart();
mark(it1,treated);
if (!isfree1)
{
d3 = create_dart();
d4 = create_dart();
this->template basic_link_alpha<2>(d1, d3);
this->template basic_link_alpha<2>(d2, d4);
}
for (unsigned int dim=3; dim<=dimension; ++dim)
{
@ -3654,21 +3657,30 @@ namespace CGAL {
is_marked(alpha(it1, dim), treated) )
{
basic_link_alpha(alpha(it1, dim, 1), d1, dim);
basic_link_alpha(alpha(it1, dim, 1, 0), d2, dim);
basic_link_alpha(alpha(d1, dim, 0), d2, dim);
basic_link_alpha(alpha(it1, dim, 1, 2), d3, dim);
basic_link_alpha(alpha(it1, dim, 1, 2, 0), d4, dim);
if (!isfree1)
{
basic_link_alpha(alpha(it1, 1, dim, 1), d3, dim);
basic_link_alpha(alpha(d3, dim, 0), d4, dim);
}
}
}
if (!isfree1)
{ this->template link_alpha<1>(this->template alpha<1>(it1), d3); }
this->template link_alpha<1>(it1, d1);
{
this->template link_alpha<1>(this->template alpha<1>(it1), d3);
if ( adart2!=null_descriptor )
{
CGAL_assertion (it2.cont());
this->template link_alpha<1>(this->template alpha<1>(it2), d4);
}
}
this->template link_alpha<1>(it1, d1);
if (adart2!=null_descriptor)
{
CGAL_assertion (it2.cont());
this->template link_alpha<1>(this->template alpha<1>(it2), d4);
this->template link_alpha<1>(it2, d2);
++it2;
}
@ -3678,14 +3690,18 @@ namespace CGAL {
update_attributes && ah!=null_descriptor)
{
internal::Set_i_attribute_of_dart_functor<Self, 0>::run(*this, d2, ah);
internal::Set_i_attribute_of_dart_functor<Self, 0>::run(*this, d4, ah);
if (!isfree1)
{
internal::Set_i_attribute_of_dart_functor<Self, 0>::run(*this, d4, ah);
}
}
}
// We do the link_alpha<0> after the link_alpha<1> to update the
// possible attributes of d2.
this->template link_alpha<0>(d1, d2);
this->template link_alpha<0>(d3, d4);
if (!isfree1)
{ this->template link_alpha<0>(d3, d4); }
}
if (are_attributes_automatically_managed() && update_attributes)
@ -3705,10 +3721,9 @@ namespace CGAL {
}
else // Here we degroup 2-attributes
{
// TODO if ( !this->template is_free<2>(d1) && d2!=null_descriptor )
if (adart2!=null_descriptor)
if (!this->template is_free<2>(d1) && d2!=null_descriptor)
{ CGAL::internal::GMap_degroup_attribute_functor_run<Self, 2>::
run(*this, adart1, adart2); }
run(*this, d1, this->template alpha<2>(d1)); }
}
}

View File

@ -34,7 +34,7 @@
* GMap_group_attribute_functor<GMap> to group the <i>-attributes of two
* given i-cells (except for j-adim). If one i-attribute is nullptr, we set the
* darts of its i-cell to the second attribute. If both i-attributes are
* non nullptr, we overide all the i-attribute of the second i-cell to the
* non nullptr, we override all the i-attribute of the second i-cell to the
* first i-attribute.
*
* GMap_degroup_attribute_functor_run<GMap> to degroup one i-attributes in two
@ -304,6 +304,13 @@ void GMap_test_split_attribute_functor_one_dart
Attribute_descriptor_i a1 = amap.template attribute<i>(adart);
if ( found_attributes.is_defined(a1) )
{ // Here the attribute was already present in the hash_map
// We need to call reserve for the cc with index case. Indeed, if the vector
// is reallocated, the reference returned by get_attribute<i>(a1) will be
// invalidated, and the copy will be wrong. Note that there is no overhead
// since the creation of the attribute need one allocation.
amap.template attributes<i>().reserve(amap.template attributes<i>().size()+1);
Attribute_descriptor_i a2 = amap.template
create_attribute<i>(amap.template get_attribute<i>(a1));

View File

@ -242,6 +242,13 @@ namespace CGAL {
{
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
"copy_attribute<i> called but i-attributes are disabled.");
// We need to do a reserve before the emplace in order to avoid a bug of
// invalid reference when the container is reallocated.
std::get<Helper::template Dimension_index<i>::value>
(mattribute_containers).reserve
(std::get<Helper::template Dimension_index<i>::value>
(mattribute_containers).size()+1);
typename Attribute_descriptor<i>::type res=
std::get<Helper::template Dimension_index<i>::value>
(mattribute_containers).emplace(get_attribute<i>(ah));

View File

@ -7,20 +7,10 @@ project(Generalized_map_Tests)
# CGAL and its components
find_package(CGAL REQUIRED)
# Boost and its components
find_package(Boost REQUIRED)
if(NOT Boost_FOUND)
message(
STATUS "This project requires the Boost library, and will not be compiled.")
return()
endif()
set(hfiles Generalized_map_2_test.h Generalized_map_3_test.h
Generalized_map_4_test.h GMap_test_insertions.h)
set(hfiles Generalized_map_2_test.h
Generalized_map_3_test.h
Generalized_map_4_test.h
GMap_test_insertions.h)
create_single_source_cgal_program("Generalized_map_test.cpp" ${hfiles})
@ -28,3 +18,5 @@ add_executable(Generalized_map_test_index Generalized_map_test.cpp ${hfiles})
target_compile_definitions(Generalized_map_test_index PUBLIC USE_COMPACT_CONTAINER_WITH_INDEX)
target_link_libraries(Generalized_map_test_index PUBLIC CGAL CGAL::Data)
cgal_add_compilation_test(Generalized_map_test_index)
create_single_source_cgal_program("gmap_test_split_attribute.cpp")

View File

@ -0,0 +1,92 @@
#include <CGAL/Generalized_map.h>
#include <CGAL/Cell_attribute.h>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdlib>
struct MyInfo
{
MyInfo() :data(1)
{}
MyInfo(int i) :data(i)
{}
int data;
};
struct Myitem1
{
using Use_index=CGAL::Tag_true; // use indices
using Index_type=std::uint16_t; // 16 bits
template<class GMap>
struct Dart_wrapper
{
typedef CGAL::Cell_attribute<GMap, MyInfo> attrib;
typedef std::tuple<void, void, attrib> Attributes;
};
};
struct Myitem2
{
template<class GMap>
struct Dart_wrapper
{
typedef CGAL::Cell_attribute<GMap, MyInfo> attrib;
typedef std::tuple<void, void, attrib> Attributes;
};
};
using GMap1=CGAL::Generalized_map<3,Myitem1>;
using GMap2=CGAL::Generalized_map<3,Myitem2>;
#define NB 1000
template<typename GMap>
bool test(const std::string& s)
{
bool res=true;
GMap m;
// 1) create a face and one attribute.
typename GMap::Dart_descriptor dd=m.make_combinatorial_polygon(4);
m.template set_attribute<2>(dd, m.template create_attribute<2>(2));
// 2) Split this face NB times => will create new 2-attributes for new faces
for(std::size_t i=0; i<NB; ++i)
{
typename GMap::Dart_descriptor
newd=m.insert_cell_1_in_cell_2(dd, m.template alpha<0,1>(dd));
if(m.template attribute<2>(newd)==GMap::null_descriptor)
{
std::cout<<"ERROR1: "<<s<<": "
<<"attribute<2>(newd)==GMap::null_descriptor"<<std::endl;
res=false;
}
else if(m.template info<2>(newd).data!=2)
{
std::cout<<"ERROR2: "<<s<<": "<<m.template info<2>(newd).data<<std::endl;
res=false;
}
newd=m.template opposite<2>(newd);
if(m.template attribute<2>(newd)==GMap::null_descriptor)
{
std::cout<<"ERROR3: "<<s<<": "
<<"attribute<2>(newd)==GMap::null_descriptor"<<std::endl;
res=false;
}
else if(m.template info<2>(newd).data!=2)
{
std::cout<<"ERROR4: "<<s<<": "<<m.template info<2>(newd).data<<std::endl;
res=false;
}
}
return res;
}
int main()
{
if(!test<GMap1>("GMap1") || !test<GMap2>("GMap2"))
{ return EXIT_FAILURE; }
return EXIT_SUCCESS;
}

View File

@ -10,7 +10,7 @@
# CGAL_USE_FILE - CMake file to use CGAL.
#
# Construct consitent error messages for use below.
# Construct consistent error messages for use below.
set(CGAL_DIR_DESCRIPTION "directory containing CGALConfig.cmake. This is either the binary directory where CGAL was configured or PREFIX/lib/CGAL for an installation.")
set(CGAL_DIR_MESSAGE "CGAL not found. Set the CGAL_DIR cmake variable or environment variable to the ${CGAL_DIR_DESCRIPTION}")

View File

@ -705,7 +705,7 @@ public: //---------------------------------------------------- circulator types
{
public:
/// default constructur
/// default constructor
Halfedge_around_face_circulator(const Surface_mesh* m=NULL, Face f=Face())
: mesh_(m)
{

View File

@ -137,7 +137,7 @@ public:
}
/// assign a scalar to all componenets
/// assign a scalar to all components
Vector<Scalar,N>& operator=(const Scalar s)
{
for (int i=0; i<N; ++i)

View File

@ -8,13 +8,6 @@ endif()
find_package(CGAL REQUIRED)
find_package(Boost 1.43.0)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
else()
set(USE_IN_SOURCE_TREE_BOOST true)
endif()
add_subdirectory(openvolumemesh)
include_directories(BEFORE openvolumemesh/src)

View File

@ -19,7 +19,7 @@ if (NOT CMAKE_BUILD_TYPE)
FORCE)
endif ()
# create our output directroy
# create our output directory
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Build)
file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build)
endif ()

View File

@ -13,7 +13,7 @@
# use this file except in compliance with the License. You may obtain a copy
# of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

View File

@ -18,9 +18,9 @@ INSTALLATION:
1) Install all the following libraries:
CGAL: https://www.cgal.org/
CGoGN: http://cgogn.u-strasbg.fr/
OpenMesh: http://www.openmesh.org/
OpenVolumeMesh: http://www.openvolumemesh.org/
CGoGN: https://cgogn.github.io/
OpenMesh: https://www.openmesh.org/
OpenVolumeMesh: https://www.openvolumemesh.org/
2) create links (or copy directory):
* in the 2D directory:
@ -41,7 +41,7 @@ CGAL_BUILD_DIR being the build directory of the CGAL library.
* In 2D, the programs take off files as input.
* In 3D, lcc and cgogn take tetmesh and OpenVolumeMesh takes ovm.
You can create a tetmesh file using tetgen programm with an off file as input (http://tetgen.berlios.de/) with option -g to generate XXX.mesh file. Rename this file into XXX.tetmesh. Modify the file to keep only the two following sections:
You can create a tetmesh file using tetgen with an OFF file as input (https://www.berlios.de/software/tetgen/) with option -g to generate XXX.mesh file. Rename this file into XXX.tetmesh. Modify the file to keep only the two following sections:
**********************
Vertices
@ -54,4 +54,4 @@ Tetrahedra
And for each tetrahedra line, remove the last column.
You obtain the tetmesh file. Then you can use the FileConverter/file_converter programm in the OpenVolumeMesh library to convert it into the corresponding ovm file.
You obtain the tetmesh file. Then you can use the FileConverter/file_converter program in the OpenVolumeMesh library to convert it into the corresponding ovm file.

View File

@ -48,14 +48,13 @@ if(NOT
(CGAL_Qt5_FOUND
AND Qt5_FOUND))
message(STATUS "NOTICE: This demo requires CGAL, "
"and Qt5, and will not be compiled.")
message("NOTICE: This demo requires CGAL and Qt5, and will not be compiled.")
else()
add_definitions(-DCGAL_USE_BASIC_VIEWER -DQT_NO_KEYWORDS)
# ui file, created wih Qt Designer
# ui file, created with Qt Designer
qt5_wrap_ui(uis MainWindow.ui CreateMesh.ui CreateMenger.ui
CreateSierpinskiCarpet.ui CreateSierpinskiTriangle.ui)

View File

@ -3261,7 +3261,7 @@ void MainWindow::sierpinski_triangle_split_face_in_four(Dart_descriptor dh, bool
}
else
{
// we dupplicate all 0-embeddings to set them to the splitted vertices
// we duplicate all 0-embeddings to set them to the split vertices
(scene.lcc)->set_dart_attribute<0>(scene.lcc->beta(d2,1),(scene.lcc)->create_vertex_attribute(scene.lcc->point(d1)));
(scene.lcc)->set_dart_attribute<0>(scene.lcc->beta(d3,1),(scene.lcc)->create_vertex_attribute(scene.lcc->point(d2)));
(scene.lcc)->set_dart_attribute<0>(scene.lcc->beta(d1,1),(scene.lcc)->create_vertex_attribute(scene.lcc->point(d3)));

View File

@ -5,7 +5,7 @@ Examples for Linear_cell_complex package:
linear_cell_complex_3_with_colored_vertices.cpp
linear_cell_complex_4.cpp
Three "basic" examples, detailled in the user manual.
Three "basic" examples, detailed in the user manual.
* plane_graph_to_lcc_2.cpp

View File

@ -4,7 +4,7 @@
cmake_minimum_required(VERSION 3.1...3.23)
project(Linear_cell_complex_Tests)
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
find_package(CGAL REQUIRED)
set(hfiles Linear_cell_complex_2_test.h
Linear_cell_complex_3_test.h Linear_cell_complex_3_test.h)
@ -26,11 +26,6 @@ target_compile_definitions(Linear_cell_complex_3_test_index PUBLIC USE_COMPACT_C
target_link_libraries(Linear_cell_complex_3_test_index PUBLIC CGAL CGAL::Data)
cgal_add_compilation_test(Linear_cell_complex_3_test_index)
if(CGAL_Qt5_FOUND)
target_link_libraries(Linear_cell_complex_3_test PUBLIC CGAL::CGAL_Basic_viewer)
target_link_libraries(Linear_cell_complex_3_test_index PUBLIC CGAL::CGAL_Basic_viewer)
endif()
add_executable(Linear_cell_complex_4_test_index Linear_cell_complex_4_test.cpp ${hfiles})
target_compile_definitions(Linear_cell_complex_4_test_index PUBLIC USE_COMPACT_CONTAINER_WITH_INDEX)
target_link_libraries(Linear_cell_complex_4_test_index PUBLIC CGAL CGAL::Data)

View File

@ -20,7 +20,6 @@
#include "Linear_cell_complex_2_test.h"
#include <fstream>
#include <typeinfo>
#include<CGAL/draw_linear_cell_complex.h>
template<typename LCC>
bool check_number_of_cells_3(LCC& lcc, unsigned int nbv, unsigned int nbe,
unsigned int nbf, unsigned int nbvol,
@ -218,7 +217,6 @@ bool test_LCC_3()
if ( !check_number_of_cells_3(lcc, 11, 13, 8, 2, 2) )
return false;
// CGAL::draw(lcc);
trace_test_begin();
lcc.template remove_cell<0>(dh9);
if ( !check_number_of_cells_3(lcc, 10, 12, 8, 2, 2) )
@ -983,7 +981,6 @@ bool test_LCC_3()
lcc.insert_cell_1_between_two_cells_2(lcc.template opposite<2>(lcc.next(lcc.next(dh1))),
lcc.next(lcc.next(dh3)));
CGAL::draw(lcc); // TODO remove
if (!check_number_of_cells_3(lcc, 16, 25, 11, 2, 1) )
return false;