# MIF 2.1
# MIF Example File: sample-reflect.mif
# Description: Example use of the Oxs_ScriptOrientScalarField and
#   Oxs_ImageScalarField classes.

set pi [expr {4*atan(1.0)}]
set mu0 [expr {4*$pi*1e-7}]

Specify Oxs_BoxAtlas:atlas {
  xrange {0 275e-9}
  yrange {0 335e-9}
  zrange {0 20e-9}
}

Specify Oxs_RectangularMesh:mesh {
  cellsize {5e-9 5e-9 5e-9}
  atlas :atlas
}

Specify Oxs_UniformExchange:NiFe {
  A  13e-12
}

Specify Oxs_UZeeman [subst {
  multiplier [expr {0.001/$mu0}]
  Hrange {
     {     0  0  0   1000  0  0   10 }
     {  1000  0  0  -1000  0  0   20 }
     { -1000  0  0   1000  0  0   20 }
  }
}]

Specify Oxs_Demag {}

Specify Oxs_RungeKuttaEvolve:evolver {}

Specify Oxs_ImageScalarField:luigimag {
   image luigi.gif
   multiplier 8e5
   offset 0
   viewplane xy
   atlas :atlas
   exterior error
}

# Support proc to refelect image.  Include translation
# in x direction so that both the original field (as
# expressed by :luigimag) and the export field have the
# same ranges, and can therefore be specified using the
# same atlas (i.e., :atlas).
proc Reflect { x y z xmin ymin zmin xmax ymax zmax} {
   return [list [expr {($xmax+$xmin-$x)}] $y $z]
}

Specify Oxs_ScriptOrientScalarField:reflect {
   field :luigimag
   script Reflect
   script_args {rawpt minpt maxpt}
   atlas :atlas
}

# Bring in common attributes for Oxs_TimeDriver block
eval [ReadFile sample-attributes.tcl]

Specify Oxs_TimeDriver {
 basename sample-reflect
 Ms :reflect
 attributes :common_driver_data
}
