v0.15.5
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
AdolCOps::ADolCDataImpl Struct Reference
Inheritance diagram for AdolCOps::ADolCDataImpl:
[legend]
Collaboration diagram for AdolCOps::ADolCDataImpl:
[legend]

Classes

struct  Data
 

Public Types

using MatrixPtr = ADolCData::MatrixPtr
 
using DataContainer = boost::multi_index::multi_index_container< Data, boost::multi_index::indexed_by< boost::multi_index::sequenced< boost::multi_index::tag< DataSequence_mi_tag > >, boost::multi_index::hashed_unique< boost::multi_index::tag< DataName_mi_tag >, boost::multi_index::member< Data, std::string, &Data::name > > > >
 
- Public Types inherited from AdolCOps::ADolCData
using MatrixPtr = boost::shared_ptr< MatrixDouble >
 

Public Member Functions

auto & getDataCommonByName ()
 
auto & getDataActiveByName ()
 
auto & getDataDependentByName ()
 
auto & getDataDependentDerivativesByName ()
 
std::pair< bool, MatrixPtrinsertCommonData (const std::string &name, const MatrixDouble &data=MatrixDouble(), int shift=0) override
 
std::pair< bool, MatrixPtrinsertActiveData (const std::string &name, const MatrixDouble &data=MatrixDouble(), int shift=0) override
 
std::pair< bool, MatrixPtrinsertDependentData (const std::string &name, const MatrixDouble &data=MatrixDouble(), int shift=0) override
 
std::pair< bool, MatrixPtrinsertDependentDerivativesData (const std::string &name, const MatrixDouble &data=MatrixDouble(), int shift=0) override
 
MatrixPtr getCommonDataPtr (const std::string &name) override
 
MatrixPtr getActiveDataPtr (const std::string &name) override
 
MatrixPtr getDependentDataPtr (const std::string &name) override
 
MatrixPtr getDependentDerivativesDataPtr (const std::string &name) override
 
MoFEMErrorCode setActiveContinuousVector (std::vector< double > &active_variables) override
 
MoFEMErrorCode setDependentContinuousVector (std::vector< double > &dependent_variables) override
 
MoFEMErrorCode setDependentDerivativesContinuousVector (std::vector< double > &dependent_variables_derivatives) override
 
MoFEMErrorCode getActiveContinuousVector (const std::vector< double > &active_variables) override
 
MoFEMErrorCode getDependentContinuousVector (const std::vector< double > &dependent_variables) override
 
MoFEMErrorCode getDependentDerivativesContinuousVector (const std::vector< double > &dependent_variables_derivatives) override
 
- Public Member Functions inherited from AdolCOps::ADolCData
virtual ~ADolCData ()=default
 

Private Member Functions

MoFEMErrorCode setContinuousVector (DataContainer &data_container, std::vector< double > &variables)
 
MoFEMErrorCode getContinuousVector (DataContainer &data_container, const std::vector< double > &variables)
 

Private Attributes

DataContainer dataCommon
 
DataContainer dataActive
 
DataContainer dataDependent
 
DataContainer dataDependentDerivatives
 

Detailed Description

Definition at line 19 of file AdolOps.cpp.

Member Typedef Documentation

◆ DataContainer

using AdolCOps::ADolCDataImpl::DataContainer = boost::multi_index::multi_index_container< Data, boost::multi_index::indexed_by< boost::multi_index::sequenced< boost::multi_index::tag<DataSequence_mi_tag> >, boost::multi_index::hashed_unique< boost::multi_index::tag<DataName_mi_tag>, boost::multi_index::member<Data, std::string, &Data::name> >> >

Definition at line 36 of file AdolOps.cpp.

◆ MatrixPtr

Definition at line 20 of file AdolOps.cpp.

Member Function Documentation

◆ getActiveContinuousVector()

MoFEMErrorCode AdolCOps::ADolCDataImpl::getActiveContinuousVector ( const std::vector< double > &  active_variables)
inlineoverridevirtual

