Skip to content

Commit 7d32702

Browse files
committed
move ParamsData out of Reactions classes
1 parent 6e8f368 commit 7d32702

File tree

6 files changed

+154
-213
lines changed

6 files changed

+154
-213
lines changed

src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ set( hpcReact_headers
55
reactions/EquilibriumReactions.hpp
66
reactions/KineticReactions.hpp
77
reactions/ReactionsBase.hpp
8+
reactions/ReactionsParameterData.hpp
9+
reactions/ReactionsParameterDataPredefined.hpp
810
)
911

1012
set( hpcReact_sources

src/reactions/KineticReactions.hpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,6 @@ class KineticReactions : public ReactionsBase< REAL_TYPE,
3434

3535
static constexpr RealType RConst = 0; //constants::gasConstant;
3636

37-
template< int NUM_PRIMARY_SPECIES,
38-
int NUM_SECONDARY_SPECIES,
39-
int NUM_KINETIC_REACTIONS >
40-
struct ParamsData : Base::template ParamsData< NUM_PRIMARY_SPECIES, NUM_SECONDARY_SPECIES >
41-
{
42-
using Base = typename Base::template ParamsData< NUM_PRIMARY_SPECIES, NUM_SECONDARY_SPECIES >;
43-
using Base::numPrimarySpecies;
44-
using Base::numSecondarySpecies;
45-
46-
static constexpr INT_TYPE numKineticReactions = NUM_KINETIC_REACTIONS;
47-
using PARENT_TYPE = KineticReactions;
48-
49-
using Base::m_ionSizePrimary;
50-
using Base::m_ionSizeSec;
51-
using Base::m_chargePrimary;
52-
using Base::m_chargeSec;
53-
using Base::m_DebyeHuckelA;
54-
using Base::m_DebyeHuckelB;
55-
using Base::m_WATEQBDot;
56-
using Base::m_stoichMatrix;
57-
58-
REAL_TYPE m_reactionRateConstant[NUM_KINETIC_REACTIONS];
59-
REAL_TYPE m_specificSurfaceArea;
60-
};
61-
6237
template< typename PARAMS_DATA >
6338
static HPCREACT_HOST_DEVICE inline void
6439
computeReactionRates( RealType const & temperature,

src/reactions/ReactionsBase.hpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -42,33 +42,6 @@ class ReactionsBase
4242
RealConstDataArrayView1d const & primarySpeciesConcentration,
4343
RealConstDataArrayView1d const & secondarySpeciesConcentration,
4444
REAL_TYPE & ionicStrength );
45-
46-
47-
template< int NUM_PRIMARY_SPECIES,
48-
int NUM_SECONDARY_SPECIES >
49-
struct ParamsData
50-
{
51-
using PARENT_TYPE = ReactionsBase;
52-
53-
static constexpr INT_TYPE numPrimarySpecies = NUM_PRIMARY_SPECIES;
54-
55-
static constexpr INT_TYPE numSecondarySpecies = NUM_SECONDARY_SPECIES;
56-
57-
REAL_TYPE m_ionSizePrimary[numPrimarySpecies];
58-
59-
REAL_TYPE m_ionSizeSec[numSecondarySpecies];
60-
61-
INT_TYPE m_chargePrimary[numPrimarySpecies];
62-
INT_TYPE m_chargeSec[numSecondarySpecies];
63-
64-
REAL_TYPE m_DebyeHuckelA;
65-
REAL_TYPE m_DebyeHuckelB;
66-
REAL_TYPE m_WATEQBDot;
67-
68-
REAL_TYPE m_stoichMatrix[numSecondarySpecies][numPrimarySpecies];
69-
70-
};
71-
7245
};
7346

