Skip to content

Commit 3ddc42c

Browse files
committed
uncrustify
1 parent dc141c0 commit 3ddc42c

18 files changed

+223
-212
lines changed

src/common/macros.hpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,42 +39,42 @@
3939

4040
#if defined( __clang__ )
4141
#define HPCREACT_NO_MISSING_BRACES( ... ) \
42-
_Pragma("clang diagnostic push") \
43-
_Pragma("clang diagnostic ignored \"-Wmissing-braces\"") \
44-
__VA_ARGS__ \
45-
_Pragma("clang diagnostic pop")
42+
_Pragma("clang diagnostic push") \
43+
_Pragma("clang diagnostic ignored \"-Wmissing-braces\"") \
44+
__VA_ARGS__ \
45+
_Pragma("clang diagnostic pop")
4646

4747
#define HPCREACT_NO_MISSING_BRACES_OPEN \
48-
_Pragma("clang diagnostic push") \
49-
_Pragma("clang diagnostic ignored \"-Wmissing-braces\"")
48+
_Pragma("clang diagnostic push") \
49+
_Pragma("clang diagnostic ignored \"-Wmissing-braces\"")
5050
#define HPCREACT_NO_MISSING_BRACES_CLOSE \
51-
_Pragma("clang diagnostic pop")
51+
_Pragma("clang diagnostic pop")
5252

5353
#elif defined(__GNUC__)
5454
#define HPCREACT_NO_MISSING_BRACES( ... ) \
55-
_Pragma("GCC diagnostic push") \
56-
_Pragma("GCC diagnostic ignored \"-Wmissing-braces\"") \
57-
__VA_ARGS__ \
58-
_Pragma("GCC diagnostic pop")
55+
_Pragma("GCC diagnostic push") \
56+
_Pragma("GCC diagnostic ignored \"-Wmissing-braces\"") \
57+
__VA_ARGS__ \
58+
_Pragma("GCC diagnostic pop")
5959

6060
#define HPCREACT_NO_MISSING_BRACES_OPEN \
61-
_Pragma("GCC diagnostic push") \
62-
_Pragma("GCC diagnostic ignored \"-Wmissing-braces\"")
61+
_Pragma("GCC diagnostic push") \
62+
_Pragma("GCC diagnostic ignored \"-Wmissing-braces\"")
6363
#define HPCREACT_NO_MISSING_BRACES_CLOSE \
64-
_Pragma("GCC diagnostic pop")
64+
_Pragma("GCC diagnostic pop")
6565

6666
#elif defined(_MSC_VER)
6767
#define HPCREACT_NO_MISSING_BRACES( ... ) \
68-
__pragma(warning(push)) \
69-
__pragma(warning(disable : 4351)) \
70-
__VA_ARGS__ \
71-
__pragma(warning(pop))
68+
__pragma(warning(push)) \
69+
__pragma(warning(disable : 4351)) \
70+
__VA_ARGS__ \
71+
__pragma(warning(pop))
7272

7373
#define HPCREACT_NO_MISSING_BRACES_OPEN \
74-
__pragma(warning(push)) \
75-
__pragma(warning(disable : 4351))
74+
__pragma(warning(push)) \
75+
__pragma(warning(disable : 4351))
7676
#define HPCREACT_NO_MISSING_BRACES_CLOSE \
77-
__pragma(warning(pop))
77+
__pragma(warning(pop))
7878
#else
7979
#define HPCREACT_NO_MISSING_BRACES( ... ) __VA_ARGS__ // No-op for unknown compilers
8080
#define HPCREACT_NO_MISSING_BRACES_OPEN

