/*
sample1.c

OpenTHFDデータ作成ライブラリ、サンプルプログラム No.1

コンパイル+実行:
Windows + VC++:
> cl.exe /O2 sample1.c oth_datalib.c
> sample1.exe
Linux + gcc:
$ gcc -O sample1.c oth_datalib.c -o sample1
$ ./sample1
*/

#include "oth_datalib.h"

int main(void)
{
	// initialize

	oth_init();

	// title

	oth_title("sample1");

	// mesh

	oth_xsection(2, -75e-3, +75e-3);
	oth_xdivision(1, 30);

	oth_ysection(2, -75e-3, +75e-3);
	oth_ydivision(1, 30);

	oth_zsection(4, -72.5e-3, -22.5e-3, +22.5e-3, +72.5e-3);
	oth_zdivision(3, 10, 9, 10);

	// material

	oth_material(2.0, 0.0, 1.0, 0.0);

	// geometry

	oth_geometry(1, 1, 0e-3, 0e-3, 0e-3, 0e-3, -22.5e-3, +22.5e-3);
	oth_geometry_name("dipole");

	// source

	oth_feed('Z', 0e-3, 0e-3, 0e-3, 1, 0, 50);

	// ABC

	//oth_pml(5, 2, 1e-5);

	// frequency

	oth_frequency(2e9, 3e9, 5);

	// solver

	oth_solver(2000, 100, 1e-4);

	// iteration

	oth_plotiter(1, 1);

	// frequency

	oth_plotsmith();
	oth_plotyin(1, 0, 0, 0);
	oth_plotzin(1, 0, 0, 0);
	oth_plotref(1, 0, 0, 0);
	//oth_plotfar0d(90, 0, 1, 0, 0, 0);
	//oth_freqdiv(10);

	// far-1d

	oth_plotfar1d('X', 72, 0);

	// far-2d

	oth_plotfar2d(18, 36);

	// near-1d

	oth_plotnear1d("E", 'Z', 30e-3, 0e-3);

	// near-2d

	oth_plotnear2d("E", 'X', 30e-3);

	// output options

	//oth_far1dstyle(1);
	//oth_far1dcomponent(1, 0, 0);
	//oth_far1ddb(1);
	//oth_far1dscale(-30, +10, 4);
	//oth_far2dcomponent(1, 0, 0, 0, 0, 0,0);
	//oth_far2ddb(1);
	//oth_far2dscale(-30, +10);
	//oth_far2dobj(0.5);
	//oth_near1ddb(1);
	//oth_near1dscale(-30, +10, 4);
	//oth_near1dexclude();
	//oth_near2ddb(1);
	//oth_near2dscale(-30, +10);
	//oth_near2ddim(1, 1);
	//oth_near2dcontour(0);
	//oth_near2dobj(1);
	//oth_near2dexclude();
	oth_near2dzoom(-50e-3, 50e-3, -50e-3, 50e-3);
	//oth_window2d(750, 500, 15, 0);
	//oth_window3d(600, 600, 12, 60, 30);

	// output

	oth_outdata("sample1.oth");

	return 0;
}
