9 std::array<chi_mesh::Vertex,4>& vertices_xyz)
11 const auto num_verts = 4;
15 for (
auto& v : vertices_xyz)
17 centroid_xyz /= num_verts;
23 for (
int v=0; v<num_verts; ++v)
25 auto v1 = vertices_xyz[v];
26 auto v2 = vertices_xyz[(v < (num_verts-1))? v+1 : 0];
28 if ((v1-v0).Cross(v2-v0).Dot(v0) < 0.0)
47 double mu = std::max(-1.0,std::fmin(1.0,bAB.Dot(bAC)));
49 return std::fabs(acos(mu));
52 double excess = GetSphericalExcess(v0,v1,v2) +
53 GetSphericalExcess(v1,v2,v0) +
54 GetSphericalExcess(v2,v0,v1);
56 area += excess - M_PI;
69 const std::vector<chi_math::QuadraturePointXYZ>& legendre_qpoints,
70 const std::vector<double>& legendre_qweights)
76 return shape_coeffs[0] + shape_coeffs[1]*mu_eta_xi[0] +
77 shape_coeffs[2]*mu_eta_xi[1] +
78 shape_coeffs[3]*mu_eta_xi[2];
82 double x_tilde_max = 0.0;
83 double x_tilde_min = 1.0;
84 double y_tilde_max = 0.0;
85 double y_tilde_min = 1.0;
89 x_tilde_max = std::fmax(x_tilde_max,v.x);
90 x_tilde_min = std::fmin(x_tilde_min,v.x);
91 y_tilde_max = std::fmax(y_tilde_max,v.y);
92 y_tilde_min = std::fmin(y_tilde_min,v.y);
96 std::array<double,4> integral = {0.0,0.0,0.0,0.0};
97 int Nq = legendre_qpoints.size();
98 double dx_tilde = (x_tilde_max - x_tilde_min);
99 double dy_tilde = (y_tilde_max - y_tilde_min);
101 for (
int i=0; i<Nq; ++i)
103 for (
int j=0; j<Nq; ++j)
106 double x_tilde = x_tilde_min + (1.0 + legendre_qpoints[j][0])*dx_tilde/2.0;
107 double y_tilde = y_tilde_min + (1.0 + legendre_qpoints[i][0])*dy_tilde/2.0;
114 double r = sqrt(x_tilde*x_tilde + y_tilde*y_tilde + a*a);
115 double detJ = (a/(r*r*r))*dx_tilde*dy_tilde/4.0;
118 for (
int k=0; k<4; ++k)
119 integral[k] += EvaluateShapeFunction(shape_coeffs[k], xyz)*detJ*
120 legendre_qweights[i]*legendre_qweights[j];
131 deployed_SQs_.clear();
132 deployed_SQs_.reserve(initial_octant_SQs_.size() * 8);
138 for (
auto& sq : initial_octant_SQs_)
139 deployed_SQs_.push_back(sq);
143 for (
auto& sq : initial_octant_SQs_)
147 for (
auto& xyz : new_sq.
vertices_xyz) xyz = xyz*octant_mod;
152 deployed_SQs_.push_back(new_sq);
157 for (
auto& sq : initial_octant_SQs_)
161 for (
auto& xyz : new_sq.
vertices_xyz) xyz = xyz*octant_mod;
166 deployed_SQs_.push_back(new_sq);
171 for (
auto& sq : initial_octant_SQs_)
175 for (
auto& xyz : new_sq.
vertices_xyz) xyz = xyz*octant_mod;
180 deployed_SQs_.push_back(new_sq);
185 for (
auto& sq : initial_octant_SQs_)
189 for (
auto& xyz : new_sq.
vertices_xyz) xyz = xyz*octant_mod;
194 deployed_SQs_.push_back(new_sq);
199 for (
auto& sq : initial_octant_SQs_)
203 for (
auto& xyz : new_sq.
vertices_xyz) xyz = xyz*octant_mod;
208 deployed_SQs_.push_back(new_sq);
213 for (
auto& sq : initial_octant_SQs_)
217 for (
auto& xyz : new_sq.
vertices_xyz) xyz = xyz*octant_mod;
222 deployed_SQs_.push_back(new_sq);
227 for (
auto& sq : initial_octant_SQs_)
231 for (
auto& xyz : new_sq.
vertices_xyz) xyz = xyz*octant_mod;
236 deployed_SQs_.push_back(new_sq);
240 deployed_SQs_history_.push_back(deployed_SQs_);
251 for (
const auto& sq : deployed_SQs_)
253 for (
int i=0;i<4;++i)
255 const auto& omega = sq.sub_sqr_points[i];
256 const double weight = sq.sub_sqr_weights[i];
258 double theta = acos(omega.z);
259 double phi = acos(omega.x/sin(theta));
261 if (omega.y/sin(theta)<0.0)
262 phi = 2.0*M_PI - phi;
266 abscissae_.push_back(abscissa);
267 weights_.push_back(weight);
268 omegas_.push_back(omega);
static double ComputeSphericalQuadrilateralArea(std::array< chi_mesh::Vertex, 4 > &vertices_xyz)
void PopulateQuadratureAbscissae()
static std::array< double, 4 > IntegrateLDFEShapeFunctions(const SphericalQuadrilateral &sq, std::array< chi_math::DynamicVector< double >, 4 > &shape_coeffs, const std::vector< chi_math::QuadraturePointXYZ > &legendre_qpoints, const std::vector< double > &legendre_qweights)
std::array< chi_mesh::Vertex, 4 > vertices_xy_tilde
On square.
chi_mesh::Vertex centroid_xyz
chi_mesh::Vector3 translation_vector
std::array< chi_mesh::Vector3, 4 > sub_sqr_points
chi_mesh::Matrix3x3 rotation_matrix
chi_mesh::Vector3 octant_modifier
std::array< chi_mesh::Vertex, 4 > vertices_xyz
On unit sphere.
Vector3 Cross(const Vector3 &that) const
Vector3 Normalized() const