Ejemplo n.º 1
0
        public Scientrace.ComplexBorderedVolume parsXBorderedVolume(XElement xBorVol)
        {
            // Replaced with below: Scientrace.MaterialProperties materialprops = this.getXMaterial(xBorVol.Element("Material"));
            Scientrace.MaterialProperties materialprops = this.getXMaterialForObject(xBorVol);
            if (xBorVol.Name.ToString() != "BorderedVolume")
            {
                throw new XMLException("BorderedVolume does not match its name: " + xBorVol.Name.ToString());
            }

            List <List <Scientrace.PlaneBorder> > nestedBorders = new List <List <Scientrace.PlaneBorder> >();

            foreach (XElement xSubVolume in xBorVol.Elements("SubVolume"))
            {
                List <Scientrace.PlaneBorder> tBorderList = new List <Scientrace.PlaneBorder>();
                foreach (XElement xBorder in xSubVolume.Elements("Plane"))
                {
                    if (xBorder.Element("Loc1") == null)               // No LocSet? Defined by location and AllowedNormal
                    {
                        Scientrace.Location      borderLoc      = this.X.getXLocation(xBorder, "Location");
                        Scientrace.NonzeroVector borderAllowDir = this.X.getXNzVectorByName(xBorder, "AllowedNormal");
                        tBorderList.Add(new Scientrace.PlaneBorder(borderLoc, borderAllowDir));
                    }
                    else                          // LocSet defined with 3 locations and an included-location to define the direction.
                    {
                        Scientrace.Location loc1       = this.X.getXLocation(xBorder, "Loc1");
                        Scientrace.Location loc2       = this.X.getXLocation(xBorder, "Loc2");
                        Scientrace.Location loc3       = this.X.getXLocation(xBorder, "Loc3");
                        Scientrace.Location includeLoc = this.X.getXLocation(xBorder, "IncludeLoc");
                        tBorderList.Add(Scientrace.PlaneBorder.createBetween3LocationsPointingTo(loc1, loc2, loc3, includeLoc));
                    }
                }
                nestedBorders.Add(tBorderList);
            }
            Scientrace.ComplexBorderedVolume tRetBoxVol = new Scientrace.ComplexBorderedVolume(this.parentcollection, materialprops, nestedBorders);
            return(tRetBoxVol);
        }
Ejemplo n.º 2
0
        public Scientrace.ComplexBorderedVolume parsXBorderedVolume(XElement xBorVol)
        {
            // Replaced with below: Scientrace.MaterialProperties materialprops = this.getXMaterial(xBorVol.Element("Material"));
            Scientrace.MaterialProperties materialprops = this.getXMaterialForObject(xBorVol);
            if (xBorVol.Name.ToString() != "BorderedVolume") {
            throw new XMLException("BorderedVolume does not match its name: "+xBorVol.Name.ToString());
            }

            List<List<Scientrace.PlaneBorder>> nestedBorders = new List<List<Scientrace.PlaneBorder>>();
            foreach (XElement xSubVolume in xBorVol.Elements("SubVolume")) {
            List<Scientrace.PlaneBorder> tBorderList = new List<Scientrace.PlaneBorder>();
            foreach (XElement xBorder in xSubVolume.Elements("Plane")) {
                if (xBorder.Element("Loc1") == null) { // No LocSet? Defined by location and AllowedNormal
                    Scientrace.Location borderLoc = this.X.getXLocation(xBorder, "Location");
                    Scientrace.NonzeroVector borderAllowDir = this.X.getXNzVectorByName(xBorder, "AllowedNormal");
                    tBorderList.Add(new Scientrace.PlaneBorder(borderLoc, borderAllowDir));
                    } else {  // LocSet defined with 3 locations and an included-location to define the direction.
                    Scientrace.Location loc1 = this.X.getXLocation(xBorder, "Loc1");
                    Scientrace.Location loc2 = this.X.getXLocation(xBorder, "Loc2");
                    Scientrace.Location loc3 = this.X.getXLocation(xBorder, "Loc3");
                    Scientrace.Location includeLoc = this.X.getXLocation(xBorder, "IncludeLoc");
                    tBorderList.Add(Scientrace.PlaneBorder.createBetween3LocationsPointingTo(loc1, loc2, loc3, includeLoc));
                    }
                }
            nestedBorders.Add(tBorderList);
            }
            Scientrace.ComplexBorderedVolume tRetBoxVol = new Scientrace.ComplexBorderedVolume(this.parentcollection, materialprops, nestedBorders);
            return tRetBoxVol;
        }