Programming Project
Resources by Kjetil André Johannessen for TMA4220.
Resources
- Grids - Mesh generation files required for first project
- WriteVTF - Write function for GLview native file format (.vtf)
- shell.m - Required for mesh generation in first project
- getplate.m - Used in some of the second project options
There follows of collection of resources related to computational geometries:
GMSH
Some students may find this free mesh generator/processor useful, available at gmsh. Tutorials etc. can be found on the site. For those wishing to use meshes created in this manner, the following cleanup scripts may be useful:
- removeUnused.m (for 3d meshes)
In addition, there is a gmsh to Matlab mesh converter: msh2m.cpp
You may compile the GMSH to Matlab converter (in Linux) by typing
g++ msh2m.cpp -o msh2m
and use this by typing
msh2m myGeometry.msh myMatlab
which will read the file myGeometry.msh and write the following files
myMatlab_pts.mmyMatlab_lines.mmyMatlab_tri.mmyMatlab_tetr.mmyMatlab_nodes.m
containing respectively all points specified, lines, triangles, tetrahedrons and nodal coordinates. For 2D examples, your elements would be in myMatlab_tri.m, the boundary elements in myMatlab_lines.m and the nodal coordinates in myMatlab_nodes.m
Minecraft
A simpler way of creating meshes is to build a structure on our dedicated minecraft server, and then convert this to a matlab triangulation by the supplied scripts. See minecraft.math.ntnu.no
Be aware that there may be some interruptions/irregularities in the server this week (16.10) as it is brought to life again!
Geometries
Here is a handful of sample geometries which you may download and play around with for your project. You may choose to use any of these in your final submission, or create your own.
- cake.zip - Princess cake skirt
- Queen.zip - Static mesh in three different resolutions. Chess queen
- King.zip - Static mesh in three different resolutions. Chess king
- Heart.zip - GMSH 2D heart
- getBeef.zip - matlab script for a beef
- Cheese.zip - GMSH script for a piece of swiss cheese
- dragon.zip - A Chinese dragon
- ball.zip - Solid unit ball
- penapple.zip - An apple-pen
Princess Cake
This is the geometry of the skirt for the princess cake. The volumetric tetrahedrals are seperated into two parts: those of the cake dough and those for the metal tube in the middle.
King & Queen
Heart
Beef
Cheese
A piece of swiss cheese. More food geometry for those doing heat equations or do you envision doing something else with it?
Dragon
Volumetric mesh from Stanford 3D Scanning repository
Solid ball
This is simply the unit ball as in problem set part 1. The difference is that this is created in GMSH, and may be easier to alter for your own creations. Note that the actual triangulation returned will be different from the getSphere.m matlab script.
Apple-pen
I got a pen… I got an apple… Apple-pen!









