Mathematica 9 is now available

Wolfram Library Archive


All Collections Articles Books Conference Proceedings
Courseware Demos MathSource Technical Notes
Title Downloads

A Simple Mesh Generator in Mathematica
Author

Zhe Hu
Revision date

2004-11-18
Description

This Mathematica notebook is an effort to transcribe the MATLAB code of a 2-D mesh generation algorithm as described explicitly in Persson and Strang's paper [1]. The goal is to make the algorithm executable in Mathematica so that its users can also experiment with the algorithm.

Since the algorithm was expressed very clearly from their original paper [1] including the MATLAB code, which is a perfect example of literate programming in MATLAB, it is pretty easy to translate the MATLAB code "literally" into Mathematica. Such translation is virtually always possible in either direction even without human interference. And such a Rosetta Stone kind of translation might be useful if one species of people coding in either MATLAB or Mathematica were to disappear, future generations would still be able to rediscover one programming language by reading its interpretation in the other one.

However, it is so tempting to present the literate programming capability of Mathematica by following its general principles; that is, (a) documentation mingles with code and both get pretty-printed; (b) shuffle code pieces for human readability. I decided to transcribe the code manually.

The original MATLAB code was documented as 8 steps (sections) in sequential order, which is easy to follow because the ideas behind the code were explained beforehand in early parts of the paper. So it is recommended that you read part 1 and 2 of the original paper. Instead of following the MATLAB code literally in 8 steps, this notebook breaks the code pieces apart and examines each of them separately.
Subject

*Engineering > Finite Element Methods
Keywords

mesh generation, literate programming
Downloads

Download
MeshV01.zip (1015.7 KB) - ZIP archive [for Mathematica 5.0]