$extrastylesheet
libMesh::VectorValue< T > Class Template Reference

#include <vector_value.h>

Inheritance diagram for libMesh::VectorValue< T >:

List of all members.

Public Member Functions

 VectorValue ()
 VectorValue (const T x, const T y=0, const T z=0)
template<typename Scalar >
 VectorValue (const Scalar x, const Scalar y=0, typename boostcopy::enable_if_c< ScalarTraits< Scalar >::value, const Scalar >::type z=0)
template<typename T2 >
 VectorValue (const VectorValue< T2 > &p)
template<typename T2 >
 VectorValue (const TypeVector< T2 > &p)
 VectorValue (const TypeVector< Real > &p_re, const TypeVector< Real > &p_im)
template<typename Scalar >
boostcopy::enable_if_c
< ScalarTraits< Scalar >
::value, VectorValue & >::type 
operator= (const Scalar &libmesh_dbg_var(p))
template<typename T2 >
void assign (const TypeVector< T2 > &)
const T & operator() (const unsigned int i) const
T & operator() (const unsigned int i)
const T & slice (const unsigned int i) const
T & slice (const unsigned int i)
template<typename T2 >
TypeVector< typename
CompareTypes< T, T2 >
::supertype > 
operator+ (const TypeVector< T2 > &) const
template<typename T2 >
const TypeVector< T > & operator+= (const TypeVector< T2 > &)
template<typename T2 >
void add (const TypeVector< T2 > &)
template<typename T2 >
void add_scaled (const TypeVector< T2 > &, const T)
template<typename T2 >
TypeVector< typename
CompareTypes< T, T2 >
::supertype > 
operator- (const TypeVector< T2 > &) const
TypeVector< T > operator- () const
template<typename T2 >
const TypeVector< T > & operator-= (const TypeVector< T2 > &)
template<typename T2 >
void subtract (const TypeVector< T2 > &)
template<typename T2 >
void subtract_scaled (const TypeVector< T2 > &, const T)
template<typename Scalar >
boostcopy::enable_if_c
< ScalarTraits< Scalar >
::value, TypeVector< typename
CompareTypes< T, Scalar >
::supertype > >::type 
operator* (const Scalar) const
template<typename T2 >
CompareTypes< T, T2 >::supertype operator* (const TypeVector< T2 > &) const
const TypeVector< T > & operator*= (const T)
template<typename Scalar >
boostcopy::enable_if_c
< ScalarTraits< Scalar >
::value, TypeVector< typename
CompareTypes< T, Scalar >
::supertype > >::type 
operator/ (const Scalar) const
const TypeVector< T > & operator/= (const T)
template<typename T2 >
CompareTypes< T, T2 >::supertype contract (const TypeVector< T2 > &) const
template<typename T2 >
TypeVector< typename
CompareTypes< T, T2 >
::supertype > 
cross (const TypeVector< T2 > &) const
TypeVector< T > unit () const
Real size () const
Real size_sq () const
void zero ()
bool relative_fuzzy_equals (const TypeVector< T > &rhs, Real tol=TOLERANCE) const
bool absolute_fuzzy_equals (const TypeVector< T > &rhs, Real tol=TOLERANCE) const
bool operator== (const TypeVector< T > &rhs) const
bool operator!= (const TypeVector< T > &rhs) const
template<>
bool operator!= (const TypeVector< Real > &rhs) const
bool operator< (const TypeVector< T > &rhs) const
template<>
bool operator< (const TypeVector< Complex > &rhs) const
bool operator<= (const TypeVector< T > &rhs) const
template<>
bool operator<= (const TypeVector< Complex > &rhs) const
bool operator> (const TypeVector< T > &rhs) const
template<>
bool operator> (const TypeVector< Complex > &rhs) const
bool operator>= (const TypeVector< T > &rhs) const
template<>
bool operator>= (const TypeVector< Complex > &rhs) const
void print (std::ostream &os=libMesh::out) const
void write_unformatted (std::ostream &out, const bool newline=true) const

Protected Attributes

_coords [LIBMESH_DIM]

Friends

std::ostream & operator<< (std::ostream &os, const TypeVector< T > &t)

Detailed Description

template<typename T>
class libMesh::VectorValue< T >

