/// <summary>
        /// Create a new ComputationalDomain object and set default values
        /// </summary>
        public GEMSComputationalDomain(GEMSProject parent)
        {
            this.parent = parent;

            minVector3 = new Vector3WithUnit(0.0f, parent.Environment.DefaultLengthUnit);
            maxVector3 = new Vector3WithUnit(0.0f, parent.Environment.DefaultLengthUnit);
        }
Exemple #2
0
        /// <summary>
        /// Open a existed project with specified file name
        /// </summary>
        private void OpenExistedProject()
        {
            SaveCurrentProject();

            // Displays an OpenFileDialog so the user can select a gpj file.
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Filter      = "OpenGEMS Project(*.gpj)|*.gpj";
            openFileDialog1.Multiselect = false;
            openFileDialog1.Title       = "Select an OpenGEMS Project File";

            // Show the Dialog.
            // If the user clicked OK in the dialog and
            // a .GPJ file was selected, open it.
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                //Create new project
                m_project = new GEMSProject();

                BindProjectWithWiews();

                //Load the project information from selected file
                m_project.Load(openFileDialog1.FileName);

                this.Text = "OpenGEMS Designer - " + m_project.CurrentFileName;
                //Update the RecentFile MenuItem
                // this.UpdateRecentFilesMenuItem(openFileDialog1.FileName);
            }
        }
Exemple #3
0
        public GEMSMaterial(XPathNavigator navigator, GEMSProject parent)
        {
            detail = navigator.GetAttribute("detail", string.Empty);
            id     = int.Parse(navigator.GetAttribute("id", string.Empty));
            name   = navigator.GetAttribute("name", string.Empty);

            navigator.MoveToChild("Epsilon", string.Empty);
            epsilonX = float.Parse(navigator.GetAttribute("x", string.Empty));
            navigator.MoveToParent();

            navigator.MoveToChild("Sigma", string.Empty);
            sigmaX = float.Parse(navigator.GetAttribute("x", string.Empty));
            navigator.MoveToParent();

            navigator.MoveToChild("Mu", string.Empty);
            muX = float.Parse(navigator.GetAttribute("x", string.Empty));
            navigator.MoveToParent();

            navigator.MoveToChild("Musigma", string.Empty);
            musigmaX = float.Parse(navigator.GetAttribute("x", string.Empty));
            navigator.MoveToParent();

            this.m_project     = parent;
            this.usedSignalIds = new List <int>();
        }
Exemple #4
0
        /// <summary>
        /// Create a new excitation object with default values
        /// </summary>
        public GEMSExcitationSource(GEMSProject parent)
        {
            this.parent = parent;

            this.sourcePluseType = PluseType.Gaussian;
            this.lossness        = 0;
            this.maxFrequency    = new Frequency(1, Frequency.FrequencyUnit.GHz);
        }
 public GEMSHuygensBox(GEMSProject parent)
 {
     this.parent    = parent;
     referencePoint = new Vector3WithUnit(0.0f, parent.Environment.DefaultLengthUnit);
     phis.Add(0);
     phis.Add(90);
     thetas.Add(90);
 }
Exemple #6
0
        private void OpenRecentProject()
        {
            SaveCurrentProject();

            //Create new project
            m_project = new GEMSProject();

            BindProjectWithWiews();
        }
Exemple #7
0
        /// <summary>
        /// Construct of material
        /// </summary>
        public GEMSMaterial(int id, GEMSProject parent)
        {
            if (id != -1)   //Create a available material
            {
                this.id            = id;
                this.usedSignalIds = new List <int>();
            }

            this.m_project = parent;
        }
Exemple #8
0
        public PreCalculateForm(GEMSProject m_project)
        {
            InitializeComponent();

            this.m_project = m_project;
            this.m_project.PreCalculateGoOn += new GEMSProject.PreCalculateGoOnEventHandler(OnPreCalculateGoOn);

            normalFont = new Font(displayFontFamily, 10, FontStyle.Regular, GraphicsUnit.Point);
            blodFont   = new Font(displayFontFamily, 10, FontStyle.Bold, GraphicsUnit.Point);
        }
        public HuygenBoxForm(GEMSProject m_project)
        {
            InitializeComponent();

            this.m_project = m_project;
            this.box       = m_project.HuygensBox.Clone();

            this.dgvFrequencyList.CellFormatting += new DataGridViewCellFormattingEventHandler(OnCellFormatting);
            this.dgvFrequencyList.RowPostPaint   += new DataGridViewRowPostPaintEventHandler(this.OnRowPostPaint);
            this.dgvFrequencyList.CellValidating += new DataGridViewCellValidatingEventHandler(OnCellValidating);
        }
