00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef delphin_output_lib_types_h
00019 #define delphin_output_lib_types_h
00020
00021 #include <string>
00022 #include <vector>
00023 #include <utility>
00024
00025 namespace DELPHIN {
00026
00035 class ReadNotification {
00036 public:
00037 ReadNotification() : abort(false) {}
00038 virtual ~ReadNotification() {}
00042 virtual void notify() = 0;
00043 virtual void notify(int) { notify(); }
00044 virtual void notify(const char *) { notify(); }
00045 virtual void notify(double) { notify(); }
00046
00047 bool abort;
00048 };
00049
00050
00052 class MaterialDef {
00053 public:
00054 MaterialDef() {};
00055 MaterialDef(unsigned int n, unsigned int c, const std::string& nam) :
00056 nr(n), color(c), name(nam) {}
00057 unsigned int nr;
00058 unsigned int color;
00059 std::string name;
00060 };
00061
00062 inline bool operator==(const MaterialDef& lhs, const MaterialDef& rhs) {
00063 return lhs.nr == rhs.nr && lhs.name == rhs.name && lhs.color == rhs.color;
00064 }
00065
00066
00067
00069 class Grid {
00070 public:
00072 Grid() { clear(); }
00074 void clear();
00075
00076 std::vector<double> xwidths;
00077 std::vector<double> ywidths;
00078 std::vector<double> zwidths;
00079 std::vector<double> x_coords;
00080 std::vector<double> y_coords;
00081 std::vector<double> x_gridCoords;
00082 std::vector<double> y_gridCoords;
00083 int constructionType;
00084 };
00085
00086
00088 class ElementGeometry {
00089 public:
00090 unsigned int n;
00091 double x;
00092 double y;
00093 unsigned int i;
00094 unsigned int j;
00095 unsigned int matnr;
00096 };
00097
00099 inline bool operator==(const ElementGeometry& lhs, const std::pair<unsigned int, unsigned int>& rhs) {
00100 return (lhs.i == rhs.first && lhs.j == rhs.second);
00101 }
00102 inline bool operator!=(const ElementGeometry& lhs, const std::pair<unsigned int, unsigned int>& rhs) {
00103 return !(lhs == rhs);
00104 }
00105
00106
00107
00109 class SidesGeometry {
00110 public:
00111 unsigned int n;
00112 double x;
00113 double y;
00114 unsigned int i;
00115 unsigned int j;
00116 bool vertical;
00117 };
00118
00119
00121 struct SideIdentification {
00122 SideIdentification(unsigned int i, unsigned int j, bool vertical) : m_i(i), m_j(j), m_vertical(vertical) {}
00123 unsigned int m_i, m_j;
00124 bool m_vertical;
00125 };
00126
00127
00130 inline bool operator==(const SidesGeometry& lhs, const SideIdentification& rhs) {
00131 return (lhs.i == rhs.m_i &&
00132 lhs.j == rhs.m_j &&
00133 lhs.vertical == rhs.m_vertical);
00134 }
00135 inline bool operator!=(const SidesGeometry& lhs, const SideIdentification& rhs) {
00136 return !(lhs == rhs);
00137 }
00138
00139
00140
00145 template <class T>
00146 class rectangle {
00147 public:
00149 rectangle() : left(T()), top(T()), right(T()), bottom(T()) {};
00151 rectangle(T l, T t, T r, T b) : left(l), top(t), right(r), bottom(b) {};
00153 void set(T l, T t, T r, T b) { left=l; top=t; right=r; bottom=b; };
00154
00156 T width() const { return right - left; };
00158 T height() const { return bottom - top; };
00159
00160 T left;
00161 T top;
00162 T right;
00163 T bottom;
00164 };
00165
00166
00170 struct ElementData : public rectangle<int> {
00171 ElementData() : rectangle(-1,-1,-1,-1), x(-1), y(-1) {}
00172 double x, y;
00173 };
00174
00175
00177 struct LineData {
00178 double x1, y1;
00179 double x2, y2;
00180 };
00181
00182
00184 struct QuadElementData {
00185 int n1, n2, n3, n4;
00186 };
00187
00188
00189 }
00190
00194
00195 #endif // delphin_output_lib_types_h
00196
00197