TDMS
Time Domain Maxwell Solver
All Classes Namespaces Files Functions Variables Typedefs Enumerations Macros Pages
mesh_base.h
Go to the documentation of this file.
1/**
2 * @file mesh_base.h
3 * @brief Generation of orientated mesh.
4 *
5 * Generate an oriented mesh on the surface of a cuboid within the FDTD grid.
6 */
7#pragma once
8
9#include "mat_io.h"
11
12/**
13 * @brief Generate a matrix of vertices which define a triangulation of a
14 * regular two dimensional grid.
15 *
16 * This function assumes that the space of interest is a 2d surface with
17 * coordinates (i,j). I0 represents the lowest value of i for any point on the
18 * rectangular grid and I1 the highest. Similarly for j. A value of k is
19 * constant. A line of the output matrix looks like:
20 *
21 * i1 j1 k i2 j2 k i3 j3 k
22 *
23 * Triangles are taken by subdividing squares in the grid in a regular manner.
24 *
25 * @param coordmap is an integer array with three entries. This array can be a
26 * permutation of {0,1,2}. This defines the mapping between i,j,k and the
27 * indices in the output matrix. For example, if coordmap = {0,1,2} then a row
28 * in the matric would look like:
29 *
30 * i1 j1 k i2 j2 k i3 j3 k
31 *
32 * If, however, we have coordmap = {2,1,0} then we would get
33 *
34 * k j1 i1 k j2 i2 k j3 i3
35 *
36 * This should be interpreted as original i columns moves to column k. original
37 * k column moves to column i.
38 *
39 * i
40 * I1 ^ . . . .
41 * | . . . .
42 * I0 | . . . .
43 * +------------>j
44 * J0 J1
45 *
46 * @param order specifies the direction of the surface normals of the triangles.
47 * This can take only 2 possible values +1 or -1. They have the following
48 * meaning:
49 *
50 * order = 1 means that the surface normal for a triangle in the:
51 * xy plane will || to the z-axis
52 * zy plane will || to the x-axis
53 * xz plane will || to the negative z-axis
54 *
55 * order = -1 means surface normals are in the opposite direction. The surface
56 * normal is assumed to be in the direction (p2-p1)x(p3-p1) where p1-p3 are the
57 * points which define the triangle, in the order that they are listed in the
58 * facet matrix.
59 *
60 * The space allocated by *vertexMatrix must be freed after use.
61 */
62void triangulatePlane(int I0, int I1, int J0, int J1, int K, int coordmap[],
63 int order, mxArray **vertexMatrix);
64void triangulatePlaneSkip(int I0, int I1, int J0, int J1, int K, int coordmap[],
65 int order, mxArray **vertexMatrix, int dI, int dJ);
66/**
67 * @brief
68 *
69 * @param vertexMatrix should be a 6 element array. Generates 6 arrays of facets
70 * using triangulatePlane. Each matrix is a plane of the cuboid which is defined
71 * by:
72 *
73 * Each matrix is a plane of the cuboid which is defined by:
74 * (I0,I1)x(J0,J1)x(K0,K1)
75 *
76 * Each vertexMatrix[i] should be destroyed after calling this function
77 *
78 * @param vertexMatrix 6-element array to write the triangulations to
79 * @param I0,I1,J0,J1,K0,K1 The Yee-cell indicies defining the cuboidal surface
80 */
81void triangulateCuboid(int I0, int I1, int J0, int J1, int K0, int K1,
82 mxArray **vertexMatrix);
83void triangulateCuboidSkip(int I0, int I1, int J0, int J1, int K0, int K1,
84 mxArray **vertexMatrix, int dI, int dJ, int dK);
85
86/**
87 * @brief Generates a triangulation of a cuboid defined the surface of a regular
88 * grid.
89 *
90 * The result is returned in a concise manner, ie, a list of vertices and a list
91 * of facets which index in to the list of vertices.
92 *
93 * The list of vertices is itself a list of indices in to the x, y and z grid
94 * label vectors. In this sense this function deals only with the topology of
95 * the cuboid and the mesh. An extra step is required to generate the actual
96 * mesh from the values returned by this function.
97 *
98 * The surface of the volume [I0,I1]x[J0,J1]x[K0,K1] is meshed by this function.
99 *
100 * @param vertices an array of vertices, each row is a numbered vertex.
101 * @param facets an array of facets each of which is created using 3 vertex
102 * indices. Each index is an index in to the vertices array.
103 * @param I0,I1,J0,J1,K0,K1 The Yee-cell indicies defining the cuboidal surface
104 */
105void conciseTriangulateCuboid(int I0, int I1, int J0, int J1, int K0, int K1,
106 mxArray **vertices, mxArray **facets);
107void conciseTriangulateCuboidSkip(int I0, int I1, int J0, int J1, int K0,
108 int K1,
109 const SurfaceSpacingStride &spacing_stride,
110 mxArray **vertices, mxArray **facets);
111
112void conciseCreateBoundary(int I0, int I1, int K0, int K1, mxArray **vertices,
113 mxArray **facets);
Includes MATLAB headers for I/O.
void triangulatePlane(int I0, int I1, int J0, int J1, int K, int coordmap[], int order, mxArray **vertexMatrix)
Generate a matrix of vertices which define a triangulation of a regular two dimensional grid.
Definition mesh_base.cpp:11
void triangulatePlaneSkip(int I0, int I1, int J0, int J1, int K, int coordmap[], int order, mxArray **vertexMatrix, int dI, int dJ)
Definition mesh_base.cpp:132
void conciseTriangulateCuboid(int I0, int I1, int J0, int J1, int K0, int K1, mxArray **vertices, mxArray **facets)
Generates a triangulation of a cuboid defined the surface of a regular grid.
Definition mesh_base.cpp:317
void triangulateCuboid(int I0, int I1, int J0, int J1, int K0, int K1, mxArray **vertexMatrix)
Definition mesh_base.cpp:258
Classes collecting parameters for the simulation.
A three-tuple of integers that contain the stride in each direction to extract the phasors on.
Definition simulation_parameters.h:53