NeoPZ
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TPZManVector< T, NumExtAlloc > Class Template Reference

Implements a vector class which allows to use external storage provided by the user. Utility. More...

#include <pzquad.h>

Inheritance diagram for TPZManVector< T, NumExtAlloc >:
[legend]
Collaboration diagram for TPZManVector< T, NumExtAlloc >:
[legend]

Public Member Functions

 TPZManVector (const int64_t size=0)
 Creates a vector of a given size. More...
 
 TPZManVector (const int64_t size, const T &copy)
 Creates a vector of a given size, filling it. More...
 
 TPZManVector (const TPZManVector< T, NumExtAlloc > &copy)
 Copy constructor. More...
 
 TPZManVector (const TPZVec< T > &copy)
 
 TPZManVector (const std::initializer_list< T > &list)
 Creates a vector from a initializer list. More...
 
TPZManVector< T, NumExtAlloc > & operator= (const TPZManVector< T, NumExtAlloc > &copy)
 Assignment operator. More...
 
TPZManVector< T, NumExtAlloc > & operator= (const std::initializer_list< T > &list)
 initializer list assignment operator More...
 
virtual ~TPZManVector ()
 Destructor. More...
 
int NAlloc () const
 Returns number of elements allocated for this object. More...
 
void Expand (const int64_t newsize)
 Expands the allocated storage to fit the newsize parameter. More...
 
void Shrink ()
 It reallocates storage to fit the necessary storage exactly. More...
 
virtual void Resize (const int64_t newsize, const T &object)
 Resizes the vector object. More...
 
virtual void Resize (const int64_t newsize)
 Resizes the vector object reallocating the storage if necessary. More...
 
- Public Member Functions inherited from TPZVec< T >
 TPZVec ()
 Creates a vector with size 0. More...
 
 TPZVec (const int64_t size)
 Creates a vector of a given size. More...
 
 TPZVec (const int64_t size, const T &copy)
 Creates a vector of a given size. More...
 
 TPZVec (const TPZVec< T > &copy)
 Creates a vector with copy constructor.
will call the empty constructor on all objects of type T created. More...
 
 TPZVec (const std::initializer_list< T > &list)
 Creates a vector from a initializer list. More...
 
virtual ~TPZVec ()
 destructor, will delete the storage allocated More...
 
void MigratePages ()
 
void ReallocForNuma ()
 
TPZVec< T > & operator= (const TPZVec< T > &copy)
 will copy the vector into the current vector. More...
 
TPZVec< T > & operator= (const std::initializer_list< T > &list)
 create a new vector and stores in the current vector More...
 
TPZVec< T > & operator= (const T &a)
 Operator attribution. Fills the vector with a value of type T. More...
 
T & operator[] (const int64_t index) const
 Access operator, will perform bounds checking unless the variable NODEBUG is defined. More...
 
T * begin () const
 Casting operator. Returns The fStore pointer. More...
 
T * end () const
 Returns a pointer to the last+1 element. More...
 
void Fill (const T &copy, const int64_t from=0, const int64_t numelem=-1)
 Will fill the elements of the vector with a copy object. More...
 
int64_t NElements () const
 Returns the number of elements of the vector. More...
 
int64_t size () const
 Returns the number of elements of the vector. More...
 
virtual void resize (const int64_t newsize)
 
void Print (std::ostream &out=std::cout)
 Prints the structural information of the vector object to the output stream.
This method will not print the objects themselves! More...
 
virtual void clear ()
 Empty the vector, make its size zero. More...
 

Private Member Functions

int64_t ExpandSize (const int64_t proposed) const
 Returns a suggested size for expanding the storage to fit the required storage. More...
 

Private Attributes

int fNAlloc
 Number of elements allocated for this object. More...
 
fExtAlloc [NumExtAlloc]
 Pointer to the externally allocated space. More...
 

Additional Inherited Members

- Protected Attributes inherited from TPZVec< T >
T * fStore
 Allocated storage for the vector object. More...
 
