Skip to content

Commit

Permalink
Doxygen comments / set boundElectrons default to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Garten committed Feb 17, 2015
1 parent 8604145 commit f8f1dc3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ value_identifier(bool, radiationFlag, false);
*
* \todo connect default to proton number
*/
value_identifier(float_X,boundElectrons,float_X(2.0));
value_identifier(float_X,boundElectrons,float_X(0.0));

/** specialization global position inside a domain (relative to origin of the
* moving window) and is loaded after all other param files)
Expand Down
30 changes: 24 additions & 6 deletions src/picongpu/include/traits/attribute/GetCharge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,50 @@ namespace detail
*
* use attribute `boundElectrons` and the proton number from
* flag `atomicNumbers` to calculate the charge
*
* \tparam T_HasBoundElectrons boolean that describes if species allows multiple charge states
* due to bound electrons
*/
template<bool T_HasBoundElectrons>
struct LoadBoundElectrons
{

/** Functor implementation
*
* \tparam T_Particle particle type
* \param singlyChargedResult charge resulting from multiplying a single
* electron charge (positive OR negative) by the macro particle weighting
* \param particle particle reference
*/
template<typename T_Particle>
HDINLINE float_X operator()(const float_X partialResult, const T_Particle& particle)
HDINLINE float_X operator()(const float_X singlyChargedResult, const T_Particle& particle)
{
const float_X protonNumber = GetAtomicNumbers<T_Particle>::type::numberOfProtons;

return partialResult * (protonNumber - particle[boundElectrons_]);
return singlyChargedResult * (protonNumber - particle[boundElectrons_]);
}
};

/** Calculate the real charge of a particle
*
* This is the fallback implementation if no `boundElectrons` are available for a particle
*
* \tparam T_HasBoundElectrons boolean that describes if species allows multiple charge states
* due to bound electrons
*/
template<>
struct LoadBoundElectrons<false>
{

/** Functor implementation
*
* \tparam T_Particle particle type
* \param singlyChargedResult charge resulting from multiplying a single
* electron charge (positive OR negative) by the macro particle weighting
* \param particle particle reference
*/
template<typename T_Particle>
HDINLINE float_X operator()(const float_X partialResult, const T_Particle& particle)
HDINLINE float_X operator()(const float_X singlyChargedResult, const T_Particle& particle)
{
return partialResult;
return singlyChargedResult;
}
};
} // namespace detail
Expand Down
14 changes: 9 additions & 5 deletions src/picongpu/include/traits/attribute/GetChargeState.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2014 Rene Widera
* Copyright 2014-2015 Marco Garten, Rene Widera
*
* This file is part of PIConGPU.
*
Expand Down Expand Up @@ -41,7 +41,10 @@ namespace detail
template<bool T_HasBoundElectrons>
struct LoadChargeState
{

/** Functor implementation
*
* \return chargeState = number of electrons in neutral atom - number of currently bound electrons
*/
template<typename T_Particle>
HDINLINE float_X operator()(const T_Particle& particle)
{
Expand All @@ -52,7 +55,8 @@ struct LoadChargeState

/** Calculate charge state of an atom / ion
*
* This is the fallback implementation if no `boundElectrons` are available for a particle
* This is the fallback implementation to throw an error if no `boundElectrons`
* are available for a species.
*/
template<>
struct LoadChargeState<false>
Expand All @@ -61,15 +65,15 @@ struct LoadChargeState<false>
template<typename T_Particle>
HDINLINE void operator()(const T_Particle& particle)
{
PMACC_CASSERT_MSG(This_species_has_no_different_charge_states,1==2);
PMACC_CASSERT_MSG(This_species_has_only_one_charge_state,1==2);
}
};
} // namespace detail

/** get the charge state of a macro particle
*
* This function trait considers the `boundElectrons` attribute if it is set.
* Charge states do not add up and also the different particles in a macro particle
* Charge states do not add up and also the various particles in a macro particle
* do NOT have different charge states where one would average over them.
*
* @param particle a reference to a particle
Expand Down

0 comments on commit f8f1dc3

Please sign in to comment.