public SampleFactory(int nbSamples, int dim, bool integrate = false, int meshSteps = 1000, double maxNorm = 1.0,
                      bool zeroAmongEdges = false, bool computeAngles = false, bool computeAnalytical      = false, CurvatureType curvatureType = CurvatureType.NEGATIVE)
 {
     NbSamples         = nbSamples;
     Dim               = dim;
     MaxNorm           = maxNorm;
     Integrate         = integrate;
     MeshSteps         = meshSteps;
     ZeroAmongEdges    = zeroAmongEdges;
     ComputeAngles     = computeAngles;
     ComputeAnalytical = computeAnalytical;
     CurvatureType     = curvatureType;
 }
Ejemplo n.º 2
0
 /// <summary>
 ///     Defines the face curvature. Depends on DefineEdgeAngle
 /// </summary>
 private void DefineFaceCurvature()
 {
     if (Edges.Any(e => e == null || e.Curvature == CurvatureType.Undefined))
     {
         _curvature = CurvatureType.Undefined;
     }
     else if (Edges.All(e => e.Curvature != CurvatureType.Concave))
     {
         _curvature = CurvatureType.Convex;
     }
     else if (Edges.All(e => e.Curvature != CurvatureType.Convex))
     {
         _curvature = CurvatureType.Concave;
     }
     else
     {
         _curvature = CurvatureType.SaddleOrFlat;
     }
 }
Ejemplo n.º 3
0
        public static RiemannianSpace GetSpace(CurvatureType curvatureType, int dim)
        {
            switch (curvatureType)
            {
            case CurvatureType.FLAT:
                return(new EuclideanGeometry(dim));

            case CurvatureType.NEGATIVE:
            {
                if (dim == 2)
                {
                    return(new BeltramiKlein2Dim());
                }
                else
                {
                    return(new BeltramiKlein(dim));
                }
            }

            case CurvatureType.POSITIVE:
            default:
                throw new NotSupportedException($"Curvature type {curvatureType} is not yet supported!");
            }
        }
Ejemplo n.º 4
0
        public void TestLength(CurvatureType curvatureType)
        {
            var ambiantSpace  = Geometries.GetSpace(CurvatureType.NEGATIVE, 2);
            var randomSamples = Simplex.RandomSamples(NUMBER_SAMPLES, 2, ambiantSpace, true, MAX_NORM);
            var counter       = 0;

            foreach (var simplex in randomSamples)
            {
                foreach (var face in simplex.Faces)
                {
                    face.Integrate(MESH_STEPS, true);
                    var volumeAnalytical = face.Volume;
                    face.Integrate(MESH_STEPS, false);
                    var volume = face.Volume;

                    if (Math.Abs(volumeAnalytical - volume) >= TOLERANCE)
                    {
                        throw new Exception($"Deviation to high for simplex number {counter}");
                    }
                }

                counter++;
            }
        }
 public void SetCurvatureType(CurvatureType type)
 {
     currentCurvatureType = type;
 }