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

Public Types

using OP = ForcesAndSourcesCore::UserDataOperator
 

Public Member Functions

 OpTopologicalObjectivePythonImpl (boost::shared_ptr< DataAtIntegrationPts > data_at_pts_ptr, boost::shared_ptr< TopologicalData > topo_p, boost::shared_ptr< ObjectiveFunctionData > python_ptr)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 

Private Attributes

boost::shared_ptr< DataAtIntegrationPtsdataAtPts
 
boost::shared_ptr< TopologicalDatatopoData
 
boost::shared_ptr< ObjectiveFunctionDatapythonPtr
 

Detailed Description

Definition at line 202 of file EshelbianTopologicalDerivativeOperators.cpp.

Member Typedef Documentation

◆ OP

using EshelbianPlasticity::OpTopologicalObjectivePythonImpl::OP = ForcesAndSourcesCore::UserDataOperator

Definition at line 204 of file EshelbianTopologicalDerivativeOperators.cpp.

Constructor & Destructor Documentation

◆ OpTopologicalObjectivePythonImpl()

EshelbianPlasticity::OpTopologicalObjectivePythonImpl::OpTopologicalObjectivePythonImpl ( boost::shared_ptr< DataAtIntegrationPts data_at_pts_ptr,
boost::shared_ptr< TopologicalData topo_p,
boost::shared_ptr< ObjectiveFunctionData python_ptr 
)
inline

Definition at line 206 of file EshelbianTopologicalDerivativeOperators.cpp.

210 : OP(NOSPACE, OP::OPSPACE), dataAtPts(data_at_pts_ptr), topoData(topo_p),
211 pythonPtr(python_ptr) {}
@ NOSPACE
Definition definitions.h:83

Member Function Documentation

◆ doWork()

MoFEMErrorCode EshelbianPlasticity::OpTopologicalObjectivePythonImpl::doWork ( int  side,
EntityType  type,
EntData data 
)

Definition at line 221 of file EshelbianTopologicalDerivativeOperators.cpp.

223 {
225
226#ifndef NDEBUG
227 if (!dataAtPts)
228 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
229 "DataAtIntegrationPts pointer is null");
230 if (!topoData)
231 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
232 "Topological data pointer is null");
233 if (!pythonPtr)
234 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
235 "ObjectiveFunctionData pointer is null");
236#endif // NDEBUG
237
238 constexpr int size_full = SPACE_DIM * SPACE_DIM;
239 const int nb_gauss_pts = getGaussPts().size2();
240 if (!nb_gauss_pts)
242
243 auto stress_full_ptr = boost::make_shared<MatrixDouble>();
244 stress_full_ptr->resize(size_full, nb_gauss_pts, false);
245 stress_full_ptr->clear();
246 auto strain_full_ptr = boost::make_shared<MatrixDouble>();
247 strain_full_ptr->resize(size_full, nb_gauss_pts, false);
248 strain_full_ptr->clear();
249
250 auto t_stress = getFTensor2FromMat<3, 3>(*stress_full_ptr);
251 auto t_strain = getFTensor2FromMat<3, 3>(*strain_full_ptr);
252
253 auto t_P = getFTensor2FromMat<SPACE_DIM, SPACE_DIM>(dataAtPts->approxPAtPts);
254 auto t_log_u =
255 getFTensor2SymmetricFromMat<3>(dataAtPts->logStretchTensorAtPts);
256
257 auto next = [&]() {
258 ++t_stress;
259 ++t_strain;
260 ++t_P;
261 ++t_log_u;
262 };
263
266
267 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
268 // we have to handle all variants, that will render how the Jacobian
269 // gradient is evaluated.
270 t_stress(i, j) = t_P(i, j);
271 t_strain(i, j) = t_log_u(i, j);
272 next();
273 }
274
275 auto &coords = OP::getCoordsAtGaussPts();
276 CHKERR pythonPtr->evalInteriorObjectiveFunction(
277 coords, dataAtPts->getSmallWL2AtPts(), stress_full_ptr, strain_full_ptr,
278 topoData->getObjAtPts(), false);
279
280 CHKERR pythonPtr->evalInteriorObjectiveGradientStrain(
281 coords, dataAtPts->getSmallWL2AtPts(), stress_full_ptr, strain_full_ptr,
282 topoData->getObjDStrainAtPts(), false);
283
284 CHKERR pythonPtr->evalInteriorObjectiveGradientU(
285 coords, dataAtPts->getSmallWL2AtPts(), stress_full_ptr, strain_full_ptr,
286 topoData->getObjDDisplacementAtPts(), false);
287
288 CHKERR pythonPtr->evalInteriorObjectiveGradientStress(
289 coords, dataAtPts->getSmallWL2AtPts(), stress_full_ptr, strain_full_ptr,
290 topoData->getObjDStressAtPts(), false);
291
293}
#define FTENSOR_INDEX(DIM, I)
constexpr int SPACE_DIM
#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_DATA_INCONSISTENCY
Definition definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j

Member Data Documentation

◆ dataAtPts

boost::shared_ptr<DataAtIntegrationPts> EshelbianPlasticity::OpTopologicalObjectivePythonImpl::dataAtPts
private

Definition at line 216 of file EshelbianTopologicalDerivativeOperators.cpp.

◆ pythonPtr

boost::shared_ptr<ObjectiveFunctionData> EshelbianPlasticity::OpTopologicalObjectivePythonImpl::pythonPtr
private

Definition at line 218 of file EshelbianTopologicalDerivativeOperators.cpp.

◆ topoData

boost::shared_ptr<TopologicalData> EshelbianPlasticity::OpTopologicalObjectivePythonImpl::topoData
private

Definition at line 217 of file EshelbianTopologicalDerivativeOperators.cpp.


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