libMesh
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
libMesh::Point Class Reference

A Point defines a location in LIBMESH_DIM dimensional Real space. More...

#include <point.h>

Inheritance diagram for libMesh::Point:
[legend]

Public Types

typedef Real value_type
 Helper typedef for C++98 generic programming. More...
 
typedef unsigned int index_type
 Helper typedef for generic index programming. More...
 

Public Member Functions

 Point (const Real x=0., const Real y=0., const Real z=0.)
 Constructor. More...
 
 Point (const Point &p)
 Copy-constructor. More...
 
 Point (const TypeVector< Real > &p)
 Copy-constructor. More...
 
 ~Point ()
 Empty. More...
 
void assign (const TypeVector< T2 > &)
 Assign to this vector without creating a temporary. More...
 
const Realoperator() (const unsigned int i) const
 
Realoperator() (const unsigned int i)
 
const Realslice (const unsigned int i) const
 
Realslice (const unsigned int i)
 
TypeVector< typename CompareTypes< Real, T2 >::supertype > operator+ (const TypeVector< T2 > &) const
 Add two vectors. More...
 
const TypeVector< Real > & operator+= (const TypeVector< T2 > &)
 Add to this vector. More...
 
void add (const TypeVector< T2 > &)
 Add to this vector without creating a temporary. More...
 
void add_scaled (const TypeVector< T2 > &, const Real &)
 Add a scaled value to this vector without creating a temporary. More...
 
TypeVector< typename CompareTypes< Real, T2 >::supertype > operator- (const TypeVector< T2 > &) const
 Subtract from this vector. More...
 
TypeVector< Realoperator- () const
 
const TypeVector< Real > & operator-= (const TypeVector< T2 > &)
 Subtract from this vector. More...
 
void subtract (const TypeVector< T2 > &)
 Subtract from this vector without creating a temporary. More...
 
void subtract_scaled (const TypeVector< T2 > &, const Real &)
 Subtract a scaled value from this vector without creating a temporary. More...
 
boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeVector< typename CompareTypes< Real, Scalar >::supertype > >::type operator* (const Scalar &) const
 Multiply this vector by a scalar value. More...
 
CompareTypes< Real, T2 >::supertype operator* (const TypeVector< T2 > &) const
 
const TypeVector< Real > & operator*= (const Real &)
 Multiply this vector by a scalar value. More...
 
boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeVector< typename CompareTypes< Real, Scalar >::supertype > >::type operator/ (const Scalar &) const
 Divide each entry of this vector by scalar value. More...
 
const TypeVector< Real > & operator/= (const Real &)
 Divide each entry of this vector by scalar value. More...
 
CompareTypes< Real, T2 >::supertype contract (const TypeVector< T2 > &) const
 
TypeVector< typename CompareTypes< Real, T2 >::supertype > cross (const TypeVector< T2 > &v) const
 
TypeVector< Realunit () const
 
auto size () const -> decltype(std::norm(Real()))
 
auto norm () const -> decltype(std::norm(Real()))
 
auto size_sq () const -> decltype(std::norm(Real()))
 
auto norm_sq () const -> decltype(std::norm(Real()))
 
bool is_zero () const
 
void zero ()
 Set all entries of the vector to 0. More...
 
bool relative_fuzzy_equals (const TypeVector< Real > &rhs, Real tol=TOLERANCE) const
 
bool absolute_fuzzy_equals (const TypeVector< Real > &rhs, Real tol=TOLERANCE) const
 
bool operator== (const TypeVector< Real > &rhs) const
 
bool operator!= (const TypeVector< Real > &rhs) const
 
bool operator< (const TypeVector< Real > &rhs) const
 
bool operator<= (const TypeVector< Real > &rhs) const
 
bool operator> (const TypeVector< Real > &rhs) const
 
bool operator>= (const TypeVector< Real > &rhs) const
 
void print (std::ostream &os=libMesh::out) const
 Formatted print, by default to libMesh::out. More...
 
