Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
v_vector.h File Reference
#include "moab/verdict.h"
#include <cmath>
#include <cassert>
+ Include dependency graph for v_vector.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

double dot_product (double vec1[], double vec2[])
 
void normalize (double vec[])
 
double * cross_product (double vec1[], double vec2[], double answer[])
 
double length (double vec[])
 
double length_squared (double vec[])
 
double interior_angle (double vec1[], double vec2[])
 

Function Documentation

◆ cross_product()

double* cross_product ( double  vec1[],
double  vec2[],
double  answer[] 
)
inline

Definition at line 37 of file v_vector.h.

38 {
39  answer[0] = vec1[1] * vec2[2] - vec1[2] * vec2[1];
40  answer[1] = vec1[2] * vec2[0] - vec1[0] * vec2[2];
41  answer[2] = vec1[0] * vec2[1] - vec1[1] * vec2[0];
42  return answer;
43 }

◆ dot_product()

double dot_product ( double  vec1[],
double  vec2[] 
)
inline

Definition at line 20 of file v_vector.h.

21 {
22  double answer = vec1[0] * vec2[0] + vec1[1] * vec2[1] + vec1[2] * vec2[2];
23  return answer;
24 }

Referenced by interior_angle(), v_quad_distortion(), and v_tri_distortion().

◆ interior_angle()

double interior_angle ( double  vec1[],
double  vec2[] 
)
inline

Definition at line 58 of file v_vector.h.

59 {
60  double cosAngle, angleRad;
61  double length1 = length( vec1 );
62  double length2 = length( vec2 );
63  assert( ( length1 > 0.0 && length2 > 0.0 ) );
64 
65  cosAngle = dot_product( vec1, vec2 ) / ( length1 * length2 );
66 
67  if( ( cosAngle > 1.0 ) && ( cosAngle < 1.0001 ) )
68  {
69  cosAngle = 1.0;
70  }
71  else if( cosAngle < -1.0 && cosAngle > -1.0001 )
72  {
73  cosAngle = -1.0;
74  }
75  else
76  {
77  assert( cosAngle < 1.0001 && cosAngle > -1.0001 );
78  }
79 
80  angleRad = acos( cosAngle );
81  return ( ( angleRad * 180. ) / VERDICT_PI );
82 }

References dot_product(), length(), and VERDICT_PI.

Referenced by v_tri_quality().

◆ length()

double length ( double  vec[])
inline
Examples
LaplacianSmoother.cpp, and LloydRelaxation.cpp.

Definition at line 46 of file v_vector.h.

47 {
48  return sqrt( vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2] );
49 }

Referenced by moab::angle_robust(), moab::area_coordinates(), MetisPartitioner::assemble_graph(), ZoltanPartitioner::assemble_graph(), MetisPartitioner::assemble_taggedents_graph(), MetisPartitioner::assemble_taggedsets_graph(), ZoltanPartitioner::balance_mesh(), moab::Bvh_tree< _Entity_handles, _Box, _Moab, _Parametrizer >::bucket_index(), moab::BVHTree::Bucket::bucket_index(), moab::GeomQueryTool::closest_to_location(), compute_area(), moab::copy_set_contents(), moab::SysUtil::filesize(), moab::NestedRefine::find_shortest_diagonal_octahedron(), moab::Intx2MeshOnSphere::findNodes(), moab::VarLenSparseTag::get_data_ptr(), moab::SmoothFace::init_facet_control_points(), moab::WriteNCDF::initialize_exodus_file(), interior_angle(), moab::SmoothFace::is_at_vertex(), moab::ReadMCNP5::load_file(), main(), ZoltanPartitioner::mbInitializePoints(), measure(), mhdf_compact_to_ranges(), mhdf_getElemHandles(), mhdf_name_to_path(), MetisPartitioner::partition_mesh(), ZoltanPartitioner::partition_mesh_and_geometry(), ZoltanPartitioner::partition_owned_cells(), perform_laplacian_smoothing(), perform_lloyd_relaxation(), moab::LloydSmoother::perform_smooth(), moab::TreeNodePrinter::print_geometry(), moab::SmoothFace::project_to_facets(), moab::SmoothFace::project_to_patch(), moab::AffineXform::rotation(), moab::SmoothCurve::u_from_position(), v_quad_distortion(), v_quad_maximum_angle(), v_quad_minimum_angle(), v_quad_scaled_jacobian(), v_tet_aspect_beta(), v_tet_quality(), v_tet_radius_ratio(), v_tri_quality(), and v_tri_scaled_jacobian().

◆ length_squared()

◆ normalize()

void normalize ( double  vec[])
inline

Definition at line 27 of file v_vector.h.

28 {
29  double x = sqrt( vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2] );
30 
31  vec[0] /= x;
32  vec[1] /= x;
33  vec[2] /= x;
34 }

Referenced by moab::Coupler::interpolate(), moab::DataCoupler::interpolate(), v_quad_quality(), v_quad_skew(), and v_quad_warpage().