Tensor Class Reference

#include <Tensor.h>

List of all members.

Public Member Functions

 Tensor (void)
 Tensor (const Tensor &t2)
 ~Tensor (void)
Tensoroperator= (const Tensor &t2)
Tensoroperator= (const BigReal &r2)
Tensoroperator+= (const Tensor &t2)
Tensoroperator-= (const Tensor &t2)
Tensoroperator *= (const BigReal &r2)
Tensoroperator/= (const BigReal &r2)
void outerAdd (BigReal scale, const Vector &v1, const Vector &v2)

Static Public Member Functions

static Tensor identity (BigReal v1=1.0)
static Tensor diagonal (const Vector &v1)
static Tensor symmetric (const Vector &v1, const Vector &v2)
static Tensor triangular (const Vector &v1, const Vector &v2)

Public Attributes

BigReal xx
BigReal xy
BigReal xz
BigReal yx
BigReal yy
BigReal yz
BigReal zx
BigReal zy
BigReal zz

Friends

int operator== (const Tensor &t1, const Tensor &t2)
int operator!= (const Tensor &t1, const Tensor &t2)
Tensor operator+ (const Tensor &t1, const Tensor &t2)
Tensor operator- (const Tensor &t1, const Tensor &t2)
Tensor operator- (const Tensor &t1)
Tensor operator * (const BigReal &r1, const Tensor &t2)
Tensor operator * (const Tensor &t1, const BigReal &r2)
Tensor operator/ (const Tensor &t1, const BigReal &r2)
Vector operator * (const Tensor &t1, const Vector &v2)
Vector operator * (const Vector &v1, const Tensor &t2)
Tensor outer (const Vector &v1, const Vector &v2)
Tensor transpose (const Tensor &t1)
Tensor symmetric (const Tensor &t1)
Tensor triangular (const Tensor &t1)
Vector diagonal (const Tensor &t1)
Vector off_diagonal (const Tensor &t1)
BigReal trace (const Tensor &t1)


Detailed Description

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 15 of file Tensor.h.


Constructor & Destructor Documentation

Tensor::Tensor ( void   )  [inline]

Definition at line 21 of file Tensor.h.

References xx, xy, xz, yx, yy, yz, zx, zy, and zz.

00021                          {
00022        xx=xy=xz=yx=yy=yz=zx=zy=zz=0.0;
00023      }

Tensor::Tensor ( const Tensor t2  )  [inline]

Definition at line 25 of file Tensor.h.

References xx, xy, xz, yx, yy, yz, zx, zy, and zz.

00025                                      {
00026        xx = t2.xx; xy = t2.xy; xz = t2.xz;
00027        yx = t2.yx; yy = t2.yy; yz = t2.yz;
00028        zx = t2.zx; zy = t2.zy; zz = t2.zz;
00029      }

Tensor::~Tensor ( void   )  [inline]

Definition at line 61 of file Tensor.h.

00061 { }


Member Function Documentation

static Tensor Tensor::diagonal ( const Vector v1  )  [inline, static]

Definition at line 37 of file Tensor.h.

References Vector::x, xx, xy, xz, Vector::y, yx, yy, yz, Vector::z, zx, zy, and zz.

Referenced by Controller::berendsenPressure(), Controller::calcPressure(), GridforceFullBaseGrid::compute_VdV(), Controller::langevinPiston1(), and Controller::langevinPiston2().

00037                                                      {
00038        Tensor tmp;
00039        tmp.xx = v1.x; tmp.xy = 0; tmp.xz = 0;
00040        tmp.yx = 0; tmp.yy = v1.y; tmp.yz = 0;
00041        tmp.zx = 0; tmp.zy = 0; tmp.zz = v1.z;
00042        return tmp;
00043      }

static Tensor Tensor::identity ( BigReal  v1 = 1.0  )  [inline, static]

Definition at line 31 of file Tensor.h.

References xx, yy, and zz.

Referenced by Controller::berendsenPressure(), Controller::calcPressure(), Controller::Controller(), Controller::langevinPiston1(), Controller::langevinPiston2(), Sequencer::multigratorPressure(), and Controller::multigratorPressure().

00031                                                      {
00032        Tensor tmp;
00033        tmp.xx = tmp.yy = tmp.zz = v1;
00034        return tmp;
00035      }

Tensor& Tensor::operator *= ( const BigReal r2  )  [inline]

Definition at line 89 of file Tensor.h.

References xx, xy, xz, yx, yy, yz, zx, zy, and zz.

00089                                                   {
00090        xx *= r2; xy *= r2; xz *= r2;
00091        yx *= r2; yy *= r2; yz *= r2;
00092        zx *= r2; zy *= r2; zz *= r2;
00093        return *this;
00094      }

Tensor& Tensor::operator+= ( const Tensor t2  )  [inline]

Definition at line 75 of file Tensor.h.

References xx, xy, xz, yx, yy, yz, zx, zy, and zz.

00075                                                  {
00076        xx += t2.xx; xy += t2.xy; xz += t2.xz;
00077        yx += t2.yx; yy += t2.yy; yz += t2.yz;
00078        zx += t2.zx; zy += t2.zy; zz += t2.zz;
00079        return *this;
00080      }

Tensor& Tensor::operator-= ( const Tensor t2  )  [inline]

Definition at line 82 of file Tensor.h.

References xx, xy, xz, yx, yy, yz, zx, zy, and zz.

00082                                                  {
00083        xx -= t2.xx; xy -= t2.xy; xz -= t2.xz;
00084        yx -= t2.yx; yy -= t2.yy; yz -= t2.yz;
00085        zx -= t2.zx; zy -= t2.zy; zz -= t2.zz;
00086        return *this;
00087      }

Tensor& Tensor::operator/= ( const BigReal r2  )  [inline]

Definition at line 96 of file Tensor.h.

References xx, xy, xz, yx, yy, yz, zx, zy, and zz.

00096                                                   {
00097        xx /= r2; xy /= r2; xz /= r2;
00098        yx /= r2; yy /= r2; yz /= r2;
00099        zx /= r2; zy /= r2; zz /= r2;
00100        return *this;
00101      }

Tensor& Tensor::operator= ( const BigReal r2  )  [inline]

Definition at line 70 of file Tensor.h.

References xx, xy, xz, yx, yy, yz, zx, zy, and zz.

00070                                                  {
00071        xx=xy=xz=yx=yy=yz=zx=zy=zz=r2;
00072        return *this;
00073      }

Tensor& Tensor::operator= ( const Tensor t2  )  [inline]

Definition at line 63 of file Tensor.h.

References xx, xy, xz, yx, yy, yz, zx, zy, and zz.

00063                                                 {
00064        xx = t2.xx; xy = t2.xy; xz = t2.xz;
00065        yx = t2.yx; yy = t2.yy; yz = t2.yz;
00066        zx = t2.zx; zy = t2.zy; zz = t2.zz;
00067        return *this;
00068      }

void Tensor::outerAdd ( BigReal  scale,
const Vector v1,
const Vector v2 
) [inline]

Definition at line 255 of file Tensor.h.

References Vector::x, xx, xy, xz, Vector::y, yx, yy, yz, Vector::z, zx, zy, and zz.

Referenced by Sequencer::calcFixVirial(), Sequencer::multigratorPressure(), Sequencer::multigratorTemperature(), Sequencer::submitHalfstep(), and Sequencer::submitReductions().

00255                                                                                {
00256   xx += v1.x * v2.x * scale;
00257   xy += v1.x * v2.y * scale;
00258   xz += v1.x * v2.z * scale;
00259   yx += v1.y * v2.x * scale;
00260   yy += v1.y * v2.y * scale;
00261   yz += v1.y * v2.z * scale;
00262   zx += v1.z * v2.x * scale;
00263   zy += v1.z * v2.y * scale;
00264   zz += v1.z * v2.z * scale;
00265 }

static Tensor Tensor::symmetric ( const Vector v1,
const Vector v2 
) [inline, static]

Definition at line 45 of file Tensor.h.

References Vector::x, xx, xy, xz, Vector::y, yx, yy, yz, Vector::z, zx, zy, and zz.

