Integral Estimate Over a Triangulated Region
is a C++ program which
reads information defining a triangulation, and estimates the integral of
a function whose values are given at the nodes.
Note that this program only expects to recieve values of the function f(x,y)
at the nodes of the triangulation, that is, as a simple list of values. No formula
for f is expected or used. A much better estimate for the integral might
be possible if a formula for f(x,y) were available, in which case a higher
order quadrature scheme could be employed.
This program should be able to compute exactly the integrals of 1, x, y, and any
linear combination of these. It will only be able to approximate the integrals
of other functions, and the accuracy of the approximation will depend in part
on the size of the triangles in the triangulation.
where 'prefix' is the common prefix for the node, element, and value files
prefix_nodes.txt, the node coordinates;
prefix_elements.txt, the elements of the triangulation.
prefix_values.txt, the value (which may be a scalar or vector)
of some function at each node.
quad is the (scalar or vector) result of the integration estimate, which
is computed and printed out by the program.
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
TRIANGULATION_QUAD is available in
a C++ version and
a FORTRAN90 version and
a MATLAB version.
Related Data and Programs:
a C++ library which
defines quadrature rules for a variety of multidimensional reqions.
a C++ program which
estimates the integral of a function over a region defined by a tetrahedral mesh.
a FORTRAN77 library which
estimates the integral of a function
over a triangulated region.
a C++ library which
carries out various operations on order 3 ("linear") or order 6
a C++ program which
reads files 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.
Examples and Tests:
EXAMPLE is a set of nodes in the unit square, which have
been arranged into an order 3 triangulation.
the node file.
the element file.
the values file, containing 4 values at each node.
(These values are actually the values of 1, x, y, and x*y,
which have exact integrals of 1, 1/2, 1/2, and 1/4.)
Only the first three integrals will be estimated exactly.
the output file from the command
List of Routines:
MAIN is the main program for TRIANGULATION_QUAD.
CH_CAP capitalizes a single character.
CH_EQI is true if two characters are equal, disregarding case.
CH_TO_DIGIT returns the integer value of a base 10 digit.
FILE_COLUMN_COUNT counts the columns in the first line of a file.
FILE_ROW_COUNT counts the number of row records in a file.
I4_MAX returns the maximum of two I4's.
I4_MIN returns the minimum of two I4's.
I4MAT_DATA_READ reads data from an I4MAT file.
I4MAT_HEADER_READ reads the header from an I4MAT file.
I4MAT_TRANSPOSE_PRINT prints an I4MAT, transposed.
I4MAT_TRANSPOSE_PRINT_SOME prints some of an I4MAT, transposed.
MESH_BASE_ZERO ensures that the element definition is zero-based.
R8_ABS returns the absolute value of an R8.
R8_HUGE returns a "huge" R8.
R8_MAX returns the maximum of two R8's.
R8_MIN returns the minimum of two R8's.
R8MAT_DATA_READ reads the data from an R8MAT file.
R8MAT_HEADER_READ reads the header from an R8MAT file.
R8MAT_TRANSPOSE_PRINT prints an R8MAT, transposed.
R8MAT_TRANSPOSE_PRINT_SOME prints some of an R8MAT, transposed.
R8VEC_PRINT prints an R8VEC.
S_LEN_TRIM returns the length of a string to the last nonblank.
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 15 October 2009.