NeoPZ
Classes | Macros | Typedefs | Functions | Variables
The Utility classes.

The utility classes define general purpose classes such as vectors, stacks, binary trees and chunk vectors.
All classes in the utility package are templated in order to improve strong type checking.
The class will perform a bounds checking on the operator arguments. More...

Classes

class  TPZMetis
 Implements renumbering for elements of a mesh. Utility. More...
 
class  TPZSloan
 Interface to sloan subrotines. Utility. More...
 
class  TPZRenumbering
 This abstract class which defines the behavior which derived classes need to implement
for implementing node sequence numbering optimization. Utility. More...
 
class  TPZfTime
 Calculate the Times. Utility. More...
 
class  TPZTimeTemp
 Takes times. (Tomada de tempos). Utility. More...
 
class  TPZAdmChunkVector< T, EXP >
 Implements a chunk vector with free store administration. Utility. More...
 
class  TPZAxesTools< TVar >
 Implements method to verify whether axes is an orthogonal normalizes matrix and to transformation from given axes to euclidian basis and viceverse. Utility. More...
 
class  TPZCheckConsistency
 Implements an interface to check the consistency of two implementations. Utility. More...
 
class  TPZFunction< TVar >
 Implements a function. Utility. More...
 
class  TPZLine
 Implements a line. Utility. More...
 
class  TPZManVector< T, NumExtAlloc >
 Implements a vector class which allows to use external storage provided by the user. Utility. More...
 
class  TPZNumeric
 Implements several methods to calculation. Utility. More...
 
class  TPZPlane
 Implements a plane (stores the plane equation). Utility. More...
 
class  TPZPolynomial
 Implements a polynomial. Utility. More...
 
class  TPZStack< T, NumExtAlloc >
 This class implements a stack object. Utility. More...
 
class  TPZString
 Implements strings as stack. Utility. More...
 
class  TPZVec< T >
 This class implements a simple vector storage scheme for a templated class T. Utility. More...
 
class  TPZAutoPointer< T >
 This class implements a reference counter mechanism to administer a dynamically allocated object. Utility. More...
 
class  TPZPermutation
 This class generates all permutations of n values. Utility. More...
 
class  TPZSemaphore
 Implements semaphore to threads. Utility. More...
 
struct  PZResourceUsage
 Information on the resources used by a child process. Utility. More...
 
class  TPZTimer
 The timer class. Utility. More...
 
class  TPZMultiTimer
 Controls several timers at once. Utility. More...
 

Macros

#define AP_MUTEX_ARRAY_SZ
 Increment and Decrement actions are mutexed by this mutex. More...
 
#define AP_MUTEX_HASH_1
 
#define AP_MUTEX_HASH_2
 
#define DEFAULTNUMBEROFCHUNKS
 Default number of elements which will be allocated in the chunk vector. More...
 
#define DEFAULTCHUNKEXPONENT
 Default number of elements in each chunk is $ pow(2,--) $. More...
 

Typedefs

typedef void * TPZPix
 TPZPix is the iterator for the AVL binary tree class. Utility. More...
 
typedef TPZVec< TPZStringTPZText
 Typedef to vector of strings. More...
 

Functions

template<class Real >
void GeneratePlaneRotation (Real &dx, Real &dy, Real &cs, Real &sn)
 Compute the values cs and sn parameters to rotation. More...
 
template<class Real >
void ApplyPlaneRotation (Real &dx, Real &dy, Real &cs, Real &sn)
 Makes rotation of the plane based on the cs and sn parameters. More...
 
void InitializePZLOG (const std::string &configfile)
 Initialize a log file adequated to use log4cxx lib. More...
 
void InitializePZLOG ()
 Initializes log file for log4cxx with commom name log4cxx.cfg. More...
 
template<class T1 , class T2 , class Scalar >
void saxpy (TPZVec< T1 > &x, const TPZVec< T2 > &y, Scalar s)
 Performs a saxpy operation: x <- x + s * y. More...
 
template<class T1 , class Scalar >
void sscal (TPZVec< T1 > &x, const Scalar s)
 Performs a sscal operation: x <- x * s. More...
 
template<class T >
TPZVec< T > operator- (const TPZVec< T > &a, const TPZVec< T > &b)
 substracts two vectors More...
 
