/*
	Test I/O.
*/

setgridsize(50, 25, 1)
setcellsize(1e-9, 1e-9, 1e-9)
setgeom(circle(50e-9))
m = uniform(1,1,1)

msat  = 800e3
aex   = 13e-12
alpha = 1
b_ext = vector(.01, 0, 0)
anisU = vector(1, 0, 0)
Ku1   = 500e3

tableadd(e_total)
tableadd(e_zeeman)
tableadd(e_demag)
tableadd(e_exch)
tableadd(e_anis)
tableadd(maxtorque)

tableadd(b_ext)
tableadd(msat)
tableadd(aex)
tableadd(alpha)

tableadd(B_demag)
tableadd(B_anis)
tableadd(torque)

tableadd(b_ext.region(0))
tableadd(msat.region(0))
tableadd(aex.region(0))
tableadd(alpha.region(0))
tableadd(b_eff.region(0))
tableadd(b_demag.region(0))
tableadd(torque.region(0))
tableadd(m.region(0))

print(m)
print(B_demag)
print(B_exch)
print(B_anis)
print(regions)
print(alpha)
print(anisU)

print(b_ext.region(0))
print(msat.region(0))
print(aex.region(0))
print(alpha.region(0))
print(b_eff.region(0))
print(b_demag.region(0))
print(torque.region(0))
print(m.region(0))

b_ext.setregion(1, vector(0, 0, 0))
alpha.setregion(1, 1)

saveas(m, "m")
saveas(B_demag, "B_demag")
saveas(B_exch, "B_exch")
saveas(B_anis, "B_anis")
saveas(regions, "regions")
saveas(alpha, "alpha")
saveas(anisU, "anisU")

save(m)
save(B_demag)
save(B_exch)
save(B_anis)
save(regions)
save(alpha)
save(anisU)

save(B_demag.region(0))
save(B_exch.region(0))
save(B_anis.region(0))
save(alpha.region(0))
save(anisU.region(0))

save(m)
save(B_demag)
save(B_exch)
save(B_anis)
save(regions)
save(alpha)
save(anisU)

tableautosave(.0001e-12)
steps(10)