src/common/pmpl.hpp

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ namespace hpcReact
2222
{
2323
#if defined(HPCREACT_USE_DEVICE)
2424
#if defined(HPCREACT_USE_CUDA)
25-
#define deviceMalloc( PTR, BYTES ) cudaMalloc( PTR, BYTES );
26-
#define deviceMallocManaged( PTR, BYTES ) cudaMallocManaged( PTR, BYTES );
27-
#define deviceDeviceSynchronize() cudaDeviceSynchronize();
28-
#define deviceMemCpy( DST, SRC, BYTES, KIND ) cudaMemcpy( DST, SRC, BYTES, KIND );
29-
#define deviceFree( PTR ) cudaFree( PTR );
25+
#define deviceMalloc( PTR, BYTES ) cudaMalloc( PTR, BYTES );
26+
#define deviceMallocManaged( PTR, BYTES ) cudaMallocManaged( PTR, BYTES );
27+
#define deviceDeviceSynchronize() cudaDeviceSynchronize();
28+
#define deviceMemCpy( DST, SRC, BYTES, KIND ) cudaMemcpy( DST, SRC, BYTES, KIND );
29+
#define deviceFree( PTR ) cudaFree( PTR );
3030
#elif defined(HPCREACT_USE_HIP)
31-
#define deviceMalloc( PTR, BYTES ) hipMalloc( PTR, BYTES );
32-
#define deviceMallocManaged( PTR, BYTES ) hipMallocManaged( PTR, BYTES );
33-
#define deviceDeviceSynchronize() hipDeviceSynchronize();
34-
#define deviceMemCpy( DST, SRC, BYTES, KIND ) hipMemcpy( DST, SRC, BYTES, KIND );
35-
#define deviceFree( PTR ) hipFree( PTR );
31+
#define deviceMalloc( PTR, BYTES ) hipMalloc( PTR, BYTES );
32+
#define deviceMallocManaged( PTR, BYTES ) hipMallocManaged( PTR, BYTES );
33+
#define deviceDeviceSynchronize() hipDeviceSynchronize();
34+
#define deviceMemCpy( DST, SRC, BYTES, KIND ) hipMemcpy( DST, SRC, BYTES, KIND );
35+
#define deviceFree( PTR ) hipFree( PTR );
3636
#endif
3737
#endif
3838

@@ -130,12 +130,18 @@ void genericKernelWrapper( int const N, DATA_TYPE * const hostData, LAMBDA && fu
130130
genericKernel <<< 1, 1 >>> ( std::forward< LAMBDA >( func ), deviceData );
131131

132132
cudaError_t e = cudaGetLastError();
133-
if (e != cudaSuccess) { fprintf(stderr, "launch error: %s\n", cudaGetErrorString(e)); abort(); }
133+
if( e != cudaSuccess )
134+
{
135+
fprintf( stderr, "launch error: %s\n", cudaGetErrorString( e )); abort();
136+
}
134137

135138
deviceDeviceSynchronize();
136139

137140
e = cudaGetLastError();
138-
if (e != cudaSuccess) { fprintf(stderr, "post-sync error: %s\n", cudaGetErrorString(e)); abort(); }
141+
if( e != cudaSuccess )
142+
{
143+
fprintf( stderr, "post-sync error: %s\n", cudaGetErrorString( e )); abort();
144+
}
139145

140146
deviceMemCpy( hostData, deviceData, N * sizeof(DATA_TYPE), cudaMemcpyDeviceToHost );
141147
deviceFree( deviceData );

src/reactions/exampleSystems/unitTests/testGenericChainReactions.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ TEST( testChainGenericKineticReactions, computeReactionRatesTest_chainReactionPa
4545
{ 0.0, 0.03, 0.0 },
4646
{ 0.0, 0.0, 0.02 } };
4747
computeReactionRatesTest< double >( serialAllKineticParams.kineticReactionsParameters(),
48-
initialSpeciesConcentration,
49-
surfaceArea, // No use. Just to pass something here
50-
expectedReactionRates,
51-
expectedReactionRatesDerivatives );
48+
initialSpeciesConcentration,
49+
surfaceArea, // No use. Just to pass something here
50+
expectedReactionRates,
51+
expectedReactionRatesDerivatives );
5252
}
5353

5454
int main( int argc, char * * argv )

src/reactions/exampleSystems/unitTests/testKineticReactions.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ TEST( testKineticReactions, computeReactionRatesTest_simpleKineticTestRateParams
3030
{ { 2.0, -0.5, 0.0, 0.0, 0.0 },
3131
{ 0.0, 0.0, 0.5, 0.25, 0.0 } };
3232
computeReactionRatesTest< double >( bulkGeneric::simpleKineticTestRateParams.kineticReactionsParameters(),
33-
initialSpeciesConcentration,
34-
surfaceArea, // No use. Just to pass something here
35-
expectedReactionRates,
36-
expectedReactionRatesDerivatives );
33+
initialSpeciesConcentration,
34+
surfaceArea, // No use. Just to pass something here
35+
expectedReactionRates,
36+
expectedReactionRatesDerivatives );
3737
}
3838

3939

@@ -49,9 +49,9 @@ TEST( testKineticReactions, computeSpeciesRatesTest_simpleKineticTestRateParams
4949

5050

5151
computeSpeciesRatesTest< double >( bulkGeneric::simpleKineticTestRateParams.kineticReactionsParameters(),
52-
initialSpeciesConcentration,
53-
expectedSpeciesRates,
54-
expectedSpeciesRatesDerivatives );
52+
initialSpeciesConcentration,
53+
expectedSpeciesRates,
54+
expectedSpeciesRatesDerivatives );
5555

5656
}
5757

@@ -62,10 +62,10 @@ TEST( testKineticReactions, testTimeStep )
6262
double const expectedSpeciesConcentrations[5] = { 3.92138293924124e-01, 3.03930853037938e-01, 5.05945480771998e-01, 7.02014627734060e-01, 5.95970744531880e-01 };
6363

