// A little script to combine 3 scalar views into a single vector view
// (with no reinterpolation, hence the temporary creation of the 3
// vector views, instead of just using Plugin(ModifyComponent) on a
// vector view, with external scalar views--we should probably make
// the plugin more intelligent instead...)

// merge the 3 scalar views
Merge "view1.pos";
Merge "view2.pos";
Merge "view3.pos";

// create three vector views with all components set to the values of the 
// scalar views
Plugin(MathEval).Expression0 = "v0";
Plugin(MathEval).Expression1 = "v0";
Plugin(MathEval).Expression2 = "v0";
Plugin(MathEval).View = 0;
Plugin(MathEval).Run;
Plugin(MathEval).View = 1;
Plugin(MathEval).Run;
Plugin(MathEval).View = 2;
Plugin(MathEval).Run;

// remove the scalar views
Delete View[0]; Delete View[0]; Delete View[0];

// set the last two components of the first vector view to
// the components of the other two
Plugin(ModifyComponent).Expression = "w0";
Plugin(ModifyComponent).View = 0;
Plugin(ModifyComponent).OtherView = 1;
Plugin(ModifyComponent).Component = 1;
Plugin(ModifyComponent).Run;
Plugin(ModifyComponent).OtherView = 2;
Plugin(ModifyComponent).Component = 2;
Plugin(ModifyComponent).Run;

// remove the extra vector views
Delete View[2]; Delete View[1];
