mirror of https://github.com/CGAL/cgal
Update GMap and examples and tests to remove global function (following similar modif in CMap)
This commit is contained in:
parent
90efe83e91
commit
8175041481
|
|
@ -1,40 +1,27 @@
|
|||
# Created by the script cgal_create_cmake_script
|
||||
# This is the CMake script for compiling a CGAL application.
|
||||
|
||||
# cmake ../ -DCMAKE_BUILD_TYPE=Debug
|
||||
# ou
|
||||
# cmake ../ -DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
project( GMap_examples )
|
||||
project( Generalized_map_examples )
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5)
|
||||
cmake_minimum_required(VERSION 2.8.10)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
||||
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -w -pedantic -Wextra -Wall")
|
||||
|
||||
if ( COMMAND cmake_policy )
|
||||
cmake_policy( SET CMP0003 NEW )
|
||||
endif()
|
||||
|
||||
# Pour le problème de valgrind avec CGAL
|
||||
# add_definition(-DCGAL_DISABLE_ROUNDING_MATH_CHECK)
|
||||
|
||||
find_package(CGAL QUIET COMPONENTS Core )
|
||||
find_package(CGAL QUIET)
|
||||
|
||||
if ( CGAL_FOUND )
|
||||
|
||||
include( ${CGAL_USE_FILE} )
|
||||
|
||||
include( CGAL_CreateSingleSourceCGALProgram )
|
||||
include_directories(BEFORE ../../include)
|
||||
|
||||
create_single_source_cgal_program( "gmap_3_simple_example.cpp" )
|
||||
create_single_source_cgal_program( "gmap_4_simple_example.cpp" )
|
||||
create_single_source_cgal_program( "gmap_3_with_colored_facets.cpp" )
|
||||
create_single_source_cgal_program( "gmap_3_operations.cpp" )
|
||||
create_single_source_cgal_program( "gmap_3_marks.cpp" )
|
||||
include_directories (BEFORE "../../include")
|
||||
|
||||
# create a target per cppfile
|
||||
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
foreach(cppfile ${cppfiles})
|
||||
create_single_source_cgal_program( "${cppfile}" )
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include <CGAL/Generalized_map.h>
|
||||
#include <CGAL/Generalized_map_constructors.h>
|
||||
#include <CGAL/Cell_attribute.h>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
|
|
@ -7,19 +6,19 @@
|
|||
// My item class: no functor is associated with Face_attribute.
|
||||
struct Myitem
|
||||
{
|
||||
template<class CMap>
|
||||
template<class GMap>
|
||||
struct Dart_wrapper
|
||||
{
|
||||
typedef CGAL::Dart<3, CMap> Dart;
|
||||
typedef CGAL::Cell_attribute<CMap, int> Face_attribute;
|
||||
typedef CGAL::GMap_dart<3, GMap> Dart;
|
||||
typedef CGAL::Cell_attribute<GMap, int> Face_attribute;
|
||||
typedef CGAL::cpp11::tuple<void,void,Face_attribute> Attributes;
|
||||
};
|
||||
};
|
||||
|
||||
// Definition of my combinatorial map.
|
||||
typedef CGAL::Combinatorial_map<3,Myitem> CMap_3;
|
||||
typedef CMap_3::Dart_handle Dart_handle;
|
||||
typedef CMap_3::Attribute_type<2>::type Face_attribute;
|
||||
typedef CGAL::Generalized_map<3,Myitem> GMap_3;
|
||||
typedef GMap_3::Dart_handle Dart_handle;
|
||||
typedef GMap_3::Attribute_type<2>::type Face_attribute;
|
||||
|
||||
// Functor called when two faces are merged.
|
||||
struct Merge_functor
|
||||
|
|
@ -36,7 +35,7 @@ struct Merge_functor
|
|||
// Functor called when one face is split in two.
|
||||
struct Split_functor
|
||||
{
|
||||
Split_functor(CMap_3& amap) : mmap(amap)
|
||||
Split_functor(GMap_3& amap) : mmap(amap)
|
||||
{}
|
||||
|
||||
// operator() automatically called after a split.
|
||||
|
|
@ -51,84 +50,84 @@ struct Split_functor
|
|||
private:
|
||||
|
||||
// The info of a face is the mean of the info of all its neighboors faces.
|
||||
void set_color_of_face(CMap_3::Dart_handle dh)
|
||||
void set_color_of_face(GMap_3::Dart_handle dh)
|
||||
{
|
||||
int nb=0;
|
||||
int sum=0;
|
||||
for (CMap_3::Dart_of_orbit_range<1>::iterator
|
||||
it=mmap.darts_of_orbit<1>(dh).begin(),
|
||||
itend=mmap.darts_of_orbit<1>(dh).end();
|
||||
for (GMap_3::Dart_of_cell_range<1>::iterator
|
||||
it=mmap.darts_of_cell<1>(dh).begin(),
|
||||
itend=mmap.darts_of_cell<1>(dh).end();
|
||||
it!=itend; ++it, ++nb)
|
||||
{ sum+=mmap.info<2>(mmap.beta<2>(it)); }
|
||||
{ sum+=mmap.info<2>(mmap.alpha<2>(it)); }
|
||||
|
||||
mmap.info<2>(dh)=(sum/nb);
|
||||
}
|
||||
|
||||
CMap_3& mmap;
|
||||
GMap_3& mmap;
|
||||
};
|
||||
|
||||
// Function allowing to display all the 2-attributes, and the characteristics
|
||||
// of a given combinatorial map.
|
||||
void display_map_and_2attributes(CMap_3& cm)
|
||||
void display_map_and_2attributes(GMap_3& gm)
|
||||
{
|
||||
for (CMap_3::Attribute_range<2>::type::iterator
|
||||
it=cm.attributes<2>().begin(), itend=cm.attributes<2>().end();
|
||||
for (GMap_3::Attribute_range<2>::type::iterator
|
||||
it=gm.attributes<2>().begin(), itend=gm.attributes<2>().end();
|
||||
it!=itend; ++it)
|
||||
{
|
||||
std::cout<<cm.info_of_attribute<2>(it)<<"; ";
|
||||
std::cout<<gm.info_of_attribute<2>(it)<<"; ";
|
||||
}
|
||||
std::cout<<std::endl;
|
||||
cm.display_characteristics(std::cout);
|
||||
std::cout<<", valid="<<cm.is_valid()<<std::endl;
|
||||
gm.display_characteristics(std::cout);
|
||||
std::cout<<", valid="<<gm.is_valid()<<std::endl;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
CMap_3 cm;
|
||||
GMap_3 gm;
|
||||
|
||||
// 0) Create 2 hexahedra.
|
||||
Dart_handle dh1 = cm.make_combinatorial_hexahedron();
|
||||
Dart_handle dh2 = cm.make_combinatorial_hexahedron();
|
||||
Dart_handle dh1 = gm.make_combinatorial_hexahedron();
|
||||
Dart_handle dh2 = gm.make_combinatorial_hexahedron();
|
||||
|
||||
// 1) Create 2-attributes of the first hexahedron, info()==7.
|
||||
for (CMap_3::One_dart_per_incident_cell_range<2, 3>::iterator
|
||||
it=cm.one_dart_per_incident_cell<2,3>(dh1).begin(),
|
||||
itend=cm.one_dart_per_incident_cell<2,3>(dh1).end(); it!=itend; ++it)
|
||||
{ cm.set_attribute<2>(it, cm.create_attribute<2>(7)); }
|
||||
for (GMap_3::One_dart_per_incident_cell_range<2, 3>::iterator
|
||||
it=gm.one_dart_per_incident_cell<2,3>(dh1).begin(),
|
||||
itend=gm.one_dart_per_incident_cell<2,3>(dh1).end(); it!=itend; ++it)
|
||||
{ gm.set_attribute<2>(it, gm.create_attribute<2>(7)); }
|
||||
|
||||
// 2) Create 2-attributes of the second hexahedron, info()==13.
|
||||
for (CMap_3::One_dart_per_incident_cell_range<2, 3>::iterator it=
|
||||
cm.one_dart_per_incident_cell<2,3>(dh2).begin(),
|
||||
itend=cm.one_dart_per_incident_cell<2,3>(dh2).end(); it!=itend; ++it)
|
||||
{ cm.set_attribute<2>(it, cm.create_attribute<2>(13)); }
|
||||
for (GMap_3::One_dart_per_incident_cell_range<2, 3>::iterator it=
|
||||
gm.one_dart_per_incident_cell<2,3>(dh2).begin(),
|
||||
itend=gm.one_dart_per_incident_cell<2,3>(dh2).end(); it!=itend; ++it)
|
||||
{ gm.set_attribute<2>(it, gm.create_attribute<2>(13)); }
|
||||
|
||||
// 3) Set the onsplit and onmerge functors.
|
||||
cm.onsplit_functor<2>()=Split_functor(cm);
|
||||
cm.onmerge_functor<2>()=Merge_functor();
|
||||
gm.onsplit_functor<2>()=Split_functor(gm);
|
||||
gm.onmerge_functor<2>()=Merge_functor();
|
||||
|
||||
// 4) 3-Sew the two hexahedra along one face. This calls 1 onmerge.
|
||||
cm.sew<3>(dh1, dh2);
|
||||
gm.sew<3>(dh1, dh2);
|
||||
|
||||
// 5) Display all the values of 2-attributes.
|
||||
display_map_and_2attributes(cm);
|
||||
display_map_and_2attributes(gm);
|
||||
|
||||
// 6) Insert a vertex in the face between the two hexahedra.
|
||||
// This calls 4 onsplit.
|
||||
Dart_handle resdart=cm.insert_cell_0_in_cell_2(dh2);
|
||||
// TODO Dart_handle resdart=gm.insert_cell_0_in_cell_2(dh2);
|
||||
|
||||
// 7) Display all the values of 2-attributes.
|
||||
display_map_and_2attributes(cm);
|
||||
display_map_and_2attributes(gm);
|
||||
|
||||
// 8) "Remove" the dynamic onmerge functor.
|
||||
cm.onmerge_functor<2>()=boost::function<void(Face_attribute&,
|
||||
gm.onmerge_functor<2>()=boost::function<void(Face_attribute&,
|
||||
Face_attribute&)>();
|
||||
|
||||
// 9) Remove one edge: this merges two faces, however no dynamic
|
||||
// functor is called (because it was removed).
|
||||
cm.remove_cell<1>(resdart);
|
||||
// TODO gm.remove_cell<1>(resdart);
|
||||
|
||||
// 10) Display all the values of 2-attributes.
|
||||
display_map_and_2attributes(cm);
|
||||
display_map_and_2attributes(gm);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,19 +17,18 @@
|
|||
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
|
||||
//
|
||||
#include <CGAL/Generalized_map.h>
|
||||
#include <CGAL/Generalized_map_constructors.h>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
|
||||
typedef CGAL::Generalized_map<3> CMap_3;
|
||||
typedef CMap_3::Dart_handle Dart_handle;
|
||||
typedef CGAL::Generalized_map<3> GMap_3;
|
||||
typedef GMap_3::Dart_handle Dart_handle;
|
||||
|
||||
int main()
|
||||
{
|
||||
CMap_3 cm;
|
||||
GMap_3 gm;
|
||||
|
||||
// Reserve a mark
|
||||
int mark = cm.get_new_mark();
|
||||
int mark = gm.get_new_mark();
|
||||
if ( mark==-1 )
|
||||
{
|
||||
std::cerr<<"No more free mark, exit."<<std::endl;
|
||||
|
|
@ -37,37 +36,37 @@ int main()
|
|||
}
|
||||
|
||||
// Create two tetrahedra.
|
||||
Dart_handle dh1 = CGAL::make_combinatorial_tetrahedron(cm);
|
||||
Dart_handle dh2 = CGAL::make_combinatorial_tetrahedron(cm);
|
||||
Dart_handle dh1 = gm.make_combinatorial_tetrahedron();
|
||||
Dart_handle dh2 = gm.make_combinatorial_tetrahedron();
|
||||
|
||||
CGAL_assertion( cm.is_valid() );
|
||||
CGAL_assertion( CGAL::is_volume_combinatorial_tetrahedron(cm, dh1) );
|
||||
CGAL_assertion( CGAL::is_volume_combinatorial_tetrahedron(cm, dh2) );
|
||||
CGAL_assertion( gm.is_valid() );
|
||||
CGAL_assertion( gm.is_volume_combinatorial_tetrahedron(dh1) );
|
||||
CGAL_assertion( gm.is_volume_combinatorial_tetrahedron(dh2) );
|
||||
|
||||
// 3-sew them.
|
||||
cm.sew<3>(dh1, dh2);
|
||||
gm.sew<3>(dh1, dh2);
|
||||
|
||||
// Mark the darts belonging to the first tetrahedron.
|
||||
for (CMap_3::Dart_of_cell_range<3>::iterator
|
||||
it(cm.darts_of_cell<3>(dh1).begin()),
|
||||
itend(cm.darts_of_cell<3>(dh1).end()); it!=itend; ++it)
|
||||
cm.mark(it, mark);
|
||||
for (GMap_3::Dart_of_cell_range<3>::iterator
|
||||
it(gm.darts_of_cell<3>(dh1).begin()),
|
||||
itend(gm.darts_of_cell<3>(dh1).end()); it!=itend; ++it)
|
||||
gm.mark(it, mark);
|
||||
|
||||
// Remove the common 2-cell between the two cubes:
|
||||
// the two tetrahedra are merged.
|
||||
// cm.remove_cell<2>(dh1);
|
||||
//TODO gm.remove_cell<2>(dh1);
|
||||
|
||||
// Thanks to the mark, we know which darts come from the first tetrahedron.
|
||||
unsigned int res=0;
|
||||
for (CMap_3::Dart_range::iterator it(cm.darts().begin()),
|
||||
itend(cm.darts().end()); it!=itend; ++it)
|
||||
for (GMap_3::Dart_range::iterator it(gm.darts().begin()),
|
||||
itend(gm.darts().end()); it!=itend; ++it)
|
||||
{
|
||||
if ( cm.is_marked(it, mark) )
|
||||
if ( gm.is_marked(it, mark) )
|
||||
++res;
|
||||
}
|
||||
|
||||
std::cout<<"Number of darts from the first tetrahedron: "<<res<<std::endl;
|
||||
cm.free_mark(mark);
|
||||
gm.free_mark(mark);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,29 +17,28 @@
|
|||
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
|
||||
//
|
||||
#include <CGAL/Generalized_map.h>
|
||||
#include <CGAL/Generalized_map_constructors.h>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
|
||||
typedef CGAL::Generalized_map<3> CMap_3;
|
||||
typedef CMap_3::Dart_handle Dart_handle;
|
||||
typedef CGAL::Generalized_map<3> GMap_3;
|
||||
typedef GMap_3::Dart_handle Dart_handle;
|
||||
|
||||
int main()
|
||||
{
|
||||
CMap_3 cm;
|
||||
GMap_3 gm;
|
||||
|
||||
// Create one hexahedron.
|
||||
Dart_handle d1 = CGAL::make_combinatorial_hexahedron(cm);
|
||||
CGAL_assertion( cm.is_valid() );
|
||||
CGAL_assertion( CGAL::is_volume_combinatorial_hexahedron(cm, d1) );
|
||||
Dart_handle d1 = gm.make_combinatorial_hexahedron();
|
||||
CGAL_assertion( gm.is_valid() );
|
||||
CGAL_assertion( gm.is_volume_combinatorial_hexahedron(d1) );
|
||||
|
||||
// Add two edges along two opposite facets.
|
||||
// CGAL::insert_cell_1_in_cell_2(cm,d1->alpha(1),d1->alpha(0));
|
||||
CGAL_assertion( cm.is_valid() );
|
||||
CGAL_assertion( gm.is_valid() );
|
||||
|
||||
Dart_handle d2=d1->alpha(2)->alpha(1)->alpha(1)->alpha(2);
|
||||
// CGAL::insert_cell_1_in_cell_2(cm,d2,d2->alpha(1)->alpha(1));
|
||||
CGAL_assertion( cm.is_valid() );
|
||||
CGAL_assertion( gm.is_valid() );
|
||||
|
||||
// Insert a facet along these two new edges plus two initial edges of the cube.
|
||||
std::vector<Dart_handle> path;
|
||||
|
|
@ -49,25 +48,25 @@ int main()
|
|||
path.push_back(d2->alpha(2)->alpha(1));
|
||||
|
||||
//Dart_handle d3=CGAL::insert_cell_2_in_cell_3(cm,path.begin(),path.end());
|
||||
CGAL_assertion( cm.is_valid() );
|
||||
CGAL_assertion( gm.is_valid() );
|
||||
|
||||
// Display the m characteristics.
|
||||
cm.display_characteristics(std::cout) << ", valid=" <<
|
||||
cm.is_valid() << std::endl;
|
||||
gm.display_characteristics(std::cout) << ", valid=" <<
|
||||
gm.is_valid() << std::endl;
|
||||
|
||||
// We use the removal operations to get back to the initial cube.
|
||||
// cm.remove_cell<2>(d3);
|
||||
CGAL_assertion( cm.is_valid() );
|
||||
// gm.remove_cell<2>(d3);
|
||||
CGAL_assertion( gm.is_valid() );
|
||||
|
||||
// cm.remove_cell<1>(d1->alpha(1));
|
||||
CGAL_assertion( cm.is_valid() );
|
||||
// gm.remove_cell<1>(d1->alpha(1));
|
||||
CGAL_assertion( gm.is_valid() );
|
||||
|
||||
// cm.remove_cell<1>(d2->alpha(0));
|
||||
CGAL_assertion( cm.is_valid() );
|
||||
// gm.remove_cell<1>(d2->alpha(0));
|
||||
CGAL_assertion( gm.is_valid() );
|
||||
|
||||
// Display the m characteristics.
|
||||
cm.display_characteristics(std::cout) << ", valid="
|
||||
<< cm.is_valid() << std::endl;
|
||||
gm.display_characteristics(std::cout) << ", valid="
|
||||
<< gm.is_valid() << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +1,29 @@
|
|||
#include <CGAL/Generalized_map.h>
|
||||
#include <CGAL/Generalized_map_constructors.h>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
|
||||
typedef CGAL::Generalized_map<3> CMap_3;
|
||||
typedef CMap_3::Dart_handle Dart_const_handle;
|
||||
typedef CGAL::Generalized_map<3> GMap_3;
|
||||
typedef GMap_3::Dart_handle Dart_const_handle;
|
||||
|
||||
int main()
|
||||
{
|
||||
CMap_3 cm;
|
||||
GMap_3 gm;
|
||||
|
||||
// Create two tetrahedra.
|
||||
Dart_const_handle d1 = CGAL::make_combinatorial_tetrahedron(cm);
|
||||
Dart_const_handle d2 = CGAL::make_combinatorial_tetrahedron(cm);
|
||||
Dart_const_handle d1 = gm.make_combinatorial_tetrahedron();
|
||||
Dart_const_handle d2 = gm.make_combinatorial_tetrahedron();
|
||||
|
||||
// Display the map characteristics.
|
||||
cm.display_characteristics(std::cout);
|
||||
std::cout<<", valid="<<cm.is_valid()<<std::endl;
|
||||
gm.display_characteristics(std::cout);
|
||||
std::cout<<", valid="<<gm.is_valid()<<std::endl;
|
||||
|
||||
unsigned int res = 0;
|
||||
// Iterate through all the darts of the first tetrahedron.
|
||||
// Note that CMap_3::Dart_of_orbit_range<1,2> is in 3D equivalent to
|
||||
// CMap_3::Dart_of_cell_range<3>.
|
||||
for (CMap_3::Dart_of_orbit_range<0,1,2>::const_iterator
|
||||
it(cm.darts_of_orbit<0,1,2>(d1).begin()),
|
||||
itend(cm.darts_of_orbit<0,1,2>(d1).end());
|
||||
// Note that GMap_3::Dart_of_orbit_range<1,2> is in 3D equivalent to
|
||||
// GMap_3::Dart_of_cell_range<3>.
|
||||
for (GMap_3::Dart_of_orbit_range<0,1,2>::const_iterator
|
||||
it(gm.darts_of_orbit<0,1,2>(d1).begin()),
|
||||
itend(gm.darts_of_orbit<0,1,2>(d1).end());
|
||||
it!=itend; ++it)
|
||||
++res;
|
||||
|
||||
|
|
@ -32,9 +31,9 @@ int main()
|
|||
|
||||
res = 0;
|
||||
// Iterate through all the darts of the face incident to d1.
|
||||
for (CMap_3::Dart_of_orbit_range<0,1>::const_iterator
|
||||
it(cm.darts_of_orbit<0,1>(d1).begin()),
|
||||
itend(cm.darts_of_orbit<0,1>(d1).end());
|
||||
for (GMap_3::Dart_of_orbit_range<0,1>::const_iterator
|
||||
it(gm.darts_of_orbit<0,1>(d1).begin()),
|
||||
itend(gm.darts_of_orbit<0,1>(d1).end());
|
||||
it!=itend; ++it)
|
||||
++res;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
|
||||
//
|
||||
#include <CGAL/Generalized_map.h>
|
||||
#include <CGAL/Generalized_map_constructors.h>
|
||||
#include <CGAL/Cell_attribute.h>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
|
@ -41,55 +40,55 @@ struct Divide_by_two_functor
|
|||
|
||||
struct Myitem
|
||||
{
|
||||
template<class CMap>
|
||||
template<class GMap>
|
||||
struct Dart_wrapper
|
||||
{
|
||||
typedef CGAL::GMap_dart<3, CMap> Dart;
|
||||
typedef CGAL::Cell_attribute<CMap, int, CGAL::Tag_true,
|
||||
typedef CGAL::GMap_dart<3, GMap> Dart;
|
||||
typedef CGAL::Cell_attribute<GMap, int, CGAL::Tag_true,
|
||||
Sum_functor, Divide_by_two_functor>
|
||||
Facet_attribute;
|
||||
typedef CGAL::cpp0x::tuple<void,void,Facet_attribute> Attributes;
|
||||
};
|
||||
};
|
||||
|
||||
typedef CGAL::Generalized_map<3,Myitem> CMap_3;
|
||||
typedef CMap_3::Dart_handle Dart_handle;
|
||||
typedef CGAL::Generalized_map<3,Myitem> GMap_3;
|
||||
typedef GMap_3::Dart_handle Dart_handle;
|
||||
|
||||
int main()
|
||||
{
|
||||
CMap_3 cm;
|
||||
GMap_3 gm;
|
||||
|
||||
// Create 2 cubes.
|
||||
Dart_handle dh1 = CGAL::make_combinatorial_hexahedron(cm);
|
||||
Dart_handle dh2 = CGAL::make_combinatorial_hexahedron(cm);
|
||||
Dart_handle dh1 = gm.make_combinatorial_hexahedron();
|
||||
Dart_handle dh2 = gm.make_combinatorial_hexahedron();
|
||||
|
||||
// 1) Create all 2-attributes and associated them to darts.
|
||||
for (CMap_3::Dart_range::iterator
|
||||
it=cm.darts().begin(), itend=cm.darts().end();
|
||||
for (GMap_3::Dart_range::iterator
|
||||
it=gm.darts().begin(), itend=gm.darts().end();
|
||||
it!=itend; ++it)
|
||||
{
|
||||
if ( it->attribute<2>()==NULL )
|
||||
cm.set_attribute<2>(it, cm.create_attribute<2>());
|
||||
gm.set_attribute<2>(it, gm.create_attribute<2>());
|
||||
}
|
||||
|
||||
// 2) Set the color of all facets of the first cube to 1
|
||||
for (CMap_3::One_dart_per_incident_cell_range<2, 3>::iterator
|
||||
it=cm.one_dart_per_incident_cell<2,3>(dh1).begin(),
|
||||
itend=cm.one_dart_per_incident_cell<2,3>(dh1).end(); it!=itend; ++it)
|
||||
for (GMap_3::One_dart_per_incident_cell_range<2, 3>::iterator
|
||||
it=gm.one_dart_per_incident_cell<2,3>(dh1).begin(),
|
||||
itend=gm.one_dart_per_incident_cell<2,3>(dh1).end(); it!=itend; ++it)
|
||||
{ it->attribute<2>()->info()=7; }
|
||||
|
||||
// 3) Set the color of all facets of the second cube to 19
|
||||
for (CMap_3::One_dart_per_incident_cell_range<2, 3>::iterator it=
|
||||
cm.one_dart_per_incident_cell<2,3>(dh2).begin(),
|
||||
itend=cm.one_dart_per_incident_cell<2,3>(dh2).end(); it!=itend; ++it)
|
||||
for (GMap_3::One_dart_per_incident_cell_range<2, 3>::iterator it=
|
||||
gm.one_dart_per_incident_cell<2,3>(dh2).begin(),
|
||||
itend=gm.one_dart_per_incident_cell<2,3>(dh2).end(); it!=itend; ++it)
|
||||
{ it->attribute<2>()->info()=13; }
|
||||
|
||||
// 4) 3-Sew the two cubes along one facet
|
||||
cm.sew<3>(dh1, dh2);
|
||||
gm.sew<3>(dh1, dh2);
|
||||
|
||||
// 5) Display all the values of 2-attributes
|
||||
for (CMap_3::Attribute_range<2>::type::iterator
|
||||
it=cm.attributes<2>().begin(), itend=cm.attributes<2>().end();
|
||||
for (GMap_3::Attribute_range<2>::type::iterator
|
||||
it=gm.attributes<2>().begin(), itend=gm.attributes<2>().end();
|
||||
it!=itend; ++it)
|
||||
{
|
||||
std::cout<<it->info()<<"; ";
|
||||
|
|
@ -100,15 +99,15 @@ int main()
|
|||
//CGAL::insert_cell_0_in_cell_2(cm, dh2);
|
||||
|
||||
// 7) Display all the values of 2-attributes
|
||||
for (CMap_3::Attribute_range<2>::type::iterator
|
||||
it=cm.attributes<2>().begin(), itend=cm.attributes<2>().end();
|
||||
for (GMap_3::Attribute_range<2>::type::iterator
|
||||
it=gm.attributes<2>().begin(), itend=gm.attributes<2>().end();
|
||||
it!=itend; ++it)
|
||||
{
|
||||
std::cout<<it->info()<<"; ";
|
||||
}
|
||||
std::cout<<std::endl;
|
||||
cm.display_characteristics(std::cout);
|
||||
std::cout<<", valid="<<cm.is_valid()<<std::endl;
|
||||
gm.display_characteristics(std::cout);
|
||||
std::cout<<", valid="<<gm.is_valid()<<std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,25 +17,24 @@
|
|||
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
|
||||
//
|
||||
#include <CGAL/Generalized_map.h>
|
||||
#include<CGAL/Generalized_map_constructors.h>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
|
||||
typedef CGAL::Generalized_map<4> CMap_4;
|
||||
typedef CMap_4::Dart_handle Dart_handle;
|
||||
typedef CGAL::Generalized_map<4> GMap_4;
|
||||
typedef GMap_4::Dart_handle Dart_handle;
|
||||
|
||||
int main()
|
||||
{
|
||||
CMap_4 cm;
|
||||
Dart_handle d1 = CGAL::make_combinatorial_tetrahedron(cm);
|
||||
Dart_handle d2 = CGAL::make_combinatorial_tetrahedron(cm);
|
||||
GMap_4 gm;
|
||||
Dart_handle d1 = gm.make_combinatorial_tetrahedron();
|
||||
Dart_handle d2 = gm.make_combinatorial_tetrahedron();
|
||||
|
||||
CGAL_assertion(cm.is_valid());
|
||||
CGAL_assertion(gm.is_valid());
|
||||
|
||||
cm.sew<4>(d1,d2);
|
||||
gm.sew<4>(d1,d2);
|
||||
|
||||
cm.display_characteristics(std::cout);
|
||||
std::cout<<", valid="<<cm.is_valid()<<std::endl;
|
||||
gm.display_characteristics(std::cout);
|
||||
std::cout<<", valid="<<gm.is_valid()<<std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,291 +0,0 @@
|
|||
// Copyright (c) 2014 CNRS and LIRIS' Establishments (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); 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 3 of the License,
|
||||
// or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
|
||||
//
|
||||
#ifndef CGAL_GENERALIZED_MAP_CONSTRUCTORS_H
|
||||
#define CGAL_GENERALIZED_MAP_CONSTRUCTORS_H 1
|
||||
|
||||
#include <CGAL/Combinatorial_map_basic_operations.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
/** @file Generalized_map_constructors.h
|
||||
* Basic creation operations for a generalized map.
|
||||
* Create edge, triangle, quadrilateral, tetrahedron, hexahedron.
|
||||
*/
|
||||
|
||||
/** Create an edge.
|
||||
* @param amap the used generalized map.
|
||||
* @return a dart of the new edge.
|
||||
*/
|
||||
template < class Map >
|
||||
typename Map::Dart_handle make_edge(Map& amap)
|
||||
{
|
||||
typename Map::Dart_handle d1 = amap.create_dart();
|
||||
typename Map::Dart_handle d2 = amap.create_dart();
|
||||
amap.basic_link_alpha(d1, d2, 0);
|
||||
return d1;
|
||||
}
|
||||
|
||||
/** Create a combinatorial polygon of length alg
|
||||
* (a cycle of alg edges alpha1 links together).
|
||||
* @param amap the used generalized map.
|
||||
* @return a new dart.
|
||||
*/
|
||||
template < class Map >
|
||||
typename Map::Dart_handle make_combinatorial_polygon(Map& amap,
|
||||
unsigned int alg)
|
||||
{
|
||||
CGAL_assertion(alg>0);
|
||||
|
||||
typename Map::Dart_handle start = make_edge(amap);
|
||||
typename Map::Dart_handle prev = amap.template alpha<0>(start);
|
||||
for ( unsigned int nb=1; nb<alg; ++nb )
|
||||
{
|
||||
typename Map::Dart_handle cur = make_edge(amap);
|
||||
amap.template basic_link_alpha<1>(prev, cur);
|
||||
prev=amap.template alpha<0>(cur);
|
||||
}
|
||||
|
||||
amap.template basic_link_alpha<1>(prev, start);
|
||||
return start;
|
||||
}
|
||||
|
||||
/** Test if a face is a combinatorial polygon of length alg
|
||||
* (a cycle of alg darts beta1 links together).
|
||||
* @param amap the used generalized map.
|
||||
* @param adart an intial dart
|
||||
* @return true iff the face containing adart is a polygon of length alg.
|
||||
*/
|
||||
template < class Map >
|
||||
bool is_face_combinatorial_polygon(const Map& amap,
|
||||
typename Map::Dart_const_handle adart,
|
||||
unsigned int alg)
|
||||
{
|
||||
CGAL_assertion(alg>0);
|
||||
|
||||
unsigned int nb = 0;
|
||||
typename Map::Dart_const_handle cur = adart;
|
||||
do
|
||||
{
|
||||
++nb;
|
||||
if ( amap.is_free(cur, 0) || amap.is_free(amap.alpha(cur, 0), 1) )
|
||||
return false; // Open face
|
||||
cur = amap.alpha(cur,0,1);
|
||||
}
|
||||
while( cur!=adart );
|
||||
return (nb==alg);
|
||||
}
|
||||
|
||||
/** Create a combinatorial tetrahedron from 4 triangles.
|
||||
* @param amap the used generalized map.
|
||||
* @param d1 a dart onto a first triangle.
|
||||
* @param d2 a dart onto a second triangle.
|
||||
* @param d3 a dart onto a third triangle.
|
||||
* @param d4 a dart onto a fourth triangle.
|
||||
* @return a new dart.
|
||||
*/
|
||||
template < class Map >
|
||||
typename Map::Dart_handle
|
||||
make_combinatorial_tetrahedron(Map& amap,
|
||||
typename Map::Dart_handle d1,
|
||||
typename Map::Dart_handle d2,
|
||||
typename Map::Dart_handle d3,
|
||||
typename Map::Dart_handle d4)
|
||||
{
|
||||
amap.template topo_sew<2>(d1, d2);
|
||||
amap.template topo_sew<2>(d3, amap.alpha(d2, 1));
|
||||
amap.template topo_sew<2>(amap.alpha(d1, 1), amap.alpha(d3, 1));
|
||||
amap.template topo_sew<2>(d4, amap.alpha(d2, 0, 1));
|
||||
amap.template topo_sew<2>(amap.alpha(d4, 0, 1), amap.alpha(d3, 0, 1));
|
||||
amap.template topo_sew<2>(amap.alpha(d4, 1), amap.alpha(d1, 0, 1));
|
||||
|
||||
return d1;
|
||||
}
|
||||
|
||||
/** Test if a volume is a combinatorial tetrahedron.
|
||||
* @param amap the used generalized map.
|
||||
* @param adart an intial dart
|
||||
* @return true iff the volume containing adart is a combinatorial tetrahedron.
|
||||
*/
|
||||
template < class Map >
|
||||
bool is_volume_combinatorial_tetrahedron(const Map& amap,
|
||||
typename Map::Dart_const_handle d1)
|
||||
{
|
||||
typename Map::Dart_const_handle d2 = amap.alpha(d1, 2);
|
||||
typename Map::Dart_const_handle d3 = amap.alpha(d2, 1, 2);
|
||||
typename Map::Dart_const_handle d4 = amap.alpha(d2, 0, 1, 2);
|
||||
|
||||
if ( !is_face_combinatorial_polygon(amap, d1, 3) ||
|
||||
!is_face_combinatorial_polygon(amap, d2, 3) ||
|
||||
!is_face_combinatorial_polygon(amap, d3, 3) ||
|
||||
!is_face_combinatorial_polygon(amap, d4, 3) ) return false;
|
||||
|
||||
// TODO do better with marks (?).
|
||||
if ( belong_to_same_cell<Map,2,1>(amap, d1, d2) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d1, d3) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d1, d4) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d2, d3) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d2, d4) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d3, d4) ) return false;
|
||||
|
||||
if ( amap.alpha(d1,1,2)!=amap.alpha(d3,1) ||
|
||||
amap.alpha(d4,0,1,2)!=amap.alpha(d3,0,1) ||
|
||||
amap.alpha(d4,1,2)!=amap.alpha(d1,0,1) ) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/** Create a new combinatorial tetrahedron.
|
||||
* @param amap the used generalized map.
|
||||
* @return a new dart.
|
||||
*/
|
||||
template < class Map >
|
||||
typename Map::Dart_handle make_combinatorial_tetrahedron(Map& amap)
|
||||
{
|
||||
typename Map::Dart_handle d1 = make_combinatorial_polygon(amap,3);
|
||||
typename Map::Dart_handle d2 = make_combinatorial_polygon(amap,3);
|
||||
typename Map::Dart_handle d3 = make_combinatorial_polygon(amap,3);
|
||||
typename Map::Dart_handle d4 = make_combinatorial_polygon(amap,3);
|
||||
|
||||
return make_combinatorial_tetrahedron(amap, d1, d2, d3, d4);
|
||||
}
|
||||
|
||||
/** Create a combinatorial hexahedron from 6 quadrilaterals.
|
||||
* @param amap the used generalized map.
|
||||
* @param d1 a dart onto a first quadrilateral.
|
||||
* @param d2 a dart onto a second quadrilateral.
|
||||
* @param d3 a dart onto a third quadrilateral.
|
||||
* @param d4 a dart onto a fourth quadrilateral.
|
||||
* @param d5 a dart onto a fifth quadrilateral.
|
||||
* @param d6 a dart onto a sixth quadrilateral.
|
||||
* @return a dart of the new cuboidal_cell.
|
||||
*/
|
||||
template < class Map >
|
||||
typename Map::Dart_handle
|
||||
make_combinatorial_hexahedron(Map& amap,
|
||||
typename Map::Dart_handle d1,
|
||||
typename Map::Dart_handle d2,
|
||||
typename Map::Dart_handle d3,
|
||||
typename Map::Dart_handle d4,
|
||||
typename Map::Dart_handle d5,
|
||||
typename Map::Dart_handle d6)
|
||||
{
|
||||
amap.template topo_sew<2>(d1,
|
||||
amap.alpha(d4,1,0,1,0));
|
||||
amap.template topo_sew<2>(amap.alpha(d1,0,1),
|
||||
amap.alpha(d6,1));
|
||||
amap.template topo_sew<2>(amap.alpha(d1,1,0,1),
|
||||
d2);
|
||||
amap.template topo_sew<2>(amap.alpha(d1,1),
|
||||
d5);
|
||||
|
||||
amap.template topo_sew<2>(d3,
|
||||
amap.alpha(d2,1,0,1));
|
||||
amap.template topo_sew<2>(amap.alpha(d3,0,1,0),
|
||||
amap.alpha(d6,0,1));
|
||||
amap.template topo_sew<2>(amap.alpha(d3,1,0,1,0),
|
||||
d4);
|
||||
amap.template topo_sew<2>(amap.alpha(d3,1),
|
||||
amap.alpha(d5,0,1,0,1));
|
||||
|
||||
amap.template topo_sew<2>(d6,
|
||||
amap.alpha(d4,1,0));
|
||||
amap.template topo_sew<2>(amap.alpha(d6,1,0,1),
|
||||
amap.alpha(d2,0,1));
|
||||
|
||||
amap.template topo_sew<2>(amap.alpha(d5,1,0),
|
||||
amap.alpha(d4,0,1));
|
||||
amap.template topo_sew<2>(amap.alpha(d5,0,1),
|
||||
amap.alpha(d2,1));
|
||||
return d1;
|
||||
}
|
||||
|
||||
/** Test if a volume is a combinatorial hexahedron.
|
||||
* @param amap the used generalized map.
|
||||
* @param adart an intial dart
|
||||
* @return true iff the volume containing adart is a combinatorial hexahedron.
|
||||
*/
|
||||
template < class Map >
|
||||
bool is_volume_combinatorial_hexahedron(const Map& amap,
|
||||
typename Map::Dart_const_handle d1)
|
||||
{
|
||||
typename Map::Dart_const_handle d2 = amap.alpha(d1,1,0,1,2);
|
||||
typename Map::Dart_const_handle d3 = amap.alpha(d2,1,0,1,2);
|
||||
typename Map::Dart_const_handle d4 = amap.alpha(d3,1,0,1,0,2);
|
||||
typename Map::Dart_const_handle d5 = amap.alpha(d1,1,2);
|
||||
typename Map::Dart_const_handle d6 = amap.alpha(d4,1,0,2);
|
||||
|
||||
if (!is_face_combinatorial_polygon(amap, d1, 4) ||
|
||||
!is_face_combinatorial_polygon(amap, d2, 4) ||
|
||||
!is_face_combinatorial_polygon(amap, d3, 4) ||
|
||||
!is_face_combinatorial_polygon(amap, d4, 4) ||
|
||||
!is_face_combinatorial_polygon(amap, d5, 4) ||
|
||||
!is_face_combinatorial_polygon(amap, d6, 4) ) return false;
|
||||
|
||||
// TODO do better with marks.
|
||||
if ( belong_to_same_cell<Map,2,1>(amap, d1, d2) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d1, d3) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d1, d4) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d1, d5) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d1, d6) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d2, d3) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d2, d4) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d2, d5) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d2, d6) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d3, d4) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d3, d5) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d3, d6) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d4, d5) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d4, d6) ||
|
||||
belong_to_same_cell<Map,2,1>(amap, d5, d6) )
|
||||
return false;
|
||||
|
||||
if ( amap.alpha(d1,2) !=amap.alpha(d4,0,1,0,1) ||
|
||||
amap.alpha(d1,0,1,2) !=amap.alpha(d6,1) ||
|
||||
amap.alpha(d3,0,1,2) !=amap.alpha(d6,0,1,0) ||
|
||||
amap.alpha(d3,1,2) !=amap.alpha(d5,0,1,0,1) ||
|
||||
amap.alpha(d6,1,0,1,2)!=amap.alpha(d2,0,1) ||
|
||||
amap.alpha(d5,1,2) !=amap.alpha(d4,0,1,0) ||
|
||||
amap.alpha(d5,0,1,2) !=amap.alpha(d2,1) ) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Create a new combinatorial hexahedron.
|
||||
* @param amap the used generalized map.
|
||||
* @return a new dart.
|
||||
*/
|
||||
template < class Map >
|
||||
typename Map::Dart_handle make_combinatorial_hexahedron(Map& amap)
|
||||
{
|
||||
typename Map::Dart_handle d1 = make_combinatorial_polygon(amap,4);
|
||||
typename Map::Dart_handle d2 = make_combinatorial_polygon(amap,4);
|
||||
typename Map::Dart_handle d3 = make_combinatorial_polygon(amap,4);
|
||||
typename Map::Dart_handle d4 = make_combinatorial_polygon(amap,4);
|
||||
typename Map::Dart_handle d5 = make_combinatorial_polygon(amap,4);
|
||||
typename Map::Dart_handle d6 = make_combinatorial_polygon(amap,4);
|
||||
|
||||
return make_combinatorial_hexahedron(amap, d1, d2, d3, d4, d5, d6);
|
||||
}
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_GENERALIZED_MAP_CONSTRUCTORS_H //
|
||||
// EOF //
|
||||
|
|
@ -1,567 +0,0 @@
|
|||
// Copyright (c) 2014 CNRS and LIRIS' Establishments (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); 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 3 of the License,
|
||||
// or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
|
||||
//
|
||||
#ifndef CGAL_GENERALIZED_MAP_INSERTIONS_H
|
||||
#define CGAL_GENERALIZED_MAP_INSERTIONS_H
|
||||
|
||||
namespace CGAL
|
||||
{
|
||||
/** @file Generalized_map_insertions.h
|
||||
* Insertion operations on generalized map.
|
||||
*/
|
||||
|
||||
/** Insert a vertex in a given edge.
|
||||
* @param amap the used generalized map.
|
||||
* @param adart a dart of the edge (!=NULL).
|
||||
* @return a dart of the new vertex.
|
||||
*/
|
||||
template<class CMap>
|
||||
typename CMap::Dart_handle
|
||||
insert_cell_0_in_cell_1( CMap& amap, typename CMap::Dart_handle adart,
|
||||
typename CMap::template
|
||||
Attribute_handle<0>::type ah=CMap::null_handle,
|
||||
bool update_attributes=true )
|
||||
{
|
||||
typename CMap::Dart_handle d1, d2;
|
||||
typename CMap::size_type mark=amap.get_new_mark();
|
||||
|
||||
// 1) We store all the darts of the edge.
|
||||
std::deque<typename CMap::Dart_handle> vect;
|
||||
typename CMap::size_type m=amap.get_new_mark();
|
||||
{
|
||||
for ( typename CMap::template Dart_of_cell_basic_range<1>::iterator
|
||||
it=amap.template darts_of_cell_basic<1>(adart, m).begin();
|
||||
it != amap.template darts_of_cell_basic<1>(adart, m).end(); ++it )
|
||||
vect.push_back(it);
|
||||
}
|
||||
|
||||
// 2) For each dart of the cell, we modify link of neighbors.
|
||||
typename std::deque<typename CMap::Dart_handle>::iterator it = vect.begin();
|
||||
for (; it != vect.end(); ++it)
|
||||
{
|
||||
d1 = amap.create_dart();
|
||||
|
||||
if (!amap.template is_free<0>(*it) &&
|
||||
amap.is_marked(amap.template alpha<0>(*it), mark))
|
||||
amap.template basic_link_alpha<1>(d1, amap.template alpha<0,0>(*it));
|
||||
|
||||
amap.template basic_link_alpha<0>(*it, d1);
|
||||
amap.mark(*it, mark);
|
||||
|
||||
for ( unsigned int dim=2; dim<=CMap::dimension; ++dim )
|
||||
{
|
||||
if (!amap.is_free(*it, dim) && amap.is_marked(amap.alpha(*it, dim), mark))
|
||||
{
|
||||
amap.basic_link_alpha(amap.beta(*it, dim, 0), d1, dim);
|
||||
}
|
||||
}
|
||||
|
||||
if (amap.are_attributes_automatically_managed() && update_attributes)
|
||||
{
|
||||
// We copy all the attributes except for dim=0
|
||||
CMap::Helper::template Foreach_enabled_attributes_except
|
||||
<CGAL::internal::GMap_group_attribute_functor_of_dart<CMap>, 0>::
|
||||
run(&amap,*it,d1);
|
||||
}
|
||||
if (ah != CMap::null_handle)
|
||||
{
|
||||
// We initialise the 0-atttrib to ah
|
||||
CGAL::internal::Set_i_attribute_of_dart_functor<CMap, 0>::
|
||||
run(&amap, d1, ah);
|
||||
amap.mark(*it, mark);
|
||||
}
|
||||
}
|
||||
|
||||
for (it = vect.begin(); it != vect.end(); ++it)
|
||||
{
|
||||
amap.unmark(*it, m);
|
||||
amap.unmark(*it, mark);
|
||||
}
|
||||
|
||||
CGAL_assertion(amap.is_whole_map_unmarked(m));
|
||||
CGAL_assertion(amap.is_whole_map_unmarked(mark));
|
||||
|
||||
amap.free_mark(m);
|
||||
amap.free_mark(mark);
|
||||
|
||||
if (amap.are_attributes_automatically_managed() && update_attributes)
|
||||
{
|
||||
if ( !amap.template is_free<1>(amap.template alpha<0>(adart)) )
|
||||
{
|
||||
CGAL::internal::GMap_degroup_attribute_functor_run<CMap, 1>::
|
||||
run(&amap, adart, amap.template alpha<0,1>(adart));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CGAL_CMAP_TEST_VALID_INSERTIONS
|
||||
CGAL_assertion( amap.is_valid() );
|
||||
#endif
|
||||
|
||||
return amap.template alpha<0>(adart);
|
||||
}
|
||||
|
||||
/** Insert a vertex in the given 2-cell which is splitted in triangles,
|
||||
* once for each inital edge of the facet.
|
||||
* @param amap the used generalized map.
|
||||
* @param adart a dart of the facet to triangulate.
|
||||
* @return A dart incident to the new vertex.
|
||||
*/
|
||||
template < class CMap >
|
||||
typename CMap::Dart_handle
|
||||
insert_cell_0_in_cell_2( CMap& amap, typename CMap::Dart_handle adart,
|
||||
typename CMap::template
|
||||
Attribute_handle<0>::type ah=CMap::null_handle,
|
||||
bool update_attributes=true )
|
||||
{
|
||||
CGAL_assertion(adart!=amap.null_handle);
|
||||
|
||||
typename CMap::Dart_handle d1=amap.null_handle, d2=amap.null_handle;
|
||||
|
||||
// Mark used to mark darts already treated.
|
||||
typename CMap::size_type treated = amap.get_new_mark();
|
||||
typename CMap::size_type m = amap.get_new_mark();
|
||||
|
||||
// Stack of darts of the face
|
||||
std::deque<typename CMap::Dart_handle> vect;
|
||||
{
|
||||
for ( typename CMap::template Dart_of_cell_basic_range<2>::iterator
|
||||
it=amap.template darts_of_cell_basic<2>(adart,m).begin();
|
||||
it != amap.template darts_of_cell_basic<2>(adart,m).end(); ++it )
|
||||
vect.push_back(it);
|
||||
}
|
||||
|
||||
// Stack of darts to degroup (one dart per edge of the face)
|
||||
std::deque<typename CMap::Dart_handle> todegroup;
|
||||
{
|
||||
for ( typename CMap::template Dart_of_cell_basic_range<2,2>::iterator
|
||||
it=amap.template darts_of_cell_basic<2,2>(adart).begin();
|
||||
it != amap.template darts_of_cell_basic<2,2>(adart).end(); ++it )
|
||||
if ( it!=adart && it!=amap.template alpha<0>(adart) )
|
||||
todegroup.push_back(it);
|
||||
}
|
||||
|
||||
// 2) For each dart of the cell, we modify link of neighbors.
|
||||
typename std::deque<typename CMap::Dart_handle>::iterator it = vect.begin();
|
||||
for (; it != vect.end(); ++it)
|
||||
{
|
||||
d1 = amap.create_dart();
|
||||
d2 = amap.create_dart();
|
||||
amap.template basic_link_alpha<0>(d1, d2);
|
||||
amap.mark(*it, treated);
|
||||
|
||||
amap.template basic_link_alpha<1>(*it, d1);
|
||||
|
||||
if (!amap.template is_free<0>(*it) &&
|
||||
amap.is_marked(amap.template alpha<0>(*it), treated))
|
||||
amap.template basic_link_alpha<1>(d2, amap.template alpha<0,1,0>(*it));
|
||||
|
||||
for ( unsigned int dim=3; dim<=CMap::dimension; ++dim )
|
||||
{
|
||||
if (!amap.is_free(*it, dim) && amap.is_marked(amap.alpha(*it, dim), treated))
|
||||
{
|
||||
amap.basic_link_alpha(amap.beta(*it, dim, 1), d1, dim);
|
||||
amap.basic_link_alpha(amap.beta(*it, dim, 1, 0), d2, dim);
|
||||
}
|
||||
}
|
||||
|
||||
if (amap.are_attributes_automatically_managed() && update_attributes)
|
||||
{
|
||||
// We copy all the attributes except for dim=1
|
||||
CMap::Helper::template Foreach_enabled_attributes_except
|
||||
<CGAL::internal::GMap_group_attribute_functor_of_dart<CMap>, 1>::
|
||||
run(&amap,*it,d1);
|
||||
// We initialise the 0-atttrib to ah
|
||||
CGAL::internal::Set_i_attribute_of_dart_functor<CMap, 0>::
|
||||
run(&amap, d2, ah);
|
||||
}
|
||||
}
|
||||
|
||||
for (it = vect.begin(); it != vect.end(); ++it)
|
||||
{
|
||||
amap.unmark(*it, m);
|
||||
amap.unmark(*it, treated);
|
||||
}
|
||||
|
||||
CGAL_assertion(amap.is_whole_map_unmarked(m));
|
||||
CGAL_assertion(amap.is_whole_map_unmarked(treated));
|
||||
amap.free_mark(m);
|
||||
amap.free_mark(treated);
|
||||
|
||||
if (amap.are_attributes_automatically_managed() && update_attributes)
|
||||
{
|
||||
for (it = todegroup.begin(); it != todegroup.end(); ++it)
|
||||
{
|
||||
CGAL::internal::GMap_degroup_attribute_functor_run<CMap, 2>::
|
||||
run(&amap, adart, *it);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CGAL_CMAP_TEST_VALID_INSERTIONS
|
||||
CGAL_assertion( amap.is_valid() );
|
||||
#endif
|
||||
|
||||
return amap.template alpha<1,0>(adart);
|
||||
}
|
||||
|
||||
/** Test if an edge can be inserted onto a 2-cell between two given darts.
|
||||
* @param amap the used generalized map.
|
||||
* @param adart1 a first dart.
|
||||
* @param adart2 a second dart.
|
||||
* @return true iff an edge can be inserted between adart1 and adart2.
|
||||
*/
|
||||
template < class CMap >
|
||||
bool is_insertable_cell_1_in_cell_2(const CMap& amap,
|
||||
typename CMap::Dart_const_handle adart1,
|
||||
typename CMap::Dart_const_handle adart2)
|
||||
{
|
||||
if ( adart1==adart2 || adart1==amap.template alpha<0>(adart2) ) return false;
|
||||
for ( CGAL::CMap_dart_const_iterator_of_orbit<CMap,0,1> it(amap,adart1);
|
||||
it.cont(); ++it )
|
||||
{
|
||||
if ( it==adart2 ) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Insert an edge in a 2-cell between two given darts.
|
||||
* @param amap the used generalized map.
|
||||
* @param adart1 a first dart of the facet (!=NULL && !=null_dart_handle).
|
||||
* @param adart2 a second dart of the facet. If NULL insert a dangling edge.
|
||||
* @return a dart of the new edge, and not incident to the
|
||||
* same vertex than adart1.
|
||||
*/
|
||||
template<class CMap>
|
||||
typename CMap::Dart_handle
|
||||
insert_cell_1_in_cell_2(CMap& amap,
|
||||
typename CMap::Dart_handle adart1,
|
||||
typename CMap::Dart_handle adart2,
|
||||
bool update_attributes=true)
|
||||
{
|
||||
if ( adart2!=amap.null_handle)
|
||||
{
|
||||
CGAL_assertion(is_insertable_cell_1_in_cell_2<CMap>(amap, adart1, adart2));
|
||||
}
|
||||
|
||||
typename CMap::size_type m1=amap.get_new_mark();
|
||||
CGAL::CMap_dart_iterator_basic_of_involution<CMap,0,1> it1(amap, adart1, m1);
|
||||
|
||||
typename CMap::size_type m2=amap.get_new_mark();
|
||||
CGAL::CMap_dart_iterator_basic_of_involution<CMap,0,1> it2(amap, adart2, m2);
|
||||
|
||||
typename CMap::Dart_handle d1=amap.null_handle;
|
||||
typename CMap::Dart_handle d2=amap.null_handle;
|
||||
|
||||
typename CMap::size_type treated=amap.get_new_mark();
|
||||
|
||||
for ( ; it1.cont(); ++it1)
|
||||
{
|
||||
CGAL_assertion (it2.cont() );
|
||||
d1 = amap.create_dart();
|
||||
d2 = amap.create_dart();
|
||||
amap.template basic_link_alpha<0>(d1, d2);
|
||||
amap.mark(it1,treated);
|
||||
|
||||
if ( !amap.template is_free<1>(it1) &&
|
||||
amap.is_marked(amap.template alpha<1>(it1), treated) )
|
||||
{
|
||||
amap.template basic_link_alpha<2>(amap.template alpha<1,1>(it1), d1);
|
||||
amap.template basic_link_alpha<2>(amap.template alpha<2,0>(d1), d2);
|
||||
}
|
||||
|
||||
for ( unsigned int dim=3; dim<=CMap::dimension; ++dim)
|
||||
{
|
||||
if ( !amap.is_free(it1, dim) &&
|
||||
amap.is_marked(amap.alpha(it1, dim), treated) )
|
||||
{
|
||||
amap.basic_link_alpha(amap.alpha(it1, dim, 1), d1, dim);
|
||||
amap.basic_link_alpha(amap.alpha(d1, dim, 0), d2, dim);
|
||||
}
|
||||
}
|
||||
|
||||
amap.template link_alpha<1>(it1, d1);
|
||||
if ( adart2!=amap.null_handle )
|
||||
{
|
||||
amap.template link_alpha<1>(it2, d2);
|
||||
++it2;
|
||||
}
|
||||
}
|
||||
|
||||
if (amap.are_attributes_automatically_managed() && update_attributes)
|
||||
{
|
||||
if ( !amap.template is_free<2>(d1) && d2!=amap.null_handle )
|
||||
CGAL::internal::GMap_degroup_attribute_functor_run<CMap, 2>::
|
||||
run(&amap, d1, amap.template alpha<2>(d1));
|
||||
}
|
||||
|
||||
amap.negate_mark(m1);
|
||||
it1.rewind();
|
||||
|
||||
if ( adart2!=amap.null_handle )
|
||||
{ it2.rewind(); amap.negate_mark(m2); }
|
||||
|
||||
for ( ; it1.cont(); ++it1, ++it2)
|
||||
{
|
||||
amap.mark(it1,m1);
|
||||
amap.unmark(it1,treated);
|
||||
if ( adart2!=amap.null_handle ) amap.mark(it2,m2);
|
||||
}
|
||||
amap.negate_mark(m1);
|
||||
CGAL_assertion( amap.is_whole_map_unmarked(m1) );
|
||||
CGAL_assertion( amap.is_whole_map_unmarked(treated) );
|
||||
amap.free_mark(m1);
|
||||
amap.free_mark(treated);
|
||||
|
||||
if ( adart2!=amap.null_handle )
|
||||
{
|
||||
amap.negate_mark(m2);
|
||||
CGAL_assertion( amap.is_whole_map_unmarked(m2) );
|
||||
}
|
||||
amap.free_mark(m2);
|
||||
|
||||
#ifdef CGAL_CMAP_TEST_VALID_INSERTIONS
|
||||
CGAL_assertion( amap.is_valid() );
|
||||
#endif
|
||||
|
||||
return amap.template alpha<1>(adart1);
|
||||
}
|
||||
|
||||
/** Test if a 2-cell can be inserted onto a given 3-cell along
|
||||
* a path of edges.
|
||||
* @param amap the used generalized map.
|
||||
* @param afirst iterator on the begining of the path.
|
||||
* @param alast iterator on the end of the path.
|
||||
* @return true iff a 2-cell can be inserted along the path.
|
||||
* the path is a sequence of dartd, one per edge
|
||||
* where the face will be inserted.
|
||||
*/
|
||||
template <class CMap, class InputIterator>
|
||||
bool is_insertable_cell_2_in_cell_3(const CMap& amap,
|
||||
InputIterator afirst,
|
||||
InputIterator alast)
|
||||
{
|
||||
CGAL_assertion( CMap::dimension>= 3 );
|
||||
|
||||
// The path must have at least one dart.
|
||||
if (afirst==alast) return false;
|
||||
typename CMap::Dart_const_handle prec = amap.null_handle;
|
||||
typename CMap::Dart_const_handle od = amap.null_handle;
|
||||
|
||||
for (InputIterator it(afirst); it!=alast; ++it)
|
||||
{
|
||||
// The path must contain only non empty darts.
|
||||
if (*it == amap.null_handle) return false;
|
||||
|
||||
// Two consecutive darts of the path must belong to two edges
|
||||
// incident to the same vertex of the same volume.
|
||||
if (prec != amap.null_handle)
|
||||
{
|
||||
if ( amap.template is_free<0>(prec) ) return false;
|
||||
|
||||
// alpha0(prec) and *it must belong to the same vertex of the same volume
|
||||
if ( !CGAL::belong_to_same_cell<CMap, 0, 2>
|
||||
(amap, amap.template alpha<0>(prec), *it) )
|
||||
return false;
|
||||
}
|
||||
prec = *it;
|
||||
}
|
||||
|
||||
// The path must be closed.
|
||||
if ( amap.template is_free<0>(prec) ) return false;
|
||||
if (!CGAL::belong_to_same_cell<CMap, 0, 2>
|
||||
(amap, amap.template alpha<0>(prec), *afirst))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Insert a 2-cell in a given 3-cell along a path of darts.
|
||||
* @param amap the used generalized map.
|
||||
* @param afirst iterator on the begining of the path.
|
||||
* @param alast iterator on the end of the path.
|
||||
* the path is a sequence of dartd, one per edge
|
||||
* where the face will be inserted.
|
||||
* @return a dart of the new 2-cell.
|
||||
*/
|
||||
template<class CMap, class InputIterator>
|
||||
typename CMap::Dart_handle
|
||||
insert_cell_2_in_cell_3(CMap& amap, InputIterator afirst, InputIterator alast,
|
||||
bool update_attributes=true)
|
||||
{
|
||||
CGAL_assertion(is_insertable_cell_2_in_cell_3(amap,afirst,alast));
|
||||
|
||||
typename CMap::Dart_handle prec = amap.null_handle, d = amap.null_handle,
|
||||
dd = amap.null_handle, first = amap.null_handle;
|
||||
bool withAlpha3 = false;
|
||||
|
||||
typename CMap::size_type treated = amap.get_new_mark();
|
||||
|
||||
{
|
||||
for (InputIterator it(afirst); !withAlpha3 && it!=alast; ++it)
|
||||
{
|
||||
if (!amap.template is_free<2>(*it)) withAlpha3 = true;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
for (InputIterator it(afirst); it!=alast; ++it)
|
||||
{
|
||||
d = amap.create_dart();
|
||||
amap.template basic_link_alpha<0>(d, amap.create_dart());
|
||||
|
||||
if ( withAlpha3 )
|
||||
{
|
||||
dd = amap.create_dart();
|
||||
amap.template basic_link_alpha<0>(dd, amap.create_dart());
|
||||
}
|
||||
|
||||
if ( prec!=amap.null_handle )
|
||||
{
|
||||
amap.template basic_link_alpha<1>(prec, d);
|
||||
if (withAlpha3)
|
||||
amap.template basic_link_alpha<1>(amap.template alpha<3>(prec), dd);
|
||||
}
|
||||
else first = amap.template alpha<0>(d);
|
||||
|
||||
if ( !amap.template is_free<2>(*it) )
|
||||
{
|
||||
amap.template link_alpha<2>(amap.template alpha<2>(*it), dd);
|
||||
}
|
||||
|
||||
amap.template link_alpha<2>(*it, d);
|
||||
if (withAlpha3) amap.template basic_link_alpha<3>(d, dd);
|
||||
|
||||
prec = amap.template alpha<0>(d);
|
||||
}
|
||||
}
|
||||
|
||||
amap.template basic_link_alpha<1>(prec, first);
|
||||
if ( withAlpha3 )
|
||||
{
|
||||
amap.template basic_link_alpha<1>(amap.template alpha<3>(prec),
|
||||
amap.template alpha<3>(first));
|
||||
}
|
||||
|
||||
// Make copies of the new facet for dimension >=4
|
||||
/* for ( unsigned int dim=4; dim<=CMap::dimension; ++dim )
|
||||
{
|
||||
if ( !amap.is_free(*it, dim) )
|
||||
{
|
||||
ddd = amap.create_dart();
|
||||
amap.template basic_link_alpha<0>(ddd, amap.create_dart());
|
||||
amap.basic_link_alpha(d, ddd, dim);
|
||||
amap.basic_link_alpha(amap.template alpha<0>(d),
|
||||
amap.template alpha<0>(ddd), dim);
|
||||
|
||||
if ( withAlpha3 )
|
||||
{
|
||||
dddd = amap.create_dart();
|
||||
amap.template basic_link_alpha<0>(dddd, amap.create_dart());
|
||||
|
||||
amap.basic_link_alpha(dd, dddd, dim);
|
||||
amap.basic_link_alpha(amap.template alpha<0>(dd),
|
||||
amap.template alpha<0>(dddd), dim);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
// Make copies of the new facet for dimension >=4
|
||||
for ( unsigned int dim=4; dim<=CMap::dimension; ++dim )
|
||||
{
|
||||
if ( !amap.is_free(first, dim) )
|
||||
{
|
||||
typename CMap::Dart_handle first2 = amap.null_handle;
|
||||
prec = amap.null_handle;
|
||||
for ( CMap_dart_iterator_basic_of_orbit<CMap,0,1> it(amap, first);
|
||||
it.cont(); ++it )
|
||||
{
|
||||
d = amap.create_dart();
|
||||
amap.basic_link_alpha(amap.template alpha<2>(it), d, dim);
|
||||
if ( withAlpha3 )
|
||||
{
|
||||
dd = amap.create_dart();
|
||||
amap.basic_link_alpha_for_involution
|
||||
(amap.template alpha<2,3>(it), dd, dim);
|
||||
amap.template basic_link_alpha_for_involution<3>(d, dd);
|
||||
}
|
||||
if ( prec!=amap.null_handle )
|
||||
{
|
||||
amap.link_alpha_0(prec, d);
|
||||
if ( withAlpha3 )
|
||||
{
|
||||
amap.basic_link_alpha_1(amap.template alpha<3>(prec), dd);
|
||||
}
|
||||
}
|
||||
else first2 = prec;
|
||||
|
||||
// We consider dim2=2 out of the loop to use link_alpha instead of
|
||||
// basic _link_alpha (to modify non void attributes only once).
|
||||
if ( !amap.template is_free<2>(it) &&
|
||||
amap.is_free(amap.template alpha<2>(it), dim) )
|
||||
amap.template link_alpha_for_involution<2>
|
||||
(amap.alpha(it,2,dim), d);
|
||||
if ( withAlpha3 &&
|
||||
!amap.template is_free<2>(amap.template alpha<3>(it)) &&
|
||||
amap.is_free(amap.template alpha<3,2>(it), dim) )
|
||||
amap.template link_alpha_for_involution<2>(amap.alpha(it,3,2,dim), dd);
|
||||
|
||||
for ( unsigned int dim2=3; dim2<=CMap::dimension; ++dim2 )
|
||||
{
|
||||
if ( dim2+1!=dim && dim2!=dim && dim2!=dim+1 )
|
||||
{
|
||||
if ( !amap.is_free(it, dim2) && amap.is_free(amap.alpha(it, dim2), dim) )
|
||||
amap.basic_link_alpha_for_involution(amap.alpha(it, dim2, dim),
|
||||
d, dim2);
|
||||
if ( withAlpha3 && !amap.is_free(amap.template alpha<3>(it), dim2) &&
|
||||
amap.is_free(amap.alpha(it, 3, dim2), dim) )
|
||||
amap.basic_link_alpha_for_involution
|
||||
(amap.alpha(it, 3, dim2, dim), dd, dim2);
|
||||
}
|
||||
}
|
||||
prec = d;
|
||||
}
|
||||
amap.basic_link_alpha_0( prec, first2 );
|
||||
if ( withAlpha3 )
|
||||
{
|
||||
amap.basic_link_alpha_1( amap.template alpha<3>(prec),
|
||||
amap.template alpha<3>(first2) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Degroup the attributes
|
||||
if ( withAlpha3 )
|
||||
{ // Here we cannot use Degroup_attribute_functor_run as new darts do not
|
||||
// have their 3-attribute
|
||||
CGAL::internal::GMap_degroup_attribute_functor_run<CMap, 3>::
|
||||
run(&amap, first, amap.template alpha<3>(first));
|
||||
}
|
||||
|
||||
#ifdef CGAL_CMAP_TEST_VALID_INSERTIONS
|
||||
CGAL_assertion( amap.is_valid() );
|
||||
#endif
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_GENERALIZED_MAP_INSERTIONS_H
|
||||
|
|
@ -38,7 +38,7 @@ namespace CGAL
|
|||
* @return true iff the i-cell can be removed.
|
||||
*/
|
||||
template <class GMap, unsigned int i, unsigned int nmi=GMap::dimension-i>
|
||||
struct Is_removable_functor
|
||||
struct Is_removable_functor_gmap
|
||||
{
|
||||
static bool run(const GMap& amap, typename GMap::Dart_const_handle adart)
|
||||
{
|
||||
|
|
@ -55,27 +55,18 @@ namespace CGAL
|
|||
};
|
||||
// Specialization for i=GMap::dimension
|
||||
template <class GMap, unsigned int i>
|
||||
struct Is_removable_functor<GMap, i, 0>
|
||||
struct Is_removable_functor_gmap<GMap, i, 0>
|
||||
{
|
||||
static bool run(const GMap&, typename GMap::Dart_const_handle)
|
||||
{ return true; }
|
||||
};
|
||||
// Specialization for i=GMap::dimension-1
|
||||
template <class GMap, unsigned int i>
|
||||
struct Is_removable_functor<GMap, i, 1>
|
||||
struct Is_removable_functor_gmap<GMap, i, 1>
|
||||
{
|
||||
static bool run(const GMap&, typename GMap::Dart_const_handle)
|
||||
{ return true; }
|
||||
};
|
||||
/** Test if an i-cell can be removed.
|
||||
* An i-cell can be removed if i==GMap::dimension or i==GMap::dimension-1,
|
||||
* or if there are at most two (i+1)-cell incident to it.
|
||||
* @param adart a dart of the i-cell.
|
||||
* @return true iff the i-cell can be removed.
|
||||
*/
|
||||
template < class GMap, unsigned int i >
|
||||
bool is_removable(const GMap& amap, typename GMap::Dart_const_handle adart)
|
||||
{ return CGAL::Is_removable_functor<GMap, i>::run(amap,adart); }
|
||||
|
||||
/** Remove an i-cell, 0<=i<dimension, and merge eventually both incident
|
||||
* (i+1)-cells.
|
||||
|
|
@ -84,7 +75,7 @@ namespace CGAL
|
|||
* @return the number of deleted darts.
|
||||
*/
|
||||
template<class GMap, unsigned int i, unsigned int nmi>
|
||||
struct Remove_cell_functor
|
||||
struct Remove_cell_functor_gmap
|
||||
{
|
||||
static size_t run(GMap& amap, typename GMap::Dart_handle adart)
|
||||
{
|
||||
|
|
@ -193,12 +184,12 @@ namespace CGAL
|
|||
};
|
||||
|
||||
/** Remove a d-cell, in a d-map (special case).
|
||||
* @param amap the used combinatorial map.
|
||||
* @param amap the used generalized map.
|
||||
* @param adart a dart of the volume to remove.
|
||||
* @return the number of deleted darts.
|
||||
*/
|
||||
template<class GMap,unsigned int i>
|
||||
struct Remove_cell_functor<GMap,i,0>
|
||||
struct Remove_cell_functor_gmap<GMap,i,0>
|
||||
{
|
||||
static size_t run(GMap& amap, typename GMap::Dart_handle adart)
|
||||
{
|
||||
|
|
@ -257,18 +248,6 @@ namespace CGAL
|
|||
}
|
||||
};
|
||||
|
||||
/** Remove an i-cell, 0<=i<=dimension.
|
||||
* @param amap the used generalized map.
|
||||
* @param adart a dart of the i-cell to remove.
|
||||
* @return the number of deleted darts.
|
||||
*/
|
||||
template< class GMap, unsigned int i >
|
||||
size_t remove_cell(GMap& amap, typename GMap::Dart_handle adart)
|
||||
{
|
||||
return
|
||||
CGAL::Remove_cell_functor<GMap,i,GMap::dimension-i>::run(amap,adart);
|
||||
}
|
||||
|
||||
/** Test if an i-cell can be contracted.
|
||||
* An i-cell can be contracted if i==1
|
||||
* or if there are at most two (i-1)-cell incident to it.
|
||||
|
|
@ -276,7 +255,7 @@ namespace CGAL
|
|||
* @return true iff the i-cell can be contracted.
|
||||
*/
|
||||
template <class GMap, unsigned int i>
|
||||
struct Is_contractible_functor
|
||||
struct Is_contractible_functor_gmap
|
||||
{
|
||||
static bool run(const GMap& amap, typename GMap::Dart_const_handle adart)
|
||||
{
|
||||
|
|
@ -293,27 +272,18 @@ namespace CGAL
|
|||
};
|
||||
// Specialization for i=0
|
||||
template <class GMap>
|
||||
struct Is_contractible_functor<GMap, 0>
|
||||
struct Is_contractible_functor_gmap<GMap, 0>
|
||||
{
|
||||
static bool run(const GMap&, typename GMap::Dart_const_handle)
|
||||
{ return false; }
|
||||
};
|
||||
// Specialization for i=1
|
||||
template <class GMap>
|
||||
struct Is_contractible_functor<GMap, 1>
|
||||
struct Is_contractible_functor_gmap<GMap, 1>
|
||||
{
|
||||
static bool run(const GMap&, typename GMap::Dart_const_handle)
|
||||
{ return true; }
|
||||
};
|
||||
/** Test if an i-cell can be contracted.
|
||||
* An i-cell can be contracted if i==1
|
||||
* or if there are at most two (i-1)-cell incident to it.
|
||||
* @param adart a dart of the i-cell.
|
||||
* @return true iff the i-cell can be contracted.
|
||||
*/
|
||||
template < class GMap, unsigned int i >
|
||||
bool is_contractible(const GMap& amap, typename GMap::Dart_const_handle adart)
|
||||
{ return CGAL::Is_contractible_functor<GMap, i>::run(amap,adart); }
|
||||
|
||||
/** Contract an i-cell, 1<=i<=dimension, and merge eventually both incident
|
||||
* (i-1)-cells.
|
||||
|
|
@ -322,7 +292,7 @@ namespace CGAL
|
|||
* @return the number of deleted darts.
|
||||
*/
|
||||
template<class GMap, unsigned int i>
|
||||
struct Contract_cell_functor
|
||||
struct Contract_cell_functor_gmap
|
||||
{
|
||||
static size_t run(GMap& amap, typename GMap::Dart_handle adart)
|
||||
{
|
||||
|
|
@ -425,15 +395,6 @@ namespace CGAL
|
|||
}
|
||||
};
|
||||
|
||||
/** Contract an i-cell, 1<=i<=dimension.
|
||||
* @param amap the used generalized map.
|
||||
* @param adart a dart of the i-cell to remove.
|
||||
* @return the number of deleted darts.
|
||||
*/
|
||||
template < class GMap, unsigned int i >
|
||||
size_t contract_cell(GMap& amap, typename GMap::Dart_handle adart)
|
||||
{ return CGAL::Contract_cell_functor<GMap,i>::run(amap,adart); }
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_GENERALIZED_MAP_OPERATIONS_H //
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
#ifndef CGAL_GENERALIZED_MAP_2_TEST
|
||||
#define CGAL_GENERALIZED_MAP_2_TEST 1
|
||||
|
||||
#include <CGAL/Generalized_map_constructors.h>
|
||||
#include <CGAL/Generalized_map_operations.h>
|
||||
|
||||
#include <CGAL/IO/Polyhedron_iostream.h>
|
||||
|
|
@ -96,9 +95,9 @@ bool test_GMAP_2()
|
|||
|
||||
// Construction operations
|
||||
trace_test_begin();
|
||||
Dart_handle dh1=CGAL::make_edge(gmap);
|
||||
Dart_handle dh2=CGAL::make_edge(gmap);
|
||||
Dart_handle dh3=CGAL::make_edge(gmap);
|
||||
Dart_handle dh1=gmap.make_edge();
|
||||
Dart_handle dh2=gmap.make_edge();
|
||||
Dart_handle dh3=gmap.make_edge();
|
||||
if ( !check_number_of_cells_2(gmap, 6, 3, 3, 3) )
|
||||
return false;
|
||||
|
||||
|
|
@ -109,8 +108,8 @@ bool test_GMAP_2()
|
|||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
Dart_handle dh5=CGAL::make_combinatorial_polygon(gmap, 3);
|
||||
Dart_handle dh6=CGAL::make_combinatorial_polygon(gmap, 3);
|
||||
Dart_handle dh5=gmap.make_combinatorial_polygon(3);
|
||||
Dart_handle dh6=gmap.make_combinatorial_polygon(3);
|
||||
if ( !check_number_of_cells_2(gmap, 10, 9, 3, 3) )
|
||||
return false;
|
||||
|
||||
|
|
@ -122,51 +121,51 @@ bool test_GMAP_2()
|
|||
trace_test_begin();
|
||||
dh5=gmap.template alpha<1>(dh5);
|
||||
dh6=gmap.template alpha<1>(dh6);
|
||||
CGAL::contract_cell<Gmap, 1>(gmap, gmap.template alpha<1>(dh5));
|
||||
gmap.contract_cell<1>(gmap.template alpha<1>(dh5));
|
||||
if ( !check_number_of_cells_2(gmap, 8, 7, 3, 3) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::contract_cell<Gmap, 2>(gmap, dh6);
|
||||
gmap.contract_cell<2>(dh6);
|
||||
if ( !check_number_of_cells_2(gmap, 6, 5, 2, 2) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::contract_cell<Gmap, 1>(gmap, gmap.template alpha<1>(dh5));
|
||||
gmap.contract_cell<1>(gmap.template alpha<1>(dh5));
|
||||
if ( !check_number_of_cells_2(gmap, 5, 4, 2, 2) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::contract_cell<Gmap, 1>(gmap, dh5);
|
||||
gmap.contract_cell<1>(dh5);
|
||||
if ( !check_number_of_cells_2(gmap, 4, 3, 1, 1) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::contract_cell<Gmap, 1>(gmap, dh2);
|
||||
gmap.contract_cell<1>(dh2);
|
||||
if ( !check_number_of_cells_2(gmap, 3, 2, 1, 1) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::contract_cell<Gmap, 1>(gmap, dh1);
|
||||
gmap.contract_cell<1>(dh1);
|
||||
if ( !check_number_of_cells_2(gmap, 2, 1, 1, 1) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::contract_cell<Gmap, 1>(gmap, dh3);
|
||||
gmap.contract_cell<1>(dh3);
|
||||
if ( !check_number_of_cells_2(gmap, 0, 0, 0, 0) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
Dart_handle dh7=CGAL::make_combinatorial_hexahedron(gmap); // f1
|
||||
Dart_handle dh7=gmap.make_combinatorial_hexahedron(); // f1
|
||||
Dart_handle dh8=gmap.template alpha<2,1,0,1,2>(dh7); // f2 opposite to f1
|
||||
Dart_handle dh9=gmap.template alpha<2>(dh7); // face incident to f1 and d2
|
||||
|
||||
CGAL::remove_cell<Gmap,2>(gmap, dh7);
|
||||
gmap.remove_cell<2>(dh7);
|
||||
if ( !check_number_of_cells_2(gmap, 8, 12, 5, 1) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::remove_cell<Gmap,2>(gmap, dh8);
|
||||
gmap.remove_cell<2>(dh8);
|
||||
if ( !check_number_of_cells_2(gmap, 8, 12, 4, 1) )
|
||||
return false;
|
||||
|
||||
|
|
@ -174,7 +173,7 @@ bool test_GMAP_2()
|
|||
gmap.template close<2>();
|
||||
if ( !check_number_of_cells_2(gmap, 8, 12, 6, 1) )
|
||||
return false;
|
||||
if ( !CGAL::is_volume_combinatorial_hexahedron(gmap, dh9) )
|
||||
if ( !gmap.is_volume_combinatorial_hexahedron(dh9) )
|
||||
{
|
||||
std::cout<<"Error: the closed volume is not a combinatorial hexahedron.\n";
|
||||
assert(false);
|
||||
|
|
|
|||
|
|
@ -68,9 +68,9 @@ bool test_GMAP_3()
|
|||
|
||||
// Construction operations
|
||||
trace_test_begin();
|
||||
Dart_handle dh1=CGAL::make_edge(gmap);
|
||||
Dart_handle dh2=CGAL::make_edge(gmap);
|
||||
Dart_handle dh3=CGAL::make_edge(gmap);
|
||||
Dart_handle dh1=gmap.make_edge();
|
||||
Dart_handle dh2=gmap.make_edge();
|
||||
Dart_handle dh3=gmap.make_edge();
|
||||
if ( !check_number_of_cells_3(gmap, 6, 3, 3, 3, 3) )
|
||||
return false;
|
||||
|
||||
|
|
@ -81,8 +81,8 @@ bool test_GMAP_3()
|
|||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
Dart_handle dh5=CGAL::make_combinatorial_polygon(gmap, 3);
|
||||
Dart_handle dh6=CGAL::make_combinatorial_polygon(gmap, 3);
|
||||
Dart_handle dh5=gmap.make_combinatorial_polygon(3);
|
||||
Dart_handle dh6=gmap.make_combinatorial_polygon(3);
|
||||
if ( !check_number_of_cells_3(gmap, 10, 9, 3, 3, 3) )
|
||||
return false;
|
||||
|
||||
|
|
@ -93,21 +93,21 @@ bool test_GMAP_3()
|
|||
|
||||
trace_test_begin();
|
||||
gmap.clear();
|
||||
Dart_handle dh7=CGAL::make_combinatorial_hexahedron(gmap); // f1
|
||||
Dart_handle dh7=gmap.make_combinatorial_hexahedron(); // f1
|
||||
Dart_handle dh8=gmap.template alpha<2,1,0,1,2>(dh7); // f2 opposite to f1
|
||||
Dart_handle dh9=gmap.template alpha<2>(dh7); // face incident to f1 and d2
|
||||
|
||||
CGAL::remove_cell<GMAP,2>(gmap, dh7);
|
||||
gmap.remove_cell<2>(dh7);
|
||||
if ( !check_number_of_cells_3(gmap, 8, 12, 5, 1, 1) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::remove_cell<GMAP,2>(gmap, dh8);
|
||||
gmap.remove_cell<2>(dh8);
|
||||
if ( !check_number_of_cells_3(gmap, 8, 12, 4, 1, 1) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
Dart_handle dh10=CGAL::make_combinatorial_hexahedron(gmap);
|
||||
Dart_handle dh10=gmap.make_combinatorial_hexahedron();
|
||||
gmap.template sew<3>(dh9,dh10);
|
||||
if ( !check_number_of_cells_3(gmap, 12, 20, 9, 2, 1) )
|
||||
return false;
|
||||
|
|
@ -127,7 +127,7 @@ bool test_GMAP_3()
|
|||
gmap.template close<2>();
|
||||
if ( !check_number_of_cells_3(gmap, 12, 20, 11, 2, 1) )
|
||||
return false;
|
||||
if ( !CGAL::is_volume_combinatorial_hexahedron(gmap, dh9) )
|
||||
if ( !gmap.is_volume_combinatorial_hexahedron(dh9) )
|
||||
{
|
||||
std::cout<<"Error: the closed volume is not a combinatorial hexahedron.\n";
|
||||
assert(false);
|
||||
|
|
@ -140,13 +140,13 @@ bool test_GMAP_3()
|
|||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::remove_cell<GMAP,3>(gmap, gmap.alpha(dh9, 2, 3));
|
||||
gmap.remove_cell<3>(gmap.alpha(dh9, 2, 3));
|
||||
if ( !check_number_of_cells_3(gmap, 12, 20, 11, 2, 1) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::remove_cell<GMAP,2>(gmap, gmap.alpha(dh9, 2));
|
||||
CGAL::remove_cell<GMAP,2>(gmap, gmap.alpha(dh9, 1, 0, 1, 2));
|
||||
gmap.remove_cell<2>(gmap.alpha(dh9, 2));
|
||||
gmap.remove_cell<2>(gmap.alpha(dh9, 1, 0, 1, 2));
|
||||
if ( !check_number_of_cells_3(gmap, 12, 20, 9, 2, 1) )
|
||||
return false;
|
||||
if ( !gmap.is_isomorphic_to(gmap2) )
|
||||
|
|
|
|||
|
|
@ -64,9 +64,9 @@ bool test_GMAP_4()
|
|||
|
||||
// Construction operations
|
||||
trace_test_begin();
|
||||
Dart_handle dh1=CGAL::make_edge(gmap);
|
||||
Dart_handle dh2=CGAL::make_edge(gmap);
|
||||
Dart_handle dh3=CGAL::make_edge(gmap);
|
||||
Dart_handle dh1=gmap.make_edge();
|
||||
Dart_handle dh2=gmap.make_edge();
|
||||
Dart_handle dh3=gmap.make_edge();
|
||||
if ( !check_number_of_cells_4(gmap, 6, 3, 3, 3, 3, 3) )
|
||||
return false;
|
||||
|
||||
|
|
@ -77,8 +77,8 @@ bool test_GMAP_4()
|
|||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
Dart_handle dh5=CGAL::make_combinatorial_polygon(gmap, 3);
|
||||
Dart_handle dh6=CGAL::make_combinatorial_polygon(gmap, 3);
|
||||
Dart_handle dh5=gmap.make_combinatorial_polygon(3);
|
||||
Dart_handle dh6=gmap.make_combinatorial_polygon(3);
|
||||
if ( !check_number_of_cells_4(gmap, 10, 9, 3, 3, 3, 3) )
|
||||
return false;
|
||||
|
||||
|
|
@ -89,27 +89,27 @@ bool test_GMAP_4()
|
|||
|
||||
trace_test_begin();
|
||||
gmap.clear();
|
||||
Dart_handle dh7=CGAL::make_combinatorial_hexahedron(gmap); // f1
|
||||
Dart_handle dh7=gmap.make_combinatorial_hexahedron(); // f1
|
||||
Dart_handle dh8=gmap.template alpha<2,1,0,1,2>(dh7); // f2 opposite to f1
|
||||
Dart_handle dh9=gmap.template alpha<2>(dh7); // face incident to f1 and d2
|
||||
|
||||
CGAL::remove_cell<GMAP,2>(gmap, dh7);
|
||||
gmap.remove_cell<2>(dh7);
|
||||
if ( !check_number_of_cells_4(gmap, 8, 12, 5, 1, 1, 1) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::remove_cell<GMAP,2>(gmap, dh8);
|
||||
gmap.remove_cell<2>(dh8);
|
||||
if ( !check_number_of_cells_4(gmap, 8, 12, 4, 1, 1, 1) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
Dart_handle dh10=CGAL::make_combinatorial_hexahedron(gmap);
|
||||
Dart_handle dh10=gmap.make_combinatorial_hexahedron();
|
||||
gmap.template sew<3>(dh9,dh10);
|
||||
if ( !check_number_of_cells_4(gmap, 12, 20, 9, 2, 1, 1) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
Dart_handle dh11=CGAL::make_combinatorial_hexahedron(gmap);
|
||||
Dart_handle dh11=gmap.make_combinatorial_hexahedron();
|
||||
gmap.template sew<4>(dh10,dh11);
|
||||
if ( !check_number_of_cells_4(gmap, 12, 20, 9, 2, 2, 1) )
|
||||
return false;
|
||||
|
|
@ -129,7 +129,7 @@ bool test_GMAP_4()
|
|||
gmap.template close<2>();
|
||||
if ( !check_number_of_cells_4(gmap, 12, 20, 11, 2, 2, 1) )
|
||||
return false;
|
||||
if ( !CGAL::is_volume_combinatorial_hexahedron(gmap, dh9) )
|
||||
if ( !gmap.is_volume_combinatorial_hexahedron(dh9) )
|
||||
{
|
||||
std::cout<<"Error: the closed volume is not a combinatorial hexahedron.\n";
|
||||
assert(false);
|
||||
|
|
@ -147,19 +147,19 @@ bool test_GMAP_4()
|
|||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::remove_cell<GMAP,4>(gmap, gmap.alpha(dh9, 2, 3, 4));
|
||||
gmap.remove_cell<4>(gmap.alpha(dh9, 2, 3, 4));
|
||||
if ( !check_number_of_cells_4(gmap, 12, 20, 11, 4, 2, 1) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::remove_cell<GMAP,3>(gmap, gmap.alpha(dh9, 2, 3));
|
||||
CGAL::remove_cell<GMAP,3>(gmap, gmap.alpha(dh10, 2, 4, 3));
|
||||
gmap.remove_cell<3>(gmap.alpha(dh9, 2, 3));
|
||||
gmap.remove_cell<3>(gmap.alpha(dh10, 2, 4, 3));
|
||||
if ( !check_number_of_cells_4(gmap, 12, 20, 11, 2, 2, 1) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::remove_cell<GMAP,2>(gmap, gmap.alpha(dh9, 2));
|
||||
CGAL::remove_cell<GMAP,2>(gmap, gmap.alpha(dh9, 1, 0, 1, 2));
|
||||
gmap.remove_cell<2>(gmap.alpha(dh9, 2));
|
||||
gmap.remove_cell<2>(gmap.alpha(dh9, 1, 0, 1, 2));
|
||||
if ( !check_number_of_cells_4(gmap, 12, 20, 9, 2, 2, 1) )
|
||||
return false;
|
||||
|
||||
|
|
@ -244,14 +244,14 @@ bool test_GMAP_4()
|
|||
toremove.push( it );
|
||||
while ( !toremove.empty() )
|
||||
{
|
||||
CGAL::remove_cell<GMAP,1>(gmap, toremove.top());
|
||||
gmap.remove_cell<1>(gmap, toremove.top());
|
||||
toremove.pop();
|
||||
}
|
||||
if ( !check_number_of_cells_4(gmap, 20, 28, 16, 3, 3, 3) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::remove_cell<GMAP,0>(gmap, dh16);
|
||||
gmap.remove_cell<0>(gmap, dh16);
|
||||
if ( !check_number_of_cells_4(gmap, 19, 27, 16, 3, 3, 3) )
|
||||
return false;
|
||||
|
||||
|
|
@ -261,14 +261,14 @@ bool test_GMAP_4()
|
|||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::remove_cell<GMAP,0>(gmap, dh15);
|
||||
gmap.remove_cell<0>(gmap, dh15);
|
||||
if ( !check_number_of_cells_4(gmap, 19, 29, 19, 4, 3, 3) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::remove_cell<GMAP,1>(gmap, gmap.beta(dh14,2,1));
|
||||
CGAL::remove_cell<GMAP,1>(gmap, gmap.beta(dh14,0));
|
||||
CGAL::remove_cell<GMAP,1>(gmap, dh14);
|
||||
gmap.remove_cell<1>(gmap, gmap.beta(dh14,2,1));
|
||||
gmap.remove_cell<1>(gmap, gmap.beta(dh14,0));
|
||||
gmap.remove_cell<1>(gmap, dh14);
|
||||
if ( !check_number_of_cells_4(gmap, 18, 26, 17, 4, 3, 3) )
|
||||
return false;
|
||||
|
||||
|
|
@ -278,13 +278,13 @@ bool test_GMAP_4()
|
|||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::remove_cell<GMAP,3>(gmap, dh13);
|
||||
CGAL::remove_cell<GMAP,3>(gmap, dh12);
|
||||
gmap.remove_cell<3>(gmap, dh13);
|
||||
gmap.remove_cell<3>(gmap, dh12);
|
||||
if ( !check_number_of_cells_4(gmap, 13, 17, 10, 2, 2, 2) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::remove_cell<GMAP,1>(gmap, dh11);
|
||||
gmap.remove_cell<1>(gmap, dh11);
|
||||
if ( !check_number_of_cells_4(gmap, 12, 16, 10, 2, 2, 2) )
|
||||
return false;
|
||||
|
||||
|
|
@ -296,14 +296,14 @@ bool test_GMAP_4()
|
|||
toremove.push( it );
|
||||
while ( !toremove.empty() )
|
||||
{
|
||||
CGAL::remove_cell<GMAP,1>(gmap, toremove.top());
|
||||
gmap.remove_cell<1>(gmap, toremove.top());
|
||||
toremove.pop();
|
||||
}
|
||||
if ( !check_number_of_cells_4(gmap, 11, 13, 8, 2, 2, 2) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::remove_cell<GMAP,0>(gmap, dh9);
|
||||
gmap.remove_cell<0>(gmap, dh9);
|
||||
if ( !check_number_of_cells_4(gmap, 10, 12, 8, 2, 2, 2) )
|
||||
return false;
|
||||
|
||||
|
|
@ -315,14 +315,14 @@ bool test_GMAP_4()
|
|||
toremove.push( it );
|
||||
while ( !toremove.empty() )
|
||||
{
|
||||
CGAL::remove_cell<GMAP,1>(gmap, toremove.top());
|
||||
gmap.remove_cell<1>(gmap, toremove.top());
|
||||
toremove.pop();
|
||||
}
|
||||
if ( !check_number_of_cells_4(gmap, 9, 9, 6, 2, 2, 2) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::remove_cell<GMAP,0>(gmap, dh7);
|
||||
gmap.remove_cell<0>(gmap, dh7);
|
||||
if ( !check_number_of_cells_4(gmap, 8, 8, 6, 2, 2, 2) )
|
||||
return false;
|
||||
|
||||
|
|
@ -332,8 +332,8 @@ bool test_GMAP_4()
|
|||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::remove_cell<GMAP,2>(gmap, dh6);
|
||||
CGAL::remove_cell<GMAP,2>(gmap, dh5);
|
||||
gmap.remove_cell<2>(gmap, dh6);
|
||||
gmap.remove_cell<2>(gmap, dh5);
|
||||
if ( !check_number_of_cells_4(gmap, 4, 3, 4, 1, 1, 1) )
|
||||
return false;
|
||||
|
||||
|
|
@ -348,9 +348,9 @@ bool test_GMAP_4()
|
|||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
CGAL::remove_cell<GMAP,1>(gmap, dh1);
|
||||
CGAL::remove_cell<GMAP,1>(gmap, dh2);
|
||||
CGAL::remove_cell<GMAP,1>(gmap, dh3);
|
||||
gmap.remove_cell<1>(dh1);
|
||||
gmap.remove_cell<1>(dh2);
|
||||
gmap.remove_cell<1>(dh3);
|
||||
if ( !check_number_of_cells_4(gmap, 0, 0, 0, 0, 0, 0) )
|
||||
return false;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue