Bug Summary

File:dm/dt/space/impls/tensor/spacetensor.c
Warning:line 35, column 10
The left operand of '>' is a garbage value

Annotated Source Code

[?] Use j/k keys for keyboard navigation

1#include <petsc/private/petscfeimpl.h> /*I "petscfe.h" I*/
2
3static PetscErrorCode PetscSpaceTensorCreateSubspace(PetscSpace space, PetscInt Nvs, PetscSpace *subspace)
4{
5 PetscInt degree;
6 const char *prefix;
7 PetscErrorCode ierr;
8
9 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 9; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
10 ierr = PetscSpaceGetDegree(space, &degree, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),10,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
11 ierr = PetscObjectGetOptionsPrefix((PetscObject)space, &prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),11,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
12 ierr = PetscSpaceCreate(PetscObjectComm((PetscObject)space), subspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),12,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
13 ierr = PetscSpaceSetType(*subspace, PETSCSPACEPOLYNOMIAL"poly");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),13,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
14 ierr = PetscSpaceSetNumVariables(*subspace, Nvs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),14,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
15 ierr = PetscSpaceSetNumComponents(*subspace, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),15,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
16 ierr = PetscSpaceSetDegree(*subspace, degree, PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),16,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
17 ierr = PetscObjectSetOptionsPrefix((PetscObject)*subspace, prefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),17,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
18 ierr = PetscObjectAppendOptionsPrefix((PetscObject)*subspace, "subspace_");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),18,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
19 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)
;
20}
21
22static PetscErrorCode PetscSpaceSetFromOptions_Tensor(PetscOptionItems *PetscOptionsObject,PetscSpace sp)
23{
24 PetscSpace_Tensor *tens = (PetscSpace_Tensor *) sp->data;
25 PetscInt Ns, Nc, i, Nv, deg;
1
'Ns' declared without an initial value
26 PetscBool uniform = PETSC_TRUE;
27 PetscErrorCode ierr;
28
29 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 29; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
30 ierr = PetscSpaceGetNumVariables(sp, &Nv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),30,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
31 if (!Nv) 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)
;
2
Assuming 'Nv' is not equal to 0
3
Taking false branch
32 ierr = PetscSpaceGetNumComponents(sp, &Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),32,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
33 ierr = PetscSpaceTensorGetNumSubspaces(sp, &Ns);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),33,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4
Calling 'PetscSpaceTensorGetNumSubspaces'
11
Returning from 'PetscSpaceTensorGetNumSubspaces'
34 ierr = PetscSpaceGetDegree(sp, &deg, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),34,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
35 if (Ns > 1) {
12
The left operand of '>' is a garbage value
36 PetscSpace s0;
37
38 ierr = PetscSpaceTensorGetSubspace(sp, 0, &s0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),38,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
39 for (i = 1; i < Ns; i++) {
40 PetscSpace si;
41
42 ierr = PetscSpaceTensorGetSubspace(sp, i, &si);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),42,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
43 if (si != s0) {uniform = PETSC_FALSE; break;}
44 }
45 }
46 Ns = (Ns == PETSC_DEFAULT-2) ? PetscMax(Nv,1)(((Nv)<(1)) ? (1) : (Nv)) : Ns;
47 ierr = PetscOptionsHead(PetscOptionsObject,"PetscSpace tensor options");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),47,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
48 ierr = PetscOptionsInt("-petscspace_tensor_spaces", "The number of subspaces", "PetscSpaceTensorSetNumSubspaces", Ns, &Ns, NULL)PetscOptionsInt_Private(PetscOptionsObject,"-petscspace_tensor_spaces"
,"The number of subspaces","PetscSpaceTensorSetNumSubspaces",
Ns,&Ns,((void*)0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),48,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
49 ierr = PetscOptionsBool("-petscspace_tensor_uniform", "Subspaces are identical", "PetscSpaceTensorSetFromOptions", uniform, &uniform, NULL)PetscOptionsBool_Private(PetscOptionsObject,"-petscspace_tensor_uniform"
,"Subspaces are identical","PetscSpaceTensorSetFromOptions",uniform
,&uniform,((void*)0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),49,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
50 ierr = PetscOptionsTail()0; do {if (PetscOptionsObject->count != 1) do { do { ; if (
petscstack && petscstack->currentsize > 0) { petscstack
->currentsize--; petscstack->function[petscstack->currentsize
] = 0; petscstack->file[petscstack->currentsize] = 0; petscstack
->line[petscstack->currentsize] = 0; petscstack->petscroutine
[petscstack->currentsize] = PETSC_FALSE; } if (petscstack)
{ petscstack->hotdepth = (((petscstack->hotdepth-1)<
(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); return
(0);} while (0);} while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),50,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
51 if (Ns < 0 || (Nv > 0 && Ns == 0)) SETERRQ1(PetscObjectComm((PetscObject)sp),PETSC_ERR_ARG_OUTOFRANGE,"Cannot have a tensor space made up of %D spaces\n",Ns)return PetscError(PetscObjectComm((PetscObject)sp),51,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,63,PETSC_ERROR_INITIAL,"Cannot have a tensor space made up of %D spaces\n"
,Ns)
;
52 if (Nv > 0 && Ns > Nv) SETERRQ2(PetscObjectComm((PetscObject)sp),PETSC_ERR_ARG_OUTOFRANGE,"Cannot have a tensor space with %D subspaces over %D variables\n", Ns, Nv)return PetscError(PetscObjectComm((PetscObject)sp),52,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,63,PETSC_ERROR_INITIAL,"Cannot have a tensor space with %D subspaces over %D variables\n"
,Ns,Nv)
;
53 if (Ns != tens->numTensSpaces) {ierr = PetscSpaceTensorSetNumSubspaces(sp, Ns);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),53,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
54 if (uniform) {
55 PetscInt Nvs = Nv / Ns;
56 PetscSpace subspace;
57
58 if (Nv % Ns) SETERRQ2(PetscObjectComm((PetscObject)sp),PETSC_ERR_ARG_WRONG,"Cannot use %D uniform subspaces for %D variable space\n", Ns, Nv)return PetscError(PetscObjectComm((PetscObject)sp),58,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,62,PETSC_ERROR_INITIAL,"Cannot use %D uniform subspaces for %D variable space\n"
,Ns,Nv)
;
59 ierr = PetscSpaceTensorGetSubspace(sp, 0, &subspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),59,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
60 if (!subspace) {ierr = PetscSpaceTensorCreateSubspace(sp, Nvs, &subspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),60,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
61 else {ierr = PetscObjectReference((PetscObject)subspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),61,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
62 ierr = PetscSpaceSetFromOptions(subspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),62,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
63 for (i = 0; i < Ns; i++) {ierr = PetscSpaceTensorSetSubspace(sp, i, subspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),63,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
64 ierr = PetscSpaceDestroy(&subspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),64,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
65 } else {
66 for (i = 0; i < Ns; i++) {
67 PetscSpace subspace;
68
69 ierr = PetscSpaceTensorGetSubspace(sp, i, &subspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),69,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
70 if (!subspace) {
71 char tprefix[128];
72
73 ierr = PetscSpaceTensorCreateSubspace(sp, 1, &subspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),73,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
74 ierr = PetscSNPrintf(tprefix, 128, "%d_",(int)i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),74,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
75 ierr = PetscObjectAppendOptionsPrefix((PetscObject)subspace, tprefix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),75,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
76 } else {
77 ierr = PetscObjectReference((PetscObject)subspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),77,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
78 }
79 ierr = PetscSpaceSetFromOptions(subspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),79,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
80 ierr = PetscSpaceTensorSetSubspace(sp, i, subspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),80,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
81 ierr = PetscSpaceDestroy(&subspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),81,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
82 }
83 }
84 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)
;
85}
86
87static PetscErrorCode PetscSpaceTensorView_Ascii(PetscSpace sp, PetscViewer v)
88{
89 PetscSpace_Tensor *tens = (PetscSpace_Tensor *) sp->data;
90 PetscBool uniform = PETSC_TRUE;
91 PetscInt Ns = tens->numTensSpaces, i, n;
92 PetscErrorCode ierr;
93
94 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 94; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
95 for (i = 1; i < Ns; i++) {
96 if (tens->tensspaces[i] != tens->tensspaces[0]) {uniform = PETSC_FALSE; break;}
97 }
98 if (uniform) {ierr = PetscViewerASCIIPrintf(v, "Tensor space of %D subspaces (all identical)\n", Ns);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),98,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
99 else {ierr = PetscViewerASCIIPrintf(v, "Tensor space of %D subspaces\n", Ns);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),99,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
100 n = uniform ? 1 : Ns;
101 for (i = 0; i < n; i++) {
102 ierr = PetscViewerASCIIPushTab(v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),102,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
103 ierr = PetscSpaceView(tens->tensspaces[i], v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),103,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
104 ierr = PetscViewerASCIIPopTab(v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),104,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
105 }
106 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)
;
107}
108
109static PetscErrorCode PetscSpaceView_Tensor(PetscSpace sp, PetscViewer viewer)
110{
111 PetscBool iascii;
112 PetscErrorCode ierr;
113
114 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 114; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
115 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERASCII"ascii", &iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),115,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
116 if (iascii) {ierr = PetscSpaceTensorView_Ascii(sp, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),116,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
117 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)
;
118}
119
120static PetscErrorCode PetscSpaceSetUp_Tensor(PetscSpace sp)
121{
122 PetscSpace_Tensor *tens = (PetscSpace_Tensor *) sp->data;
123 PetscInt Nv, Ns, i;
124 PetscBool uniform = PETSC_TRUE;
125 PetscInt deg, maxDeg;
126 PetscErrorCode ierr;
127
128 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 128; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
129 if (tens->setupCalled) 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)
;
130 ierr = PetscSpaceGetNumVariables(sp, &Nv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),130,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
131 ierr = PetscSpaceTensorGetNumSubspaces(sp, &Ns);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),131,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
132 if (Ns == PETSC_DEFAULT-2) {
133 Ns = Nv;
134 ierr = PetscSpaceTensorSetNumSubspaces(sp, Ns);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),134,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
135 }
136 if (!Ns) {
137 if (Nv) SETERRQ(PetscObjectComm((PetscObject)sp), PETSC_ERR_ARG_OUTOFRANGE, "Cannot have zero subspaces")return PetscError(PetscObjectComm((PetscObject)sp),137,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,63,PETSC_ERROR_INITIAL,"Cannot have zero subspaces")
;
138 } else {
139 PetscSpace s0;
140
141 if (Nv > 0 && Ns > Nv) SETERRQ2(PetscObjectComm((PetscObject)sp),PETSC_ERR_ARG_OUTOFRANGE,"Cannot have a tensor space with %D subspaces over %D variables\n", Ns, Nv)return PetscError(PetscObjectComm((PetscObject)sp),141,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,63,PETSC_ERROR_INITIAL,"Cannot have a tensor space with %D subspaces over %D variables\n"
,Ns,Nv)
;
142 ierr = PetscSpaceTensorGetSubspace(sp, 0, &s0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),142,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
143 for (i = 1; i < Ns; i++) {
144 PetscSpace si;
145
146 ierr = PetscSpaceTensorGetSubspace(sp, i, &si);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),146,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
147 if (si != s0) {uniform = PETSC_FALSE; break;}
148 }
149 if (uniform) {
150 PetscInt Nvs = Nv / Ns;
151
152 if (Nv % Ns) SETERRQ2(PetscObjectComm((PetscObject)sp),PETSC_ERR_ARG_WRONG,"Cannot use %D uniform subspaces for %D variable space\n", Ns, Nv)return PetscError(PetscObjectComm((PetscObject)sp),152,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,62,PETSC_ERROR_INITIAL,"Cannot use %D uniform subspaces for %D variable space\n"
,Ns,Nv)
;
153 if (!s0) {ierr = PetscSpaceTensorCreateSubspace(sp, Nvs, &s0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),153,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
154 else {ierr = PetscObjectReference((PetscObject) s0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),154,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
155 ierr = PetscSpaceSetUp(s0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),155,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
156 for (i = 0; i < Ns; i++) {ierr = PetscSpaceTensorSetSubspace(sp, i, s0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),156,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
157 ierr = PetscSpaceDestroy(&s0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),157,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
158 } else {
159 for (i = 0 ; i < Ns; i++) {
160 PetscSpace si;
161
162 ierr = PetscSpaceTensorGetSubspace(sp, i, &si);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),162,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
163 if (!si) {ierr = PetscSpaceTensorCreateSubspace(sp, 1, &si);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),163,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
164 else {ierr = PetscObjectReference((PetscObject) si);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),164,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
165 ierr = PetscSpaceSetUp(si);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),165,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
166 ierr = PetscSpaceTensorSetSubspace(sp, i, si);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),166,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
167 ierr = PetscSpaceDestroy(&si);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),167,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
168 }
169 }
170 }
171 deg = PETSC_MAX_INT2147483647;
172 maxDeg = 0;
173 for (i = 0; i < Ns; i++) {
174 PetscSpace si;
175 PetscInt iDeg, iMaxDeg;
176
177 ierr = PetscSpaceTensorGetSubspace(sp, i, &si);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),177,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
178 ierr = PetscSpaceGetDegree(si, &iDeg, &iMaxDeg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),178,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
179 deg = PetscMin(deg, iDeg)(((deg)<(iDeg)) ? (deg) : (iDeg));
180 maxDeg += iMaxDeg;
181 }
182 sp->degree = deg;
183 sp->maxDegree = maxDeg;
184 tens->uniform = uniform;
185 tens->setupCalled = PETSC_TRUE;
186 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)
;
187}
188
189static PetscErrorCode PetscSpaceDestroy_Tensor(PetscSpace sp)
190{
191 PetscSpace_Tensor *tens = (PetscSpace_Tensor *) sp->data;
192 PetscInt Ns, i;
193 PetscErrorCode ierr;
194
195 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 195; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
196 Ns = tens->numTensSpaces;
197 if (tens->heightsubspaces) {
198 PetscInt d;
199
200 /* sp->Nv is the spatial dimension, so it is equal to the number
201 * of subspaces on higher co-dimension points */
202 for (d = 0; d < sp->Nv; ++d) {
203 ierr = PetscSpaceDestroy(&tens->heightsubspaces[d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),203,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
204 }
205 }
206 ierr = PetscFree(tens->heightsubspaces)((*PetscTrFree)((void*)(tens->heightsubspaces),206,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
) || ((tens->heightsubspaces) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),206,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
207 for (i = 0; i < Ns; i++) {ierr = PetscSpaceDestroy(&tens->tensspaces[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),207,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
208 ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscSpaceTensorSetSubspace_C", NULL)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscSpaceTensorSetSubspace_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),208,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
209 ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscSpaceTensorGetSubspace_C", NULL)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscSpaceTensorGetSubspace_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),209,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
210 ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscSpaceTensorSetNumSubspaces_C", NULL)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscSpaceTensorSetNumSubspaces_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),210,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
211 ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscSpaceTensorGetNumSubspaces_C", NULL)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscSpaceTensorGetNumSubspaces_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),211,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
212 ierr = PetscFree(tens->tensspaces)((*PetscTrFree)((void*)(tens->tensspaces),212,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
) || ((tens->tensspaces) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),212,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
213 ierr = PetscFree(tens)((*PetscTrFree)((void*)(tens),213,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
) || ((tens) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),213,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
214 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)
;
215}
216
217static PetscErrorCode PetscSpaceGetDimension_Tensor(PetscSpace sp, PetscInt *dim)
218{
219 PetscSpace_Tensor *tens = (PetscSpace_Tensor *) sp->data;
220 PetscInt i, Ns, Nc, d;
221 PetscErrorCode ierr;
222
223 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 223; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
224 ierr = PetscSpaceSetUp(sp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),224,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
225 Ns = tens->numTensSpaces;
226 Nc = sp->Nc;
227 d = 1;
228 for (i = 0; i < Ns; i++) {
229 PetscInt id;
230
231 ierr = PetscSpaceGetDimension(tens->tensspaces[i], &id);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),231,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
232 d *= id;
233 }
234 d *= Nc;
235 *dim = d;
236 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
237}
238
239static PetscErrorCode PetscSpaceEvaluate_Tensor(PetscSpace sp, PetscInt npoints, const PetscReal points[], PetscReal B[], PetscReal D[], PetscReal H[])
240{
241 PetscSpace_Tensor *tens = (PetscSpace_Tensor *) sp->data;
242 DM dm = sp->dm;
243 PetscInt Nc = sp->Nc;
244 PetscInt Nv = sp->Nv;
245 PetscInt Ns;
246 PetscReal *lpoints, *sB = NULL((void*)0), *sD = NULL((void*)0), *sH = NULL((void*)0);
247 PetscInt c, pdim, d, e, der, der2, i, l, si, p, s, step;
248 PetscErrorCode ierr;
249
250 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 250; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
251 if (!tens->setupCalled) {ierr = PetscSpaceSetUp(sp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),251,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
252 Ns = tens->numTensSpaces;
253 ierr = PetscSpaceGetDimension(sp,&pdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),253,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
254 pdim /= Nc;
255 ierr = DMGetWorkArray(dm, npoints*Nv, MPIU_REAL((MPI_Datatype)0x4c00080b), &lpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),255,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
256 if (B || D || H) {ierr = DMGetWorkArray(dm, npoints*pdim, MPIU_REAL((MPI_Datatype)0x4c00080b), &sB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),256,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
257 if (D || H) {ierr = DMGetWorkArray(dm, npoints*pdim*Nv, MPIU_REAL((MPI_Datatype)0x4c00080b), &sD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),257,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
258 if (H) {ierr = DMGetWorkArray(dm, npoints*pdim*Nv*Nv, MPIU_REAL((MPI_Datatype)0x4c00080b), &sH);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),258,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
259 if (B) {
260 for (i = 0; i < npoints*pdim*Nc*Nc; i++) B[i] = 0.;
261 for (i = 0; i < npoints*pdim; i++) B[i * Nc*Nc] = 1.;
262 }
263 if (D) {
264 for (i = 0; i < npoints*pdim*Nc*Nc*Nv; i++) D[i] = 0.;
265 for (i = 0; i < npoints*pdim; i++) {
266 for (l = 0; l < Nv; l++) {
267 D[i * Nc*Nc*Nv + l] = 1.;
268 }
269 }
270 }
271 if (H) {
272 for (i = 0; i < npoints*pdim*Nc*Nc*Nv*Nv; i++) D[i] = 0.;
273 for (i = 0; i < npoints*pdim; i++) {
274 for (l = 0; l < Nv*Nv; l++) {
275 H[i * Nc*Nc*Nv*Nv + l] = 1.;
276 }
277 }
278 }
279 for (s = 0, d = 0, step = 1; s < Ns; s++) {
280 PetscInt sNv, spdim;
281 PetscInt skip, j, k;
282
283 ierr = PetscSpaceGetNumVariables(tens->tensspaces[s], &sNv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),283,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
284 ierr = PetscSpaceGetDimension(tens->tensspaces[s], &spdim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),284,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
285 if ((pdim % step) || (pdim % spdim)) SETERRQ6(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Bad tensor loop: Nv %d, Ns %D, pdim %D, s %D, step %D, spdim %D", Nv, Ns, pdim, s, step, spdim)return PetscError(((MPI_Comm)0x44000001),285,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,77,PETSC_ERROR_INITIAL,"Bad tensor loop: Nv %d, Ns %D, pdim %D, s %D, step %D, spdim %D"
,Nv,Ns,pdim,s,step,spdim)
;
286 skip = pdim / (step * spdim);
287 for (p = 0; p < npoints; ++p) {
288 for (i = 0; i < sNv; i++) {
289 lpoints[p * sNv + i] = points[p*Nv + d + i];
290 }
291 }
292 ierr = PetscSpaceEvaluate(tens->tensspaces[s], npoints, lpoints, sB, sD, sH);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),292,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
293 if (B) {
294 for (p = 0; p < npoints; p++) {
295 for (k = 0; k < skip; k++) {
296 for (si = 0; si < spdim; si++) {
297 for (j = 0; j < step; j++) {
298 i = (k * spdim + si) * step + j;
299 B[(pdim * p + i) * Nc * Nc] *= sB[spdim * p + si];
300 }
301 }
302 }
303 }
304 }
305 if (D) {
306 for (p = 0; p < npoints; p++) {
307 for (k = 0; k < skip; k++) {
308 for (si = 0; si < spdim; si++) {
309 for (j = 0; j < step; j++) {
310 i = (k * spdim + si) * step + j;
311 for (der = 0; der < Nv; der++) {
312 if (der >= d && der < d + sNv) {
313 D[(pdim * p + i) * Nc*Nc*Nv + der] *= sD[(spdim * p + si) * sNv + der - d];
314 } else {
315 D[(pdim * p + i) * Nc*Nc*Nv + der] *= sB[spdim * p + si];
316 }
317 }
318 }
319 }
320 }
321 }
322 }
323 if (H) {
324 for (p = 0; p < npoints; p++) {
325 for (k = 0; k < skip; k++) {
326 for (si = 0; si < spdim; si++) {
327 for (j = 0; j < step; j++) {
328 i = (k * spdim + si) * step + j;
329 for (der = 0; der < Nv; der++) {
330 for (der2 = 0; der2 < Nv; der2++) {
331 if (der >= d && der < d + sNv && der2 >= d && der2 < d + sNv) {
332 H[((pdim * p + i) * Nc*Nc*Nv + der) * Nv + der2] *= sH[((spdim * p + si) * sNv + der - d) * sNv + der2 - d];
333 } else if (der >= d && der < d + sNv) {
334 H[((pdim * p + i) * Nc*Nc*Nv + der) * Nv + der2] *= sD[(spdim * p + si) * sNv + der - d];
335 } else if (der2 >= d && der2 < d + sNv) {
336 H[((pdim * p + i) * Nc*Nc*Nv + der) * Nv + der2] *= sD[(spdim * p + si) * sNv + der2 - d];
337 } else {
338 H[((pdim * p + i) * Nc*Nc*Nv + der) * Nv + der2] *= sB[spdim * p + si];
339 }
340 }
341 }
342 }
343 }
344 }
345 }
346 }
347 d += sNv;
348 step *= spdim;
349 }
350 if (B && Nc > 1) {
351 /* Make direct sum basis for multicomponent space */
352 for (p = 0; p < npoints; ++p) {
353 for (i = 0; i < pdim; ++i) {
354 for (c = 1; c < Nc; ++c) {
355 B[(p*pdim*Nc + i*Nc + c)*Nc + c] = B[(p*pdim + i)*Nc*Nc];
356 }
357 }
358 }
359 }
360 if (D && Nc > 1) {
361 /* Make direct sum basis for multicomponent space */
362 for (p = 0; p < npoints; ++p) {
363 for (i = 0; i < pdim; ++i) {
364 for (c = 1; c < Nc; ++c) {
365 for (d = 0; d < Nv; ++d) {
366 D[((p*pdim*Nc + i*Nc + c)*Nc + c)*Nv + d] = D[(p*pdim + i)*Nc*Nc*Nv + d];
367 }
368 }
369 }
370 }
371 }
372 if (H && Nc > 1) {
373 /* Make direct sum basis for multicomponent space */
374 for (p = 0; p < npoints; ++p) {
375 for (i = 0; i < pdim; ++i) {
376 for (c = 1; c < Nc; ++c) {
377 for (d = 0; d < Nv; ++d) {
378 for (e = 0; e < Nv; ++e) {
379 H[(((p*pdim*Nc + i*Nc + c)*Nc + c)*Nv + d)*Nv + e] = H[((p*pdim + i)*Nc*Nc*Nv + d)*Nv + e];
380 }
381 }
382 }
383 }
384 }
385 }
386 if (H) {ierr = DMRestoreWorkArray(dm, npoints*pdim*Nv*Nv, MPIU_REAL((MPI_Datatype)0x4c00080b), &sH);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),386,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
387 if (D || H) {ierr = DMRestoreWorkArray(dm, npoints*pdim*Nv, MPIU_REAL((MPI_Datatype)0x4c00080b), &sD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),387,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
388 if (B || D || H) {ierr = DMRestoreWorkArray(dm, npoints*pdim, MPIU_REAL((MPI_Datatype)0x4c00080b), &sB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),388,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
389 ierr = DMRestoreWorkArray(dm, npoints*Nv, MPIU_REAL((MPI_Datatype)0x4c00080b), &lpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),389,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
390 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)
;
391}
392
393PetscErrorCode PetscSpaceTensorSetNumSubspaces(PetscSpace sp, PetscInt numTensSpaces)
394{
395 PetscErrorCode ierr;
396
397 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 397; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
398 PetscValidHeaderSpecific(sp, PETSCSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),398,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),398,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(sp))->classid != PETSCSPACE_CLASSID
) { if (((PetscObject)(sp))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),398,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),398,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
399 ierr = PetscTryMethod(sp,"PetscSpaceTensorSetNumSubspaces_C",(PetscSpace,PetscInt),(sp,numTensSpaces))0; do { PetscErrorCode (*f)(PetscSpace,PetscInt), __ierr; __ierr
= PetscObjectQueryFunction_Private(((PetscObject)sp),("PetscSpaceTensorSetNumSubspaces_C"
),(PetscVoidFunction*)(&f));do {if (__builtin_expect(!!(__ierr
),0)) return PetscError(((MPI_Comm)0x44000001),399,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr =
(*f)(sp,numTensSpaces);do {if (__builtin_expect(!!(__ierr),0
)) return PetscError(((MPI_Comm)0x44000001),399,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),399,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
400 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)
;
401}
402
403PetscErrorCode PetscSpaceTensorGetNumSubspaces(PetscSpace sp, PetscInt *numTensSpaces)
404{
405 PetscErrorCode ierr;
406
407 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 407; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5
Within the expansion of the macro 'PetscFunctionBegin':
a
Assuming 'petscstack' is null
408 PetscValidHeaderSpecific(sp, PETSCSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),408,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),408,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(sp))->classid != PETSCSPACE_CLASSID
) { if (((PetscObject)(sp))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),408,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),408,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
6
Within the expansion of the macro 'PetscValidHeaderSpecific':
a
Assuming the condition is false
409 PetscValidIntPointer(numTensSpaces, 2)do { if (!numTensSpaces) return PetscError(((MPI_Comm)0x44000001
),409,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(numTensSpaces,PETSC_INT)) return PetscError
(((MPI_Comm)0x44000001),409,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer to Int: Parameter # %d"
,2); } while (0)
;
7
Within the expansion of the macro 'PetscValidIntPointer':
a
Assuming the condition is false
410 ierr = PetscTryMethod(sp,"PetscSpaceTensorGetNumSubspaces_C",(PetscSpace,PetscInt*),(sp,numTensSpaces))0; do { PetscErrorCode (*f)(PetscSpace,PetscInt*), __ierr; __ierr
= PetscObjectQueryFunction_Private(((PetscObject)sp),("PetscSpaceTensorGetNumSubspaces_C"
),(PetscVoidFunction*)(&f));do {if (__builtin_expect(!!(__ierr
),0)) return PetscError(((MPI_Comm)0x44000001),410,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr =
(*f)(sp,numTensSpaces);do {if (__builtin_expect(!!(__ierr),0
)) return PetscError(((MPI_Comm)0x44000001),410,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),410,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
8
Within the expansion of the macro 'PetscTryMethod':
a
Assuming '__ierr' is 0
b
Assuming 'f' is null
9
Within the expansion of the macro 'CHKERRQ':
411 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)
;
10
Within the expansion of the macro 'PetscFunctionReturn':
a
Assuming 'petscstack' is null
412}
413
414PetscErrorCode PetscSpaceTensorSetSubspace(PetscSpace sp, PetscInt s, PetscSpace subsp)
415{
416 PetscErrorCode ierr;
417
418 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 418; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
419 PetscValidHeaderSpecific(sp, PETSCSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),419,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),419,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(sp))->classid != PETSCSPACE_CLASSID
) { if (((PetscObject)(sp))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),419,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),419,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
420 if (subsp) PetscValidHeaderSpecific(subsp, PETSCSPACE_CLASSID, 3)do { if (!subsp) return PetscError(((MPI_Comm)0x44000001),420
,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",3); if (
!PetscCheckPointer(subsp,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),420,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,3); if (((PetscObject)(subsp))->classid != PETSCSPACE_CLASSID
) { if (((PetscObject)(subsp))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),420,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,3); else return PetscError(((MPI_Comm)0x44000001),420,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,3); } } while (0)
;
421 ierr = PetscTryMethod(sp,"PetscSpaceTensorSetSubspace_C",(PetscSpace,PetscInt,PetscSpace),(sp,s,subsp))0; do { PetscErrorCode (*f)(PetscSpace,PetscInt,PetscSpace), __ierr
; __ierr = PetscObjectQueryFunction_Private(((PetscObject)sp)
,("PetscSpaceTensorSetSubspace_C"),(PetscVoidFunction*)(&
f));do {if (__builtin_expect(!!(__ierr),0)) return PetscError
(((MPI_Comm)0x44000001),421,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr =
(*f)(sp,s,subsp);do {if (__builtin_expect(!!(__ierr),0)) return
PetscError(((MPI_Comm)0x44000001),421,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),421,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
422 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)
;
423}
424
425PetscErrorCode PetscSpaceTensorGetSubspace(PetscSpace sp, PetscInt s, PetscSpace *subsp)
426{
427 PetscErrorCode ierr;
428
429 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 429; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
430 PetscValidHeaderSpecific(sp, PETSCSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),430,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),430,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(sp))->classid != PETSCSPACE_CLASSID
) { if (((PetscObject)(sp))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),430,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),430,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
431 PetscValidPointer(subsp, 3)do { if (!subsp) return PetscError(((MPI_Comm)0x44000001),431
,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(subsp,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),431,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
;
432 ierr = PetscTryMethod(sp,"PetscSpaceTensorGetSubspace_C",(PetscSpace,PetscInt,PetscSpace*),(sp,s,subsp))0; do { PetscErrorCode (*f)(PetscSpace,PetscInt,PetscSpace*),
__ierr; __ierr = PetscObjectQueryFunction_Private(((PetscObject
)sp),("PetscSpaceTensorGetSubspace_C"),(PetscVoidFunction*)(&
f));do {if (__builtin_expect(!!(__ierr),0)) return PetscError
(((MPI_Comm)0x44000001),432,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr =
(*f)(sp,s,subsp);do {if (__builtin_expect(!!(__ierr),0)) return
PetscError(((MPI_Comm)0x44000001),432,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} } while(0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),432,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
433 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)
;
434}
435
436static PetscErrorCode PetscSpaceTensorSetNumSubspaces_Tensor(PetscSpace space, PetscInt numTensSpaces)
437{
438 PetscSpace_Tensor *tens = (PetscSpace_Tensor *) space->data;
439 PetscInt Ns;
440 PetscErrorCode ierr;
441
442 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 442; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
443 if (tens->setupCalled) SETERRQ(PetscObjectComm((PetscObject)space),PETSC_ERR_ARG_WRONGSTATE,"Cannot change number of subspaces after setup called\n")return PetscError(PetscObjectComm((PetscObject)space),443,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,73,PETSC_ERROR_INITIAL,"Cannot change number of subspaces after setup called\n"
)
;
444 Ns = tens->numTensSpaces;
445 if (numTensSpaces == Ns) 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)
;
446 if (Ns >= 0) {
447 PetscInt s;
448
449 for (s = 0; s < Ns; s++) {ierr = PetscSpaceDestroy(&tens->tensspaces[s]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),449,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
450 ierr = PetscFree(tens->tensspaces)((*PetscTrFree)((void*)(tens->tensspaces),450,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
) || ((tens->tensspaces) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),450,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
451 }
452 Ns = tens->numTensSpaces = numTensSpaces;
453 ierr = PetscCalloc1(Ns, &tens->tensspaces)PetscMallocA(1,PETSC_TRUE,453,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,(size_t)(Ns)*sizeof(**(&tens->tensspaces)),(&tens
->tensspaces))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),453,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
454 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)
;
455}
456
457static PetscErrorCode PetscSpaceTensorGetNumSubspaces_Tensor(PetscSpace space, PetscInt *numTensSpaces)
458{
459 PetscSpace_Tensor *tens = (PetscSpace_Tensor *) space->data;
460
461 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 461; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
462 *numTensSpaces = tens->numTensSpaces;
463 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)
;
464}
465
466static PetscErrorCode PetscSpaceTensorSetSubspace_Tensor(PetscSpace space, PetscInt s, PetscSpace subspace)
467{
468 PetscSpace_Tensor *tens = (PetscSpace_Tensor *) space->data;
469 PetscInt Ns;
470 PetscErrorCode ierr;
471
472 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 472; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
473 if (tens->setupCalled) SETERRQ(PetscObjectComm((PetscObject)space),PETSC_ERR_ARG_WRONGSTATE,"Cannot change subspace after setup called\n")return PetscError(PetscObjectComm((PetscObject)space),473,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,73,PETSC_ERROR_INITIAL,"Cannot change subspace after setup called\n"
)
;
474 Ns = tens->numTensSpaces;
475 if (Ns < 0) SETERRQ(PetscObjectComm((PetscObject)space),PETSC_ERR_ARG_WRONGSTATE,"Must call PetscSpaceTensorSetNumSubspaces() first\n")return PetscError(PetscObjectComm((PetscObject)space),475,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,73,PETSC_ERROR_INITIAL,"Must call PetscSpaceTensorSetNumSubspaces() first\n"
)
;
476 if (s < 0 || s >= Ns) SETERRQ1(PetscObjectComm((PetscObject)space),PETSC_ERR_ARG_OUTOFRANGE,"Invalid subspace number %D\n",subspace)return PetscError(PetscObjectComm((PetscObject)space),476,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,63,PETSC_ERROR_INITIAL,"Invalid subspace number %D\n",subspace
)
;
477 ierr = PetscObjectReference((PetscObject)subspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),477,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
478 ierr = PetscSpaceDestroy(&tens->tensspaces[s]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),478,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
479 tens->tensspaces[s] = subspace;
480 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)
;
481}
482
483static PetscErrorCode PetscSpaceGetHeightSubspace_Tensor(PetscSpace sp, PetscInt height, PetscSpace *subsp)
484{
485 PetscSpace_Tensor *tens = (PetscSpace_Tensor *) sp->data;
486 PetscInt Nc, dim, order, i;
487 PetscSpace bsp;
488 PetscErrorCode ierr;
489
490 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 490; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
491 if (!tens->uniform) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Can only get a generic height subspace of a uniform tensor space: this tensor space is not uniform.\n")return PetscError(((MPI_Comm)0x44000001),491,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,75,PETSC_ERROR_INITIAL,"Can only get a generic height subspace of a uniform tensor space: this tensor space is not uniform.\n"
)
;
492 ierr = PetscSpaceGetNumComponents(sp, &Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),492,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
493 ierr = PetscSpaceGetNumVariables(sp, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),493,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
494 ierr = PetscSpaceGetDegree(sp, &order, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),494,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
495 if (height > dim || height < 0) {SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Asked for space at height %D for dimension %D space", height, dim)return PetscError(((MPI_Comm)0x44000001),495,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,63,PETSC_ERROR_INITIAL,"Asked for space at height %D for dimension %D space"
,height,dim)
;}
496 if (!tens->heightsubspaces) {ierr = PetscCalloc1(dim, &tens->heightsubspaces)PetscMallocA(1,PETSC_TRUE,496,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,(size_t)(dim)*sizeof(**(&tens->heightsubspaces)),(&
tens->heightsubspaces))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),496,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
497 if (height <= dim) {
498 if (!tens->heightsubspaces[height-1]) {
499 PetscSpace sub;
500 const char *name;
501
502 ierr = PetscSpaceTensorGetSubspace(sp, 0, &bsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),502,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
503 ierr = PetscSpaceCreate(PetscObjectComm((PetscObject) sp), &sub);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),503,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
504 ierr = PetscObjectGetName((PetscObject) sp, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),504,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
505 ierr = PetscObjectSetName((PetscObject) sub, name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),505,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
506 ierr = PetscSpaceSetType(sub, PETSCSPACETENSOR"tensor");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),506,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
507 ierr = PetscSpaceSetNumComponents(sub, Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),507,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
508 ierr = PetscSpaceSetDegree(sub, order, PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),508,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
509 ierr = PetscSpaceSetNumVariables(sub, dim-height);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),509,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
510 ierr = PetscSpaceTensorSetNumSubspaces(sub, dim-height);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),510,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
511 for (i = 0; i < dim - height; i++) {
512 ierr = PetscSpaceTensorSetSubspace(sub, i, bsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),512,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
513 }
514 ierr = PetscSpaceSetUp(sub);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),514,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
515 tens->heightsubspaces[height-1] = sub;
516 }
517 *subsp = tens->heightsubspaces[height-1];
518 } else {
519 *subsp = NULL((void*)0);
520 }
521 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)
;
522}
523
524static PetscErrorCode PetscSpaceTensorGetSubspace_Tensor(PetscSpace space, PetscInt s, PetscSpace *subspace)
525{
526 PetscSpace_Tensor *tens = (PetscSpace_Tensor *) space->data;
527 PetscInt Ns;
528
529 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 529; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
530 Ns = tens->numTensSpaces;
531 if (Ns < 0) SETERRQ(PetscObjectComm((PetscObject)space),PETSC_ERR_ARG_WRONGSTATE,"Must call PetscSpaceTensorSetNumSubspaces() first\n")return PetscError(PetscObjectComm((PetscObject)space),531,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,73,PETSC_ERROR_INITIAL,"Must call PetscSpaceTensorSetNumSubspaces() first\n"
)
;
532 if (s < 0 || s >= Ns) SETERRQ1(PetscObjectComm((PetscObject)space),PETSC_ERR_ARG_OUTOFRANGE,"Invalid subspace number %D\n",subspace)return PetscError(PetscObjectComm((PetscObject)space),532,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,63,PETSC_ERROR_INITIAL,"Invalid subspace number %D\n",subspace
)
;
533 *subspace = tens->tensspaces[s];
534 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)
;
535}
536
537static PetscErrorCode PetscSpaceInitialize_Tensor(PetscSpace sp)
538{
539 PetscErrorCode ierr;
540
541 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 541; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
542 sp->ops->setfromoptions = PetscSpaceSetFromOptions_Tensor;
543 sp->ops->setup = PetscSpaceSetUp_Tensor;
544 sp->ops->view = PetscSpaceView_Tensor;
545 sp->ops->destroy = PetscSpaceDestroy_Tensor;
546 sp->ops->getdimension = PetscSpaceGetDimension_Tensor;
547 sp->ops->evaluate = PetscSpaceEvaluate_Tensor;
548 sp->ops->getheightsubspace = PetscSpaceGetHeightSubspace_Tensor;
549 ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscSpaceTensorGetNumSubspaces_C", PetscSpaceTensorGetNumSubspaces_Tensor)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscSpaceTensorGetNumSubspaces_C"
,(PetscVoidFunction)(PetscSpaceTensorGetNumSubspaces_Tensor))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),549,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
550 ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscSpaceTensorSetNumSubspaces_C", PetscSpaceTensorSetNumSubspaces_Tensor)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscSpaceTensorSetNumSubspaces_C"
,(PetscVoidFunction)(PetscSpaceTensorSetNumSubspaces_Tensor))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),550,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
551 ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscSpaceTensorGetSubspace_C", PetscSpaceTensorGetSubspace_Tensor)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscSpaceTensorGetSubspace_C"
,(PetscVoidFunction)(PetscSpaceTensorGetSubspace_Tensor))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),551,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
552 ierr = PetscObjectComposeFunction((PetscObject) sp, "PetscSpaceTensorSetSubspace_C", PetscSpaceTensorSetSubspace_Tensor)PetscObjectComposeFunction_Private((PetscObject) sp,"PetscSpaceTensorSetSubspace_C"
,(PetscVoidFunction)(PetscSpaceTensorSetSubspace_Tensor))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),552,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
553 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
554}
555
556/*MC
557 PETSCSPACETENSOR = "tensor" - A PetscSpace object that encapsulates a tensor product space.
558 Subspaces are scalar spaces (num of componenents = 1), so the components
559 of a vector-valued tensor space are assumed to be identical.
560
561 Level: intermediate
562
563.seealso: PetscSpaceType, PetscSpaceCreate(), PetscSpaceSetType()
564M*/
565
566PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscSpaceCreate_Tensor(PetscSpace sp)
567{
568 PetscSpace_Tensor *tens;
569 PetscErrorCode ierr;
570
571 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
; petscstack->line[petscstack->currentsize] = 571; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
572 PetscValidHeaderSpecific(sp, PETSCSPACE_CLASSID, 1)do { if (!sp) return PetscError(((MPI_Comm)0x44000001),572,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(sp,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),572,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(sp))->classid != PETSCSPACE_CLASSID
) { if (((PetscObject)(sp))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),572,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),572,__func__
,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
573 ierr = PetscNewLog(sp,&tens)(PetscMallocA(1,PETSC_TRUE,573,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,(size_t)(1)*sizeof(**(((&tens)))),(((&tens)))) || PetscLogObjectMemory
((PetscObject)sp,sizeof(**(&tens))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),573,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
574 sp->data = tens;
575
576 tens->numTensSpaces = PETSC_DEFAULT-2;
577
578 ierr = PetscSpaceInitialize_Tensor(sp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),578,__func__,"/sandbox/petsc/petsc.master/src/dm/dt/space/impls/tensor/spacetensor.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
579 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)
;
580}
581