/* ---------------------------------------
   Some conventions used:
    - Point indices are elements of [1, 99]
    - Line indices are elements of [100, 999]
    - Surface indices are elements of [1000, 9999]
   --------------------------------------- */

/* ---------------------------------------
   Shared naming information
   --------------------------------------- */
Include "SharedNames.geo";

/* ---------------------------------------
   Variable definitions
   --------------------------------------- */
cml = 0.0025;       //characteristic mesh length
a = 0.1;           //major axis
b = 0.07;          //minor axis
e = Sqrt(a^2-b^2); //focal distance from center

/* ---------------------------------------
   Elliptical mirror
   --------------------------------------- */
Point(1) = { 0,  0, 0, cml}; //origin
Point(2) = { a,  0, 0, cml}; //boundary points of the major axis
Point(3) = {-a,  0, 0, cml};
Point(4) = { 0,  b, 0, cml}; //boundary points of the minor axis
Point(5) = { 0, -b, 0, cml};
Point(6) = { e,  0, 0, cml}; //1st focus / source
Point(7) = {-e,  0, 0, cml}; //2nd focus

Ellipse(101) = {2, 1, 6, 4}; //ellipse segments
Ellipse(102) = {4, 1, 6, 3};
Ellipse(103) = {5, 1, 6, 3};
Ellipse(104) = {2, 1, 6, 5};

Line(105) = {3,7};
Line(106) = {7,6};
Line(107) = {6,2};

Line Loop(100) = {101, 102, 105, 106, 107}; //complete ellipse
Line Loop(101) = {104, 103, 105, 106, 107}; 

Physical Line(200) = {105,106,107};
Physical Line(BOUNDARY) = {101, 102, 103, 104};

Plane Surface(1000) = {100}; //inside the mirror
Physical Surface(INNER1) = {1000};

Plane Surface(1001) = {101}; 
Physical Surface(INNER2) = {1001};

/* ---------------------------------------
   Sources
   --------------------------------------- */
Physical Point(SOURCE) = {6};
