GCC Code Coverage Report


Directory: ./
File: src/sys/classes/rg/tests/test1f.F90
Date: 2025-10-04 04:19:13
Exec Total Coverage
Lines: 95 97 97.9%
Functions: 2 2 100.0%
Branches: 34 64 53.1%

Line Branch Exec Source
1 !
2 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3 ! SLEPc - Scalable Library for Eigenvalue Problem Computations
4 ! Copyright (c) 2002-, Universitat Politecnica de Valencia, Spain
5 !
6 ! This file is part of SLEPc.
7 ! SLEPc is distributed under a 2-clause BSD license (see LICENSE).
8 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9 !
10 ! Program usage: mpiexec -n <np> ./test1f [-help]
11 !
12 ! Description: Simple example that tests RG interface functions.
13 !
14 ! ----------------------------------------------------------------------
15 !
16 8 program main
17 #include <slepc/finclude/slepcrg.h>
18 6 use slepcrg
19 implicit none
20
21 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
22 ! Declarations
23 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24
25 RG rg
26 PetscInt i,n,inside,one
27 PetscMPIInt rank
28 PetscErrorCode ierr
29 PetscReal re,im
30 PetscScalar ar,ai,cr(10),ci(10)
31 PetscScalar vr(7),vi(7)
32 PetscScalar center
33 PetscReal radius,vscale,a,b,c,d
34
35 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
36 ! Beginning of program
37 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
38
39 6 one = 1
40
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(SlepcInitialize(PETSC_NULL_CHARACTER,ierr))
41
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallMPIA(MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr))
42
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGCreate(PETSC_COMM_WORLD,rg,ierr))
43
44 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
45 ! Ellipse
46 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
47
48
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGSetType(rg,RGELLIPSE,ierr))
49 6 center = 1.1
50 6 radius = 2
51 6 vscale = 0.1
52
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGEllipseSetParameters(rg,center,radius,vscale,ierr))
53
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGSetFromOptions(rg,ierr))
54
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGView(rg,PETSC_NULL_VIEWER,ierr))
55 6 re = 0.1
56 6 im = 0.3
57 #if defined(PETSC_USE_COMPLEX)
58 4 ar = re+im*PETSC_i
59 4 ai = 0.0
60 #else
61 2 ar = re
62 2 ai = im
63 #endif
64
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGCheckInside(rg,one,ar,ai,inside,ierr))
65
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (rank .eq. 0) then
66
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 if (inside >= 0) then
67 write(*,110) re, im, 'inside'
68 else
69 6 write(*,110) re, im, 'outside'
70 endif
71 endif
72 110 format ('Point (',F4.1,',',F4.1,') is ',A7,' the region')
73
74
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGComputeBoundingBox(rg,a,b,c,d,ierr))
75
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (rank .eq. 0) then
76 6 write(*,115) a, b, c, d
77 endif
78 115 format ('Bounding box: [',F4.1,',',F4.1,']x[',F4.1,',',F4.1,']')
79
80
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (rank .eq. 0) then
81 6 write (*,*) 'Contour points:'
82 endif
83 6 n = 10
84
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGComputeContour(rg,n,cr,ci,ierr))
85
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
66 do i=1,n
86 #if defined(PETSC_USE_COMPLEX)
87 40 re = PetscRealPart(cr(i))
88 40 im = PetscImaginaryPart(cr(i))
89 #else
90 20 re = cr(i)
91 20 im = ci(i)
92 #endif
93
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
66 if (rank .eq. 0) then
94 60 write(*,120) re, im
95 endif
96 enddo
97 120 format ('(',F7.4,',',F7.4,')')
98
99 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
100 ! Interval
101 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
102
103
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGSetType(rg,RGINTERVAL,ierr))
104 6 a = -1
105 6 b = 1
106 6 c = -0.1
107 6 d = 0.1
108
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGIntervalSetEndpoints(rg,a,b,c,d,ierr))
109
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGSetFromOptions(rg,ierr))
110
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGView(rg,PETSC_NULL_VIEWER,ierr))
111 6 re = 0.2
112 6 im = 0
113 #if defined(PETSC_USE_COMPLEX)
114 4 ar = re+im*PETSC_i
115 4 ai = 0.0
116 #else
117 2 ar = re
118 2 ai = im
119 #endif
120
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGCheckInside(rg,one,ar,ai,inside,ierr))
121
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (rank .eq. 0) then
122
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (inside >= 0) then
123 6 write(*,110) re, im, 'inside'
124 else
125 write(*,110) re, im, 'outside'
126 endif
127 endif
128
129 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
130 ! Polygon
131 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
132
133 #if defined(PETSC_USE_COMPLEX)
134 4 vr(1) = (0.0,2.0)
135 4 vr(2) = (1.0,4.0)
136 4 vr(3) = (2.0,5.0)
137 4 vr(4) = (4.0,3.0)
138 4 vr(5) = (5.0,4.0)
139 4 vr(6) = (6.0,1.0)
140 4 vr(7) = (2.0,0.0)
141 #else
142 2 vr(1) = 0.0
143 2 vi(1) = 1.0
144 2 vr(2) = 0.0
145 2 vi(2) = -1.0
146 2 vr(3) = 0.6
147 2 vi(3) = -0.8
148 2 vr(4) = 1.0
149 2 vi(4) = -1.0
150 2 vr(5) = 2.0
151 2 vi(5) = 0.0
152 2 vr(6) = 1.0
153 2 vi(6) = 1.0
154 2 vr(7) = 0.6
155 2 vi(7) = 0.8
156 #endif
157
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGSetType(rg,RGPOLYGON,ierr))
158 6 n = 7
159
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGPolygonSetVertices(rg,n,vr,vi,ierr))
160
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGSetFromOptions(rg,ierr))
161
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGView(rg,PETSC_NULL_VIEWER,ierr))
162 6 re = 5
163 6 im = 0.9
164 #if defined(PETSC_USE_COMPLEX)
165 4 ar = re+im*PETSC_i
166 4 ai = 0.0
167 #else
168 2 ar = re
169 2 ai = im
170 #endif
171
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGCheckInside(rg,one,ar,ai,inside,ierr))
172
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (rank .eq. 0) then
173
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
6 if (inside >= 0) then
174 4 write(*,110) re, im, 'inside'
175 else
176 2 write(*,110) re, im, 'outside'
177 endif
178 endif
179
180 ! *** Clean up
181
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
6 PetscCallA(RGDestroy(rg,ierr))
182
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
6 PetscCallA(SlepcFinalize(ierr))
183 1 end
184
185 !/*TEST
186 !
187 ! test:
188 ! suffix: 1
189 ! requires: !complex
190 !
191 ! test:
192 ! suffix: 1_complex
193 ! requires: complex
194 !
195 !TEST*/
196