MFEM v2.0
Public Member Functions | Private Member Functions | Friends
Array< T > Class Template Reference

#include <array.hpp>

Inheritance diagram for Array< T >:
Inheritance graph
[legend]
Collaboration diagram for Array< T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Array (int asize=0, int ainc=0)
 Creates array of asize elements.
 Array (T *_data, int asize, int ainc=0)
 ~Array ()
 Destructor.
 operator T * ()
 Return the data as 'T *'.
 operator const T * () const
 Return the data as 'const T *'.
T * GetData ()
 Returns the data.
void StealData (T **p)
 Changes the ownership of the the data.
void LoseData ()
 NULL-ifies the data.
void MakeDataOwner ()
 Make the Array own the data.
int Size () const
 Logical size of the array.
void SetSize (int nsize)
 Change logical size of the array, keep existing entries.
T & operator[] (int i)
 Access element.
const T & operator[] (int i) const
 Access const element.
int Append (const T &el)
 Append element to array, resize if necessary.
int Append (const Array< T > &els)
 Append another array to this array, resize if necessary.
int Prepend (const T &el)
 Prepend an element to the array, resize if necessary.
T & Last ()
 Return the last element in the array.
int Union (const T &el)
 Append element when it is not yet in the array, return index.
int Find (const T &el) const
 Return the first index where 'el' is found; return -1 if not found.
void DeleteLast ()
 Delete the last entry.
void DeleteFirst (const T &el)
 Delete the first 'el' entry.
void DeleteAll ()
 Delete whole array.
void Copy (Array &copy) const
 Create a copy of the current array.
void MakeRef (const Array &master)
 Make this Array a reference to 'master'.
void GetSubArray (int offset, int sa_size, Array< T > &sa)
void Print (ostream &out, int width)
 Prints array to stream with width elements per row.
void Save (ostream &out)
 Prints array to stream out.
Max () const
void Sort ()
 Sorts the array.
void operator= (const T &a)

Private Member Functions

Array< T > & operator= (Array< T > &)
 Array copy is not supported.
 Array (const Array< T > &)
 Array copy is not supported.

Friends

void Swap (Array< T > &, Array< T > &)

Detailed Description

template<class T>
class Array< T >

Abstract data type Array.

Array<T> is an automatically increasing array containing elements of the generic type T. The allocated size may be larger then the logical size of the array. The elements can be accessed by the [] operator, the range is 0 to size-1.

Definition at line 63 of file array.hpp.


Constructor & Destructor Documentation

template<class T>
Array< T >::Array ( int  asize = 0,
int  ainc = 0 
) [inline, explicit]

Creates array of asize elements.

Definition at line 69 of file array.hpp.

template<class T>
Array< T >::Array ( T *  _data,
int  asize,
int  ainc = 0 
) [inline]

Creates array using an existing c-array of asize elements; allocsize is set to -asize to indicate that the data will not be deleted.

Definition at line 75 of file array.hpp.

template<class T>
Array< T >::~Array ( ) [inline]

Destructor.

Definition at line 79 of file array.hpp.

template<class T>
Array< T >::Array ( const Array< T > &  ) [private]

Array copy is not supported.


Member Function Documentation

template<class T>
int Array< T >::Append ( const T &  el) [inline]
template<class T>
int Array< T >::Append ( const Array< T > &  els) [inline]

Append another array to this array, resize if necessary.

Definition at line 301 of file array.hpp.

References Array< T >::Size().

template<class T>
void Array< T >::Copy ( Array< T > &  copy) const [inline]
template<class T >
void Array< T >::DeleteAll ( ) [inline]

Delete whole array.

Definition at line 366 of file array.hpp.

Referenced by FiniteElementSpace::Destructor(), Mesh::Load(), and Mesh::SetState().

template<class T>
void Array< T >::DeleteFirst ( const T &  el) [inline]

Delete the first 'el' entry.

Definition at line 353 of file array.hpp.

template<class T>
void Array< T >::DeleteLast ( ) [inline]

Delete the last entry.

Definition at line 131 of file array.hpp.

template<class T>
int Array< T >::Find ( const T &  el) const [inline]

Return the first index where 'el' is found; return -1 if not found.

Definition at line 344 of file array.hpp.

