Nektar++
Classes | Static Public Member Functions | List of all members
Nektar::MemoryManager< DataType > Class Template Reference

General purpose memory allocation routines with the ability to allocate from thread specific memory pools. More...

#include <NekMemoryManager.hpp>

Classes

struct  rebind
 

Static Public Member Functions

static void Deallocate (DataType *&data)
 Deallocate a pointer allocated by MemoryManager::Allocate. More...
 
template<typename... Args>
static DataType * Allocate (const Args &...args)
 Allocates a single object from the memory pool. More...
 
template<typename... Args>
static std::shared_ptr< DataType > AllocateSharedPtr (const Args &...args)
 Allocate a shared pointer from the memory pool. More...
 
template<typename DeallocatorType , typename... Args>
static std::shared_ptr< DataType > AllocateSharedPtrD (const DeallocatorType &d, const Args &...args)
 
static DataType * RawAllocate (size_t NumberOfElements)
 Allocates a chunk of raw, uninitialized memory, capable of holding NumberOfElements objects. More...
 
static void RawDeallocate (DataType *array, size_t NumberOfElements)
 Deallocates memory allocated from RawAllocate. More...
 

Allocator Interface

The allocator interface allows a MemoryManager object to be used in any object that allows an allocator parameter, such as STL containers.

typedef DataType value_type
 
typedef size_t size_type
 
typedef ptrdiff_t difference_type
 
typedef DataType * pointer
 
typedef const DataType * const_pointer
 
typedef DataType & reference
 
typedef const DataType & const_reference
 
 MemoryManager ()
 
template<typename T >
 MemoryManager (const MemoryManager< T > &rhs)
 
 ~MemoryManager ()
 
pointer address (reference r) const
 
const_pointer address (const_reference r) const
 
pointer allocate (size_type n, std::allocator< void >::const_pointer hint=0)
 
void deallocate (pointer p, size_type n)
 
void construct (pointer p, const_reference val)
 
void destroy (pointer p)
 
size_type max_size ()
 

Detailed Description

template<typename DataType>
class Nektar::MemoryManager< DataType >

General purpose memory allocation routines with the ability to allocate from thread specific memory pools.

If compiled with NEKTAR_MEMORY_POOL_ENABLED, the MemoryManager allocates from thread specific memory pools for small objects. Large objects are managed with the system supplied new/delete. These memory pools provide faster allocation and deallocation of small objects (particularly useful for shared pointers which allocate many 4 byte objects).

Warning
All memory allocated from the memory manager must be returned to the memory manager. Calling delete on memory allocated from the manager will likely cause undefined behavior. A particularly subtle violation of this rule occurs when giving memory allocated from the manager to a shared pointer.
std::shared_ptr<Obj> f(MemoryManager<Obj>::Allocate());
static DataType * Allocate(const Args &...args)
Allocates a single object from the memory pool.
Shared pointers call delete when they go out of scope, so this line of code will cause problems. Instead, you should call the AllocateSharedPtr method:
std::shared_ptr<Obj> f = MemoryManager<Obj>::AllocateSharedPtr();
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

Definition at line 83 of file NekMemoryManager.hpp.

Member Typedef Documentation

◆ const_pointer

template<typename DataType >
typedef const DataType* Nektar::MemoryManager< DataType >::const_pointer

Definition at line 245 of file NekMemoryManager.hpp.

◆ const_reference

template<typename DataType >
typedef const DataType& Nektar::MemoryManager< DataType >::const_reference

Definition at line 247 of file NekMemoryManager.hpp.

◆ difference_type

template<typename DataType >
typedef ptrdiff_t Nektar::MemoryManager< DataType >::difference_type

Definition at line 243 of file NekMemoryManager.hpp.

◆ pointer

template<typename DataType >
typedef DataType* Nektar::MemoryManager< DataType >::pointer

Definition at line 244 of file NekMemoryManager.hpp.

◆ reference

template<typename DataType >
typedef DataType& Nektar::MemoryManager< DataType >::reference

Definition at line 246 of file NekMemoryManager.hpp.

◆ size_type

template<typename DataType >
typedef size_t Nektar::MemoryManager< DataType >::size_type

Definition at line 242 of file NekMemoryManager.hpp.

◆ value_type

template<typename DataType >
typedef DataType Nektar::MemoryManager< DataType >::value_type

Definition at line 241 of file NekMemoryManager.hpp.

Constructor & Destructor Documentation

◆ MemoryManager() [1/2]

template<typename DataType >
Nektar::MemoryManager< DataType >::MemoryManager ( )
inline

Definition at line 249 of file NekMemoryManager.hpp.

249 {}

◆ MemoryManager() [2/2]

template<typename DataType >
template<typename T >
Nektar::MemoryManager< DataType >::MemoryManager ( const MemoryManager< T > &  rhs)
inline

Definition at line 251 of file NekMemoryManager.hpp.

252  {
253  boost::ignore_unused(rhs);
254  }

◆ ~MemoryManager()

template<typename DataType >
Nektar::MemoryManager< DataType >::~MemoryManager ( )
inline

Definition at line 255 of file NekMemoryManager.hpp.

255 {}

Member Function Documentation

◆ address() [1/2]

template<typename DataType >
const_pointer Nektar::MemoryManager< DataType >::address ( const_reference  r) const
inline

Definition at line 258 of file NekMemoryManager.hpp.

258 { return &r; }

◆ address() [2/2]

template<typename DataType >
pointer Nektar::MemoryManager< DataType >::address ( reference  r) const
inline

Definition at line 257 of file NekMemoryManager.hpp.

257 { return &r; }

◆ Allocate()

template<typename DataType >
template<typename... Args>
static DataType* Nektar::MemoryManager< DataType >::Allocate ( const Args &...  args)
inlinestatic

Allocates a single object from the memory pool.

Exceptions
unknownAny exception thrown by DataType's default constructor will propogate through this method.

The allocated object must be returned to the memory pool via Deallocate.

Definition at line 153 of file NekMemoryManager.hpp.

