Mandel.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef MANDEL_MANDEL_H
  2. #define MANDEL_MANDEL_H
  3. #include <vector>
  4. #include <map>
  5. #include <string>
  6. #include <memory>
  7. #include "MandelUtil.h"
  8. #include "Generators.h"
  9. #include "CpuGenerators.h"
  10. #include "Hardware.h"
  11. //#include "Fixedp.h"
  12. namespace mnd
  13. {
  14. enum class GeneratorType;
  15. class MandelContext;
  16. class MandelDevice;
  17. extern MandelContext initializeContext(void);
  18. }
  19. enum class mnd::GeneratorType
  20. {
  21. FLOAT,
  22. FLOAT_SSE2,
  23. FLOAT_AVX,
  24. FLOAT_AVX512,
  25. FLOAT_NEON,
  26. DOUBLE,
  27. DOUBLE_SSE2,
  28. DOUBLE_AVX,
  29. DOUBLE_AVX512,
  30. DOUBLE_NEON,
  31. DOUBLE_DOUBLE,
  32. QUAD_DOUBLE,
  33. FLOAT128,
  34. FLOAT256
  35. };
  36. class mnd::MandelDevice
  37. {
  38. private:
  39. friend class MandelContext;
  40. std::string vendor;
  41. std::string name;
  42. std::map<GeneratorType, std::unique_ptr<Generator>> generators;
  43. MandelDevice(void);
  44. public:
  45. inline const std::string& getVendor(void) const { return vendor; }
  46. inline const std::string& getName(void) const { return name; }
  47. Generator* getGenerator(GeneratorType type) const;
  48. //Generator* getGeneratorQuad(bool smooth = true) const;
  49. //Generator* getGenerator128(bool smooth = true) const;
  50. };
  51. class mnd::MandelContext
  52. {
  53. private:
  54. friend MandelContext mnd::initializeContext(void);
  55. CpuInfo cpuInfo;
  56. std::map<GeneratorType, std::unique_ptr<Generator>> cpuGenerators;
  57. std::unique_ptr<AdaptiveGenerator> adaptiveGenerator;
  58. std::vector<MandelDevice> devices;
  59. MandelContext(void);
  60. std::unique_ptr<AdaptiveGenerator> createAdaptiveGenerator(void);
  61. std::vector<MandelDevice> createDevices(void);
  62. public:
  63. Generator& getDefaultGenerator(bool smooth = true);
  64. const std::vector<MandelDevice>& getDevices(void);
  65. Generator* getCpuGenerator(mnd::GeneratorType type);
  66. const CpuInfo& getCpuInfo(void) const { return cpuInfo; }
  67. };
  68. #endif // MANDEL_MANDEL_H