v0.13.2
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Types | Private Attributes | Static Private Attributes | List of all members
MoFEM::SchurL2Mats Struct Reference

Schur complement data storage. More...

#include <src/finite_elements/Schur.hpp>

Inheritance diagram for MoFEM::SchurL2Mats:
[legend]
Collaboration diagram for MoFEM::SchurL2Mats:
[legend]

Classes

struct  col_mi_tag
 
struct  idx_mi_tag
 
struct  row_mi_tag
 
struct  uid_mi_tag
 

Public Types

using MatSetValuesPtr = boost::function< MoFEMErrorCode(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const MatrixDouble &mat, InsertMode iora)>
 

Public Member Functions

 SchurL2Mats (const size_t idx, const UId uid_row, const UId uid_col)
 
virtual ~SchurL2Mats ()=default
 
auto & getMat () const
 
auto & getRowInd () const
 
auto & getColInd () const
 

Static Public Member Functions

static MoFEMErrorCode MatSetValues (Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const MatrixDouble &mat, InsertMode iora)
 

Public Attributes

const UId uidRow
 
const UId uidCol
 

Static Public Attributes

static MatSetValuesPtr matSetValuesPtr
 backend assembly function More...
 

Private Types

using SchurL2Storage = multi_index_container< SchurL2Mats, indexed_by< ordered_unique< tag< uid_mi_tag >, composite_key< SchurL2Mats, member< SchurL2Mats, const UId, &SchurL2Mats::uidRow >, member< SchurL2Mats, const UId, &SchurL2Mats::uidCol > > >, ordered_non_unique< tag< row_mi_tag >, member< SchurL2Mats, const UId, &SchurL2Mats::uidRow > >, ordered_non_unique< tag< col_mi_tag >, member< SchurL2Mats, const UId, &SchurL2Mats::uidCol > > > >
 

Private Attributes

const size_t iDX
 
friend OpSchurAssembleBegin
 
friend OpSchurAssembleEndImpl
 

Static Private Attributes

static boost::ptr_vector< MatrixDoublelocMats
 
static boost::ptr_vector< VectorIntrowIndices
 
static boost::ptr_vector< VectorIntcolIndices
 
static SchurL2Storage schurL2Storage
 

Detailed Description

Schur complement data storage.

Definition at line 125 of file Schur.hpp.

Member Typedef Documentation

◆ MatSetValuesPtr

using MoFEM::SchurL2Mats::MatSetValuesPtr = boost::function<MoFEMErrorCode( Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const MatrixDouble &mat, InsertMode iora)>

Definition at line 137 of file Schur.hpp.

◆ SchurL2Storage

using MoFEM::SchurL2Mats::SchurL2Storage = multi_index_container< SchurL2Mats, indexed_by< ordered_unique< tag<uid_mi_tag>, composite_key< SchurL2Mats, member<SchurL2Mats, const UId, &SchurL2Mats::uidRow>, member<SchurL2Mats, const UId, &SchurL2Mats::uidCol> > >, ordered_non_unique<tag<row_mi_tag>, member<SchurL2Mats, const UId, &SchurL2Mats::uidRow> >, ordered_non_unique<tag<col_mi_tag>, member<SchurL2Mats, const UId, &SchurL2Mats::uidCol> > > >
private

Definition at line 160 of file Schur.hpp.

Constructor & Destructor Documentation

◆ SchurL2Mats()

MoFEM::SchurL2Mats::SchurL2Mats ( const size_t  idx,
const UId  uid_row,
const UId  uid_col 
)

Definition at line 17 of file Schur.cpp.

18 : iDX(idx), uidRow(uid_row), uidCol(uid_col) {}
const UId uidCol
Definition: Schur.hpp:131
const UId uidRow
Definition: Schur.hpp:130
const size_t iDX
Definition: Schur.hpp:150

◆ ~SchurL2Mats()

virtual MoFEM::SchurL2Mats::~SchurL2Mats ( )
virtualdefault

Member Function Documentation

◆ getColInd()

auto & MoFEM::SchurL2Mats::getColInd ( ) const
inline

Definition at line 135 of file Schur.hpp.

135{ return colIndices[iDX]; }
static boost::ptr_vector< VectorInt > colIndices
Definition: Schur.hpp:184

◆ getMat()

auto & MoFEM::SchurL2Mats::getMat ( ) const
inline

Definition at line 133 of file Schur.hpp.

133{ return locMats[iDX]; }
static boost::ptr_vector< MatrixDouble > locMats
Definition: Schur.hpp:182

◆ getRowInd()

auto & MoFEM::SchurL2Mats::getRowInd ( ) const
inline

Definition at line 134 of file Schur.hpp.

134{ return rowIndices[iDX]; }
static boost::ptr_vector< VectorInt > rowIndices
Definition: Schur.hpp:183

◆ MatSetValues()

MoFEMErrorCode MoFEM::SchurL2Mats::MatSetValues ( Mat  M,
const EntitiesFieldData::EntData row_data,
const EntitiesFieldData::EntData col_data,
const MatrixDouble mat,
InsertMode  iora 
)
static

