当前位置: 首页>>代码示例>>C#>>正文


C# IMesh.InitializeMesh方法代码示例

本文整理汇总了C#中IMesh.InitializeMesh方法的典型用法代码示例。如果您正苦于以下问题:C# IMesh.InitializeMesh方法的具体用法?C# IMesh.InitializeMesh怎么用?C# IMesh.InitializeMesh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IMesh的用法示例。


在下文中一共展示了IMesh.InitializeMesh方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test

        public void Test()
        {
            u = 100000;
            particles = new ParticleArrayStorage<Particle>(1000000);
            boundaryConditions = new BoundaryConditions
            {
                Top = new BoundaryCondition { Value = x => 0, Type = BoundaryConditionType.Neumann },
                Bottom = new BoundaryCondition { Value = x => 0, Type = BoundaryConditionType.Neumann },
                Left = new BoundaryCondition { Value = x => 0, Type = BoundaryConditionType.Dirichlet },
                Right = new BoundaryCondition { Value = x => u, Type = BoundaryConditionType.Dirichlet }
            };

            grid = new Grid2D();
            grid.InitializeGrid(5, 5, 0, 4, 0, 4);
            mesh = new Mesh2D();
            mesh.InitializeMesh(grid.N * grid.M);
            interpolator = new CloudInCellCurrentLinkage(particles, grid, mesh, false);
            poissonSolver = new Poisson2DFdmSolver(grid, boundaryConditions);
            poissonSolver.FdmMatrix = poissonSolver.BuildMatrix();
            var particle = new Particle(4, 1, 0, 0, 0, 0, 1);
            var particleId = particles.Add(particle);
            particles.Set(Field.PrevX, particleId, 2);
            particles.Set(Field.PrevY, particleId, 1);

            var cell = grid.FindCell(particles.Get(Field.X, particleId), particles.Get(Field.Y, particleId));
            particles.SetParticleCell(particleId, cell);

            interpolator.InterpolateDensity();
        }
开发者ID:vlad294,项目名称:PICSolver,代码行数:29,代码来源:PICTest.cs

示例2: Prepare

        public void Prepare(PICProject project)
        {
            w = project.Relaxation;
            backscattering = project.Backscattering;
            alfa = project.BackscatteringAlfa;
            beta = project.BackscatteringBeta;
            step = project.Step;
            u = project.Voltage;

            particles = new ParticleArrayStorage<Particle>(project.ParticlesCount);
            boundaryConditions = new BoundaryConditions
            {
                Top = new BoundaryCondition { Value = x => 0, Type = BoundaryConditionType.Neumann },
                Bottom = new BoundaryCondition { Value = x => 0, Type = BoundaryConditionType.Neumann },
                Left = new BoundaryCondition { Value = x => 0, Type = BoundaryConditionType.Dirichlet },
                Right = new BoundaryCondition { Value = x => u, Type = BoundaryConditionType.Dirichlet }
            };

            emitter = new Emitter2D(0, project.EmitterBottom, 0, project.EmitterTop, project.ParticlesCount, 0, 0, -0.5 * Constants.ChildLangmuirCurrent(project.Length, u), step);
            mover = new Leapfrog();
            grid = new Grid2D();
            grid.InitializeGrid(project.GridN, project.GridM, 0, project.Length, 0, project.Height);
            mesh = new Mesh2D();
            mesh.InitializeMesh(grid.N * grid.M);
            interpolator = new CloudInCellCurrentLinkage(particles, grid, mesh, false);
            poissonSolver = new Poisson2DFdmSolver(grid, boundaryConditions);
            poissonSolver.FdmMatrix = poissonSolver.BuildMatrix();
            h = step * Constants.LightVelocity;
            Monitor = new PICMonitor(grid, mesh, particles, this);
            density = new double[grid.N * grid.M];
            Trajectories = new List<Tuple<int, double, double>>(particles.Count * 1000);
        }
开发者ID:vlad294,项目名称:PICSolver,代码行数:32,代码来源:IterativePICSolver2D.cs


注:本文中的IMesh.InitializeMesh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。