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)=default
 Trivial copy-constructor. More...
 
 Point (const TypeVector< Real > &p)
 Copy-constructor from non-point Typevector. More...
 
Pointoperator= (const Point &p)=default
 Copy-assignment operator. More...
 
template<typename T , typename = typename boostcopy::enable_if_c<ScalarTraits<T>::value,void>::type>
 Point (const T x)
 Disambiguate constructing from non-Real scalars. More...
 
 ~Point ()=default
 Destructor. 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 norm () 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< Complex > &rhs) const
 
bool operator<= (const TypeVector< Real > &rhs) const
 
bool operator<= (const TypeVector< Complex > &rhs) const
 
bool operator> (const TypeVector< Real > &rhs) const
 
bool operator> (const TypeVector< Complex > &rhs) const
 
bool operator>= (const TypeVector< Real > &rhs) const
 
bool operator>= (const TypeVector< Complex > &rhs) const
 
void print (std::ostream &os=libMesh::out) const
 Formatted print, by default to libMesh::out. More...
 
void write_unformatted (std::ostream &out_stream, 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 39 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 149 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 144 of file type_vector.h.

Constructor & Destructor Documentation

◆ Point() [1/4]

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

Constructor.

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

Definition at line 47 of file point.h.

49  :
50  TypeVector<Real> (x,y,z)
51  {}
template class LIBMESH_EXPORT TypeVector< Real >
Definition: type_vector.C:227

◆ Point() [2/4]

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

Trivial copy-constructor.

◆ Point() [3/4]

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

Copy-constructor from non-point Typevector.

Definition at line 61 of file point.h.

61  :
63  {}
template class LIBMESH_EXPORT TypeVector< Real >
Definition: type_vector.C:227

◆ Point() [4/4]

template<typename T , typename = typename boostcopy::enable_if_c<ScalarTraits<T>::value,void>::type>
libMesh::Point::Point ( const T  x)
inline

Disambiguate constructing from non-Real scalars.

Definition at line 76 of file point.h.

76  :
77  TypeVector<Real> (x,0,0)
78  {}
template class LIBMESH_EXPORT TypeVector< Real >
Definition: type_vector.C:227

◆ ~Point()

libMesh::Point::~Point ( )
default

Destructor.

Member Function Documentation

◆ absolute_fuzzy_equals()

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

Definition at line 979 of file type_vector.h.

References std::abs().

980 {
981 #if LIBMESH_DIM == 1
982  return (std::abs(_coords[0] - rhs._coords[0])
983  <= tol);
984 #endif
985 
986 #if LIBMESH_DIM == 2
987  return (std::abs(_coords[0] - rhs._coords[0]) +
988  std::abs(_coords[1] - rhs._coords[1])
989  <= tol);
990 #endif
991 
992 #if LIBMESH_DIM == 3
993  return (std::abs(_coords[0] - rhs._coords[0]) +
994  std::abs(_coords[1] - rhs._coords[1]) +
995  std::abs(_coords[2] - rhs._coords[2])
996  <= tol);
997 #endif
998 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
Definition: type_vector.h:57

◆ add()

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

Add to this vector without creating a temporary.

Definition at line 627 of file type_vector.h.

628 {
629 #if LIBMESH_DIM == 1
630  _coords[0] += p._coords[0];
631 #endif
632 
633 #if LIBMESH_DIM == 2
634  _coords[0] += p._coords[0];
635  _coords[1] += p._coords[1];
636 #endif
637 
638 #if LIBMESH_DIM == 3
639  _coords[0] += p._coords[0];
640  _coords[1] += p._coords[1];
641  _coords[2] += p._coords[2];
642 #endif
643 
644 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439

◆ add_scaled()

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

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

Definition at line 651 of file type_vector.h.

652 {
653 #if LIBMESH_DIM == 1
654  _coords[0] += factor*p(0);
655 #endif
656 
657 #if LIBMESH_DIM == 2
658  _coords[0] += factor*p(0);
659  _coords[1] += factor*p(1);
660 #endif
661 
662 #if LIBMESH_DIM == 3
663  _coords[0] += factor*p(0);
664  _coords[1] += factor*p(1);
665  _coords[2] += factor*p(2);
666 #endif
667 
668 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439

◆ assign()

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

Assign to this vector without creating a temporary.

Definition at line 556 of file type_vector.h.

557 {
558  for (unsigned int i=0; i<LIBMESH_DIM; i++)
559  _coords[i] = p._coords[i];
560 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439

◆ contract()

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

Definition at line 896 of file type_vector.h.

897 {
898  return (*this)*(p);
899 }

◆ 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 906 of file type_vector.h.

References libMesh::libmesh_ignore().

907 {
908  typedef typename CompareTypes<T, T2>::supertype TS;
909  libmesh_assert_equal_to (LIBMESH_DIM, 3);
910 
911  // | i j k |
912  // |(*this)(0) (*this)(1) (*this)(2)|
913  // | p(0) p(1) p(2) |
914 
915 #if LIBMESH_DIM == 3
916  return TypeVector<TS>( _coords[1]*p._coords[2] - _coords[2]*p._coords[1],
917  -_coords[0]*p._coords[2] + _coords[2]*p._coords[0],
918  _coords[0]*p._coords[1] - _coords[1]*p._coords[0]);
919 #else
920  libmesh_ignore(p);
921  return TypeVector<TS>(0);
922 #endif
923 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439
void libmesh_ignore(const Args &...)

◆ is_zero()

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

Definition at line 969 of file type_vector.h.

970 {
971  for (const auto & val : _coords)
972  if (val != T(0))
973  return false;
974  return true;
975 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439

◆ norm()

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

Definition at line 929 of file type_vector.h.

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

930 {
931  return std::sqrt(this->norm_sq());
932 }
ADRealEigenVector< T, D, asd > sqrt(const ADRealEigenVector< T, D, asd > &)
Definition: type_vector.h:53
auto norm_sq() const -> decltype(std::norm(Real()))
Definition: type_vector.h:948

◆ norm_sq()

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

Definition at line 948 of file type_vector.h.

References libMesh::TensorTools::norm_sq().

949 {
950 #if LIBMESH_DIM == 1
951  return (TensorTools::norm_sq(_coords[0]));
952 #endif
953 
954 #if LIBMESH_DIM == 2
955  return (TensorTools::norm_sq(_coords[0]) +
957 #endif
958 
959 #if LIBMESH_DIM == 3
960  return (TensorTools::norm_sq(_coords[0]) +
963 #endif
964 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439
auto norm_sq(const T &a) -> decltype(std::norm(a))
Definition: tensor_tools.h:104

◆ operator!=()

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

Definition at line 1051 of file type_vector.h.

1052 {
1053  return (!(*this == rhs));
1054 }

◆ operator()() [1/2]

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

Definition at line 566 of file type_vector.h.

567 {
568  libmesh_assert_less (i, LIBMESH_DIM);
569 
570  return _coords[i];
571 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439

◆ operator()() [2/2]

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

Definition at line 577 of file type_vector.h.

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

◆ 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
inlineinherited

Multiply this vector by a scalar value.

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

Definition at line 763 of file type_vector.h.

764 {
765  typedef typename CompareTypes<T, Scalar>::supertype SuperType;
766 
767 #if LIBMESH_DIM == 1
768  return TypeVector<SuperType>(_coords[0]*factor);
769 #endif
770 
771 #if LIBMESH_DIM == 2
772  return TypeVector<SuperType>(_coords[0]*factor,
773  _coords[1]*factor);
774 #endif
775 
776 #if LIBMESH_DIM == 3
777  return TypeVector<SuperType>(_coords[0]*factor,
778  _coords[1]*factor,
779  _coords[2]*factor);
780 #endif
781 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439

◆ operator*() [2/2]

CompareTypes< Real , T2 >::supertype libMesh::TypeVector< Real >::operator* ( const TypeVector< T2 > &  p) const
inlineinherited
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 874 of file type_vector.h.

875 {
876 #if LIBMESH_DIM == 1
877  return _coords[0]*p._coords[0];
878 #endif
879 
880 #if LIBMESH_DIM == 2
881  return (_coords[0]*p._coords[0] +
882  _coords[1]*p._coords[1]);
883 #endif
884 
885 #if LIBMESH_DIM == 3
886  return (_coords[0]*p(0) +
887  _coords[1]*p(1) +
888  _coords[2]*p(2));
889 #endif
890 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439

◆ operator*=()

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

Multiply this vector by a scalar value.

Returns
A reference to *this.

Definition at line 800 of file type_vector.h.

801 {
802 #if LIBMESH_DIM == 1
803  _coords[0] *= factor;
804 #endif
805 
806 #if LIBMESH_DIM == 2
807  _coords[0] *= factor;
808  _coords[1] *= factor;
809 #endif
810 
811 #if LIBMESH_DIM == 3
812  _coords[0] *= factor;
813  _coords[1] *= factor;
814  _coords[2] *= factor;
815 #endif
816 
817  return *this;
818 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439

◆ operator+()

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

Add two vectors.

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

Definition at line 590 of file type_vector.h.

591 {
592  typedef typename CompareTypes<T, T2>::supertype TS;
593 #if LIBMESH_DIM == 1
594  return TypeVector<TS> (_coords[0] + p._coords[0]);
595 #endif
596 
597 #if LIBMESH_DIM == 2
598  return TypeVector<TS> (_coords[0] + p._coords[0],
599  _coords[1] + p._coords[1]);
600 #endif
601 
602 #if LIBMESH_DIM == 3
603  return TypeVector<TS> (_coords[0] + p._coords[0],
604  _coords[1] + p._coords[1],
605  _coords[2] + p._coords[2]);
606 #endif
607 
608 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439

◆ operator+=()

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

Add to this vector.

Returns
A reference to *this.

Definition at line 615 of file type_vector.h.

616 {
617  this->add (p);
618 
619  return *this;
620 }
void add(const TypeVector< T2 > &)
Add to this vector without creating a temporary.
Definition: type_vector.h:627

◆ operator-() [1/2]

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

Subtract from this vector.

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

Definition at line 676 of file type_vector.h.

677 {
678  typedef typename CompareTypes<T, T2>::supertype TS;
679 
680 #if LIBMESH_DIM == 1
681  return TypeVector<TS>(_coords[0] - p._coords[0]);
682 #endif
683 
684 #if LIBMESH_DIM == 2
685  return TypeVector<TS>(_coords[0] - p._coords[0],
686  _coords[1] - p._coords[1]);
687 #endif
688 
689 #if LIBMESH_DIM == 3
690  return TypeVector<TS>(_coords[0] - p._coords[0],
691  _coords[1] - p._coords[1],
692  _coords[2] - p._coords[2]);
693 #endif
694 
695 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439

◆ operator-() [2/2]

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

Definition at line 735 of file type_vector.h.

736 {
737 
738 #if LIBMESH_DIM == 1
739  return TypeVector(-_coords[0]);
740 #endif
741 
742 #if LIBMESH_DIM == 2
743  return TypeVector(-_coords[0],
744  -_coords[1]);
745 #endif
746 
747 #if LIBMESH_DIM == 3
748  return TypeVector(-_coords[0],
749  -_coords[1],
750  -_coords[2]);
751 #endif
752 
753 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439
TypeVector()
Empty constructor.
Definition: type_vector.h:451

◆ operator-=()

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

Subtract from this vector.

Returns
A reference to *this.

Definition at line 702 of file type_vector.h.

703 {
704  this->subtract (p);
705 
706  return *this;
707 }
void subtract(const TypeVector< T2 > &)
Subtract from this vector without creating a temporary.
Definition: type_vector.h:714

◆ operator/()

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

Divide each entry of this vector by scalar value.

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

Definition at line 828 of file type_vector.h.

829 {
830  libmesh_assert_not_equal_to (factor, static_cast<T>(0.));
831 
832  typedef typename CompareTypes<T, Scalar>::supertype TS;
833 
834 #if LIBMESH_DIM == 1
835  return TypeVector<TS>(_coords[0]/factor);
836 #endif
837 
838 #if LIBMESH_DIM == 2
839  return TypeVector<TS>(_coords[0]/factor,
840  _coords[1]/factor);
841 #endif
842 
843 #if LIBMESH_DIM == 3
844  return TypeVector<TS>(_coords[0]/factor,
845  _coords[1]/factor,
846  _coords[2]/factor);
847 #endif
848 
849 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439

◆ operator/=()

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

Divide each entry of this vector by scalar value.

Returns
A reference to *this.

Definition at line 857 of file type_vector.h.

858 {
859  libmesh_assert_not_equal_to (factor, static_cast<T>(0.));
860 
861  for (unsigned int i=0; i<LIBMESH_DIM; i++)
862  _coords[i] /= factor;
863 
864  return *this;
865 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439

◆ operator<() [1/2]

bool libMesh::TypeVector< Complex >::operator< ( const TypeVector< Complex > &  rhs) const
inherited

Definition at line 148 of file type_vector.C.

References std::imag(), and std::real().

149 {
150  for (unsigned int i=0; i<LIBMESH_DIM; i++)
151  {
152  if ((*this)(i).real() < rhs(i).real())
153  return true;
154  if ((*this)(i).real() > rhs(i).real())
155  return false;
156  if ((*this)(i).imag() < rhs(i).imag())
157  return true;
158  if ((*this)(i).imag() > rhs(i).imag())
159  return false;
160  }
161  return false;
162 }
boost::multiprecision::float128 real(const boost::multiprecision::float128 in)
boost::multiprecision::float128 imag(const boost::multiprecision::float128)

◆ operator<() [2/2]

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.

Definition at line 90 of file type_vector.C.

91 {
92  for (unsigned int i=0; i<LIBMESH_DIM; i++)
93  {
94  if ((*this)(i) < rhs(i))
95  return true;
96  if ((*this)(i) > rhs(i))
97  return false;
98  }
99  return false;
100 }

◆ operator<=() [1/2]

bool libMesh::TypeVector< Complex >::operator<= ( const TypeVector< Complex > &  rhs) const
inherited

Definition at line 167 of file type_vector.C.

References std::imag(), and std::real().

168 {
169  for (unsigned int i=0; i<LIBMESH_DIM; i++)
170  {
171  if ((*this)(i).real() < rhs(i).real())
172  return true;
173  if ((*this)(i).real() > rhs(i).real())
174  return false;
175  if ((*this)(i).imag() < rhs(i).imag())
176  return true;
177  if ((*this)(i).imag() > rhs(i).imag())
178  return false;
179  }
180  return true;
181 }
boost::multiprecision::float128 real(const boost::multiprecision::float128 in)
boost::multiprecision::float128 imag(const boost::multiprecision::float128)

◆ operator<=() [2/2]

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.

Definition at line 104 of file type_vector.C.

105 {
106  for (unsigned int i=0; i<LIBMESH_DIM; i++)
107  {
108  if ((*this)(i) < rhs(i))
109  return true;
110  if ((*this)(i) > rhs(i))
111  return false;
112  }
113  return true;
114 }

◆ operator=()

Point& libMesh::Point::operator= ( const Point p)
default

Copy-assignment operator.

◆ operator==()

bool libMesh::TypeVector< Real >::operator== ( const TypeVector< Real > &  rhs) const
inlineinherited
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 1029 of file type_vector.h.

Referenced by libMesh::Node::operator==().

1030 {
1031 #if LIBMESH_DIM == 1
1032  return (_coords[0] == rhs._coords[0]);
1033 #endif
1034 
1035 #if LIBMESH_DIM == 2
1036  return (_coords[0] == rhs._coords[0] &&
1037  _coords[1] == rhs._coords[1]);
1038 #endif
1039 
1040 #if LIBMESH_DIM == 3
1041  return (_coords[0] == rhs._coords[0] &&
1042  _coords[1] == rhs._coords[1] &&
1043  _coords[2] == rhs._coords[2]);
1044 #endif
1045 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439

◆ operator>() [1/2]

bool libMesh::TypeVector< Complex >::operator> ( const TypeVector< Complex > &  rhs) const
inherited

Definition at line 186 of file type_vector.C.

References std::imag(), and std::real().

187 {
188  for (unsigned int i=0; i<LIBMESH_DIM; i++)
189  {
190  if ((*this)(i).real() > rhs(i).real())
191  return true;
192  if ((*this)(i).real() < rhs(i).real())
193  return false;
194  if ((*this)(i).imag() > rhs(i).imag())
195  return true;
196  if ((*this)(i).imag() < rhs(i).imag())
197  return false;
198  }
199  return false;
200 }
boost::multiprecision::float128 real(const boost::multiprecision::float128 in)
boost::multiprecision::float128 imag(const boost::multiprecision::float128)

◆ operator>() [2/2]

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.

Definition at line 119 of file type_vector.C.

120 {
121  for (unsigned int i=0; i<LIBMESH_DIM; i++)
122  {
123  if ((*this)(i) > rhs(i))
124  return true;
125  if ((*this)(i) < rhs(i))
126  return false;
127  }
128  return false;
129 }

◆ operator>=() [1/2]

bool libMesh::TypeVector< Complex >::operator>= ( const TypeVector< Complex > &  rhs) const
inherited

Definition at line 205 of file type_vector.C.

References std::imag(), and std::real().

206 {
207  for (unsigned int i=0; i<LIBMESH_DIM; i++)
208  {
209  if ((*this)(i).real() > rhs(i).real())
210  return true;
211  if ((*this)(i).real() < rhs(i).real())
212  return false;
213  if ((*this)(i).imag() > rhs(i).imag())
214  return true;
215  if ((*this)(i).imag() < rhs(i).imag())
216  return false;
217  }
218  return true;
219 }
boost::multiprecision::float128 real(const boost::multiprecision::float128 in)
boost::multiprecision::float128 imag(const boost::multiprecision::float128)

◆ operator>=() [2/2]

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.

Definition at line 133 of file type_vector.C.

134 {
135  for (unsigned int i=0; i<LIBMESH_DIM; i++)
136  {
137  if ((*this)(i) > rhs(i))
138  return true;
139  if ((*this)(i) < rhs(i))
140  return false;
141  }
142  return true;
143 }

◆ print()

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

Formatted print, by default to libMesh::out.

Definition at line 47 of file type_vector.C.

48 {
49 #if LIBMESH_DIM == 1
50 
51  os << "x=" << (*this)(0);
52 
53 #endif
54 #if LIBMESH_DIM == 2
55 
56  os << "(x,y)=("
57  << std::setw(8) << (*this)(0) << ", "
58  << std::setw(8) << (*this)(1) << ")";
59 
60 #endif
61 #if LIBMESH_DIM == 3
62 
63  os << "(x,y,z)=("
64  << std::setw(8) << (*this)(0) << ", "
65  << std::setw(8) << (*this)(1) << ", "
66  << std::setw(8) << (*this)(2) << ")";
67 #endif
68 }

◆ relative_fuzzy_equals()

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

Definition at line 1004 of file type_vector.h.

References std::abs().

1005 {
1006 #if LIBMESH_DIM == 1
1007  return this->absolute_fuzzy_equals(rhs, tol *
1008  (std::abs(_coords[0]) + std::abs(rhs._coords[0])));
1009 #endif
1010 
1011 #if LIBMESH_DIM == 2
1012  return this->absolute_fuzzy_equals(rhs, tol *
1013  (std::abs(_coords[0]) + std::abs(rhs._coords[0]) +
1014  std::abs(_coords[1]) + std::abs(rhs._coords[1])));
1015 #endif
1016 
1017 #if LIBMESH_DIM == 3
1018  return this->absolute_fuzzy_equals(rhs, tol *
1019  (std::abs(_coords[0]) + std::abs(rhs._coords[0]) +
1020  std::abs(_coords[1]) + std::abs(rhs._coords[1]) +
1021  std::abs(_coords[2]) + std::abs(rhs._coords[2])));
1022 #endif
1023 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
Definition: type_vector.h:57
bool absolute_fuzzy_equals(const TypeVector< Real > &rhs, Real tol=TOLERANCE) const
Definition: type_vector.h:979

◆ slice() [1/2]

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

Definition at line 187 of file type_vector.h.

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

◆ slice() [2/2]

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

Definition at line 193 of file type_vector.h.

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

◆ subtract()

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

Subtract from this vector without creating a temporary.

Definition at line 714 of file type_vector.h.

715 {
716  for (unsigned int i=0; i<LIBMESH_DIM; i++)
717  _coords[i] -= p._coords[i];
718 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439

◆ subtract_scaled()

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

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

Definition at line 725 of file type_vector.h.

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

◆ unit()

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

Definition at line 1120 of file type_vector.h.

References std::norm().

1121 {
1122 
1123  auto && length = norm();
1124 
1125  libmesh_assert_not_equal_to (length, static_cast<Real>(0.));
1126 
1127 #if LIBMESH_DIM == 1
1128  return TypeVector<T>(_coords[0]/length);
1129 #endif
1130 
1131 #if LIBMESH_DIM == 2
1132  return TypeVector<T>(_coords[0]/length,
1133  _coords[1]/length);
1134 #endif
1135 
1136 #if LIBMESH_DIM == 3
1137  return TypeVector<T>(_coords[0]/length,
1138  _coords[1]/length,
1139  _coords[2]/length);
1140 #endif
1141 
1142 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439
auto norm() const -> decltype(std::norm(Real()))
Definition: type_vector.h:929

◆ write_unformatted()

void libMesh::TypeVector< Real >::write_unformatted ( std::ostream &  out_stream,
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.

Definition at line 75 of file type_vector.C.

77 {
78  os << std::setiosflags(std::ios::showpoint)
79  << (*this)(0) << " "
80  << (*this)(1) << " "
81  << (*this)(2) << " ";
82 
83  if (newline)
84  os << '\n';
85 }

◆ zero()

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

Set all entries of the vector to 0.

Definition at line 938 of file type_vector.h.

939 {
940  for (unsigned int i=0; i<LIBMESH_DIM; i++)
941  _coords[i] = 0.;
942 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:439

Friends And Related Function Documentation

◆ Node

friend class Node
friend

Make the derived class a friend.

Definition at line 90 of file point.h.

Member Data Documentation

◆ _coords

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

The coordinates of the TypeVector.

Definition at line 439 of file type_vector.h.


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