Point Class Reference
#include <point.h>

Public Member Functions | |
| Point (const Real x=0., const Real y=0., const Real z=0.) | |
| Point (const Point &p) | |
| Point (const TypeVector< Real > &p) | |
| virtual | ~Point () |
| template<typename T2 > | |
| void | assign (const TypeVector< T2 > &) |
| T | operator() (const unsigned int i) const |
| T & | operator() (const unsigned int i) |
| template<typename T2 > | |
| TypeVector< typename CompareTypes< T, T2 > ::supertype > | operator+ (const TypeVector< T2 > &) const |
| template<typename T2 > | |
| const TypeVector< T > & | operator+= (const TypeVector< T2 > &) |
| template<typename T2 > | |
| void | add (const TypeVector< T2 > &) |
| template<typename T2 > | |
| void | add_scaled (const TypeVector< T2 > &, const T) |
| template<typename T2 > | |
| TypeVector< typename CompareTypes< T, T2 > ::supertype > | operator- (const TypeVector< T2 > &) const |
| TypeVector< T > | operator- () const |
| template<typename T2 > | |
| const TypeVector< T > & | operator-= (const TypeVector< T2 > &) |
| template<typename T2 > | |
| void | subtract (const TypeVector< T2 > &) |
| template<typename T2 > | |
| void | subtract_scaled (const TypeVector< T2 > &, const T) |
| template<typename Scalar > | |
| boostcopy::enable_if_c < ScalarTraits< Scalar > ::value, TypeVector< typename CompareTypes< T, Scalar > ::supertype > >::type | operator* (const Scalar) const |
| template<typename T2 > | |
| CompareTypes< T, T2 >::supertype | operator* (const TypeVector< T2 > &) const |
| const TypeVector< T > & | operator*= (const T) |
| template<typename Scalar > | |
| boostcopy::enable_if_c < ScalarTraits< Scalar > ::value, TypeVector< typename CompareTypes< T, Scalar > ::supertype > >::type | operator/ (const Scalar) const |
| const TypeVector< T > & | operator/= (const T) |
| template<typename T2 > | |
| TypeVector< typename CompareTypes< T, T2 > ::supertype > | cross (const TypeVector< T2 > &) const |
| TypeVector< T > | unit () const |
| Real | size () const |
| Real | size_sq () const |
| void | zero () |
| bool | relative_fuzzy_equals (const TypeVector< T > &rhs, Real tol=TOLERANCE) const |
| bool | absolute_fuzzy_equals (const TypeVector< T > &rhs, Real tol=TOLERANCE) const |
| bool | operator== (const TypeVector< T > &rhs) const |
| bool | operator!= (const TypeVector< T > &rhs) const |
| template<> | |
| bool | operator!= (const TypeVector< Real > &rhs) const |
| bool | operator< (const TypeVector< T > &rhs) const |
| template<> | |
| bool | operator< (const TypeVector< Complex > &rhs) const |
| bool | operator> (const TypeVector< T > &rhs) const |
| template<> | |
| bool | operator> (const TypeVector< Complex > &rhs) const |
| void | print (std::ostream &os) const |
| void | write_unformatted (std::ostream &out, const bool newline=true) const |
Protected Attributes | |
| T | _coords [LIBMESH_DIM] |
Friends | |
| class | Node |
| std::ostream & | operator<< (std::ostream &os, const TypeVector< T > &t) |
Detailed Description
APoint defines a location in LIBMESH_DIM dimensional Real space. Points are always real-valued, even if the library is configured with --enable-complex.
Definition at line 42 of file point.h.
Constructor & Destructor Documentation
Constructor. By default sets all entries to 0. Gives the point 0 in LIBMESH_DIM dimensions.
Definition at line 89 of file point.h.
Referenced by Node::PackedNode::build_point().
00091 : 00092 TypeVector<Real> (x,y,z) 00093 { 00094 }
| Point::Point | ( | const Point & | p | ) | [inline] |
Copy-constructor.
Definition at line 99 of file point.h.
00099 : 00100 TypeVector<Real> (p) 00101 { 00102 }
| Point::Point | ( | const TypeVector< Real > & | p | ) | [inline] |
Copy-constructor.
Definition at line 107 of file point.h.
00107 : 00108 TypeVector<Real> (p) 00109 { 00110 }
Member Function Documentation
| bool TypeVector< T >::absolute_fuzzy_equals | ( | const TypeVector< T > & | rhs, | |
| Real | tol = TOLERANCE | |||
| ) | const [inline, inherited] |
- Returns:
trueiff two vectors occupy approximately the same physical location in space, to within an absolute tolerance oftol.
Definition at line 755 of file type_vector.h.
References TypeVector< T >::_coords.
Referenced by LocationMap< T >::find(), and TypeVector< T >::relative_fuzzy_equals().
00756 { 00757 #if LIBMESH_DIM == 1 00758 return (std::abs(_coords[0] - rhs._coords[0]) 00759 <= tol); 00760 #endif 00761 00762 #if LIBMESH_DIM == 2 00763 return (std::abs(_coords[0] - rhs._coords[0]) + 00764 std::abs(_coords[1] - rhs._coords[1]) 00765 <= tol); 00766 #endif 00767 00768 #if LIBMESH_DIM == 3 00769 return (std::abs(_coords[0] - rhs._coords[0]) + 00770 std::abs(_coords[1] - rhs._coords[1]) + 00771 std::abs(_coords[2] - rhs._coords[2]) 00772 <= tol); 00773 #endif 00774 }
| void TypeVector< T >::add | ( | const TypeVector< T2 > & | p | ) | [inline, inherited] |
Add to this vector without creating a temporary.
Definition at line 426 of file type_vector.h.
References TypeVector< T >::_coords.
Referenced by Elem::centroid(), InfFE< Dim, T_radial, T_map >::inverse_map(), FE< Dim, T >::inverse_map(), LaplaceMeshSmoother::smooth(), and MeshTools::Modification::smooth().
00427 { 00428 #if LIBMESH_DIM == 1 00429 _coords[0] += p._coords[0]; 00430 #endif 00431 00432 #if LIBMESH_DIM == 2 00433 _coords[0] += p._coords[0]; 00434 _coords[1] += p._coords[1]; 00435 #endif 00436 00437 #if LIBMESH_DIM == 3 00438 _coords[0] += p._coords[0]; 00439 _coords[1] += p._coords[1]; 00440 _coords[2] += p._coords[2]; 00441 #endif 00442 00443 }
| void TypeVector< T >::add_scaled | ( | const TypeVector< T2 > & | p, | |
| const T | factor | |||
| ) | [inline, inherited] |
Add a scaled value to this vector without creating a temporary.
Definition at line 450 of file type_vector.h.
References TypeVector< T >::_coords.
Referenced by HPCoarsenTest::add_projection(), KellyErrorEstimator::boundary_side_integration(), System::calculate_norm(), Elem::coarsen(), FEBase::coarsened_dof_values(), FEMContext::fixed_interior_gradient(), FEMContext::fixed_side_gradient(), MeshFunction::gradient(), FEMContext::interior_gradient(), KellyErrorEstimator::internal_side_integration(), InfFE< Dim, T_radial, T_map >::inverse_map(), FE< Dim, T >::map(), FE< Dim, T >::map_eta(), FE< Dim, T >::map_xi(), FE< Dim, T >::map_zeta(), PatchRecoveryErrorEstimator::EstimateError::operator()(), HPCoarsenTest::select_refinement(), FEMContext::side_gradient(), and MeshTools::Modification::smooth().
00451 { 00452 #if LIBMESH_DIM == 1 00453 _coords[0] += factor*p(0); 00454 #endif 00455 00456 #if LIBMESH_DIM == 2 00457 _coords[0] += factor*p(0); 00458 _coords[1] += factor*p(1); 00459 #endif 00460 00461 #if LIBMESH_DIM == 3 00462 _coords[0] += factor*p(0); 00463 _coords[1] += factor*p(1); 00464 _coords[2] += factor*p(2); 00465 #endif 00466 00467 }
| void TypeVector< T >::assign | ( | const TypeVector< T2 > & | p | ) | [inline, inherited] |
Assign to a vector without creating a temporary.
Definition at line 335 of file type_vector.h.
References TypeVector< T >::_coords.
| TypeVector< typename CompareTypes< T, T2 >::supertype > TypeVector< T >::cross | ( | const TypeVector< T2 > & | p | ) | const [inline, inherited] |
Cross 2 vectors together, i.e. cross-product.
Definition at line 696 of file type_vector.h.
References TypeVector< T >::_coords.
Referenced by FEBase::compute_face_map(), FEXYZ< Dim >::compute_face_values(), Plane::create_from_three_points(), Tri3::volume(), Quad4::volume(), Tet4::volume(), Pyramid5::volume(), Prism6::volume(), and Hex8::volume().
00697 { 00698 typedef typename CompareTypes<T, T2>::supertype TS; 00699 libmesh_assert (LIBMESH_DIM == 3); 00700 00701 // | i j k | 00702 // |(*this)(0) (*this)(1) (*this)(2)| 00703 // | p(0) p(1) p(2) | 00704 00705 return TypeVector<TS>( _coords[1]*p._coords[2] - _coords[2]*p._coords[1], 00706 -_coords[0]*p._coords[2] + _coords[2]*p._coords[0], 00707 _coords[0]*p._coords[1] - _coords[1]*p._coords[0]); 00708 }
| bool TypeVector< Real >::operator!= | ( | const TypeVector< Real > & | rhs | ) | const [inline, inherited] |
| bool TypeVector< T >::operator!= | ( | const TypeVector< T > & | rhs | ) | const [inherited] |
- Returns:
trueiff two vectors do not occupy approximately the same physical location in space.
| T & TypeVector< T >::operator() | ( | const unsigned int | i | ) | [inline, inherited] |
Return a writeable reference to the
element of the vector.
Definition at line 363 of file type_vector.h.
References TypeVector< T >::_coords.
00364 { 00365 #if LIBMESH_DIM < 3 00366 00367 if (i >= LIBMESH_DIM) 00368 { 00369 // std::cerr << "ERROR: You are assigning to a vector component" << std::endl 00370 // << "that is out of range for the compiled LIBMESH_DIM!" << std::endl 00371 // << " LIBMESH_DIM=" << LIBMESH_DIM << " , i=" << i 00372 // << std::endl; 00373 libmesh_error(); 00374 } 00375 00376 #endif 00377 00378 libmesh_assert (i<LIBMESH_DIM); 00379 00380 return _coords[i]; 00381 }
| T TypeVector< T >::operator() | ( | const unsigned int | i | ) | const [inline, inherited] |
Return the
element of the vector.
Definition at line 345 of file type_vector.h.
References TypeVector< T >::_coords.
00346 { 00347 libmesh_assert (i<3); 00348 00349 #if LIBMESH_DIM < 3 00350 00351 if (i > (LIBMESH_DIM-1)) 00352 return 0.; 00353 00354 #endif 00355 00356 return _coords[i]; 00357 }
| CompareTypes< T, T2 >::supertype TypeVector< T >::operator* | ( | const TypeVector< T2 > & | p | ) | const [inline, inherited] |
Multiply 2 vectors together, i.e. dot-product. The vectors may be of different types.
Definition at line 673 of file type_vector.h.
References TypeVector< T >::_coords.
00674 { 00675 #if LIBMESH_DIM == 1 00676 return _coords[0]*p._coords[0]; 00677 #endif 00678 00679 #if LIBMESH_DIM == 2 00680 return (_coords[0]*p._coords[0] + 00681 _coords[1]*p._coords[1]); 00682 #endif 00683 00684 #if LIBMESH_DIM == 3 00685 return (_coords[0]*p(0) + 00686 _coords[1]*p(1) + 00687 _coords[2]*p(2)); 00688 #endif 00689 }
| boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeVector< typename CompareTypes< T, Scalar >::supertype > >::type TypeVector< T >::operator* | ( | const Scalar | factor | ) | const [inline, inherited] |
Multiply a vector by a number, i.e. scale.
Definition at line 562 of file type_vector.h.
References TypeVector< T >::_coords.
00563 { 00564 typedef typename CompareTypes<T, Scalar>::supertype TS; 00565 00566 #if LIBMESH_DIM == 1 00567 return TypeVector<TS>(_coords[0]*factor); 00568 #endif 00569 00570 #if LIBMESH_DIM == 2 00571 return TypeVector<TS>(_coords[0]*factor, 00572 _coords[1]*factor); 00573 #endif 00574 00575 #if LIBMESH_DIM == 3 00576 return TypeVector<TS>(_coords[0]*factor, 00577 _coords[1]*factor, 00578 _coords[2]*factor); 00579 #endif 00580 }
| const TypeVector< T > & TypeVector< T >::operator*= | ( | const T | factor | ) | [inline, inherited] |
Multiply this vector by a number, i.e. scale.
Definition at line 599 of file type_vector.h.
References TypeVector< T >::_coords.
00600 { 00601 #if LIBMESH_DIM == 1 00602 _coords[0] *= factor; 00603 #endif 00604 00605 #if LIBMESH_DIM == 2 00606 _coords[0] *= factor; 00607 _coords[1] *= factor; 00608 #endif 00609 00610 #if LIBMESH_DIM == 3 00611 _coords[0] *= factor; 00612 _coords[1] *= factor; 00613 _coords[2] *= factor; 00614 #endif 00615 00616 return *this; 00617 }
| TypeVector< typename CompareTypes< T, T2 >::supertype > TypeVector< T >::operator+ | ( | const TypeVector< T2 > & | p | ) | const [inline, inherited] |
Add two vectors.
Definition at line 389 of file type_vector.h.
References TypeVector< T >::_coords.
00390 { 00391 typedef typename CompareTypes<T, T2>::supertype TS; 00392 #if LIBMESH_DIM == 1 00393 return TypeVector<TS> (_coords[0] + p._coords[0]); 00394 #endif 00395 00396 #if LIBMESH_DIM == 2 00397 return TypeVector<TS> (_coords[0] + p._coords[0], 00398 _coords[1] + p._coords[1]); 00399 #endif 00400 00401 #if LIBMESH_DIM == 3 00402 return TypeVector<TS> (_coords[0] + p._coords[0], 00403 _coords[1] + p._coords[1], 00404 _coords[2] + p._coords[2]); 00405 #endif 00406 00407 }
| const TypeVector< T > & TypeVector< T >::operator+= | ( | const TypeVector< T2 > & | p | ) | [inline, inherited] |
| TypeVector< T > TypeVector< T >::operator- | ( | ) | const [inline, inherited] |
Return the opposite of a vector
Definition at line 534 of file type_vector.h.
References TypeVector< T >::_coords, and TypeVector< T >::TypeVector.
00535 { 00536 00537 #if LIBMESH_DIM == 1 00538 return TypeVector(-_coords[0]); 00539 #endif 00540 00541 #if LIBMESH_DIM == 2 00542 return TypeVector(-_coords[0], 00543 -_coords[1]); 00544 #endif 00545 00546 #if LIBMESH_DIM == 3 00547 return TypeVector(-_coords[0], 00548 -_coords[1], 00549 -_coords[2]); 00550 #endif 00551 00552 }
| TypeVector< typename CompareTypes< T, T2 >::supertype > TypeVector< T >::operator- | ( | const TypeVector< T2 > & | p | ) | const [inline, inherited] |
Subtract two vectors.
Definition at line 475 of file type_vector.h.
References TypeVector< T >::_coords.
00476 { 00477 typedef typename CompareTypes<T, T2>::supertype TS; 00478 00479 #if LIBMESH_DIM == 1 00480 return TypeVector<TS>(_coords[0] - p._coords[0]); 00481 #endif 00482 00483 #if LIBMESH_DIM == 2 00484 return TypeVector<TS>(_coords[0] - p._coords[0], 00485 _coords[1] - p._coords[1]); 00486 #endif 00487 00488 #if LIBMESH_DIM == 3 00489 return TypeVector<TS>(_coords[0] - p._coords[0], 00490 _coords[1] - p._coords[1], 00491 _coords[2] - p._coords[2]); 00492 #endif 00493 00494 }
| const TypeVector< T > & TypeVector< T >::operator-= | ( | const TypeVector< T2 > & | p | ) | [inline, inherited] |
Subtract from this vector.
Definition at line 501 of file type_vector.h.
References TypeVector< T >::subtract().
00502 { 00503 this->subtract (p); 00504 00505 return *this; 00506 }
| boostcopy::enable_if_c< ScalarTraits< Scalar >::value, TypeVector< typename CompareTypes< T, Scalar >::supertype > >::type TypeVector< T >::operator/ | ( | const Scalar | factor | ) | const [inline, inherited] |
Divide a vector by a number, i.e. scale.
Definition at line 627 of file type_vector.h.
References TypeVector< T >::_coords.
00628 { 00629 libmesh_assert (factor != static_cast<T>(0.)); 00630 00631 typedef typename CompareTypes<T, Scalar>::supertype TS; 00632 00633 #if LIBMESH_DIM == 1 00634 return TypeVector<TS>(_coords[0]/factor); 00635 #endif 00636 00637 #if LIBMESH_DIM == 2 00638 return TypeVector<TS>(_coords[0]/factor, 00639 _coords[1]/factor); 00640 #endif 00641 00642 #if LIBMESH_DIM == 3 00643 return TypeVector<TS>(_coords[0]/factor, 00644 _coords[1]/factor, 00645 _coords[2]/factor); 00646 #endif 00647 00648 }
| const TypeVector< T > & TypeVector< T >::operator/= | ( | const T | factor | ) | [inline, inherited] |
Divide this vector by a number, i.e. scale.
Definition at line 656 of file type_vector.h.
References TypeVector< T >::_coords.
00657 { 00658 libmesh_assert (factor != static_cast<T>(0.)); 00659 00660 for (unsigned int i=0; i<LIBMESH_DIM; i++) 00661 _coords[i] /= factor; 00662 00663 return *this; 00664 }
| bool TypeVector< Complex >::operator< | ( | const TypeVector< Complex > & | rhs | ) | const [inline, inherited] |
Definition at line 141 of file type_vector.C.
00142 { 00143 for (unsigned int i=0; i<LIBMESH_DIM; i++) 00144 { 00145 if ((*this)(i).real() < rhs(i).real()) 00146 return true; 00147 if ((*this)(i).real() > rhs(i).real()) 00148 return false; 00149 if ((*this)(i).imag() < rhs(i).imag()) 00150 return true; 00151 if ((*this)(i).imag() > rhs(i).imag()) 00152 return false; 00153 } 00154 return false; 00155 }
| bool TypeVector< T >::operator< | ( | const TypeVector< T > & | rhs | ) | const [inline, inherited] |
- Returns:
trueif this vector is "less" than another. Useful for sorting. Also used for choosing some arbitrary basis function orientations
Definition at line 110 of file type_vector.C.
00111 { 00112 for (unsigned int i=0; i<LIBMESH_DIM; i++) 00113 { 00114 if ((*this)(i) < rhs(i)) 00115 return true; 00116 if ((*this)(i) > rhs(i)) 00117 return false; 00118 } 00119 return false; 00120 }
| bool TypeVector< T >::operator== | ( | const TypeVector< T > & | rhs | ) | const [inline, inherited] |
- Returns:
trueiff two vectors occupy approximately the same physical location in space, to within an absolute tolerance ofTOLERANCE.
Definition at line 805 of file type_vector.h.
References TypeVector< T >::_coords.
00806 { 00807 #if LIBMESH_DIM == 1 00808 return (_coords[0] == rhs._coords[0]); 00809 #endif 00810 00811 #if LIBMESH_DIM == 2 00812 return (_coords[0] == rhs._coords[0] && 00813 _coords[1] == rhs._coords[1]); 00814 #endif 00815 00816 #if LIBMESH_DIM == 3 00817 return (_coords[0] == rhs._coords[0] && 00818 _coords[1] == rhs._coords[1] && 00819 _coords[2] == rhs._coords[2]); 00820 #endif 00821 }
| bool TypeVector< Complex >::operator> | ( | const TypeVector< Complex > & | rhs | ) | const [inline, inherited] |
Definition at line 160 of file type_vector.C.
00161 { 00162 for (unsigned int i=0; i<LIBMESH_DIM; i++) 00163 { 00164 if ((*this)(i).real() > rhs(i).real()) 00165 return true; 00166 if ((*this)(i).real() < rhs(i).real()) 00167 return false; 00168 if ((*this)(i).imag() > rhs(i).imag()) 00169 return true; 00170 if ((*this)(i).imag() < rhs(i).imag()) 00171 return false; 00172 } 00173 return false; 00174 }
| bool TypeVector< T >::operator> | ( | const TypeVector< T > & | rhs | ) | const [inline, inherited] |
- Returns:
trueif this vector is "greater" than another. Useful for sorting. Also used for choosing some arbitrary basis function orientations
Definition at line 125 of file type_vector.C.
00126 { 00127 for (unsigned int i=0; i<LIBMESH_DIM; i++) 00128 { 00129 if ((*this)(i) > rhs(i)) 00130 return true; 00131 if ((*this)(i) < rhs(i)) 00132 return false; 00133 } 00134 return false; 00135 }
| void TypeVector< T >::print | ( | std::ostream & | os | ) | const [inline, inherited] |
Formatted print to std::cout.
Definition at line 63 of file type_vector.C.
00064 { 00065 #if LIBMESH_DIM == 1 00066 00067 os << "x=" << (*this)(0) << '\n'; 00068 00069 #endif 00070 #if LIBMESH_DIM == 2 00071 00072 os << "(x,y)=(" 00073 << std::setw(8) << (*this)(0) << ", " 00074 << std::setw(8) << (*this)(1) << ")" 00075 << '\n'; 00076 00077 #endif 00078 #if LIBMESH_DIM == 3 00079 00080 os << "(x,y,z)=(" 00081 << std::setw(8) << (*this)(0) << ", " 00082 << std::setw(8) << (*this)(1) << ", " 00083 << std::setw(8) << (*this)(2) << ")" 00084 << '\n'; 00085 #endif 00086 }
| bool TypeVector< T >::relative_fuzzy_equals | ( | const TypeVector< T > & | rhs, | |
| Real | tol = TOLERANCE | |||
| ) | const [inline, inherited] |
- Returns:
trueiff two vectors occupy approximately the same physical location in space, to within a relative tolerance oftol.
Definition at line 780 of file type_vector.h.
References TypeVector< T >::_coords, and TypeVector< T >::absolute_fuzzy_equals().
Referenced by Quad9::has_affine_map(), Quad8::has_affine_map(), Quad4::has_affine_map(), Prism6::has_affine_map(), Prism18::has_affine_map(), Prism15::has_affine_map(), Hex8::has_affine_map(), Hex27::has_affine_map(), and Hex20::has_affine_map().
00781 { 00782 #if LIBMESH_DIM == 1 00783 return this->absolute_fuzzy_equals(rhs, tol * 00784 (std::abs(_coords[0]) + std::abs(rhs._coords[0]))); 00785 #endif 00786 00787 #if LIBMESH_DIM == 2 00788 return this->absolute_fuzzy_equals(rhs, tol * 00789 (std::abs(_coords[0]) + std::abs(rhs._coords[0]) + 00790 std::abs(_coords[1]) + std::abs(rhs._coords[1]))); 00791 #endif 00792 00793 #if LIBMESH_DIM == 3 00794 return this->absolute_fuzzy_equals(rhs, tol * 00795 (std::abs(_coords[0]) + std::abs(rhs._coords[0]) + 00796 std::abs(_coords[1]) + std::abs(rhs._coords[1]) + 00797 std::abs(_coords[2]) + std::abs(rhs._coords[2]))); 00798 #endif 00799 }
| Real TypeVector< T >::size | ( | ) | const [inline, inherited] |
Returns the magnitude of the vector, i.e. the square-root of the sum of the elements squared.
Definition at line 714 of file type_vector.h.
References TypeVector< T >::size_sq().
Referenced by Sphere::above_surface(), InfElemBuilder::build_inf_elem(), Elem::hmax(), Elem::hmin(), InfFE< Dim, T_radial, T_map >::inverse_map(), FE< Dim, T >::inverse_map(), FEInterface::inverse_map(), Tri3::min_and_max_angle(), Tet4::min_and_max_angle(), Sphere::on_surface(), Tri::quality(), MeshTools::Modification::smooth(), Sphere::surface_coords(), and TypeVector< T >::unit().
00715 { 00716 return std::sqrt(this->size_sq()); 00717 }
| Real TypeVector< T >::size_sq | ( | ) | const [inline, inherited] |
Returns the magnitude of the vector squared, i.e. the sum of the element magnitudes squared.
Definition at line 733 of file type_vector.h.
References TypeVector< T >::_coords, and libmesh_norm().
Referenced by ExactSolution::_compute_error(), System::calculate_norm(), ExactErrorEstimator::find_squared_element_error(), HPCoarsenTest::select_refinement(), TypeVector< T >::size(), Sphere::Sphere(), and Edge3::volume().
00734 { 00735 #if LIBMESH_DIM == 1 00736 return (libmesh_norm(_coords[0])); 00737 #endif 00738 00739 #if LIBMESH_DIM == 2 00740 return (libmesh_norm(_coords[0]) + 00741 libmesh_norm(_coords[1])); 00742 #endif 00743 00744 #if LIBMESH_DIM == 3 00745 return (libmesh_norm(_coords[0]) + 00746 libmesh_norm(_coords[1]) + 00747 libmesh_norm(_coords[2])); 00748 #endif 00749 }
| void TypeVector< T >::subtract | ( | const TypeVector< T2 > & | p | ) | [inline, inherited] |
Subtract from this vector without creating a temporary.
Definition at line 513 of file type_vector.h.
References TypeVector< T >::_coords.
Referenced by TypeVector< T >::operator-=().
| void TypeVector< T >::subtract_scaled | ( | const TypeVector< T2 > & | p, | |
| const T | factor | |||
| ) | [inline, inherited] |
Subtract a scaled value from this vector without creating a temporary.
Definition at line 524 of file type_vector.h.
References TypeVector< T >::_coords.
Referenced by HPCoarsenTest::select_refinement().
00525 { 00526 for (unsigned int i=0; i<LIBMESH_DIM; i++) 00527 _coords[i] -= factor*p(i); 00528 }
| TypeVector< T > TypeVector< T >::unit | ( | ) | const [inline, inherited] |
Think of a vector as a dim dimensional vector. This will return a unit vector aligned in that direction.
Definition at line 36 of file type_vector.C.
References TypeVector< T >::_coords, and TypeVector< T >::size().
Referenced by FEBase::compute_face_map(), FEXYZ< Dim >::compute_face_values(), Plane::create_from_point_normal(), Plane::create_from_three_points(), MeshTools::Modification::distort(), and Sphere::unit_normal().
00037 { 00038 00039 const Real length = size(); 00040 00041 libmesh_assert (length != static_cast<Real>(0.)); 00042 00043 #if LIBMESH_DIM == 1 00044 return TypeVector<T>(_coords[0]/length); 00045 #endif 00046 00047 #if LIBMESH_DIM == 2 00048 return TypeVector<T>(_coords[0]/length, 00049 _coords[1]/length); 00050 #endif 00051 00052 #if LIBMESH_DIM == 3 00053 return TypeVector<T>(_coords[0]/length, 00054 _coords[1]/length, 00055 _coords[2]/length); 00056 #endif 00057 00058 }
| void TypeVector< T >::write_unformatted | ( | std::ostream & | out, | |
| const bool | newline = true | |||
| ) | const [inline, inherited] |
Unformatted print to the stream out. Simply prints the elements of the vector separated by spaces. Optionally prints a newline, which it does by default.
Definition at line 93 of file type_vector.C.
Referenced by InfElemBuilder::build_inf_elem(), TecplotIO::write_ascii(), and DivaIO::write_stream().
00095 { 00096 libmesh_assert (out); 00097 00098 out << std::setiosflags(std::ios::showpoint) 00099 << (*this)(0) << " " 00100 << (*this)(1) << " " 00101 << (*this)(2) << " "; 00102 00103 if (newline) 00104 out << '\n'; 00105 }
| void TypeVector< T >::zero | ( | ) | [inline, inherited] |
Zero the vector in any dimension.
Definition at line 723 of file type_vector.h.
References TypeVector< T >::_coords.
00724 { 00725 for (unsigned int i=0; i<LIBMESH_DIM; i++) 00726 _coords[i] = 0.; 00727 }
Friends And Related Function Documentation
friend class Node [friend] |
| std::ostream& operator<< | ( | std::ostream & | os, | |
| const TypeVector< T > & | t | |||
| ) | [friend, inherited] |
Formatted print as above but allows you to do Point p(1,2,3); std::cout << p << std::endl;
Definition at line 268 of file type_vector.h.
00269 { 00270 t.print(os); 00271 return os; 00272 }
Member Data Documentation
T TypeVector< T >::_coords[LIBMESH_DIM] [protected, inherited] |
The coordinates of the TypeVector
Definition at line 286 of file type_vector.h.
Referenced by TypeVector< T >::absolute_fuzzy_equals(), TypeVector< T >::add(), TypeVector< T >::add_scaled(), TypeVector< T >::assign(), TypeVector< T >::cross(), TypeVector< T >::operator()(), TypeVector< T >::operator*(), TypeVector< T >::operator*=(), TypeVector< T >::operator+(), TypeVector< T >::operator-(), TypeVector< T >::operator/(), TypeVector< T >::operator/=(), TypeVector< T >::operator==(), TypeVector< T >::relative_fuzzy_equals(), TypeVector< T >::size_sq(), TypeVector< T >::subtract(), TypeVector< T >::subtract_scaled(), TypeVector< T >::TypeVector(), TypeVector< T >::unit(), and TypeVector< T >::zero().
The documentation for this class was generated from the following file: