Morpho Lang Morpho Versions Save

The Morpho language 🦋. Morpho is a small embeddable language for scientific computing applications.

v0.6.0

1 month ago

Release notes for 0.6.0

We're pleased to announce Morpho 0.6.0, which represents a great deal of behind-the-scenes work to ready the Morpho codebase for future developments. See our Roadmap document for more details.

Morpho now built as a shared library

Rather than the previous monolithic strucutre, the Morpho codebase has been divided into a shared library ("libmorpho") and a terminal application ("morpho-cli"). This means that Morpho can easily be embedded in other applications, and improves maintainability as these components can be updated separately. Morphoview has been migrated to a separate repository.

Internal improvements

  • Major code reorganization to improve the logical structure and maintainability of the morpho codebase.
  • Transitioned to Cmake build system to improve cross-platform compilation.
  • Rewritten parser to improve error reporting and enable reuse across Morpho.

Improved quadrature

Functionals like LineIntegral, AreaIntegral and VolumeIntegral can now make use of a greatly improved quadrature routine. This will become the default in future versions of Morpho. Particularly in 3D, the new routine offers significantly improved performance, and can be extended in future. To use the new quadrature routine simply set the method optional argument:

var a = AreaIntegral(integrandfn, method = {})

The method Dictionary can specifically request particular quadrature rules or orders; more information will be in the dev guide.

Namespaces

You can now use the import keyword with a new keyword, as, to import the contents of a module into a given namespace:

import color as col

print col.Red 

This helps Morpho programs avoid library conflicts and improves modularization.

Tuple data type

Morpho now supports Tuples, an ordered immutable collection. The syntax is similar to Python:

var t = (0,1,2,3)

Tuples act much like Lists, but can be used as keys in a Dictionary.

JSON import and export

Morpho now provides a JSON class which supports import and output using the JavaScript Object Notation (JSON) format, widely used for data interchange.

var a = JSON.parse("[1,2,3]")
print a 

Minor new features

  • Formatted output for numbers is now available using the format method on the Int and Float classes.
  • Errors can now be raised as "warnings", which are alerts to the user that do not interrupt execution.

Improved documentation

Many previously un- or under-documented features have now been added to the interactive help. If you notice something that isn't well documented, please alert us via the issue tracker in Github.

Minor fixes

  • Many improvements to the debugger, including better support for printing object properties.
  • Improved calculation of derivatives.
  • Bugfixes to closures, string interpolation, parallel force and energy calculations and many others.

v0.6.0-alpha

2 months ago

Prerelease for v0.6.0.

v0.5.7

11 months ago

0.5.7 is the final release in the 0.5 series. This release contains a number of improvements and bugfixes:

Windows install instructions fixed

We have updated the installation instructions for Windows with this release to work with either WSL1 or WSL2.

Gradients in AreaIntegral and VolumeIntegral

You can now compute the local gradient of a field using the grad() function within the integrand supplied to AreaIntegral and VolumeIntegral. This significantly enhances the number of models morpho can handle.

Improved System class

  • System.print(), System.readline() and System.sleep() methods added.

  • System.clock() now reports wall time (useful for testing the effect of parallelization)

  • System.arguments() provides access to the command line options morpho was run with.

Minor improvements

  • New Matrix.roll() and List.roll() methods shift the contents of a List or Matrix respectively.

  • Field.linearize() provides access to the underlying Matrix store.

  • IdentityMatrix() constructor function.

  • Debugger now supports printing of global variables and object properties.

  • Fix issues with compilation on some platforms.

  • Experimental support for accessing integrand values for individual elements on some functionals.

  • Numerous minor bugfixes.

v0.5.6

1 year ago
  • Parallelized force and energy calculations
  • New ways to extend morpho
  • New manual chapter on visualization
  • Many improvements and bugfixes

Parallelized Force and Energy calculations

Morpho now supports parallelized force and energy calculations, which can lead to significant speedups for some programs. To use these, run morpho with -w flag and supply the number of worker threads to use:

morpho5 -w4 program.morpho

Further features for parallel programming will appear in future releases.

Resources and Packages

The morpho runtime can now look for resource files---help files, morpho files, etc.---in multiple places. The default location is now configurable at installation, and also via a .morphopackages file stored in the user home directory. This enables morpho modules to live in their own git repository, together with resource files, and should make it easier for users to contribute to morpho. More details are in the dev guide.

Extensions

It's now possible to extend morpho through dynamic libraries written in C and linked at runtime. From the user's perspective, these work just like modules using the import keyword.

New manual chapter on visualization

We continue to improve the manual, and now include a chapter on visualization. The developer guide has also been updated.

Other improvements

  • Improvements to morpho's object model. New Function, Closures and Invocation classes provided that respond to standard methods.
  • Fixes to some functionals to work correctly with 2D meshes.
  • You can now supply anonymous functions in the arguments to a function.
  • You can set the minimum and maximum values for plotfield using the optional cmin and cmax and arguments.
  • Manual contains additional information on installation

v0.5.6-rc1

1 year ago

Morpho 0.5.6 includes:

Parallelized Force and Energy calculations

Morpho now supports parallelized force and energy calculations, which can lead to significant speedups for some programs. To use these, run morpho with -w flag and supply the number of worker threads to use:

morpho5 -w4 program.morpho

Further features for parallel programming will appear in future releases.

Resources and Packages

The morpho runtime can now look for resource files---help files, morpho files, etc.---in multiple places. The default location is now configurable at installation, and also via a .morphopackages file stored in the user home directory. This enables morpho modules to live in their own git repository, together with resource files, and should make it easier for users to contribute to morpho. More details are in the dev guide.

Extensions

It's now possible to extend morpho through dynamic libraries written in C and linked at runtime. From the user's perspective, these work just like modules using the import keyword.

Other improvements

  • Improvements to morpho's object model. New Function, Closures and Invocation classes provided that respond to standard methods.
  • Fixes to some functionals to work correctly with 2D meshes.
  • You can now supply anonymous functions in the arguments to a function.
  • You can set the minimum and maximum values for plotfield using the optional cmin and cmax and arguments.
  • Manual contains additional information on installation

v0.5.5

1 year ago

Release notes for 0.5.5

  • Significantly improved performance, particularly on mesh generation.
  • Improved manual and new developer's guide.
  • New developer tools, including a debugger and profiler.
  • Improvements to linear algebra functionality.
  • Mixins

Documentation

We have added two new chapters to the manual, one on working with Meshes and the other describing the examples in detail. Additional chapters to follow. We've also improved the formatting of the manual, and a number of previously undocumented features are now documented in the manual and in the interactive help. A first draft of a developers guide, to be expanded on further, is also included.

Developer tools

Morpho now provides a profiler and a rewritten debugger. To use these, run with -profile or -debug respectively. Upon completion, the profiler will produce a report of the fraction of program execution time spent in each morpho function, allowing the programmer to identify optimization targets. We've used this tool to significantly improve a number of morpho components.

Mixins

You can now create a class from multiple other classes (called a mixin) using the new with keyword:

class Foo is Boo with Hoo, Moo { ... }

Boo is the superclass of Foo, but methods defined in Hoo and Moo are copied into Foo before Foo's methods are defined. This enables greater modularity and facilitates code reuse.

New linear algebra features

Its now possible to convert Sparse matrices to dense matrices and vice-versa by passing them to the relevant constructor function, e.g.

var a = Sparse([[0,0,1],[1,1,1]])
var b = Matrix(a)

You can assemble matrices in block form using other matrices:

var c = Matrix([[a,0],[0,a]])

You can compute the eigenvalues and eigenvectors of a matrix with the new eigenvalues() and eigensystem() methods.

Preliminary work for numerical hessians is in place.

Other improvements

  • Interactive mode now supports UTF8 characters.
  • Object now provides respondsto() and has() to determine the available methods and properties respectively.
  • Optimizing compiler [off by default; run with -O flag] lays the groundwork for significant future performance improvements.
  • MeshGen and Delauney modules run significantly faster.
  • Hydrogel functional is faster and dimensionally independent.
  • Numerous minor bugfixes.

v0.5.4

1 year ago

v0.5.4, Oct 3 2022

  • Morphoview now supports text rendering. The graphics, plot and povray modules have been updated to support this, including new ScaleBar and plotmeshlabels.
  • Meshtools extensively revised, including new MeshPruner class to coarsen meshes. 3D refinement now supported. Improved refinement of Selections.
  • Variadic functions can accept variable numbers of parameters.
  • New System class will become a repository for new system-related functionality.
  • Many bugfixes.

Detailed notes:

Meshtools

The meshtools module has been extensively revised with many new features:

  • New MeshPruner class added that enables coarsening of meshes, analogous to MeshRefiner.
  • Refinement of 3D elements.
  • Refinement of selections is improved.
  • Bugfixes for MeshRefiner and MeshMerge to prevent duplicate elements being generated in some circumstances.

Text

The morphoview application now supports text rendering. A number of modules have been updated to take advantage of this:

  • plot now provides ScaleBar objects that are useful for plotfield, as well as plotmeshlabels to label a mesh with element ids.
  • graphics now provides a Text class for textual elements, and has some performance improvements.
  • color now provides a number of new ColorMaps: ViridisMap, InfernoMap, MagmaMap and PlasmaMap, all of which are more friendly for people with color vision deficiency.

Variadic functions

You can now create functions that accept a variable number of parameters. Arguments passed to a function can be accessed as a List.

fn func(x, ...v) {
    for (a in v) print a
}

Other improvements:

  • New VolumeIntegral module to complement AreaIntegral and LineIntegral.
  • Internal improvements to the morpho virtual machine.
  • A System class to enable you to get platform information.
  • Numerous bugfixes.
  • Numerous improvements to the documentation.
  • Improvements to the povray module.
  • New examples for plot module.
  • You can now translate the view in morphoview by right click and dragging or using alt-arrow keys.

v0.5.3

2 years ago

This version includes the following highlights:

  • Support for complex numbers with a Complex class.
  • FloryHuggins replaced with Hydrogel functional.
  • GaussianCurvature can now use geodesic curvature.
  • MeshSlice module enables taking a cross section of a mesh (often useful for visualization)
  • Added catenoid example.
  • Support for M1 processor (use Makefile.m1 to compile).
  • Improvements to continuous testing infrastructure.
  • Numerous bug fixes including in the File class, mesh saving, the vtk module, meshgen, and many others.

Detailed notes:

Full Changelog: https://github.com/Morpho-lang/morpho/compare/v0.5.2...v0.5.3

v0.5.2

2 years ago
  • New meshgen module to create meshes in 2D and 3D.
  • New delaunay module to create Delaunay triangulations in arbitrary dimensions.
  • New vtk module to load and save meshes and fields in VTK legacy format.
  • List, Array and Matrix slices (e.g. a[0..5] means elements 0 to 5 of a list)
  • Minor improvements to apply, min, max and bounds functions.
  • Code improvements to facilitate future expansion of Morpho.
  • Numerous bugfixes.

v0.5.1

2 years ago
  • Improvements to error handling:
    • Programs can now generate errors with the Error class.
    • Programs can handle errors that occur with try/catch.
  • FloryHuggins functional added for hydrogel simulations.
  • POVray module supports transparency.
  • Improvements to arrays.
  • Various bugfixes.