// Gmsh project created on Mon Jun 25 18:58:22 2018
SetFactory("OpenCASCADE");

//Inputs
x_cube = 2;
y_cube = 2;
z_cube = 2;
r_curv = 0.4;

x_dom = 10;
y_dom = 10;
z_dom = 10;

//Position cube in domain (centred)

x0 = (x_dom-x_cube)/2;
y0 = (y_dom-y_cube)/2;
z0 = (z_dom-z_cube)/2;

//Outer cube (domain)
Box(1) = {0, 0, 0, x_dom, y_dom, z_dom};
//Delete { Volume{1}; }

//Inner cube
Box(2) = {x0, y0, z0, x_cube, y_cube, z_cube};
Fillet{2}{13,14,15,16,17,18,19,20}{r_curv}
Delete { Volume{2}; }

//Connect inner and outer cube

Line(41) = {22, 5};
Line(42) = {18, 5};
Line(43) = {14, 1};
Line(44) = {10, 1};
Line(45) = {12, 3};
Line(46) = {16, 3};
Line(47) = {20, 7};
Line(48) = {24, 7};
Line(49) = {21, 6};
Line(50) = {17, 6};
Line(51) = {13, 2};
Line(52) = {9, 2};
Line(53) = {11, 4};
Line(54) = {15, 4};
Line(55) = {19, 8};
Line(56) = {23, 8};

//From here, the surfaces are not defined correctly

Line Loop(21) = {46, 12, -47, -30}; Plane Surface(21) = {21};
Line Loop(22) = {47, -48, 39};Plane Surface(22) = {22};
Line Loop(23) = {48, -6, -41, 38};Plane Surface(23) = {23};
Line Loop(24) = {41, -42, -35};Plane Surface(24) = {24};
Line Loop(25) = {42, -10, -43, 27};Plane Surface(25) = {25};
Line Loop(26) = {43, -44, 19};Plane Surface(26) = {26};
Line Loop(27) = {44, 2, -45, -15};Plane Surface(27) = {27};
Line Loop(28) = {45, -46, -23};Plane Surface(28) = {28};

Line Loop(29) = {54, 11, -55, -28};Plane Surface(29) = {29};
Line Loop(30) = {54, -53, 21};Plane Surface(30) = {30};
Line Loop(31) = {53, -4, -52, 14};Plane Surface(31) = {31};
Line Loop(32) = {52, -51, -17};Plane Surface(32) = {32};
Line Loop(33) = {51, 9, -50, -25};Plane Surface(33) = {33};
Line Loop(34) = {50, -49, 33};Plane Surface(34) = {34};
Line Loop(35) = {49, 8, -56, -36};Plane Surface(35) = {35};
Line Loop(36) = {56, -55, -37};Plane Surface(36) = {36};

//Cannot use the command Surface Loop to connect the volumes
 
//Surface Loop(3) = {18, 14, 10, 20, 16, 17, 13, 15, 19, 11, 9, 8, 12, 7};
