libMesh
Loading...
Searching...
No Matches
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.
 
typedef unsigned int index_type
 Helper typedef for generic index programming.
 

Public Member Functions

LIBMESH_DEVICE_INLINE Point (const Real x=0., const Real y=0., const Real z=0.)
 Constructor.
 
LIBMESH_DEVICE_INLINE Point (const Point &p)=default
 Trivial copy-constructor.
 
LIBMESH_DEVICE_INLINE Point (const TypeVector< Real > &p)
 Copy-constructor from non-point Typevector.
 
LIBMESH_DEVICE_INLINE Point & operator= (const Point &p)=default
 Copy-assignment operator.
 
template<typename T , typename = typename std::enable_if<ScalarTraits<T>::value,void>::type>
LIBMESH_DEVICE_INLINE Point (const T x)
 Disambiguate constructing from non-Real scalars.
 
 ~Point ()=default
 Destructor.
 
LIBMESH_DEVICE_INLINE void assign (const TypeVector< T2 > &)
 Assign to this vector without creating a temporary.
 
const Real & operator() (const unsigned int i) const
 
Real & operator() (const unsigned int i)
 
LIBMESH_DEVICE_INLINE const Real & slice (const unsigned int i) const
 
LIBMESH_DEVICE_INLINE Real & slice (const unsigned int i)
 
TypeVector< typename CompareTypes< Real, T2 >::supertype > operator+ (const TypeVector< T2 > &) const
 Add two vectors.
 
LIBMESH_DEVICE_INLINE TypeVector< typename CompareTypes< Real, T2 >::supertype > operator+ (const TypeVector< T2 > &p) const
 
const TypeVector< Real > & operator+= (const TypeVector< T2 > &)
 Add to this vector.
 
LIBMESH_DEVICE_INLINE const TypeVector< Real > & operator+= (const TypeVector< T2 > &p)
 
void add (const TypeVector< T2 > &)
 Add to this vector without creating a temporary.
 
LIBMESH_DEVICE_INLINE void add (const TypeVector< T2 > &p)
 
LIBMESH_DEVICE_INLINE void add_scaled (const TypeVector< T2 > &, const Real &)
 Add a scaled value to this vector without creating a temporary.
 
TypeVector< typename CompareTypes< Real, T2 >::supertype > operator- (const TypeVector< T2 > &) const
 Subtract from this vector.
 
TypeVector< Real > operator- () const
 
LIBMESH_DEVICE_INLINE TypeVector< typename CompareTypes< Real, T2 >::supertype > operator- (const TypeVector< T2 > &p) const
 
const TypeVector< Real > & operator-= (const TypeVector< T2 > &)
 Subtract from this vector.
 
LIBMESH_DEVICE_INLINE const TypeVector< Real > & operator-= (const TypeVector< T2 > &p)
 
void subtract (const TypeVector< T2 > &)
 Subtract from this vector without creating a temporary.
 
LIBMESH_DEVICE_INLINE void subtract (const TypeVector< T2 > &p)
 
LIBMESH_DEVICE_INLINE void subtract_scaled (const TypeVector< T2 > &, const Real &)
 Subtract a scaled value from this vector without creating a temporary.
 
std::enable_if< ScalarTraits< Scalar >::value, TypeVector< typenameCompareTypes< Real, Scalar >::supertype > >::type operator* (const Scalar &) const
 Multiply this vector by a scalar value.
 
CompareTypes< Real, T2 >::supertype operator* (const TypeVector< T2 > &) const
 
LIBMESH_DEVICE_INLINE std::enable_if< ScalarTraits< Scalar >::value, TypeVector< typenameCompareTypes< Real, Scalar >::supertype > >::type operator* (const Scalar &factor) const
 
LIBMESH_DEVICE_INLINE CompareTypes< Real, T2 >::supertype operator* (const TypeVector< T2 > &p) const
 
const TypeVector< Real > & operator*= (const Real &)
 Multiply this vector by a scalar value.
 
std::enable_if< ScalarTraits< Scalar >::value, TypeVector< typenameCompareTypes< Real, Scalar >::supertype > >::type operator/ (const Scalar &) const
 Divide each entry of this vector by scalar value.
 
LIBMESH_DEVICE_INLINE std::enable_if< ScalarTraits< Scalar >::value, TypeVector< typenameCompareTypes< Real, Scalar >::supertype > >::type operator/ (const Scalar &factor) const
 
const TypeVector< Real > & operator/= (const Real &)
 Divide each entry of this vector by scalar value.
 
LIBMESH_DEVICE_INLINE CompareTypes< Real, T2 >::supertype contract (const TypeVector< T2 > &) const
 
TypeVector< typename CompareTypes< Real, T2 >::supertype > cross (const TypeVector< T2 > &v) const
 
LIBMESH_DEVICE_INLINE TypeVector< typename CompareTypes< Real, T2 >::supertype > cross (const TypeVector< T2 > &p) const
 
LIBMESH_DEVICE_INLINE TypeVector< Real > unit () const
 
auto norm () const
 
auto norm () const
 
auto norm () const
 
auto norm () const
 
auto norm () const
 
auto norm_sq () const
 
LIBMESH_DEVICE_INLINE auto l1_norm () const
 
auto l1_norm () const
 
auto l1_norm () const
 
LIBMESH_DEVICE_INLINE bool is_zero () const
 
LIBMESH_DEVICE_INLINE void zero ()
 Set all entries of the vector to 0.
 
bool relative_fuzzy_equals (const TypeVector< Real > &rhs, Real tol=TOLERANCE) const
 
bool absolute_fuzzy_equals (const TypeVector< Real > &rhs, Real tol=TOLERANCE) const
 
LIBMESH_DEVICE_INLINE bool operator== (const TypeVector< Real > &rhs) const
 
LIBMESH_DEVICE_INLINE 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.
 
void write_unformatted (std::ostream &out_stream, const bool newline=true) const
 Unformatted print to the stream out.
 

Protected Attributes

Real _coords [LIBMESH_DIM]
 The coordinates of the TypeVector.
 

Friends

class Node
 Make the derived class a friend.
 

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 40 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 123 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 118 of file type_vector.h.

Constructor & Destructor Documentation

◆ Point() [1/4]

LIBMESH_DEVICE_INLINE 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 49 of file point.h.

51 :
52 TypeVector<Real> (x,y,z)
53 {}
template class LIBMESH_EXPORT TypeVector< Real >

◆ Point() [2/4]

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

Trivial copy-constructor.

◆ Point() [3/4]

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

Copy-constructor from non-point Typevector.

Definition at line 65 of file point.h.

65 :
67 {}

◆ Point() [4/4]

template<typename T , typename = typename std::enable_if<ScalarTraits<T>::value,void>::type>
LIBMESH_DEVICE_INLINE libMesh::Point::Point ( const T  x)
inline

Disambiguate constructing from non-Real scalars.

Definition at line 82 of file point.h.

82 :
83 TypeVector<Real> (x,0,0)
84 {}

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

1044{
1045 return libMesh::absolute_fuzzy_equals(*this, rhs, tol);
1046}
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.

◆ add() [1/2]

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

Add to this vector without creating a temporary.

◆ add() [2/2]

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

Definition at line 619 of file type_vector.h.

620{
621#if LIBMESH_DIM == 1
622 _coords[0] += p._coords[0];
623#endif
624
625#if LIBMESH_DIM == 2
626 _coords[0] += p._coords[0];
627 _coords[1] += p._coords[1];
628#endif
629
630#if LIBMESH_DIM == 3
631 _coords[0] += p._coords[0];
632 _coords[1] += p._coords[1];
633 _coords[2] += p._coords[2];
634#endif
635
636}
Real _coords[LIBMESH_DIM]
The coordinates of the TypeVector.

◆ add_scaled()

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

644{
645#if LIBMESH_DIM == 1
646 _coords[0] += factor*p(0);
647#endif
648
649#if LIBMESH_DIM == 2
650 _coords[0] += factor*p(0);
651 _coords[1] += factor*p(1);
652#endif
653
654#if LIBMESH_DIM == 3
655 _coords[0] += factor*p(0);
656 _coords[1] += factor*p(1);
657 _coords[2] += factor*p(2);
658#endif
659
660}

◆ assign()

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

Assign to this vector without creating a temporary.

Definition at line 146 of file type_vector.h.

549{
550 for (unsigned int i=0; i<LIBMESH_DIM; i++)
551 _coords[i] = p._coords[i];
552}

◆ contract()

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

Definition at line 291 of file type_vector.h.

890{
891 return (*this)*(p);
892}

◆ cross() [1/2]

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

Definition at line 900 of file type_vector.h.

901{
902 typedef typename CompareTypes<T, T2>::supertype TS;
903 libmesh_assert_equal_to (LIBMESH_DIM, 3);
904
905 // | i j k |
906 // |(*this)(0) (*this)(1) (*this)(2)|
907 // | p(0) p(1) p(2) |
908
909#if LIBMESH_DIM == 3
910 return TypeVector<TS>( _coords[1]*p._coords[2] - _coords[2]*p._coords[1],
911 -_coords[0]*p._coords[2] + _coords[2]*p._coords[0],
912 _coords[0]*p._coords[1] - _coords[1]*p._coords[0]);
913#else
915 return TypeVector<TS>(0);
916#endif
917}
void libmesh_ignore(const Args &...)

◆ cross() [2/2]

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.

◆ is_zero()

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

Definition at line 328 of file type_vector.h.

1017{
1018 for (const auto & val : _coords)
1019 if (val != T(0))
1020 return false;
1021 return true;
1022}

◆ l1_norm() [1/3]

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

Definition at line 322 of file type_vector.h.

1032{
1033 using std::abs;
1034 decltype(abs(T())) ret{};
1035 for (const auto i : make_range(libmesh_dim))
1036 ret += abs(_coords[i]);
1037
1038 return ret;
1039}
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< bool >::l1_norm ( ) const
inherited

◆ l1_norm() [3/3]

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

Definition at line 203 of file type_vector.C.

204{
205 bool ret{};
206 for (const auto i : make_range(libmesh_dim))
207 ret += _coords[i];
208
209 return ret;
210}

◆ norm() [1/5]

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

Definition at line 310 of file type_vector.h.

924{
925 using std::sqrt;
926
927 // The norm is not differentiable at the origin: the directional
928 // derivative there depends on the direction of approach, so there is no
929 // well-defined gradient, and computing sqrt(norm_sq()) directly would
930 // divide by zero in the derivative terms of AD types. We return a zero
931 // derivative in this case, consistent with the MetaPhysicL convention for
932 // other functions with the same kind of non-differentiable point (e.g.
933 // abs()).
934 if (this->is_zero())
935 return decltype(sqrt(this->norm_sq())){};
936
937 return sqrt(this->norm_sq());
938}
LIBMESH_DEVICE_INLINE bool is_zero() const

◆ norm() [2/5]

auto libMesh::TypeVector< float >::norm ( ) const
inlineinherited

Definition at line 978 of file type_vector.h.

979{
980 using std::sqrt;
981 return sqrt(this->norm_sq());
982}

◆ norm() [3/5]

auto libMesh::TypeVector< double >::norm ( ) const
inlineinherited

Definition at line 986 of file type_vector.h.

987{
988 using std::sqrt;
989 return sqrt(this->norm_sq());
990}

◆ norm() [4/5]

auto libMesh::TypeVector< longdouble >::norm ( ) const
inlineinherited

Definition at line 994 of file type_vector.h.

995{
996 using std::sqrt;
997 return sqrt(this->norm_sq());
998}

◆ norm() [5/5]

auto libMesh::TypeVector< Real >::norm ( ) const
inlineinherited

Definition at line 1006 of file type_vector.h.

1007{
1008 using std::sqrt;
1009 return sqrt(this->norm_sq());
1010}

◆ norm_sq()

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

Definition at line 316 of file type_vector.h.

955{
956#if LIBMESH_DIM == 1
957 return (TensorTools::norm_sq(_coords[0]));
958#endif
959
960#if LIBMESH_DIM == 2
961 return (TensorTools::norm_sq(_coords[0]) +
962 TensorTools::norm_sq(_coords[1]));
963#endif
964
965#if LIBMESH_DIM == 3
966 return (TensorTools::norm_sq(_coords[0]) +
967 TensorTools::norm_sq(_coords[1]) +
968 TensorTools::norm_sq(_coords[2]));
969#endif
970}

◆ operator!=()

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

Definition at line 364 of file type_vector.h.

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

◆ operator()() [1/2]

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

570{
571 libmesh_assert_less (i, LIBMESH_DIM);
572
573 return _coords[i];
574}

◆ operator()() [2/2]

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

559{
560 libmesh_assert_less (i, LIBMESH_DIM);
561
562 return _coords[i];
563}

◆ operator*() [1/4]

std::enable_if< ScalarTraits< Scalar >::value, TypeVector< typenameCompareTypes< Real , Scalar >::supertype > >::type libMesh::TypeVector< Real >::operator* ( const Scalar &  ) const
inherited

Multiply this vector by a scalar value.

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

◆ operator*() [2/4]

LIBMESH_DEVICE_INLINE std::enable_if< ScalarTraits< Scalar >::value, TypeVector< typenameCompareTypes< Real , Scalar >::supertype > >::type libMesh::TypeVector< Real >::operator* ( const Scalar &  factor) const
inherited

Definition at line 755 of file type_vector.h.