template<class T >
TPZVec< T > & operator-= (TPZVec< T > &a, const TPZVec< T > &b)
 substracts two vectors More...
 
template<class T1 >
double sdot (TPZVec< T1 > &x, TPZVec< T1 > &y)
 Performs a sdot operation: dot <- Transpose[x] * y. More...
 
template<class T1 >
REAL dist (TPZVec< T1 > &vec1, TPZVec< T1 > &vec2)
 
template<class T >
TPZVec< T > & Sort (TPZVec< T > &v)
 Sorting the elements into v. More...
 
template<class T >
int Find (TPZVec< T > &v, const T &e)
 Finds if exists the element e into vector v. More...
 
template<class T >
Min (TPZVec< T > &v)
 Returns the minimum element into v. More...
 
template<class T >
Max (TPZVec< T > &v)
 Returns the maximum element into v. More...
 
template<class T , int N>
void Intersect (const TPZVec< T > &one, const TPZVec< T > &two, TPZStack< T, N > &result)
 Gets commom elements into the one and two vectors. More...
 
template<class T , int N>
void Intersect (const TPZVec< T > &one, const TPZVec< T > &two, const TPZVec< T > &three, TPZStack< T, N > &result)
 Gets commom elements into the one, two and three vectors. More...
 
template<class T >
Norm (const TPZVec< T > &one)
 Gets commom elements into the one and two vectors. More...
 
template<class T >
void Cross (const TPZVec< T > &x1, const TPZVec< T > &x2, TPZVec< T > &result)
 
template<class T >
Dot (const TPZVec< T > &x1, const TPZVec< T > &x2)
 
pthread_mutex_t * get_ap_mutex (void *obj)
 
template<typename R , typename T >
TPZAutoPointer< R > TPZAutoPointerDynamicCast (TPZAutoPointer< T > in)
 
template<typename T , typename std::enable_if< std::is_pointer< T >::value, int >::type * = nullptr>
void ReadInternal (T &output, TPZStream &buf, void *context)
 An object of this class implements a vector which allocates objects by chunks. Utility. More...
 
 TPZTimer::TPZTimer ()
 
 TPZTimer::TPZTimer (std::string pn)
 Default constructor. More...
 
 TPZTimer::~TPZTimer ()
 Default Destructor. More...
 
std::string & TPZTimer::processName ()
 Gets the process name (for reporting purposes). More...
 
const std::string & TPZTimer::processName () const
 Gets the process name (for reporting purposes). More...
 
void TPZTimer::reset ()
 Zeroes the timer. More...
 
double TPZTimer::seconds () const
 Returns the elapsed time in seconds. More...
 
 TPZMultiTimer::TPZMultiTimer (int nT)
 Default constructor. More...
 
 TPZMultiTimer::~TPZMultiTimer ()
 Destructor. More...
 
int TPZMultiTimer::nTimers () const
 Number of active timers. More...
 
TPZTimerTPZMultiTimer::getTimer (int i)
 Returns a specific timer. More...
 
const TPZTimerTPZMultiTimer::getTimer (int i) const
 Returns a specific timer. More...
 
std::string & TPZMultiTimer::processName (int i)
 Gets the process name (for reporting purposes). More...
 
const std::string & TPZMultiTimer::processName (int i) const
 Gets the process name (for reporting purposes). More...
 
void TPZMultiTimer::start (int i)
 Turns the timer on. More...
 
void TPZMultiTimer::start ()
 Turns the timer on. More...
 
void TPZMultiTimer::stop (int i)
 Turns the timer off, and computes the elapsed time. More...
 
void TPZMultiTimer::stop ()
 Turns the timer off, and computes the elapsed time. More...
 
void TPZMultiTimer::reset (int i)
 Zeroes the timer. More...
 
void TPZMultiTimer::reset ()
 Zeroes the timer. More...
 
double TPZMultiTimer::seconds (int i) const
 Returns the elapsed time in seconds. More...
 

Variables

TPZTimeTemp tempo
 External variable to TPZTimeTemp (to take time) More...
 
const int DEFAULTVEC_ALLOC
 To allocate vector by default. More...
 
pthread_mutex_t gAutoPointerMutexArray []
 

Detailed Description

The utility classes define general purpose classes such as vectors, stacks, binary trees and chunk vectors.
All classes in the utility package are templated in order to improve strong type checking.
The class will perform a bounds checking on the operator arguments.

Macro Definition Documentation

◆ AP_MUTEX_ARRAY_SZ

#define AP_MUTEX_ARRAY_SZ

Increment and Decrement actions are mutexed by this mutex.

Definition at line 19 of file tpzautopointer.h.

Referenced by AutoPointerMutexArrayInit::AutoPointerMutexArrayInit(), and AutoPointerMutexArrayInit::~AutoPointerMutexArrayInit().

◆ AP_MUTEX_HASH_1

#define AP_MUTEX_HASH_1

Definition at line 28 of file tpzautopointer.h.

◆ AP_MUTEX_HASH_2

#define AP_MUTEX_HASH_2

Definition at line 35 of file tpzautopointer.h.

Referenced by get_ap_mutex().

◆ DEFAULTCHUNKEXPONENT

#define DEFAULTCHUNKEXPONENT

Default number of elements in each chunk is $ pow(2,--) $.

Definition at line 29 of file TPZChunkVector.h.

◆ DEFAULTNUMBEROFCHUNKS

#define DEFAULTNUMBEROFCHUNKS

Default number of elements which will be allocated in the chunk vector.

Definition at line 23 of file TPZChunkVector.h.

Typedef Documentation

◆ TPZPix

typedef void* TPZPix

TPZPix is the iterator for the AVL binary tree class. Utility.

See also
TPZAVLMap

Definition at line 14 of file pzpix.h.

◆ TPZText

typedef TPZVec< TPZString > TPZText

Typedef to vector of strings.

Definition at line 126 of file pzstring.h.

Function Documentation

◆ ApplyPlaneRotation()

template<class Real >
void ApplyPlaneRotation ( Real &  dx,
Real &  dy,
Real &  cs,
Real &  sn 
)

Makes rotation of the plane based on the cs and sn parameters.

Definition at line 195 of file gmres.h.

Referenced by GMRES().

◆ Cross()

template<class T >
void Cross ( const TPZVec< T > &  x1,
const TPZVec< T > &  x2,
TPZVec< T > &  result 
)

◆ dist()

template<class T1 >
REAL dist ( TPZVec< T1 > &  vec1,
TPZVec< T1 > &  vec2 
)

◆ Dot()

template<class T >
T Dot ( const TPZVec< T > &  x1,
const TPZVec< T > &  x2 
)

Definition at line 273 of file pzvec_extras.h.

References TPZVec< T >::NElements(), and PZError.

◆ Find()

template<class T >
int Find ( TPZVec< T > &  v,
const T &  e 
)

Finds if exists the element e into vector v.

Definition at line 150 of file pzvec_extras.h.

References dist(), and TPZVec< T >::NElements().

◆ GeneratePlaneRotation()

template<class Real >
void GeneratePlaneRotation ( Real &  dx,
Real &  dy,
Real &  cs,
Real &  sn 
)

Compute the values cs and sn parameters to rotation.

Definition at line 176 of file gmres.h.

References abs(), dx(), and sqrt.

Referenced by GMRES().

◆ get_ap_mutex()

pthread_mutex_t* get_ap_mutex ( void *  obj)
inline

◆ getTimer() [1/2]

TPZTimer & TPZMultiTimer::getTimer ( int  i)
inline

Returns a specific timer.

Definition at line 212 of file TPZTimer.h.

References TPZMultiTimer::timers.

Referenced by operator<<().

◆ getTimer() [2/2]

const TPZTimer & TPZMultiTimer::getTimer ( int  i) const
inline

Returns a specific timer.

Definition at line 218 of file TPZTimer.h.

References TPZMultiTimer::timers.

◆ InitializePZLOG() [1/2]

void InitializePZLOG ( const std::string &  configfile)
inline

Initialize a log file adequated to use log4cxx lib.

Definition at line 106 of file pzlog.h.

◆ InitializePZLOG() [2/2]

void InitializePZLOG ( )

Initializes log file for log4cxx with commom name log4cxx.cfg.

Definition at line 14 of file pzlog.cpp.

References InitializePZLOG(), and test::res.

Referenced by InitializePZLOG(), and main().

◆ Intersect() [1/2]

template<class T , int N>
void Intersect ( const TPZVec< T > &  one,
const TPZVec< T > &  two,
TPZStack< T, N > &  result 
)

