Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
CurlVariation.cs
3
5{
10 {
11 private readonly double c1;
12 private readonly double c2;
13
18 : base(new ScriptNode[] { c1, c2 }, new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar },
20 {
21 this.c1 = 0;
22 this.c2 = 0;
23 }
24
25 private CurlVariation(double C1, double C2, ScriptNode c1, ScriptNode c2, int Start, int Length, Expression Expression)
26 : base(new ScriptNode[] { c1, c2 }, new ArgumentType[] { ArgumentType.Scalar, ArgumentType.Scalar },
28 {
29 this.c1 = C1;
30 this.c2 = C2;
31 }
32
36 public override string[] DefaultArgumentNames
37 {
38 get
39 {
40 return new string[] { "c1", "c2" };
41 }
42 }
43
48 {
51
52 return new CurlVariation(C1, C2, this.Arguments[0], this.Arguments[1],
53 this.Start, this.Length, this.Expression);
54 }
55
59 public override void Operate(ref double x, ref double y)
60 {
61 double t1 = 1 + this.c1 * x + this.c2 * (x * x - y * y);
62 double t2 = this.c1 * y + 2 * this.c2 * x * y;
63 double r = t1 * t1 + t2 * t2 + 1e-6;
64 x = (x * t1 + y * t2) / r;
65 y = (y * t1 - x * t2) / r;
66 }
67
71 public override string FunctionName => nameof(CurlVariation);
72 }
73}
Class managing a script expression.
Definition: Expression.cs:39
static double ToDouble(object Object)
Converts an object to a double value.
Definition: Expression.cs:4824
CurlVariation(ScriptNode c1, ScriptNode c2, int Start, int Length, Expression Expression)
TODO
override IElement Evaluate(IElement[] Arguments, Variables Variables)
TODO
override void Operate(ref double x, ref double y)
TODO
ScriptNode[] Arguments
Function arguments.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
Expression Expression
Expression of which the node is a part.
Definition: ScriptNode.cs:177
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Collection of variables.
Definition: Variables.cs:25
Basic interface for all types of elements.
Definition: IElement.cs:20
ArgumentType
Type of parameter used in a function definition or a lambda definition.
Definition: IFunction.cs:9