Skip to content

Commit 05215ed

Browse files
committed
Code cleanup to pass pfformat check
1 parent ec770f1 commit 05215ed

File tree

8 files changed

+199
-183
lines changed

8 files changed

+199
-183
lines changed

pfnuopc/include/pf_nuopc_macros.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
!-------------------------------------------------------------------------------
2-
! Define Defaults
3-
!-------------------------------------------------------------------------------
4-
#define CONTEXT line=__LINE__,file=__FILE__
5-
#define PASSTHRU msg=ESMF_LOGERR_PASSTHRU,CONTEXT
6-
#define ESMF_STDERRORCHECK(rc) ESMF_LogFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)
1+
!Define Defaults
2+
#define CONTEXT line = __LINE__, file = __FILE__
3+
#define PASSTHRU msg = ESMF_LOGERR_PASSTHRU, CONTEXT
4+
#define ESMF_STDERRORCHECK(rc) ESMF_LogFoundError(rcToCheck = rc, msg = ESMF_LOGERR_PASSTHRU, line = __LINE__, file = __FILE__)
75

8-
!-------------------------------------------------------------------------------
9-
! Define ESMF real kind to match Appplications single/double precision
10-
!-------------------------------------------------------------------------------
6+
!Define ESMF real kind to match Appplications single / double precision
117
#if defined(REAL4)
128
#define ESMF_KIND_FIELD ESMF_KIND_R4
139
#define ESMF_KIND_COORD ESMF_KIND_R4

pfsimulator/amps/cuda/amps_init.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ int amps_EmbeddedInit(void)
269269
int amps_EmbeddedInitFComm(MPI_Fint *f_handle)
270270
{
271271
MPI_Comm comm;
272+
272273
comm = MPI_Comm_f2c(*f_handle);
273274
return amps_EmbeddedInitComm(comm);
274275
}

pfsimulator/amps/mpi1/amps_init.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ int amps_EmbeddedInit(void)
265265
int amps_EmbeddedInitFComm(MPI_Fint *f_handle)
266266
{
267267
MPI_Comm comm;
268+
268269
comm = MPI_Comm_f2c(*f_handle);
269270
return amps_EmbeddedInitComm(comm);
270271
}