template<class T>
T* Array< T >::GetData ( ) [inline]

Returns the data.

Definition at line 88 of file array.hpp.

Referenced by ListOfIntegerSets::AsTable(), and Array< BilinearFormIntegrator * >::Copy().

template<class T>
void Array< T >::GetSubArray ( int  offset,
int  sa_size,
Array< T > &  sa 
) [inline]

Definition at line 386 of file array.hpp.

References Array< T >::SetSize().

Referenced by FiniteElementSpace::GlobalRestrictionMatrix().

template<class T >
T & Array< T >::Last ( ) [inline]

Return the last element in the array.

Definition at line 324 of file array.hpp.

References mfem_error().

Referenced by Interpolate(), and Revolve3D().

template<class T>
void Array< T >::LoseData ( ) [inline]

NULL-ifies the data.

Definition at line 95 of file array.hpp.

Referenced by ParFiniteElementSpace::LoseDofOffsets(), and ParFiniteElementSpace::LoseTrueDofOffsets().

template<class T>
void Array< T >::MakeDataOwner ( ) [inline]

Make the Array own the data.

Definition at line 98 of file array.hpp.

template<class T >
void Array< T >::MakeRef ( const Array< T > &  master) [inline]

Make this Array a reference to 'master'.

Definition at line 375 of file array.hpp.

References BaseArray::allocsize, BaseArray::data, BaseArray::inc, and BaseArray::size.

template<class T >
T Array< T >::Max ( ) const

Finds the maximal element in the array. (uses the comparison operator '<' for class T)

Definition at line 77 of file array.cpp.

References mfem_error().

Referenced by main(), and Transpose().

template<class T>
Array< T >::operator const T * ( ) const [inline]

Return the data as 'const T *'.

Definition at line 85 of file array.hpp.

template<class T>
Array< T >::operator T * ( ) [inline]

Return the data as 'T *'.

Definition at line 82 of file array.hpp.

template<class T>
void Array< T >::operator= ( const T &  a) [inline]

Definition at line 394 of file array.hpp.

template<class T>
Array<T>& Array< T >::operator= ( Array< T > &  ) [private]

Array copy is not supported.

template<class T >
T & Array< T >::operator[] ( int  i) [inline]

Access element.

Definition at line 267 of file array.hpp.

References mfem_error().

template<class T >
const T & Array< T >::operator[] ( int  i) const [inline]

Access const element.

Definition at line 280 of file array.hpp.

References mfem_error().

template<class T>
int Array< T >::Prepend ( const T &  el) [inline]

Prepend an element to the array, resize if necessary.

Definition at line 313 of file array.hpp.

template<class T >
void Array< T >::Print ( ostream &  out,
int  width 
)

Prints array to stream with width elements per row.

Definition at line 56 of file array.cpp.

Referenced by NURBSExtension::Print(), NURBSPatch::Print(), and NURBSExtension::PrintCharacteristics().

template<class T >
void Array< T >::Save ( ostream &  out)

Prints array to stream out.

Definition at line 69 of file array.cpp.

template<class T >
void Array< T >::SetSize ( int  nsize) [inline]

Change logical size of the array, keep existing entries.

Definition at line 255 of file array.hpp.

References mfem_error().

