Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Two_tuple< T > Struct Template Reference

#include <Tuple.h>

Public Types

typedef Tuple_traits< T > Traits
 
typedef Traits::Value Value
 
typedef Traits::Value_opposite Value_opposite
 
typedef Traits::Pointer Pointer
 
typedef Traits::Const_pointer Const_pointer
 
typedef Traits::Reference Reference
 
typedef Traits::Const_reference Const_reference
 
typedef Traits::Init_reference Init_reference
 
typedef Traits::Pointer_equivalent Pointer_equivalent
 
typedef Two_tuple< T > Self
 
typedef const Two_tuple
< Value_opposite
Const_self
 

Public Member Functions

 Two_tuple ()
 
 Two_tuple (Init_reference p, Init_reference q)
 
 Two_tuple (Const_reference t)
 
Const_reference operator[] (int i) const
 
Reference operator[] (int i)
 
int dimension () const
 
int id () const
 
bool operator== (const Self &x) const
 
bool operator!= (const Self &x) const
 
std::ostream & print (std::ostream &os, const char *s) const
 
 operator Const_self & () const
 
Self operator+ (const Self &t) const
 
Self operator- (const Self &t) const
 
Selfoperator+= (const Self &t)
 
Selfoperator-= (const Self &t)
 
Value operator* (const Self &t) const
 
Selfoperator*= (Const_reference t)
 
Self operator/ (Const_reference t) const
 
Selfoperator/= (Const_reference t)
 
Self multiply (const Self &b) const
 
Self divide (const Self &b) const
 

Protected Attributes

Value v0
 
Value v1
 

Detailed Description

template<class T>
struct Two_tuple< T >

Definition at line 139 of file Tuple.h.

Member Typedef Documentation

Definition at line 144 of file Tuple.h.

Definition at line 146 of file Tuple.h.

Definition at line 151 of file Tuple.h.

Definition at line 147 of file Tuple.h.

Definition at line 143 of file Tuple.h.

Definition at line 148 of file Tuple.h.

Definition at line 145 of file Tuple.h.

typedef Two_tuple<T> Self

Definition at line 150 of file Tuple.h.

typedef Tuple_traits<T> Traits

Definition at line 140 of file Tuple.h.

Definition at line 141 of file Tuple.h.

Definition at line 142 of file Tuple.h.

Constructor & Destructor Documentation

Two_tuple ( )
inline

Definition at line 153 of file Tuple.h.

153 {}
Two_tuple ( Init_reference  p,
Init_reference  q 
)
inline

Definition at line 154 of file Tuple.h.

155  : v0(p), v1(q) {}
Value v1
Definition: Tuple.h:220
Value v0
Definition: Tuple.h:219
NT q
Two_tuple ( Const_reference  t)
inlineexplicit

Definition at line 156 of file Tuple.h.

156 : v0(t), v1(t) {}
Value v1
Definition: Tuple.h:220
Value v0
Definition: Tuple.h:219

Member Function Documentation

int dimension ( ) const
inline

Definition at line 166 of file Tuple.h.

166 { return 2; }
Self divide ( const Self b) const
inline

Definition at line 213 of file Tuple.h.

References Two_tuple< T >::v0, and Two_tuple< T >::v1.

213  {
214  return Self( b.v0==Value(0) ? Value(0) : v0 /b.v0,
215  b.v1==Value(0) ? Value(0) : v1 /b.v1);
216  }
Traits::Value Value
Definition: Tuple.h:141
Value v1
Definition: Tuple.h:220
Two_tuple< T > Self
Definition: Tuple.h:150
Value v0
Definition: Tuple.h:219
int id ( ) const
inline

Definition at line 167 of file Tuple.h.

167 { return static_cast<int>(this); }
Self multiply ( const Self b) const
inline

Definition at line 209 of file Tuple.h.

References Two_tuple< T >::v0, and Two_tuple< T >::v1.

209  {
210  return Self( v0 *b.v0, v1 *b.v1);
211  }
Value v1
Definition: Tuple.h:220
Two_tuple< T > Self
Definition: Tuple.h:150
Value v0
Definition: Tuple.h:219
operator Const_self & ( ) const
inline

Definition at line 182 of file Tuple.h.

183  { return reinterpret_cast<Const_self&>(*this); }
const Two_tuple< Value_opposite > Const_self
Definition: Tuple.h:151
bool operator!= ( const Self x) const
inline

Definition at line 169 of file Tuple.h.

References Two_tuple< T >::v0, and Two_tuple< T >::v1.

169 { return v0!=x.v0 || v1!=x.v1; }
void int int REAL * x
Definition: read.cpp:74
Value v1
Definition: Tuple.h:220
Value v0
Definition: Tuple.h:219
Value operator* ( const Self t) const
inline

