v0.8.23
ForcesAndSourcesCore.cpp
Go to the documentation of this file.
1 /** \file ForcesAndSourcesCore.cpp
2 
3 \brief Implementation of Elements on Entities for Forces and Sources
4 
5 */
6 
7 /* This file is part of MoFEM.
8  * MoFEM is free software: you can redistribute it and/or modify it under
9  * the terms of the GNU Lesser General Public License as published by the
10  * Free Software Foundation, either version 3 of the License, or (at your
11  * option) any later version.
12  *
13  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16  * License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>. */
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 #include <cblas.h>
25 #include <lapack_wrap.h>
26 // #include <gm_rule.h>
27 #ifdef __cplusplus
28 }
29 #endif
30 
31 namespace MoFEM {
32 
34  :
35 
36  mField(m_field),
37  dataOnElement{
38 
39  nullptr,
40  boost::shared_ptr<DataForcesAndSourcesCore>(
41  new DataForcesAndSourcesCore(MBENTITYSET)), // NOFIELD
42  boost::shared_ptr<DataForcesAndSourcesCore>(
43  new DataForcesAndSourcesCore(MBENTITYSET)), // H1
44  boost::shared_ptr<DataForcesAndSourcesCore>(
45  new DataForcesAndSourcesCore(MBENTITYSET)), // HCURL
46  boost::shared_ptr<DataForcesAndSourcesCore>(
47  new DataForcesAndSourcesCore(MBENTITYSET)), // HDIV
48  boost::shared_ptr<DataForcesAndSourcesCore>(
49  new DataForcesAndSourcesCore(MBENTITYSET)) // L2
50 
51  },
52  derivedDataOnElement{
53 
54  nullptr,
55  boost::shared_ptr<DataForcesAndSourcesCore>(
56  new DerivedDataForcesAndSourcesCore(dataOnElement[NOFIELD])),
57  boost::shared_ptr<DataForcesAndSourcesCore>(
58  new DerivedDataForcesAndSourcesCore(dataOnElement[H1])),
59  boost::shared_ptr<DataForcesAndSourcesCore>(
60  new DerivedDataForcesAndSourcesCore(dataOnElement[HCURL])),
61  boost::shared_ptr<DataForcesAndSourcesCore>(
62  new DerivedDataForcesAndSourcesCore(dataOnElement[HDIV])),
63  boost::shared_ptr<DataForcesAndSourcesCore>(
64  new DerivedDataForcesAndSourcesCore(dataOnElement[L2]))
65 
66  },
67  dataNoField(*dataOnElement[NOFIELD].get()),
68  dataH1(*dataOnElement[H1].get()), dataHcurl(*dataOnElement[HCURL].get()),
69  dataHdiv(*dataOnElement[HDIV].get()), dataL2(*dataOnElement[L2].get()),
70  getRuleHook(0), setRuleHook(0),
71  lastEvaluatedElementEntityType(MBMAXTYPE) {}
72 
75 
77  switch (mField.get_moab().type_from_handle(ent)) {
78  case MBVERTEX:
79  num_nodes = 1;
80  break;
81  case MBEDGE:
82  num_nodes = 2;
83  break;
84  case MBTRI:
85  num_nodes = 3;
86  break;
87  case MBQUAD:
88  num_nodes = 4;
89  break;
90  case MBTET:
91  num_nodes = 4;
92  break;
93  case MBPRISM:
94  num_nodes = 6;
95  break;
96  default:
97  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
98  }
99 
101 }
102 
103 // ** Sense **
104 
106  const EntityType type,
107  boost::ptr_vector<DataForcesAndSourcesCore::EntData> &data) const {
109 
110  auto &side_table = numeredEntFiniteElementPtr->getSideNumberTable().get<2>();
111  for (auto r = side_table.equal_range(type); r.first != r.second; ++r.first) {
112 
113  const int side_number = (*r.first)->side_number;
114  const int brother_side_number = (*r.first)->brother_side_number;
115  const int sense = (*r.first)->sense;
116 
117  data[side_number].getSense() = sense;
118  if (brother_side_number != -1)
119  data[brother_side_number].getSense() = sense;
120  }
122 }
123 
124 // ** Order **
125 
126 template <typename ENTMULTIINDEX>
127 static inline int getMaxOrder(const ENTMULTIINDEX &multi_index) {
128  int max_order = 0;
129  for (auto ent_field_weak_ptr : multi_index)
130  if (auto e = ent_field_weak_ptr.lock()) {
131  const int order = e->getMaxOrder();
132  max_order = (max_order < order) ? order : max_order;
133  }
134  return max_order;
135 }
136 
138  int max_order = 0;
139  for (auto e : *dataFieldEntsPtr) {
140  const int order = e->getMaxOrder();
141  max_order = (max_order < order) ? order : max_order;
142  }
143  return max_order;
144 }
145 
147  return getMaxOrder(*rowFieldEntsPtr);
148 }
149 
151  return getMaxOrder(*colFieldEntsPtr);
152 }
153 
155  const EntityType type, const FieldSpace space,
156  boost::ptr_vector<DataForcesAndSourcesCore::EntData> &data) const {
158 
159  auto &side_table = numeredEntFiniteElementPtr->getSideNumberTable();
160 
161  for (unsigned int s = 0; s != data.size(); ++s)
162  data[s].getDataOrder() = 0;
163 
164  auto &fields_ents =
166 
167  for (auto r = fields_ents.equal_range(boost::make_tuple(type, space));
168  r.first != r.second; ++r.first) {
169 
170  auto &e = **r.first;
171 
172  auto sit = side_table.find(e.getEnt());
173  if (sit != side_table.end()) {
174 
175  auto &side = *sit;
176  const int side_number = side->side_number;
177 
178  ApproximationOrder ent_order = e.getMaxOrder();
179  auto &dat = data[side_number];
180  const int order = e.getMaxOrder();
181  dat.getDataOrder() =
182  dat.getDataOrder() > ent_order ? dat.getDataOrder() : ent_order;
183  } else
184  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
185  "Entity on side of the element not found");
186 
187  }
188 
189  for (auto r = side_table.get<2>().equal_range(type); r.first != r.second;
190  ++r.first) {
191  const int brother_side_number = (*r.first)->brother_side_number;
192  if (brother_side_number != -1) {
193  const int side_number = (*r.first)->side_number;
194  data[brother_side_number].getDataOrder() =
195  data[side_number].getDataOrder();
196  }
197  }
198 
200 }
201 
202 // ** Indices **
203 
205  const boost::string_ref field_name, FENumeredDofEntity_multiIndex &dofs,
206  VectorInt &nodes_indices, VectorInt &local_nodes_indices) const {
208  auto &dofs_by_type = dofs.get<Composite_Name_And_Type_mi_tag>();
209  auto tuple = boost::make_tuple(field_name, MBVERTEX);
210  auto dit = dofs_by_type.lower_bound(tuple);
211  auto hi_dit = dofs_by_type.upper_bound(tuple);
212 
213  if (dit != hi_dit) {
214 
215  int num_nodes;
216  CHKERR getNumberOfNodes(num_nodes);
217  int max_nb_dofs = 0;
218  const int nb_dofs_on_vert = (*dit)->getNbOfCoeffs();
219  max_nb_dofs = nb_dofs_on_vert * num_nodes;
220  nodes_indices.resize(max_nb_dofs, false);
221  local_nodes_indices.resize(max_nb_dofs, false);
222  if (std::distance(dit, hi_dit) != max_nb_dofs) {
223  std::fill(nodes_indices.begin(), nodes_indices.end(), -1);
224  std::fill(local_nodes_indices.begin(), local_nodes_indices.end(), -1);
225  }
226 
227  for (; dit != hi_dit; dit++) {
228  auto &dof = **dit;
229  const int idx = dof.getPetscGlobalDofIdx();
230  const int local_idx = dof.getPetscLocalDofIdx();
231  const int side_number = dof.sideNumberPtr->side_number;
232  const int pos = side_number * nb_dofs_on_vert + dof.getDofCoeffIdx();
233  nodes_indices[pos] = idx;
234  local_nodes_indices[pos] = local_idx;
235  const int brother_side_number =
236  (*dit)->sideNumberPtr->brother_side_number;
237  if (brother_side_number != -1) {
238  const int elem_idx =
239  brother_side_number * nb_dofs_on_vert + (*dit)->getDofCoeffIdx();
240  nodes_indices[elem_idx] = idx;
241  local_nodes_indices[elem_idx] = local_idx;
242  }
243  }
244 
245  } else {
246  nodes_indices.resize(0, false);
247  local_nodes_indices.resize(0, false);
248  }
249 
251 }
252 
255  const std::string &field_name) const {
256  return getNodesIndices(field_name,
257  const_cast<FENumeredDofEntity_multiIndex &>(
258  numeredEntFiniteElementPtr->getRowsDofs()),
259  data.dataOnEntities[MBVERTEX][0].getIndices(),
260  data.dataOnEntities[MBVERTEX][0].getLocalIndices());
261 }
262 
265  const std::string &field_name) const {
266  return getNodesIndices(field_name,
267  const_cast<FENumeredDofEntity_multiIndex &>(
268  numeredEntFiniteElementPtr->getColsDofs()),
269  data.dataOnEntities[MBVERTEX][0].getIndices(),
270  data.dataOnEntities[MBVERTEX][0].getLocalIndices());
271 }
272 
274  DataForcesAndSourcesCore &data, const std::string &field_name,
275  FENumeredDofEntity_multiIndex &dofs, const EntityType type_lo,
276  const EntityType type_hi) const {
278 
279  for (EntityType t = type_lo; t != type_hi; ++t) {
280  for (auto &dat : data.dataOnEntities[t]) {
281  dat.getIndices().resize(0, false);
282  dat.getLocalIndices().resize(0, false);
283  }
284  }
285 
286  auto &dofs_by_type = dofs.get<Composite_Name_And_Type_mi_tag>();
287  auto dit = dofs_by_type.lower_bound(boost::make_tuple(field_name, type_lo));
288  if (dit == dofs_by_type.end())
290  auto hi_dit =
291  dofs_by_type.lower_bound(boost::make_tuple(field_name, type_hi));
292  for (; dit != hi_dit; ++dit) {
293  auto &dof = **dit;
294  const EntityType type = dof.getEntType();
295  const int side = dof.sideNumberPtr->side_number;
296  auto &dat = data.dataOnEntities[type][side];
297 
298  const int nb_dofs_on_ent = dof.getNbDofsOnEnt();
299  if (nb_dofs_on_ent) {
300  const int brother_side = dof.sideNumberPtr->brother_side_number;
301  auto &ent_field_indices = dat.getIndices();
302  auto &ent_field_local_indices = dat.getLocalIndices();
303  if (ent_field_indices.empty()) {
304  ent_field_indices.resize(nb_dofs_on_ent, false);
305  ent_field_local_indices.resize(nb_dofs_on_ent, false);
306  std::fill(ent_field_indices.data().begin(),
307  ent_field_indices.data().end(), -1);
308  std::fill(ent_field_local_indices.data().begin(),
309  ent_field_local_indices.data().end(), -1);
310  }
311  const int idx = dof.getEntDofIdx();
312  ent_field_indices[idx] = dof.getPetscGlobalDofIdx();
313  ent_field_local_indices[idx] = dof.getPetscLocalDofIdx();
314  if (brother_side != -1) {
315  auto &dat_brother = data.dataOnEntities[type][brother_side];
316  dat_brother.getIndices().resize(nb_dofs_on_ent, false);
317  dat_brother.getLocalIndices().resize(nb_dofs_on_ent, false);
318  dat_brother.getIndices()[idx] = dat.getIndices()[idx];
319  dat_brother.getLocalIndices()[idx] = dat.getLocalIndices()[idx];
320  }
321  }
322  }
323 
325 }
326 
328 ForcesAndSourcesCore::getNoFieldIndices(const std::string &field_name,
330  VectorInt &indices) const {
332  auto dit = dofs.get<FieldName_mi_tag>().lower_bound(field_name);
333  auto hi_dit = dofs.get<FieldName_mi_tag>().upper_bound(field_name);
334  indices.resize(std::distance(dit, hi_dit));
335  for (; dit != hi_dit; dit++) {
336  int idx = (*dit)->getPetscGlobalDofIdx();
337  indices[(*dit)->getDofCoeffIdx()] = idx;
338  }
340 }
341 
343  DataForcesAndSourcesCore &data, const std::string &field_name) const {
345  if (data.dataOnEntities[MBENTITYSET].size() == 0) {
346  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
347  }
348  CHKERR getNoFieldIndices(field_name,
349  const_cast<FENumeredDofEntity_multiIndex &>(
350  numeredEntFiniteElementPtr->getRowsDofs()),
351  data.dataOnEntities[MBENTITYSET][0].getIndices());
353 }
354 
356  DataForcesAndSourcesCore &data, const std::string &field_name) const {
358  if (data.dataOnEntities[MBENTITYSET].size() == 0) {
359  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
360  }
361  CHKERR getNoFieldIndices(field_name,
362  const_cast<FENumeredDofEntity_multiIndex &>(
363  numeredEntFiniteElementPtr->getColsDofs()),
364  data.dataOnEntities[MBENTITYSET][0].getIndices());
366 }
367 
368 // ** Indices from problem **
369 
371  const std::string &field_name, const NumeredDofEntity_multiIndex &dofs,
372  VectorInt &nodes_indices) const {
374  nodes_indices.resize(0);
375  auto &side_table = const_cast<SideNumber_multiIndex &>(
376  numeredEntFiniteElementPtr->getSideNumberTable());
377  auto siit = side_table.get<1>().lower_bound(boost::make_tuple(MBVERTEX, 0));
378  auto hi_siit =
379  side_table.get<1>().lower_bound(boost::make_tuple(MBVERTEX, 10000));
380 
381  int nn = 0;
382  for (; siit != hi_siit; siit++, nn++) {
383 
384  if (siit->get()->side_number == -1)
385  continue;
386 
387  const EntityHandle ent = siit->get()->ent;
388  auto dit =
389  dofs.get<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>().lower_bound(
390  boost::make_tuple(field_name, ent, 0));
391  auto hi_dit =
392  dofs.get<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>().upper_bound(
393  boost::make_tuple(field_name, ent, 10000)); /// very large number
394  if (dit != hi_dit) {
395  if (!nn) {
396  nodes_indices.resize((*dit)->getNbOfCoeffs() *
397  std::distance(siit, hi_siit));
398  }
399  for (; dit != hi_dit; dit++) {
400  nodes_indices[siit->get()->side_number * (*dit)->getNbOfCoeffs() +
401  (*dit)->getDofCoeffIdx()] =
402  (*dit)->getPetscGlobalDofIdx();
403  }
404  }
405  }
406 
408 }
409 
411  const std::string &field_name, const NumeredDofEntity_multiIndex &dofs,
412  EntityType type, int side_number, VectorInt &indices) const {
414 
415  indices.resize(0);
416 
417  auto &side_table = const_cast<SideNumber_multiIndex &>(
418  numeredEntFiniteElementPtr->getSideNumberTable());
419  auto siit =
420  side_table.get<1>().lower_bound(boost::make_tuple(type, side_number));
421  auto hi_siit =
422  side_table.get<1>().upper_bound(boost::make_tuple(type, side_number));
423 
424  for (; siit != hi_siit; siit++) {
425 
426  if (siit->get()->side_number == -1)
427  continue;
428 
429  const EntityHandle ent = siit->get()->ent;
430  NumeredDofEntity_multiIndex::index<
431  Composite_Name_And_Ent_And_EntDofIdx_mi_tag>::type::iterator dit,
432  hi_dit;
433  dit = dofs.get<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>().lower_bound(
434  boost::make_tuple(field_name, ent, 0));
435  hi_dit =
436  dofs.get<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>().upper_bound(
437  boost::make_tuple(field_name, ent, 10000)); /// very large number
438 
439  indices.resize(std::distance(dit, hi_dit));
440  for (; dit != hi_dit; dit++) {
441 
442  indices[(*dit)->getEntDofIdx()] = (*dit)->getPetscGlobalDofIdx();
443  }
444  }
445 
447 }
448 
450  const std::string &field_name, VectorInt &nodes_indices) const {
451  return getProblemNodesIndices(field_name, *(problemPtr->numeredDofsRows),
452  nodes_indices);
453 }
454 
457  EntityType type, int side_number,
458  VectorInt &indices) const {
459  return getProblemTypeIndices(field_name, *(problemPtr->numeredDofsRows), type,
460  side_number, indices);
461 }
462 
464  const std::string &field_name, VectorInt &nodes_indices) const {
465  return getProblemNodesIndices(field_name, *(problemPtr->numeredDofsCols),
466  nodes_indices);
467 }
468 
471  EntityType type, int side_number,
472  VectorInt &indices) const {
473  return getProblemTypeIndices(field_name, *(problemPtr->numeredDofsCols), type,
474  side_number, indices);
475 }
476 
477 // ** Data **
478 
480  const boost::string_ref field_name, FEDofEntity_multiIndex &dofs,
481  VectorDouble &nodes_data, VectorDofs &nodes_dofs, FieldSpace &space,
482  FieldApproximationBase &base) const {
484  auto &dofs_by_name_and_type = dofs.get<Composite_Name_And_Type_mi_tag>();
485  auto tuple = boost::make_tuple(field_name, MBVERTEX);
486  auto dit = dofs_by_name_and_type.lower_bound(tuple);
487  if (dit == dofs_by_name_and_type.end())
488  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
489  "No nodal dofs on element");
490  auto hi_dit = dofs.get<Composite_Name_And_Type_mi_tag>().upper_bound(tuple);
491 
492  if (dit != hi_dit) {
493  auto &first_dof = **dit;
494  space = first_dof.getSpace();
495  base = first_dof.getApproxBase();
496  int num_nodes;
497  CHKERR getNumberOfNodes(num_nodes);
498  const int nb_dof_idx = first_dof.getNbOfCoeffs();
499  const int max_nb_dofs = nb_dof_idx * num_nodes;
500  nodes_data.resize(max_nb_dofs, false);
501  nodes_dofs.resize(max_nb_dofs, false);
502  nodes_data.clear();
503 
504  std::vector<boost::weak_ptr<FEDofEntity>> brother_dofs_vec;
505  for (; dit != hi_dit;) {
506  const auto &dof_ptr = *dit;
507  const auto &dof = *dof_ptr;
508  const auto &sn = *dof.sideNumberPtr;
509  const int side_number = sn.side_number;
510  const int brother_side_number = sn.brother_side_number;
511  if (brother_side_number != -1)
512  brother_dofs_vec.emplace_back(dof_ptr);
513 
514  int pos = side_number * nb_dof_idx;
515  auto ent_filed_data_vec = dof.getEntFieldData();
516  for (int ii = 0; ii != nb_dof_idx; ++ii) {
517  nodes_data[pos] = ent_filed_data_vec[ii];
518  nodes_dofs[pos] = *dit;
519  ++pos;
520  ++dit;
521  }
522  }
523 
524  for(auto &dof_ptr : brother_dofs_vec) {
525  if (const auto d = dof_ptr.lock()) {
526  const auto &sn = d->sideNumberPtr;
527  const int side_number = sn->side_number;
528  const int brother_side_number = sn->brother_side_number;
529  int pos = side_number * nb_dof_idx;
530  int brother_pos = brother_side_number * nb_dof_idx;
531  for (int ii = 0; ii != nb_dof_idx; ++ii) {
532  nodes_data[brother_pos] = nodes_data[pos];
533  nodes_dofs[brother_pos] = nodes_dofs[pos];
534  ++pos;
535  ++brother_pos;
536  }
537  }
538  }
539 
540  } else {
541  nodes_data.resize(0, false);
542  nodes_dofs.resize(0, false);
543  }
544 
546 }
547 
550  const std::string &field_name) const {
551  return getNodesFieldData(field_name,
552  const_cast<FEDofEntity_multiIndex &>(
553  numeredEntFiniteElementPtr->getDataDofs()),
554  data.dataOnEntities[MBVERTEX][0].getFieldData(),
555  data.dataOnEntities[MBVERTEX][0].getFieldDofs(),
556  data.dataOnEntities[MBVERTEX][0].getSpace(),
557  data.dataOnEntities[MBVERTEX][0].getBase());
558 }
559 
561  DataForcesAndSourcesCore &data, const std::string &field_name,
562  const EntityType type_lo, const EntityType type_hi) const {
564 
565  for (EntityType t = type_lo; t != type_hi; ++t) {
566  for (auto &dat : data.dataOnEntities[t]) {
567  dat.getDataOrder() = 0;
568  dat.getBase() = NOBASE;
569  dat.getSpace() = NOSPACE;
570  dat.getFieldData().resize(0, false);
571  dat.getFieldDofs().resize(0, false);
572  }
573  }
574 
575  auto &dofs = const_cast<FEDofEntity_multiIndex &>(
576  numeredEntFiniteElementPtr->getDataDofs());
577  auto &dofs_by_type = dofs.get<Composite_Name_And_Type_mi_tag>();
578  auto dit = dofs_by_type.lower_bound(boost::make_tuple(field_name, type_lo));
579  if (dit == dofs_by_type.end())
581  auto hi_dit =
582  dofs_by_type.lower_bound(boost::make_tuple(field_name, type_hi));
583  std::vector<boost::weak_ptr<FEDofEntity>> brother_dofs_vec;
584  for (; dit != hi_dit;) {
585 
586  auto &dof = **dit;
587  const int nb_dofs_on_ent = dof.getNbDofsOnEnt();
588  if (nb_dofs_on_ent) {
589 
590  const EntityType type = dof.getEntType();
591  const int side = dof.sideNumberPtr->side_number;
592  auto &dat = data.dataOnEntities[type][side];
593 
594  auto &ent_field_dofs = dat.getFieldDofs();
595  auto &ent_field_data = dat.getFieldData();
596  const int brother_side = dof.sideNumberPtr->brother_side_number;
597  if (brother_side != -1)
598  brother_dofs_vec.emplace_back(*dit);
599 
600  if (ent_field_data.empty()) {
601 
602  dat.getBase() = dof.getApproxBase();
603  dat.getSpace() = dof.getSpace();
604  const int ent_order = dof.getMaxOrder();
605  dat.getDataOrder() =
606  dat.getDataOrder() > ent_order ? dat.getDataOrder() : ent_order;
607  ent_field_data.resize(nb_dofs_on_ent, false);
608  noalias(ent_field_data) = dof.getEntFieldData();
609  ent_field_dofs.resize(nb_dofs_on_ent, false);
610  for (int ii = 0; ii != nb_dofs_on_ent; ++ii) {
611  ent_field_dofs[ii] = *dit;
612  ++dit;
613  }
614  }
615  }
616  }
617 
618  for (auto &dof_ptr : brother_dofs_vec) {
619  if (auto d = dof_ptr.lock()) {
620  const EntityType type = d->getEntType();
621  const int side = d->sideNumberPtr->side_number;
622  const int brother_side = d->sideNumberPtr->brother_side_number;
623  auto &dat = data.dataOnEntities[type][side];
624  auto &dat_brother = data.dataOnEntities[type][brother_side];
625  dat_brother.getBase() = dat.getBase();
626  dat_brother.getSpace() = dat.getSpace();
627  dat_brother.getDataOrder() = dat.getDataOrder();
628  dat_brother.getFieldData() = dat.getFieldData();
629  dat_brother.getFieldDofs() = dat.getFieldDofs();
630  }
631  }
632 
634 }
635 
637  const boost::string_ref field_name, FEDofEntity_multiIndex &dofs,
638  VectorDouble &ent_field_data, VectorDofs &ent_field_dofs) const {
640  auto dit = dofs.get<FieldName_mi_tag>().lower_bound(field_name);
641  auto hi_dit = dofs.get<FieldName_mi_tag>().upper_bound(field_name);
642  int size = std::distance(dit, hi_dit);
643  ent_field_data.resize(size, false);
644  ent_field_dofs.resize(size, false);
645  for (; dit != hi_dit; dit++) {
646  int idx = (*dit)->getDofCoeffIdx();
647  ent_field_data[idx] = (*dit)->getFieldData();
648  ent_field_dofs[idx] = *dit;
649  }
651 }
652 
654  DataForcesAndSourcesCore &data, const boost::string_ref field_name) const {
656  if (data.dataOnEntities[MBENTITYSET].size() == 0) {
657  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
658  }
660  field_name,
661  const_cast<FEDofEntity_multiIndex &>(
662  numeredEntFiniteElementPtr->getDataDofs()),
663  data.dataOnEntities[MBENTITYSET][0].getFieldData(),
664  data.dataOnEntities[MBENTITYSET][0].getFieldDofs());
666 }
667 
668 // ** Face **
669 
673  // PetscAttachDebugger();
674  data.facesNodes.resize(4, 3, false);
675  auto &side_table = const_cast<SideNumber_multiIndex &>(
676  numeredEntFiniteElementPtr->getSideNumberTable());
677  auto siit = side_table.get<1>().lower_bound(boost::make_tuple(MBTRI, 0));
678  auto hi_siit = side_table.get<1>().upper_bound(boost::make_tuple(MBTRI, 4));
679  if (std::distance(siit, hi_siit) != 4) {
680  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
681  "Should be 4 triangles on tet, side_table not initialized");
682  }
683  const int canonical_face_sense_p1[4][3] = {
684  {0, 1, 3},
685  {1, 2, 3},
686  {0, 3, 2} /**/,
687  {0, 2, 1} /**/}; // second index is offset (positive sense)
688  const int canonical_face_sense_m1[4][3] = {
689  {0, 3, 1},
690  {1, 3, 2},
691  {0, 2, 3},
692  {0, 1, 2}}; // second index is offset (negative sense
693  for (; siit != hi_siit; siit++) {
694  const boost::shared_ptr<SideNumber> side = *siit;
695  int face_conn[3] = {-1, -1, -1};
696  if (side->offset == 0) {
697  face_conn[0] = side->sense == 1
698  ? canonical_face_sense_p1[(int)side->side_number][0]
699  : canonical_face_sense_m1[(int)side->side_number][0];
700  face_conn[1] = side->sense == 1
701  ? canonical_face_sense_p1[(int)side->side_number][1]
702  : canonical_face_sense_m1[(int)side->side_number][1];
703  face_conn[2] = side->sense == 1
704  ? canonical_face_sense_p1[(int)side->side_number][2]
705  : canonical_face_sense_m1[(int)side->side_number][2];
706  }
707  if (side->offset == 1) {
708  face_conn[0] =
709  side->sense == 1
710  ? canonical_face_sense_p1[(int)side->side_number][1]
711  : canonical_face_sense_m1[(int)side->side_number][2] /**/;
712  face_conn[1] = side->sense == 1
713  ? canonical_face_sense_p1[(int)side->side_number][2]
714  : canonical_face_sense_m1[(int)side->side_number][0];
715  face_conn[2] = side->sense == 1
716  ? canonical_face_sense_p1[(int)side->side_number][0]
717  : canonical_face_sense_m1[(int)side->side_number][1];
718  }
719  if (side->offset == 2) {
720  face_conn[0] =
721  side->sense == 1
722  ? canonical_face_sense_p1[(int)side->side_number][2]
723  : canonical_face_sense_m1[(int)side->side_number][1] /**/;
724  face_conn[1] = side->sense == 1
725  ? canonical_face_sense_p1[(int)side->side_number][0]
726  : canonical_face_sense_m1[(int)side->side_number][2];
727  face_conn[2] = side->sense == 1
728  ? canonical_face_sense_p1[(int)side->side_number][1]
729  : canonical_face_sense_m1[(int)side->side_number][0];
730  }
731  for (int nn = 0; nn < 3; nn++)
732  data.facesNodes(side->side_number, nn) = face_conn[nn];
733  {
734  const EntityHandle *conn_tet;
735  int num_nodes_tet;
737  CHKERR mField.get_moab().get_connectivity(ent, conn_tet, num_nodes_tet,
738  true);
739  if (num_nodes_tet != 4)
740  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
741  "data inconsistency");
742  int num_nodes_face;
743  const EntityHandle *conn_face;
744  CHKERR mField.get_moab().get_connectivity(side->ent, conn_face,
745  num_nodes_face, true);
746  if (num_nodes_face != 3)
747  SETERRQ(PETSC_COMM_SELF, 1, "data inconsistency");
748  if (conn_face[0] != conn_tet[data.facesNodes(side->side_number, 0)])
749  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
750  "data inconsistency");
751  if (conn_face[1] != conn_tet[data.facesNodes(side->side_number, 1)])
752  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
753  "data inconsistency");
754  if (conn_face[2] != conn_tet[data.facesNodes(side->side_number, 2)])
755  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
756  "data inconsistency");
757  }
758  }
760 }
761 
762 // ** Space and Base **
763 
765  DataForcesAndSourcesCore &data) const {
767 
768  if (nInTheLoop == 0) {
769  data.sPace.reset();
770  data.bAse.reset();
771  for (EntityType t = MBVERTEX; t != MBMAXTYPE; ++t) {
772  data.spacesOnEntities[t].reset();
773  data.basesOnEntities[t].reset();
774  }
775  for (int s = 0; s != LASTSPACE; ++s) {
776  data.basesOnSpaces[s].reset();
777  }
778  }
779 
780  if (dataFieldEntsPtr)
781  for (auto e : *dataFieldEntsPtr) {
782  // get data from entity
783  const EntityType type = e->getEntType();
784  const FieldSpace space = e->getSpace();
785  const FieldApproximationBase approx = e->getApproxBase();
786 
787  // set data
788  data.sPace.set(space);
789  data.bAse.set(approx);
790  data.spacesOnEntities[type].set(space);
791  data.basesOnEntities[type].set(approx);
792  data.basesOnSpaces[space].set(approx);
793  }
794  else
795  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
796  "data fields ents not allocated on element");
797 
799 }
800 
802  const FieldApproximationBase b) {
804  if (dataOnElement[H1]->bAse.test(b)) {
805  switch (static_cast<FieldApproximationBase>(b)) {
806  case NOBASE:
807  break;
811  if (!getElementPolynomialBase()) {
812  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
813  "Functions genrating approximation base not defined");
814  }
815  for (int space = H1; space != LASTSPACE; ++space) {
816  if (dataOnElement[H1]->sPace.test(space) &&
817  dataOnElement[H1]->bAse.test(b) &&
818  dataOnElement[H1]->basesOnSpaces[space].test(b)) {
819  CHKERR getElementPolynomialBase()->getValue(
820  gaussPts,
821  boost::shared_ptr<BaseFunctionCtx>(new EntPolynomialBaseCtx(
822  *dataOnElement[space], static_cast<FieldSpace>(space),
823  static_cast<FieldApproximationBase>(b), NOBASE)));
824  }
825  }
826  break;
827  case USER_BASE:
828  if (!getUserPolynomialBase()) {
829  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
830  "Functions genrating user approximation base not defined");
831  }
832  for (int space = H1; space != LASTSPACE; ++space)
833  if (dataOnElement[H1]->sPace.test(space) &&
834  dataOnElement[H1]->bAse.test(b) &&
835  dataOnElement[H1]->basesOnSpaces[space].test(b)) {
836  CHKERR getUserPolynomialBase()->getValue(
837  gaussPts,
838  boost::shared_ptr<BaseFunctionCtx>(new EntPolynomialBaseCtx(
839  *dataOnElement[space], static_cast<FieldSpace>(space),
840  static_cast<FieldApproximationBase>(b), NOBASE)));
841  }
842  break;
843  default:
845  "Base <%s> not yet implemented",
846  ApproximationBaseNames[static_cast<FieldApproximationBase>(b)]);
847  }
848  }
850 }
851 
854  /// Use the some node base. Node base is usually used for construction other
855  /// bases.
856  for (int space = HCURL; space != LASTSPACE; ++space) {
857  dataOnElement[space]->dataOnEntities[MBVERTEX][0].getNSharedPtr(NOBASE) =
858  dataOnElement[H1]->dataOnEntities[MBVERTEX][0].getNSharedPtr(NOBASE);
859  }
860  for (int b = AINSWORTH_LEGENDRE_BASE; b != LASTBASE; b++) {
862  static_cast<FieldApproximationBase>(b));
863  }
865 }
866 
869 
870  const EntityType type = numeredEntFiniteElementPtr->getEntType();
871  if (type == lastEvaluatedElementEntityType)
873 
874  // Data on elements for proper spaces
875  for (int space = H1; space != LASTSPACE; ++space) {
876  dataOnElement[space]->setElementType(type);
877  derivedDataOnElement[space]->setElementType(type);
878  }
879 
881 
883 }
884 
885 #define FUNCTION_NAME_WITH_OP_NAME(OP) \
886  std::ostringstream ss; \
887  ss << "(Calling user data operator " \
888  << boost::typeindex::type_id_runtime(OP).pretty_name() << " rowField " \
889  << (OP).rowFieldName << " colField " << (OP).colFieldName << ") "
890 
891 #define CATCH_OP_ERRORS(OP) \
892  catch (MoFEMExceptionInitial const &ex) { \
893  FUNCTION_NAME_WITH_OP_NAME(OP) << PETSC_FUNCTION_NAME; \
894  return PetscError(PETSC_COMM_SELF, ex.lINE, ss.str().c_str(), __FILE__, \
895  ex.errorCode, PETSC_ERROR_INITIAL, ex.what()); \
896  } \
897  catch (MoFEMExceptionRepeat const &ex) { \
898  FUNCTION_NAME_WITH_OP_NAME(OP) << PETSC_FUNCTION_NAME; \
899  return PetscError(PETSC_COMM_SELF, ex.lINE, ss.str().c_str(), __FILE__, \
900  ex.errorCode, PETSC_ERROR_REPEAT, " "); \
901  } \
902  catch (MoFEMException const &ex) { \
903  FUNCTION_NAME_WITH_OP_NAME(OP) << ex.errorMessage; \
904  SETERRQ(PETSC_COMM_SELF, ex.errorCode, ss.str().c_str()); \
905  } \
906  catch (std::exception const &ex) { \
907  std::string message("Error: " + std::string(ex.what()) + " at " + \
908  boost::lexical_cast<std::string>(__LINE__) + " : " + \
909  std::string(__FILE__) + " in " + \
910  std::string(PETSC_FUNCTION_NAME)); \
911  FUNCTION_NAME_WITH_OP_NAME(OP) << message; \
912  SETERRQ(PETSC_COMM_SELF, MOFEM_STD_EXCEPTION_THROW, ss.str().c_str()); \
913  }
914 
917 
918  const EntityType type = numeredEntFiniteElementPtr->getEntType();
921  std::vector<std::string> last_eval_field_name(2);
922 
923  boost::ptr_vector<UserDataOperator>::iterator oit, hi_oit;
924  oit = opPtrVector.begin();
925  hi_oit = opPtrVector.end();
926 
927  for (; oit != hi_oit; oit++) {
928 
929  oit->setPtrFE(this);
930 
931  if (oit->opType == UserDataOperator::OPLAST) {
932 
933  // Set field
934  switch (oit->sPace) {
935  case NOSPACE:
936  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Unknown space");
937  case NOFIELD:
938  case H1:
939  case HCURL:
940  case HDIV:
941  case L2:
942  break;
943  default:
944  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
945  "Not implemented for this space", oit->sPace);
946  }
947 
948  // Reseat all data which all field dependent
949  dataOnElement[oit->sPace]->resetFieldDependentData();
950  last_eval_field_name[0] = "";
951 
952  // Run operator
953  try {
954  CHKERR oit->opRhs(*dataOnElement[oit->sPace], oit->doVertices,
955  oit->doEdges, oit->doQuads, oit->doTris, oit->doTets,
956  false);
957  }
958  CATCH_OP_ERRORS(*oit);
959 
960  } else {
961 
962  boost::shared_ptr<DataForcesAndSourcesCore> op_data[2];
963 
964  for (int ss = 0; ss != 2; ss++) {
965 
966  const std::string field_name =
967  !ss ? oit->rowFieldName : oit->colFieldName;
968  const Field *field_struture = mField.get_field_structure(field_name);
969  const BitFieldId data_id = field_struture->getId();
970  const FieldSpace space = field_struture->getSpace();
971  op_data[ss] = !ss ? dataOnElement[space] : derivedDataOnElement[space];
972 
973  if ((oit->getNumeredEntFiniteElementPtr()->getBitFieldIdData() &
974  data_id)
975  .none()) {
976  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
977  "no data field < %s > on finite element < %s >",
978  field_name.c_str(), feName.c_str());
979  }
980 
981  if (oit->getOpType() & types[ss] ||
982  oit->getOpType() & UserDataOperator::OPROWCOL) {
983 
984  switch (space) {
985  case NOSPACE:
986  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "unknown space");
987  break;
988  case NOFIELD:
989  case H1:
990  case HCURL:
991  case HDIV:
992  case L2:
993  break;
994  default:
995  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
996  "Not implemented for this space", space);
997  }
998 
999  if (last_eval_field_name[ss] != field_name) {
1000 
1001  CHKERR getEntityFieldData(*op_data[ss], field_name, MBEDGE);
1002  if (!ss)
1003  CHKERR getEntityRowIndices(*op_data[ss], field_name, MBEDGE);
1004  else
1005  CHKERR getEntityColIndices(*op_data[ss], field_name, MBEDGE);
1006 
1007  switch (space) {
1008  case NOSPACE:
1009  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1010  "unknown space");
1011  break;
1012  case H1:
1013  if (!ss)
1014  CHKERR getRowNodesIndices(*op_data[ss], field_name);
1015  else
1016  CHKERR getColNodesIndices(*op_data[ss], field_name);
1017  CHKERR getNodesFieldData(*op_data[ss], field_name);
1018  break;
1019  case HCURL:
1020  case HDIV:
1021  break;
1022  case L2:
1023  switch (type) {
1024  case MBVERTEX:
1025  CHKERR getNodesFieldData(*op_data[ss], field_name);
1026  break;
1027  default:
1028  break;
1029  }
1030  break;
1031  case NOFIELD:
1032  if (!getNinTheLoop()) {
1033  // NOFIELD data are the same for each element, can be
1034  // retrieved only once
1035  if (!ss) {
1036  CHKERR getNoFieldRowIndices(*op_data[ss], field_name);
1037  } else {
1038  CHKERR getNoFieldColIndices(*op_data[ss], field_name);
1039  }
1040  CHKERR getNoFieldFieldData(*op_data[ss], field_name);
1041  }
1042  break;
1043  default:
1044  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
1045  "Not implemented for this space", space);
1046  }
1047  last_eval_field_name[ss] = field_name;
1048  }
1049  }
1050  }
1051 
1052  if (oit->getOpType() & UserDataOperator::OPROW) {
1053  try {
1054  CHKERR oit->opRhs(*op_data[0], false);
1055  }
1056  CATCH_OP_ERRORS(*oit);
1057  }
1058 
1059  if (oit->getOpType() & UserDataOperator::OPCOL) {
1060  try {
1061  CHKERR oit->opRhs(*op_data[1], false);
1062  }
1063  CATCH_OP_ERRORS(*oit);
1064  }
1065 
1066  if (oit->getOpType() & UserDataOperator::OPROWCOL) {
1067  try {
1068  CHKERR oit->opLhs(*op_data[0], *op_data[1], oit->sYmm);
1069  }
1070  CATCH_OP_ERRORS(*oit);
1071  }
1072  }
1073  }
1075 }
1076 
1077 // **** Data Operator ****
1078 
1079 static MoFEMErrorCode
1081  const EntityType type, const int side,
1082  const std::string field_name, VectorInt &indices) {
1084  switch (type) {
1085  case MBVERTEX:
1086  CHKERR fe_ptr->getProblemNodesRowIndices(field_name, indices);
1087  break;
1088  default:
1089  CHKERR fe_ptr->getProblemTypeRowIndices(field_name, type, side, indices);
1090  }
1092 }
1093 
1094 static MoFEMErrorCode
1096  const EntityType type, const int side,
1097  const std::string field_name, VectorInt &indices) {
1099  switch (type) {
1100  case MBVERTEX:
1101  CHKERR fe_ptr->getProblemNodesColIndices(field_name, indices);
1102  break;
1103  default:
1104  CHKERR fe_ptr->getProblemTypeColIndices(field_name, type, side, indices);
1105  }
1107 }
1108 
1110  const std::string field_name, const EntityType type, const int side,
1111  VectorInt &indices) const {
1113  if (ptrFE == NULL) {
1114  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
1115  }
1116  CHKERR get_porblem_row_indices(ptrFE, type, side, field_name, indices);
1118 }
1119 
1121  const std::string field_name, const EntityType type, const int side,
1122  VectorInt &indices) const {
1124  if (ptrFE == NULL) {
1125  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
1126  }
1127  CHKERR get_porblem_col_indices(ptrFE, type, side, field_name, indices);
1129 }
1130 
1131 } // namespace MoFEM
ForcesAndSourcesCore(Interface &m_field)
int getMaxRowOrder() const
Get max order of approximation for field in rows.
std::bitset< LASTSPACE > spacesOnEntities[MBMAXTYPE]
spaces on entity types
ublas::matrix< int > facesNodes
nodes on finite element faces
boost::ptr_vector< UserDataOperator > opPtrVector
Vector of finite element users data operators.
MoFEMErrorCode calculateBaseFunctionsOnElement()
Calculate base functions.
MoFEMErrorCode getProblemColIndices(const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
Get col indices.
MatrixDouble gaussPts
Matrix of integration points.
field with continuous normal traction
Definition: definitions.h:172
user implemented approximation base
Definition: definitions.h:153
MoFEMErrorCode getNoFieldColIndices(DataForcesAndSourcesCore &data, const std::string &field_name) const
get col NoField indices
virtual moab::Interface & get_moab()=0
MoFEMErrorCode getEntitySense(const EntityType type, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get sense (orientation) of entity
data structure for finite element entityIt keeps that about indices of degrees of freedom,...
MoFEMErrorCode createDataOnElement()
Create a entity data on element object.
Provide data structure for (tensor) field approximation.The Field is intended to provide support for ...
MoFEMErrorCode getColNodesIndices(DataForcesAndSourcesCore &data, const std::string &field_name) const
get col node indices from FENumeredDofEntity_multiIndex
const boost::shared_ptr< DataForcesAndSourcesCore > derivedDataOnElement[LASTSPACE]
Entity data on element entity columns fields.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:500
scalar or vector of scalars describe (no true field)
Definition: definitions.h:169
std::bitset< LASTBASE > basesOnEntities[MBMAXTYPE]
bases on entity types
MoFEMErrorCode getEntityDataOrder(const EntityType type, const FieldSpace space, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
Get the entity data order.
auto & getUserPolynomialBase()
Get the User Polynomial Base object.
multi_index_container< boost::shared_ptr< FENumeredDofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< FENumeredDofEntity::interface_type_DofEntity, const UId &, &FENumeredDofEntity::getGlobalUniqueId > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< FENumeredDofEntity::interface_type_DofEntity, EntityHandle, &FENumeredDofEntity::getEnt > >, ordered_non_unique< tag< FieldName_mi_tag >, const_mem_fun< FENumeredDofEntity::interface_type_Field, boost::string_ref, &FENumeredDofEntity::getNameRef > >, ordered_non_unique< tag< Composite_Name_Type_And_Side_Number_mi_tag >, composite_key< FENumeredDofEntity, const_mem_fun< FENumeredDofEntity::interface_type_Field, boost::string_ref, &FENumeredDofEntity::getNameRef >, const_mem_fun< FENumeredDofEntity::interface_type_RefEntity, EntityType, &FENumeredDofEntity::getEntType >, KeyFromKey< member< SideNumber, char, &SideNumber::side_number >, member< FENumeredDofEntity::BaseFEEntity, boost::shared_ptr< SideNumber >, &FENumeredDofEntity::sideNumberPtr > > > >, ordered_non_unique< tag< Composite_Name_And_Type_mi_tag >, composite_key< FENumeredDofEntity, const_mem_fun< FENumeredDofEntity::interface_type_Field, boost::string_ref, &FENumeredDofEntity::getNameRef >, const_mem_fun< FENumeredDofEntity::interface_type_RefEntity, EntityType, &FENumeredDofEntity::getEntType > > >, ordered_non_unique< tag< Composite_Name_And_Ent_mi_tag >, composite_key< FENumeredDofEntity, const_mem_fun< FENumeredDofEntity::interface_type_Field, boost::string_ref, &FENumeredDofEntity::getNameRef >, const_mem_fun< FENumeredDofEntity::interface_type_DofEntity, EntityHandle, &FENumeredDofEntity::getEnt > > > > > FENumeredDofEntity_multiIndex
MultiIndex container keeps FENumeredDofEntity.
Class used to pass element data to calculate base functions on tet,triangle,edge.
MoFEMErrorCode getNodesFieldData(const boost::string_ref field_name, FEDofEntity_multiIndex &dofs, VectorDouble &nodes_data, VectorDofs &nodes_dofs, FieldSpace &space, FieldApproximationBase &base) const
Get field data on nodes.
boost::shared_ptr< const FieldEntity_vector_view > colFieldEntsPtr
Pointer to finite element field entities column view.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:476
const boost::shared_ptr< DataForcesAndSourcesCore > dataOnElement[LASTSPACE]
Entity data on element entity rows fields.
std::string feName
Name of finite element.
MoFEMErrorCode getFaceTriNodes(DataForcesAndSourcesCore &data) const
Get nodes on triangles.
int getNinTheLoop() const
get number of evaluated element in the loop
boost::shared_ptr< const FieldEntity_vector_view > rowFieldEntsPtr
Pointer to finite element field entities row view.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:507
MoFEMErrorCode getNoFieldRowIndices(DataForcesAndSourcesCore &data, const std::string &field_name) const
get col NoField indices
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
FieldSpace getSpace() const
Get field approximation space.
static MoFEMErrorCode get_porblem_col_indices(const ForcesAndSourcesCore *fe_ptr, const EntityType type, const int side, const std::string field_name, VectorInt &indices)
OpType
Controls loop over entities on element.
MoFEMErrorCode getNoFieldFieldData(const boost::string_ref field_name, FEDofEntity_multiIndex &dofs, VectorDouble &ent_field_data, VectorDofs &ent_field_dofs) const
boost::ptr_vector< EntData > dataOnEntities[MBMAXTYPE]
FieldSpace in [ 0, LASTSPACE )
Definition: definitions.h:174
const Problem * problemPtr
raw pointer to problem
static const char *const ApproximationBaseNames[]
Definition: definitions.h:157
MoFEMErrorCode loopOverOperators()
Iterate user data operators.
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
MoFEMErrorCode getProblemNodesRowIndices(const std::string &field_name, VectorInt &nodes_indices) const
#define CATCH_OP_ERRORS(OP)
EntityType lastEvaluatedElementEntityType
Last evaluated type of element entity.
MoFEMErrorCode getProblemTypeRowIndices(const std::string &field_name, EntityType type, int side_number, VectorInt &indices) const
const Tensor1_Expr< const dTensor0< T, Dim, i >, typename promote< T, double >::V, Dim, i > d(const Tensor0< T * > &a, const Index< i, Dim > index, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: dTensor0.hpp:27
static MoFEMErrorCode get_porblem_row_indices(const ForcesAndSourcesCore *fe_ptr, const EntityType type, const int side, const std::string field_name, VectorInt &indices)
FieldApproximationBase
approximation base
Definition: definitions.h:142
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:66
std::bitset< LASTBASE > basesOnSpaces[LASTSPACE]
base on spaces
const BitFieldId & getId() const
Get unique field id.
MoFEMErrorCode getNodesIndices(const boost::string_ref field_name, FENumeredDofEntity_multiIndex &dofs, VectorInt &nodes_indices, VectorInt &local_nodes_indices) const
get node indices
MoFEMErrorCode getProblemNodesColIndices(const std::string &field_name, VectorInt &nodes_indices) const
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:144
MoFEMErrorCode getProblemTypeColIndices(const std::string &field_name, EntityType type, int side_number, VectorInt &indices) const
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredDofsRows
store DOFs on rows for this problem
field with continuous tangents
Definition: definitions.h:171
FieldSpace
approximation spaces
Definition: definitions.h:167
std::bitset< BITFIELDID_SIZE > BitFieldId
Field Id.
Definition: Types.hpp:53
#define CHKERR
Inline error check.
Definition: definitions.h:595
MoFEMErrorCode getEntityIndices(DataForcesAndSourcesCore &data, const std::string &field_name, FENumeredDofEntity_multiIndex &dofs, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
int nInTheLoop
number currently of processed method
MoFEMErrorCode getEntityFieldData(DataForcesAndSourcesCore &data, const std::string &field_name, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
MoFEMErrorCode getNoFieldIndices(const std::string &field_name, FENumeredDofEntity_multiIndex &dofs, VectorInt &nodes_indices) const
get NoField indices
MoFEMErrorCode getProblemTypeIndices(const std::string &field_name, const NumeredDofEntity_multiIndex &dofs, EntityType type, int side_number, VectorInt &indices) const
get indices by type (generic function) which are declared for problem but not this particular element
static int getMaxOrder(const ENTMULTIINDEX &multi_index)
multi_index_container< boost::shared_ptr< FEDofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< FEDofEntity::interface_type_DofEntity, const UId &, &FEDofEntity::getGlobalUniqueId > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< FEDofEntity::interface_type_DofEntity, EntityHandle, &FEDofEntity::getEnt > >, ordered_non_unique< tag< FieldName_mi_tag >, const_mem_fun< FEDofEntity::interface_type_Field, boost::string_ref, &FEDofEntity::getNameRef > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< FEDofEntity::interface_type_RefEntity, EntityType, &FEDofEntity::getEntType > >, ordered_non_unique< tag< Composite_Name_And_Type_mi_tag >, composite_key< FEDofEntity, const_mem_fun< FEDofEntity::interface_type_Field, boost::string_ref, &FEDofEntity::getNameRef >, const_mem_fun< FEDofEntity::interface_type_RefEntity, EntityType, &FEDofEntity::getEntType > > >, ordered_non_unique< tag< Composite_Name_And_Ent_mi_tag >, composite_key< FEDofEntity, const_mem_fun< FEDofEntity::interface_type_Field, boost::string_ref, &FEDofEntity::getNameRef >, const_mem_fun< FEDofEntity::interface_type_DofEntity, EntityHandle, &FEDofEntity::getEnt > > >, ordered_non_unique< tag< Composite_Name_Type_And_Side_Number_mi_tag >, composite_key< FEDofEntity, const_mem_fun< FEDofEntity::interface_type_Field, boost::string_ref, &FEDofEntity::getNameRef >, const_mem_fun< FEDofEntity::interface_type_RefEntity, EntityType, &FEDofEntity::getEntType >, KeyFromKey< member< SideNumber, char, &SideNumber::side_number >, member< FEDofEntity::BaseFEEntity, boost::shared_ptr< SideNumber >, &FEDofEntity::sideNumberPtr > > > > > > FEDofEntity_multiIndex
MultiIndex container keeps FEDofEntity.
ublas::vector< int, IntAllocator > VectorInt
Definition: Types.hpp:75
ublas::vector< boost::shared_ptr< const FEDofEntity >, DofsAllocator > VectorDofs
MultiIndex Tag for field name.
std::bitset< LASTSPACE > sPace
spaces on element
MoFEMErrorCode getNumberOfNodes(int &num_nodes) const
MoFEMErrorCode getEntityColIndices(DataForcesAndSourcesCore &data, const std::string &field_name, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
boost::shared_ptr< const FieldEntity_multiIndex_spaceType_view > dataFieldEntsPtr
Pointer to finite element field entities data view.
structure to get information form mofem into DataForcesAndSourcesCore
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:406
virtual MPI_Comm & get_comm() const =0
continuous field
Definition: definitions.h:170
virtual const Field * get_field_structure(const std::string &name)=0
get field structure
ublas::vector< double, DoubleAllocator > VectorDouble
Definition: Types.hpp:76
MoFEMErrorCode getRowNodesIndices(DataForcesAndSourcesCore &data, const std::string &field_name) const
get row node indices from FENumeredDofEntity_multiIndex
MoFEMErrorCode getSpacesAndBaseOnEntities(DataForcesAndSourcesCore &data) const
Get field approximation space and base on entities.
std::bitset< LASTBASE > bAse
bases on element
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredDofsCols
store DOFs on columns for this problem
int getMaxColOrder() const
Get max order of approximation for field in columns.
MoFEMErrorCode getProblemRowIndices(const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
Get row indices.
int getMaxDataOrder() const
Get max order of approximation for data fields.
this class derive data form other data structure
const int order
approximation order
MoFEMErrorCode getProblemNodesIndices(const std::string &field_name, const NumeredDofEntity_multiIndex &dofs, VectorInt &nodes_indices) const
get indices of nodal indices which are declared for problem but not this particular element
MoFEMErrorCode getEntityRowIndices(DataForcesAndSourcesCore &data, const std::string &field_name, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
auto & getElementPolynomialBase()
Get the Entity Polynomial Base object.
multi_index_container< boost::shared_ptr< NumeredDofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, const UId &, &NumeredDofEntity::getGlobalUniqueId > >, ordered_non_unique< tag< Unique_Ent_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, const UId &, &NumeredDofEntity::getEntGlobalUniqueId > >, ordered_non_unique< tag< Part_mi_tag >, member< NumeredDofEntity, unsigned int, &NumeredDofEntity::pArt > >, ordered_non_unique< tag< Idx_mi_tag >, member< NumeredDofEntity, DofIdx, &NumeredDofEntity::dofIdx > >, ordered_non_unique< tag< FieldName_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_Field, boost::string_ref, &NumeredDofEntity::getNameRef > >, ordered_non_unique< tag< PetscGlobalIdx_mi_tag >, member< NumeredDofEntity, DofIdx, &NumeredDofEntity::petscGloablDofIdx > >, ordered_non_unique< tag< PetscLocalIdx_mi_tag >, member< NumeredDofEntity, DofIdx, &NumeredDofEntity::petscLocalDofIdx > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, EntityHandle, &NumeredDofEntity::getEnt > >, ordered_non_unique< tag< Composite_Name_And_Ent_And_EntDofIdx_mi_tag >, composite_key< NumeredDofEntity, const_mem_fun< NumeredDofEntity::interface_type_Field, boost::string_ref, &NumeredDofEntity::getNameRef >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, EntityHandle, &NumeredDofEntity::getEnt >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, DofIdx, &NumeredDofEntity::getEntDofIdx > > >, ordered_non_unique< tag< Composite_Name_And_Part_mi_tag >, composite_key< NumeredDofEntity, const_mem_fun< NumeredDofEntity::interface_type_Field, boost::string_ref, &NumeredDofEntity::getNameRef >, member< NumeredDofEntity, unsigned int, &NumeredDofEntity::pArt > > >, ordered_non_unique< tag< Composite_Name_Ent_And_Part_mi_tag >, composite_key< NumeredDofEntity, const_mem_fun< NumeredDofEntity::interface_type_Field, boost::string_ref, &NumeredDofEntity::getNameRef >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, EntityHandle, &NumeredDofEntity::getEnt >, member< NumeredDofEntity, unsigned int, &NumeredDofEntity::pArt > > > > > NumeredDofEntity_multiIndex
MultiIndex container keeps NumeredDofEntity.
field with C-1 continuity
Definition: definitions.h:173