-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtriangulation_2d_example.f90
More file actions
42 lines (32 loc) · 1.01 KB
/
Copy pathtriangulation_2d_example.f90
File metadata and controls
42 lines (32 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
program example
use iso_fortran_env
use fplot_core
implicit none
! Parameters
integer(int32), parameter :: npts = 1000
real(real64), parameter :: pi = 2.0d0 * acos(0.0d0)
! Local Variables
type(delaunay_tri_2d) :: tri
real(real64) :: x(npts), y(npts), theta(npts), radius(npts)
type(plot_2d) :: plt
type(plot_data_tri_2d) :: ds
! Initialization
call random_number(theta)
theta = 2.0d0 * pi * theta
call random_number(radius)
radius = radius + 0.5d0
x = radius * cos(theta)
y = radius * sin(theta)
! Create a 2D triangulation from the data
call tri%create(x, y)
! Display the number of points and elements
print '(A, I0, A, I0, A)', "The triangulation consists of ", &
tri%get_point_count(), " points, and ", tri%get_triangle_count(), &
" triangles."
! Plot the triangulation
call plt%initialize()
call plt%set_font_size(14)
call ds%define_data(tri)
call plt%push(ds)
call plt%draw()
end program