(* QckBldUp.m ----------------------------------------------------------- *)

(* Generates the standard form of all posets of a specified size, given all 
	standard posets of one size smaller. *)

(* Utils Needed: AntiChnsIdls[], WriteLstOfLst[]. *)
(* Function Needed: StdFormIso[]. *)
(* Data Needed: stdpsts* for * = n-1. *)

(* User must specify the directory and size of posets to be generated. *)

(* Change directory: *)
SetDirectory["G:/.isis/home/c/a/cagann/public_html/Posets"];

(* Change the size, n, of posets: *)    pstsiz = 1;

<< GenrlUtils.m;    << PosetUtils.m;    << InvExIsoFncts.m;

stmem = MaxMemoryUsed[]; sttim = AbsoluteTime[]; stcpu = TimeUsed[];

(* Extend standard posets of length pstsiz-1 to form posets of the desired 
	size. *)
Which[
	pstsiz \[Equal] 1,
	augmentatns = {{{}}},
	pstsiz > 1,
	augmentatns = Sort[Flatten[
		Map[Function[x,
			Map[ Append[x,#]&, AntiChnsIdls[x][[1]] ]
		], ReadList[StringJoin["StdPsts/stdpsts",ToString[pstsiz-1]]] ]       
	,1]]
];

(* Find standard forms of the extended posets and write them to a file. *)
WriteLstOfLst[
	StringJoin["StdPsts/stdpsts",ToString[pstsiz]],
	Union[ Map[StdFormIso[#][[1]]&,augmentatns] ]
];		

emem = MaxMemoryUsed[]; etim = AbsoluteTime[]; ecpu = TimeUsed[];
PrntCnsmptn[stmem,emem,sttim,etim,stcpu,ecpu];

(* End of QckBldUp.m. *)