65 explicit Table (
int dim,
int connections_per_row = 3);
73 Table (
int nrows,
int *partitioning);
76 void MakeI (
int nrows);
85 void SetSize(
int dim,
int connections_per_row);
89 void SetDims(
int rows,
int nnz);
115 const int *
GetI()
const {
return I; }
116 const int *
GetJ()
const {
return J; }
123 const int *
ReadI(
bool on_dev =
true)
const
136 const int *
ReadJ(
bool on_dev =
true)
const
154 void SetIJ(
int *newI,
int *newJ,
int newsize = -1);
161 int Push(
int i,
int j );
186 void Save(std::ostream &
out)
const;
187 void Load(std::istream &in);
207 void Transpose (
const Table &A, Table &At,
int ncols_A_ = -1);
211 void Transpose(
const Array<int> &A, Table &At,
int ncols_A_ = -1);
214 void Mult (
const Table &A,
const Table &B, Table &C);
215 Table *
Mult (
const Table &A,
const Table &B);
225 STable (
int dim,
int connections_per_row = 3);
237 int Push(
int i,
int j );
254 int NumRows, NumEntries;
256 #ifdef MFEM_USE_MEMALLOC
260 int Push_(
int r,
int c);
261 int Index(
int r,
int c)
const;
268 {
return ((a <= b) ? Push_(a, b) : Push_(b, a)); }
270 {
return ((a <= b) ? Index(a, b) : Index(b, a)); }
const int * ReadJ(bool on_dev=true) const
int * ReadWriteJ(bool on_dev=true)
Table(int nrows, Array< Connection > &list)
void SetSize(int dim, int connections_per_row)
Set the size and the number of connections for the table.
const Memory< int > & GetJMemory() const
void AddColumnsInRow(int r, int ncol)
int operator()(int i, int j) const
void MakeI(int nrows)
Next 7 methods are used together with the default constructor.
void Swap< Table >(Table &a, Table &b)
Specialization of the template function Swap<> for class Table.
void SortRows()
Sort the column (TYPE II) indices in each row.
bool operator<(const Connection &rhs) const
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
void SetDims(int rows, int nnz)
int * WriteI(bool on_dev=true)
T * Write(Memory< T > &mem, int size, bool on_dev=true)
Get a pointer for write access to mem with the mfem::Device's DeviceMemoryClass, if on_dev = true...
void GetRow(int i, Array< int > &row) const
Return row i in array row (the Table must be finalized)
void Save(std::ostream &out) const
void LoseData()
Call this if data has been stolen.
const int * HostReadI() const
int * WriteJ(bool on_dev=true)
const Memory< int > & GetIMemory() const
int Size_of_connections() const
int Capacity() const
Return the size of the allocated memory.
RowIterator(const DSTable &t, int r)
void AddConnections(int r, const int *c, int nc)
int Width() const
Returns the number of TYPE II elements (after Finalize() is called).
int operator()(int i, int j) const
void Print(std::ostream &out=mfem::out, int width=4) const
Prints the table to stream out.
void MakeFromList(int nrows, const Array< Connection > &list)
Table & operator=(const Table &rhs)
Assignment operator: deep copy.
Memory< int > & GetJMemory()
void AddConnection(int r, int c)
int Size() const
Returns the number of TYPE I elements.
const T * Read(const Memory< T > &mem, int size, bool on_dev=true)
Get a pointer for read access to mem with the mfem::Device's DeviceMemoryClass, if on_dev = true...
Connection(int from, int to)
void Reset()
Reset the memory to be empty, ensuring that Delete() will be a no-op.
void PrintMatlab(std::ostream &out) const
STable(int dim, int connections_per_row=3)
Creates table with fixed number of connections.
void SetIndex(int new_idx)
Memory< int > & GetIMemory()
int size
size is the number of TYPE I elements.
void AddAColumnInRow(int r)
void Transpose(const Table &A, Table &At, int ncols_A_)
Transpose a Table.
Helper struct for defining a connectivity table, see Table::MakeFromList.
T * ReadWrite(Memory< T > &mem, int size, bool on_dev=true)
Get a pointer for read+write access to mem with the mfem::Device's DeviceMemoryClass, if on_dev = true, or the mfem::Device's HostMemoryClass, otherwise.
void Load(std::istream &in)
void SetIJ(int *newI, int *newJ, int newsize=-1)
Replace the I and J arrays with the given newI and newJ arrays.
bool operator==(const Connection &rhs) const
int * ReadWriteI(bool on_dev=true)
const int * GetRow(int i) const
const int * HostReadJ() const
~STable()
Destroys STable.
int operator()(int a, int b) const
int NumberOfEntries() const
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
std::size_t MemoryUsage() const
void Copy(Table ©) const
const int * ReadI(bool on_dev=true) const
Table()
Creates an empty table.