Exemple #10
0
        public void Initialize(GEMSProject project, SceneMode mode)
        {
            Reset( );

            //Data source
            m_project              = project;
            m_project.DataChanged += new GEMSProject.DataChangedEventHandler(OnGEMSProjectDataChanged);

            currentMode = mode;

            //Create the renders
            Initialize( );
        }
Exemple #11
0
        /// <summary>
        /// Create a new project
        /// </summary>
        private void CreateNewProject()
        {
            SaveCurrentProject();

            //Create new project
            m_project = new GEMSProject();

            BindProjectWithWiews();

            //Load the project information from selected file
            m_project.Initialize();

            this.Text = "OpenGEMS Designer - " + m_project.CurrentFileName;
        }
Exemple #12
0
        public GEMSMesh(XPathNavigator navigator, GEMSProject parent)
        {
            this.parent = parent;

            //Read the key points in three axises
            ReadKeyPointsInOneAxis(Axis.X, navigator, keyPointsInX);
            ReadKeyPointsInOneAxis(Axis.Y, navigator, keyPointsInY);
            ReadKeyPointsInOneAxis(Axis.Z, navigator, keyPointsInZ);

            //Read the mesh points in three axises
            ReadMeshPointsInOneAxis(Axis.X, navigator, meshPointsInX);
            ReadMeshPointsInOneAxis(Axis.Y, navigator, meshPointsInY);
            ReadMeshPointsInOneAxis(Axis.Z, navigator, meshPointsInZ);

            MinAndMaxMeshSizeInOneAxis(meshPointsInX, ref minMeshCell.X, ref maxMeshCell.X);
            MinAndMaxMeshSizeInOneAxis(meshPointsInY, ref minMeshCell.Y, ref maxMeshCell.Y);
            MinAndMaxMeshSizeInOneAxis(meshPointsInZ, ref minMeshCell.Z, ref maxMeshCell.Z);
        }
Exemple #13
0
        /// <summary>
        /// Create a new excitation object and load the information from the specified file
        /// </summary>
        /// <param name="navigator"></param>
        /// <returns></returns>
        public GEMSExcitationSource(XPathNavigator navigator, GEMSProject parent)
        {
            this.parent = parent;

            navigator.MoveToChild("Pulse", "");
            sourcePluseType = (PluseType)Enum.Parse(typeof(PluseType), navigator.GetAttribute("kind", ""));

            if (sourcePluseType != PluseType.None)
            {
                navigator.MoveToFirstChild();
                lossness = int.Parse(navigator.GetAttribute("lossness", ""));
                navigator.MoveToParent();
            }
            navigator.MoveToParent();

            navigator.MoveToChild("Max", "");
            MaxFrequency = new Frequency(navigator.GetAttribute("value", ""), navigator.GetAttribute("unit", ""));
            navigator.MoveToParent();
        }
