Smith  0.1
Smith is an implicit thermal structural mechanics simulation code.
Namespaces | Functions
differentiable_test_utils.hpp File Reference

Utility functions for testing. More...

#include "gretl/double_state.hpp"
#include "smith/differentiable_numerics/field_state.hpp"
#include "smith/physics/scalar_objective.hpp"
Include dependency graph for differentiable_test_utils.hpp:

Go to the source code of this file.

Namespaces

 smith
 Accelerator functionality.
 

Functions

template<typename DispSpace , typename DensitySpace >
auto smith::createKineticEnergyIntegrator (smith::Domain &domain, const mfem::ParFiniteElementSpace &velocity_space, const mfem::ParFiniteElementSpace &density_space)
 Utility function to construct a smith::functional which evaluates the total kinetic energy.
 
template<typename DispSpace , typename DensitySpace >
gretl::State< double > smith::computeKineticEnergy (const std::shared_ptr< smith::Functional< double(DispSpace, DispSpace, DensitySpace)>> &energy_func, smith::FieldState disp, smith::FieldState velo, smith::FieldState density, double scaling)
 Utility function which computes the kinetic energy and returns it as a gretl state (with its vjp defined)
 
auto smith::checkGradients (const gretl::State< double > &objectiveState, FieldState &inputState, FiniteElementDual &inputDual, double objectiveBase, gretl::DataStore &dataStore, double eps)
 testing utility to confirm order of convergence of the finite differences relative to the backprop gradient
 
auto smith::checkGradients (const gretl::State< double > &objectiveState, gretl::State< double, double > &inputState, double &inputDual, double objectiveBase, gretl::DataStore &dataStore, double eps)
 testing utility to confirm order of convergence of the finite differences relative to the backprop gradient
 
double smith::checkGradWrt (const gretl::State< double > &objective, smith::FieldState &input, double eps, size_t num_fd_steps=4, bool printmore=false)
 Testing utility function which runs a gretl graph num_fd_steps (with increasingly smaller finite difference steps) to check if the computed graph gradients are converging to the finite differenced gradients at the expected rate.
 
double smith::checkGradWrt (const gretl::State< double > &objective, gretl::State< double, double > &input, double eps, size_t num_fd_steps=4, bool printmore=false)
 Testing utility function which runs a gretl graph num_fd_steps (with increasingly smaller finite difference steps) to check if the computed graph gradients are converging to the finite differenced gradients at the expected rate.
 

Detailed Description

Utility functions for testing.

Definition in file differentiable_test_utils.hpp.