756{
757 typedef typename CompareTypes<T, Scalar>::supertype SuperType;
758
759#if LIBMESH_DIM == 1
760 return TypeVector<SuperType>(_coords[0]*factor);
761#endif
762
763#if LIBMESH_DIM == 2
764 return TypeVector<SuperType>(_coords[0]*factor,
765 _coords[1]*factor);
766#endif
767
768#if LIBMESH_DIM == 3
769 return TypeVector<SuperType>(_coords[0]*factor,
770 _coords[1]*factor,
771 _coords[2]*factor);
772#endif
773}

◆ operator*() [3/4]

CompareTypes< Real , T2 >::supertype libMesh::TypeVector< Real >::operator* ( const TypeVector< T2 > &  ) 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.

◆ operator*() [4/4]

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

Definition at line 867 of file type_vector.h.

868{
869#if LIBMESH_DIM == 1
870 return _coords[0]*p._coords[0];
871#endif
872
873#if LIBMESH_DIM == 2
874 return (_coords[0]*p._coords[0] +
875 _coords[1]*p._coords[1]);
876#endif
877
878#if LIBMESH_DIM == 3
879 return (_coords[0]*p(0) +
880 _coords[1]*p(1) +
881 _coords[2]*p(2));
882#endif
883}

◆ operator*=()

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

793{
794#if LIBMESH_DIM == 1
795 _coords[0] *= factor;
796#endif
797
798#if LIBMESH_DIM == 2
799 _coords[0] *= factor;
800 _coords[1] *= factor;
801#endif
802
803#if LIBMESH_DIM == 3
804 _coords[0] *= factor;
805 _coords[1] *= factor;
806 _coords[2] *= factor;
807#endif
808
809 return *this;
810}

◆ operator+() [1/2]

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

Add two vectors.

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

◆ operator+() [2/2]

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

Definition at line 582 of file type_vector.h.

583{
584 typedef typename CompareTypes<T, T2>::supertype TS;
585#if LIBMESH_DIM == 1
586 return TypeVector<TS> (_coords[0] + p._coords[0]);
587#endif
588
589#if LIBMESH_DIM == 2
590 return TypeVector<TS> (_coords[0] + p._coords[0],
591 _coords[1] + p._coords[1]);
592#endif
593
594#if LIBMESH_DIM == 3
595 return TypeVector<TS> (_coords[0] + p._coords[0],
596 _coords[1] + p._coords[1],
597 _coords[2] + p._coords[2]);
598#endif
599
600}

◆ operator+=() [1/2]

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

Add to this vector.

Returns
A reference to *this.

◆ operator+=() [2/2]

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

Definition at line 607 of file type_vector.h.

608{
609 this->add (p);
610
611 return *this;
612}
void add(const TypeVector< T2 > &)
Add to this vector without creating a temporary.

◆ operator-() [1/3]

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

Definition at line 237 of file type_vector.h.

728{
729
730#if LIBMESH_DIM == 1
731 return TypeVector(-_coords[0]);
732#endif
733
734#if LIBMESH_DIM == 2
735 return TypeVector(-_coords[0],
736 -_coords[1]);
737#endif
738
739#if LIBMESH_DIM == 3
740 return TypeVector(-_coords[0],
741 -_coords[1],
742 -_coords[2]);
743#endif
744
745}

◆ operator-() [2/3]

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

Subtract from this vector.

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

◆ operator-() [3/3]

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

Definition at line 668 of file type_vector.h.

669{
670 typedef typename CompareTypes<T, T2>::supertype TS;
671
672#if LIBMESH_DIM == 1
673 return TypeVector<TS>(_coords[0] - p._coords[0]);
674#endif
675
676#if LIBMESH_DIM == 2
677 return TypeVector<TS>(_coords[0] - p._coords[0],
678 _coords[1] - p._coords[1]);
679#endif
680
681#if LIBMESH_DIM == 3
682 return TypeVector<TS>(_coords[0] - p._coords[0],
683 _coords[1] - p._coords[1],
684 _coords[2] - p._coords[2]);
685#endif
686
687}

◆ operator-=() [1/2]

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

Subtract from this vector.

Returns
A reference to *this.

◆ operator-=() [2/2]

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

Definition at line 694 of file type_vector.h.

695{
696 this->subtract (p);
697
698 return *this;
699}
void subtract(const TypeVector< T2 > &)
Subtract from this vector without creating a temporary.

◆ operator/() [1/2]

std::enable_if< ScalarTraits< Scalar >::value, TypeVector< typenameCompareTypes< Real , Scalar >::supertype > >::type libMesh::TypeVector< Real >::operator/ ( const Scalar &  ) const
inherited

Divide each entry of this vector by scalar value.

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

◆ operator/() [2/2]

