-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a macro particle counter to the `fieldTmp` per cell particle to grid operations. Assumes all (macro) particles are point like in space and can be used to validate particle memory structures.
- Loading branch information
Showing
7 changed files
with
141 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
src/picongpu/include/particles/particleToGrid/derivedAttributes/MacroCounter.def
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/** | ||
* Copyright 2017 Axel Huebl | ||
* | ||
* This file is part of PIConGPU. | ||
* | ||
* PIConGPU is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* PIConGPU is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with PIConGPU. | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "pmacc_types.hpp" | ||
#include <vector> | ||
|
||
|
||
namespace picongpu | ||
{ | ||
namespace particleToGrid | ||
{ | ||
namespace derivedAttributes | ||
{ | ||
struct MacroCounter | ||
{ | ||
|
||
HDINLINE float1_64 | ||
getUnit() const; | ||
|
||
HINLINE std::vector<float_64> | ||
getUnitDimension() const | ||
{ | ||
/* L, M, T, I, theta, N, J | ||
* | ||
* Counter is unitless | ||
*/ | ||
std::vector<float_64> unitDimension( 7, 0.0 ); | ||
|
||
return unitDimension; | ||
} | ||
|
||
HINLINE std::string | ||
getName() const | ||
{ | ||
return "macroParticleCounter"; | ||
} | ||
|
||
/** Calculate a new attribute per particle | ||
* | ||
* Returns a new (on-the-fly calculated) attribute of a particle | ||
* that can then be mapped to the cells the particle contributes to. | ||
* This method is called on a per-thread basis (each thread of a block | ||
* handles a particle of a frame). | ||
* | ||
* \tparam T_Particle particle in the frame | ||
* \param particle particle in the frame | ||
* | ||
* \return new attribute for the particle (type \see T_AttributeType) | ||
*/ | ||
template< class T_Particle > | ||
DINLINE float_X | ||
operator()( T_Particle& particle ) const; | ||
}; | ||
} /* namespace derivedAttributes */ | ||
} /* namespace particleToGrid */ | ||
} /* namespace picongpu */ |
50 changes: 50 additions & 0 deletions
50
src/picongpu/include/particles/particleToGrid/derivedAttributes/MacroCounter.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Copyright 2017 Axel Huebl | ||
* | ||
* This file is part of PIConGPU. | ||
* | ||
* PIConGPU is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* PIConGPU is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with PIConGPU. | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "particles/particleToGrid/derivedAttributes/MacroCounter.def" | ||
|
||
#include "simulation_defines.hpp" | ||
|
||
|
||
namespace picongpu | ||
{ | ||
namespace particleToGrid | ||
{ | ||
namespace derivedAttributes | ||
{ | ||
|
||
HDINLINE float1_64 | ||
MacroCounter::getUnit() const | ||
{ | ||
return 1.0; | ||
} | ||
|
||
template< class T_Particle > | ||
DINLINE float_X | ||
MacroCounter::operator()( T_Particle& particle ) const | ||
{ | ||
/* return attribute */ | ||
return 1.0; | ||
} | ||
} /* namespace derivedAttributes */ | ||
} /* namespace particleToGrid */ | ||
} /* namespace picongpu */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters