Esempio n. 1
0
        private static void TestCuda()
        {
            var model = StructureGenerator.Generate3DFrameElementGrid(2, 2, 2);


            //model.Nodes[4].Constraints = model.Nodes[5].Constraints = model.Nodes[6].Constraints = Constraints.Fixed;

            //model.Nodes[7].Constraints = Constraint.FromString("011101");

            var t = model.Nodes.Select(i => i.Constraints).ToArray();

            StructureGenerator.AddRandomiseLoading(model, true, false, LoadCase.DefaultLoadCase);

            var config = new SolverConfiguration();

            //config.SolverFactory = new CudaSolver.CuSparseDirectSpdSolverFactory();
            config.LoadCases.AddRange(new List <LoadCase>()
            {
                LoadCase.DefaultLoadCase
            });

            model.Solve_MPC(config);
            //model.Solve(config);

            //model.Solve();

            var tmp = model.LastResult.Displacements.First().Value;
        }
Esempio n. 2
0
 public void SetUp()
 {
     Generator     = new StructureGenerator(Configuration);
     Configuration = new CodeGeneratorConfiguration().MediaTypes;
     Candidate     = Type = new CodeTypeDeclaration();
     ContentType   = new MediaType();
 }
Esempio n. 3
0
        private static void Test_P_Delta_matrix()
        {
            var model = StructureGenerator.Generate3DFrameElementGrid(10, 10, 10);


            var zs = model.Nodes.Where(i => i.Constraints != Constraint.Fixed)
                     .Select(i => i.Location.Z).Distinct().ToList();

            foreach (var z in zs)
            {
                var relm = new RigidElement_MPC();

                relm.Nodes.AddRange(model.Nodes.Where(i => i.Location.Z == z));

                model.MpcElements.Add(relm);

                relm.UseForAllLoads = true;
            }

            StructureGenerator.AddRandomDisplacements(model, 0.1);


            model.Clone();

            #region

            #endregion

            CalcUtil.GenerateP_Delta_Mpc(model, LoadCase.DefaultLoadCase, new DenseIrrefFinder());
        }
 public void SetUp()
 {
     Generator     = new StructureGenerator(Configuration);
     Configuration = new CodeGeneratorConfiguration().MediaTypes;
     attribute     = new CodeAttributeDeclaration("MediaType");
     contentType   = new MediaType();
 }
Esempio n. 5
0
        /// <summary>
        /// Generates all the POCOs that go in the Model namespace for the structures defined in the service model.
        /// </summary>
        void GenerateStructures()
        {
            var excludedOperations = config.ServiceModel.ExcludedOperations;

            foreach (var definition in this.config.ServiceModel.Structures)
            {
                if (!this.processedStructures.Contains(definition.Name) && !definition.IsException)
                {
                    // if the shape had a substitution, we can skip generation
                    if (this.config.ServiceModel.Customizations.IsSubstitutedShape(definition.Name))
                    {
                        continue;
                    }

                    // if the shape is a request or response type and the parent operation
                    // was excluded, then skip generation
                    var opName = definition.RelatedOperationName;
                    if (!string.IsNullOrEmpty(opName) && excludedOperations.Contains(opName))
                    {
                        continue;
                    }

                    var generator = new StructureGenerator()
                    {
                        ClassName = definition.Name,
                        Structure = definition
                    };
                    this.ExecuteGenerator(generator, definition.Name + ".cs", "Model");
                    this.processedStructures.Add(definition.Name);
                }
            }
        }