Implements AdolCOps::ADolCData.

Definition at line 171 of file AdolOps.cpp.

172 {
173 return getContinuousVector(dataActive, active_variables);
174 }
DataContainer dataActive
Definition AdolOps.cpp:240
MoFEMErrorCode getContinuousVector(DataContainer &data_container, const std::vector< double > &variables)
Definition AdolOps.cpp:212

◆ getActiveDataPtr()

MatrixPtr AdolCOps::ADolCDataImpl::getActiveDataPtr ( const std::string &  name)
inlineoverridevirtual

Implements AdolCOps::ADolCData.

Definition at line 121 of file AdolOps.cpp.

121 {
122 auto &data_by_name = getDataActiveByName();
123 auto it = data_by_name.find(name);
124 if (it == data_by_name.end()) {
126 "Active data with name " + name + " not found");
127 return MatrixPtr();
128 }
129 return boost::shared_ptr<MatrixDouble>(this->shared_from_this(), &it->data);
130 }
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition definitions.h:34
auto & getDataActiveByName()
Definition AdolOps.cpp:53
ADolCData::MatrixPtr MatrixPtr
Definition AdolOps.cpp:20

◆ getCommonDataPtr()

MatrixPtr AdolCOps::ADolCDataImpl::getCommonDataPtr ( const std::string &  name)
inlineoverridevirtual

Implements AdolCOps::ADolCData.

Definition at line 110 of file AdolOps.cpp.

110 {
111 auto &data_by_name = getDataCommonByName();
112 auto it = data_by_name.find(name);
113 if (it == data_by_name.end()) {
115 "Common data with name " + name + " not found");
116 return MatrixPtr();
117 }
118 return boost::shared_ptr<MatrixDouble>(this->shared_from_this(), &it->data);
119 }
auto & getDataCommonByName()
Definition AdolOps.cpp:49

◆ getContinuousVector()

MoFEMErrorCode AdolCOps::ADolCDataImpl::getContinuousVector ( DataContainer data_container,
const std::vector< double > &  variables 
)
inlineprivate

Definition at line 212 of file AdolOps.cpp.

213 {
215
216 auto &data_by_sequence =
217 boost::multi_index::get<DataSequence_mi_tag>(data_container);
218
219 int nb_variables = 0;
220 for (const auto &d : data_by_sequence)
221 nb_variables += d.data.data().size();
222
223 if (variables.size() != static_cast<size_t>(nb_variables)) {
224 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
225 "Inconsistent size of continuous vector");
226 }
227
228 int shift = 0;
229 for (const auto &d : data_by_sequence) {
230 d.shift = shift;
231 for (auto it = d.data.data().begin(); it != d.data.data().end();
232 ++it, ++shift)
233 *it = variables[shift];
234 }
235
237 }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...

◆ getDataActiveByName()

auto & AdolCOps::ADolCDataImpl::getDataActiveByName ( )
inline

Definition at line 53 of file AdolOps.cpp.

53 {
54 return boost::multi_index::get<DataName_mi_tag>(dataActive);
55 }

◆ getDataCommonByName()

auto & AdolCOps::ADolCDataImpl::getDataCommonByName ( )
inline

Definition at line 49 of file AdolOps.cpp.

49 {
50 return boost::multi_index::get<DataName_mi_tag>(dataCommon);
51 }
DataContainer dataCommon
Definition AdolOps.cpp:239

◆ getDataDependentByName()

auto & AdolCOps::ADolCDataImpl::getDataDependentByName ( )
inline

Definition at line 57 of file AdolOps.cpp.

57 {
58 return boost::multi_index::get<DataName_mi_tag>(dataDependent);
59 }
DataContainer dataDependent
Definition AdolOps.cpp:241

◆ getDataDependentDerivativesByName()

auto & AdolCOps::ADolCDataImpl::getDataDependentDerivativesByName ( )
inline

Definition at line 61 of file AdolOps.cpp.

