forked from xuhaocuhk/ComputeTechnic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
86 lines (67 loc) · 2.67 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include <iostream>
#include <bricks/BrickFactory.h>
#include <configure/global_variables.h>
#include <objectives/Grader.h>
#include <fstream>
#include <connector/BeamLayoutConnectorGenerator.h>
#include <util/Timer.h>
#include <io/DataWriter.h>
#include "core/LEGOGenerator.h"
using std::vector;
using std::set;
using std::cout;
using std::endl;
using std::cin;
int main(int argc, char *argv[]) {
if(argc == 1){
printf("Please specify sketch path mode!\n");
printf("Either -path_select or -path_provide\n");
exit(1);
}else{
if( strcmp(argv[1], "-path_select") == 0 ){
if(argc == 3){
glob_vars::current_input = std::stoi(argv[2]);
}else if(argc == 2){
// do nothing
}else{
printf("Argument error!\n");
exit(1);
}
}else if( strcmp(argv[1], "-path_provide") == 0){
printf("Please provide sketch path:\n");
glob_vars::sketch_path = argv[2];
}else{
printf("Argument error!\n");
exit(1);
}
}
LEGOGenerator generator;
DataWriter::initDebugDirectory();
DataWriter::writeProgramStatistics(glob_vars::config_file);
////establish symmetry on sketchline level
glob_vars::sketchGraph->estabilshSketchSymmetry();
////initialize guiding graph
glob_vars::guidingGraph = new GuidingGraph(glob_vars::sketchGraph);
////statistics of input sketch
DataWriter::writeInputStatistics(glob_vars::config_file);
////stage one:estimate local beam orientation
glob_vars::sketchGraph->estimateLocalBeamOrientation();
////extract components and compute all possible beam placements
generator.extractComponents();
generator.computeBeamPlacements();
////stage two: main generation
printf("Second Stage Generation!\n");
generator.stage_two_generation();
/******* Debugging... Show all uncovered edges *******/
DataWriter::writeUnCoveredUnitEdge( "uncovered_edges" );
/***** Testing Connector Stuff *****/
BeamLayoutConnectorGenerator connectorGenerator(generator.major_compont_graph);
connectorGenerator.genConnectorsCoverUnCoveredEdges();
connectorGenerator.genStraightConnectors();
DataWriter::writeBeamHoles(connectorGenerator, "");
DataWriter::writeBeamInstances(*generator.major_compont_graph, connectorGenerator, "_3DBeamsFinalConnectors_indv_nsymm", true, false);
DataWriter::writeFinalResultStatistics(*generator.major_compont_graph, connectorGenerator);
DataWriter::writeFinalResultComplexity(*generator.major_compont_graph, connectorGenerator);
glob_vars::config_file.close();
return 0;
}