Skip to content

Commit a7b7801

Browse files
committed
make format and rebased
1 parent 5a308c5 commit a7b7801

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+2836
-3347
lines changed

examples/Hdiv-mass/basis/Hdiv-hex.h

Lines changed: 120 additions & 126 deletions
Large diffs are not rendered by default.

examples/Hdiv-mass/basis/Hdiv-quad.h

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -27,37 +27,34 @@
2727
// To see how the nodal basis is constructed visit:
2828
// https://github.com/rezgarshakeri/H-div-Tests
2929
int NodalHdivBasisQuad(CeedScalar *x, CeedScalar *Bx, CeedScalar *By) {
30-
31-
Bx[0] = 0.125*x[0]*x[0] - 0.125 ;
32-
By[0] = -0.25*x[0]*x[1] + 0.25*x[0] + 0.25*x[1] - 0.25 ;
33-
Bx[1] = 0.125 - 0.125*x[0]*x[0] ;
34-
By[1] = 0.25*x[0]*x[1] - 0.25*x[0] + 0.25*x[1] - 0.25 ;
35-
Bx[2] = -0.25*x[0]*x[1] + 0.25*x[0] - 0.25*x[1] + 0.25 ;
36-
By[2] = 0.125*x[1]*x[1] - 0.125 ;
37-
Bx[3] = 0.25*x[0]*x[1] + 0.25*x[0] + 0.25*x[1] + 0.25 ;
38-
By[3] = 0.125 - 0.125*x[1]*x[1] ;
39-
Bx[4] = 0.125*x[0]*x[0] - 0.125 ;
40-
By[4] = -0.25*x[0]*x[1] - 0.25*x[0] + 0.25*x[1] + 0.25 ;
41-
Bx[5] = 0.125 - 0.125*x[0]*x[0] ;
42-
By[5] = 0.25*x[0]*x[1] + 0.25*x[0] + 0.25*x[1] + 0.25 ;
43-
Bx[6] = -0.25*x[0]*x[1] + 0.25*x[0] + 0.25*x[1] - 0.25 ;
44-
By[6] = 0.125*x[1]*x[1] - 0.125 ;
45-
Bx[7] = 0.25*x[0]*x[1] + 0.25*x[0] - 0.25*x[1] - 0.25 ;
46-
By[7] = 0.125 - 0.125*x[1]*x[1] ;
30+
Bx[0] = 0.125 * x[0] * x[0] - 0.125;
31+
By[0] = -0.25 * x[0] * x[1] + 0.25 * x[0] + 0.25 * x[1] - 0.25;
32+
Bx[1] = 0.125 - 0.125 * x[0] * x[0];
33+
By[1] = 0.25 * x[0] * x[1] - 0.25 * x[0] + 0.25 * x[1] - 0.25;
34+
Bx[2] = -0.25 * x[0] * x[1] + 0.25 * x[0] - 0.25 * x[1] + 0.25;
35+
By[2] = 0.125 * x[1] * x[1] - 0.125;
36+
Bx[3] = 0.25 * x[0] * x[1] + 0.25 * x[0] + 0.25 * x[1] + 0.25;
37+
By[3] = 0.125 - 0.125 * x[1] * x[1];
38+
Bx[4] = 0.125 * x[0] * x[0] - 0.125;
39+
By[4] = -0.25 * x[0] * x[1] - 0.25 * x[0] + 0.25 * x[1] + 0.25;
40+
Bx[5] = 0.125 - 0.125 * x[0] * x[0];
41+
By[5] = 0.25 * x[0] * x[1] + 0.25 * x[0] + 0.25 * x[1] + 0.25;
42+
Bx[6] = -0.25 * x[0] * x[1] + 0.25 * x[0] + 0.25 * x[1] - 0.25;
43+
By[6] = 0.125 * x[1] * x[1] - 0.125;
44+
Bx[7] = 0.25 * x[0] * x[1] + 0.25 * x[0] - 0.25 * x[1] - 0.25;
45+
By[7] = 0.125 - 0.125 * x[1] * x[1];
4746
return 0;
4847
}
49-
static void HdivBasisQuad(CeedInt Q, CeedScalar *q_ref, CeedScalar *q_weights,
50-
CeedScalar *interp, CeedScalar *div, CeedQuadMode quad_mode) {
51-
48+
static void HdivBasisQuad(CeedInt Q, CeedScalar *q_ref, CeedScalar *q_weights, CeedScalar *interp, CeedScalar *div, CeedQuadMode quad_mode) {
5249
// Get 1D quadrature on [-1,1]
5350
CeedScalar q_ref_1d[Q], q_weight_1d[Q];
5451
switch (quad_mode) {
55-
case CEED_GAUSS:
56-
CeedGaussQuadrature(Q, q_ref_1d, q_weight_1d);
57-
break;
58-
case CEED_GAUSS_LOBATTO:
59-
CeedLobattoQuadrature(Q, q_ref_1d, q_weight_1d);
60-
break;
52+
case CEED_GAUSS:
53+
CeedGaussQuadrature(Q, q_ref_1d, q_weight_1d);
54+
break;
55+
case CEED_GAUSS_LOBATTO:
56+
CeedLobattoQuadrature(Q, q_ref_1d, q_weight_1d);
57+
break;
6158
}
6259

6360
// Divergence operator; Divergence of nodal basis for ref element
@@ -66,22 +63,20 @@ static void HdivBasisQuad(CeedInt Q, CeedScalar *q_ref, CeedScalar *q_weights,
6663
CeedScalar Bx[8], By[8];
6764
CeedScalar x[2];
6865

69-
for (CeedInt i=0; i<Q; i++) {
70-
for (CeedInt j=0; j<Q; j++) {
71-
CeedInt k1 = Q*i+j;
72-
q_ref[k1] = q_ref_1d[j];
73-
q_ref[k1 + Q*Q] = q_ref_1d[i];
74-
q_weights[k1] = q_weight_1d[j]*q_weight_1d[i];
75-
x[0] = q_ref_1d[j];
76-
x[1] = q_ref_1d[i];
66+
for (CeedInt i = 0; i < Q; i++) {
67+
for (CeedInt j = 0; j < Q; j++) {
68+
CeedInt k1 = Q * i + j;
69+
q_ref[k1] = q_ref_1d[j];
70+
q_ref[k1 + Q * Q] = q_ref_1d[i];
71+
q_weights[k1] = q_weight_1d[j] * q_weight_1d[i];
72+
x[0] = q_ref_1d[j];
73+
x[1] = q_ref_1d[i];
7774
NodalHdivBasisQuad(x, Bx, By);
78-
for (CeedInt k=0; k<8; k++) {
79-
interp[k1*8+k] = Bx[k];
80-
interp[k1*8+k+8*Q*Q] = By[k];
81-
div[k1*8+k] = D;
75+
for (CeedInt k = 0; k < 8; k++) {
76+
interp[k1 * 8 + k] = Bx[k];
77+
interp[k1 * 8 + k + 8 * Q * Q] = By[k];
78+
div[k1 * 8 + k] = D;
8279
}
8380
}
8481
}
8582
}
86-
87-

examples/Hdiv-mass/include/cl-options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ PetscErrorCode RegisterProblems_Hdiv(AppCtx app_ctx);
99
// Process general command line options
1010
PetscErrorCode ProcessCommandLineOptions(MPI_Comm comm, AppCtx app_ctx);
1111

12-
#endif // cloptions_h
12+
#endif // cloptions_h

examples/Hdiv-mass/include/matops.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
PetscErrorCode ApplyLocal_Ceed(User user, Vec X, Vec Y);
1010
PetscErrorCode MatMult_Ceed(Mat A, Vec X, Vec Y);
11-
PetscErrorCode ComputeError(User user, Vec X, CeedVector target,
12-
CeedScalar *l2_error);
11+
PetscErrorCode ComputeError(User user, Vec X, CeedVector target, CeedScalar *l2_error);
1312

14-
#endif // matops_h
13+
#endif // matops_h
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#ifndef petsc_macros
22
#define petsc_macros
33

4-
#if PETSC_VERSION_LT(3,14,0)
5-
# define DMPlexGetClosureIndices(a,b,c,d,e,f,g,h,i) DMPlexGetClosureIndices(a,b,c,d,f,g,i)
6-
# define DMPlexRestoreClosureIndices(a,b,c,d,e,f,g,h,i) DMPlexRestoreClosureIndices(a,b,c,d,f,g,i)
4+
#if PETSC_VERSION_LT(3, 14, 0)
5+
#define DMPlexGetClosureIndices(a, b, c, d, e, f, g, h, i) DMPlexGetClosureIndices(a, b, c, d, f, g, i)
6+
#define DMPlexRestoreClosureIndices(a, b, c, d, e, f, g, h, i) DMPlexRestoreClosureIndices(a, b, c, d, f, g, i)
77
#endif
88

9-
#if PETSC_VERSION_LT(3,14,0)
10-
# define DMAddBoundary(a,b,c,d,e,f,g,h,i,j,k,l,m,n) DMAddBoundary(a,b,c,e,h,i,j,k,f,g,m)
11-
#elif PETSC_VERSION_LT(3,16,0)
12-
# define DMAddBoundary(a,b,c,d,e,f,g,h,i,j,k,l,m,n) DMAddBoundary(a,b,c,e,h,i,j,k,l,f,g,m)
9+
#if PETSC_VERSION_LT(3, 14, 0)
10+
#define DMAddBoundary(a, b, c, d, e, f, g, h, i, j, k, l, m, n) DMAddBoundary(a, b, c, e, h, i, j, k, f, g, m)
11+
#elif PETSC_VERSION_LT(3, 16, 0)
12+
#define DMAddBoundary(a, b, c, d, e, f, g, h, i, j, k, l, m, n) DMAddBoundary(a, b, c, e, h, i, j, k, l, f, g, m)
1313
#else
14-
# define DMAddBoundary(a,b,c,d,e,f,g,h,i,j,k,l,m,n) DMAddBoundary(a,b,c,d,f,g,h,i,j,k,l,m,n)
14+
#define DMAddBoundary(a, b, c, d, e, f, g, h, i, j, k, l, m, n) DMAddBoundary(a, b, c, d, f, g, h, i, j, k, l, m, n)
1515
#endif
1616

1717
#endif

examples/Hdiv-mass/include/problems.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ PetscErrorCode Hdiv_POISSON_MASS3D(ProblemData *problem_data, void *ctx);
1616

1717
// 4) richard
1818

19-
#endif // problems_h
19+
#endif // problems_h

examples/Hdiv-mass/include/setup-dm.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#ifndef setupdm_h
22
#define setupdm_h
33

4+
#include <ceed.h>
45
#include <petsc.h>
56
#include <petscdmplex.h>
67
#include <petscsys.h>
7-
#include <ceed.h>
8+
89
#include "../include/structs.h"
910

1011
// ---------------------------------------------------------------------------
1112
// Set-up DM
1213
// ---------------------------------------------------------------------------
13-
PetscErrorCode CreateDistributedDM(MPI_Comm comm, ProblemData *problem_data,
14-
DM *dm);
14+
PetscErrorCode CreateDistributedDM(MPI_Comm comm, ProblemData *problem_data, DM *dm);
1515

16-
#endif // setupdm_h
16+
#endif // setupdm_h

examples/Hdiv-mass/include/setup-libceed.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,10 @@ PetscErrorCode CeedDataDestroy(CeedData ceed_data);
1010
// Utility function - essential BC dofs are encoded in closure indices as -(i+1)
1111
PetscInt Involute(PetscInt i);
1212
// Utility function to create local CEED restriction from DMPlex
13-
PetscErrorCode CreateRestrictionFromPlex(Ceed ceed, DM dm,
14-
CeedInt height, DMLabel domain_label, CeedInt value,
15-
CeedElemRestriction *elem_restr);
13+
PetscErrorCode CreateRestrictionFromPlex(Ceed ceed, DM dm, CeedInt height, DMLabel domain_label, CeedInt value, CeedElemRestriction *elem_restr);
1614
// Utility function to create local CEED Oriented restriction from DMPlex
17-
PetscErrorCode CreateRestrictionFromPlexOriented(Ceed ceed, DM dm,
18-
CeedInt P, CeedElemRestriction *elem_restr_oriented);
15+
PetscErrorCode CreateRestrictionFromPlexOriented(Ceed ceed, DM dm, CeedInt P, CeedElemRestriction *elem_restr_oriented);
1916
// Set up libCEED for a given degree
20-
PetscErrorCode SetupLibceed(DM dm, Ceed ceed, AppCtx app_ctx,
21-
ProblemData *problem_data, PetscInt U_g_size,
22-
PetscInt U_loc_size, CeedData ceed_data,
17+
PetscErrorCode SetupLibceed(DM dm, Ceed ceed, AppCtx app_ctx, ProblemData *problem_data, PetscInt U_g_size, PetscInt U_loc_size, CeedData ceed_data,
2318
CeedVector rhs_ceed, CeedVector *target);
24-
#endif // setuplibceed_h
19+
#endif // setuplibceed_h

examples/Hdiv-mass/include/structs.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
typedef struct AppCtx_ *AppCtx;
99
struct AppCtx_ {
1010
// libCEED arguments
11-
PetscInt degree;
12-
PetscInt q_extra;
11+
PetscInt degree;
12+
PetscInt q_extra;
1313
// Problem type arguments
1414
PetscFunctionList problems;
1515
char problem_name[PETSC_MAX_PATH_LEN];
@@ -19,8 +19,7 @@ struct AppCtx_ {
1919
typedef struct CeedData_ *CeedData;
2020
struct CeedData_ {
2121
CeedBasis basis_x, basis_u;
22-
CeedElemRestriction elem_restr_x, elem_restr_u,
23-
elem_restr_u_i;
22+
CeedElemRestriction elem_restr_x, elem_restr_u, elem_restr_u_i;
2423
CeedQFunction qf_residual, qf_error;
2524
CeedOperator op_residual, op_error;
2625
CeedVector x_ceed, y_ceed;
@@ -52,8 +51,8 @@ struct PH3DContext_ {
5251
// Struct that contains all enums and structs used for the physics of all problems
5352
typedef struct Physics_ *Physics;
5453
struct Physics_ {
55-
PQ2DContext pq2d_ctx;
56-
PH3DContext ph3d_ctx;
54+
PQ2DContext pq2d_ctx;
55+
PH3DContext ph3d_ctx;
5756
};
5857

5958
// PETSc user data
@@ -72,11 +71,11 @@ struct User_ {
7271
// Problem specific data
7372
typedef struct {
7473
CeedQFunctionUser setup_rhs, residual, setup_error;
75-
const char *setup_rhs_loc, *residual_loc, *setup_error_loc;
74+
const char *setup_rhs_loc, *residual_loc, *setup_error_loc;
7675
CeedQuadMode quadrature_mode;
7776
CeedInt elem_node, dim;
78-
PetscErrorCode (*setup_ctx)(Ceed, CeedData, Physics);
77+
PetscErrorCode (*setup_ctx)(Ceed, CeedData, Physics);
7978

8079
} ProblemData;
8180

82-
#endif // structs_h
81+
#endif // structs_h

0 commit comments

Comments
 (0)