-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kristjan Nielsen
committed
Nov 2, 2023
1 parent
eddcb59
commit a533927
Showing
21 changed files
with
307 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
GsaGH/Parameters/5_Results/3_Caches/IElement1dResultCache.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Collections.Concurrent; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
|
||
namespace GsaGH.Parameters.Results { | ||
public interface IElement1dResultCache<T1, T2, T3> | ||
where T1 : IElement1dQuantity<T2> where T2 : IResultItem { | ||
IApiResult ApiResult { get; } | ||
ConcurrentDictionary<int, Collection<T1>> Cache { get; } | ||
IElement1dResultSubset<T1, T2, T3> ResultSubset(ICollection<int> elementIds, int positionCount); | ||
IElement1dResultSubset<T1, T2, T3> ResultSubset(ICollection<int> elementIds, ReadOnlyCollection<double> positions); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
GsaGH/Parameters/5_Results/4_Subsets/Element1dDisplacements.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Collections.Concurrent; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Linq; | ||
using OasysUnits; | ||
|
||
namespace GsaGH.Parameters.Results { | ||
public class Element1dDisplacements : IElement1dResultSubset<IElement1dDisplacement, IDisplacement, ResultVector6<Element1dExtremaKey>> { | ||
public ResultVector6<Element1dExtremaKey> Max { get; private set; } | ||
public ResultVector6<Element1dExtremaKey> Min { get; private set; } | ||
public IList<int> Ids { get; private set; } | ||
|
||
public ConcurrentDictionary<int, Collection<IElement1dDisplacement>> Subset { get; } | ||
= new ConcurrentDictionary<int, Collection<IElement1dDisplacement>>(); | ||
|
||
public Element1dDisplacements(ConcurrentDictionary<int, Collection<IElement1dDisplacement>> results) { | ||
Subset = results; | ||
Ids = results.Keys.OrderBy(x => x).ToList(); | ||
(Max, Min) = results.BeamExtrema<IElement1dDisplacement, IDisplacement>(); | ||
} | ||
|
||
public IDisplacement GetExtrema(Element1dExtremaKey key) { | ||
return Subset[key.Id][key.Permutation].Results[key.Position]; | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
GsaGH/Parameters/5_Results/4_Subsets/Element1dResultsFactory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using GsaAPI; | ||
using System.Collections.ObjectModel; | ||
|
||
namespace GsaGH.Parameters.Results { | ||
public static class Element1dResultsFactory { | ||
public static Collection<IElement1dDisplacement> CreateBeamDisplacements( | ||
ReadOnlyCollection<Double6> results, ReadOnlyCollection<double> positions) { | ||
return new Collection<IElement1dDisplacement> { | ||
new Element1dDisplacement(results, positions) | ||
}; | ||
} | ||
|
||
public static Collection<IElement1dDisplacement> CreateBeamDisplacements( | ||
ReadOnlyCollection<ReadOnlyCollection<Double6>> results, ReadOnlyCollection<double> positions) { | ||
var permutations = new Collection<IElement1dDisplacement>(); | ||
foreach (ReadOnlyCollection<Double6> permutation in results) { | ||
permutations.Add(new Element1dDisplacement(permutation, positions)); | ||
} | ||
return permutations; | ||
} | ||
|
||
public static Collection<IElement1dDisplacement> AddMissingPositions( | ||
this Collection<IElement1dDisplacement> existing, | ||
ReadOnlyCollection<Double6> results, ReadOnlyCollection<double> positions) { | ||
for (int i = 0; i < results.Count; i++) { | ||
if (!existing[0].Results.ContainsKey(positions[i])) { | ||
existing[0].Results.Add(positions[i], new Displacement(results[i])); | ||
} | ||
} | ||
|
||
return existing; | ||
} | ||
|
||
public static Collection<IElement1dDisplacement> AddMissingPositions( | ||
this Collection<IElement1dDisplacement> existing, | ||
ReadOnlyCollection<ReadOnlyCollection<Double6>> results, ReadOnlyCollection<double> positions) { | ||
for (int i = 0; i < existing.Count; i++) { | ||
for (int j = 0; j < results.Count; j++) { | ||
if (!existing[i].Results.ContainsKey(positions[j])) { | ||
existing[i].Results.Add(positions[j], new Displacement(results[i][j])); | ||
} | ||
} | ||
} | ||
|
||
return existing; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.