示例#1
0
int main( int argc, char* argv[] )
{
	clock_t		t0 = StartTiming();

/* ------------------ */
/* Parse command line */
/* ------------------ */

	gArgs.SetCmdLine( argc, argv );

	TS.SetLogFile( flog );

	if( !ReadScriptParams( scr, gArgs.script, flog ) )
		goto exit;

	inv_scl = 1.0 / scr.crossscale;

/* ---------------- */
/* Read source data */
/* ---------------- */

	if( gArgs.zb >= 0 && gArgs.za < 0 )
		gArgs.za = gArgs.zb;

	TS.FillFromRgns( gArgs.srcmons, gArgs.idb, gArgs.zb, gArgs.za );

	fprintf( flog, "Got %d images.\n", (int)TS.vtil.size() );

	if( !TS.vtil.size() )
		goto exit;

	TS.SetTileDimsFromImageFile();
	TS.GetTileDims( gW, gH );

	t0 = StopTiming( flog, "ReadFile", t0 );

/* ------------- */
/* Sort by layer */
/* ------------- */

	TS.SortAll_z();

/* ----- */
/* Stuff */
/* ----- */

	ScapeStuff();

/* ---- */
/* Done */
/* ---- */

exit:
	fprintf( flog, "\n" );
	VMStats( flog );
	fclose( flog );

	return 0;
}
示例#2
0
int main( int argc, char **argv )
{
	clock_t	t0 = StartTiming();

/* ---------- */
/* Parameters */
/* ---------- */

	MPIInit( argc, argv );

	if( !gArgs.SetCmdLine( argc, argv ) ||
		!gArgs.GetRanges() ) {

		MPIExit();
		exit( 42 );
	}

/* ------------ */
/* Initial data */
/* ------------ */

	if( !LayerCat( vL, gArgs.tempdir, gArgs.cachedir,
			gArgs.zolo, gArgs.zohi, false ) ) {

		MPIExit();
		exit( 42 );
	}

	InitTables( gArgs.zilo, gArgs.zihi );

	{
		CLoadPoints	*LP = new CLoadPoints;
		LP->Load( gArgs.tempdir, gArgs.cachedir );
		delete LP;
	}

/* ----- */
/* Solve */
/* ----- */

	printf( "\n---- Solve ----\n" );

	SetSolveParams( gArgs.regtype, gArgs.Wr, gArgs.Etol );

	XArray	Xevn, Xodd;

	if( !strcmp( gArgs.mode, "A2A" ) ) {

		Xevn.Load( gArgs.prior );

		if( gArgs.untwist )
			UntwistAffines( Xevn );

		Xodd.Resize( 6 );
		Solve( Xevn, Xodd, gArgs.iters );
	}
	else if( !strcmp( gArgs.mode, "A2H" ) ) {

		Xevn.Resize( 8 );

		{	// limit A lifetime
			XArray	*A = new XArray;
			A->Load( gArgs.prior );

			if( gArgs.untwist )
				UntwistAffines( *A );

			Solve( *A, Xevn, 1 );
			delete A;
		}

		Xodd.Resize( 8 );
		Solve( Xevn, Xodd, gArgs.iters );
	}
	else if( !strcmp( gArgs.mode, "H2H" ) ) {

		Xevn.Load( gArgs.prior );
		Xodd.Resize( 8 );
		Solve( Xevn, Xodd, gArgs.iters );
	}
	else if( !strcmp( gArgs.mode, "eval" ) ) {

		Xevn.Load( gArgs.prior );

		if( gArgs.untwist )
			UntwistAffines( Xevn );

		gArgs.iters = 0;
	}
	else {	// split

		Xevn.Load( gArgs.prior );
		gArgs.iters = 0;
	}

	const XArray& Xfinal = ((gArgs.iters & 1) ? Xodd : Xevn);

/* ----------- */
/* Postprocess */
/* ----------- */

	if( gArgs.mode[0] == 's' ) {

		Split	S( Xfinal, gArgs.splitmin );

		S.Run();
	}
	else {

		Evaluate( Xfinal );

		if( gArgs.mode[0] != 'e' )
			Xfinal.Save();
	}

/* ------- */
/* Cleanup */
/* ------- */

	if( !wkid ) {
		printf( "\n" );
		StopTiming( stdout, "Lsq", t0 );
	}

	MPIExit();
	VMStats( stdout );

	return 0;
}