File: DDviaProjection.c

package info (click to toggle)
spooles 2.2-9
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 19,012 kB
  • sloc: ansic: 146,834; csh: 3,615; makefile: 2,040; perl: 74
file content (77 lines) | stat: -rw-r--r-- 1,933 bytes parent folder | download | duplicates (7)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*  DDviaProjection.c  */

#include"../GPart.h"

/*--------------------------------------------------------------------*/
/*
   ---------------------------------------------------------
   set the compids[] vector using a global map from vertices
   to domains and interface nodes.

   DDmapIV -- IV object that contains the map from vertices
              to domains and interface nodes

   created -- 96mar17, cca
   ---------------------------------------------------------
*/
void
GPart_DDviaProjection (
   GPart   *gpart,
   IV      *DDmapIV
) {
int   *compids, *domainMap, *map, *vtxMap ;
int   dom, domloc, ndom, ndomloc, nvtx, vglob, vloc ;
/*
   ---------------
   check the input
   ---------------
*/
if ( gpart == NULL || DDmapIV == NULL ) {
   fprintf(stderr, "\n fatal error in GPart_DDviaProjection(%p,%p)"
           "\n bad input\n", gpart, DDmapIV) ;
   exit(-1) ;
}
nvtx    = gpart->nvtx ;
compids = IV_entries(&gpart->compidsIV) ;
/*
   --------------------------
   find the number of domains
   --------------------------
*/
vtxMap = IV_entries(&gpart->vtxMapIV) ;
map    = IV_entries(DDmapIV) ;
ndom   = IV_max(DDmapIV) ;
/*
   ------------------------
   check for a quick return
   ------------------------
*/
if ( gpart->par == NULL ) {
   IVcopy(nvtx, compids, map) ;
   gpart->ncomp = ndom ;
   return ;
}
/*
   ----------------------------------------
   fill compids[] with the local domain ids
   ----------------------------------------
*/
domainMap = IVinit(ndom+1, -1) ;
ndomloc = 0 ;
for ( vloc = 0 ; vloc < nvtx ; vloc++ ) {
   vglob = vtxMap[vloc] ;
   if ( (dom = map[vglob]) > 0 ) {
      if ( (domloc = domainMap[dom]) == -1 ) {
         domloc = domainMap[dom] = ++ndomloc ;
      }
      compids[vloc] = domloc ;
   } else {
      compids[vloc] = 0 ;
   }
}
gpart->ncomp = ndomloc ;
IVfree(domainMap) ; 

return ; }

/*--------------------------------------------------------------------*/