4 #include "util/common.hpp"
6 #include "Operators/Vector/vector_dist_operators.hpp"
7 #include "OdeIntegrators/OdeIntegrators.hpp"
16 std::cout <<
"Work " << t << std::endl;
17 dxdt.data.get<0>() = x.data.get<0>();
21 int main(
int argc,
char* argv[])
23 openfpm_init(&argc,&argv);
24 size_t edgeSemiSize =
int(std::atof(argv[1]));
25 double tf = std::atof(argv[2]);
26 const size_t sz[2] = {edgeSemiSize,edgeSemiSize };
28 size_t bc[2] = { NON_PERIODIC, NON_PERIODIC };
30 spacing[0] = 1.0 / (sz[0] - 1);
31 spacing[1] = 1.0 / (sz[1] - 1);
32 double rCut = 3.9 * spacing[0];
37 auto it = Particles.getGridIterator(sz);
42 mem_id k0 = key.get(0);
43 double xp0 = k0 * spacing[0];
44 Particles.getLastPos()[0] = xp0;
45 mem_id k1 = key.get(1);
46 double yp0 = k1 * spacing[1];
47 Particles.getLastPos()[1] = yp0;
48 Particles.getLastProp<0>() = xp0*yp0*exp(-5);
49 Particles.getLastProp<1>() = xp0*yp0*exp(5);
54 Particles.ghost_get<0>();
55 Particles.hostToDeviceProp<0,1,2>();
56 auto Init = getV<0,comp_dev>(Particles);
57 auto Sol = getV<1,comp_dev>(Particles);
58 auto OdeSol = getV<2,comp_dev>(Particles);
61 x0.data.get<0>()=Init;
62 x0.data.get<0>().getVector().deviceToHost<0>();
70 size_t steps=boost::numeric::odeint::integrate_const( boost::numeric::odeint::runge_kutta4< state_type, double, state_type, double, boost::numeric::odeint::vector_space_algebra_ofp_gpu,boost::numeric::odeint::ofp_operations>(),ExponentialGPU,x0,t0,tf,dt);
72 OdeSol=x0.data.get<0>();
73 Particles.deviceToHostProp<0,1,2>();
74 auto it2 = Particles.getDomainIterator();
76 while (it2.isNext()) {
78 if (fabs(Particles.getProp<1>(p) - Particles.getProp<2>(p)) > worst) {
79 worst = fabs(Particles.getProp<1>(p) - Particles.getProp<2>(p));
83 std::cout<<
"WCT:"<<tt.
getwct()<<std::endl;
85 std::cout<<worst<<std::endl;
This class represent an N-dimensional box.
Class for cpu time benchmarking.
void stop()
Stop the timer.
double getcputime()
Return the cpu time.
void start()
Start the timer.
double getwct()
Return the elapsed real time.
Main class that encapsulate a vector properties operand to be used for expressions construction.
KeyT const ValueT ValueT OffsetIteratorT OffsetIteratorT int
[in] The number of segments that comprise the sorting data