Definition at line 32 of file Schur.cpp.

34 {
36
37 CHKERR matSetValuesPtr(M, row_data, col_data, mat, iora);
38
39 auto get_row_indices = [&]() -> const VectorInt & {
40 if (auto e_ptr = row_data.getFieldEntities()[0]) {
41 if (auto stored_data_ptr =
42 e_ptr->getSharedStoragePtr<EssentialBcStorage>()) {
43 return stored_data_ptr->entityIndices;
44 }
45 }
46 return row_data.getIndices();
47 };
48
49 const auto &row_ind = get_row_indices();
50 const auto &col_ind = col_data.getIndices();
51
52 const auto nb_rows = row_ind.size();
53 const auto nb_cols = col_ind.size();
54
55 const auto idx = SchurL2Mats::schurL2Storage.size();
56 const auto size = SchurL2Mats::locMats.size();
57
58 if (idx >= size) {
59 SchurL2Mats::locMats.push_back(new MatrixDouble());
60 SchurL2Mats::rowIndices.push_back(new VectorInt());
61 SchurL2Mats::colIndices.push_back(new VectorInt());
62 }
63
64 // insert index
65 auto get_uid = [](auto &data) {
66 return data.getFieldEntities()[0]->getLocalUniqueId();
67 };
68
69 auto p = SchurL2Mats::schurL2Storage.emplace(idx, get_uid(row_data),
70 get_uid(col_data));
71
72 auto get_storage = [&p]() { return const_cast<SchurL2Mats &>(*p.first); };
73
74 if (p.second) {
75
76 auto asmb = [&](auto &sm) {
77 sm.resize(nb_rows, nb_cols, false);
78 noalias(sm) = mat;
79 };
80
81 asmb(get_storage().getMat());
82
83 auto add_indices = [](auto &storage, auto &ind) {
84 storage.resize(ind.size(), false);
85 noalias(storage) = ind;
86 };
87
88 add_indices(get_storage().getRowInd(), row_ind);
89 add_indices(get_storage().getColInd(), col_ind);
90
91 } else {
92
93 auto asmb = [&](auto &sm) {
95 switch (iora) {
96 case ADD_VALUES:
97 sm += mat;
98 break;
99 case INSERT_VALUES:
100 noalias(sm) = mat;
101 break;
102 default:
103 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
104 "Assembly type not implemented");
105 }
107 };
108
109 CHKERR asmb(get_storage().getMat());
110
111 }
112
114}
static Index< 'M', 3 > M
static Index< 'p', 3 > p
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:77
UBlasVector< int > VectorInt
Definition: Types.hpp:67
SchurL2Mats(const size_t idx, const UId uid_row, const UId uid_col)
Definition: Schur.cpp:17
static MatSetValuesPtr matSetValuesPtr
backend assembly function
Definition: Schur.hpp:142
static SchurL2Storage schurL2Storage
Definition: Schur.hpp:185
auto & getMat() const
Definition: Schur.hpp:133
auto & getRowInd() const
Definition: Schur.hpp:134
auto & getColInd() const
Definition: Schur.hpp:135

Member Data Documentation

◆ colIndices

boost::ptr_vector< VectorInt > MoFEM::SchurL2Mats::colIndices
staticprivate

Definition at line 184 of file Schur.hpp.

◆ iDX

const size_t MoFEM::SchurL2Mats::iDX
private

Definition at line 150 of file Schur.hpp.

◆ locMats

boost::ptr_vector< MatrixDouble > MoFEM::SchurL2Mats::locMats
staticprivate

Definition at line 182 of file Schur.hpp.

◆ matSetValuesPtr

SchurL2Mats::MatSetValuesPtr MoFEM::SchurL2Mats::matSetValuesPtr
static
Initial value:
=
MoFEMErrorCode schur_mat_set_values_wrap(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const MatrixDouble &mat, InsertMode iora)
Definition: Schur.cpp:21

backend assembly function

Definition at line 142 of file Schur.hpp.

◆ OpSchurAssembleBegin

friend MoFEM::SchurL2Mats::OpSchurAssembleBegin
private

Definition at line 152 of file Schur.hpp.

◆ OpSchurAssembleEndImpl

friend MoFEM::SchurL2Mats::OpSchurAssembleEndImpl
private

Definition at line 153 of file Schur.hpp.

◆ rowIndices

boost::ptr_vector< VectorInt > MoFEM::SchurL2Mats::rowIndices
staticprivate

Definition at line 183 of file Schur.hpp.

◆ schurL2Storage

SchurL2Mats::SchurL2Storage MoFEM::SchurL2Mats::schurL2Storage
staticprivate

Definition at line 185 of file Schur.hpp.

◆ uidCol

const UId MoFEM::SchurL2Mats::uidCol

Definition at line 131 of file Schur.hpp.

◆ uidRow

const UId MoFEM::SchurL2Mats::uidRow

Definition at line 130 of file Schur.hpp.


The documentation for this struct was generated from the following files: