File: | dm/impls/plex/plexinterpolate.c |
Warning: | line 196, column 10 Array access (via field 'flags') results in a null pointer dereference |
[?] Use j/k keys for keyboard navigation
1 | #include <petsc/private/dmpleximpl.h> /*I "petscdmplex.h" I*/ | |||
2 | #include <petsc/private/hashmapi.h> | |||
3 | #include <petsc/private/hashmapij.h> | |||
4 | ||||
5 | /* HashIJKL */ | |||
6 | ||||
7 | #include <petsc/private/hashmap.h> | |||
8 | ||||
9 | typedef struct _PetscHashIJKLKey { PetscInt i, j, k, l; } PetscHashIJKLKey; | |||
10 | ||||
11 | #define PetscHashIJKLKeyHash(key)PetscHashCombine(PetscHashCombine(PetscHashInt((key).i),PetscHashInt ((key).j)), PetscHashCombine(PetscHashInt((key).k),PetscHashInt ((key).l))) \ | |||
12 | PetscHashCombine(PetscHashCombine(PetscHashInt((key).i),PetscHashInt((key).j)), \ | |||
13 | PetscHashCombine(PetscHashInt((key).k),PetscHashInt((key).l))) | |||
14 | ||||
15 | #define PetscHashIJKLKeyEqual(k1,k2)(((k1).i==(k2).i) ? ((k1).j==(k2).j) ? ((k1).k==(k2).k) ? ((k1 ).l==(k2).l) : 0 : 0 : 0) \ | |||
16 | (((k1).i==(k2).i) ? ((k1).j==(k2).j) ? ((k1).k==(k2).k) ? ((k1).l==(k2).l) : 0 : 0 : 0) | |||
17 | ||||
18 | PETSC_HASH_MAP(HashIJKL, PetscHashIJKLKey, PetscInt, PetscHashIJKLKeyHash, PetscHashIJKLKeyEqual, -1)typedef struct kh_HashIJKL_s { khint_t n_buckets, size, n_occupied , upper_bound; khint32_t *flags; PetscHashIJKLKey *keys; PetscInt *vals; } kh_HashIJKL_t; static inline __attribute((unused)) kh_HashIJKL_t *kh_init_HashIJKL(void) { return (kh_HashIJKL_t*)calloc(1,sizeof (kh_HashIJKL_t)); } static inline __attribute((unused)) void kh_destroy_HashIJKL (kh_HashIJKL_t *h) { if (h) { free((void *)h->keys); free( h->flags); free((void *)h->vals); free(h); } } static inline __attribute((unused)) void kh_clear_HashIJKL(kh_HashIJKL_t * h) { if (h && h->flags) { memset(h->flags, 0xaa , ((h->n_buckets) < 16? 1 : (h->n_buckets)>>4) * sizeof(khint32_t)); h->size = h->n_occupied = 0; } } static inline __attribute((unused)) khint_t kh_get_HashIJKL( const kh_HashIJKL_t *h, PetscHashIJKLKey key) { if (h->n_buckets ) { khint_t k, i, last, mask, step = 0; mask = h->n_buckets - 1; k = PetscHashCombine(PetscHashCombine(PetscHashInt((key ).i),PetscHashInt((key).j)), PetscHashCombine(PetscHashInt((key ).k),PetscHashInt((key).l))); i = k & mask; last = i; while (!((h->flags[i>>4]>>((i&0xfU)<<1))& 2) && (((h->flags[i>>4]>>((i&0xfU) <<1))&1) || !(((h->keys[i]).i==(key).i) ? ((h-> keys[i]).j==(key).j) ? ((h->keys[i]).k==(key).k) ? ((h-> keys[i]).l==(key).l) : 0 : 0 : 0))) { i = (i + (++step)) & mask; if (i == last) return h->n_buckets; } return ((h-> flags[i>>4]>>((i&0xfU)<<1))&3)? h-> n_buckets : i; } else return 0; } static inline __attribute(( unused)) int kh_resize_HashIJKL(kh_HashIJKL_t *h, khint_t new_n_buckets ) { khint32_t *new_flags = 0; khint_t j = 1; { (--(new_n_buckets ), (new_n_buckets)|=(new_n_buckets)>>1, (new_n_buckets) |=(new_n_buckets)>>2, (new_n_buckets)|=(new_n_buckets)>> 4, (new_n_buckets)|=(new_n_buckets)>>8, (new_n_buckets) |=(new_n_buckets)>>16, ++(new_n_buckets)); if (new_n_buckets < 4) new_n_buckets = 4; if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 0; else { new_flags = (khint32_t *)malloc(((new_n_buckets) < 16? 1 : (new_n_buckets)>> 4) * sizeof(khint32_t)); if (!new_flags) return -1; memset(new_flags , 0xaa, ((new_n_buckets) < 16? 1 : (new_n_buckets)>> 4) * sizeof(khint32_t)); if (h->n_buckets < new_n_buckets ) { PetscHashIJKLKey *new_keys = (PetscHashIJKLKey*)realloc(( void *)h->keys,new_n_buckets * sizeof(PetscHashIJKLKey)); if (!new_keys) { free(new_flags); return -1; } h->keys = new_keys ; if (1) { PetscInt *new_vals = (PetscInt*)realloc((void *)h-> vals,new_n_buckets * sizeof(PetscInt)); if (!new_vals) { free (new_flags); return -1; } h->vals = new_vals; } } } } if ( j) { for (j = 0; j != h->n_buckets; ++j) { if (((h->flags [j>>4]>>((j&0xfU)<<1))&3) == 0) { PetscHashIJKLKey key = h->keys[j]; PetscInt val; khint_t new_mask; new_mask = new_n_buckets - 1; if (1) val = h->vals[j]; (h->flags [j>>4]|=1ul<<((j&0xfU)<<1)); while (1) { khint_t k, i, step = 0; k = PetscHashCombine(PetscHashCombine (PetscHashInt((key).i),PetscHashInt((key).j)), PetscHashCombine (PetscHashInt((key).k),PetscHashInt((key).l))); i = k & new_mask ; while (!((new_flags[i>>4]>>((i&0xfU)<< 1))&2)) i = (i + (++step)) & new_mask; (new_flags[i>> 4]&=~(2ul<<((i&0xfU)<<1))); if (i < h-> n_buckets && ((h->flags[i>>4]>>((i& 0xfU)<<1))&3) == 0) { { PetscHashIJKLKey tmp = h-> keys[i]; h->keys[i] = key; key = tmp; } if (1) { PetscInt tmp = h->vals[i]; h->vals[i] = val; val = tmp; } (h->flags [i>>4]|=1ul<<((i&0xfU)<<1)); } else { h ->keys[i] = key; if (1) h->vals[i] = val; break; } } } } if (h->n_buckets > new_n_buckets) { h->keys = (PetscHashIJKLKey *)realloc((void *)h->keys,new_n_buckets * sizeof(PetscHashIJKLKey )); if (1) h->vals = (PetscInt*)realloc((void *)h->vals ,new_n_buckets * sizeof(PetscInt)); } free(h->flags); h-> flags = new_flags; h->n_buckets = new_n_buckets; h->n_occupied = h->size; h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); } return 0; } static inline __attribute ((unused)) khint_t kh_put_HashIJKL(kh_HashIJKL_t *h, PetscHashIJKLKey key, int *ret) { khint_t x; if (h->n_occupied >= h-> upper_bound) { if (h->n_buckets > (h->size<<1) ) { if (kh_resize_HashIJKL(h, h->n_buckets - 1) < 0) { * ret = -1; return h->n_buckets; } } else if (kh_resize_HashIJKL (h, h->n_buckets + 1) < 0) { *ret = -1; return h->n_buckets ; } } { khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; x = site = h->n_buckets; k = PetscHashCombine(PetscHashCombine (PetscHashInt((key).i),PetscHashInt((key).j)), PetscHashCombine (PetscHashInt((key).k),PetscHashInt((key).l))); i = k & mask ; if (((h->flags[i>>4]>>((i&0xfU)<<1 ))&2)) x = i; else { last = i; while (!((h->flags[i>> 4]>>((i&0xfU)<<1))&2) && (((h-> flags[i>>4]>>((i&0xfU)<<1))&1) || ! (((h->keys[i]).i==(key).i) ? ((h->keys[i]).j==(key).j) ? ((h->keys[i]).k==(key).k) ? ((h->keys[i]).l==(key).l) : 0 : 0 : 0))) { if (((h->flags[i>>4]>>((i& 0xfU)<<1))&1)) site = i; i = (i + (++step)) & mask ; if (i == last) { x = site; break; } } if (x == h->n_buckets ) { if (((h->flags[i>>4]>>((i&0xfU)<< 1))&2) && site != h->n_buckets) x = site; else x = i; } } } if (((h->flags[x>>4]>>((x&0xfU )<<1))&2)) { h->keys[x] = key; (h->flags[x>> 4]&=~(3ul<<((x&0xfU)<<1))); ++h->size; ++h->n_occupied; *ret = 1; } else if (((h->flags[x>> 4]>>((x&0xfU)<<1))&1)) { h->keys[x] = key ; (h->flags[x>>4]&=~(3ul<<((x&0xfU)<< 1))); ++h->size; *ret = 2; } else *ret = 0; return x; } static inline __attribute((unused)) void kh_del_HashIJKL(kh_HashIJKL_t *h, khint_t x) { if (x != h->n_buckets && !((h-> flags[x>>4]>>((x&0xfU)<<1))&3)) { ( h->flags[x>>4]|=1ul<<((x&0xfU)<<1)); --h->size; } } typedef kh_HashIJKL_t *PetscHashIJKL; static inline __attribute((unused)) PetscErrorCode PetscHashIJKLCreate (PetscHashIJKL *ht) { do { do { ; if (petscstack && ( petscstack->currentsize < 64)) { petscstack->function [petscstack->currentsize] = __func__; petscstack->file[ petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); *ht = kh_init_HashIJKL(); do { if (__builtin_expect (!!(!(*ht!=((void*)0))),0)) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","*ht!=((void*)0)" ); } while(0); do { do { ; if (petscstack && petscstack ->currentsize > 0) { petscstack->currentsize--; petscstack ->function[petscstack->currentsize] = 0; petscstack-> file[petscstack->currentsize] = 0; petscstack->line[petscstack ->currentsize] = 0; petscstack->petscroutine[petscstack ->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack ->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHashIJKLDestroy (PetscHashIJKL *ht) { do { do { ; if (petscstack && ( petscstack->currentsize < 64)) { petscstack->function [petscstack->currentsize] = __func__; petscstack->file[ petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); if (!*ht) do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize --; petscstack->function[petscstack->currentsize] = 0; petscstack ->file[petscstack->currentsize] = 0; petscstack->line [petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return (0);} while (0); kh_destroy_HashIJKL(*ht); *ht = ((void*)0); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHashIJKLReset (PetscHashIJKL ht) { do { do { ; if (petscstack && (petscstack ->currentsize < 64)) { petscstack->function[petscstack ->currentsize] = __func__; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); { if (ht) { free((ht)->keys); free((ht)-> flags); free((ht)->vals); memset((ht), 0x00, sizeof(*(ht)) ); } }; do { do { ; if (petscstack && petscstack-> currentsize > 0) { petscstack->currentsize--; petscstack ->function[petscstack->currentsize] = 0; petscstack-> file[petscstack->currentsize] = 0; petscstack->line[petscstack ->currentsize] = 0; petscstack->petscroutine[petscstack ->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack ->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHashIJKLDuplicate (PetscHashIJKL ht,PetscHashIJKL *hd) { int ret; PetscHashIJKLKey key; PetscInt val; do { do { ; if (petscstack && (petscstack ->currentsize < 64)) { petscstack->function[petscstack ->currentsize] = __func__; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!hd) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(hd,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); *hd = kh_init_HashIJKL(); do { if (__builtin_expect (!!(!(*hd!=((void*)0))),0)) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","*hd!=((void*)0)" ); } while(0); ret = kh_resize_HashIJKL(*hd, ((ht)->size)) ; do { if (__builtin_expect(!!(!(ret==0)),0)) return PetscError (((MPI_Comm)0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","ret==0" ); } while(0); { khint_t __i; for (__i = (khint_t)(0); __i != ((ht)->n_buckets); ++__i) { if (!(!(((ht)->flags[(__i) >>4]>>(((__i)&0xfU)<<1))&3))) continue ; (key) = ((ht)->keys[__i]); (val) = ((ht)->vals[__i]); { khiter_t i; i = kh_put_HashIJKL(*hd, key, &ret); do { if (__builtin_expect(!!(!(ret>=0)),0)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","ret>=0" ); } while(0); ((*hd)->vals[i]) = val;}; } } do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack ->currentsize--; petscstack->function[petscstack->currentsize ] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack ->line[petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return (0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHashIJKLClear(PetscHashIJKL ht) { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack ->function[petscstack->currentsize] = __func__; petscstack ->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); kh_clear_HashIJKL(ht); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack-> currentsize--; petscstack->function[petscstack->currentsize ] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack ->line[petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return (0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHashIJKLResize(PetscHashIJKL ht,PetscInt nb) { int ret; do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); ret = kh_resize_HashIJKL(ht, (khint_t)nb); do { if (__builtin_expect(!!(!(ret>=0)),0)) return PetscError( ((MPI_Comm)0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","ret>=0" ); } while(0); do { do { ; if (petscstack && petscstack ->currentsize > 0) { petscstack->currentsize--; petscstack ->function[petscstack->currentsize] = 0; petscstack-> file[petscstack->currentsize] = 0; petscstack->line[petscstack ->currentsize] = 0; petscstack->petscroutine[petscstack ->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack ->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHashIJKLGetSize (PetscHashIJKL ht,PetscInt *n) { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function [petscstack->currentsize] = __func__; petscstack->file[ petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!n) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(n,PETSC_INT)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,2); } while (0); *n = (PetscInt)((ht)->size); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute ((unused)) PetscErrorCode PetscHashIJKLGetCapacity(PetscHashIJKL ht,PetscInt *n) { do { do { ; if (petscstack && (petscstack ->currentsize < 64)) { petscstack->function[petscstack ->currentsize] = __func__; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!n) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(n,PETSC_INT)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,2); } while (0); *n = (PetscInt)((ht)->n_buckets); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute ((unused)) PetscErrorCode PetscHashIJKLHas(PetscHashIJKL ht,PetscHashIJKLKey key,PetscBool *has) { khiter_t iter; do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack ->function[petscstack->currentsize] = __func__; petscstack ->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!has) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (!PetscCheckPointer(has,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); iter = kh_get_HashIJKL(ht, key); *has = (iter != ((ht)->n_buckets)) ? PETSC_TRUE : PETSC_FALSE; do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute ((unused)) PetscErrorCode PetscHashIJKLGet(PetscHashIJKL ht,PetscHashIJKLKey key,PetscInt *val) { khiter_t iter; do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack ->function[petscstack->currentsize] = __func__; petscstack ->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!val) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (!PetscCheckPointer(val,PETSC_INT)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,3); } while (0); iter = kh_get_HashIJKL(ht, key); *val = (iter != ((ht)->n_buckets)) ? ((ht)->vals[iter]) : (-1); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute ((unused)) PetscErrorCode PetscHashIJKLSet(PetscHashIJKL ht,PetscHashIJKLKey key,PetscInt val) { int ret; khiter_t iter; do { do { ; if ( petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize] = __func__ ; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); iter = kh_put_HashIJKL(ht, key, &ret); do { if (__builtin_expect(!!(!(ret>=0)),0)) return PetscError( ((MPI_Comm)0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","ret>=0" ); } while(0); ((ht)->vals[iter]) = val; do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack-> currentsize--; petscstack->function[petscstack->currentsize ] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack ->line[petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return (0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHashIJKLDel(PetscHashIJKL ht,PetscHashIJKLKey key) { khiter_t iter; do { do { ; if (petscstack && (petscstack-> currentsize < 64)) { petscstack->function[petscstack-> currentsize] = __func__; petscstack->file[petscstack->currentsize ] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); iter = kh_get_HashIJKL(ht, key); kh_del_HashIJKL (ht, iter); do { do { ; if (petscstack && petscstack-> currentsize > 0) { petscstack->currentsize--; petscstack ->function[petscstack->currentsize] = 0; petscstack-> file[petscstack->currentsize] = 0; petscstack->line[petscstack ->currentsize] = 0; petscstack->petscroutine[petscstack ->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack ->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHashIJKLQuerySet (PetscHashIJKL ht,PetscHashIJKLKey key,PetscInt val,PetscBool *missing) { int ret; khiter_t iter; do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack ->function[petscstack->currentsize] = __func__; petscstack ->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!missing) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (!PetscCheckPointer(missing,PETSC_CHAR)) return PetscError(( (MPI_Comm)0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); iter = kh_put_HashIJKL(ht, key, &ret); do { if (__builtin_expect(!!(!(ret>=0)),0)) return PetscError( ((MPI_Comm)0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","ret>=0" ); } while(0); ((ht)->vals[iter]) = val; *missing = ret ? PETSC_TRUE : PETSC_FALSE; do { do { ; if (petscstack && petscstack ->currentsize > 0) { petscstack->currentsize--; petscstack ->function[petscstack->currentsize] = 0; petscstack-> file[petscstack->currentsize] = 0; petscstack->line[petscstack ->currentsize] = 0; petscstack->petscroutine[petscstack ->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack ->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHashIJKLQueryDel (PetscHashIJKL ht,PetscHashIJKLKey key,PetscBool *present) { khiter_t iter; do { do { ; if (petscstack && (petscstack-> currentsize < 64)) { petscstack->function[petscstack-> currentsize] = __func__; petscstack->file[petscstack->currentsize ] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!present) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (!PetscCheckPointer(present,PETSC_CHAR)) return PetscError(( (MPI_Comm)0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); iter = kh_get_HashIJKL(ht, key); if (iter != (( ht)->n_buckets)) { kh_del_HashIJKL(ht, iter); *present = PETSC_TRUE ; } else { *present = PETSC_FALSE; } do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack-> currentsize--; petscstack->function[petscstack->currentsize ] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack ->line[petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return (0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHashIJKLFind(PetscHashIJKL ht,PetscHashIJKLKey key,PetscHashIter *iter,PetscBool *found) { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function [petscstack->currentsize] = __func__; petscstack->file[ petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!iter) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(iter,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); do { if (!found) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (!PetscCheckPointer(found,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); *iter = kh_get_HashIJKL(ht, key); *found = (*iter != ((ht)->n_buckets)) ? PETSC_TRUE : PETSC_FALSE; do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute ((unused)) PetscErrorCode PetscHashIJKLPut(PetscHashIJKL ht,PetscHashIJKLKey key,PetscHashIter *iter,PetscBool *missing) { int ret; do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!iter) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(iter,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); do { if (!missing) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (!PetscCheckPointer(missing,PETSC_CHAR)) return PetscError(( (MPI_Comm)0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); *iter = kh_put_HashIJKL(ht, key, &ret); do { if (__builtin_expect(!!(!(ret>=0)),0)) return PetscError( ((MPI_Comm)0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","ret>=0" ); } while(0); *missing = ret ? PETSC_TRUE : PETSC_FALSE; do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute ((unused)) PetscErrorCode PetscHashIJKLIterGet(PetscHashIJKL ht ,PetscHashIter iter,PetscInt *val) { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack ->function[petscstack->currentsize] = __func__; petscstack ->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!val) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (!PetscCheckPointer(val,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); *val = __builtin_expect(!!(iter < ((ht)-> n_buckets) && (!(((ht)->flags[(iter)>>4]>> (((iter)&0xfU)<<1))&3))),1) ? ((ht)->vals[iter ]) : (-1); do { do { ; if (petscstack && petscstack-> currentsize > 0) { petscstack->currentsize--; petscstack ->function[petscstack->currentsize] = 0; petscstack-> file[petscstack->currentsize] = 0; petscstack->line[petscstack ->currentsize] = 0; petscstack->petscroutine[petscstack ->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack ->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHashIJKLIterSet (PetscHashIJKL ht,PetscHashIter iter,PetscInt val) { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); if (__builtin_expect(!!(iter < ((ht)->n_buckets ) && (!(((ht)->flags[(iter)>>4]>>(((iter )&0xfU)<<1))&3))),1)) ((ht)->vals[iter]) = val ; do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHashIJKLIterDel (PetscHashIJKL ht,PetscHashIter iter) { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack ->function[petscstack->currentsize] = __func__; petscstack ->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); if (__builtin_expect(!!(iter < ((ht)->n_buckets )),1)) kh_del_HashIJKL(ht, iter); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize --; petscstack->function[petscstack->currentsize] = 0; petscstack ->file[petscstack->currentsize] = 0; petscstack->line [petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return (0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHashIJKLGetKeys(PetscHashIJKL ht,PetscInt *off,PetscHashIJKLKey array[]) { PetscHashIJKLKey key; PetscInt pos; do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize] = __func__ ; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!off) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(off,PETSC_INT)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,2); } while (0); pos = *off; { khint_t __i; for (__i = (khint_t )(0); __i != ((ht)->n_buckets); ++__i) { if (!(!(((ht)-> flags[(__i)>>4]>>(((__i)&0xfU)<<1))& 3))) continue; (key) = ((ht)->keys[__i]); array[pos++] = key ; } }; *off = pos; do { do { ; if (petscstack && petscstack ->currentsize > 0) { petscstack->currentsize--; petscstack ->function[petscstack->currentsize] = 0; petscstack-> file[petscstack->currentsize] = 0; petscstack->line[petscstack ->currentsize] = 0; petscstack->petscroutine[petscstack ->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack ->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHashIJKLGetVals (PetscHashIJKL ht,PetscInt *off,PetscInt array[]) { PetscInt val ; PetscInt pos; do { do { ; if (petscstack && (petscstack ->currentsize < 64)) { petscstack->function[petscstack ->currentsize] = __func__; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!off) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(off,PETSC_INT)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,2); } while (0); pos = *off; { khint_t __i; for (__i = (khint_t )(0); __i != ((ht)->n_buckets); ++__i) { if (!(!(((ht)-> flags[(__i)>>4]>>(((__i)&0xfU)<<1))& 3))) continue; (val) = ((ht)->vals[__i]); array[pos++] = val ; } }; *off = pos; do { do { ; if (petscstack && petscstack ->currentsize > 0) { petscstack->currentsize--; petscstack ->function[petscstack->currentsize] = 0; petscstack-> file[petscstack->currentsize] = 0; petscstack->line[petscstack ->currentsize] = 0; petscstack->petscroutine[petscstack ->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack ->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHashIJKLGetPairs (PetscHashIJKL ht,PetscInt *off,PetscHashIJKLKey karray[],PetscInt varray[]) { PetscInt val; PetscHashIJKLKey key; PetscInt pos ; do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 18; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!off) return PetscError(((MPI_Comm)0x44000001 ),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(off,PETSC_INT)) return PetscError(((MPI_Comm )0x44000001),18,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,2); } while (0); pos = *off; { khint_t __i; for (__i = (khint_t )(0); __i != ((ht)->n_buckets); ++__i) { if (!(!(((ht)-> flags[(__i)>>4]>>(((__i)&0xfU)<<1))& 3))) continue; (key) = ((ht)->keys[__i]); (val) = ((ht)-> vals[__i]); { karray[pos] = key; varray[pos++] = val;}; } } * off = pos; do { do { ; if (petscstack && petscstack-> currentsize > 0) { petscstack->currentsize--; petscstack ->function[petscstack->currentsize] = 0; petscstack-> file[petscstack->currentsize] = 0; petscstack->line[petscstack ->currentsize] = 0; petscstack->petscroutine[petscstack ->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack ->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } | |||
19 | ||||
20 | ||||
21 | /* | |||
22 | DMPlexGetFaces_Internal - Gets groups of vertices that correspond to faces for the given cell | |||
23 | This assumes that the mesh is not interpolated from the depth of point p to the vertices | |||
24 | */ | |||
25 | PetscErrorCode DMPlexGetFaces_Internal(DM dm, PetscInt dim, PetscInt p, PetscInt *numFaces, PetscInt *faceSize, const PetscInt *faces[]) | |||
26 | { | |||
27 | const PetscInt *cone = NULL((void*)0); | |||
28 | PetscInt coneSize; | |||
29 | PetscErrorCode ierr; | |||
30 | ||||
31 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 31; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
32 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),32,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),32,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if ( ((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm )0x44000001),32,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),32,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
33 | ierr = DMPlexGetConeSize(dm, p, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),33,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
34 | ierr = DMPlexGetCone(dm, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),34,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
35 | ierr = DMPlexGetRawFaces_Internal(dm, dim, coneSize, cone, numFaces, faceSize, faces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),35,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
36 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
37 | } | |||
38 | ||||
39 | /* | |||
40 | DMPlexRestoreFaces_Internal - Restores the array | |||
41 | */ | |||
42 | PetscErrorCode DMPlexRestoreFaces_Internal(DM dm, PetscInt dim, PetscInt p, PetscInt *numFaces, PetscInt *faceSize, const PetscInt *faces[]) | |||
43 | { | |||
44 | PetscErrorCode ierr; | |||
45 | ||||
46 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 46; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
47 | if (faces) { ierr = DMRestoreWorkArray(dm, 0, MPIU_INT((MPI_Datatype)0x4c000405), (void *) faces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),47,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); } | |||
48 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
49 | } | |||
50 | ||||
51 | /* | |||
52 | DMPlexGetRawFaces_Internal - Gets groups of vertices that correspond to faces for the given cone | |||
53 | */ | |||
54 | PetscErrorCode DMPlexGetRawFaces_Internal(DM dm, PetscInt dim, PetscInt coneSize, const PetscInt cone[], PetscInt *numFaces, PetscInt *faceSize, const PetscInt *faces[]) | |||
55 | { | |||
56 | PetscInt *facesTmp; | |||
57 | PetscInt maxConeSize, maxSupportSize; | |||
58 | PetscErrorCode ierr; | |||
59 | ||||
60 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 60; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
61 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),61,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),61,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if ( ((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm )0x44000001),61,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),61,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
62 | if (faces && coneSize) PetscValidIntPointer(cone,4)do { if (!cone) return PetscError(((MPI_Comm)0x44000001),62,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",4); if (!PetscCheckPointer(cone,PETSC_INT)) return PetscError(((MPI_Comm )0x44000001),62,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,4); } while (0); | |||
63 | ierr = DMPlexGetMaxSizes(dm, &maxConeSize, &maxSupportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),63,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
64 | if (faces) {ierr = DMGetWorkArray(dm, PetscSqr(PetscMax(maxConeSize, maxSupportSize))(((((maxConeSize)<(maxSupportSize)) ? (maxSupportSize) : ( maxConeSize)))*((((maxConeSize)<(maxSupportSize)) ? (maxSupportSize ) : (maxConeSize)))), MPIU_INT((MPI_Datatype)0x4c000405), &facesTmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),64,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
65 | switch (dim) { | |||
66 | case 1: | |||
67 | switch (coneSize) { | |||
68 | case 2: | |||
69 | if (faces) { | |||
70 | facesTmp[0] = cone[0]; facesTmp[1] = cone[1]; | |||
71 | *faces = facesTmp; | |||
72 | } | |||
73 | if (numFaces) *numFaces = 2; | |||
74 | if (faceSize) *faceSize = 1; | |||
75 | break; | |||
76 | default: | |||
77 | SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Cone size %D not supported for dimension %D", coneSize, dim)return PetscError(((MPI_Comm)0x44000001),77,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,63,PETSC_ERROR_INITIAL,"Cone size %D not supported for dimension %D" ,coneSize,dim); | |||
78 | } | |||
79 | break; | |||
80 | case 2: | |||
81 | switch (coneSize) { | |||
82 | case 3: | |||
83 | if (faces) { | |||
84 | facesTmp[0] = cone[0]; facesTmp[1] = cone[1]; | |||
85 | facesTmp[2] = cone[1]; facesTmp[3] = cone[2]; | |||
86 | facesTmp[4] = cone[2]; facesTmp[5] = cone[0]; | |||
87 | *faces = facesTmp; | |||
88 | } | |||
89 | if (numFaces) *numFaces = 3; | |||
90 | if (faceSize) *faceSize = 2; | |||
91 | break; | |||
92 | case 4: | |||
93 | /* Vertices follow right hand rule */ | |||
94 | if (faces) { | |||
95 | facesTmp[0] = cone[0]; facesTmp[1] = cone[1]; | |||
96 | facesTmp[2] = cone[1]; facesTmp[3] = cone[2]; | |||
97 | facesTmp[4] = cone[2]; facesTmp[5] = cone[3]; | |||
98 | facesTmp[6] = cone[3]; facesTmp[7] = cone[0]; | |||
99 | *faces = facesTmp; | |||
100 | } | |||
101 | if (numFaces) *numFaces = 4; | |||
102 | if (faceSize) *faceSize = 2; | |||
103 | break; | |||
104 | default: | |||
105 | SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Cone size %D not supported for dimension %D", coneSize, dim)return PetscError(((MPI_Comm)0x44000001),105,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,63,PETSC_ERROR_INITIAL,"Cone size %D not supported for dimension %D" ,coneSize,dim); | |||
106 | } | |||
107 | break; | |||
108 | case 3: | |||
109 | switch (coneSize) { | |||
110 | case 3: | |||
111 | if (faces) { | |||
112 | facesTmp[0] = cone[0]; facesTmp[1] = cone[1]; | |||
113 | facesTmp[2] = cone[1]; facesTmp[3] = cone[2]; | |||
114 | facesTmp[4] = cone[2]; facesTmp[5] = cone[0]; | |||
115 | *faces = facesTmp; | |||
116 | } | |||
117 | if (numFaces) *numFaces = 3; | |||
118 | if (faceSize) *faceSize = 2; | |||
119 | break; | |||
120 | case 4: | |||
121 | /* Vertices of first face follow right hand rule and normal points away from last vertex */ | |||
122 | if (faces) { | |||
123 | facesTmp[0] = cone[0]; facesTmp[1] = cone[1]; facesTmp[2] = cone[2]; | |||
124 | facesTmp[3] = cone[0]; facesTmp[4] = cone[3]; facesTmp[5] = cone[1]; | |||
125 | facesTmp[6] = cone[0]; facesTmp[7] = cone[2]; facesTmp[8] = cone[3]; | |||
126 | facesTmp[9] = cone[2]; facesTmp[10] = cone[1]; facesTmp[11] = cone[3]; | |||
127 | *faces = facesTmp; | |||
128 | } | |||
129 | if (numFaces) *numFaces = 4; | |||
130 | if (faceSize) *faceSize = 3; | |||
131 | break; | |||
132 | case 8: | |||
133 | /* 7--------6 | |||
134 | /| /| | |||
135 | / | / | | |||
136 | 4--------5 | | |||
137 | | | | | | |||
138 | | | | | | |||
139 | | 1--------2 | |||
140 | | / | / | |||
141 | |/ |/ | |||
142 | 0--------3 | |||
143 | */ | |||
144 | if (faces) { | |||
145 | facesTmp[0] = cone[0]; facesTmp[1] = cone[1]; facesTmp[2] = cone[2]; facesTmp[3] = cone[3]; /* Bottom */ | |||
146 | facesTmp[4] = cone[4]; facesTmp[5] = cone[5]; facesTmp[6] = cone[6]; facesTmp[7] = cone[7]; /* Top */ | |||
147 | facesTmp[8] = cone[0]; facesTmp[9] = cone[3]; facesTmp[10] = cone[5]; facesTmp[11] = cone[4]; /* Front */ | |||
148 | facesTmp[12] = cone[2]; facesTmp[13] = cone[1]; facesTmp[14] = cone[7]; facesTmp[15] = cone[6]; /* Back */ | |||
149 | facesTmp[16] = cone[3]; facesTmp[17] = cone[2]; facesTmp[18] = cone[6]; facesTmp[19] = cone[5]; /* Right */ | |||
150 | facesTmp[20] = cone[0]; facesTmp[21] = cone[4]; facesTmp[22] = cone[7]; facesTmp[23] = cone[1]; /* Left */ | |||
151 | *faces = facesTmp; | |||
152 | } | |||
153 | if (numFaces) *numFaces = 6; | |||
154 | if (faceSize) *faceSize = 4; | |||
155 | break; | |||
156 | default: | |||
157 | SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Cone size %D not supported for dimension %D", coneSize, dim)return PetscError(((MPI_Comm)0x44000001),157,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,63,PETSC_ERROR_INITIAL,"Cone size %D not supported for dimension %D" ,coneSize,dim); | |||
158 | } | |||
159 | break; | |||
160 | default: | |||
161 | SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Dimension %D not supported", dim)return PetscError(((MPI_Comm)0x44000001),161,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,63,PETSC_ERROR_INITIAL,"Dimension %D not supported",dim); | |||
162 | } | |||
163 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
164 | } | |||
165 | ||||
166 | /* | |||
167 | DMPlexGetRawFacesHybrid_Internal - Gets groups of vertices that correspond to faces for the given cone using hybrid ordering (prisms) | |||
168 | */ | |||
169 | static PetscErrorCode DMPlexGetRawFacesHybrid_Internal(DM dm, PetscInt dim, PetscInt coneSize, const PetscInt cone[], PetscInt *numFaces, PetscInt *numFacesNotH, PetscInt *faceSize, const PetscInt *faces[]) | |||
170 | { | |||
171 | PetscInt *facesTmp; | |||
172 | PetscInt maxConeSize, maxSupportSize; | |||
173 | PetscErrorCode ierr; | |||
174 | ||||
175 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 175; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
176 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),176,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),176,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if ( ((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm )0x44000001),176,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),176,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
177 | if (faces && coneSize) PetscValidIntPointer(cone,4)do { if (!cone) return PetscError(((MPI_Comm)0x44000001),177, __func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",4); if (!PetscCheckPointer(cone,PETSC_INT)) return PetscError(((MPI_Comm )0x44000001),177,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,4); } while (0); | |||
178 | ierr = DMPlexGetMaxSizes(dm, &maxConeSize, &maxSupportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),178,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
179 | if (faces) {ierr = DMGetWorkArray(dm, PetscSqr(PetscMax(maxConeSize, maxSupportSize))(((((maxConeSize)<(maxSupportSize)) ? (maxSupportSize) : ( maxConeSize)))*((((maxConeSize)<(maxSupportSize)) ? (maxSupportSize ) : (maxConeSize)))), MPIU_INT((MPI_Datatype)0x4c000405), &facesTmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),179,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
180 | switch (dim) { | |||
181 | case 1: | |||
182 | switch (coneSize) { | |||
183 | case 2: | |||
184 | if (faces) { | |||
185 | facesTmp[0] = cone[0]; facesTmp[1] = cone[1]; | |||
186 | *faces = facesTmp; | |||
187 | } | |||
188 | if (numFaces) *numFaces = 2; | |||
189 | if (numFacesNotH) *numFacesNotH = 2; | |||
190 | if (faceSize) *faceSize = 1; | |||
191 | break; | |||
192 | default: | |||
193 | SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Cone size %D not supported for dimension %D", coneSize, dim)return PetscError(((MPI_Comm)0x44000001),193,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,63,PETSC_ERROR_INITIAL,"Cone size %D not supported for dimension %D" ,coneSize,dim); | |||
194 | } | |||
195 | break; | |||
196 | case 2: | |||
197 | switch (coneSize) { | |||
198 | case 4: | |||
199 | if (faces) { | |||
200 | facesTmp[0] = cone[0]; facesTmp[1] = cone[1]; | |||
201 | facesTmp[2] = cone[2]; facesTmp[3] = cone[3]; | |||
202 | facesTmp[4] = cone[0]; facesTmp[5] = cone[2]; | |||
203 | facesTmp[6] = cone[1]; facesTmp[7] = cone[3]; | |||
204 | *faces = facesTmp; | |||
205 | } | |||
206 | if (numFaces) *numFaces = 4; | |||
207 | if (numFacesNotH) *numFacesNotH = 2; | |||
208 | if (faceSize) *faceSize = 2; | |||
209 | break; | |||
210 | default: | |||
211 | SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Cone size %D not supported for dimension %D", coneSize, dim)return PetscError(((MPI_Comm)0x44000001),211,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,63,PETSC_ERROR_INITIAL,"Cone size %D not supported for dimension %D" ,coneSize,dim); | |||
212 | } | |||
213 | break; | |||
214 | case 3: | |||
215 | switch (coneSize) { | |||
216 | case 6: /* triangular prism */ | |||
217 | if (faces) { | |||
218 | facesTmp[0] = cone[0]; facesTmp[1] = cone[1]; facesTmp[2] = cone[2]; facesTmp[3] = -1; /* Bottom */ | |||
219 | facesTmp[4] = cone[3]; facesTmp[5] = cone[4]; facesTmp[6] = cone[5]; facesTmp[7] = -1; /* Top */ | |||
220 | facesTmp[8] = cone[0]; facesTmp[9] = cone[1]; facesTmp[10] = cone[3]; facesTmp[11] = cone[4]; /* Back left */ | |||
221 | facesTmp[12] = cone[1]; facesTmp[13] = cone[2]; facesTmp[14] = cone[4]; facesTmp[15] = cone[5]; /* Back right */ | |||
222 | facesTmp[16] = cone[2]; facesTmp[17] = cone[0]; facesTmp[18] = cone[5]; facesTmp[19] = cone[3]; /* Front */ | |||
223 | *faces = facesTmp; | |||
224 | } | |||
225 | if (numFaces) *numFaces = 5; | |||
226 | if (numFacesNotH) *numFacesNotH = 2; | |||
227 | if (faceSize) *faceSize = -4; | |||
228 | break; | |||
229 | default: | |||
230 | SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Cone size %D not supported for dimension %D", coneSize, dim)return PetscError(((MPI_Comm)0x44000001),230,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,63,PETSC_ERROR_INITIAL,"Cone size %D not supported for dimension %D" ,coneSize,dim); | |||
231 | } | |||
232 | break; | |||
233 | default: | |||
234 | SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Dimension %D not supported", dim)return PetscError(((MPI_Comm)0x44000001),234,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,63,PETSC_ERROR_INITIAL,"Dimension %D not supported",dim); | |||
235 | } | |||
236 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
237 | } | |||
238 | ||||
239 | static PetscErrorCode DMPlexRestoreRawFacesHybrid_Internal(DM dm, PetscInt dim, PetscInt coneSize, const PetscInt cone[], PetscInt *numFaces, PetscInt *numFacesNotH, PetscInt *faceSize, const PetscInt *faces[]) | |||
240 | { | |||
241 | PetscErrorCode ierr; | |||
242 | ||||
243 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 243; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
244 | if (faces) { ierr = DMRestoreWorkArray(dm, 0, MPIU_INT((MPI_Datatype)0x4c000405), (void *) faces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),244,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); } | |||
245 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
246 | } | |||
247 | ||||
248 | static PetscErrorCode DMPlexGetFacesHybrid_Internal(DM dm, PetscInt dim, PetscInt p, PetscInt *numFaces, PetscInt *numFacesNotH, PetscInt *faceSize, const PetscInt *faces[]) | |||
249 | { | |||
250 | const PetscInt *cone = NULL((void*)0); | |||
251 | PetscInt coneSize; | |||
252 | PetscErrorCode ierr; | |||
253 | ||||
254 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 254; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
255 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),255,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),255,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if ( ((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm )0x44000001),255,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),255,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
256 | ierr = DMPlexGetConeSize(dm, p, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),256,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
257 | ierr = DMPlexGetCone(dm, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),257,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
258 | ierr = DMPlexGetRawFacesHybrid_Internal(dm, dim, coneSize, cone, numFaces, numFacesNotH, faceSize, faces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),258,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
259 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
260 | } | |||
261 | ||||
262 | /* This interpolates faces for cells at some stratum */ | |||
263 | static PetscErrorCode DMPlexInterpolateFaces_Internal(DM dm, PetscInt cellDepth, DM idm) | |||
264 | { | |||
265 | DMLabel subpointMap; | |||
266 | PetscHashIJKL faceTable; | |||
267 | PetscInt *pStart, *pEnd; | |||
268 | PetscInt cellDim, depth, faceDepth = cellDepth, numPoints = 0, faceSizeAll = 0, face, c, d; | |||
269 | PetscInt coneSizeH = 0, faceSizeAllH = 0, faceSizeAllT = 0, numCellFacesH = 0, faceT = 0, faceH, pMax = -1, dim, outerloop; | |||
270 | PetscInt cMax, fMax, eMax, vMax; | |||
271 | PetscErrorCode ierr; | |||
272 | ||||
273 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 273; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
274 | ierr = DMGetDimension(dm, &cellDim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),274,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
275 | /* HACK: I need a better way to determine face dimension, or an alternative to GetFaces() */ | |||
276 | ierr = DMPlexGetSubpointMap(dm, &subpointMap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),276,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
277 | if (subpointMap) ++cellDim; | |||
278 | ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),278,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
279 | ++depth; | |||
280 | ++cellDepth; | |||
281 | cellDim -= depth - cellDepth; | |||
282 | ierr = PetscMalloc2(depth+1,&pStart,depth+1,&pEnd)PetscMallocA(2,PETSC_FALSE,282,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,(size_t)(depth+1)*sizeof(**(&pStart)),(&pStart),(size_t )(depth+1)*sizeof(**(&pEnd)),(&pEnd));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),282,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
283 | for (d = depth-1; d >= faceDepth; --d) { | |||
284 | ierr = DMPlexGetDepthStratum(dm, d, &pStart[d+1], &pEnd[d+1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),284,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
285 | } | |||
286 | ierr = DMPlexGetDepthStratum(dm, -1, NULL((void*)0), &pStart[faceDepth]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),286,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
287 | pEnd[faceDepth] = pStart[faceDepth]; | |||
288 | for (d = faceDepth-1; d >= 0; --d) { | |||
289 | ierr = DMPlexGetDepthStratum(dm, d, &pStart[d], &pEnd[d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),289,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
290 | } | |||
291 | cMax = fMax = eMax = vMax = PETSC_DETERMINE-1; | |||
292 | ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),292,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
293 | if (cellDim == dim) { | |||
294 | ierr = DMPlexGetHybridBounds(dm, &cMax, NULL((void*)0), NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),294,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
295 | pMax = cMax; | |||
296 | } else if (cellDim == dim -1) { | |||
297 | ierr = DMPlexGetHybridBounds(dm, &cMax, &fMax, NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),297,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
298 | pMax = fMax; | |||
299 | } | |||
300 | pMax = pMax < 0 ? pEnd[cellDepth] : pMax; | |||
301 | if (pMax < pEnd[cellDepth]) { | |||
302 | const PetscInt *cellFaces, *cone; | |||
303 | PetscInt numCellFacesT, faceSize, cf; | |||
304 | ||||
305 | /* First get normal cell face size (we now allow hybrid cells to meet normal cells on either hybrid or normal faces */ | |||
306 | if (pStart[cellDepth] < pMax) {ierr = DMPlexGetFaces_Internal(dm, cellDim, pStart[cellDepth], NULL((void*)0), &faceSizeAll, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),306,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
307 | ||||
308 | ierr = DMPlexGetConeSize(dm, pMax, &coneSizeH);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),308,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
309 | ierr = DMPlexGetCone(dm, pMax, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),309,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
310 | ierr = DMPlexGetRawFacesHybrid_Internal(dm, cellDim, coneSizeH, cone, &numCellFacesH, &numCellFacesT, &faceSize, &cellFaces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),310,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
311 | if (faceSize < 0) { | |||
312 | PetscInt *sizes, minv, maxv; | |||
313 | ||||
314 | /* count vertices of hybrid and non-hybrid faces */ | |||
315 | ierr = PetscCalloc1(numCellFacesH, &sizes)PetscMallocA(1,PETSC_TRUE,315,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,(size_t)(numCellFacesH)*sizeof(**(&sizes)),(&sizes));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),315,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
316 | for (cf = 0; cf < numCellFacesT; ++cf) { /* These are the non-hybrid faces */ | |||
317 | const PetscInt *cellFace = &cellFaces[-cf*faceSize]; | |||
318 | PetscInt f; | |||
319 | ||||
320 | for (f = 0; f < -faceSize; ++f) sizes[cf] += (cellFace[f] >= 0 ? 1 : 0); | |||
321 | } | |||
322 | ierr = PetscSortInt(numCellFacesT, sizes);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),322,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
323 | minv = sizes[0]; | |||
324 | maxv = sizes[PetscMax(numCellFacesT-1, 0)(((numCellFacesT-1)<(0)) ? (0) : (numCellFacesT-1))]; | |||
325 | if (minv != maxv) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_SUP, "Different number of vertices for non-hybrid face %D != %D", minv, maxv)return PetscError(((MPI_Comm)0x44000001),325,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,56,PETSC_ERROR_INITIAL,"Different number of vertices for non-hybrid face %D != %D" ,minv,maxv); | |||
326 | faceSizeAllT = minv; | |||
327 | ierr = PetscArrayzero(sizes, numCellFacesH)PetscMemzero(sizes,(numCellFacesH)*sizeof(*(sizes)));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),327,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
328 | for (cf = numCellFacesT; cf < numCellFacesH; ++cf) { /* These are the hybrid faces */ | |||
329 | const PetscInt *cellFace = &cellFaces[-cf*faceSize]; | |||
330 | PetscInt f; | |||
331 | ||||
332 | for (f = 0; f < -faceSize; ++f) sizes[cf-numCellFacesT] += (cellFace[f] >= 0 ? 1 : 0); | |||
333 | } | |||
334 | ierr = PetscSortInt(numCellFacesH - numCellFacesT, sizes);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),334,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
335 | minv = sizes[0]; | |||
336 | maxv = sizes[PetscMax(numCellFacesH - numCellFacesT-1, 0)(((numCellFacesH - numCellFacesT-1)<(0)) ? (0) : (numCellFacesH - numCellFacesT-1))]; | |||
337 | ierr = PetscFree(sizes)((*PetscTrFree)((void*)(sizes),337,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ) || ((sizes) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),337,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
338 | if (minv != maxv) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_SUP, "Different number of vertices for hybrid face %D != %D", minv, maxv)return PetscError(((MPI_Comm)0x44000001),338,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,56,PETSC_ERROR_INITIAL,"Different number of vertices for hybrid face %D != %D" ,minv,maxv); | |||
339 | faceSizeAllH = minv; | |||
340 | if (!faceSizeAll) faceSizeAll = faceSizeAllT; | |||
341 | } else { /* the size of the faces in hybrid cells is the same */ | |||
342 | faceSizeAll = faceSizeAllH = faceSizeAllT = faceSize; | |||
343 | } | |||
344 | ierr = DMPlexRestoreRawFacesHybrid_Internal(dm, cellDim, coneSizeH, cone, &numCellFacesH, &numCellFacesT, &faceSize, &cellFaces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),344,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
345 | } else if (pEnd[cellDepth] > pStart[cellDepth]) { | |||
346 | ierr = DMPlexGetFaces_Internal(dm, cellDim, pStart[cellDepth], NULL((void*)0), &faceSizeAll, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),346,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
347 | faceSizeAllH = faceSizeAllT = faceSizeAll; | |||
348 | } | |||
349 | if (faceSizeAll > 4) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Do not support interpolation of meshes with faces of %D vertices", faceSizeAll)return PetscError(((MPI_Comm)0x44000001),349,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,62,PETSC_ERROR_INITIAL,"Do not support interpolation of meshes with faces of %D vertices" ,faceSizeAll); | |||
350 | ||||
351 | /* With hybrid grids, we first iterate on hybrid cells and start numbering the non-hybrid faces | |||
352 | Then, faces for non-hybrid cells are numbered. | |||
353 | This is to guarantee consistent orientations (all 0) of all the points in the cone of the hybrid cells */ | |||
354 | ierr = PetscHashIJKLCreate(&faceTable);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),354,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
355 | for (outerloop = 0, face = pStart[faceDepth]; outerloop < 2; outerloop++) { | |||
356 | PetscInt start, end; | |||
357 | ||||
358 | start = outerloop == 0 ? pMax : pStart[cellDepth]; | |||
359 | end = outerloop == 0 ? pEnd[cellDepth] : pMax; | |||
360 | for (c = start; c < end; ++c) { | |||
361 | const PetscInt *cellFaces; | |||
362 | PetscInt numCellFaces, faceSize, faceSizeInc, faceSizeCheck, cf; | |||
363 | ||||
364 | if (c < pMax) { | |||
365 | ierr = DMPlexGetFaces_Internal(dm, cellDim, c, &numCellFaces, &faceSize, &cellFaces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),365,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
366 | if (faceSize != faceSizeAll) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Inconsistent face for cell %D of size %D != %D", c, faceSize, faceSizeAll)return PetscError(((MPI_Comm)0x44000001),366,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"Inconsistent face for cell %D of size %D != %D" ,c,faceSize,faceSizeAll); | |||
367 | faceSizeCheck = faceSizeAll; | |||
368 | } else { /* Hybrid cell */ | |||
369 | const PetscInt *cone; | |||
370 | PetscInt numCellFacesN, coneSize; | |||
371 | ||||
372 | ierr = DMPlexGetConeSize(dm, c, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),372,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
373 | if (coneSize != coneSizeH) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_SUP, "Unexpected hybrid coneSize %D != %D", coneSize, coneSizeH)return PetscError(((MPI_Comm)0x44000001),373,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,56,PETSC_ERROR_INITIAL,"Unexpected hybrid coneSize %D != %D" ,coneSize,coneSizeH); | |||
374 | ierr = DMPlexGetCone(dm, c, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),374,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
375 | ierr = DMPlexGetRawFacesHybrid_Internal(dm, cellDim, coneSize, cone, &numCellFaces, &numCellFacesN, &faceSize, &cellFaces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),375,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
376 | if (numCellFaces != numCellFacesH) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_SUP, "Unexpected numCellFaces %D != %D for hybrid cell %D", numCellFaces, numCellFacesH, c)return PetscError(((MPI_Comm)0x44000001),376,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,56,PETSC_ERROR_INITIAL,"Unexpected numCellFaces %D != %D for hybrid cell %D" ,numCellFaces,numCellFacesH,c); | |||
377 | faceSize = PetscMax(faceSize, -faceSize)(((faceSize)<(-faceSize)) ? (-faceSize) : (faceSize)); | |||
378 | if (faceSize > 4) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Do not support interpolation of meshes with faces of %D vertices", faceSize)return PetscError(((MPI_Comm)0x44000001),378,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,62,PETSC_ERROR_INITIAL,"Do not support interpolation of meshes with faces of %D vertices" ,faceSize); | |||
379 | numCellFaces = numCellFacesN; /* process only non-hybrid faces */ | |||
380 | faceSizeCheck = faceSizeAllT; | |||
381 | } | |||
382 | faceSizeInc = faceSize; | |||
383 | for (cf = 0; cf < numCellFaces; ++cf) { | |||
384 | const PetscInt *cellFace = &cellFaces[cf*faceSizeInc]; | |||
385 | PetscInt faceSizeH = faceSize; | |||
386 | PetscHashIJKLKey key; | |||
387 | PetscHashIter iter; | |||
388 | PetscBool missing; | |||
389 | ||||
390 | if (faceSizeInc == 2) { | |||
391 | key.i = PetscMin(cellFace[0], cellFace[1])(((cellFace[0])<(cellFace[1])) ? (cellFace[0]) : (cellFace [1])); | |||
392 | key.j = PetscMax(cellFace[0], cellFace[1])(((cellFace[0])<(cellFace[1])) ? (cellFace[1]) : (cellFace [0])); | |||
393 | key.k = PETSC_MAX_INT2147483647; | |||
394 | key.l = PETSC_MAX_INT2147483647; | |||
395 | } else { | |||
396 | key.i = cellFace[0]; | |||
397 | key.j = cellFace[1]; | |||
398 | key.k = cellFace[2]; | |||
399 | key.l = faceSize > 3 ? (cellFace[3] < 0 ? faceSizeH = 3, PETSC_MAX_INT2147483647 : cellFace[3]) : PETSC_MAX_INT2147483647; | |||
400 | ierr = PetscSortInt(faceSize, (PetscInt *) &key);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),400,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
401 | } | |||
402 | /* this check is redundant for non-hybrid meshes */ | |||
403 | if (faceSizeH != faceSizeCheck) SETERRQ4(PETSC_COMM_SELF, PETSC_ERR_SUP, "Unexpected number of vertices for face %D of point %D -> %D != %D", cf, c, faceSizeH, faceSizeCheck)return PetscError(((MPI_Comm)0x44000001),403,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,56,PETSC_ERROR_INITIAL,"Unexpected number of vertices for face %D of point %D -> %D != %D" ,cf,c,faceSizeH,faceSizeCheck); | |||
404 | ierr = PetscHashIJKLPut(faceTable, key, &iter, &missing);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),404,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
405 | if (missing) { | |||
406 | ierr = PetscHashIJKLIterSet(faceTable, iter, face++);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),406,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
407 | if (c >= pMax) ++faceT; | |||
408 | } | |||
409 | } | |||
410 | if (c < pMax) { | |||
411 | ierr = DMPlexRestoreFaces_Internal(dm, cellDim, c, &numCellFaces, &faceSize, &cellFaces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),411,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
412 | } else { | |||
413 | ierr = DMPlexRestoreRawFacesHybrid_Internal(dm, cellDim, coneSizeH, NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0), &cellFaces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),413,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
414 | } | |||
415 | } | |||
416 | } | |||
417 | pEnd[faceDepth] = face; | |||
418 | ||||
419 | /* Second pass for hybrid meshes: number hybrid faces */ | |||
420 | for (c = pMax; c < pEnd[cellDepth]; ++c) { | |||
421 | const PetscInt *cellFaces, *cone; | |||
422 | PetscInt numCellFaces, numCellFacesN, faceSize, cf, coneSize; | |||
423 | ||||
424 | ierr = DMPlexGetConeSize(dm, c, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),424,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
425 | ierr = DMPlexGetCone(dm, c, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),425,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
426 | ierr = DMPlexGetRawFacesHybrid_Internal(dm, cellDim, coneSize, cone, &numCellFaces, &numCellFacesN, &faceSize, &cellFaces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),426,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
427 | if (numCellFaces != numCellFacesH) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_SUP, "Unexpected hybrid numCellFaces %D != %D", numCellFaces, numCellFacesH)return PetscError(((MPI_Comm)0x44000001),427,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,56,PETSC_ERROR_INITIAL,"Unexpected hybrid numCellFaces %D != %D" ,numCellFaces,numCellFacesH); | |||
428 | faceSize = PetscMax(faceSize, -faceSize)(((faceSize)<(-faceSize)) ? (-faceSize) : (faceSize)); | |||
429 | for (cf = numCellFacesN; cf < numCellFaces; ++cf) { /* These are the hybrid faces */ | |||
430 | const PetscInt *cellFace = &cellFaces[cf*faceSize]; | |||
431 | PetscHashIJKLKey key; | |||
432 | PetscHashIter iter; | |||
433 | PetscBool missing; | |||
434 | PetscInt faceSizeH = faceSize; | |||
435 | ||||
436 | if (faceSize == 2) { | |||
437 | key.i = PetscMin(cellFace[0], cellFace[1])(((cellFace[0])<(cellFace[1])) ? (cellFace[0]) : (cellFace [1])); | |||
438 | key.j = PetscMax(cellFace[0], cellFace[1])(((cellFace[0])<(cellFace[1])) ? (cellFace[1]) : (cellFace [0])); | |||
439 | key.k = PETSC_MAX_INT2147483647; | |||
440 | key.l = PETSC_MAX_INT2147483647; | |||
441 | } else { | |||
442 | key.i = cellFace[0]; | |||
443 | key.j = cellFace[1]; | |||
444 | key.k = cellFace[2]; | |||
445 | key.l = faceSize > 3 ? (cellFace[3] < 0 ? faceSizeH = 3, PETSC_MAX_INT2147483647 : cellFace[3]) : PETSC_MAX_INT2147483647; | |||
446 | ierr = PetscSortInt(faceSize, (PetscInt *) &key);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),446,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
447 | } | |||
448 | if (faceSizeH != faceSizeAllH) SETERRQ4(PETSC_COMM_SELF, PETSC_ERR_SUP, "Unexpected number of vertices for hybrid face %D of point %D -> %D != %D", cf, c, faceSizeH, faceSizeAllH)return PetscError(((MPI_Comm)0x44000001),448,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,56,PETSC_ERROR_INITIAL,"Unexpected number of vertices for hybrid face %D of point %D -> %D != %D" ,cf,c,faceSizeH,faceSizeAllH); | |||
449 | ierr = PetscHashIJKLPut(faceTable, key, &iter, &missing);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),449,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
450 | if (missing) {ierr = PetscHashIJKLIterSet(faceTable, iter, face++);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),450,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
451 | } | |||
452 | ierr = DMPlexRestoreRawFacesHybrid_Internal(dm, cellDim, coneSize, cone, &numCellFaces, &numCellFacesN, &faceSize, &cellFaces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),452,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
453 | } | |||
454 | faceH = face - pEnd[faceDepth]; | |||
455 | if (faceH) { | |||
456 | if (fMax == PETSC_DETERMINE-1) fMax = pEnd[faceDepth]; | |||
457 | else if (eMax == PETSC_DETERMINE-1) eMax = pEnd[faceDepth]; | |||
458 | else SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Number of unassigned hybrid facets %D for cellDim %D and dimension %D", faceH, cellDim, dim)return PetscError(((MPI_Comm)0x44000001),458,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"Number of unassigned hybrid facets %D for cellDim %D and dimension %D" ,faceH,cellDim,dim); | |||
459 | } | |||
460 | pEnd[faceDepth] = face; | |||
461 | ierr = PetscHashIJKLDestroy(&faceTable);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),461,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
462 | /* Count new points */ | |||
463 | for (d = 0; d <= depth; ++d) { | |||
464 | numPoints += pEnd[d]-pStart[d]; | |||
465 | } | |||
466 | ierr = DMPlexSetChart(idm, 0, numPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),466,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
467 | /* Set cone sizes */ | |||
468 | for (d = 0; d <= depth; ++d) { | |||
469 | PetscInt coneSize, p; | |||
470 | ||||
471 | if (d == faceDepth) { | |||
472 | /* Now we have two cases: */ | |||
473 | if (faceSizeAll == faceSizeAllT) { | |||
474 | /* I see no way to do this if we admit faces of different shapes */ | |||
475 | for (p = pStart[d]; p < pEnd[d]-faceH; ++p) { | |||
476 | ierr = DMPlexSetConeSize(idm, p, faceSizeAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),476,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
477 | } | |||
478 | for (p = pEnd[d]-faceH; p < pEnd[d]; ++p) { | |||
479 | ierr = DMPlexSetConeSize(idm, p, faceSizeAllH);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
480 | } | |||
481 | } else if (faceSizeAll == faceSizeAllH) { | |||
482 | for (p = pStart[d]; p < pStart[d]+faceT; ++p) { | |||
483 | ierr = DMPlexSetConeSize(idm, p, faceSizeAllT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),483,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
484 | } | |||
485 | for (p = pStart[d]+faceT; p < pEnd[d]-faceH; ++p) { | |||
486 | ierr = DMPlexSetConeSize(idm, p, faceSizeAll);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),486,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
487 | } | |||
488 | for (p = pEnd[d]-faceH; p < pEnd[d]; ++p) { | |||
489 | ierr = DMPlexSetConeSize(idm, p, faceSizeAllH);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),489,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
490 | } | |||
491 | } else SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Inconsistent faces sizes N: %D T: %D H: %D", faceSizeAll, faceSizeAllT, faceSizeAllH)return PetscError(((MPI_Comm)0x44000001),491,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"Inconsistent faces sizes N: %D T: %D H: %D" ,faceSizeAll,faceSizeAllT,faceSizeAllH); | |||
492 | } else if (d == cellDepth) { | |||
493 | for (p = pStart[d]; p < pEnd[d]; ++p) { | |||
494 | /* Number of cell faces may be different from number of cell vertices*/ | |||
495 | if (p < pMax) { | |||
496 | ierr = DMPlexGetFaces_Internal(dm, cellDim, p, &coneSize, NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),496,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
497 | } else { | |||
498 | ierr = DMPlexGetFacesHybrid_Internal(dm, cellDim, p, &coneSize, NULL((void*)0), NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),498,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
499 | } | |||
500 | ierr = DMPlexSetConeSize(idm, p, coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),500,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
501 | } | |||
502 | } else { | |||
503 | for (p = pStart[d]; p < pEnd[d]; ++p) { | |||
504 | ierr = DMPlexGetConeSize(dm, p, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),504,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
505 | ierr = DMPlexSetConeSize(idm, p, coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),505,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
506 | } | |||
507 | } | |||
508 | } | |||
509 | ierr = DMSetUp(idm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),509,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
510 | /* Get face cones from subsets of cell vertices */ | |||
511 | if (faceSizeAll > 4) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Do not support interpolation of meshes with faces of %D vertices", faceSizeAll)return PetscError(((MPI_Comm)0x44000001),511,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,62,PETSC_ERROR_INITIAL,"Do not support interpolation of meshes with faces of %D vertices" ,faceSizeAll); | |||
512 | ierr = PetscHashIJKLCreate(&faceTable);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),512,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
513 | for (d = depth; d > cellDepth; --d) { | |||
514 | const PetscInt *cone; | |||
515 | PetscInt p; | |||
516 | ||||
517 | for (p = pStart[d]; p < pEnd[d]; ++p) { | |||
518 | ierr = DMPlexGetCone(dm, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),518,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
519 | ierr = DMPlexSetCone(idm, p, cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),519,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
520 | ierr = DMPlexGetConeOrientation(dm, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),520,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
521 | ierr = DMPlexSetConeOrientation(idm, p, cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),521,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
522 | } | |||
523 | } | |||
524 | for (outerloop = 0, face = pStart[faceDepth]; outerloop < 2; outerloop++) { | |||
525 | PetscInt start, end; | |||
526 | ||||
527 | start = outerloop == 0 ? pMax : pStart[cellDepth]; | |||
528 | end = outerloop == 0 ? pEnd[cellDepth] : pMax; | |||
529 | for (c = start; c < end; ++c) { | |||
530 | const PetscInt *cellFaces; | |||
531 | PetscInt numCellFaces, faceSize, faceSizeInc, cf; | |||
532 | ||||
533 | if (c < pMax) { | |||
534 | ierr = DMPlexGetFaces_Internal(dm, cellDim, c, &numCellFaces, &faceSize, &cellFaces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),534,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
535 | if (faceSize != faceSizeAll) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Inconsistent face for cell %D of size %D != %D", c, faceSize, faceSizeAll)return PetscError(((MPI_Comm)0x44000001),535,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"Inconsistent face for cell %D of size %D != %D" ,c,faceSize,faceSizeAll); | |||
536 | } else { | |||
537 | const PetscInt *cone; | |||
538 | PetscInt numCellFacesN, coneSize; | |||
539 | ||||
540 | ierr = DMPlexGetConeSize(dm, c, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),540,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
541 | if (coneSize != coneSizeH) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_SUP, "Unexpected hybrid coneSize %D != %D", coneSize, coneSizeH)return PetscError(((MPI_Comm)0x44000001),541,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,56,PETSC_ERROR_INITIAL,"Unexpected hybrid coneSize %D != %D" ,coneSize,coneSizeH); | |||
542 | ierr = DMPlexGetCone(dm, c, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),542,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
543 | ierr = DMPlexGetRawFacesHybrid_Internal(dm, cellDim, coneSize, cone, &numCellFaces, &numCellFacesN, &faceSize, &cellFaces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),543,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
544 | if (numCellFaces != numCellFacesH) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_SUP, "Unexpected numCellFaces %D != %D for hybrid cell %D", numCellFaces, numCellFacesH, c)return PetscError(((MPI_Comm)0x44000001),544,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,56,PETSC_ERROR_INITIAL,"Unexpected numCellFaces %D != %D for hybrid cell %D" ,numCellFaces,numCellFacesH,c); | |||
545 | faceSize = PetscMax(faceSize, -faceSize)(((faceSize)<(-faceSize)) ? (-faceSize) : (faceSize)); | |||
546 | if (faceSize > 4) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Do not support interpolation of meshes with faces of %D vertices", faceSize)return PetscError(((MPI_Comm)0x44000001),546,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,62,PETSC_ERROR_INITIAL,"Do not support interpolation of meshes with faces of %D vertices" ,faceSize); | |||
547 | numCellFaces = numCellFacesN; /* process only non-hybrid faces */ | |||
548 | } | |||
549 | faceSizeInc = faceSize; | |||
550 | for (cf = 0; cf < numCellFaces; ++cf) { | |||
551 | const PetscInt *cellFace = &cellFaces[cf*faceSizeInc]; | |||
552 | PetscHashIJKLKey key; | |||
553 | PetscHashIter iter; | |||
554 | PetscBool missing; | |||
555 | ||||
556 | if (faceSizeInc == 2) { | |||
557 | key.i = PetscMin(cellFace[0], cellFace[1])(((cellFace[0])<(cellFace[1])) ? (cellFace[0]) : (cellFace [1])); | |||
558 | key.j = PetscMax(cellFace[0], cellFace[1])(((cellFace[0])<(cellFace[1])) ? (cellFace[1]) : (cellFace [0])); | |||
559 | key.k = PETSC_MAX_INT2147483647; | |||
560 | key.l = PETSC_MAX_INT2147483647; | |||
561 | } else { | |||
562 | key.i = cellFace[0]; | |||
563 | key.j = cellFace[1]; | |||
564 | key.k = cellFace[2]; | |||
565 | key.l = faceSizeInc > 3 ? (cellFace[3] < 0 ? faceSize = 3, PETSC_MAX_INT2147483647 : cellFace[3]) : PETSC_MAX_INT2147483647; | |||
566 | ierr = PetscSortInt(faceSizeInc, (PetscInt *) &key);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),566,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
567 | } | |||
568 | ierr = PetscHashIJKLPut(faceTable, key, &iter, &missing);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),568,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
569 | if (missing) { | |||
570 | ierr = DMPlexSetCone(idm, face, cellFace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),570,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
571 | ierr = PetscHashIJKLIterSet(faceTable, iter, face);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),571,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
572 | ierr = DMPlexInsertCone(idm, c, cf, face++);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),572,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
573 | } else { | |||
574 | const PetscInt *cone; | |||
575 | PetscInt coneSize, ornt, i, j, f; | |||
576 | ||||
577 | ierr = PetscHashIJKLIterGet(faceTable, iter, &f);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),577,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
578 | ierr = DMPlexInsertCone(idm, c, cf, f);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),578,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
579 | /* Orient face: Do not allow reverse orientation at the first vertex */ | |||
580 | ierr = DMPlexGetConeSize(idm, f, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),580,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
581 | ierr = DMPlexGetCone(idm, f, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),581,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
582 | if (coneSize != faceSize) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Invalid number of face vertices %D for face %D should be %D", coneSize, f, faceSize)return PetscError(((MPI_Comm)0x44000001),582,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"Invalid number of face vertices %D for face %D should be %D" ,coneSize,f,faceSize); | |||
583 | /* - First find the initial vertex */ | |||
584 | for (i = 0; i < faceSize; ++i) if (cellFace[0] == cone[i]) break; | |||
585 | /* - Try forward comparison */ | |||
586 | for (j = 0; j < faceSize; ++j) if (cellFace[j] != cone[(i+j)%faceSize]) break; | |||
587 | if (j == faceSize) { | |||
588 | if ((faceSize == 2) && (i == 1)) ornt = -2; | |||
589 | else ornt = i; | |||
590 | } else { | |||
591 | /* - Try backward comparison */ | |||
592 | for (j = 0; j < faceSize; ++j) if (cellFace[j] != cone[(i+faceSize-j)%faceSize]) break; | |||
593 | if (j == faceSize) { | |||
594 | if (i == 0) ornt = -faceSize; | |||
595 | else ornt = -i; | |||
596 | } else SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Could not determine orientation of face %D in cell %D", f, c)return PetscError(((MPI_Comm)0x44000001),596,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"Could not determine orientation of face %D in cell %D" ,f,c); | |||
597 | } | |||
598 | ierr = DMPlexInsertConeOrientation(idm, c, cf, ornt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),598,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
599 | } | |||
600 | } | |||
601 | if (c < pMax) { | |||
602 | ierr = DMPlexRestoreFaces_Internal(dm, cellDim, c, &numCellFaces, &faceSize, &cellFaces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),602,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
603 | } else { | |||
604 | ierr = DMPlexRestoreRawFacesHybrid_Internal(dm, cellDim, coneSizeH, NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0), &cellFaces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),604,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
605 | } | |||
606 | } | |||
607 | } | |||
608 | /* Second pass for hybrid meshes: orient hybrid faces */ | |||
609 | for (c = pMax; c < pEnd[cellDepth]; ++c) { | |||
610 | const PetscInt *cellFaces, *cone; | |||
611 | PetscInt numCellFaces, numCellFacesN, faceSize, cf, coneSize; | |||
612 | ||||
613 | ierr = DMPlexGetConeSize(dm, c, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),613,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
614 | ierr = DMPlexGetCone(dm, c, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),614,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
615 | ierr = DMPlexGetRawFacesHybrid_Internal(dm, cellDim, coneSize, cone, &numCellFaces, &numCellFacesN, &faceSize, &cellFaces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),615,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
616 | if (numCellFaces != numCellFacesH) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_SUP, "Unexpected hybrid numCellFaces %D != %D", numCellFaces, numCellFacesH)return PetscError(((MPI_Comm)0x44000001),616,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,56,PETSC_ERROR_INITIAL,"Unexpected hybrid numCellFaces %D != %D" ,numCellFaces,numCellFacesH); | |||
617 | faceSize = PetscMax(faceSize, -faceSize)(((faceSize)<(-faceSize)) ? (-faceSize) : (faceSize)); | |||
618 | for (cf = numCellFacesN; cf < numCellFaces; ++cf) { /* These are the hybrid faces */ | |||
619 | const PetscInt *cellFace = &cellFaces[cf*faceSize]; | |||
620 | PetscHashIJKLKey key; | |||
621 | PetscHashIter iter; | |||
622 | PetscBool missing; | |||
623 | PetscInt faceSizeH = faceSize; | |||
624 | ||||
625 | if (faceSize == 2) { | |||
626 | key.i = PetscMin(cellFace[0], cellFace[1])(((cellFace[0])<(cellFace[1])) ? (cellFace[0]) : (cellFace [1])); | |||
627 | key.j = PetscMax(cellFace[0], cellFace[1])(((cellFace[0])<(cellFace[1])) ? (cellFace[1]) : (cellFace [0])); | |||
628 | key.k = PETSC_MAX_INT2147483647; | |||
629 | key.l = PETSC_MAX_INT2147483647; | |||
630 | } else { | |||
631 | key.i = cellFace[0]; | |||
632 | key.j = cellFace[1]; | |||
633 | key.k = cellFace[2]; | |||
634 | key.l = faceSize > 3 ? (cellFace[3] < 0 ? faceSizeH = 3, PETSC_MAX_INT2147483647 : cellFace[3]) : PETSC_MAX_INT2147483647; | |||
635 | ierr = PetscSortInt(faceSize, (PetscInt *) &key);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),635,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
636 | } | |||
637 | if (faceSizeH != faceSizeAllH) SETERRQ4(PETSC_COMM_SELF, PETSC_ERR_SUP, "Unexpected number of vertices for hybrid face %D of point %D -> %D != %D", cf, c, faceSizeH, faceSizeAllH)return PetscError(((MPI_Comm)0x44000001),637,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,56,PETSC_ERROR_INITIAL,"Unexpected number of vertices for hybrid face %D of point %D -> %D != %D" ,cf,c,faceSizeH,faceSizeAllH); | |||
638 | ierr = PetscHashIJKLPut(faceTable, key, &iter, &missing);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),638,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
639 | if (missing) { | |||
640 | ierr = DMPlexSetCone(idm, face, cellFace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),640,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
641 | ierr = PetscHashIJKLIterSet(faceTable, iter, face);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),641,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
642 | ierr = DMPlexInsertCone(idm, c, cf, face++);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),642,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
643 | } else { | |||
644 | PetscInt fv[4] = {0, 1, 2, 3}; | |||
645 | const PetscInt *cone; | |||
646 | PetscInt coneSize, ornt, i, j, f; | |||
647 | ||||
648 | ierr = PetscHashIJKLIterGet(faceTable, iter, &f);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),648,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
649 | ierr = DMPlexInsertCone(idm, c, cf, f);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),649,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
650 | /* Orient face: Do not allow reverse orientation at the first vertex */ | |||
651 | ierr = DMPlexGetConeSize(idm, f, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),651,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
652 | ierr = DMPlexGetCone(idm, f, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),652,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
653 | if (coneSize != faceSizeH) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Invalid number of face vertices %D for face %D should be %D", coneSize, f, faceSizeH)return PetscError(((MPI_Comm)0x44000001),653,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"Invalid number of face vertices %D for face %D should be %D" ,coneSize,f,faceSizeH); | |||
654 | /* Hybrid faces are stored as tensor products of edges, so to compare them to normal faces, we have to flip */ | |||
655 | if (faceSize == 4 && c >= pMax && faceSizeAll != faceSizeAllT && f < pEnd[faceDepth] - faceH) {fv[2] = 3; fv[3] = 2;} | |||
656 | /* - First find the initial vertex */ | |||
657 | for (i = 0; i < faceSizeH; ++i) if (cellFace[fv[0]] == cone[i]) break; | |||
658 | /* - Try forward comparison */ | |||
659 | for (j = 0; j < faceSizeH; ++j) if (cellFace[fv[j]] != cone[(i+j)%faceSizeH]) break; | |||
660 | if (j == faceSizeH) { | |||
661 | if ((faceSizeH == 2) && (i == 1)) ornt = -2; | |||
662 | else ornt = i; | |||
663 | } else { | |||
664 | /* - Try backward comparison */ | |||
665 | for (j = 0; j < faceSizeH; ++j) if (cellFace[fv[j]] != cone[(i+faceSizeH-j)%faceSizeH]) break; | |||
666 | if (j == faceSizeH) { | |||
667 | if (i == 0) ornt = -faceSizeH; | |||
668 | else ornt = -i; | |||
669 | } else SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Could not determine orientation of face %D in cell %D", f, c)return PetscError(((MPI_Comm)0x44000001),669,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"Could not determine orientation of face %D in cell %D" ,f,c); | |||
670 | } | |||
671 | ierr = DMPlexInsertConeOrientation(idm, c, cf, ornt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),671,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
672 | } | |||
673 | } | |||
674 | ierr = DMPlexRestoreRawFacesHybrid_Internal(dm, cellDim, coneSize, cone, &numCellFaces, &numCellFacesN, &faceSize, &cellFaces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),674,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
675 | } | |||
676 | if (face != pEnd[faceDepth]) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Invalid number of faces %D should be %D", face-pStart[faceDepth], pEnd[faceDepth]-pStart[faceDepth])return PetscError(((MPI_Comm)0x44000001),676,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"Invalid number of faces %D should be %D" ,face-pStart[faceDepth],pEnd[faceDepth]-pStart[faceDepth]); | |||
677 | ierr = PetscFree2(pStart,pEnd)PetscFreeA(2,677,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,&(pStart),&(pEnd));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),677,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
678 | ierr = PetscHashIJKLDestroy(&faceTable);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),678,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
679 | ierr = PetscFree2(pStart,pEnd)PetscFreeA(2,679,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,&(pStart),&(pEnd));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),679,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
680 | ierr = DMPlexSetHybridBounds(idm, cMax, fMax, eMax, vMax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),680,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
681 | ierr = DMPlexSymmetrize(idm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),681,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
682 | ierr = DMPlexStratify(idm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),682,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
683 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
684 | } | |||
685 | ||||
686 | PetscErrorCode DMPlexOrientCell(DM dm, PetscInt p, PetscInt masterConeSize, const PetscInt masterCone[]) | |||
687 | { | |||
688 | PetscInt coneSize; | |||
689 | PetscInt start1=0; | |||
690 | PetscBool reverse1=PETSC_FALSE; | |||
691 | const PetscInt *cone=NULL((void*)0); | |||
692 | PetscErrorCode ierr; | |||
693 | ||||
694 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 694; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
695 | ierr = DMPlexGetConeSize(dm, p, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),695,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
696 | if (!coneSize) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); /* do nothing for points with no cone */ | |||
697 | ierr = DMPlexGetCone(dm, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),697,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
698 | ierr = DMPlexFixFaceOrientations_Orient_Private(coneSize, masterConeSize, masterCone, cone, &start1, &reverse1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),698,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
699 | #if defined(PETSC_USE_DEBUG1) | |||
700 | if (PetscUnlikely(cone[start1] != masterCone[0])__builtin_expect(!!(cone[start1] != masterCone[0]),0)) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_PLIB, "The algorithm above is wrong as cone[%d] = %d != %d = masterCone[0]", start1, cone[start1], masterCone[0])return PetscError(((MPI_Comm)0x44000001),700,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"The algorithm above is wrong as cone[%d] = %d != %d = masterCone[0]" ,start1,cone[start1],masterCone[0]); | |||
701 | #endif | |||
702 | ierr = DMPlexOrientCell_Internal(dm, p, start1, reverse1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),702,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
703 | #if defined(PETSC_USE_DEBUG1) | |||
704 | { | |||
705 | PetscInt c; | |||
706 | ierr = DMPlexGetCone(dm, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),706,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
707 | for (c = 0; c < 2; c++) { | |||
708 | if (PetscUnlikely(cone[c] != masterCone[c])__builtin_expect(!!(cone[c] != masterCone[c]),0)) SETERRQ4(PETSC_COMM_SELF, PETSC_ERR_PLIB, "The algorithm above is wrong as cone[%d] = %d != %d = masterCone[%d]", c, cone[c], masterCone[c], c)return PetscError(((MPI_Comm)0x44000001),708,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"The algorithm above is wrong as cone[%d] = %d != %d = masterCone[%d]" ,c,cone[c],masterCone[c],c); | |||
709 | } | |||
710 | } | |||
711 | #endif | |||
712 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
713 | } | |||
714 | ||||
715 | PetscErrorCode DMPlexOrientCell_Internal(DM dm, PetscInt p, PetscInt start1, PetscBool reverse1) | |||
716 | { | |||
717 | PetscInt i, j, k, maxConeSize, coneSize, coneConeSize, supportSize, supportConeSize; | |||
718 | PetscInt start0, start; | |||
719 | PetscBool reverse0, reverse; | |||
720 | PetscInt newornt; | |||
721 | const PetscInt *cone=NULL((void*)0), *support=NULL((void*)0), *supportCone=NULL((void*)0), *ornts=NULL((void*)0); | |||
722 | PetscInt *newcone=NULL((void*)0), *newornts=NULL((void*)0); | |||
723 | PetscErrorCode ierr; | |||
724 | ||||
725 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 725; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
726 | if (!start1 && !reverse1) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
727 | ierr = DMPlexGetConeSize(dm, p, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),727,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
728 | if (!coneSize) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); /* do nothing for points with no cone */ | |||
729 | ierr = DMPlexGetCone(dm, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),729,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
730 | ierr = DMPlexGetMaxSizes(dm, &maxConeSize, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),730,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
731 | /* permute p's cone and orientations */ | |||
732 | ierr = DMPlexGetConeOrientation(dm, p, &ornts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),732,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
733 | ierr = DMGetWorkArray(dm, maxConeSize, MPIU_INT((MPI_Datatype)0x4c000405), &newcone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),733,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
734 | ierr = DMGetWorkArray(dm, maxConeSize, MPIU_INT((MPI_Datatype)0x4c000405), &newornts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),734,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
735 | ierr = DMPlexFixFaceOrientations_Permute_Private(coneSize, cone, start1, reverse1, newcone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),735,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
736 | ierr = DMPlexFixFaceOrientations_Permute_Private(coneSize, ornts, start1, reverse1, newornts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),736,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
737 | /* if direction of p (face) is flipped, flip also p's cone points (edges) */ | |||
738 | if (reverse1) { | |||
739 | for (i=0; i<coneSize; i++) { | |||
740 | ierr = DMPlexGetConeSize(dm, cone[i], &coneConeSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),740,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
741 | ierr = DMPlexFixFaceOrientations_Translate_Private(newornts[i], &start0, &reverse0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),741,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
742 | ierr = DMPlexFixFaceOrientations_Combine_Private(coneConeSize, start0, reverse0, 1, PETSC_FALSE, &start, &reverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),742,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
743 | ierr = DMPlexFixFaceOrientations_TranslateBack_Private(coneConeSize, start, reverse, &newornts[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),743,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
744 | } | |||
745 | } | |||
746 | ierr = DMPlexSetConeOrientation(dm, p, newornts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),746,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
747 | /* fix oriention of p within cones of p's support points */ | |||
748 | ierr = DMPlexGetSupport(dm, p, &support);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),748,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
749 | ierr = DMPlexGetSupportSize(dm, p, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),749,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
750 | for (j=0; j<supportSize; j++) { | |||
751 | ierr = DMPlexGetCone(dm, support[j], &supportCone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),751,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
752 | ierr = DMPlexGetConeSize(dm, support[j], &supportConeSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),752,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
753 | ierr = DMPlexGetConeOrientation(dm, support[j], &ornts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),753,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
754 | for (k=0; k<supportConeSize; k++) { | |||
755 | if (supportCone[k] != p) continue; | |||
756 | ierr = DMPlexFixFaceOrientations_Translate_Private(ornts[k], &start0, &reverse0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),756,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
757 | ierr = DMPlexFixFaceOrientations_Combine_Private(coneSize, start0, reverse0, start1, reverse1, &start, &reverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),757,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
758 | ierr = DMPlexFixFaceOrientations_TranslateBack_Private(coneSize, start, reverse, &newornt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),758,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
759 | ierr = DMPlexInsertConeOrientation(dm, support[j], k, newornt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),759,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
760 | } | |||
761 | } | |||
762 | /* rewrite cone */ | |||
763 | ierr = DMPlexSetCone(dm, p, newcone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),763,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
764 | ierr = DMRestoreWorkArray(dm, maxConeSize, MPIU_INT((MPI_Datatype)0x4c000405), &newcone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),764,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
765 | ierr = DMRestoreWorkArray(dm, maxConeSize, MPIU_INT((MPI_Datatype)0x4c000405), &newornts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),765,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
766 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
767 | } | |||
768 | ||||
769 | static PetscErrorCode SortRmineRremoteByRemote_Private(PetscSF sf, PetscInt *rmine1[], PetscInt *rremote1[]) | |||
770 | { | |||
771 | PetscInt nleaves; | |||
772 | PetscInt nranks; | |||
773 | const PetscMPIInt *ranks=NULL((void*)0); | |||
774 | const PetscInt *roffset=NULL((void*)0), *rmine=NULL((void*)0), *rremote=NULL((void*)0); | |||
775 | PetscInt n, o, r; | |||
776 | PetscErrorCode ierr; | |||
777 | ||||
778 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 778; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
779 | ierr = PetscSFGetRanks(sf, &nranks, &ranks, &roffset, &rmine, &rremote);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),779,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
780 | nleaves = roffset[nranks]; | |||
781 | ierr = PetscMalloc2(nleaves, rmine1, nleaves, rremote1)PetscMallocA(2,PETSC_FALSE,781,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,(size_t)(nleaves)*sizeof(**(rmine1)),(rmine1),(size_t)(nleaves )*sizeof(**(rremote1)),(rremote1));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),781,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
782 | for (r=0; r<nranks; r++) { | |||
783 | /* simultaneously sort rank-wise portions of rmine & rremote by values in rremote | |||
784 | - to unify order with the other side */ | |||
785 | o = roffset[r]; | |||
786 | n = roffset[r+1] - o; | |||
787 | ierr = PetscArraycpy(&(*rmine1)[o], &rmine[o], n)((sizeof(*(&(*rmine1)[o])) != sizeof(*(&rmine[o]))) || PetscMemcpy(&(*rmine1)[o],&rmine[o],(n)*sizeof(*(& (*rmine1)[o]))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),787,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
788 | ierr = PetscArraycpy(&(*rremote1)[o], &rremote[o], n)((sizeof(*(&(*rremote1)[o])) != sizeof(*(&rremote[o]) )) || PetscMemcpy(&(*rremote1)[o],&rremote[o],(n)*sizeof (*(&(*rremote1)[o]))));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),788,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
789 | ierr = PetscSortIntWithArray(n, &(*rremote1)[o], &(*rmine1)[o]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),789,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
790 | } | |||
791 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
792 | } | |||
793 | ||||
794 | PetscErrorCode DMPlexOrientInterface(DM dm) | |||
795 | { | |||
796 | PetscSF sf=NULL((void*)0); | |||
797 | PetscInt (*roots)[2], (*leaves)[2]; | |||
798 | PetscMPIInt (*rootsRanks)[2], (*leavesRanks)[2]; | |||
799 | const PetscInt *locals=NULL((void*)0); | |||
800 | const PetscSFNode *remotes=NULL((void*)0); | |||
801 | PetscInt nroots, nleaves, p, c; | |||
802 | PetscInt nranks, n, o, r; | |||
803 | const PetscMPIInt *ranks=NULL((void*)0); | |||
804 | const PetscInt *roffset=NULL((void*)0); | |||
805 | PetscInt *rmine1=NULL((void*)0), *rremote1=NULL((void*)0); /* rmine and rremote copies simultaneously sorted by rank and rremote */ | |||
806 | const PetscInt *cone=NULL((void*)0); | |||
807 | PetscInt coneSize, ind0; | |||
808 | MPI_Comm comm; | |||
809 | PetscMPIInt rank; | |||
810 | PetscInt debug = 0; | |||
811 | PetscErrorCode ierr; | |||
812 | ||||
813 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 813; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
814 | ierr = DMGetPointSF(dm, &sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),814,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
815 | ierr = PetscSFGetGraph(sf, &nroots, &nleaves, &locals, &remotes);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),815,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
816 | if (nroots < 0) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
817 | ierr = PetscSFSetUp(sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),817,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
818 | ierr = PetscSFGetRanks(sf, &nranks, &ranks, &roffset, NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),818,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
819 | #if defined(PETSC_USE_DEBUG1) | |||
820 | ierr = DMViewFromOptions(dm, NULL((void*)0), "-before_fix_dm_view");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),820,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
821 | ierr = DMPlexCheckPointSF(dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),821,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
822 | #endif | |||
823 | ierr = SortRmineRremoteByRemote_Private(sf, &rmine1, &rremote1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),823,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
824 | ierr = PetscMalloc4(nroots, &roots, nroots, &leaves, nroots, &rootsRanks, nroots, &leavesRanks)PetscMallocA(4,PETSC_FALSE,824,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,(size_t)(nroots)*sizeof(**(&roots)),(&roots),(size_t )(nroots)*sizeof(**(&leaves)),(&leaves),(size_t)(nroots )*sizeof(**(&rootsRanks)),(&rootsRanks),(size_t)(nroots )*sizeof(**(&leavesRanks)),(&leavesRanks));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),824,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
825 | ierr = PetscObjectGetComm((PetscObject) dm, &comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),825,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
826 | ierr = MPI_Comm_rank(comm, &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),826,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
827 | if (debug && rank == 0) {ierr = PetscSynchronizedPrintf(comm, "Roots\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),827,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
828 | for (p = 0; p < nroots; ++p) { | |||
829 | ierr = DMPlexGetConeSize(dm, p, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),829,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
830 | ierr = DMPlexGetCone(dm, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),830,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
831 | /* Translate all points to root numbering */ | |||
832 | for (c = 0; c < 2; c++) { | |||
833 | if (coneSize > 1) { | |||
834 | ierr = PetscFindInt(cone[c], nleaves, locals, &ind0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),834,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
835 | if (ind0 < 0) { | |||
836 | roots[p][c] = cone[c]; | |||
837 | rootsRanks[p][c] = rank; | |||
838 | } else { | |||
839 | roots[p][c] = remotes[ind0].index; | |||
840 | rootsRanks[p][c] = remotes[ind0].rank; | |||
841 | } | |||
842 | } else { | |||
843 | roots[p][c] = -1; | |||
844 | rootsRanks[p][c] = -1; | |||
845 | } | |||
846 | } | |||
847 | } | |||
848 | if (debug) { | |||
849 | for (p = 0; p < nroots; ++p) { | |||
850 | ierr = DMPlexGetConeSize(dm, p, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),850,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
851 | ierr = DMPlexGetCone(dm, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),851,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
852 | if (coneSize > 1) { | |||
853 | ierr = PetscSynchronizedPrintf(comm, "[%d] %D: cone=[%D %D] roots=[%D %D] rootsRanks=[%D %D]\n", rank, p, cone[0], cone[1], roots[p][0], roots[p][1], rootsRanks[p][0], rootsRanks[p][1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),853,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
854 | } | |||
855 | } | |||
856 | ierr = PetscSynchronizedFlush(comm, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),856,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
857 | } | |||
858 | for (p = 0; p < nroots; ++p) { | |||
859 | for (c = 0; c < 2; c++) { | |||
860 | leaves[p][c] = -2; | |||
861 | leavesRanks[p][c] = -2; | |||
862 | } | |||
863 | } | |||
864 | ierr = PetscSFBcastBegin(sf, MPIU_2INT((MPI_Datatype)0x4c000816), roots, leaves);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),864,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
865 | ierr = PetscSFBcastBegin(sf, MPI_2INT((MPI_Datatype)0x4c000816), rootsRanks, leavesRanks);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),865,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
866 | ierr = PetscSFBcastEnd(sf, MPIU_2INT((MPI_Datatype)0x4c000816), roots, leaves);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),866,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
867 | ierr = PetscSFBcastEnd(sf, MPI_2INT((MPI_Datatype)0x4c000816), rootsRanks, leavesRanks);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),867,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
868 | if (debug) {ierr = PetscSynchronizedFlush(comm, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),868,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
869 | if (debug && rank == 0) {ierr = PetscSynchronizedPrintf(comm, "Referred leaves\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),869,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
870 | for (p = 0; p < nroots; ++p) { | |||
871 | if (leaves[p][0] < 0) continue; | |||
872 | ierr = DMPlexGetConeSize(dm, p, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),872,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
873 | ierr = DMPlexGetCone(dm, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),873,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
874 | if (debug) {ierr = PetscSynchronizedPrintf(comm, "[%d] %D: cone=[%D %D] leaves=[%D %D] roots=[%D %D] leavesRanks=[%D %D] rootsRanks=[%D %D]\n", rank, p, cone[0], cone[1], leaves[p][0], leaves[p][1], roots[p][0], roots[p][1], leavesRanks[p][0], leavesRanks[p][1], rootsRanks[p][0], rootsRanks[p][1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),874,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
875 | if ((leaves[p][0] != roots[p][0]) || (leaves[p][1] != roots[p][1]) || (leavesRanks[p][0] != rootsRanks[p][0]) || (leavesRanks[p][0] != rootsRanks[p][0])) { | |||
876 | PetscInt masterCone[2]; | |||
877 | /* Translate these two cone points back to leave numbering */ | |||
878 | for (c = 0; c < 2; c++) { | |||
879 | if (leavesRanks[p][c] == rank) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_PLIB, "this should never happen - remote rank of point %D is the same rank",leavesRanks[p][c])return PetscError(((MPI_Comm)0x44000001),879,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"this should never happen - remote rank of point %D is the same rank" ,leavesRanks[p][c]); | |||
880 | /* Find index of rank leavesRanks[p][c] among remote ranks */ | |||
881 | /* No need for PetscMPIIntCast because these integers were originally cast from PetscMPIInt. */ | |||
882 | ierr = PetscFindMPIInt((PetscMPIInt)leavesRanks[p][c], nranks, ranks, &r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),882,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
883 | if (PetscUnlikely(r < 0)__builtin_expect(!!(r < 0),0)) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_PLIB, "this should never happen - rank %D not found among remote ranks",leavesRanks[p][c])return PetscError(((MPI_Comm)0x44000001),883,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"this should never happen - rank %D not found among remote ranks" ,leavesRanks[p][c]); | |||
884 | /* Find point leaves[p][c] among remote points aimed at rank leavesRanks[p][c] */ | |||
885 | o = roffset[r]; | |||
886 | n = roffset[r+1] - o; | |||
887 | ierr = PetscFindInt(leaves[p][c], n, &rremote1[o], &ind0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),887,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
888 | if (PetscUnlikely(ind0 < 0)__builtin_expect(!!(ind0 < 0),0)) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_PLIB, "No cone point of %D is connected to (%D, %D) - it seems there is missing connection in point SF!",p,ranks[r],leaves[p][c])return PetscError(((MPI_Comm)0x44000001),888,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"No cone point of %D is connected to (%D, %D) - it seems there is missing connection in point SF!" ,p,ranks[r],leaves[p][c]); | |||
889 | /* Get the corresponding local point */ | |||
890 | masterCone[c] = rmine1[o+ind0];CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),890,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
891 | } | |||
892 | if (debug) {ierr = PetscSynchronizedPrintf(comm, "[%d] %D: masterCone=[%D %D]\n", rank, p, masterCone[0], masterCone[1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),892,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
893 | /* Vaclav's note: Here we only compare first 2 points of the cone. Full cone size would lead to stronger self-checking. */ | |||
894 | ierr = DMPlexOrientCell(dm, p, 2, masterCone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),894,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
895 | } | |||
896 | } | |||
897 | #if defined(PETSC_USE_DEBUG1) | |||
898 | ierr = DMViewFromOptions(dm, NULL((void*)0), "-after_fix_dm_view");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),898,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
899 | for (r = 0; r < nleaves; ++r) { | |||
900 | p = locals[r]; | |||
901 | ierr = DMPlexGetConeSize(dm, p, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),901,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
902 | if (!coneSize) continue; | |||
903 | ierr = DMPlexGetCone(dm, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),903,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
904 | for (c = 0; c < 2; c++) { | |||
905 | ierr = PetscFindInt(cone[c], nleaves, locals, &ind0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),905,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
906 | if (ind0 < 0) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Point SF contains %D but is missing its cone point cone[%D] = %D!", p, c, cone[c])return PetscError(((MPI_Comm)0x44000001),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"Point SF contains %D but is missing its cone point cone[%D] = %D!" ,p,c,cone[c]); | |||
907 | if (leaves[p][c] != remotes[ind0].index || leavesRanks[p][c] != remotes[ind0].rank) { | |||
908 | if (leavesRanks[p][c] == rank) { | |||
909 | PetscInt ind1; | |||
910 | ierr = PetscFindInt(leaves[p][c], nleaves, locals, &ind1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),910,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
911 | if (ind1 < 0) { | |||
912 | SETERRQ8(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Point %D = locals[%d]: cone[%D]=%D --> (%D, %D) differs from the enforced (%D, %D). The latter was not even found among the local SF points - it is probably broken!", p, r, c, cone[c], remotes[ind0].rank, remotes[ind0].index, leavesRanks[p][c], leaves[p][c])return PetscError(((MPI_Comm)0x44000001),912,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"Point %D = locals[%d]: cone[%D]=%D --> (%D, %D) differs from the enforced (%D, %D). The latter was not even found among the local SF points - it is probably broken!" ,p,r,c,cone[c],remotes[ind0].rank,remotes[ind0].index,leavesRanks [p][c],leaves[p][c]); | |||
913 | } else { | |||
914 | SETERRQ9(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Point %D = locals[%d]: cone[%D]=%D --> (%D, %D) differs from the enforced %D --> (%D, %D). Is the algorithm above or the point SF broken?", p, r, c, cone[c], remotes[ind0].rank, remotes[ind0].index, leaves[p][c], remotes[ind1].rank, remotes[ind1].index)return PetscError(((MPI_Comm)0x44000001),914,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"Point %D = locals[%d]: cone[%D]=%D --> (%D, %D) differs from the enforced %D --> (%D, %D). Is the algorithm above or the point SF broken?" ,p,r,c,cone[c],remotes[ind0].rank,remotes[ind0].index,leaves[ p][c],remotes[ind1].rank,remotes[ind1].index); | |||
915 | } | |||
916 | } else { | |||
917 | SETERRQ8(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Point %D = locals[%d]: cone[%D]=%D --> (%D, %D) differs from the enforced (%D, %D). Is the algorithm above or the point SF broken?", p, r, c, cone[c], remotes[ind0].rank, remotes[ind0].index, leavesRanks[p][c], leaves[p][c])return PetscError(((MPI_Comm)0x44000001),917,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"Point %D = locals[%d]: cone[%D]=%D --> (%D, %D) differs from the enforced (%D, %D). Is the algorithm above or the point SF broken?" ,p,r,c,cone[c],remotes[ind0].rank,remotes[ind0].index,leavesRanks [p][c],leaves[p][c]); | |||
918 | } | |||
919 | } | |||
920 | } | |||
921 | } | |||
922 | #endif | |||
923 | if (debug) {ierr = PetscSynchronizedFlush(comm, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),923,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
924 | ierr = PetscFree4(roots, leaves, rootsRanks, leavesRanks)PetscFreeA(4,924,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,&(roots),&(leaves),&(rootsRanks),&(leavesRanks ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),924,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
925 | ierr = PetscFree2(rmine1, rremote1)PetscFreeA(2,925,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,&(rmine1),&(rremote1));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),925,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
926 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
927 | } | |||
928 | ||||
929 | static PetscErrorCode IntArrayViewFromOptions(MPI_Comm comm, const char opt[], const char name[], const char idxname[], const char valname[], PetscInt n, const PetscInt a[]) | |||
930 | { | |||
931 | PetscInt idx; | |||
932 | PetscMPIInt rank; | |||
933 | PetscBool flg; | |||
934 | PetscErrorCode ierr; | |||
935 | ||||
936 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 936; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
937 | ierr = PetscOptionsHasName(NULL((void*)0), NULL((void*)0), opt, &flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),937,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
938 | if (!flg) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
939 | ierr = MPI_Comm_rank(comm, &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),939,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
940 | ierr = PetscSynchronizedPrintf(comm, "[%d]%s:\n", rank, name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),940,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
941 | for (idx = 0; idx < n; ++idx) {ierr = PetscSynchronizedPrintf(comm, "[%d]%s %D %s %D\n", rank, idxname, idx, valname, a[idx]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),941,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
942 | ierr = PetscSynchronizedFlush(comm, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),942,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
943 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
944 | } | |||
945 | ||||
946 | static PetscErrorCode SFNodeArrayViewFromOptions(MPI_Comm comm, const char opt[], const char name[], const char idxname[], PetscInt n, const PetscSFNode a[]) | |||
947 | { | |||
948 | PetscInt idx; | |||
949 | PetscMPIInt rank; | |||
950 | PetscBool flg; | |||
951 | PetscErrorCode ierr; | |||
952 | ||||
953 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 953; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
954 | ierr = PetscOptionsHasName(NULL((void*)0), NULL((void*)0), opt, &flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),954,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
955 | if (!flg) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
956 | ierr = MPI_Comm_rank(comm, &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),956,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
957 | ierr = PetscSynchronizedPrintf(comm, "[%d]%s:\n", rank, name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),957,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
958 | if (idxname) { | |||
959 | for (idx = 0; idx < n; ++idx) {ierr = PetscSynchronizedPrintf(comm, "[%d]%s %D rank %D index %D\n", rank, idxname, idx, a[idx].rank, a[idx].index);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),959,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
960 | } else { | |||
961 | for (idx = 0; idx < n; ++idx) {ierr = PetscSynchronizedPrintf(comm, "[%d]rank %D index %D\n", rank, a[idx].rank, a[idx].index);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),961,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
962 | } | |||
963 | ierr = PetscSynchronizedFlush(comm, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),963,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
964 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
965 | } | |||
966 | ||||
967 | static PetscErrorCode DMPlexMapToLocalPoint(PetscHMapIJ roothash, const PetscInt localPoints[], PetscMPIInt rank, PetscSFNode remotePoint, PetscInt *localPoint) | |||
968 | { | |||
969 | PetscErrorCode ierr; | |||
970 | ||||
971 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 971; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
972 | if (remotePoint.rank == rank) { | |||
973 | *localPoint = remotePoint.index; | |||
974 | } else { | |||
975 | PetscHashIJKey key; | |||
976 | PetscInt root; | |||
977 | ||||
978 | key.i = remotePoint.index; | |||
979 | key.j = remotePoint.rank; | |||
980 | ierr = PetscHMapIJGet(roothash, key, &root);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),980,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
981 | if (root >= 0) { | |||
982 | *localPoint = localPoints[root]; | |||
983 | } else PetscFunctionReturn(1)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(1);} while (0); | |||
984 | } | |||
985 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
986 | } | |||
987 | ||||
988 | /*@ | |||
989 | DMPlexInterpolatePointSF - Insert interpolated points in the overlap into the PointSF in parallel, following local interpolation | |||
990 | ||||
991 | Collective on dm | |||
992 | ||||
993 | Input Parameters: | |||
994 | + dm - The interpolated DM | |||
995 | - pointSF - The initial SF without interpolated points | |||
996 | ||||
997 | Output Parameter: | |||
998 | . pointSF - The SF including interpolated points | |||
999 | ||||
1000 | Level: intermediate | |||
1001 | ||||
1002 | Note: All debugging for this process can be turned on with the options: -dm_interp_pre_view -petscsf_interp_pre_view -petscsection_interp_candidate_view -petscsection_interp_candidate_remote_view -petscsection_interp_claim_view -petscsf_interp_pre_view -dmplex_interp_debug | |||
1003 | ||||
1004 | .seealso: DMPlexInterpolate(), DMPlexUninterpolate() | |||
1005 | @*/ | |||
1006 | PetscErrorCode DMPlexInterpolatePointSF(DM dm, PetscSF pointSF) | |||
1007 | { | |||
1008 | /* | |||
1009 | Okay, the algorithm is: | |||
1010 | - Take each point in the overlap (root) | |||
1011 | - Look at the neighboring points in the overlap (candidates) | |||
1012 | - Send these candidate points to neighbors | |||
1013 | - Neighbor checks for edge between root and candidate | |||
1014 | - If edge is found, it replaces candidate point with edge point | |||
1015 | - Send back the overwritten candidates (claims) | |||
1016 | - Original guy checks for edges, different from original candidate, and gets its own edge | |||
1017 | - This pair is put into SF | |||
1018 | ||||
1019 | We need a new algorithm that tolerates groups larger than 2. | |||
1020 | - Take each point in the overlap (root) | |||
1021 | - Find all collections of points in the overlap which make faces (do early join) | |||
1022 | - Send collections as candidates (add size as first number) | |||
1023 | - Make sure to send collection to all owners of all overlap points in collection | |||
1024 | - Neighbor check for face in collections | |||
1025 | - If face is found, it replaces candidate point with face point | |||
1026 | - Send back the overwritten candidates (claims) | |||
1027 | - Original guy checks for faces, different from original candidate, and gets its own face | |||
1028 | - This pair is put into SF | |||
1029 | */ | |||
1030 | PetscHMapI leafhash; | |||
1031 | PetscHMapIJ roothash; | |||
1032 | const PetscInt *localPoints, *rootdegree; | |||
1033 | const PetscSFNode *remotePoints; | |||
1034 | PetscSFNode *candidates, *candidatesRemote, *claims; | |||
1035 | PetscSection candidateSection, candidateSectionRemote, claimSection; | |||
1036 | PetscInt numLeaves, l, numRoots, r, candidatesSize, candidatesRemoteSize; | |||
1037 | PetscMPIInt size, rank; | |||
1038 | PetscHashIJKey key; | |||
1039 | PetscBool debug = PETSC_FALSE; | |||
1040 | PetscErrorCode ierr; | |||
1041 | ||||
1042 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 1042; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1043 | ierr = PetscOptionsHasName(NULL((void*)0), ((PetscObject) dm)->prefix, "-dmplex_interp_debug", &debug);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1043,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1044 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject) dm), &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1044,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1045 | ierr = MPI_Comm_rank(PetscObjectComm((PetscObject) dm), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1045,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1046 | ierr = PetscSFGetGraph(pointSF, &numRoots, &numLeaves, &localPoints, &remotePoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1046,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1047 | if (size < 2 || numRoots < 0) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
| ||||
1048 | ierr = PetscObjectViewFromOptions((PetscObject) dm, NULL((void*)0), "-dm_interp_pre_view");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1048,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1049 | ierr = PetscObjectViewFromOptions((PetscObject) pointSF, NULL((void*)0), "-petscsf_interp_pre_view");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1049,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1050 | ierr = PetscLogEventBegin(DMPLEX_InterpolateSF,dm,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [DMPLEX_InterpolateSF].active) ? (*PetscLogPLB)((DMPLEX_InterpolateSF ),0,(PetscObject)(dm),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1050,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1051 | /* Build hashes of points in the SF for efficient lookup */ | |||
1052 | ierr = PetscHMapICreate(&leafhash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1052,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1053 | ierr = PetscHMapIJCreate(&roothash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1053,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1054 | for (l = 0; l < numLeaves; ++l) { | |||
1055 | key.i = remotePoints[l].index; | |||
1056 | key.j = remotePoints[l].rank; | |||
1057 | ierr = PetscHMapISet(leafhash, localPoints[l], l);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1057,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1058 | ierr = PetscHMapIJSet(roothash, key, l);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1058,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1059 | } | |||
1060 | /* Compute root degree to identify shared points */ | |||
1061 | ierr = PetscSFComputeDegreeBegin(pointSF, &rootdegree);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1061,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1062 | ierr = PetscSFComputeDegreeEnd(pointSF, &rootdegree);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1062,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1063 | ierr = IntArrayViewFromOptions(PetscObjectComm((PetscObject) dm), "-interp_root_degree_view", "Root degree", "point", "degree", numRoots, rootdegree);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1063,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1064 | /* Build a section / SFNode array of candidate points (face bd points) in the cone(support(leaf)), | |||
1065 | where each candidate is defined by a set of remote points (roots) for the other points that define the face. */ | |||
1066 | ierr = PetscSectionCreate(PetscObjectComm((PetscObject) dm), &candidateSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1066,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1067 | ierr = PetscSectionSetChart(candidateSection, 0, numRoots);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1067,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1068 | { | |||
1069 | PetscHMapIJ facehash; | |||
1070 | ||||
1071 | ierr = PetscHMapIJCreate(&facehash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1071,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1072 | for (l = 0; l < numLeaves; ++l) { | |||
1073 | const PetscInt localPoint = localPoints[l]; | |||
1074 | const PetscInt *support; | |||
1075 | PetscInt supportSize, s; | |||
1076 | ||||
1077 | if (debug) {ierr = PetscSynchronizedPrintf(PetscObjectComm((PetscObject) dm), "[%d] Checking local point %D\n", rank, localPoint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1077,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1078 | ierr = DMPlexGetSupportSize(dm, localPoint, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1078,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1079 | ierr = DMPlexGetSupport(dm, localPoint, &support);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1079,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1080 | for (s = 0; s < supportSize; ++s) { | |||
1081 | const PetscInt face = support[s]; | |||
1082 | const PetscInt *cone; | |||
1083 | PetscInt coneSize, c, f, root; | |||
1084 | PetscBool isFace = PETSC_TRUE; | |||
1085 | ||||
1086 | /* Only add face once */ | |||
1087 | if (debug) {ierr = PetscSynchronizedPrintf(PetscObjectComm((PetscObject) dm), "[%d] Support point %D\n", rank, face);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1087,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1088 | key.i = localPoint; | |||
1089 | key.j = face; | |||
1090 | ierr = PetscHMapIJGet(facehash, key, &f);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1090,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1091 | if (f >= 0) continue; | |||
1092 | ierr = DMPlexGetConeSize(dm, face, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1092,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1093 | ierr = DMPlexGetCone(dm, face, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1093,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1094 | /* If a cone point does not map to leaves on any proc, then do not put face in SF */ | |||
1095 | for (c = 0; c < coneSize; ++c) { | |||
1096 | if (debug) {ierr = PetscSynchronizedPrintf(PetscObjectComm((PetscObject) dm), "[%d] Cone point %D\n", rank, cone[c]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1096,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1097 | ierr = PetscHMapIGet(leafhash, cone[c], &root);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1097,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1098 | if (!rootdegree[cone[c]] && (root < 0)) {isFace = PETSC_FALSE; break;} | |||
1099 | } | |||
1100 | if (isFace) { | |||
1101 | if (debug) {ierr = PetscSynchronizedPrintf(PetscObjectComm((PetscObject) dm), "[%d] Found shared face %D\n", rank, face);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1101,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1102 | ierr = PetscHMapIJSet(facehash, key, l);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1102,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1103 | ierr = PetscSectionAddDof(candidateSection, localPoint, coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1103,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1104 | } | |||
1105 | } | |||
1106 | } | |||
1107 | if (debug) {ierr = PetscSynchronizedFlush(PetscObjectComm((PetscObject) dm), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1107,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1108 | ierr = PetscHMapIJClear(facehash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1108,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1109 | ierr = PetscSectionSetUp(candidateSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1109,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1110 | ierr = PetscSectionGetStorageSize(candidateSection, &candidatesSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1110,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1111 | ierr = PetscMalloc1(candidatesSize, &candidates)PetscMallocA(1,PETSC_FALSE,1111,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,(size_t)(candidatesSize)*sizeof(**(&candidates)),(&candidates ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1111,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1112 | for (l = 0; l < numLeaves; ++l) { | |||
1113 | const PetscInt localPoint = localPoints[l]; | |||
1114 | const PetscInt *support; | |||
1115 | PetscInt supportSize, s, offset, idx = 0; | |||
1116 | ||||
1117 | if (debug) {ierr = PetscSynchronizedPrintf(PetscObjectComm((PetscObject) dm), "[%d] Checking local point %D\n", rank, localPoint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1117,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1118 | ierr = PetscSectionGetOffset(candidateSection, localPoint, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1118,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1119 | ierr = DMPlexGetSupportSize(dm, localPoint, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1119,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1120 | ierr = DMPlexGetSupport(dm, localPoint, &support);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1120,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1121 | for (s = 0; s < supportSize; ++s) { | |||
1122 | const PetscInt face = support[s]; | |||
1123 | const PetscInt *cone; | |||
1124 | PetscInt coneSize, c, f, root; | |||
1125 | PetscBool isFace = PETSC_TRUE; | |||
1126 | ||||
1127 | /* Only add face once */ | |||
1128 | if (debug) {ierr = PetscSynchronizedPrintf(PetscObjectComm((PetscObject) dm), "[%d] Support point %D\n", rank, face);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1128,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1129 | key.i = localPoint; | |||
1130 | key.j = face; | |||
1131 | ierr = PetscHMapIJGet(facehash, key, &f);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1131,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1132 | if (f >= 0) continue; | |||
1133 | ierr = DMPlexGetConeSize(dm, face, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1133,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1134 | ierr = DMPlexGetCone(dm, face, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1134,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1135 | /* If a cone point does not map to leaves on any proc, then do not put face in SF */ | |||
1136 | for (c = 0; c < coneSize; ++c) { | |||
1137 | if (debug) {ierr = PetscSynchronizedPrintf(PetscObjectComm((PetscObject) dm), "[%d] Cone point %D\n", rank, cone[c]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1137,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1138 | ierr = PetscHMapIGet(leafhash, cone[c], &root);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1138,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1139 | if (!rootdegree[cone[c]] && (root < 0)) {isFace = PETSC_FALSE; break;} | |||
1140 | } | |||
1141 | if (isFace) { | |||
1142 | if (debug) {ierr = PetscSynchronizedPrintf(PetscObjectComm((PetscObject) dm), "[%d] Adding shared face %D at idx %D\n", rank, face, idx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1142,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1143 | ierr = PetscHMapIJSet(facehash, key, l);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1143,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1144 | candidates[offset+idx].rank = -1; | |||
1145 | candidates[offset+idx++].index = coneSize-1; | |||
1146 | for (c = 0; c < coneSize; ++c) { | |||
1147 | if (cone[c] == localPoint) continue; | |||
1148 | if (rootdegree[cone[c]]) { | |||
1149 | candidates[offset+idx].rank = rank; | |||
1150 | candidates[offset+idx++].index = cone[c]; | |||
1151 | } else { | |||
1152 | ierr = PetscHMapIGet(leafhash, cone[c], &root);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1152,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1153 | if (root < 0) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Cannot locate local point %D in SF", cone[c])return PetscError(((MPI_Comm)0x44000001),1153,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"Cannot locate local point %D in SF", cone[c]); | |||
1154 | candidates[offset+idx++] = remotePoints[root]; | |||
1155 | } | |||
1156 | } | |||
1157 | } | |||
1158 | } | |||
1159 | } | |||
1160 | if (debug) {ierr = PetscSynchronizedFlush(PetscObjectComm((PetscObject) dm), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1160,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1161 | ierr = PetscHMapIJDestroy(&facehash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1161,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1162 | ierr = PetscObjectViewFromOptions((PetscObject) candidateSection, NULL((void*)0), "-petscsection_interp_candidate_view");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1162,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1163 | ierr = SFNodeArrayViewFromOptions(PetscObjectComm((PetscObject) dm), "-petscsection_interp_candidate_view", "Candidates", NULL((void*)0), candidatesSize, candidates);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1163,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1164 | } | |||
1165 | /* Gather candidate section / array pair into the root partition via inverse(multi(pointSF)). */ | |||
1166 | /* Note that this section is indexed by offsets into leaves, not by point number */ | |||
1167 | { | |||
1168 | PetscSF sfMulti, sfInverse, sfCandidates; | |||
1169 | PetscInt *remoteOffsets; | |||
1170 | ||||
1171 | ierr = PetscSFGetMultiSF(pointSF, &sfMulti);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1171,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1172 | ierr = PetscSFCreateInverseSF(sfMulti, &sfInverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1172,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1173 | ierr = PetscSectionCreate(PetscObjectComm((PetscObject) dm), &candidateSectionRemote);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1173,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1174 | ierr = PetscSFDistributeSection(sfInverse, candidateSection, &remoteOffsets, candidateSectionRemote);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1174,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1175 | ierr = PetscSFCreateSectionSF(sfInverse, candidateSection, remoteOffsets, candidateSectionRemote, &sfCandidates);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1175,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1176 | ierr = PetscSectionGetStorageSize(candidateSectionRemote, &candidatesRemoteSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1176,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1177 | ierr = PetscMalloc1(candidatesRemoteSize, &candidatesRemote)PetscMallocA(1,PETSC_FALSE,1177,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,(size_t)(candidatesRemoteSize)*sizeof(**(&candidatesRemote )),(&candidatesRemote));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1177,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1178 | ierr = PetscSFBcastBegin(sfCandidates, MPIU_2INT((MPI_Datatype)0x4c000816), candidates, candidatesRemote);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1178,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1179 | ierr = PetscSFBcastEnd(sfCandidates, MPIU_2INT((MPI_Datatype)0x4c000816), candidates, candidatesRemote);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1179,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1180 | ierr = PetscSFDestroy(&sfInverse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1180,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1181 | ierr = PetscSFDestroy(&sfCandidates);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1181,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1182 | ierr = PetscFree(remoteOffsets)((*PetscTrFree)((void*)(remoteOffsets),1182,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ) || ((remoteOffsets) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1182,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1183 | ||||
1184 | ierr = PetscObjectViewFromOptions((PetscObject) candidateSectionRemote, NULL((void*)0), "-petscsection_interp_candidate_remote_view");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1184,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1185 | ierr = SFNodeArrayViewFromOptions(PetscObjectComm((PetscObject) dm), "-petscsection_interp_candidate_remote_view", "Remote Candidates", NULL((void*)0), candidatesRemoteSize, candidatesRemote);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1185,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1186 | } | |||
1187 | /* */ | |||
1188 | { | |||
1189 | PetscInt idx; | |||
1190 | /* There is a section point for every leaf attached to a given root point */ | |||
1191 | for (r = 0, idx = 0; r < numRoots; ++r) { | |||
1192 | PetscInt deg; | |||
1193 | for (deg = 0; deg < rootdegree[r]; ++deg, ++idx) { | |||
1194 | PetscInt offset, dof, d; | |||
1195 | ||||
1196 | ierr = PetscSectionGetDof(candidateSectionRemote, idx, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1196,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1197 | ierr = PetscSectionGetOffset(candidateSectionRemote, idx, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1197,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1198 | for (d = 0; d < dof; ++d) { | |||
1199 | const PetscInt sizeInd = offset+d; | |||
1200 | const PetscInt numPoints = candidatesRemote[sizeInd].index; | |||
1201 | const PetscInt *join = NULL((void*)0); | |||
1202 | PetscInt points[1024], p, joinSize; | |||
1203 | ||||
1204 | points[0] = r; | |||
1205 | for (p = 0; p < numPoints; ++p) { | |||
1206 | ierr = DMPlexMapToLocalPoint(roothash, localPoints, rank, candidatesRemote[offset+(++d)], &points[p+1]); | |||
1207 | if (ierr) {d += numPoints-1 - p; break;} /* We got a point not in our overlap */ | |||
1208 | if (debug) {ierr = PetscSynchronizedPrintf(PetscObjectComm((PetscObject) dm), "[%d] Checking local candidate %D\n", rank, points[p+1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1208,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1209 | } | |||
1210 | if (ierr) continue; | |||
1211 | ierr = DMPlexGetJoin(dm, numPoints+1, points, &joinSize, &join);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1211,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1212 | if (joinSize == 1) { | |||
1213 | if (debug) {ierr = PetscSynchronizedPrintf(PetscObjectComm((PetscObject) dm), "[%d] Adding face %D at idx %D\n", rank, join[0], sizeInd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1213,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1214 | candidatesRemote[sizeInd].rank = rank; | |||
1215 | candidatesRemote[sizeInd].index = join[0]; | |||
1216 | } | |||
1217 | ierr = DMPlexRestoreJoin(dm, numPoints+1, points, &joinSize, &join);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1217,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1218 | } | |||
1219 | } | |||
1220 | } | |||
1221 | if (debug) {ierr = PetscSynchronizedFlush(PetscObjectComm((PetscObject) dm), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1221,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1222 | } | |||
1223 | /* Push claims back to receiver via the MultiSF and derive new pointSF mapping on receiver */ | |||
1224 | { | |||
1225 | PetscSF sfMulti, sfClaims, sfPointNew; | |||
1226 | PetscSFNode *remotePointsNew; | |||
1227 | PetscHMapI claimshash; | |||
1228 | PetscInt *remoteOffsets, *localPointsNew; | |||
1229 | PetscInt claimsSize, pStart, pEnd, root, numLocalNew, p, d; | |||
1230 | ||||
1231 | ierr = PetscSFGetMultiSF(pointSF, &sfMulti);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1231,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1232 | ierr = PetscSectionCreate(PetscObjectComm((PetscObject) dm), &claimSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1232,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1233 | ierr = PetscSFDistributeSection(sfMulti, candidateSectionRemote, &remoteOffsets, claimSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1233,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1234 | ierr = PetscSFCreateSectionSF(sfMulti, candidateSectionRemote, remoteOffsets, claimSection, &sfClaims);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1234,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1235 | ierr = PetscSectionGetStorageSize(claimSection, &claimsSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1235,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1236 | ierr = PetscMalloc1(claimsSize, &claims)PetscMallocA(1,PETSC_FALSE,1236,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,(size_t)(claimsSize)*sizeof(**(&claims)),(&claims));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1236,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1237 | ierr = PetscSFBcastBegin(sfClaims, MPIU_2INT((MPI_Datatype)0x4c000816), candidatesRemote, claims);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1237,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1238 | ierr = PetscSFBcastEnd(sfClaims, MPIU_2INT((MPI_Datatype)0x4c000816), candidatesRemote, claims);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1238,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1239 | ierr = PetscSFDestroy(&sfClaims);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1239,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1240 | ierr = PetscFree(remoteOffsets)((*PetscTrFree)((void*)(remoteOffsets),1240,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ) || ((remoteOffsets) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1240,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1241 | ierr = PetscObjectViewFromOptions((PetscObject) claimSection, NULL((void*)0), "-petscsection_interp_claim_view");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1241,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1242 | ierr = SFNodeArrayViewFromOptions(PetscObjectComm((PetscObject) dm), "-petscsection_interp_claim_view", "Claims", NULL((void*)0), claimsSize, claims);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1242,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1243 | /* Walk the original section of local supports and add an SF entry for each updated item */ | |||
1244 | ierr = PetscHMapICreate(&claimshash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1244,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1245 | for (p = 0; p < numRoots; ++p) { | |||
1246 | PetscInt dof, offset; | |||
1247 | ||||
1248 | if (debug) {ierr = PetscSynchronizedPrintf(PetscObjectComm((PetscObject) dm), "[%d] Checking root for claims %D\n", rank, p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1248,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1249 | ierr = PetscSectionGetDof(candidateSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1249,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1250 | ierr = PetscSectionGetOffset(candidateSection, p, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1250,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1251 | for (d = 0; d < dof;) { | |||
1252 | if (claims[offset+d].rank >= 0) { | |||
1253 | const PetscInt faceInd = offset+d; | |||
1254 | const PetscInt numPoints = candidates[faceInd].index; | |||
1255 | const PetscInt *join = NULL((void*)0); | |||
1256 | PetscInt joinSize, points[1024], c; | |||
1257 | ||||
1258 | if (debug) {ierr = PetscSynchronizedPrintf(PetscObjectComm((PetscObject) dm), "[%d] Found claim for remote point (%D, %D)\n", rank, claims[faceInd].rank, claims[faceInd].index);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1258,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1259 | points[0] = p; | |||
1260 | if (debug) {ierr = PetscSynchronizedPrintf(PetscObjectComm((PetscObject) dm), "[%d] point %D\n", rank, points[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1260,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1261 | for (c = 0, ++d; c < numPoints; ++c, ++d) { | |||
1262 | key.i = candidates[offset+d].index; | |||
1263 | key.j = candidates[offset+d].rank; | |||
1264 | ierr = PetscHMapIJGet(roothash, key, &root);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1264,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1265 | points[c+1] = localPoints[root]; | |||
1266 | if (debug) {ierr = PetscSynchronizedPrintf(PetscObjectComm((PetscObject) dm), "[%d] point %D\n", rank, points[c+1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1266,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1267 | } | |||
1268 | ierr = DMPlexGetJoin(dm, numPoints+1, points, &joinSize, &join);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1268,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1269 | if (joinSize == 1) { | |||
1270 | if (debug) {ierr = PetscSynchronizedPrintf(PetscObjectComm((PetscObject) dm), "[%d] Found local face %D\n", rank, join[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1270,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1271 | ierr = PetscHMapISet(claimshash, join[0], faceInd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1271,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1272 | } | |||
1273 | ierr = DMPlexRestoreJoin(dm, numPoints+1, points, &joinSize, &join);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1273,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1274 | } else d += claims[offset+d].index+1; | |||
1275 | } | |||
1276 | } | |||
1277 | if (debug) {ierr = PetscSynchronizedFlush(PetscObjectComm((PetscObject) dm), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1277,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1278 | /* Create new pointSF from hashed claims */ | |||
1279 | ierr = PetscHMapIGetSize(claimshash, &numLocalNew);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1279,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1280 | ierr = DMPlexGetChart(dm, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1280,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1281 | ierr = PetscMalloc1(numLeaves + numLocalNew, &localPointsNew)PetscMallocA(1,PETSC_FALSE,1281,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,(size_t)(numLeaves + numLocalNew)*sizeof(**(&localPointsNew )),(&localPointsNew));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1281,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1282 | ierr = PetscMalloc1(numLeaves + numLocalNew, &remotePointsNew)PetscMallocA(1,PETSC_FALSE,1282,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,(size_t)(numLeaves + numLocalNew)*sizeof(**(&remotePointsNew )),(&remotePointsNew));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1282,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1283 | for (p = 0; p < numLeaves; ++p) { | |||
1284 | localPointsNew[p] = localPoints[p]; | |||
1285 | remotePointsNew[p].index = remotePoints[p].index; | |||
1286 | remotePointsNew[p].rank = remotePoints[p].rank; | |||
1287 | } | |||
1288 | p = numLeaves; | |||
1289 | ierr = PetscHMapIGetKeys(claimshash, &p, localPointsNew);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1289,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1290 | ierr = PetscSortInt(numLocalNew, &localPointsNew[numLeaves]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1290,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1291 | for (p = numLeaves; p < numLeaves + numLocalNew; ++p) { | |||
1292 | PetscInt offset; | |||
1293 | ierr = PetscHMapIGet(claimshash, localPointsNew[p], &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1293,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1294 | remotePointsNew[p] = claims[offset]; | |||
1295 | } | |||
1296 | ierr = PetscSFCreate(PetscObjectComm((PetscObject) dm), &sfPointNew);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1296,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1297 | ierr = PetscSFSetGraph(sfPointNew, pEnd-pStart, numLeaves+numLocalNew, localPointsNew, PETSC_OWN_POINTER, remotePointsNew, PETSC_OWN_POINTER);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1297,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1298 | ierr = DMSetPointSF(dm, sfPointNew);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1298,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1299 | ierr = PetscSFDestroy(&sfPointNew);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1299,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1300 | ierr = PetscHMapIDestroy(&claimshash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1300,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1301 | } | |||
1302 | ierr = PetscHMapIDestroy(&leafhash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1302,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1303 | ierr = PetscHMapIJDestroy(&roothash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1303,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1304 | ierr = PetscSectionDestroy(&candidateSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1304,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1305 | ierr = PetscSectionDestroy(&candidateSectionRemote);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1305,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1306 | ierr = PetscSectionDestroy(&claimSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1306,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1307 | ierr = PetscFree(candidates)((*PetscTrFree)((void*)(candidates),1307,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ) || ((candidates) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1307,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1308 | ierr = PetscFree(candidatesRemote)((*PetscTrFree)((void*)(candidatesRemote),1308,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ) || ((candidatesRemote) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1308,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1309 | ierr = PetscFree(claims)((*PetscTrFree)((void*)(claims),1309,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ) || ((claims) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1309,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1310 | ierr = PetscLogEventEnd(DMPLEX_InterpolateSF,dm,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [DMPLEX_InterpolateSF].active) ? (*PetscLogPLE)((DMPLEX_InterpolateSF ),0,(PetscObject)(dm),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1310,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1311 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1312 | } | |||
1313 | ||||
1314 | /*@C | |||
1315 | DMPlexInterpolate - Take in a cell-vertex mesh and return one with all intermediate faces, edges, etc. | |||
1316 | ||||
1317 | Collective on dm | |||
1318 | ||||
1319 | Input Parameters: | |||
1320 | + dm - The DMPlex object with only cells and vertices | |||
1321 | - dmInt - The interpolated DM | |||
1322 | ||||
1323 | Output Parameter: | |||
1324 | . dmInt - The complete DMPlex object | |||
1325 | ||||
1326 | Level: intermediate | |||
1327 | ||||
1328 | Notes: | |||
1329 | It does not copy over the coordinates. | |||
1330 | ||||
1331 | .seealso: DMPlexUninterpolate(), DMPlexCreateFromCellList(), DMPlexCopyCoordinates() | |||
1332 | @*/ | |||
1333 | PetscErrorCode DMPlexInterpolate(DM dm, DM *dmInt) | |||
1334 | { | |||
1335 | DM idm, odm = dm; | |||
1336 | PetscSF sfPoint; | |||
1337 | PetscInt depth, dim, d; | |||
1338 | const char *name; | |||
1339 | PetscBool flg=PETSC_TRUE; | |||
1340 | PetscErrorCode ierr; | |||
1341 | ||||
1342 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 1342; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1343 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1343,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),1343,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if ( ((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm )0x44000001),1343,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),1343,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
1344 | PetscValidPointer(dmInt, 2)do { if (!dmInt) return PetscError(((MPI_Comm)0x44000001),1344 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(dmInt,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),1344,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||
1345 | ierr = PetscLogEventBegin(DMPLEX_Interpolate,dm,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [DMPLEX_Interpolate].active) ? (*PetscLogPLB)((DMPLEX_Interpolate ),0,(PetscObject)(dm),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1345,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1346 | ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1346,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1347 | ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1347,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1348 | if ((depth == dim) || (dim <= 1)) { | |||
1349 | ierr = PetscObjectReference((PetscObject) dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1349,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1350 | idm = dm; | |||
1351 | } else { | |||
1352 | for (d = 1; d < dim; ++d) { | |||
1353 | /* Create interpolated mesh */ | |||
1354 | ierr = DMCreate(PetscObjectComm((PetscObject)dm), &idm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1354,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1355 | ierr = DMSetType(idm, DMPLEX"plex");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1355,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1356 | ierr = DMSetDimension(idm, dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1356,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1357 | if (depth > 0) { | |||
1358 | ierr = DMPlexInterpolateFaces_Internal(odm, 1, idm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1358,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1359 | ierr = DMGetPointSF(odm, &sfPoint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1359,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1360 | ierr = DMPlexInterpolatePointSF(idm, sfPoint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1360,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1361 | } | |||
1362 | if (odm != dm) {ierr = DMDestroy(&odm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1362,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1363 | odm = idm; | |||
1364 | } | |||
1365 | ierr = PetscObjectGetName((PetscObject) dm, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1365,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1366 | ierr = PetscObjectSetName((PetscObject) idm, name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1366,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1367 | ierr = DMPlexCopyCoordinates(dm, idm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1367,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1368 | ierr = DMCopyLabels(dm, idm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1368,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1369 | ierr = PetscOptionsGetBool(((PetscObject)dm)->options, ((PetscObject)dm)->prefix, "-dm_plex_interpolate_orient_interfaces", &flg, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1369,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1370 | if (flg) {ierr = DMPlexOrientInterface(idm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1370,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
1371 | } | |||
1372 | { | |||
1373 | PetscBool isper; | |||
1374 | const PetscReal *maxCell, *L; | |||
1375 | const DMBoundaryType *bd; | |||
1376 | ||||
1377 | ierr = DMGetPeriodicity(dm,&isper,&maxCell,&L,&bd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1377,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1378 | ierr = DMSetPeriodicity(idm,isper,maxCell,L,bd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1378,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1379 | } | |||
1380 | *dmInt = idm; | |||
1381 | ierr = PetscLogEventEnd(DMPLEX_Interpolate,dm,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [DMPLEX_Interpolate].active) ? (*PetscLogPLE)((DMPLEX_Interpolate ),0,(PetscObject)(dm),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1381,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1382 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1383 | } | |||
1384 | ||||
1385 | /*@ | |||
1386 | DMPlexCopyCoordinates - Copy coordinates from one mesh to another with the same vertices | |||
1387 | ||||
1388 | Collective on dmA | |||
1389 | ||||
1390 | Input Parameter: | |||
1391 | . dmA - The DMPlex object with initial coordinates | |||
1392 | ||||
1393 | Output Parameter: | |||
1394 | . dmB - The DMPlex object with copied coordinates | |||
1395 | ||||
1396 | Level: intermediate | |||
1397 | ||||
1398 | Note: This is typically used when adding pieces other than vertices to a mesh | |||
1399 | ||||
1400 | .seealso: DMCopyLabels(), DMGetCoordinates(), DMGetCoordinatesLocal(), DMGetCoordinateDM(), DMGetCoordinateSection() | |||
1401 | @*/ | |||
1402 | PetscErrorCode DMPlexCopyCoordinates(DM dmA, DM dmB) | |||
1403 | { | |||
1404 | Vec coordinatesA, coordinatesB; | |||
1405 | VecType vtype; | |||
1406 | PetscSection coordSectionA, coordSectionB; | |||
1407 | PetscScalar *coordsA, *coordsB; | |||
1408 | PetscInt spaceDim, Nf, vStartA, vStartB, vEndA, vEndB, coordSizeB, v, d; | |||
1409 | PetscInt cStartA, cEndA, cStartB, cEndB, cS, cE; | |||
1410 | PetscBool lc = PETSC_FALSE; | |||
1411 | PetscErrorCode ierr; | |||
1412 | ||||
1413 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 1413; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1414 | PetscValidHeaderSpecific(dmA, DM_CLASSID, 1)do { if (!dmA) return PetscError(((MPI_Comm)0x44000001),1414, __func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(dmA,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),1414,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(dmA))->classid != DM_CLASSID) { if (((PetscObject)(dmA))->classid == -1) return PetscError(( (MPI_Comm)0x44000001),1414,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),1414,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
1415 | PetscValidHeaderSpecific(dmB, DM_CLASSID, 2)do { if (!dmB) return PetscError(((MPI_Comm)0x44000001),1415, __func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if ( !PetscCheckPointer(dmB,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),1415,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,2); if (((PetscObject)(dmB))->classid != DM_CLASSID) { if (((PetscObject)(dmB))->classid == -1) return PetscError(( (MPI_Comm)0x44000001),1415,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,2); else return PetscError(((MPI_Comm)0x44000001),1415,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,2); } } while (0); | |||
1416 | if (dmA == dmB) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1417 | ierr = DMPlexGetDepthStratum(dmA, 0, &vStartA, &vEndA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1417,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1418 | ierr = DMPlexGetDepthStratum(dmB, 0, &vStartB, &vEndB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1418,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1419 | if ((vEndA-vStartA) != (vEndB-vStartB)) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_SIZ, "The number of vertices in first DM %d != %d in the second DM", vEndA-vStartA, vEndB-vStartB)return PetscError(((MPI_Comm)0x44000001),1419,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,60,PETSC_ERROR_INITIAL,"The number of vertices in first DM %d != %d in the second DM" ,vEndA-vStartA,vEndB-vStartB); | |||
1420 | ierr = DMPlexGetHeightStratum(dmA, 0, &cStartA, &cEndA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1420,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1421 | ierr = DMPlexGetHeightStratum(dmB, 0, &cStartB, &cEndB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1421,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1422 | ierr = DMGetCoordinateSection(dmA, &coordSectionA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1422,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1423 | ierr = DMGetCoordinateSection(dmB, &coordSectionB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1423,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1424 | if (coordSectionA == coordSectionB) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1425 | ierr = PetscSectionGetNumFields(coordSectionA, &Nf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1425,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1426 | if (!Nf) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1427 | if (Nf > 1) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_ARG_SIZ, "The number of coordinate fields must be 1, not %D", Nf)return PetscError(((MPI_Comm)0x44000001),1427,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,60,PETSC_ERROR_INITIAL,"The number of coordinate fields must be 1, not %D" ,Nf); | |||
1428 | if (!coordSectionB) { | |||
1429 | PetscInt dim; | |||
1430 | ||||
1431 | ierr = PetscSectionCreate(PetscObjectComm((PetscObject) coordSectionA), &coordSectionB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1431,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1432 | ierr = DMGetCoordinateDim(dmA, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1432,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1433 | ierr = DMSetCoordinateSection(dmB, dim, coordSectionB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1433,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1434 | ierr = PetscObjectDereference((PetscObject) coordSectionB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1434,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1435 | } | |||
1436 | ierr = PetscSectionSetNumFields(coordSectionB, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1436,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1437 | ierr = PetscSectionGetFieldComponents(coordSectionA, 0, &spaceDim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1437,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1438 | ierr = PetscSectionSetFieldComponents(coordSectionB, 0, spaceDim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1438,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1439 | ierr = PetscSectionGetChart(coordSectionA, &cS, &cE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1439,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1440 | if (cStartA <= cS && cS < cEndA) { /* localized coordinates */ | |||
1441 | if ((cEndA-cStartA) != (cEndB-cStartB)) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_SIZ, "The number of cells in first DM %D != %D in the second DM", cEndA-cStartA, cEndB-cStartB)return PetscError(((MPI_Comm)0x44000001),1441,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,60,PETSC_ERROR_INITIAL,"The number of cells in first DM %D != %D in the second DM" ,cEndA-cStartA,cEndB-cStartB); | |||
1442 | cS = cS - cStartA + cStartB; | |||
1443 | cE = vEndB; | |||
1444 | lc = PETSC_TRUE; | |||
1445 | } else { | |||
1446 | cS = vStartB; | |||
1447 | cE = vEndB; | |||
1448 | } | |||
1449 | ierr = PetscSectionSetChart(coordSectionB, cS, cE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1449,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1450 | for (v = vStartB; v < vEndB; ++v) { | |||
1451 | ierr = PetscSectionSetDof(coordSectionB, v, spaceDim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1451,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1452 | ierr = PetscSectionSetFieldDof(coordSectionB, v, 0, spaceDim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1452,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1453 | } | |||
1454 | if (lc) { /* localized coordinates */ | |||
1455 | PetscInt c; | |||
1456 | ||||
1457 | for (c = cS-cStartB; c < cEndB-cStartB; c++) { | |||
1458 | PetscInt dof; | |||
1459 | ||||
1460 | ierr = PetscSectionGetDof(coordSectionA, c + cStartA, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1460,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1461 | ierr = PetscSectionSetDof(coordSectionB, c + cStartB, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1461,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1462 | ierr = PetscSectionSetFieldDof(coordSectionB, c + cStartB, 0, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1462,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1463 | } | |||
1464 | } | |||
1465 | ierr = PetscSectionSetUp(coordSectionB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1465,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1466 | ierr = PetscSectionGetStorageSize(coordSectionB, &coordSizeB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1466,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1467 | ierr = DMGetCoordinatesLocal(dmA, &coordinatesA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1467,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1468 | ierr = VecCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &coordinatesB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1468,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1469 | ierr = PetscObjectSetName((PetscObject) coordinatesB, "coordinates");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1469,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1470 | ierr = VecSetSizes(coordinatesB, coordSizeB, PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1470,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1471 | ierr = VecGetBlockSize(coordinatesA, &d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1471,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1472 | ierr = VecSetBlockSize(coordinatesB, d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1472,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1473 | ierr = VecGetType(coordinatesA, &vtype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1473,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1474 | ierr = VecSetType(coordinatesB, vtype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1474,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1475 | ierr = VecGetArray(coordinatesA, &coordsA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1475,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1476 | ierr = VecGetArray(coordinatesB, &coordsB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1476,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1477 | for (v = 0; v < vEndB-vStartB; ++v) { | |||
1478 | PetscInt offA, offB; | |||
1479 | ||||
1480 | ierr = PetscSectionGetOffset(coordSectionA, v + vStartA, &offA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1480,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1481 | ierr = PetscSectionGetOffset(coordSectionB, v + vStartB, &offB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1481,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1482 | for (d = 0; d < spaceDim; ++d) { | |||
1483 | coordsB[offB+d] = coordsA[offA+d]; | |||
1484 | } | |||
1485 | } | |||
1486 | if (lc) { /* localized coordinates */ | |||
1487 | PetscInt c; | |||
1488 | ||||
1489 | for (c = cS-cStartB; c < cEndB-cStartB; c++) { | |||
1490 | PetscInt dof, offA, offB; | |||
1491 | ||||
1492 | ierr = PetscSectionGetOffset(coordSectionA, c + cStartA, &offA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1492,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1493 | ierr = PetscSectionGetOffset(coordSectionB, c + cStartB, &offB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1493,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1494 | ierr = PetscSectionGetDof(coordSectionA, c + cStartA, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1494,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1495 | ierr = PetscArraycpy(coordsB + offB,coordsA + offA,dof)((sizeof(*(coordsB + offB)) != sizeof(*(coordsA + offA))) || PetscMemcpy (coordsB + offB,coordsA + offA,(dof)*sizeof(*(coordsB + offB) )));;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1495,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1496 | } | |||
1497 | } | |||
1498 | ierr = VecRestoreArray(coordinatesA, &coordsA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1498,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1499 | ierr = VecRestoreArray(coordinatesB, &coordsB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1499,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1500 | ierr = DMSetCoordinatesLocal(dmB, coordinatesB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1500,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1501 | ierr = VecDestroy(&coordinatesB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1501,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1502 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1503 | } | |||
1504 | ||||
1505 | /*@ | |||
1506 | DMPlexUninterpolate - Take in a mesh with all intermediate faces, edges, etc. and return a cell-vertex mesh | |||
1507 | ||||
1508 | Collective on dm | |||
1509 | ||||
1510 | Input Parameter: | |||
1511 | . dm - The complete DMPlex object | |||
1512 | ||||
1513 | Output Parameter: | |||
1514 | . dmUnint - The DMPlex object with only cells and vertices | |||
1515 | ||||
1516 | Level: intermediate | |||
1517 | ||||
1518 | Notes: | |||
1519 | It does not copy over the coordinates. | |||
1520 | ||||
1521 | .seealso: DMPlexInterpolate(), DMPlexCreateFromCellList(), DMPlexCopyCoordinates() | |||
1522 | @*/ | |||
1523 | PetscErrorCode DMPlexUninterpolate(DM dm, DM *dmUnint) | |||
1524 | { | |||
1525 | DM udm; | |||
1526 | PetscInt dim, vStart, vEnd, cStart, cEnd, cMax, c, maxConeSize = 0, *cone; | |||
1527 | PetscErrorCode ierr; | |||
1528 | ||||
1529 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ; petscstack->line[petscstack->currentsize] = 1529; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1530 | PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1530,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),1530,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if ( ((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm )0x44000001),1530,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),1530,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
1531 | PetscValidPointer(dmUnint, 2)do { if (!dmUnint) return PetscError(((MPI_Comm)0x44000001),1531 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(dmUnint,PETSC_CHAR)) return PetscError(( (MPI_Comm)0x44000001),1531,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||
1532 | ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1532,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1533 | if (dim <= 1) { | |||
1534 | ierr = PetscObjectReference((PetscObject) dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1534,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1535 | *dmUnint = dm; | |||
1536 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1537 | } | |||
1538 | ierr = DMPlexGetDepthStratum(dm, 0, &vStart, &vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1538,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1539 | ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1539,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1540 | ierr = DMPlexGetHybridBounds(dm, &cMax, NULL((void*)0), NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1540,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1541 | ierr = DMCreate(PetscObjectComm((PetscObject) dm), &udm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1541,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1542 | ierr = DMSetType(udm, DMPLEX"plex");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1542,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1543 | ierr = DMSetDimension(udm, dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1543,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1544 | ierr = DMPlexSetChart(udm, cStart, vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1544,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1545 | for (c = cStart; c < cEnd; ++c) { | |||
1546 | PetscInt *closure = NULL((void*)0), closureSize, cl, coneSize = 0; | |||
1547 | ||||
1548 | ierr = DMPlexGetTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1548,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1549 | for (cl = 0; cl < closureSize*2; cl += 2) { | |||
1550 | const PetscInt p = closure[cl]; | |||
1551 | ||||
1552 | if ((p >= vStart) && (p < vEnd)) ++coneSize; | |||
1553 | } | |||
1554 | ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1554,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1555 | ierr = DMPlexSetConeSize(udm, c, coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1555,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1556 | maxConeSize = PetscMax(maxConeSize, coneSize)(((maxConeSize)<(coneSize)) ? (coneSize) : (maxConeSize)); | |||
1557 | } | |||
1558 | ierr = DMSetUp(udm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1558,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1559 | ierr = PetscMalloc1(maxConeSize, &cone)PetscMallocA(1,PETSC_FALSE,1559,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,(size_t)(maxConeSize)*sizeof(**(&cone)),(&cone));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1559,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1560 | for (c = cStart; c < cEnd; ++c) { | |||
1561 | PetscInt *closure = NULL((void*)0), closureSize, cl, coneSize = 0; | |||
1562 | ||||
1563 | ierr = DMPlexGetTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1563,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1564 | for (cl = 0; cl < closureSize*2; cl += 2) { | |||
1565 | const PetscInt p = closure[cl]; | |||
1566 | ||||
1567 | if ((p >= vStart) && (p < vEnd)) cone[coneSize++] = p; | |||
1568 | } | |||
1569 | ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1569,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1570 | ierr = DMPlexSetCone(udm, c, cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1570,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1571 | } | |||
1572 | ierr = PetscFree(cone)((*PetscTrFree)((void*)(cone),1572,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ) || ((cone) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1572,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1573 | ierr = DMPlexSetHybridBounds(udm, cMax, PETSC_DETERMINE-1, PETSC_DETERMINE-1, PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1573,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1574 | ierr = DMPlexSymmetrize(udm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1574,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1575 | ierr = DMPlexStratify(udm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1575,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1576 | /* Reduce SF */ | |||
1577 | { | |||
1578 | PetscSF sfPoint, sfPointUn; | |||
1579 | const PetscSFNode *remotePoints; | |||
1580 | const PetscInt *localPoints; | |||
1581 | PetscSFNode *remotePointsUn; | |||
1582 | PetscInt *localPointsUn; | |||
1583 | PetscInt vEnd, numRoots, numLeaves, l; | |||
1584 | PetscInt numLeavesUn = 0, n = 0; | |||
1585 | PetscErrorCode ierr; | |||
1586 | ||||
1587 | /* Get original SF information */ | |||
1588 | ierr = DMGetPointSF(dm, &sfPoint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1588,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1589 | ierr = DMGetPointSF(udm, &sfPointUn);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1589,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1590 | ierr = DMPlexGetDepthStratum(dm, 0, NULL((void*)0), &vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1590,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1591 | ierr = PetscSFGetGraph(sfPoint, &numRoots, &numLeaves, &localPoints, &remotePoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1591,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1592 | /* Allocate space for cells and vertices */ | |||
1593 | for (l = 0; l < numLeaves; ++l) if (localPoints[l] < vEnd) numLeavesUn++; | |||
1594 | /* Fill in leaves */ | |||
1595 | if (vEnd >= 0) { | |||
1596 | ierr = PetscMalloc1(numLeavesUn, &remotePointsUn)PetscMallocA(1,PETSC_FALSE,1596,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,(size_t)(numLeavesUn)*sizeof(**(&remotePointsUn)),(& remotePointsUn));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1596,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1597 | ierr = PetscMalloc1(numLeavesUn, &localPointsUn)PetscMallocA(1,PETSC_FALSE,1597,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,(size_t)(numLeavesUn)*sizeof(**(&localPointsUn)),(&localPointsUn ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1597,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1598 | for (l = 0; l < numLeaves; l++) { | |||
1599 | if (localPoints[l] < vEnd) { | |||
1600 | localPointsUn[n] = localPoints[l]; | |||
1601 | remotePointsUn[n].rank = remotePoints[l].rank; | |||
1602 | remotePointsUn[n].index = remotePoints[l].index; | |||
1603 | ++n; | |||
1604 | } | |||
1605 | } | |||
1606 | if (n != numLeavesUn) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Inconsistent number of leaves %d != %d", n, numLeavesUn)return PetscError(((MPI_Comm)0x44000001),1606,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,77,PETSC_ERROR_INITIAL,"Inconsistent number of leaves %d != %d" ,n,numLeavesUn); | |||
1607 | ierr = PetscSFSetGraph(sfPointUn, vEnd, numLeavesUn, localPointsUn, PETSC_OWN_POINTER, remotePointsUn, PETSC_OWN_POINTER);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1607,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1608 | } | |||
1609 | } | |||
1610 | { | |||
1611 | PetscBool isper; | |||
1612 | const PetscReal *maxCell, *L; | |||
1613 | const DMBoundaryType *bd; | |||
1614 | ||||
1615 | ierr = DMGetPeriodicity(dm,&isper,&maxCell,&L,&bd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1615,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1616 | ierr = DMSetPeriodicity(udm,isper,maxCell,L,bd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1616,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plexinterpolate.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1617 | } | |||
1618 | ||||
1619 | *dmUnint = udm; | |||
1620 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1621 | } |
1 | #if !defined(PETSC_HASHMAPI_H) |
2 | #define PETSC_HASHMAPI_H |
3 | |
4 | #include <petsc/private/hashmap.h> |
5 | |
6 | PETSC_HASH_MAP(HMapI, PetscInt, PetscInt, PetscHashInt, PetscHashEqual, -1)typedef struct kh_HMapI_s { khint_t n_buckets, size, n_occupied , upper_bound; khint32_t *flags; PetscInt *keys; PetscInt *vals ; } kh_HMapI_t; static inline __attribute((unused)) kh_HMapI_t *kh_init_HMapI(void) { return (kh_HMapI_t*)calloc(1,sizeof(kh_HMapI_t )); } static inline __attribute((unused)) void kh_destroy_HMapI (kh_HMapI_t *h) { if (h) { free((void *)h->keys); free(h-> flags); free((void *)h->vals); free(h); } } static inline __attribute ((unused)) void kh_clear_HMapI(kh_HMapI_t *h) { if (h && h->flags) { memset(h->flags, 0xaa, ((h->n_buckets) < 16? 1 : (h->n_buckets)>>4) * sizeof(khint32_t)); h-> size = h->n_occupied = 0; } } static inline __attribute((unused )) khint_t kh_get_HMapI(const kh_HMapI_t *h, PetscInt key) { if (h->n_buckets) { khint_t k, i, last, mask, step = 0; mask = h->n_buckets - 1; k = PetscHashInt(key); i = k & mask ; last = i; while (!((h->flags[i>>4]>>((i& 0xfU)<<1))&2) && (((h->flags[i>>4] >>((i&0xfU)<<1))&1) || !((h->keys[i]) == (key)))) { i = (i + (++step)) & mask; if (i == last) return h->n_buckets; } return ((h->flags[i>>4]>>( (i&0xfU)<<1))&3)? h->n_buckets : i; } else return 0; } static inline __attribute((unused)) int kh_resize_HMapI (kh_HMapI_t *h, khint_t new_n_buckets) { khint32_t *new_flags = 0; khint_t j = 1; { (--(new_n_buckets), (new_n_buckets)|=( new_n_buckets)>>1, (new_n_buckets)|=(new_n_buckets)>> 2, (new_n_buckets)|=(new_n_buckets)>>4, (new_n_buckets) |=(new_n_buckets)>>8, (new_n_buckets)|=(new_n_buckets)>> 16, ++(new_n_buckets)); if (new_n_buckets < 4) new_n_buckets = 4; if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 0; else { new_flags = (khint32_t*)malloc(((new_n_buckets ) < 16? 1 : (new_n_buckets)>>4) * sizeof(khint32_t)) ; if (!new_flags) return -1; memset(new_flags, 0xaa, ((new_n_buckets ) < 16? 1 : (new_n_buckets)>>4) * sizeof(khint32_t)) ; if (h->n_buckets < new_n_buckets) { PetscInt *new_keys = (PetscInt*)realloc((void *)h->keys,new_n_buckets * sizeof (PetscInt)); if (!new_keys) { free(new_flags); return -1; } h ->keys = new_keys; if (1) { PetscInt *new_vals = (PetscInt *)realloc((void *)h->vals,new_n_buckets * sizeof(PetscInt) ); if (!new_vals) { free(new_flags); return -1; } h->vals = new_vals; } } } } if (j) { for (j = 0; j != h->n_buckets; ++j) { if (((h->flags[j>>4]>>((j&0xfU)<< 1))&3) == 0) { PetscInt key = h->keys[j]; PetscInt val ; khint_t new_mask; new_mask = new_n_buckets - 1; if (1) val = h->vals[j]; (h->flags[j>>4]|=1ul<<((j& 0xfU)<<1)); while (1) { khint_t k, i, step = 0; k = PetscHashInt (key); i = k & new_mask; while (!((new_flags[i>>4]>> ((i&0xfU)<<1))&2)) i = (i + (++step)) & new_mask ; (new_flags[i>>4]&=~(2ul<<((i&0xfU)<< 1))); if (i < h->n_buckets && ((h->flags[i>> 4]>>((i&0xfU)<<1))&3) == 0) { { PetscInt tmp = h->keys[i]; h->keys[i] = key; key = tmp; } if (1) { PetscInt tmp = h->vals[i]; h->vals[i] = val; val = tmp; } (h-> flags[i>>4]|=1ul<<((i&0xfU)<<1)); } else { h->keys[i] = key; if (1) h->vals[i] = val; break; } } } } if (h->n_buckets > new_n_buckets) { h->keys = ( PetscInt*)realloc((void *)h->keys,new_n_buckets * sizeof(PetscInt )); if (1) h->vals = (PetscInt*)realloc((void *)h->vals ,new_n_buckets * sizeof(PetscInt)); } free(h->flags); h-> flags = new_flags; h->n_buckets = new_n_buckets; h->n_occupied = h->size; h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); } return 0; } static inline __attribute ((unused)) khint_t kh_put_HMapI(kh_HMapI_t *h, PetscInt key, int *ret) { khint_t x; if (h->n_occupied >= h->upper_bound ) { if (h->n_buckets > (h->size<<1)) { if (kh_resize_HMapI (h, h->n_buckets - 1) < 0) { *ret = -1; return h->n_buckets ; } } else if (kh_resize_HMapI(h, h->n_buckets + 1) < 0 ) { *ret = -1; return h->n_buckets; } } { khint_t k, i, site , last, mask = h->n_buckets - 1, step = 0; x = site = h-> n_buckets; k = PetscHashInt(key); i = k & mask; if (((h-> flags[i>>4]>>((i&0xfU)<<1))&2)) x = i; else { last = i; while (!((h->flags[i>>4]>> ((i&0xfU)<<1))&2) && (((h->flags[i>> 4]>>((i&0xfU)<<1))&1) || !((h->keys[i] ) == (key)))) { if (((h->flags[i>>4]>>((i& 0xfU)<<1))&1)) site = i; i = (i + (++step)) & mask ; if (i == last) { x = site; break; } } if (x == h->n_buckets ) { if (((h->flags[i>>4]>>((i&0xfU)<< 1))&2) && site != h->n_buckets) x = site; else x = i; } } } if (((h->flags[x>>4]>>((x&0xfU )<<1))&2)) { h->keys[x] = key; (h->flags[x>> 4]&=~(3ul<<((x&0xfU)<<1))); ++h->size; ++h->n_occupied; *ret = 1; } else if (((h->flags[x>> 4]>>((x&0xfU)<<1))&1)) { h->keys[x] = key ; (h->flags[x>>4]&=~(3ul<<((x&0xfU)<< 1))); ++h->size; *ret = 2; } else *ret = 0; return x; } static inline __attribute((unused)) void kh_del_HMapI(kh_HMapI_t *h , khint_t x) { if (x != h->n_buckets && !((h->flags [x>>4]>>((x&0xfU)<<1))&3)) { (h-> flags[x>>4]|=1ul<<((x&0xfU)<<1)); --h-> size; } } typedef kh_HMapI_t *PetscHMapI; static inline __attribute ((unused)) PetscErrorCode PetscHMapICreate(PetscHMapI *ht) { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); *ht = kh_init_HMapI(); do { if (__builtin_expect (!!(!(*ht!=((void*)0))),0)) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","*ht!=((void*)0)" ); } while(0); do { do { ; if (petscstack && petscstack ->currentsize > 0) { petscstack->currentsize--; petscstack ->function[petscstack->currentsize] = 0; petscstack-> file[petscstack->currentsize] = 0; petscstack->line[petscstack ->currentsize] = 0; petscstack->petscroutine[petscstack ->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack ->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHMapIDestroy (PetscHMapI *ht) { do { do { ; if (petscstack && (petscstack ->currentsize < 64)) { petscstack->function[petscstack ->currentsize] = __func__; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); if (!*ht) do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize --; petscstack->function[petscstack->currentsize] = 0; petscstack ->file[petscstack->currentsize] = 0; petscstack->line [petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return (0);} while (0); kh_destroy_HMapI(*ht); *ht = ((void*)0); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute ((unused)) PetscErrorCode PetscHMapIReset(PetscHMapI ht) { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); { if (ht) { free((ht)->keys); free((ht)-> flags); free((ht)->vals); memset((ht), 0x00, sizeof(*(ht)) ); } }; do { do { ; if (petscstack && petscstack-> currentsize > 0) { petscstack->currentsize--; petscstack ->function[petscstack->currentsize] = 0; petscstack-> file[petscstack->currentsize] = 0; petscstack->line[petscstack ->currentsize] = 0; petscstack->petscroutine[petscstack ->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack ->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHMapIDuplicate (PetscHMapI ht,PetscHMapI *hd) { int ret; PetscInt key; PetscInt val; do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!hd) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(hd,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); *hd = kh_init_HMapI(); do { if (__builtin_expect (!!(!(*hd!=((void*)0))),0)) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","*hd!=((void*)0)" ); } while(0); ret = kh_resize_HMapI(*hd, ((ht)->size)); do { if (__builtin_expect(!!(!(ret==0)),0)) return PetscError(( (MPI_Comm)0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","ret==0" ); } while(0); { khint_t __i; for (__i = (khint_t)(0); __i != ((ht)->n_buckets); ++__i) { if (!(!(((ht)->flags[(__i) >>4]>>(((__i)&0xfU)<<1))&3))) continue ; (key) = ((ht)->keys[__i]); (val) = ((ht)->vals[__i]); { khiter_t i; i = kh_put_HMapI(*hd, key, &ret); do { if ( __builtin_expect(!!(!(ret>=0)),0)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","ret>=0" ); } while(0); ((*hd)->vals[i]) = val;}; } } do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack ->currentsize--; petscstack->function[petscstack->currentsize ] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack ->line[petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return (0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHMapIClear(PetscHMapI ht) { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function [petscstack->currentsize] = __func__; petscstack->file[ petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); kh_clear_HMapI(ht); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize --; petscstack->function[petscstack->currentsize] = 0; petscstack ->file[petscstack->currentsize] = 0; petscstack->line [petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return (0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHMapIResize(PetscHMapI ht,PetscInt nb) { int ret; do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); ret = kh_resize_HMapI(ht, (khint_t)nb); do { if (__builtin_expect(!!(!(ret>=0)),0)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","ret>=0" ); } while(0); do { do { ; if (petscstack && petscstack ->currentsize > 0) { petscstack->currentsize--; petscstack ->function[petscstack->currentsize] = 0; petscstack-> file[petscstack->currentsize] = 0; petscstack->line[petscstack ->currentsize] = 0; petscstack->petscroutine[petscstack ->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack ->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHMapIGetSize (PetscHMapI ht,PetscInt *n) { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function [petscstack->currentsize] = __func__; petscstack->file[ petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!n) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(n,PETSC_INT)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,2); } while (0); *n = (PetscInt)((ht)->size); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute ((unused)) PetscErrorCode PetscHMapIGetCapacity(PetscHMapI ht ,PetscInt *n) { do { do { ; if (petscstack && (petscstack ->currentsize < 64)) { petscstack->function[petscstack ->currentsize] = __func__; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!n) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(n,PETSC_INT)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,2); } while (0); *n = (PetscInt)((ht)->n_buckets); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute ((unused)) PetscErrorCode PetscHMapIHas(PetscHMapI ht,PetscInt key,PetscBool *has) { khiter_t iter; do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack ->function[petscstack->currentsize] = __func__; petscstack ->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!has) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (!PetscCheckPointer(has,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); iter = kh_get_HMapI(ht, key); *has = (iter != ( (ht)->n_buckets)) ? PETSC_TRUE : PETSC_FALSE; do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack ->currentsize--; petscstack->function[petscstack->currentsize ] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack ->line[petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return (0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHMapIGet(PetscHMapI ht,PetscInt key,PetscInt *val) { khiter_t iter; do { do { ; if (petscstack && (petscstack-> currentsize < 64)) { petscstack->function[petscstack-> currentsize] = __func__; petscstack->file[petscstack->currentsize ] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!val) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (!PetscCheckPointer(val,PETSC_INT)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,3); } while (0); iter = kh_get_HMapI(ht, key); *val = (iter != ((ht)->n_buckets)) ? ((ht)->vals[iter]) : (-1); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute ((unused)) PetscErrorCode PetscHMapISet(PetscHMapI ht,PetscInt key,PetscInt val) { int ret; khiter_t iter; do { do { ; if ( petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize] = __func__ ; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); iter = kh_put_HMapI(ht, key, &ret); do { if (__builtin_expect(!!(!(ret>=0)),0)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","ret>=0" ); } while(0); ((ht)->vals[iter]) = val; do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack-> currentsize--; petscstack->function[petscstack->currentsize ] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack ->line[petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return (0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHMapIDel(PetscHMapI ht,PetscInt key) { khiter_t iter; do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); iter = kh_get_HMapI(ht, key); kh_del_HMapI(ht, iter ); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHMapIQuerySet (PetscHMapI ht,PetscInt key,PetscInt val,PetscBool *missing) { int ret; khiter_t iter; do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function [petscstack->currentsize] = __func__; petscstack->file[ petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!missing) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (!PetscCheckPointer(missing,PETSC_CHAR)) return PetscError(( (MPI_Comm)0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); iter = kh_put_HMapI(ht, key, &ret); do { if (__builtin_expect(!!(!(ret>=0)),0)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","ret>=0" ); } while(0); ((ht)->vals[iter]) = val; *missing = ret ? PETSC_TRUE : PETSC_FALSE; do { do { ; if (petscstack && petscstack ->currentsize > 0) { petscstack->currentsize--; petscstack ->function[petscstack->currentsize] = 0; petscstack-> file[petscstack->currentsize] = 0; petscstack->line[petscstack ->currentsize] = 0; petscstack->petscroutine[petscstack ->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack ->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHMapIQueryDel (PetscHMapI ht,PetscInt key,PetscBool *present) { khiter_t iter ; do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!present) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (!PetscCheckPointer(present,PETSC_CHAR)) return PetscError(( (MPI_Comm)0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); iter = kh_get_HMapI(ht, key); if (iter != ((ht) ->n_buckets)) { kh_del_HMapI(ht, iter); *present = PETSC_TRUE ; } else { *present = PETSC_FALSE; } do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack-> currentsize--; petscstack->function[petscstack->currentsize ] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack ->line[petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return (0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHMapIFind(PetscHMapI ht,PetscInt key,PetscHashIter *iter ,PetscBool *found) { do { do { ; if (petscstack && (petscstack ->currentsize < 64)) { petscstack->function[petscstack ->currentsize] = __func__; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!iter) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(iter,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); do { if (!found) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (!PetscCheckPointer(found,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); *iter = kh_get_HMapI(ht, key); *found = (*iter != ((ht)->n_buckets)) ? PETSC_TRUE : PETSC_FALSE; do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute ((unused)) PetscErrorCode PetscHMapIPut(PetscHMapI ht,PetscInt key,PetscHashIter *iter,PetscBool *missing) { int ret; do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!iter) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(iter,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); do { if (!missing) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (!PetscCheckPointer(missing,PETSC_CHAR)) return PetscError(( (MPI_Comm)0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); *iter = kh_put_HMapI(ht, key, &ret); do { if (__builtin_expect(!!(!(ret>=0)),0)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","ret>=0" ); } while(0); *missing = ret ? PETSC_TRUE : PETSC_FALSE; do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute ((unused)) PetscErrorCode PetscHMapIIterGet(PetscHMapI ht,PetscHashIter iter,PetscInt *val) { do { do { ; if (petscstack && ( petscstack->currentsize < 64)) { petscstack->function [petscstack->currentsize] = __func__; petscstack->file[ petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!val) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if (!PetscCheckPointer(val,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3); } while (0); *val = __builtin_expect(!!(iter < ((ht)-> n_buckets) && (!(((ht)->flags[(iter)>>4]>> (((iter)&0xfU)<<1))&3))),1) ? ((ht)->vals[iter ]) : (-1); do { do { ; if (petscstack && petscstack-> currentsize > 0) { petscstack->currentsize--; petscstack ->function[petscstack->currentsize] = 0; petscstack-> file[petscstack->currentsize] = 0; petscstack->line[petscstack ->currentsize] = 0; petscstack->petscroutine[petscstack ->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack ->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHMapIIterSet (PetscHMapI ht,PetscHashIter iter,PetscInt val) { do { do { ; if (petscstack && (petscstack->currentsize < 64 )) { petscstack->function[petscstack->currentsize] = __func__ ; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); if (__builtin_expect(!!(iter < ((ht)->n_buckets ) && (!(((ht)->flags[(iter)>>4]>>(((iter )&0xfU)<<1))&3))),1)) ((ht)->vals[iter]) = val ; do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHMapIIterDel (PetscHMapI ht,PetscHashIter iter) { do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack ->function[petscstack->currentsize] = __func__; petscstack ->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); if (__builtin_expect(!!(iter < ((ht)->n_buckets )),1)) kh_del_HMapI(ht, iter); do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize --; petscstack->function[petscstack->currentsize] = 0; petscstack ->file[petscstack->currentsize] = 0; petscstack->line [petscstack->currentsize] = 0; petscstack->petscroutine [petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)< (0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return (0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHMapIGetKeys(PetscHMapI ht,PetscInt *off,PetscInt array []) { PetscInt key; PetscInt pos; do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function [petscstack->currentsize] = __func__; petscstack->file[ petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!off) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(off,PETSC_INT)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,2); } while (0); pos = *off; { khint_t __i; for (__i = (khint_t )(0); __i != ((ht)->n_buckets); ++__i) { if (!(!(((ht)-> flags[(__i)>>4]>>(((__i)&0xfU)<<1))& 3))) continue; (key) = ((ht)->keys[__i]); array[pos++] = key ; } }; *off = pos; do { do { ; if (petscstack && petscstack ->currentsize > 0) { petscstack->currentsize--; petscstack ->function[petscstack->currentsize] = 0; petscstack-> file[petscstack->currentsize] = 0; petscstack->line[petscstack ->currentsize] = 0; petscstack->petscroutine[petscstack ->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack ->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHMapIGetVals (PetscHMapI ht,PetscInt *off,PetscInt array[]) { PetscInt val ; PetscInt pos; do { do { ; if (petscstack && (petscstack ->currentsize < 64)) { petscstack->function[petscstack ->currentsize] = __func__; petscstack->file[petscstack-> currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!off) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(off,PETSC_INT)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,2); } while (0); pos = *off; { khint_t __i; for (__i = (khint_t )(0); __i != ((ht)->n_buckets); ++__i) { if (!(!(((ht)-> flags[(__i)>>4]>>(((__i)&0xfU)<<1))& 3))) continue; (val) = ((ht)->vals[__i]); array[pos++] = val ; } }; *off = pos; do { do { ; if (petscstack && petscstack ->currentsize > 0) { petscstack->currentsize--; petscstack ->function[petscstack->currentsize] = 0; petscstack-> file[petscstack->currentsize] = 0; petscstack->line[petscstack ->currentsize] = 0; petscstack->petscroutine[petscstack ->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack ->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } static inline __attribute((unused)) PetscErrorCode PetscHMapIGetPairs (PetscHMapI ht,PetscInt *off,PetscInt karray[],PetscInt varray []) { PetscInt val; PetscInt key; PetscInt pos; do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize] = __func__ ; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ; petscstack->line[petscstack->currentsize] = 6; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); do { if (!ht) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if (!PetscCheckPointer(ht,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1); } while (0); do { if (!off) return PetscError(((MPI_Comm)0x44000001 ),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(off,PETSC_INT)) return PetscError(((MPI_Comm )0x44000001),6,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashmapi.h" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d" ,2); } while (0); pos = *off; { khint_t __i; for (__i = (khint_t )(0); __i != ((ht)->n_buckets); ++__i) { if (!(!(((ht)-> flags[(__i)>>4]>>(((__i)&0xfU)<<1))& 3))) continue; (key) = ((ht)->keys[__i]); (val) = ((ht)-> vals[__i]); { karray[pos] = key; varray[pos++] = val;}; } } * off = pos; do { do { ; if (petscstack && petscstack-> currentsize > 0) { petscstack->currentsize--; petscstack ->function[petscstack->currentsize] = 0; petscstack-> file[petscstack->currentsize] = 0; petscstack->line[petscstack ->currentsize] = 0; petscstack->petscroutine[petscstack ->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack ->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return(0);} while (0); } |
7 | |
8 | #endif /* PETSC_HASHMAPI_H */ |
1 | #if !defined(PETSC_HASHTABLE_H) | |||
2 | #define PETSC_HASHTABLE_H | |||
3 | ||||
4 | #include <petsc/private/petscimpl.h> | |||
5 | ||||
6 | #define kh_inlineinline PETSC_INLINEinline | |||
7 | #define klib_unused__attribute((unused)) PETSC_UNUSED__attribute((unused)) | |||
8 | #include <petsc/private/kernels/khash.h> | |||
9 | ||||
10 | /* Required for khash <= 0.2.5 */ | |||
11 | #if !defined(kcalloc) | |||
12 | #define kcalloc(N,Z)calloc(N,Z) calloc(N,Z) | |||
13 | #endif | |||
14 | #if !defined(kmalloc) | |||
15 | #define kmalloc(Z)malloc(Z) malloc(Z) | |||
16 | #endif | |||
17 | #if !defined(krealloc) | |||
18 | #define krealloc(P,Z)realloc(P,Z) realloc(P,Z) | |||
19 | #endif | |||
20 | #if !defined(kfree) | |||
21 | #define kfree(P)free(P) free(P) | |||
22 | #endif | |||
23 | ||||
24 | /* --- Useful extensions to khash --- */ | |||
25 | ||||
26 | #if !defined(kh_reset) | |||
27 | /*! @function | |||
28 | @abstract Reset a hash table to initial state. | |||
29 | @param name Name of the hash table [symbol] | |||
30 | @param h Pointer to the hash table [khash_t(name)*] | |||
31 | */ | |||
32 | #define kh_reset(name, h){ if (h) { free((h)->keys); free((h)->flags); free((h)-> vals); memset((h), 0x00, sizeof(*(h))); } } { \ | |||
33 | if (h) { \ | |||
34 | kfree((h)->keys)free((h)->keys); kfree((h)->flags)free((h)->flags); \ | |||
35 | kfree((h)->vals)free((h)->vals); \ | |||
36 | memset((h), 0x00, sizeof(*(h))); \ | |||
37 | } } | |||
38 | #endif /*kh_reset*/ | |||
39 | ||||
40 | #if !defined(kh_foreach) | |||
41 | /*! @function | |||
42 | @abstract Iterate over the entries in the hash table | |||
43 | @param h Pointer to the hash table [khash_t(name)*] | |||
44 | @param kvar Variable to which key will be assigned | |||
45 | @param vvar Variable to which value will be assigned | |||
46 | @param code Block of code to execute | |||
47 | */ | |||
48 | #define kh_foreach(h, kvar, vvar, code){ khint_t __i; for (__i = (khint_t)(0); __i != ((h)->n_buckets ); ++__i) { if (!(!(((h)->flags[(__i)>>4]>>((( __i)&0xfU)<<1))&3))) continue; (kvar) = ((h)-> keys[__i]); (vvar) = ((h)->vals[__i]); code; } } { khint_t __i; \ | |||
49 | for (__i = kh_begin(h)(khint_t)(0); __i != kh_end(h)((h)->n_buckets); ++__i) { \ | |||
50 | if (!kh_exist(h,__i)(!(((h)->flags[(__i)>>4]>>(((__i)&0xfU)<< 1))&3))) continue; \ | |||
51 | (kvar) = kh_key(h,__i)((h)->keys[__i]); \ | |||
52 | (vvar) = kh_val(h,__i)((h)->vals[__i]); \ | |||
53 | code; \ | |||
54 | } } | |||
55 | #endif /*kh_foreach*/ | |||
56 | ||||
57 | #if !defined(kh_foreach_key) | |||
58 | /*! @function | |||
59 | @abstract Iterate over the keys in the hash table | |||
60 | @param h Pointer to the hash table [khash_t(name)*] | |||
61 | @param kvar Variable to which key will be assigned | |||
62 | @param code Block of code to execute | |||
63 | */ | |||
64 | #define kh_foreach_key(h, kvar, code){ khint_t __i; for (__i = (khint_t)(0); __i != ((h)->n_buckets ); ++__i) { if (!(!(((h)->flags[(__i)>>4]>>((( __i)&0xfU)<<1))&3))) continue; (kvar) = ((h)-> keys[__i]); code; } } { khint_t __i; \ | |||
65 | for (__i = kh_begin(h)(khint_t)(0); __i != kh_end(h)((h)->n_buckets); ++__i) { \ | |||
66 | if (!kh_exist(h,__i)(!(((h)->flags[(__i)>>4]>>(((__i)&0xfU)<< 1))&3))) continue; \ | |||
67 | (kvar) = kh_key(h,__i)((h)->keys[__i]); \ | |||
68 | code; \ | |||
69 | } } | |||
70 | #endif /*kh_foreach_key*/ | |||
71 | ||||
72 | #if !defined(kh_foreach_value) | |||
73 | /*! @function | |||
74 | @abstract Iterate over the values in the hash table | |||
75 | @param h Pointer to the hash table [khash_t(name)*] | |||
76 | @param vvar Variable to which value will be assigned | |||
77 | @param code Block of code to execute | |||
78 | */ | |||
79 | #define kh_foreach_value(h, vvar, code){ khint_t __i; for (__i = (khint_t)(0); __i != ((h)->n_buckets ); ++__i) { if (!(!(((h)->flags[(__i)>>4]>>((( __i)&0xfU)<<1))&3))) continue; (vvar) = ((h)-> vals[__i]); code; } } { khint_t __i; \ | |||
80 | for (__i = kh_begin(h)(khint_t)(0); __i != kh_end(h)((h)->n_buckets); ++__i) { \ | |||
81 | if (!kh_exist(h,__i)(!(((h)->flags[(__i)>>4]>>(((__i)&0xfU)<< 1))&3))) continue; \ | |||
82 | (vvar) = kh_val(h,__i)((h)->vals[__i]); \ | |||
83 | code; \ | |||
84 | } } | |||
85 | #endif /*kh_foreach_value*/ | |||
86 | ||||
87 | ||||
88 | /* --- Helper macro for error checking --- */ | |||
89 | ||||
90 | #if defined(PETSC_USE_DEBUG1) | |||
91 | #define PetscHashAssert(expr)do { if (__builtin_expect(!!(!(expr)),0)) return PetscError(( (MPI_Comm)0x44000001),91,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashtable.h" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","expr" ); } while(0) do { \ | |||
92 | if (PetscUnlikely(!(expr))__builtin_expect(!!(!(expr)),0)) \ | |||
93 | SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB, \return PetscError(((MPI_Comm)0x44000001),95,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashtable.h" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","expr" ) | |||
94 | "[khash] Assertion: `%s' failed.", \return PetscError(((MPI_Comm)0x44000001),95,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashtable.h" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","expr" ) | |||
95 | PetscStringize(expr))return PetscError(((MPI_Comm)0x44000001),95,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashtable.h" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","expr" ); \ | |||
96 | } while(0) | |||
97 | #else | |||
98 | #define PetscHashAssert(expr)do { if (__builtin_expect(!!(!(expr)),0)) return PetscError(( (MPI_Comm)0x44000001),98,__func__,"/sandbox/petsc/petsc.next-tmp/include/petsc/private/hashtable.h" ,76,PETSC_ERROR_INITIAL,"[khash] Assertion: `%s' failed.","expr" ); } while(0) ((void)(expr)) | |||
99 | #endif | |||
100 | ||||
101 | ||||
102 | /* --- Low level iterator API --- */ | |||
103 | ||||
104 | typedef khiter_t PetscHashIter; | |||
105 | ||||
106 | #define PetscHashIterBegin(ht,i)do { (i) = (khint_t)(0); if ((i) != (((ht))->n_buckets) && !(!((((ht))->flags[((i))>>4]>>((((i))&0xfU )<<1))&3))) do { ++((i)); } while (((i)) != ((((ht) ))->n_buckets) && !(!(((((ht)))->flags[(((i)))>> 4]>>(((((i)))&0xfU)<<1))&3))); } while (0 ) do { \ | |||
107 | (i) = kh_begin((ht))(khint_t)(0); \ | |||
108 | if ((i) != kh_end((ht))(((ht))->n_buckets) && !kh_exist((ht),(i))(!((((ht))->flags[((i))>>4]>>((((i))&0xfU) <<1))&3))) \ | |||
109 | PetscHashIterNext((ht),(i))do { ++((i)); } while (((i)) != ((((ht)))->n_buckets) && !(!(((((ht)))->flags[(((i)))>>4]>>(((((i)))& 0xfU)<<1))&3))); \ | |||
110 | } while (0) | |||
111 | ||||
112 | #define PetscHashIterNext(ht,i)do { ++(i); } while ((i) != (((ht))->n_buckets) && !(!((((ht))->flags[((i))>>4]>>((((i))&0xfU )<<1))&3))) \ | |||
113 | do { ++(i); } while ((i) != kh_end((ht))(((ht))->n_buckets) && !kh_exist((ht),(i))(!((((ht))->flags[((i))>>4]>>((((i))&0xfU) <<1))&3))) | |||
114 | ||||
115 | #define PetscHashIterAtEnd(ht,i)((i) == (((ht))->n_buckets)) ((i) == kh_end((ht))(((ht))->n_buckets)) | |||
116 | ||||
117 | #define PetscHashIterGetKey(ht,i,k)((k) = (((ht))->keys[(i)])) ((k) = kh_key((ht),(i))(((ht))->keys[(i)])) | |||
118 | ||||
119 | #define PetscHashIterGetVal(ht,i,v)((v) = (((ht))->vals[(i)])) ((v) = kh_val((ht),(i))(((ht))->vals[(i)])) | |||
120 | ||||
121 | #define PetscHashIterSetVal(ht,i,v)((((ht))->vals[(i)]) = (v)) (kh_val((ht),(i))(((ht))->vals[(i)]) = (v)) | |||
122 | ||||
123 | ||||
124 | /* --- Thomas Wang integer hash functions --- */ | |||
125 | ||||
126 | typedef khint32_t PetscHash32_t; | |||
127 | typedef khint64_t PetscHash64_t; | |||
128 | typedef khint_t PetscHash_t; | |||
129 | ||||
130 | /* Thomas Wang's first version for 32bit integers */ | |||
131 | PETSC_STATIC_INLINEstatic inline PetscHash_t PetscHash_UInt32_v0(PetscHash32_t key) | |||
132 | { | |||
133 | key += ~(key << 15); | |||
134 | key ^= (key >> 10); | |||
135 | key += (key << 3); | |||
136 | key ^= (key >> 6); | |||
137 | key += ~(key << 11); | |||
138 | key ^= (key >> 16); | |||
139 | return key; | |||
140 | } | |||
141 | ||||
142 | /* Thomas Wang's second version for 32bit integers */ | |||
143 | PETSC_STATIC_INLINEstatic inline PetscHash_t PetscHash_UInt32_v1(PetscHash32_t key) | |||
144 | { | |||
145 | key = ~key + (key << 15); /* key = (key << 15) - key - 1; */ | |||
146 | key = key ^ (key >> 12); | |||
147 | key = key + (key << 2); | |||
148 | key = key ^ (key >> 4); | |||
149 | key = key * 2057; /* key = (key + (key << 3)) + (key << 11); */ | |||
150 | key = key ^ (key >> 16); | |||
151 | return key; | |||
152 | } | |||
153 | ||||
154 | PETSC_STATIC_INLINEstatic inline PetscHash_t PetscHash_UInt32(PetscHash32_t key) | |||
155 | { | |||
156 | return PetscHash_UInt32_v1(key); | |||
157 | } | |||
158 | ||||
159 | /* Thomas Wang's version for 64bit integer -> 32bit hash */ | |||
160 | PETSC_STATIC_INLINEstatic inline PetscHash32_t PetscHash_UInt64_32(PetscHash64_t key) | |||
161 | { | |||
162 | key = ~key + (key << 18); /* key = (key << 18) - key - 1; */ | |||
163 | key = key ^ (key >> 31); | |||
164 | key = key * 21; /* key = (key + (key << 2)) + (key << 4); */ | |||
165 | key = key ^ (key >> 11); | |||
166 | key = key + (key << 6); | |||
167 | key = key ^ (key >> 22); | |||
168 | return (PetscHash32_t)key; | |||
169 | } | |||
170 | ||||
171 | /* Thomas Wang's version for 64bit integer -> 64bit hash */ | |||
172 | PETSC_STATIC_INLINEstatic inline PetscHash64_t PetscHash_UInt64_64(PetscHash64_t key) | |||
173 | { | |||
174 | key = ~key + (key << 21); /* key = (key << 21) - key - 1; */ | |||
175 | key = key ^ (key >> 24); | |||
176 | key = key * 265; /* key = (key + (key << 3)) + (key << 8); */ | |||
177 | key = key ^ (key >> 14); | |||
178 | key = key * 21; /* key = (key + (key << 2)) + (key << 4); */ | |||
179 | key = key ^ (key >> 28); | |||
180 | key = key + (key << 31); | |||
181 | return key; | |||
182 | } | |||
183 | ||||
184 | PETSC_STATIC_INLINEstatic inline PetscHash_t PetscHash_UInt64(PetscHash64_t key) | |||
185 | { | |||
186 | return sizeof(PetscHash_t) < sizeof(PetscHash64_t) | |||
187 | ? (PetscHash_t)PetscHash_UInt64_32(key) | |||
188 | : (PetscHash_t)PetscHash_UInt64_64(key); | |||
189 | } | |||
190 | ||||
191 | PETSC_STATIC_INLINEstatic inline PetscHash_t PetscHashInt(PetscInt key) | |||
192 | { | |||
193 | #if defined(PETSC_USE_64BIT_INDICES) | |||
194 | return PetscHash_UInt64((PetscHash64_t)key); | |||
195 | #else | |||
196 | return PetscHash_UInt32((PetscHash32_t)key); | |||
| ||||
197 | #endif | |||
198 | } | |||
199 | ||||
200 | PETSC_STATIC_INLINEstatic inline PetscHash_t PetscHashCombine(PetscHash_t seed, PetscHash_t hash) | |||
201 | { | |||
202 | /* https://doi.org/10.1002/asi.10170 */ | |||
203 | /* https://dl.acm.org/citation.cfm?id=759509 */ | |||
204 | return seed ^ (hash + (seed << 6) + (seed >> 2)); | |||
205 | } | |||
206 | ||||
207 | #define PetscHashEqual(a,b)((a) == (b)) ((a) == (b)) | |||
208 | ||||
209 | ||||
210 | #endif /* PETSC_HASHTABLE_H */ |