QUAD_MESH
Quadrilateral Meshes
QUAD_MESH
is a MATLAB library which
carries out operations involving meshes of quadrilaterals.
The mesh is the collection of quadrilaterals. Each quadrilateral
is termed an "element". The points used to define the shape of the
quadrilateral (the corners, and sometimes a few more points) are called
the "nodes".
Routines are available to:

evaluate "quality measures" for the mesh;

create a "node neighbor array" for each node;

create an "element neighbor array" for each element;

estimate the integral of a function over the region covered by the mesh;

plot the nodes and elements of a mesh;

determine the parts of the mesh that lie on the boundary;

sample points at random from the region covered by the mesh;

search a mesh to determine which element contains a point.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
QUAD_MESH is available in
a C++ version and
a FORTRAN90 version and
a MATLAB version.
Related Data and Programs:
FEM2D,
a data directory which
contains a description and examples of files that describe a 2D finite element model.
FEM_IO,
a MATLAB library which
reads or writes node, element and data files defining a finite element model.
FEM2D_PACK,
a MATLAB library which
handles various tasks associated with finite element meshes.
MESH_BANDWIDTH,
a MATLAB program which
returns the geometric bandwidth associated with a mesh of
elements of any order and in a space of arbitrary dimension.
MESH_DISPLAY,
a MATLAB program which
reads data defining a polygonal mesh and displays it, with optional numbering.
MESH_DISPLAY_OPENGL,
a C++ program which
reads files defining a polygonal mesh and displays an image using OpenGL.
QUAD_MESH,
a data directory which
defines a format for storing meshes of quadrilaterals over a 2D region.
QUAD_MESH_ORDER1_DISPLAY,
a MATLAB program which
plots piecewise constant data associated with a mesh of quadrilaterals;
QUAD_MESH_RCM,
a MATLAB program which
computes the reverse CuthillMcKee (RCM) reordering for nodes in a mesh of 4node
quadrilaterals.
TRIANGULATION,
a MATLAB library which
carries out operations involving meshes of triangular elements.
Reference:

Hans Rudolf Schwarz,
Methode der Finiten Elemente,
Teubner Studienbuecher, 1980,
ISBN: 3519023490.

Gilbert Strang, George Fix,
An Analysis of the Finite Element Method,
Cambridge, 1973,
ISBN: 096140888X,
LC: TA335.S77.

Olgierd Zienkiewicz,
The Finite Element Method,
Sixth Edition,
ButterworthHeinemann, 2005,
ISBN: 0750663200,
TA640.2.Z54
Source Code:

adj_bandwidth.m,
omputes the bandwidth of an adjacency matrix.

adj_perm_bandwidth.m,
omputes the bandwidth of a permuted adjacency matrix.

adj_set_q4_mesh.m,
sets the adjacencies in a Q4 mesh.

adj_size_q4_mesh.m,
counts adjacencies in a Q4 mesh.

area_q4_mesh.m,
computes areas of elements in a Q4 mesh;

area_quad.m,
return the area of a quadrilateral;

boundary_edge_count_q4_mesh.m,
counts boundary edges.

boundary_edge_count_euler_q4_mesh.m,
counts boundary edges using Euler's formula.

example1_q4_mesh.m,
sets up example #1 Q4 mesh.

example1_q4_mesh_size.m,
sets sizes for example #1 Q4 mesh.

example1_q4_mesh_plot.m,
plots example #1 Q4 mesh.

example1_q4_mesh_test.m

example2_q4_mesh.m,
sets up example #2 Q4 mesh.

example2_q4_mesh_size.m,
sets sizes for example #2 Q4 mesh.

example2_q4_mesh_plot.m,
plots example #2 Q4 mesh.

example2_q4_mesh_test.m

example3_q4_mesh.m,
sets up example #3 Q4 mesh.

example3_q4_mesh_size.m,
sets sizes for example #3 Q4 mesh.

example3_q4_mesh_plot.m,
plots example #3 Q4 mesh.

example3_q4_mesh_test.m

example4_q4_mesh.m,
sets up example #4 Q4 mesh.

example4_q4_mesh_size.m,
sets sizes for example #4 Q4 mesh.

