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 std::enable_if<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...
 
std::enable_if< 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...
 
std::enable_if< 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
 
auto norm_sq () const
 
auto l1_norm () const
 
auto l1_norm () const
 
auto l1_norm () const
 
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 122 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 117 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:216

◆ 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:216

◆ Point() [4/4]

template<typename T , typename = typename std::enable_if<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:216

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

References libMesh::absolute_fuzzy_equals().

976 {
977  return libMesh::absolute_fuzzy_equals(*this, rhs, tol);
978 }
bool absolute_fuzzy_equals(const T &var1, const T2 &var2, const Real tol=TOLERANCE *TOLERANCE)
Function to check whether two variables are equal within an absolute tolerance.
Definition: fuzzy_equals.h:64

◆ add()

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

Add to this vector without creating a temporary.

Definition at line 605 of file type_vector.h.

606 {
607 #if LIBMESH_DIM == 1
608  _coords[0] += p._coords[0];
609 #endif
610 
611 #if LIBMESH_DIM == 2
612  _coords[0] += p._coords[0];
613  _coords[1] += p._coords[1];
614 #endif
615 
616 #if LIBMESH_DIM == 3
617  _coords[0] += p._coords[0];
618  _coords[1] += p._coords[1];
619  _coords[2] += p._coords[2];
620 #endif
621 
622 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417

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

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

◆ assign()

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

Assign to this vector without creating a temporary.

Definition at line 534 of file type_vector.h.

535 {
536  for (unsigned int i=0; i<LIBMESH_DIM; i++)
537  _coords[i] = p._coords[i];
538 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417

◆ contract()

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

Definition at line 875 of file type_vector.h.

876 {
877  return (*this)*(p);
878 }

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

References libMesh::libmesh_ignore().

886 {
887  typedef typename CompareTypes<T, T2>::supertype TS;
888  libmesh_assert_equal_to (LIBMESH_DIM, 3);
889 
890  // | i j k |
891  // |(*this)(0) (*this)(1) (*this)(2)|
892  // | p(0) p(1) p(2) |
893 
894 #if LIBMESH_DIM == 3
895  return TypeVector<TS>( _coords[1]*p._coords[2] - _coords[2]*p._coords[1],
896  -_coords[0]*p._coords[2] + _coords[2]*p._coords[0],
897  _coords[0]*p._coords[1] - _coords[1]*p._coords[0]);
898 #else
899  libmesh_ignore(p);
900  return TypeVector<TS>(0);
901 #endif
902 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417
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 949 of file type_vector.h.

950 {
951  for (const auto & val : _coords)
952  if (val != T(0))
953  return false;
954  return true;
955 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417

◆ l1_norm() [1/3]

auto libMesh::TypeVector< bool >::l1_norm ( ) const
inherited

Definition at line 203 of file type_vector.C.

References libMesh::libmesh_dim, and libMesh::make_range().

204 {
205  bool ret{};
206  for (const auto i : make_range(libmesh_dim))
207  ret += _coords[i];
208 
209  return ret;
210 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417
static constexpr std::size_t libmesh_dim
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176

◆ l1_norm() [2/3]

auto libMesh::TypeVector< Real >::l1_norm ( ) const
inherited
Returns
The L1 norm of the vector

Definition at line 963 of file type_vector.h.

References libMesh::libmesh_dim, and libMesh::make_range().

964 {
965  using std::abs;
966  decltype(abs(T())) ret{};
967  for (const auto i : make_range(libmesh_dim))
968  ret += abs(_coords[i]);
969 
970  return ret;
971 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417
static constexpr std::size_t libmesh_dim
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:176

◆ l1_norm() [3/3]

auto libMesh::TypeVector< bool >::l1_norm ( ) const
inherited

◆ norm()

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

Definition at line 908 of file type_vector.h.

References libMesh::TensorTools::norm_sq().

909 {
910  using std::sqrt;
911  return sqrt(this->norm_sq());
912 }

◆ norm_sq()

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

Definition at line 928 of file type_vector.h.

References libMesh::TensorTools::norm_sq().

929 {
930 #if LIBMESH_DIM == 1
931  return (TensorTools::norm_sq(_coords[0]));
932 #endif
933 
934 #if LIBMESH_DIM == 2
935  return (TensorTools::norm_sq(_coords[0]) +
937 #endif
938 
939 #if LIBMESH_DIM == 3
940  return (TensorTools::norm_sq(_coords[0]) +
943 #endif
944 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417
auto norm_sq(const T &a)
Definition: tensor_tools.h:104

◆ operator!=()

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

Definition at line 1015 of file type_vector.h.

1016 {
1017  return (!(*this == rhs));
1018 }

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

545 {
546  libmesh_assert_less (i, LIBMESH_DIM);
547 
548  return _coords[i];
549 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417

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

556 {
557  libmesh_assert_less (i, LIBMESH_DIM);
558 
559  return _coords[i];
560 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417

◆ operator*() [1/2]

std::enable_if< 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 741 of file type_vector.h.

742 {
743  typedef typename CompareTypes<T, Scalar>::supertype SuperType;
744 
745 #if LIBMESH_DIM == 1
746  return TypeVector<SuperType>(_coords[0]*factor);
747 #endif
748 
749 #if LIBMESH_DIM == 2
750  return TypeVector<SuperType>(_coords[0]*factor,
751  _coords[1]*factor);
752 #endif
753 
754 #if LIBMESH_DIM == 3
755  return TypeVector<SuperType>(_coords[0]*factor,
756  _coords[1]*factor,
757  _coords[2]*factor);
758 #endif
759 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417

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

854 {
855 #if LIBMESH_DIM == 1
856  return _coords[0]*p._coords[0];
857 #endif
858 
859 #if LIBMESH_DIM == 2
860  return (_coords[0]*p._coords[0] +
861  _coords[1]*p._coords[1]);
862 #endif
863 
864 #if LIBMESH_DIM == 3
865  return (_coords[0]*p(0) +
866  _coords[1]*p(1) +
867  _coords[2]*p(2));
868 #endif
869 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417

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

779 {
780 #if LIBMESH_DIM == 1
781  _coords[0] *= factor;
782 #endif
783 
784 #if LIBMESH_DIM == 2
785  _coords[0] *= factor;
786  _coords[1] *= factor;
787 #endif
788 
789 #if LIBMESH_DIM == 3
790  _coords[0] *= factor;
791  _coords[1] *= factor;
792  _coords[2] *= factor;
793 #endif
794 
795  return *this;
796 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417

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

569 {
570  typedef typename CompareTypes<T, T2>::supertype TS;
571 #if LIBMESH_DIM == 1
572  return TypeVector<TS> (_coords[0] + p._coords[0]);
573 #endif
574 
575 #if LIBMESH_DIM == 2
576  return TypeVector<TS> (_coords[0] + p._coords[0],
577  _coords[1] + p._coords[1]);
578 #endif
579 
580 #if LIBMESH_DIM == 3
581  return TypeVector<TS> (_coords[0] + p._coords[0],
582  _coords[1] + p._coords[1],
583  _coords[2] + p._coords[2]);
584 #endif
585 
586 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417

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

594 {
595  this->add (p);
596 
597  return *this;
598 }
void add(const TypeVector< T2 > &)
Add to this vector without creating a temporary.
Definition: type_vector.h:605

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

655 {
656  typedef typename CompareTypes<T, T2>::supertype TS;
657 
658 #if LIBMESH_DIM == 1
659  return TypeVector<TS>(_coords[0] - p._coords[0]);
660 #endif
661 
662 #if LIBMESH_DIM == 2
663  return TypeVector<TS>(_coords[0] - p._coords[0],
664  _coords[1] - p._coords[1]);
665 #endif
666 
667 #if LIBMESH_DIM == 3
668  return TypeVector<TS>(_coords[0] - p._coords[0],
669  _coords[1] - p._coords[1],
670  _coords[2] - p._coords[2]);
671 #endif
672 
673 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417

◆ operator-() [2/2]

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

Definition at line 713 of file type_vector.h.

714 {
715 
716 #if LIBMESH_DIM == 1
717  return TypeVector(-_coords[0]);
718 #endif
719 
720 #if LIBMESH_DIM == 2
721  return TypeVector(-_coords[0],
722  -_coords[1]);
723 #endif
724 
725 #if LIBMESH_DIM == 3
726  return TypeVector(-_coords[0],
727  -_coords[1],
728  -_coords[2]);
729 #endif
730 
731 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417
TypeVector()
Empty constructor.
Definition: type_vector.h:429

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

681 {
682  this->subtract (p);
683 
684  return *this;
685 }
void subtract(const TypeVector< T2 > &)
Subtract from this vector without creating a temporary.
Definition: type_vector.h:692

◆ operator/()

std::enable_if< 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 806 of file type_vector.h.

807 {
808  typedef typename CompareTypes<T, Scalar>::supertype TS;
809 
810  libmesh_assert_not_equal_to (static_cast<TS>(factor),
811  static_cast<TS>(0.));
812 
813 #if LIBMESH_DIM == 1
814  return TypeVector<TS>(_coords[0]/factor);
815 #endif
816 
817 #if LIBMESH_DIM == 2
818  return TypeVector<TS>(_coords[0]/factor,
819  _coords[1]/factor);
820 #endif
821 
822 #if LIBMESH_DIM == 3
823  return TypeVector<TS>(_coords[0]/factor,
824  _coords[1]/factor,
825  _coords[2]/factor);
826 #endif
827 
828 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417

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

837 {
838  libmesh_assert_not_equal_to (factor, static_cast<T>(0.));
839 
840  for (unsigned int i=0; i<LIBMESH_DIM; i++)
841  _coords[i] /= factor;
842 
843  return *this;
844 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417

◆ operator<() [1/2]

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

Definition at line 124 of file type_vector.C.

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

125 {
126  for (unsigned int i=0; i<LIBMESH_DIM; i++)
127  {
128  if ((*this)(i).real() < rhs(i).real())
129  return true;
130  if ((*this)(i).real() > rhs(i).real())
131  return false;
132  if ((*this)(i).imag() < rhs(i).imag())
133  return true;
134  if ((*this)(i).imag() > rhs(i).imag())
135  return false;
136  }
137  return false;
138 }
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 66 of file type_vector.C.

67 {
68  for (unsigned int i=0; i<LIBMESH_DIM; i++)
69  {
70  if ((*this)(i) < rhs(i))
71  return true;
72  if ((*this)(i) > rhs(i))
73  return false;
74  }
75  return false;
76 }

◆ operator<=() [1/2]

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

Definition at line 143 of file type_vector.C.

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

144 {
145  for (unsigned int i=0; i<LIBMESH_DIM; i++)
146  {
147  if ((*this)(i).real() < rhs(i).real())
148  return true;
149  if ((*this)(i).real() > rhs(i).real())
150  return false;
151  if ((*this)(i).imag() < rhs(i).imag())
152  return true;
153  if ((*this)(i).imag() > rhs(i).imag())
154  return false;
155  }
156  return true;
157 }
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 80 of file type_vector.C.

81 {
82  for (unsigned int i=0; i<LIBMESH_DIM; i++)
83  {
84  if ((*this)(i) < rhs(i))
85  return true;
86  if ((*this)(i) > rhs(i))
87  return false;
88  }
89  return true;
90 }

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

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

994 {
995 #if LIBMESH_DIM == 1
996  return (_coords[0] == rhs._coords[0]);
997 #endif
998 
999 #if LIBMESH_DIM == 2
1000  return (_coords[0] == rhs._coords[0] &&
1001  _coords[1] == rhs._coords[1]);
1002 #endif
1003 
1004 #if LIBMESH_DIM == 3
1005  return (_coords[0] == rhs._coords[0] &&
1006  _coords[1] == rhs._coords[1] &&
1007  _coords[2] == rhs._coords[2]);
1008 #endif
1009 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417

◆ operator>() [1/2]

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

Definition at line 162 of file type_vector.C.

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

163 {
164  for (unsigned int i=0; i<LIBMESH_DIM; i++)
165  {
166  if ((*this)(i).real() > rhs(i).real())
167  return true;
168  if ((*this)(i).real() < rhs(i).real())
169  return false;
170  if ((*this)(i).imag() > rhs(i).imag())
171  return true;
172  if ((*this)(i).imag() < rhs(i).imag())
173  return false;
174  }
175  return false;
176 }
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 95 of file type_vector.C.

96 {
97  for (unsigned int i=0; i<LIBMESH_DIM; i++)
98  {
99  if ((*this)(i) > rhs(i))
100  return true;
101  if ((*this)(i) < rhs(i))
102  return false;
103  }
104  return false;
105 }

◆ operator>=() [1/2]

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

Definition at line 181 of file type_vector.C.

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

182 {
183  for (unsigned int i=0; i<LIBMESH_DIM; i++)
184  {
185  if ((*this)(i).real() > rhs(i).real())
186  return true;
187  if ((*this)(i).real() < rhs(i).real())
188  return false;
189  if ((*this)(i).imag() > rhs(i).imag())
190  return true;
191  if ((*this)(i).imag() < rhs(i).imag())
192  return false;
193  }
194  return true;
195 }
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 109 of file type_vector.C.

110 {
111  for (unsigned int i=0; i<LIBMESH_DIM; i++)
112  {
113  if ((*this)(i) > rhs(i))
114  return true;
115  if ((*this)(i) < rhs(i))
116  return false;
117  }
118  return true;
119 }

◆ print()

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

Formatted print, by default to libMesh::out.

Definition at line 1166 of file type_vector.h.

1167 {
1168 #if LIBMESH_DIM == 1
1169 
1170  os << "x=" << (*this)(0);
1171 
1172 #endif
1173 #if LIBMESH_DIM == 2
1174 
1175  os << "(x,y)=("
1176  << std::setw(8) << (*this)(0) << ", "
1177  << std::setw(8) << (*this)(1) << ")";
1178 
1179 #endif
1180 #if LIBMESH_DIM == 3
1181 
1182  os << "(x,y,z)=("
1183  << std::setw(8) << (*this)(0) << ", "
1184  << std::setw(8) << (*this)(1) << ", "
1185  << std::setw(8) << (*this)(2) << ")";
1186 #endif
1187 }

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

References libMesh::relative_fuzzy_equals().

985 {
986  return libMesh::relative_fuzzy_equals(*this, rhs, tol);
987 }
bool relative_fuzzy_equals(const T &var1, const T2 &var2, const Real tol=TOLERANCE *TOLERANCE)
Function to check whether two variables are equal within a relative tolerance.
Definition: fuzzy_equals.h:78

◆ slice() [1/2]

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

Definition at line 160 of file type_vector.h.

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

◆ slice() [2/2]

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

Definition at line 166 of file type_vector.h.

166 { 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 692 of file type_vector.h.

693 {
694  for (unsigned int i=0; i<LIBMESH_DIM; i++)
695  _coords[i] -= p._coords[i];
696 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417

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

704 {
705  for (unsigned int i=0; i<LIBMESH_DIM; i++)
706  _coords[i] -= factor*p(i);
707 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417

◆ unit()

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

Definition at line 1141 of file type_vector.h.

References std::norm().

1142 {
1143 
1144  auto && length = norm();
1145 
1146  libmesh_assert_not_equal_to (length, static_cast<Real>(0.));
1147 
1148 #if LIBMESH_DIM == 1
1149  return TypeVector<T>(_coords[0]/length);
1150 #endif
1151 
1152 #if LIBMESH_DIM == 2
1153  return TypeVector<T>(_coords[0]/length,
1154  _coords[1]/length);
1155 #endif
1156 
1157 #if LIBMESH_DIM == 3
1158  return TypeVector<T>(_coords[0]/length,
1159  _coords[1]/length,
1160  _coords[2]/length);
1161 #endif
1162 
1163 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417

◆ 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 51 of file type_vector.C.

53 {
54  os << std::setiosflags(std::ios::showpoint)
55  << (*this)(0) << " "
56  << (*this)(1) << " "
57  << (*this)(2) << " ";
58 
59  if (newline)
60  os << '\n';
61 }

◆ zero()

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

Set all entries of the vector to 0.

Definition at line 918 of file type_vector.h.

919 {
920  for (unsigned int i=0; i<LIBMESH_DIM; i++)
921  _coords[i] = 0.;
922 }
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.
Definition: type_vector.h:417

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


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