12 #include "gtest/gtest.h" 16 const double tol = 1e-8;
17 const double eps = 1e-9;
24 const Real start_r = (nrings - 1) *
pitch;
26 const Real startx = start_r * std::cos(theta0);
27 const Real starty = start_r * std::sin(theta0);
28 for (
int i = 0; i < nrings; i++)
30 int n_rods_in_row = nrings + i;
31 const Real y = starty - i *
pitch * std::sin(theta0);
32 const Real x_row = startx + i *
pitch * std::cos(theta0);
33 for (
int j = 0;
j < n_rods_in_row;
j++)
46 if (std::abs(
x) <
eps && std::abs(
y) <
eps)
49 double diff = std::abs(
x -
y);
52 double largest = (
y >
x) ?
y :
x;
53 return diff <= largest *
tol;
59 for (
int i = 0; i < LIBMESH_DIM; i++)
68 TEST(MeshTests, triRodCoordinates)
75 std::vector<Point> positions;
77 std::sort(positions.begin(), positions.end(),
pointLess);
79 std::vector<Point> positions2;
81 std::sort(positions2.begin(), positions2.end(),
pointLess);
83 ASSERT_EQ(positions.size(), positions2.size());
85 std::stringstream msg;
86 for (
size_t i = 0; i < positions.size(); i++)
88 msg <<
"point " << i + 1 <<
" differs: " << positions[i] <<
" != " << positions2[i] <<
"\n";
90 if (msg.str().size() > 0)
void triRodPositionsRef(std::vector< Point > &positions, Real nrings, Real pitch, Point center)
TEST(MeshTests, triRodCoordinates)
const std::vector< double > y
bool pointLess(const Point &a, const Point &b)
const std::vector< double > x
static const std::string pitch
static void rodPositions(std::vector< Point > &positions, unsigned int nrings, Real pitch, Point center)
Calculates and stores the pin positions/centers for a hexagonal assembly containing the given number ...
bool absolute_fuzzy_equals(const T &var1, const T2 &var2, const Real tol=TOLERANCE *TOLERANCE)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
static const std::string center
bool relativeEq(double x, double y)