61 {
62 return boost::multi_index::get<DataName_mi_tag>(dataDependentDerivatives);
63 }
DataContainer dataDependentDerivatives
Definition AdolOps.cpp:242

◆ getDependentContinuousVector()

MoFEMErrorCode AdolCOps::ADolCDataImpl::getDependentContinuousVector ( const std::vector< double > &  dependent_variables)
inlineoverridevirtual

Implements AdolCOps::ADolCData.

Definition at line 176 of file AdolOps.cpp.

177 {
178 return getContinuousVector(dataDependent, dependent_variables);
179 }

◆ getDependentDataPtr()

MatrixPtr AdolCOps::ADolCDataImpl::getDependentDataPtr ( const std::string &  name)
inlineoverridevirtual

Implements AdolCOps::ADolCData.

Definition at line 132 of file AdolOps.cpp.

132 {
133 auto &data_by_name = getDataDependentByName();
134 auto it = data_by_name.find(name);
135 if (it == data_by_name.end()) {
137 "Dependent data with name " + name + " not found");
138 return MatrixPtr();
139 }
140 return boost::shared_ptr<MatrixDouble>(this->shared_from_this(), &it->data);
141 }
auto & getDataDependentByName()
Definition AdolOps.cpp:57

◆ getDependentDerivativesContinuousVector()

MoFEMErrorCode AdolCOps::ADolCDataImpl::getDependentDerivativesContinuousVector ( const std::vector< double > &  dependent_variables_derivatives)
inlineoverridevirtual

Implements AdolCOps::ADolCData.

Definition at line 181 of file AdolOps.cpp.

182 {
184 dependent_variables_derivatives);
185 }

◆ getDependentDerivativesDataPtr()

MatrixPtr AdolCOps::ADolCDataImpl::getDependentDerivativesDataPtr ( const std::string &  name)
inlineoverridevirtual

Implements AdolCOps::ADolCData.

Definition at line 143 of file AdolOps.cpp.

143 {
144 auto &data_by_name = getDataDependentDerivativesByName();
145 auto it = data_by_name.find(name);
146 if (it == data_by_name.end()) {
148 "Dependent derivatives data with name " + name +
149 " not found");
150 return MatrixPtr();
151 }
152 return boost::shared_ptr<MatrixDouble>(this->shared_from_this(), &it->data);
153 }
auto & getDataDependentDerivativesByName()
Definition AdolOps.cpp:61

◆ insertActiveData()

std::pair< bool, MatrixPtr > AdolCOps::ADolCDataImpl::insertActiveData ( const std::string &  name,
const MatrixDouble &  data = MatrixDouble(),
int  shift = 0 
)
inlineoverridevirtual

Implements AdolCOps::ADolCData.

Definition at line 77 of file AdolOps.cpp.

79 {
80 auto insert_ret = getDataActiveByName().insert(Data{name, data, shift});
81 if (!insert_ret.second)
82 return {false, MatrixPtr()};
83 return {true, boost::shared_ptr<MatrixDouble>(this->shared_from_this(),
84 &insert_ret.first->data)};
85 }

◆ insertCommonData()

std::pair< bool, MatrixPtr > AdolCOps::ADolCDataImpl::insertCommonData ( const std::string &  name,
const MatrixDouble &  data = MatrixDouble(),
int  shift = 0 
)
inlineoverridevirtual

Implements AdolCOps::ADolCData.

Definition at line 66 of file AdolOps.cpp.

68 {
69 auto insert_ret = getDataCommonByName().insert(Data{name, data, shift});
70 if (!insert_ret.second)
71 return {false, MatrixPtr()};
72 return {true, boost::shared_ptr<MatrixDouble>(this->shared_from_this(),
73 &insert_ret.first->data)};
74 }

◆ insertDependentData()

std::pair< bool, MatrixPtr > AdolCOps::ADolCDataImpl::insertDependentData ( const std::string &  name,
const MatrixDouble &  data = MatrixDouble(),
int  shift = 0 
)
inlineoverridevirtual

