Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | 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

class  DeallocateSharedPtr
 
class  DefaultCustomDeallocator
 
struct  rebind
 

Public Member Functions

 BOOST_PP_REPEAT_FROM_TO (1, NEKTAR_MAX_MEMORY_MANAGER_CONSTRUCTOR_ARGS, ALLOCATE_METHOD_GENERATOR, Allocate)
 
 BOOST_PP_REPEAT_FROM_TO (0, NEKTAR_MAX_MEMORY_MANAGER_CONSTRUCTOR_ARGS, ALLOCATE_SHARED_PTR_METHOD_WITH_DEALLOCATOR_GENERATOR, AllocateSharedPtrD)
 
 BOOST_PP_REPEAT_FROM_TO (1, NEKTAR_MAX_MEMORY_MANAGER_CONSTRUCTOR_ARGS, ALLOCATE_SHARED_PTR_METHOD_GENERATOR, AllocateSharedPtr)
 

Static Public Member Functions

static void Deallocate (DataType *&data)
 Deallocate a pointer allocated by MemoryManager::Allocate. More...
 
static DataType * Allocate ()
 Allocates a single object from the memory pool. More...
 
static boost::shared_ptr
< DataType > 
AllocateSharedPtr ()
 Allocate a shared pointer from the memory pool. More...
 
static DataType * RawAllocate (unsigned int NumberOfElements)
 Allocates a chunk of raw, uninitialized memory, capable of holding NumberOfElements objects. More...
 
