Loading graph_driver/xrays.cpp +8 −7 Original line number Diff line number Diff line Loading @@ -30,8 +30,8 @@ static base solution(const base t) { /// @param[in] argv Array of commandline arguments. //------------------------------------------------------------------------------ int main(int argc, const char * argv[]) { //typedef std::complex<double> base; typedef double base; typedef std::complex<double> base; //typedef double base; //typedef float base; //typedef std::complex<float> base; typedef backend::cpu<base> cpu; Loading @@ -39,8 +39,8 @@ int main(int argc, const char * argv[]) { const std::chrono::high_resolution_clock::time_point start = std::chrono::high_resolution_clock::now(); const size_t num_times = 10000; const size_t num_rays = 1; //const size_t num_rays = 10000; //const size_t num_rays = 1; const size_t num_rays = 10000; std::vector<std::thread> threads(std::max(std::min(std::thread::hardware_concurrency(), static_cast<unsigned int> (num_rays)), Loading Loading @@ -79,12 +79,13 @@ int main(int argc, const char * argv[]) { ky->set(backend::base_cast<cpu> (0.0)); kz->set(backend::base_cast<cpu> (0.0)); //auto eq = equilibrium::make_slab_density<cpu> (); auto eq = equilibrium::make_no_magnetic_field<cpu> (); auto eq = equilibrium::make_slab_density<cpu> (); //auto eq = equilibrium::make_no_magnetic_field<cpu> (); solver::split_simplextic<dispersion::bohm_gross<cpu>> //solver::split_simplextic<dispersion::bohm_gross<cpu>> //solver::rk4<dispersion::bohm_gross<cpu>> //solver::rk4<dispersion::simple<cpu>> solver::rk4<dispersion::ordinary_wave<cpu>> //solver::rk4<dispersion::cold_plasma<cpu>> solve(omega, kx, ky, kz, x, y, z, t, 30.0/num_times, eq); solve.init(kx); Loading graph_framework.xcodeproj/project.xcworkspace/xcuserdata/m4c.xcuserdatad/UserInterfaceState.xcuserstate −47 B (168 KiB) File changed.No diff preview for this file type. View original file View changed file graph_framework/arithmetic.hpp +26 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,22 @@ namespace graph { auto lm = multiply_cast(this->left); auto rm = multiply_cast(this->right); // Assume constants are on the left. // v1 + -c*v2 -> v1 - c*v2 // -c*v1 + v2 -> v2 - c*v1 auto none = constant<typename LN::backend> (-1); if (rm.get()) { auto rmc = constant_cast(rm->get_left()); if (rmc.get() && rmc->evaluate().is_negative()) { return this->left - none*rm->get_left()*rm->get_right(); } } else if (lm.get()) { auto lmc = constant_cast(lm->get_left()); if (lmc.get() && lmc->evaluate().is_negative()) { return this->right - none*lm->get_left()*lm->get_right(); } } if (lm.get() && rm.get()) { if (lm->get_left()->is_match(rm->get_left())) { return lm->get_left()*(lm->get_right() + rm->get_right()); Loading Loading @@ -340,6 +356,16 @@ namespace graph { auto lm = multiply_cast(this->left); auto rm = multiply_cast(this->right); // Assume constants are on the left. // v1 - -c*v2 -> v1 + c*v2 auto none = constant<typename LN::backend> (-1); if (rm.get()) { auto rmc = constant_cast(rm->get_left()); if (rmc.get() && rmc->evaluate().is_negative()) { return this->left + none*rm->get_left()*rm->get_right(); } } if (lm.get() && rm.get()) { if (lm->get_left()->is_match(rm->get_left())) { return lm->get_left()*(lm->get_right() - rm->get_right()); Loading graph_framework/backend_protocall.hpp +7 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,13 @@ namespace backend { //------------------------------------------------------------------------------ virtual bool is_zero() const = 0; //------------------------------------------------------------------------------ /// @brief Is every element negative. /// /// @returns Returns true if every element is negative. //------------------------------------------------------------------------------ virtual bool is_negative() const = 0; //------------------------------------------------------------------------------ /// @brief Take sqrt. //------------------------------------------------------------------------------ Loading graph_framework/cpu_backend.hpp +15 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,21 @@ namespace backend { return true; } //------------------------------------------------------------------------------ /// @brief Is every element negative. /// /// @returns Returns true if every element is negative. //------------------------------------------------------------------------------ virtual bool is_negative() const final { for (BASE d : data) { if (std::real(d) > std::real(static_cast<BASE> (0.0))) { return false; } } return true; } //------------------------------------------------------------------------------ /// @brief Take sqrt. //------------------------------------------------------------------------------ Loading Loading
graph_driver/xrays.cpp +8 −7 Original line number Diff line number Diff line Loading @@ -30,8 +30,8 @@ static base solution(const base t) { /// @param[in] argv Array of commandline arguments. //------------------------------------------------------------------------------ int main(int argc, const char * argv[]) { //typedef std::complex<double> base; typedef double base; typedef std::complex<double> base; //typedef double base; //typedef float base; //typedef std::complex<float> base; typedef backend::cpu<base> cpu; Loading @@ -39,8 +39,8 @@ int main(int argc, const char * argv[]) { const std::chrono::high_resolution_clock::time_point start = std::chrono::high_resolution_clock::now(); const size_t num_times = 10000; const size_t num_rays = 1; //const size_t num_rays = 10000; //const size_t num_rays = 1; const size_t num_rays = 10000; std::vector<std::thread> threads(std::max(std::min(std::thread::hardware_concurrency(), static_cast<unsigned int> (num_rays)), Loading Loading @@ -79,12 +79,13 @@ int main(int argc, const char * argv[]) { ky->set(backend::base_cast<cpu> (0.0)); kz->set(backend::base_cast<cpu> (0.0)); //auto eq = equilibrium::make_slab_density<cpu> (); auto eq = equilibrium::make_no_magnetic_field<cpu> (); auto eq = equilibrium::make_slab_density<cpu> (); //auto eq = equilibrium::make_no_magnetic_field<cpu> (); solver::split_simplextic<dispersion::bohm_gross<cpu>> //solver::split_simplextic<dispersion::bohm_gross<cpu>> //solver::rk4<dispersion::bohm_gross<cpu>> //solver::rk4<dispersion::simple<cpu>> solver::rk4<dispersion::ordinary_wave<cpu>> //solver::rk4<dispersion::cold_plasma<cpu>> solve(omega, kx, ky, kz, x, y, z, t, 30.0/num_times, eq); solve.init(kx); Loading
graph_framework.xcodeproj/project.xcworkspace/xcuserdata/m4c.xcuserdatad/UserInterfaceState.xcuserstate −47 B (168 KiB) File changed.No diff preview for this file type. View original file View changed file
graph_framework/arithmetic.hpp +26 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,22 @@ namespace graph { auto lm = multiply_cast(this->left); auto rm = multiply_cast(this->right); // Assume constants are on the left. // v1 + -c*v2 -> v1 - c*v2 // -c*v1 + v2 -> v2 - c*v1 auto none = constant<typename LN::backend> (-1); if (rm.get()) { auto rmc = constant_cast(rm->get_left()); if (rmc.get() && rmc->evaluate().is_negative()) { return this->left - none*rm->get_left()*rm->get_right(); } } else if (lm.get()) { auto lmc = constant_cast(lm->get_left()); if (lmc.get() && lmc->evaluate().is_negative()) { return this->right - none*lm->get_left()*lm->get_right(); } } if (lm.get() && rm.get()) { if (lm->get_left()->is_match(rm->get_left())) { return lm->get_left()*(lm->get_right() + rm->get_right()); Loading Loading @@ -340,6 +356,16 @@ namespace graph { auto lm = multiply_cast(this->left); auto rm = multiply_cast(this->right); // Assume constants are on the left. // v1 - -c*v2 -> v1 + c*v2 auto none = constant<typename LN::backend> (-1); if (rm.get()) { auto rmc = constant_cast(rm->get_left()); if (rmc.get() && rmc->evaluate().is_negative()) { return this->left + none*rm->get_left()*rm->get_right(); } } if (lm.get() && rm.get()) { if (lm->get_left()->is_match(rm->get_left())) { return lm->get_left()*(lm->get_right() - rm->get_right()); Loading
graph_framework/backend_protocall.hpp +7 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,13 @@ namespace backend { //------------------------------------------------------------------------------ virtual bool is_zero() const = 0; //------------------------------------------------------------------------------ /// @brief Is every element negative. /// /// @returns Returns true if every element is negative. //------------------------------------------------------------------------------ virtual bool is_negative() const = 0; //------------------------------------------------------------------------------ /// @brief Take sqrt. //------------------------------------------------------------------------------ Loading
graph_framework/cpu_backend.hpp +15 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,21 @@ namespace backend { return true; } //------------------------------------------------------------------------------ /// @brief Is every element negative. /// /// @returns Returns true if every element is negative. //------------------------------------------------------------------------------ virtual bool is_negative() const final { for (BASE d : data) { if (std::real(d) > std::real(static_cast<BASE> (0.0))) { return false; } } return true; } //------------------------------------------------------------------------------ /// @brief Take sqrt. //------------------------------------------------------------------------------ Loading