NeoPZ
|
Implements a chunk vector with free store administration. Utility. More...
#include <TPZStream.h>
Public Types | |
enum | CompactScheme { NEVER, NOW, ALWAYS } |
Public Types inherited from TPZChunkVector< T, EXP > | |
typedef T | value_type |
typedef value_type * | pointer |
typedef const value_type * | const_pointer |
typedef TPZChunkVectorIterator< false, value_type, EXP > | iterator |
typedef TPZChunkVectorIterator< true, value_type, EXP > | const_iterator |
typedef value_type & | reference |
typedef const value_type & | const_reference |
typedef int64_t | size_type |
Public Member Functions | |
TPZAdmChunkVector< T, EXP > & | operator= (const TPZAdmChunkVector< T, EXP > &TPZAdmCh) |
Assignment operator. More... | |
TPZAdmChunkVector (const TPZAdmChunkVector< T, EXP > &AdmCh) | |
Copy constructor. More... | |
TPZAdmChunkVector (int numberofchunks=DEFAULTNUMBEROFCHUNKS) | |
Constructor. More... | |
virtual | ~TPZAdmChunkVector () |
Destructor. More... | |
int | AllocateNewElement () |
Makes more room for new elements. More... | |
void | SetFree (int index) |
Indicate an element as free. More... | |
int64_t | NFreeElements () const |
Access method to return the number of free elements. More... | |
void | CompactDataStructure (CompactScheme type=CompactScheme::ALWAYS) |
Sets the method to compact the data structure based on the. More... | |
int | PrintFree (int i) |
Print index i into the fFree vector. More... | |
void | Resize (const int newsize) |
Increase the size of the chunk vector. More... | |
int | ClassId () const override |
Define the class id associated with the class. More... | |
void | Read (TPZStream &buf, void *context) override |
read objects from the stream More... | |
void | Write (TPZStream &buf, int withclassid) const override |
Writes this object to the TPZStream buffer. Include the classid if withclassid = true. More... | |
Public Member Functions inherited from TPZChunkVector< T, EXP > | |
TPZChunkVector< T, EXP > & | operator= (const TPZChunkVector< T, EXP > &TCh) |
Assignment operator, copies all elements from the object TCh. More... | |
TPZChunkVector (const TPZChunkVector< T, EXP > &TCh) | |
Copy constructor. More... | |
TPZChunkVector (int64_t numberofchunks=DEFAULTNUMBEROFCHUNKS) | |
Constructor with numberofchunks chunks. More... | |
virtual | ~TPZChunkVector () |
Destructor. More... | |
iterator | begin () |
const_iterator | begin () const |
const_iterator | cbegin () const |
iterator | end () |
const_iterator | end () const |
const_iterator | cend () const |
int64_t | NElements () const |
Access method to query the number of elements of the vector. More... | |
void | Resize (const int64_t newsize) |
Increase the size of the chunk vector. More... | |
T & | operator[] (const int64_t nelem) const |
Returns a reference to the ith element of the vector. More... | |
int64_t | FindObject (T *object) |
Finds the index of an object by its pointer. More... | |
int | ClassId () const override |
Define the class id associated with the class. More... | |
void | Read (TPZStream &buf, void *context) override |
read objects from the stream More... | |
void | Write (TPZStream &buf, int withclassid) const override |
Writes this object to the TPZStream buffer. Include the classid if withclassid = true. More... | |
Public Member Functions inherited from TPZSavable | |
TPZSavable () | |
virtual | ~TPZSavable () |
virtual std::list< std::map< std::string, uint64_t > > | VersionHistory () const |
virtual std::pair< std::string, uint64_t > | Version () const |
virtual bool | Compare (TPZSavable *copy, bool override=false) |
Compares the object for identity with the object pointed to, eventually copy the object. More... | |
virtual bool | Compare (TPZSavable *copy, bool override=false) const |
Compares the object for identity with the object pointed to, eventually copy the object. More... | |
Public Member Functions inherited from TPZRegisterClassId | |
template<typename T > | |
TPZRegisterClassId (int(T::*)() const) | |
TPZRegisterClassId ()=default | |
Private Attributes | |
CompactScheme | fCompactScheme |
Internal variable indicating the type of compacting scheme. More... | |
TPZManVector< int > | fNFree |
Number of free elements within each chunk. More... | |
TPZStack< int > | fFree |
List of indexes of freed elements. More... | |
Friends | |
class | TPZStream |
class | TPZGeoMesh |
Additional Inherited Members | |
Static Public Member Functions inherited from TPZSavable | |
static std::set< TPZRestoreClassBase * > & | RestoreClassSet () |
This static function guarantees that the gMap object is available when needed. More... | |
static std::map< int, TPZRestore_t > & | ClassIdMap () |
This static function guarantees that the gMap object is available when needed. More... | |
static std::pair< std::string, uint64_t > | NeoPZVersion () |
static void | Register (TPZRestoreClassBase *restore) |
static void | RegisterClassId (int classid, TPZRestore_t fun) |
static TPZSavable * | CreateInstance (const int &classId) |
Protected Attributes inherited from TPZChunkVector< T, EXP > | |
int64_t | fNElements |
Number of elements of the chunk vector. More... | |
TPZManVector< T * > | fVec |
Vector which points to each chunk of objects. More... | |
Implements a chunk vector with free store administration. Utility.
An object of this class allows the user to request a new object of the type administered and allows the user to flag given elements as unused.
Definition at line 39 of file TPZStream.h.
enum TPZAdmChunkVector::CompactScheme |
Enumerator | |
---|---|
NEVER | |
NOW | |
ALWAYS |
Definition at line 29 of file pzadmchunk.h.
TPZAdmChunkVector< T, EXP >::TPZAdmChunkVector | ( | const TPZAdmChunkVector< T, EXP > & | AdmCh | ) |
Copy constructor.
AdmCh | Object whose elements will be copied. |
Definition at line 258 of file pzadmchunk.h.
TPZAdmChunkVector< T, EXP >::TPZAdmChunkVector | ( | int | numberofchunks = DEFAULTNUMBEROFCHUNKS | ) |
Constructor.
Constructor with indication of the initial size of the chunk allocation vector and the size of the chunks these sizes cannot be modified during the lifecycle of the object.
numberofchunks | Indicates how large the initial chunk vector will be. |
Definition at line 165 of file pzadmchunk.h.
|
virtual |
Destructor.
Definition at line 178 of file pzadmchunk.h.
int TPZAdmChunkVector< T, EXP >::AllocateNewElement | ( | ) |
Makes more room for new elements.
Definition at line 184 of file pzadmchunk.h.
Referenced by TPZCompMesh::AllocateNewConnect(), TPZAdmChunkVectorThreadSafe< T, EXP >::AllocateNewElement(), TPZBuildSBFem::CreateElementCenterNodes(), TPZCheckGeom::CreateMesh(), pzgeom::TPZChangeEl::CreateMiddleNodeAtEdge(), TPZRefPattern::CreateMidSideNodes(), TPZGenSpecialGrid::GeneratePolygonalSphereFromOctahedron(), pzgeom::TPZQuadraticPrism::InsertExampleElement(), pzgeom::TPZGeoCube::InsertExampleElement(), pzgeom::TPZQuadraticPyramid::InsertExampleElement(), pzgeom::TPZQuadraticCube::InsertExampleElement(), pzgeom::TPZGeoTetrahedra::InsertExampleElement(), pzgeom::TPZGeoPyramid::InsertExampleElement(), pzgeom::TPZQuadraticTetra::InsertExampleElement(), pzgeom::TPZGeoPrism::InsertExampleElement(), pzgeom::TPZGeoLinear::InsertExampleElement(), pzgeom::TPZGeoPoint::InsertExampleElement(), pzgeom::TPZQuadraticLine::InsertExampleElement(), pzgeom::TPZQuadraticTrig::InsertExampleElement(), pzgeom::TPZGeoQuad::InsertExampleElement(), pzgeom::TPZQuadraticQuad::InsertExampleElement(), pzgeom::TPZGeoTriangle::InsertExampleElement(), pzgeom::TPZEllipse3D::InsertExampleElement(), pzgeom::TPZQuadTorus::InsertExampleElement(), pzgeom::TPZWavyLine::InsertExampleElement(), pzgeom::TPZTriangleTorus::InsertExampleElement(), pzgeom::TPZQuadSphere< GeomQuad >::InsertExampleElement(), pzgeom::TPZArc3D::InsertExampleElement(), pzgeom::TPZTriangleSphere< GeomTriang >::InsertExampleElement(), TPZHyperPlaneIntersect::Intersect(), TPBSpStructMatrix::main(), TPZSymetricSpStructMatrix::main(), TPZSpStructMatrix::main(), TPZGenGrid::MergeGeoMesh(), pzrefine::TPZRefPrism::NewMidSideNode(), pzrefine::TPZRefTriangle::NewMidSideNode(), pzrefine::TPZRefCube::NewMidSideNode(), pzrefine::TPZRefLinear::NewMidSideNode(), pzrefine::TPZRefPyramid::NewMidSideNode(), pzrefine::TPZRefQuad::NewMidSideNode(), pzrefine::TPZRefTetrahedra::NewMidSideNode(), TPZReadTetGen::ProcessNodes(), PYBIND11_MODULE(), TPZGenGrid::ReadAndMergeGeoMesh(), TPZReadMeshHR::ReadNodes(), TPZHyperPlaneIntersect::ReorderGeneral(), TCedricTest::TetrahedralMeshUsingRefinement(), TPZCompEl::TPZCompEl(), TPZGeoEl::TPZGeoEl(), TPZGraphEl::TPZGraphEl(), TPZSubCompMesh::TransferElementFrom(), and TPZSubCompMesh::TransferElementTo().
|
inlineoverridevirtual |
Define the class id associated with the class.
This id has to be unique for all classes A non unique id is flagged at the startup of the program
Implements TPZSavable.
Definition at line 114 of file pzadmchunk.h.
void TPZAdmChunkVector< T, EXP >::CompactDataStructure | ( | CompactScheme | type = CompactScheme::ALWAYS | ) |
Sets the method to compact the data structure based on the.
type | Type of compacting scheme to be used. parameter type:
|
Definition at line 222 of file pzadmchunk.h.
Referenced by TPZGeoMesh::CleanUp(), TPZCompMesh::CleanUp(), TPZAdmChunkVectorThreadSafe< T, EXP >::CompactDataStructure(), TPZAdmChunkVector< TPZGeoEl *>::NFreeElements(), TPZAdmChunkVector< TPZGeoEl *>::SetFree(), TPZGraphMesh::TPZGraphMesh(), and TPZSubCompMesh::~TPZSubCompMesh().
|
inline |
Access method to return the number of free elements.
Definition at line 87 of file pzadmchunk.h.
Referenced by TPZAdmChunkVectorThreadSafe< T, EXP >::NFreeElements(), TPZGeoMesh::Print(), TPZGeoMesh::PrintTopologicalInfo(), and TPZGeoMesh::ReallyNEl().
TPZAdmChunkVector< T, EXP > & TPZAdmChunkVector< T, EXP >::operator= | ( | const TPZAdmChunkVector< T, EXP > & | TPZAdmCh | ) |
Assignment operator.
TPZAdmCh | Vector which will be duplicated. It will copy the objects from TPZAdmCh will call the assignment operator on all objects (also the freed objects). |
Definition at line 265 of file pzadmchunk.h.
|
inline |
Print index i into the fFree vector.
Definition at line 104 of file pzadmchunk.h.
Referenced by TPZAdmChunkVectorThreadSafe< T, EXP >::PrintFree().
|
inlineoverridevirtual |
read objects from the stream
Reimplemented from TPZSavable.
Definition at line 118 of file pzadmchunk.h.
Referenced by TPZGraphMesh::Read(), TPZGeoMesh::Read(), and TPZCompMesh::Read().
void TPZAdmChunkVector< T, EXP >::Resize | ( | const int | newsize | ) |
Increase the size of the chunk vector.
newsize | Requested new size of the vector. |
Definition at line 280 of file pzadmchunk.h.
Referenced by TPZBuildMultiphysicsMesh::AddConnects(), TPZMultiphysicsCompMesh::AddConnects(), TPZMulticamadaOrthotropic::AddPlacaOrtho(), TPZAdmChunkVector< TPZGeoEl *>::AllocateNewElement(), TPZBuildMultiphysicsMesh::AppendConnects(), TPZRefPattern::BuildSideMesh(), TPZMultiphysicsCompMesh::CleanElementsConnects(), TPZGeoMesh::CleanUp(), TPZCompMesh::CleanUp(), TPZAdmChunkVector< TPZGeoEl *>::CompactDataStructure(), TPZHierarquicalGrid::ComputeExtrusion(), TPZAnalysis::CreateListOfCompElsToComputeError(), Hdiv3dPaper201504::CreateOneCubo(), TPZGraphMesh::ElementList(), TPZExtendGridDimension::ExtendedMesh(), TPZRefPatternTools::GenerateGMeshFromElementVec(), TPZGenSubStruct::GenerateMesh(), TCedricTest::GenerateNodes(), TPZAcademicGeoMesh::GenerateNodes(), Hdiv3dPaper201504::GenerateNodes(), TPZGenGrid::GenerateNodes(), TPZRefPattern::GeneratePermutations(), Hdiv2dPaper201504::GMesh(), hdivCurvedJCompAppMath::GMeshCilindricalMesh(), Hdiv3dPaper201504::GMeshWithPrism(), TPZGeoMeshBuilder::InsertNodes(), hdivCurvedJCompAppMath::MakeCircle(), hdivCurvedJCompAppMath::MakeSphereFromQuadrilateral(), MalhaGeom(), TPZGeoMesh::operator=(), TPZCompMesh::operator=(), TPZAdmChunkVector< TPZGeoEl *>::PrintFree(), TPZRefPattern::PrintVTK(), PYBIND11_MODULE(), TPZGenPartialGrid::Read(), TPZAdmChunkVector< TPZGeoEl *>::Read(), TPZRefPattern::ReadAndCreateRefinementPattern(), TPZGMSHReadMesh::ReadMesh2D(), TPZGMSHReadMesh::ReadMesh2D2(), TPZGMSHReadMesh::ReadMesh3D(), TPZStream::ReadPointers(), TPZAcademicGeoMesh::RedBlackPyramidalAndHexagonalMesh(), TPZAdmChunkVectorThreadSafe< T, EXP >::Resize(), TPZGraphMesh::SetCompMesh(), TCedricTest::TCedricTest(), TPZAcademicGeoMesh::TPZAcademicGeoMesh(), TPZCompMesh::TPZCompMesh(), TPZGraphEl::TPZGraphEl(), TPZGraphMesh::TPZGraphMesh(), TPZMulticamadaOrthotropic::TPZMulticamadaOrthotropic(), and TPZSubCompMesh::~TPZSubCompMesh().
void TPZAdmChunkVector< T, EXP >::SetFree | ( | int | index | ) |
Indicate an element as free.
index | The index of the element being put on the free stack. |
Definition at line 199 of file pzadmchunk.h.
Referenced by TPZCompMesh::CleanUpUnconnectedNodes(), TPZAdmChunkVectorThreadSafe< T, EXP >::SetFree(), TPZSubCompMesh::TransferElementFrom(), TPZSubCompMesh::TransferElementTo(), and TPZCompEl::~TPZCompEl().
|
inlineoverridevirtual |
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
Writes this object to the TPZStream buffer. Include the classid if withclassid = true
Reimplemented from TPZSavable.
Definition at line 132 of file pzadmchunk.h.
Referenced by TPZGraphMesh::Write(), TPZGeoMesh::Write(), and TPZCompMesh::Write().
|
friend |
Definition at line 147 of file pzadmchunk.h.
|
friend |
Definition at line 146 of file pzadmchunk.h.
|
private |
Internal variable indicating the type of compacting scheme.
Definition at line 153 of file pzadmchunk.h.
Referenced by TPZAdmChunkVector< TPZGeoEl *>::CompactDataStructure(), TPZAdmChunkVector< TPZGeoEl *>::operator=(), TPZAdmChunkVector< TPZGeoEl *>::Read(), TPZStream::ReadPointers(), TPZAdmChunkVector< TPZGeoEl *>::SetFree(), TPZAdmChunkVector< TPZGeoEl *>::Write(), and TPZStream::WritePointers().
|
private |
List of indexes of freed elements.
Definition at line 159 of file pzadmchunk.h.
Referenced by TPZAdmChunkVector< TPZGeoEl *>::AllocateNewElement(), TPZAdmChunkVector< TPZGeoEl *>::CompactDataStructure(), TPZAdmChunkVector< TPZGeoEl *>::NFreeElements(), TPZAdmChunkVector< TPZGeoEl *>::operator=(), TPZAdmChunkVector< TPZGeoEl *>::PrintFree(), TPZAdmChunkVector< TPZGeoEl *>::Read(), TPZStream::ReadPointers(), TPZAdmChunkVector< TPZGeoEl *>::Resize(), TPZAdmChunkVector< TPZGeoEl *>::SetFree(), TPZAdmChunkVector< TPZGeoEl *>::Write(), and TPZStream::WritePointers().
|
private |
Number of free elements within each chunk.
Definition at line 156 of file pzadmchunk.h.
Referenced by TPZAdmChunkVector< TPZGeoEl *>::AllocateNewElement(), TPZAdmChunkVector< TPZGeoEl *>::CompactDataStructure(), TPZAdmChunkVector< TPZGeoEl *>::operator=(), TPZAdmChunkVector< TPZGeoEl *>::Read(), TPZStream::ReadPointers(), TPZAdmChunkVector< TPZGeoEl *>::Resize(), TPZAdmChunkVector< TPZGeoEl *>::SetFree(), TPZAdmChunkVector< TPZGeoEl *>::TPZAdmChunkVector(), TPZAdmChunkVector< TPZGeoEl *>::Write(), and TPZStream::WritePointers().