File: | ts/characteristic/interface/characteristic.c |
Warning: | line 531, column 12 2nd function call argument is an uninitialized value |
[?] Use j/k keys for keyboard navigation
1 | ||||
2 | #include <petsc/private/characteristicimpl.h> /*I "petsccharacteristic.h" I*/ | |||
3 | #include <petscdmda.h> | |||
4 | #include <petscviewer.h> | |||
5 | ||||
6 | PetscClassId CHARACTERISTIC_CLASSID; | |||
7 | PetscLogEvent CHARACTERISTIC_SetUp, CHARACTERISTIC_Solve, CHARACTERISTIC_QueueSetup, CHARACTERISTIC_DAUpdate; | |||
8 | PetscLogEvent CHARACTERISTIC_HalfTimeLocal, CHARACTERISTIC_HalfTimeRemote, CHARACTERISTIC_HalfTimeExchange; | |||
9 | PetscLogEvent CHARACTERISTIC_FullTimeLocal, CHARACTERISTIC_FullTimeRemote, CHARACTERISTIC_FullTimeExchange; | |||
10 | /* | |||
11 | Contains the list of registered characteristic routines | |||
12 | */ | |||
13 | PetscFunctionList CharacteristicList = NULL((void*)0); | |||
14 | PetscBool CharacteristicRegisterAllCalled = PETSC_FALSE; | |||
15 | ||||
16 | PetscErrorCode DMDAGetNeighborsRank(DM, PetscMPIInt []); | |||
17 | PetscInt DMDAGetNeighborRelative(DM, PetscReal, PetscReal); | |||
18 | PetscErrorCode DMDAMapToPeriodicDomain(DM, PetscScalar []); | |||
19 | ||||
20 | PetscErrorCode CharacteristicHeapSort(Characteristic, Queue, PetscInt); | |||
21 | PetscErrorCode CharacteristicSiftDown(Characteristic, Queue, PetscInt, PetscInt); | |||
22 | ||||
23 | PetscErrorCode CharacteristicView(Characteristic c, PetscViewer viewer) | |||
24 | { | |||
25 | PetscBool iascii; | |||
26 | PetscErrorCode ierr; | |||
27 | ||||
28 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 28; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
29 | PetscValidHeaderSpecific(c, CHARACTERISTIC_CLASSID, 1)do { if (!c) return PetscError(((MPI_Comm)0x44000001),29,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(c,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),29,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(c))->classid != CHARACTERISTIC_CLASSID ) { if (((PetscObject)(c))->classid == -1) return PetscError (((MPI_Comm)0x44000001),29,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),29,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
30 | if (!viewer) { | |||
31 | ierr = PetscViewerASCIIGetStdout(PetscObjectComm((PetscObject)c),&viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),31,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
32 | } | |||
33 | PetscValidHeaderSpecific(viewer, PETSC_VIEWER_CLASSID, 2)do { if (!viewer) return PetscError(((MPI_Comm)0x44000001),33 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if ( !PetscCheckPointer(viewer,PETSC_OBJECT)) return PetscError((( MPI_Comm)0x44000001),33,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,2); if (((PetscObject)(viewer))->classid != PETSC_VIEWER_CLASSID ) { if (((PetscObject)(viewer))->classid == -1) return PetscError (((MPI_Comm)0x44000001),33,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,2); else return PetscError(((MPI_Comm)0x44000001),33,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,2); } } while (0); | |||
34 | PetscCheckSameComm(c, 1, viewer, 2)do { PetscErrorCode _6_ierr,__flag; _6_ierr = MPI_Comm_compare (PetscObjectComm((PetscObject)c),PetscObjectComm((PetscObject )viewer),&__flag);do {if (__builtin_expect(!!(_6_ierr),0) ) return PetscError(((MPI_Comm)0x44000001),34,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,_6_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (__flag != 1 && __flag != 0) return PetscError(((MPI_Comm)0x44000001 ),34,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,80,PETSC_ERROR_INITIAL,"Different communicators in the two objects: Argument # %d and %d flag %d" ,1,2,__flag); } while (0); | |||
35 | ||||
36 | ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERASCII"ascii", &iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),36,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
37 | if (!iascii) { | |||
38 | if (c->ops->view) { | |||
39 | ierr = (*c->ops->view)(c, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),39,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
40 | } | |||
41 | } | |||
42 | 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); | |||
43 | } | |||
44 | ||||
45 | PetscErrorCode CharacteristicDestroy(Characteristic *c) | |||
46 | { | |||
47 | PetscErrorCode ierr; | |||
48 | ||||
49 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 49; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
50 | if (!*c) 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); | |||
51 | PetscValidHeaderSpecific(*c, CHARACTERISTIC_CLASSID, 1)do { if (!*c) return PetscError(((MPI_Comm)0x44000001),51,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(*c,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),51,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(*c))->classid != CHARACTERISTIC_CLASSID ) { if (((PetscObject)(*c))->classid == -1) return PetscError (((MPI_Comm)0x44000001),51,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),51,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
52 | if (--((PetscObject)(*c))->refct > 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); | |||
53 | ||||
54 | if ((*c)->ops->destroy) { | |||
55 | ierr = (*(*c)->ops->destroy)((*c));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),55,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
56 | } | |||
57 | ierr = MPI_Type_free(&(*c)->itemType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),57,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
58 | ierr = PetscFree((*c)->queue)((*PetscTrFree)((void*)((*c)->queue),58,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || (((*c)->queue) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),58,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
59 | ierr = PetscFree((*c)->queueLocal)((*PetscTrFree)((void*)((*c)->queueLocal),59,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || (((*c)->queueLocal) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),59,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
60 | ierr = PetscFree((*c)->queueRemote)((*PetscTrFree)((void*)((*c)->queueRemote),60,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || (((*c)->queueRemote) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),60,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
61 | ierr = PetscFree((*c)->neighbors)((*PetscTrFree)((void*)((*c)->neighbors),61,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || (((*c)->neighbors) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),61,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
62 | ierr = PetscFree((*c)->needCount)((*PetscTrFree)((void*)((*c)->needCount),62,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || (((*c)->needCount) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),62,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
63 | ierr = PetscFree((*c)->localOffsets)((*PetscTrFree)((void*)((*c)->localOffsets),63,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || (((*c)->localOffsets) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),63,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
64 | ierr = PetscFree((*c)->fillCount)((*PetscTrFree)((void*)((*c)->fillCount),64,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || (((*c)->fillCount) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),64,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
65 | ierr = PetscFree((*c)->remoteOffsets)((*PetscTrFree)((void*)((*c)->remoteOffsets),65,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || (((*c)->remoteOffsets) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),65,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
66 | ierr = PetscFree((*c)->request)((*PetscTrFree)((void*)((*c)->request),66,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || (((*c)->request) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),66,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
67 | ierr = PetscFree((*c)->status)((*PetscTrFree)((void*)((*c)->status),67,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || (((*c)->status) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),67,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
68 | ierr = PetscHeaderDestroy(c)(PetscHeaderDestroy_Private((PetscObject)(*c)) || ((*PetscTrFree )((void*)(*c),68,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || ((*c) = 0,0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),68,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
69 | 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); | |||
70 | } | |||
71 | ||||
72 | PetscErrorCode CharacteristicCreate(MPI_Comm comm, Characteristic *c) | |||
73 | { | |||
74 | Characteristic newC; | |||
75 | PetscErrorCode ierr; | |||
76 | ||||
77 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 77; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
78 | PetscValidPointer(c, 2)do { if (!c) return PetscError(((MPI_Comm)0x44000001),78,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(c,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),78,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2); } while (0); | |||
79 | *c = NULL((void*)0); | |||
80 | ierr = CharacteristicInitializePackage();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),80,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
81 | ||||
82 | ierr = PetscHeaderCreate(newC, CHARACTERISTIC_CLASSID, "Characteristic", "Characteristic", "Characteristic", comm, CharacteristicDestroy, CharacteristicView)(PetscMallocA(1,PETSC_TRUE,82,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,(size_t)(1)*sizeof(**((&(newC)))),((&(newC)))) || PetscHeaderCreate_Private ((PetscObject)newC,CHARACTERISTIC_CLASSID,"Characteristic","Characteristic" ,"Characteristic",comm,(PetscObjectDestroyFunction)CharacteristicDestroy ,(PetscObjectViewFunction)CharacteristicView) || ((PetscLogPHC ) ? (*PetscLogPHC)((PetscObject)(newC)) : 0) || PetscLogObjectMemory ((PetscObject)newC,sizeof(*(newC))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),82,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
83 | *c = newC; | |||
84 | ||||
85 | newC->structured = PETSC_TRUE; | |||
86 | newC->numIds = 0; | |||
87 | newC->velocityDA = NULL((void*)0); | |||
88 | newC->velocity = NULL((void*)0); | |||
89 | newC->velocityOld = NULL((void*)0); | |||
90 | newC->numVelocityComp = 0; | |||
91 | newC->velocityComp = NULL((void*)0); | |||
92 | newC->velocityInterp = NULL((void*)0); | |||
93 | newC->velocityInterpLocal = NULL((void*)0); | |||
94 | newC->velocityCtx = NULL((void*)0); | |||
95 | newC->fieldDA = NULL((void*)0); | |||
96 | newC->field = NULL((void*)0); | |||
97 | newC->numFieldComp = 0; | |||
98 | newC->fieldComp = NULL((void*)0); | |||
99 | newC->fieldInterp = NULL((void*)0); | |||
100 | newC->fieldInterpLocal = NULL((void*)0); | |||
101 | newC->fieldCtx = NULL((void*)0); | |||
102 | newC->itemType = 0; | |||
103 | newC->queue = NULL((void*)0); | |||
104 | newC->queueSize = 0; | |||
105 | newC->queueMax = 0; | |||
106 | newC->queueLocal = NULL((void*)0); | |||
107 | newC->queueLocalSize = 0; | |||
108 | newC->queueLocalMax = 0; | |||
109 | newC->queueRemote = NULL((void*)0); | |||
110 | newC->queueRemoteSize = 0; | |||
111 | newC->queueRemoteMax = 0; | |||
112 | newC->numNeighbors = 0; | |||
113 | newC->neighbors = NULL((void*)0); | |||
114 | newC->needCount = NULL((void*)0); | |||
115 | newC->localOffsets = NULL((void*)0); | |||
116 | newC->fillCount = NULL((void*)0); | |||
117 | newC->remoteOffsets = NULL((void*)0); | |||
118 | newC->request = NULL((void*)0); | |||
119 | newC->status = NULL((void*)0); | |||
120 | 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); | |||
121 | } | |||
122 | ||||
123 | /*@C | |||
124 | CharacteristicSetType - Builds Characteristic for a particular solver. | |||
125 | ||||
126 | Logically Collective on Characteristic | |||
127 | ||||
128 | Input Parameters: | |||
129 | + c - the method of characteristics context | |||
130 | - type - a known method | |||
131 | ||||
132 | Options Database Key: | |||
133 | . -characteristic_type <method> - Sets the method; use -help for a list | |||
134 | of available methods | |||
135 | ||||
136 | Notes: | |||
137 | See "include/petsccharacteristic.h" for available methods | |||
138 | ||||
139 | Normally, it is best to use the CharacteristicSetFromOptions() command and | |||
140 | then set the Characteristic type from the options database rather than by using | |||
141 | this routine. Using the options database provides the user with | |||
142 | maximum flexibility in evaluating the many different Krylov methods. | |||
143 | The CharacteristicSetType() routine is provided for those situations where it | |||
144 | is necessary to set the iterative solver independently of the command | |||
145 | line or options database. This might be the case, for example, when | |||
146 | the choice of iterative solver changes during the execution of the | |||
147 | program, and the user's application is taking responsibility for | |||
148 | choosing the appropriate method. In other words, this routine is | |||
149 | not for beginners. | |||
150 | ||||
151 | Level: intermediate | |||
152 | ||||
153 | .keywords: Characteristic, set, method | |||
154 | ||||
155 | .seealso: CharacteristicType | |||
156 | ||||
157 | @*/ | |||
158 | PetscErrorCode CharacteristicSetType(Characteristic c, CharacteristicType type) | |||
159 | { | |||
160 | PetscErrorCode ierr, (*r)(Characteristic); | |||
161 | PetscBool match; | |||
162 | ||||
163 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 163; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
164 | PetscValidHeaderSpecific(c, CHARACTERISTIC_CLASSID, 1)do { if (!c) return PetscError(((MPI_Comm)0x44000001),164,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(c,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),164,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(c))->classid != CHARACTERISTIC_CLASSID ) { if (((PetscObject)(c))->classid == -1) return PetscError (((MPI_Comm)0x44000001),164,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),164,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
165 | PetscValidCharPointer(type, 2)do { if (!type) return PetscError(((MPI_Comm)0x44000001),165, __func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if (!PetscCheckPointer(type,PETSC_CHAR)) return PetscError(((MPI_Comm )0x44000001),165,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,68,PETSC_ERROR_INITIAL,"Invalid Pointer to char: Parameter # %d" ,2); } while (0); | |||
166 | ||||
167 | ierr = PetscObjectTypeCompare((PetscObject) c, type, &match);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),167,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
168 | if (match) 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); | |||
169 | ||||
170 | if (c->data) { | |||
171 | /* destroy the old private Characteristic context */ | |||
172 | ierr = (*c->ops->destroy)(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),172,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
173 | c->ops->destroy = NULL((void*)0); | |||
174 | c->data = 0; | |||
175 | } | |||
176 | ||||
177 | ierr = PetscFunctionListFind(CharacteristicList,type,&r)PetscFunctionListFind_Private((CharacteristicList),(type),(PetscVoidFunction *)(&r));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),177,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
178 | if (!r) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_UNKNOWN_TYPE, "Unknown Characteristic type given: %s", type)return PetscError(((MPI_Comm)0x44000001),178,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,86,PETSC_ERROR_INITIAL,"Unknown Characteristic type given: %s" ,type); | |||
179 | c->setupcalled = 0; | |||
180 | ierr = (*r)(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),180,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
181 | ierr = PetscObjectChangeTypeName((PetscObject) c, type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),181,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
182 | 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); | |||
183 | } | |||
184 | ||||
185 | /*@ | |||
186 | CharacteristicSetUp - Sets up the internal data structures for the | |||
187 | later use of an iterative solver. | |||
188 | ||||
189 | Collective on Characteristic | |||
190 | ||||
191 | Input Parameter: | |||
192 | . ksp - iterative context obtained from CharacteristicCreate() | |||
193 | ||||
194 | Level: developer | |||
195 | ||||
196 | .keywords: Characteristic, setup | |||
197 | ||||
198 | .seealso: CharacteristicCreate(), CharacteristicSolve(), CharacteristicDestroy() | |||
199 | @*/ | |||
200 | PetscErrorCode CharacteristicSetUp(Characteristic c) | |||
201 | { | |||
202 | PetscErrorCode ierr; | |||
203 | ||||
204 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 204; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
205 | PetscValidHeaderSpecific(c, CHARACTERISTIC_CLASSID, 1)do { if (!c) return PetscError(((MPI_Comm)0x44000001),205,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(c,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),205,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(c))->classid != CHARACTERISTIC_CLASSID ) { if (((PetscObject)(c))->classid == -1) return PetscError (((MPI_Comm)0x44000001),205,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),205,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
206 | ||||
207 | if (!((PetscObject)c)->type_name) { | |||
208 | ierr = CharacteristicSetType(c, CHARACTERISTICDA"da");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),208,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
209 | } | |||
210 | ||||
211 | if (c->setupcalled == 2) 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); | |||
212 | ||||
213 | ierr = PetscLogEventBegin(CHARACTERISTIC_SetUp,c,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_SetUp].active) ? (*PetscLogPLB)((CHARACTERISTIC_SetUp ),0,(PetscObject)(c),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),213,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
214 | if (!c->setupcalled) { | |||
215 | ierr = (*c->ops->setup)(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),215,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
216 | } | |||
217 | ierr = PetscLogEventEnd(CHARACTERISTIC_SetUp,c,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_SetUp].active) ? (*PetscLogPLE)((CHARACTERISTIC_SetUp ),0,(PetscObject)(c),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),217,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
218 | c->setupcalled = 2; | |||
219 | 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); | |||
220 | } | |||
221 | ||||
222 | /*@C | |||
223 | CharacteristicRegister - Adds a solver to the method of characteristics package. | |||
224 | ||||
225 | Not Collective | |||
226 | ||||
227 | Input Parameters: | |||
228 | + name_solver - name of a new user-defined solver | |||
229 | - routine_create - routine to create method context | |||
230 | ||||
231 | Sample usage: | |||
232 | .vb | |||
233 | CharacteristicRegister("my_char", MyCharCreate); | |||
234 | .ve | |||
235 | ||||
236 | Then, your Characteristic type can be chosen with the procedural interface via | |||
237 | .vb | |||
238 | CharacteristicCreate(MPI_Comm, Characteristic* &char); | |||
239 | CharacteristicSetType(char,"my_char"); | |||
240 | .ve | |||
241 | or at runtime via the option | |||
242 | .vb | |||
243 | -characteristic_type my_char | |||
244 | .ve | |||
245 | ||||
246 | Notes: | |||
247 | CharacteristicRegister() may be called multiple times to add several user-defined solvers. | |||
248 | ||||
249 | .keywords: Characteristic, register | |||
250 | ||||
251 | .seealso: CharacteristicRegisterAll(), CharacteristicRegisterDestroy() | |||
252 | ||||
253 | Level: advanced | |||
254 | @*/ | |||
255 | PetscErrorCode CharacteristicRegister(const char sname[],PetscErrorCode (*function)(Characteristic)) | |||
256 | { | |||
257 | PetscErrorCode ierr; | |||
258 | ||||
259 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 259; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
260 | ierr = CharacteristicInitializePackage();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),260,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
261 | ierr = PetscFunctionListAdd(&CharacteristicList,sname,function)PetscFunctionListAdd_Private((&CharacteristicList),(sname ),(PetscVoidFunction)(function));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),261,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
262 | 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); | |||
263 | } | |||
264 | ||||
265 | PetscErrorCode CharacteristicSetVelocityInterpolation(Characteristic c, DM da, Vec v, Vec vOld, PetscInt numComponents, PetscInt components[], PetscErrorCode (*interp)(Vec, PetscReal[], PetscInt, PetscInt[], PetscScalar[], void*), void *ctx) | |||
266 | { | |||
267 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 267; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
268 | c->velocityDA = da; | |||
269 | c->velocity = v; | |||
270 | c->velocityOld = vOld; | |||
271 | c->numVelocityComp = numComponents; | |||
272 | c->velocityComp = components; | |||
273 | c->velocityInterp = interp; | |||
274 | c->velocityCtx = ctx; | |||
275 | 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); | |||
276 | } | |||
277 | ||||
278 | PetscErrorCode CharacteristicSetVelocityInterpolationLocal(Characteristic c, DM da, Vec v, Vec vOld, PetscInt numComponents, PetscInt components[], PetscErrorCode (*interp)(void*, PetscReal [], PetscInt, PetscInt[], PetscScalar[], void*), void *ctx) | |||
279 | { | |||
280 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 280; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
281 | c->velocityDA = da; | |||
282 | c->velocity = v; | |||
283 | c->velocityOld = vOld; | |||
284 | c->numVelocityComp = numComponents; | |||
285 | c->velocityComp = components; | |||
286 | c->velocityInterpLocal = interp; | |||
287 | c->velocityCtx = ctx; | |||
288 | 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); | |||
289 | } | |||
290 | ||||
291 | PetscErrorCode CharacteristicSetFieldInterpolation(Characteristic c, DM da, Vec v, PetscInt numComponents, PetscInt components[], PetscErrorCode (*interp)(Vec, PetscReal[], PetscInt, PetscInt[], PetscScalar[], void*), void *ctx) | |||
292 | { | |||
293 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 293; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
294 | #if 0 | |||
295 | if (numComponents > 2) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP, "Fields with more than 2 components are not supported. Send mail to [email protected].")return PetscError(((MPI_Comm)0x44000001),295,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,56,PETSC_ERROR_INITIAL,"Fields with more than 2 components are not supported. Send mail to [email protected]." ); | |||
296 | #endif | |||
297 | c->fieldDA = da; | |||
298 | c->field = v; | |||
299 | c->numFieldComp = numComponents; | |||
300 | c->fieldComp = components; | |||
301 | c->fieldInterp = interp; | |||
302 | c->fieldCtx = ctx; | |||
303 | 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); | |||
304 | } | |||
305 | ||||
306 | PetscErrorCode CharacteristicSetFieldInterpolationLocal(Characteristic c, DM da, Vec v, PetscInt numComponents, PetscInt components[], PetscErrorCode (*interp)(void*, PetscReal[], PetscInt, PetscInt[], PetscScalar [], void*), void *ctx) | |||
307 | { | |||
308 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 308; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
309 | #if 0 | |||
310 | if (numComponents > 2) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP, "Fields with more than 2 components are not supported. Send mail to [email protected].")return PetscError(((MPI_Comm)0x44000001),310,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,56,PETSC_ERROR_INITIAL,"Fields with more than 2 components are not supported. Send mail to [email protected]." ); | |||
311 | #endif | |||
312 | c->fieldDA = da; | |||
313 | c->field = v; | |||
314 | c->numFieldComp = numComponents; | |||
315 | c->fieldComp = components; | |||
316 | c->fieldInterpLocal = interp; | |||
317 | c->fieldCtx = ctx; | |||
318 | 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); | |||
319 | } | |||
320 | ||||
321 | PetscErrorCode CharacteristicSolve(Characteristic c, PetscReal dt, Vec solution) | |||
322 | { | |||
323 | CharacteristicPointDA2D Qi; | |||
324 | DM da = c->velocityDA; | |||
325 | Vec velocityLocal, velocityLocalOld; | |||
326 | Vec fieldLocal; | |||
| ||||
327 | DMDALocalInfo info; | |||
328 | PetscScalar **solArray; | |||
329 | void *velocityArray; | |||
330 | void *velocityArrayOld; | |||
331 | void *fieldArray; | |||
332 | PetscScalar *interpIndices; | |||
333 | PetscScalar *velocityValues, *velocityValuesOld; | |||
334 | PetscScalar *fieldValues; | |||
335 | PetscMPIInt rank; | |||
336 | PetscInt dim; | |||
337 | PetscMPIInt neighbors[9]; | |||
338 | PetscInt dof; | |||
339 | PetscInt gx, gy; | |||
340 | PetscInt n, is, ie, js, je, comp; | |||
341 | PetscErrorCode ierr; | |||
342 | ||||
343 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 343; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
344 | c->queueSize = 0; | |||
345 | ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)c), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),345,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
346 | ierr = DMDAGetNeighborsRank(da, neighbors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),346,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
347 | ierr = CharacteristicSetNeighbors(c, 9, neighbors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),347,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
348 | ierr = CharacteristicSetUp(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),348,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
349 | /* global and local grid info */ | |||
350 | ierr = DMDAGetInfo(da, &dim, &gx, &gy, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),350,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
351 | ierr = DMDAGetLocalInfo(da, &info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),351,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
352 | is = info.xs; ie = info.xs+info.xm; | |||
353 | js = info.ys; je = info.ys+info.ym; | |||
354 | /* Allocation */ | |||
355 | ierr = PetscMalloc1(dim, &interpIndices)PetscMallocA(1,PETSC_FALSE,355,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,(size_t)(dim)*sizeof(**(&interpIndices)),(&interpIndices ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),355,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
356 | ierr = PetscMalloc1(c->numVelocityComp, &velocityValues)PetscMallocA(1,PETSC_FALSE,356,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,(size_t)(c->numVelocityComp)*sizeof(**(&velocityValues )),(&velocityValues));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),356,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
357 | ierr = PetscMalloc1(c->numVelocityComp, &velocityValuesOld)PetscMallocA(1,PETSC_FALSE,357,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,(size_t)(c->numVelocityComp)*sizeof(**(&velocityValuesOld )),(&velocityValuesOld));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),357,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
358 | ierr = PetscMalloc1(c->numFieldComp, &fieldValues)PetscMallocA(1,PETSC_FALSE,358,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,(size_t)(c->numFieldComp)*sizeof(**(&fieldValues)),(& fieldValues));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),358,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
359 | ierr = PetscLogEventBegin(CHARACTERISTIC_Solve,0,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_Solve].active) ? (*PetscLogPLB)((CHARACTERISTIC_Solve ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),359,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
360 | ||||
361 | /* ----------------------------------------------------------------------- | |||
362 | PART 1, AT t-dt/2 | |||
363 | -----------------------------------------------------------------------*/ | |||
364 | ierr = PetscLogEventBegin(CHARACTERISTIC_QueueSetup,0,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_QueueSetup].active) ? (*PetscLogPLB)((CHARACTERISTIC_QueueSetup ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),364,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
365 | /* GET POSITION AT HALF TIME IN THE PAST */ | |||
366 | if (c->velocityInterpLocal) { | |||
367 | ierr = DMGetLocalVector(c->velocityDA, &velocityLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),367,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
368 | ierr = DMGetLocalVector(c->velocityDA, &velocityLocalOld);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),368,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
369 | ierr = DMGlobalToLocalBegin(c->velocityDA, c->velocity, INSERT_VALUES, velocityLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),369,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
370 | ierr = DMGlobalToLocalEnd(c->velocityDA, c->velocity, INSERT_VALUES, velocityLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),370,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
371 | ierr = DMGlobalToLocalBegin(c->velocityDA, c->velocityOld, INSERT_VALUES, velocityLocalOld);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),371,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
372 | ierr = DMGlobalToLocalEnd(c->velocityDA, c->velocityOld, INSERT_VALUES, velocityLocalOld);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),372,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
373 | ierr = DMDAVecGetArray(c->velocityDA, velocityLocal, &velocityArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),373,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
374 | ierr = DMDAVecGetArray(c->velocityDA, velocityLocalOld, &velocityArrayOld);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),374,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
375 | } | |||
376 | ierr = PetscInfo(NULL, "Calculating position at t_{n - 1/2}\n")PetscInfo_Private(__func__,((void*)0),"Calculating position at t_{n - 1/2}\n" );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),376,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
377 | for (Qi.j = js; Qi.j < je; Qi.j++) { | |||
378 | for (Qi.i = is; Qi.i < ie; Qi.i++) { | |||
379 | interpIndices[0] = Qi.i; | |||
380 | interpIndices[1] = Qi.j; | |||
381 | if (c->velocityInterpLocal) {ierr = c->velocityInterpLocal(velocityArray, interpIndices, c->numVelocityComp, c->velocityComp, velocityValues, c->velocityCtx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),381,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
382 | else {ierr = c->velocityInterp(c->velocity, interpIndices, c->numVelocityComp, c->velocityComp, velocityValues, c->velocityCtx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),382,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
383 | Qi.x = Qi.i - velocityValues[0]*dt/2.0; | |||
384 | Qi.y = Qi.j - velocityValues[1]*dt/2.0; | |||
385 | ||||
386 | /* Determine whether the position at t - dt/2 is local */ | |||
387 | Qi.proc = DMDAGetNeighborRelative(da, Qi.x, Qi.y); | |||
388 | ||||
389 | /* Check for Periodic boundaries and move all periodic points back onto the domain */ | |||
390 | ierr = DMDAMapCoordsToPeriodicDomain(da,&(Qi.x),&(Qi.y));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),390,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
391 | ierr = CharacteristicAddPoint(c, &Qi);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),391,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
392 | } | |||
393 | } | |||
394 | ierr = PetscLogEventEnd(CHARACTERISTIC_QueueSetup,0,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_QueueSetup].active) ? (*PetscLogPLE)((CHARACTERISTIC_QueueSetup ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),394,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
395 | ||||
396 | ierr = PetscLogEventBegin(CHARACTERISTIC_HalfTimeExchange,0,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_HalfTimeExchange].active) ? (*PetscLogPLB)((CHARACTERISTIC_HalfTimeExchange ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),396,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
397 | ierr = CharacteristicSendCoordinatesBegin(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),397,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
398 | ierr = PetscLogEventEnd(CHARACTERISTIC_HalfTimeExchange,0,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_HalfTimeExchange].active) ? (*PetscLogPLE)((CHARACTERISTIC_HalfTimeExchange ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),398,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
399 | ||||
400 | ierr = PetscLogEventBegin(CHARACTERISTIC_HalfTimeLocal,0,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_HalfTimeLocal].active) ? (*PetscLogPLB)((CHARACTERISTIC_HalfTimeLocal ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),400,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
401 | /* Calculate velocity at t_n+1/2 (local values) */ | |||
402 | ierr = PetscInfo(NULL, "Calculating local velocities at t_{n - 1/2}\n")PetscInfo_Private(__func__,((void*)0),"Calculating local velocities at t_{n - 1/2}\n" );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),402,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
403 | for (n = 0; n < c->queueSize; n++) { | |||
404 | Qi = c->queue[n]; | |||
405 | if (c->neighbors[Qi.proc] == rank) { | |||
406 | interpIndices[0] = Qi.x; | |||
407 | interpIndices[1] = Qi.y; | |||
408 | if (c->velocityInterpLocal) { | |||
409 | ierr = c->velocityInterpLocal(velocityArray, interpIndices, c->numVelocityComp, c->velocityComp, velocityValues, c->velocityCtx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),409,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
410 | ierr = c->velocityInterpLocal(velocityArrayOld, interpIndices, c->numVelocityComp, c->velocityComp, velocityValuesOld, c->velocityCtx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),410,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
411 | } else { | |||
412 | ierr = c->velocityInterp(c->velocity, interpIndices, c->numVelocityComp, c->velocityComp, velocityValues, c->velocityCtx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),412,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
413 | ierr = c->velocityInterp(c->velocityOld, interpIndices, c->numVelocityComp, c->velocityComp, velocityValuesOld, c->velocityCtx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),413,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
414 | } | |||
415 | Qi.x = 0.5*(velocityValues[0] + velocityValuesOld[0]); | |||
416 | Qi.y = 0.5*(velocityValues[1] + velocityValuesOld[1]); | |||
417 | } | |||
418 | c->queue[n] = Qi; | |||
419 | } | |||
420 | ierr = PetscLogEventEnd(CHARACTERISTIC_HalfTimeLocal,0,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_HalfTimeLocal].active) ? (*PetscLogPLE)((CHARACTERISTIC_HalfTimeLocal ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),420,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
421 | ||||
422 | ierr = PetscLogEventBegin(CHARACTERISTIC_HalfTimeExchange,0,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_HalfTimeExchange].active) ? (*PetscLogPLB)((CHARACTERISTIC_HalfTimeExchange ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),422,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
423 | ierr = CharacteristicSendCoordinatesEnd(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),423,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
424 | ierr = PetscLogEventEnd(CHARACTERISTIC_HalfTimeExchange,0,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_HalfTimeExchange].active) ? (*PetscLogPLE)((CHARACTERISTIC_HalfTimeExchange ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),424,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
425 | ||||
426 | ||||
427 | /* Calculate velocity at t_n+1/2 (fill remote requests) */ | |||
428 | ierr = PetscLogEventBegin(CHARACTERISTIC_HalfTimeRemote,0,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_HalfTimeRemote].active) ? (*PetscLogPLB)((CHARACTERISTIC_HalfTimeRemote ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),428,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
429 | ierr = PetscInfo1(NULL, "Calculating %d remote velocities at t_{n - 1/2}\n", c->queueRemoteSize)PetscInfo_Private(__func__,((void*)0),"Calculating %d remote velocities at t_{n - 1/2}\n" ,c->queueRemoteSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),429,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
430 | for (n = 0; n < c->queueRemoteSize; n++) { | |||
431 | Qi = c->queueRemote[n]; | |||
432 | interpIndices[0] = Qi.x; | |||
433 | interpIndices[1] = Qi.y; | |||
434 | if (c->velocityInterpLocal) { | |||
435 | ierr = c->velocityInterpLocal(velocityArray, interpIndices, c->numVelocityComp, c->velocityComp, velocityValues, c->velocityCtx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),435,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
436 | ierr = c->velocityInterpLocal(velocityArrayOld, interpIndices, c->numVelocityComp, c->velocityComp, velocityValuesOld, c->velocityCtx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),436,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
437 | } else { | |||
438 | ierr = c->velocityInterp(c->velocity, interpIndices, c->numVelocityComp, c->velocityComp, velocityValues, c->velocityCtx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),438,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
439 | ierr = c->velocityInterp(c->velocityOld, interpIndices, c->numVelocityComp, c->velocityComp, velocityValuesOld, c->velocityCtx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),439,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
440 | } | |||
441 | Qi.x = 0.5*(velocityValues[0] + velocityValuesOld[0]); | |||
442 | Qi.y = 0.5*(velocityValues[1] + velocityValuesOld[1]); | |||
443 | c->queueRemote[n] = Qi; | |||
444 | } | |||
445 | ierr = PetscLogEventEnd(CHARACTERISTIC_HalfTimeRemote,0,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_HalfTimeRemote].active) ? (*PetscLogPLE)((CHARACTERISTIC_HalfTimeRemote ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),445,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
446 | ierr = PetscLogEventBegin(CHARACTERISTIC_HalfTimeExchange,0,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_HalfTimeExchange].active) ? (*PetscLogPLB)((CHARACTERISTIC_HalfTimeExchange ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),446,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
447 | ierr = CharacteristicGetValuesBegin(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),447,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
448 | ierr = CharacteristicGetValuesEnd(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),448,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
449 | if (c->velocityInterpLocal) { | |||
450 | ierr = DMDAVecRestoreArray(c->velocityDA, velocityLocal, &velocityArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),450,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
451 | ierr = DMDAVecRestoreArray(c->velocityDA, velocityLocalOld, &velocityArrayOld);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),451,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
452 | ierr = DMRestoreLocalVector(c->velocityDA, &velocityLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),452,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
453 | ierr = DMRestoreLocalVector(c->velocityDA, &velocityLocalOld);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),453,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
454 | } | |||
455 | ierr = PetscLogEventEnd(CHARACTERISTIC_HalfTimeExchange,0,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_HalfTimeExchange].active) ? (*PetscLogPLE)((CHARACTERISTIC_HalfTimeExchange ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),455,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
456 | ||||
457 | /* ----------------------------------------------------------------------- | |||
458 | PART 2, AT t-dt | |||
459 | -----------------------------------------------------------------------*/ | |||
460 | ||||
461 | /* GET POSITION AT t_n (local values) */ | |||
462 | ierr = PetscLogEventBegin(CHARACTERISTIC_FullTimeLocal,0,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_FullTimeLocal].active) ? (*PetscLogPLB)((CHARACTERISTIC_FullTimeLocal ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),462,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
463 | ierr = PetscInfo(NULL, "Calculating position at t_{n}\n")PetscInfo_Private(__func__,((void*)0),"Calculating position at t_{n}\n" );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),463,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
464 | for (n = 0; n < c->queueSize; n++) { | |||
465 | Qi = c->queue[n]; | |||
466 | Qi.x = Qi.i - Qi.x*dt; | |||
467 | Qi.y = Qi.j - Qi.y*dt; | |||
468 | ||||
469 | /* Determine whether the position at t-dt is local */ | |||
470 | Qi.proc = DMDAGetNeighborRelative(da, Qi.x, Qi.y); | |||
471 | ||||
472 | /* Check for Periodic boundaries and move all periodic points back onto the domain */ | |||
473 | ierr = DMDAMapCoordsToPeriodicDomain(da,&(Qi.x),&(Qi.y));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),473,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
474 | ||||
475 | c->queue[n] = Qi; | |||
476 | } | |||
477 | ierr = PetscLogEventEnd(CHARACTERISTIC_FullTimeLocal,0,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_FullTimeLocal].active) ? (*PetscLogPLE)((CHARACTERISTIC_FullTimeLocal ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),477,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
478 | ||||
479 | ierr = PetscLogEventBegin(CHARACTERISTIC_FullTimeExchange,0,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_FullTimeExchange].active) ? (*PetscLogPLB)((CHARACTERISTIC_FullTimeExchange ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),479,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
480 | ierr = CharacteristicSendCoordinatesBegin(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),480,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
481 | ierr = PetscLogEventEnd(CHARACTERISTIC_FullTimeExchange,0,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_FullTimeExchange].active) ? (*PetscLogPLE)((CHARACTERISTIC_FullTimeExchange ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),481,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
482 | ||||
483 | /* GET VALUE AT FULL TIME IN THE PAST (LOCAL REQUESTS) */ | |||
484 | ierr = PetscLogEventBegin(CHARACTERISTIC_FullTimeLocal,0,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_FullTimeLocal].active) ? (*PetscLogPLB)((CHARACTERISTIC_FullTimeLocal ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),484,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
485 | if (c->fieldInterpLocal) { | |||
486 | ierr = DMGetLocalVector(c->fieldDA, &fieldLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),486,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
487 | ierr = DMGlobalToLocalBegin(c->fieldDA, c->field, INSERT_VALUES, fieldLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),487,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
488 | ierr = DMGlobalToLocalEnd(c->fieldDA, c->field, INSERT_VALUES, fieldLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),488,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
489 | ierr = DMDAVecGetArray(c->fieldDA, fieldLocal, &fieldArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),489,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
490 | } | |||
491 | ierr = PetscInfo(NULL, "Calculating local field at t_{n}\n")PetscInfo_Private(__func__,((void*)0),"Calculating local field at t_{n}\n" );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),491,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
492 | for (n = 0; n < c->queueSize; n++) { | |||
493 | if (c->neighbors[c->queue[n].proc] == rank) { | |||
494 | interpIndices[0] = c->queue[n].x; | |||
495 | interpIndices[1] = c->queue[n].y; | |||
496 | if (c->fieldInterpLocal) {ierr = c->fieldInterpLocal(fieldArray, interpIndices, c->numFieldComp, c->fieldComp, fieldValues, c->fieldCtx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),496,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
497 | else {ierr = c->fieldInterp(c->field, interpIndices, c->numFieldComp, c->fieldComp, fieldValues, c->fieldCtx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),497,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
498 | for (comp = 0; comp < c->numFieldComp; comp++) c->queue[n].field[comp] = fieldValues[comp]; | |||
499 | } | |||
500 | } | |||
501 | ierr = PetscLogEventEnd(CHARACTERISTIC_FullTimeLocal,0,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_FullTimeLocal].active) ? (*PetscLogPLE)((CHARACTERISTIC_FullTimeLocal ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),501,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
502 | ||||
503 | ierr = PetscLogEventBegin(CHARACTERISTIC_FullTimeExchange,0,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_FullTimeExchange].active) ? (*PetscLogPLB)((CHARACTERISTIC_FullTimeExchange ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),503,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
504 | ierr = CharacteristicSendCoordinatesEnd(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),504,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
505 | ierr = PetscLogEventEnd(CHARACTERISTIC_FullTimeExchange,0,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_FullTimeExchange].active) ? (*PetscLogPLE)((CHARACTERISTIC_FullTimeExchange ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),505,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
506 | ||||
507 | /* GET VALUE AT FULL TIME IN THE PAST (REMOTE REQUESTS) */ | |||
508 | ierr = PetscLogEventBegin(CHARACTERISTIC_FullTimeRemote,0,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_FullTimeRemote].active) ? (*PetscLogPLB)((CHARACTERISTIC_FullTimeRemote ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),508,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
509 | ierr = PetscInfo1(NULL, "Calculating %d remote field points at t_{n}\n", c->queueRemoteSize)PetscInfo_Private(__func__,((void*)0),"Calculating %d remote field points at t_{n}\n" ,c->queueRemoteSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),509,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
510 | for (n = 0; n < c->queueRemoteSize; n++) { | |||
511 | interpIndices[0] = c->queueRemote[n].x; | |||
512 | interpIndices[1] = c->queueRemote[n].y; | |||
513 | ||||
514 | /* for debugging purposes */ | |||
515 | if (1) { /* hacked bounds test...let's do better */ | |||
516 | PetscScalar im = interpIndices[0]; PetscScalar jm = interpIndices[1]; | |||
517 | ||||
518 | if ((im < (PetscScalar) is - 1.) || (im > (PetscScalar) ie) || (jm < (PetscScalar) js - 1.) || (jm > (PetscScalar) je)) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_LIB, "Nonlocal point: (%g,%g)", im, jm)return PetscError(((MPI_Comm)0x44000001),518,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,76,PETSC_ERROR_INITIAL,"Nonlocal point: (%g,%g)",im,jm); | |||
519 | } | |||
520 | ||||
521 | if (c->fieldInterpLocal) {ierr = c->fieldInterpLocal(fieldArray, interpIndices, c->numFieldComp, c->fieldComp, fieldValues, c->fieldCtx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),521,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
522 | else {ierr = c->fieldInterp(c->field, interpIndices, c->numFieldComp, c->fieldComp, fieldValues, c->fieldCtx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),522,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} | |||
523 | for (comp = 0; comp < c->numFieldComp; comp++) c->queueRemote[n].field[comp] = fieldValues[comp]; | |||
524 | } | |||
525 | ierr = PetscLogEventEnd(CHARACTERISTIC_FullTimeRemote,0,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_FullTimeRemote].active) ? (*PetscLogPLE)((CHARACTERISTIC_FullTimeRemote ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),525,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
526 | ||||
527 | ierr = PetscLogEventBegin(CHARACTERISTIC_FullTimeExchange,0,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_FullTimeExchange].active) ? (*PetscLogPLB)((CHARACTERISTIC_FullTimeExchange ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),527,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
528 | ierr = CharacteristicGetValuesBegin(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),528,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
529 | ierr = CharacteristicGetValuesEnd(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),529,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
530 | if (c->fieldInterpLocal) { | |||
531 | ierr = DMDAVecRestoreArray(c->fieldDA, fieldLocal, &fieldArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),531,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
| ||||
532 | ierr = DMRestoreLocalVector(c->fieldDA, &fieldLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),532,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
533 | } | |||
534 | ierr = PetscLogEventEnd(CHARACTERISTIC_FullTimeExchange,0,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_FullTimeExchange].active) ? (*PetscLogPLE)((CHARACTERISTIC_FullTimeExchange ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),534,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
535 | ||||
536 | /* Return field of characteristics at t_n-1 */ | |||
537 | ierr = PetscLogEventBegin(CHARACTERISTIC_DAUpdate,0,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_DAUpdate].active) ? (*PetscLogPLB)((CHARACTERISTIC_DAUpdate ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),537,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
538 | ierr = DMDAGetInfo(c->fieldDA,0,0,0,0,0,0,0,&dof,0,0,0,0,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),538,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
539 | ierr = DMDAVecGetArray(c->fieldDA, solution, &solArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),539,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
540 | for (n = 0; n < c->queueSize; n++) { | |||
541 | Qi = c->queue[n]; | |||
542 | for (comp = 0; comp < c->numFieldComp; comp++) solArray[Qi.j][Qi.i*dof+c->fieldComp[comp]] = Qi.field[comp]; | |||
543 | } | |||
544 | ierr = DMDAVecRestoreArray(c->fieldDA, solution, &solArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),544,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
545 | ierr = PetscLogEventEnd(CHARACTERISTIC_DAUpdate,0,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_DAUpdate].active) ? (*PetscLogPLE)((CHARACTERISTIC_DAUpdate ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),545,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
546 | ierr = PetscLogEventEnd(CHARACTERISTIC_Solve,0,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog ->curStage].perfInfo.active && petsc_stageLog-> stageInfo[petsc_stageLog->curStage].eventLog->eventInfo [CHARACTERISTIC_Solve].active) ? (*PetscLogPLE)((CHARACTERISTIC_Solve ),0,(PetscObject)(0),(PetscObject)(0),(PetscObject)(0),(PetscObject )(0)) : 0 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),546,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
547 | ||||
548 | /* Cleanup */ | |||
549 | ierr = PetscFree(interpIndices)((*PetscTrFree)((void*)(interpIndices),549,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || ((interpIndices) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),549,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
550 | ierr = PetscFree(velocityValues)((*PetscTrFree)((void*)(velocityValues),550,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || ((velocityValues) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),550,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
551 | ierr = PetscFree(velocityValuesOld)((*PetscTrFree)((void*)(velocityValuesOld),551,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || ((velocityValuesOld) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),551,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
552 | ierr = PetscFree(fieldValues)((*PetscTrFree)((void*)(fieldValues),552,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || ((fieldValues) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),552,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
553 | 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); | |||
554 | } | |||
555 | ||||
556 | PetscErrorCode CharacteristicSetNeighbors(Characteristic c, PetscInt numNeighbors, PetscMPIInt neighbors[]) | |||
557 | { | |||
558 | PetscErrorCode ierr; | |||
559 | ||||
560 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 560; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
561 | c->numNeighbors = numNeighbors; | |||
562 | ierr = PetscFree(c->neighbors)((*PetscTrFree)((void*)(c->neighbors),562,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || ((c->neighbors) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),562,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
563 | ierr = PetscMalloc1(numNeighbors, &c->neighbors)PetscMallocA(1,PETSC_FALSE,563,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,(size_t)(numNeighbors)*sizeof(**(&c->neighbors)),(& c->neighbors));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),563,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
564 | ierr = PetscMemcpy(c->neighbors, neighbors, numNeighbors * sizeof(PetscMPIInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),564,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
565 | 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); | |||
566 | } | |||
567 | ||||
568 | PetscErrorCode CharacteristicAddPoint(Characteristic c, CharacteristicPointDA2D *point) | |||
569 | { | |||
570 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 570; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
571 | if (c->queueSize >= c->queueMax) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE, "Exceeeded maximum queue size %d", c->queueMax)return PetscError(((MPI_Comm)0x44000001),571,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,63,PETSC_ERROR_INITIAL,"Exceeeded maximum queue size %d",c-> queueMax); | |||
572 | c->queue[c->queueSize++] = *point; | |||
573 | 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); | |||
574 | } | |||
575 | ||||
576 | int CharacteristicSendCoordinatesBegin(Characteristic c) | |||
577 | { | |||
578 | PetscMPIInt rank, tag = 121; | |||
579 | PetscInt i, n; | |||
580 | PetscErrorCode ierr; | |||
581 | ||||
582 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 582; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
583 | ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)c), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),583,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
584 | ierr = CharacteristicHeapSort(c, c->queue, c->queueSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),584,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
585 | ierr = PetscMemzero(c->needCount, c->numNeighbors * sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),585,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
586 | for (i = 0; i < c->queueSize; i++) c->needCount[c->queue[i].proc]++; | |||
587 | c->fillCount[0] = 0; | |||
588 | for (n = 1; n < c->numNeighbors; n++) { | |||
589 | ierr = MPI_Irecv(&(c->fillCount[n]), 1, MPIU_INT, c->neighbors[n], tag, PetscObjectComm((PetscObject)c), &(c->request[n-1]))((petsc_irecv_ct++,0) || PetscMPITypeSize(&(petsc_irecv_len ),(1),(((MPI_Datatype)0x4c000405))) || MPI_Irecv((&(c-> fillCount[n])),(1),(((MPI_Datatype)0x4c000405)),(c->neighbors [n]),(tag),(PetscObjectComm((PetscObject)c)),(&(c->request [n-1]))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),589,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
590 | } | |||
591 | for (n = 1; n < c->numNeighbors; n++) { | |||
592 | ierr = MPI_Send(&(c->needCount[n]), 1, MPIU_INT, c->neighbors[n], tag, PetscObjectComm((PetscObject)c))((petsc_send_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(1),(((MPI_Datatype)0x4c000405))) || MPI_Send((&(c-> needCount[n])),(1),(((MPI_Datatype)0x4c000405)),(c->neighbors [n]),(tag),(PetscObjectComm((PetscObject)c))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),592,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
593 | } | |||
594 | ierr = MPI_Waitall(c->numNeighbors-1, c->request, c->status)((petsc_wait_all_ct++,petsc_sum_of_waits_ct += (PetscLogDouble ) (c->numNeighbors-1),0) || MPI_Waitall((c->numNeighbors -1),(c->request),(c->status)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),594,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
595 | /* Initialize the remote queue */ | |||
596 | c->queueLocalMax = c->localOffsets[0] = 0; | |||
597 | c->queueRemoteMax = c->remoteOffsets[0] = 0; | |||
598 | for (n = 1; n < c->numNeighbors; n++) { | |||
599 | c->remoteOffsets[n] = c->queueRemoteMax; | |||
600 | c->queueRemoteMax += c->fillCount[n]; | |||
601 | c->localOffsets[n] = c->queueLocalMax; | |||
602 | c->queueLocalMax += c->needCount[n]; | |||
603 | } | |||
604 | /* HACK BEGIN */ | |||
605 | for (n = 1; n < c->numNeighbors; n++) c->localOffsets[n] += c->needCount[0]; | |||
606 | c->needCount[0] = 0; | |||
607 | /* HACK END */ | |||
608 | if (c->queueRemoteMax) { | |||
609 | ierr = PetscMalloc1(c->queueRemoteMax, &c->queueRemote)PetscMallocA(1,PETSC_FALSE,609,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,(size_t)(c->queueRemoteMax)*sizeof(**(&c->queueRemote )),(&c->queueRemote));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),609,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
610 | } else c->queueRemote = NULL((void*)0); | |||
611 | c->queueRemoteSize = c->queueRemoteMax; | |||
612 | ||||
613 | /* Send and Receive requests for values at t_n+1/2, giving the coordinates for interpolation */ | |||
614 | for (n = 1; n < c->numNeighbors; n++) { | |||
615 | ierr = PetscInfo2(NULL, "Receiving %d requests for values from proc %d\n", c->fillCount[n], c->neighbors[n])PetscInfo_Private(__func__,((void*)0),"Receiving %d requests for values from proc %d\n" ,c->fillCount[n],c->neighbors[n]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),615,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
616 | ierr = MPI_Irecv(&(c->queueRemote[c->remoteOffsets[n]]), c->fillCount[n], c->itemType, c->neighbors[n], tag, PetscObjectComm((PetscObject)c), &(c->request[n-1]))((petsc_irecv_ct++,0) || PetscMPITypeSize(&(petsc_irecv_len ),(c->fillCount[n]),(c->itemType)) || MPI_Irecv((&( c->queueRemote[c->remoteOffsets[n]])),(c->fillCount[ n]),(c->itemType),(c->neighbors[n]),(tag),(PetscObjectComm ((PetscObject)c)),(&(c->request[n-1]))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),616,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
617 | } | |||
618 | for (n = 1; n < c->numNeighbors; n++) { | |||
619 | ierr = PetscInfo2(NULL, "Sending %d requests for values from proc %d\n", c->needCount[n], c->neighbors[n])PetscInfo_Private(__func__,((void*)0),"Sending %d requests for values from proc %d\n" ,c->needCount[n],c->neighbors[n]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),619,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
620 | ierr = MPI_Send(&(c->queue[c->localOffsets[n]]), c->needCount[n], c->itemType, c->neighbors[n], tag, PetscObjectComm((PetscObject)c))((petsc_send_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(c->needCount[n]),(c->itemType)) || MPI_Send((&(c ->queue[c->localOffsets[n]])),(c->needCount[n]),(c-> itemType),(c->neighbors[n]),(tag),(PetscObjectComm((PetscObject )c))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),620,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
621 | } | |||
622 | 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); | |||
623 | } | |||
624 | ||||
625 | PetscErrorCode CharacteristicSendCoordinatesEnd(Characteristic c) | |||
626 | { | |||
627 | #if 0 | |||
628 | PetscMPIInt rank; | |||
629 | PetscInt n; | |||
630 | #endif | |||
631 | PetscErrorCode ierr; | |||
632 | ||||
633 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 633; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
634 | ierr = MPI_Waitall(c->numNeighbors-1, c->request, c->status)((petsc_wait_all_ct++,petsc_sum_of_waits_ct += (PetscLogDouble ) (c->numNeighbors-1),0) || MPI_Waitall((c->numNeighbors -1),(c->request),(c->status)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),634,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
635 | #if 0 | |||
636 | ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)c), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),636,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
637 | for (n = 0; n < c->queueRemoteSize; n++) { | |||
638 | if (c->neighbors[c->queueRemote[n].proc] == rank) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB, "This is messed up, n = %d proc = %d", n, c->queueRemote[n].proc)return PetscError(((MPI_Comm)0x44000001),638,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,77,PETSC_ERROR_INITIAL,"This is messed up, n = %d proc = %d" ,n,c->queueRemote[n].proc); | |||
639 | } | |||
640 | #endif | |||
641 | 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); | |||
642 | } | |||
643 | ||||
644 | PetscErrorCode CharacteristicGetValuesBegin(Characteristic c) | |||
645 | { | |||
646 | PetscMPIInt tag = 121; | |||
647 | PetscInt n; | |||
648 | PetscErrorCode ierr; | |||
649 | ||||
650 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 650; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
651 | /* SEND AND RECIEVE FILLED REQUESTS for velocities at t_n+1/2 */ | |||
652 | for (n = 1; n < c->numNeighbors; n++) { | |||
653 | ierr = MPI_Irecv(&(c->queue[c->localOffsets[n]]), c->needCount[n], c->itemType, c->neighbors[n], tag, PetscObjectComm((PetscObject)c), &(c->request[n-1]))((petsc_irecv_ct++,0) || PetscMPITypeSize(&(petsc_irecv_len ),(c->needCount[n]),(c->itemType)) || MPI_Irecv((&( c->queue[c->localOffsets[n]])),(c->needCount[n]),(c-> itemType),(c->neighbors[n]),(tag),(PetscObjectComm((PetscObject )c)),(&(c->request[n-1]))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),653,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
654 | } | |||
655 | for (n = 1; n < c->numNeighbors; n++) { | |||
656 | ierr = MPI_Send(&(c->queueRemote[c->remoteOffsets[n]]), c->fillCount[n], c->itemType, c->neighbors[n], tag, PetscObjectComm((PetscObject)c))((petsc_send_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(c->fillCount[n]),(c->itemType)) || MPI_Send((&(c ->queueRemote[c->remoteOffsets[n]])),(c->fillCount[n ]),(c->itemType),(c->neighbors[n]),(tag),(PetscObjectComm ((PetscObject)c))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),656,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
657 | } | |||
658 | 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); | |||
659 | } | |||
660 | ||||
661 | PetscErrorCode CharacteristicGetValuesEnd(Characteristic c) | |||
662 | { | |||
663 | PetscErrorCode ierr; | |||
664 | ||||
665 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 665; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
666 | ierr = MPI_Waitall(c->numNeighbors-1, c->request, c->status)((petsc_wait_all_ct++,petsc_sum_of_waits_ct += (PetscLogDouble ) (c->numNeighbors-1),0) || MPI_Waitall((c->numNeighbors -1),(c->request),(c->status)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),666,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
667 | /* Free queue of requests from other procs */ | |||
668 | ierr = PetscFree(c->queueRemote)((*PetscTrFree)((void*)(c->queueRemote),668,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || ((c->queueRemote) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),668,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
669 | 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); | |||
670 | } | |||
671 | ||||
672 | /*---------------------------------------------------------------------*/ | |||
673 | /* | |||
674 | Based on code from http://linux.wku.edu/~lamonml/algor/sort/heap.html | |||
675 | */ | |||
676 | PetscErrorCode CharacteristicHeapSort(Characteristic c, Queue queue, PetscInt size) | |||
677 | /*---------------------------------------------------------------------*/ | |||
678 | { | |||
679 | PetscErrorCode ierr; | |||
680 | CharacteristicPointDA2D temp; | |||
681 | PetscInt n; | |||
682 | ||||
683 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 683; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
684 | if (0) { /* Check the order of the queue before sorting */ | |||
685 | ierr = PetscInfo(NULL, "Before Heap sort\n")PetscInfo_Private(__func__,((void*)0),"Before Heap sort\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),685,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
686 | for (n=0; n<size; n++) { | |||
687 | ierr = PetscInfo2(NULL,"%d %d\n",n,queue[n].proc)PetscInfo_Private(__func__,((void*)0),"%d %d\n",n,queue[n].proc );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),687,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
688 | } | |||
689 | } | |||
690 | ||||
691 | /* SORTING PHASE */ | |||
692 | for (n = (size / 2)-1; n >= 0; n--) { | |||
693 | ierr = CharacteristicSiftDown(c, queue, n, size-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),693,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); /* Rich had size-1 here, Matt had size*/ | |||
694 | } | |||
695 | for (n = size-1; n >= 1; n--) { | |||
696 | temp = queue[0]; | |||
697 | queue[0] = queue[n]; | |||
698 | queue[n] = temp; | |||
699 | ierr = CharacteristicSiftDown(c, queue, 0, n-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),699,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
700 | } | |||
701 | if (0) { /* Check the order of the queue after sorting */ | |||
702 | ierr = PetscInfo(NULL, "Avter Heap sort\n")PetscInfo_Private(__func__,((void*)0),"Avter Heap sort\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),702,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
703 | for (n=0; n<size; n++) { | |||
704 | ierr = PetscInfo2(NULL,"%d %d\n",n,queue[n].proc)PetscInfo_Private(__func__,((void*)0),"%d %d\n",n,queue[n].proc );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),704,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
705 | } | |||
706 | } | |||
707 | 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); | |||
708 | } | |||
709 | ||||
710 | /*---------------------------------------------------------------------*/ | |||
711 | /* | |||
712 | Based on code from http://linux.wku.edu/~lamonml/algor/sort/heap.html | |||
713 | */ | |||
714 | PetscErrorCode CharacteristicSiftDown(Characteristic c, Queue queue, PetscInt root, PetscInt bottom) | |||
715 | /*---------------------------------------------------------------------*/ | |||
716 | { | |||
717 | PetscBool done = PETSC_FALSE; | |||
718 | PetscInt maxChild; | |||
719 | CharacteristicPointDA2D temp; | |||
720 | ||||
721 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 721; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
722 | while ((root*2 <= bottom) && (!done)) { | |||
723 | if (root*2 == bottom) maxChild = root * 2; | |||
724 | else if (queue[root*2].proc > queue[root*2+1].proc) maxChild = root * 2; | |||
725 | else maxChild = root * 2 + 1; | |||
726 | ||||
727 | if (queue[root].proc < queue[maxChild].proc) { | |||
728 | temp = queue[root]; | |||
729 | queue[root] = queue[maxChild]; | |||
730 | queue[maxChild] = temp; | |||
731 | root = maxChild; | |||
732 | } else done = PETSC_TRUE; | |||
733 | } | |||
734 | 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); | |||
735 | } | |||
736 | ||||
737 | /* [center, left, top-left, top, top-right, right, bottom-right, bottom, bottom-left] */ | |||
738 | PetscErrorCode DMDAGetNeighborsRank(DM da, PetscMPIInt neighbors[]) | |||
739 | { | |||
740 | DMBoundaryType bx, by; | |||
741 | PetscBool IPeriodic = PETSC_FALSE, JPeriodic = PETSC_FALSE; | |||
742 | MPI_Comm comm; | |||
743 | PetscMPIInt rank; | |||
744 | PetscInt **procs,pi,pj,pim,pip,pjm,pjp,PI,PJ; | |||
745 | PetscErrorCode ierr; | |||
746 | ||||
747 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ; petscstack->line[petscstack->currentsize] = 747; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
748 | ierr = PetscObjectGetComm((PetscObject) da, &comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),748,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
749 | ierr = MPI_Comm_rank(comm, &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),749,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
750 | ierr = DMDAGetInfo(da, 0, 0, 0, 0, &PI,&PJ, 0, 0, 0, &bx, &by,0, 0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),750,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
751 | ||||
752 | if (bx == DM_BOUNDARY_PERIODIC) IPeriodic = PETSC_TRUE; | |||
753 | if (by == DM_BOUNDARY_PERIODIC) JPeriodic = PETSC_TRUE; | |||
754 | ||||
755 | neighbors[0] = rank; | |||
756 | rank = 0; | |||
757 | ierr = PetscMalloc1(PJ,&procs)PetscMallocA(1,PETSC_FALSE,757,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,(size_t)(PJ)*sizeof(**(&procs)),(&procs));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),757,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
758 | for (pj=0; pj<PJ; pj++) { | |||
759 | ierr = PetscMalloc1(PI,&(procs[pj]))PetscMallocA(1,PETSC_FALSE,759,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,(size_t)(PI)*sizeof(**(&(procs[pj]))),(&(procs[pj])) );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),759,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
760 | for (pi=0; pi<PI; pi++) { | |||
761 | procs[pj][pi] = rank; | |||
762 | rank++; | |||
763 | } | |||
764 | } | |||
765 | ||||
766 | pi = neighbors[0] % PI; | |||
767 | pj = neighbors[0] / PI; | |||
768 | pim = pi-1; if (pim<0) pim=PI-1; | |||
769 | pip = (pi+1)%PI; | |||
770 | pjm = pj-1; if (pjm<0) pjm=PJ-1; | |||
771 | pjp = (pj+1)%PJ; | |||
772 | ||||
773 | neighbors[1] = procs[pj] [pim]; | |||
774 | neighbors[2] = procs[pjp][pim]; | |||
775 | neighbors[3] = procs[pjp][pi]; | |||
776 | neighbors[4] = procs[pjp][pip]; | |||
777 | neighbors[5] = procs[pj] [pip]; | |||
778 | neighbors[6] = procs[pjm][pip]; | |||
779 | neighbors[7] = procs[pjm][pi]; | |||
780 | neighbors[8] = procs[pjm][pim]; | |||
781 | ||||
782 | if (!IPeriodic) { | |||
783 | if (pi==0) neighbors[1]=neighbors[2]=neighbors[8]=neighbors[0]; | |||
784 | if (pi==PI-1) neighbors[4]=neighbors[5]=neighbors[6]=neighbors[0]; | |||
785 | } | |||
786 | ||||
787 | if (!JPeriodic) { | |||
788 | if (pj==0) neighbors[6]=neighbors[7]=neighbors[8]=neighbors[0]; | |||
789 | if (pj==PJ-1) neighbors[2]=neighbors[3]=neighbors[4]=neighbors[0]; | |||
790 | } | |||
791 | ||||
792 | for (pj = 0; pj < PJ; pj++) { | |||
793 | ierr = PetscFree(procs[pj])((*PetscTrFree)((void*)(procs[pj]),793,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || ((procs[pj]) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),793,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
794 | } | |||
795 | ierr = PetscFree(procs)((*PetscTrFree)((void*)(procs),795,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ) || ((procs) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),795,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
796 | 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); | |||
797 | } | |||
798 | ||||
799 | /* | |||
800 | SUBDOMAIN NEIGHBORHOOD PROCESS MAP: | |||
801 | 2 | 3 | 4 | |||
802 | __|___|__ | |||
803 | 1 | 0 | 5 | |||
804 | __|___|__ | |||
805 | 8 | 7 | 6 | |||
806 | | | | |||
807 | */ | |||
808 | PetscInt DMDAGetNeighborRelative(DM da, PetscReal ir, PetscReal jr) | |||
809 | { | |||
810 | DMDALocalInfo info; | |||
811 | PetscReal is,ie,js,je; | |||
812 | PetscErrorCode ierr; | |||
813 | ||||
814 | ierr = DMDAGetLocalInfo(da, &info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),814,__func__,"/sandbox/petsc/petsc.next-tmp/src/ts/characteristic/interface/characteristic.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
815 | is = (PetscReal) info.xs - 0.5; ie = (PetscReal) info.xs + info.xm - 0.5; | |||
816 | js = (PetscReal) info.ys - 0.5; je = (PetscReal) info.ys + info.ym - 0.5; | |||
817 | ||||
818 | if (ir >= is && ir <= ie) { /* center column */ | |||
819 | if (jr >= js && jr <= je) return 0; | |||
820 | else if (jr < js) return 7; | |||
821 | else return 3; | |||
822 | } else if (ir < is) { /* left column */ | |||
823 | if (jr >= js && jr <= je) return 1; | |||
824 | else if (jr < js) return 8; | |||
825 | else return 2; | |||
826 | } else { /* right column */ | |||
827 | if (jr >= js && jr <= je) return 5; | |||
828 | else if (jr < js) return 6; | |||
829 | else return 4; | |||
830 | } | |||
831 | } |