|
| 1 | +#pragma once |
| 2 | + |
| 3 | +#include <memory> |
| 4 | +#include <Eigen/Dense> |
| 5 | +#include "uti.h" |
| 6 | +#include "device_uti.h" |
| 7 | + |
| 8 | +template <typename T, int dim> |
| 9 | +class NeoHookeanEnergy |
| 10 | +{ |
| 11 | +public: |
| 12 | + NeoHookeanEnergy(const std::vector<T> &x, const std::vector<int> &e, T mu, T lam); |
| 13 | + NeoHookeanEnergy(); |
| 14 | + ~NeoHookeanEnergy(); |
| 15 | + NeoHookeanEnergy(NeoHookeanEnergy &&rhs); |
| 16 | + NeoHookeanEnergy(const NeoHookeanEnergy &rhs); |
| 17 | + NeoHookeanEnergy &operator=(NeoHookeanEnergy &&rhs); |
| 18 | + |
| 19 | + void update_x(const DeviceBuffer<T> &x); |
| 20 | + void init_vol_IB(); |
| 21 | + T val(); // Calculate the value of the energy |
| 22 | + const DeviceBuffer<T> &grad(); // Calculate the gradient of the energy |
| 23 | + const DeviceTripletMatrix<T, 1> &hess(); // Calculate the Hessian matrix of the energy |
| 24 | + T init_step_size(const DeviceBuffer<T> &p); // Calculate the initial step size for the line search |
| 25 | + |
| 26 | +private: |
| 27 | + struct Impl; |
| 28 | + std::unique_ptr<Impl> pimpl_; |
| 29 | + // static __device__ void polar_svd(const Eigen::Matrix<T, dim, dim> &F, Eigen::Matrix<T, dim, dim> &U, Eigen::Matrix<T, dim, dim> &V, Eigen::Matrix<T, dim, 1> &s); |
| 30 | + // static __device__ Eigen::Matrix<T, dim, 1> dPsi_div_dsigma(const Eigen::Matrix<T, dim, 1> &s, T mu, T lam); |
| 31 | + // static __device__ Eigen::Matrix<T, dim, dim> d2Psi_div_dsigma2(const Eigen::Matrix<T, dim, 1> &s, T mu, T lam); |
| 32 | + // static __device__ T B_left_coef(const Eigen::Matrix<T, dim, 1> &s, T mu, T lam); |
| 33 | + // static __device__ T Psi(const Eigen::Matrix<T, dim, dim> &F, T mu, T lam); |
| 34 | + // static __device__ Eigen::Matrix<T, dim, dim> dPsi_div_dF(const Eigen::Matrix<T, dim, dim> &F, T mu, T lam); |
| 35 | + // static __device__ Eigen::Matrix<T, 4, 4> d2Psi_div_dF2(const Eigen::Matrix<T, dim, dim> &F, T mu, T lam); |
| 36 | + // static __device__ Eigen::Matrix<T, 6, 1> dPsi_div_dx(const Eigen::Matrix<T, dim, dim> &P, const Eigen::Matrix<T, dim, dim> &IB); |
| 37 | + // static __device__ Eigen::Matrix<T, 6, 6> d2Psi_div_dx2(const Eigen::Matrix<T, 4, 4> &dP_div_dF, const Eigen::Matrix<T, dim, dim> &IB); |
| 38 | +}; |
0 commit comments