10#ifndef TEUCHOS_TABLE_HPP 
   11#define TEUCHOS_TABLE_HPP 
   13#include "Teuchos_TableDecl.hpp" 
   14#include "Teuchos_Assert.hpp" 
   15#include "Teuchos_vector.hpp" 
   25Table<T>::Table(
int ncols_init, 
int nrows_reserve):ncols(ncols_init) {
 
   27  reserve(data, ncols * nrows_reserve);
 
   31void swap(Table<T>& a, Table<T>& b) {
 
   34  swap(a.ncols, b.ncols);
 
   38int get_nrows(Table<T> 
const& t) {
 
   39  TEUCHOS_DEBUG_ASSERT(t.ncols > 0);
 
   40  TEUCHOS_DEBUG_ASSERT(Teuchos::size(t.data) % t.ncols == 0);
 
   41  return Teuchos::size(t.data) / t.ncols;
 
   45int get_ncols(Table<T> 
const& t) { 
return t.ncols; }
 
   48void resize(Table<T>& t, 
int new_nrows, 
int new_ncols) {
 
   50  Teuchos::resize(t.data, new_nrows * t.ncols);
 
   54typename Table<T>::Ref at(Table<T>& t, 
int row, 
int col) {
 
   55  TEUCHOS_DEBUG_ASSERT(0 <= col);
 
   56  TEUCHOS_DEBUG_ASSERT(col < t.ncols);
 
   57  TEUCHOS_DEBUG_ASSERT(0 <= row);
 
   58  TEUCHOS_DEBUG_ASSERT(row < get_nrows(t));
 
   59  return Teuchos::at(t.data, row * t.ncols + col);
 
   63typename Table<T>::ConstRef at(Table<T> 
const& t, 
int row, 
int col) {
 
   64  TEUCHOS_DEBUG_ASSERT(0 <= col);
 
   65  TEUCHOS_DEBUG_ASSERT(col < t.ncols);
 
   66  TEUCHOS_DEBUG_ASSERT(0 <= row);
 
   67  TEUCHOS_DEBUG_ASSERT(row < get_nrows(t));
 
   68  return Teuchos::at(t.data, row * t.ncols + col);
 
#define TEUCHOS_ASSERT(assertion_test)
This macro is throws when an assert fails.
 
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...