Example #1
0
        private IMifEnergy CreateCubicAnisotropy(string[] lines)
        {
            string          name   = helper.GetName(lines[0]);
            int             number = helper.GetIndexOfStringContaining(lines, "K1");
            var             textK1 = helper.GetCodeToClosingBrace(lines, number, '{');
            IMifScalarField k1     = scalarFieldFactory.Create(textK1);

            number = helper.GetIndexOfStringContaining(lines, "axis1");
            var             textAxis = helper.GetCodeToClosingBrace(lines, number, '{');
            IMifVectorField axis1    = vectorFieldFactory.Create(textAxis);

            number   = helper.GetIndexOfStringContaining(lines, "axis2");
            textAxis = helper.GetCodeToClosingBrace(lines, number, '{');
            IMifVectorField axis2 = vectorFieldFactory.Create(textAxis);

            return(new CubicAnisotropy(name, k1, axis1, axis2));
        }
Example #2
0
        private IMifEnergy CreateUZeeman(string[] text)
        {
            string name       = _helper.GetName(text[0]);
            var    index      = _helper.GetIndexOfStringContaining(text, hRange);
            var    list       = GetHRange(_helper.GetCodeToClosingBrace(text, index, '{'));
            var    multiplier = text.Where(s => s.Contains(_multiplier)).
                                Select(s => s.Substring(s.IndexOf(_multiplier) + _multiplier.Length)).FirstOrDefault();

            multiplier = multiplier.Replace(" ", "");
            double multiplierValue = double.Parse(multiplier);

            return(new UZeeman(name, multiplierValue, list));
        }
        private IMifEnergy CreateTwoSurfaceExchange(string[] lines)
        {
            Surface surface1, surface2;
            double  sigma1, sigma2;
            string  name        = _helper.GetName(lines[0]);
            var     index       = _helper.GetIndexOfStringContaining(lines, _surface1);
            var     surfaceText = _helper.GetCodeToClosingBrace(lines, index, '{');

            surface1    = CreateSurface(surfaceText);
            index       = _helper.GetIndexOfStringContaining(lines, _surface2);
            surfaceText = _helper.GetCodeToClosingBrace(lines, index, '{');
            surface2    = CreateSurface(surfaceText);
            var sigmaText = GetValueOf(_sigma, lines);

            sigma1    = double.Parse(sigmaText);
            sigmaText = GetValueOf(_sigma + "2", lines);
            sigma2    = double.Parse(sigmaText);

            return(new TwoSurfaceExchange(name, sigma1, sigma2, surface1, surface2));
        }