Exemple #14
0
        public GEMSSingle(XPathNavigator navigator, GEMSProject parent)
        {
            this.parent = parent;

            //Basic information
            id   = int.Parse(navigator.GetAttribute("id", string.Empty));
            name = navigator.GetAttribute("name", string.Empty);
            float transparency = float.Parse(navigator.GetAttribute("transparent", string.Empty));

            pec = navigator.GetAttribute("pec", string.Empty) == "0" ? false:true;

            //Material
            int materialId = int.Parse(navigator.GetAttribute("material", string.Empty));

            //Find the material in the material list of the project
            material = parent.SearchMaterial(materialId);
            if (material != null)
            {
                material.UsedSignalIds.Add(this.id);
            }

            //Color of the geometry belongs to this single
            navigator.MoveToChild("Color", string.Empty);
            int blue  = int.Parse(navigator.GetAttribute("blue", string.Empty));
            int red   = int.Parse(navigator.GetAttribute("red", string.Empty));
            int green = int.Parse(navigator.GetAttribute("green", string.Empty));

            singleColor = Color.FromArgb(GetModelMaterialTransparency(transparency), red, green, blue);
            navigator.MoveToParent( );

            //Operations
            LoadOperations(navigator);

            //Information of excitation or output
            currentEO = SingleEO.Load(navigator, this);

            UpdatePrimaryModel( );
            UpdateSingleEOSymbolModel( );
        }
        /// <summary>
        /// Create a new ComputationalDomain object and load the information from the specified file
        /// </summary>
        /// <param name="navigator"></param>
        /// <returns></returns>
        public GEMSComputationalDomain(XPathNavigator navigator, GEMSProject parent)
        {
            this.parent = parent;

            minVector3 = new Vector3WithUnit();
            maxVector3 = new Vector3WithUnit();

            navigator.MoveToChild("X0", string.Empty);
            minVector3.X  = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty));
            conditionXmin = (BoundaryCondition)Enum.Parse(typeof(BoundaryCondition), navigator.GetAttribute("condition", string.Empty));
            navigator.MoveToParent();

            navigator.MoveToChild("X1", string.Empty);
            maxVector3.X  = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty));
            conditionXmax = (BoundaryCondition)Enum.Parse(typeof(BoundaryCondition), navigator.GetAttribute("condition", string.Empty));
            navigator.MoveToParent();

            navigator.MoveToChild("Y0", string.Empty);
            minVector3.Y  = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty));
            conditionYmin = (BoundaryCondition)Enum.Parse(typeof(BoundaryCondition), navigator.GetAttribute("condition", string.Empty));
            navigator.MoveToParent();

            navigator.MoveToChild("Y1", string.Empty);
            maxVector3.Y  = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty));
            conditionYmax = (BoundaryCondition)Enum.Parse(typeof(BoundaryCondition), navigator.GetAttribute("condition", string.Empty));
            navigator.MoveToParent();

            navigator.MoveToChild("Z0", string.Empty);
            minVector3.Z  = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty));
            conditionZmin = (BoundaryCondition)Enum.Parse(typeof(BoundaryCondition), navigator.GetAttribute("condition", string.Empty));
            navigator.MoveToParent();

            navigator.MoveToChild("Z1", string.Empty);
            maxVector3.Z  = new Length(navigator.GetAttribute("value", string.Empty), navigator.GetAttribute("unit", string.Empty));
            conditionZmax = (BoundaryCondition)Enum.Parse(typeof(BoundaryCondition), navigator.GetAttribute("condition", string.Empty));
            navigator.MoveToParent();
        }
Exemple #16
0
 public GEMSMesh(GEMSProject parent)
 {
     this.parent = parent;
 }
Exemple #17
0
 public GEMSSingle(int id, GEMSProject parent)
 {
     this.id     = id;
     this.parent = parent;
 }
Exemple #18
0
        public GEMSParallel(XPathNavigator navigator, GEMSProject parent)
        {
            this.parent = parent;

            //Read the division information
            navigator.MoveToChild("Division", string.Empty);
            ReadDivisionInfoInOneAxis(Axis.X, divisionInX, navigator);
            ReadDivisionInfoInOneAxis(Axis.Y, divisionInY, navigator);
            ReadDivisionInfoInOneAxis(Axis.Z, divisionInZ, navigator);
            navigator.MoveToParent();

            //Read the area information

            /*navigator.MoveToChild("Areas", string.Empty);
             * XPathNodeIterator nodes = navigator.SelectChildren("Area", string.Empty);
             * while (nodes.MoveNext())
             * {
             *  XPathNavigator areaNavigator = nodes.Current.Clone();
             *  GEMSParallelArea area = new GEMSParallelArea(areaNavigator);
             *  areaList.Add(area);
             *
             *  int areaMeshCount = (area.End.X - area.Start.X)
             * (area.End.Y - area.Start.Y)
             * (area.End.Z - area.Start.Z);
             *
             *  if (minAreaMeshCount < 0)
             *      minAreaMeshCount = areaMeshCount;
             *  else
             *      minAreaMeshCount = minAreaMeshCount < areaMeshCount ? minAreaMeshCount : areaMeshCount;
             *
             *  if (maxAreaMeshCount < 0)
             *      maxAreaMeshCount = areaMeshCount;
             *  else
             *      maxAreaMeshCount = maxAreaMeshCount > areaMeshCount ? maxAreaMeshCount : areaMeshCount;
             *
             * }
             * navigator.MoveToParent();*/

            //Create area list based the division information
            UpdateAreaList( );

            if (divisionInX.Count > 0)
            {
                meshCountInX = divisionInX[divisionInX.Count - 1];
            }
            else
            {
                meshCountInX = parent.Mesh.MeshCountInX;
            }

            if (divisionInY.Count > 0)
            {
                meshCountInY = divisionInY[divisionInY.Count - 1];
            }
            else
            {
                meshCountInY = parent.Mesh.MeshCountInY;
            }

            if (divisionInZ.Count > 0)
            {
                meshCountInZ = divisionInZ[divisionInZ.Count - 1];
            }
            else
            {
                meshCountInZ = parent.Mesh.MeshCountInZ;
            }
        }
