Example #1
0
        // METHODS
        public Mesh GenerateMesh(IPhysicalModel model, MeshProperties props)
        {
            Mesh mesh = null;

            FileInfo fileInfo = new FileInfo(gmshExecutionPath);

            if (fileInfo.Exists)
            {
                DateTime now          = DateTime.Now;
                string   prefix       = $"{now.Year}-{now.Month}-{now.Day}--{now.Hour}-{now.Minute}-{now.Second}-{now.Millisecond}";
                string   geometryFile = Path.Combine(fileInfo.DirectoryName, $"{prefix}.geo");
                string   meshFile     = Path.Combine(fileInfo.DirectoryName, $"{prefix}.msh");
                GenerateGeometryFile(geometryFile, model.GetSurfaces(), props);
                ExecuteGmsh(geometryFile, meshFile);
                mesh = ReadMeshFile(meshFile);
            }

            return(mesh);
        }