17 std::vector<std::vector<int>> face_node_mappings,
23 GetVertexLocations(grid, cell),
24 std::move(face_node_mappings),
26 volume_quadrature_(volume_quadrature),
27 surface_quadrature_(surface_quadrature)
40std::vector<std::vector<int>>
43 const size_t num_faces = cell.
faces_.size();
44 std::vector<std::vector<int>> mappings;
45 mappings.reserve(num_faces);
46 for (
auto& face : cell.
faces_)
48 std::vector<int> face_dof_mapping;
49 face_dof_mapping.reserve(face.vertex_ids_.size());
50 for (uint64_t fvid : face.vertex_ids_)
53 for (
size_t ci = 0; ci < cell.
vertex_ids_.size(); ci++)
57 mapping =
static_cast<int>(ci);
67 face_dof_mapping.push_back(mapping);
70 mappings.push_back(face_dof_mapping);
75std::vector<chi_mesh::Vector3>
79 std::vector<chi_mesh::Vector3> verts;
95 return {nat_xyz[0], nat_xyz[1], nat_xyz[2]};
106 std::vector<double>& shape_values)
const
110 shape_values.clear();
112 shape_values.push_back(
RefShape(i, natural_xyz));
124 std::vector<chi_mesh::Vector3>& gradshape_values)
const
128 gradshape_values.clear();
130 gradshape_values.push_back(
RefGradShape(i, natural_xyz));
136 typedef std::vector<Vec3>
VecVec3;
140 std::vector<unsigned int> quadrature_point_indices;
142 std::vector<VecDbl> shape_value;
143 std::vector<VecVec3> shape_grad;
146 quadrature_point_indices.reserve(num_qpoints);
147 for (
unsigned int qp = 0; qp < num_qpoints; ++qp)
148 quadrature_point_indices.push_back(qp);
150 JxW.assign(num_qpoints, 0.0);
153 qpoints_xyz.assign(num_qpoints,
Vec3{0.0, 0.0, 0.0});
155 for (uint32_t qp : quadrature_point_indices)
167 const double ref_shape_i =
RefShape(i, qpoint);
168 shape_value[i][qp] = ref_shape_i;
170 const VecDbl b = {ref_shape_grad.
x, ref_shape_grad.
y, ref_shape_grad.
z};
173 shape_grad[i][qp] = {JTInv_b[0], JTInv_b[1], JTInv_b[2]};
177 qpoints_xyz[qp] += ref_shape_i * node_xyz;
201 typedef std::vector<Vec3>
VecVec3;
202 const size_t num_qpoints = surface_quadrature.qpoints_.size();
205 std::vector<unsigned int> quadrature_point_indices;
207 std::vector<VecDbl> shape_value;
208 std::vector<VecVec3> shape_grad;
212 quadrature_point_indices.reserve(num_qpoints);
213 for (
unsigned int qp = 0; qp < num_qpoints; ++qp)
214 quadrature_point_indices.push_back(qp);
216 JxW.assign(num_qpoints, 0.0);
217 normals.assign(num_qpoints,
Vec3{0.0, 0.0, 0.0});
220 qpoints_xyz.assign(num_qpoints,
Vec3{0.0, 0.0, 0.0});
222 const size_t f = face_index;
223 for (uint32_t qp : quadrature_point_indices)
225 const Vec3& qpoint_face = surface_quadrature.qpoints_[qp];
231 const auto [detJ, qp_normal] =
234 normals[qp] = qp_normal;
236 JxW[qp] = detJ * surface_quadrature.weights_[qp];
240 const double ref_shape_i =
RefShape(i, qpoint);
241 shape_value[i][qp] = ref_shape_i;
243 const VecDbl b = {ref_shape_grad.
x, ref_shape_grad.
y, ref_shape_grad.
z};
246 shape_grad[i][qp] = {JTInv_b[0], JTInv_b[1], JTInv_b[2]};
250 qpoints_xyz[qp] += ref_shape_i * node_xyz;
264std::pair<double, LagrangeBaseMapping::Vec3>
266 const Vec3& qpoint_face)
const
273 : cell_mapping_(cell_mapping), world_x_(world_x)
276 const auto cell_type = cell.
Type();
293 for (uint32_t i = 0; i < num_nodes; ++i)
296 result_vec3 -=
Vec3(0.0, 0.0, shape_i_val * node_x[i].z);
299 for (uint32_t i = 0; i < num_nodes; ++i)
303 Vec3(shape_i_val * node_x[i].x, shape_i_val * node_x[i].y, 0.0);
306 for (uint32_t i = 0; i < num_nodes; ++i)
309 return {result_vec3.
x, result_vec3.
y, result_vec3.
z};
#define ChiLogicalError(message)
std::vector< VecDbl > MatDbl
std::vector< double > VecDbl
static void Exit(int error_code)
const std::vector< std::vector< int > > face_node_mappings_
const std::vector< chi_mesh::Vector3 > node_locations_
const chi_mesh::Cell & ReferenceCell() const
const std::vector< chi_mesh::Vector3 > & GetNodeLocations() const
std::vector< chi_math::QuadraturePointXYZ > qpoints_
std::vector< double > weights_
virtual Vec3 RefGradShape(uint32_t i, const Vec3 &qpoint) const =0
static std::vector< chi_mesh::Vector3 > GetVertexLocations(const chi_mesh::MeshContinuum &grid, const chi_mesh::Cell &cell)
virtual double RefShape(uint32_t i, const Vec3 &qpoint) const =0
std::vector< double > VecDbl
const Quadrature & volume_quadrature_
void GradShapeValues(const chi_mesh::Vector3 &xyz, std::vector< chi_mesh::Vector3 > &gradshape_values) const override
LagrangeBaseMapping(const chi_mesh::MeshContinuum &grid, const chi_mesh::Cell &cell, size_t num_nodes, std::vector< std::vector< int > > face_node_mappings, const Quadrature &volume_quadrature, const Quadrature &surface_quadrature)
finite_element::SurfaceQuadraturePointData MakeSurfaceQuadraturePointData(size_t face_index) const override
virtual const Quadrature & GetSurfaceQuadrature(size_t face_index) const
virtual std::pair< double, Vec3 > RefFaceJacobianDeterminantAndNormal(size_t face_index, const Vec3 &qpoint_face) const
static std::vector< std::vector< int > > MakeFaceNodeMapping(const chi_mesh::Cell &cell)
finite_element::VolumetricQuadraturePointData MakeVolumetricQuadraturePointData() const override
virtual MatDbl RefJacobian(const Vec3 &qpoint) const =0
void ShapeValues(const chi_mesh::Vector3 &xyz, std::vector< double > &shape_values) const override
double ShapeValue(int i, const chi_mesh::Vector3 &xyz) const override
chi_mesh::Vector3 GradShapeValue(int i, const chi_mesh::Vector3 &xyz) const override
const Quadrature & surface_quadrature_
virtual Vec3 FaceToElementQPointConversion(size_t face_index, const Vec3 &qpoint_face) const =0
Vec3 MapWorldXYZToNaturalXYZ(const Vec3 &world_xyz) const
WorldXYZToNaturalMappingHelper(const LagrangeBaseMapping &cell_mapping, const Vec3 &world_x)
VecDbl F(const VecDbl &x) const override
const LagrangeBaseMapping & cell_mapping_
MatDbl J(const VecDbl &x) const override
std::vector< CellFace > faces_
std::vector< uint64_t > vertex_ids_
std::vector< chi_mesh::Vector3 > VecVec3
MatDbl Inverse(const MatDbl &A)
double Determinant(const MatDbl &A)
VecDbl NewtonIteration(const NonLinearFunction &non_linear_function, const VecDbl &x_0, unsigned int max_iters, double epsilon, bool verbose=false)
MatDbl Transpose(const MatDbl &A)
MatDbl MatMul(const MatDbl &A, const double c)