LIBMESH_DEVICE_INLINE std::enable_if< ScalarTraits< Scalar >::value, TypeVector< typenameCompareTypes< Real , Scalar >::supertype > >::type libMesh::TypeVector< Real >::operator/ ( const Scalar &  factor) const
inherited

Definition at line 820 of file type_vector.h.

821{
822 typedef typename CompareTypes<T, Scalar>::supertype TS;
823
824 libmesh_assert_not_equal_to (static_cast<TS>(factor),
825 static_cast<TS>(0.));
826
827#if LIBMESH_DIM == 1
828 return TypeVector<TS>(_coords[0]/factor);
829#endif
830
831#if LIBMESH_DIM == 2
832 return TypeVector<TS>(_coords[0]/factor,
833 _coords[1]/factor);
834#endif
835
836#if LIBMESH_DIM == 3
837 return TypeVector<TS>(_coords[0]/factor,
838 _coords[1]/factor,
839 _coords[2]/factor);
840#endif
841
842}

◆ operator/=()

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

851{
852 libmesh_assert_not_equal_to (factor, static_cast<T>(0.));
853
854 for (unsigned int i=0; i<LIBMESH_DIM; i++)
855 _coords[i] /= factor;
856
857 return *this;
858}

◆ operator<() [1/2]

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

Definition at line 124 of file type_vector.C.

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 372 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.

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}

◆ 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 380 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=()

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

Copy-assignment operator.

◆ operator==()

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

1062{
1063#if LIBMESH_DIM == 1
1064 return (_coords[0] == rhs._coords[0]);
1065#endif
1066
1067#if LIBMESH_DIM == 2
1068 return (_coords[0] == rhs._coords[0] &&
1069 _coords[1] == rhs._coords[1]);
1070#endif
1071
1072#if LIBMESH_DIM == 3
1073 return (_coords[0] == rhs._coords[0] &&
1074 _coords[1] == rhs._coords[1] &&
1075 _coords[2] == rhs._coords[2]);
1076#endif
1077}

◆ operator>() [1/2]

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

Definition at line 162 of file type_vector.C.

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}

◆ 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 388 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.

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}

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

1235{
1236#if LIBMESH_DIM == 1
1237
1238 os << "x=" << (*this)(0);
1239
1240#endif
1241#if LIBMESH_DIM == 2
1242
1243 os << "(x,y)=("
1244 << std::setw(8) << (*this)(0) << ", "
1245 << std::setw(8) << (*this)(1) << ")";
1246
1247#endif
1248#if LIBMESH_DIM == 3
1249
1250 os << "(x,y,z)=("
1251 << std::setw(8) << (*this)(0) << ", "
1252 << std::setw(8) << (*this)(1) << ", "
1253 << std::setw(8) << (*this)(2) << ")";
1254#endif
1255}

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

1053{
1054 return libMesh::relative_fuzzy_equals(*this, rhs, tol);
1055}
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.

◆ slice() [1/2]

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

Definition at line 171 of file type_vector.h.

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

◆ slice() [2/2]

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

Definition at line 164 of file type_vector.h.

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

◆ subtract() [1/2]

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

Subtract from this vector without creating a temporary.

◆ subtract() [2/2]

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

Definition at line 706 of file type_vector.h.

707{
708 for (unsigned int i=0; i<LIBMESH_DIM; i++)
709 _coords[i] -= p._coords[i];
710}

◆ subtract_scaled()

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

718{
719 for (unsigned int i=0; i<LIBMESH_DIM; i++)
720 _coords[i] -= factor*p(i);
721}

◆ unit()

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

Definition at line 304 of file type_vector.h.

1210{
1211
1212 auto && length = norm();
1213
1214 libmesh_assert_not_equal_to (length, static_cast<Real>(0.));
1215
1216#if LIBMESH_DIM == 1
1217 return TypeVector<T>(_coords[0]/length);
1218#endif
1219
1220#if LIBMESH_DIM == 2
1221 return TypeVector<T>(_coords[0]/length,
1222 _coords[1]/length);
1223#endif
1224
1225#if LIBMESH_DIM == 3
1226 return TypeVector<T>(_coords[0]/length,
1227 _coords[1]/length,
1228 _coords[2]/length);
1229#endif
1230
1231}
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ 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 423 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()

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

Set all entries of the vector to 0.

Definition at line 334 of file type_vector.h.

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

Friends And Related Symbol Documentation

◆ Node

friend class Node
friend

Make the derived class a friend.

Definition at line 96 of file point.h.

Member Data Documentation

◆ _coords

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

The coordinates of the TypeVector.

Definition at line 431 of file type_vector.h.


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