mirror of https://github.com/CGAL/cgal
testsuite
This commit is contained in:
parent
acc7160261
commit
d28b5eddfc
|
|
@ -2119,12 +2119,18 @@ Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Ed
|
||||||
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Set_cost_cache.h -text
|
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Set_cost_cache.h -text
|
||||||
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Vertex_is_fixed_property_map_always_false.h -text
|
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Vertex_is_fixed_property_map_always_false.h -text
|
||||||
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/collapse_triangulation_edge_Polyhedron_3.h -text
|
Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/collapse_triangulation_edge_Polyhedron_3.h -text
|
||||||
|
Surface_mesh_simplification/test/Surface_mesh_simplification/LT_cost_cache_strategy.cpp -text
|
||||||
|
Surface_mesh_simplification/test/Surface_mesh_simplification/LT_cost_placement_cache_strategy.cpp -text
|
||||||
Surface_mesh_simplification/test/Surface_mesh_simplification/LT_no_cache_strategy.cpp -text
|
Surface_mesh_simplification/test/Surface_mesh_simplification/LT_no_cache_strategy.cpp -text
|
||||||
|
Surface_mesh_simplification/test/Surface_mesh_simplification/MP_no_cache_strategy.cpp -text
|
||||||
Surface_mesh_simplification/test/Surface_mesh_simplification/aux_edge_collapse_test_Polyhedron_3.cpp -text
|
Surface_mesh_simplification/test/Surface_mesh_simplification/aux_edge_collapse_test_Polyhedron_3.cpp -text
|
||||||
|
Surface_mesh_simplification/test/Surface_mesh_simplification/check_audit_edge_collapse_visitor.cpp -text
|
||||||
Surface_mesh_simplification/test/Surface_mesh_simplification/create_audit_edge_collapse_Polyhedron_3_LT.cpp -text
|
Surface_mesh_simplification/test/Surface_mesh_simplification/create_audit_edge_collapse_Polyhedron_3_LT.cpp -text
|
||||||
|
Surface_mesh_simplification/test/Surface_mesh_simplification/create_audit_edge_collapse_Polyhedron_3_MP.cpp -text
|
||||||
Surface_mesh_simplification/test/Surface_mesh_simplification/create_audit_edge_collapse_visitor.cpp -text
|
Surface_mesh_simplification/test/Surface_mesh_simplification/create_audit_edge_collapse_visitor.cpp -text
|
||||||
Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_test.cpp -text
|
Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_test.cpp -text
|
||||||
Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_test.kdevelop -text
|
Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_test.kdevelop -text
|
||||||
|
Surface_mesh_simplification/test/Surface_mesh_simplification/test_edge_collapse_Polyhedron_3_LT_no_cache.cpp -text
|
||||||
Surface_mesher/demo/Surface_mesher/windows/Mesh.suo -text
|
Surface_mesher/demo/Surface_mesher/windows/Mesh.suo -text
|
||||||
Surface_mesher/demo/Surface_mesher/windows/res/Mesh.ico -text svneol=unset#image/x-icon
|
Surface_mesher/demo/Surface_mesher/windows/res/Mesh.ico -text svneol=unset#image/x-icon
|
||||||
Surface_mesher/demo/Surface_mesher/windows/res/MeshDoc.ico -text svneol=unset#image/x-icon
|
Surface_mesher/demo/Surface_mesher/windows/res/MeshDoc.ico -text svneol=unset#image/x-icon
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ include $(CGAL_MAKEFILE)
|
||||||
|
|
||||||
CXXFLAGS = -I../../include/ \
|
CXXFLAGS = -I../../include/ \
|
||||||
-I../../../BGL/include/ \
|
-I../../../BGL/include/ \
|
||||||
|
$(TESTSUITE_CXXFLAGS) \
|
||||||
$(EXTRA_FLAGS) \
|
$(EXTRA_FLAGS) \
|
||||||
$(CGAL_CXXFLAGS)
|
$(CGAL_CXXFLAGS)
|
||||||
|
|
||||||
|
|
@ -22,9 +23,13 @@ CXXFLAGS = -I../../include/ \
|
||||||
# linker flags
|
# linker flags
|
||||||
#---------------------------------------------------------------------#
|
#---------------------------------------------------------------------#
|
||||||
|
|
||||||
LIBPATH = $(CGAL_LIBPATH)
|
LIBPATH = \
|
||||||
|
$(TESTSUITE_LIBPATH) \
|
||||||
|
$(CGAL_LIBPATH)
|
||||||
|
|
||||||
LDFLAGS = $(CGAL_LDFLAGS)
|
LDFLAGS = \
|
||||||
|
$(TESTSUITE_LDFLAGS) \
|
||||||
|
$(CGAL_LDFLAGS)
|
||||||
|
|
||||||
#---------------------------------------------------------------------#
|
#---------------------------------------------------------------------#
|
||||||
# target entries
|
# target entries
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
SMS::Set_no_cache<Surface> cache ;
|
||||||
|
SMS::Cached_cost<Surface> cost ;
|
||||||
|
SMS::LindstromTurk_placement<Surface> placement ;
|
||||||
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
SMS::Set_no_cache<Surface> cache ;
|
||||||
|
SMS::LindstromTurk_cost<Surface> cost ;
|
||||||
|
SMS::LindstromTurk_placement<Surface> placement ;
|
||||||
|
|
||||||
|
|
@ -1,2 +1,4 @@
|
||||||
Method sMethod = LT ;
|
SMS::Set_no_cache<Surface> cache ;
|
||||||
Cache sCache = None ;
|
SMS::LindstromTurk_cost<Surface> cost ;
|
||||||
|
SMS::LindstromTurk_placement<Surface> placement ;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
SMS::Set_no_cache<Surface> cache ;
|
||||||
|
SMS::Edge_length_cost<Surface> cost ;
|
||||||
|
SMS::Midpoint_placement<Surface> placement ;
|
||||||
|
|
||||||
|
|
@ -22,8 +22,6 @@
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <boost/tokenizer.hpp>
|
|
||||||
#include <boost/lexical_cast.hpp>
|
|
||||||
|
|
||||||
#define CGAL_CHECK_EXPENSIVE
|
#define CGAL_CHECK_EXPENSIVE
|
||||||
|
|
||||||
|
|
@ -72,213 +70,98 @@ void error_handler ( char const* what, char const* expr, char const* file, int l
|
||||||
if ( msg != 0)
|
if ( msg != 0)
|
||||||
cerr << "Explanation:" << msg << endl;
|
cerr << "Explanation:" << msg << endl;
|
||||||
|
|
||||||
throw std::logic_error("");
|
throw std::runtime_error(expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace SMS = CGAL::Surface_mesh_simplification ;
|
namespace SMS = CGAL::Surface_mesh_simplification ;
|
||||||
|
|
||||||
typedef Vertex_is_fixed_property_map_always_false<Surface> Vertex_is_fixed_map ;
|
typedef Vertex_is_fixed_property_map_always_false<Surface> Vertex_is_fixed_map ;
|
||||||
|
|
||||||
enum Method { LT, MP } ;
|
template<class T>
|
||||||
enum Cache { None, Cost, CostAndPlacement } ;
|
ostream& operator << ( ostream& os, optional<T> const& o )
|
||||||
|
|
||||||
char const* method_to_string( Method aMethod )
|
|
||||||
{
|
{
|
||||||
switch(aMethod)
|
if ( o )
|
||||||
{
|
return os << *o ;
|
||||||
case LT: return "LT" ; break ;
|
else return os << "<null>" ;
|
||||||
case MP: return "MP" ; break ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return "<unknown>" ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* cache_to_string( Cache aCache )
|
#define ERROR(msg) \
|
||||||
{
|
{ \
|
||||||
switch(aCache)
|
cerr << "\nError: " << msg << endl \
|
||||||
{
|
<< " File:" << __FILE__ << endl \
|
||||||
case None : return "NoCache" ; break ;
|
<< " Line:" << __LINE__ << endl ; \
|
||||||
case Cost : return "CostCache" ; break ;
|
throw runtime_error("test error"); \
|
||||||
case CostAndPlacement : return "CostAndPlacementCache" ; break ;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return "<unknown>" ;
|
#define CHECK_MSG(pred,msg) if (!(pred)) ERROR(msg)
|
||||||
}
|
|
||||||
|
#define CHECK(pred) CHECK_MSG(pred,#pred)
|
||||||
|
|
||||||
|
#define CHECK_EQUAL(x,y) CHECK_MSG(((x)==(y)),"assertion " << #x << ":(" << x << ")==" << #y << ":(" << y << ") FAILED")
|
||||||
|
#define CHECK_NOT_EQUAL(x,y) CHECK_MSG(((x)!=(y)),"assertion " << #x << ":(" << x << ")!=" << #y << ":(" << y << ") FAILED")
|
||||||
|
|
||||||
#include VISITOR
|
#include VISITOR
|
||||||
#include STRATEGY
|
|
||||||
|
|
||||||
typedef SMS::LindstromTurk_params LT_params ;
|
bool Test ( string aName )
|
||||||
typedef char Dummy_params ;
|
|
||||||
|
|
||||||
typedef SMS::Cost_cache<Surface> Cost_cache ;
|
|
||||||
typedef SMS::Cost_and_placement_cache<Surface> Cost_placement_cache ;
|
|
||||||
|
|
||||||
typedef SMS::Cached_cost <Surface> Cached_cost ;
|
|
||||||
typedef SMS::Edge_length_cost <Surface> MP_cost ;
|
|
||||||
typedef SMS::LindstromTurk_cost<Surface> LT_cost ;
|
|
||||||
|
|
||||||
typedef SMS::Cached_placement<Surface> Cached_placement ;
|
|
||||||
typedef SMS::Midpoint_placement<Surface> MP_placement ;
|
|
||||||
typedef SMS::LindstromTurk_placement<Surface> LT_placement ;
|
|
||||||
|
|
||||||
typedef SMS::Set_no_cache<Surface> Set_no_cache ;
|
|
||||||
|
|
||||||
typedef SMS::Set_cost_cache<Surface,MP_cost> Set_cost_cache_MP ;
|
|
||||||
typedef SMS::LindstromTurk_set_cost_cache<Surface> Set_cost_cache_LT ;
|
|
||||||
|
|
||||||
typedef SMS::Set_cost_and_placement_cache<Surface,MP_cost,MP_placement> Set_cost_placement_cache_MP ;
|
|
||||||
typedef SMS::LindstromTurk_set_cost_and_placement_cache<Surface> Set_cost_placement_cache_LT ;
|
|
||||||
|
|
||||||
bool Test ( string aName, Method aMethod, Cache aCache )
|
|
||||||
{
|
{
|
||||||
bool rSucceeded = false ;
|
bool rSucceeded = false ;
|
||||||
|
|
||||||
string off_name = aName ;
|
try
|
||||||
|
|
||||||
string audit_name = aName.substr(0,aName.find_last_of(".")) + "_" + method_to_string(aMethod) + ".audit" ;
|
|
||||||
|
|
||||||
ifstream off_is(off_name.c_str());
|
|
||||||
if ( off_is )
|
|
||||||
{
|
{
|
||||||
Surface lSurface;
|
string off_name = aName ;
|
||||||
off_is >> lSurface ;
|
|
||||||
if ( lSurface.is_valid() )
|
string audit_name = aName.substr(0,aName.find_last_of(".")) + "_" + STRATEGY_ACRN + ".audit" ;
|
||||||
|
|
||||||
|
ifstream off_is(off_name.c_str());
|
||||||
|
if ( off_is )
|
||||||
{
|
{
|
||||||
if ( lSurface.is_pure_triangle() )
|
Surface lSurface;
|
||||||
|
off_is >> lSurface ;
|
||||||
|
if ( lSurface.is_valid() )
|
||||||
{
|
{
|
||||||
ofstream audit_s(audit_name.c_str());
|
if ( lSurface.is_pure_triangle() )
|
||||||
if ( audit_s )
|
|
||||||
{
|
{
|
||||||
|
Visitor lVisitor(audit_name) ;
|
||||||
|
|
||||||
set_halfedgeds_items_id(lSurface);
|
set_halfedgeds_items_id(lSurface);
|
||||||
|
|
||||||
SMS::Count_stop_predicate<Surface> stop(1);
|
SMS::Count_stop_predicate<Surface> stop(1);
|
||||||
|
|
||||||
Cached_cost get_cached_cost ;
|
#include STRATEGY_POLICIES
|
||||||
MP_cost get_MP_cost;
|
|
||||||
LT_cost get_LT_cost;
|
|
||||||
|
|
||||||
Cached_placement get_cached_placement ;
|
|
||||||
MP_placement get_MP_placement;
|
|
||||||
LT_placement get_LT_placement;
|
|
||||||
|
|
||||||
Set_no_cache set_no_cache ;
|
|
||||||
|
|
||||||
Set_cost_cache_MP set_cost_cache_MP(get_MP_cost) ;
|
|
||||||
Set_cost_cache_LT set_cost_cache_LT ;
|
|
||||||
|
|
||||||
Set_cost_placement_cache_MP set_cost_placement_cache_MP(get_MP_cost,get_MP_placement) ;
|
|
||||||
Set_cost_placement_cache_LT set_cost_placement_cache_LT ;
|
|
||||||
|
|
||||||
Visitor lVisitor(audit_s) ;
|
|
||||||
|
|
||||||
int r = -1 ;
|
|
||||||
|
|
||||||
Real_timer t ; t.start();
|
Real_timer t ; t.start();
|
||||||
switch( aMethod )
|
edge_collapse(lSurface
|
||||||
{
|
,stop
|
||||||
case MP:
|
,set_cache(cache)
|
||||||
|
.get_cost(cost)
|
||||||
switch ( aCache )
|
.get_placement(placement)
|
||||||
{
|
.visitor(&lVisitor)
|
||||||
case None :
|
);
|
||||||
|
|
||||||
r = edge_collapse(lSurface
|
|
||||||
,stop
|
|
||||||
,set_cache(set_no_cache)
|
|
||||||
.get_cost(get_MP_cost)
|
|
||||||
.get_placement(get_MP_placement)
|
|
||||||
.visitor(&lVisitor)
|
|
||||||
);
|
|
||||||
break ;
|
|
||||||
|
|
||||||
case Cost :
|
|
||||||
|
|
||||||
r = edge_collapse(lSurface
|
|
||||||
,stop
|
|
||||||
,set_cache(set_cost_cache_MP)
|
|
||||||
.get_cost(get_cached_cost)
|
|
||||||
.get_placement(get_MP_placement)
|
|
||||||
.visitor(&lVisitor)
|
|
||||||
);
|
|
||||||
break ;
|
|
||||||
|
|
||||||
case CostAndPlacement :
|
|
||||||
|
|
||||||
r = edge_collapse(lSurface
|
|
||||||
,stop
|
|
||||||
,set_cache(set_cost_placement_cache_MP)
|
|
||||||
.get_cost(get_cached_cost)
|
|
||||||
.get_placement(get_cached_placement)
|
|
||||||
.visitor(&lVisitor)
|
|
||||||
);
|
|
||||||
break ;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
break ;
|
|
||||||
|
|
||||||
case LT:
|
|
||||||
|
|
||||||
switch ( aCache )
|
|
||||||
{
|
|
||||||
case None :
|
|
||||||
|
|
||||||
r = edge_collapse(lSurface
|
|
||||||
,stop
|
|
||||||
,set_cache(set_no_cache)
|
|
||||||
.get_cost(get_LT_cost)
|
|
||||||
.get_placement(get_LT_placement)
|
|
||||||
.visitor(&lVisitor)
|
|
||||||
);
|
|
||||||
break ;
|
|
||||||
|
|
||||||
case Cost :
|
|
||||||
|
|
||||||
r = edge_collapse(lSurface
|
|
||||||
,stop
|
|
||||||
,set_cache(set_cost_cache_LT)
|
|
||||||
.get_cost(get_cached_cost)
|
|
||||||
.get_placement(get_LT_placement)
|
|
||||||
.visitor(&lVisitor)
|
|
||||||
);
|
|
||||||
break ;
|
|
||||||
|
|
||||||
case CostAndPlacement :
|
|
||||||
|
|
||||||
r = edge_collapse(lSurface
|
|
||||||
,stop
|
|
||||||
,set_cache(set_cost_placement_cache_LT)
|
|
||||||
.get_cost(get_cached_cost)
|
|
||||||
.get_placement(get_cached_placement)
|
|
||||||
.visitor(&lVisitor)
|
|
||||||
);
|
|
||||||
break ;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
t.stop();
|
t.stop();
|
||||||
|
|
||||||
rSucceeded = true ;
|
rSucceeded = true ;
|
||||||
}
|
}
|
||||||
else cerr << "Unable to open audit file: " << audit_name << endl ;
|
else
|
||||||
|
{
|
||||||
|
cerr << "Surface is not triangulated (has faces with more than 3 sides): " << aName << endl ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cerr << "Surface is not triangulated (has faces with more than 3 sides): " << aName << endl ;
|
cerr << "Invalid surface: " << aName << endl ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cerr << "Invalid surface: " << aName << endl ;
|
cerr << "Unable to open test file " << aName << endl ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
catch ( exception const& x )
|
||||||
{
|
{
|
||||||
cerr << "Unable to open test file " << aName << endl ;
|
cerr << "Exception caught: " << x.what() << endl ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return rSucceeded ;
|
return rSucceeded ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -306,7 +189,7 @@ int main( int argc, char** argv )
|
||||||
unsigned lOK = 0 ;
|
unsigned lOK = 0 ;
|
||||||
for ( vector<string>::const_iterator it = lCases.begin(); it != lCases.end() ; ++ it )
|
for ( vector<string>::const_iterator it = lCases.begin(); it != lCases.end() ; ++ it )
|
||||||
{
|
{
|
||||||
if ( Test(*it, sMethod, sCache) )
|
if ( Test(*it) )
|
||||||
++ lOK ;
|
++ lOK ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,166 @@
|
||||||
|
#include <map>
|
||||||
|
#include <boost/tokenizer.hpp>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
class Visitor
|
||||||
|
{
|
||||||
|
private :
|
||||||
|
|
||||||
|
struct Data
|
||||||
|
{
|
||||||
|
Data ( bool isf ) : is_fixed(isf) {}
|
||||||
|
|
||||||
|
bool is_fixed ;
|
||||||
|
bool is_collapsable ;
|
||||||
|
size_t order ;
|
||||||
|
optional<double> cost ;
|
||||||
|
optional<Point> placement ;
|
||||||
|
} ;
|
||||||
|
typedef shared_ptr<Data> Data_ptr ;
|
||||||
|
|
||||||
|
typedef map<int,Data_ptr> Table ;
|
||||||
|
|
||||||
|
private :
|
||||||
|
|
||||||
|
typedef char_separator<char> Separator ;
|
||||||
|
typedef tokenizer<Separator> Tokenizer ;
|
||||||
|
|
||||||
|
void ReadAudit( istream& in )
|
||||||
|
{
|
||||||
|
size_t order = 0 ;
|
||||||
|
string line ;
|
||||||
|
while ( getline(in,line) )
|
||||||
|
{
|
||||||
|
if ( line.length() > 1 )
|
||||||
|
{
|
||||||
|
Tokenizer tk(line,Separator(" "));
|
||||||
|
vector<string> tokens(tk.begin(),tk.end());
|
||||||
|
CHECK( tokens.size() > 1 ) ;
|
||||||
|
char c = tokens[0][0] ;
|
||||||
|
switch ( c )
|
||||||
|
{
|
||||||
|
case 'I' :
|
||||||
|
{
|
||||||
|
CHECK( tokens.size() > 2 ) ;
|
||||||
|
size_t id = lexical_cast<size_t>(tokens[1]);
|
||||||
|
bool is_fixed = lexical_cast<bool> (tokens[2]);
|
||||||
|
CHECK(audit_table.find(id)==audit_table.end());
|
||||||
|
audit_table.insert(make_pair(id, Data_ptr( new Data(is_fixed) ) ) ) ;
|
||||||
|
}
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case 'S' :
|
||||||
|
{
|
||||||
|
size_t id = lexical_cast<size_t>(tokens[1]);
|
||||||
|
Data_ptr data = audit_table[id];
|
||||||
|
CHECK(data);
|
||||||
|
|
||||||
|
optional<double> cost ;
|
||||||
|
if ( tokens.size() > 2 )
|
||||||
|
cost = lexical_cast<double>(tokens[2]);
|
||||||
|
|
||||||
|
data->cost = cost ;
|
||||||
|
data->order = order++;
|
||||||
|
}
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case 'C' :
|
||||||
|
{
|
||||||
|
size_t id = lexical_cast<size_t>(tokens[1]);
|
||||||
|
Data_ptr data = audit_table[id];
|
||||||
|
CHECK(data);
|
||||||
|
|
||||||
|
optional<Point> placement ;
|
||||||
|
if ( tokens.size() > 4 )
|
||||||
|
{
|
||||||
|
double x = lexical_cast<double>(tokens[2]);
|
||||||
|
double y = lexical_cast<double>(tokens[3]);
|
||||||
|
double z = lexical_cast<double>(tokens[4]);
|
||||||
|
placement = Point(x,y,z);
|
||||||
|
}
|
||||||
|
|
||||||
|
data->is_collapsable = true ;
|
||||||
|
data->placement = placement ;
|
||||||
|
}
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case 'N' :
|
||||||
|
{
|
||||||
|
size_t id = lexical_cast<size_t>(tokens[1]);
|
||||||
|
Data_ptr data = audit_table[id];
|
||||||
|
CHECK(data);
|
||||||
|
|
||||||
|
data->is_collapsable = false ;
|
||||||
|
}
|
||||||
|
break ;
|
||||||
|
|
||||||
|
default :
|
||||||
|
ERROR("Invalid audit line: " << line );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public :
|
||||||
|
|
||||||
|
Visitor ( string audit_name )
|
||||||
|
{
|
||||||
|
ifstream in(audit_name.c_str());
|
||||||
|
if ( in )
|
||||||
|
ReadAudit(in);
|
||||||
|
else ERROR("Unable to open audit file: " << audit_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnStarted( Surface& ) { order = 0 ; }
|
||||||
|
|
||||||
|
void OnFinished ( Surface& )
|
||||||
|
{
|
||||||
|
CHECK( audit_table.size() == actual_table.size() );
|
||||||
|
|
||||||
|
for ( size_t i = 0, ei = audit_table.size() ; i != ei ; ++ i )
|
||||||
|
{
|
||||||
|
size_t idx = i * 2 ;
|
||||||
|
Data_ptr audit_data = audit_table[idx];
|
||||||
|
Data_ptr actual_data = actual_table[idx];
|
||||||
|
CHECK(audit_data);
|
||||||
|
CHECK(actual_data);
|
||||||
|
CHECK_EQUAL(audit_data->order ,actual_data->order);
|
||||||
|
CHECK_EQUAL(audit_data->is_fixed ,actual_data->is_fixed);
|
||||||
|
CHECK_EQUAL(audit_data->is_collapsable ,actual_data->is_collapsable);
|
||||||
|
CHECK_EQUAL(!audit_data->cost ,!actual_data->cost);
|
||||||
|
CHECK_EQUAL(!audit_data->placement ,!actual_data->placement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnStopConditionReached( Surface& )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnCollected( Halfedge_handle const& aEdge, bool aIsFixed, Surface& )
|
||||||
|
{
|
||||||
|
actual_table.insert(make_pair(aEdge->id(), Data_ptr( new Data(aIsFixed) ) ) ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnSelected( Halfedge_handle const& aEdge, Surface&, optional<double> const& aCost, size_t, size_t )
|
||||||
|
{
|
||||||
|
actual_table[aEdge->id()]->cost = aCost ;
|
||||||
|
actual_table[aEdge->id()]->order = order ++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnCollapsing(Halfedge_handle const& aEdge, Surface&, optional<Point> const& aPlacement )
|
||||||
|
{
|
||||||
|
actual_table[aEdge->id()]->placement = aPlacement ;
|
||||||
|
actual_table[aEdge->id()]->is_collapsable = true ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnNonCollapsable(Halfedge_handle const& aEdge, Surface& )
|
||||||
|
{
|
||||||
|
actual_table[aEdge->id()]->is_collapsable = false ;
|
||||||
|
}
|
||||||
|
|
||||||
|
private :
|
||||||
|
|
||||||
|
Table audit_table ;
|
||||||
|
Table actual_table ;
|
||||||
|
size_t order ;
|
||||||
|
} ;
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#define VISITOR "create_audit_edge_collapse_visitor.cpp"
|
#define VISITOR "create_audit_edge_collapse_visitor.cpp"
|
||||||
#define STRATEGY "LT_no_cache_strategy.cpp"
|
#define STRATEGY_ACRN "LT"
|
||||||
|
#define STRATEGY_POLICIES "LT_no_cache_strategy.cpp"
|
||||||
|
|
||||||
#include "aux_edge_collapse_test_Polyhedron_3.cpp"
|
#include "aux_edge_collapse_test_Polyhedron_3.cpp"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
#define VISITOR "create_audit_edge_collapse_visitor.cpp"
|
||||||
|
#define STRATEGY_ACRN "MP"
|
||||||
|
#define STRATEGY_POLICIES "MP_no_cache_strategy.cpp"
|
||||||
|
|
||||||
|
#include "aux_edge_collapse_test_Polyhedron_3.cpp"
|
||||||
|
|
@ -1,6 +1,11 @@
|
||||||
struct Visitor
|
struct Visitor
|
||||||
{
|
{
|
||||||
Visitor ( ostream& o ) : mOut(&o) {}
|
Visitor ( string audit_name )
|
||||||
|
:
|
||||||
|
mOut( new ofstream(audit_name.c_str(), ios::trunc ) )
|
||||||
|
{
|
||||||
|
CHECK_MSG(!out(), "Unable to open audit file: " << audit_name);
|
||||||
|
}
|
||||||
|
|
||||||
void OnStarted( Surface& ) {}
|
void OnStarted( Surface& ) {}
|
||||||
|
|
||||||
|
|
@ -10,12 +15,12 @@ struct Visitor
|
||||||
|
|
||||||
void OnCollected( Halfedge_handle const& aEdge, bool aIsFixed, Surface& )
|
void OnCollected( Halfedge_handle const& aEdge, bool aIsFixed, Surface& )
|
||||||
{
|
{
|
||||||
out() << "P" << aEdge->id() << " " << aIsFixed << endl ;
|
out() << "I " << aEdge->id() << " " << aIsFixed << endl ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnSelected( Halfedge_handle const& aEdge, Surface&, optional<double> const& aCost, size_t, size_t )
|
void OnSelected( Halfedge_handle const& aEdge, Surface&, optional<double> const& aCost, size_t, size_t )
|
||||||
{
|
{
|
||||||
out() << "S" << aEdge->id() << " " ;
|
out() << "S " << aEdge->id() << " " ;
|
||||||
if ( aCost )
|
if ( aCost )
|
||||||
out() << *aCost ;
|
out() << *aCost ;
|
||||||
out() << endl ;
|
out() << endl ;
|
||||||
|
|
@ -23,18 +28,18 @@ struct Visitor
|
||||||
|
|
||||||
void OnCollapsing(Halfedge_handle const& aEdge, Surface&, optional<Point> const& aPlacement )
|
void OnCollapsing(Halfedge_handle const& aEdge, Surface&, optional<Point> const& aPlacement )
|
||||||
{
|
{
|
||||||
out() << "C" << aEdge->id() << " " ;
|
out() << "C " << aEdge->id() << " " ;
|
||||||
if ( aPlacement )
|
if ( aPlacement )
|
||||||
out() << aPlacement->x() << " " << aPlacement->y() ;
|
out() << aPlacement->x() << " " << aPlacement->y() << " " << aPlacement->z() ;
|
||||||
out() << endl ;
|
out() << endl ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnNonCollapsable(Halfedge_handle const& aEdge, Surface& )
|
void OnNonCollapsable(Halfedge_handle const& aEdge, Surface& )
|
||||||
{
|
{
|
||||||
out() << "N" << aEdge->id() << endl ;
|
out() << "N " << aEdge->id() << endl ;
|
||||||
}
|
}
|
||||||
|
|
||||||
ostream& out() { return *mOut; }
|
ostream& out() { return *mOut; }
|
||||||
|
|
||||||
ostream* mOut ;
|
shared_ptr<ostream> mOut ;
|
||||||
} ;
|
} ;
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,14 @@
|
||||||
<ignoreparts/>
|
<ignoreparts/>
|
||||||
<projectdirectory>.</projectdirectory>
|
<projectdirectory>.</projectdirectory>
|
||||||
<absoluteprojectpath>false</absoluteprojectpath>
|
<absoluteprojectpath>false</absoluteprojectpath>
|
||||||
<description></description>
|
<description/>
|
||||||
</general>
|
</general>
|
||||||
<kdevcustomproject>
|
<kdevcustomproject>
|
||||||
<run>
|
<run>
|
||||||
<mainprogram>create_audit_edge_collapse_Polyhedron_3_LT</mainprogram>
|
<mainprogram>create_audit_edge_collapse_Polyhedron_3_LT</mainprogram>
|
||||||
<directoryradio>build</directoryradio>
|
<directoryradio>build</directoryradio>
|
||||||
<customdirectory>/</customdirectory>
|
<customdirectory>/</customdirectory>
|
||||||
<programargs></programargs>
|
<programargs/>
|
||||||
<terminal>false</terminal>
|
<terminal>false</terminal>
|
||||||
<autocompile>true</autocompile>
|
<autocompile>true</autocompile>
|
||||||
<envvars/>
|
<envvars/>
|
||||||
|
|
@ -26,8 +26,8 @@
|
||||||
<numberofjobs>1</numberofjobs>
|
<numberofjobs>1</numberofjobs>
|
||||||
<prio>0</prio>
|
<prio>0</prio>
|
||||||
<dontact>false</dontact>
|
<dontact>false</dontact>
|
||||||
<makebin></makebin>
|
<makebin/>
|
||||||
<defaulttarget></defaulttarget>
|
<defaulttarget/>
|
||||||
<makeoptions>CGAL_MAKEFILE=/home/fcacciola/Programming/CGAL/make/makefile_i686_Linux-2.6_g++-4.0.2</makeoptions>
|
<makeoptions>CGAL_MAKEFILE=/home/fcacciola/Programming/CGAL/make/makefile_i686_Linux-2.6_g++-4.0.2</makeoptions>
|
||||||
<selectedenvironment>default</selectedenvironment>
|
<selectedenvironment>default</selectedenvironment>
|
||||||
<environments>
|
<environments>
|
||||||
|
|
@ -38,17 +38,17 @@
|
||||||
</make>
|
</make>
|
||||||
<build>
|
<build>
|
||||||
<buildtool>make</buildtool>
|
<buildtool>make</buildtool>
|
||||||
<builddir></builddir>
|
<builddir/>
|
||||||
</build>
|
</build>
|
||||||
</kdevcustomproject>
|
</kdevcustomproject>
|
||||||
<kdevdebugger>
|
<kdevdebugger>
|
||||||
<general>
|
<general>
|
||||||
<dbgshell></dbgshell>
|
<dbgshell/>
|
||||||
<programargs>data/tetra.off</programargs>
|
<programargs>data/tetra.off</programargs>
|
||||||
<gdbpath></gdbpath>
|
<gdbpath/>
|
||||||
<configGdbScript></configGdbScript>
|
<configGdbScript/>
|
||||||
<runShellScript></runShellScript>
|
<runShellScript/>
|
||||||
<runGdbScript></runGdbScript>
|
<runGdbScript/>
|
||||||
<breakonloadinglibs>true</breakonloadinglibs>
|
<breakonloadinglibs>true</breakonloadinglibs>
|
||||||
<separatetty>false</separatetty>
|
<separatetty>false</separatetty>
|
||||||
<floatingtoolbar>false</floatingtoolbar>
|
<floatingtoolbar>false</floatingtoolbar>
|
||||||
|
|
@ -128,7 +128,7 @@
|
||||||
<headerCompletionDelay>250</headerCompletionDelay>
|
<headerCompletionDelay>250</headerCompletionDelay>
|
||||||
</codecompletion>
|
</codecompletion>
|
||||||
<creategettersetter>
|
<creategettersetter>
|
||||||
<prefixGet></prefixGet>
|
<prefixGet/>
|
||||||
<prefixSet>set</prefixSet>
|
<prefixSet>set</prefixSet>
|
||||||
<prefixVariable>m_,_</prefixVariable>
|
<prefixVariable>m_,_</prefixVariable>
|
||||||
<parameterName>theValue</parameterName>
|
<parameterName>theValue</parameterName>
|
||||||
|
|
@ -154,8 +154,8 @@
|
||||||
</cppsupportpart>
|
</cppsupportpart>
|
||||||
<kdevvisualadvance>
|
<kdevvisualadvance>
|
||||||
<emulator>VisualBoyAdvance</emulator>
|
<emulator>VisualBoyAdvance</emulator>
|
||||||
<binary></binary>
|
<binary/>
|
||||||
<addOptions></addOptions>
|
<addOptions/>
|
||||||
<terminal>false</terminal>
|
<terminal>false</terminal>
|
||||||
<fullscreen>false</fullscreen>
|
<fullscreen>false</fullscreen>
|
||||||
<graphicFilter>-f0</graphicFilter>
|
<graphicFilter>-f0</graphicFilter>
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,20 @@ LDFLAGS = \
|
||||||
# target entries
|
# target entries
|
||||||
#---------------------------------------------------------------------#
|
#---------------------------------------------------------------------#
|
||||||
|
|
||||||
all: create_audit_edge_collapse_Polyhedron_3_LT
|
all: create_audit_edge_collapse_Polyhedron_3_LT \
|
||||||
|
create_audit_edge_collapse_Polyhedron_3_MP \
|
||||||
|
test_edge_collapse_Polyhedron_3_LT \
|
||||||
|
|
||||||
create_audit_edge_collapse_Polyhedron_3_LT$(EXE_EXT): create_audit_edge_collapse_Polyhedron_3_LT$(OBJ_EXT)
|
create_audit_edge_collapse_Polyhedron_3_LT$(EXE_EXT): create_audit_edge_collapse_Polyhedron_3_LT$(OBJ_EXT)
|
||||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)create_audit_edge_collapse_Polyhedron_3_LT create_audit_edge_collapse_Polyhedron_3_LT$(OBJ_EXT) $(LDFLAGS)
|
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)create_audit_edge_collapse_Polyhedron_3_LT create_audit_edge_collapse_Polyhedron_3_LT$(OBJ_EXT) $(LDFLAGS)
|
||||||
|
|
||||||
clean: create_audit_edge_collapse_Polyhedron_3_LT.clean
|
|
||||||
|
test_edge_collapse_Polyhedron_3_LT$(EXE_EXT): test_edge_collapse_Polyhedron_3_LT$(OBJ_EXT)
|
||||||
|
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)test_edge_collapse_Polyhedron_3_LT test_edge_collapse_Polyhedron_3_LT$(OBJ_EXT) $(LDFLAGS)
|
||||||
|
|
||||||
|
clean: create_audit_edge_collapse_Polyhedron_3_LT.clean \
|
||||||
|
create_audit_edge_collapse_Polyhedron_3_MP.clean \
|
||||||
|
test_edge_collapse_Polyhedron_3_LT.clean \
|
||||||
|
|
||||||
#---------------------------------------------------------------------#
|
#---------------------------------------------------------------------#
|
||||||
# suffix rules
|
# suffix rules
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
#define VISITOR "check_audit_edge_collapse_visitor.cpp"
|
||||||
|
#define STRATEGY_ACRN "LT"
|
||||||
|
#define STRATEGY_POLICIES "LT_no_cache_strategy.cpp"
|
||||||
|
|
||||||
|
#include "aux_edge_collapse_test_Polyhedron_3.cpp"
|
||||||
Loading…
Reference in New Issue