154  {
155  #ifdef NEKTAR_USE_ALIGNED_MEM
156  void *ptr = boost::alignment::aligned_alloc(tinysimd::simd<NekDouble>::alignment,
157  sizeof(DataType));
158  return new (ptr) DataType(args...);
159  #else
160  return new DataType(args...);
161  #endif
162  }
typename abi< ScalarType >::type simd
Definition: tinysimd.hpp:83

Referenced by Nektar::MemoryManager< DataType >::AllocateSharedPtrD().

◆ allocate()

template<typename DataType >
pointer Nektar::MemoryManager< DataType >::allocate ( size_type  n,
std::allocator< void >::const_pointer  hint = 0 
)
inline

Definition at line 260 of file NekMemoryManager.hpp.

261  {
262  boost::ignore_unused(hint);
263  return RawAllocate(n);
264  }
static DataType * RawAllocate(size_t NumberOfElements)
Allocates a chunk of raw, uninitialized memory, capable of holding NumberOfElements objects.

References Nektar::MemoryManager< DataType >::RawAllocate().

◆ AllocateSharedPtr()

template<typename DataType >
template<typename... Args>
static std::shared_ptr<DataType> Nektar::MemoryManager< DataType >::AllocateSharedPtr ( const Args &...  args)
inlinestatic

Allocate a shared pointer from the memory pool.

The shared pointer does not need to be returned to the memory pool. When the reference count to this object reaches 0, the shared pointer will automatically return the memory.

Definition at line 171 of file NekMemoryManager.hpp.

172  {
173  return AllocateSharedPtrD( [](DataType *){}, args...);
174  }
static std::shared_ptr< DataType > AllocateSharedPtrD(const DeallocatorType &d, const Args &...args)

References Nektar::MemoryManager< DataType >::AllocateSharedPtrD().

