26#ifndef OOMPH_MAP_MATRIX_HEADER
27#define OOMPH_MAP_MATRIX_HEADER
32#include <oomph-lib-config.h>
107 template<
class KEY_TYPE_ROW,
class KEY_TYPE_COL,
class VALUE_TYPE>
127 typedef std::map<KEY_TYPE_ROW, std::map<KEY_TYPE_COL, VALUE_TYPE>*>
158 if (
it2->second != 0)
161 (*this)(
it->first,
it2->first) =
it2->second;
171 std::map<KEY_TYPE_ROW, VALUE_TYPE>&
copied_map)
283 if (
it2->second != 0)
298 unsigned long count = 0;
314 if (
it2->second != 0)
328 unsigned long count = 0;
345 if (
it2->second != 0)
360 unsigned long count = 0;
386 unsigned long count = 0;
418 Row_pt[
i] =
new std::map<KEY_TYPE_COL, VALUE_TYPE>;
432 std::map<KEY_TYPE_ROW, std::map<KEY_TYPE_COL, VALUE_TYPE>*>
Row_pt;
506 template<
class KEY_TYPE,
class VALUE_TYPE>
523 typedef std::map<KEY_TYPE, std::map<KEY_TYPE, VALUE_TYPE>*>
OuterMap;
549 if (
it2->second != 0)
551 (*this)(
it->first,
it2->first) =
it2->second;
MapMatrixMixed is a generalised, STL-map-based, sparse(ish) matrix class with mixed indices.
VALUE_TYPE & operator()(const KEY_TYPE_ROW &i, const KEY_TYPE_COL &j)
Return (reference to) entry. Careful: If the entry does not exist then it is created and set to zero.
InnerMapMixed::const_iterator ConstInnerMixedIt
Typedef to keep the code more readable const version.
void operator=(const MapMatrixMixed &)=delete
Broken assignment operator.
VALUE_TYPE * entry_pt(const KEY_TYPE_ROW &i, const KEY_TYPE_COL &j)
Return pointer to entry.
unsigned long nnz()
Work out number of non-‘zero’ entries.
void copy_column(const KEY_TYPE_COL &j, std::map< KEY_TYPE_ROW, VALUE_TYPE > &copied_map)
Copy a single column into its own map.
MapMatrixMixed()
Default (empty) constructor.
unsigned long nnz() const
Work out number of non-‘zero’ entries, const version.
std::map< KEY_TYPE_COL, VALUE_TYPE > InnerMapMixed
Typedef to keep the code more readable.
virtual ~MapMatrixMixed()
Destructor.
InnerMapMixed::iterator InnerMixedIt
Typedef to keep the code more readable.
void output(std::ostream &outfile)
Dump all non-‘zero’ entries to file. Output is in the format ‘i’, ‘j’, ‘entry[i][j]’.
OuterMapMixed::const_iterator ConstOuterMixedIt
Typedef to keep the code more readable const version.
void clear()
Wipe all entries.
std::map< KEY_TYPE_ROW, std::map< KEY_TYPE_COL, VALUE_TYPE > * > Row_pt
Here's the generalised matrix structure: A map of pointers to the maps that hold the entries in each ...
unsigned long size() const
Work out total number of entries const version.
MapMatrixMixed(const MapMatrixMixed< KEY_TYPE_ROW, KEY_TYPE_COL, VALUE_TYPE > &map_mat)
Copy constructor.
OuterMapMixed::iterator OuterMixedIt
Typedef to keep the code more readable.
VALUE_TYPE get(const KEY_TYPE_ROW &i, const KEY_TYPE_COL &j) const
Get an element corresponding to the key (i,j) Searches the container for an element with a key equiva...
unsigned long size()
Work out total number of entries.
std::map< KEY_TYPE_ROW, std::map< KEY_TYPE_COL, VALUE_TYPE > * > OuterMapMixed
Typedef to keep the code more readable.
MapMatrix is a generalised, STL-map-based, sparse(-ish) matrix class.
std::map< KEY_TYPE, std::map< KEY_TYPE, VALUE_TYPE > * > OuterMap
Typedef to keep the code more readable.
InnerMap::iterator InnerIt
Typedef to keep the code more readable.
MapMatrix()
Default (empty) constructor.
OuterMap::const_iterator ConstOuterIt
Typedef to keep the code more readable.
OuterMap::iterator OuterIt
Typedef to keep the code more readable.
InnerMap::const_iterator ConstInnerIt
Typedef to keep the code more readable.
MapMatrix(const MapMatrix< KEY_TYPE, VALUE_TYPE > &map_mat)
Copy constructor.
void operator=(const MapMatrix &)=delete
Broken assignment operator.
std::map< KEY_TYPE, VALUE_TYPE > InnerMap
Typedef to keep the code more readable.
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).