diff --git a/src/maxwell_solver.cpp b/src/maxwell_solver.cpp index aee2197fbfc8f0e985ac98199b8c36f5fb58ae57..60887a56de3783fc1e78895bca943132613e6934 100644 --- a/src/maxwell_solver.cpp +++ b/src/maxwell_solver.cpp @@ -9,6 +9,8 @@ #include <omp.h> #endif +#include <fstream> + #include "gmsh.h" #include "silo_output.hpp" #include "maxwell_interface.h" @@ -115,6 +117,21 @@ public: } }; +double +integrate(const model& mod, const maxwell::solver_state& state, line_integrator& lint) +{ + return lint.integrate(mod, state.emf_curr.Ex); +} + +double +integrate(const model& mod, const maxwell::solver_state_gpu& state, line_integrator& lint) +{ + maxwell::field f; + f.resize( mod.num_dofs() ); + state.emf_curr.copyout(f); + return lint.integrate(mod, f.Ex); +} + template<typename State> void test_it(const model& mod, State& state, maxwell::parameter_loader& mpl) { @@ -139,6 +156,8 @@ void test_it(const model& mod, State& state, maxwell::parameter_loader& mpl) point_3d end(46e-9, 0.0, 38e-9); line_integrator lint(start, end, 50); + std::ofstream ofs("voltage.dat"); + timecounter tc; tc.tic(); prepare_sources(mod, state, mpl); @@ -160,7 +179,7 @@ void test_it(const model& mod, State& state, maxwell::parameter_loader& mpl) std::cout << "Cycle " << i << ": t = " << state.curr_time << " s"; std::cout << ", DOFs/s: " << (mod.num_dofs()*6*cycle_print_rate)/(time) << std::endl; tc.tic(); - std::cout << "Voltage = " << lint.integrate(mod, state.emf_curr.Ex) << std::endl; + ofs << state.curr_time << " " << integrate(mod, state, lint) << std::endl; } } }