This class defines a vector in LIBMESH_DIM dimensional Real or Complex space. The typedef RealVectorValue always defines a real-valued vector, and NumberVectorValue defines a real or complex-valued vector depending on how the library was configured.

Author:
Benjamin S. Kirk, 2003.

Definition at line 40 of file vector_value.h.


Constructor & Destructor Documentation

template<typename T >
libMesh::VectorValue< T >::VectorValue ( ) [inline]

Empty constructor. Gives the vector 0 in LIBMESH_DIM dimensional T space.

Definition at line 125 of file vector_value.h.

                             :
  TypeVector<T> ()
{
}
template<typename T>
libMesh::VectorValue< T >::VectorValue ( const T  x,
const T  y = 0,
const T  z = 0 
) [inline]

Constructor-from-T. By default sets higher dimensional entries to 0.

Definition at line 133 of file vector_value.h.

                                        :
  TypeVector<T> (x,y,z)
{
}
template<typename T >
template<typename Scalar >
libMesh::VectorValue< T >::VectorValue ( const Scalar  x,
const Scalar  y = 0,
typename boostcopy::enable_if_c< ScalarTraits< Scalar >::value, const Scalar >::type  z = 0 
) [inline]

Constructor-from-scalars. By default sets higher dimensional entries to 0.

Definition at line 145 of file vector_value.h.

                                                  :
  TypeVector<T> (x,y,z)
{
}
template<typename T >
template<typename T2 >
libMesh::VectorValue< T >::VectorValue ( const VectorValue< T2 > &  p) [inline]

Copy-constructor.

Definition at line 159 of file vector_value.h.

                                                     :
  TypeVector<T> (p)
{
}
template<typename T >
template<typename T2 >
libMesh::VectorValue< T >::VectorValue ( const TypeVector< T2 > &  p) [inline]

Copy-constructor.

Definition at line 169 of file vector_value.h.

                                                    :
  TypeVector<T> (p)
{
}
template<typename T>
libMesh::VectorValue< T >::VectorValue ( const TypeVector< Real > &  p_re,
const TypeVector< Real > &  p_im 
) [inline]

Constructor that takes two TypeVector<Real> representing the real and imaginary part as arguments.

Definition at line 177 of file vector_value.h.

                                                           :
  TypeVector<T> (Complex (p_re(0), p_im(0)),
                 Complex (p_re(1), p_im(1)),
                 Complex (p_re(2), p_im(2)))
{
}

Member Function Documentation

template<typename T>
bool libMesh::TypeVector< T >::absolute_fuzzy_equals ( const TypeVector< T > &  rhs,
Real  tol = TOLERANCE 
) const [inline, inherited]
Returns:
true iff two vectors occupy approximately the same physical location in space, to within an absolute tolerance of tol.

Definition at line 854 of file type_vector.h.

References libMesh::TypeVector< T >::_coords, and std::abs().

Referenced by libMesh::FEGenericBase< OutputType >::compute_periodic_constraints(), libMesh::LocationMap< T >::find(), and libMesh::SerialMesh::stitching_helper().

{
#if LIBMESH_DIM == 1
  return (std::abs(_coords[0] - rhs._coords[0])
          <= tol);
#endif

#if LIBMESH_DIM == 2
  return (std::abs(_coords[0] - rhs._coords[0]) +
          std::abs(_coords[1] - rhs._coords[1])
          <= tol);
#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])
          <= tol);
#endif
}
template<typename T >
template<typename T2 >
void libMesh::TypeVector< T >::add ( const TypeVector< T2 > &  p) [inline, inherited]

Add to this vector without creating a temporary.

Definition at line 516 of file type_vector.h.

References libMesh::TypeVector< T >::_coords.

Referenced by libMesh::Elem::centroid(), libMesh::FE< Dim, T >::inverse_map(), libMesh::InfFE< Dim, T_radial, T_map >::inverse_map(), libMesh::LaplaceMeshSmoother::smooth(), and libMesh::MeshTools::Modification::smooth().

{
#if LIBMESH_DIM == 1
  _coords[0] += p._coords[0];
#endif

#if LIBMESH_DIM == 2
  _coords[0] += p._coords[0];
  _coords[1] += p._coords[1];
#endif

#if LIBMESH_DIM == 3
  _coords[0] += p._coords[0];
  _coords[1] += p._coords[1];
  _coords[2] += p._coords[2];
#endif

}
template<typename T >
template<typename T2 >
void libMesh::TypeVector< T >::assign ( const TypeVector< T2 > &  p) [inline, inherited]

Assign to a vector without creating a temporary.

Definition at line 445 of file type_vector.h.

References libMesh::TypeVector< T >::_coords.

{
  for (unsigned int i=0; i<LIBMESH_DIM; i++)
    _coords[i] = p._coords[i];
}
template<typename T >
template<typename T2 >
CompareTypes< T, T2 >::supertype libMesh::TypeVector< T >::contract ( const TypeVector< T2 > &  p) const [inline, inherited]

Multiply 2 vectors together, i.e. dot-product. The vectors may be of different types.

Definition at line 785 of file type_vector.h.

{
  return (*this)*(p);
}
template<typename T >
template<typename T2 >
TypeVector< typename CompareTypes< T, T2 >::supertype > libMesh::TypeVector< T >::cross ( const TypeVector< T2 > &  p) const [inherited]

Cross 2 vectors together, i.e. cross-product.

Definition at line 795 of file type_vector.h.

References libMesh::TypeVector< T >::_coords.

Referenced by libMesh::FEXYZMap::compute_face_map(), libMesh::FEMap::compute_face_map(), libMesh::Plane::create_from_three_points(), libMesh::Quad4::volume(), libMesh::Tri3::volume(), libMesh::Pyramid5::volume(), libMesh::Prism6::volume(), libMesh::Hex8::volume(), and libMesh::Tet4::volume().

{
  typedef typename CompareTypes<T, T2>::supertype TS;
  libmesh_assert_equal_to (LIBMESH_DIM, 3);

  // |     i          j          k    |
  // |(*this)(0) (*this)(1) (*this)(2)|
  // |   p(0)       p(1)       p(2)   |

  return TypeVector<TS>( _coords[1]*p._coords[2] - _coords[2]*p._coords[1],
                         -_coords[0]*p._coords[2] + _coords[2]*p._coords[0],
                         _coords[0]*p._coords[1] - _coords[1]*p._coords[0]);
}
template<typename T>
bool libMesh::TypeVector< T >::operator!= ( const TypeVector< T > &  rhs) const [inherited]
Returns:
true iff two vectors do not occupy approximately the same physical location in space.
template<>
bool libMesh::TypeVector< Real >::operator!= ( const TypeVector< Real > &  rhs) const [inline, inherited]

Definition at line 926 of file type_vector.h.

{
  return (!(*this == rhs));
}
template<typename T >
const T & libMesh::TypeVector< T >::operator() ( const unsigned int  i) const [inline, inherited]

Return the $ i^{th} $ element of the vector.

Definition at line 455 of file type_vector.h.

{
  libmesh_assert_less (i, LIBMESH_DIM);

  return _coords[i];
}
template<typename T >
T & libMesh::TypeVector< T >::operator() ( const unsigned int  i) [inline, inherited]

Return a writeable reference to the $ i^{th} $ element of the vector.

Definition at line 466 of file type_vector.h.

{
  libmesh_assert_less (i, LIBMESH_DIM);

  return _coords[i];
}
template<typename T >
template<typename Scalar >
boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeVector< typename CompareTypes< T, Scalar >::supertype > >::type libMesh::TypeVector< T >::operator* ( const Scalar  factor) const [inline, inherited]

Multiply a vector by a number, i.e. scale.

Definition at line 652 of file type_vector.h.

{
  typedef typename CompareTypes<T, Scalar>::supertype SuperType;

#if LIBMESH_DIM == 1
  return TypeVector<SuperType>(_coords[0]*factor);
#endif

#if LIBMESH_DIM == 2
  return TypeVector<SuperType>(_coords[0]*factor,
                               _coords[1]*factor);
#endif

#if LIBMESH_DIM == 3
  return TypeVector<SuperType>(_coords[0]*factor,
                               _coords[1]*factor,
                               _coords[2]*factor);
#endif
}
template<typename T >
template<typename T2 >
CompareTypes< T, T2 >::supertype libMesh::TypeVector< T >::operator* ( const TypeVector< T2 > &  p) const [inline, inherited]

Multiply 2 vectors together, i.e. dot-product. The vectors may be of different types.

Definition at line 763 of file type_vector.h.

References libMesh::TypeVector< T >::_coords.

