Bug Summary

File:ts/characteristic/interface/characteristic.c
Warning:line 525, column 12
2nd function call argument is an uninitialized value

Annotated Source Code

[?] 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
6PetscClassId CHARACTERISTIC_CLASSID;
7PetscLogEvent CHARACTERISTIC_SetUp, CHARACTERISTIC_Solve, CHARACTERISTIC_QueueSetup, CHARACTERISTIC_DAUpdate;
8PetscLogEvent CHARACTERISTIC_HalfTimeLocal, CHARACTERISTIC_HalfTimeRemote, CHARACTERISTIC_HalfTimeExchange;
9PetscLogEvent CHARACTERISTIC_FullTimeLocal, CHARACTERISTIC_FullTimeRemote, CHARACTERISTIC_FullTimeExchange;
10/*
11 Contains the list of registered characteristic routines
12*/
13PetscFunctionList CharacteristicList = NULL((void*)0);
14PetscBool CharacteristicRegisterAllCalled = PETSC_FALSE;
15
16PetscErrorCode DMDAGetNeighborsRank(DM, PetscMPIInt []);
17PetscInt DMDAGetNeighborRelative(DM, PetscReal, PetscReal);
18PetscErrorCode DMDAMapToPeriodicDomain(DM, PetscScalar []);
19
20PetscErrorCode CharacteristicHeapSort(Characteristic, Queue, PetscInt);
21PetscErrorCode CharacteristicSiftDown(Characteristic, Queue, PetscInt, PetscInt);
22
23PetscErrorCode 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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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
45PetscErrorCode 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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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.master/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
72PetscErrorCode 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.master/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.master/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.master/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.master/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.master/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.master/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.seealso: CharacteristicType
154
155@*/
156PetscErrorCode CharacteristicSetType(Characteristic c, CharacteristicType type)
157{
158 PetscErrorCode ierr, (*r)(Characteristic);
159 PetscBool match;
160
161 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
; petscstack->line[petscstack->currentsize] = 161; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
162 PetscValidHeaderSpecific(c, CHARACTERISTIC_CLASSID, 1)do { if (!c) return PetscError(((MPI_Comm)0x44000001),162,__func__
,"/sandbox/petsc/petsc.master/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),162,__func__,"/sandbox/petsc/petsc.master/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),162,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),162,__func__
,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
163 PetscValidCharPointer(type, 2)do { if (!type) return PetscError(((MPI_Comm)0x44000001),163,
__func__,"/sandbox/petsc/petsc.master/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),163,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer to char: Parameter # %d"
,2); } while (0)
;
164
165 ierr = PetscObjectTypeCompare((PetscObject) c, type, &match);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),165,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
166 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)
;
167
168 if (c->data) {
169 /* destroy the old private Characteristic context */
170 ierr = (*c->ops->destroy)(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),170,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
171 c->ops->destroy = NULL((void*)0);
172 c->data = 0;
173 }
174
175 ierr = PetscFunctionListFind(CharacteristicList,type,&r)PetscFunctionListFind_Private((CharacteristicList),(type),(PetscVoidFunction
*)(&r))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),175,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
176 if (!r) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_UNKNOWN_TYPE, "Unknown Characteristic type given: %s", type)return PetscError(((MPI_Comm)0x44000001),176,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,86,PETSC_ERROR_INITIAL,"Unknown Characteristic type given: %s"
,type)
;
177 c->setupcalled = 0;
178 ierr = (*r)(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),178,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
179 ierr = PetscObjectChangeTypeName((PetscObject) c, type);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),179,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
180 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)
;
181}
182
183/*@
184 CharacteristicSetUp - Sets up the internal data structures for the
185 later use of an iterative solver.
186
187 Collective on Characteristic
188
189 Input Parameter:
190. ksp - iterative context obtained from CharacteristicCreate()
191
192 Level: developer
193
194.seealso: CharacteristicCreate(), CharacteristicSolve(), CharacteristicDestroy()
195@*/
196PetscErrorCode CharacteristicSetUp(Characteristic c)
197{
198 PetscErrorCode ierr;
199
200 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
; petscstack->line[petscstack->currentsize] = 200; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
201 PetscValidHeaderSpecific(c, CHARACTERISTIC_CLASSID, 1)do { if (!c) return PetscError(((MPI_Comm)0x44000001),201,__func__
,"/sandbox/petsc/petsc.master/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),201,__func__,"/sandbox/petsc/petsc.master/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),201,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),201,__func__
,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
202
203 if (!((PetscObject)c)->type_name) {
204 ierr = CharacteristicSetType(c, CHARACTERISTICDA"da");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),204,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
205 }
206
207 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)
;
208
209 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),209,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
210 if (!c->setupcalled) {
211 ierr = (*c->ops->setup)(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),211,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
212 }
213 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),213,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
214 c->setupcalled = 2;
215 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)
;
216}
217
218/*@C
219 CharacteristicRegister - Adds a solver to the method of characteristics package.
220
221 Not Collective
222
223 Input Parameters:
224+ name_solver - name of a new user-defined solver
225- routine_create - routine to create method context
226
227 Sample usage:
228.vb
229 CharacteristicRegister("my_char", MyCharCreate);
230.ve
231
232 Then, your Characteristic type can be chosen with the procedural interface via
233.vb
234 CharacteristicCreate(MPI_Comm, Characteristic* &char);
235 CharacteristicSetType(char,"my_char");
236.ve
237 or at runtime via the option
238.vb
239 -characteristic_type my_char
240.ve
241
242 Notes:
243 CharacteristicRegister() may be called multiple times to add several user-defined solvers.
244
245.seealso: CharacteristicRegisterAll(), CharacteristicRegisterDestroy()
246
247 Level: advanced
248@*/
249PetscErrorCode CharacteristicRegister(const char sname[],PetscErrorCode (*function)(Characteristic))
250{
251 PetscErrorCode ierr;
252
253 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
; petscstack->line[petscstack->currentsize] = 253; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
254 ierr = CharacteristicInitializePackage();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),254,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
255 ierr = PetscFunctionListAdd(&CharacteristicList,sname,function)PetscFunctionListAdd_Private((&CharacteristicList),(sname
),(PetscVoidFunction)(function))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),255,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
256 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)
;
257}
258
259PetscErrorCode CharacteristicSetVelocityInterpolation(Characteristic c, DM da, Vec v, Vec vOld, PetscInt numComponents, PetscInt components[], PetscErrorCode (*interp)(Vec, PetscReal[], PetscInt, PetscInt[], PetscScalar[], void*), void *ctx)
260{
261 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
; petscstack->line[petscstack->currentsize] = 261; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
262 c->velocityDA = da;
263 c->velocity = v;
264 c->velocityOld = vOld;
265 c->numVelocityComp = numComponents;
266 c->velocityComp = components;
267 c->velocityInterp = interp;
268 c->velocityCtx = ctx;
269 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)
;
270}
271
272PetscErrorCode CharacteristicSetVelocityInterpolationLocal(Characteristic c, DM da, Vec v, Vec vOld, PetscInt numComponents, PetscInt components[], PetscErrorCode (*interp)(void*, PetscReal [], PetscInt, PetscInt[], PetscScalar[], void*), void *ctx)
273{
274 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
; petscstack->line[petscstack->currentsize] = 274; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
275 c->velocityDA = da;
276 c->velocity = v;
277 c->velocityOld = vOld;
278 c->numVelocityComp = numComponents;
279 c->velocityComp = components;
280 c->velocityInterpLocal = interp;
281 c->velocityCtx = ctx;
282 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)
;
283}
284
285PetscErrorCode CharacteristicSetFieldInterpolation(Characteristic c, DM da, Vec v, PetscInt numComponents, PetscInt components[], PetscErrorCode (*interp)(Vec, PetscReal[], PetscInt, PetscInt[], PetscScalar[], void*), void *ctx)
286{
287 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
; petscstack->line[petscstack->currentsize] = 287; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
288#if 0
289 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),289,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,56,PETSC_ERROR_INITIAL,"Fields with more than 2 components are not supported. Send mail to [email protected]."
)
;
290#endif
291 c->fieldDA = da;
292 c->field = v;
293 c->numFieldComp = numComponents;
294 c->fieldComp = components;
295 c->fieldInterp = interp;
296 c->fieldCtx = ctx;
297 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)
;
298}
299
300PetscErrorCode CharacteristicSetFieldInterpolationLocal(Characteristic c, DM da, Vec v, PetscInt numComponents, PetscInt components[], PetscErrorCode (*interp)(void*, PetscReal[], PetscInt, PetscInt[], PetscScalar [], void*), void *ctx)
301{
302 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
; petscstack->line[petscstack->currentsize] = 302; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
303#if 0
304 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),304,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,56,PETSC_ERROR_INITIAL,"Fields with more than 2 components are not supported. Send mail to [email protected]."
)
;
305#endif
306 c->fieldDA = da;
307 c->field = v;
308 c->numFieldComp = numComponents;
309 c->fieldComp = components;
310 c->fieldInterpLocal = interp;
311 c->fieldCtx = ctx;
312 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)
;
313}
314
315PetscErrorCode CharacteristicSolve(Characteristic c, PetscReal dt, Vec solution)
316{
317 CharacteristicPointDA2D Qi;
318 DM da = c->velocityDA;
319 Vec velocityLocal, velocityLocalOld;
320 Vec fieldLocal;
1
'fieldLocal' declared without an initial value
321 DMDALocalInfo info;
322 PetscScalar **solArray;
323 void *velocityArray;
324 void *velocityArrayOld;
325 void *fieldArray;
326 PetscScalar *interpIndices;
327 PetscScalar *velocityValues, *velocityValuesOld;
328 PetscScalar *fieldValues;
329 PetscMPIInt rank;
330 PetscInt dim;
331 PetscMPIInt neighbors[9];
332 PetscInt dof;
333 PetscInt gx, gy;
334 PetscInt n, is, ie, js, je, comp;
335 PetscErrorCode ierr;
336
337 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
; petscstack->line[petscstack->currentsize] = 337; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
338 c->queueSize = 0;
339 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)c), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),339,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
340 ierr = DMDAGetNeighborsRank(da, neighbors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),340,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
341 ierr = CharacteristicSetNeighbors(c, 9, neighbors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),341,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
342 ierr = CharacteristicSetUp(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),342,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
343 /* global and local grid info */
344 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),344,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
345 ierr = DMDAGetLocalInfo(da, &info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),345,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
346 is = info.xs; ie = info.xs+info.xm;
347 js = info.ys; je = info.ys+info.ym;
348 /* Allocation */
349 ierr = PetscMalloc1(dim, &interpIndices)PetscMallocA(1,PETSC_FALSE,349,__func__,"/sandbox/petsc/petsc.master/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),349,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
350 ierr = PetscMalloc1(c->numVelocityComp, &velocityValues)PetscMallocA(1,PETSC_FALSE,350,__func__,"/sandbox/petsc/petsc.master/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),350,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
351 ierr = PetscMalloc1(c->numVelocityComp, &velocityValuesOld)PetscMallocA(1,PETSC_FALSE,351,__func__,"/sandbox/petsc/petsc.master/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),351,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
352 ierr = PetscMalloc1(c->numFieldComp, &fieldValues)PetscMallocA(1,PETSC_FALSE,352,__func__,"/sandbox/petsc/petsc.master/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),352,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
353 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),353,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
354
355 /* -----------------------------------------------------------------------
356 PART 1, AT t-dt/2
357 -----------------------------------------------------------------------*/
358 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),358,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
359 /* GET POSITION AT HALF TIME IN THE PAST */
360 if (c->velocityInterpLocal) {
2
Assuming the condition is false
3
Taking false branch
361 ierr = DMGetLocalVector(c->velocityDA, &velocityLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),361,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
362 ierr = DMGetLocalVector(c->velocityDA, &velocityLocalOld);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),362,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
363 ierr = DMGlobalToLocalBegin(c->velocityDA, c->velocity, INSERT_VALUES, velocityLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),363,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
364 ierr = DMGlobalToLocalEnd(c->velocityDA, c->velocity, INSERT_VALUES, velocityLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),364,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
365 ierr = DMGlobalToLocalBegin(c->velocityDA, c->velocityOld, INSERT_VALUES, velocityLocalOld);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),365,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
366 ierr = DMGlobalToLocalEnd(c->velocityDA, c->velocityOld, INSERT_VALUES, velocityLocalOld);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),366,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
367 ierr = DMDAVecGetArray(c->velocityDA, velocityLocal, &velocityArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),367,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
368 ierr = DMDAVecGetArray(c->velocityDA, velocityLocalOld, &velocityArrayOld);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),368,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
369 }
370 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),370,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
371 for (Qi.j = js; Qi.j < je; Qi.j++) {
4
Loop condition is false. Execution continues on line 388
372 for (Qi.i = is; Qi.i < ie; Qi.i++) {
373 interpIndices[0] = Qi.i;
374 interpIndices[1] = Qi.j;
375 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),375,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
376 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),376,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
377 Qi.x = Qi.i - velocityValues[0]*dt/2.0;
378 Qi.y = Qi.j - velocityValues[1]*dt/2.0;
379
380 /* Determine whether the position at t - dt/2 is local */
381 Qi.proc = DMDAGetNeighborRelative(da, Qi.x, Qi.y);
382
383 /* Check for Periodic boundaries and move all periodic points back onto the domain */
384 ierr = DMDAMapCoordsToPeriodicDomain(da,&(Qi.x),&(Qi.y));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),384,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
385 ierr = CharacteristicAddPoint(c, &Qi);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),385,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
386 }
387 }
388 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),388,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
389
390 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),390,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
391 ierr = CharacteristicSendCoordinatesBegin(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),391,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
392 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),392,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
393
394 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),394,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
395 /* Calculate velocity at t_n+1/2 (local values) */
396 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),396,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
397 for (n = 0; n < c->queueSize; n++) {
5
Assuming the condition is false
6
Loop condition is false. Execution continues on line 414
398 Qi = c->queue[n];
399 if (c->neighbors[Qi.proc] == rank) {
400 interpIndices[0] = Qi.x;
401 interpIndices[1] = Qi.y;
402 if (c->velocityInterpLocal) {
403 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),403,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
404 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),404,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
405 } else {
406 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),406,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
407 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),407,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
408 }
409 Qi.x = 0.5*(velocityValues[0] + velocityValuesOld[0]);
410 Qi.y = 0.5*(velocityValues[1] + velocityValuesOld[1]);
411 }
412 c->queue[n] = Qi;
413 }
414 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),414,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
415
416 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),416,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
417 ierr = CharacteristicSendCoordinatesEnd(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),417,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
418 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),418,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
419
420
421 /* Calculate velocity at t_n+1/2 (fill remote requests) */
422 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),422,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
423 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),423,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
424 for (n = 0; n < c->queueRemoteSize; n++) {
7
Assuming the condition is false
8
Loop condition is false. Execution continues on line 439
425 Qi = c->queueRemote[n];
426 interpIndices[0] = Qi.x;
427 interpIndices[1] = Qi.y;
428 if (c->velocityInterpLocal) {
429 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),429,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
430 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),430,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
431 } else {
432 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),432,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
433 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),433,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
434 }
435 Qi.x = 0.5*(velocityValues[0] + velocityValuesOld[0]);
436 Qi.y = 0.5*(velocityValues[1] + velocityValuesOld[1]);
437 c->queueRemote[n] = Qi;
438 }
439 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),439,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
440 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),440,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
441 ierr = CharacteristicGetValuesBegin(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),441,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
442 ierr = CharacteristicGetValuesEnd(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),442,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
443 if (c->velocityInterpLocal) {
9
Assuming the condition is false
10
Taking false branch
444 ierr = DMDAVecRestoreArray(c->velocityDA, velocityLocal, &velocityArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),444,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
445 ierr = DMDAVecRestoreArray(c->velocityDA, velocityLocalOld, &velocityArrayOld);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),445,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
446 ierr = DMRestoreLocalVector(c->velocityDA, &velocityLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),446,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
447 ierr = DMRestoreLocalVector(c->velocityDA, &velocityLocalOld);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),447,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
448 }
449 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),449,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
450
451 /* -----------------------------------------------------------------------
452 PART 2, AT t-dt
453 -----------------------------------------------------------------------*/
454
455 /* GET POSITION AT t_n (local values) */
456 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),456,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
457 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),457,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
458 for (n = 0; n < c->queueSize; n++) {
11
Loop condition is false. Execution continues on line 471
459 Qi = c->queue[n];
460 Qi.x = Qi.i - Qi.x*dt;
461 Qi.y = Qi.j - Qi.y*dt;
462
463 /* Determine whether the position at t-dt is local */
464 Qi.proc = DMDAGetNeighborRelative(da, Qi.x, Qi.y);
465
466 /* Check for Periodic boundaries and move all periodic points back onto the domain */
467 ierr = DMDAMapCoordsToPeriodicDomain(da,&(Qi.x),&(Qi.y));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),467,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
468
469 c->queue[n] = Qi;
470 }
471 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),471,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
472
473 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),473,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
474 ierr = CharacteristicSendCoordinatesBegin(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),474,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
475 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),475,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
476
477 /* GET VALUE AT FULL TIME IN THE PAST (LOCAL REQUESTS) */
478 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),478,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
479 if (c->fieldInterpLocal) {
12
Assuming the condition is false
13
Taking false branch
480 ierr = DMGetLocalVector(c->fieldDA, &fieldLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),480,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
481 ierr = DMGlobalToLocalBegin(c->fieldDA, c->field, INSERT_VALUES, fieldLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),481,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
482 ierr = DMGlobalToLocalEnd(c->fieldDA, c->field, INSERT_VALUES, fieldLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),482,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
483 ierr = DMDAVecGetArray(c->fieldDA, fieldLocal, &fieldArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),483,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
484 }
485 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),485,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
486 for (n = 0; n < c->queueSize; n++) {
14
Assuming the condition is true
15
Loop condition is true. Entering loop body
20
Assuming the condition is false
21
Loop condition is false. Execution continues on line 495
487 if (c->neighbors[c->queue[n].proc] == rank) {
16
Taking true branch
488 interpIndices[0] = c->queue[n].x;
489 interpIndices[1] = c->queue[n].y;
490 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),490,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
17
Taking false branch
491 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),491,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
492 for (comp = 0; comp < c->numFieldComp; comp++) c->queue[n].field[comp] = fieldValues[comp];
18
Assuming the condition is false
19
Loop condition is false. Execution continues on line 486
493 }
494 }
495 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),495,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
496
497 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),497,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
498 ierr = CharacteristicSendCoordinatesEnd(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),498,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
499 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),499,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
500
501 /* GET VALUE AT FULL TIME IN THE PAST (REMOTE REQUESTS) */
502 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),502,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
503 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),503,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
504 for (n = 0; n < c->queueRemoteSize; n++) {
22
Assuming the condition is false
23
Loop condition is false. Execution continues on line 519
505 interpIndices[0] = c->queueRemote[n].x;
506 interpIndices[1] = c->queueRemote[n].y;
507
508 /* for debugging purposes */
509 if (1) { /* hacked bounds test...let's do better */
510 PetscScalar im = interpIndices[0]; PetscScalar jm = interpIndices[1];
511
512 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),512,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,76,PETSC_ERROR_INITIAL,"Nonlocal point: (%g,%g)",im,jm)
;
513 }
514
515 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),515,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
516 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),516,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
517 for (comp = 0; comp < c->numFieldComp; comp++) c->queueRemote[n].field[comp] = fieldValues[comp];
518 }
519 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),519,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
520
521 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),521,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
522 ierr = CharacteristicGetValuesBegin(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),522,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
523 ierr = CharacteristicGetValuesEnd(c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),523,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
524 if (c->fieldInterpLocal) {
24
Assuming the condition is true
25
Taking true branch
525 ierr = DMDAVecRestoreArray(c->fieldDA, fieldLocal, &fieldArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),525,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
26
2nd function call argument is an uninitialized value
526 ierr = DMRestoreLocalVector(c->fieldDA, &fieldLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),526,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
527 }
528 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),528,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
529
530 /* Return field of characteristics at t_n-1 */
531 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),531,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
532 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),532,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
533 ierr = DMDAVecGetArray(c->fieldDA, solution, &solArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),533,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
534 for (n = 0; n < c->queueSize; n++) {
535 Qi = c->queue[n];
536 for (comp = 0; comp < c->numFieldComp; comp++) solArray[Qi.j][Qi.i*dof+c->fieldComp[comp]] = Qi.field[comp];
537 }
538 ierr = DMDAVecRestoreArray(c->fieldDA, solution, &solArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),538,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
539 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),539,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
540 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),540,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
541
542 /* Cleanup */
543 ierr = PetscFree(interpIndices)((*PetscTrFree)((void*)(interpIndices),543,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
) || ((interpIndices) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),543,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
544 ierr = PetscFree(velocityValues)((*PetscTrFree)((void*)(velocityValues),544,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
) || ((velocityValues) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),544,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
545 ierr = PetscFree(velocityValuesOld)((*PetscTrFree)((void*)(velocityValuesOld),545,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
) || ((velocityValuesOld) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),545,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
546 ierr = PetscFree(fieldValues)((*PetscTrFree)((void*)(fieldValues),546,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
) || ((fieldValues) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),546,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
547 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)
;
548}
549
550PetscErrorCode CharacteristicSetNeighbors(Characteristic c, PetscInt numNeighbors, PetscMPIInt neighbors[])
551{
552 PetscErrorCode ierr;
553
554 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
; petscstack->line[petscstack->currentsize] = 554; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
555 c->numNeighbors = numNeighbors;
556 ierr = PetscFree(c->neighbors)((*PetscTrFree)((void*)(c->neighbors),556,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
) || ((c->neighbors) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),556,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
557 ierr = PetscMalloc1(numNeighbors, &c->neighbors)PetscMallocA(1,PETSC_FALSE,557,__func__,"/sandbox/petsc/petsc.master/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),557,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
558 ierr = PetscArraycpy(c->neighbors, neighbors, numNeighbors)((sizeof(*(c->neighbors)) != sizeof(*(neighbors))) || PetscMemcpy
(c->neighbors,neighbors,(numNeighbors)*sizeof(*(c->neighbors
))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),558,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
559 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)
;
560}
561
562PetscErrorCode CharacteristicAddPoint(Characteristic c, CharacteristicPointDA2D *point)
563{
564 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
; petscstack->line[petscstack->currentsize] = 564; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
565 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),565,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,63,PETSC_ERROR_INITIAL,"Exceeeded maximum queue size %d",c->
queueMax)
;
566 c->queue[c->queueSize++] = *point;
567 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)
;
568}
569
570int CharacteristicSendCoordinatesBegin(Characteristic c)
571{
572 PetscMPIInt rank, tag = 121;
573 PetscInt i, n;
574 PetscErrorCode ierr;
575
576 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
; petscstack->line[petscstack->currentsize] = 576; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
577 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)c), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),577,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
578 ierr = CharacteristicHeapSort(c, c->queue, c->queueSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),578,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
579 ierr = PetscArrayzero(c->needCount, c->numNeighbors)PetscMemzero(c->needCount,(c->numNeighbors)*sizeof(*(c->
needCount)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),579,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
580 for (i = 0; i < c->queueSize; i++) c->needCount[c->queue[i].proc]++;
581 c->fillCount[0] = 0;
582 for (n = 1; n < c->numNeighbors; n++) {
583 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),583,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
584 }
585 for (n = 1; n < c->numNeighbors; n++) {
586 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),586,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
587 }
588 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),588,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
589 /* Initialize the remote queue */
590 c->queueLocalMax = c->localOffsets[0] = 0;
591 c->queueRemoteMax = c->remoteOffsets[0] = 0;
592 for (n = 1; n < c->numNeighbors; n++) {
593 c->remoteOffsets[n] = c->queueRemoteMax;
594 c->queueRemoteMax += c->fillCount[n];
595 c->localOffsets[n] = c->queueLocalMax;
596 c->queueLocalMax += c->needCount[n];
597 }
598 /* HACK BEGIN */
599 for (n = 1; n < c->numNeighbors; n++) c->localOffsets[n] += c->needCount[0];
600 c->needCount[0] = 0;
601 /* HACK END */
602 if (c->queueRemoteMax) {
603 ierr = PetscMalloc1(c->queueRemoteMax, &c->queueRemote)PetscMallocA(1,PETSC_FALSE,603,__func__,"/sandbox/petsc/petsc.master/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),603,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
604 } else c->queueRemote = NULL((void*)0);
605 c->queueRemoteSize = c->queueRemoteMax;
606
607 /* Send and Receive requests for values at t_n+1/2, giving the coordinates for interpolation */
608 for (n = 1; n < c->numNeighbors; n++) {
609 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),609,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
610 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),610,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
611 }
612 for (n = 1; n < c->numNeighbors; n++) {
613 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),613,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
614 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),614,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
615 }
616 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)
;
617}
618
619PetscErrorCode CharacteristicSendCoordinatesEnd(Characteristic c)
620{
621#if 0
622 PetscMPIInt rank;
623 PetscInt n;
624#endif
625 PetscErrorCode ierr;
626
627 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
; petscstack->line[petscstack->currentsize] = 627; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
628 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),628,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
629#if 0
630 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)c), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),630,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
631 for (n = 0; n < c->queueRemoteSize; n++) {
632 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),632,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,77,PETSC_ERROR_INITIAL,"This is messed up, n = %d proc = %d"
,n,c->queueRemote[n].proc)
;
633 }
634#endif
635 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)
;
636}
637
638PetscErrorCode CharacteristicGetValuesBegin(Characteristic c)
639{
640 PetscMPIInt tag = 121;
641 PetscInt n;
642 PetscErrorCode ierr;
643
644 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
; petscstack->line[petscstack->currentsize] = 644; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
645 /* SEND AND RECIEVE FILLED REQUESTS for velocities at t_n+1/2 */
646 for (n = 1; n < c->numNeighbors; n++) {
647 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),647,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
648 }
649 for (n = 1; n < c->numNeighbors; n++) {
650 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),650,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
651 }
652 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)
;
653}
654
655PetscErrorCode CharacteristicGetValuesEnd(Characteristic c)
656{
657 PetscErrorCode ierr;
658
659 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
; petscstack->line[petscstack->currentsize] = 659; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
660 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),660,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
661 /* Free queue of requests from other procs */
662 ierr = PetscFree(c->queueRemote)((*PetscTrFree)((void*)(c->queueRemote),662,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
) || ((c->queueRemote) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),662,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
663 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)
;
664}
665
666/*---------------------------------------------------------------------*/
667/*
668 Based on code from http://linux.wku.edu/~lamonml/algor/sort/heap.html
669*/
670PetscErrorCode CharacteristicHeapSort(Characteristic c, Queue queue, PetscInt size)
671/*---------------------------------------------------------------------*/
672{
673 PetscErrorCode ierr;
674 CharacteristicPointDA2D temp;
675 PetscInt n;
676
677 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
; petscstack->line[petscstack->currentsize] = 677; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
678 if (0) { /* Check the order of the queue before sorting */
679 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),679,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
680 for (n=0; n<size; n++) {
681 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),681,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
682 }
683 }
684
685 /* SORTING PHASE */
686 for (n = (size / 2)-1; n >= 0; n--) {
687 ierr = CharacteristicSiftDown(c, queue, n, size-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),687,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* Rich had size-1 here, Matt had size*/
688 }
689 for (n = size-1; n >= 1; n--) {
690 temp = queue[0];
691 queue[0] = queue[n];
692 queue[n] = temp;
693 ierr = CharacteristicSiftDown(c, queue, 0, n-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),693,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
694 }
695 if (0) { /* Check the order of the queue after sorting */
696 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),696,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
697 for (n=0; n<size; n++) {
698 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),698,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
699 }
700 }
701 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)
;
702}
703
704/*---------------------------------------------------------------------*/
705/*
706 Based on code from http://linux.wku.edu/~lamonml/algor/sort/heap.html
707*/
708PetscErrorCode CharacteristicSiftDown(Characteristic c, Queue queue, PetscInt root, PetscInt bottom)
709/*---------------------------------------------------------------------*/
710{
711 PetscBool done = PETSC_FALSE;
712 PetscInt maxChild;
713 CharacteristicPointDA2D temp;
714
715 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
; petscstack->line[petscstack->currentsize] = 715; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
716 while ((root*2 <= bottom) && (!done)) {
717 if (root*2 == bottom) maxChild = root * 2;
718 else if (queue[root*2].proc > queue[root*2+1].proc) maxChild = root * 2;
719 else maxChild = root * 2 + 1;
720
721 if (queue[root].proc < queue[maxChild].proc) {
722 temp = queue[root];
723 queue[root] = queue[maxChild];
724 queue[maxChild] = temp;
725 root = maxChild;
726 } else done = PETSC_TRUE;
727 }
728 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)
;
729}
730
731/* [center, left, top-left, top, top-right, right, bottom-right, bottom, bottom-left] */
732PetscErrorCode DMDAGetNeighborsRank(DM da, PetscMPIInt neighbors[])
733{
734 DMBoundaryType bx, by;
735 PetscBool IPeriodic = PETSC_FALSE, JPeriodic = PETSC_FALSE;
736 MPI_Comm comm;
737 PetscMPIInt rank;
738 PetscInt **procs,pi,pj,pim,pip,pjm,pjp,PI,PJ;
739 PetscErrorCode ierr;
740
741 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
; petscstack->line[petscstack->currentsize] = 741; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
742 ierr = PetscObjectGetComm((PetscObject) da, &comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),742,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
743 ierr = MPI_Comm_rank(comm, &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),743,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
744 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),744,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
745
746 if (bx == DM_BOUNDARY_PERIODIC) IPeriodic = PETSC_TRUE;
747 if (by == DM_BOUNDARY_PERIODIC) JPeriodic = PETSC_TRUE;
748
749 neighbors[0] = rank;
750 rank = 0;
751 ierr = PetscMalloc1(PJ,&procs)PetscMallocA(1,PETSC_FALSE,751,__func__,"/sandbox/petsc/petsc.master/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),751,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
752 for (pj=0; pj<PJ; pj++) {
753 ierr = PetscMalloc1(PI,&(procs[pj]))PetscMallocA(1,PETSC_FALSE,753,__func__,"/sandbox/petsc/petsc.master/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),753,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
754 for (pi=0; pi<PI; pi++) {
755 procs[pj][pi] = rank;
756 rank++;
757 }
758 }
759
760 pi = neighbors[0] % PI;
761 pj = neighbors[0] / PI;
762 pim = pi-1; if (pim<0) pim=PI-1;
763 pip = (pi+1)%PI;
764 pjm = pj-1; if (pjm<0) pjm=PJ-1;
765 pjp = (pj+1)%PJ;
766
767 neighbors[1] = procs[pj] [pim];
768 neighbors[2] = procs[pjp][pim];
769 neighbors[3] = procs[pjp][pi];
770 neighbors[4] = procs[pjp][pip];
771 neighbors[5] = procs[pj] [pip];
772 neighbors[6] = procs[pjm][pip];
773 neighbors[7] = procs[pjm][pi];
774 neighbors[8] = procs[pjm][pim];
775
776 if (!IPeriodic) {
777 if (pi==0) neighbors[1]=neighbors[2]=neighbors[8]=neighbors[0];
778 if (pi==PI-1) neighbors[4]=neighbors[5]=neighbors[6]=neighbors[0];
779 }
780
781 if (!JPeriodic) {
782 if (pj==0) neighbors[6]=neighbors[7]=neighbors[8]=neighbors[0];
783 if (pj==PJ-1) neighbors[2]=neighbors[3]=neighbors[4]=neighbors[0];
784 }
785
786 for (pj = 0; pj < PJ; pj++) {
787 ierr = PetscFree(procs[pj])((*PetscTrFree)((void*)(procs[pj]),787,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
) || ((procs[pj]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),787,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
788 }
789 ierr = PetscFree(procs)((*PetscTrFree)((void*)(procs),789,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
) || ((procs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),789,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
790 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)
;
791}
792
793/*
794 SUBDOMAIN NEIGHBORHOOD PROCESS MAP:
795 2 | 3 | 4
796 __|___|__
797 1 | 0 | 5
798 __|___|__
799 8 | 7 | 6
800 | |
801*/
802PetscInt DMDAGetNeighborRelative(DM da, PetscReal ir, PetscReal jr)
803{
804 DMDALocalInfo info;
805 PetscReal is,ie,js,je;
806 PetscErrorCode ierr;
807
808 ierr = DMDAGetLocalInfo(da, &info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),808,__func__,"/sandbox/petsc/petsc.master/src/ts/characteristic/interface/characteristic.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
809 is = (PetscReal) info.xs - 0.5; ie = (PetscReal) info.xs + info.xm - 0.5;
810 js = (PetscReal) info.ys - 0.5; je = (PetscReal) info.ys + info.ym - 0.5;
811
812 if (ir >= is && ir <= ie) { /* center column */
813 if (jr >= js && jr <= je) return 0;
814 else if (jr < js) return 7;
815 else return 3;
816 } else if (ir < is) { /* left column */
817 if (jr >= js && jr <= je) return 1;
818 else if (jr < js) return 8;
819 else return 2;
820 } else { /* right column */
821 if (jr >= js && jr <= je) return 5;
822 else if (jr < js) return 6;
823 else return 4;
824 }
825}