IterationGenerator.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef MANDEL_ITERATIONGENERATOR_H
  2. #define MANDEL_ITERATIONGENERATOR_H
  3. #include "Generators.h"
  4. #include "ClGenerators.h"
  5. #include "IterationFormula.h"
  6. #include <utility>
  7. #include <complex>
  8. namespace mnd
  9. {
  10. class IterationGenerator;
  11. class NaiveGenerator;
  12. class CompiledGenerator;
  13. class CompiledClGenerator;
  14. // forward declaration
  15. struct ExecData;
  16. class MandelDevice;
  17. }
  18. class mnd::IterationGenerator : public mnd::MandelGenerator
  19. {
  20. protected:
  21. IterationFormula z0;
  22. IterationFormula zi;
  23. public:
  24. IterationGenerator(IterationFormula z0, IterationFormula zi, const mnd::Real& prec);
  25. };
  26. class mnd::NaiveGenerator : public mnd::IterationGenerator
  27. {
  28. public:
  29. NaiveGenerator(IterationFormula z0, IterationFormula zi, const mnd::Real& prec);
  30. NaiveGenerator(NaiveGenerator&&) = default;
  31. virtual void generate(const MandelInfo& info, float* data);
  32. private:
  33. std::complex<double> iterate(std::complex<double> z, std::complex<double> c);
  34. std::complex<double> calc(mnd::Expression& expr, std::complex<double> z, std::complex<double> c);
  35. };
  36. #if defined(__x86_64__) || defined(_M_X64)
  37. class mnd::CompiledGenerator : public mnd::MandelGenerator
  38. {
  39. std::unique_ptr<ExecData> execData;
  40. public:
  41. CompiledGenerator(std::unique_ptr<ExecData> execData);
  42. CompiledGenerator(CompiledGenerator&&);
  43. virtual ~CompiledGenerator(void);
  44. virtual void generate(const MandelInfo& info, float* data);
  45. std::string dump(void) const;
  46. };
  47. #endif
  48. #ifdef WITH_OPENCL
  49. class mnd::CompiledClGenerator : public mnd::ClGeneratorFloat
  50. {
  51. public:
  52. CompiledClGenerator(const MandelDevice& device, const std::string& code);
  53. CompiledClGenerator(CompiledClGenerator&&) = default;
  54. //virtual ~CompiledGenerator(void);
  55. //virtual void generate(const MandelInfo& info, float* data);
  56. virtual std::string getKernelCode(bool smooth) const override;
  57. virtual void generate(const MandelInfo& info, float* data);
  58. //std::string dump(void) const;
  59. };
  60. #endif // WITH_OPENCL
  61. #endif // MANDEL_ITERATIONGENERATOR_H