void write_unformatted (std::ostream &out, const bool newline=true) const
 Unformatted print to the stream out. More...
 

Protected Attributes

Real _coords [LIBMESH_DIM]
 The coordinates of the TypeVector. More...
 

Friends

class Node
 Make the derived class a friend. More...
 

Detailed Description

A Point defines a location in LIBMESH_DIM dimensional Real space.

Points are always real-valued, even if the library is configured with –enable-complex.

Author
Benjamin S. Kirk
Date
2003 A geometric point in (x,y,z) space.

Definition at line 38 of file point.h.

Member Typedef Documentation

◆ index_type

typedef unsigned int libMesh::TypeVector< Real >::index_type
inherited

Helper typedef for generic index programming.

Definition at line 141 of file type_vector.h.

◆ value_type

typedef Real libMesh::TypeVector< Real >::value_type
inherited

Helper typedef for C++98 generic programming.

Definition at line 136 of file type_vector.h.

Constructor & Destructor Documentation

◆ Point() [1/3]

libMesh::Point::Point ( const Real  x = 0.,
const Real  y = 0.,
const Real  z = 0. 
)

Constructor.

By default sets all entries to 0. Gives the point 0 in LIBMESH_DIM dimensions.

Definition at line 46 of file point.h.

48  :
49  TypeVector<Real> (x,y,z)
50  {}

◆ Point() [2/3]

libMesh::Point::Point ( const Point p)

Copy-constructor.

Definition at line 55 of file point.h.

55  :
56  TypeVector<Real> (p)
57  {}

◆ Point() [3/3]

libMesh::Point::Point ( const TypeVector< Real > &  p)

Copy-constructor.

Definition at line 62 of file point.h.

62  :
63  TypeVector<Real> (p)
64  {}

◆ ~Point()

libMesh::Point::~Point ( )

Empty.

Definition at line 69 of file point.h.

69 {}

Member Function Documentation

◆ absolute_fuzzy_equals()

bool libMesh::TypeVector< Real >::absolute_fuzzy_equals ( const TypeVector< Real > &  rhs,
Real  tol = TOLERANCE 
) const
inherited
Returns
true if two vectors are equal to within an absolute tolerance of tol.

Definition at line 1010 of file type_vector.h.

References std::abs().