Exemple #19
0
 public GEMSParallel(GEMSProject parent)
 {
     this.parent        = parent;
     this.startPecPoint = MeshPointKey.Key(-1, -1, -1);
     this.endPecPoint   = MeshPointKey.Key(-1, -1, -1);
 }
Exemple #20
0
        public ParallelInfoForm(GEMSProject project)
        {
            InitializeComponent( );

            m_project = project;
        }
        public GEMSHuygensBox(XPathNavigator navigator, GEMSProject parent)
        {
            this.parent = parent;

            isEnable = (int.Parse(navigator.GetAttribute("enabled", string.Empty)) == 1);
            isMcOnly = (int.Parse(navigator.GetAttribute("mconly", string.Empty)) == 1);

            navigator.MoveToChild("Geometry", string.Empty);
            minX = int.Parse(navigator.GetAttribute("minx", string.Empty));
            minY = int.Parse(navigator.GetAttribute("miny", string.Empty));
            minZ = int.Parse(navigator.GetAttribute("minz", string.Empty));
            maxX = int.Parse(navigator.GetAttribute("maxx", string.Empty));
            maxY = int.Parse(navigator.GetAttribute("maxy", string.Empty));
            maxZ = int.Parse(navigator.GetAttribute("maxz", string.Empty));
            navigator.MoveToParent();

            navigator.MoveToChild("RefPoint", string.Empty);
            referencePoint   = new Vector3WithUnit();
            referencePoint.X = new Length(navigator.GetAttribute("x", string.Empty), navigator.GetAttribute("ux", string.Empty));
            referencePoint.Y = new Length(navigator.GetAttribute("y", string.Empty), navigator.GetAttribute("uy", string.Empty));
            referencePoint.Z = new Length(navigator.GetAttribute("z", string.Empty), navigator.GetAttribute("uz", string.Empty));
            navigator.MoveToParent();

            //Frequency list
            navigator.MoveToChild("FrequencyList", string.Empty);
            frequencyUnit = (Frequency.FrequencyUnit)Enum.Parse(typeof(Frequency.FrequencyUnit), navigator.GetAttribute("unit", string.Empty));
            XPathNodeIterator nodes = navigator.SelectChildren("Frequency", string.Empty);

            while (nodes.MoveNext())
            {
                frequencys.Add(float.Parse(nodes.Current.GetAttribute("value", string.Empty)));
            }
            navigator.MoveToParent();

            navigator.MoveToChild("TwoD", string.Empty);
            //Phi plane
            navigator.MoveToChild("PhiPlane", string.Empty);
            isPhiEnable = (int.Parse(navigator.GetAttribute("enabled", string.Empty)) == 1);
            nodes       = navigator.SelectChildren("Phi", string.Empty);
            phis.Clear();
            while (nodes.MoveNext())
            {
                phis.Add(float.Parse(nodes.Current.GetAttribute("value", string.Empty)));
            }
            navigator.MoveToChild("Theta", string.Empty);
            thetaStart = float.Parse(navigator.GetAttribute("from", string.Empty));
            thetaStep  = float.Parse(navigator.GetAttribute("step", string.Empty));
            thetaEnd   = float.Parse(navigator.GetAttribute("to", string.Empty));
            navigator.MoveToParent();
            navigator.MoveToParent();

            //Theta plane
            navigator.MoveToChild("ThetaPlane", string.Empty);
            isThetaEnable = (int.Parse(navigator.GetAttribute("enabled", string.Empty)) == 1);
            nodes         = navigator.SelectChildren("Theta", string.Empty);
            thetas.Clear();
            while (nodes.MoveNext())
            {
                thetas.Add(float.Parse(nodes.Current.GetAttribute("value", string.Empty)));
            }
            navigator.MoveToChild("Phi", string.Empty);
            phiStart = float.Parse(navigator.GetAttribute("from", string.Empty));
            phiStep  = float.Parse(navigator.GetAttribute("step", string.Empty));
            phiEnd   = float.Parse(navigator.GetAttribute("to", string.Empty));
            navigator.MoveToParent();
            navigator.MoveToParent();

            navigator.MoveToParent();

            navigator.MoveToChild("ApertureField", string.Empty);
            apertureField = byte.Parse(navigator.GetAttribute("value", string.Empty));
            navigator.MoveToParent();
        }