Average Node Data to Create Element Data
is a C program which
reads datafiles describing a set of nodes, their triangulation, and the
value of one or more quantities at each node, and outputs a file
that averages the quantities for each element. This operation
in effect creates an "order1" finite element model of the data.
The program reads three data files:
a node file, containing
X, Y coordinates of points;
an element file,
containing a list of sets of three points making up each
triangular element; (if this file does not exist, the
program will generate the element data automatically).
a node values file,
containing the values of one or more data items
at each node.
an element values file,
containing the values of the data, averaged over
the nodes in each element.
prefix_nodes.txt, lists the node coordinates;
prefix_elements.txt lists the indices of nodes that form elements
(this file is optional, and if not supplied, the information will
be generated internally);
prefix_values.txt contains the value assigned to each node.
prefix_element_values.txt will contain the values averaged
over the nodes in each element.
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
TRIANGULATION_NODE_TO_ELEMENT is available in
a C version and
a C++ version and
a FORTRAN77 version and
a FORTRAN90 version and
a MATLAB version.
Related Data and Programs:
a C program which
reads information defining a 1D, 2D or 3D mesh, namely
a file of node coordinates and a file of elements defined by
node indices, and creates a corresponding XML file for input
to DOLFIN or FENICS.
a C library which
carries out various operations on order 3 ("linear") or order 6
a C++ program which
reads information about a 3-node (linear) triangulation and creates data
defining a corresponding 6-node (quadratic) triangulation;
a C++ program which
reads information about a 6-node (quadratic) triangulation
and creates data defining a corresponding 3-node (linear) triangulation;
Examples and Tests:
List of Routines:
MAIN is the main program for TRIANGULATION_NODE_TO_ELEMENT.
CH_CAP capitalizes a single character.
CH_EQI is a case insensitive comparison of two characters for equality.
CH_TO_DIGIT returns the integer value of a base 10 digit.
FILE_COLUMN_COUNT counts the number of columns in the first line of a file.
FILE_ROW_COUNT counts the number of row records in a file.
I4MAT_DATA_READ reads data from an I4MAT file.
I4MAT_HEADER_READ reads the header from an I4MAT.
I4MAT_TRANSPOSE_PRINT_SOME prints some of the transpose of an I4MAT.
I4MAT_WRITE writes an I4MAT file.
MESH_BASE_ONE ensures that the element definition is one-based.
R8MAT_DATA_READ reads data from an R8MAT file.
R8MAT_HEADER_READ reads the header from an R8MAT file.
R8MAT_TRANSPOSE_PRINT_SOME prints some of an R8MAT, transposed.
R8MAT_WRITE writes an R8MAT file.
S_TO_I4 reads an I4 from a string.
S_TO_I4VEC reads an I4VEC from a string.
S_TO_R8 reads an R8 from a string.
S_TO_R8VEC reads an R8VEC from a string.
S_WORD_COUNT counts the number of "words" in a string.
TIMESTAMP prints the current YMDHMS date as a time stamp.
You can go up one level to
the C source codes.
Last revised on 08 April 2014.