Gets commom elements into the one and two vectors.

Definition at line 188 of file pzvec_extras.h.

References TPZVec< T >::NElements(), and TPZStack< T, NumExtAlloc >::Push().

◆ Intersect() [2/2]

template<class T , int N>
void Intersect ( const TPZVec< T > &  one,
const TPZVec< T > &  two,
const TPZVec< T > &  three,
TPZStack< T, N > &  result 
)

Gets commom elements into the one, two and three vectors.

Definition at line 213 of file pzvec_extras.h.

References TPZVec< T >::NElements(), and TPZStack< T, NumExtAlloc >::Push().

◆ Max()

template<class T >
T Max ( TPZVec< T > &  v)

Returns the maximum element into v.

Definition at line 174 of file pzvec_extras.h.

References m, and TPZVec< T >::NElements().

◆ Min()

template<class T >
T Min ( TPZVec< T > &  v)

Returns the minimum element into v.

Definition at line 160 of file pzvec_extras.h.

References m, and TPZVec< T >::NElements().

◆ Norm()

template<class T >
T Norm ( const TPZVec< T > &  one)

Gets commom elements into the one and two vectors.

Definition at line 245 of file pzvec_extras.h.

References TPZVec< T >::NElements(), test::res, and sqrt.

◆ nTimers()

int TPZMultiTimer::nTimers ( ) const
inline

Number of active timers.

Definition at line 206 of file TPZTimer.h.

References TPZMultiTimer::timers.

Referenced by operator<<().

◆ operator-()

template<class T >
TPZVec<T> operator- ( const TPZVec< T > &  a,
const TPZVec< T > &  b 
)

substracts two vectors

Definition at line 65 of file pzvec_extras.h.

References DebugStop, and TPZVec< T >::size().

◆ operator-=()

template<class T >
TPZVec<T>& operator-= ( TPZVec< T > &  a,
const TPZVec< T > &  b 
)

◆ processName() [1/4]

std::string & TPZTimer::processName ( )
inline

◆ processName() [2/4]

const std::string & TPZTimer::processName ( ) const
inline

Gets the process name (for reporting purposes).

Definition at line 174 of file TPZTimer.h.

References TPZTimer::ProcessName.

◆ processName() [3/4]

std::string & TPZMultiTimer::processName ( int  i)
inline

Gets the process name (for reporting purposes).

Definition at line 224 of file TPZTimer.h.

References TPZMultiTimer::timers.

Referenced by operator<<(), and TPZReadTetGen::Process().

◆ processName() [4/4]

const std::string & TPZMultiTimer::processName ( int  i) const
inline

Gets the process name (for reporting purposes).

Definition at line 230 of file TPZTimer.h.

References TPZMultiTimer::timers.

◆ ReadInternal()

template<typename T , typename std::enable_if< std::is_pointer< T >::value, int >::type * = nullptr>
void ReadInternal ( T &  output,
TPZStream buf,
void *  context 
)

An object of this class implements a vector which allocates objects by chunks. Utility.

Definition at line 142 of file TPZChunkVector.h.

References TPZPersistenceManager::GetInstance(), and TPZStream::Read().

Referenced by TPZAdmChunkVector< TPZGeoEl *>::Read(), and TPZChunkVector< TPZGraphNode, 10 >::Read().

◆ reset() [1/3]

void TPZTimer::reset ( )
inline

Zeroes the timer.

Definition at line 180 of file TPZTimer.h.

References TPZTimer::AccumSec.

◆ reset() [2/3]

void TPZMultiTimer::reset ( int  i)
inline

Zeroes the timer.

Definition at line 266 of file TPZTimer.h.

References TPZMultiTimer::timers.

◆ reset() [3/3]

void TPZMultiTimer::reset ( )
inline

Zeroes the timer.

Definition at line 272 of file TPZTimer.h.

References TPZMultiTimer::timers.

◆ saxpy()

template<class T1 , class T2 , class Scalar >
void saxpy ( TPZVec< T1 > &  x,
const TPZVec< T2 > &  y,
Scalar  s 
)

Performs a saxpy operation: x <- x + s * y.

Since
Jan 9, 2002
Author
Cantao!

Definition at line 24 of file pzvec_extras.h.

References TPZVec< T >::NElements(), and PZError.

Referenced by TPZTensor< STATE >::ComputeEigenvector1().

