MFEM  v4.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Protected Attributes | List of all members
mfem::Table Class Reference

#include <table.hpp>

Inheritance diagram for mfem::Table:
[legend]
Collaboration diagram for mfem::Table:
[legend]

Public Member Functions

 Table ()
 Creates an empty table. More...
 
 Table (const Table &)
 Copy constructor. More...
 
Tableoperator= (const Table &rhs)
 Assignment operator: deep copy. More...
 
 Table (int dim, int connections_per_row=3)
 Create a table with an upper limit for the number of connections. More...
 
 Table (int nrows, Array< Connection > &list)
 
 Table (int nrows, int *partitioning)
 
void MakeI (int nrows)
 Next 7 methods are used together with the default constructor. More...
 
void AddAColumnInRow (int r)
 
void AddColumnsInRow (int r, int ncol)
 
void MakeJ ()
 
void AddConnection (int r, int c)
 
void AddConnections (int r, const int *c, int nc)
 
void ShiftUpI ()
 
void SetSize (int dim, int connections_per_row)
 Set the size and the number of connections for the table. More...
 
void SetDims (int rows, int nnz)
 
int Size () const
 Returns the number of TYPE I elements. More...
 
int Size_of_connections () const
 
int operator() (int i, int j) const
 
void GetRow (int i, Array< int > &row) const
 Return row i in array row (the Table must be finalized) More...
 
int RowSize (int i) const
 
const int * GetRow (int i) const
 
int * GetRow (int i)
 
int * GetI ()
 
int * GetJ ()
 
const int * GetI () const
 
const int * GetJ () const
 
Memory< int > & GetIMemory ()
 
Memory< int > & GetJMemory ()
 
const Memory< int > & GetIMemory () const
 
const Memory< int > & GetJMemory () const
 
void SortRows ()
 Sort the column (TYPE II) indices in each row. More...
 
void SetIJ (int *newI, int *newJ, int newsize=-1)
 Replace the I and J arrays with the given newI and newJ arrays. More...
 
int Push (int i, int j)
 
void Finalize ()
 
void MakeFromList (int nrows, const Array< Connection > &list)
 
int Width () const
 Returns the number of TYPE II elements (after Finalize() is called). More...
 
void LoseData ()
 Call this if data has been stolen. More...
 
void Print (std::ostream &out=mfem::out, int width=4) const
 Prints the table to stream out. More...
 
void PrintMatlab (std::ostream &out) const
 
void Save (std::ostream &out) const
 
void Load (std::istream &in)
 
void Copy (Table &copy) const
 
void Swap (Table &other)
 
void Clear ()
 
long MemoryUsage () const
 
 ~Table ()
 Destroys Table. More...
 

Protected Attributes

int size
 size is the number of TYPE I elements. More...
 
Memory< int > I
 
Memory< int > J
 

Detailed Description

Data type Table. Table stores the connectivity of elements of TYPE I to elements of TYPE II, for example, it may be Element-To-Face connectivity table, etc.

Definition at line 43 of file table.hpp.

Constructor & Destructor Documentation

mfem::Table::Table ( )
inline

Creates an empty table.

Definition at line 56 of file table.hpp.

mfem::Table::Table ( const Table table)

Copy constructor.

Definition at line 27 of file table.cpp.

mfem::Table::Table ( int  dim,
int  connections_per_row = 3 
)
explicit

Create a table with an upper limit for the number of connections.

Definition at line 54 of file table.cpp.

mfem::Table::Table ( int  nrows,
Array< Connection > &  list 
)
inline

Create a table from a list of connections, see MakeFromList().

Definition at line 68 of file table.hpp.

mfem::Table::Table ( int  nrows,
int *  partitioning 
)

Create a table with one entry per row with column indices given by 'partitioning'.

Definition at line 70 of file table.cpp.

mfem::Table::~Table ( )

Destroys Table.

Definition at line 408 of file table.cpp.

Member Function Documentation

void mfem::Table::AddAColumnInRow ( int  r)
inline

Definition at line 77 of file table.hpp.

void mfem::Table::AddColumnsInRow ( int  r,
int  ncol 
)
inline

Definition at line 78 of file table.hpp.

void mfem::Table::AddConnection ( int  r,
int  c 
)
inline

Definition at line 80 of file table.hpp.

void mfem::Table::AddConnections ( int  r,
const int *  c,
int  nc 
)

Definition at line 108 of file table.cpp.

void mfem::Table::Clear ( )

Definition at line 381 of file table.cpp.

void mfem::Table::Copy ( Table copy) const

Definition at line 390 of file table.cpp.

void mfem::Table::Finalize ( )