{
#if LIBMESH_DIM == 1
  return _coords[0]*p._coords[0];
#endif

#if LIBMESH_DIM == 2
  return (_coords[0]*p._coords[0] +
          _coords[1]*p._coords[1]);
#endif

#if LIBMESH_DIM == 3
  return (_coords[0]*p(0) +
          _coords[1]*p(1) +
          _coords[2]*p(2));
#endif
}
template<typename T>
const TypeVector< T > & libMesh::TypeVector< T >::operator*= ( const T  factor) [inline, inherited]

Multiply this vector by a number, i.e. scale.

Definition at line 689 of file type_vector.h.

{
#if LIBMESH_DIM == 1
  _coords[0] *= factor;
#endif

#if LIBMESH_DIM == 2
  _coords[0] *= factor;
  _coords[1] *= factor;
#endif

#if LIBMESH_DIM == 3
  _coords[0] *= factor;
  _coords[1] *= factor;
  _coords[2] *= factor;
#endif

  return *this;
}
template<typename T >
template<typename T2 >
TypeVector< typename CompareTypes< T, T2 >::supertype > libMesh::TypeVector< T >::operator+ ( const TypeVector< T2 > &  p) const [inline, inherited]

Add two vectors.

Definition at line 479 of file type_vector.h.

References libMesh::TypeVector< T >::_coords.

{
  typedef typename CompareTypes<T, T2>::supertype TS;
#if LIBMESH_DIM == 1
  return TypeVector<TS> (_coords[0] + p._coords[0]);
#endif

#if LIBMESH_DIM == 2
  return TypeVector<TS> (_coords[0] + p._coords[0],
                         _coords[1] + p._coords[1]);
#endif

#if LIBMESH_DIM == 3
  return TypeVector<TS> (_coords[0] + p._coords[0],
                         _coords[1] + p._coords[1],
                         _coords[2] + p._coords[2]);
#endif

}
template<typename T >
template<typename T2 >
const TypeVector< T > & libMesh::TypeVector< T >::operator+= ( const TypeVector< T2 > &  p) [inline, inherited]

Add to this vector.

Definition at line 504 of file type_vector.h.

{
  this->add (p);

  return *this;
}
template<typename T >
template<typename T2 >
TypeVector< typename CompareTypes< T, T2 >::supertype > libMesh::TypeVector< T >::operator- ( const TypeVector< T2 > &  p) const [inline, inherited]

Subtract two vectors.

Definition at line 565 of file type_vector.h.

References libMesh::TypeVector< T >::_coords.

{
  typedef typename CompareTypes<T, T2>::supertype TS;

#if LIBMESH_DIM == 1
  return TypeVector<TS>(_coords[0] - p._coords[0]);
#endif

#if LIBMESH_DIM == 2
  return TypeVector<TS>(_coords[0] - p._coords[0],
                        _coords[1] - p._coords[1]);
#endif

#if LIBMESH_DIM == 3
  return TypeVector<TS>(_coords[0] - p._coords[0],
                        _coords[1] - p._coords[1],
                        _coords[2] - p._coords[2]);
#endif

}
template<typename T >
TypeVector< T > libMesh::TypeVector< T >::operator- ( ) const [inline, inherited]

Return the opposite of a vector

Definition at line 624 of file type_vector.h.

{

#if LIBMESH_DIM == 1
  return TypeVector(-_coords[0]);
#endif

#if LIBMESH_DIM == 2
  return TypeVector(-_coords[0],
                    -_coords[1]);
#endif

#if LIBMESH_DIM == 3
  return TypeVector(-_coords[0],
                    -_coords[1],
                    -_coords[2]);
#endif

}
template<typename T >
template<typename T2 >
const TypeVector< T > & libMesh::TypeVector< T >::operator-= ( const TypeVector< T2 > &  p) [inline, inherited]

Subtract from this vector.

Definition at line 591 of file type_vector.h.

{
  this->subtract (p);

  return *this;
}
template<typename T >
template<typename Scalar >
boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeVector< typename CompareTypes< T, Scalar >::supertype > >::type libMesh::TypeVector< T >::operator/ ( const Scalar  factor) const [inline, inherited]

Divide a vector by a number, i.e. scale.

Definition at line 717 of file type_vector.h.

