Mesh partitioning

From The FEniCS project

Partitioning of a 16x16x16 tetrahedral grid of the unit cube into 20 sub domains with DOLFIN. DOLFIN uses SCOTCH for mesh partitioning.

Image:fenics-mesh-partitioning.png
# Python code
from dolfin import *

# Create mesh
mesh = UnitCube(16, 16, 16)

# Partition mesh
partitions = MeshFunction("uint")
mesh.partition(20, partitions)

# Plot mesh partition
plot(partitions)
// C++ code
#include <dolfin.h>
using namespace dolfin;

// Create mesh
UnitCube mesh(16, 16, 16);

// Partition mesh
MeshFunction<unsigned int> partitions;
mesh.partition(20, partitions);

// Plot mesh partition
plot(partitions);

Contributed by Anders Logg and Magnus Vikström

Personal tools