Definition at line 197 of file Tuple.h.

References Two_tuple< T >::v0, and Two_tuple< T >::v1.

198  { return v0*t.v0+v1*t.v1; }
Value v1
Definition: Tuple.h:220
Value v0
Definition: Tuple.h:219
Self& operator*= ( Const_reference  t)
inline

Definition at line 200 of file Tuple.h.

References Two_tuple< T >::v0, and Two_tuple< T >::v1.

201  { v0*=t; v1*=t; return *this; }
Value v1
Definition: Tuple.h:220
Value v0
Definition: Tuple.h:219
Self operator+ ( const Self t) const
inline

Definition at line 185 of file Tuple.h.

References Two_tuple< T >::v0, and Two_tuple< T >::v1.

186  { return Self( v0+t.v0, v1+t.v1); }
Value v1
Definition: Tuple.h:220
Two_tuple< T > Self
Definition: Tuple.h:150
Value v0
Definition: Tuple.h:219
Self& operator+= ( const Self t)
inline

Definition at line 191 of file Tuple.h.

References Two_tuple< T >::v0, and Two_tuple< T >::v1.

192  { v0+=t.v0; v1+=t.v1; return *this; }
Value v1
Definition: Tuple.h:220
Value v0
Definition: Tuple.h:219
Self operator- ( const Self t) const
inline

Definition at line 188 of file Tuple.h.

References Two_tuple< T >::v0, and Two_tuple< T >::v1.

189  { return Self( v0-t.v0, v1-t.v1); }
Value v1
Definition: Tuple.h:220
Two_tuple< T > Self
Definition: Tuple.h:150
Value v0
Definition: Tuple.h:219
Self& operator-= ( const Self t)
inline

Definition at line 194 of file Tuple.h.

References Two_tuple< T >::v0, and Two_tuple< T >::v1.

195  { v0-=t.v0; v1-=t.v1; return *this; }
Value v1
Definition: Tuple.h:220
Value v0
Definition: Tuple.h:219
Self operator/ ( Const_reference  t) const
inline

Definition at line 203 of file Tuple.h.

References Two_tuple< T >::v0, and Two_tuple< T >::v1.

204  { return Self( v0/t, v1/t); }
Value v1
Definition: Tuple.h:220
Two_tuple< T > Self
Definition: Tuple.h:150
Value v0
Definition: Tuple.h:219
Self& operator/= ( Const_reference  t)
inline

Definition at line 206 of file Tuple.h.

References Two_tuple< T >::v0, and Two_tuple< T >::v1.

207  { v0/=t; v1/=t; return *this; }
Value v1
Definition: Tuple.h:220
Value v0
Definition: Tuple.h:219
bool operator== ( const Self x) const
inline

Definition at line 168 of file Tuple.h.

References Two_tuple< T >::v0, and Two_tuple< T >::v1.

168 { return v0==x.v0 && v1==x.v1; }
void int int REAL * x
Definition: read.cpp:74
Value v1
Definition: Tuple.h:220
Value v0
Definition: Tuple.h:219
Const_reference operator[] ( int  i) const
inline

Definition at line 158 of file Tuple.h.

References Tuple_traits< T >::ref().

158  {
159  return Traits::ref(reinterpret_cast<Pointer_equivalent>
160  (const_cast<Self*>(this))+i);
161  }
static Reference ref(Pointer_equivalent p)
Definition: Tuple.h:42
blockLoc i
Definition: read.cpp:79

Here is the call graph for this function:

Reference operator[] ( int  i)
inline

Definition at line 162 of file Tuple.h.

References Tuple_traits< T >::ref().

162  {
163  return Traits::ref(reinterpret_cast<Pointer_equivalent>(this)+(i&1));
164  }
static Reference ref(Pointer_equivalent p)
Definition: Tuple.h:42
blockLoc i
Definition: read.cpp:79

Here is the call graph for this function:

std::ostream& print ( std::ostream &  os,
const char *  s 
) const
inline

Definition at line 171 of file Tuple.h.

References IO::ASCII, IO::BINARY, IO::mode, Two_tuple< T >::v0, and Two_tuple< T >::v1.

171  {
172  switch(os.iword(IO::mode)) {
173  case IO::ASCII :
174  return os << v0 << ' ' << v1;
175  case IO::BINARY :
176  return os << v0 << v1;
177  default:
178  return os << s << "(" << v0 << ' ' << v1 << ' ' << ")";
179  }
180  }
double s
Definition: blastest.C:80
Definition: io.h:64
static int mode
Definition: io.h:63
Definition: io.h:64
Value v1
Definition: Tuple.h:220
Value v0
Definition: Tuple.h:219

Member Data Documentation


The documentation for this struct was generated from the following file: