13 boost::shared_ptr<MatrixDouble> base_mass_ptr,
14 boost::shared_ptr<EntitiesFieldData> data_l2,
17 verbosity(verb), severityLevel(sev), baseMassPtr(base_mass_ptr),
25 if (
dataL2->dataOnEntities[MBVERTEX].size() != 1) {
26 dataL2->dataOnEntities[MBVERTEX].clear();
27 dataL2->dataOnEntities[MBVERTEX].push_back(
30 if (
dataL2->dataOnEntities[fe_type].size() != 1) {
31 dataL2->dataOnEntities[fe_type].clear();
35 auto &vertex_data =
dataL2->dataOnEntities[MBVERTEX][0];
36 vertex_data.getNSharedPtr(
NOBASE) =
37 fe_ptr->getEntData(
H1, MBVERTEX, 0).getNSharedPtr(
NOBASE);
38 vertex_data.getDiffNSharedPtr(
NOBASE) =
39 fe_ptr->getEntData(
H1, MBVERTEX, 0).getDiffNSharedPtr(
NOBASE);
41 auto &ent_data =
dataL2->dataOnEntities[fe_type][0];
42 ent_data.getSense() = 1;
43 ent_data.getSpace() =
L2;
44 ent_data.getBase() =
base;
45 ent_data.getOrder() = get_order();
47 CHKERR fe_ptr->getElementPolynomialBase()->getValue(
48 getGaussPts(), boost::make_shared<EntPolynomialBaseCtx>(
57 auto &ent_data =
dataL2->dataOnEntities[fe_type][0];
58 auto &base_funcions = ent_data.getN(
base);
59 const auto nb = base_funcions.size2();
63 const auto nb_integration_pts =
getGaussPts().size2();
68 "Mass matrix is null pointer");
72 nN.resize(nb, nb,
false);
77 auto t_row_base = ent_data.getFTensor0N();
79 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
81 const double alpha = t_w;
83 for (
int rr = 0; rr != nb; ++rr) {
86 auto a_mat_ptr = &nN(rr, 0);
88 auto t_col_base = ent_data.getFTensor0N(gg, 0);
90 for (
int cc = 0; cc <= rr; ++cc) {
92 *a_mat_ptr += alpha * (t_row_base * t_col_base);
114 "Space should be set to L2");
118 [
this]() {
return std::max(0, getPtrFE()->getMaxDataOrder() - 1); });
125 boost::shared_ptr<EntitiesFieldData> data_l2,
126 boost::shared_ptr<MatrixDouble> inv_jac_ptr)
136 return applyTransform<2, 2, 2, 2>(diff_n);
139 const auto fe_type = getFEType();
140 auto &ent_data = dataL2->dataOnEntities[fe_type][0];
141 CHKERR apply_transform(ent_data.getDiffN());
147 int derivative, boost::shared_ptr<MatrixDouble> base_mass_ptr,
148 boost::shared_ptr<EntitiesFieldData> data_l2,
151 calcBaseDerivative(derivative) {
153 doEntities[MBVERTEX] =
false;
156 template <
int BASE_DIM,
int SPACE_DIM>
162 const int nb_gauss_pts = data.
getN(base).size1();
163 const int nb_approx_bases = data.
getN(base).size2() /
BASE_DIM;
164 const int nb_derivatives =
167 const int nb_prj_bases = ent_data.
getN().size2();
171 if (!n_diff_shared_ptr)
172 n_diff_shared_ptr = boost::make_shared<MatrixDouble>();
174 auto &nex_diff_base = *(n_diff_shared_ptr);
176 nex_diff_base.resize(nb_gauss_pts, nb_approx_bases * next_nb_derivatives,
178 nex_diff_base.clear();
181 auto next_diffs_ptr = &*nex_diff_base.data().begin();
182 auto t_next_diff = getFTensor1FromPtr<SPACE_DIM>(next_diffs_ptr);
184 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
186 auto ptr = &*nF.data().begin();
188 for (
auto r = 0;
r != nb_approx_bases * nb_derivatives; ++
r) {
191 for (
int rr = 0; rr != nb_prj_bases; ++rr) {
192 t_next_diff(
i) += l2_diff_base(
i) * (*ptr);
204 template <
int BASE_DIM>
210 auto &approx_base = data.
getN(base);
211 const auto nb_approx_bases = approx_base.size2() /
BASE_DIM;
213 if (nb_approx_bases) {
215 const auto fe_type = getFEType();
216 const auto nb_integration_pts = approx_base.size1();
218 const auto space_dim =
222 int nb_derivatives =
BASE_DIM * pow(space_dim, calcBaseDerivative - 1);
224 auto &ent_data = dataL2->dataOnEntities[fe_type][0];
225 const int nb_prj_bases = ent_data.getN().size2();
230 "Mass matrix is null pointer");
232 auto &nN = *baseMassPtr;
235 if (diff_approx_base.size2() != nb_approx_bases * nb_derivatives) {
237 "Number of derivatives and basses do not match");
239 if (ent_data.getN().size1() != nb_integration_pts) {
241 "Number of integration points is not consistent");
243 if (nN.size2() != nb_prj_bases) {
245 "Number of base functions and size of mass matrix does not math");
249 nF.resize(nb_approx_bases * nb_derivatives, nb_prj_bases,
false);
252 auto t_w = getFTensor0IntegrationWeight();
255 auto diff_base_ptr = &*diff_approx_base.data().begin();
257 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
259 const double alpha = t_w;
261 for (
int r = 0;
r != nb_approx_bases * nb_derivatives; ++
r) {
264 auto t_base = ent_data.getFTensor0N(base, gg, 0);
265 for (
int rr = 0; rr != nb_prj_bases; ++rr) {
266 nF(
r, rr) += alpha * (t_base * (*diff_base_ptr));
276 for (
auto r = 0;
r != nb_approx_bases * nb_derivatives; ++
r) {
277 ublas::matrix_row<MatrixDouble> mc(nF,
r);
282 CHKERR setBaseImpl<BASE_DIM, 3>(data, ent_data);
283 else if (space_dim == 2)
284 CHKERR setBaseImpl<BASE_DIM, 2>(data, ent_data);
289 "Space dim can be only 1,2,3 but is %d", space_dim);
298 return doWorkImpl<1>(side,
type, data);
304 return doWorkImpl<3>(side,
type, data);