Skip to content

Commit

Permalink
Code contains an error related to the rate object in ReactingNetwork:…
Browse files Browse the repository at this point in the history
…:getTableOne function in ReactionNetwork.tpp (ORNL-Fusion#185)
  • Loading branch information
LP-Nick committed Jun 14, 2024
1 parent 07aab00 commit 3347069
Show file tree
Hide file tree
Showing 13 changed files with 307 additions and 184 deletions.
16 changes: 8 additions & 8 deletions xolotl/core/include/xolotl/core/network/ConstantReaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,32 +324,32 @@ class ConstantReaction : public Reaction<TNetwork, TDerived>

KOKKOS_INLINE_FUNCTION
double
computeTableOne(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex)
computeTableOne(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates,IndexType gridIndex)
{
return 0.0;
}

KOKKOS_INLINE_FUNCTION
double
computeTableTwo(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex)
computeTableTwo(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates,IndexType gridIndex)
{
return 0.0;
}

KOKKOS_INLINE_FUNCTION
double
computeTableThree(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex)
computeTableThree(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates, IndexType gridIndex)
{
return 0.0;
}

KOKKOS_INLINE_FUNCTION
double
computeTableFour(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex)
computeTableFour(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates, IndexType gridIndex)
{
return 0.0;
}
Expand Down
24 changes: 12 additions & 12 deletions xolotl/core/include/xolotl/core/network/IReactionNetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,15 +398,15 @@ class IReactionNetwork
/**
* @brief Compute a list of data values for each species in ID order
*/
virtual std::vector<double>
virtual std::vector<std::vector<double>>
getRxnDataValues(Kokkos::View<const double*> conc) = 0;

/**
* @brief Add data values to elements of given output vector
*/
virtual void
addRxnDataValues(Kokkos::View<const double*> conc,
std::vector<double>& totalVals) = 0;
std::vector<std::vector<double>>& totalVals) = 0;

/**
* @brief Get number of data values (excluding time)
Expand All @@ -424,7 +424,7 @@ class IReactionNetwork
* @brief Append line of data values to Rxn output file
*/
virtual void
writeRxnDataLine(const std::vector<double>& localData, double time) = 0;
writeRxnDataLine(const std::vector<std::vector<double>>& localData, double time) = 0;

