00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "ligo_error.h"
00027
00028 namespace NLLIGO
00029 {
00030
00031
00032
00033 CLigoError::CLigoError()
00034 {
00035 clear ();
00036 }
00037
00038
00039
00040 void CLigoError::pushVertexError (TError code, uint id, uint edge)
00041 {
00042
00043 uint vertex;
00044 for (vertex=0; vertex<_VertexError.size(); vertex++)
00045 {
00046 if (_VertexError[vertex].Id == id)
00047 {
00048 _VertexError[vertex] = CVertex (code, id, edge);
00049 break;
00050 }
00051 }
00052
00053
00054 if (vertex == _VertexError.size())
00055 {
00056
00057 _VertexError.push_back (CVertex (code, id, edge));
00058 }
00059 }
00060
00061
00062
00063 uint CLigoError::numVertexError () const
00064 {
00065 return _VertexError.size ();
00066 }
00067
00068
00069
00070 CLigoError::TError CLigoError::getVertexError (uint error, uint &id, uint &edge) const
00071 {
00072 const CVertex &vertex = _VertexError[error];
00073 id = vertex.Id;
00074 edge = vertex.Edge;
00075 return vertex.Code;
00076 }
00077
00078
00079
00080 void CLigoError::clear ()
00081 {
00082 MainError = NoError;
00083 _VertexError.clear ();
00084 }
00085
00086
00087
00088 const char* CLigoError::_StringError[CLigoError::ErrorCount]=
00089 {
00090 "No error",
00091 "No vertex in the edge list",
00092 "Opened edges detected",
00093 "Mulitple edge on the boundary",
00094 "Vertex list invalid. One vertex should be a corner",
00095 "The vertex has not been inserted in the edge list",
00096 "The vertex has been inserted in the edge list",
00097 "Flat zone, all vertices are in the same corner",
00098 "The zone must have 4 edges to define a material",
00099 "A edge of the zone is not symetrical",
00100 "Not the same number of vertex",
00101 "Some vertices are not the same",
00102 "No corner found",
00103 "A edge has two times the same corner",
00104 "A corner is missing in this edge",
00105 "A boundary vertex is used by multiple edges",
00106 "Unkown error",
00107 };
00108
00109
00110
00111 const char* CLigoError::getStringError (TError errorCode)
00112 {
00113 if (errorCode<=ErrorCount)
00114 {
00115 return _StringError[errorCode];
00116 }
00117 else
00118 {
00119 return _StringError[UnknownError];
00120 }
00121 }
00122
00123
00124
00125 }