Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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::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::Utilities::ProcessBL::BoundaryLayer2D(), Nektar::Utilities::ProcessBL::BoundaryLayer3D(), Nektar::LinearElasticSystem::BuildLaplacianIJMatrix(), Nektar::SolverUtils::FilterAeroForces::CalculateForcesMapping(), Nektar::LibUtilities::NodalTriElec::CalculatePoints(), Nektar::LibUtilities::NodalPrismElec::CalculatePoints(), Nektar::LibUtilities::NodalTriEvenlySpaced::CalculatePoints(), Nektar::LibUtilities::NodalTriFekete::CalculatePoints(), Nektar::LibUtilities::NodalTetElec::CalculatePoints(), Nektar::LibUtilities::NodalPrismEvenlySpaced::CalculatePoints(), Nektar::LibUtilities::NodalTetEvenlySpaced::CalculatePoints(), Nektar::CFSBndCond::CFSBndCond(), Nektar::NekMeshUtils::BPoint::ChangeType(), 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::PanditGilesDemir03::create(), Nektar::Fox02::create(), Nektar::FentonKarma::create(), Nektar::LuoRudy91::create(), Nektar::CourtemancheRamirezNattel98::create(), Nektar::CellModelAlievPanfilov::create(), Nektar::SteadyAdvectionDiffusionReaction::create(), Nektar::TenTusscher06::create(), Nektar::VelocityCorrectionScheme::create(), Nektar::VCSWeakPressure::create(), Nektar::CellModelFitzHughNagumo::create(), Nektar::Winslow99::create(), Nektar::Poisson::create(), Nektar::Helmholtz::create(), Nektar::VCSMapping::create(), Nektar::Utilities::OutputSTL::create(), Nektar::EulerCFE::create(), Nektar::Utilities::ProcessCyl::create(), Nektar::FieldUtils::ProcessDeform::create(), Nektar::FieldUtils::ProcessDisplacement::create(), Nektar::NekMeshUtils::HOSurfaceMesh::create(), Nektar::NekMeshUtils::ProcessLoadCAD::create(), Nektar::NekMeshUtils::ProcessLoadOctree::create(), Nektar::Utilities::ProcessOptiExtract::create(), Nektar::Utilities::ProcessPerAlign::create(), Nektar::Utilities::InputTec::create(), Nektar::ProtocolS1S2::create(), Nektar::IsentropicVortex::create(), Nektar::RinglebFlow::create(), Nektar::SteadyAdvectionDiffusion::create(), Nektar::FilterEnergy::create(), Nektar::NoAdvection::create(), Nektar::NekMeshUtils::VolumeMesh::create(), Nektar::FieldUtils::OutputStdOut::create(), Nektar::Utilities::OutputVtk::create(), Nektar::FieldUtils::OutputXml::create(), Nektar::EigenValuesAdvection::create(), Nektar::NekMeshUtils::CADCurveOCE::create(), Nektar::NekMeshUtils::CADSurfOCE::create(), Nektar::FieldUtils::ProcessJacobianEnergy::create(), Nektar::ImageWarpingSystem::create(), Nektar::NekMeshUtils::CADVertOCE::create(), Nektar::FieldUtils::ProcessQualityMetric::create(), Nektar::Utilities::InputPly::create(), Nektar::ProtocolS1::create(), Nektar::ProtocolSingle::create(), Nektar::NekMeshUtils::CADSystemOCE::create(), Nektar::Utilities::InputSwan::create(), Nektar::Utilities::InputVtk::create(), Nektar::SolverUtils::FilterAverageFields::create(), Nektar::AlternateSkewAdvection::create(), Nektar::FilterBenchmark::create(), Nektar::FilterCellHistoryPoints::create(), Nektar::SolverUtils::FilterCheckpoint::create(), Nektar::FilterCheckpointCellModel::create(), Nektar::LibUtilities::MeshPartitionMetis::create(), Nektar::FilterElectrogram::create(), Nektar::SolverUtils::FilterReynoldsStresses::create(), Nektar::UnsteadyAdvection::create(), Nektar::UnsteadyInviscidBurger::create(), Nektar::FieldUtils::OutputInfo::create(), Nektar::FieldUtils::OutputPts::create(), Nektar::FieldUtils::OutputVtk::create(), Nektar::SolverUtils::FilterThresholdMin::create(), Nektar::SolverUtils::DriverStandard::create(), Nektar::MultiRegions::GlobalLinSysIterativeFull::create(), Nektar::Utilities::ProcessCurve::create(), Nektar::Utilities::ProcessExtrude::create(), Nektar::Utilities::ProcessSpherigon::create(), Nektar::Projection::create(), Nektar::Utilities::InputStar::create(), Nektar::Laplace::create(), Nektar::SkewSymmetricAdvection::create(), Nektar::FieldUtils::OutputFld::create(), Nektar::NavierStokesAdvection::create(), Nektar::SolverUtils::FilterHistoryPoints::create(), Nektar::SolverUtils::FilterMovingAverage::create(), Nektar::AdjointAdvection::create(), Nektar::SolverUtils::FilterThresholdMax::create(), Nektar::UnsteadyDiffusion::create(), Nektar::UnsteadyAdvectionDiffusion::create(), Nektar::SolverUtils::DriverModifiedArnoldi::create(), Nektar::MultiRegions::PreconditionerLinearWithBlock::create(), Nektar::MultiRegions::PreconditionerLinearWithLowEnergy::create(), Nektar::FieldUtils::ProcessBoundaryExtract::create(), Nektar::FieldUtils::ProcessConcatenateFld::create(), Nektar::FieldUtils::ProcessEquiSpacedOutput::create(), Nektar::FieldUtils::ProcessInterpField::create(), Nektar::Utilities::ProcessLinear::create(), Nektar::FieldUtils::ProcessNumModes::create(), Nektar::FieldUtils::ProcessVorticity::create(), Nektar::PulseWavePropagation::create(), Nektar::SolverUtils::FilterAeroForces::create(), Nektar::LibUtilities::MeshPartitionScotch::create(), Nektar::NavierStokesCFE::create(), Nektar::Utilities::OutputNekpp::create(), Nektar::MultiRegions::PreconditionerDiagonal::create(), Nektar::ForcingStabilityCoupledLNS::create(), Nektar::FieldUtils::ProcessAddFld::create(), Nektar::FieldUtils::ProcessAddCompositeID::create(), Nektar::FieldUtils::ProcessC0Projection::create(), Nektar::BidomainRoth::create(), Nektar::FieldUtils::ProcessGrad::create(), Nektar::FieldUtils::ProcessHomogeneousPlane::create(), Nektar::FieldUtils::ProcessHomogeneousStretch::create(), Nektar::FieldUtils::ProcessInnerProduct::create(), Nektar::FieldUtils::ProcessMeanMode::create(), Nektar::FieldUtils::ProcessMultiShear::create(), Nektar::FieldUtils::ProcessQCriterion::create(), Nektar::FieldUtils::ProcessPrintFldNorms::create(), Nektar::FieldUtils::ProcessScalGrad::create(), Nektar::FieldUtils::ProcessScaleInFld::create(), Nektar::FieldUtils::ProcessSurfDistance::create(), Nektar::Utilities::InputMCF::create(), Nektar::FieldUtils::ProcessWSS::create(), Nektar::PulseWaveSystemOutput::create(), Nektar::ShallowWaterSystem::create(), Nektar::StimulusPoint::create(), Nektar::StimulusRect::create(), Nektar::SolverUtils::DriverAdaptive::create(), Nektar::Bidomain::create(), Nektar::SolverUtils::DriverSteadyState::create(), Nektar::MultiRegions::PreconditionerLinearWithDiag::create(), Nektar::FieldUtils::ProcessCombineAvg::create(), Nektar::FieldUtils::ProcessInterpPointDataToFld::create(), Nektar::FieldUtils::ProcessInterpPoints::create(), Nektar::ArterialPressureArea::create(), Nektar::FieldUtils::ProcessMapping::create(), Nektar::FieldUtils::InputDat::create(), Nektar::FieldUtils::ProcessPointDataToFld::create(), Nektar::QInflow::create(), Nektar::IsentropicVortexBC::create(), Nektar::RCROutflow::create(), Nektar::UnsteadyViscousBurgers::create(), Nektar::RinglebFlowBC::create(), Nektar::ROutflow::create(), Nektar::LymphaticPressureArea::create(), Nektar::WallViscousBC::create(), Nektar::SubSteppingExtrapolateWeakPressure::create(), Nektar::SymmetryBC::create(), Nektar::TerminalOutflow::create(), Nektar::TimeDependentBC::create(), Nektar::TimeDependentInflow::create(), Nektar::SolverUtils::FilterFieldConvert::create(), Nektar::WallBC::create(), Nektar::UndefinedInOutflow::create(), Nektar::SolverUtils::DriverArpack::create(), Nektar::MultiRegions::PreconditionerBlock::create(), Nektar::MultiRegions::GlobalLinSysDirectFull::create(), Nektar::PressureOutflowBC::create(), Nektar::PressureOutflowFileBC::create(), Nektar::Utilities::ProcessBL::create(), Nektar::Utilities::ProcessDetectSurf::create(), Nektar::NonSmoothShockCapture::create(), Nektar::Utilities::ProcessExtractSurf::create(), Nektar::MultiRegions::GlobalLinSysXxtFull::create(), Nektar::Utilities::ProcessInsertSurface::create(), Nektar::Utilities::ProcessJac::create(), Nektar::Utilities::ProcessLinkCheck::create(), Nektar::Utilities::ProcessScalar::create(), Nektar::Utilities::ProcessTetSplit::create(), Nektar::RiemannInvariantBC::create(), Nektar::LinearSWE::create(), Nektar::SmoothShockCapture::create(), Nektar::ExtrapOrder0BC::create(), Nektar::MappingExtrapolate::create(), Nektar::NekMeshUtils::SurfaceMesh::create(), Nektar::Monodomain::create(), Nektar::NonlinearSWE::create(), Nektar::SolverUtils::ForcingAbsorption::create(), Nektar::ForcingMovingBody::create(), Nektar::APE::create(), Nektar::MultiRegions::PreconditionerLowEnergy::create(), Nektar::PressureOutflowNonReflectiveBC::create(), Nektar::FieldUtils::InputFld::create(), Nektar::Utilities::InputGmsh::create(), Nektar::FieldUtils::InputNek5000::create(), Nektar::Utilities::InputNekpp::create(), Nektar::NekMeshUtils::Generator2D::create(), Nektar::FieldUtils::InputPts::create(), Nektar::Utilities::InputSem::create(), Nektar::FieldUtils::InputXml::create(), Nektar::StimulusCirc::create(), Nektar::FilterMovingBody::create(), Nektar::SolverUtils::ForcingNoise::create(), Nektar::PressureInflowFileBC::create(), Nektar::MultiRegions::GlobalLinSysPETScFull::create(), Nektar::SolverUtils::ForcingBody::create(), Nektar::MultiRegions::GlobalLinSysDirectStaticCond::create(), Nektar::LibUtilities::CommSerial::create(), Nektar::GlobalMapping::MappingXYofZ::create(), Nektar::SolverUtils::FilterEnergy1D::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::Utilities::InputNek5000::create(), Nektar::StandardExtrapolate::create(), Nektar::SubSteppingExtrapolate::create(), Nektar::WeakPressureExtrapolate::create(), Nektar::SolverUtils::FilterModalEnergy::create(), Nektar::SolverUtils::ForcingProgrammatic::create(), Nektar::LinearisedAdvection::create(), Nektar::FieldUtils::OutputTecplot::create(), Nektar::LibUtilities::CommMpi::create(), Nektar::LibUtilities::NekFFTW::create(), Nektar::Utilities::InputNek::create(), Nektar::Utilities::OutputGmsh::create(), Nektar::CFLtester::create(), Nektar::Utilities::ProcessVarOpti::create(), Nektar::CoupledLinearNS::create(), Nektar::MultiRegions::PreconditionerNull::create(), Nektar::FieldUtils::OutputTecplotBinary::create(), Nektar::LibUtilities::TimeIntegrationIMEXOrder1::create(), Nektar::LibUtilities::TimeIntegrationIMEXOrder2::create(), Nektar::LibUtilities::TimeIntegrationIMEXOrder3::create(), Nektar::LibUtilities::FieldIOXml::create(), Nektar::LibUtilities::TimeIntegrationIMEXdirk_1_1_1::create(), Nektar::LibUtilities::FieldIOHdf5::create(), Nektar::LibUtilities::TimeIntegrationIMEXdirk_1_2_1::create(), Nektar::FieldUtils::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(), Nektar::MultiRegions::DisContField2D::DisContField2D(), Nektar::MultiRegions::DisContField3DHomogeneous1D::DisContField3DHomogeneous1D(), Nektar::MultiRegions::DisContField3DHomogeneous2D::DisContField3DHomogeneous2D(), Nektar::SolverUtils::EquationSystem::ErrorExtraPoints(), Nektar::Utilities::ProcessCurve::EvaluateCoordinate(), 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::FieldUtils::ProcessIsoContour::ExtractContour(), Nektar::VortexWaveInteraction::FileRelaxation(), Nektar::MultiRegions::DisContField3D::FindPeriodicFaces(), Nektar::MultiRegions::ExpList::GenBlockMatrix(), Nektar::MultiRegions::ExpList::GeneralGetFieldDefinitions(), Nektar::MultiRegions::DisContField3D::GenerateBoundaryConditionExpansion(), Nektar::MultiRegions::DisContField2D::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::StdNodalTriExp::GenNBasisTransMatrix(), Nektar::StdRegions::StdNodalTetExp::GenNBasisTransMatrix(), Nektar::StdRegions::StdNodalPrismExp::GenNBasisTransMatrix(), Nektar::CoupledLinearNS::GenPressureExp(), Nektar::MultiRegions::DisContField1D::GetDomainBCs(), Nektar::SpatialDomains::MeshGraph2D::GetElementsFromEdge(), Nektar::LinearisedAdvection::GetFloquetBlockMatrix(), Nektar::NekMeshUtils::Pyramid::GetGeom(), Nektar::NekMeshUtils::Quadrilateral::GetGeom(), Nektar::NekMeshUtils::Prism::GetGeom(), Nektar::NekMeshUtils::Line::GetGeom(), Nektar::NekMeshUtils::Tetrahedron::GetGeom(), Nektar::NekMeshUtils::Triangle::GetGeom(), Nektar::NekMeshUtils::Hexahedron::GetGeom(), Nektar::NekMeshUtils::Edge::GetGeom(), Nektar::NekMeshUtils::Face::GetGeom(), Nektar::NekMeshUtils::Node::GetGeom(), Nektar::FieldUtils::ProcessQualityMetric::GetQ(), Nektar::MultiRegions::GetStdExp(), Nektar::MultiRegions::GlobalMatrix::GlobalMatrix(), Nektar::LibUtilities::PtsIO::ImportFieldData(), Nektar::LibUtilities::FieldIOXml::ImportFieldDefs(), Nektar::ForcingMovingBody::InitialiseFilter(), Nektar::LibUtilities::TimeIntegrationScheme::InitializeScheme(), Nektar::StdRegions::StdExpansion::LaplacianMatrixOp_MatFree_GenericImpl(), Nektar::SolverUtils::EquationSystem::LoadPts(), main(), Nektar::NekMeshUtils::Generator2D::MakeBL(), Nektar::MultiRegions::MultiLevelBisectedGraph::MultiLevelBisectedGraph(), Nektar::MultiRegions::MultiLevelBisectionReordering(), Nektar::SpatialDomains::MeshGraph3D::PopulateFaceToElMap(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::PrepareLocalSchurComplement(), Nektar::FieldUtils::InputDat::Process(), Nektar::FieldUtils::InputPts::Process(), Nektar::FieldUtils::InputXml::Process(), Nektar::NekMeshUtils::VolumeMesh::Process(), Nektar::NekMeshUtils::HOSurfaceMesh::Process(), Nektar::NekMeshUtils::ProcessLoadOctree::Process(), Nektar::Utilities::InputNek5000::Process(), Nektar::FieldUtils::ProcessDisplacement::Process(), Nektar::Utilities::ProcessSpherigon::Process(), Nektar::FieldUtils::OutputPts::Process(), Nektar::FieldUtils::ProcessInterpField::Process(), Nektar::FieldUtils::ProcessHomogeneousPlane::Process(), Nektar::Utilities::InputNek::Process(), Nektar::FieldUtils::ProcessInterpPoints::Process(), Nektar::FieldUtils::ProcessInterpPointDataToFld::Process(), Nektar::NekMeshUtils::SurfaceMesh::Process(), Nektar::NekMeshUtils::Generator2D::Process(), Nektar::Utilities::ProcessTetSplit::Process(), Nektar::FieldUtils::ProcessIsoContour::Process(), Nektar::SpatialDomains::MeshGraph::Read(), Nektar::SpatialDomains::MeshGraph3D::ReadEdges(), Nektar::SpatialDomains::MeshGraph2D::ReadEdges(), Nektar::SpatialDomains::MeshGraph1D::ReadElements(), Nektar::SpatialDomains::MeshGraph2D::ReadElements(), Nektar::SpatialDomains::MeshGraph3D::ReadFaces(), Nektar::FieldUtils::Iso::SeparateRegions(), Nektar::MultiRegions::DisContField1D::SetBoundaryConditionExpansion(), Nektar::SpatialDomains::MeshGraph::SetDomainRange(), Nektar::ForcingMovingBody::SetDynEqCoeffMatrix(), 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::FieldUtils::ProcessEquiSpacedOutput::SetupEquiSpacedField(), Nektar::SpatialDomains::MeshGraph::SetUpExpansionMap(), Nektar::FieldUtils::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::Extrapolate::UpdateRobinPrimCoeff(), Nektar::MultiRegions::GlobalLinSysDirectStaticCond::v_AssembleSchurComplement(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_AssembleSchurComplement(), Nektar::MultiRegions::PreconditionerLinear::v_BuildPreconditioner(), Nektar::MultiRegions::PreconditionerLowEnergy::v_BuildPreconditioner(), 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::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::Utilities::NodalUtilTriMonomial::v_CreateUtil(), 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::Utilities::ProcessCurve::v_GenerateEdgeNodes(), 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::StdRegions::StdPointExp::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::LocalRegions::PyrExp::v_GetLinStdExp(), Nektar::LocalRegions::TetExp::v_GetLinStdExp(), Nektar::LocalRegions::PrismExp::v_GetLinStdExp(), Nektar::LocalRegions::TriExp::v_GetLinStdExp(), Nektar::LocalRegions::QuadExp::v_GetLinStdExp(), Nektar::LocalRegions::HexExp::v_GetLinStdExp(), Nektar::LocalRegions::SegExp::v_GetLinStdExp(), Nektar::LocalRegions::NodalTriExp::v_GetLinStdExp(), 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::LibUtilities::FieldIOHdf5::v_Import(), Nektar::SolverUtils::FilterHistoryPoints::v_Initialise(), Nektar::FilterElectrogram::v_Initialise(), Nektar::SolverUtils::ForcingBody::v_InitObject(), Nektar::ImageWarpingSystem::v_InitObject(), Nektar::SolverUtils::Advection3DHomogeneous1D::v_InitObject(), Nektar::APE::v_InitObject(), Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_InitObject(), Nektar::CompressibleFlowSystem::v_InitObject(), Nektar::LinearElasticSystem::v_InitObject(), Nektar::LinearisedAdvection::v_InitObject(), Nektar::PulseWaveSystem::v_InitObject(), Nektar::IncNavierStokes::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.

References CellMLToNektar.cellml_metadata::p.

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()