コード例 #1
0
        public (List <Simplex>, List <SimplexComplex>) RandomSamples()
        {
            var riemannianSpace = Geometries.GetSpace(CurvatureType, Dim);
            var randomSimplices = Simplex.RandomSamples(NbSamples, Dim, riemannianSpace, ZeroAmongEdges, MaxNorm);
            var randomComplexes = new List <SimplexComplex>();
            var counter         = 0;

            foreach (var randomSimplex in randomSimplices)
            {
                var stopWatch = new Stopwatch();
                stopWatch.Start();

                var simplexComplex = new SimplexComplex(randomSimplex);
                simplexComplex.Propagate();

                if (Integrate)
                {
                    simplexComplex.Integrate(MeshSteps, null, ComputeAnalytical);
                }

                if (ComputeAngles)
                {
                    simplexComplex.ComputeAngles();
                }

                counter++;

                stopWatch.Stop();
                var sampleCreationEventArgs = new SampleCreationEventArgs(counter, NbSamples, stopWatch.Elapsed.TotalSeconds);
                OnSampleCreationEvent(sampleCreationEventArgs);
                randomComplexes.Add(simplexComplex);
            }

            return(randomSimplices, randomComplexes);
        }
コード例 #2
0
        protected virtual void OnSampleCreationEvent(SampleCreationEventArgs e)
        {
            EventHandler <SampleCreationEventArgs> handler = RaiseSampleCreatorEvent;

            if (handler != null)
            {
                handler(this, e);
            }
        }