1011 {
1012 #if LIBMESH_DIM == 1
1013  return (std::abs(_coords[0] - rhs._coords[0])
1014  <= tol);
1015 #endif
1016 
1017 #if LIBMESH_DIM == 2
1018  return (std::abs(_coords[0] - rhs._coords[0]) +
1019  std::abs(_coords[1] - rhs._coords[1])
1020  <= tol);
1021 #endif
1022 
1023 #if LIBMESH_DIM == 3
1024  return (std::abs(_coords[0] - rhs._coords[0]) +
1025  std::abs(_coords[1] - rhs._coords[1]) +
1026  std::abs(_coords[2] - rhs._coords[2])
1027  <= tol);
1028 #endif
1029 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445
double abs(double a)

◆ add()

void libMesh::TypeVector< Real >::add ( const TypeVector< T2 > &  p)
inherited

Add to this vector without creating a temporary.

Definition at line 639 of file type_vector.h.

640 {
641 #if LIBMESH_DIM == 1
642  _coords[0] += p._coords[0];
643 #endif
644 
645 #if LIBMESH_DIM == 2
646  _coords[0] += p._coords[0];
647  _coords[1] += p._coords[1];
648 #endif
649 
650 #if LIBMESH_DIM == 3
651  _coords[0] += p._coords[0];
652  _coords[1] += p._coords[1];
653  _coords[2] += p._coords[2];
654 #endif
655 
656 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445

◆ add_scaled()

void libMesh::TypeVector< Real >::add_scaled ( const TypeVector< T2 > &  p,
const Real &  factor 
)
inherited

Add a scaled value to this vector without creating a temporary.

Definition at line 663 of file type_vector.h.

664 {
665 #if LIBMESH_DIM == 1
666  _coords[0] += factor*p(0);
667 #endif
668 
669 #if LIBMESH_DIM == 2
670  _coords[0] += factor*p(0);
671  _coords[1] += factor*p(1);
672 #endif
673 
674 #if LIBMESH_DIM == 3
675  _coords[0] += factor*p(0);
676  _coords[1] += factor*p(1);
677  _coords[2] += factor*p(2);
678 #endif
679 
680 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445

◆ assign()

void libMesh::TypeVector< Real >::assign ( const TypeVector< T2 > &  p)
inherited

Assign to this vector without creating a temporary.

Definition at line 568 of file type_vector.h.

569 {
570  for (unsigned int i=0; i<LIBMESH_DIM; i++)
571  _coords[i] = p._coords[i];
572 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445

◆ contract()

CompareTypes< Real , T2 >::supertype libMesh::TypeVector< Real >::contract ( const TypeVector< T2 > &  p) const
inherited
Returns
The result of TypeVector::operator*().

Definition at line 908 of file type_vector.h.

909 {
910  return (*this)*(p);
911 }

◆ cross()

TypeVector< typename CompareTypes< Real , T2 >::supertype > libMesh::TypeVector< Real >::cross ( const TypeVector< T2 > &  v) const
inherited
Returns
The cross product of this vector with v.

Definition at line 918 of file type_vector.h.

919 {
920  typedef typename CompareTypes<T, T2>::supertype TS;
921  libmesh_assert_equal_to (LIBMESH_DIM, 3);
922 
923  // | i j k |
924  // |(*this)(0) (*this)(1) (*this)(2)|
925  // | p(0) p(1) p(2) |
926 
927  return TypeVector<TS>( _coords[1]*p._coords[2] - _coords[2]*p._coords[1],
928  -_coords[0]*p._coords[2] + _coords[2]*p._coords[0],
929  _coords[0]*p._coords[1] - _coords[1]*p._coords[0]);
930 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445

◆ is_zero()

bool libMesh::TypeVector< Real >::is_zero ( ) const
inherited
Returns
True if all values in the vector are zero

Definition at line 1000 of file type_vector.h.

1001 {
1002  for (const auto & val : _coords)
1003  if (val != T(0))
1004  return false;
1005  return true;
1006 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445

◆ norm()

auto libMesh::TypeVector< Real >::norm ( ) const-> decltype(std::norm(Real ()))
inherited
Returns
The magnitude of the vector, i.e. the square-root of the sum of the elements squared.

Definition at line 948 of file type_vector.h.

References libMesh::TensorTools::norm_sq(), and std::sqrt().

949 {
950  return std::sqrt(this->norm_sq());
951 }
MetaPhysicL::DualNumber< T, D > sqrt(const MetaPhysicL::DualNumber< T, D > &in)
auto norm_sq() const -> decltype(std::norm(Real()))
Definition: type_vector.h:979

◆ norm_sq()

auto libMesh::TypeVector< Real >::norm_sq ( ) const-> decltype(std::norm(Real ()))
inherited
Returns
The magnitude of the vector squared, i.e. the sum of the element magnitudes squared.

Definition at line 979 of file type_vector.h.

References libMesh::TensorTools::norm_sq().

980 {
981 #if LIBMESH_DIM == 1
982  return (TensorTools::norm_sq(_coords[0]));
983 #endif
984 
985 #if LIBMESH_DIM == 2
986  return (TensorTools::norm_sq(_coords[0]) +
988 #endif
989 
990 #if LIBMESH_DIM == 3
991  return (TensorTools::norm_sq(_coords[0]) +
994 #endif
995 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445
T norm_sq(std::complex< T > a)
Definition: tensor_tools.h:85

◆ operator!=()

bool libMesh::TypeVector< Real >::operator!= ( const TypeVector< Real > &  rhs) const
inherited
Returns
!(*this == rhs)

Definition at line 1082 of file type_vector.h.

1083 {
1084  return (!(*this == rhs));
1085 }

◆ operator()() [1/2]

const Real & libMesh::TypeVector< Real >::operator() ( const unsigned int  i) const
inherited
Returns
A const reference to the $ i^{th} $ entry of the vector.

Definition at line 578 of file type_vector.h.

579 {
580  libmesh_assert_less (i, LIBMESH_DIM);
581 
582  return _coords[i];
583 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445

◆ operator()() [2/2]

Real & libMesh::TypeVector< Real >::operator() ( const unsigned int  i)
inherited
Returns
A writable reference to the $ i^{th} $ entry of the vector.

Definition at line 589 of file type_vector.h.

590 {
591  libmesh_assert_less (i, LIBMESH_DIM);
592 
593  return _coords[i];
594 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445

◆ operator*() [1/2]

boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeVector< typename CompareTypes< Real , Scalar >::supertype > >::type libMesh::TypeVector< Real >::operator* ( const Scalar &  factor) const
inherited

Multiply this vector by a scalar value.

Returns
A copy of the result, this vector is unchanged.

Definition at line 775 of file type_vector.h.

776 {
777  typedef typename CompareTypes<T, Scalar>::supertype SuperType;
778 
779 #if LIBMESH_DIM == 1
780  return TypeVector<SuperType>(_coords[0]*factor);
781 #endif
782 
783 #if LIBMESH_DIM == 2
784  return TypeVector<SuperType>(_coords[0]*factor,
785  _coords[1]*factor);
786 #endif
787 
788 #if LIBMESH_DIM == 3
789  return TypeVector<SuperType>(_coords[0]*factor,
790  _coords[1]*factor,
791  _coords[2]*factor);
792 #endif
793 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445

◆ operator*() [2/2]

CompareTypes< Real , T2 >::supertype libMesh::TypeVector< Real >::operator* ( const TypeVector< T2 > &  p) const
inherited
Returns
The dot-product of this vector with another vector.
Note
The complex conjugate is not taken in the complex-valued case.
The vectors may contain different numeric types.

Definition at line 886 of file type_vector.h.

887 {
888 #if LIBMESH_DIM == 1
889  return _coords[0]*p._coords[0];
890 #endif
891 
892 #if LIBMESH_DIM == 2
893  return (_coords[0]*p._coords[0] +
894  _coords[1]*p._coords[1]);
895 #endif
896 
897 #if LIBMESH_DIM == 3
898  return (_coords[0]*p(0) +
899  _coords[1]*p(1) +
900  _coords[2]*p(2));
901 #endif
902 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445

◆ operator*=()

const TypeVector< Real > & libMesh::TypeVector< Real >::operator*= ( const Real &  factor)
inherited

Multiply this vector by a scalar value.

Returns
A reference to *this.

Definition at line 812 of file type_vector.h.

813 {
814 #if LIBMESH_DIM == 1
815  _coords[0] *= factor;
816 #endif
817 
818 #if LIBMESH_DIM == 2
819  _coords[0] *= factor;
820  _coords[1] *= factor;
821 #endif
822 
823 #if LIBMESH_DIM == 3
824  _coords[0] *= factor;
825  _coords[1] *= factor;
826  _coords[2] *= factor;
827 #endif
828 
829  return *this;
830 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445

◆ operator+()

TypeVector< typename CompareTypes< Real , T2 >::supertype > libMesh::TypeVector< Real >::operator+ ( const TypeVector< T2 > &  p) const
inherited

Add two vectors.

Returns
A copy of the result, this vector is unchanged.

Definition at line 602 of file type_vector.h.

603 {
604  typedef typename CompareTypes<T, T2>::supertype TS;
605 #if LIBMESH_DIM == 1
606  return TypeVector<TS> (_coords[0] + p._coords[0]);
607 #endif
608 
609 #if LIBMESH_DIM == 2
610  return TypeVector<TS> (_coords[0] + p._coords[0],
611  _coords[1] + p._coords[1]);
612 #endif
613 
614 #if LIBMESH_DIM == 3
615  return TypeVector<TS> (_coords[0] + p._coords[0],
616  _coords[1] + p._coords[1],
617  _coords[2] + p._coords[2]);
618 #endif
619 
620 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445

◆ operator+=()

const TypeVector< Real > & libMesh::TypeVector< Real >::operator+= ( const TypeVector< T2 > &  p)
inherited

Add to this vector.

Returns
A reference to *this.

Definition at line 627 of file type_vector.h.

628 {
629  this->add (p);
630 
631  return *this;
632 }
void add(const TypeVector< T2 > &)
Add to this vector without creating a temporary.
Definition: type_vector.h:639

◆ operator-() [1/2]

TypeVector< typename CompareTypes< Real , T2 >::supertype > libMesh::TypeVector< Real >::operator- ( const TypeVector< T2 > &  p) const
inherited

Subtract from this vector.

Returns
A copy of the result, this vector is unchanged.

Definition at line 688 of file type_vector.h.

689 {
690  typedef typename CompareTypes<T, T2>::supertype TS;
691 
692 #if LIBMESH_DIM == 1
693  return TypeVector<TS>(_coords[0] - p._coords[0]);
694 #endif
695 
696 #if LIBMESH_DIM == 2
697  return TypeVector<TS>(_coords[0] - p._coords[0],
698  _coords[1] - p._coords[1]);
699 #endif
700 
701 #if LIBMESH_DIM == 3
702  return TypeVector<TS>(_coords[0] - p._coords[0],
703  _coords[1] - p._coords[1],
704  _coords[2] - p._coords[2]);
705 #endif
706 
707 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445

◆ operator-() [2/2]

TypeVector< Real > libMesh::TypeVector< Real >::operator- ( ) const
inherited
Returns
The negative of this vector in a separate copy.

Definition at line 747 of file type_vector.h.

748 {
749 
750 #if LIBMESH_DIM == 1
751  return TypeVector(-_coords[0]);
752 #endif
753 
754 #if LIBMESH_DIM == 2
755  return TypeVector(-_coords[0],
756  -_coords[1]);
757 #endif
758 
759 #if LIBMESH_DIM == 3
760  return TypeVector(-_coords[0],
761  -_coords[1],
762  -_coords[2]);
763 #endif
764 
765 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445
TypeVector()
Empty constructor.
Definition: type_vector.h:457

◆ operator-=()

const TypeVector< Real > & libMesh::TypeVector< Real >::operator-= ( const TypeVector< T2 > &  p)
inherited

Subtract from this vector.

Returns
A reference to *this.

Definition at line 714 of file type_vector.h.

715 {
716  this->subtract (p);
717 
718  return *this;
719 }
void subtract(const TypeVector< T2 > &)
Subtract from this vector without creating a temporary.
Definition: type_vector.h:726

◆ operator/()

boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeVector< typename CompareTypes< Real , Scalar >::supertype > >::type libMesh::TypeVector< Real >::operator/ ( const Scalar &  factor) const
inherited

Divide each entry of this vector by scalar value.

Returns
A copy of the result, this vector is unchanged.

Definition at line 840 of file type_vector.h.

841 {
842  libmesh_assert_not_equal_to (factor, static_cast<T>(0.));
843 
844  typedef typename CompareTypes<T, Scalar>::supertype TS;
845 
846 #if LIBMESH_DIM == 1
847  return TypeVector<TS>(_coords[0]/factor);
848 #endif
849 
850 #if LIBMESH_DIM == 2
851  return TypeVector<TS>(_coords[0]/factor,
852  _coords[1]/factor);
853 #endif
854 
855 #if LIBMESH_DIM == 3
856  return TypeVector<TS>(_coords[0]/factor,
857  _coords[1]/factor,
858  _coords[2]/factor);
859 #endif
860 
861 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445

◆ operator/=()

const TypeVector< Real > & libMesh::TypeVector< Real >::operator/= ( const Real &  factor)
inherited

Divide each entry of this vector by scalar value.

Returns
A reference to *this.

Definition at line 869 of file type_vector.h.

870 {
871  libmesh_assert_not_equal_to (factor, static_cast<T>(0.));
872 
873  for (unsigned int i=0; i<LIBMESH_DIM; i++)
874  _coords[i] /= factor;
875 
876  return *this;
877 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445

◆ operator<()

bool libMesh::TypeVector< Real >::operator< ( const TypeVector< Real > &  rhs) const
inherited
Returns
true if this vector is "less" than rhs.

Useful for sorting. Also used for choosing some arbitrary basis function orientations.

◆ operator<=()

bool libMesh::TypeVector< Real >::operator<= ( const TypeVector< Real > &  rhs) const
inherited
Returns
true if this vector is <= to rhs.

Useful for sorting. Also used for choosing some arbitrary constraint equation directions.

◆ operator==()

bool libMesh::TypeVector< Real >::operator== ( const TypeVector< Real > &  rhs) const
inherited
Returns
true if this(i)==rhs(i) for each component of the vector.
Note
For floating point types T, the function absolute_fuzzy_equals() may be a more appropriate choice.

Definition at line 1060 of file type_vector.h.

1061 {
1062 #if LIBMESH_DIM == 1
1063  return (_coords[0] == rhs._coords[0]);
1064 #endif
1065 
1066 #if LIBMESH_DIM == 2
1067  return (_coords[0] == rhs._coords[0] &&
1068  _coords[1] == rhs._coords[1]);
1069 #endif
1070 
1071 #if LIBMESH_DIM == 3
1072  return (_coords[0] == rhs._coords[0] &&
1073  _coords[1] == rhs._coords[1] &&
1074  _coords[2] == rhs._coords[2]);
1075 #endif
1076 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445

◆ operator>()

bool libMesh::TypeVector< Real >::operator> ( const TypeVector< Real > &  rhs) const
inherited
Returns
true if this vector is "greater" than rhs.

Useful for sorting. Also used for choosing some arbitrary basis function orientations.

◆ operator>=()

bool libMesh::TypeVector< Real >::operator>= ( const TypeVector< Real > &  rhs) const
inherited
Returns
true if this vector is >= rhs.

Useful for sorting. Also used for choosing some arbitrary constraint equation directions.

◆ print()

void libMesh::TypeVector< Real >::print ( std::ostream &  os = libMesh::out) const
inherited

Formatted print, by default to libMesh::out.

◆ relative_fuzzy_equals()

bool libMesh::TypeVector< Real >::relative_fuzzy_equals ( const TypeVector< Real > &  rhs,
Real  tol = TOLERANCE 
) const
inherited
Returns
true if two vectors are equal to within a relative tolerance of tol.

Definition at line 1035 of file type_vector.h.

References std::abs().

1036 {
1037 #if LIBMESH_DIM == 1
1038  return this->absolute_fuzzy_equals(rhs, tol *
1039  (std::abs(_coords[0]) + std::abs(rhs._coords[0])));
1040 #endif
1041 
1042 #if LIBMESH_DIM == 2
1043  return this->absolute_fuzzy_equals(rhs, tol *
1044  (std::abs(_coords[0]) + std::abs(rhs._coords[0]) +
1045  std::abs(_coords[1]) + std::abs(rhs._coords[1])));
1046 #endif
1047 
1048 #if LIBMESH_DIM == 3
1049  return this->absolute_fuzzy_equals(rhs, tol *
1050  (std::abs(_coords[0]) + std::abs(rhs._coords[0]) +
1051  std::abs(_coords[1]) + std::abs(rhs._coords[1]) +
1052  std::abs(_coords[2]) + std::abs(rhs._coords[2])));
1053 #endif
1054 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445
double abs(double a)
bool absolute_fuzzy_equals(const TypeVector< Real > &rhs, Real tol=TOLERANCE) const
Definition: type_vector.h:1010

◆ size()

auto libMesh::TypeVector< Real >::size ( ) const-> decltype(std::norm(Real ()))
inherited
Returns
The magnitude of the vector, i.e. the square-root of the sum of the elements squared.
Deprecated:
Use the norm() function instead.

Definition at line 937 of file type_vector.h.

References std::norm().

938 {
939  libmesh_deprecated();
940  return this->norm();
941 }
auto norm() const -> decltype(std::norm(Real()))
Definition: type_vector.h:948

◆ size_sq()

auto libMesh::TypeVector< Real >::size_sq ( ) const-> decltype(std::norm(Real ()))
inherited
Returns
The magnitude of the vector squared, i.e. the sum of the element magnitudes squared.
Deprecated:
Use the norm_sq() function instead.

Definition at line 968 of file type_vector.h.

References libMesh::TensorTools::norm_sq().

969 {
970  libmesh_deprecated();
971  return this->norm_sq();
972 }
auto norm_sq() const -> decltype(std::norm(Real()))
Definition: type_vector.h:979

◆ slice() [1/2]

const Real & libMesh::TypeVector< Real >::slice ( const unsigned int  i) const
inherited

Definition at line 174 of file type_vector.h.

174 { return (*this)(i); }

◆ slice() [2/2]

Real & libMesh::TypeVector< Real >::slice ( const unsigned int  i)
inherited

Definition at line 180 of file type_vector.h.

180 { return (*this)(i); }

◆ subtract()

void libMesh::TypeVector< Real >::subtract ( const TypeVector< T2 > &  p)
inherited

Subtract from this vector without creating a temporary.

Definition at line 726 of file type_vector.h.

727 {
728  for (unsigned int i=0; i<LIBMESH_DIM; i++)
729  _coords[i] -= p._coords[i];
730 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445

◆ subtract_scaled()

void libMesh::TypeVector< Real >::subtract_scaled ( const TypeVector< T2 > &  p,
const Real &  factor 
)
inherited

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

Definition at line 737 of file type_vector.h.

738 {
739  for (unsigned int i=0; i<LIBMESH_DIM; i++)
740  _coords[i] -= factor*p(i);
741 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445

◆ unit()

TypeVector< Real > libMesh::TypeVector< Real >::unit ( ) const
inherited
Returns
A unit vector in the direction of *this.

Definition at line 1150 of file type_vector.h.

References std::norm().

1151 {
1152 
1153  auto && length = norm();
1154 
1155  libmesh_assert_not_equal_to (length, static_cast<Real>(0.));
1156 
1157 #if LIBMESH_DIM == 1
1158  return TypeVector<T>(_coords[0]/length);
1159 #endif
1160 
1161 #if LIBMESH_DIM == 2
1162  return TypeVector<T>(_coords[0]/length,
1163  _coords[1]/length);
1164 #endif
1165 
1166 #if LIBMESH_DIM == 3
1167  return TypeVector<T>(_coords[0]/length,
1168  _coords[1]/length,
1169  _coords[2]/length);
1170 #endif
1171 
1172 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445
auto norm() const -> decltype(std::norm(Real()))
Definition: type_vector.h:948

◆ write_unformatted()

void libMesh::TypeVector< Real >::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. Also prints a newline by default, however, this behavior can be controlled with the newline parameter.

◆ zero()

void libMesh::TypeVector< Real >::zero ( )
inherited

Set all entries of the vector to 0.

Definition at line 957 of file type_vector.h.

958 {
959  for (unsigned int i=0; i<LIBMESH_DIM; i++)
960  _coords[i] = 0.;
961 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:445

Friends And Related Function Documentation

◆ Node

friend class Node
friend

Make the derived class a friend.

Definition at line 76 of file point.h.

Member Data Documentation

◆ _coords

Real libMesh::TypeVector< Real >::_coords[LIBMESH_DIM]
protectedinherited

The coordinates of the TypeVector.

Definition at line 445 of file type_vector.h.


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