Chi-Tech
UnitIntegralContainer.cc
Go to the documentation of this file.
2
5
6#include "mesh/Cell/cell.h"
7
8namespace chi_diffusion
9{
10
12 MatDbl IntV_gradShapeI_gradShapeJ,
13 MatVec3 IntV_shapeI_gradshapeJ,
14 MatDbl IntV_shapeI_shapeJ,
15 VecDbl IntV_shapeI,
16 VecVec3 IntV_gradshapeI,
17 std::vector<MatDbl> IntS_shapeI_shapeJ,
18 std::vector<VecDbl> IntS_shapeI,
19 std::vector<MatVec3> IntS_shapeI_gradshapeJ,
20 std::vector<std::vector<int>> face_dof_mappings,
21 size_t num_nodes)
22 : IntV_gradShapeI_gradShapeJ_(std::move(IntV_gradShapeI_gradShapeJ)),
23 IntV_shapeI_gradshapeJ_(std::move(IntV_shapeI_gradshapeJ)),
24 IntV_shapeI_shapeJ_(std::move(IntV_shapeI_shapeJ)),
25 IntV_shapeI_(std::move(IntV_shapeI)),
26 IntV_gradshapeI_(std::move(IntV_gradshapeI)),
27 IntS_shapeI_shapeJ_(std::move(IntS_shapeI_shapeJ)),
28 IntS_shapeI_(std::move(IntS_shapeI)),
29 IntS_shapeI_gradshapeJ_(std::move(IntS_shapeI_gradshapeJ)),
30 face_dof_mappings_(std::move(face_dof_mappings)),
31 num_nodes_(num_nodes)
32{
33}
34
37{
40
41 VolQPData internal_data = cell_mapping.MakeVolumetricQuadraturePointData();
42 std::vector<FaceQPData> faces_qp_data;
43 for (size_t f = 0; f < cell_mapping.ReferenceCell().faces_.size(); ++f)
44 faces_qp_data.push_back(cell_mapping.MakeSurfaceQuadraturePointData(f));
45
46 const auto n_dof_per_cell = internal_data.NumNodes();
47
48 MatDbl IntV_gradshapeI_gradshapeJ(n_dof_per_cell, VecDbl(n_dof_per_cell));
49 MatVec3 IntV_shapeI_gradshapeJ(n_dof_per_cell, VecVec3(n_dof_per_cell));
50 MatDbl IntV_shapeI_shapeJ(n_dof_per_cell, VecDbl(n_dof_per_cell));
51 VecDbl IntV_shapeI(n_dof_per_cell);
52 VecVec3 IntV_gradshapeI(n_dof_per_cell);
53
54 std::vector<MatDbl> IntS_shapeI_shapeJ(faces_qp_data.size());
55 std::vector<VecDbl> IntS_shapeI(faces_qp_data.size());
56 std::vector<MatVec3> IntS_shapeI_gradshapeJ(faces_qp_data.size());
57
58 // volume integrals
59 for (unsigned int i = 0; i < n_dof_per_cell; ++i)
60 {
61 for (unsigned int j = 0; j < n_dof_per_cell; ++j)
62 {
63 for (const auto& qp : internal_data.QuadraturePointIndices())
64 {
65 IntV_gradshapeI_gradshapeJ[i][j] +=
66 internal_data.ShapeGrad(i, qp).Dot(internal_data.ShapeGrad(j, qp)) *
67 internal_data.JxW(qp);
68
69 IntV_shapeI_gradshapeJ[i][j] += internal_data.ShapeValue(i, qp) *
70 internal_data.ShapeGrad(j, qp) *
71 internal_data.JxW(qp);
72
73 IntV_shapeI_shapeJ[i][j] += internal_data.ShapeValue(i, qp) *
74 internal_data.ShapeValue(j, qp) *
75 internal_data.JxW(qp);
76 } // for qp
77 } // for j
78
79 for (const auto& qp : internal_data.QuadraturePointIndices())
80 {
81 IntV_shapeI[i] += internal_data.ShapeValue(i, qp) * internal_data.JxW(qp);
82
83 IntV_gradshapeI[i] +=
84 internal_data.ShapeGrad(i, qp) * internal_data.JxW(qp);
85 } // for qp
86 } // for i
87
88 // surface integrals
89 for (size_t f = 0; f < faces_qp_data.size(); ++f)
90 {
91 IntS_shapeI_shapeJ[f].resize(n_dof_per_cell, VecDbl(n_dof_per_cell));
92 IntS_shapeI[f].resize(n_dof_per_cell);
93 IntS_shapeI_gradshapeJ[f].resize(n_dof_per_cell, VecVec3(n_dof_per_cell));
94
95 for (unsigned int i = 0; i < n_dof_per_cell; ++i)
96 {
97 for (unsigned int j = 0; j < n_dof_per_cell; ++j)
98 {
99 for (const auto& qp : faces_qp_data[f].QuadraturePointIndices())
100 {
101 IntS_shapeI_shapeJ[f][i][j] += faces_qp_data[f].ShapeValue(i, qp) *
102 faces_qp_data[f].ShapeValue(j, qp) *
103 faces_qp_data[f].JxW(qp);
104
105 IntS_shapeI_gradshapeJ[f][i][j] +=
106 faces_qp_data[f].ShapeValue(i, qp) *
107 faces_qp_data[f].ShapeGrad(j, qp) * faces_qp_data[f].JxW(qp);
108 } // for qp
109 } // for j
110
111 for (const auto& qp : faces_qp_data[f].QuadraturePointIndices())
112 {
113 IntS_shapeI[f][i] +=
114 faces_qp_data[f].ShapeValue(i, qp) * faces_qp_data[f].JxW(qp);
115 } // for qp
116 } // for i
117 } // for f
118
119 // unit integral data
120 UnitIntegralContainer ui_data(IntV_gradshapeI_gradshapeJ,
128 cell_mapping.GetFaceNodeMappings(),
129 n_dof_per_cell);
130
131 return ui_data;
132}
133
135 unsigned int j) const
136{
137 double value;
138 auto& row_I = IntV_gradShapeI_gradShapeJ_.at(i);
139 value = row_I.at(j);
140 return value;
141}
144 unsigned int j) const
145{
146 chi_mesh::Vector3 value;
147 auto& row_I = IntV_shapeI_gradshapeJ_.at(i);
148 value = row_I.at(j);
149 return value;
150}
152 unsigned int j) const
153{
154 double value;
155 auto& row_I = IntV_shapeI_shapeJ_.at(i);
156 value = row_I.at(j);
157 return value;
158}
159double UnitIntegralContainer::IntV_shapeI(unsigned int i) const
160{
161 double value = IntV_shapeI_.at(i);
162 return value;
163}
165{
166 chi_mesh::Vector3 value;
167 value = IntV_gradshapeI_.at(i);
168 return value;
169}
171 unsigned int i,
172 unsigned int j) const
173{
174 double value;
175 auto& face_data = IntS_shapeI_shapeJ_.at(face);
176 auto& rowI = face_data.at(i);
177 value = rowI.at(j);
178 return value;
179}
180
181double UnitIntegralContainer::IntS_shapeI(unsigned int face,
182 unsigned int i) const
183{
184 double value;
185 auto& face_data = IntS_shapeI_.at(face);
186 value = face_data.at(i);
187 return value;
188}
189
191 unsigned int face, unsigned int i, unsigned int j) const
192{
193 chi_mesh::Vector3 value;
194 auto& face_data = IntS_shapeI_gradshapeJ_.at(face);
195 auto& rowI = face_data.at(i);
196 value = rowI.at(j);
197 return value;
198}
199
200} // namespace chi_diffusion
UnitIntegralContainer(MatDbl IntV_gradShapeI_gradShapeJ, MatVec3 IntV_shapeI_gradshapeJ, MatDbl IntV_shapeI_shapeJ, VecDbl IntV_shapeI, VecVec3 IntV_gradshapeI, std::vector< MatDbl > IntS_shapeI_shapeJ, std::vector< VecDbl > IntS_shapeI, std::vector< MatVec3 > IntS_shapeI_gradshapeJ, std::vector< std::vector< int > > face_dof_mappings, size_t num_nodes)
static UnitIntegralContainer Make(const chi_math::CellMapping &cell_mapping)
chi_mesh::Vector3 IntV_shapeI_gradshapeJ(unsigned int i, unsigned int j) const
chi_mesh::Vector3 IntV_gradshapeI(unsigned int i) const
double IntV_shapeI(unsigned int i) const
double IntV_shapeI_shapeJ(unsigned int i, unsigned int j) const
chi_mesh::Vector3 IntS_shapeI_gradshapeJ(unsigned int face, unsigned int i, unsigned int j) const
double IntV_gradShapeI_gradShapeJ(unsigned int i, unsigned int j) const
std::vector< chi_mesh::Vector3 > VecVec3
double IntS_shapeI(unsigned int face, unsigned int i) const
std::vector< MatVec3 > IntS_shapeI_gradshapeJ_
double IntS_shapeI_shapeJ(unsigned int face, unsigned int i, unsigned int j) const
const std::vector< std::vector< int > > & GetFaceNodeMappings() const
Definition: CellMapping.cc:41
virtual finite_element::VolumetricQuadraturePointData MakeVolumetricQuadraturePointData() const =0
virtual finite_element::SurfaceQuadraturePointData MakeSurfaceQuadraturePointData(size_t face_index) const =0
const chi_mesh::Cell & ReferenceCell() const
Definition: CellMapping.cc:27