Referenced by Controller::Controller().

00045                                                                         {
00046        Tensor tmp;
00047        tmp.xx = v1.x; tmp.xy = v2.x; tmp.xz = v2.y;
00048        tmp.yx = v2.x; tmp.yy = v1.y; tmp.yz = v2.z;
00049        tmp.zx = v2.y; tmp.zy = v2.z; tmp.zz = v1.z;
00050        return tmp;
00051      }

static Tensor Tensor::triangular ( const Vector v1,
const Vector v2 
) [inline, static]

Definition at line 53 of file Tensor.h.

References Vector::x, xx, xy, xz, Vector::y, yx, yy, yz, Vector::z, zx, zy, and zz.

00053                                                                          {
00054        Tensor tmp;
00055        tmp.xx = v1.x; tmp.xy = v2.x; tmp.xz = v2.y;
00056        tmp.yx = 0; tmp.yy = v1.y; tmp.yz = v2.z;
00057        tmp.zx = 0; tmp.zy = 0; tmp.zz = v1.z;
00058        return tmp;
00059      }


Friends And Related Function Documentation

Vector diagonal ( const Tensor t1  )  [friend]

Definition at line 194 of file Tensor.h.

00194                                                      {
00195        return Vector(t1.xx,t1.yy,t1.zz);
00196      }

Vector off_diagonal ( const Tensor t1  )  [friend]

Definition at line 198 of file Tensor.h.

00198                                                          {
00199        return Vector(t1.xy,t1.xz,t1.yz);
00200      }

Vector operator * ( const Vector v1,
const Tensor t2 
) [friend]

Definition at line 160 of file Tensor.h.

00160                                                                         {
00161        Vector tmp;
00162        tmp.x = t2.xx * v1.x + t2.yx * v1.y + t2.zx * v1.z;
00163        tmp.y = t2.xy * v1.x + t2.yy * v1.y + t2.zy * v1.z;
00164        tmp.z = t2.xz * v1.x + t2.yz * v1.y + t2.zz * v1.z;
00165        return tmp;
00166      }

Vector operator * ( const Tensor t1,
const Vector v2 
) [friend]

Definition at line 152 of file Tensor.h.

00152                                                                         {
00153        Vector tmp;
00154        tmp.x = t1.xx * v2.x + t1.xy * v2.y + t1.xz * v2.z;
00155        tmp.y = t1.yx * v2.x + t1.yy * v2.y + t1.yz * v2.z;
00156        tmp.z = t1.zx * v2.x + t1.zy * v2.y + t1.zz * v2.z;
00157        return tmp;
00158      }

Tensor operator * ( const Tensor t1,
const BigReal r2 
) [friend]

Definition at line 140 of file Tensor.h.

00140                                                                          {
00141        Tensor tmp(t1);
00142        tmp *= r2;
00143        return tmp;
00144      }

Tensor operator * ( const BigReal r1,
const Tensor t2 
) [friend]

Definition at line 134 of file Tensor.h.

00134                                                                          {
00135        Tensor tmp(t2);
00136        tmp *= r1;
00137        return tmp;
00138      }

int operator!= ( const Tensor t1,
const Tensor t2 
) [friend]

Definition at line 112 of file Tensor.h.

00112                                                                       {
00113        return ( ! ( t1 == t2 ) );
00114      }

Tensor operator+ ( const Tensor t1,
const Tensor t2 
) [friend]

Definition at line 116 of file Tensor.h.

00116                                                                         {
00117        Tensor tmp(t1);
00118        tmp += t2;
00119        return tmp;
00120      }

Tensor operator- ( const Tensor t1  )  [friend]

Definition at line 128 of file Tensor.h.

00128                                                       {
00129        Tensor tmp(t1);
00130        tmp *= -1.0;
00131        return tmp;
00132      }

Tensor operator- ( const Tensor t1,
const Tensor t2 
) [friend]

Definition at line 122 of file Tensor.h.

00122                                                                         {
00123        Tensor tmp(t1);
00124        tmp -= t2;
00125        return tmp;
00126      }

Tensor operator/ ( const Tensor t1,
const BigReal r2 
) [friend]

Definition at line 146 of file Tensor.h.

00146                                                                          {
00147        Tensor tmp(t1);
00148        tmp /= r2;
00149        return tmp;
00150      }

int operator== ( const Tensor t1,
const Tensor t2 
) [friend]

Definition at line 105 of file Tensor.h.

00105                                                                       {
00106        return (
00107        t1.xx == t2.xx && t1.xy == t2.xy && t1.xz == t2.xz &&
00108        t1.yx == t2.yx && t1.yy == t2.yy && t1.yz == t2.yz &&
00109        t1.zx == t2.zx && t1.zy == t2.zy && t1.zz == t2.zz );
00110      }

Tensor outer ( const Vector v1,
const Vector v2 
) [friend]

Definition at line 241 of file Tensor.h.

00241                                                         {
00242        Tensor tmp;
00243        tmp.xx = v1.x * v2.x;
00244        tmp.xy = v1.x * v2.y;
00245        tmp.xz = v1.x * v2.z;
00246        tmp.yx = v1.y * v2.x;
00247        tmp.yy = v1.y * v2.y;
00248        tmp.yz = v1.y * v2.z;
00249        tmp.zx = v1.z * v2.x;
00250        tmp.zy = v1.z * v2.y;
00251        tmp.zz = v1.z * v2.z;
00252        return tmp;
00253 }

Tensor symmetric ( const Tensor t1  )  [friend]

Definition at line 178 of file Tensor.h.

00178                                                       {
00179        Tensor tmp;
00180        tmp.xx = t1.xx; tmp.xy = 0.5*(t1.xy+t1.yx); tmp.xz = 0.5*(t1.xz+t1.zx);
00181        tmp.yx = tmp.xy; tmp.yy = t1.yy; tmp.yz = 0.5*(t1.yz+t1.zy);
00182        tmp.zx = tmp.xz; tmp.zy = tmp.yz; tmp.zz = t1.zz;
00183        return tmp;
00184      }

BigReal trace ( const Tensor t1  )  [friend]

Definition at line 202 of file Tensor.h.

00202                                                    {
00203        return (t1.xx + t1.yy + t1.zz);
00204      }

Tensor transpose ( const Tensor t1  )  [friend]

Definition at line 170 of file Tensor.h.

00170                                                       {
00171        Tensor tmp;
00172        tmp.xx = t1.xx; tmp.yx = t1.xy; tmp.zx = t1.xz;
00173        tmp.xy = t1.yx; tmp.yy = t1.yy; tmp.zy = t1.yz;
00174        tmp.xz = t1.zx; tmp.yz = t1.zy; tmp.zz = t1.zz;
00175        return tmp;
00176      }

Tensor triangular ( const Tensor t1  )  [friend]

Definition at line 186 of file Tensor.h.

00186                                                        {
00187        Tensor tmp;
00188        tmp.xx = t1.xx; tmp.xy = 0.5*(t1.xy+t1.yx); tmp.xz = 0.5*(t1.xz+t1.zx);
00189        tmp.yx = 0; tmp.yy = t1.yy; tmp.yz = 0.5*(t1.yz+t1.zy);
00190        tmp.zx = 0; tmp.zy = 0; tmp.zz = t1.zz;
00191        return tmp;
00192      }


Member Data Documentation

BigReal Tensor::xx

Definition at line 17 of file Tensor.h.

Referenced by Controller::berendsenPressure(), diagonal(), CudaComputeNonbonded::finishReductions(), ComputeNonbondedCUDA::finishReductions(), HomePatch::hardWallDrude(), identity(), Sequencer::langevinPiston(), Controller::langevinPiston1(), Controller::langevinPiston2(), operator *=(), operator+=(), operator-=(), operator/=(), operator<<(), operator=(), outer(), outerAdd(), HomePatch::rattle1old(), GridforceFullBaseGrid::readHeader(), symmetric(), Tensor(), GridforceFullSubGrid::tensorMult(), and triangular().

BigReal Tensor::xy

Definition at line 17 of file Tensor.h.

Referenced by diagonal(), CudaComputeNonbonded::finishReductions(), ComputeNonbondedCUDA::finishReductions(), operator *=(), operator+=(), operator-=(), operator/=(), operator<<(), operator=(), outer(), outerAdd(), GridforceFullBaseGrid::readHeader(), symmetric(), Tensor(), GridforceFullSubGrid::tensorMult(), and triangular().

BigReal Tensor::xz

Definition at line 17 of file Tensor.h.

Referenced by diagonal(), CudaComputeNonbonded::finishReductions(), ComputeNonbondedCUDA::finishReductions(), operator *=(), operator+=(), operator-=(), operator/=(), operator<<(), operator=(), outer(), outerAdd(), GridforceFullBaseGrid::readHeader(), symmetric(), Tensor(), GridforceFullSubGrid::tensorMult(), and triangular().

BigReal Tensor::yx

Definition at line 18 of file Tensor.h.

Referenced by diagonal(), CudaComputeNonbonded::finishReductions(), ComputeNonbondedCUDA::finishReductions(), operator *=(), operator+=(), operator-=(), operator/=(), operator<<(), operator=(), outer(), outerAdd(), GridforceFullBaseGrid::readHeader(), symmetric(), Tensor(), GridforceFullSubGrid::tensorMult(), and triangular().

BigReal Tensor::yy

Definition at line 18 of file Tensor.h.

Referenced by Controller::berendsenPressure(), diagonal(), CudaComputeNonbonded::finishReductions(), ComputeNonbondedCUDA::finishReductions(), HomePatch::hardWallDrude(), identity(), Sequencer::langevinPiston(), Controller::langevinPiston1(), Controller::langevinPiston2(), operator *=(), operator+=(), operator-=(), operator/=(), operator<<(), operator=(), outer(), outerAdd(), HomePatch::rattle1old(), GridforceFullBaseGrid::readHeader(), symmetric(), Tensor(), GridforceFullSubGrid::tensorMult(), and triangular().

BigReal Tensor::yz

Definition at line 18 of file Tensor.h.

Referenced by diagonal(), CudaComputeNonbonded::finishReductions(), ComputeNonbondedCUDA::finishReductions(), operator *=(), operator+=(), operator-=(), operator/=(), operator<<(), operator=(), outer(), outerAdd(), GridforceFullBaseGrid::readHeader(), symmetric(), Tensor(), GridforceFullSubGrid::tensorMult(), and triangular().

BigReal Tensor::zx

Definition at line 19 of file Tensor.h.

Referenced by diagonal(), CudaComputeNonbonded::finishReductions(), ComputeNonbondedCUDA::finishReductions(), operator *=(), operator+=(), operator-=(), operator/=(), operator<<(), operator=(), outer(), outerAdd(), GridforceFullBaseGrid::readHeader(), symmetric(), Tensor(), GridforceFullSubGrid::tensorMult(), and triangular().

BigReal Tensor::zy

Definition at line 19 of file Tensor.h.

Referenced by diagonal(), CudaComputeNonbonded::finishReductions(), ComputeNonbondedCUDA::finishReductions(), operator *=(), operator+=(), operator-=(), operator/=(), operator<<(), operator=(), outer(), outerAdd(), GridforceFullBaseGrid::readHeader(), symmetric(), Tensor(), GridforceFullSubGrid::tensorMult(), and triangular().

BigReal Tensor::zz

Definition at line 19 of file Tensor.h.

Referenced by Controller::berendsenPressure(), diagonal(), CudaComputeNonbonded::finishReductions(), ComputeNonbondedCUDA::finishReductions(), HomePatch::hardWallDrude(), identity(), Sequencer::langevinPiston(), Controller::langevinPiston1(), Controller::langevinPiston2(), operator *=(), operator+=(), operator-=(), operator/=(), operator<<(), operator=(), outer(), outerAdd(), HomePatch::rattle1old(), GridforceFullBaseGrid::readHeader(), symmetric(), Tensor(), GridforceFullSubGrid::tensorMult(), and triangular().


The documentation for this class was generated from the following file:
Generated on Mon Nov 20 01:17:20 2017 for NAMD by  doxygen 1.4.7