Esempio n. 6
0
        static void TestHingedInternalForce()
        {
            //test internal force of a beam with partially end release

            var model = StructureGenerator.Generate3DBarElementGrid(2, 1, 1);

            var bar = model.Elements[0] as BarElement;

            bar.StartReleaseCondition = Constraints.MovementFixed & Constraints.FixedRX;
            bar.EndReleaseCondition   = Constraints.MovementFixed & Constraints.FixedRX;

            //var ld = new Loads.UniformLoad() { Direction = Vector.K, Magnitude = -100 };

            var ld = new Loads.ConcentratedLoad()
            {
                Force = new Force(0, 0, -1, 0, 0, 0), ForceIsoLocation = new IsoPoint(0.0)
            };

            bar.Loads.Add(ld);

            model.Solve_MPC();

            var func = new Func <double, double>(xi => bar.GetExactInternalForceAt(xi).My);

            FunctionVisualizer.VisualizeInNewWindow(func, -1 + 1e-10, 1 - 1e-10, 100);
        }
Esempio n. 7
0
        private static void TestIntelMkl()
        {
            var model = StructureGenerator.Generate3DBarElementGrid(1, 1, 2);


            //model.Nodes[4].Constraints = model.Nodes[5].Constraints = model.Nodes[6].Constraints = Constraints.Fixed;

            //model.Nodes[7].Constraints = Constraint.FromString("011101");

            var t = model.Nodes.Select(i => i.Constraints).ToArray();

            StructureGenerator.AddRandomiseLoading(model, true, false, LoadCase.DefaultLoadCase);

            var config = new SolverConfiguration();

            config.SolverFactory = new IntelMklSolver.MklPardisoDirectSPDSolverFactory();
            config.LoadCases     = new List <LoadCase>()
            {
                LoadCase.DefaultLoadCase
            };

            model.Solve_MPC(config);
            //model.Solve(config);

            //model.Solve();

            var tmp = model.LastResult.Displacements.First().Value;
        }
        static void TestGrid()
        {
            var model = StructureGenerator.Generate3DBarElementGrid(10, 10, 10);

            model.Trace.Listeners.Add(new ConsoleTraceListener());

            model.Solve_MPC();
        }
Esempio n. 9
0
        private static void TestVisualize()
        {
            var model = StructureGenerator.Generate3DFrameElementGrid(2, 2, 2);

            StructureGenerator.AddRandomiseLoading(model, true, false, LoadCase.DefaultLoadCase);

            ModelVisualizerControl.VisualizeInNewWindow(model);
        }
Esempio n. 10
0
        static void testRrefTime()
        {
            var gen = StructureGenerator.Generate3DBarElementGrid(10, 10, 10);

            gen.Trace.Listeners.Add(new ConsoleTraceListener());


            gen.Solve_MPC();
        }
Esempio n. 11
0
        public void GenerateVault()
        {
            MFilesServerApplication mfserver = new MFilesServerApplication();

            mfserver.Connect(NetworkAddress: "mfbuilderdl01");
            Vault vault = mfserver.LogInToVault("{1C6A118E-DD8E-411C-8E6F-DAF8805FC781}");

            StructureGenerator.VaultToJsonFile(vault, "VaultStructure.json");
        }
Esempio n. 12
0
        private static void Test2()
        {
            var model = StructureGenerator.Generate3DFrameElementGrid(5, 5, 5);
            //StructureGenerator.AddRandomiseLoading(model, LoadCase.DefaultLoadCase);

            //var wrapped = SerializationObsolete.ObjectWrapper.Wrap(model);

            var data = DataContractSerializerHelper.SerializeXml(model);
        }
Esempio n. 13
0
    public void Finish()
    {
        chunk.UnlockLocalGroupForStructuring();

        chunk.BlocksWereUpdated();
        StructureGenerator.CheckNeighborNeedUpdate(chunk, flagHolder.Dequeue());
        Pools.intQN.Return(flagHolder);

        chunk.builtStructures = true;
    }
Esempio n. 14
0
        private void Test1()
        {
            var model = StructureGenerator.Generate3DFrameElementGrid(5, 5, 5);

            //StructureGenerator.AddRandomiseLoading(model, LoadCase.DefaultLoadCase);

            StructureGenerator.AddRandomiseLoading(model, true, false, LoadCase.DefaultLoadCase);


            new Frame3DDValidator(model).Validate();
        }
Esempio n. 15
0
    void Start()
    {
        /*
         * Brick b1 = new Brick(3, 1);
         * Brick b2 = new Brick(2, 2);
         * //Brick b3 = new Brick(3, 1);
         *
         * Structure s = new Structure(4, 4, 4);
         *
         * s.AddBrick(b1, 1, 1, 0, Direction.NORTH);
         * s.AddBrick(b2, 0, 0, 0, Direction.NORTH);
         * //s.AddBrick(b3, -1, 3, 0, Direction.NORTH);
         *
         * foreach(Brick piece in s.Pieces) {
         *  int[][] bounds = piece.GetBounds();
         *  Debug.LogFormat("Bounds: ({0}, {1}) to ({2}, {3})", bounds[0][0], bounds[0][1], bounds[1][0], bounds[1][1]);
         * }
         */

        //Random.InitState(12345);
        StructureGenerator sg = new StructureGenerator();

        sg.Generate();
        List <int[]> pages = sg.GetManualPages();

        int[] page = pages[0];

        printArray(page, 8);
        printArray(page.Rotate(1, 8, 8), 8);
        printArray(page.Rotate(2, 8, 8), 8);
        printArray(page.Rotate(3, 8, 8), 8);

        /*
         * for (int i = 0; i < 10; i++) {
         *  for (int j = 0; j < 10; j++) {
         *      Debug.LogFormat("i={0} j={1}", i, j);
         *      if (i == 3 && j == 5) {
         *          goto label1;
         *      }
         *      if (i == 7 && j == 2) {
         *          goto label2;
         *      }
         *      if (i == 9 && j == 3) {
         *          goto label3;
         *      }
         *      label1:;
         *  }
         *  label2:;
         * }
         * label3:
         * Debug.Log("DONE");
         */
    }
        public void PublishLipidProfile()
        {
            //var profile = (Profile)FhirParser.ParseResourceFromXml(File.ReadAllText(@"TestData\lipid.profile.xml"));
            var profile = (Profile)FhirParser.ParseResourceFromXml(File.ReadAllText(@"TestData\profile.hvlabresult.xml"));
            var pkp     = new ProfileKnowledgeProvider("hvlabres", @"c:\temp\dist\images");

            {
                var publisher = new ProfileTableGenerator(pkp);

                var result = File.ReadAllText(@"TestData\publish-header.cshtml");
                result += publisher.Generate(profile, false).ToString(System.Xml.Linq.SaveOptions.DisableFormatting);
                result += File.ReadAllText(@"TestData\publish-footer.cshtml");

                File.WriteAllText(@"c:\temp\publisher\" + pkp.GetLinkForProfileTable(profile), result);
            }

            {
                var publisher = new StructureGenerator(pkp);

                foreach (var structure in profile.Structure)
                {
                    var result = File.ReadAllText(@"TestData\publish-header.cshtml");
                    result += publisher.generateStructureTable(structure, false, profile)
                              .ToString(System.Xml.Linq.SaveOptions.DisableFormatting);
                    result += File.ReadAllText(@"TestData\publish-footer.cshtml");

                    File.WriteAllText(@"c:\temp\publisher\" + pkp.GetLinkForLocalStructure(profile, structure), result);
                }
            }

            {
                var dictgen = new DictHtmlGenerator(pkp);
                var result  = File.ReadAllText(@"TestData\publish-header.cshtml");
                result += dictgen.Generate(profile)
                          .ToString(System.Xml.Linq.SaveOptions.DisableFormatting);
                result += File.ReadAllText(@"TestData\publish-footer.cshtml");

                File.WriteAllText(@"c:\temp\publisher\" + pkp.GetLinkForProfileDict(profile), result);
            }

            {
                var vs = (ValueSet)FhirParser.ParseResourceFromXml(File.ReadAllText(@"TestData\hv-laboratory-result-interpretation-v1.xml"));

                var vsGen = new ValueSetGenerator(pkp);

                var result = File.ReadAllText(@"TestData\publish-header.cshtml");
                result += vsGen.generate(vs)
                          .ToString(System.Xml.Linq.SaveOptions.DisableFormatting);
                result += File.ReadAllText(@"TestData\publish-footer.cshtml");

                File.WriteAllText(@"c:\temp\publisher\" + "hv-laboratory-result-interpretation-v1.html", result);
            }
        }
Esempio n. 17
0
        private static void TestWithOpensees()
        {
            var model = StructureGenerator.Generate3DBarElementGrid(5, 5, 5);

            StructureGenerator.AddRandomiseLoading(model, true, false, LoadCase.DefaultLoadCase);
            StructureGenerator.AddRandomDisplacements(model, 0.3);


            model.Solve_MPC();

            OpenseesValidator.OpenseesValidate(model, LoadCase.DefaultLoadCase, false);
        }
 private void ResetVariables()
 {
     ga = null;
     lblStopWatch.Text     = "0.00";
     lblGenerations.Text   = "0";
     lblBestFitness.Text   = "0";
     timerCounter          = 0;
     gridResult.DataSource = new List <object>
     {
         new { From = "", To = "" }
     };
 }
Esempio n. 19
0
        private static void Test_P_Delta_matrix()
        {
            var model = StructureGenerator.Generate3DFrameElementGrid(2, 2, 2);


            var zs = model.Nodes
                     .Where(i => i.Constraints != Constraints.Fixed)
                     .Select(i => i.Location.Z).Distinct().ToList();


            foreach (var z in zs)
            {
                var relm  = new RigidElement_MPC();
                var relm2 = new RigidElement();

                relm.Nodes.AddRange(model.Nodes.Where(i => i.Location.Z == z));
                relm2.Nodes.AddRange(model.Nodes.Where(i => i.Location.Z == z));

                model.MpcElements.Add(relm);
                model.RigidElements.Add(relm2);

                relm.UseForAllLoads  = true;
                relm2.UseForAllLoads = true;
            }

            //StructureGenerator.AddRandomDisplacements(model, 0.1);

            /**/
            foreach (var node in model.Nodes)
            {
                if (node.Constraints == Constraints.Fixed)
                {
                    node.Settlements.Add(new Settlement(new Displacement(1, 0, 0, 0, 0, 0)));
                    node.Loads.Clear();
                }
            }
            /**/


            StructureGenerator.AddRandomiseLoading(model, true, false, LoadCase.DefaultLoadCase);

            //model.Clone();

            #region

            #endregion

            model.Solve();
            //CalcUtil.GenerateP_Delta_Mpc(model, LoadCase.DefaultLoadCase,new GaussRrefFinder());
            model.LastResult.AddAnalysisResult(LoadCase.DefaultLoadCase);
            model.LastResult.AddAnalysisResult_MPC(LoadCase.DefaultLoadCase);
        }
Esempio n. 20
0
        static void testRref()
        {
            var model = StructureGenerator.Generate3DBarElementGrid(10, 10, 10);

            var t = new VirtualConstraint();

            t.Nodes.Add(model.Nodes[0]);
            t.UseForAllLoads = true;
            t.Constraint     = Constraints.FixedDX;
            model.MpcElements.Add(t);

            CalcUtil.GenerateP_Delta_Mpc(model, LoadCase.DefaultLoadCase, new Mathh.CsparsenetQrDisplacementPermutationCalculator());
        }
Esempio n. 21
0
    public void GenerateBlockArray()
    {
        blocks = new Block[size.x * size.y * size.z];
        int index = 0;

        for (int x = 0; x < size.x; x++)
        {
            for (int y = 0; y < size.y; y++)
            {
                for (int z = 0; z < size.z; z++)
                {
                    int value = Mathf.CeilToInt(
                        Mathf.PerlinNoise((x + position.x + 84) / 32f, (z + position.z) / 32f) * 15f +
                        Mathf.PerlinNoise((x + position.x) / 64f, (z + position.z + 84) / 64f) * 27f +
                        Mathf.PerlinNoise((x + position.x - 612) / 16f, (z + position.z) / 16f) * 5f +
                        Mathf.PerlinNoise((x + position.x) / 4f, (z + position.z) / 4f + 64) +
                        Mathf.PerlinNoise((x + position.x + 8) / 24f, (z + position.z) / 24f - 8) * 12f + 84f
                        );

                    if (y + position.y > value)
                    {
                        if (y + position.y == value + 7 && Random.Range(0, 15) == 1)
                        {
                            StructureGenerator.GenerateWoodenPlatform(position, x, y, z, blocks);
                        }

                        index++;
                        continue;
                    }

                    if (y + position.y == value)
                    {
                        blocks[index] = Block.Grass;
                    }

                    if (y + position.y < value && y + position.y > value - 3)
                    {
                        blocks[index] = Block.Dirt;
                    }

                    if (y + position.y <= value - 3)
                    {
                        blocks[index] = Block.Stone;
                    }

                    index++;
                }
            }
        }
    }
        public static void Run()
        {
            var model = StructureGenerator.Generate3DTetrahedralElementGrid(10, 10, 201, 1, 1, 1);

            var e   = 210e9;
            var miu = 0.28;

            foreach (var elm in model.Elements)
            {
                if (elm is TetrahedronElement tet)
                {
                    tet.Material = Materials.UniformIsotropicMaterial.CreateFromYoungPoisson(e, miu);
                    tet.FixNodeOrder();
                }
            }

            var dx = model.Nodes.Max(i => i.Location.X) - model.Nodes.Min(i => i.Location.X);
            var dy = model.Nodes.Max(i => i.Location.Y) - model.Nodes.Min(i => i.Location.Y);
            var dz = model.Nodes.Max(i => i.Location.Z) - model.Nodes.Min(i => i.Location.Z);

            var l = dz;// model.Nodes.Max(i => i.Location.Z);

            var cnt = model.Nodes.Where(i => i.Location.Z == l);

            var f     = 1e7;
            var I     = dy * dx * dx * dx / 12;
            var rigid = new MpcElements.RigidElement_MPC()
            {
                UseForAllLoads = true
            };

            foreach (var node in cnt)
            {
                node.Loads.Add(new NodalLoad(new Force(f / cnt.Count(), 0, 0, 0, 0, 0)));
                rigid.Nodes.Add(node);
                //node.Constraints = Constraints.Released;
            }

            //model.MpcElements.Add(rigid);
            model.Trace.Listeners.Add(new ConsoleTraceListener());
            model.Solve_MPC();

            //Controls.ModelVisualizerControl.VisualizeInNewWindow(model);

            var delta = f * l * l * l / (3 * e * I);

            var t = cnt.Average(i => i.GetNodalDisplacement().DX);

            var ratio = delta / t;
        }
        public void GetIdStructure()
        {
            var ga1          = new StructureGenerator("H2O", 100, 2000, 0.20);
            var molecule1    = ga1.FindSolution();
            var idStructure1 = _linkService.GetIdStructure(molecule1.LinkEdges);

            Assert.AreEqual("HO2-OH2", idStructure1);

            var ga2          = new StructureGenerator("C2H6O", 100, 2000, 0.20);
            var molecule2    = ga2.FindSolution();
            var idStructure2 = _linkService.GetIdStructure(molecule2.LinkEdges);

            Assert.AreEqual("CC2-CH5-CO1-HC5-HO1-OC1-OH1", idStructure2);
        }
Esempio n. 24
0
        static void TestGrid()
        {
            var model = StructureGenerator.Generate3DBarElementGrid(10, 10, 10);

            model.Trace.Listeners.Add(new ConsoleTraceListener());

            model.Solve_MPC();

            Console.WriteLine("Total matrix rents: {0}", model.MatrixPool.TotalRents);
            //Console.WriteLine("Total matrix creates: {0}", Matrix.CreateCount);
            //Console.WriteLine("Total matrix destructs: {0}", Matrix.DistructCount);

            Console.ReadKey();
        }
Esempio n. 25
0
        public void Execute()
        {
            var    pkp       = new ProfileKnowledgeProvider("http://www.hl7.org/implement/standards/fhir/");
            var    generator = new StructureGenerator(Context.TargetDir, false, pkp);
            string s         = File.ReadAllText(Context.FullPath);
            var    profile   = (Profile)FhirParser.ParseResourceFromXml(s);

            foreach (var structure in profile.Structure)
            {
                var result = generator.generateStructureTable(structure, false, profile, "http://nu.nl/publisher.html", Context.Name)
                             .ToString(System.Xml.Linq.SaveOptions.DisableFormatting);

                File.WriteAllText(Context.TargetDir + "\\" + pkp.getLinkForStructure(Context.Name, structure.Name), result);
            }
        }
Esempio n. 26
0
        public void Execute()
        {
            var pkp = new ProfileKnowledgeProvider("http://www.hl7.org/implement/standards/fhir/");
            var generator = new StructureGenerator(Context.TargetDir, false, pkp);
            string s = File.ReadAllText(Context.FullPath);
            var profile = (Profile)FhirParser.ParseResourceFromXml(s);

            foreach (var structure in profile.Structure)
            {
                var result = generator.generateStructureTable(structure, false, profile, "http://nu.nl/publisher.html", Context.Name)
                        .ToString(System.Xml.Linq.SaveOptions.DisableFormatting);

                File.WriteAllText(Context.TargetDir + "\\" + pkp.getLinkForStructure(Context.Name, structure.Name), result);
            }
        }
        private void StartSearch()
        {
            try
            {
                CancelSearch();
                ClearCharts();

                var populationSize = Int32.Parse(this.txtPopulationSize.Text);
                var maxGenerations = Int32.Parse(this.txtMaxGenerations.Text);
                var mutationRate   = Double.Parse(this.txtMutationRate.Text);
                var nomenclature   = this.txtNomenclature.Text;

                StartTimer();
                this.searchThread = new Thread(() =>
                {
                    SetStatus("Iniciando população...");
                    ga = new StructureGenerator(nomenclature, populationSize, maxGenerations, mutationRate);
                    StartWatchers();
                    SetStatus("Procurando estrutura molecular...");
                    MoleculeGraph molecule = ga.FindSolution();

                    SetDataSource(gridResult, molecule.LinkEdges.Select(x => new
                    {
                        From = x.From.ToString(),
                        To   = x.To.ToString()
                    }).ToList());

                    SetStatus("Fim!");
                });
                searchThread.Start();

                new Task(() =>
                {
                    while (searchThread != null && searchThread.IsAlive)
                    {
                        Thread.Sleep(500);
                    }

                    SetEnabled(btnCancel, false);
                    SetEnabled(btnSearch, true);
                    timer1.Enabled = false;
                }).Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro: " + ex.Message);
            }
        }
        public static void Test1()
        {
            var model = StructureGenerator.Generate3DBarElementGrid(1, 1, 3);

            var mpc = new MpcElements.TelepathyLink(model.Nodes[1], model.Nodes[2]);

            mpc.ConnectDx = true;
            mpc.ConnectDy = true;

            model.Nodes[2].Loads.Add(new NodalLoad(new Force(1, 2, 3, 4, 5, 6)));

            mpc.UseForAllLoads = true;

            model.MpcElements.Add(mpc);

            model.Solve_MPC();
        }
Esempio n. 29
0
        public void PublishLipidProfileStructures()
        {
            var source  = new FileArtifactSource(true);
            var profile = (Profile)source.ReadResourceArtifact(new Uri("http://from.file/TestData/lipid.profile.xml"));

            var publisher = new StructureGenerator();

            foreach (var structure in profile.Structure)
            {
                var result = File.ReadAllText(@"TestData\publish-header.xml");
                result += publisher.generateStructureTable("bla.html", structure, false, @"c:\temp\publisher", false, profile, "http://nu.nl/publisher.html", "publisher.html")
                          .ToString(System.Xml.Linq.SaveOptions.DisableFormatting);
                result += File.ReadAllText(@"TestData\publish-footer.xml");

                File.WriteAllText(@"c:\temp\publisher\" + structure.Name + ".html", result);
            }
        }
Esempio n. 30
0
    public void GenerateBlockArray()
    {
        blocks = new Block[size.x * size.y * size.z];
        int index = 0;

        for (int x = 0; x < size.x; x++)
        {
            for (int y = 0; y < size.y; y++)
            {
                for (int z = 0; z < size.z; z++)
                {
                    // Генерация шума по оси Y - таким образом получаем псевдо случайную карту
                    int value = Mathf.CeilToInt(Mathf.PerlinNoise((x + position.x) / 32f, (z + position.z) / 32f) * 15f + 84f);

                    if (y + position.y > value)
                    {
                        // Генерация структур (платформ и тд)
                        if (y + position.y == value + 7 && Random.Range(0, 15) == 1)
                        {
                            StructureGenerator.GenerateWoodenPlatform(position, x, y, z, blocks);
                        }
                        index++;
                        continue;
                    }

                    if (y + position.y == value)
                    {
                        blocks[index] = Block.Grass;
                    }

                    if (y + position.y < value && y + position.y > value - 3)
                    {
                        blocks[index] = Block.Dirt;
                    }

                    if (y + position.y <= value - 3)
                    {
                        blocks[index] = Block.Stone;
                    }
                    index++;
                }
            }
        }

        StructureGenerator.GetWaitingBlock(position, blocks);
    }
Esempio n. 31
0
        private void CreateGrid_Click(object sender, RoutedEventArgs e)
        {
            var wnd = new Window2();

            var res = wnd.ShowDialog();

            if (!res.HasValue || !res.Value)
            {
                return;
            }

            var grd = StructureGenerator.Generate3DFrameElementGrid(wnd.Context.XSpans + 1, wnd.Context.YSpans + 1,
                                                                    wnd.Context.ZSpans + 1);

            if (wnd.Context.RandomLoads)
            {
                StructureGenerator.AddRandomiseLoading(grd, true, false);
            }

            Context.Model = grd;
        }
Esempio n. 32
0
 public async void Initialize(uint seed)
 {
     Seed = seed;
     var random = new FastRandom(Seed);
     var settings = await MainEngine.GetEngineInstance().GeneralSettings;
     m_sealevel = settings.SeaLevel;
     m_mountainHeight = settings.MountainHeight - m_sealevel;
     var rescale = settings.BiomeSampleRescale;
     m_detailScale = settings.DetailScale;
     m_sinkHoleDepth = settings.SinkHoleDepth;
     m_biomeThickness = settings.BiomeThickness;
     m_elevation = new SimplexNoise2D(random.NextUInt());
     m_detail = new SimplexNoise2D(random.NextUInt());
     m_detail2 = new SimplexNoise2D(random.NextUInt());
     m_volume = new SimplexNoise3D(random.NextUInt());
     m_voroni = new CellNoise2D(random.NextUInt());
     m_populator = new StructureGenerator(random.NextUInt());
     m_riverGenerator = new PathGenerator(random.NextUInt(), GetHeight);
     m_riverGenerator.InitializePathSystem(0, 0, 256);
     m_biomeGenerator = new BiomeGeneratorCollection(random.NextUInt(), GetHeight, settings.Biomes, rescale, m_sealevel, m_mountainHeight);
     m_provinceGenerator = new ProvinceGeneratorCollection(random.NextUInt(), GetHeight, settings.Provinces, rescale, m_sealevel, m_mountainHeight);
     IsInitialized = true;
 }