IAP GITLAB

Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • AirShowerPhysics/corsika
  • rulrich/corsika
  • AAAlvesJr/corsika
  • Andre/corsika
  • arrabito/corsika
  • Nikos/corsika
  • olheiser73/corsika
  • AirShowerPhysics/papers/corsika
  • pranav/corsika
9 results
Show changes
Showing
with 6 additions and 1652 deletions
/**
* (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu
*
* See file AUTHORS for a list of contributors.
*
* This software is distributed under the terms of the GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#ifndef _include_Stack_h__
#define _include_Stack_h__
#include <corsika/stack/StackIterator.h> // include here, to help application programmres
/**
All classes around management of particles on a stack.
*/
namespace corsika::stack {
template <typename>
class PI; // forward decl
/**
Interface definition of a Stack object. The Stack implements the
std-type begin/end function to allow integration in normal for
loops etc.
*/
template <typename StackData, template <typename> typename PI>
class Stack : public StackData {
public:
typedef Stack<StackData, PI> StackType;
typedef StackIteratorInterface<StackData, PI> StackIterator;
typedef const StackIterator ConstStackIterator;
typedef typename StackIterator::ParticleInterfaceType ParticleType;
friend class StackIteratorInterface<StackData, PI>;
public:
using StackData::GetCapacity;
using StackData::GetSize;
using StackData::Clear;
using StackData::Copy;
using StackData::DecrementSize;
using StackData::IncrementSize;
using StackData::Init;
public:
/// these are functions required by std containers and std loops
StackIterator begin() { return StackIterator(*this, 0); }
StackIterator end() { return StackIterator(*this, GetSize()); }
StackIterator last() { return StackIterator(*this, GetSize() - 1); }
/// these are functions required by std containers and std loops
ConstStackIterator cbegin() const { return ConstStackIterator(*this, 0); }
ConstStackIterator cend() const { return ConstStackIterator(*this, GetSize()); }
ConstStackIterator clast() const { return ConstStackIterator(*this, GetSize() - 1); }
/// increase stack size, create new particle at end of stack
StackIterator NewParticle() {
IncrementSize();
return StackIterator(*this, GetSize() - 1);
}
/// delete this particle
void Delete(StackIterator& p) {
if (GetSize() == 0) { /*error*/
}
if (p.GetIndex() < GetSize() - 1) Copy(GetSize() - 1, p.GetIndex());
DeleteLast();
// p.SetInvalid();
}
void Delete(ParticleType& p) { Delete(p.GetIterator()); }
/// delete last particle on stack by decrementing stack size
void DeleteLast() { DecrementSize(); }
/// check if there are no further particles on stack
bool IsEmpty() { return GetSize() == 0; }
StackIterator GetNextParticle() { return last(); }
protected:
StackData& GetStackData() { return static_cast<StackData&>(*this); }
const StackData& GetStackData() const { return static_cast<const StackData&>(*this); }
};
} // namespace corsika::stack
#endif
This diff is collapsed.
This diff is collapsed.
add_library (CORSIKAunits INTERFACE)
set (CORSIKAunits_NAMESPACE corsika/units)
set (
CORSIKAunits_HEADERS
PhysicalUnits.h
PhysicalConstants.h
)
CORSIKA_COPY_HEADERS_TO_NAMESPACE (CORSIKAunits ${CORSIKAunits_NAMESPACE} ${CORSIKAunits_HEADERS})
target_include_directories (CORSIKAunits
INTERFACE
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/ThirdParty>
$<INSTALL_INTERFACE:include>
)
install (FILES ${CORSIKAunits_HEADERS} DESTINATION include/${CORSIKAunits_NAMESPACE})
# code testing
add_executable (testUnits testUnits.cc)
target_link_libraries (testUnits CORSIKAunits CORSIKAthirdparty) # for catch2
add_test(NAME testUnits COMMAND testUnits)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.