#include <type_tensor.h>
Inherited by TensorValue< T >.
template<typename T2 > TypeTensor (const TypeTensor< T2 > &p)
~TypeTensor ()
template<typename T2 > void assign (const TypeTensor< T2 > &)
T operator() (const unsigned int i, const unsigned int j) const
T & operator() (const unsigned int i, const unsigned int j)
template<typename T2 > TypeTensor< typename CompareTypes< T, T2 >::supertype > operator+ (const TypeTensor< T2 > &) const
template<typename T2 > const TypeTensor< T > & operator+= (const TypeTensor< T2 > &)
template<typename T2 > void add (const TypeTensor< T2 > &)
template<typename T2 > void add_scaled (const TypeTensor< T2 > &, const T)
template<typename T2 > TypeTensor< typename CompareTypes< T, T2 >::supertype > operator- (const TypeTensor< T2 > &) const
template<typename T2 > const TypeTensor< T > & operator-= (const TypeTensor< T2 > &)
template<typename T2 > void subtract (const TypeTensor< T2 > &)
template<typename T2 > void subtract_scaled (const TypeTensor< T2 > &, const T)
TypeTensor< T > operator- () const
template<typename Scalar > boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeTensor< typename CompareTypes< T, Scalar >::supertype > >::type operator* (const Scalar) const
template<typename Scalar > const TypeTensor< T > & operator*= (const Scalar)
template<typename Scalar > boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeTensor< typename CompareTypes< T, Scalar >::supertype > >::type operator/ (const Scalar) const
const TypeTensor< T > & operator/= (const T)
template<typename T2 > TypeTensor< T > operator* (const TypeTensor< T2 > &) const
template<typename T2 > CompareTypes< T, T2 >::supertype contract (const TypeTensor< T2 > &) const
template<typename T2 > TypeVector< typename CompareTypes< T, T2 >::supertype > operator* (const TypeVector< T2 > &) const
TypeTensor< T > transpose () const
Real size () const
Real size_sq () const
T det () const
T tr () const
void zero ()
bool operator== (const TypeTensor< T > &rhs) const
bool operator< (const TypeTensor< T > &rhs) const
bool operator> (const TypeTensor< T > &rhs) const
void print (std::ostream &os) const
void write_unformatted (std::ostream &out, const bool newline=true) const
template<> bool operator< (const TypeTensor< Real > &rhs) const
template<> bool operator> (const TypeTensor< Real > &rhs) const
template<> bool operator< (const TypeTensor< Complex > &rhs) const
template<> bool operator> (const TypeTensor< Complex > &rhs) const
T _coords [LIBMESH_DIM *LIBMESH_DIM]
TypeTensor (const T xx=0., const T xy=0., const T xz=0., const T yx=0., const T yy=0., const T yz=0., const T zx=0., const T zy=0., const T zz=0.)
template<typename T2 > TypeTensor (const TypeVector< T2 > &vx)
template<typename T2 > TypeTensor (const TypeVector< T2 > &vx, const TypeVector< T2 > &vy)
template<typename T2 > TypeTensor (const TypeVector< T2 > &vx, const TypeVector< T2 > &vy, const TypeVector< T2 > &vz)
class TypeTensor
std::ostream & operator<< (std::ostream &os, const TypeTensor< T > &t)
Author:
Definition at line 45 of file type_tensor.h.
Definition at line 307 of file type_tensor.h.
References TypeTensor< T >::_coords.
{
_coords[0] = xx;
if (LIBMESH_DIM == 2)
{
_coords[1] = xy;
_coords[2] = yx;
_coords[3] = yy;
}
if (LIBMESH_DIM == 3)
{
_coords[1] = xy;
_coords[2] = xz;
_coords[3] = yx;
_coords[4] = yy;
_coords[5] = yz;
_coords[6] = zx;
_coords[7] = zy;
_coords[8] = zz;
}
}
Definition at line 354 of file type_tensor.h.
References TypeTensor< T >::_coords.
{
libmesh_assert(LIBMESH_DIM == 1);
_coords[0] = vx(0);
}
Definition at line 362 of file type_tensor.h.
References TypeTensor< T >::_coords.
{
libmesh_assert(LIBMESH_DIM == 2);
_coords[0] = vx(0);
_coords[1] = vx(1);
_coords[2] = vy(0);
_coords[3] = vy(1);
}
Definition at line 373 of file type_tensor.h.
References TypeTensor< T >::_coords.
{
libmesh_assert(LIBMESH_DIM == 3);
_coords[0] = vx(0);
_coords[1] = vx(1);
_coords[2] = vx(2);
_coords[3] = vy(0);
_coords[4] = vy(1);
_coords[5] = vy(2);
_coords[6] = vz(0);
_coords[7] = vz(1);
_coords[8] = vz(2);
}
Definition at line 344 of file type_tensor.h.
References TypeTensor< T >::_coords.
{
// copy the nodes from vector p to me
for (unsigned int i=0; i<LIBMESH_DIM*LIBMESH_DIM; i++)
_coords[i] = p._coords[i];
}
Definition at line 392 of file type_tensor.h.
{
}
Definition at line 502 of file type_tensor.h.
References TypeTensor< T >::_coords.
Referenced by TypeVector< T >::operator+=(), and TypeTensor< T >::operator+=().
{
for (unsigned int i=0; i<LIBMESH_DIM*LIBMESH_DIM; i++)
_coords[i] += p._coords[i];
}
Definition at line 513 of file type_tensor.h.
References TypeTensor< T >::_coords.
Referenced by HPCoarsenTest::add_projection(), System::calculate_norm(), FEMContext::fixed_interior_hessian(), FEMContext::fixed_side_hessian(), MeshFunction::hessian(), FEMContext::interior_hessian(), PatchRecoveryErrorEstimator::EstimateError::operator()(), HPCoarsenTest::select_refinement(), and FEMContext::side_hessian().
{
for (unsigned int i=0; i<LIBMESH_DIM*LIBMESH_DIM; i++)
_coords[i] += factor*p._coords[i];
}
Definition at line 401 of file type_tensor.h.
References TypeTensor< T >::_coords.
{
for (unsigned int i=0; i<LIBMESH_DIM; i++)
_coords[i] = p._coords[i];
}
Definition at line 811 of file type_tensor.h.
References TypeTensor< T >::_coords.
Referenced by HPCoarsenTest::add_projection(), and HPCoarsenTest::select_refinement().
{
typename CompareTypes<T,T2>::supertype sum = 0.;
for (unsigned int i=0; i<LIBMESH_DIM*LIBMESH_DIM; i++)
sum += _coords[i]*t._coords[i];
return sum;
}
Definition at line 832 of file type_tensor.h.
References TypeTensor< T >::_coords.
Referenced by Sphere::Sphere().
{
#if LIBMESH_DIM == 1
return _coords[0];
#endif
#if LIBMESH_DIM == 2
return (_coords[0] * _coords[3]
- _coords[1] * _coords[2]);
#endif
#if LIBMESH_DIM == 3
return (_coords[0] * _coords[4] * _coords[8]
+ _coords[1] * _coords[5] * _coords[6]
+ _coords[2] * _coords[3] * _coords[7]
- _coords[0] * _coords[5] * _coords[7]
- _coords[1] * _coords[3] * _coords[8]
- _coords[2] * _coords[4] * _coords[6]);
#endif
}
Definition at line 411 of file type_tensor.h.
References TypeTensor< T >::_coords.
{
libmesh_assert (i<3);
libmesh_assert (j<3);
#if LIBMESH_DIM < 3
if (i >= LIBMESH_DIM || j >= LIBMESH_DIM)
return 0.;
#endif
return _coords[i*LIBMESH_DIM+j];
}
Definition at line 429 of file type_tensor.h.
References TypeTensor< T >::_coords.
{
#if LIBMESH_DIM < 3
if (i >= LIBMESH_DIM || j >= LIBMESH_DIM)
{
// std::cerr << 'ERROR: You are assigning to a tensor component' << std::endl
// << 'that is out of range for the compiled LIBMESH_DIM!' << std::endl
// << ' LIBMESH_DIM=' << LIBMESH_DIM << ' , i=' << i << ' , j=' << j << std::endl;
libmesh_error();
}
#endif
libmesh_assert (i<LIBMESH_DIM);
libmesh_assert (j<LIBMESH_DIM);
return _coords[i*LIBMESH_DIM+j];
}
Definition at line 790 of file type_tensor.h.
{
TypeTensor<T> returnval;
for (unsigned int i=0; i<LIBMESH_DIM; i++)
for (unsigned int j=0; j<LIBMESH_DIM; j++)
for (unsigned int k=0; k<LIBMESH_DIM; k++)
returnval(i,j) += (*this)(i,k)*p(k,j);
return returnval;
}
Definition at line 775 of file type_tensor.h.
{
TypeVector<typename CompareTypes<T,T2>::supertype> returnval;
for (unsigned int i=0; i<LIBMESH_DIM; i++)
for (unsigned int j=0; j<LIBMESH_DIM; j++)
returnval(i) += (*this)(i,j)*p(j);
return returnval;
}
Definition at line 629 of file type_tensor.h.
References TypeTensor< T >::_coords.
{
typedef typename CompareTypes<T, Scalar>::supertype TS;
#if LIBMESH_DIM == 1
return TypeTensor<TS>(_coords[0]*factor);
#endif
#if LIBMESH_DIM == 2
return TypeTensor<TS>(_coords[0]*factor,
_coords[1]*factor,
_coords[2]*factor,
_coords[3]*factor);
#endif
#if LIBMESH_DIM == 3
return TypeTensor<TS>(_coords[0]*factor,
_coords[1]*factor,
_coords[2]*factor,
_coords[3]*factor,
_coords[4]*factor,
_coords[5]*factor,
_coords[6]*factor,
_coords[7]*factor,
_coords[8]*factor);
#endif
}
Definition at line 676 of file type_tensor.h.
References TypeTensor< T >::_coords.
{
for (unsigned int i=0; i<LIBMESH_DIM*LIBMESH_DIM; i++)
_coords[i] *= factor;
return *this;
}
Definition at line 456 of file type_tensor.h.
References TypeTensor< T >::_coords, and TypeTensor< T >::TypeTensor.
{
#if LIBMESH_DIM == 1
return TypeTensor(_coords[0] + p._coords[0]);
#endif
#if LIBMESH_DIM == 2
return TypeTensor(_coords[0] + p._coords[0],
_coords[1] + p._coords[1],
0.,
_coords[2] + p._coords[2],
_coords[3] + p._coords[3]);
#endif
#if LIBMESH_DIM == 3
return TypeTensor(_coords[0] + p._coords[0],
_coords[1] + p._coords[1],
_coords[2] + p._coords[2],
_coords[3] + p._coords[3],
_coords[4] + p._coords[4],
_coords[5] + p._coords[5],
_coords[6] + p._coords[6],
_coords[7] + p._coords[7],
_coords[8] + p._coords[8]);
#endif
}
Definition at line 490 of file type_tensor.h.
References TypeTensor< T >::add().
{
this->add (p);
return *this;
}
Definition at line 526 of file type_tensor.h.
References TypeTensor< T >::_coords, and TypeTensor< T >::TypeTensor.
{
#if LIBMESH_DIM == 1
return TypeTensor(_coords[0] - p._coords[0]);
#endif
#if LIBMESH_DIM == 2
return TypeTensor(_coords[0] - p._coords[0],
_coords[1] - p._coords[1],
0.,
_coords[2] - p._coords[2],
_coords[3] - p._coords[3]);
#endif
#if LIBMESH_DIM == 3
return TypeTensor(_coords[0] - p._coords[0],
_coords[1] - p._coords[1],
_coords[2] - p._coords[2],
_coords[3] - p._coords[3],
_coords[4] - p._coords[4],
_coords[5] - p._coords[5],
_coords[6] - p._coords[6],
_coords[7] - p._coords[7],
_coords[8] - p._coords[8]);
#endif
}
Definition at line 593 of file type_tensor.h.
References TypeTensor< T >::_coords, and TypeTensor< T >::TypeTensor.
{
#if LIBMESH_DIM == 1
return TypeTensor(-_coords[0]);
#endif
#if LIBMESH_DIM == 2
return TypeTensor(-_coords[0],
-_coords[1],
-_coords[2],
-_coords[3]);
#endif
#if LIBMESH_DIM == 3
return TypeTensor(-_coords[0],
-_coords[1],
-_coords[2],
-_coords[3],
-_coords[4],
-_coords[5],
-_coords[6],
-_coords[7],
-_coords[8]);
#endif
}
Definition at line 560 of file type_tensor.h.
References TypeTensor< T >::subtract().
{
this->subtract (p);
return *this;
}
Definition at line 693 of file type_tensor.h.
References TypeTensor< T >::_coords.
{
libmesh_assert (factor != static_cast<T>(0.));
typedef typename CompareTypes<T, Scalar>::supertype TS;
#if LIBMESH_DIM == 1
return TypeTensor<TS>(_coords[0]/factor);
#endif
#if LIBMESH_DIM == 2
return TypeTensor<TS>(_coords[0]/factor,
_coords[1]/factor,
_coords[2]/factor,
_coords[3]/factor);
#endif
#if LIBMESH_DIM == 3
return TypeTensor<TS>(_coords[0]/factor,
_coords[1]/factor,
_coords[2]/factor,
_coords[3]/factor,
_coords[4]/factor,
_coords[5]/factor,
_coords[6]/factor,
_coords[7]/factor,
_coords[8]/factor);
#endif
}
Definition at line 758 of file type_tensor.h.
References TypeTensor< T >::_coords.
{
libmesh_assert (factor != static_cast<T>(0.));
for (unsigned int i=0; i<LIBMESH_DIM*LIBMESH_DIM; i++)
_coords[i] /= factor;
return *this;
}
Definition at line 112 of file type_tensor.C.
{
for (unsigned int i=0; i<LIBMESH_DIM; i++)
for (unsigned int j=0; j<LIBMESH_DIM; j++)
{
if ((*this)(i,j) < rhs(i,j))
return true;
if ((*this)(i,j) > rhs(i,j))
return false;
}
return false;
}
Definition at line 145 of file type_tensor.C.
{
for (unsigned int i=0; i<LIBMESH_DIM; i++)
for (unsigned int j=0; j<LIBMESH_DIM; j++)
{
if ((*this)(i,j).real() < rhs(i,j).real())
return true;
if ((*this)(i,j).real() > rhs(i,j).real())
return false;
if ((*this)(i,j).imag() < rhs(i,j).imag())
return true;
if ((*this)(i,j).imag() > rhs(i,j).imag())
return false;
}
return false;
}
Definition at line 894 of file type_tensor.h.
References TypeTensor< T >::_coords.
{
#if LIBMESH_DIM == 1
return (std::abs(_coords[0] - rhs._coords[0])
< TOLERANCE);
#endif
#if LIBMESH_DIM == 2
return ((std::abs(_coords[0] - rhs._coords[0]) +
std::abs(_coords[1] - rhs._coords[1]) +
std::abs(_coords[2] - rhs._coords[2]) +
std::abs(_coords[3] - rhs._coords[3]))
< 4.*TOLERANCE);
#endif
#if LIBMESH_DIM == 3
return ((std::abs(_coords[0] - rhs._coords[0]) +
std::abs(_coords[1] - rhs._coords[1]) +
std::abs(_coords[2] - rhs._coords[2]) +
std::abs(_coords[3] - rhs._coords[3]) +
std::abs(_coords[4] - rhs._coords[4]) +
std::abs(_coords[5] - rhs._coords[5]) +
std::abs(_coords[6] - rhs._coords[6]) +
std::abs(_coords[7] - rhs._coords[7]) +
std::abs(_coords[8] - rhs._coords[8]))
< 9.*TOLERANCE);
#endif
}
Definition at line 128 of file type_tensor.C.
{
for (unsigned int i=0; i<LIBMESH_DIM; i++)
for (unsigned int j=0; j<LIBMESH_DIM; j++)
{
if ((*this)(i,j) > rhs(i,j))
return true;
if ((*this)(i,j) < rhs(i,j))
return false;
}
return false;
}
Definition at line 165 of file type_tensor.C.
{
for (unsigned int i=0; i<LIBMESH_DIM; i++)
for (unsigned int j=0; j<LIBMESH_DIM; j++)
{
if ((*this)(i,j).real() > rhs(i,j).real())
return true;
if ((*this)(i,j).real() < rhs(i,j).real())
return false;
if ((*this)(i,j).imag() > rhs(i,j).imag())
return true;
if ((*this)(i,j).imag() < rhs(i,j).imag())
return false;
}
return false;
}
Definition at line 38 of file type_tensor.C.
{
#if LIBMESH_DIM == 1
os << 'x=' << (*this)(0) << std::endl;
#endif
#if LIBMESH_DIM == 2
os << '(xx,xy)=('
<< std::setw(8) << (*this)(0,0) << ', '
<< std::setw(8) << (*this)(0,1) << ')'
<< std::endl;
os << '(yx,yy)=('
<< std::setw(8) << (*this)(1,0) << ', '
<< std::setw(8) << (*this)(1,1) << ')'
<< std::endl;
#endif
#if LIBMESH_DIM == 3
os << '(xx,xy,xz)=('
<< std::setw(8) << (*this)(0,0) << ', '
<< std::setw(8) << (*this)(0,1) << ', '
<< std::setw(8) << (*this)(0,2) << ')'
<< std::endl;
os << '(yx,yy,yz)=('
<< std::setw(8) << (*this)(1,0) << ', '
<< std::setw(8) << (*this)(1,1) << ', '
<< std::setw(8) << (*this)(1,2) << ')'
<< std::endl;
os << '(zx,zy,zz)=('
<< std::setw(8) << (*this)(2,0) << ', '
<< std::setw(8) << (*this)(2,1) << ', '
<< std::setw(8) << (*this)(2,2) << ')'
<< std::endl;
#endif
}
Definition at line 823 of file type_tensor.h.
References TypeTensor< T >::size_sq().
Referenced by TypeVector< T >::unit().
{
return std::sqrt(this->size_sq());
}
Definition at line 882 of file type_tensor.h.
References TypeTensor< T >::_coords, and libmesh_norm().
Referenced by ExactSolution::_compute_error(), UniformRefinementEstimator::_estimate_error(), System::calculate_norm(), ExactErrorEstimator::find_squared_element_error(), HPCoarsenTest::select_refinement(), TypeVector< T >::size(), and TypeTensor< T >::size().
{
Real sum = 0.;
for (unsigned int i=0; i<LIBMESH_DIM*LIBMESH_DIM; i++)
sum += libmesh_norm(_coords[i]);
return sum;
}
Definition at line 572 of file type_tensor.h.
References TypeTensor< T >::_coords.
Referenced by TypeVector< T >::operator-=(), and TypeTensor< T >::operator-=().
{
for (unsigned int i=0; i<LIBMESH_DIM*LIBMESH_DIM; i++)
_coords[i] -= p._coords[i];
}
Definition at line 583 of file type_tensor.h.
References TypeTensor< T >::_coords.
Referenced by HPCoarsenTest::select_refinement().
{
for (unsigned int i=0; i<LIBMESH_DIM*LIBMESH_DIM; i++)
_coords[i] -= factor*p._coords[i];
}
Definition at line 855 of file type_tensor.h.
References TypeTensor< T >::_coords.
{
#if LIBMESH_DIM == 1
return _coords[0];
#endif
#if LIBMESH_DIM == 2
return _coords[0] + _coords[3];
#endif
#if LIBMESH_DIM == 3
return _coords[0] + _coords[4] + _coords[8];
#endif
}
Definition at line 728 of file type_tensor.h.
References TypeTensor< T >::_coords, and TypeTensor< T >::TypeTensor.
{
#if LIBMESH_DIM == 1
return TypeTensor(_coords[0]);
#endif
#if LIBMESH_DIM == 2
return TypeTensor(_coords[0],
_coords[2],
_coords[1],
_coords[3]);
#endif
#if LIBMESH_DIM == 3
return TypeTensor(_coords[0],
_coords[3],
_coords[6],
_coords[1],
_coords[4],
_coords[7],
_coords[2],
_coords[5],
_coords[8]);
#endif
}
Definition at line 82 of file type_tensor.C.
{
libmesh_assert (out);
out << std::setiosflags(std::ios::showpoint)
<< (*this)(0,0) << ' '
<< (*this)(0,1) << ' '
<< (*this)(0,2) << ' ';
if (newline)
out << ';
out << std::setiosflags(std::ios::showpoint)
<< (*this)(1,0) << ' '
<< (*this)(1,1) << ' '
<< (*this)(1,2) << ' ';
if (newline)
out << ';
out << std::setiosflags(std::ios::showpoint)
<< (*this)(2,0) << ' '
<< (*this)(2,1) << ' '
<< (*this)(2,2) << ' ';
if (newline)
out << ';
}
Definition at line 872 of file type_tensor.h.
References TypeTensor< T >::_coords.
{
for (unsigned int i=0; i<LIBMESH_DIM*LIBMESH_DIM; i++)
_coords[i] = 0.;
}
Definition at line 281 of file type_tensor.h.
{
t.print(os);
return os;
}
Definition at line 48 of file type_tensor.h.
Referenced by TypeTensor< T >::operator+(), TypeTensor< T >::operator-(), and TypeTensor< T >::transpose().
Definition at line 298 of file type_tensor.h.
Referenced by TypeVector< T >::absolute_fuzzy_equals(), TypeVector< T >::add(), TypeTensor< T >::add(), TypeVector< T >::add_scaled(), TypeTensor< T >::add_scaled(), TypeVector< T >::assign(), TypeTensor< T >::assign(), TypeTensor< T >::contract(), TypeVector< T >::cross(), TypeTensor< T >::det(), TypeVector< T >::operator()(), TypeTensor< T >::operator()(), TypeVector< T >::operator*(), TypeTensor< T >::operator*(), TypeVector< T >::operator*=(), TypeTensor< T >::operator*=(), TypeVector< T >::operator+(), TypeTensor< T >::operator+(), TypeVector< T >::operator-(), TypeTensor< T >::operator-(), TypeVector< T >::operator/(), TypeTensor< T >::operator/(), TypeVector< T >::operator/=(), TypeTensor< T >::operator/=(), TypeVector< T >::operator==(), TypeTensor< T >::operator==(), TypeVector< T >::relative_fuzzy_equals(), TypeVector< T >::size_sq(), TypeTensor< T >::size_sq(), TypeVector< T >::subtract(), TypeTensor< T >::subtract(), TypeVector< T >::subtract_scaled(), TypeTensor< T >::subtract_scaled(), TypeTensor< T >::tr(), TypeTensor< T >::transpose(), TypeTensor< T >::TypeTensor(), TypeVector< T >::TypeVector(), TypeVector< T >::unit(), TypeVector< T >::zero(), and TypeTensor< T >::zero().
Generated automatically by Doxygen for libMesh from the source code.