v0.15.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ObjectiveFunctionData Struct Referenceabstract

Abstract interface for Python-defined objective functions. More...

Inheritance diagram for ObjectiveFunctionData:
[legend]

Public Member Functions

virtual MoFEMErrorCode evalObjectiveFunction (MatrixDouble &coords, boost::shared_ptr< MatrixDouble > u_ptr, boost::shared_ptr< MatrixDouble > stress_ptr, boost::shared_ptr< MatrixDouble > strain_ptr, boost::shared_ptr< VectorDouble > o_ptr)=0
 Evaluate objective function f(coords, u, stress, strain)
 
virtual MoFEMErrorCode evalObjectiveGradientStress (MatrixDouble &coords, boost::shared_ptr< MatrixDouble > u_ptr, boost::shared_ptr< MatrixDouble > stress_ptr, boost::shared_ptr< MatrixDouble > strain_ptr, boost::shared_ptr< MatrixDouble > o_ptr)=0
 Evaluate gradient of objective function w.r.t. stress: ∂f/∂σ
 
virtual MoFEMErrorCode evalObjectiveGradientStrain (MatrixDouble &coords, boost::shared_ptr< MatrixDouble > u_ptr, boost::shared_ptr< MatrixDouble > stress_ptr, boost::shared_ptr< MatrixDouble > strain_ptr, boost::shared_ptr< MatrixDouble > o_ptr)=0
 Evaluate gradient of objective function w.r.t. strain: ∂f/∂ε

 
virtual MoFEMErrorCode numberOfModes (int block_id, int &modes)=0
 Return number of topology optimization modes for given block.
 
virtual MoFEMErrorCode blockModes (int block_id, MatrixDouble &coords, std::array< double, 3 > &centroid, std::array< double, 6 > &bbox, MatrixDouble &o_ptr)=0
 Define spatial modes for topology optimization.
 
virtual ~ObjectiveFunctionData ()=default
 

Detailed Description

Abstract interface for Python-defined objective functions.

This interface allows users to define custom objective functions in Python that can be called from C++ during the optimization process. The objective function and its gradients are evaluated at integration points using:

Key methods:

Examples
mofem/tutorials/vec-7/adjoint.cpp.

Definition at line 124 of file adjoint.cpp.

Constructor & Destructor Documentation

◆ ~ObjectiveFunctionData()

virtual ObjectiveFunctionData::~ObjectiveFunctionData ( )
virtualdefault

Member Function Documentation

◆ blockModes()

virtual MoFEMErrorCode ObjectiveFunctionData::blockModes ( int  block_id,
MatrixDouble coords,
std::array< double, 3 > &  centroid,
std::array< double, 6 > &  bbox,
MatrixDouble o_ptr 
)
pure virtual

Define spatial modes for topology optimization.

Implemented in ObjectiveFunctionDataImpl.

Examples
mofem/tutorials/vec-7/adjoint.cpp.

◆ evalObjectiveFunction()

virtual MoFEMErrorCode ObjectiveFunctionData::evalObjectiveFunction ( MatrixDouble coords,
boost::shared_ptr< MatrixDouble u_ptr,
boost::shared_ptr< MatrixDouble stress_ptr,
boost::shared_ptr< MatrixDouble strain_ptr,
boost::shared_ptr< VectorDouble o_ptr 
)
pure virtual

Evaluate objective function f(coords, u, stress, strain)

Implemented in ObjectiveFunctionDataImpl.

Examples
mofem/tutorials/vec-7/adjoint.cpp.

◆ evalObjectiveGradientStrain()

virtual MoFEMErrorCode ObjectiveFunctionData::evalObjectiveGradientStrain ( MatrixDouble coords,
boost::shared_ptr< MatrixDouble u_ptr,
boost::shared_ptr< MatrixDouble stress_ptr,
boost::shared_ptr< MatrixDouble strain_ptr,
boost::shared_ptr< MatrixDouble o_ptr 
)
pure virtual

Evaluate gradient of objective function w.r.t. strain: ∂f/∂ε

Implemented in ObjectiveFunctionDataImpl.

Examples
mofem/tutorials/vec-7/adjoint.cpp.

◆ evalObjectiveGradientStress()

virtual MoFEMErrorCode ObjectiveFunctionData::evalObjectiveGradientStress ( MatrixDouble coords,
boost::shared_ptr< MatrixDouble u_ptr,
boost::shared_ptr< MatrixDouble stress_ptr,
boost::shared_ptr< MatrixDouble strain_ptr,
boost::shared_ptr< MatrixDouble o_ptr 
)
pure virtual

Evaluate gradient of objective function w.r.t. stress: ∂f/∂σ

Implemented in ObjectiveFunctionDataImpl.

Examples
mofem/tutorials/vec-7/adjoint.cpp.

◆ numberOfModes()

virtual MoFEMErrorCode ObjectiveFunctionData::numberOfModes ( int  block_id,
int &  modes 
)
pure virtual

Return number of topology optimization modes for given block.

Implemented in ObjectiveFunctionDataImpl.

Examples
mofem/tutorials/vec-7/adjoint.cpp.

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