static void RawDeallocate (DataType *array, unsigned int 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.
boost::shared_ptr<Obj> f(MemoryManager<Obj>::Allocate());
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:
boost::shared_ptr<Obj> f = MemoryManager<Obj>::AllocateSharedPtr();

Definition at line 102 of file NekMemoryManager.hpp.

Member Typedef Documentation

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

Definition at line 326 of file NekMemoryManager.hpp.

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

Definition at line 328 of file NekMemoryManager.hpp.

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

Definition at line 324 of file NekMemoryManager.hpp.

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

Definition at line 325 of file NekMemoryManager.hpp.

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

Definition at line 327 of file NekMemoryManager.hpp.

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

Definition at line 323 of file NekMemoryManager.hpp.

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

Definition at line 322 of file NekMemoryManager.hpp.

Constructor & Destructor Documentation

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

Definition at line 330 of file NekMemoryManager.hpp.

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

Definition at line 332 of file NekMemoryManager.hpp.

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

Definition at line 333 of file NekMemoryManager.hpp.

333 {}

Member Function Documentation

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

Definition at line 335 of file NekMemoryManager.hpp.

335 { return &r; }
template<typename DataType>
const_pointer Nektar::MemoryManager< DataType >::address ( const_reference  r) const
inline

Definition at line 336 of file NekMemoryManager.hpp.

336 { return &r; }
template<typename DataType>
static DataType* Nektar::MemoryManager< DataType >::Allocate ( )
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 215 of file NekMemoryManager.hpp.

216  {
217  return new DataType();
218  }
template<typename DataType>
pointer Nektar::MemoryManager< DataType >::allocate ( size_type  n,
std::allocator< void >::const_pointer  hint = 0 
)
inline

Definition at line 338 of file NekMemoryManager.hpp.

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

339  {
340  return RawAllocate(n);
341  }
static DataType * RawAllocate(unsigned int NumberOfElements)
Allocates a chunk of raw, uninitialized memory, capable of holding NumberOfElements objects...
template<typename DataType>
static boost::shared_ptr<DataType> Nektar::MemoryManager< DataType >::AllocateSharedPtr ( )
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 235 of file NekMemoryManager.hpp.

Referenced by Nektar::SpatialDomains::MeshGraph::AddEdge(), 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::FilterAeroForces::CalculateForcesMapping(), Nektar::CellModel::CellModel(), Nektar::NekMeshUtils::Quadrilateral::Complete(), Nektar::NekMeshUtils::Prism::Complete(), Nektar::NekMeshUtils::Tetrahedron::Complete(), Nektar::NekMeshUtils::Triangle::Complete(), Nektar::MultiRegions::GlobalLinSysStaticCond::ConstructNextLevelCondensedSystem(), Nektar::MultiRegions::ContField1D::ContField1D(), Nektar::MultiRegions::ContField2D::ContField2D(), Nektar::MultiRegions::ContField3D::ContField3D(), Nektar::MultiRegions::ContField3DHomogeneous1D::ContField3DHomogeneous1D(), Nektar::MultiRegions::ContField3DHomogeneous2D::ContField3DHomogeneous2D(), Nektar::CoupledLocalToGlobalC0ContMap::CoupledLocalToGlobalC0ContMap(), Nektar::Fox02::create(), Nektar::LuoRudy91::create(), Nektar::FentonKarma::create(), Nektar::PanditGilesDemir03::create(), Nektar::CellModelFitzHughNagumo::create(), Nektar::CellModelAlievPanfilov::create(), Nektar::CourtemancheRamirezNattel98::create(), Nektar::SteadyAdvectionDiffusionReaction::create(), Nektar::TenTusscher06::create(), Nektar::VelocityCorrectionScheme::create(), Nektar::Winslow99::create(), Nektar::Helmholtz::create(), Nektar::VCSMapping::create(), Nektar::Poisson::create(), Nektar::Utilities::ProcessCyl::create(), Nektar::Utilities::ProcessDeform::create(), Nektar::Utilities::ProcessDisplacement::create(), Nektar::Utilities::ProcessOptiExtract::create(), Nektar::Utilities::ProcessPerAlign::create(), Nektar::ProtocolS1S2::create(), Nektar::Utilities::InputTec::create(), Nektar::SteadyAdvectionDiffusion::create(), Nektar::FilterEnergy::create(), Nektar::NoAdvection::create(), Nektar::EigenValuesAdvection::create(), Nektar::Utilities::ProcessJacobianEnergy::create(), Nektar::Utilities::ProcessQualityMetric::create(), Nektar::AlternateSkewAdvection::create(), Nektar::ProtocolS1::create(), Nektar::ProtocolSingle::create(), Nektar::ImageWarpingSystem::create(), Nektar::Utilities::InputVtk::create(), Nektar::Utilities::InputPly::create(), Nektar::Utilities::InputSwan::create(), Nektar::SolverUtils::FilterAverageFields::create(), Nektar::FilterBenchmark::create(), Nektar::FilterCellHistoryPoints::create(), Nektar::SolverUtils::FilterCheckpoint::create(), Nektar::UnsteadyAdvection::create(), Nektar::LibUtilities::MeshPartitionMetis::create(), Nektar::FilterCheckpointCellModel::create(), Nektar::FilterElectrogram::create(), Nektar::Utilities::OutputInfo::create(), Nektar::Utilities::OutputStdOut::create(), Nektar::Utilities::OutputXml::create(), Nektar::UnsteadyInviscidBurger::create(), Nektar::SolverUtils::FilterReynoldsStresses::create(), Nektar::SolverUtils::DriverStandard::create(), Nektar::SolverUtils::FilterThresholdMin::create(), Nektar::MultiRegions::GlobalLinSysIterativeFull::create(), Nektar::Utilities::ProcessSpherigon::create(), Nektar::SkewSymmetricAdvection::create(), Nektar::Utilities::InputStar::create(), Nektar::UnsteadyDiffusion::create(), Nektar::Laplace::create(), Nektar::UnsteadyAdvectionDiffusion::create(), Nektar::NavierStokesAdvection::create(), Nektar::SolverUtils::FilterHistoryPoints::create(), Nektar::Utilities::OutputFld::create(), Nektar::Utilities::OutputPts::create(), Nektar::Utilities::OutputVtk::create(), Nektar::SolverUtils::FilterMovingAverage::create(), Nektar::SolverUtils::FilterThresholdMax::create(), Nektar::SolverUtils::DriverModifiedArnoldi::create(), Nektar::MultiRegions::PreconditionerLinearWithBlock::create(), Nektar::MultiRegions::PreconditionerLinearWithLowEnergy::create(), Nektar::Utilities::ProcessBoundaryExtract::create(), Nektar::Utilities::ProcessConcatenateFld::create(), Nektar::Utilities::ProcessEquiSpacedOutput::create(), Nektar::Utilities::ProcessInterpField::create(), Nektar::Utilities::ProcessInterpPoints::create(), Nektar::Utilities::ProcessLinear::create(), Nektar::Utilities::ProcessNumModes::create(), Nektar::Utilities::ProcessVorticity::create(), Nektar::PulseWavePropagation::create(), Nektar::SolverUtils::FilterAeroForces::create(), Nektar::LibUtilities::MeshPartitionScotch::create(), Nektar::Utilities::OutputNekpp::create(), Nektar::BidomainRoth::create(), Nektar::Utilities::ProcessAddFld::create(), Nektar::Utilities::ProcessC0Projection::create(), Nektar::ForcingStabilityCoupledLNS::create(), Nektar::Utilities::ProcessHomogeneousPlane::create(), Nektar::Utilities::ProcessInnerProduct::create(), Nektar::Utilities::ProcessGrad::create(), Nektar::Utilities::ProcessMeanMode::create(), Nektar::Utilities::ProcessMultiShear::create(), Nektar::Utilities::ProcessQCriterion::create(), Nektar::Utilities::ProcessPrintFldNorms::create(), Nektar::Utilities::ProcessScaleInFld::create(), Nektar::Utilities::ProcessScalGrad::create(), Nektar::Utilities::ProcessSurfDistance::create(), Nektar::Utilities::ProcessWSS::create(), Nektar::PulseWaveSystemOutput::create(), Nektar::Utilities::InputCAD::create(), Nektar::ShallowWaterSystem::create(), Nektar::StimulusRect::create(), Nektar::StimulusPoint::create(), Nektar::SolverUtils::DriverAdaptive::create(), Nektar::MultiRegions::PreconditionerDiagonal::create(), Nektar::MultiRegions::PreconditionerLinearWithDiag::create(), Nektar::SolverUtils::DriverSteadyState::create(), Nektar::Utilities::ProcessInterpPointDataToFld::create(), Nektar::Utilities::ProcessMapping::create(), Nektar::Utilities::ProcessPointDataToFld::create(), Nektar::QInflow::create(), Nektar::Utilities::InputDat::create(), Nektar::RCROutflow::create(), Nektar::ROutflow::create(), Nektar::ArterialPressureArea::create(), Nektar::TerminalOutflow::create(), Nektar::TimeDependentInflow::create(), Nektar::LymphaticPressureArea::create(), Nektar::UndefinedInOutflow::create(), Nektar::UnsteadyViscousBurgers::create(), Nektar::Bidomain::create(), Nektar::SolverUtils::DriverArpack::create(), Nektar::APE::create(), Nektar::Utilities::ProcessBL::create(), Nektar::Utilities::ProcessDetectSurf::create(), Nektar::Utilities::ProcessExtractSurf::create(), Nektar::MultiRegions::GlobalLinSysDirectFull::create(), Nektar::Utilities::ProcessJac::create(), Nektar::Utilities::ProcessScalar::create(), Nektar::MultiRegions::GlobalLinSysXxtFull::create(), Nektar::Utilities::ProcessTetSplit::create(), Nektar::LinearSWE::create(), Nektar::Monodomain::create(), Nektar::NonlinearSWE::create(), Nektar::MultiRegions::PreconditionerBlock::create(), Nektar::SolverUtils::ForcingAbsorption::create(), Nektar::MultiRegions::PreconditionerLowEnergy::create(), Nektar::ForcingMovingBody::create(), Nektar::Utilities::InputGmsh::create(), Nektar::Utilities::InputFld::create(), Nektar::Utilities::InputNekpp::create(), Nektar::Utilities::InputSem::create(), Nektar::Utilities::InputXml::create(), Nektar::StimulusCirc::create(), Nektar::MappingExtrapolate::create(), Nektar::FilterMovingBody::create(), Nektar::SolverUtils::ForcingNoise::create(), Nektar::MultiRegions::GlobalLinSysPETScFull::create(), Nektar::Utilities::InputPts::create(), Nektar::SolverUtils::ForcingBody::create(), Nektar::MultiRegions::GlobalLinSysDirectStaticCond::create(), Nektar::LibUtilities::CommSerial::create(), Nektar::CompressibleFlowSystem::create(), Nektar::GlobalMapping::MappingXYofZ::create(), Nektar::SolverUtils::FilterEnergy1D::create(), Nektar::Utilities::OutputTecplot::create(), Nektar::GlobalMapping::MappingGeneral::create(), Nektar::GlobalMapping::MappingTranslation::create(), Nektar::GlobalMapping::MappingXofXZ::create(), Nektar::GlobalMapping::MappingXofZ::create(), Nektar::GlobalMapping::MappingXYofXY::create(), Nektar::MultiRegions::PreconditionerLinear::create(), Nektar::StandardExtrapolate::create(), Nektar::SubSteppingExtrapolate::create(), Nektar::SolverUtils::FilterModalEnergy::create(), Nektar::SolverUtils::ForcingProgrammatic::create(), Nektar::EulerCFE::create(), Nektar::AdjointAdvection::create(), Nektar::LibUtilities::CommMpi::create(), Nektar::LinearisedAdvection::create(), Nektar::NavierStokesCFE::create(), Nektar::LibUtilities::NekFFTW::create(), Nektar::Utilities::InputNek::create(), Nektar::Utilities::OutputGmsh::create(), Nektar::CFLtester::create(), Nektar::CoupledLinearNS::create(), Nektar::MultiRegions::PreconditionerNull::create(), Nektar::LibUtilities::TimeIntegrationIMEXOrder1::create(), Nektar::LibUtilities::TimeIntegrationIMEXOrder2::create(), Nektar::LibUtilities::TimeIntegrationIMEXOrder3::create(), Nektar::LibUtilities::TimeIntegrationIMEXdirk_1_1_1::create(), Nektar::LibUtilities::TimeIntegrationIMEXdirk_1_2_1::create(), Nektar::Utilities::ProcessIsoContour::create(), Nektar::LibUtilities::TimeIntegrationIMEXdirk_1_2_2::create(), Nektar::LibUtilities::TimeIntegrationIMEXdirk_4_4_3::create(), Nektar::LibUtilities::TimeIntegrationIMEXdirk_2_2_2::create(), Nektar::LibUtilities::TimeIntegrationIMEXdirk_2_3_3::create(), Nektar::LibUtilities::TimeIntegrationIMEXdirk_2_3_2::create(), Nektar::LibUtilities::TimeIntegrationIMEXdirk_3_4_3::create(), Nektar::LibUtilities::TimeIntegrationForwardEuler::create(), Nektar::LibUtilities::TimeIntegrationBackwardEuler::create(), Nektar::LibUtilities::TimeIntegrationBDFImplicitOrder1::create(), Nektar::LibUtilities::TimeIntegrationBDFImplicitOrder2::create(), Nektar::LibUtilities::TimeIntegrationMidpoint::create(), Nektar::LibUtilities::TimeIntegrationRungeKutta2::create(), Nektar::LibUtilities::TimeIntegrationRungeKutta2_ImprovedEuler::create(), Nektar::LibUtilities::TimeIntegrationRungeKutta2_SSP::create(), Nektar::LibUtilities::TimeIntegrationRungeKutta3_SSP::create(), Nektar::LibUtilities::TimeIntegrationClassicalRungeKutta4::create(), Nektar::LibUtilities::TimeIntegrationRungeKutta4::create(), Nektar::LibUtilities::TimeIntegrationDIRKOrder2::create(), Nektar::LibUtilities::TimeIntegrationDIRKOrder3::create(), Nektar::LibUtilities::TimeIntegrationAdamsBashforthOrder2::create(), Nektar::LibUtilities::TimeIntegrationAdamsBashforthOrder3::create(), Nektar::LibUtilities::TimeIntegrationAdamsMoultonOrder2::create(), Nektar::LibUtilities::TimeIntegrationIMEXGear::create(), Nektar::LibUtilities::TimeIntegrationCNAB::create(), Nektar::LibUtilities::TimeIntegrationMCNAB::create(), Nektar::StdRegions::StdExpansion::CreateGeneralMatrix(), Nektar::StdRegions::StdExpansion::CreateIndexMap(), Nektar::LocalRegions::PyrExp::CreateMatrix(), Nektar::LocalRegions::NodalTriExp::CreateMatrix(), Nektar::LocalRegions::TetExp::CreateMatrix(), Nektar::LocalRegions::PrismExp::CreateMatrix(), Nektar::LocalRegions::QuadExp::CreateMatrix(), Nektar::LocalRegions::TriExp::CreateMatrix(), Nektar::LocalRegions::SegExp::CreateMatrix(), Nektar::LocalRegions::HexExp::CreateMatrix(), Nektar::MultiRegions::PreconditionerLowEnergy::CreateRefHexGeom(), Nektar::MultiRegions::PreconditionerLowEnergy::CreateRefPrismGeom(), Nektar::MultiRegions::PreconditionerLowEnergy::CreateRefTetGeom(), Nektar::LocalRegions::PyrExp::CreateStaticCondMatrix(), Nektar::LocalRegions::NodalTriExp::CreateStaticCondMatrix(), Nektar::LocalRegions::TetExp::CreateStaticCondMatrix(), Nektar::LocalRegions::PrismExp::CreateStaticCondMatrix(), Nektar::LocalRegions::QuadExp::CreateStaticCondMatrix(), Nektar::LocalRegions::TriExp::CreateStaticCondMatrix(), Nektar::LocalRegions::SegExp::CreateStaticCondMatrix(), Nektar::LocalRegions::HexExp::CreateStaticCondMatrix(), Nektar::LocalRegions::NodalTriExp::CreateStdMatrix(), Nektar::StdRegions::StdExpansion::CreateStdStaticCondMatrix(), Diffusion::Diffusion(), Nektar::MultiRegions::DisContField2D::DisContField2D(), Nektar::MultiRegions::DisContField3DHomogeneous1D::DisContField3DHomogeneous1D(), Nektar::MultiRegions::DisContField3DHomogeneous2D::DisContField3DHomogeneous2D(), Nektar::SolverUtils::EquationSystem::ErrorExtraPoints(), Nektar::SolverUtils::Forcing::EvaluateFunction(), Nektar::GlobalMapping::Mapping::EvaluateFunction(), Nektar::MultiRegions::DisContField3D::EvaluateHDGPostProcessing(), Nektar::MultiRegions::DisContField2D::EvaluateHDGPostProcessing(), Nektar::MultiRegions::ExpList0D::ExpList0D(), Nektar::MultiRegions::ExpList1D::ExpList1D(), Nektar::MultiRegions::ExpList1DHomogeneous2D::ExpList1DHomogeneous2D(), Nektar::MultiRegions::ExpList2D::ExpList2D(), Nektar::MultiRegions::ExpList2DHomogeneous1D::ExpList2DHomogeneous1D(), Nektar::MultiRegions::ExpList3D::ExpList3D(), Nektar::MultiRegions::ExpList3DHomogeneous1D::ExpList3DHomogeneous1D(), Nektar::MultiRegions::ExpList3DHomogeneous2D::ExpList3DHomogeneous2D(), Nektar::MultiRegions::ExpListHomogeneous1D::ExpListHomogeneous1D(), Nektar::MultiRegions::ExpListHomogeneous2D::ExpListHomogeneous2D(), Nektar::Utilities::ProcessIsoContour::ExtractContour(), Nektar::VortexWaveInteraction::FileRelaxation(), Nektar::FilterBenchmark::FilterBenchmark(), Nektar::SolverUtils::FilterCheckpoint::FilterCheckpoint(), Nektar::FilterCheckpointCellModel::FilterCheckpointCellModel(), Nektar::SolverUtils::FilterModalEnergy::FilterModalEnergy(), Nektar::SolverUtils::FilterSampler::FilterSampler(), Nektar::SolverUtils::FilterThresholdMax::FilterThresholdMax(), Nektar::SolverUtils::FilterThresholdMin::FilterThresholdMin(), Nektar::MultiRegions::DisContField3D::FindPeriodicFaces(), Nektar::MultiRegions::ExpList::GenBlockMatrix(), Nektar::MultiRegions::ExpList::GeneralGetFieldDefinitions(), Nektar::MultiRegions::DisContField3D::GenerateBoundaryConditionExpansion(), Nektar::MultiRegions::DisContField2D::GenerateBoundaryConditionExpansion(), 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::StdNodalTetExp::GenNBasisTransMatrix(), Nektar::StdRegions::StdNodalPrismExp::GenNBasisTransMatrix(), Nektar::StdRegions::StdNodalTriExp::GenNBasisTransMatrix(), Nektar::CoupledLinearNS::GenPressureExp(), Nektar::MultiRegions::DisContField1D::GetDomainBCs(), Nektar::SpatialDomains::MeshGraph2D::GetElementsFromEdge(), Nektar::LinearisedAdvection::GetFloquetBlockMatrix(), Nektar::AdjointAdvection::GetFloquetBlockMatrix(), Nektar::NekMeshUtils::Line::GetGeom(), Nektar::NekMeshUtils::Quadrilateral::GetGeom(), Nektar::NekMeshUtils::Pyramid::GetGeom(), Nektar::NekMeshUtils::Prism::GetGeom(), Nektar::NekMeshUtils::Hexahedron::GetGeom(), Nektar::NekMeshUtils::Tetrahedron::GetGeom(), Nektar::NekMeshUtils::Edge::GetGeom(), Nektar::NekMeshUtils::Node::GetGeom(), Nektar::NekMeshUtils::Triangle::GetGeom(), Nektar::NekMeshUtils::Face::GetGeom(), Nektar::Utilities::ProcessQualityMetric::GetQ(), Nektar::MultiRegions::GetStdExp(), Nektar::MultiRegions::GlobalMatrix::GlobalMatrix(), Nektar::LibUtilities::PtsIO::ImportFieldData(), Nektar::LibUtilities::FieldIO::ImportFieldDefs(), Nektar::LinearisedAdvection::ImportFldBase(), Nektar::AdjointAdvection::ImportFldBase(), Nektar::ForcingMovingBody::InitialiseFilter(), Nektar::LibUtilities::TimeIntegrationScheme::InitializeScheme(), Nektar::StdRegions::StdExpansion::LaplacianMatrixOp_MatFree_GenericImpl(), Nektar::CellModel::LoadCellModel(), main(), Nektar::GlobalMapping::Mapping::Mapping(), Nektar::MultiRegions::MultiLevelBisectedGraph::MultiLevelBisectedGraph(), Nektar::MultiRegions::MultiLevelBisectionReordering(), Nektar::SpatialDomains::MeshGraph3D::PopulateFaceToElMap(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::PrepareLocalSchurComplement(), Nektar::Utilities::InputCAD::Process(), Nektar::Utilities::InputDat::Process(), Nektar::Utilities::InputFld::Process(), Nektar::Utilities::InputXml::Process(), Nektar::Utilities::InputPts::Process(), Nektar::Utilities::ProcessInterpField::Process(), Nektar::Utilities::ProcessSpherigon::Process(), Nektar::Utilities::ProcessInterpPoints::Process(), Nektar::Utilities::OutputPts::Process(), Nektar::Utilities::ProcessMultiShear::Process(), Nektar::Utilities::InputNek::Process(), Nektar::Utilities::ProcessBL::Process(), Nektar::Utilities::ProcessTetSplit::Process(), Nektar::Utilities::ProcessIsoContour::Process(), Nektar::SpatialDomains::MeshGraph::Read(), Nektar::SpatialDomains::BoundaryConditions::ReadBoundaryConditions(), Nektar::SpatialDomains::MeshGraph3D::ReadEdges(), Nektar::SpatialDomains::MeshGraph2D::ReadEdges(), Nektar::SpatialDomains::MeshGraph1D::ReadElements(), Nektar::SpatialDomains::MeshGraph2D::ReadElements(), Nektar::SpatialDomains::MeshGraph3D::ReadFaces(), Nektar::Utilities::Iso::separate_regions(), Nektar::MultiRegions::DisContField1D::SetBoundaryConditionExpansion(), Nektar::SpatialDomains::MeshGraph::SetDomainRange(), Nektar::ForcingMovingBody::SetDynEqCoeffMatrix(), Nektar::SpatialDomains::MeshGraph::SetExpansions(), SetFields(), Nektar::LinearElasticSystem::SetStaticCondBlock(), Nektar::SolverUtils::FilterModalEnergy::SetUpBaseFields(), Nektar::SolverUtils::EquationSystem::SetUpBaseFields(), Nektar::MultiRegions::PreconditionerLowEnergy::SetupBlockTransformationMatrix(), Nektar::MultiRegions::DisContField3DHomogeneous2D::SetupBoundaryConditions(), Nektar::MultiRegions::DisContField3DHomogeneous1D::SetupBoundaryConditions(), Nektar::CoupledLinearNS::SetUpCoupledMatrix(), Nektar::MultiRegions::DisContField3D::SetUpDG(), Nektar::MultiRegions::DisContField2D::SetUpDG(), Nektar::MultiRegions::DisContField1D::SetUpDG(), Nektar::PulseWaveSystem::SetUpDomainInterfaces(), Nektar::Utilities::ProcessEquiSpacedOutput::SetupEquiSpacedField(), Nektar::SpatialDomains::MeshGraph::SetUpExpansionMap(), Nektar::Utilities::ProcessIsoContour::SetupIsoFromFieldPts(), Nektar::MultiRegions::PreconditionerLowEnergy::SetUpReferenceElements(), Nektar::MultiRegions::GlobalLinSysStaticCond::SetupTopLevel(), Nektar::SpatialDomains::PyrGeom::SetUpXmap(), Nektar::SpatialDomains::TetGeom::SetUpXmap(), Nektar::SpatialDomains::PrismGeom::SetUpXmap(), Nektar::SpatialDomains::HexGeom::SetUpXmap(), Nektar::SpatialDomains::SegGeom::SetUpXmap(), Nektar::SpatialDomains::QuadGeom::SetUpXmap(), Nektar::SpatialDomains::TriGeom::SetUpXmap(), Nektar::LibUtilities::TimeIntegrationScheme::TimeIntegrate(), Nektar::SolverUtils::UpdateGeometry(), Nektar::MultiRegions::GlobalLinSysDirectStaticCond::v_AssembleSchurComplement(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_AssembleSchurComplement(), Nektar::LocalRegions::Expansion3D::v_BuildInverseTransformationMatrix(), Nektar::MultiRegions::PreconditionerLinear::v_BuildPreconditioner(), Nektar::MultiRegions::PreconditionerLowEnergy::v_BuildPreconditioner(), Nektar::LocalRegions::Expansion3D::v_BuildTransformationMatrix(), Nektar::LocalRegions::Expansion3D::v_BuildVertexMatrix(), Nektar::LocalRegions::Expansion2D::v_BuildVertexMatrix(), Nektar::LocalRegions::PyrExp::v_CreateStdMatrix(), Nektar::LocalRegions::TetExp::v_CreateStdMatrix(), Nektar::LocalRegions::PrismExp::v_CreateStdMatrix(), Nektar::LocalRegions::TriExp::v_CreateStdMatrix(), Nektar::LocalRegions::QuadExp::v_CreateStdMatrix(), Nektar::LocalRegions::SegExp::v_CreateStdMatrix(), Nektar::LocalRegions::HexExp::v_CreateStdMatrix(), Nektar::SolverUtils::DriverAdaptive::v_Execute(), Nektar::SpatialDomains::TriGeom::v_FillGeom(), Nektar::StdRegions::StdQuadExp::v_FwdTrans_BndConstrained(), Nektar::LocalRegions::TriExp::v_FwdTrans_BndConstrained(), Nektar::LocalRegions::QuadExp::v_FwdTrans_BndConstrained(), Nektar::StdRegions::StdTriExp::v_FwdTrans_BndConstrained(), Nektar::SpatialDomains::PyrGeom::v_GenGeomFactors(), Nektar::SpatialDomains::PrismGeom::v_GenGeomFactors(), Nektar::SpatialDomains::HexGeom::v_GenGeomFactors(), Nektar::SpatialDomains::Geometry3D::v_GenGeomFactors(), Nektar::SpatialDomains::QuadGeom::v_GenGeomFactors(), Nektar::SpatialDomains::SegGeom::v_GenGeomFactors(), Nektar::SpatialDomains::TriGeom::v_GenGeomFactors(), Nektar::LocalRegions::Expansion1D::v_GenMatrix(), Nektar::StdRegions::StdPointExp::v_GenMatrix(), Nektar::LocalRegions::Expansion3D::v_GenMatrix(), Nektar::LocalRegions::Expansion2D::v_GenMatrix(), Nektar::StdRegions::StdQuadExp::v_GenMatrix(), Nektar::StdRegions::StdTriExp::v_GenMatrix(), Nektar::StdRegions::StdSegExp::v_GenMatrix(), Nektar::StdRegions::StdPrismExp::v_GenMatrix(), Nektar::StdRegions::StdTetExp::v_GenMatrix(), Nektar::MultiRegions::GlobalLinSys::v_GetBlock(), Nektar::MultiRegions::DisContField3DHomogeneous2D::v_GetBndElmtExpansion(), Nektar::MultiRegions::DisContField3DHomogeneous1D::v_GetBndElmtExpansion(), Nektar::MultiRegions::DisContField3D::v_GetBndElmtExpansion(), Nektar::MultiRegions::DisContField2D::v_GetBndElmtExpansion(), Nektar::MultiRegions::DisContField1D::v_GetBndElmtExpansion(), Nektar::MultiRegions::DisContField1D::v_GetRobinBCInfo(), Nektar::MultiRegions::DisContField3D::v_GetRobinBCInfo(), Nektar::MultiRegions::DisContField2D::v_GetRobinBCInfo(), Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_GetStaticCondBlock(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_GetStaticCondBlock(), Nektar::MultiRegions::GlobalLinSys::v_GetStaticCondBlock(), Nektar::LocalRegions::PyrExp::v_GetStdExp(), Nektar::LocalRegions::TetExp::v_GetStdExp(), Nektar::LocalRegions::PrismExp::v_GetStdExp(), Nektar::LocalRegions::TriExp::v_GetStdExp(), Nektar::LocalRegions::QuadExp::v_GetStdExp(), Nektar::LocalRegions::HexExp::v_GetStdExp(), Nektar::LocalRegions::SegExp::v_GetStdExp(), Nektar::LocalRegions::NodalTriExp::v_GetStdExp(), Nektar::SolverUtils::FilterHistoryPoints::v_Initialise(), Nektar::FilterElectrogram::v_Initialise(), Nektar::SolverUtils::ForcingBody::v_InitObject(), Nektar::SolverUtils::Diffusion3DHomogeneous1D::v_InitObject(), Nektar::ImageWarpingSystem::v_InitObject(), Nektar::SolverUtils::Advection3DHomogeneous1D::v_InitObject(), Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_InitObject(), Nektar::LinearElasticSystem::v_InitObject(), Nektar::LinearisedAdvection::v_InitObject(), Nektar::AdjointAdvection::v_InitObject(), Nektar::PulseWaveSystem::v_InitObject(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_InitObject(), Nektar::CoupledLinearNS::v_InitObject(), Nektar::SolverUtils::EquationSystem::v_InitObject(), Nektar::MultiRegions::AssemblyMapCG::v_LinearSpaceMap(), Nektar::MultiRegions::ExpList3D::v_ReadGlobalOptimizationParameters(), Nektar::MultiRegions::ExpList2D::v_ReadGlobalOptimizationParameters(), Nektar::StdRegions::StdTriExp::v_ReduceOrderCoeffs(), Nektar::StdRegions::StdPrismExp::v_ReduceOrderCoeffs(), Nektar::StdRegions::StdTetExp::v_ReduceOrderCoeffs(), Nektar::LocalRegions::TriExp::v_ReduceOrderCoeffs(), and Nektar::MultiRegions::PreconditionerLowEnergy::v_TransformedSchurCompl().

236  {
237  return AllocateSharedPtrD(DefaultCustomDeallocator());
238  }
template<typename DataType>
Nektar::MemoryManager< DataType >::BOOST_PP_REPEAT_FROM_TO ( ,
NEKTAR_MAX_MEMORY_MANAGER_CONSTRUCTOR_ARGS  ,
ALLOCATE_METHOD_GENERATOR  ,
Allocate   
)
template<typename DataType>
Nektar::MemoryManager< DataType >::BOOST_PP_REPEAT_FROM_TO ( ,
NEKTAR_MAX_MEMORY_MANAGER_CONSTRUCTOR_ARGS  ,
ALLOCATE_SHARED_PTR_METHOD_WITH_DEALLOCATOR_GENERATOR  ,
AllocateSharedPtrD   
)
template<typename DataType>
Nektar::MemoryManager< DataType >::BOOST_PP_REPEAT_FROM_TO ( ,
NEKTAR_MAX_MEMORY_MANAGER_CONSTRUCTOR_ARGS  ,
ALLOCATE_SHARED_PTR_METHOD_GENERATOR  ,
AllocateSharedPtr   
)
template<typename DataType>
void Nektar::MemoryManager< DataType >::construct ( pointer  p,
const_reference  val 
)
inline

Definition at line 348 of file NekMemoryManager.hpp.

349  {
350  new(p) DataType(val);
351  }
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 147 of file NekMemoryManager.hpp.

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

Referenced by Nektar::MemoryManager< DataType >::DeallocateSharedPtr< ObjectType, CustomDeallocator >::operator()().

148  {
149  #ifdef NEKTAR_MEMORY_POOL_ENABLED
150  data->~DataType();
151  GetMemoryPool().Deallocate(data, sizeof(DataType));
152  #else //NEKTAR_MEMORY_POOL_ENABLED
153  delete data;
154  #endif //NEKTAR_MEMORY_POOL_ENABLED
155 
156  data = NULL;
157  }
void Deallocate(void *p, size_t bytes)
Deallocate memory claimed by an earlier call to allocate.
MemPool & GetMemoryPool()
template<typename DataType>
void Nektar::MemoryManager< DataType >::deallocate ( pointer  p,
size_type  n 
)
inline

Definition at line 343 of file NekMemoryManager.hpp.

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

344  {
345  return RawDeallocate(p, n);
346  }
static void RawDeallocate(DataType *array, unsigned int NumberOfElements)
Deallocates memory allocated from RawAllocate.
template<typename DataType>
void Nektar::MemoryManager< DataType >::destroy ( pointer  p)
inline

Definition at line 353 of file NekMemoryManager.hpp.

354  {
355  p->~DataType();
356  }
template<typename DataType>
size_type Nektar::MemoryManager< DataType >::max_size ( )
inline

Definition at line 358 of file NekMemoryManager.hpp.

359  {
360  return std::numeric_limits<size_type>::max()/sizeof(DataType);
361  }
template<typename DataType>
static DataType* Nektar::MemoryManager< DataType >::RawAllocate ( unsigned int  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 290 of file NekMemoryManager.hpp.

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

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

291  {
292  #ifdef NEKTAR_MEMORY_POOL_ENABLED
293  return static_cast<DataType*>(GetMemoryPool().Allocate(sizeof(DataType)*NumberOfElements));
294  #else //NEKTAR_MEMORY_POOL_ENABLED
295  return static_cast<DataType*>(::operator new(NumberOfElements * sizeof(DataType)));
296  #endif //NEKTAR_MEMORY_POOL_ENABLED
297  }
void * Allocate(size_t bytes)
Allocate a block of memory of size ByteSize.
MemPool & GetMemoryPool()
template<typename DataType>
static void Nektar::MemoryManager< DataType >::RawDeallocate ( DataType *  array,
unsigned int  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 306 of file NekMemoryManager.hpp.

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

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

307  {
308  #ifdef NEKTAR_MEMORY_POOL_ENABLED
309  GetMemoryPool().Deallocate(array, sizeof(DataType)*NumberOfElements);
310  #else //NEKTAR_MEMORY_POOL_ENABLED
311  ::operator delete(array);
312  #endif //NEKTAR_MEMORY_POOL_ENABLED
313 
314  }
void Deallocate(void *p, size_t bytes)
Deallocate memory claimed by an earlier call to allocate.
MemPool & GetMemoryPool()