oomph::NodeOrdering Namespace Reference

Functions

bool node_global_position_comparison (Node *nd1_pt, Node *nd2_pt)
 

Detailed Description

///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////

Function Documentation

◆ node_global_position_comparison()

bool oomph::NodeOrdering::node_global_position_comparison ( Node nd1_pt,
Node nd2_pt 
)
inline

Function for ordering nodes. Return true if first node's position is "before" second nodes. Dimension 0 checked first, then... until they are different (by more than tol=1e-10). If they are both in exactly the same place an error is thrown.

2919  {
2920  unsigned ndim = nd1_pt->ndim();
2921 
2922  unsigned j;
2923  for (j = 0; j < ndim; j++)
2924  {
2925  if (std::abs(nd1_pt->x(j) - nd2_pt->x(j)) > 1e-10)
2926  {
2927  if (nd1_pt->x(j) < nd2_pt->x(j))
2928  {
2929  return true;
2930  }
2931  else
2932  {
2933  return false;
2934  }
2935  }
2936  // otherwise they are the same in this dimension, check next one.
2937  }
2938 
2939  std::string err = "Nodes are at the same point to ~ 1e-10!";
2940  err += " difference is " +
2941  StringConversion::to_string(std::abs(nd1_pt->x(j) - nd2_pt->x(j)));
2942  throw OomphLibError(
2944  }
AnnoyingScalar abs(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:135
Array< double, 1, 3 > e(1./3., 0.5, 2.)
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
std::string to_string(T object, unsigned float_precision=8)
Definition: oomph_utilities.h:189
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References abs(), e(), j, oomph::Node::ndim(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::Global_string_for_annotation::string(), oomph::StringConversion::to_string(), and oomph::Node::x().

Referenced by oomph::Mesh::get_node_reordering().