File : polymervol.adb


with Ada.Text_IO, Messages, Ints, Reps, Lin;
use Ada.Text_IO, Messages, Ints, Reps, Lin;
with Lattice, Lattice.Ops, Lattice.IO;
use Lattice, Lattice.Ops, Lattice.IO;
with Lass;

procedure PolymerVol is         -- compute polymer volume, argument: somename.pol

  N1: constant Positive := 15;  -- lattice patch depth:  -N1 .. N1
  N2: constant Positive := 15;  -- lattice patch width:  -N2 .. N1
  N3: constant Positive := 10;  -- lattice patch height: -N3 .. N3

  OK: Boolean;
  LP: Positive;
  Mov: Blob(8);
  B: PolyPtr;
  A: RMatPtr;

  FileName: String := GetArg(1);

begin
  Verbose := 2;
  SetDim(N1,N2,N3);
  Read(FileName,B,LP);
  InitPatch(N1,N2,N3,LP);
  SetMovable(B,Mov,OK);
  if not OK then
    Message("PolymerVol",Data_Problem);
  end if;

  A := Constraints(Mov);
  FreePatch;

  declare
    NumVar: constant Positive := 3*Mov.L;
    NumEqu: constant Positive :=   Mov.M;

    package Lasserre is new Lass(NumEqu => NumEqu, NumVar => NumVar);
    use Lasserre;

  begin
    MinDoTrans :=    5;    -- min dimension for translations
    MinVolSave :=    4;    -- min dimension for considering saved volume
    MaxVolSave :=   99;    -- max dimension for using saved volume
    MinVolConv :=    4;    -- min dimension for converting saved volume

    Show("Dimension:  ",NumVar);
    Show("Halfspaces: ",NumEqu);
    Show("MinDoTrans  ",MinDoTrans);
    Show("MinVolSave  ",MinVolSave);
    Show("MaxVolSave  ",MaxVolSave);
    Show("MinVolConv  ",MinVolConv);
    Vol(A,B.R);
    StorageInfo;
  end;

  Show(B);
  AdaWrite(MyImg(B) & ".ada",B);

end PolymerVol;