Add heat exchangers
This commit is contained in:
@@ -54,11 +54,23 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
return p;
|
||||
}
|
||||
|
||||
public Path? GetPath(IEnumerable<INode> points, Func<INode, bool>? valid = null) {
|
||||
if (points.Count() < 2) throw new ArgumentException("Path is too short");
|
||||
var start = points.First();
|
||||
var path = new Path(start, []);
|
||||
foreach (var end in points.Skip(1)) {
|
||||
if (GetPath(start, end, valid, visited: [..path.Hops.Select(h => h.Node)]) is not Path p)
|
||||
return null;
|
||||
path.Hops = [..path.Hops, ..p.Hops];
|
||||
start = end;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
public Path? GetPath(INode start, INode end, Func<INode, bool>? valid = null, HashSet<INode>? visited = null) {
|
||||
if (!Nodes.Contains(start) || !Nodes.Contains(end)) throw new ArgumentException("Start/end node not contained in graph");
|
||||
valid ??= a => true;
|
||||
visited ??= [];
|
||||
visited.Add(start);
|
||||
visited = [.. visited ?? [], start];
|
||||
List<(IEdge, INode)> hops = [];
|
||||
Path? path = null;
|
||||
foreach (var o in start.Outputs) {
|
||||
|
||||
Reference in New Issue
Block a user