Referenced by Nektar::CFSImplicit::AddMatNSBlkDiagVol(), Nektar::SolverUtils::Advection::AddTraceJacToMat(), Nektar::CFSImplicit::AllocateNekBlkMatDig(), Nektar::PreconCfsBRJ::AllocateNekBlkMatDig(), Nektar::FieldUtils::Field::AppendExpList(), Nektar::ArtificialDiffusion::ArtificialDiffusion(), Nektar::MultiRegions::GlobalLinSysDirectFull::AssembleFullMatrix(), Nektar::MultiRegions::AssemblyMap::AssemblyMap(), Nektar::MultiRegions::AssemblyMapCG::AssemblyMapCG(), Nektar::MultiRegions::AssemblyMapDG::AssemblyMapDG(), Nektar::MultiRegions::PreconditionerBlock::BlockPreconditionerCG(), Nektar::MultiRegions::PreconditionerBlock::BlockPreconditionerHDG(), Nektar::MultiRegions::BottomUpSubStructuredGraph::BottomUpSubStructuredGraph(), Nektar::LinearElasticSystem::BuildLaplacianIJMatrix(), Nektar::SolverUtils::ForcingAbsorption::CalcAbsorption(), Nektar::SolverUtils::FilterAeroForces::CalculateForcesMapping(), Nektar::LibUtilities::NodalPrismElec::CalculatePoints(), Nektar::LibUtilities::NodalPrismEvenlySpaced::CalculatePoints(), Nektar::LibUtilities::NodalTetElec::CalculatePoints(), Nektar::LibUtilities::NodalTetEvenlySpaced::CalculatePoints(), Nektar::LibUtilities::NodalTriElec::CalculatePoints(), Nektar::LibUtilities::NodalTriEvenlySpaced::CalculatePoints(), Nektar::LibUtilities::NodalTriFekete::CalculatePoints(), Nektar::CFSBndCond::CFSBndCond(), Nektar::Collections::Collection::Collection(), Nektar::MultiRegions::GlobalLinSysStaticCond::ConstructNextLevelCondensedSystem(), Nektar::MultiRegions::ContField::ContField(), Nektar::MultiRegions::ContField3DHomogeneous1D::ContField3DHomogeneous1D(), Nektar::MultiRegions::ContField3DHomogeneous2D::ContField3DHomogeneous2D(), Nektar::CoupledLocalToGlobalC0ContMap::CoupledLocalToGlobalC0ContMap(), Nektar::SpatialDomains::MeshGraphHDF5::create(), Nektar::SpatialDomains::MeshGraphXml::create(), Nektar::SpatialDomains::MeshGraphXmlCompressed::create(), Nektar::BetaPressureArea::create(), Nektar::EmpiricalPressureArea::create(), Nektar::PowerPressureArea::create(), Nektar::TemplatePressureArea::create(), Nektar::AInflow::create(), Nektar::QInflow::create(), Nektar::RCROutflow::create(), Nektar::ROutflow::create(), Nektar::TerminalOutflow::create(), Nektar::TimeDependentInflow::create(), Nektar::UInflow::create(), Nektar::UndefinedInOutflow::create(), Nektar::PreconCfsBRJ::create(), Nektar::MultiRegions::GlobalLinSysDirectFull::create(), Nektar::MultiRegions::GlobalLinSysDirectStaticCond::create(), Nektar::MultiRegions::GlobalLinSysIterativeFull::create(), Nektar::MultiRegions::GlobalLinSysPETScFull::create(), Nektar::MultiRegions::GlobalLinSysXxtFull::create(), Nektar::IdealGasEoS::create(), Nektar::PengRobinsonEoS::create(), Nektar::VanDerWaalsEoS::create(), Nektar::PulseWaveSystemOutput::create(), Nektar::MappingExtrapolate::create(), Nektar::StandardExtrapolate::create(), Nektar::SubSteppingExtrapolate::create(), Nektar::SubSteppingExtrapolateWeakPressure::create(), Nektar::WeakPressureExtrapolate::create(), Nektar::ExtrapOrder0BC::create(), Nektar::IsentropicVortexBC::create(), Nektar::PressureInflowFileBC::create(), Nektar::PressureMachTemperatureBC::create(), Nektar::PressureOutflowBC::create(), Nektar::PressureOutflowNonReflectiveBC::create(), Nektar::RiemannInvariantBC::create(), Nektar::RinglebFlowBC::create(), Nektar::StagnationInflowBC::create(), Nektar::SymmetryBC::create(), Nektar::TimeDependentBC::create(), Nektar::WallBC::create(), Nektar::WallViscousBC::create(), Nektar::NonSmoothShockCapture::create(), Nektar::GlobalMapping::MappingGeneral::create(), Nektar::GlobalMapping::MappingTranslation::create(), Nektar::GlobalMapping::MappingXofXZ::create(), Nektar::GlobalMapping::MappingXofZ::create(), Nektar::GlobalMapping::MappingXYofXY::create(), Nektar::GlobalMapping::MappingXYofZ::create(), Nektar::PanditGilesDemir03::create(), Nektar::LibUtilities::NekLinSysIterCG::create(), Nektar::LibUtilities::NekLinSysIterFixedpointJacobi::create(), Nektar::LibUtilities::NekLinSysIterGMRES::create(), Nektar::LibUtilities::NekNonlinSysNewton::create(), Nektar::CellModelAlievPanfilov::create(), Nektar::CourtemancheRamirezNattel98::create(), Nektar::FentonKarma::create(), Nektar::CellModelFitzHughNagumo::create(), Nektar::Fox02::create(), Nektar::LuoRudy91::create(), Nektar::TenTusscher06::create(), Nektar::Winslow99::create(), Nektar::StimulusCirc::create(), Nektar::StimulusPoint::create(), Nektar::StimulusRect::create(), Nektar::SolverUtils::DriverAdaptive::create(), Nektar::SolverUtils::DriverArpack::create(), Nektar::SolverUtils::DriverModifiedArnoldi::create(), Nektar::SolverUtils::DriverStandard::create(), Nektar::SolverUtils::DriverSteadyState::create(), Nektar::APE::create(), Nektar::LEE::create(), Nektar::CFLtester::create(), Nektar::EigenValuesAdvection::create(), Nektar::Helmholtz::create(), Nektar::Laplace::create(), Nektar::MMFAdvection::create(), Nektar::Poisson::create(), Nektar::Projection::create(), Nektar::SteadyAdvectionDiffusion::create(), Nektar::SteadyAdvectionDiffusionReaction::create(), Nektar::UnsteadyAdvectionDiffusion::create(), Nektar::UnsteadyDiffusion::create(), Nektar::UnsteadyInviscidBurger::create(), Nektar::UnsteadyReactionDiffusion::create(), Nektar::UnsteadyViscousBurgers::create(), Nektar::Bidomain::create(), Nektar::BidomainRoth::create(), Nektar::Monodomain::create(), Nektar::EulerCFE::create(), Nektar::EulerImplicitCFE::create(), Nektar::NavierStokesCFE::create(), Nektar::NavierStokesCFEAxisym::create(), Nektar::NavierStokesImplicitCFE::create(), Nektar::MMFDiffusion::create(), Nektar::Dummy::create(), Nektar::ImageWarpingSystem::create(), Nektar::CoupledLinearNS::create(), Nektar::SmoothedProfileMethod::create(), Nektar::VCSMapping::create(), Nektar::VelocityCorrectionScheme::create(), Nektar::VCSWeakPressure::create(), Nektar::MMFMaxwell::create(), Nektar::PulseWavePropagation::create(), Nektar::LinearSWE::create(), Nektar::MMFSWE::create(), Nektar::NonlinearSWE::create(), Nektar::ShallowWaterSystem::create(), Nektar::SolverUtils::ForcingAbsorption::create(), Nektar::SolverUtils::ForcingBody::create(), Nektar::SolverUtils::ForcingMovingReferenceFrame::create(), Nektar::SolverUtils::ForcingNoise::create(), Nektar::SolverUtils::ForcingProgrammatic::create(), Nektar::SolverUtils::FilterModalEnergy::create(), Nektar::SolverUtils::FilterThresholdMin::create(), Nektar::SolverUtils::FilterAeroForces::create(), Nektar::SolverUtils::FilterAverageFields::create(), Nektar::SolverUtils::FilterCheckpoint::create(), Nektar::SolverUtils::FilterEnergy1D::create(), Nektar::SolverUtils::FilterError::create(), Nektar::SolverUtils::FilterFieldConvert::create(), Nektar::SolverUtils::FilterHistoryPoints::create(), Nektar::SolverUtils::FilterMovingAverage::create(), Nektar::SolverUtils::FilterThresholdMax::create(), Nektar::ForcingAxiSymmetric::create(), Nektar::ForcingQuasi1D::create(), Nektar::ForcingMovingBody::create(), Nektar::ForcingStabilityCoupledLNS::create(), Nektar::SolverUtils::FilterEnergy::create(), Nektar::SolverUtils::FilterMean::create(), Nektar::FilterBenchmark::create(), Nektar::FilterCellHistoryPoints::create(), Nektar::FilterCheckpointCellModel::create(), Nektar::FilterElectrogram::create(), Nektar::FilterMovingBody::create(), Nektar::FilterAeroForcesSPM::create(), Nektar::SolverUtils::FilterReynoldsStresses::create(), Nektar::ProtocolS1::create(), Nektar::ProtocolS1S2::create(), Nektar::ProtocolSingle::create(), Nektar::SpatialDomains::MeshPartitionMetis::create(), Nektar::SpatialDomains::MeshPartitionPtScotch::create(), Nektar::SpatialDomains::MeshPartitionScotch::create(), Nektar::MultiRegions::PreconditionerBlock::create(), Nektar::MultiRegions::PreconditionerDiagonal::create(), Nektar::MultiRegions::PreconditionerNull::create(), Nektar::MultiRegions::PreconditionerLinear::create(), Nektar::MultiRegions::PreconditionerLinearWithBlock::create(), Nektar::MultiRegions::PreconditionerLinearWithDiag::create(), Nektar::MultiRegions::PreconditionerLinearWithLowEnergy::create(), Nektar::MultiRegions::PreconditionerLowEnergy::create(), Nektar::FieldUtils::InputDat::create(), Nektar::FieldUtils::InputFld::create(), Nektar::FieldUtils::InputNek5000::create(), Nektar::FieldUtils::InputPts::create(), Nektar::FieldUtils::InputSemtex::create(), Nektar::FieldUtils::InputXml::create(), Nektar::FieldUtils::OutputFld::create(), Nektar::FieldUtils::OutputInfo::create(), Nektar::FieldUtils::OutputPts::create(), Nektar::FieldUtils::OutputStdOut::create(), Nektar::FieldUtils::OutputTecplot::create(), Nektar::FieldUtils::OutputTecplotBinary::create(), Nektar::FieldUtils::OutputVtk::create(), Nektar::FieldUtils::OutputXml::create(), Nektar::FieldUtils::ProcessAddCompositeID::create(), Nektar::FieldUtils::ProcessAddFld::create(), Nektar::FieldUtils::ProcessBoundaryExtract::create(), Nektar::FieldUtils::ProcessC0Projection::create(), Nektar::FieldUtils::ProcessCombineAvg::create(), Nektar::FieldUtils::ProcessConcatenateFld::create(), Nektar::FieldUtils::ProcessCreateExp::create(), Nektar::FieldUtils::ProcessDeform::create(), Nektar::FieldUtils::ProcessDisplacement::create(), Nektar::FieldUtils::ProcessDOF::create(), Nektar::FieldUtils::ProcessEquiSpacedOutput::create(), Nektar::FieldUtils::ProcessFieldFromString::create(), Nektar::FieldUtils::ProcessGrad::create(), Nektar::FieldUtils::ProcessHalfModeToFourier::create(), Nektar::FieldUtils::ProcessHomogeneousPlane::create(), Nektar::FieldUtils::ProcessHomogeneousStretch::create(), Nektar::FieldUtils::ProcessInnerProduct::create(), Nektar::FieldUtils::ProcessInterpField::create(), Nektar::FieldUtils::ProcessInterpPointDataToFld::create(), Nektar::FieldUtils::ProcessInterpPoints::create(), Nektar::FieldUtils::ProcessInterpPtsToPts::create(), Nektar::FieldUtils::ProcessIsoContour::create(), Nektar::FieldUtils::ProcessJacobianEnergy::create(), Nektar::FieldUtils::ProcessL2Criterion::create(), Nektar::FieldUtils::ProcessMapping::create(), Nektar::FieldUtils::ProcessMean::create(), Nektar::FieldUtils::ProcessMeanMode::create(), Nektar::FieldUtils::ProcessMultiShear::create(), Nektar::FieldUtils::ProcessNumModes::create(), Nektar::FieldUtils::ProcessPhiFromFile::create(), Nektar::FieldUtils::ProcessPointDataToFld::create(), Nektar::FieldUtils::ProcessPrintFldNorms::create(), Nektar::FieldUtils::ProcessQCriterion::create(), Nektar::FieldUtils::ProcessQualityMetric::create(), Nektar::FieldUtils::ProcessRemoveField::create(), Nektar::FieldUtils::ProcessScaleInFld::create(), Nektar::FieldUtils::ProcessScalGrad::create(), Nektar::FieldUtils::ProcessStreamFunction::create(), Nektar::FieldUtils::ProcessSurfDistance::create(), Nektar::FieldUtils::ProcessVorticity::create(), Nektar::FieldUtils::ProcessWallNormalData::create(), Nektar::FieldUtils::ProcessWSS::create(), Nektar::LibUtilities::NekFFTW::create(), Nektar::LibUtilities::CommCwipi::create(), Nektar::LibUtilities::CommMpi::create(), Nektar::LibUtilities::CommSerial::create(), Nektar::LibUtilities::FieldIOHdf5::create(), Nektar::LibUtilities::FieldIOXml::create(), Nektar::SolverUtils::CouplingCwipi::create(), Nektar::SolverUtils::CouplingFile::create(), Nektar::LibUtilities::AdamsMoultonTimeIntegrationScheme::create(), Nektar::LibUtilities::AdamsMoultonOrder1TimeIntegrationScheme::create(), Nektar::LibUtilities::AdamsMoultonOrder2TimeIntegrationScheme::create(), Nektar::LibUtilities::AdamsMoultonOrder3TimeIntegrationScheme::create(), Nektar::LibUtilities::AdamsMoultonOrder4TimeIntegrationScheme::create(), Nektar::LibUtilities::BDFImplicitTimeIntegrationScheme::create(), Nektar::LibUtilities::BDFImplicitOrder1TimeIntegrationScheme::create(), Nektar::LibUtilities::BDFImplicitOrder2TimeIntegrationScheme::create(), Nektar::LibUtilities::CNABTimeIntegrationScheme::create(), Nektar::LibUtilities::EulerExponentialTimeIntegrationScheme::create(), Nektar::LibUtilities::EulerTimeIntegrationScheme::create(), Nektar::LibUtilities::BackwardEulerTimeIntegrationScheme::create(), Nektar::LibUtilities::ForwardEulerTimeIntegrationScheme::create(), Nektar::LibUtilities::IMEXdirkTimeIntegrationScheme::create(), Nektar::LibUtilities::IMEXdirk_1_1_1TimeIntegrationScheme::create(), Nektar::LibUtilities::IMEXdirk_1_2_1TimeIntegrationScheme::create(), Nektar::LibUtilities::IMEXdirk_1_2_2TimeIntegrationScheme::create(), Nektar::LibUtilities::IMEXdirk_2_2_2TimeIntegrationScheme::create(), Nektar::LibUtilities::IMEXdirk_2_3_2TimeIntegrationScheme::create(), Nektar::LibUtilities::IMEXdirk_2_3_3TimeIntegrationScheme::create(), Nektar::LibUtilities::IMEXdirk_3_4_3TimeIntegrationScheme::create(), Nektar::LibUtilities::IMEXdirk_4_4_3TimeIntegrationScheme::create(), Nektar::LibUtilities::IMEXGearTimeIntegrationScheme::create(), Nektar::LibUtilities::IMEXTimeIntegrationScheme::create(), Nektar::LibUtilities::IMEXOrder1TimeIntegrationScheme::create(), Nektar::LibUtilities::IMEXOrder2TimeIntegrationScheme::create(), Nektar::LibUtilities::IMEXOrder3TimeIntegrationScheme::create(), Nektar::LibUtilities::IMEXOrder4TimeIntegrationScheme::create(), Nektar::LibUtilities::MCNABTimeIntegrationScheme::create(), Nektar::LibUtilities::RungeKuttaTimeIntegrationScheme::create(), Nektar::LibUtilities::RungeKutta2TimeIntegrationScheme::create(), Nektar::LibUtilities::ClassicalRungeKutta4TimeIntegrationScheme::create(), Nektar::LibUtilities::RungeKutta5TimeIntegrationScheme::create(), Nektar::LibUtilities::RungeKutta2_ImprovedEulerTimeIntegrationScheme::create(), Nektar::LibUtilities::RungeKutta2_SSPTimeIntegrationScheme::create(), Nektar::LibUtilities::RungeKutta3_SSPTimeIntegrationScheme::create(), Nektar::AdjointAdvection::create(), Nektar::AlternateSkewAdvection::create(), Nektar::LinearisedAdvection::create(), Nektar::NavierStokesAdvection::create(), Nektar::NoAdvection::create(), Nektar::SkewSymmetricAdvection::create(), Nektar::FieldUtils::Field::CreateExp(), Nektar::FieldUtils::ProcessInterpPoints::CreateFieldPts(), Nektar::FieldUtils::ProcessInterpPtsToPts::CreateFieldPts(), Nektar::StdRegions::StdExpansion::CreateGeneralMatrix(), Nektar::LocalRegions::Expansion::CreateIndexMap(), Nektar::LibUtilities::NekLinSysIter::CreateInstance(), Nektar::LibUtilities::NekNonlinSys::CreateInstance(), Nektar::LibUtilities::NekSys::CreateInstance(), Nektar::LocalRegions::HexExp::CreateMatrix(), Nektar::LocalRegions::NodalTriExp::CreateMatrix(), Nektar::LocalRegions::PrismExp::CreateMatrix(), Nektar::LocalRegions::PyrExp::CreateMatrix(), Nektar::LocalRegions::QuadExp::CreateMatrix(), Nektar::LocalRegions::SegExp::CreateMatrix(), Nektar::LocalRegions::TetExp::CreateMatrix(), Nektar::LocalRegions::TriExp::CreateMatrix(), Nektar::MultiRegions::PreconditionerLowEnergy::CreateRefHexGeom(), Nektar::MultiRegions::PreconditionerLowEnergy::CreateRefPrismGeom(), Nektar::MultiRegions::PreconditionerLowEnergy::CreateRefPyrGeom(), Nektar::MultiRegions::PreconditionerLowEnergy::CreateRefTetGeom(), Nektar::LocalRegions::HexExp::CreateStaticCondMatrix(), Nektar::LocalRegions::NodalTriExp::CreateStaticCondMatrix(), Nektar::LocalRegions::PrismExp::CreateStaticCondMatrix(), Nektar::LocalRegions::PyrExp::CreateStaticCondMatrix(), Nektar::LocalRegions::QuadExp::CreateStaticCondMatrix(), Nektar::LocalRegions::SegExp::CreateStaticCondMatrix(), Nektar::LocalRegions::TetExp::CreateStaticCondMatrix(), Nektar::LocalRegions::TriExp::CreateStaticCondMatrix(), Nektar::LocalRegions::NodalTriExp::CreateStdMatrix(), Nektar::StdRegions::StdExpansion::CreateStdStaticCondMatrix(), Nektar::MultiRegions::DisContField::DisContField(), Nektar::MultiRegions::DisContField3DHomogeneous1D::DisContField3DHomogeneous1D(), Nektar::MultiRegions::DisContField3DHomogeneous2D::DisContField3DHomogeneous2D(), Nektar::SolverUtils::CouplingCwipi::DumpRawFields(), Nektar::SolverUtils::EquationSystem::ErrorExtraPoints(), Nektar::MultiRegions::DisContField::EvaluateHDGPostProcessing(), Nektar::SolverUtils::SessionFunction::EvaluatePts(), Nektar::MultiRegions::ExpList::ExpList(), Nektar::MultiRegions::ExpList2DHomogeneous1D::ExpList2DHomogeneous1D(), Nektar::MultiRegions::ExpList3DHomogeneous1D::ExpList3DHomogeneous1D(), Nektar::MultiRegions::ExpList3DHomogeneous2D::ExpList3DHomogeneous2D(), Nektar::MultiRegions::ExpListHomogeneous1D::ExpListHomogeneous1D(), Nektar::MultiRegions::ExpListHomogeneous2D::ExpListHomogeneous2D(), Nektar::FieldUtils::ProcessIsoContour::ExtractContour(), Nektar::MultiRegions::PreconditionerLowEnergy::ExtractLocMat(), Nektar::SolverUtils::CouplingCwipi::ExtrapolateFields(), Field_Init(), Nektar::VortexWaveInteraction::FileRelaxation(), Nektar::MultiRegions::DisContField::FindPeriodicTraces(), Nektar::MultiRegions::ExpList::GenBlockMatrix(), Nektar::MultiRegions::ExpList::GeneralGetFieldDefinitions(), Nektar::MultiRegions::DisContField::GenerateBoundaryConditionExpansion(), Nektar::Extrapolate::GenerateHOPBCMap(), Nektar::SpatialDomains::SegGeom::GenerateOneSpaceDimGeom(), Nektar::MultiRegions::ExpList3DHomogeneous1D::GenExpList3DHomogeneous1D(), Nektar::MultiRegions::ExpList::GenGlobalMatrix(), Nektar::MultiRegions::ExpList::GenGlobalMatrixFull(), Nektar::MultiRegions::ExpListHomogeneous1D::GenHomogeneous1DBlockMatrix(), Nektar::MultiRegions::ExpListHomogeneous2D::GenHomogeneous2DBlockMatrix(), Nektar::StdRegions::StdNodalPrismExp::GenNBasisTransMatrix(), Nektar::StdRegions::StdNodalTetExp::GenNBasisTransMatrix(), Nektar::StdRegions::StdNodalTriExp::GenNBasisTransMatrix(), Nektar::CoupledLinearNS::GenPressureExp(), Nektar::MultiRegions::DisContField::GetDomainBCs(), Nektar::MultiRegions::ExpList::GetExpIndex(), Nektar::LinearisedAdvection::GetFloquetBlockMatrix(), Nektar::CFSImplicit::GetFluxVectorJacPoint(), Nektar::SolverUtils::Forcing::GetFunction(), Nektar::SolverUtils::EquationSystem::GetFunction(), Nektar::FieldUtils::ProcessQualityMetric::GetQ(), Nektar::MultiRegions::GlobalMatrix::GlobalMatrix(), Nektar::LibUtilities::FieldIOXml::ImportFieldDefs(), Nektar::MultiRegions::ExpList::InitialiseExpVector(), Nektar::ForcingMovingBody::InitialiseFilter(), Nektar::LibUtilities::TimeIntegrationAlgorithmGLM::InitializeData(), Nektar::NavierStokesCFE::InitObject_Explicit(), Nektar::StdRegions::StdExpansion::LaplacianMatrixOp_MatFree_GenericImpl(), Nektar::MultiRegions::MultiLevelBisectedGraph::MultiLevelBisectedGraph(), Nektar::MultiRegions::MultiLevelBisectionReordering(), Nektar::CFSImplicit::MultiplyElmtInvMassPlusSource(), Nektar::FieldUtils::OutputPts::OutputFromExp(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::PrepareLocalSchurComplement(), Nektar::LibUtilities::Timer::PrintElapsedRegions(), Nektar::FieldUtils::InputDat::Process(), Nektar::FieldUtils::InputPts::Process(), Nektar::FieldUtils::InputXml::Process(), Nektar::FieldUtils::ProcessCreateExp::Process(), Nektar::FieldUtils::ProcessDisplacement::Process(), Nektar::FieldUtils::ProcessEquiSpacedOutput::Process(), Nektar::FieldUtils::ProcessHomogeneousPlane::Process(), Nektar::FieldUtils::ProcessInterpField::Process(), Nektar::FieldUtils::ProcessInterpPointDataToFld::Process(), Nektar::FieldUtils::ProcessInterpPoints::Process(), Nektar::FieldUtils::ProcessIsoContour::Process(), Nektar::FieldUtils::ProcessPointDataToFld::Process(), Nektar::FieldUtils::ProcessWallNormalData::Process(), Nektar::SpatialDomains::BoundaryConditions::ReadBoundaryConditions(), Nektar::MultiRegions::PreconditionerLowEnergy::ReSetPrismMaxRMat(), Nektar::MultiRegions::PreconditionerLowEnergy::ReSetTetMaxRMat(), Nektar::SolverUtils::CouplingCwipi::SendCallback(), Nektar::FieldUtils::Iso::SeparateRegions(), Nektar::ForcingMovingBody::SetDynEqCoeffMatrix(), Nektar::LinearElasticSystem::SetStaticCondBlock(), Nektar::SolverUtils::FilterModalEnergy::SetUpBaseFields(), Nektar::MultiRegions::PreconditionerLowEnergy::SetupBlockTransformationMatrix(), Nektar::MultiRegions::DisContField3DHomogeneous1D::SetupBoundaryConditions(), Nektar::MultiRegions::DisContField3DHomogeneous2D::SetupBoundaryConditions(), Nektar::CoupledLinearNS::SetUpCoupledMatrix(), Nektar::MultiRegions::DisContField::SetUpDG(), Nektar::PulseWaveSystem::SetUpDomainInterfaces(), Nektar::SmoothedProfileMethod::SetUpExpansions(), Nektar::FieldUtils::Field::SetUpFirstExpList(), Nektar::FieldUtils::ProcessIsoContour::SetupIsoFromFieldPts(), Nektar::MultiRegions::PreconditionerLowEnergy::SetUpPyrMaxRMat(), Nektar::SolverUtils::CouplingCwipi::SetupReceive(), Nektar::MultiRegions::PreconditionerLowEnergy::SetUpReferenceElements(), Nektar::SolverUtils::CouplingCwipi::SetupSendInterpolation(), Nektar::MultiRegions::GlobalLinSysStaticCond::SetupTopLevel(), Nektar::SpatialDomains::HexGeom::SetUpXmap(), Nektar::SpatialDomains::PrismGeom::SetUpXmap(), Nektar::SpatialDomains::PyrGeom::SetUpXmap(), Nektar::SpatialDomains::QuadGeom::SetUpXmap(), Nektar::SpatialDomains::SegGeom::SetUpXmap(), Nektar::SpatialDomains::TetGeom::SetUpXmap(), Nektar::SpatialDomains::TriGeom::SetUpXmap(), Nektar::LibUtilities::TimeIntegrationAlgorithmGLM::TimeIntegrate(), Nektar::MultiRegions::GlobalLinSysIterative::UpdateKnownSolutions(), Nektar::Extrapolate::UpdateRobinPrimCoeff(), Nektar::SolverUtils::AdvectionWeakDG::v_AddVolumJacToMat(), Nektar::MultiRegions::GlobalLinSysDirectStaticCond::v_AssembleSchurComplement(), Nektar::MultiRegions::PreconditionerLinear::v_BuildPreconditioner(), Nektar::MultiRegions::PreconditionerLowEnergy::v_BuildPreconditioner(), Nektar::LocalRegions::Expansion2D::v_BuildVertexMatrix(), Nektar::LocalRegions::HexExp::v_CreateStdMatrix(), Nektar::LocalRegions::PrismExp::v_CreateStdMatrix(), Nektar::LocalRegions::PyrExp::v_CreateStdMatrix(), Nektar::LocalRegions::QuadExp::v_CreateStdMatrix(), Nektar::LocalRegions::TetExp::v_CreateStdMatrix(), Nektar::LocalRegions::TriExp::v_CreateStdMatrix(), Nektar::LocalRegions::SegExp::v_CreateStdMatrix(), Nektar::LibUtilities::NodalUtilTriangle::v_CreateUtil(), Nektar::LibUtilities::NodalUtilTetrahedron::v_CreateUtil(), Nektar::LibUtilities::NodalUtilPrism::v_CreateUtil(), Nektar::LibUtilities::NodalUtilQuad::v_CreateUtil(), Nektar::LibUtilities::NodalUtilHex::v_CreateUtil(), Nektar::SolverUtils::DriverAdaptive::v_Execute(), Nektar::SpatialDomains::TriGeom::v_FillGeom(), Nektar::LocalRegions::QuadExp::v_FwdTrans_BndConstrained(), Nektar::LocalRegions::TriExp::v_FwdTrans_BndConstrained(), Nektar::StdRegions::StdQuadExp::v_FwdTrans_BndConstrained(), Nektar::StdRegions::StdTriExp::v_FwdTrans_BndConstrained(), Nektar::SpatialDomains::HexGeom::v_GenGeomFactors(), Nektar::SpatialDomains::PrismGeom::v_GenGeomFactors(), Nektar::SpatialDomains::PyrGeom::v_GenGeomFactors(), Nektar::SpatialDomains::QuadGeom::v_GenGeomFactors(), Nektar::SpatialDomains::SegGeom::v_GenGeomFactors(), Nektar::SpatialDomains::TetGeom::v_GenGeomFactors(), Nektar::SpatialDomains::TriGeom::v_GenGeomFactors(), Nektar::StdRegions::StdPointExp::v_GenMatrix(), Nektar::StdRegions::StdPrismExp::v_GenMatrix(), Nektar::StdRegions::StdQuadExp::v_GenMatrix(), Nektar::StdRegions::StdSegExp::v_GenMatrix(), Nektar::StdRegions::StdTetExp::v_GenMatrix(), Nektar::StdRegions::StdTriExp::v_GenMatrix(), Nektar::LocalRegions::Expansion2D::v_GenMatrix(), Nektar::MultiRegions::GlobalLinSys::v_GetBlock(), Nektar::MultiRegions::DisContField::v_GetBndElmtExpansion(), Nektar::MultiRegions::DisContField3DHomogeneous1D::v_GetBndElmtExpansion(), Nektar::MultiRegions::DisContField3DHomogeneous2D::v_GetBndElmtExpansion(), Nektar::NavierStokesImplicitCFE::v_GetFluxDerivJacDirctn(), Nektar::LocalRegions::HexExp::v_GetLinStdExp(), Nektar::LocalRegions::NodalTriExp::v_GetLinStdExp(), Nektar::LocalRegions::PrismExp::v_GetLinStdExp(), Nektar::LocalRegions::PyrExp::v_GetLinStdExp(), Nektar::LocalRegions::QuadExp::v_GetLinStdExp(), Nektar::LocalRegions::TetExp::v_GetLinStdExp(), Nektar::LocalRegions::TriExp::v_GetLinStdExp(), Nektar::LocalRegions::SegExp::v_GetLinStdExp(), Nektar::MultiRegions::DisContField::v_GetRobinBCInfo(), Nektar::MultiRegions::GlobalLinSys::v_GetStaticCondBlock(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_GetStaticCondBlock(), Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_GetStaticCondBlock(), Nektar::LocalRegions::HexExp::v_GetStdExp(), Nektar::LocalRegions::NodalTriExp::v_GetStdExp(), Nektar::LocalRegions::PrismExp::v_GetStdExp(), Nektar::LocalRegions::PyrExp::v_GetStdExp(), Nektar::LocalRegions::QuadExp::v_GetStdExp(), Nektar::LocalRegions::TetExp::v_GetStdExp(), Nektar::LocalRegions::TriExp::v_GetStdExp(), Nektar::LocalRegions::SegExp::v_GetStdExp(), Nektar::LibUtilities::FieldIOHdf5::v_Import(), Nektar::LibUtilities::CsvIO::v_ImportFieldData(), Nektar::LibUtilities::PtsIO::v_ImportFieldData(), Nektar::SolverUtils::CouplingFile::v_Init(), Nektar::SolverUtils::FilterHistoryPoints::v_Initialise(), Nektar::FilterElectrogram::v_Initialise(), Nektar::SolverUtils::EquationSystem::v_InitObject(), Nektar::CompressibleFlowSystem::v_InitObject(), Nektar::ImageWarpingSystem::v_InitObject(), Nektar::CoupledLinearNS::v_InitObject(), Nektar::IncNavierStokes::v_InitObject(), Nektar::LinearElasticSystem::v_InitObject(), Nektar::PulseWaveSystem::v_InitObject(), Nektar::SolverUtils::ForcingBody::v_InitObject(), Nektar::ForcingAxiSymmetric::v_InitObject(), Nektar::ForcingQuasi1D::v_InitObject(), Nektar::SolverUtils::Advection3DHomogeneous1D::v_InitObject(), Nektar::LinearisedAdvection::v_InitObject(), Nektar::MultiRegions::AssemblyMapCG::v_LinearSpaceMap(), Nektar::LocalRegions::TriExp::v_ReduceOrderCoeffs(), Nektar::StdRegions::StdPrismExp::v_ReduceOrderCoeffs(), Nektar::StdRegions::StdPyrExp::v_ReduceOrderCoeffs(), Nektar::StdRegions::StdTetExp::v_ReduceOrderCoeffs(), Nektar::StdRegions::StdTriExp::v_ReduceOrderCoeffs(), Nektar::SolverUtils::CouplingFile::v_Send(), and Nektar::MultiRegions::PreconditionerLowEnergy::v_TransformedSchurCompl().

◆ AllocateSharedPtrD()

template<typename DataType >
template<typename DeallocatorType , typename... Args>
static std::shared_ptr<DataType> Nektar::MemoryManager< DataType >::AllocateSharedPtrD ( const DeallocatorType &  d,
const Args &...  args 
)
inlinestatic

Definition at line 177 of file NekMemoryManager.hpp.

179  {
180  DataType* data = Allocate(args...);
181  return std::shared_ptr<DataType>(
182  data, [=](DataType *ptr){
183  d(ptr);
185  });
186  }
static void Deallocate(DataType *&data)
Deallocate a pointer allocated by MemoryManager::Allocate.

References Nektar::MemoryManager< DataType >::Allocate(), and Nektar::MemoryManager< DataType >::Deallocate().

Referenced by Nektar::MemoryManager< DataType >::AllocateSharedPtr(), and Nektar::CreateStorage().

◆ construct()

template<typename DataType >
void Nektar::MemoryManager< DataType >::construct ( pointer  p,
const_reference  val 
)
inline

Definition at line 271 of file NekMemoryManager.hpp.

272  {
273  new(p) DataType(val);
274  }

References CellMLToNektar.cellml_metadata::p.

◆ Deallocate()

template<typename DataType >
static void Nektar::MemoryManager< DataType >::Deallocate ( DataType *&  data)
inlinestatic

Deallocate a pointer allocated by MemoryManager::Allocate.

Note
Results are undefined if called with a pointer to something that was not allocated with the memory manager.

Use this method to deallocate a pointer you have allocated from the MemoryManager using the Allocate method.

Example:

CustObj* c = MemoryManager::Allocate<CustObj>();

Definition at line 99 of file NekMemoryManager.hpp.

100  {
101 #ifdef NEKTAR_MEMORY_POOL_ENABLED
102  data->~DataType();
103  GetMemoryPool().Deallocate(data, sizeof(DataType));
104 #else
105 #ifdef NEKTAR_USE_ALIGNED_MEM
106  boost::alignment::aligned_free(data);
107 #else
108  delete data;
109 #endif
110 #endif
111 
112  data = NULL;
113  }
void Deallocate(void *p, size_t bytes)
Deallocate memory claimed by an earlier call to allocate.
MemPool & GetMemoryPool()

References Nektar::MemPool::Deallocate(), and Nektar::GetMemoryPool().

Referenced by Nektar::MemoryManager< DataType >::AllocateSharedPtrD().

◆ deallocate()

template<typename DataType >
void Nektar::MemoryManager< DataType >::deallocate ( pointer  p,
size_type  n 
)
inline

Definition at line 266 of file NekMemoryManager.hpp.

267  {
268  return RawDeallocate(p, n);
269  }
static void RawDeallocate(DataType *array, size_t NumberOfElements)
Deallocates memory allocated from RawAllocate.

References CellMLToNektar.cellml_metadata::p, and Nektar::MemoryManager< DataType >::RawDeallocate().

◆ destroy()

template<typename DataType >
void Nektar::MemoryManager< DataType >::destroy ( pointer  p)
inline

Definition at line 276 of file NekMemoryManager.hpp.

277  {
278  p->~DataType();
279  }

References CellMLToNektar.cellml_metadata::p.

◆ max_size()

template<typename DataType >
size_type Nektar::MemoryManager< DataType >::max_size ( )
inline

Definition at line 281 of file NekMemoryManager.hpp.

282  {
283  return std::numeric_limits<size_type>::max()/sizeof(DataType);
284  }

◆ RawAllocate()

template<typename DataType >
static DataType* Nektar::MemoryManager< DataType >::RawAllocate ( size_t  NumberOfElements)
inlinestatic

Allocates a chunk of raw, uninitialized memory, capable of holding NumberOfElements objects.

Parameters
NumberOfElementsThe number of elements the array should be capable of holding.

This method is not meant to be called by client code. Use Array instead. Any memory allocated from this method must be returned to the memory pool via RawDeallocate. Failure to do so will result in memory leaks and undefined behavior.

Definition at line 198 of file NekMemoryManager.hpp.

199  {
200 #ifdef NEKTAR_MEMORY_POOL_ENABLED
201  return static_cast<DataType*>(GetMemoryPool().Allocate(
202  NumberOfElements * sizeof(DataType)));
203 #else //NEKTAR_MEMORY_POOL_ENABLED
204  #ifdef NEKTAR_USE_ALIGNED_MEM
205  return static_cast<DataType*>(boost::alignment::aligned_alloc(
207  NumberOfElements * sizeof(DataType)));
208  #else
209  return static_cast<DataType*>(::operator new(NumberOfElements * sizeof(DataType)));
210  #endif
211 #endif //NEKTAR_MEMORY_POOL_ENABLED
212  }
void * Allocate(size_t bytes)
Allocate a block of memory of size ByteSize.

References Nektar::MemPool::Allocate(), and Nektar::GetMemoryPool().

Referenced by Nektar::MemoryManager< DataType >::allocate(), Nektar::CreateStorage(), and Nektar::Array< OneD, const DataType >::CreateStorage().

◆ RawDeallocate()

template<typename DataType >
static void Nektar::MemoryManager< DataType >::RawDeallocate ( DataType *  array,
size_t  NumberOfElements 
)
inlinestatic

Deallocates memory allocated from RawAllocate.

Parameters
arrayA pointer to the memory returned from RawAllocate.
NumberOfElementsThe number of object held in the array.

This method is not meant to be called by client code. Use Array instead. Only memory allocated via RawAllocate should be returned to the pool here.

Definition at line 221 of file NekMemoryManager.hpp.

222  {
223 #ifdef NEKTAR_MEMORY_POOL_ENABLED
224  GetMemoryPool().Deallocate(array, sizeof(DataType)*NumberOfElements);
225 #else //NEKTAR_MEMORY_POOL_ENABLED
226  boost::ignore_unused(NumberOfElements);
227  #ifdef NEKTAR_USE_ALIGNED_MEM
228  boost::alignment::aligned_free(array);
229  #else
230  ::operator delete(array);
231  #endif
232 #endif //NEKTAR_MEMORY_POOL_ENABLED
233  }

References Nektar::MemPool::Deallocate(), and Nektar::GetMemoryPool().

Referenced by Nektar::CreateStorage(), Nektar::MemoryManager< DataType >::deallocate(), Nektar::Array< OneD, const DataType >::operator=(), and Nektar::Array< OneD, const DataType >::~Array().