Exemplo n.º 1
0
        static ILayer Create_Layer(Dictionary<string, object> data)
        {
            // get various necessary properties from this list
            Material mat = Layer_Tool.GetMaterial((string)data["mat"]);
            Geometry_Type geom_type;
            if (data.ContainsKey("geom")) { geom_type = GetGeometryType((string)data["geom"]); } else geom_type = Geometry_Type.slab;

            // set geometry
            IGeom geom;
            switch (geom_type)
            {
                case Geometry_Type.slab:
                    geom = new Slab((double)data["zmin"], (double)data["zmax"]);
                    break;

                case Geometry_Type.sheet:
                    geom = new Sheet((double)data["zmin"]);
                    break;

                case Geometry_Type.strip:
                    geom = new Strip((double)data["zmin"], (double)data["zmax"], (double)data["dx"], (double)data["dy"], (double)data["width"], (double)data["theta"]);
                    break;

                case Geometry_Type.half_slab:
                    geom = new Half_Slab((double)data["zmin"], (double)data["zmax"], (double)data["dx"], (double)data["dy"], (double)data["theta"]);
                    break;

                case Geometry_Type.half_strip:
                    geom = new Half_Strip((double)data["zmin"], (double)data["zmax"], (double)data["dx"], (double)data["dy"], (double)data["width"], (double)data["theta"]);
                    break;

                case Geometry_Type.triangle_slab:
                    geom = new Triangle_Slab((double)data["zmin"], (double)data["zmax"], (double)data["x0"], (double)data["y0"], (double)data["theta1"], (double)data["theta2"]);
                    break;

                default:
                    throw new NotImplementedException("Error - Unknown geometry");
            }

            // create layer
            ILayer result;

            switch (mat)
            {
                case Material.GaAs:
                    result = new GaAs_Layer(geom, (int)data["layer_no"]);
                    break;

                case Material.AlGaAs:
                    result = new AlGaAs_Layer(geom, (int)data["layer_no"], (double)data["x"]);
                    break;

                case Material.InGaAs:
                    result = new InGaAs_Layer(geom, (int)data["layer_no"], (double)data["x"]);
                    break;

                case Material.InAlAs:
                    result = new InAlAs_Layer(geom, (int)data["layer_no"], (double)data["x"]);
                    break;

                case Material.PMMA:
                    result = new PMMA_Layer(geom, (int)data["layer_no"]);
                    break;

                case Material.Al2O3:
                    result = new Al2O3_Layer(geom, (int)data["layer_no"]);
                    break;

                case Material.Metal:
                    result = new Metal_Layer(geom, (int)data["layer_no"]);
                    break;

                case Material.Air:
                    result = new Air_Layer(geom, (int)data["layer_no"]);
                    break;

                // substrate always comes from -infty
                case Material.Substrate:
                    result = new Substrate_Layer(new Slab(-1.0 * double.MaxValue, (double)data["zmax"]), (int)data["layer_no"]);
                    break;

                default:
                    throw new NotImplementedException("Error - Unknown material");
            }

            // if this is actually a composite layer, then rewrite result... (this is simpler than putting a "Composite" material for the switch above)
            if (data.ContainsKey("composite"))
                if ((bool)data["composite"])
                    result = Create_Composite_Layer(result, data, geom);

            // and set dopent levels if necessary
            if (data.ContainsKey("nd") || data.ContainsKey("na"))
            {
                if (!data.ContainsKey("nd"))
                    data.Add("nd", 0.0);
                if (!data.ContainsKey("na"))
                    data.Add("na", 0.0);

                // use a factor of 10^-21 to convert from cm^-3 to nm^-3
                data["na"] = 1.0e-21 * (double)data["na"];
                data["nd"] = 1.0e-21 * (double)data["nd"];

                result.Set_Dopents((double)data["na"], (double)data["nd"]);
            }

            return result;
        }
Exemplo n.º 2
0
        static ILayer Create_Layer(Dictionary <string, object> data)
        {
            // get various necessary properties from this list
            Material      mat = Layer_Tool.GetMaterial((string)data["mat"]);
            Geometry_Type geom_type;

            if (data.ContainsKey("geom"))
            {
                geom_type = GetGeometryType((string)data["geom"]);
            }
            else
            {
                geom_type = Geometry_Type.slab;
            }

            // set geometry
            IGeom geom;

            switch (geom_type)
            {
            case Geometry_Type.slab:
                geom = new Slab((double)data["zmin"], (double)data["zmax"]);
                break;

            case Geometry_Type.sheet:
                geom = new Sheet((double)data["zmin"]);
                break;

            case Geometry_Type.strip:
                geom = new Strip((double)data["zmin"], (double)data["zmax"], (double)data["dx"], (double)data["dy"], (double)data["width"], (double)data["theta"]);
                break;

            case Geometry_Type.half_slab:
                geom = new Half_Slab((double)data["zmin"], (double)data["zmax"], (double)data["dx"], (double)data["dy"], (double)data["theta"]);
                break;

            case Geometry_Type.half_strip:
                geom = new Half_Strip((double)data["zmin"], (double)data["zmax"], (double)data["dx"], (double)data["dy"], (double)data["width"], (double)data["theta"]);
                break;

            case Geometry_Type.triangle_slab:
                geom = new Triangle_Slab((double)data["zmin"], (double)data["zmax"], (double)data["x0"], (double)data["y0"], (double)data["theta1"], (double)data["theta2"]);
                break;

            default:
                throw new NotImplementedException("Error - Unknown geometry");
            }

            // create layer
            ILayer result;

            switch (mat)
            {
            case Material.GaAs:
                result = new GaAs_Layer(geom, (int)data["layer_no"]);
                break;

            case Material.AlGaAs:
                result = new AlGaAs_Layer(geom, (int)data["layer_no"], (double)data["x"]);
                break;

            case Material.InGaAs:
                result = new InGaAs_Layer(geom, (int)data["layer_no"], (double)data["x"]);
                break;

            case Material.InAlAs:
                result = new InAlAs_Layer(geom, (int)data["layer_no"], (double)data["x"]);
                break;

            case Material.PMMA:
                result = new PMMA_Layer(geom, (int)data["layer_no"]);
                break;

            case Material.Al2O3:
                result = new Al2O3_Layer(geom, (int)data["layer_no"]);
                break;

            case Material.Metal:
                result = new Metal_Layer(geom, (int)data["layer_no"]);
                break;

            case Material.Air:
                result = new Air_Layer(geom, (int)data["layer_no"]);
                break;

            // substrate always comes from -infty
            case Material.Substrate:
                result = new Substrate_Layer(new Slab(-1.0 * double.MaxValue, (double)data["zmax"]), (int)data["layer_no"]);
                break;

            default:
                throw new NotImplementedException("Error - Unknown material");
            }

            // if this is actually a composite layer, then rewrite result... (this is simpler than putting a "Composite" material for the switch above)
            if (data.ContainsKey("composite"))
            {
                if ((bool)data["composite"])
                {
                    result = Create_Composite_Layer(result, data, geom);
                }
            }

            // and set dopent levels if necessary
            if (data.ContainsKey("nd") || data.ContainsKey("na"))
            {
                if (!data.ContainsKey("nd"))
                {
                    data.Add("nd", 0.0);
                }
                if (!data.ContainsKey("na"))
                {
                    data.Add("na", 0.0);
                }

                // use a factor of 10^-21 to convert from cm^-3 to nm^-3
                data["na"] = 1.0e-21 * (double)data["na"];
                data["nd"] = 1.0e-21 * (double)data["nd"];

                result.Set_Dopents((double)data["na"], (double)data["nd"]);
            }

            return(result);
        }