{
  libmesh_assert_not_equal_to (factor, static_cast<T>(0.));

  typedef typename CompareTypes<T, Scalar>::supertype TS;

#if LIBMESH_DIM == 1
  return TypeVector<TS>(_coords[0]/factor);
#endif

#if LIBMESH_DIM == 2
  return TypeVector<TS>(_coords[0]/factor,
                        _coords[1]/factor);
#endif

#if LIBMESH_DIM == 3
  return TypeVector<TS>(_coords[0]/factor,
                        _coords[1]/factor,
                        _coords[2]/factor);
#endif

}
template<typename T>
const TypeVector< T > & libMesh::TypeVector< T >::operator/= ( const T  factor) [inline, inherited]

Divide this vector by a number, i.e. scale.

Definition at line 746 of file type_vector.h.

{
  libmesh_assert_not_equal_to (factor, static_cast<T>(0.));

  for (unsigned int i=0; i<LIBMESH_DIM; i++)
    _coords[i] /= factor;

  return *this;
}
template<>
bool libMesh::TypeVector< Complex >::operator< ( const TypeVector< Complex > &  rhs) const [inherited]

Definition at line 167 of file type_vector.C.

{
  for (unsigned int i=0; i<LIBMESH_DIM; i++)
    {
      if ((*this)(i).real() < rhs(i).real())
        return true;
      if ((*this)(i).real() > rhs(i).real())
        return false;
      if ((*this)(i).imag() < rhs(i).imag())
        return true;
      if ((*this)(i).imag() > rhs(i).imag())
        return false;
    }
  return false;
}
template<typename T>
bool libMesh::TypeVector< T >::operator< ( const TypeVector< T > &  rhs) const [inherited]
Returns:
true if this vector is "less" than another. Useful for sorting. Also used for choosing some arbitrary basis function orientations

Definition at line 109 of file type_vector.C.

{
  for (unsigned int i=0; i<LIBMESH_DIM; i++)
    {
      if ((*this)(i) < rhs(i))
        return true;
      if ((*this)(i) > rhs(i))
        return false;
    }
  return false;
}
template<>
bool libMesh::TypeVector< Complex >::operator<= ( const TypeVector< Complex > &  rhs) const [inherited]

Definition at line 186 of file type_vector.C.

{
  for (unsigned int i=0; i<LIBMESH_DIM; i++)
    {
      if ((*this)(i).real() < rhs(i).real())
        return true;
      if ((*this)(i).real() > rhs(i).real())
        return false;
      if ((*this)(i).imag() < rhs(i).imag())
        return true;
      if ((*this)(i).imag() > rhs(i).imag())
        return false;
    }
  return true;
}
template<typename T>
bool libMesh::TypeVector< T >::operator<= ( const TypeVector< T > &  rhs) const [inherited]
Returns:
true if this vector is "less" than or equal to another. Useful for sorting. Also used for choosing some arbitrary constraint equation directions

Definition at line 123 of file type_vector.C.

{
  for (unsigned int i=0; i<LIBMESH_DIM; i++)
    {
      if ((*this)(i) < rhs(i))
        return true;
      if ((*this)(i) > rhs(i))
        return false;
    }
  return true;
}
template<typename T>
template<typename Scalar >
boostcopy::enable_if_c< ScalarTraits<Scalar>::value, VectorValue&>::type libMesh::VectorValue< T >::operator= ( const Scalar &  libmesh_dbg_varp) [inline]

Assignment-from-scalar operator. Used only to zero out vectors.

Definition at line 98 of file vector_value.h.

  { libmesh_assert_equal_to (p, Scalar(0)); this->zero(); return *this; }
template<typename T>
bool libMesh::TypeVector< T >::operator== ( const TypeVector< T > &  rhs) const [inline, inherited]
Returns:
true iff two vectors occupy approximately the same physical location in space, to within an absolute tolerance of TOLERANCE.

Definition at line 904 of file type_vector.h.

References libMesh::TypeVector< T >::_coords.

{
#if LIBMESH_DIM == 1
  return (_coords[0] == rhs._coords[0]);
#endif

#if LIBMESH_DIM == 2
  return (_coords[0] == rhs._coords[0] &&
          _coords[1] == rhs._coords[1]);
#endif

#if LIBMESH_DIM == 3
  return (_coords[0] == rhs._coords[0] &&
          _coords[1] == rhs._coords[1] &&
          _coords[2] == rhs._coords[2]);
#endif
}
template<>
bool libMesh::TypeVector< Complex >::operator> ( const TypeVector< Complex > &  rhs) const [inherited]