/**
* @brief Computes the map between the different cluster bounds and moment
Expand Down Expand Up @@ -518,21 +518,21 @@ class IReactionNetwork
getLeftSideRate(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex) = 0;

virtual double
getTableOne(ConcentrationsView concentrations, IndexType clusterId,
virtual std::vector<std::vector<double>>
getTableOne(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
IndexType gridIndex) = 0;

virtual double
getTableTwo(ConcentrationsView concentrations, IndexType clusterId,
virtual std::vector<std::vector<double>>
getTableTwo(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
IndexType gridIndex) = 0;

virtual double
getTableThree(ConcentrationsView concentrations, IndexType clusterId,
virtual std::vector<std::vector<double>>
getTableThree(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
IndexType gridIndex) = 0;

virtual double
getTableFour(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex) = 0;
virtual std::vector<std::vector<double>>
getTableFour(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
IndexType gridIndex) = 0;

/**
* Get the diagonal fill for the Jacobian, corresponding to the reactions.
Expand Down
16 changes: 8 additions & 8 deletions xolotl/core/include/xolotl/core/network/NucleationReaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,32 +122,32 @@ class NucleationReaction : public Reaction<TNetwork, TDerived>

KOKKOS_INLINE_FUNCTION
double
computeTableOne(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex)
computeTableOne(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates,IndexType gridIndex)
{
return 0.0;
}

KOKKOS_INLINE_FUNCTION
double
computeTableTwo(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex)
computeTableTwo(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates,IndexType gridIndex)
{
return 0.0;
}

KOKKOS_INLINE_FUNCTION
double
computeTableThree(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex)
computeTableThree(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates, IndexType gridIndex)
{
return 0.0;
}

KOKKOS_INLINE_FUNCTION
double
computeTableFour(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex)
computeTableFour(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates, IndexType gridIndex)
{
return 0.0;
}
Expand Down
16 changes: 8 additions & 8 deletions xolotl/core/include/xolotl/core/network/ReSolutionReaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,32 +117,32 @@ class ReSolutionReaction : public Reaction<TNetwork, TDerived>

KOKKOS_INLINE_FUNCTION
double
computeTableOne(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex)
computeTableOne(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates,IndexType gridIndex)
{
return 0.0;
}

KOKKOS_INLINE_FUNCTION
double
computeTableTwo(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex)
computeTableTwo(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates,IndexType gridIndex)
{
return 0.0;
}

KOKKOS_INLINE_FUNCTION
double
computeTableThree(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex)
computeTableThree(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates, IndexType gridIndex)
{
return 0.0;
}

KOKKOS_INLINE_FUNCTION
double
computeTableFour(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex)
computeTableFour(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates, IndexType gridIndex)
{
return 0.0;
}
Expand Down
95 changes: 70 additions & 25 deletions xolotl/core/include/xolotl/core/network/Reaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <xolotl/core/network/detail/ReactionData.h>
#include <xolotl/util/Array.h>


namespace xolotl
{
namespace core
Expand Down Expand Up @@ -170,39 +171,57 @@ class Reaction
KOKKOS_INLINE_FUNCTION
double
contributeTableOne(ConcentrationsView concentrations,
IndexType clusterId, IndexType gridIndex)
std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates, IndexType gridIndex)
{
return asDerived()->computeTableOne(
concentrations, clusterId, gridIndex);
concentrations, clusterBins, rates, gridIndex);

}

KOKKOS_INLINE_FUNCTION
double
contributeTableTwo(ConcentrationsView concentrations,
IndexType clusterId, IndexType gridIndex)
std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates, IndexType gridIndex)
{
return asDerived()->computeTableTwo(
concentrations, clusterId, gridIndex);
concentrations, clusterBins, rates, gridIndex);
}

KOKKOS_INLINE_FUNCTION
double
contributeTableThree(ConcentrationsView concentrations,
IndexType clusterId, IndexType gridIndex)
std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates, IndexType gridIndex)
{
return asDerived()->computeTableThree(
concentrations, clusterId, gridIndex);
concentrations, clusterBins, rates, gridIndex);
}

KOKKOS_INLINE_FUNCTION
double
contributeTableFour(ConcentrationsView concentrations,
IndexType clusterId, IndexType gridIndex)
std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates, IndexType gridIndex)
{
return asDerived()->computeTableFour(
concentrations, clusterId, gridIndex);
concentrations, clusterBins, rates, gridIndex);
}


KOKKOS_INLINE_FUNCTION
int
whichBin(std::vector<std::vector<IndexType>> clusterBins,
IndexType clusterId)
{
for (auto i=0;i<clusterBins.size();i++){
for (auto j=0;j<clusterBins[i].size();j++){
if(clusterBins[i][j] == clusterId) return (i);
}
}
return 0;
}

KOKKOS_INLINE_FUNCTION
void
defineJacobianEntries(Connectivity connectivity)
Expand Down Expand Up @@ -422,23 +441,36 @@ class ProductionReaction : public Reaction<TNetwork, TDerived>

KOKKOS_INLINE_FUNCTION
double
computeTableOne(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex);
computeTableOne(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates, IndexType gridIndex);

KOKKOS_INLINE_FUNCTION
double
computeTableTwo(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex);
computeTableTwo(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates, IndexType gridIndex);

KOKKOS_INLINE_FUNCTION
double
computeTableThree(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex){return 0.0;}
computeTableThree(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates, IndexType gridIndex){return 0.0;}

KOKKOS_INLINE_FUNCTION
double
computeTableFour(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex){return 0.0;}
computeTableFour(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates, IndexType gridIndex){return 0.0;}

KOKKOS_INLINE_FUNCTION
int
whichBin(std::vector<std::vector<IndexType>> clusterBins,
IndexType clusterId)
{
for (auto i=0;i<clusterBins.size();i++){
for (auto j=0;j<clusterBins[i].size();j++){
if(clusterBins[i][j] == clusterId) return (i);
}
}
return 0;
}

KOKKOS_INLINE_FUNCTION
void
Expand Down Expand Up @@ -570,23 +602,36 @@ class DissociationReaction : public Reaction<TNetwork, TDerived>

KOKKOS_INLINE_FUNCTION
double
computeTableOne(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex){return 0.0;}
computeTableOne(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates, IndexType gridIndex){return 0.0;}

KOKKOS_INLINE_FUNCTION
double
computeTableTwo(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex){return 0.0;}
computeTableTwo(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates, IndexType gridIndex){return 0.0;}

KOKKOS_INLINE_FUNCTION
double
computeTableThree(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex);
computeTableThree(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates, IndexType gridIndex);

KOKKOS_INLINE_FUNCTION
double
computeTableFour(ConcentrationsView concentrations, IndexType clusterId,
IndexType gridIndex);
computeTableFour(ConcentrationsView concentrations, std::vector<std::vector<IndexType>> clusterBins,
std::vector<std::vector<double>>& rates, IndexType gridIndex);

KOKKOS_INLINE_FUNCTION
int
whichBin(std::vector<std::vector<IndexType>> clusterBins,
IndexType clusterId)
{
for (auto i=0;i<clusterBins.size();i++){
for (auto j=0;j<clusterBins[i].size();j++){
if(clusterBins[i][j] == clusterId) return (i);
}
}
return 0;
}

KOKKOS_INLINE_FUNCTION
void
Expand Down
Loading

0 comments on commit 3347069

Please sign in to comment.