6464
timeStepTest< double >( bulkGeneric::simpleKineticTestRateParams.kineticReactionsParameters(),
65-
2.0,
66-
10,
67-
initialSpeciesConcentration,
68-
expectedSpeciesConcentrations );
65+
2.0,
66+
10,
67+
initialSpeciesConcentration,
68+
expectedSpeciesConcentrations );
6969

7070
}
7171

src/reactions/exampleSystems/unitTests/testMomasEasyCase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void testMoMasAllEquilibriumHelper()
6565
targetAggregatePrimarySpeciesConcentration,
6666
logInitialPrimarySpeciesConcentration,
6767
logPrimarySpeciesConcentrationCopy );
68-
});
68+
} );
6969

7070
double const expectedPrimarySpeciesConcentrations[numPrimarySpecies] =
7171
{

src/reactions/exampleSystems/unitTests/testMomasMediumCase.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ void testMoMasMediumEquilibriumHelper()
6060
logmath::log( initialPrimarySpeciesConcentration[3] ),
6161
logmath::log( initialPrimarySpeciesConcentration[4] )
6262
};
63-
63+
6464
EquilibriumReactionsType::enforceEquilibrium_Aggregate( 0,
6565
hpcReact::MoMasBenchmark::mediumCaseParams.equilibriumReactionsParameters(),
6666
targetAggregatePrimarySpeciesConcentration,
6767
logInitialPrimarySpeciesConcentration,
6868
logPrimarySpeciesConcentrationCopy );
69-
});
69+
} );
7070

7171
double const expectedPrimarySpeciesConcentrations[numPrimarySpecies] =
7272
{

src/reactions/geochemistry/unitTests/testGeochemicalKineticReactions.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ TEST( testKineticReactions, computeReactionRatesTest_carbonateSystemAllKinetic )
8282
};
8383

8484
computeReactionRatesTest< double >( carbonateSystemAllKinetic.kineticReactionsParameters(),
85-
initialSpeciesConcentration,
86-
surfaceArea, // No use. Just to pass something here
87-
expectedReactionRates,
88-
expectedReactionRatesDerivatives );
85+
initialSpeciesConcentration,
86+
surfaceArea, // No use. Just to pass something here
87+
expectedReactionRates,
88+
expectedReactionRatesDerivatives );
8989
}
9090

9191
TEST( testKineticReactions, computeReactionRatesQuotientTest_carbonateSystem )
@@ -120,10 +120,10 @@ TEST( testKineticReactions, computeReactionRatesQuotientTest_carbonateSystem )
120120
};
121121

122122
computeReactionRatesTest< double >( carbonateSystem.kineticReactionsParameters(),
123-
initialSpeciesConcentration,
124-
surfaceArea,
125-
expectedReactionRates,
126-
expectedReactionRatesDerivatives );
123+
initialSpeciesConcentration,
124+
surfaceArea,
125+
expectedReactionRates,
126+
expectedReactionRatesDerivatives );
127127
}
128128

129129
//******************************************************************************

src/reactions/geochemistry/unitTests/testGeochemicalMixedReactions.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ TEST( testMixedReactions, testTimeStep_carbonateSystem )
5151
};
5252

5353
timeStepTest< double >( carbonateSystem,
54-
1.0,
55-
10,
56-
initialAggregateSpeciesConcentration,
57-
surfaceArea,
58-
expectedSpeciesConcentrations );
54+
1.0,
55+
10,
56+
initialAggregateSpeciesConcentration,
57+
surfaceArea,
58+
expectedSpeciesConcentrations );
5959

6060
}
6161

src/reactions/massActions/MassActions.hpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void calculateLogSecondarySpeciesConcentration( PARAMS_DATA const & params,
7373
ARRAY_1D_TO_CONST const & logPrimarySpeciesConcentrations,
7474
ARRAY_1D & logSecondarySpeciesConcentrations )
7575
{
76-
if constexpr( PARAMS_DATA::numSecondarySpecies() <= 0 )
76+
if constexpr ( PARAMS_DATA::numSecondarySpecies() <= 0 )
7777
{
7878
return;
7979
}
@@ -83,7 +83,7 @@ void calculateLogSecondarySpeciesConcentration( PARAMS_DATA const & params,
8383
INDEX_TYPE >( params,
8484
logPrimarySpeciesConcentrations,
8585
logSecondarySpeciesConcentrations,
86-
[](INDEX_TYPE, INDEX_TYPE, REAL_TYPE ){} );
86+
[]( INDEX_TYPE, INDEX_TYPE, REAL_TYPE ){} );
8787
}
8888

8989

@@ -147,14 +147,16 @@ void calculateAggregatePrimaryConcentrationsWrtLogC( PARAMS_DATA const & params,
147147
{
148148
REAL_TYPE const speciesConcentration_i = logmath::exp( logPrimarySpeciesConcentrations[i] );
149149
aggregatePrimarySpeciesConcentrations[i] = speciesConcentration_i;
150-
dAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations( i, i ) = logmath::dWrtLogConst<REAL_TYPE>() * speciesConcentration_i;
150+
dAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations( i, i ) = logmath::dWrtLogConst< REAL_TYPE >() * speciesConcentration_i;
151151
for( int j = 0; j < numSecondarySpecies; ++j )
152152
{
153153
REAL_TYPE const secondarySpeciesConcentrations_j = logmath::exp( logSecondarySpeciesConcentrations[j] );
154154
aggregatePrimarySpeciesConcentrations[i] += params.stoichiometricMatrix( j, i+numSecondarySpecies ) * secondarySpeciesConcentrations_j;
155155
for( int k=0; k<numPrimarySpecies; ++k )
156156
{
157-
REAL_TYPE const dSecondarySpeciesConcentrations_dLogPrimarySpeciesConcentration = logmath::dWrtLogConst<REAL_TYPE>() * params.stoichiometricMatrix( j, k+numSecondarySpecies ) * secondarySpeciesConcentrations_j;
157+
REAL_TYPE const dSecondarySpeciesConcentrations_dLogPrimarySpeciesConcentration = logmath::dWrtLogConst< REAL_TYPE >() *
158+
params.stoichiometricMatrix( j, k+numSecondarySpecies ) *
159+
secondarySpeciesConcentrations_j;
158160
dAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations( i, k ) += params.stoichiometricMatrix( j, i+numSecondarySpecies ) *
159161
dSecondarySpeciesConcentrations_dLogPrimarySpeciesConcentration;
160162
}
@@ -178,7 +180,7 @@ void calculateAggregatePrimaryConcentrationsWrtLogC( PARAMS_DATA const & params,
178180
{
179181
static constexpr int numSecondarySpecies = PARAMS_DATA::numSecondarySpecies();
180182

181-
if constexpr( numSecondarySpecies > 0 )
183+
if constexpr ( numSecondarySpecies > 0 )
182184
{
183185
REAL_TYPE logSecondarySpeciesConcentrations[numSecondarySpecies] = {0};
184186

@@ -237,8 +239,10 @@ void calculateTotalAndMobileAggregatePrimaryConcentrationsWrtLogC( PARAMS_DATA c
237239
REAL_TYPE const speciesConcentration_i = logmath::exp( logPrimarySpeciesConcentrations[i] );
238240
aggregatePrimarySpeciesConcentrations[i] = speciesConcentration_i;
239241
mobileAggregatePrimarySpeciesConcentrations[i] = speciesConcentration_i;
240-
dAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations( i, i ) = logmath::dWrtLogConst<REAL_TYPE>() * speciesConcentration_i;
241-
dMobileAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations( i, i ) = logmath::dWrtLogConst<REAL_TYPE>() * speciesConcentration_i;
242+
dAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations( i, i ) = logmath::dWrtLogConst< REAL_TYPE >() *
243+
speciesConcentration_i;
244+
dMobileAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations( i, i ) = logmath::dWrtLogConst< REAL_TYPE >() *
245+
speciesConcentration_i;
242246

243247
for( int j = 0; j < numSecondarySpecies; ++j )
244248
{
@@ -247,7 +251,9 @@ void calculateTotalAndMobileAggregatePrimaryConcentrationsWrtLogC( PARAMS_DATA c
247251
mobileAggregatePrimarySpeciesConcentrations[i] += params.stoichiometricMatrix( j, i+numSecondarySpecies ) * secondarySpeciesConcentrations_j * params.mobileSecondarySpeciesFlag( j );
248252
for( int k=0; k<numPrimarySpecies; ++k )
249253
{
250-
REAL_TYPE const dSecondarySpeciesConcentrations_dLogPrimarySpeciesConcentration = logmath::dWrtLogConst<REAL_TYPE>() * params.stoichiometricMatrix( j, k+numSecondarySpecies ) * secondarySpeciesConcentrations_j;
254+
REAL_TYPE const dSecondarySpeciesConcentrations_dLogPrimarySpeciesConcentration = logmath::dWrtLogConst< REAL_TYPE >() *
255+
params.stoichiometricMatrix( j, k+numSecondarySpecies ) *
256+
secondarySpeciesConcentrations_j;
251257
dAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations( i, k ) += params.stoichiometricMatrix( j, i+numSecondarySpecies ) *
252258
dSecondarySpeciesConcentrations_dLogPrimarySpeciesConcentration;
253259

0 commit comments

Comments
 (0)