Abscissae and weights of an integration rule on a reference element.
Create with the constructor, q = cubature(CUB_HEX, 3), or in place
with call q%set(CUB_HEX, 3). Integrate with
sum(q%weights * f(q%abscissae)) or a loop over q%npoints.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public | :: | elm | = | 0 |
Element type, |
|
| integer, | public | :: | dim | = | 0 |
Spatial dimension |
|
| integer, | public | :: | degree(3) | = | 0 |
Degree of exactness, see module documentation |
|
| integer, | public | :: | npoints | = | 0 |
Number of points |
|
| real(kind=rk), | public, | allocatable | :: | abscissae(:,:) |
Abscissae, shape |
||
| real(kind=rk), | public, | allocatable | :: | weights(:) |
Weights, shape |
Construct a rule, e.g. cubature(CUB_TRI, 4) or cubature(CUB_HEX, [3, 3, 1])
Construct a rule of degree degree in every direction
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | elm |
Element type, |
||
| integer, | intent(in) | :: | degree |
Degree of exactness |
Construct a rule with per-direction degrees
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | elm |
Element type, |
||
| integer, | intent(in) | :: | degree(:) |
Degrees of exactness, size 1 or number of directions |
Build the rule in place
Build a rule of degree degree in every direction
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cubature), | intent(inout) | :: | self | |||
| integer, | intent(in) | :: | elm |
Element type, |
||
| integer, | intent(in) | :: | degree |
Degree of exactness |
Build a rule with per-direction degrees.
degree has size 1 (same degree in every direction) or ndegrees(elm):
1 for CUB_LIN, CUB_TRI, CUB_TET; 2 for CUB_QUA, CUB_WED
(triangle, axial); 3 for CUB_HEX. Stops on invalid input.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cubature), | intent(inout) | :: | self | |||
| integer, | intent(in) | :: | elm |
Element type, |
||
| integer, | intent(in) | :: | degree(:) |
Degrees of exactness |
True if the rule is set and consistent
True if the rule is set and its arrays are consistent
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cubature), | intent(in) | :: | self |
Write element, dimension, degrees, points
Write element type, dimension, degrees and number of points
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cubature), | intent(in) | :: | self | |||
| integer, | intent(in), | optional | :: | unit |
Output unit, default |
Write the summary, points and weights
Write the summary, every abscissa and weight, and the weight sum
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cubature), | intent(in) | :: | self | |||
| integer, | intent(in), | optional | :: | unit |
Output unit, default |
Deallocate and reset
Deallocate and reset to the unset state
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(cubature), | intent(inout) | :: | self |
type :: cubature !! Abscissae and weights of an integration rule on a reference element. !! !! Create with the constructor, `q = cubature(CUB_HEX, 3)`, or in place !! with `call q%set(CUB_HEX, 3)`. Integrate with !! `sum(q%weights * f(q%abscissae))` or a loop over `q%npoints`. integer :: elm = 0 !! Element type, `CUB_*` integer :: dim = 0 !! Spatial dimension integer :: degree(3) = 0 !! Degree of exactness, see module documentation integer :: npoints = 0 !! Number of points real(rk), allocatable :: abscissae(:,:) !! Abscissae, shape `[dim, npoints]` real(rk), allocatable :: weights(:) !! Weights, shape `[npoints]` contains generic :: set => set_iso, set_aniso !! Build the rule in place procedure, private :: set_iso procedure, private :: set_aniso procedure :: is_valid !! True if the rule is set and consistent procedure :: summary !! Write element, dimension, degrees, points procedure :: show !! Write the summary, points and weights procedure :: destroy !! Deallocate and reset end type cubature