65 const Table &table2,
int offset2);
69 const Table &table2,
int offset2,
70 const Table &table3,
int offset3);
73 explicit Table(
int dim,
int connections_per_row = 3);
81 Table(
int nrows,
int *partitioning);
85 void MakeI(
int nrows);
95 void SetSize(
int dim,
int connections_per_row);
100 void SetDims(
int rows,
int nnz);
137 const int *
ReadI(
bool on_dev =
true)
const {
return I.
Read(on_dev); }
144 const int *
ReadJ(
bool on_dev =
true)
const {
return J.
Read(on_dev); }
156 void SetIJ(
int *newI,
int *newJ,
int newsize = -1);
163 int Push(
int i,
int j );
190 void Save(std::ostream &
out)
const;
191 void Load(std::istream &in);
202void Transpose (
const Table &A, Table &At,
int ncols_A_ = -1);
211void Transpose(
const Array<int> &A, Table &At,
int ncols_A_ = -1);
214void Mult (
const Table &A,
const Table &B, Table &C);
215Table *
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
257 MemAlloc <Node, 1024> NodesMem;
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)); }
Memory< T > & GetMemory()
Return a reference to the Memory object used by the Array.
const T * HostRead() const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), false).
T * ReadWrite(bool on_dev=true)
Shortcut for mfem::ReadWrite(a.GetMemory(), a.Size(), on_dev).
void LoseData()
NULL-ifies the data.
int Size() const
Return the logical size of the array.
T * Write(bool on_dev=true)
Shortcut for mfem::Write(a.GetMemory(), a.Size(), on_dev).
T * GetData()
Returns the data.
const T * Read(bool on_dev=true) const
Shortcut for mfem::Read(a.GetMemory(), a.Size(), on_dev).
T * HostReadWrite()
Shortcut for mfem::ReadWrite(a.GetMemory(), a.Size(), false).
T * HostWrite()
Shortcut for mfem::Write(a.GetMemory(), a.Size(), false).
RowIterator(const DSTable &t, int r)
void SetIndex(int new_idx)
int NumberOfEntries() const
int operator()(int a, int b) const
Class used by MFEM to store pointers to host and/or device memory.
STable(int dim, int connections_per_row=3)
Creates table with fixed number of connections.
~STable()
Destroys STable.
int operator()(int i, int j) const
Table stores the connectivity of elements of TYPE I to elements of TYPE II. For example,...
void Save(std::ostream &out) const
void LoseData()
Releases ownership of and null-ifies the data.
int size
The number of TYPE I elements.
const int * GetRow(int i) const
int * ReadWriteI(bool on_dev=true)
const int * HostReadI() const
const int * ReadJ(bool on_dev=true) const
Table(int nrows, Array< Connection > &list)
Create a table from a list of connections, see MakeFromList().
Array< int > J
The length of the J array is equal to the number of connections between TYPE I and TYPE II elements.
void AddConnections(int r, const int *c, int nc)
void PrintMatlab(std::ostream &out) const
void Load(std::istream &in)
int operator()(int i, int j) const
Returns index of the connection between element i of TYPE I and element j of TYPE II.
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 GetRow(int i, Array< int > &row) const
Return row i in array row (the Table must be finalized)
const Memory< int > & GetIMemory() const
int Push(int i, int j)
Establish connection between element i and element j in the table.
void AddConnection(int r, int c)
Array< int > I
The length of the I array is 'size + 1',.
void Finalize()
Finalize the table initialization.
void Print(std::ostream &out=mfem::out, int width=4) const
Prints the table to the stream out.
void SetIJ(int *newI, int *newJ, int newsize=-1)
Replace the I and J arrays with the given newI and newJ arrays.
const int * HostReadJ() const
Table()
Creates an empty table.
int Size() const
Returns the number of TYPE I elements.
int Width() const
Returns the number of TYPE II elements (after Finalize() is called).
const int * ReadI(bool on_dev=true) const
std::size_t MemoryUsage() const
int Size_of_connections() const
Returns the number of connections in the table.
void AddColumnsInRow(int r, int ncol)
void 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 ...
void Copy(Table ©) const
int * WriteI(bool on_dev=true)
Memory< int > & GetJMemory()
void AddAColumnInRow(int r)
void SortRows()
Sort the column (TYPE II) indices in each row.
int * WriteJ(bool on_dev=true)
int * ReadWriteJ(bool on_dev=true)
void SetDims(int rows, int nnz)
Set the rows and the number of all connections for the table.
Memory< int > & GetIMemory()
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
void Transpose(const Table &A, Table &At, int ncols_A_)
Transpose a Table.
Helper struct for defining a connectivity table, see Table::MakeFromList.
bool operator==(const Connection &rhs) const
bool operator<(const Connection &rhs) const
Connection(int from, int to)