//+
SetFactory("OpenCASCADE");

Mesh.CharacteristicLengthMin = 0.001;
Mesh.CharacteristicLengthMax = 2.0;

Mesh.CharacteristicLengthExtendFromBoundary = 1;

Mesh.Algorithm = 6;
Mesh.Smoothing = 3;
Mesh.Algorithm3D = 1;

Box(1) = {0, -0.5, -0.5, 1, 1, 1};
Box(2) = {-1, -0.5, -0.5, 1, 1, 1};
Sphere(3) = {0.5, 0.0, 0.0, 0.3, -Pi/2, Pi/2, 2*Pi};

Coherence;

surfs_box1() = Unique(Abs(Boundary{ Volume{4}; } ));
lines_box1() = Unique(Abs(Boundary{ Surface{surfs_box1()}; } ));
pts_box1() = Unique(Abs(Boundary{ Line{lines_box1()}; } ));

surfs_sphere() = Unique(Abs(Boundary{ Volume{3}; } ));
lines_sphere() = Unique(Abs(Boundary{ Surface{surfs_sphere()}; } ));
pts_sphere() = Unique(Abs(Boundary{ Line{lines_sphere()}; } ));

surfs_box2() = Unique(Abs(Boundary{ Volume{2}; } ));
lines_box2() = Unique(Abs(Boundary{ Surface{surfs_box2()}; } ));
pts_box2() = Unique(Abs(Boundary{ Line{lines_box2()}; } ));

// sorted from largest to smallest:
Characteristic Length{pts_box2()} = 0.5;
Characteristic Length{pts_sphere()} = 0.2;
Characteristic Length{pts_box1()} = 0.1;

