//==== Init Is Called Once During Each Custom Geom Construction  ============================//
//==== Avoid Global Variables Unless You Want Shared With All Custom Geoms of This Type =====//
void Init()
{
	//==== Add Parm Types  =====//
	string diameter = AddParm( PARM_DOUBLE_TYPE, "Diameter", "Design" );
	SetParmValLimits( diameter, 10.0, 0.0, 1.0e12 );
	SetParmDescript( diameter, "Diameter of Cone" );

	//==== Add Cross Sections  =====//
	string xsec_surf = AddXSecSurf();
	AppendCustomXSec( xsec_surf, XS_POINT);
	AppendCustomXSec( xsec_surf, XS_CIRCLE);

	//==== Add A Default Point Source At Nose ====//
	SetupCustomDefaultSource( POINT_SOURCE, 0, 0.1, 1.0, 1.0, 1.0 );
}

//==== InitGui Is Called Once During Each Custom Geom Construction ====//
void InitGui()
{
	AddGui( GDEV_TAB, "Design"  );
	AddGui( GDEV_YGAP );
	AddGui( GDEV_DIVIDER_BOX, "Design" );
	AddGui( GDEV_SLIDER_ADJ_RANGE_INPUT, "Diameter", "Diameter", "Design"  );
}

//==== UpdateGui Is Called Every Time The Gui is Updated ====//
void UpdateGui()
{
}

//==== UpdateSurf Is Called Every Time The Geom is Updated ====//
void UpdateSurf()
{
	string geom_id = GetCurrCustomGeom();

	//==== Set Base XSec Diameter ====//
	string dia_parm = GetParm( geom_id, "Diameter", "Design" );
	double dia_val  = GetParmVal( dia_parm );

	//==== Get The XSecs To Change ====//
	string xsec_surf = GetXSecSurf( geom_id, 0 );
	string xsec1 = GetXSec( xsec_surf, 1 );

	//==== Set The Diameter ====//
	string xsec1_dia = GetXSecParm( xsec1, "Circle_Diameter" );
	SetParmVal( xsec1_dia, dia_val );

	SetVspSurfType( DISK_SURF, -1 );
	SetVspSurfCfdType( CFD_TRANSPARENT, -1 );
	SkinXSecSurf();
}

//==== Optional Scale =====//
void Scale(double curr_scale )
{
	string geom_id = GetCurrCustomGeom();

	string dia_id   = GetParm( geom_id, "Diameter", "Design" );

	double dia = curr_scale * GetParmVal( dia_id );

	SetParmVal( dia_id, dia );
}
