| 813 | namespace element { |
| 814 | |
| 815 | struct FiberData |
| 816 | { |
| 817 | FiberData() |
| 818 | : y(0.0), z(0.0), a(0.0) {} |
| 819 | FiberData(double _y, double _z, double _a) |
| 820 | : y(_y), z(_z), a(_a) {} |
| 821 | inline bool operator < (const FiberData &other) const { |
| 822 | const double rel_tol = 1.0e-5; |
| 823 | double tol = std::max(std::abs(y), std::abs(other.y))*rel_tol; |
| 824 | if (utils::misc::lessThanWithTol(y, other.y, tol)) return true; |
| 825 | if (utils::misc::greaterThanWithTol(y, other.y, tol)) return false; |
| 826 | tol = std::max(std::abs(z), std::abs(other.z))*rel_tol; |
| 827 | if (utils::misc::lessThanWithTol(z, other.z, tol)) return true; |
| 828 | if (utils::misc::greaterThanWithTol(z, other.z, tol)) return false; |
| 829 | tol = std::max(std::abs(a), std::abs(other.a))*rel_tol; |
| 830 | if (utils::misc::lessThanWithTol(a, other.a, tol)) return true; |
| 831 | if (utils::misc::greaterThanWithTol(a, other.a, tol)) return false; |
| 832 | return false; // equal |
| 833 | } |
| 834 | inline bool operator > (const FiberData &other) const { |
| 835 | const double rel_tol = 1.0e-5; |
| 836 | double tol = std::max(std::abs(y), std::abs(other.y))*rel_tol; |
| 837 | if (utils::misc::greaterThanWithTol(y, other.y, tol)) return true; |
| 838 | if (utils::misc::lessThanWithTol(y, other.y, tol)) return false; |
| 839 | tol = std::max(std::abs(z), std::abs(other.z))*rel_tol; |
| 840 | if (utils::misc::greaterThanWithTol(z, other.z, tol)) return true; |
| 841 | if (utils::misc::lessThanWithTol(z, other.z, tol)) return false; |
| 842 | tol = std::max(std::abs(a), std::abs(other.a))*rel_tol; |
| 843 | if (utils::misc::greaterThanWithTol(a, other.a, tol)) return true; |
| 844 | if (utils::misc::lessThanWithTol(a, other.a, tol)) return false; |
| 845 | return false; // equal |
| 846 | } |
| 847 | inline const double *data()const { return &y; } |
| 848 | double y; |
| 849 | double z; |
| 850 | double a; |
| 851 | }; |
| 852 | |
| 853 | typedef std::vector<FiberData> FiberDataCollection; |
| 854 | |