example4_q4_mesh_plot.m,
plots example #4 Q4 mesh.

example4_q4_mesh_test.m

fem_bandwidth.m,
determines the bandwidth associated with the finite element mesh;

file_column_count.m,
counts the number of columns in the first line of a file.

file_row_count.m,
counts the number of row records in a file.

i4_modp.m,
computes the positive modulus of an I4.

i4_wrap.m,
wraps an I4.

i4col_compare.m,
compares two columns of an I4COL;

i4col_sort_a.m,
ascending sorts the columns of an I4COL;

i4col_sorted_unique_count.m,
counts the number of unique elements in a sorted I4COL;

i4col_swap.m,
swaps two columns of an I4COL;

i4mat_data_read.m,
reads data from an I4MAT file..

i4mat_header_read.m,
reads the header from an I4MAT file.

i4mat_transpose_print.m,
prints the transpose of an I4MAT.

i4mat_transpose_print_some.m,
prints some of the transpose of an I4MAT.

i4mat_write.m,
writes an I4MAT file.

i4vec_print.m,
prints an I4VEC.

mesh_base_one.m
detects and corrects 0based indexing.

node_order_q4_mesh.m,
determines the order of nodes in a Q4 mesh.

neighbor_elements_q4_mesh.m,
determines element neighbors in a Q4 mesh.

plot_q4_mesh.m,
plots a Q4 mesh.

r8_uniform_01.m,
returns a unit pseudorandom R8.

r8mat_data_read.m,
reads a table from an R8MAT file.

r8mat_header_read.m,
reads a table header from an R8MAT file.

r8mat_transpose_print.m,
prints the transpose of an R8MAT;

r8mat_transpose_print_some.m,
prints some of the transpose of an R8MAT;

r8mat_write.m,
writes an R8MAT file.

r8vec_print.m,
prints an R8VEC.

r8vec_uniform_01.m,
returns a unit pseudorandom R8VEC.

reference_to_physical_q4.m
maps points in a Q4 reference triangle into physical space.

s_len_trim.m,
returns the length of a character string to the last nonblank.

s_word_count.m,
counts the number of words in a string.

sample_q4_mesh.m,
randomly samples a point from a Q4 mesh;

sample_quad.m,
randomly samples a point from a quadrilateral;

sort_heap_external.m,
externally sorts a list of values into ascending order;

timestamp.m,
prints the current YMDHMS date as a timestamp.

triangle_area.m,
returns the area of a triangle;

triangle_sample.m,
randomly samples a point from a triangle;
Examples and Tests:

quad_mesh_test.m,
a sample calling program.

quad_mesh_test01.m,
tests ADJ_SIZE_Q4_MESH.

quad_mesh_test02.m,
tests AREA_Q4_MESH.

quad_mesh_test03.m,
tests AREA_QUAD.

quad_mesh_test04.m,
tests BOUNDARY_EDGE_COUNT_Q4_MESH.

quad_mesh_test05.m,
tests BOUNDARY_EDGE_COUNT_EULER_Q4_MESH.

quad_mesh_test08.m,
tests NEIGHBOR_ELEMENTS_Q4_MESH.

quad_mesh_test09.m,
writes data to files.

quad_mesh_test10.m,
tests NODE_ORDER_Q4_MESH.

quad_mesh_test105.m,
tests SAMPLE_Q4_MESH.

quad_mesh_test11.m,
tests SAMPLE_QUAD.

quad_mesh_test_output.txt,
the output file.
EXAMPLE1 is a mesh made up of squares of uniform size. The squares
are arranged in a grid with a few irregularities, however. In particular,
there is an interior hole.
EXAMPLE2 is a mesh made up of quadrilaterals that are "trying" to tile a
semicircle. The row of elements that touches the origin is degenerate, and
are essentially triangles. The elements vary in area.
SAMPLE_QUAD demonstrates how a single quadrilateral can be randomly sampled.

sample_quad.txt,
node coordinates for random sample points in a quadrilateral.

sample_quad.png,
a PNG image of the random sample points in a quadrilateral.
You can go up one level to
the MATLAB source codes.
Last revised on 18 September 2016.