v0.16.3
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Typedefs
MatrixManager.cpp File Reference
#include <limits>
#include <unordered_map>

Go to the source code of this file.

Classes

struct  MoFEM::ElementColumns
 Create compressed matrix. More...
 
struct  MoFEM::ElementColumns::Segment
 
struct  MoFEM::CreateRowCompressedADJMatrix
 

Namespaces

namespace  MoFEM
 implementation of Data Operators for Forces and Sources
 

Macros

#define MatrixManagerFunctionBegin
 Create adjacent matrices using different indices.
 

Typedefs

using MoFEM::CreateRowComressedADJMatrix = CreateRowCompressedADJMatrix
 

Macro Definition Documentation

◆ MatrixManagerFunctionBegin

#define MatrixManagerFunctionBegin
Value:
MOFEM_LOG_CHANNEL("WORLD"); \
MOFEM_LOG_CHANNEL("SYNC"); \
MOFEM_LOG_FUNCTION(); \
MOFEM_LOG_TAG("SYNC", "MatrixManager"); \
MOFEM_LOG_TAG("WORLD", "MatrixManager")
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...

Create adjacent matrices using different indices.

Definition at line 9 of file MatrixManager.cpp.

16 {
17
18/** \brief Create compressed matrix
19
20 \note Only function class members are allowed in this class. NO VARIABLES.
21
22 \todo It is obsolete implementation, code should be moved to interface
23 MatrixManager.
24
25 \todo While matrix is created is assumed that all entities on element are
26 adjacent to each other, in some cases, this is created denser matrices than it
27 should be. Some kind of filtering can be added.
28
29 \todo Creation of the block matrices
30
31 \todo Some efficiency improvement are possible
32
33
34 */
35/** Column indices of the finite elements met while assembling the rows,
36 * grouped by column field, built once per element from its column view and
37 * the entity DOF cache. A row entity merges the lists of its adjacent
38 * elements with a stamp array instead of walking the views, locking weak
39 * pointers and sorting the concatenation for every row entity.
40 */
41struct ElementColumns {
42 struct Segment {
43 BitFieldId field; ///< Column field of the indices in [begin, end).
44 int begin, end; ///< Range in indices.
45 };
46 std::vector<int> indices; ///< All elements, concatenated.
47 std::vector<Segment> segments; ///< Per element, one or more segments.
48 std::vector<std::array<int, 2>> elementSegments; ///< Segment range per slot.
49 std::unordered_map<const EntFiniteElement *, int> slot; ///< Element slot.
50};
51
52struct CreateRowCompressedADJMatrix : public Core {
53
54 CreateRowCompressedADJMatrix(moab::Interface &moab,
55 MPI_Comm comm = PETSC_COMM_WORLD,
56 int verbose = 1)
57 : Core(moab, comm, verbose) {}
58
59 using ProblemsByName = Problem_multiIndex::index<Problem_mi_tag>::type;
60
61 /** \brief Create matrix adjacencies
62
63 TAG is the container index of the numbered DOFs that is iterated and
64 whose index fills the arrays. The rows of this rank are the ones with
65 its part, except for the adjacency matrix of a problem that is not
66 partitioned yet (MATMPIADJ): then they are a PetscLayout range of the
67 global index, which buildProblem assigns in UID order on every rank.
68
69 */
70 template <typename TAG>
72 createMatArrays(ProblemsByName::iterator p_miit, const MatType type,
73 std::vector<PetscInt> &i, std::vector<PetscInt> &j,
74 const bool no_diagonals = true, int verb = QUIET) const;
75
76private:
77 using AdjByEnt = FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
78 Unique_mi_tag>::type;
79
80 using DofByGlobalPetscIndex =
81 NumeredDofEntity_multiIndex::index<PetscGlobalIdx_mi_tag>::type;
82
83 /** \brief Get element adjacencies
84 */
85 template <typename TAG>
86 MoFEMErrorCode getEntityAdjacencies(
87 ProblemsByName::iterator p_miit,
88 typename boost::multi_index::index<NumeredDofEntity_multiIndex,
89 TAG>::type::iterator mit_row,
90 boost::shared_ptr<FieldEntity> mofem_ent_ptr,
91 std::vector<int> &dofs_col_view, int verb) const;
92
93 /** \brief Add the column indices of one element and return its slot
94 *
95 * Requires the entity column DOF cache set by createMatArrays. Elements
96 * are added the first time a row entity is adjacent to them, so only the
97 * elements that contribute to local rows are listed.
98 */
99 template <typename TAG>
100 MoFEMErrorCode addElementColumns(const EntFiniteElement &fe,
101 ElementColumns &columns, int &slot) const;
102};
103
104template <typename TAG>
105MoFEMErrorCode CreateRowCompressedADJMatrix::addElementColumns(
106 const EntFiniteElement &fe, ElementColumns &columns, int &slot) const {
108 slot = columns.elementSegments.size();
109 columns.slot[&fe] = slot;
110 const int first_segment = columns.segments.size();
111 bool open = false;
112 for (auto &it : fe.getColFieldEnts()) {
113 if (auto e = it.lock()) {
114 auto cache = e->entityCacheColDofs.lock();
115 if (!cache)
116 SETERRQ(mofemComm, MOFEM_DATA_INCONSISTENCY, "Cache not set");
117 if (!open || columns.segments.back().field != e->getId()) {
118 if (open)
119 columns.segments.back().end = columns.indices.size();
120 columns.segments.push_back(
121 {e->getId(), static_cast<int>(columns.indices.size()), 0});
122 open = true;
123 }
124 for (auto vit = cache->loHi[0]; vit != cache->loHi[1]; ++vit) {
125 const int idx = TAG::get_index(vit);
126 if (PetscLikely(idx >= 0))
127 columns.indices.push_back(idx);
128 }
129 }
130 }
131 if (open)
132 columns.segments.back().end = columns.indices.size();
133 columns.elementSegments.push_back(
134 {first_segment, static_cast<int>(columns.segments.size())});
136}
137
138/**
139 * @deprecated do not use, instead use CreateRowCompressedADJMatrix
140 */
141using CreateRowComressedADJMatrix = CreateRowCompressedADJMatrix;
142
143template <typename TAG>
144MoFEMErrorCode CreateRowCompressedADJMatrix::getEntityAdjacencies(
145 ProblemsByName::iterator p_miit,
146 typename boost::multi_index::index<NumeredDofEntity_multiIndex,
147 TAG>::type::iterator mit_row,
148 boost::shared_ptr<FieldEntity> mofem_ent_ptr,
149 std::vector<int> &dofs_col_view, int verb) const {
151
152 BitRefLevel prb_bit = p_miit->getBitRefLevel();
153 BitRefLevel prb_mask = p_miit->getBitRefLevelMask();
154
155 const EmptyFieldBlocks &empty_field_blocks = p_miit->getEmptyFieldBlocks();
156
157 dofs_col_view.clear();
158 for (auto r = entFEAdjacencies.get<Unique_mi_tag>().equal_range(
159 mofem_ent_ptr->getLocalUniqueId());
160 r.first != r.second; ++r.first) {
161
162 if (r.first->byWhat & BYROW) {
163
164 if ((r.first->entFePtr->getId() & p_miit->getBitFEId()).none()) {
165 // if element is not part of problem
166 continue;
167 }
168
169 const BitRefLevel &fe_bit = r.first->entFePtr->getBitRefLevel();
170 // if entity is not problem refinement level
171 if ((fe_bit & prb_bit).any() && (fe_bit & prb_mask) == fe_bit) {
172
173 auto check_block = [&empty_field_blocks](auto &r_if, auto &col_id) {
174 for (auto &b : empty_field_blocks) {
175 if ((b.first & r_if).any() && (b.second & col_id).any()) {
176 return false;
177 }
178 }
179 return true;
180 };
181
182 for (auto &it : r.first->entFePtr->getColFieldEnts()) {
183 if (auto e = it.lock()) {
184
185 if (check_block((*mit_row)->getId(), e->getId())) {
186
187 if (auto cache = e->entityCacheColDofs.lock()) {
188 const auto lo = cache->loHi[0];
189 const auto hi = cache->loHi[1];
190 for (auto vit = lo; vit != hi; ++vit) {
191
192 const int idx = TAG::get_index(vit);
193 if (PetscLikely(idx >= 0))
194 dofs_col_view.push_back(idx);
195
196#ifndef NDEBUG
197 const DofIdx nb_dofs_col = p_miit->getNbDofsCol();
198 if (PetscUnlikely(idx >= nb_dofs_col)) {
199 MOFEM_LOG("SELF", Sev::error)
200 << "Problem with dof: " << std::endl
201 << "Rank " << rAnk << " : " << *(*vit);
202 SETERRQ(
203 mofemComm, PETSC_ERR_ARG_SIZ,
204 "Index of dof larger than number of DOFs in column");
205 }
206#endif
207 }
208
209 } else {
210 SETERRQ(mofemComm, MOFEM_DATA_INCONSISTENCY, "Cache not set");
211 }
212 }
213 }
214 }
215 }
216 }
217 }
218
220}
221
222template <typename TAG>
223MoFEMErrorCode CreateRowCompressedADJMatrix::createMatArrays(
224 ProblemsByName::iterator p_miit, const MatType type,
225 std::vector<PetscInt> &i, std::vector<PetscInt> &j, const bool no_diagonals,
226 int verb) const {
228
229 PetscLogEventBegin(MOFEM_EVENT_createMat, 0, 0, 0, 0);
230
231 auto cache = boost::make_shared<std::vector<EntityCacheNumeredDofs>>(
232 entsFields.size());
233
234 size_t idx = 0;
235 for (auto it = entsFields.begin(); it != entsFields.end(); ++it, ++idx) {
236
237 const auto uid = (*it)->getLocalUniqueId();
238 auto r = entFEAdjacencies.get<Unique_mi_tag>().equal_range(uid);
239 for (auto lo = r.first; lo != r.second; ++lo) {
240
241 if ((lo->getBitFEId() & p_miit->getBitFEId()).any()) {
242
243 const BitRefLevel &prb_bit = p_miit->getBitRefLevel();
244 const BitRefLevel &prb_mask = p_miit->getBitRefLevelMask();
245 const BitRefLevel &fe_bit = lo->entFePtr->getBitRefLevel();
246
247 // if entity is not problem refinement level
248 if ((fe_bit & prb_mask) != fe_bit)
249 continue;
250 if ((fe_bit & prb_bit).none())
251 continue;
252
253 auto dit = p_miit->numeredColDofsPtr->lower_bound(uid);
254
255 decltype(dit) hi_dit;
256 if (dit != p_miit->numeredColDofsPtr->end())
257 hi_dit = p_miit->numeredColDofsPtr->upper_bound(
258 uid | static_cast<UId>(MAX_DOFS_ON_ENTITY - 1));
259 else
260 hi_dit = dit;
261
262 (*it)->entityCacheColDofs =
263 boost::shared_ptr<EntityCacheNumeredDofs>(cache, &((*cache)[idx]));
264 (*cache)[idx].loHi = {dit, hi_dit};
265
266 break;
267 }
268 }
269 }
270
271 using NumeredDofEntitysByIdx =
272 typename boost::multi_index::index<NumeredDofEntity_multiIndex,
273 TAG>::type;
274
275 // Get multi-indices for rows and columns
276 const NumeredDofEntitysByIdx &dofs_row_by_idx =
277 p_miit->numeredRowDofsPtr->get<TAG>();
278 int nb_dofs_row = p_miit->getNbDofsRow();
279 if (nb_dofs_row == 0) {
280 SETERRQ(mofemComm, MOFEM_DATA_INCONSISTENCY, "problem <%s> has zero rows",
281 p_miit->getName().c_str());
282 }
283
284 // Get adjacencies form other processors
285 std::map<int, std::vector<int>> adjacent_dofs_on_other_parts;
286
287 // The adjacency matrix for partitioning is made before any part is set:
288 // its rows are a PetscLayout range of the global index. Otherwise the rows
289 // of this rank are the ones with its part, and the adjacencies of shared
290 // rows owned elsewhere are collected from the other parts. If only the
291 // algebra is partitioned there is nothing to collect: the mesh is assumed
292 // to be the same on every processor.
293 const bool rows_by_layout = strcmp(type, MATMPIADJ) == 0;
294 typename NumeredDofEntitysByIdx::iterator miit_row, hi_miit_row;
295
296 if (rows_by_layout) {
297
298 // Get range of local indices
299 PetscLayout layout;
300 CHKERR PetscLayoutCreate(mofemComm, &layout);
301 CHKERR PetscLayoutSetBlockSize(layout, 1);
302 CHKERR PetscLayoutSetSize(layout, nb_dofs_row);
303 CHKERR PetscLayoutSetUp(layout);
304 PetscInt rstart, rend;
305 CHKERR PetscLayoutGetRange(layout, &rstart, &rend);
306 CHKERR PetscLayoutDestroy(&layout);
307
308 if (verb >= VERBOSE) {
309 MOFEM_LOG("SYNC", Sev::noisy)
310 << "row lower " << rstart << " row upper " << rend;
311 MOFEM_LOG_SYNCHRONISE(mofemComm)
312 }
313
314 miit_row = dofs_row_by_idx.lower_bound(rstart);
315 hi_miit_row = dofs_row_by_idx.lower_bound(rend);
316 if (std::distance(miit_row, hi_miit_row) != rend - rstart) {
317 SETERRQ(
318 mofemComm, PETSC_ERR_ARG_SIZ,
319 "data inconsistency, std::distance(miit_row,hi_miit_row) != rend - "
320 "rstart (%ld != %d - %d = %d) ",
321 std::distance(miit_row, hi_miit_row), rend, rstart, rend - rstart);
322 }
323
324 } else {
325
326 MPI_Comm comm;
327 // // Make sure it is a PETSc mofemComm
328 CHKERR PetscCommDuplicate(get_comm(), &comm, NULL);
329
330 // get adjacent nodes on other partitions
331 std::vector<std::vector<int>> dofs_vec(sIze);
332
333 boost::shared_ptr<FieldEntity> mofem_ent_ptr;
334 std::vector<int> dofs_col_view;
335
336 typename NumeredDofEntitysByIdx::iterator mit_row, hi_mit_row;
337
338 mit_row = dofs_row_by_idx.begin();
339 hi_mit_row = dofs_row_by_idx.end();
340 for (; mit_row != hi_mit_row; mit_row++) {
341
342 // Shared or multi-shared row and not owned. Those data should be send to
343 // other side.
344
345 // Get entity adjacencies, no need to repeat that operation for dofs when
346 // are on the same entity. For simplicity is assumed that those sheered
347 // the same adjacencies.
348 unsigned char pstatus = (*mit_row)->getPStatus();
349 if ((pstatus & PSTATUS_NOT_OWNED) &&
350 (pstatus & (PSTATUS_SHARED | PSTATUS_MULTISHARED))) {
351
352 bool get_adj_col = true;
353 if (mofem_ent_ptr) {
354 if (mofem_ent_ptr->getLocalUniqueId() ==
355 (*mit_row)->getFieldEntityPtr()->getLocalUniqueId()) {
356 get_adj_col = false;
357 }
358 }
359
360 if (get_adj_col) {
361 // Get entity adjacencies
362 mofem_ent_ptr = (*mit_row)->getFieldEntityPtr();
363 CHKERR getEntityAdjacencies<TAG>(p_miit, mit_row, mofem_ent_ptr,
364 dofs_col_view, verb);
365 // Sort, unique and resize dofs_col_view
366 {
367 std::sort(dofs_col_view.begin(), dofs_col_view.end());
368 std::vector<int>::iterator new_end =
369 std::unique(dofs_col_view.begin(), dofs_col_view.end());
370 int new_size = std::distance(dofs_col_view.begin(), new_end);
371 dofs_col_view.resize(new_size);
372 }
373 // Add that row. Patterns is that first index is row index, second is
374 // size of adjacencies after that follows column adjacencies.
375 int owner = (*mit_row)->getOwnerProc();
376 dofs_vec[owner].emplace_back(TAG::get_index(mit_row)); // row index
377 dofs_vec[owner].emplace_back(
378 dofs_col_view.size()); // nb. of column adjacencies
379 // add adjacent cools
380 dofs_vec[owner].insert(dofs_vec[owner].end(), dofs_col_view.begin(),
381 dofs_col_view.end());
382 }
383 }
384 }
385
386 int nsends = 0; // number of messages to send
387 std::vector<int> dofs_vec_length(sIze); // length of the message to proc
388 for (int proc = 0; proc < sIze; proc++) {
389
390 if (!dofs_vec[proc].empty()) {
391
392 dofs_vec_length[proc] = dofs_vec[proc].size();
393 nsends++;
394
395 } else {
396
397 dofs_vec_length[proc] = 0;
398 }
399 }
400
401 std::vector<MPI_Status> status(sIze);
402
403 // Computes the number of messages a node expects to receive
404 int nrecvs; // number of messages received
405 CHKERR PetscGatherNumberOfMessages(comm, NULL, &dofs_vec_length[0],
406 &nrecvs);
407
408 // Computes info about messages that a MPI-node will receive, including
409 // (from-id,length) pairs for each message.
410 int *onodes; // list of node-ids from which messages are expected
411 int *olengths; // corresponding message lengths
412 CHKERR PetscGatherMessageLengths(comm, nsends, nrecvs, &dofs_vec_length[0],
413 &onodes, &olengths);
414
415 // Gets a unique new tag from a PETSc communicator.
416 int tag;
417 CHKERR PetscCommGetNewTag(comm, &tag);
418
419 // Allocate a buffer sufficient to hold messages of size specified in
420 // olengths. And post Irecvs on these buffers using node info from onodes
421 int **rbuf; // must bee freed by user
422 MPI_Request *r_waits; // must bee freed by user
423
424 // rbuf has a pointers to messages. It has size of of nrecvs (number of
425 // messages) +1. In the first index a block is allocated,
426 // such that rbuf[i] = rbuf[i-1]+olengths[i-1].
427 CHKERR PetscPostIrecvInt(comm, tag, nrecvs, onodes, olengths, &rbuf,
428 &r_waits);
429
430 MPI_Request *s_waits; // status of sens messages
431 CHKERR PetscMalloc1(nsends, &s_waits);
432
433 // Send messages
434 for (int proc = 0, kk = 0; proc < sIze; proc++) {
435 if (!dofs_vec_length[proc])
436 continue; // no message to send to this proc
437 CHKERR MPI_Isend(&(dofs_vec[proc])[0], // buffer to send
438 dofs_vec_length[proc], // message length
439 MPIU_INT, proc, // to proc
440 tag, comm, s_waits + kk);
441 kk++;
442 }
443
444 // Wait for received
445 if (nrecvs) {
446 CHKERR MPI_Waitall(nrecvs, r_waits, &status[0]);
447 }
448 // Wait for send messages
449 if (nsends) {
450 CHKERR MPI_Waitall(nsends, s_waits, &status[0]);
451 }
452
453 for (int kk = 0; kk < nrecvs; kk++) {
454
455 int len = olengths[kk];
456 int *data_from_proc = rbuf[kk];
457
458 for (int ii = 0; ii < len;) {
459
460 int row_idx = data_from_proc[ii++]; // get row number
461 int nb_adj_dofs = data_from_proc[ii++]; // get nb. of adjacent dofs
462
463 if (debug) {
464
465 DofByGlobalPetscIndex::iterator dit;
466 dit = p_miit->numeredRowDofsPtr->get<PetscGlobalIdx_mi_tag>().find(
467 row_idx);
468 if (dit ==
469 p_miit->numeredRowDofsPtr->get<PetscGlobalIdx_mi_tag>().end()) {
470 SETERRQ(get_comm(), MOFEM_DATA_INCONSISTENCY,
471 "dof %d can not be found in problem", row_idx);
472 }
473 }
474
475 for (int jj = 0; jj < nb_adj_dofs; jj++) {
476 adjacent_dofs_on_other_parts[row_idx].push_back(data_from_proc[ii++]);
477 }
478 }
479 }
480
481 // Cleaning
482 CHKERR PetscFree(s_waits);
483 CHKERR PetscFree(rbuf[0]);
484 CHKERR PetscFree(rbuf);
485 CHKERR PetscFree(r_waits);
486 CHKERR PetscFree(onodes);
487 CHKERR PetscFree(olengths);
488
489 miit_row = dofs_row_by_idx.begin();
490 hi_miit_row = dofs_row_by_idx.end();
491
492 CHKERR PetscCommDestroy(&comm);
493 }
494
495 boost::shared_ptr<FieldEntity> mofem_ent_ptr;
496 int row_last_evaluated_idx = -1;
497
498 std::vector<int> dofs_vec;
499
500 // Column lists per element, built on first use and merged per row entity
501 // through a stamp array: an index enters the row once, without sorting
502 // the concatenation of all adjacent elements' DOFs.
503 ElementColumns columns;
504 columns.slot.reserve(p_miit->numeredFiniteElementsPtr->size());
505 std::vector<int> stamp(p_miit->getNbDofsCol(), -1);
506 int stamp_id = -1;
507 const auto &empty_field_blocks = p_miit->getEmptyFieldBlocks();
508 auto check_block = [&empty_field_blocks](const BitFieldId &row_field,
509 const BitFieldId &col_field) {
510 for (auto &b : empty_field_blocks)
511 if ((b.first & row_field).any() && (b.second & col_field).any())
512 return false;
513 return true;
514 };
515 const BitRefLevel prb_bit = p_miit->getBitRefLevel();
516 const BitRefLevel prb_mask = p_miit->getBitRefLevelMask();
517 auto push_once = [&](const int idx) {
519 if (PetscUnlikely(idx >= static_cast<int>(stamp.size())))
520 SETERRQ(mofemComm, PETSC_ERR_ARG_SIZ,
521 "Index of dof larger than number of DOFs in column");
522 if (stamp[idx] != stamp_id) {
523 stamp[idx] = stamp_id;
524 dofs_vec.push_back(idx);
525 }
527 };
528
529 // loop local rows
530 int nb_loc_row_from_iterators = 0;
531 unsigned int rows_to_fill = p_miit->getNbLocalDofsRow();
532 // Stage one sorted list per run of rows on a field entity. This is much
533 // smaller than the final CSR at high order, where many rows share a list.
534 struct RowPattern {
535 std::size_t begin, end;
536 int firstRow, lastRow;
537 };
538 std::vector<RowPattern> row_patterns;
539 row_patterns.reserve(std::min<std::size_t>(rows_to_fill, entsFields.size()));
540 std::vector<PetscInt> pattern_columns;
541 std::vector<PetscInt> row_diagonals;
542 if (no_diagonals)
543 row_diagonals.reserve(rows_to_fill);
544 std::size_t nb_nonzeros = j.size();
545 i.reserve(rows_to_fill + 1);
546 for (; miit_row != hi_miit_row; miit_row++) {
547
548 if (!rows_by_layout) {
549 if (static_cast<int>((*miit_row)->getPart()) != rAnk)
550 continue;
551 }
552 // This is only for cross-check if everything is ok
553 nb_loc_row_from_iterators++;
554
555 // add next row to compressed matrix
556 i.push_back(static_cast<PetscInt>(nb_nonzeros));
557
558 // Get entity adjacencies, no need to repeat that operation for dofs when
559 // are on the same entity. For simplicity is assumed that those share the
560 // same adjacencies.
561 if ((!mofem_ent_ptr)
562 ? 1
563 : (mofem_ent_ptr->getLocalUniqueId() !=
564 (*miit_row)->getFieldEntityPtr()->getLocalUniqueId())) {
565
566 // get entity adjacencies
567 mofem_ent_ptr = (*miit_row)->getFieldEntityPtr();
568 row_last_evaluated_idx = TAG::get_index(miit_row);
569 const BitFieldId row_field = (*miit_row)->getId();
570
571 dofs_vec.resize(0);
572 ++stamp_id;
573 for (auto r = entFEAdjacencies.get<Unique_mi_tag>().equal_range(
574 mofem_ent_ptr->getLocalUniqueId());
575 r.first != r.second; ++r.first) {
576 if (!(r.first->byWhat & BYROW))
577 continue;
578 const auto &fe_ptr = r.first->entFePtr;
579 if ((fe_ptr->getId() & p_miit->getBitFEId()).none())
580 continue;
581 const BitRefLevel &fe_bit = fe_ptr->getBitRefLevel();
582 if (!((fe_bit & prb_bit).any() && (fe_bit & prb_mask) == fe_bit))
583 continue;
584 int slot;
585 auto slot_it = columns.slot.find(fe_ptr.get());
586 if (slot_it != columns.slot.end())
587 slot = slot_it->second;
588 else
589 CHKERR addElementColumns<TAG>(*fe_ptr, columns, slot);
590 const auto segment_range = columns.elementSegments[slot];
591 for (int s = segment_range[0]; s != segment_range[1]; ++s) {
592 const auto &segment = columns.segments[s];
593 if (!check_block(row_field, segment.field))
594 continue;
595 for (int k = segment.begin; k != segment.end; ++k)
596 CHKERR push_once(columns.indices[k]);
597 }
598 }
599
600 unsigned char pstatus = (*miit_row)->getPStatus();
601 if (pstatus > 0) {
602 std::map<int, std::vector<int>>::iterator mit;
603 mit = adjacent_dofs_on_other_parts.find(row_last_evaluated_idx);
604 if (mit == adjacent_dofs_on_other_parts.end()) {
605 // NOTE: Dof can adjacent to other part but no elements are there
606 // which use that dof std::cerr << *miit_row << std::endl; SETERRQ(
607 // get_comm(),MOFEM_DATA_INCONSISTENCY,
608 // "data inconsistency row_last_evaluated_idx = %d",
609 // row_last_evaluated_idx
610 // );
611 } else {
612 for (auto idx : mit->second)
613 CHKERR push_once(idx);
614 }
615 }
616
617 // The unique list is sorted so that PETSc inserts rows in order.
618 std::sort(dofs_vec.begin(), dofs_vec.end());
619 const auto begin = pattern_columns.size();
620 pattern_columns.insert(pattern_columns.end(), dofs_vec.begin(),
621 dofs_vec.end());
622 row_patterns.push_back({begin, pattern_columns.size(),
623 nb_loc_row_from_iterators - 1,
624 nb_loc_row_from_iterators});
625 }
626
627 row_patterns.back().lastRow = nb_loc_row_from_iterators;
628 auto row_size = dofs_vec.size();
629 if (no_diagonals) {
630 const auto diagonal = TAG::get_index(miit_row);
631 row_diagonals.push_back(diagonal);
632 if (std::binary_search(dofs_vec.begin(), dofs_vec.end(), diagonal))
633 --row_size;
634 }
635 if (row_size > std::numeric_limits<PetscInt>::max() - nb_nonzeros)
636 SETERRQ(mofemComm, PETSC_ERR_ARG_SIZ,
637 "CSR column offsets exceed the PetscInt range");
638 nb_nonzeros += row_size;
639 }
640
641 i.push_back(static_cast<PetscInt>(nb_nonzeros));
642 // The exact row counts are known: reserve once and bulk-copy each list,
643 // splitting it only when the graph-partitioning path excludes a diagonal.
644 j.reserve(nb_nonzeros);
645 for (const auto &pattern : row_patterns) {
646 const auto begin = pattern_columns.begin() + pattern.begin;
647 const auto end = pattern_columns.begin() + pattern.end;
648 for (int row = pattern.firstRow; row != pattern.lastRow; ++row) {
649 if (!no_diagonals || i[row + 1] - i[row] == pattern.end - pattern.begin)
650 j.insert(j.end(), begin, end);
651 else {
652 const auto diagonal = std::lower_bound(begin, end, row_diagonals[row]);
653 j.insert(j.end(), begin, diagonal);
654 j.insert(j.end(), std::next(diagonal), end);
655 }
656 }
657 }
658
659 if (strcmp(type, MATMPIADJ) == 0) {
660
661 // Adjacency matrix used to partition problems, f.e. METIS
662 if (i.size() - 1 != (unsigned int)nb_loc_row_from_iterators) {
663 SETERRQ(
664 get_comm(), PETSC_ERR_ARG_SIZ,
665 "Number of rows from iterator is different than size of rows in "
666 "compressed row "
667 "matrix (unsigned int)nb_local_dofs_row != i.size() - 1, i.e. %u != "
668 "%zu",
669 (unsigned int)nb_loc_row_from_iterators, i.size() - 1);
670 }
671
672 } else if (strcmp(type, MATMPIAIJ) == 0) {
673
674 // Compressed MPIADJ matrix
675 if (i.size() - 1 != (unsigned int)nb_loc_row_from_iterators) {
676 SETERRQ(
677 get_comm(), PETSC_ERR_ARG_SIZ,
678 "Number of rows from iterator is different than size of rows in "
679 "compressed row "
680 "matrix (unsigned int)nb_local_dofs_row != i.size() - 1, i.e. %u != "
681 "%zu",
682 (unsigned int)nb_loc_row_from_iterators, i.size() - 1);
683 }
684 PetscInt nb_local_dofs_row = p_miit->getNbLocalDofsRow();
685 if ((unsigned int)nb_local_dofs_row != i.size() - 1) {
686 SETERRQ(
687 get_comm(), PETSC_ERR_ARG_SIZ,
688 "Number of rows is different than size of rows in compressed row "
689 "matrix (unsigned int)nb_local_dofs_row != i.size() - 1, i.e. %u != "
690 "%zu",
691 (unsigned int)nb_local_dofs_row, i.size() - 1);
692 }
693
694 } else if (strcmp(type, MATAIJ) == 0) {
695
696 // Sequential compressed ADJ matrix
697 if (i.size() - 1 != (unsigned int)nb_loc_row_from_iterators) {
698 SETERRQ(
699 get_comm(), PETSC_ERR_ARG_SIZ,
700 "Number of rows form iterator is different than size of rows in "
701 "compressed row "
702 "matrix (unsigned int)nb_local_dofs_row != i.size() - 1, i.e. %u != "
703 "%zu",
704 (unsigned int)nb_loc_row_from_iterators, i.size() - 1);
705 }
706 PetscInt nb_local_dofs_row = p_miit->getNbLocalDofsRow();
707 if ((unsigned int)nb_local_dofs_row != i.size() - 1) {
708 SETERRQ(
709 get_comm(), PETSC_ERR_ARG_SIZ,
710 "Number of rows is different than size of rows in compressed row "
711 "matrix (unsigned int)nb_local_dofs_row != i.size() - 1, i.e. %u != "
712 "%zu",
713 (unsigned int)nb_local_dofs_row, i.size() - 1);
714 }
715
716 } else if (strcmp(type, MATAIJCUSPARSE) == 0) {
717
718 if (i.size() - 1 != (unsigned int)nb_loc_row_from_iterators) {
719 SETERRQ(get_comm(), PETSC_ERR_ARG_SIZ, "data inconsistency");
720 }
721 PetscInt nb_local_dofs_row = p_miit->getNbLocalDofsRow();
722 if ((unsigned int)nb_local_dofs_row != i.size() - 1) {
723 SETERRQ(get_comm(), PETSC_ERR_ARG_SIZ, "data inconsistency");
724 }
725
726 } else {
727
728 SETERRQ(get_comm(), PETSC_ERR_ARG_NULL, "not implemented");
729 }
730
731 PetscLogEventEnd(MOFEM_EVENT_createMat, 0, 0, 0, 0);
733}
734
736MatrixManager::query_interface(boost::typeindex::type_index type_index,
737 UnknownInterface **iface) const {
738 *iface = const_cast<MatrixManager *>(this);
739 return 0;
740}
741
742MatrixManager::MatrixManager(const MoFEM::Core &core)
743 : cOre(const_cast<MoFEM::Core &>(core)) {
744 PetscLogEventRegister("MatMngCrtMPIAIJ", 0, &MOFEM_EVENT_createMPIAIJ);
745 PetscLogEventRegister("MatMngCrtMPIAIJWthArr", 0,
746 &MOFEM_EVENT_createMPIAIJWithArrays);
747 PetscLogEventRegister("MatMngCrtMPIAdjWithArr", 0,
748 &MOFEM_EVENT_createMPIAdjWithArrays);
749 PetscLogEventRegister("MatMngCrtMPIAIJCUSPARSEWthArr", 0,
750 &MOFEM_EVENT_createMPIAIJCUSPARSEWithArrays);
751 PetscLogEventRegister("MatMngCrtSeqAIJCUSPARSEWthArrs", 0,
752 &MOFEM_EVENT_createSeqAIJCUSPARSEWithArrays);
753 PetscLogEventRegister("MatMngCrtSeqAIJWthArrs", 0,
754 &MOFEM_EVENT_createSeqAIJWithArrays);
755 PetscLogEventRegister("MatMngCrtCheckMPIAIJWthArrFillIn", 0,
756 &MOFEM_EVENT_checkMatrixFillIn);
757}
758
759template <>
760MoFEMErrorCode MatrixManager::createMPIAIJWithArrays<PetscGlobalIdx_mi_tag>(
761 const std::string name, Mat *Aij, int verb) {
763
764 MoFEM::CoreInterface &m_field = cOre;
765 CreateRowCompressedADJMatrix *core_ptr =
766 static_cast<CreateRowCompressedADJMatrix *>(&cOre);
767 PetscLogEventBegin(MOFEM_EVENT_createMPIAIJWithArrays, 0, 0, 0, 0);
768
769 auto problems_ptr = m_field.get_problems();
770 auto &prb = problems_ptr->get<Problem_mi_tag>();
771 auto p_miit = prb.find(name);
772 if (p_miit == prb.end()) {
773 SETERRQ(m_field.get_comm(), MOFEM_NOT_FOUND,
774 "problem < %s > is not found (top tip: check spelling)",
775 name.c_str());
776 }
777
778 std::vector<int> i_vec, j_vec;
779 j_vec.reserve(10000);
780 CHKERR core_ptr->createMatArrays<PetscGlobalIdx_mi_tag>(
781 p_miit, MATMPIAIJ, i_vec, j_vec, false, verb);
782
783 int nb_row_dofs = p_miit->getNbDofsRow();
784 int nb_col_dofs = p_miit->getNbDofsCol();
785 int nb_local_dofs_row = p_miit->getNbLocalDofsRow();
786 int nb_local_dofs_col = p_miit->getNbLocalDofsCol();
787
788 CHKERR ::MatCreateMPIAIJWithArrays(
789 m_field.get_comm(), nb_local_dofs_row, nb_local_dofs_col, nb_row_dofs,
790 nb_col_dofs, &*i_vec.begin(), &*j_vec.begin(), PETSC_NULLPTR, Aij);
791
792 PetscLogEventEnd(MOFEM_EVENT_createMPIAIJWithArrays, 0, 0, 0, 0);
794}
795
796template <>
798MatrixManager::createMPIAIJCUSPARSEWithArrays<PetscGlobalIdx_mi_tag>(
799 const std::string name, Mat *Aij, int verb) {
801
802 MoFEM::CoreInterface &m_field = cOre;
803 CreateRowCompressedADJMatrix *core_ptr =
804 static_cast<CreateRowCompressedADJMatrix *>(&cOre);
805 PetscLogEventBegin(MOFEM_EVENT_createMPIAIJCUSPARSEWithArrays, 0, 0, 0, 0);
806
807 auto problems_ptr = m_field.get_problems();
808 auto &prb = problems_ptr->get<Problem_mi_tag>();
809 auto p_miit = prb.find(name);
810 if (p_miit == prb.end()) {
811 SETERRQ(m_field.get_comm(), MOFEM_NOT_FOUND,
812 "problem < %s > is not found (top tip: check spelling)",
813 name.c_str());
814 }
815
816 std::vector<int> i_vec, j_vec;
817 j_vec.reserve(10000);
818 CHKERR core_ptr->createMatArrays<PetscGlobalIdx_mi_tag>(
819 p_miit, MATAIJCUSPARSE, i_vec, j_vec, false, verb);
820
821 int nb_local_dofs_row = p_miit->getNbLocalDofsRow();
822 int nb_local_dofs_col = p_miit->getNbLocalDofsCol();
823
824 auto get_layout = [&]() {
825 int start_ranges, end_ranges;
826 PetscLayout layout;
827 CHKERR PetscLayoutCreate(m_field.get_comm(), &layout);
828 CHKERR PetscLayoutSetBlockSize(layout, 1);
829 CHKERR PetscLayoutSetLocalSize(layout, nb_local_dofs_col);
830 CHKERR PetscLayoutSetUp(layout);
831 CHKERR PetscLayoutGetRange(layout, &start_ranges, &end_ranges);
832 CHKERR PetscLayoutDestroy(&layout);
833 return std::make_pair(start_ranges, end_ranges);
834 };
835
836 auto get_nnz = [&](auto &d_nnz, auto &o_nnz) {
838 auto layout = get_layout();
839 int j = 0;
840 for (int i = 0; i != nb_local_dofs_row; ++i) {
841 for (; j != i_vec[i + 1]; ++j) {
842 if (j_vec[j] < layout.second && j_vec[j] >= layout.first)
843 ++(d_nnz[i]);
844 else
845 ++(o_nnz[i]);
846 }
847 }
849 };
850
851 std::vector<int> d_nnz(nb_local_dofs_row, 0), o_nnz(nb_local_dofs_row, 0);
852 CHKERR get_nnz(d_nnz, o_nnz);
853
854#ifdef PETSC_HAVE_CUDA
855 CHKERR ::MatCreateAIJCUSPARSE(m_field.get_comm(), nb_local_dofs_row,
856 nb_local_dofs_col, nb_row_dofs, nb_col_dofs, 0,
857 &*d_nnz.begin(), 0, &*o_nnz.begin(), Aij);
858#else
859 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
860 "Error: To use this matrix type compile PETSc with CUDA.");
861#endif
862
863 PetscLogEventEnd(MOFEM_EVENT_createMPIAIJCUSPARSEWithArrays, 0, 0, 0, 0);
864
866}
867
868template <>
870MatrixManager::createSeqAIJCUSPARSEWithArrays<PetscLocalIdx_mi_tag>(
871 const std::string name, Mat *Aij, int verb) {
873
874#ifdef PETSC_HAVE_CUDA
875 // CHKERR ::MatCreateSeqAIJCUSPARSE(MPI_Comm comm, PetscInt m, PetscInt n,
876 // PetscInt nz, const PetscInt nnz[], Mat
877 // *A);
878 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
879 "Not implemented type of matrix yet, try MPI version (aijcusparse)");
880#endif
881
883}
884
885template <>
887MatrixManager::createMPIAIJ<PetscGlobalIdx_mi_tag>(const std::string name,
888 Mat *Aij, int verb) {
889 MoFEM::CoreInterface &m_field = cOre;
890 CreateRowCompressedADJMatrix *core_ptr =
891 static_cast<CreateRowCompressedADJMatrix *>(&cOre);
893 PetscLogEventBegin(MOFEM_EVENT_createMPIAIJ, 0, 0, 0, 0);
894
895 auto problems_ptr = m_field.get_problems();
896 auto &prb = problems_ptr->get<Problem_mi_tag>();
897 auto p_miit = prb.find(name);
898 if (p_miit == prb.end()) {
899 SETERRQ(m_field.get_comm(), MOFEM_NOT_FOUND,
900 "problem < %s > is not found (top tip: check spelling)",
901 name.c_str());
902 }
903
904 std::vector<int> i_vec, j_vec;
905 j_vec.reserve(10000);
906 CHKERR core_ptr->createMatArrays<PetscGlobalIdx_mi_tag>(
907 p_miit, MATMPIAIJ, i_vec, j_vec, false, verb);
908
909 int nb_row_dofs = p_miit->getNbDofsRow();
910 int nb_col_dofs = p_miit->getNbDofsCol();
911 int nb_local_dofs_row = p_miit->getNbLocalDofsRow();
912 int nb_local_dofs_col = p_miit->getNbLocalDofsCol();
913
914 auto get_layout = [&]() {
915 int start_ranges, end_ranges;
916 PetscLayout layout;
917 CHKERR PetscLayoutCreate(m_field.get_comm(), &layout);
918 CHKERR PetscLayoutSetBlockSize(layout, 1);
919 CHKERR PetscLayoutSetLocalSize(layout, nb_local_dofs_col);
920 CHKERR PetscLayoutSetUp(layout);
921 CHKERR PetscLayoutGetRange(layout, &start_ranges, &end_ranges);
922 CHKERR PetscLayoutDestroy(&layout);
923 return std::make_pair(start_ranges, end_ranges);
924 };
925
926 auto get_nnz = [&](auto &d_nnz, auto &o_nnz) {
928 auto layout = get_layout();
929 int j = 0;
930 for (int i = 0; i != nb_local_dofs_row; ++i) {
931 for (; j != i_vec[i + 1]; ++j) {
932 if (j_vec[j] < layout.second && j_vec[j] >= layout.first)
933 ++(d_nnz[i]);
934 else
935 ++(o_nnz[i]);
936 }
937 }
939 };
940
941 std::vector<int> d_nnz(nb_local_dofs_row, 0), o_nnz(nb_local_dofs_row, 0);
942 CHKERR get_nnz(d_nnz, o_nnz);
943
944 CHKERR MatCreate(m_field.get_comm(), Aij);
945 CHKERR MatSetSizes(*Aij, nb_local_dofs_row, nb_local_dofs_col, nb_row_dofs,
946 nb_col_dofs);
947 CHKERR MatSetType(*Aij, MATMPIAIJ);
948 CHKERR MatMPIAIJSetPreallocation(*Aij, 0, &*d_nnz.begin(), 0,
949 &*o_nnz.begin());
950
951 PetscLogEventEnd(MOFEM_EVENT_createMPIAIJ, 0, 0, 0, 0);
953}
954
955template <>
957MatrixManager::createMPIAdjWithArrays<PetscGlobalIdx_mi_tag>(
958 const std::string name, Mat *Adj, int verb) {
959 MoFEM::CoreInterface &m_field = cOre;
960 CreateRowCompressedADJMatrix *core_ptr =
961 static_cast<CreateRowCompressedADJMatrix *>(&cOre);
963 PetscLogEventBegin(MOFEM_EVENT_createMPIAdjWithArrays, 0, 0, 0, 0);
964
965 auto problems_ptr = m_field.get_problems();
966 auto &prb = problems_ptr->get<Problem_mi_tag>();
967 auto p_miit = prb.find(name);
968 if (p_miit == prb.end()) {
969 SETERRQ(m_field.get_comm(), MOFEM_NOT_FOUND,
970 "problem < %s > is not found (top tip: check spelling)",
971 name.c_str());
972 }
973
974 std::vector<int> i_vec, j_vec;
975 j_vec.reserve(10000);
976 CHKERR core_ptr->createMatArrays<PetscGlobalIdx_mi_tag>(
977 p_miit, MATMPIADJ, i_vec, j_vec, true, verb);
978 int *_i, *_j;
979 CHKERR PetscMalloc(i_vec.size() * sizeof(int), &_i);
980 CHKERR PetscMalloc(j_vec.size() * sizeof(int), &_j);
981 copy(i_vec.begin(), i_vec.end(), _i);
982 copy(j_vec.begin(), j_vec.end(), _j);
983
984 int nb_col_dofs = p_miit->getNbDofsCol();
985 CHKERR MatCreateMPIAdj(m_field.get_comm(), i_vec.size() - 1, nb_col_dofs, _i,
986 _j, PETSC_NULLPTR, Adj);
987 CHKERR MatSetOption(*Adj, MAT_STRUCTURALLY_SYMMETRIC, PETSC_TRUE);
988
989 PetscLogEventEnd(MOFEM_EVENT_createMPIAdjWithArrays, 0, 0, 0, 0);
991}
992
993template <>
994MoFEMErrorCode MatrixManager::createSeqAIJWithArrays<PetscLocalIdx_mi_tag>(
995 const std::string name, Mat *Aij, int verb) {
996 MoFEM::CoreInterface &m_field = cOre;
997 CreateRowCompressedADJMatrix *core_ptr =
998 static_cast<CreateRowCompressedADJMatrix *>(&cOre);
1000 PetscLogEventBegin(MOFEM_EVENT_createMPIAIJWithArrays, 0, 0, 0, 0);
1001
1002 auto problems_ptr = m_field.get_problems();
1003 auto &prb = problems_ptr->get<Problem_mi_tag>();
1004 auto p_miit = prb.find(name);
1005 if (p_miit == prb.end()) {
1006 SETERRQ(m_field.get_comm(), MOFEM_NOT_FOUND,
1007 "problem < %s > is not found (top tip: check spelling)",
1008 name.c_str());
1009 }
1010
1011 std::vector<int> i_vec, j_vec;
1012 j_vec.reserve(10000);
1013 CHKERR core_ptr->createMatArrays<PetscGlobalIdx_mi_tag>(p_miit, MATAIJ, i_vec,
1014 j_vec, false, verb);
1015
1016 int nb_local_dofs_row = p_miit->getNbLocalDofsRow();
1017 int nb_local_dofs_col = p_miit->getNbLocalDofsCol();
1018
1019 double *_a;
1020 CHKERR PetscMalloc(j_vec.size() * sizeof(double), &_a);
1021
1022 Mat tmpMat;
1023 CHKERR ::MatCreateSeqAIJWithArrays(PETSC_COMM_SELF, nb_local_dofs_row,
1024 nb_local_dofs_col, &*i_vec.begin(),
1025 &*j_vec.begin(), _a, &tmpMat);
1026 CHKERR MatDuplicate(tmpMat, MAT_SHARE_NONZERO_PATTERN, Aij);
1027 CHKERR MatDestroy(&tmpMat);
1028
1029 CHKERR PetscFree(_a);
1030
1031 PetscLogEventEnd(MOFEM_EVENT_createMPIAIJWithArrays, 0, 0, 0, 0);
1033}
1034
1035MoFEMErrorCode MatrixManager::checkMatrixFillIn(const std::string problem_name,
1036 int row_print, int col_print,
1037 Mat A, int verb) {
1038 MoFEM::CoreInterface &m_field = cOre;
1040
1041 PetscLogEventBegin(MOFEM_EVENT_checkMatrixFillIn, 0, 0, 0, 0);
1042
1043 struct TestMatrixFillIn : public FEMethod {
1044 CoreInterface *mFieldPtr;
1045
1046 Mat A;
1047
1048 int rowPrint, colPrint;
1049
1050 TestMatrixFillIn(CoreInterface *m_field_ptr, Mat a, int row_print,
1051 int col_print)
1052 : mFieldPtr(m_field_ptr), A(a), rowPrint(row_print),
1053 colPrint(col_print){};
1054
1055 MoFEMErrorCode preProcess() {
1058 }
1059
1060 MoFEMErrorCode operator()() {
1062
1063 if (refinedFiniteElementsPtr->find(
1064 numeredEntFiniteElementPtr->getEnt()) ==
1065 refinedFiniteElementsPtr->end()) {
1066 SETERRQ(mFieldPtr->get_comm(), MOFEM_DATA_INCONSISTENCY,
1067 "data inconsistency");
1068 }
1069
1070 auto row_dofs = getRowDofsPtr();
1071 auto col_dofs = getColDofsPtr();
1072
1073 for (auto cit = col_dofs->begin(); cit != col_dofs->end(); cit++) {
1074
1075 if (refinedEntitiesPtr->find((*cit)->getEnt()) ==
1076 refinedEntitiesPtr->end()) {
1077 SETERRQ(mFieldPtr->get_comm(), MOFEM_DATA_INCONSISTENCY,
1078 "data inconsistency");
1079 }
1080 if (!(*cit)->getActive()) {
1081 SETERRQ(mFieldPtr->get_comm(), MOFEM_DATA_INCONSISTENCY,
1082 "data inconsistency");
1083 }
1084
1085 FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
1086 Composite_Unique_mi_tag>::type::iterator ait;
1087 ait = adjacenciesPtr->get<Composite_Unique_mi_tag>().find(
1088 boost::make_tuple((*cit)->getFieldEntityPtr()->getLocalUniqueId(),
1089 numeredEntFiniteElementPtr->getLocalUniqueId()));
1090 if (ait == adjacenciesPtr->end()) {
1091 SETERRQ(mFieldPtr->get_comm(), MOFEM_DATA_INCONSISTENCY,
1092 "adjacencies data inconsistency");
1093 } else {
1094 UId uid = ait->getEntUniqueId();
1095 if (entitiesPtr->find(uid) == entitiesPtr->end()) {
1096 SETERRQ(mFieldPtr->get_comm(), MOFEM_DATA_INCONSISTENCY,
1097 "data inconsistency");
1098 }
1099 if (dofsPtr->find((*cit)->getLocalUniqueId()) == dofsPtr->end()) {
1100 SETERRQ(mFieldPtr->get_comm(), MOFEM_DATA_INCONSISTENCY,
1101 "data inconsistency");
1102 }
1103 }
1104
1105 if ((*cit)->getEntType() != MBVERTEX) {
1106
1107 auto range =
1108 col_dofs->get<Ent_mi_tag>().equal_range((*cit)->getEnt());
1109 int nb_dofs_on_ent = std::distance(range.first, range.second);
1110
1111 int max_order = (*cit)->getMaxOrder();
1112 if ((*cit)->getNbOfCoeffs() * (*cit)->getOrderNbDofs(max_order) !=
1113 nb_dofs_on_ent) {
1114
1115 /* It could be that you have
1116 removed DOFs from problem, and for example if this was vector field
1117 with components {Ux,Uy,Uz}, you removed on Uz element.*/
1118
1119 MOFEM_LOG("SELF", Sev::warning)
1120 << "Warning: Number of Dofs in Col different than number "
1121 "of dofs for given entity order: "
1122 << "Field name: " << (*cit)->getName() << " "
1123 << (*cit)->getNbOfCoeffs() * (*cit)->getOrderNbDofs(max_order)
1124 << " != " << nb_dofs_on_ent;
1125 }
1126 }
1127 }
1128
1129 for (auto rit = row_dofs->begin(); rit != row_dofs->end(); rit++) {
1130
1131 if (refinedEntitiesPtr->find((*rit)->getEnt()) ==
1132 refinedEntitiesPtr->end()) {
1133 SETERRQ(mFieldPtr->get_comm(), MOFEM_DATA_INCONSISTENCY,
1134 "data inconsistency");
1135 }
1136 if (!(*rit)->getActive()) {
1137 SETERRQ(mFieldPtr->get_comm(), MOFEM_DATA_INCONSISTENCY,
1138 "data inconsistency");
1139 }
1140
1141 FieldEntityEntFiniteElementAdjacencyMap_multiIndex::index<
1142 Composite_Unique_mi_tag>::type::iterator ait;
1143 ait = adjacenciesPtr->get<Composite_Unique_mi_tag>().find(
1144 boost::make_tuple((*rit)->getFieldEntityPtr()->getLocalUniqueId(),
1145 numeredEntFiniteElementPtr->getLocalUniqueId()));
1146 if (ait == adjacenciesPtr->end()) {
1147 MOFEM_LOG_ATTRIBUTES("SYNC", LogManager::BitScope);
1148 MOFEM_LOG("SELF", Sev::error) << *(*rit);
1149 MOFEM_LOG("SELF", Sev::error) << *(*rit);
1150 MOFEM_LOG("SELF", Sev::error) << *numeredEntFiniteElementPtr;
1151 MOFEM_LOG("SELF", Sev::error) << "dof: " << (*rit)->getBitRefLevel();
1152 MOFEM_LOG("SELF", Sev::error)
1153 << "fe: " << numeredEntFiniteElementPtr->getBitRefLevel();
1154 MOFEM_LOG("SELF", Sev::error)
1155 << "problem: " << problemPtr->getBitRefLevel();
1156 MOFEM_LOG("SELF", Sev::error)
1157 << "problem mask: " << problemPtr->getBitRefLevelMask();
1158 SETERRQ(mFieldPtr->get_comm(), MOFEM_DATA_INCONSISTENCY,
1159 "adjacencies data inconsistency");
1160 } else {
1161 UId uid = ait->getEntUniqueId();
1162 if (entitiesPtr->find(uid) == entitiesPtr->end()) {
1163 SETERRQ(mFieldPtr->get_comm(), MOFEM_DATA_INCONSISTENCY,
1164 "data inconsistency");
1165 }
1166 if (dofsPtr->find((*rit)->getLocalUniqueId()) == dofsPtr->end()) {
1167 SETERRQ(mFieldPtr->get_comm(), MOFEM_DATA_INCONSISTENCY,
1168 "data inconsistency");
1169 }
1170 }
1171 int row = (*rit)->getPetscGlobalDofIdx();
1172
1173 auto col_dofs = getColDofsPtr();
1174 for (auto cit = col_dofs->begin(); cit != col_dofs->end(); cit++) {
1175
1176 int col = (*cit)->getPetscGlobalDofIdx();
1177
1178 if (row == rowPrint && col == colPrint) {
1179 MOFEM_LOG("SELF", Sev::noisy) << "fe:\n"
1180 << *numeredEntFiniteElementPtr;
1181 MOFEM_LOG("SELF", Sev::noisy) << "row:\n" << *(*rit);
1182 MOFEM_LOG("SELF", Sev::noisy) << "col:\n" << *(*cit);
1183 MOFEM_LOG("SELF", Sev::noisy)
1184 << "fe:\n"
1185 << numeredEntFiniteElementPtr->getBitRefLevel();
1186 MOFEM_LOG("SELF", Sev::noisy) << "row:\n"
1187 << (*rit)->getBitRefLevel();
1188 MOFEM_LOG("SELF", Sev::noisy) << "col:\n"
1189 << (*cit)->getBitRefLevel();
1190 }
1191
1192 CHKERR MatSetValue(A, row, col, 1, INSERT_VALUES);
1193 }
1194
1195 if ((*rit)->getEntType() != MBVERTEX) {
1196
1197 auto range =
1198 row_dofs->get<Ent_mi_tag>().equal_range((*rit)->getEnt());
1199 int nb_dofs_on_ent = std::distance(range.first, range.second);
1200
1201 int max_order = (*rit)->getMaxOrder();
1202 if ((*rit)->getNbOfCoeffs() * (*rit)->getOrderNbDofs(max_order) !=
1203 nb_dofs_on_ent) {
1204
1205 /* It could be that you have removed DOFs from problem, and for
1206 * example if this was vector field with components {Ux,Uy,Uz}, you
1207 * removed on Uz element. */
1208
1209 MOFEM_LOG("SELF", Sev::warning)
1210 << "Warning: Number of Dofs in Row different than number "
1211 "of dofs for given entity order "
1212 << "Field name: " << (*rit)->getName() << " "
1213 << (*rit)->getNbOfCoeffs() * (*rit)->getOrderNbDofs(max_order)
1214 << " != " << nb_dofs_on_ent;
1215 }
1216 }
1217 }
1218
1220 }
1221
1222 MoFEMErrorCode postProcess() {
1224
1225 // cerr << mFieldPtr->get_comm_rank() << endl;
1226 CHKERR MatAssemblyBegin(A, MAT_FLUSH_ASSEMBLY);
1227 CHKERR MatAssemblyEnd(A, MAT_FLUSH_ASSEMBLY);
1228
1230 }
1231 };
1232
1233 // create matrix
1234 CHKERR MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_TRUE);
1235
1236 if (verb >= VERY_VERBOSE) {
1237 MatView(A, PETSC_VIEWER_STDOUT_WORLD);
1238 }
1239
1240 if (verb >= NOISY) {
1241 MatView(A, PETSC_VIEWER_DRAW_WORLD);
1242 std::string wait;
1243 std::cin >> wait;
1244 }
1245
1246 TestMatrixFillIn method(&m_field, A, row_print, col_print);
1247
1248 // get problem
1249 auto problems_ptr = m_field.get_problems();
1250 auto &prb_set = problems_ptr->get<Problem_mi_tag>();
1251 auto p_miit = prb_set.find(problem_name);
1252 if (p_miit == prb_set.end())
1253 SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
1254 "problem < %s > not found (top tip: check spelling)",
1255 problem_name.c_str());
1256 MOFEM_LOG_C("WORLD", Sev::inform, "check problem < %s >",
1257 problem_name.c_str());
1258
1259 // loop all elements in problem and check if assemble is without error
1260 auto fe_ptr = m_field.get_finite_elements();
1261 for (auto &fe : *fe_ptr) {
1262 MOFEM_LOG_C("WORLD", Sev::verbose, "\tcheck element %s",
1263 fe->getName().c_str());
1264 CHKERR m_field.loop_finite_elements(problem_name, fe->getName(), method,
1265 nullptr, MF_EXIST,
1266 CacheTupleSharedPtr(), verb);
1267 }
1268
1269 CHKERR MatAssemblyBegin(A, MAT_FINAL_ASSEMBLY);
1270 CHKERR MatAssemblyEnd(A, MAT_FINAL_ASSEMBLY);
1271
1272 PetscLogEventEnd(MOFEM_EVENT_checkMatrixFillIn, 0, 0, 0, 0);
1273
1275}
1276
1277template <>
1279MatrixManager::checkMPIAIJWithArraysMatrixFillIn<PetscGlobalIdx_mi_tag>(
1280 const std::string problem_name, int row_print, int col_print, int verb) {
1282 // create matrix
1283 SmartPetscObj<Mat> A;
1284 CHKERR createMPIAIJWithArrays<PetscGlobalIdx_mi_tag>(problem_name, A, verb);
1285 CHKERR MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_TRUE);
1286 CHKERR checkMatrixFillIn(problem_name, row_print, col_print, A, verb);
1288}
1289
1290template <>
1291MoFEMErrorCode MatrixManager::checkMPIAIJMatrixFillIn<PetscGlobalIdx_mi_tag>(
1292 const std::string problem_name, int row_print, int col_print, int verb) {
1294 // create matrix
1295 SmartPetscObj<Mat> A;
1296 CHKERR createMPIAIJ<PetscGlobalIdx_mi_tag>(problem_name, A, verb);
1297 CHKERR MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_TRUE);
1298 CHKERR checkMatrixFillIn(problem_name, row_print, col_print, A, verb);
1300}
1301
1302template <>
1303MoFEMErrorCode MatrixManager::createHybridL2MPIAIJ<PetscGlobalIdx_mi_tag>(
1304 const std::string problem_name, SmartPetscObj<Mat> &aij_ptr, int verb) {
1305 MoFEM::CoreInterface &m_field = cOre;
1307
1308 auto prb_ptr = m_field.get_problems();
1309 auto p_miit = prb_ptr->get<Problem_mi_tag>().find(problem_name);
1310 if (p_miit == prb_ptr->get<Problem_mi_tag>().end()) {
1311 SETERRQ(m_field.get_comm(), MOFEM_NOT_FOUND,
1312 "problem < %s > is not found (top tip: check spelling)",
1313 problem_name.c_str());
1314 }
1315
1316 auto nb_rows = p_miit->getNbDofsRow();
1317 auto nb_cols = p_miit->getNbDofsCol();
1318 auto nb_loc_rows = p_miit->getNbLocalDofsRow();
1319 auto nb_loc_cols = p_miit->getNbLocalDofsCol();
1320
1321 auto row_ptr = p_miit->getNumeredRowDofsPtr();
1322 auto col_ptr = p_miit->getNumeredColDofsPtr();
1323
1324 BitFieldId fields_ids;
1325 for (auto &c : *col_ptr) {
1326 fields_ids |= c->getId();
1327 }
1328 auto fields = m_field.get_fields();
1329 std::vector<int> fields_bit_numbers;
1330 for (auto &f : *fields) {
1331 if ((fields_ids & f->getId()).any()) {
1332 fields_bit_numbers.push_back(f->getBitNumber());
1333 }
1334 }
1335
1336 Range adj;
1337 EntityHandle prev_ent = 0;
1338 int prev_dim = -1;
1339
1340 // Each bridge cell is reached from every one of its faces; its faces are
1341 // found in MOAB once and kept. Only cells on the problem's refinement level
1342 // are bridges: after a local refinement an unsplit face is also adjacent
1343 // to the refined parent cell, which is not in the problem.
1344 std::unordered_map<EntityHandle, Range> bridge_faces;
1345 auto ref_ents = m_field.get_ref_ents();
1346 const auto prb_bit = p_miit->getBitRefLevel();
1347 const auto prb_mask = p_miit->getBitRefLevelMask();
1348 auto on_problem_level = [&](EntityHandle cell) {
1349 auto it = ref_ents->find(cell);
1350 if (it == ref_ents->end())
1351 return false;
1352 const auto &bit = (*it)->getBitRefLevel();
1353 return (bit & prb_bit).any() && (bit & prb_mask) == bit;
1354 };
1355 auto get_adj = [&](auto ent, auto dim) -> const Range & {
1356 if (prev_ent == ent && prev_dim == dim) {
1357 return adj;
1358 } else {
1359 adj.clear();
1360 Range bridge;
1361 CHK_MOAB_THROW(m_field.get_moab().get_adjacencies(&ent, 1, dim + 1,
1362 false, bridge),
1363 "bridge adjacency");
1364 for (auto b : bridge) {
1365 auto it = bridge_faces.find(b);
1366 if (it == bridge_faces.end()) {
1367 Range faces;
1368 if (on_problem_level(b))
1369 CHK_MOAB_THROW(m_field.get_moab().get_adjacencies(&b, 1, dim,
1370 false, faces),
1371 "bridge faces");
1372 it = bridge_faces.emplace(b, std::move(faces)).first;
1373 }
1374 adj.merge(it->second);
1375 }
1376 prev_ent = ent;
1377 prev_dim = dim;
1378 return adj;
1379 }
1380 };
1381
1382 // Fetched once; every owner query below would otherwise look the
1383 // ParallelComm up through two tag operations.
1384 auto *pcomm = ParallelComm::get_pcomm(
1385 &m_field.get_moab(), m_field.get_basic_entity_data_ptr()->pcommID);
1386
1387 int prev_bit_number = -1;
1388 EntityHandle prev_first_ent = 0;
1389 EntityHandle prev_second_ent = 0;
1390 using IT = boost::multi_index::index<NumeredDofEntity_multiIndex,
1391 Unique_mi_tag>::type::iterator;
1392 std::pair<IT, IT> pair_lo_hi;
1393 auto get_col_it = [&](auto bit_number, auto first_ent, auto second_ent) {
1394 if (bit_number == prev_bit_number && first_ent == prev_first_ent &&
1395 second_ent == prev_second_ent) {
1396 return pair_lo_hi;
1397 } else {
1398 auto lo_it = col_ptr->get<Unique_mi_tag>().lower_bound(
1399 DofEntity::getLoFieldEntityUId(bit_number, first_ent));
1400 auto hi_it = col_ptr->get<Unique_mi_tag>().upper_bound(
1401 DofEntity::getHiFieldEntityUId(bit_number, second_ent));
1402 pair_lo_hi = std::make_pair(lo_it, hi_it);
1403 prev_bit_number = bit_number;
1404 prev_first_ent = first_ent;
1405 prev_second_ent = second_ent;
1406 return pair_lo_hi;
1407 }
1408 };
1409
1410 auto create_ghost_vec = [&]() {
1411 SmartPetscObj<Vec> v;
1412 CHKERR m_field.getInterface<VecManager>()->vecCreateGhost(problem_name, ROW,
1413 v);
1414 CHKERR VecZeroEntries(v);
1415 CHKERR VecGhostUpdateBegin(v, INSERT_VALUES, SCATTER_FORWARD);
1416 CHKERR VecGhostUpdateEnd(v, INSERT_VALUES, SCATTER_FORWARD);
1417 return v;
1418 };
1419
1420 auto v_o_nnz = create_ghost_vec();
1421 auto v_d_nnz = create_ghost_vec();
1422
1423
1424 double *o_nnz_real;
1425 CHKERR VecGetArray(v_o_nnz, &o_nnz_real);
1426 double *d_nnz_real;
1427 CHKERR VecGetArray(v_d_nnz, &d_nnz_real);
1428
1429 EntityHandle counted_ent = 0;
1430 int counted_owner = -1;
1431 PetscInt diagonal_nnz = 0, off_diagonal_nnz = 0;
1432 for (auto r = row_ptr->begin(); r != row_ptr->end(); ++r) {
1433
1434 auto row_loc_idx = (*r)->getPetscLocalDofIdx();
1435 if (row_loc_idx < 0)
1436 continue;
1437
1438 auto ent = (*r)->getEnt();
1439 const int row_owner = (*r)->getOwnerProc(pcomm);
1440 // All DOFs on this entity see the same columns. Count once for its
1441 // owner, then retain the existing ghost-row accumulation for each DOF.
1442 if (ent != counted_ent || row_owner != counted_owner) {
1443 diagonal_nnz = off_diagonal_nnz = 0;
1444 const auto &adj = get_adj(ent, dimension_from_handle(ent));
1445 for (auto p = adj.pair_begin(); p != adj.pair_end(); ++p) {
1446 for (auto bit_number : fields_bit_numbers) {
1447 auto [lo_it, hi_it] = get_col_it(bit_number, p->first, p->second);
1448 for (; lo_it != hi_it; ++lo_it) {
1449 if ((*lo_it)->getPetscLocalDofIdx() < 0)
1450 continue;
1451 if ((*lo_it)->getOwnerProc(pcomm) == row_owner)
1452 ++diagonal_nnz;
1453 else
1454 ++off_diagonal_nnz;
1455 }
1456 }
1457 }
1458 counted_ent = ent;
1459 counted_owner = row_owner;
1460 }
1461 d_nnz_real[row_loc_idx] += diagonal_nnz;
1462 o_nnz_real[row_loc_idx] += off_diagonal_nnz;
1463 }
1464
1465 CHKERR VecRestoreArray(v_o_nnz, &o_nnz_real);
1466 CHKERR VecRestoreArray(v_d_nnz, &d_nnz_real);
1467
1468 auto update_vec = [&](auto v) {
1470 CHKERR VecGhostUpdateBegin(v, ADD_VALUES, SCATTER_REVERSE);
1471 CHKERR VecGhostUpdateEnd(v, ADD_VALUES, SCATTER_REVERSE);
1472 CHKERR VecAssemblyBegin(v);
1473 CHKERR VecAssemblyEnd(v);
1475 };
1476
1477 CHKERR update_vec(v_o_nnz);
1478 CHKERR update_vec(v_d_nnz);
1479
1480 int o_nz = 0;
1481 int d_nz = 0;
1482
1483 CHKERR VecGetArray(v_d_nnz, &d_nnz_real);
1484 CHKERR VecGetArray(v_o_nnz, &o_nnz_real);
1485
1486 std::vector<int> d_nnz(nb_loc_rows, 0);
1487 std::vector<int> o_nnz(nb_loc_rows, 0);
1488 for (auto r = row_ptr->begin(); r != row_ptr->end(); ++r) {
1489
1490 auto row_loc_idx = (*r)->getPetscLocalDofIdx();
1491
1492 if (
1493
1494 row_loc_idx >= 0 && row_loc_idx < nb_loc_rows
1495
1496 ) {
1497 auto row_loc_idx = (*r)->getPetscLocalDofIdx();
1498 d_nz += d_nnz_real[row_loc_idx];
1499 d_nnz[row_loc_idx] = d_nnz_real[row_loc_idx];
1500 o_nz += o_nnz_real[row_loc_idx];
1501 o_nnz[row_loc_idx] = o_nnz_real[row_loc_idx];
1502 }
1503
1504 }
1505
1506 CHKERR VecRestoreArray(v_o_nnz, &o_nnz_real);
1507 CHKERR VecRestoreArray(v_d_nnz, &d_nnz_real);
1508
1509 if (verb >= QUIET) {
1510 MOFEM_LOG("SYNC", Sev::verbose)
1511 << "Hybrid L2 matrix d_nz: " << d_nz << " o_nz: " << o_nz;
1512 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::verbose);
1513 }
1514
1515 if (verb >= VERBOSE) {
1516 MOFEM_LOG("SYNC", Sev::noisy) << "Hybrid L2 matrix";
1517 int idx = 0;
1518 for (auto &d : d_nnz) {
1519 MOFEM_LOG("SYNC", Sev::noisy) << idx << ": " << d;
1520 ++idx;
1521 }
1522 MOFEM_LOG_SEVERITY_SYNC(m_field.get_comm(), Sev::noisy);
1523 }
1524
1525 Mat a_raw;
1526 CHKERR MatCreateAIJ(m_field.get_comm(), nb_loc_rows, nb_loc_cols, nb_rows,
1527 nb_cols, 0, d_nnz.data(), 0, o_nnz.data(), &a_raw);
1528 CHKERR MatSetOption(a_raw, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_TRUE);
1529 aij_ptr = SmartPetscObj<Mat>(a_raw);
1530
1531 MOFEM_LOG_CHANNEL("WORLD");
1532 MOFEM_LOG_CHANNEL("SYNC");
1533
1535}
1536
1537} // namespace MoFEM
CGALInterfaceImpl & owner
std::vector< std::array< EntityHandle, 3 > > faces
Sorted keys.
unsigned char status
MPI_Comm comm
Core & cOre
Tag tag
ProjectedField & field
std::vector< double > empty
One value per component.
std::string type
#define MOFEM_LOG_SEVERITY_SYNC(comm, severity)
Synchronise "SYNC" on curtain severity level.
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
#define MOFEM_LOG_C(channel, severity, format,...)
#define MatrixManagerFunctionBegin
Create adjacent matrices using different indices.
std::vector< FieldBitNumber > row
Definition Schur.cpp:2488
It it
Definition Schur.cpp:2568
It end
Definition Schur.cpp:2568
std::vector< FieldBitNumber > col
Definition Schur.cpp:2488
SmartPetscObj< Vec > diagonal
std::string name
constexpr double a
@ VERY_VERBOSE
@ QUIET
@ NOISY
@ VERBOSE
@ ROW
@ MF_EXIST
#define MAX_DOFS_ON_ENTITY
Maximal number of DOFs on entity.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
@ MOFEM_NOT_FOUND
Definition definitions.h:33
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
@ MOFEM_NOT_IMPLEMENTED
Definition definitions.h:32
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ BYROW
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
static const bool debug
multi_index_container< boost::shared_ptr< NumeredDofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, UId, &NumeredDofEntity::getLocalUniqueId > >, ordered_non_unique< tag< Part_mi_tag >, member< NumeredDofEntity, unsigned int, &NumeredDofEntity::pArt > >, 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 > > > > NumeredDofEntity_multiIndex
MultiIndex container keeps NumeredDofEntity.
virtual const FiniteElement_multiIndex * get_finite_elements() const =0
Get the finite elements object.
virtual const Problem_multiIndex * get_problems() const =0
Get the problems object.
virtual const RefEntity_multiIndex * get_ref_ents() const =0
Get the ref ents object.
virtual const Field_multiIndex * get_fields() const =0
Get the fields object.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
#define MOFEM_LOG_ATTRIBUTES(channel, bit)
Add attributes to channel.
virtual MoFEMErrorCode loop_finite_elements(const std::string problem_name, const std::string &fe_name, FEMethod &method, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)=0
Make a loop over finite elements.
auto bit
set bit
FTensor::Index< 'i', SPACE_DIM > i
const double c
speed of light (cm/ns)
const double v
phase velocity of light in medium (cm/ns)
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
int DofIdx
Index of DOF.
Definition Types.hpp:18
std::bitset< BITFIELDID_SIZE > BitFieldId
Field Id.
Definition Types.hpp:42
uint128_t UId
Unique Id.
Definition Types.hpp:31
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition Types.hpp:40
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
CreateRowCompressedADJMatrix CreateRowComressedADJMatrix
Problem::EmptyFieldBlocks EmptyFieldBlocks
auto dimension_from_handle(const EntityHandle h)
get entity dimension form handle
CoreTmp< 0 > Core
Definition Core.hpp:1161
boost::shared_ptr< CacheTuple > CacheTupleSharedPtr
int r
Definition sdf.py:205
constexpr AssemblyType A
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
virtual boost::shared_ptr< BasicEntityData > & get_basic_entity_data_ptr()=0
Get pointer to basic entity data.
Core (interface) class.
Definition Core.hpp:83
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
constexpr IntegrationType IT