Generators.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #ifndef MANDEL_GENERATORS_H
  2. #define MANDEL_GENERATORS_H
  3. #include "MandelUtil.h"
  4. #include <vector>
  5. #include <map>
  6. #include <utility>
  7. namespace mnd
  8. {
  9. class Generator;
  10. class AdaptiveGenerator;
  11. enum class Precision : int
  12. {
  13. FLOAT,
  14. DOUBLE,
  15. DOUBLE_DOUBLE,
  16. FLOAT128,
  17. QUAD_DOUBLE,
  18. FLOAT256,
  19. INF_PREC,
  20. };
  21. Real getPrecision(Precision p);
  22. }
  23. class mnd::Generator
  24. {
  25. public:
  26. Generator(void) = default;
  27. virtual ~Generator(void);
  28. Generator(const Generator&) = delete;
  29. Generator& operator=(const Generator&) = delete;
  30. Generator(Generator&&) = default;
  31. Generator& operator=(Generator&&) = default;
  32. virtual void generate(const MandelInfo& info, float* data) = 0;
  33. };
  34. class mnd::AdaptiveGenerator : public Generator
  35. {
  36. std::map<Real, Generator*, std::greater<Real>> generators;
  37. public:
  38. AdaptiveGenerator(void) = default;
  39. AdaptiveGenerator(Generator* floatGen, Generator* doubleGen);
  40. virtual ~AdaptiveGenerator(void) = default;
  41. void addGenerator(const Real& precision, Generator& generator);
  42. void addGenerator(Precision p, Generator& generator);
  43. virtual void generate(const MandelInfo& info, float* data);
  44. };
  45. #endif // MANDEL_GENERATORS_H