Build a Workspace

To build a workspace, you'll need to create meshes for the fundamental region and for the sphere. For most applications you will also need to contruct the matrices which take the ODF to the pole figures.

ODF Mesh

To build a mesh to represent the ODF, you need to create a base mesh and then refine it to the desired level. The function CubBaseMesh returns the base mesh for the cubic fundamental region, and the function CubSymmetries returns the cubic symmetry group represented in quaternions. The mesh refinement is accomplished in the function RefineMesh by refining each tetrahedron uniformly in each direction. The example code below creates a mesh on the cubic fundamental region with a refinement level of three, meaning that each tetrahedron in the base mesh is refined to contain twenty-seven tetrahedra (three cubed).
cfr0 = CubBaseMesh;
csym = CubSymmetries;
cfr = RefineMesh(cfr0, 3, csym);

Sphere Mesh

The process to build a mesh on the sphere or on the hemisphere is similar. The base mesh is created with SphBaseMesh, which has an option to mesh the hemisphere instead of the full sphere. The refinement is still done with RefineMesh; in the two-dimensional case, a refinement level of ten (as in the code section below) refines each original triangle into one hundred. A final note is that the resulting mesh coordinates need to be normalized since the inscribed triangles are subdivided, but not projected onto the sphere.
sph0 = SphBaseMesh(2, 'Hemisphere', 'on'); % 2d sphere
sph = RefineMesh(sph0, 10);
sph.crd = UnitVector(sph.crd);

ODF-PF Matrices

Building the matrices which map the ODF to various pole figures is the most computationally intensive task of building a workspace. However, it need only be done once as you can save the resulting matrices in a matlab binary file. The matrices are all sparse and so take up relatively little space. The core function for creating the matrices is OdfPfMatrix, but this can be overwhelming on memory, so we recommend using the interface routine BuildOdfPfMatrix, which builds the matrices in blocks instead of all at once. Its arguments include the orientation mesh, , its symmetry group, the requested hkl and a list of target points on the sphere, usually the coordinates of the sphere mesh. It also requires the number of points per fiber. Each target point has a corresponding fiber in the orientation space. The resolution of the fiber integration is determined by the points per fiber argument. Finally, the argument, INVPF, controls whether to compute the usual pole figure or the inverse pole figure. The code section below computes the ODF to PF matrix for the meshes computed above for a [1 0 0] hkl with 1000 points per fiber, using blocks of fifty target points.
hkl = [1 0 0]';
ppf = 1000;
INVPF = 0;
block = 50;
odfpf = BuildOdfPfMatrix(hkl, ...
    cfr, CubSymmetries, ...
    sph, ppf, INVPF, block);

Examples

Examples are given for the cubic, hexagonal and orthorhombic workspaces. The process is nearly identical for each, so a function m-file, Workspace.m, is provided and used by each.