# Name / Description
string name = "CylinderY";
string description = "Cylinder along Y-Axis";

# Number of partitions
int nPartitions = 2;

# A partition may contain options set through a function called partitionOptions()...
global double x = 0.5, z = 0.5, r = 0.1;
int partitionOptions()
{
	Dialog ui = createDialog("CylinderX Scheme Options");
	ui.verticalFill = TRUE;
	ui.addDoubleSpin("x", "X", 0.0, 1.0, 0.1, x);
	ui.addDoubleSpin("z", "Z", 0.0, 1.0, 0.1, z);
	ui.addDoubleSpin("r", "R", 0.001, 1.0, 0.1, r);
	if (ui.show())
	{
		x = ui.asDouble("x");
		z = ui.asDouble("z");
		r = ui.asDouble("r");
		return TRUE;
	}
	else return FALSE;
}

# Every partition definition *must* contain 'partition' and 'partitionName' functions
int partition(double px, double py, double pz)
{
	// Check 1 - Is the point inside the defined cylinder (region 1)
	if (((px-x)*(px-x) + (pz-z)*(pz-z)) <= (r*r)) return 1;

	// Not inside any defined regions, so return '0' for 'inside rest of cell'
	return 0;
}

string partitionName(int id)
{
	switch(id)
	{
		case (0):
			return "Unit Cell";
		case (1):
			return "Cylinder";
		default:
			return "UNKNOWN";
	}
}
