def ParseXMLNode(self, orebodyDataNode): """ Generate Ore body data from xml tree node. """ self.type = GetAttributeString(orebodyDataNode, "type") self.dip = GetAttributeValue(orebodyDataNode, "dip") self.cover = GetAttributeValue(orebodyDataNode, "cover") if (HasAttribute(orebodyDataNode, "length")): self.length = GetAttributeValue(orebodyDataNode, "length") self.width = GetAttributeValue(orebodyDataNode, "width") self.height = GetAttributeValue(orebodyDataNode, "height") if (self.width > self.length): temp = self.width self.width = self.length self.length = temp elif (HasAttribute(orebodyDataNode, "mass")): self.orebodyMass = GetAttributeValue(orebodyDataNode, "mass") self.CalculateDepositVolume() self.CalculateDepositDimensionsFromVolume() else: BluecapError("Failed to find orebody mass or dimensions in input.") for child in GetChildren(orebodyDataNode): type = GetXMLTag(child) name = GetAttributeString(child, "name") grade = GetAttributeValue(child, "grade") self.metalGrades[name] = grade
def ParseXMLNode(self,actionNode,problemManager): """ Generate an Iterator action from the xml tree node. """ self.number = GetAttributeValueOrDefault(actionNode,"number",self.number) for child in GetChildren(actionNode): type = GetXMLTag(child) self.actions.append( ActionFactory.CreateFromXML(type,child,problemManager) ) return
def ParseXMLNode(self, problemManager, solvManagerNode): """ Generate Solvers from xml tree node. """ for child in GetChildren(solvManagerNode): type = GetXMLTag(child) name = GetAttributeString(child, "name") self.solvers[name] = SolverFactory.CreateFromXML( type, child, problemManager)
def ParseXMLNode(self, fnManagerNode, problemManager): """ Generate Functions from xml tree node. """ for child in GetChildren(fnManagerNode): type = GetXMLTag(child) name = GetAttributeString(child, "name") self.functions[name] = FunctionFactory.CreateFromXML( type, child, problemManager)
def ParseXMLNode(self, mineDataNode): """ Generate Mine Data Manager data from xml tree node. """ # Location if(HasChild(mineDataNode,"Location")): locNode = GetChild(mineDataNode,"Location") self.mineLatLong[0] = GetAttributeValue(locNode,"lat") self.mineLatLong[1] = GetAttributeValue(locNode,"long") # Orebody if(HasChild(mineDataNode,"Orebody")): orebodyNode = GetChild(mineDataNode,"Orebody") orebodyName = GetAttributeStringOrDefault(orebodyNode,"name","unnamed") self.theOrebodies[orebodyName] = OreBodyDataManager(orebodyName) self.theOrebodies[orebodyName].ParseXMLNode(orebodyNode) self.theOrebodies["Active"] = self.theOrebodies[orebodyName] self.theOreBody = self.theOrebodies[orebodyName] self.theMines[orebodyName] = MiningSystemDataManager(orebodyName) self.theMiningSystem = self.theMines[orebodyName] # Orebody Set if(HasChild(mineDataNode,"OrebodyList")): orebodyList = GetChild(mineDataNode,"OrebodyList") setActive = True for orebodyNode in GetChildren(orebodyList): if(GetXMLTag(orebodyNode) != "note"): orebodyName = GetAttributeString(orebodyNode,"name") self.theOrebodies[orebodyName] = OreBodyDataManager(orebodyName) self.theOrebodies[orebodyName].latLong = np.array(self.mineLatLong) # set global lat long as orebody lat long as default self.theOrebodies[orebodyName].ParseXMLNode(orebodyNode) self.theMines[orebodyName] = MiningSystemDataManager(orebodyName) if(setActive): self.theOrebodies["Active"] = self.theOrebodies[orebodyName] self.theOreBody = self.theOrebodies[orebodyName] self.theMiningSystem = self.theMines[orebodyName] setActive = False theFunctionManager = FunctionManager() if( (self.theOreBody.cover < 0.0 ) and (theFunctionManager.HasFunction("DepthOfCover") ) ): self.theOreBody.cover = theFunctionManager.GetFunction("DepthOfCover").f( self.mineLatLong[::-1] ) print("Cover set to: ", self.theOreBody.cover ) if(HasChild(mineDataNode,"Mining")): miningNode = GetChild(mineDataNode,"Mining") # pass XML settings to all orebodies self.theMines["Active"].ParseXMLNode(miningNode) for orebodyName in self.theOrebodies: self.theMines[orebodyName].ParseXMLNode(miningNode) # Infrastructure if(HasChild(mineDataNode,"Infrastructure")): infrastructureNode = GetChild(mineDataNode,"Infrastructure") self.theInfrastructureManager.ParseXMLNode(infrastructureNode) # Rehabilitation if(HasChild(mineDataNode,"Rehabilitation")): rehabNode = GetChild(mineDataNode,"Rehabilitation") self.theRehabilitationManager = RehabilitationDataManager() self.theRehabilitationManager.ParseXMLNode(rehabNode) # Economics if(HasChild(mineDataNode,"Economics")): economicsNode = GetChild(mineDataNode,"Economics") self.theEconomicDataManager.ParseXMLNode(economicsNode)