Referenced by BilinearForm::BilinearForm(), FiniteElementSpace::BuildDofToArrays(), Poly_1D::ClosedBasis(), Poly_1D::ClosedPoints(), ComputeFlux(), Array< BilinearFormIntegrator * >::Copy(), IntegrationRules::CubeIntegrationRules(), FiniteElementSpace::DofsToVDofs(), FindPartitioningComponents(), NURBSExtension::Generate2DBdrElementDofTable(), NURBSExtension::Generate2DElementDofTable(), NURBSExtension::Generate3DBdrElementDofTable(), NURBSExtension::Generate3DElementDofTable(), NURBSExtension::GenerateActiveBdrElems(), NURBSExtension::GenerateActiveVertices(), Mesh::GenerateBoundaryElements(), NURBSExtension::GenerateElementDofTable(), Mesh::GenerateFaces(), NURBSExtension::GenerateOffsets(), NURBSExtension::Get2DPatchNets(), NURBSExtension::Get3DPatchNets(), FiniteElementSpace::GetBdrElementDofs(), Mesh::GetBdrElementEdges(), NURBSExtension::GetBdrElementTopo(), NURBSPatchMap::GetBdrPatchKnotVectors(), NURBSExtension::GetBdrPatchKnotVectors(), FiniteElementSpace::GetEdgeDofs(), FiniteElementSpace::GetEdgeInteriorDofs(), Mesh::GetElementColoring(), FiniteElementSpace::GetElementDofs(), Mesh::GetElementEdges(), Mesh::GetElementFaces(), FiniteElementSpace::GetElementInteriorDofs(), NURBSExtension::GetElementLocalToGlobal(), Mesh::GetElementToEdgeTable(), Mesh::GetElementToFaceTable(), NURBSExtension::GetElementTopo(), FiniteElementSpace::GetEssentialVDofs(), FiniteElementSpace::GetFaceDofs(), Mesh::GetFaceEdges(), GridFunction::GetNodalValues(), NURBSExtension::GetPatchKnotVectors(), Table::GetRow(), Array< T >::GetSubArray(), NURBSExtension::GetVertexLocalToGlobal(), Triangle::GetVertices(), Tetrahedron::GetVertices(), Segment::GetVertices(), Quadrilateral::GetVertices(), Point::GetVertices(), Hexahedron::GetVertices(), Mesh::HexUniformRefinement(), Mesh::Load(), Mesh::LoadPatchTopo(), FiniteElementSpace::LocalInterpolation(), Mesh::LocalRefinement(), MatrixArrayCoefficient::MatrixArrayCoefficient(), Mesh::Mesh(), NURBSExtension::NURBSExtension(), NURBSFiniteElement::NURBSFiniteElement(), NURBSPatch::NURBSPatch(), Poly_1D::OpenBasis(), Poly_1D::OpenPoints(), IntegrationRules::PointIntegrationRules(), Mesh::PrintVTK(), Mesh::QuadUniformRefinement(), IntegerSet::Recreate(), IntegrationRules::SegmentIntegrationRules(), IntegrationRules::Set(), Mesh::SetAttributes(), NURBSExtension::SetCoordsFromPatches(), NURBSExtension::SetKnotsFromPatches(), IntegrationRules::SquareIntegrationRules(), NURBSPatch::swap(), IntegrationRules::TetrahedronIntegrationRules(), IntegrationRules::TriangleIntegrationRules(), and Mesh::UpdateNURBS().

template<class T>
int Array< T >::Size ( ) const [inline]

Logical size of the array.

Definition at line 101 of file array.hpp.

Referenced by Vector::AddElementVector(), SparseMatrix::AddRow(), SparseMatrix::AddSubMatrix(), DenseMatrix::AdjustDofDirection(), FiniteElementSpace::AdjustVDofs(), Array< T >::Append(), LinearForm::Assemble(), DiscreteLinearOperator::Assemble(), MixedBilinearForm::Assemble(), BilinearForm::Assemble(), ListOfIntegerSets::AsTable(), BilinearForm::BilinearForm(), FiniteElementSpace::BuildDofToArrays(), FiniteElementSpace::BuildElementToDofTable(), NURBSExtension::CheckBdrPatches(), Mesh::CheckDisplacements(), Mesh::CheckPartitioning(), NURBSExtension::CheckPatches(), Poly_1D::ClosedBasis(), Poly_1D::ClosedPoints(), BilinearForm::ComputeElementMatrices(), BilinearForm::ComputeElementMatrix(), ComputeFlux(), FiniteElementSpace::ConstructRefinementData(), NURBSExtension::ConvertToPatches(), IntegrationRules::CubeIntegrationRules(), FiniteElementSpace::D2C_GlobalRestrictionMatrix(), FiniteElementSpace::D2Const_GlobalRestrictionMatrix(), NURBSExtension::DegreeElevate(), NURBSPatch::DegreeElevate(), IntegrationRules::DeleteIntRuleArray(), FiniteElementSpace::DofsToVDofs(), Mesh::ElementToElementTable(), BilinearForm::EliminateEssentialBC(), BilinearForm::EliminateEssentialBCFromDofs(), FiniteElementSpace::EliminateEssentialBCFromGRM(), MixedBilinearForm::EliminateTestDofs(), MixedBilinearForm::EliminateTrialDofs(), BilinearForm::EliminateVDofs(), Mesh::GenerateBoundaryElements(), Mesh::GenerateFaces(), IntegrationRules::Get(), FiniteElementSpace::GetBdrElementDofs(), Mesh::GetBdrElementTransformation(), Mesh::GetEdgeVertices(), Mesh::GetElementArrayEdgeTable(), GridFunction::GetElementAverages(), FiniteElementSpace::GetElementDofs(), Mesh::GetElementFaces(), Mesh::GetElementTransformation(), FiniteElementSpace::GetEssentialVDofs(), FiniteElementSpace::GetFaceDofs(), Mesh::GetFaceEdgeTable(), GridFunction::GetNodalValues(), GroupTopology::GetNumNeighbors(), SparseMatrix::GetSubMatrix(), Vector::GetSubVector(), GridFunction::GetValue(), Mesh::GetVertices(), FiniteElementSpace::GlobalRestrictionMatrix(), NURBSExtension::HavePatches(), NURBSPatch::init(), ListOfIntegerSets::Insert(), IntegerSet::IntegerSet(), Interpolate(), NURBSExtension::KnotInsert(), NURBSPatch::KnotInsert(), Mesh::KnotInsert(), Mesh::Load(), FiniteElementSpace::LocalInterpolation(), Mesh::LocalRefinement(), ListOfIntegerSets::Lookup(), NURBSPatch::MakeUniformDegree(), Mesh::MoveVertices(), NURBSExtension::NURBSExtension(), NURBSPatch::NURBSPatch(), Poly_1D::OpenBasis(), Poly_1D::OpenPoints(), IntegerSet::operator==(), SparseMatrix::PartMult(), IntegerSet::PickRandomElement(), NURBSPatch::Print(), Mesh::PrintVTK(), Mesh::PrintXG(), GridFunction::ProjectCoefficient(), Revolve3D(), NURBSPatch::Rotate3D(), GridFunction::SaveSTL(), Mesh::ScaleElements(), Mesh::ScaleSubdomains(), IntegrationRules::SegmentIntegrationRules(), IntegrationRules::Set(), Mesh::SetAttributes(), NURBSPatchMap::SetBdrPatchDofMap(), NURBSPatchMap::SetBdrPatchVertexMap(), NURBSExtension::SetCoordsFromPatches(), NURBSExtension::SetKnotsFromPatches(), NURBSPatchMap::SetPatchDofMap(), NURBSPatchMap::SetPatchVertexMap(), SparseMatrix::SetSubMatrix(), SparseMatrix::SetSubMatrixTranspose(), Vector::SetSubVector(), Mesh::SetVertices(), ListOfIntegerSets::Size(), IntegerSet::Size(), IntegrationRules::SquareIntegrationRules(), NURBSPatch::swap(), IntegrationRules::TetrahedronIntegrationRules(), Mesh::Transform(), Transpose(), NURBSExtension::UniformRefinement(), NURBSPatch::UniformRefinement(), Mesh::UniformRefinement(), Mesh::UpdateNURBS(), ZZErrorEstimator(), BilinearForm::~BilinearForm(), FiniteElementSpace::~FiniteElementSpace(), LinearForm::~LinearForm(), ListOfIntegerSets::~ListOfIntegerSets(), Mesh::~Mesh(), MixedBilinearForm::~MixedBilinearForm(), NURBSExtension::~NURBSExtension(), NURBSPatch::~NURBSPatch(), and Poly_1D::~Poly_1D().

template<class T >
void Array< T >::Sort ( )

Sorts the array.

Definition at line 101 of file array.cpp.

Referenced by IntegerSet::Recreate(), and Mesh::SetAttributes().

template<class T>
void Array< T >::StealData ( T **  p) [inline]

Changes the ownership of the the data.

Definition at line 91 of file array.hpp.

template<class T>
int Array< T >::Union ( const T &  el) [inline]

Append element when it is not yet in the array, return index.

Definition at line 334 of file array.hpp.

Referenced by FiniteElementSpace::ConstructRefinementData().


Friends And Related Function Documentation

template<class T>
void Swap ( Array< T > &  a,
Array< T > &  b 
) [friend]

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines