v0.16.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
MatOps::OpEvalMatHuHuImpl< DIM, DomainEleOp > Struct Template Reference
Inheritance diagram for MatOps::OpEvalMatHuHuImpl< DIM, DomainEleOp >:
[legend]
Collaboration diagram for MatOps::OpEvalMatHuHuImpl< DIM, DomainEleOp >:
[legend]

Public Member Functions

 OpEvalMatHuHuImpl (boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 

Protected Attributes

boost::shared_ptr< PhysicalEquationsphysicalPtr
 
const bool evalStress
 
const bool evalTangent
 

Detailed Description

template<int DIM, typename DomainEleOp>
struct MatOps::OpEvalMatHuHuImpl< DIM, DomainEleOp >

Definition at line 150 of file MatHuHu.cpp.

Constructor & Destructor Documentation

◆ OpEvalMatHuHuImpl()

template<int DIM, typename DomainEleOp >
MatOps::OpEvalMatHuHuImpl< DIM, DomainEleOp >::OpEvalMatHuHuImpl ( boost::shared_ptr< PhysicalEquations physical_ptr,
bool  eval_stress,
bool  eval_tangent 
)
inline

Definition at line 152 of file MatHuHu.cpp.

154 : DomainEleOp("U", DomainEleOp::OPROW), physicalPtr(physical_ptr),
155 evalStress(eval_stress), evalTangent(eval_tangent) {}
boost::shared_ptr< PhysicalEquations > physicalPtr
Definition MatHuHu.cpp:160

Member Function Documentation

◆ doWork()

template<int DIM, typename DomainEleOp >
MoFEMErrorCode MatOps::OpEvalMatHuHuImpl< DIM, DomainEleOp >::doWork ( int  side,
EntityType  type,
EntData data 
)

Definition at line 166 of file MatHuHu.cpp.

168 {
170 int nb_dofs = data.getIndices().size();
171 if (!nb_dofs)
173 int nb_integration_pts = data.getN().size1();
174 auto *fe_ptr = const_cast<FEMethod *>(this->getFEMethod());
175 const auto ent = fe_ptr->getFEEntityHandle();
176
177 auto get_tag = [&]() {
178 if (physicalPtr->tagVsRangePtr) {
179 for (const auto &tag_range_pair : *physicalPtr->tagVsRangePtr) {
180 if (tag_range_pair.second.find(ent) != tag_range_pair.second.end()) {
181 return tag_range_pair.first;
182 }
183 }
184 }
185 return physicalPtr->tAg; // Default tag if no range matches
186 };
187
188 const int current_tag = get_tag();
189
190 auto mat_grad_ptr = physicalPtr->matOpsDataPtr->getCommonDataPtr("grad");
191 auto mat_k_ptr = physicalPtr->matOpsDataPtr->getCommonDataPtr("k");
192 auto mat_k_dF_ptr = physicalPtr->matOpsDataPtr->getCommonDataPtr("k_dF");
193
194#ifndef NDEBUG
195 if (!mat_grad_ptr || !mat_k_ptr || !mat_k_dF_ptr) {
196 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
197 "Missing common data for ADOL-C evaluation");
198 }
199 if (mat_grad_ptr->size2() != DIM * DIM) {
200 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
201 "Inconsistent size of gradient matrix for ADOL-C evaluation");
202 }
203 if (mat_grad_ptr->size1() != nb_integration_pts) {
204 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
205 "Inconsistent size of gradient matrix data for ADOL-C evaluation");
206 }
207#endif
208
210 auto get_grad_at_pts =
211 MatrixSizeHelper<GetFTensor2FromMatType<DIM, DIM, -1, DL>, DL>::get(
212 *mat_grad_ptr, nb_integration_pts);
213 auto get_k_at_pts =
215 *mat_k_ptr, nb_integration_pts);
216 auto get_k_dF_at_pts =
217 MatrixSizeHelper<GetFTensor2FromMatType<DIM, DIM, -1, DL>, DL>::size(
218 *mat_k_dF_ptr, nb_integration_pts);
219
220 if (evalStress) {
221 FTENSOR_INDEX(DIM, i);
222 FTENSOR_INDEX(DIM, J);
223 FTENSOR_INDEX(DIM, K);
224 FTENSOR_INDEX(DIM, L);
225
226 auto t_grad_at_pts = get_grad_at_pts();
227 auto t_k_at_pts = get_k_at_pts();
228
229 auto next = [&]() {
230 ++t_grad_at_pts;
231 ++t_k_at_pts;
232 };
233
235
236 for (auto gg = 0; gg != nb_integration_pts; ++gg) {
237 auto t_F = getFTensor2FromPtr<DIM, DIM>(
238 physicalPtr->matOpsDataPtr->getActiveDataPtr("F")->data().data());
239 t_F(i, J) = t_grad_at_pts(i, J) + t_kd(i, J);
240 CHKERR physicalPtr->setParams(fe_ptr, gg);
241 CHKERR physicalPtr->evaluateVariable(current_tag, ent, gg);
242 t_k_at_pts(0) =
243 (*physicalPtr->matOpsDataPtr->getDependentDataPtr("k"))(0, 0);
244 next();
245 }
246 }
247
248 if (evalTangent) {
249 FTENSOR_INDEX(DIM, i);
250 FTENSOR_INDEX(DIM, J);
251 FTENSOR_INDEX(DIM, k);
252 FTENSOR_INDEX(DIM, L);
253
254 auto t_grad_at_pts = get_grad_at_pts();
255 auto t_k_dF_at_pts = get_k_dF_at_pts();
257
258 auto next = [&]() {
259 ++t_grad_at_pts;
260 ++t_k_dF_at_pts;
261 };
262
263 for (auto gg = 0; gg != nb_integration_pts; ++gg) {
264 auto t_F = getFTensor2FromPtr<DIM, DIM>(
265 physicalPtr->matOpsDataPtr->getActiveDataPtr("F")->data().data());
266 t_F(i, J) = t_grad_at_pts(i, J) + t_kd(i, J);
267 CHKERR physicalPtr->setParams(fe_ptr, gg);
268 CHKERR physicalPtr->evaluateDerivatives(current_tag, ent, gg);
269 auto t_k_dF = getFTensor2FromPtr<DIM, DIM>(
270 physicalPtr->matOpsDataPtr->getDependentDerivativesDataPtr("k_dF")
271 ->data()
272 .data());
273 t_k_dF_at_pts(i, J) = t_k_dF(i, J);
274 next();
275 }
276 }
277
279}
#define FTENSOR_INDEX(DIM, I)
Kronecker Delta class.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition definitions.h:34
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
constexpr auto t_kd
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'J', DIM1 > J
Definition level_set.cpp:30
FTensor::Index< 'k', 3 > k
DataLayoutTraits< DataLayout::GaussByCoeffs > DL
Definition MatHuHu.hpp:33
decltype(GetFTensor1FromMatImpl< Tensor_Dim, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor1FromMatType
decltype(GetFTensor2FromMatImpl< Tensor_Dim0, Tensor_Dim1, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor2FromMatType
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
const VectorInt & getIndices() const
Get global indices of degrees of freedom on entity.
Structure for user loop methods on finite elements.
EntityHandle getFEEntityHandle() const
Get the entity handle of the current finite element.

Member Data Documentation

◆ evalStress

template<int DIM, typename DomainEleOp >
const bool MatOps::OpEvalMatHuHuImpl< DIM, DomainEleOp >::evalStress
protected

Definition at line 161 of file MatHuHu.cpp.

◆ evalTangent

template<int DIM, typename DomainEleOp >
const bool MatOps::OpEvalMatHuHuImpl< DIM, DomainEleOp >::evalTangent
protected

Definition at line 162 of file MatHuHu.cpp.

◆ physicalPtr

template<int DIM, typename DomainEleOp >
boost::shared_ptr<PhysicalEquations> MatOps::OpEvalMatHuHuImpl< DIM, DomainEleOp >::physicalPtr
protected

Definition at line 160 of file MatHuHu.cpp.


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