00001
00004 #ifndef UTIL_CM
00005 #define UTIL_CM
00006 #include <iostream>
00007 #include <string>
00008
00009 static void check_error (bool expr, const std::string & message);
00010 static void check_warn (bool expr, const std::string & message);
00011 static void usage();
00012
00017 static void check_error (bool expr, const std::string & message) {
00018 if (expr) {
00019 std::cerr << "Error: " << message << std::endl;
00020 exit(1);
00021 }
00022 }
00023
00028 static void check_warn (bool expr, const std::string & message) {
00029 if (expr)
00030 std::cerr << "Warning: " << message << std::endl;
00031 }
00032
00033
00034
00035
00036
00037
00038
00042 static void usage() {
00043 std::cerr << "USAGE:\n CirclePatterns.exe <INPUT_OPTIONS> "
00044 << " <OUTPUT_OPTIONS> [OTHER OPTIONS] | <INPUT_FILE_WITH_OPTIONS>\n" << std::endl;
00045 std::cerr << "OPTIONS:\n"
00046 << " MAIN OPTIONS:\n"
00047 << " -io <input obj file>\n"
00048 << " -oo <output obj file>\n"
00049 << " <text file with options>\n"
00050 << " ADDITIONAL INPUT OPTIONS:\n"
00051 << " -ic <input conn file>\n"
00052 << " -iv <singularities file>\n"
00053 << " -ie <edges to cut file>\n"
00054 << " ADDITIONAL OUTPUT OPTIONS:\n"
00055 << " -oc <output conn file>\n"
00056 << " -ob <output cut obj file>\n"
00057 << " -ovt <otput vt file>\n"
00058 << " OTHER OPTIONS:\n"
00059 << " -no (only cut and layout mesh, no parameterization is computed)\n"
00060 << " -help (outputs usage message)\n"
00061 << std::endl;
00062
00063 exit(1);
00064 }
00065
00070 struct ProgramOptions {
00072 std::string file_in;
00073
00075 std::string edge_file;
00076
00078 std::string vert_file;
00079
00081 std::string conn_file_out;
00082
00084 std::string obj_file_out;
00085
00087 std::string vt_file_out;
00088
00090 bool read_obj;
00091
00093 bool read_conn;
00094
00096 bool read_vert;
00097
00099 bool read_edges;
00100
00102 bool write_obj;
00103
00105 bool write_vt;
00106
00108 bool write_conn;
00109
00112 bool do_optim;
00113
00114 ProgramOptions(): file_in(""), edge_file(""), vert_file(""),
00115 conn_file_out(""), obj_file_out(""), vt_file_out(""),
00116 read_obj(false), read_conn(false),
00117 read_vert(false), read_edges(false),
00118 write_obj(false), write_conn(false),
00119 write_vt(false), do_optim(true)
00120 {}
00121 };
00122
00123 #endif
00124