int64_t fNElements
 Number of elements of the vector object. More...
 

Detailed Description

template<class T, int NumExtAlloc = DEFAULTVEC_ALLOC>
class TPZManVector< T, NumExtAlloc >

Implements a vector class which allows to use external storage provided by the user. Utility.

See also
Shrink The external storage will be used if the number of elements of the external storage is
greater than or equal to the number of elements the object needs. When changing the size
of the object, this class will only allocate new storage area if the storage currently allocated
is insufficient to the hold the object.
This makes the resize method more efficient in terms of dynamic memory allocation the Shrink method
will reallocate the storage to fit the number of elements exactly.

Definition at line 16 of file pzquad.h.

Constructor & Destructor Documentation

◆ TPZManVector() [1/5]

template<class T , int NumExtAlloc>
TPZManVector< T, NumExtAlloc >::TPZManVector ( const int64_t  size = 0)

Creates a vector of a given size.

Parameters
sizeSize of the new vector. It will call the empty constructor on all objects of type T.

Definition at line 152 of file pzmanvector.h.

◆ TPZManVector() [2/5]

template<class T, int NumExtAlloc>
TPZManVector< T, NumExtAlloc >::TPZManVector ( const int64_t  size,
const T &  copy 
)

Creates a vector of a given size, filling it.

Parameters
sizeSize of the new vector.
copyModel object to initialize the other objects. It will call the empty constructor on all objects of type T created. Copies the object copy to all elements.

Definition at line 175 of file pzmanvector.h.

◆ TPZManVector() [3/5]

template<class T, int NumExtAlloc>
TPZManVector< T, NumExtAlloc >::TPZManVector ( const TPZManVector< T, NumExtAlloc > &  copy)
inline

Copy constructor.

Parameters
copyOriginal vector.It will call the empty constructor on all objects of type T created.

Definition at line 203 of file pzmanvector.h.

◆ TPZManVector() [4/5]

template<class T, int NumExtAlloc>
TPZManVector< T, NumExtAlloc >::TPZManVector ( const TPZVec< T > &  copy)
inline

Definition at line 230 of file pzmanvector.h.

◆ TPZManVector() [5/5]

template<class T, int NumExtAlloc>
TPZManVector< T, NumExtAlloc >::TPZManVector ( const std::initializer_list< T > &  list)
inline

Creates a vector from a initializer list.

Parameters
listthe initializer list, usually enclosed in curly brackets

Definition at line 258 of file pzmanvector.h.

◆ ~TPZManVector()

template<class T , int NumExtAlloc>
TPZManVector< T, NumExtAlloc >::~TPZManVector ( )
virtual

Destructor.

Deletes the storage allocated.

Definition at line 357 of file pzmanvector.h.

Member Function Documentation

◆ Expand()

template<class T , int NumExtAlloc>
void TPZManVector< T, NumExtAlloc >::Expand ( const int64_t  newsize)

Expands the allocated storage to fit the newsize parameter.

Parameters
newsizeStorage size which is requested.Does nothing if the externally provided storage is larger than newsize. Does not change the size of the vector.

Definition at line 367 of file pzmanvector.h.

Referenced by TPZTransfer< TVar >::ExpandColumnVectorEntries(), TPZTransfer< TVar >::ExpandDoubleValueEntries(), TPZManVector< TPZPostProcVar, 20 >::NAlloc(), and TPZStack< int, 100 >::TPZStack().

◆ ExpandSize()

template<class T , int NumExtAlloc>
int64_t TPZManVector< T, NumExtAlloc >::ExpandSize ( const int64_t  proposed) const
private

Returns a suggested size for expanding the storage to fit the required storage.

Parameters
proposedStorage needed for the new vector.
Returns
Expansion size which is suggested. It suggests to expand the storage size at least 20%. This method will not expand the allocated storage size.

Definition at line 527 of file pzmanvector.h.