Finalize the table initialization. The function may be called only once, after the table has been initialized, in order to compress array J (by getting rid of -1's in array J). Calling this function will "freeze" the table and function Push will work no more. Note: The table is functional even without calling Finalize().

Definition at line 243 of file table.cpp.

int* mfem::Table::GetI ( )
inline

Definition at line 113 of file table.hpp.

const int* mfem::Table::GetI ( ) const
inline

Definition at line 115 of file table.hpp.

Memory<int>& mfem::Table::GetIMemory ( )
inline

Definition at line 118 of file table.hpp.

const Memory<int>& mfem::Table::GetIMemory ( ) const
inline

Definition at line 120 of file table.hpp.

int* mfem::Table::GetJ ( )
inline

Definition at line 114 of file table.hpp.

const int* mfem::Table::GetJ ( ) const
inline

Definition at line 116 of file table.hpp.

Memory<int>& mfem::Table::GetJMemory ( )
inline

Definition at line 119 of file table.hpp.

const Memory<int>& mfem::Table::GetJMemory ( ) const
inline

Definition at line 121 of file table.hpp.

void mfem::Table::GetRow ( int  i,
Array< int > &  row 
) const

Return row i in array row (the Table must be finalized)

Definition at line 191 of file table.cpp.

const int* mfem::Table::GetRow ( int  i) const
inline

Definition at line 110 of file table.hpp.

int* mfem::Table::GetRow ( int  i)
inline

Definition at line 111 of file table.hpp.

void mfem::Table::Load ( std::istream &  in)

Definition at line 362 of file table.cpp.

void mfem::Table::LoseData ( )
inline

Call this if data has been stolen.

Definition at line 154 of file table.hpp.

void mfem::Table::MakeFromList ( int  nrows,
const Array< Connection > &  list 
)

Create the table from a list of connections {(from, to)}, where 'from' is a TYPE I index and 'to' is a TYPE II index. The list is assumed to be sorted and free of duplicities, i.e., you need to call Array::Sort and Array::Unique before calling this method.

Definition at line 280 of file table.cpp.

void mfem::Table::MakeI ( int  nrows)

Next 7 methods are used together with the default constructor.

Definition at line 85 of file table.cpp.

void mfem::Table::MakeJ ( )

Definition at line 95 of file table.cpp.

long mfem::Table::MemoryUsage ( ) const

Definition at line 402 of file table.cpp.

int mfem::Table::operator() ( int  i,
int  j 
) const

Returns index of the connection between element i of TYPE I and element j of TYPE II. If there is no connection between element i and element j established in the table, then the return value is -1.

Definition at line 169 of file table.cpp.

Table & mfem::Table::operator= ( const Table rhs)

Assignment operator: deep copy.

Definition at line 44 of file table.cpp.

void mfem::Table::Print ( std::ostream &  out = mfem::out,
int  width = 4 
) const

Prints the table to stream out.

Definition at line 311 of file table.cpp.

void mfem::Table::PrintMatlab ( std::ostream &  out) const

Definition at line 333 of file table.cpp.

int mfem::Table::Push ( int  i,
int  j 
)

Establish connection between element i and element j in the table. The return value is the index of the connection. It returns -1 if it fails to establish the connection. Possibilities are there is not enough memory on row i to establish connection to j, an attempt to establish new connection after calling Finalize().

Definition at line 220 of file table.cpp.

int mfem::Table::RowSize ( int  i) const
inline

Definition at line 108 of file table.hpp.

void mfem::Table::Save ( std::ostream &  out) const

Definition at line 348 of file table.cpp.

void mfem::Table::SetDims ( int  rows,
int  nnz 
)

Set the rows and the number of all connections for the table. Does NOT initialize the whole array I ! (I[0]=0 and I[rows]=nnz only)

Definition at line 144 of file table.cpp.

void mfem::Table::SetIJ ( int *  newI,
int *  newJ,
int  newsize = -1 
)

Replace the I and J arrays with the given newI and newJ arrays.

If newsize < 0, then the size of the Table is not modified.

Definition at line 208 of file table.cpp.

void mfem::Table::SetSize ( int  dim,
int  connections_per_row 
)

Set the size and the number of connections for the table.

Definition at line 128 of file table.cpp.

void mfem::Table::ShiftUpI ( )

Definition at line 119 of file table.cpp.

int mfem::Table::Size ( ) const
inline

Returns the number of TYPE I elements.

Definition at line 92 of file table.hpp.

int mfem::Table::Size_of_connections ( ) const
inline

Returns the number of connections in the table. If Finalize() is not called, it returns the number of possible connections established by the used constructor. Otherwise, it is exactly the number of established connections before calling Finalize().

Definition at line 98 of file table.hpp.

void mfem::Table::SortRows ( )

Sort the column (TYPE II) indices in each row.

Definition at line 200 of file table.cpp.

void mfem::Table::Swap ( Table other)

Definition at line 395 of file table.cpp.

int mfem::Table::Width ( ) const

Returns the number of TYPE II elements (after Finalize() is called).

Definition at line 301 of file table.cpp.

Member Data Documentation

Memory<int> mfem::Table::I
protected

Arrays for the connectivity information in the CSR storage. I is of size "size+1", J is of size the number of connections between TYPE I to TYPE II elements (actually stored I[size]).

Definition at line 52 of file table.hpp.

Memory<int> mfem::Table::J
protected

Definition at line 52 of file table.hpp.

int mfem::Table::size
protected

size is the number of TYPE I elements.

Definition at line 47 of file table.hpp.


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