private void GenerateMethods(int inGrade1, int inGrade2)
        {
            var gpCaseText = new ListComposer("," + Environment.NewLine);

            var gradesList =
                DualFlag
                ? Frame.GradesOfEGp(inGrade1, inGrade2)
                .Select(grade => Frame.VSpaceDimension - grade)

                : Frame.GradesOfEGp(inGrade1, inGrade2);

            foreach (var outGrade in gradesList)
            {
                var funcName = BladesLibraryGenerator.GetBinaryFunctionName(OperatorName, inGrade1, inGrade2, outGrade);

                BladesLibraryGenerator.GenerateBilinearProductMethodFile(
                    OperatorName,
                    funcName,
                    inGrade1,
                    inGrade2,
                    outGrade
                    );

                gpCaseText.Add(Templates["gp_case"],
                               "frame", FrameTargetName,
                               "grade", outGrade,
                               "name", funcName
                               );
            }

            var name = BladesLibraryGenerator.GetBinaryFunctionName(OperatorName, inGrade1, inGrade2);

            _mainFileGenerator.GenerateIntermediateMethod(gpCaseText.ToString(), name);
        }
Esempio n. 2
0
        private void GenerateMethods(int inputGrade)
        {
            var gpCaseText = new ListComposer("," + Environment.NewLine);

            var gradesList = CurrentFrame.GradesOfEGp(inputGrade, inputGrade);

            foreach (var outputGrade in gradesList)
            {
                var funcName =
                    BladesLibraryGenerator
                    .GetBinaryFunctionName(OperatorName, inputGrade, inputGrade, outputGrade);

                GenerateMethod(
                    funcName,
                    inputGrade,
                    outputGrade
                    );

                gpCaseText.Add(Templates["selfgp_case"],
                               "frame", CurrentFrameName,
                               "grade", outputGrade,
                               "name", funcName
                               );
            }

            TextComposer.AppendAtNewLine(
                Templates["selfgp"],
                "frame", CurrentFrameName,
                "name", BladesLibraryGenerator.GetBinaryFunctionName(OperatorName, inputGrade, inputGrade),
                "double", GMacLanguage.ScalarTypeName,
                "selfgp_case", gpCaseText
                );
        }
        public string GetCasesText()
        {
            var t2 = Templates["bilinearproduct_main_case"];

            var casesText = new ListComposer(Environment.NewLine);

            foreach (var grade1 in CurrentFrame.Grades())
            {
                foreach (var grade2 in CurrentFrame.Grades())
                {
                    if (IsLegalGrade(grade1, grade2) == false)
                    {
                        continue;
                    }

                    var grade = GetFinalGrade(grade1, grade2);

                    var id = grade1 + grade2 * CurrentFrame.GradesCount;

                    var name = BladesLibraryGenerator.GetBinaryFunctionName(OperatorName, grade1, grade2, grade);

                    casesText.Add(t2,
                                  "name", name,
                                  "id", id,
                                  "g1", grade1,
                                  "g2", grade2,
                                  "grade", grade,
                                  "frame", CurrentFrameName
                                  );
                }
            }

            return(casesText.ToString());
        }
        private void GenerateMainMethod()
        {
            var casesText = new ListComposer(Environment.NewLine);

            foreach (var inGrade1 in CurrentFrame.Grades())
            {
                foreach (var inGrade2 in CurrentFrame.Grades())
                {
                    var id = inGrade1 + inGrade2 * CurrentFrame.GradesCount;

                    casesText.Add(Templates["dp_main_case"],
                                  "name", BladesLibraryGenerator.GetBinaryFunctionName(OperatorName, inGrade1, inGrade2),
                                  "id", id,
                                  "g1", inGrade1,
                                  "g2", inGrade2,
                                  "frame", CurrentFrameName
                                  );
                }
            }

            TextComposer.AppendAtNewLine(
                Templates["dp_main"],
                "name", OperatorName,
                "frame", CurrentFrameName,
                "cases", casesText
                );
        }
        private void GenerateMethods(int inGrade1, int inGrade2)
        {
            var gpCaseText = new ListComposer(Environment.NewLine);
            var gradesList = CurrentFrame.GradesOfEGp(inGrade1, inGrade2).OrderByDescending(grade => grade);

            foreach (var outGrade in gradesList)
            {
                var funcName = BladesLibraryGenerator.GetBinaryFunctionName(DefaultMacro.EuclideanBinary.GeometricProduct, inGrade1, inGrade2, outGrade);

                gpCaseText.Add(Templates["dp_case"],
                               "name", funcName,
                               "num", CurrentFrame.KvSpaceDimension(outGrade),
                               "frame", CurrentFrameName,
                               "grade", outGrade
                               );
            }

            TextComposer.AppendAtNewLine(
                Templates["dp"],
                "frame", CurrentFrameName,
                "name", BladesLibraryGenerator.GetBinaryFunctionName(OperatorName, inGrade1, inGrade2),
                "double", GMacLanguage.ScalarTypeName,
                "dp_case", gpCaseText
                );
        }
        public override void Generate()
        {
            GenerateBladeFileStartCode();

            var t2 = Templates["applyversor_main_case"];

            var casesText = new ListComposer(Environment.NewLine);

            foreach (var inGrade1 in CurrentFrame.Grades())
            {
                foreach (var inGrade2 in CurrentFrame.Grades())
                {
                    var outGrade = inGrade2;

                    var id = inGrade1 + inGrade2 * CurrentFrame.GradesCount;

                    var name = BladesLibraryGenerator.GetBinaryFunctionName(OperatorName, inGrade1, inGrade2, outGrade);

                    casesText.Add(t2,
                                  "name", name,
                                  "id", id,
                                  "g1", inGrade1,
                                  "g2", inGrade2,
                                  "grade", outGrade,
                                  "frame", CurrentFrameName
                                  );
                }
            }

            TextComposer.AppendAtNewLine(
                Templates["applyversor_main"],
                "name", OperatorName,
                "frame", CurrentFrameName,
                "cases", casesText
                );

            GenerateBladeFileFinishCode();

            FileComposer.FinalizeText();
        }
Esempio n. 7
0
        private void GenerateMainMethod()
        {
            var casesTemplate = Templates["selfgp_main_case"];

            var casesText = new ListComposer(Environment.NewLine);

            foreach (var grade in CurrentFrame.Grades())
            {
                casesText.Add(
                    casesTemplate,
                    "name", BladesLibraryGenerator.GetBinaryFunctionName(OperatorName, grade, grade),
                    "grade", grade,
                    "frame", CurrentFrameName
                    );
            }

            TextComposer.AppendAtNewLine(
                Templates["selfgp_main"],
                "name", OperatorName,
                "frame", CurrentFrameName,
                "cases", casesText
                );
        }