Implements AdolCOps::ADolCData.

Definition at line 88 of file AdolOps.cpp.

90 {
91 auto insert_ret = getDataDependentByName().insert(Data{name, data, shift});
92 if (!insert_ret.second)
93 return {false, MatrixPtr()};
94 return {true, boost::shared_ptr<MatrixDouble>(this->shared_from_this(),
95 &insert_ret.first->data)};
96 }

◆ insertDependentDerivativesData()

std::pair< bool, MatrixPtr > AdolCOps::ADolCDataImpl::insertDependentDerivativesData ( const std::string &  name,
const MatrixDouble &  data = MatrixDouble(),
int  shift = 0 
)
inlineoverridevirtual

Implements AdolCOps::ADolCData.

Definition at line 99 of file AdolOps.cpp.

101 {
102 auto insert_ret =
103 getDataDependentDerivativesByName().insert(Data{name, data, shift});
104 if (!insert_ret.second)
105 return {false, MatrixPtr()};
106 return {true, boost::shared_ptr<MatrixDouble>(this->shared_from_this(),
107 &insert_ret.first->data)};
108 }

◆ setActiveContinuousVector()

MoFEMErrorCode AdolCOps::ADolCDataImpl::setActiveContinuousVector ( std::vector< double > &  active_variables)
inlineoverridevirtual

Implements AdolCOps::ADolCData.

Definition at line 156 of file AdolOps.cpp.

156 {
157 return setContinuousVector(dataActive, active_variables);
158 }
MoFEMErrorCode setContinuousVector(DataContainer &data_container, std::vector< double > &variables)
Definition AdolOps.cpp:188

◆ setContinuousVector()

MoFEMErrorCode AdolCOps::ADolCDataImpl::setContinuousVector ( DataContainer data_container,
std::vector< double > &  variables 
)
inlineprivate

Definition at line 188 of file AdolOps.cpp.

189 {
191
192 auto &data_by_sequence =
193 boost::multi_index::get<DataSequence_mi_tag>(data_container);
194
195 int nb_variables = 0;
196 for (const auto &d : data_by_sequence)
197 nb_variables += d.data.data().size();
198
199 variables.resize(nb_variables);
200
201 int shift = 0;
202 for (const auto &d : data_by_sequence) {
203 d.shift = shift;
204 for (auto it = d.data.data().begin(); it != d.data.data().end();
205 ++it, ++shift)
206 variables[shift] = *it;
207 }
208
210 }

◆ setDependentContinuousVector()

MoFEMErrorCode AdolCOps::ADolCDataImpl::setDependentContinuousVector ( std::vector< double > &  dependent_variables)
inlineoverridevirtual

Implements AdolCOps::ADolCData.

Definition at line 160 of file AdolOps.cpp.

161 {
162 return setContinuousVector(dataDependent, dependent_variables);
163 }

◆ setDependentDerivativesContinuousVector()

MoFEMErrorCode AdolCOps::ADolCDataImpl::setDependentDerivativesContinuousVector ( std::vector< double > &  dependent_variables_derivatives)
inlineoverridevirtual

Implements AdolCOps::ADolCData.

Definition at line 165 of file AdolOps.cpp.

166 {
168 dependent_variables_derivatives);
169 }

Member Data Documentation

◆ dataActive

DataContainer AdolCOps::ADolCDataImpl::dataActive
private

Definition at line 240 of file AdolOps.cpp.

◆ dataCommon

DataContainer AdolCOps::ADolCDataImpl::dataCommon
private

Definition at line 239 of file AdolOps.cpp.

◆ dataDependent

DataContainer AdolCOps::ADolCDataImpl::dataDependent
private

Definition at line 241 of file AdolOps.cpp.

◆ dataDependentDerivatives

DataContainer AdolCOps::ADolCDataImpl::dataDependentDerivatives
private

Definition at line 242 of file AdolOps.cpp.


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