public void ApplyPointLoadsByPattern(string patternName) { foreach (sNode sn in this.nodes) { StatNode stn = sn.extraData as StatNode; if (stn != null) { if (sn.pointLoads != null && sn.pointLoads.Count > 0) { sXYZ load = sXYZ.Zero(); //sXYZ moment = sXYZ.Zero(); foreach (sPointLoad pl in sn.pointLoads) { if (pl.loadPatternName == patternName) { load += pl.forceVector; //moment += pl.momentVector; //currently StatSystem cannot do moment load } } if (load.GetLength() > 0.0) { stn.AddLoad(load.X, load.Y, load.Z); } } } } }
private void BuildFESystem() { this.FEsystem = new StatSystem(); this.FEsystem.PointMergeTolerance = this.systemSettings.mergeTolerance_m; this.FEsystem.MergeNewNodes = true; sStatConverter conv = new sStatConverter(); foreach (IFrameSet bs in this.frameSets) { foreach (sFrame b in bs.frames) { StatCrossSection cs = conv.ToStatCrossSection(b, bs.AsMinuteDensity); StatNode n0 = this.FEsystem.AddNode(conv.ToCVector(b.node0)); StatNode n1 = this.FEsystem.AddNode(conv.ToCVector(b.node1)); C_vector uv = conv.ToCVector(b.upVector); StatBeam sb = this.FEsystem.AddBeam(n0, n1, cs, uv); b.extraData = sb; sb.ExtraData = b; } } foreach (sNode sn in this.nodes) { StatNode n = null; if (sn.boundaryCondition != null) { //n = this.FEsystem.AddNode(sn.location.X, sn.location.Y, sn.location.Z); n = FindStatNode(sn, this.systemSettings.mergeTolerance_m); if (sn.boundaryCondition.supportType == eSupportType.FIXED) { n.SupportType = BOUNDARYCONDITIONS.ALL; } else if (sn.boundaryCondition.supportType == eSupportType.PINNED) { n.SupportType = BOUNDARYCONDITIONS.TRANSLATIONS; } else if (sn.boundaryCondition.supportType == eSupportType.CUSTOM) { } } if (sn.pointLoads != null && sn.pointLoads.Count > 0) { n = FindStatNode(sn, this.systemSettings.mergeTolerance_m); } if (n != null) { sn.extraData = n; n.ExtraData = sn; } } }
public StatMismatchWarning(int line, StatNode expected, StatNode actual, string message = "Statements differ") { if (expected.Equals(actual)) { throw new ArgumentException("Expected different objects"); } this.Expected = expected; this.Actual = actual; this.Message = message; this.Line = line; }
public override ASTNode VisitLabeledStatement([NotNull] LabeledStatementContext ctx) { if (ctx.Identifier() is null) { throw new NotImplementedException(); } string label = ctx.Identifier().GetText(); StatNode statement = this.Visit(ctx.statement()).As <StatNode>(); return(new LabeledStatNode(ctx.Start.Line, label, statement)); }
public void ApplyPointLoadsByCombo(string comboName, ref double deadFactor) { sLoadCombination combo = GetLoadComboByName(comboName); //double Dfactor = 0.0; foreach (sNode sn in this.nodes) { StatNode stn = sn.extraData as StatNode; if (stn != null) { if (sn.pointLoads != null && sn.pointLoads.Count > 0) { sPointLoad comboLoad = new sPointLoad(); if (combo.combinationType == eCombinationType.LinearAdditive) { for (int i = 0; i < combo.patterns.Count; ++i) { string pattern = combo.patterns[i]; double factor = combo.factors[i]; if (pattern != "DEAD") { sn.UpdatePointLoadByPatternFactor_LinearAdditive(pattern, factor, ref comboLoad); } else { deadFactor = factor; } } } //else what? if (comboLoad.forceVector != null || comboLoad.momentVector != null) { //need to reset node load???????????????? comboLoad.location = sn.location; if (comboLoad.forceVector != null) { stn.AddLoad(comboLoad.forceVector.X, comboLoad.forceVector.Y, comboLoad.forceVector.Z); object t = stn; } if (comboLoad.momentVector != null) { stn.AddLoad(comboLoad.momentVector.X, comboLoad.momentVector.Y, comboLoad.momentVector.Z); } } } } } }
private void CGStat(FuncInfo funcInfo, StatNode node) { switch (node.Type) { case GrammarNodeType.FunctionCallStat: CGFuncCallStat(funcInfo, node as FuncCallStatNode); break; case GrammarNodeType.BreakStat: int pc = funcInfo.EmitJMP(0, 0); funcInfo.AddBreakJmp(pc); break; case GrammarNodeType.DoStat: CGDoStat(funcInfo, node as DoStatNode); break; case GrammarNodeType.RepeatStat: CGRepeatStat(funcInfo, node as RepeatStatNode); break; case GrammarNodeType.WhileStat: CGWhileStat(funcInfo, node as WhileStatNode); break; case GrammarNodeType.ForInStat: CGWhileStat(funcInfo, node as WhileStatNode); break; case GrammarNodeType.IfStat: CGIfStat(funcInfo, node as IfStatNode); break; case GrammarNodeType.ForNumStat: CGForNumStat(funcInfo, node as ForNumStatNode); break; case GrammarNodeType.LocalVarDecStat: CGLocalVarDefStat(funcInfo, node as LocalVarDecStatNode); break; case GrammarNodeType.LocalFuncDefStat: CGLocalFuncDefStat(funcInfo, node as LoacalFuncDefStatNode); break; case GrammarNodeType.AssignStat: CGAssignStat(funcInfo, node as AssignStatNode); break; } }
public StatNode FindStatNode(sNode jn, double tol) { StatNode clnode = null; foreach (StatNode n in this.FEsystem.Nodes) { C_vector jv = new C_vector(jn.location.X, jn.location.Y, jn.location.Z); if (jv.DistanceTo(n.p) < tol) { clnode = n; break; } } return(clnode); }
public override ASTNode VisitSelectionStatement([NotNull] SelectionStatementContext ctx) { switch (ctx.children.First().GetText()) { case "if": ExprNode condition = this.Visit(ctx.expression()).As <ExprNode>(); StatementContext[] statements = ctx.statement(); StatNode thenStatement = this.Visit(statements.First()).As <StatNode>(); StatNode? elseStatement = statements.Length > 1 ? this.Visit(statements.Last()).As <StatNode>() : null; return(elseStatement is null ? new IfStatNode(ctx.Start.Line, condition, thenStatement) : new IfStatNode(ctx.Start.Line, condition, thenStatement, elseStatement)); case "switch": throw new NotImplementedException("switch"); default: throw new SyntaxErrorException("Unknown construct", ctx.Start.Line, ctx.Start.Column); } }
public override ASTNode VisitIterationStatement([NotNull] IterationStatementContext ctx) { IterStatNode it; StatNode statement = this.Visit(ctx.statement()).As <StatNode>(); if (ctx.For() is { })
public ForNode(IDNode id, TypeNode type, int from, int to, StatNode stat, LexLocation location) { ID = id; Type = type; From = from; To = to; Statement = stat; Location = location; }
public LoopNode(ExprNode count, StatNode stat, LexLocation location) { Count = count; Statement = stat; Location = location; }
public void AddStatement(StatNode node) { Statements.Add(node); }
public BlockNode(StatNode node, LexLocation location) { Statements.Add(node); Location = location; }