public IIR Execute(IIR predecessorIR) { var ir = (AstIR)predecessorIR; VulcanLogging.ProcessPackages(ir.AstRootNode); return(ir); }
public void ImpulseResponseTest() { // a0 0.3 // H(z) = ------------ = ------------ // b0 + b1 z^-1 1 - 0.7 z^-1 var b0 = 0.3; var a0 = 1; var a1 = -0.7; var b = new[] { b0 }; var a = new[] { a0, a1 }; var filter = new IIR(b, a); var impulse_response_length = 3; var delta = new double[3]; delta[0] = 1; var impulse_response = filter.Process(delta).ToArray(); Assert.AreEqual(impulse_response_length, impulse_response.Length); double[] expected_impulse_response = { b0, -a1 * b0, -a1 * -a1 * b0 }; CollectionAssert.AreEqual(expected_impulse_response, impulse_response); }
public IIR Execute(IIR predecessorIR) { AstIR astIR = predecessorIR as AstIR; if (astIR == null) { return(null); } // Initialize Lowering Engine InitializeLoweringEngine(); PhysicalIR physicalIR = new PhysicalIR(astIR); foreach (Task.AstPackageNode packageNode in astIR.AstRootNode.Packages) { if (packageNode.Emit) { var root = physicalIR.InitializePackage(packageNode.Name); PhysicalLoweringProcessor.Lower(packageNode, new TaskLoweringContext(root)); } } return(physicalIR); }
void AFilterCoefficients() { iir = new IIR(); biQuads = new BiQuad[3]; for (int i = 0; i < biQuads.Length; i++) { biQuads[i] = new BiQuad(); } biQuads[0].a0 = 1; biQuads[0].a1 = -1.34730722798; biQuads[0].a1 = -1.34730722798; biQuads[0].a2 = 0.349057529796; biQuads[0].b0 = 0.965250965250; biQuads[0].b1 = -1.34730163086; biQuads[0].b2 = 0.382050665614; biQuads[1].a0 = 1; biQuads[1].a1 = -1.89387049481; biQuads[1].a2 = 0.895159769170; biQuads[1].b0 = 0.946969696969; biQuads[1].b1 = -1.89393939393; biQuads[1].b2 = 0.946969696969; biQuads[2].a0 = 1; biQuads[2].a1 = -1.34730722798; biQuads[2].a2 = 0.349057529796; biQuads[2].b0 = 0.646665428100; biQuads[2].b1 = -0.38362237137; biQuads[2].b2 = -0.26304305672; iir.Init(biQuads, biQuads.Length); }
public IIR Execute(IIR predecessorIR) { var xmlIR = predecessorIR as XmlIR; if (xmlIR == null) { MessageEngine.Trace(Severity.Error, Resources.ErrorPhaseWorkflowIncorrectInputIRType, predecessorIR.GetType().ToString(), Name); } var xsltFileList = new List <string>(); string xsltFolderPath = PathManager.GetToolSubpath(Settings.Default.SubPathXsltTransformFolder); foreach (string xsltFile in _xsltFiles.Split(';')) { if (!String.IsNullOrEmpty(xsltFile)) { xsltFileList.Add(Path.Combine(xsltFolderPath, xsltFile)); } } var settings = new XsltSettings(true, false); var output = new XmlIR(); // REVIEW: The approach I take here is to pipeline XSLT transforms using a MemoryStream. This isn't great. // In the next .NET Fx, they are expecting to fix XslCompiledTransform so it can pipeline more resonably. This should be changed at that time. foreach (BimlFile bimlFile in xmlIR.BimlFiles) { XDocument document = bimlFile.XDocument; var intermediateXmlDocument = new XmlDocument(); intermediateXmlDocument.Load(document.CreateReader()); if (!String.IsNullOrEmpty(xmlIR.TemplatePath)) { foreach (string s in xsltFileList) { var xslt = new XslCompiledTransform(); var args = new XsltArgumentList(); args.AddParam("TemplatePath", String.Empty, xmlIR.TemplatePath); xslt.Load(s, settings, new XmlUrlResolver()); var intermediateMemoryStream = new MemoryStream(); xslt.Transform(intermediateXmlDocument, args, intermediateMemoryStream); intermediateMemoryStream.Position = 0; intermediateXmlDocument = new XmlDocument(); intermediateXmlDocument.Load(intermediateMemoryStream); } } output.AddXml(bimlFile.FilePath, intermediateXmlDocument, bimlFile.EmitType, true); } output.SchemaSet = xmlIR.SchemaSet; output.DefaultXmlNamespace = xmlIR.DefaultXmlNamespace; return(output); }
public IIR Execute(IIR predecessorIR) { var xmlIR = predecessorIR as XmlIR; if (xmlIR == null) { MessageEngine.Trace(Severity.Error, Resources.ErrorPhaseWorkflowIncorrectInputIRType, predecessorIR.GetType().ToString(), Name); } var xsltFileList = new List<string>(); string xsltFolderPath = PathManager.GetToolSubpath(Settings.Default.SubPathXsltTransformFolder); foreach (string xsltFile in _xsltFiles.Split(';')) { if (!String.IsNullOrEmpty(xsltFile)) { xsltFileList.Add(Path.Combine(xsltFolderPath, xsltFile)); } } var settings = new XsltSettings(true, false); var output = new XmlIR(); // REVIEW: The approach I take here is to pipeline XSLT transforms using a MemoryStream. This isn't great. // In the next .NET Fx, they are expecting to fix XslCompiledTransform so it can pipeline more resonably. This should be changed at that time. foreach (BimlFile bimlFile in xmlIR.BimlFiles) { XDocument document = bimlFile.XDocument; var intermediateXmlDocument = new XmlDocument(); intermediateXmlDocument.Load(document.CreateReader()); if (!String.IsNullOrEmpty(xmlIR.TemplatePath)) { foreach (string s in xsltFileList) { var xslt = new XslCompiledTransform(); var args = new XsltArgumentList(); args.AddParam("TemplatePath", String.Empty, xmlIR.TemplatePath); xslt.Load(s, settings, new XmlUrlResolver()); var intermediateMemoryStream = new MemoryStream(); xslt.Transform(intermediateXmlDocument, args, intermediateMemoryStream); intermediateMemoryStream.Position = 0; intermediateXmlDocument = new XmlDocument(); intermediateXmlDocument.Load(intermediateMemoryStream); } } output.AddXml(bimlFile.FilePath, intermediateXmlDocument, bimlFile.EmitType, true); } output.SchemaSet = xmlIR.SchemaSet; output.DefaultXmlNamespace = xmlIR.DefaultXmlNamespace; return output; }
public IIR Execute(IIR predecessorIR) { var xmlIR = predecessorIR as XmlIR; if (xmlIR == null) { // Message.Trace(Severity.Error, Resources.ErrorPhaseWorkflowIncorrectInputIRType, PredecessorIR.GetType().ToString(), this.Name); } var astIR = new AstIR(xmlIR) { AstRootNode = new AstRootNode(null) }; var unboundReferences = new UnboundReferences(); var languageSettings = new LanguageSettings(_defaultXmlNamespace, typeof(AstNode)); foreach (BimlFile bimlFile in astIR.BimlFiles) { if (bimlFile.XDocument.Root != null) { AstParser.ParseDocument(bimlFile, astIR.AstRootNode, unboundReferences, languageSettings); } } unboundReferences.ResolveAll(astIR.AstRootNode.SymbolTable); CompileTimeResolver.ResolveAll(astIR.AstRootNode.SymbolTable, unboundReferences); if (unboundReferences.Count > 0) { foreach (var unboundReference in unboundReferences) { string filename = unboundReference.BimlFile.Name; string refName = unboundReference.XValue; string refTypeFriendlyName = unboundReference.BoundProperty.PropertyType.Name; string xml = unboundReference.XObject.ToString(); int line = ((IXmlLineInfo)unboundReference.XObject).LineNumber; int offset = ((IXmlLineInfo)unboundReference.XObject).LinePosition; var friendlyNames = (FriendlyNameAttribute[])unboundReference.BoundProperty.PropertyType.GetCustomAttributes(typeof(FriendlyNameAttribute), false); if (friendlyNames != null && friendlyNames.Length > 0) { refTypeFriendlyName = friendlyNames[0].FriendlyName; } // TODO: Fatal Error MessageEngine.Trace(filename, line, offset, Severity.Error, "V0101", null, "Could not resolve reference to '{0}' of type '{1}'. '{2}' is invalid.", refName, refTypeFriendlyName, xml); } throw new InvalidOperationException("Parsing was unsuccessful."); } return(astIR); }
public IIR Execute(IIR predecessorIR) { var xmlIR = predecessorIR as XmlIR; if (xmlIR == null) { MessageEngine.Trace(Severity.Error, Resources.ErrorPhaseWorkflowIncorrectInputIRType, predecessorIR.GetType().ToString(), Name); } xmlIR.ValidateXDocuments(); return xmlIR; }
public IIR Execute(IIR predecessorIR) { var xmlIR = predecessorIR as XmlIR; if (xmlIR == null) { MessageEngine.Trace(Severity.Error, Resources.ErrorPhaseWorkflowIncorrectInputIRType, predecessorIR.GetType().ToString(), Name); } xmlIR.ValidateXDocuments(); return(xmlIR); }
public VulcanEngine.IR.IIR Execute(IIR PredecessorIR) { XmlIR xmlIR = PredecessorIR as XmlIR; if (xmlIR == null) { _message.Trace(Severity.Error, Resources.ErrorPhaseWorkflowIncorrectInputIRType, PredecessorIR.GetType().ToString(), this.Name); } string XsltFolderPath = PathManager.GetToolSubpath(Settings.Default.SubPathXsltTransformFolder); string[] XsltFileNames = Directory.GetFiles(XsltFolderPath, "*.xsl"); if (XsltFileNames.Length <= 0) { _message.Trace(Severity.Warning, Resources.WarningNoPreProcessorFound); return(null); } XsltSettings settings = new XsltSettings(true, false); XmlIR output = new XmlIR(); // REVIEW: The approach I take here is to pipeline XSLT transforms using a MemoryStream. This isn't great. // In the next .NET Fx, they are expecting to fix XslCompiledTransform so it can pipeline more resonably. This should be changed at that time. foreach (XmlIRDocumentType docType in xmlIR.XDocuments.Keys) { foreach (XDocument xDocument in xmlIR.XDocuments[docType]) { XmlDocument intermediateXMLDocument = new XmlDocument(); intermediateXMLDocument.Load(xDocument.CreateReader()); foreach (string s in XsltFileNames) { XslCompiledTransform xslt = new XslCompiledTransform(); XsltArgumentList args = new XsltArgumentList(); args.AddParam("XSLTFolderPath", String.Empty, XsltFolderPath); xslt.Load(s, settings, new XmlUrlResolver()); MemoryStream intermediateMemoryStream = new MemoryStream(); xslt.Transform(intermediateXMLDocument, args, intermediateMemoryStream); intermediateMemoryStream.Position = 0; intermediateXMLDocument = new XmlDocument(); intermediateXMLDocument.Load(intermediateMemoryStream); } output.AddXml(intermediateXMLDocument, docType); } } return(output); }
public void SupplyIRFromPredecessor(PhaseExecutionHost Predecessor, IIR IR) { if (!this._Predecessors.Contains(Predecessor)) { Message.Trace(Severity.Error, Resources.ErrorInvalidWorkflowPhaseSpecifier, Predecessor._WorkflowUniqueName); return; } if (this._PredecessorIRs.ContainsKey(Predecessor)) { Message.Trace(Severity.Error, Resources.ErrorAttemptedWorkflowSupplyDuplicatePhaseIR, Predecessor._WorkflowUniqueName, this._WorkflowUniqueName); return; } this._PredecessorIRs.Add(Predecessor, IR); }
public VulcanEngine.IR.IIR Execute(IIR PredecessorIR) { XmlIR xmlIR = PredecessorIR as XmlIR; if (xmlIR == null) { _message.Trace(Severity.Error, Resources.ErrorPhaseWorkflowIncorrectInputIRType, PredecessorIR.GetType().ToString(), this.Name); } string XsltFolderPath = PathManager.GetToolSubpath(Settings.Default.SubPathXsltTransformFolder); string[] XsltFileNames = Directory.GetFiles(XsltFolderPath, "*.xsl"); if (XsltFileNames.Length <= 0) { _message.Trace(Severity.Warning, Resources.WarningNoPreProcessorFound); return null; } XsltSettings settings = new XsltSettings(true, false); XmlIR output = new XmlIR(); // REVIEW: The approach I take here is to pipeline XSLT transforms using a MemoryStream. This isn't great. // In the next .NET Fx, they are expecting to fix XslCompiledTransform so it can pipeline more resonably. This should be changed at that time. foreach (XmlIRDocumentType docType in xmlIR.XDocuments.Keys) { foreach (XDocument xDocument in xmlIR.XDocuments[docType]) { XmlDocument intermediateXMLDocument = new XmlDocument(); intermediateXMLDocument.Load(xDocument.CreateReader()); foreach (string s in XsltFileNames) { XslCompiledTransform xslt = new XslCompiledTransform(); XsltArgumentList args = new XsltArgumentList(); args.AddParam("XSLTFolderPath", String.Empty, XsltFolderPath); xslt.Load(s, settings, new XmlUrlResolver()); MemoryStream intermediateMemoryStream = new MemoryStream(); xslt.Transform(intermediateXMLDocument, args, intermediateMemoryStream); intermediateMemoryStream.Position = 0; intermediateXMLDocument = new XmlDocument(); intermediateXMLDocument.Load(intermediateMemoryStream); } output.AddXml(intermediateXMLDocument,docType); } } return output; }
public IIR Execute(IIR predecessorIR) { var xmlIR = predecessorIR as XmlIR; if (xmlIR == null) { // Message.Trace(Severity.Error, Resources.ErrorPhaseWorkflowIncorrectInputIRType, PredecessorIR.GetType().ToString(), this.Name); } var astIR = new AstIR(xmlIR) { AstRootNode = new AstRootNode(null) }; var unboundReferences = new UnboundReferences(); var languageSettings = new LanguageSettings(_defaultXmlNamespace, typeof(AstNode)); foreach (BimlFile bimlFile in astIR.BimlFiles) { if (bimlFile.XDocument.Root != null) { AstParser.ParseDocument(bimlFile, astIR.AstRootNode, unboundReferences, languageSettings); } } unboundReferences.ResolveAll(astIR.AstRootNode.SymbolTable); CompileTimeResolver.ResolveAll(astIR.AstRootNode.SymbolTable, unboundReferences); if (unboundReferences.Count > 0) { foreach (var unboundReference in unboundReferences) { string filename = unboundReference.BimlFile.Name; string refName = unboundReference.XValue; string refTypeFriendlyName = unboundReference.BoundProperty.PropertyType.Name; string xml = unboundReference.XObject.ToString(); int line = ((IXmlLineInfo)unboundReference.XObject).LineNumber; int offset = ((IXmlLineInfo)unboundReference.XObject).LinePosition; var friendlyNames = (FriendlyNameAttribute[])unboundReference.BoundProperty.PropertyType.GetCustomAttributes(typeof(FriendlyNameAttribute), false); if (friendlyNames != null && friendlyNames.Length > 0) { refTypeFriendlyName = friendlyNames[0].FriendlyName; } // TODO: Fatal Error MessageEngine.Trace(filename, line, offset, Severity.Error, "V0101", null, "Could not resolve reference to '{0}' of type '{1}'. '{2}' is invalid.", refName, refTypeFriendlyName, xml); } throw new InvalidOperationException("Parsing was unsuccessful."); } return astIR; }
public void SupplyIRFromPredecessor(PhaseExecutionHost predecessor, IIR ir) { if (!_predecessors.Contains(predecessor)) { MessageEngine.Trace(Severity.Error, Resources.ErrorInvalidWorkflowPhaseSpecifier, predecessor._workflowUniqueName); return; } if (_predecessorIRs.ContainsKey(predecessor)) { MessageEngine.Trace(Severity.Error, Resources.ErrorAttemptedWorkflowSupplyDuplicatePhaseIR, predecessor._workflowUniqueName, _workflowUniqueName); return; } _predecessorIRs.Add(predecessor, ir); }
// REVIEW: Root phases are special cased in a variety of locations. Perhaps we can simplify. public void ExecutePhaseWorkflowGraph(IIR rootIR) { // Setup Root Phases List <PhaseExecutionHost> rootHosts = _phaseWorkflow.FindAll(host => host.IsRootPhase); foreach (PhaseExecutionHost rootHost in rootHosts) { rootHost.SupplyRootIR(rootIR); } // Check Graph For Cycles if (!IsPhaseWorkflowGraphAcyclic) { MessageEngine.Trace(Severity.Error, Resources.ErrorWorkflowCycleDetected, Name); return; } // Execute Graph var executionWaitHandles = new List <EventWaitHandle>(); List <PhaseExecutionHost> notStarted = _phaseWorkflow.FindAll(host => !host.ExecutionStarted); while (notStarted.Count > 0) { List <PhaseExecutionHost> runnable = notStarted.FindAll(host => host.IsPredecessorIRFullySpecified); foreach (PhaseExecutionHost host in runnable) { var executionWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, host.WorkflowUniqueName); executionWaitHandles.Add(executionWaitHandle); ThreadStart phaseThreadJob = delegate { host.Execute(executionWaitHandle); }; var phaseThread = new Thread(phaseThreadJob); phaseThread.Start(); } int index = WaitHandle.WaitAny(executionWaitHandles.ToArray()); executionWaitHandles.RemoveAt(index); if (_phaseWorkflow.Any(host => host.FatalErrorOccurred)) { throw new InvalidOperationException("Fatal Error Occurred."); } notStarted = _phaseWorkflow.FindAll(host => !host.ExecutionStarted); } }
// REVIEW: Root phases are special cased in a variety of locations. Perhaps we can simplify. public void ExecutePhaseWorkflowGraph(IIR RootIR) { // Setup Root Phases List <PhaseExecutionHost> RootHosts = this._PhaseWorkflow.FindAll(delegate(PhaseExecutionHost Host) { return(Host.IsRootPhase); }); foreach (PhaseExecutionHost RootHost in RootHosts) { RootHost.SupplyRootIR(RootIR); } // Check Graph For Cycles if (!this.IsPhaseWorkflowGraphAcyclic) { Message.Trace(Severity.Error, Resources.ErrorWorkflowCycleDetected, this.Name); return; } // Execute Graph List <EventWaitHandle> ExecutionWaitHandles = new List <EventWaitHandle>(); List <PhaseExecutionHost> NotStarted = this._PhaseWorkflow.FindAll(delegate(PhaseExecutionHost Host) { return(!Host.ExecutionStarted); }); while (NotStarted.Count > 0) { List <PhaseExecutionHost> Runnable = NotStarted.FindAll(delegate(PhaseExecutionHost Host) { return(Host.IsPredecessorIRFullySpecified); }); // TODO: Should we use the ThreadPool here? foreach (PhaseExecutionHost Host in Runnable) { EventWaitHandle ExecutionWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Host.WorkflowUniqueName); ExecutionWaitHandles.Add(ExecutionWaitHandle); ThreadStart PhaseThreadJob = new ThreadStart(delegate() { Host.Execute(ExecutionWaitHandle); }); Thread PhaseThread = new Thread(PhaseThreadJob); PhaseThread.Start(); } int index = EventWaitHandle.WaitAny(ExecutionWaitHandles.ToArray()); ExecutionWaitHandles.RemoveAt(index); NotStarted = this._PhaseWorkflow.FindAll(delegate(PhaseExecutionHost Host) { return(!Host.ExecutionStarted); }); } }
private void CheckFrameworkItems(string parentFile, string subFile, bool isSubsetOf) { Assert.IsTrue(File.Exists(parentFile), "PRE file was not found"); Assert.IsTrue(File.Exists(subFile), "POST file was not found"); // TODO: Fix this hack MessageEngine.ClearMessages(); var parser = new XmlToAstParserPhase("TestParser", _defaultXmlNamespace); var lowerer = new AstLowererPhase("TestLowerer"); var parentXmlIR = new XmlIR(); parentXmlIR.AddXml(parentFile, XmlIRDocumentType.Source, true); IIR parentParsed = parser.Execute(parentXmlIR); Assert.IsTrue(MessageEngine.ErrorCount == 0, "There were parse errors in the PRE file."); // TODO: Fix this hack MessageEngine.ClearMessages(); var parentAstRootNode = ((AstIR)lowerer.Execute(parentParsed)).AstRootNode; Assert.IsTrue(MessageEngine.ErrorCount == 0, "There were lowering errors in the PRE file."); // TODO: Fix this hack MessageEngine.ClearMessages(); var subXmlIR = new XmlIR(); subXmlIR.AddXml(subFile, XmlIRDocumentType.Source, true); IIR subParsed = parser.Execute(subXmlIR); Assert.IsTrue(MessageEngine.ErrorCount == 0, "There were parse errors in the POST file."); // TODO: Fix this hack MessageEngine.ClearMessages(); var subAstRootNode = ((AstIR)lowerer.Execute(subParsed)).AstRootNode; Assert.IsTrue(MessageEngine.ErrorCount == 0, "There were lowering errors in the POST file."); CheckFrameworkItems(parentAstRootNode, subAstRootNode, isSubsetOf); }
public IIR Execute(IIR predecessorIR) { var ir = (AstIR)predecessorIR; CloneTableLowerer.ProcessCloneTable(ir.AstRootNode.SymbolTable); PrincipalsLowerer.ProcessPrincipals(ir.AstRootNode); SchemaLowerer.ProcessSchemas(ir.AstRootNode); ProcessTables(ir.AstRootNode); RetryContainerLowerer.ProcessRetryContainers(ir.AstRootNode.SymbolTable); EtlFragmentsLowerer.ProcessEtlFragments(ir.AstRootNode.SymbolTable); LateArrivingLowerer.ProcessLateArrivingLookupTransformations(ir.AstRootNode.SymbolTable); IsNullPatcherLowerer.ProcessIsNullPatcherTransformations(ir.AstRootNode.SymbolTable); SlowlyChangingDimensionsLowerer.ProcessSlowlyChangingDimensionTransformations(ir.AstRootNode.SymbolTable); StagingContainerLowerer.ProcessContainers(ir.AstRootNode.SymbolTable); StoredProcedureLowerer.ProcessStoredProcedures(ir.AstRootNode.SymbolTable); MergeLowerer.ProcessMerges(ir.AstRootNode.SymbolTable); ExecutePackageLowerer.ProcessExecutePackageTransformations(ir.AstRootNode.SymbolTable); return ir; }
public IIR Execute(IIR predecessorIR) { var ir = (AstIR)predecessorIR; CloneTableLowerer.ProcessCloneTable(ir.AstRootNode.SymbolTable); PrincipalsLowerer.ProcessPrincipals(ir.AstRootNode); SchemaLowerer.ProcessSchemas(ir.AstRootNode); ProcessTables(ir.AstRootNode); RetryContainerLowerer.ProcessRetryContainers(ir.AstRootNode.SymbolTable); EtlFragmentsLowerer.ProcessEtlFragments(ir.AstRootNode.SymbolTable); LateArrivingLowerer.ProcessLateArrivingLookupTransformations(ir.AstRootNode.SymbolTable); IsNullPatcherLowerer.ProcessIsNullPatcherTransformations(ir.AstRootNode.SymbolTable); SlowlyChangingDimensionsLowerer.ProcessSlowlyChangingDimensionTransformations(ir.AstRootNode.SymbolTable); StagingContainerLowerer.ProcessContainers(ir.AstRootNode.SymbolTable); StoredProcedureLowerer.ProcessStoredProcedures(ir.AstRootNode.SymbolTable); MergeLowerer.ProcessMerges(ir.AstRootNode.SymbolTable); ExecutePackageLowerer.ProcessExecutePackageTransformations(ir.AstRootNode.SymbolTable); return(ir); }
public IIR Execute(IIR predecessorIR) { AstIR astIR = predecessorIR as AstIR; if (astIR == null) { return null; } // Initialize Lowering Engine InitializeLoweringEngine(); PhysicalIR physicalIR = new PhysicalIR(astIR); foreach (Task.AstPackageNode packageNode in astIR.AstRootNode.Packages) { if (packageNode.Emit) { var root = physicalIR.InitializePackage(packageNode.Name); PhysicalLoweringProcessor.Lower(packageNode, new TaskLoweringContext(root)); } } return physicalIR; }
public void CheckFrameworkItemsNoLowering(string file) { Assert.IsTrue(File.Exists(file), "File was not found"); // TODO: Fix this hack MessageEngine.ClearMessages(); var parser = new XmlToAstParserPhase("TestParser", _defaultXmlNamespace); var lowerer = new AstLowererPhase("TestLowerer"); var unloweredXmlIR = new XmlIR(); unloweredXmlIR.AddXml(file, XmlIRDocumentType.Source, true); var unloweredAstRootNode = ((AstIR)parser.Execute(unloweredXmlIR)).AstRootNode; Assert.IsTrue(MessageEngine.ErrorCount == 0, "There were parse errors in the unlowered file pass."); // TODO: Fix this hack MessageEngine.ClearMessages(); var loweredXmlIR = new XmlIR(); loweredXmlIR.AddXml(file, XmlIRDocumentType.Source, true); IIR loweredParsed = parser.Execute(loweredXmlIR); Assert.IsTrue(MessageEngine.ErrorCount == 0, "There were parse errors in the lowered file pass."); // TODO: Fix this hack MessageEngine.ClearMessages(); var loweredAstRootNode = ((AstIR)lowerer.Execute(loweredParsed)).AstRootNode; Assert.IsTrue(MessageEngine.ErrorCount == 0, "There were lowering errors in the file."); CheckFrameworkItems(unloweredAstRootNode, loweredAstRootNode, false); }
public void Init() { iir = new IIR(); iir.Init(biQuads, biQuads.Length); }
public void iirInitialization() { iir = new IIR(); iir.Init(biQuadsSections, biQuadsSections.Length); }//FIRST AFTER DESIGNING
// REVIEW: Root phases are special cased in a variety of locations. Perhaps we can simplify. public void ExecutePhaseWorkflowGraph(IIR RootIR) { // Setup Root Phases List<PhaseExecutionHost> RootHosts = this._PhaseWorkflow.FindAll(delegate(PhaseExecutionHost Host) { return Host.IsRootPhase; }); foreach (PhaseExecutionHost RootHost in RootHosts) { RootHost.SupplyRootIR(RootIR); } // Check Graph For Cycles if (!this.IsPhaseWorkflowGraphAcyclic) { Message.Trace(Severity.Error, Resources.ErrorWorkflowCycleDetected, this.Name); return; } // Execute Graph List<EventWaitHandle> ExecutionWaitHandles = new List<EventWaitHandle>(); List<PhaseExecutionHost> NotStarted = this._PhaseWorkflow.FindAll(delegate(PhaseExecutionHost Host) { return !Host.ExecutionStarted; }); while (NotStarted.Count > 0) { List<PhaseExecutionHost> Runnable = NotStarted.FindAll(delegate(PhaseExecutionHost Host) { return Host.IsPredecessorIRFullySpecified; }); // TODO: Should we use the ThreadPool here? foreach (PhaseExecutionHost Host in Runnable) { EventWaitHandle ExecutionWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, Host.WorkflowUniqueName); ExecutionWaitHandles.Add(ExecutionWaitHandle); ThreadStart PhaseThreadJob = new ThreadStart(delegate() { Host.Execute(ExecutionWaitHandle); }); Thread PhaseThread = new Thread(PhaseThreadJob); PhaseThread.Start(); } int index = EventWaitHandle.WaitAny(ExecutionWaitHandles.ToArray()); ExecutionWaitHandles.RemoveAt(index); NotStarted = this._PhaseWorkflow.FindAll(delegate(PhaseExecutionHost Host) { return !Host.ExecutionStarted; }); } }
public void SupplyRootIR(IIR rootIR) { _rootIR = rootIR; }
public void SupplyRootIR(IIR RootIR) { this._RootIR = RootIR; }
// REVIEW: Root phases are special cased in a variety of locations. Perhaps we can simplify. public void ExecutePhaseWorkflowGraph(IIR rootIR) { // Setup Root Phases List<PhaseExecutionHost> rootHosts = _phaseWorkflow.FindAll(host => host.IsRootPhase); foreach (PhaseExecutionHost rootHost in rootHosts) { rootHost.SupplyRootIR(rootIR); } // Check Graph For Cycles if (!IsPhaseWorkflowGraphAcyclic) { MessageEngine.Trace(Severity.Error, Resources.ErrorWorkflowCycleDetected, Name); return; } // Execute Graph var executionWaitHandles = new List<EventWaitHandle>(); List<PhaseExecutionHost> notStarted = _phaseWorkflow.FindAll(host => !host.ExecutionStarted); while (notStarted.Count > 0) { List<PhaseExecutionHost> runnable = notStarted.FindAll(host => host.IsPredecessorIRFullySpecified); foreach (PhaseExecutionHost host in runnable) { var executionWaitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, host.WorkflowUniqueName); executionWaitHandles.Add(executionWaitHandle); ThreadStart phaseThreadJob = delegate { host.Execute(executionWaitHandle); }; var phaseThread = new Thread(phaseThreadJob); phaseThread.Start(); } int index = WaitHandle.WaitAny(executionWaitHandles.ToArray()); executionWaitHandles.RemoveAt(index); if (_phaseWorkflow.Any(host => host.FatalErrorOccurred)) { throw new InvalidOperationException("Fatal Error Occurred."); } notStarted = _phaseWorkflow.FindAll(host => !host.ExecutionStarted); } }
public void Allocate(int outputLength, IIR iir, DataObjectElement[] outputData) { this.iir = iir; output = new double[outputLength]; outputData[0].data = output; }
public IIR Execute(IIR predecessorIR) { var ir = (AstIR)predecessorIR; VulcanLogging.ProcessPackages(ir.AstRootNode); return ir; }