pfsimulator/amps/oas3/amps_init.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ int amps_EmbeddedInit(void)
278278
int amps_EmbeddedInitFComm(MPI_Fint *f_handle)
279279
{
280280
MPI_Comm comm;
281+
281282
comm = MPI_Comm_f2c(*f_handle);
282283
return amps_EmbeddedInitComm(comm);
283284
}
@@ -309,7 +310,8 @@ int amps_EmbeddedInitFComm(MPI_Fint *f_handle)
309310
int amps_EmbeddedInitComm(MPI_Comm comm)
310311
{
311312
int result;
312-
MPI_Comm_compare(oas3Comm, comm, &result );
313+
314+
MPI_Comm_compare(oas3Comm, comm, &result);
313315
if (result != MPI_CONGRUENT)
314316
{
315317
printf("AMPS Error: oas3Comm is not congruent with embedded usage\n");

pfsimulator/amps/smpi/amps_init.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ int amps_EmbeddedInit(void)
268268
int amps_EmbeddedInitFComm(MPI_Fint *f_handle)
269269
{
270270
MPI_Comm comm;
271+
271272
comm = MPI_Comm_f2c(*f_handle);
272273
return amps_EmbeddedInitComm(comm);
273274
}

pfsimulator/parflow_lib/cpl_parflow.c

Lines changed: 103 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ amps_ThreadLocalDcl(PFModule *, Solver_module);
4040
amps_ThreadLocalDcl(PFModule *, solver);
4141
amps_ThreadLocalDcl(Vector *, evap_trans);
4242

43-
void cplparflowinit_(int *fcom,
44-
char *input_file,
45-
int *numprocs,
46-
int *subgridcount,
47-
int *nz,
48-
int *ierror)
43+
void cplparflowinit_(int * fcom,
44+
char * input_file,
45+
int * numprocs,
46+
int * subgridcount,
47+
int * nz,
48+
int * ierror)
4949
{
5050
Grid *grid;
5151
char *seperators = " \n";
@@ -129,22 +129,21 @@ void cplparflowinit_(int *fcom,
129129
*ierror = 0;
130130
}
131131

132-
void cplparflowadvance_(double *current_time,
133-
double *dt,
134-
float *imp_flux,
135-
float *exp_pressure,
136-
float *exp_porosity,
137-
float *exp_saturation,
138-
float *exp_specific,
139-
float *exp_zmult,
140-
int *num_soil_layers,
141-
int *num_cpl_layers,
142-
int *ghost_size_i_lower,
143-
int *ghost_size_j_lower,
144-
int *ghost_size_i_upper,
145-
int *ghost_size_j_upper,
146-
int *ierror)
147-
132+
void cplparflowadvance_(double * current_time,
133+
double * dt,
134+
float * imp_flux,
135+
float * exp_pressure,
136+
float * exp_porosity,
137+
float * exp_saturation,
138+
float * exp_specific,
139+
float * exp_zmult,
140+
int * num_soil_layers,
141+
int * num_cpl_layers,
142+
int * ghost_size_i_lower,
143+
int * ghost_size_j_lower,
144+
int * ghost_size_i_upper,
145+
int * ghost_size_j_upper,
146+
int * ierror)
148147
{
149148
ProblemData *problem_data = GetProblemDataRichards(amps_ThreadLocal(solver));
150149
Vector *solver_mask = GetMaskRichards(amps_ThreadLocal(solver));
@@ -262,19 +261,18 @@ void cplparflowadvance_(double *current_time,
262261
*ierror = 0;
263262
}
264263

265-
void cplparflowexport_(float *exp_pressure,
266-
float *exp_porosity,
267-
float *exp_saturation,
268-
float *exp_specific,
269-
float *exp_zmult,
270-
int *num_soil_layers,
271-
int *num_cpl_layers,
272-
int *ghost_size_i_lower,
273-
int *ghost_size_j_lower,
274-
int *ghost_size_i_upper,
275-
int *ghost_size_j_upper,
276-
int *ierror)
277-
264+
void cplparflowexport_(float * exp_pressure,
265+
float * exp_porosity,
266+
float * exp_saturation,
267+
float * exp_specific,
268+
float * exp_zmult,
269+
int * num_soil_layers,
270+
int * num_cpl_layers,
271+
int * ghost_size_i_lower,
272+
int * ghost_size_j_lower,
273+
int * ghost_size_i_upper,
274+
int * ghost_size_j_upper,
275+
int * ierror)
278276
{
279277
ProblemData *problem_data = GetProblemDataRichards(amps_ThreadLocal(solver));
280278
Vector *solver_mask = GetMaskRichards(amps_ThreadLocal(solver));
@@ -348,18 +346,18 @@ void cplparflowexport_(float *exp_pressure,
348346
* k-index data for the top of the domain.
349347
*/
350348
void CPL2PF(
351-
float * imp_array, /* import array */
352-
int imp_nz, /* layers of import array, X, Y are
353-
* assumed to be the same as PF vector
354-
* subgrid */
355-
int cpy_layers, /* number of layers to copy */
356-
int ghost_size_i_lower, /* Number of ghost cells */
357-
int ghost_size_j_lower,
358-
int ghost_size_i_upper,
359-
int ghost_size_j_upper,
360-
Vector *pf_vector,
361-
Vector *top,
362-
Vector *mask)
349+
float * imp_array, /* import array */
350+
int imp_nz, /* layers of import array, X, Y are
351+
* assumed to be the same as PF vector
352+
* subgrid */
353+
int cpy_layers, /* number of layers to copy */
354+
int ghost_size_i_lower, /* Number of ghost cells */
355+
int ghost_size_j_lower,
356+
int ghost_size_i_upper,
357+
int ghost_size_j_upper,
358+
Vector * pf_vector,
359+
Vector * top,
360+
Vector * mask)
363361
{
364362
Grid *grid = VectorGrid(pf_vector);
365363
int sg;
@@ -419,17 +417,17 @@ void CPL2PF(
419417
* Copy data from a PF vector to an export array
420418
*/
421419
void PF2CPL(
422-
Vector *pf_vector,
423-
float * exp_array, /* export array */
424-
int exp_nz, /* layers of export array, X, Y are
425-
* assumed to be the same as PF vector
426-
* subgrid */
427-
int ghost_size_i_lower, /* Number of ghost cells */
428-
int ghost_size_j_lower,
429-
int ghost_size_i_upper,
430-
int ghost_size_j_upper,
431-
Vector *top,
432-
Vector *mask)
420+
Vector * pf_vector,
421+
float * exp_array, /* export array */
422+
int exp_nz, /* layers of export array, X, Y are
423+
* assumed to be the same as PF vector
424+
* subgrid */
425+
int ghost_size_i_lower, /* Number of ghost cells */
426+
int ghost_size_j_lower,
427+
int ghost_size_i_upper,
428+
int ghost_size_j_upper,
429+
Vector * top,
430+
Vector * mask)
433431
{
434432
Grid *grid = VectorGrid(pf_vector);
435433
int sg;
@@ -480,7 +478,9 @@ void PF2CPL(
480478
((j - iy + ghost_size_j_lower) * (exp_nx * exp_nz));
481479
exp_array[exp_index] = (float)(subvector_data[pf_index]);
482480
}
483-
}else{
481+
}
482+
else
483+
{
484484
// fill missing export
485485
for (k = 0; k < exp_nz; k++)
486486
{
@@ -500,23 +500,26 @@ void PF2CPL(
500500
* Local Decomposition
501501
*--------------------------------------------------------------------------*/
502502

503-
void cplparflowlcldecomp_(int *sg,
504-
int *lowerx,
505-
int *upperx,
506-
int *lowery,
507-
int *uppery,
508-
int *ierror)
503+
void cplparflowlcldecomp_(int * sg,
504+
int * lowerx,
505+
int * upperx,
506+
int * lowery,
507+
int * uppery,
508+
int * ierror)
509509
{
510510
Grid *grid = GetGrid2DRichards(amps_ThreadLocal(solver));
511511
int subgridcount = SubgridArraySize(GridSubgrids(grid));
512-
if (*sg < 0 || *sg > (subgridcount-1))
512+
513+
if (*sg < 0 || *sg > (subgridcount - 1))
513514
{
514515
*lowerx = 0;
515516
*upperx = 0;
516517
*lowery = 0;
517518
*uppery = 0;
518519
*ierror = 22;
519-
}else{
520+
}
521+
else
522+
{
520523
Subgrid *subgrid = GridSubgrid(grid, *sg);
521524
*lowerx = SubgridIX(subgrid);
522525
*upperx = *lowerx + SubgridNX(subgrid) - 1;
@@ -530,17 +533,20 @@ void cplparflowlcldecomp_(int *sg,
530533
* Local Watershed Mask
531534
*--------------------------------------------------------------------------*/
532535

533-
void cplparflowlclmask_(int *sg,
534-
int *localmask,
535-
int *ierror)
536+
void cplparflowlclmask_(int * sg,
537+
int * localmask,
538+
int * ierror)
536539
{
537540
Grid *grid = GetGrid2DRichards(amps_ThreadLocal(solver));
538541
int subgridcount = SubgridArraySize(GridSubgrids(grid));
539542
Vector *mask = GetMaskRichards(amps_ThreadLocal(solver));
540-
if (*sg < 0 || *sg > (subgridcount-1))
543+
544+
if (*sg < 0 || *sg > (subgridcount - 1))
541545
{
542546
*ierror = 22;
543-
}else{
547+
}
548+
else
549+
{
544550
Subgrid *subgrid = GridSubgrid(grid, *sg);
545551
int ix = SubgridIX(subgrid);
546552
int iy = SubgridIY(subgrid);
@@ -561,7 +567,9 @@ void cplparflowlclmask_(int *sg,
561567
if (mask_data[mask_index] > 0)
562568
{
563569
localmask[localmask_index] = 1;
564-
}else{
570+
}
571+
else
572+
{
565573
localmask[localmask_index] = 0;
566574
}
567575
}
@@ -574,20 +582,23 @@ void cplparflowlclmask_(int *sg,
574582
* Local Cartesian Coordinates Center
575583
*--------------------------------------------------------------------------*/
576584

577-
void cplparflowlclxyctr_(int *sg,
578-
float *localx,
579-
float *localy,
580-
int *ierror)
585+
void cplparflowlclxyctr_(int * sg,
586+
float * localx,
587+
float * localy,
588+
int * ierror)
581589
{
582590
Grid *grid = GetGrid2DRichards(amps_ThreadLocal(solver));
583591
int subgridcount = SubgridArraySize(GridSubgrids(grid));
584-
if (*sg < 0 || *sg > (subgridcount-1))
592+
593+
if (*sg < 0 || *sg > (subgridcount - 1))
585594
{
586595
*ierror = 22;
587-
}else{
596+
}
597+
else
598+
{
588599
Subgrid *subgrid = GridSubgrid(grid, *sg);
589-
int nx = SubgridNX(subgrid);
590-
int ny = SubgridNY(subgrid);
600+
int nx = SubgridNX(subgrid);
601+
int ny = SubgridNY(subgrid);
591602
float lx = SubgridX(subgrid);
592603
float ly = SubgridY(subgrid);
593604
float dx = SubgridDX(subgrid);
@@ -612,20 +623,23 @@ void cplparflowlclxyctr_(int *sg,
612623
* Local Cartesian Coordinates Edge
613624
*--------------------------------------------------------------------------*/
614625

615-
void cplparflowlclxyedg_(int *sg,
616-
float *localx,
617-
float *localy,
618-
int *ierror)
626+
void cplparflowlclxyedg_(int * sg,
627+
float * localx,
628+
float * localy,
629+
int * ierror)
619630
{
620631
Grid *grid = GetGrid2DRichards(amps_ThreadLocal(solver));
621632
int subgridcount = SubgridArraySize(GridSubgrids(grid));
622-
if (*sg < 0 || *sg > (subgridcount-1))
633+
634+
if (*sg < 0 || *sg > (subgridcount - 1))
623635
{
624636
*ierror = 22;
625-
}else{
637+
}
638+
else
639+
{
626640
Subgrid *subgrid = GridSubgrid(grid, *sg);
627-
int nx = SubgridNX(subgrid);
628-
int ny = SubgridNY(subgrid);
641+
int nx = SubgridNX(subgrid);
642+
int ny = SubgridNY(subgrid);
629643
float lx = SubgridX(subgrid);
630644
float ly = SubgridY(subgrid);
631645
float dx = SubgridDX(subgrid);

0 commit comments

Comments
 (0)