Definition at line 205 of file type_vector.C.

{
  for (unsigned int i=0; i<LIBMESH_DIM; i++)
    {
      if ((*this)(i).real() > rhs(i).real())
        return true;
      if ((*this)(i).real() < rhs(i).real())
        return false;
      if ((*this)(i).imag() > rhs(i).imag())
        return true;
      if ((*this)(i).imag() < rhs(i).imag())
        return false;
    }
  return false;
}
template<typename T>
bool libMesh::TypeVector< T >::operator> ( const TypeVector< T > &  rhs) const [inherited]
Returns:
true if this vector is "greater" than another. Useful for sorting. Also used for choosing some arbitrary basis function orientations

Definition at line 138 of file type_vector.C.

{
  for (unsigned int i=0; i<LIBMESH_DIM; i++)
    {
      if ((*this)(i) > rhs(i))
        return true;
      if ((*this)(i) < rhs(i))
        return false;
    }
  return false;
}
template<>
bool libMesh::TypeVector< Complex >::operator>= ( const TypeVector< Complex > &  rhs) const [inherited]

Definition at line 224 of file type_vector.C.

{
  for (unsigned int i=0; i<LIBMESH_DIM; i++)
    {
      if ((*this)(i).real() > rhs(i).real())
        return true;
      if ((*this)(i).real() < rhs(i).real())
        return false;
      if ((*this)(i).imag() > rhs(i).imag())
        return true;
      if ((*this)(i).imag() < rhs(i).imag())
        return false;
    }
  return true;
}
template<typename T>
bool libMesh::TypeVector< T >::operator>= ( const TypeVector< T > &  rhs) const [inherited]
Returns:
true if this vector is "greater" than or equal to another. Useful for sorting. Also used for choosing some arbitrary constraint equation directions

Definition at line 152 of file type_vector.C.

{
  for (unsigned int i=0; i<LIBMESH_DIM; i++)
    {
      if ((*this)(i) > rhs(i))
        return true;
      if ((*this)(i) < rhs(i))
        return false;
    }
  return true;
}
template<typename T >
void libMesh::TypeVector< T >::print ( std::ostream &  os = libMesh::out) const [inherited]

Formatted print, by default to libMesh::out.

Definition at line 64 of file type_vector.C.

{
#if LIBMESH_DIM == 1

  os << "x=" << (*this)(0);

#endif
#if LIBMESH_DIM == 2

  os << "(x,y)=("
     << std::setw(8) << (*this)(0) << ", "
     << std::setw(8) << (*this)(1) << ")";

#endif
#if LIBMESH_DIM == 3

  os <<  "(x,y,z)=("
     << std::setw(8) << (*this)(0) << ", "
     << std::setw(8) << (*this)(1) << ", "
     << std::setw(8) << (*this)(2) << ")";
#endif
}
template<typename T>
bool libMesh::TypeVector< T >::relative_fuzzy_equals ( const TypeVector< T > &  rhs,
Real  tol = TOLERANCE 
) const [inline, inherited]
Returns:
true iff two vectors occupy approximately the same physical location in space, to within a relative tolerance of tol.

Definition at line 879 of file type_vector.h.

References libMesh::TypeVector< T >::_coords, and std::abs().

Referenced by libMesh::Prism6::has_affine_map(), libMesh::Quad4::has_affine_map(), libMesh::Hex8::has_affine_map(), libMesh::Quad9::has_affine_map(), libMesh::Quad8::has_affine_map(), libMesh::Hex20::has_affine_map(), libMesh::Hex27::has_affine_map(), libMesh::Prism18::has_affine_map(), and libMesh::Prism15::has_affine_map().