7447
} // namespace hpcReact
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#pragma once
2+
3+
4+
namespace hpcReact
5+
{
6+
7+
template< typename REAL_TYPE,
8+
typename INT_TYPE,
9+
int NUM_PRIMARY_SPECIES,
10+
int NUM_SECONDARY_SPECIES >
11+
struct EquilibriumReactionsParameterData
12+
{
13+
using RealType = REAL_TYPE;
14+
using IntType = INT_TYPE;
15+
16+
static constexpr INT_TYPE numPrimarySpecies = NUM_PRIMARY_SPECIES;
17+
static constexpr INT_TYPE numSecondarySpecies = NUM_SECONDARY_SPECIES;
18+
19+
REAL_TYPE m_ionSizePrimary[numPrimarySpecies];
20+
21+
REAL_TYPE m_ionSizeSec[numSecondarySpecies];
22+
23+
INT_TYPE m_chargePrimary[numPrimarySpecies];
24+
INT_TYPE m_chargeSec[numSecondarySpecies];
25+
26+
REAL_TYPE m_DebyeHuckelA;
27+
REAL_TYPE m_DebyeHuckelB;
28+
REAL_TYPE m_WATEQBDot;
29+
30+
REAL_TYPE m_stoichMatrix[numSecondarySpecies][numPrimarySpecies];
31+
32+
};
33+
34+
template< typename REAL_TYPE,
35+
typename INT_TYPE,
36+
int NUM_PRIMARY_SPECIES,
37+
int NUM_SECONDARY_SPECIES,
38+
int NUM_KINETIC_REACTIONS >
39+
struct KineticReactionsParameterData : EquilibriumReactionsParameterData< REAL_TYPE, INT_TYPE, NUM_PRIMARY_SPECIES, NUM_SECONDARY_SPECIES >
40+
{
41+
using Base = EquilibriumReactionsParameterData<REAL_TYPE, INT_TYPE, NUM_PRIMARY_SPECIES, NUM_SECONDARY_SPECIES >;
42+
using Base::numPrimarySpecies;
43+
using Base::numSecondarySpecies;
44+
45+
static constexpr INT_TYPE numKineticReactions = NUM_KINETIC_REACTIONS;
46+
47+
using Base::m_ionSizePrimary;
48+
using Base::m_ionSizeSec;
49+
using Base::m_chargePrimary;
50+
using Base::m_chargeSec;
51+
using Base::m_DebyeHuckelA;
52+
using Base::m_DebyeHuckelB;
53+
using Base::m_WATEQBDot;
54+
using Base::m_stoichMatrix;
55+
56+
REAL_TYPE m_reactionRateConstant[NUM_KINETIC_REACTIONS];
57+
REAL_TYPE m_specificSurfaceArea;
58+
};
59+
60+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#pragma once
2+
3+
#include "ReactionsParameterData.hpp"
4+
5+
namespace hpcReact
6+
{
7+
8+
constexpr
9+
EquilibriumReactionsParameterData< double, int, 7, 11 > chemicalReactionsParams =
10+
{ { 9.00, 4.00, 6.00, 4.00, 3.00, 8.00, 4.00 },
11+
{ 3.50, 3.00, 4.50, 3.00, 4.00, 3.00, 3.00, 4.00, 3.00, 3.00, 4.00 },
12+
{ 1, -1, 2, -2, -1, 2, 1 },
13+
{ -1, 0, -2, 0, 1, 0, 0, 1, 0, 0, -1},
14+
0.5465,
15+
0.3346,
16+
0.0438,
17+
{ { -1, 0, 0, 0, 0, 0, 0 },
18+
{ 1, 1, 0, 0, 0, 0, 0 },
19+
{ -1, 1, 0, 0, 0, 0, 0 },
20+
{ 1, 1, 0, 0, 0, 0, 0 },
21+
{ 0, 1, 1, 0, 0, 0, 0 },
22+
{ -1, 1, 1, 0, 0, 0, 0 },
23+
{ 0, 0, 1, 1, 0, 0, 0 },
24+
{ 0, 0, 1, 1, 0, 0, 0 },
25+
{ 0, 0, 1, 0, 2, 0, 0 },
26+
{ 0, 0, 0, 1, 0, 1, 0 },
27+
{ 0, 0, 0, 1, 0, 0, 1 }
28+
}
29+
};
30+
31+
32+
} // namespace hpcReact

0 commit comments

Comments
 (0)