Referenced by TPZManVector< TPZPostProcVar, 20 >::NAlloc(), and TPZManVector< TPZPostProcVar, 20 >::Resize().

◆ NAlloc()

template<class T, int NumExtAlloc = DEFAULTVEC_ALLOC>
int TPZManVector< T, NumExtAlloc >::NAlloc ( ) const
inline

Returns number of elements allocated for this object.

Definition at line 92 of file pzmanvector.h.

Referenced by TPZTransfer< TVar >::ExpandColumnVectorEntries(), and TPZTransfer< TVar >::ExpandDoubleValueEntries().

◆ operator=() [1/2]

template<class T, int NumExtAlloc>
TPZManVector< T, NumExtAlloc > & TPZManVector< T, NumExtAlloc >::operator= ( const TPZManVector< T, NumExtAlloc > &  copy)

Assignment operator.

Parameters
copyVector which will be copied.
Returns
Reference to the current object. It first deletes the allocated storage before allocating storage for the copy only if necessary (when there is no preallocated storage or when the current storage cannot hold the copied vector

Definition at line 285 of file pzmanvector.h.

◆ operator=() [2/2]

template<class T, int NumExtAlloc>
TPZManVector< T, NumExtAlloc > & TPZManVector< T, NumExtAlloc >::operator= ( const std::initializer_list< T > &  list)

initializer list assignment operator

Parameters
listlist which will be assigned, usually wrapped in curly brackets
Returns
Reference to the current object

Definition at line 322 of file pzmanvector.h.

◆ Resize() [1/2]

template<class T, int NumExtAlloc>
void TPZManVector< T, NumExtAlloc >::Resize ( const int64_t  newsize,
const T &  object 
)
virtual

Resizes the vector object.

See also
TPZVec<T>::Resize(const int, const T&)
Parameters
newsizeSize of the vector.
objectObject used to initialize the new members. It reallocates storage if necessary, and copies the existing objects onto the new storage.

Reimplemented from TPZVec< T >.

Definition at line 426 of file pzmanvector.h.

Referenced by TPZElementGroup::AddElement(), TPZSBFemElementGroup::AddElement(), TPZMultiphysicsCompEl< TGeometry >::AddElement(), TPZCompMesh::AdjustBoundaryElements(), TPZInterpolatedElement::AdjustPreferredSideOrder(), TPZSubCompMesh::AllocateNewConnect(), TPZElementMatrix::ApplyConstraints(), TPZCompMesh::BandWidth(), TPZMatLaplacian::BCInterfaceJump(), TPZMatPoisson3d::BCInterfaceJump(), TPZCompEl::BuildConnectList(), TPZNodesetCompute::BuildElementGraph(), TPZSparseBlockDiagonal< TVar >::BuildFromMatrix(), TPZBuildMultiphysicsMesh::BuildHybridMesh(), TPZMultiphysicsCompMesh::BuildMultiphysicsSpace(), TPZRefPattern::BuildSideMesh(), TPZInterpolationSpace::BuildTransferMatrix(), TPZInterpolatedElement::BuildTransferMatrix(), TPZInterpolatedElement::CalcIntegral(), TPZCompElPostProc< TCOMPEL >::CalcResidual(), TPZMultiphysicsCompEl< TGeometry >::CalcResidual(), TPZAgglomerateElement::CalcStiff(), TPZSubCompMesh::CalcStiff(), TPZMultiphysicsCompEl< TGeometry >::CalcStiff(), TPZLadeKim::CheckConv(), CheckElement(), TPZSkylNSymMatrix< TVar >::Clear(), TPZDXGraphMesh::Close(), TPZRenumbering::ColorNodes(), TPZElementMatrix::ComputeDestinationIndices(), TPZCompMesh::ComputeElGraph(), TPZGeoElSide::ComputeNeighbours(), TPZCompMesh::ComputeNodElCon(), TPZInterpolationSpace::ComputeNormal(), TPZReducedSpace::ComputeRequiredData(), TPZInterpolationSpace::ComputeRequiredData(), TPZMohrCoulombPV::ComputeSigma(), TPZMohrCoulombNeto::ComputeSigma(), TPZCompElHDivPressure< TSHAPE >::ComputeSolution(), TPZReducedSpace::ComputeSolution(), TPZInterpolatedElement::ComputeSolution(), TPZInterfaceElement::ComputeSolution(), TPZSBFemVolume::ComputeSolution(), TPZCompElDisc::ComputeSolution(), TPZCompElHDiv< TSHAPE >::ComputeSolutionHDiv(), TPZCompElHDivPressure< TSHAPE >::ComputeSolutionPressureHDiv(), TPZIntRuleT3D::ComputingSymmetricCubatureRule(), TPZIntRuleT::ComputingSymmetricCubatureRule(), TPZL2Projection::Contribute(), TPZL2Projection::ContributeVecShape(), TPZRenumbering::ConvertGraph(), TPZCompElWithMem< TBASE >::CopyIntPtIndicesFrom(), TPZGradientReconstruction::TPZGradientData::CreateGhostsNeighbors(), TPZMHMixedMeshControl::CreateHDivPressureMHMMesh(), TPZMultiphysicsElement::CreateInterface(), TPZInterpolationSpace::CreateInterface(), TPZInterpolatedElement::CreateMidSideConnect(), TPZMHMeshControl::CreateSkeletonElements(), TPZMHMeshControl::DefinePartitionbyCoarseIndices(), pztopology::Pr< TFather >::Diagnostic(), TPZMHMeshControl::DivideBoundarySkeletonElements(), TPZBuildSBFem::DivideSkeleton(), TPZMHMeshControl::DivideSkeletonElements(), TPZVTKGraphMesh::DrawSolution(), TPZMatConvectionProblem::Errors(), TPZAnalysisError::EvaluateError(), TPZSBFemVolume::EvaluateError(), TPZInterfaceElement::EvaluateInterfaceJump(), TPZInterfaceElement::ExistInterfaces(), TPZTransfer< TVar >::ExpandColumnVectorEntries(), TPZAnalysisError::ExpandConnected(), TPZCompElSide::ExpandConnected(), TPZTransfer< TVar >::ExpandDoubleValueEntries(), TPZMixedElasticityMaterial::FillVecShapeIndex(), TPZPoroElastoPlasticAnalysis::FindPorousMaterials(), TPZCompElWithMem< TBASE >::ForcePrepareIntPtIndices(), TPZInterpolatedElement::ForceSideOrder(), TPZGenGrid::GenerateElementsZigZag(), TPZCutHillMcKee::SGraph::GetAdjacentNodes(), TPZCompMesh::GetElementPatch(), TPZSubCompMesh::GetFromSuperMesh(), TPZMHMeshControl::GetMeshes(), TPZMultiphysicsCompEl< TGeometry >::GetReferenceIndexVec(), TPZPlasticTest::GlobalCheckConv(), TPZAnalysisError::hp_Adaptive_Mesh_Design(), TPZAnalysisError::HPAdapt(), TPZMHMeshControl::HybridizeSkeleton(), TPZDohrStructMatrix::IdentifyExternalConnectIndexes(), TPZSubCompMesh::InitializeEF(), TPZSkylNSymMatrix< TVar >::InitializeElem(), TPZInterfaceElement::InitializeElementMatrix(), TPZReducedSpace::InitializeElementMatrix(), TPZMultiphysicsInterfaceElement::InitializeElementMatrix(), TPZInterpolationSpace::InitializeElementMatrix(), TPZCompElLagrange::InitializeElementMatrix(), TPZElementGroup::InitializeElementMatrix(), TPZMultiphysicsCompEl< TGeometry >::InitializeElementMatrix(), TPZGradientReconstruction::TPZGradientData::InitializeGradData(), TPZMultiphysicsCompEl< TGeometry >::InitializeIntegrationRule(), TPZInterfaceElement::InitMaterialData(), TPZSBFemVolume::InitMaterialData(), TPZInterpolationSpace::InitMaterialData(), TPZMultiphysicsInterfaceElement::InitMaterialData(), TPZMultiphysicsCompEl< TGeometry >::InitMaterialData(), TPZGeoMeshBuilder::InsertElement(), TPZGmshReader::InsertElement(), TPZMultiphysicsCompEl< TGeometry >::IntegrateSolution(), TPZCompEl::IntegrateSolution(), TPZDiscontinuousGalerkin::InterfaceJump(), TPZHyperPlaneIntersect::Intersect(), TPZProjectEllipse::LeastSquaresToGetEllipse(), TPZProjectEllipse::LeastSquaresToGetSimpleEllipse(), pztopology::Pr< TFather >::LowerDimensionSides(), pztopology::TPZTetrahedron::LowerDimensionSides(), pztopology::TPZPyramid::LowerDimensionSides(), pztopology::TPZTriangle::LowerDimensionSides(), pztopology::TPZPrism::LowerDimensionSides(), pztopology::TPZQuadrilateral::LowerDimensionSides(), pztopology::TPZCube::LowerDimensionSides(), pztopology::TPZLine::LowerDimensionSides(), TPZSubCompMesh::MakeAllInternal(), TPZSubCompMesh::MakeExternal(), TPZSubCompMesh::MakeInternal(), TPZFlowCompMesh::MaxVelocityOfMesh(), TPZGenGrid::MergeGeoMesh(), TPZManVector< TPZPostProcVar, 20 >::NAlloc(), TPZGradientReconstruction::TPZGradientData::NodeCloserCenterX(), TPZRefPatternTools::NodesHunter(), TPZChunkVector< TPZGraphNode, 10 >::operator=(), TPZAnalysisError::PlotLocal(), TPZAnalysis::PostProcessErrorParallel(), TPZAnalysis::PostProcessErrorSerial(), TPZMetis::Print(), TPZYCMohrCoulombPV::ProjectSigma(), TPZCutHillMcKee::SGraph::PseudoPeripheralNodes(), TPZStack< int, 100 >::Push(), TPZSequenceSolver< TVar >::Read(), TPZEqnArray< TVar >::Read(), TPZElasticity3D::Read(), TPZMixedElasticityMaterial::Read(), TPZStream::Read(), TPZFileEqnStorage< TVar >::ReadBlockPositions(), TPZInterpolatedElement::RecomputeRestraints(), TPZCompElSide::RemoveConnectDuplicates(), TPZCompElSide::RemoveDuplicates(), TPZMultiphysicsElement::RemoveInterface(), TPZInterpolationSpace::RemoveInterface(), TPZMultiphysicsElement::RemoveInterfaces(), TPZInterpolationSpace::RemoveInterfaces(), TPZInterpolatedElement::RemoveSideRestraintsII(), TPZHyperPlaneIntersect::Reorder(), TPZHyperPlaneIntersect::ReorderGeneral(), TPZMetis::Resequence(), TPZCutHillMcKee::Resequence(), TPZSloanRenumbering::Resequence(), TPZElementMatrix::Reset(), TPZEqnArray< TVar >::Reset(), TPZFront< STATE >::Reset(), TPZElastoPlasticAnalysis::ResetMultiPhysics(), TPZPlasticStep< YC_t, TF_t, ER_t >::ResetPlasticMem(), TPZAdmChunkVector< TPZGeoEl *>::Resize(), TPZChunkVector< TPZGraphNode, 10 >::Resize(), TPZYCMohrCoulombPV::ReturnMapLeftEdge(), TPZYCMohrCoulombPV::ReturnMapRightEdge(), TPZCutHillMcKee::SGraph::RootedLevelStructure(), TPZTransfer< TVar >::SetBlocks(), TPZGenGrid::SetData(), TPZSBFemVolume::SetElementGroupIndex(), TPZCompElWithMem< TBASE >::SetFreeIntPtIndices(), TPZMultiphysicsInterfaceElement::SetLeftRightElementIndices(), TPZCompElWithMem< TBASE >::SetMemoryIndices(), TPZSubCompMesh::SetNumberRigidBodyModes(), TPZElasticity3D::SetPostProcessingDirection(), TPZPostProcMat::SetPostProcessVarIndexList(), TPZMHMeshControl::SetSubdomain(), pzshape::TPZShapePrism::Shape(), pzshape::TPZShapePiram::Shape(), TPZSBFemVolume::Shape(), TPZCompMesh::Skyline(), TPZMatElastoPlastic2D< T, TMEM >::Solution(), TPZCompElHDivPressure< TSHAPE >::Solution(), TPZCoupledTransportDarcy::Solution(), TPZMultiphysicsCompEl< TGeometry >::Solution(), TPZInterpolationSpace::Solution(), TPZSBFemVolume::Solution(), TPZPlasticTest::StrainTest(), TPZPlasticTest::StressTest(), TPZSpBlockDiagPivot< TVar >::Substitution2(), TPZAnalysis::ThreadData::ThreadWork(), TPZAdmChunkVector< TPZGeoEl *>::TPZAdmChunkVector(), TPZChunkVector< TPZGraphNode, 10 >::TPZChunkVector(), TPZCompElHDiv< TSHAPE >::TPZCompElHDiv(), TPZCompElHDivPressure< TSHAPE >::TPZCompElHDivPressure(), TPZCompElHDivPressureBound< TSHAPE >::TPZCompElHDivPressureBound(), TPZElasticity3D::TPZElasticity3D(), TPZGmshReader::TPZGmshReader(), TPZGradient::TPZGradient(), TPZMatElastoPlastic< T, TMEM >::TPZMatElastoPlastic(), TPZMaterialData::TPZMaterialData(), TPZMeshSolution::TPZMeshSolution(), TPZMultiphysicsCompMesh::TPZMultiphysicsCompMesh(), TPZMultiphysicsInterfaceElement::TPZMultiphysicsInterfaceElement(), TPZParFrontMatrix< TVar, store, front >::TPZParFrontMatrix(), TPZPostProcMat::TPZPostProcMat(), TPZNonLinMultGridAnalysis::UniformlyRefineMesh(), TPZBuildMultiphysicsMesh::UniformRefineCompEl(), TPZElementGroup::Unwrap(), TPZSparseBlockDiagonal< TVar >::UpdateFrom(), TPZParFrontMatrix< TVar, store, front >::WriteFile(), TPZStackEqnStorage< TVar >::Zero(), TPZFileEqnStorage< TVar >::Zero(), TPZIntRuleT::~TPZIntRuleT(), TPZIntRuleT3D::~TPZIntRuleT3D(), and TPZMultiphysicsCompMesh::~TPZMultiphysicsCompMesh().

◆ Resize() [2/2]

template<class T, int NumExtAlloc>
void TPZManVector< T, NumExtAlloc >::Resize ( const int64_t  newsize)
virtual

Resizes the vector object reallocating the storage if necessary.

See also
TPZVec<T>::Resize(const int);
Parameters
newsizeSize of the vector. It copies the existing objects to the new storage. The new members are not initialized.

Reimplemented from TPZVec< T >.

Definition at line 482 of file pzmanvector.h.

◆ Shrink()

template<class T , int NumExtAlloc>
void TPZManVector< T, NumExtAlloc >::Shrink ( )

Member Data Documentation

◆ fExtAlloc

template<class T, int NumExtAlloc = DEFAULTVEC_ALLOC>
T TPZManVector< T, NumExtAlloc >::fExtAlloc[NumExtAlloc]
private

◆ fNAlloc

template<class T, int NumExtAlloc = DEFAULTVEC_ALLOC>
int TPZManVector< T, NumExtAlloc >::fNAlloc
private

The documentation for this class was generated from the following files: