SPEED
GET_DIME_DG.f90
Go to the documentation of this file.
1! Copyright (C) 2012 The SPEED FOUNDATION
2! Author: Ilario Mazzieri
3!
4! This file is part of SPEED.
5!
6! SPEED is free software; you can redistribute it and/or modify it
7! under the terms of the GNU Affero General Public License as
8! published by the Free Software Foundation, either version 3 of the
9! License, or (at your option) any later version.
10!
11! SPEED is distributed in the hope that it will be useful, but
12! WITHOUT ANY WARRANTY; without even the implied warranty of
13! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14! Affero General Public License for more details.
15!
16! You should have received a copy of the GNU Affero General Public License
17! along with SPEED. If not, see <http://www.gnu.org/licenses/>.
18
40
41 subroutine get_dime_dg(nm, sd, tag_mat, cs_nnz_loc, cs_loc, &
42 nn_loc, local_n_num, ne_loc, local_el_num, &
43 xs,ys,zs,&
44 nel_dg_loc, nel_dg_glo, &
45 i4count, mpi_id, mpi_comm)
46
47 implicit none
48
49 include 'SPEED.MPI'
50
51 integer*4 :: nm, cs_nnz_loc, nn_loc, ne_loc, nel_dg_loc, nel_dg_glo
52 integer*4 :: im, nn, ie, ned, err_out
53 integer*4 :: ne1, ne2, ne3, ne4, ic1, ic2, ic3, ic4
54 integer*4 :: ne5, ne6, ne7, ne8, ic5, ic6, ic7, ic8
55 integer*4 :: mpi_comm, mpi_id, mpi_ierr
56
57 integer*4, dimension(nm) :: tag_mat, sd
58 integer*4, dimension(0:cs_nnz_loc) :: cs_loc
59 integer*4, dimension(nn_loc) :: local_n_num, i4count
60 integer*4, dimension(ne_loc) :: local_el_num
61
62 real*8, dimension(nn_loc) :: xs,ys,zs
63
64!************************************************************************************************
65! conto il numero di elemnti dg
66!************************************************************************************************
67
68 nel_dg_loc = 0
69 ned = cs_loc(0) - 1
70
71 do im = 1,nm
72
73 nn = sd(im) +1
74
75 do ie = 1,ned
76 if (cs_loc(cs_loc(ie -1) + 0) .eq. tag_mat(im)) then
77
78 ne1 = cs_loc(cs_loc(ie -1) +nn*nn*(1 -1) +nn*(1 -1) +(1 -1) +1)
79 ne2 = cs_loc(cs_loc(ie -1) +nn*nn*(1 -1) +nn*(nn -1) +(1 -1) +1)
80 ne3 = cs_loc(cs_loc(ie -1) +nn*nn*(nn -1) +nn*(nn -1) +(1 -1) +1)
81 ne4 = cs_loc(cs_loc(ie -1) +nn*nn*(nn -1) +nn*(1 -1) +(1 -1) +1)
82
83 if ((i4count(ne1).ne.0) .and. (i4count(ne2).ne.0) .and. (i4count(ne3).ne.0) .and. (i4count(ne4).ne.0)) then
84 nel_dg_loc = nel_dg_loc +1
85 endif
86
87 ne1 = cs_loc(cs_loc(ie -1) +nn*nn*(1 -1) +nn*(1 -1) +(1 -1) +1)
88 ne2 = cs_loc(cs_loc(ie -1) +nn*nn*(1 -1) +nn*(1 -1) +(nn -1) +1)
89 ne3 = cs_loc(cs_loc(ie -1) +nn*nn*(nn -1) +nn*(1 -1) +(nn -1) +1)
90 ne4 = cs_loc(cs_loc(ie -1) +nn*nn*(nn -1) +nn*(1 -1) +(1 -1) +1)
91
92 if ((i4count(ne1).ne.0) .and. (i4count(ne2).ne.0) .and. (i4count(ne3).ne.0) .and. (i4count(ne4).ne.0)) then
93 nel_dg_loc = nel_dg_loc +1
94 endif
95
96 ne1 = cs_loc(cs_loc(ie -1) +nn*nn*(1 -1) +nn*(1 -1) +(1 -1) +1)
97 ne2 = cs_loc(cs_loc(ie -1) +nn*nn*(1 -1) +nn*(1 -1) +(nn -1) +1)
98 ne3 = cs_loc(cs_loc(ie -1) +nn*nn*(1 -1) +nn*(nn -1) +(nn -1) +1)
99 ne4 = cs_loc(cs_loc(ie -1) +nn*nn*(1 -1) +nn*(nn -1) +(1 -1) +1)
100
101 if ((i4count(ne1).ne.0) .and. (i4count(ne2).ne.0) .and. (i4count(ne3).ne.0) .and. (i4count(ne4).ne.0)) then
102 nel_dg_loc = nel_dg_loc +1
103 endif
104
105 ne1 = cs_loc(cs_loc(ie -1) +nn*nn*(1 -1) +nn*(1 -1) +(nn -1) +1)
106 ne2 = cs_loc(cs_loc(ie -1) +nn*nn*(1 -1) +nn*(nn -1) +(nn -1) +1)
107 ne3 = cs_loc(cs_loc(ie -1) +nn*nn*(nn -1) +nn*(nn -1) +(nn -1) +1)
108 ne4 = cs_loc(cs_loc(ie -1) +nn*nn*(nn -1) +nn*(1 -1) +(nn -1) +1)
109
110 if ((i4count(ne1).ne.0) .and. (i4count(ne2).ne.0) .and. (i4count(ne3).ne.0) .and. (i4count(ne4).ne.0)) then
111 nel_dg_loc = nel_dg_loc +1
112 endif
113
114 ne1 = cs_loc(cs_loc(ie -1) +nn*nn*(1 -1) +nn*(nn -1) +(1 -1) +1)
115 ne2 = cs_loc(cs_loc(ie -1) +nn*nn*(1 -1) +nn*(nn -1) +(nn -1) +1)
116 ne3 = cs_loc(cs_loc(ie -1) +nn*nn*(nn -1) +nn*(nn -1) +(nn -1) +1)
117 ne4 = cs_loc(cs_loc(ie -1) +nn*nn*(nn -1) +nn*(nn -1) +(1 -1) +1)
118
119
120 if ((i4count(ne1).ne.0) .and. (i4count(ne2).ne.0) .and. (i4count(ne3).ne.0) .and. (i4count(ne4).ne.0)) then
121 nel_dg_loc = nel_dg_loc +1
122 endif
123
124 ne1 = cs_loc(cs_loc(ie -1) +nn*nn*(nn -1) +nn*(1 -1) +(1 -1) +1)
125 ne2 = cs_loc(cs_loc(ie -1) +nn*nn*(nn -1) +nn*(1 -1) +(nn -1) +1)
126 ne3 = cs_loc(cs_loc(ie -1) +nn*nn*(nn -1) +nn*(nn -1) +(nn -1) +1)
127 ne4 = cs_loc(cs_loc(ie -1) +nn*nn*(nn -1) +nn*(nn -1) +(1 -1) +1)
128
129
130 if ((i4count(ne1).ne.0) .and. (i4count(ne2).ne.0) .and. (i4count(ne3).ne.0) .and. (i4count(ne4).ne.0)) then
131 nel_dg_loc = nel_dg_loc +1
132 endif
133
134 endif
135 enddo
136 enddo
137
138
139 call mpi_allreduce(nel_dg_loc, nel_dg_glo, 1, speed_integer, mpi_sum, mpi_comm, mpi_ierr)
140
141
142
143
144 end subroutine get_dime_dg
145
subroutine get_dime_dg(nm, sd, tag_mat, cs_nnz_loc, cs_loc, nn_loc, local_n_num, ne_loc, local_el_num, xs, ys, zs, nel_dg_loc, nel_dg_glo, i4count, mpi_id, mpi_comm)
Counts number of DG elements (local and global)