{
#if LIBMESH_DIM == 1
  return this->absolute_fuzzy_equals(rhs, tol *
                                     (std::abs(_coords[0]) + std::abs(rhs._coords[0])));
#endif

#if LIBMESH_DIM == 2
  return this->absolute_fuzzy_equals(rhs, tol *
                                     (std::abs(_coords[0]) + std::abs(rhs._coords[0]) +
                                      std::abs(_coords[1]) + std::abs(rhs._coords[1])));
#endif

#if LIBMESH_DIM == 3
  return this->absolute_fuzzy_equals(rhs, tol *
                                     (std::abs(_coords[0]) + std::abs(rhs._coords[0]) +
                                      std::abs(_coords[1]) + std::abs(rhs._coords[1]) +
                                      std::abs(_coords[2]) + std::abs(rhs._coords[2])));
#endif
}
template<typename T>
const T& libMesh::TypeVector< T >::slice ( const unsigned int  i) const [inline, inherited]

Definition at line 123 of file type_vector.h.

{ return (*this)(i); }
template<typename T>
T& libMesh::TypeVector< T >::slice ( const unsigned int  i) [inline, inherited]

Definition at line 130 of file type_vector.h.

{ return (*this)(i); }
template<typename T >
template<typename T2 >
void libMesh::TypeVector< T >::subtract ( const TypeVector< T2 > &  p) [inline, inherited]

Subtract from this vector without creating a temporary.

Definition at line 603 of file type_vector.h.

References libMesh::TypeVector< T >::_coords.

{
  for (unsigned int i=0; i<LIBMESH_DIM; i++)
    _coords[i] -= p._coords[i];
}
template<typename T>
template<typename T2 >
void libMesh::TypeVector< T >::subtract_scaled ( const TypeVector< T2 > &  p,
const T  factor 
) [inline, inherited]

Subtract a scaled value from this vector without creating a temporary.

Definition at line 614 of file type_vector.h.

Referenced by libMesh::HPCoarsenTest::select_refinement().

{
  for (unsigned int i=0; i<LIBMESH_DIM; i++)
    _coords[i] -= factor*p(i);
}
template<typename T >
TypeVector< T > libMesh::TypeVector< T >::unit ( ) const [inherited]

Think of a vector as a dim dimensional vector. This will return a unit vector aligned in that direction.

Definition at line 37 of file type_vector.C.

References libMesh::Real.

Referenced by libMesh::FEXYZMap::compute_face_map(), libMesh::FEMap::compute_face_map(), libMesh::Plane::create_from_point_normal(), libMesh::Plane::create_from_three_points(), libMesh::MeshTools::Modification::distort(), and libMesh::Sphere::unit_normal().

{

  const Real length = size();

  libmesh_assert_not_equal_to (length, static_cast<Real>(0.));

#if LIBMESH_DIM == 1
  return TypeVector<T>(_coords[0]/length);
#endif

#if LIBMESH_DIM == 2
  return TypeVector<T>(_coords[0]/length,
                       _coords[1]/length);
#endif

#if LIBMESH_DIM == 3
  return TypeVector<T>(_coords[0]/length,
                       _coords[1]/length,
                       _coords[2]/length);
#endif

}
template<typename T >
void libMesh::TypeVector< T >::write_unformatted ( std::ostream &  out,
const bool  newline = true 
) const [inherited]

Unformatted print to the stream out. Simply prints the elements of the vector separated by spaces. Optionally prints a newline, which it does by default.

Definition at line 92 of file type_vector.C.

References libMesh::libmesh_assert().

Referenced by libMesh::InfElemBuilder::build_inf_elem(), libMesh::TecplotIO::write_ascii(), and libMesh::DivaIO::write_stream().

{
  libmesh_assert (os);

  os << std::setiosflags(std::ios::showpoint)
     << (*this)(0) << " "
     << (*this)(1) << " "
     << (*this)(2) << " ";

  if (newline)
    os << '\n';
}
template<typename T >
void libMesh::TypeVector< T >::zero ( ) [inline, inherited]

Zero the vector in any dimension.

Definition at line 822 of file type_vector.h.

Referenced by libMesh::VectorValue< Real >::operator=(), and libMesh::TypeVector< Real >::operator=().

{
  for (unsigned int i=0; i<LIBMESH_DIM; i++)
    _coords[i] = 0.;
}

Friends And Related Function Documentation

template<typename T>
std::ostream& operator<< ( std::ostream &  os,
const TypeVector< T > &  t 
) [friend, inherited]

Formatted print as above but allows you to do Point p(1,2,3); std::cout << p << std::endl;

Definition at line 329 of file type_vector.h.

  {
    t.print(os);
    return os;
  }

Member Data Documentation


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