20 #ifndef LIBMESH_TYPE_VECTOR_H 21 #define LIBMESH_TYPE_VECTOR_H 37 template <
typename T>
class TypeTensor;
38 template <
typename T>
class VectorValue;
39 template <
typename T>
class TensorValue;
54 template <
typename T2>
79 template <
typename Scalar1,
typename Scalar2,
typename Scalar3>
82 const Scalar1>::type x,
85 const Scalar2>::type y=0,
88 const Scalar3>::type z=0);
96 template <
typename Scalar>
112 template <
typename T2>
123 template <
typename T2>
129 template <
typename Scalar>
134 { libmesh_assert_equal_to (p, Scalar(0)); this->
zero();
return *
this; }
139 const T &
operator () (
const unsigned int i)
const;
140 const T &
slice (
const unsigned int i)
const {
return (*
this)(i); }
146 T &
slice (
const unsigned int i) {
return (*
this)(i); }
153 template <
typename T2>
162 template <
typename T2>
168 template <
typename T2>
174 template <
typename T2>
182 template <
typename T2>
191 template <
typename T2>
197 template <
typename T2>
204 template <
typename T2>
217 template <
typename Scalar>
219 ScalarTraits<Scalar>::value,
235 template <
typename Scalar>
237 ScalarTraits<Scalar>::value,
254 template <
typename T2>
261 template <
typename T2>
268 template <
typename T2>
283 #ifdef LIBMESH_ENABLE_DEPRECATED 299 #ifdef LIBMESH_ENABLE_DEPRECATED 348 bool operator < (const TypeVector<T> & rhs)
const;
356 bool operator <= (const TypeVector<T> & rhs)
const;
387 friend std::ostream & operator << (std::ostream & os, const TypeVector<T> & t)
416 template <
typename T>
433 template <
typename T>
444 libmesh_assert_equal_to (y, 0);
450 libmesh_assert_equal_to (z, 0);
455 template <
typename T>
456 template <
typename Scalar1,
typename Scalar2,
typename Scalar3>
460 const Scalar1>::type x,
463 const Scalar2>::type y,
466 const Scalar3>::type z)
473 libmesh_assert_equal_to (y, 0);
479 libmesh_assert_equal_to (z, 0);
485 template <
typename T>
486 template <
typename Scalar>
491 const Scalar>::type * )
506 template <
typename T>
507 template <
typename T2>
512 for (
unsigned int i=0; i<LIBMESH_DIM; i++)
518 template <
typename T>
526 template <
typename T>
527 template <
typename T2>
531 for (
unsigned int i=0; i<LIBMESH_DIM; i++)
537 template <
typename T>
541 libmesh_assert_less (i, LIBMESH_DIM);
548 template <
typename T>
552 libmesh_assert_less (i, LIBMESH_DIM);
559 template <
typename T>
560 template <
typename T2>
585 template <
typename T>
586 template <
typename T2>
597 template <
typename T>
598 template <
typename T2>
621 template <
typename T>
622 template <
typename T2>
645 template <
typename T>
646 template <
typename T2>
672 template <
typename T>
673 template <
typename T2>
684 template <
typename T>
685 template <
typename T2>
689 for (
unsigned int i=0; i<LIBMESH_DIM; i++)
695 template <
typename T>
696 template <
typename T2>
700 for (
unsigned int i=0; i<LIBMESH_DIM; i++)
706 template <
typename T>
730 template <
typename T>
731 template <
typename Scalar>
734 ScalarTraits<Scalar>::value,
758 template <
typename T,
typename Scalar>
761 ScalarTraits<Scalar>::value,
771 template <
typename T>
795 template <
typename T>
796 template <
typename Scalar>
799 ScalarTraits<Scalar>::value,
803 libmesh_assert_not_equal_to (factor, static_cast<T>(0.));
827 template <
typename T>
832 libmesh_assert_not_equal_to (factor, static_cast<T>(0.));
834 for (
unsigned int i=0; i<LIBMESH_DIM; i++)
843 template <
typename T>
844 template <
typename T2>
850 return _coords[0]*p._coords[0];
854 return (
_coords[0]*p._coords[0] +
865 template <
typename T>
866 template <
typename T2>
876 template <
typename T>
877 template <
typename T2>
882 libmesh_assert_equal_to (LIBMESH_DIM, 3);
895 #ifdef LIBMESH_ENABLE_DEPRECATED 896 template <
typename T>
900 libmesh_deprecated();
907 template <
typename T>
911 return std::sqrt(this->
norm_sq());
916 template <
typename T>
920 for (
unsigned int i=0; i<LIBMESH_DIM; i++)
926 #ifdef LIBMESH_ENABLE_DEPRECATED 927 template <
typename T>
931 libmesh_deprecated();
938 template <
typename T>
960 template <
typename T>
985 template <
typename T>
1000 #if LIBMESH_DIM == 3 1010 template <
typename T>
1014 #if LIBMESH_DIM == 1 1015 return (
_coords[0] == rhs._coords[0]);
1018 #if LIBMESH_DIM == 2 1019 return (
_coords[0] == rhs._coords[0] &&
1020 _coords[1] == rhs._coords[1]);
1023 #if LIBMESH_DIM == 3 1024 return (
_coords[0] == rhs._coords[0] &&
1025 _coords[1] == rhs._coords[1] &&
1026 _coords[2] == rhs._coords[2]);
1032 template <
typename T>
1036 return (!(*
this == rhs));
1049 template <
typename T>
1056 libmesh_assert_equal_to (LIBMESH_DIM, 3);
1059 a(0)*(b(1)*c(2) - b(2)*c(1)) -
1060 a(1)*(b(0)*c(2) - b(2)*c(0)) +
1061 a(2)*(b(0)*c(1) - b(1)*c(0));
1070 template <
typename T>
1076 libmesh_assert_equal_to (LIBMESH_DIM, 3);
1078 T x = b(1)*c(2) - b(2)*c(1),
1079 y = b(0)*c(2) - b(2)*c(0),
1080 z = b(0)*c(1) - b(1)*c(0);
1082 return x*x + y*y + z*z;
1090 template <
typename T>
1096 libmesh_assert_equal_to (LIBMESH_DIM, 3);
1103 #endif // LIBMESH_TYPE_VECTOR_H bool operator>=(const TypeVector< T > &rhs) const
bool operator==(const TypeVector< T > &rhs) const
const T & slice(const unsigned int i) const
bool operator>(const TypeVector< T > &rhs) const
CompareTypes< T, T2 >::supertype contract(const TypeVector< T2 > &) const
void add_scaled(const TypeVector< T2 > &, const T)
T cross_norm(const TypeVector< T > &b, const TypeVector< T > &c)
void write_unformatted(std::ostream &out, const bool newline=true) const
const class libmesh_nullptr_t libmesh_nullptr
static const Real TOLERANCE
TypeVector< T > operator-() const
TypeVector< typename CompareTypes< T, T2 >::supertype > operator+(const TypeVector< T2 > &) const
const TypeVector< T > & operator+=(const TypeVector< T2 > &)
void add(const TypeVector< T2 > &)
const TypeVector< T > & operator/=(const T)
T cross_norm_sq(const TypeVector< T > &b, const TypeVector< T > &c)
T triple_product(const TypeVector< T > &a, const TypeVector< T > &b, const TypeVector< T > &c)
void subtract(const TypeVector< T2 > &)
void print(std::ostream &os=libMesh::out) const
bool operator!=(const TypeVector< T > &rhs) const
TypeVector< typename CompareTypes< T, T2 >::supertype > cross(const TypeVector< T2 > &v) const
void subtract_scaled(const TypeVector< T2 > &, const T)
TypeVector< T > unit() const
const TypeVector< T > & operator-=(const TypeVector< T2 > &)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool absolute_fuzzy_equals(const TypeVector< T > &rhs, Real tol=TOLERANCE) const
boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeVector< typename CompareTypes< T, Scalar >::supertype > >::type operator/(const Scalar) const
void assign(const TypeVector< T2 > &)
boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeVector< typename CompareTypes< T, Scalar >::supertype > >::type operator*(const Scalar) const
const T & operator()(const unsigned int i) const
T & slice(const unsigned int i)
const TypeVector< T > & operator*=(const T)
OStreamProxy out(std::cout)
boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeVector & >::type operator=(const Scalar &libmesh_dbg_var(p))
bool relative_fuzzy_equals(const TypeVector< T > &rhs, Real tol=TOLERANCE) const