Beispiel #1
0
 public EomsElement()
 {
     ElementType         = "EOMS";
     Type                = EomsType.None;
     _initialFunction    = "";
     _evaluationFunction = "";
 }
Beispiel #2
0
 public void Clone(object value)
 {
     // Writes a deep (value-wise) copy onto the object from value
     if (value.GetType() == typeof(EquationsOfMotion))
     {
         EquationsOfMotion v = (EquationsOfMotion)value;
         EvaluationFunction = v.EvaluationFunction;
         InitialFunction    = v.InitialFunction;
         Type = v.Type;
     }
 }
Beispiel #3
0
        public override void FromXml(string source)
        {
            // Deserializes object from xml string
            XqlParser parser = new XqlParser();

            parser.LoadData(source);
            List <Hashtable> results = parser.Query("SELECT EOMSType, initFcn, evalFcn FROM " + ElementType);

            if (results.Count == 0)
            {
                throw new HsfElementException("Unable to parse " + ElementType + " from xml");
            }

            // Load enum
            Array posValues = Enum.GetValues(typeof(EomsType));

            foreach (EomsType v in posValues)
            {
                if (Enum.GetName(typeof(EomsType), v) == results[0]["EOMSType"].ToString())
                {
                    Type = v;
                }
            }

            // Load function?
            if (Type == EomsType.Scripted)
            {
                _initialFunction    = results[0]["initFcn"].ToString();
                _evaluationFunction = results[0]["evalFcn"].ToString();
            }
            else
            {
                _initialFunction    = "";
                _evaluationFunction = "";
            }
        }
Beispiel #4
0
 public EquationsOfMotion()
 {
     Type               = EomsType.scripted;
     InitialFunction    = "print";
     EvaluationFunction = "print";
 }