2 #include "../../tessellation/triangle_area.hpp" 4 PhysicalGeometry::~PhysicalGeometry(
void) {}
16 const Vector2D anchor = edge_list[0].vertices.first;
17 for(
size_t i=1;i<edge_list.size();++i)
19 edge_list[i].vertices.second);
27 for (
size_t i = 0; i < chull.size()-1; ++i)
31 res += dv*0.3333333333*
Vector2D(chull[0].x + chull[i].x + chull[i + 1].x, chull[0].y + chull[i].y + chull[i + 1].y);
41 for(
size_t i=1;i<chull.size()-1;++i)
48 origin(origin_i), direction(direction_i/
abs(direction_i)) {}
64 axis_(origin,direction) {}
70 return M_PI*(p1.
y+p2.
y)*sqrt((p2.
y - p1.
y )*(p2.
y - p1.
y )+ (p2.
x - p1.
x)*(p2.
x - p1.
x));
74 double calc_cone_segment_volume(
const Vector2D& p1,
78 const Vector2D q1 = change_coordinate(p1, axis);
79 const Vector2D q2 = change_coordinate(p2, axis);
80 return (M_PI/3.)*(q2.
x-q1.
x)*(q1.
y*q1.
y+ q2.
y *q2.
y +q1.
y*q2.
y);
83 double calc_triangular_ring_volume(
const Vector2D& p1,
88 return std::abs(calc_cone_segment_volume(p1,p2,axis)+
89 calc_cone_segment_volume(p2,p3,axis)+
90 calc_cone_segment_volume(p3,p1,axis));
97 const Vector2D anchor = edge_list[0].vertices.first;
98 for(
size_t i=1;i<edge_list.size();++i)
99 res += calc_triangular_ring_volume(anchor,
100 edge_list[i].vertices.first,
101 edge_list[i].vertices.second,
110 Vector2D anchor = change_coordinate(chull[0], axis_);
111 for (
size_t i = 1; i < chull.size() - 1; ++i)
113 Vector2D q1 = change_coordinate(chull[i], axis_);
114 Vector2D q2 = change_coordinate(chull[i+1], axis_);
117 res += dv*
Vector2D((2 * anchor.
x*anchor.
y + q1.
x*anchor.
y + q2.
x*anchor.
y + q1.
y*anchor.
x + q1.
y*q1.
x * 2 + q1.
y*q2.
x 118 + q2.
y*anchor.
x + q2.
y*q1.
x + 2 * q2.
x*q2.
y) / 12.0, (anchor.
y*anchor.
y + anchor.
y*q1.
y + anchor.
y*q2.
y 119 + q1.
y*q2.
y + q1.
y*q1.
y + q2.
y*q2.
y) / 6.0);
121 double realV = calcVolume(chull);
122 res *= 2*M_PI / realV;
125 Vector2D res2(res.
x*axis_.direction.x+res.
y*perp.
x, res.
y*perp.
y+res.
x*axis_.direction.y);
133 for(
size_t i=1;i<chull.size()-1;++i)
134 res += calc_triangular_ring_volume(anchor,
double calcArea(const Edge &edge) const
Calculates the physical area of an edge.
Vector3D CrossProduct(Vector3D const &v1, Vector3D const &v2)
Returns the cross product of two vectors.
Interface between two cells.
Vector2D calcCentroid(const vector< Vector2D > &chull) const
Calculates the centroid of a cell.
Vector2D calcCentroid(const vector< Vector2D > &chull) const
Calculates the centroid of a cell.
double y
Component in the y direction.
const Axis & getAxis(void) const
Returns the axis of revolution.
double calcVolume(const vector< Edge > &edge_list) const
Calculates the physical volume of a cell.
double calcVolume(const vector< Edge > &edge_list) const
Calculates the physical volume of a cell.
double ScalarProd(Vector3D const &v1, Vector3D const &v2)
Scalar product of two vectors.
Axis(const Vector2D &origin_i, const Vector2D &direction_i)
Class constructor.
std::pair< Vector2D, Vector2D > vertices
Points at the ends of the edge.
const Vector2D direction
Positive direction of the axis.
double calcArea(const Edge &edge) const
Calculates the physical area of an edge.
double calc_triangle_area(const Vector2D &p1, const Vector2D &p2, const Vector2D &p3)
Calculates the area of a triangle.
SlabSymmetry(void)
Class constructor.
Physical geometry of the grid.
double abs(Vector3D const &v)
Norm of a vector.
const Vector2D origin
Origin of the axis.
double x
Component in the x direction.
Vector2D zcross(Vector2D const &v)
Cross product of a vector in x,y plane with a unit vector in the z direction.
CylindricalSymmetry(const Vector2D &origin, const Vector2D &direction)
Class constructor.