◆ sdot()

template<class T1 >
double sdot ( TPZVec< T1 > &  x,
TPZVec< T1 > &  y 
)

Performs a sdot operation: dot <- Transpose[x] * y.

Since
Mar 20, 2003
Author
Tiago Forti
Erick Santos

Definition at line 98 of file pzvec_extras.h.

References TPZVec< T >::NElements(), and PZError.

Referenced by TPZInterfaceElement::ComputeNormal(), TPZGeoElSide::Normal(), and TPZPlasticStep< YC_t, TF_t, ER_t >::UpdatePlasticVars().

◆ seconds() [1/2]

double TPZTimer::seconds ( ) const
inline

Returns the elapsed time in seconds.

Definition at line 186 of file TPZTimer.h.

References TPZTimer::AccumSec.

◆ seconds() [2/2]

double TPZMultiTimer::seconds ( int  i) const
inline

Returns the elapsed time in seconds.

Definition at line 281 of file TPZTimer.h.

References TPZMultiTimer::timers.

◆ Sort()

template<class T >
TPZVec< T >& Sort ( TPZVec< T > &  v)

Sorting the elements into v.

Definition at line 142 of file pzvec_extras.h.

References TPZVec< T >::begin(), and TPZVec< T >::NElements().

Referenced by TPZMatrix< STATE >::SetIsDecomposed(), and TPZMatrix< STATE >::SolveEigenvaluesJacobi().

◆ sscal()

template<class T1 , class Scalar >
void sscal ( TPZVec< T1 > &  x,
const Scalar  s 
)

Performs a sscal operation: x <- x * s.

Since
Mar 20, 2003
Author
Tiago Forti
Erick Santos

Definition at line 49 of file pzvec_extras.h.

References TPZVec< T >::NElements().

Referenced by TPZTensor< STATE >::ComputeEigenvector1().

◆ start() [1/2]

void TPZMultiTimer::start ( int  i)
inline

Turns the timer on.

Definition at line 236 of file TPZTimer.h.

References TPZMultiTimer::timers.

Referenced by TPZReadTetGen::Process().

◆ start() [2/2]

void TPZMultiTimer::start ( )
inline

Turns the timer on.

Definition at line 242 of file TPZTimer.h.

References TPZMultiTimer::timers.

◆ stop() [1/2]

void TPZMultiTimer::stop ( int  i)
inline

Turns the timer off, and computes the elapsed time.

Definition at line 251 of file TPZTimer.h.

References TPZMultiTimer::timers.

Referenced by TPZReadTetGen::Process().

◆ stop() [2/2]

void TPZMultiTimer::stop ( )
inline

Turns the timer off, and computes the elapsed time.

Definition at line 257 of file TPZTimer.h.

References TPZMultiTimer::timers.

◆ TPZAutoPointerDynamicCast()

template<typename R , typename T >
TPZAutoPointer<R> TPZAutoPointerDynamicCast ( TPZAutoPointer< T >  in)

◆ TPZMultiTimer()

TPZMultiTimer::TPZMultiTimer ( int  nT)
inline

Default constructor.

Parameters
nTNumber of different timers we want to use.

Definition at line 194 of file TPZTimer.h.

References TPZMultiTimer::timers.

◆ TPZTimer() [1/2]

TPZTimer::TPZTimer ( )
inline

Definition at line 159 of file TPZTimer.h.

◆ TPZTimer() [2/2]

TPZTimer::TPZTimer ( std::string  pn)
inline

Default constructor.

Parameters
pnThe user can give a "process name" to the timer.
This name will be printed when the extraction operator is called.

Definition at line 162 of file TPZTimer.h.

◆ ~TPZMultiTimer()

TPZMultiTimer::~TPZMultiTimer ( )
inline

Destructor.

Definition at line 200 of file TPZTimer.h.

◆ ~TPZTimer()

TPZTimer::~TPZTimer ( )
inline

Default Destructor.

Definition at line 165 of file TPZTimer.h.

Variable Documentation

◆ DEFAULTVEC_ALLOC

const int DEFAULTVEC_ALLOC

To allocate vector by default.

Definition at line 13 of file pzmanvector.h.

◆ gAutoPointerMutexArray

pthread_mutex_t gAutoPointerMutexArray[]

◆ tempo

TPZTimeTemp tempo