Skip to content

Commit 10c832d

Browse files
Merge pull request #70 from SpiceSharp/development
Development
2 parents b88f306 + 48c1b97 commit 10c832d

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

SpiceSharpBehavioral/Parsers/Nodes/DerivativesHelper.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public static class DerivativesHelper
1212
/// <summary>
1313
/// The default function rules.
1414
/// </summary>
15-
public static readonly Dictionary<string, FunctionRule> Defaults = new Dictionary<string, FunctionRule>
15+
public static Dictionary<string, FunctionRule> Defaults { get; set; } = new Dictionary<string, FunctionRule>(StringComparer.OrdinalIgnoreCase)
1616
{
1717
{ "abs", (f, da) => Derivatives.ChainRule(f, da.Check(1), "sgn") },
1818
{ "sgn", Zero },
@@ -52,6 +52,20 @@ public static class DerivativesHelper
5252
{ "arg", (f, da) => DAtan2(f, new[] { Node.Function("imag", da.Check(1)[0]), Node.Function("real", da[0]) }) },
5353
};
5454

55+
/// <summary>
56+
/// Helper methods that changes the equality comparer for function names.
57+
/// </summary>
58+
/// <param name="comparer">The name comparer.</param>
59+
public static void RemapFunctions(IEqualityComparer<string> comparer)
60+
{
61+
var nmap = new Dictionary<string, FunctionRule>(comparer);
62+
foreach (var map in Defaults)
63+
{
64+
nmap.Add(map.Key, map.Value);
65+
}
66+
Defaults = nmap;
67+
}
68+
5569
private static IReadOnlyList<Node> Check(this IReadOnlyList<Node> arguments, int expected)
5670
{
5771
if (arguments == null || arguments.Count != expected)

SpiceSharpBehavioral/SpiceSharpBehavioral.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
5-
<Version>3.1.1</Version>
5+
<Version>3.1.2</Version>
66
<Authors>Sven Boulanger</Authors>
77
<Title>Spice#.Behavioral</Title>
88
<Description>Spice#.Behavioral is a library that allows using behavioral components in the circuit simulator Spice#.</Description>
@@ -11,12 +11,12 @@
1111
<RepositoryUrl>https://github.com/SpiceSharp/SpiceSharpBehavioral</RepositoryUrl>
1212
<PackageTags>circuit electronics netlist parser spice simulator simulation ode solver design behavioral modeling</PackageTags>
1313
<PackageIconUrl></PackageIconUrl>
14-
<AssemblyVersion>3.1.1.0</AssemblyVersion>
14+
<AssemblyVersion>3.1.2.0</AssemblyVersion>
1515
<PackageReleaseNotes>Refer to the GitHub release for release notes.</PackageReleaseNotes>
1616
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1717
<Company />
1818
<NeutralLanguage>en</NeutralLanguage>
19-
<FileVersion>3.1.1.0</FileVersion>
19+
<FileVersion>3.1.2.0</FileVersion>
2020
<DebugType>full</DebugType>
2121
<DebugSymbols>true</DebugSymbols>
2222
<PackageLicenseExpression>MIT</PackageLicenseExpression>

0 commit comments

Comments
 (0)