# Name / Description
string name = "CylinderZ";
string description = "Cylinder along Z-Axis";

# Number of partitions
int nPartitions = 2;

# A partition may contain options set through a function called partitionOptions()...
global double x = 0.5, y = 0.5, r = 0.2;
int partitionOptions()
{
	Dialog ui = createDialog("CylinderX Scheme Options");
	ui.verticalFill = TRUE;
	ui.addDoubleSpin("x", "X", 0.0, 1.0, 0.1, x);
	ui.addDoubleSpin("y", "Y", 0.0, 1.0, 0.1, y);
	ui.addDoubleSpin("r", "R", 0.001, 1.0, 0.1, r);
	if (ui.show())
	{
		x = ui.asDouble("x");
		y = ui.asDouble("y");
		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) + (py-y)*(py-y)) <= (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";
	}
}
