Smith  0.1
Smith is an implicit thermal structural mechanics simulation code.
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
smith Namespace Reference

Accelerator functionality. More...

Namespaces

 accelerator
 Namespace for methods involving accelerator-enabled builds.
 
 cli
 Command line functionality.
 
 heat_transfer
 HeatTransfer helper structs.
 
 input
 The input related helper functions and objects.
 
 mesh
 Mesh related input options.
 
 output
 The output related helper functions and objects.
 
 profiling
 profiling namespace
 
 solid_mechanics
 SolidMechanics helper data types.
 
 thermomechanics
 Thermomechanics helper data types.
 

Classes

class  DifferentiablePhysics
 Implementation of BasePhysics which uses FieldStates and gretl to track the computational graph, dynamically checkpoint, and back-propagate sensitivities. More...
 
class  DifferentiableSolver
 Abstract interface to DifferentiableSolver interface. Each differentiable solve should provide both its forward solve and an adjoint solve. More...
 
class  LinearDifferentiableSolver
 Implementation of the DifferentiableSolver interface for the special case of linear solves with linear adjoint solves. More...
 
class  NonlinearDifferentiableSolver
 Implementation of the DifferentiableSolver interface for the special case of nonlinear solves with linear adjoint solves. More...
 
class  DifferentiableBlockSolver
 Abstract interface to DifferentiableBlockSolver interface. Each differentiable block solve should provide both its forward solve and an adjoint solve. More...
 
class  LinearDifferentiableBlockSolver
 Implementation of the DifferentiableBlockSolver interface for the special case of linear solves with linear adjoint solves. More...
 
class  NonlinearDifferentiableBlockSolver
 Implementation of the DifferentiableBlockSolver interface for the special case of nonlinear solves with linear adjoint solves. More...
 
class  DirichletBoundaryConditions
 A generic class for setting Dirichlet boundary conditions on arbitrary physics. More...
 
struct  zero_dual_from_state
 functor which takes a std::shared_ptr<FiniteElementState>, and returns a zero-valued std::shared_ptr<FiniteElementDual> with the same space More...
 
struct  zero_state_from_dual
 functor which takes a std::shared_ptr<FiniteElementDual>, and returns a zero-valued std::shared_ptr<FiniteElementState> with the same space More...
 
struct  FieldStateWeightedSum
 temporary object to register the multiplication of a gretl::State<double> with a FieldState. Casts back More...
 
class  LumpedMassExplicitNewmarkStateAdvancer
 Lumped mass explicit dynamics implementation for the StateAdvancer interface. More...
 
class  ParaviewWriter
 Class which interactions with ParaViewDataCollection to write arbitrary field results to disk. This allows output independent of a particular BasePhysics. More...
 
class  SolidMechanicsStateAdvancer
 Implementation of the StateAdvancer interface for advancing the solution of solid mechanics problems. More...
 
class  StateAdvancer
 Base state advancer class, allows specification for quasi-static solve strategies, or time integration algorithms. More...
 
class  TimeDiscretizedWeakForm
 
class  TimeDiscretizedWeakForm< spatial_dim, OutputSpace, Parameters< InputSpaces... > >
 A time discretized weakform gets a TimeInfo object passed as arguments to q-function (lambdas which are integrated over quadrature points) so users can have access to time increments, and timestep cycle. These quantities are often valuable for time integrated PDEs. More...
 
class  SecondOrderTimeDiscretizedWeakForms
 A container holding the two types of weak forms useful for solving time discretized second order (in time) systems of equations. More...
 
class  SecondOrderTimeDiscretizedWeakForm
 
class  SecondOrderTimeDiscretizedWeakForm< spatial_dim, OutputSpace, Parameters< TrialInputSpace, InputSpaces... > >
 Useful for time-discretized PDEs of second order (involves for first and second derivatives of time). Users write q-functions in terns of u, u_dot, u_dot_dot, and the weak form is transformed by the ImplicitNewmarkSecondOrderTimeIntegrationRule so that is it globally a function of u, u_old, u_dot_old, u_dot_dot_old, with u as the distinct unknown for the time discretized system. More...
 
struct  BackwardEulerFirstOrderTimeIntegrationRule
 encodes rules for time discretizing first order odes (involving first time derivatives). When solving f(u, u_dot, t) = 0 this class provides the current discrete approximation for u and u_dot as a function of (u^{n+1}, u^n). More...
 
struct  ImplicitNewmarkSecondOrderTimeIntegrationRule
 encodes rules for time discretizing second order odes (involving first and second time derivatives). When solving f(u, u_dot, u_dot_dot, t) = 0 this class provides the current discrete approximation for u, u_dot, and u_dot_dot as a function of (u^{n+1},u^n,u_dot^n,u_dot_dot^n). More...
 
class  TimestepEstimator
 Base class interface for estimating the stable timestep given the current state and parameters. More...
 
class  ConstantTimeStepEstimator
 TimeStepEstimator which uses a simple and fixed timestep. More...
 
class  ApplicationManager
 RAII Application Manager class. Initializes MPI and other important libraries as well as automatically finalizes them upon going out of scope. More...
 
struct  variant_alternative
 Obtains the type at index I of a variant<T0, T1> More...
 
struct  variant_alternative< 0, T0, T1 >
 Obtains the type at index 0 of a variant<T0, T1> More...
 
struct  variant_alternative< 1, T0, T1 >
 Obtains the type at index 1 of a variant<T0, T1> More...
 
struct  variant
 A simple variant type that supports only two elements. More...
 
class  BlockDiagonalPreconditioner
 Simple block diagonal preconditioner for block systems. More...
 
class  BlockTriangularPreconditioner
 Simple block triangular preconditioner for block systems. More...
 
class  BlockSchurPreconditioner
 Simple 2x2 block Schur complement preconditioner for block systems. More...
 
class  NewtonSolver
 Newton solver with a 2-way line-search. Reverts to regular Newton if max_line_search_iterations is set to 0. More...
 
struct  TrustRegionSettings
 Internal structure for storing trust region settings. More...
 
struct  TrustRegionResults
 Internal structure for storing trust region stateful data. More...
 
class  TrustRegion
 Equation solver class based on a standard preconditioned trust-region algorithm. More...
 
class  EquationSolver
 This class manages the objects typically required to solve a nonlinear set of equations arising from discretization of a PDE of the form F(x) = 0. Specifically, it has. More...
 
class  SuperLUSolver
 A wrapper class for using the MFEM SuperLU solver with a HypreParMatrix. More...
 
struct  DifferentiateWRT
 
struct  differentiate_wrt_this
 this type exists solely as a way to signal to smith::Functional that the function smith::Functional::operator()` should differentiate w.r.t. a specific argument More...
 
struct  Domain
 a class for representing a geometric region that can be used for integration More...
 
struct  dual
 Dual number struct (value plus gradient) More...
 
struct  is_dual_number
 class for checking if a type is a dual number or not More...
 
struct  is_dual_number< dual< T > >
 class for checking if a type is a dual number or not More...
 
struct  ElementRestriction
 
struct  BlockElementRestriction
 a generalization of mfem::ElementRestriction that works with multiple kinds of element geometries. Instead of doing the "E->L" (gather) and "L->E" (scatter) operations for only one element geometry, this class does them with block "E-vectors", where each element geometry is a separate block. More...
 
struct  TensorProductQuadratureRule
 a convenience class for generating information about tensor product integration rules from the underlying 1D rule. More...
 
struct  CompileTimeValue
 
struct  batched_jacobian
 this struct is used to look up mfem's memory layout of the quadrature point jacobian matrices More...
 
struct  batched_jacobian< mfem::Geometry::CUBE, q >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
struct  batched_jacobian< mfem::Geometry::SQUARE, q >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
struct  batched_jacobian< mfem::Geometry::TRIANGLE, q >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
struct  batched_jacobian< mfem::Geometry::TETRAHEDRON, q >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
struct  batched_position
 this struct is used to look up mfem's memory layout of the quadrature point position vectors More...
 
struct  batched_position< mfem::Geometry::CUBE, q >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
struct  batched_position< mfem::Geometry::SQUARE, q >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
struct  batched_position< mfem::Geometry::TRIANGLE, q >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
struct  batched_position< mfem::Geometry::TETRAHEDRON, q >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
struct  batched_position< mfem::Geometry::SEGMENT, q >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
struct  H1
 H1 elements of order p. More...
 
struct  Hcurl
 H(curl) elements of order p. More...
 
struct  L2
 Discontinuous elements of order p. More...
 
struct  QOI
 "Quantity of Interest" elements (i.e. elements with a single shape function, 1) More...
 
struct  FunctionSpace
 a small POD class for tracking function space metadata More...
 
struct  finite_element
 Template prototype for finite element implementations. More...
 
struct  DependsOn
 
struct  Index
 Compile-time alias for index of differentiation. More...
 
class  Functional< test(trials...), exec >
 Intended to be like std::function for finite element kernels. More...
 
struct  QoIProlongation
 this class behaves like a Prolongation operator, except is specialized for the case of a quantity of interest. The action of its MultTranspose() operator (the only thing it is used for) sums the values from different processors. More...
 
struct  QoIElementRestriction
 this class behaves like a Restriction operator, except is specialized for the case of a quantity of interest. The action of its ScatterAdd() operator (the only thing it is used for) sums the values on this local processor. More...
 
class  Functional< double(trials...), exec >
 a partial template specialization of Functional with test == double, implying "quantity of interest" More...
 
struct  GeometricFactors
 a class that computes and stores positions and jacobians at each quadrature point More...
 
struct  Dimension
 Compile-time alias for a dimension. More...
 
struct  Integral
 a class for representing a Integral calculations and their derivatives More...
 
struct  isotropic_tensor
 an object representing a highly symmetric kind of tensor, that is interoperable with smith::tensor, but uses less memory and performs less calculation than its dense counterpart More...
 
struct  isotropic_tensor< T, n >
 there is no such thing as a rank-1 isotropic tensor, but we include this specialization to help explain that to users, rather than just producing an "incomplete type" compilation error More...
 
struct  isotropic_tensor< T, m, m >
 a rank-2 isotropic tensor is essentially just the Identity matrix, with a constant of proportionality More...
 
struct  isotropic_tensor< T, 3, 3, 3 >
 the only rank-3 isotropic tensor we suport is the alternating tensor (levi-civita symbol) More...
 
struct  isotropic_tensor< T, m, m, m, m >
 there are 3 independent rank-4 isotropic tensors (dilatational, symmetric, antisymmetric), so this object represents a linear combination of them More...
 
struct  QuadratureRule
 A rule for numerical quadrature (set of points and weights) Can be thought of as a compile-time analogue of mfem::IntegrationRule. More...
 
struct  Nothing
 these classes are a little confusing. These two special types represent the similar (but different) cases of: More...
 
struct  Empty
 see Nothing for a complete description of this class and when to use it More...
 
struct  QuadratureData
 A class for storing and access user-defined types at quadrature points. More...
 
class  ShapeAwareFunctional< shape, test(trials...), exec >
 This is a small wrapper around smith::Functional for shape-displaced domains of integration. More...
 
struct  tensor
 Arbitrary-rank tensor class. More...
 
struct  zero
 A sentinel struct for eliding no-op tensor operations. More...
 
struct  is_zero
 checks if a type is zero More...
 
struct  is_zero< zero >
 
struct  LuFactorization
 Representation of an LU factorization. More...
 
struct  tuple
 This is a class that mimics most of std::tuple's interface, except that it is usable in CUDA kernels and admits some arithmetic operator overloads. More...
 
struct  tuple< T0 >
 Type that mimics std::tuple. More...
 
struct  tuple< T0, T1 >
 Type that mimics std::tuple. More...
 
struct  tuple< T0, T1, T2 >
 Type that mimics std::tuple. More...
 
struct  tuple< T0, T1, T2, T3 >
 Type that mimics std::tuple. More...
 
struct  tuple< T0, T1, T2, T3, T4 >
 Type that mimics std::tuple. More...
 
struct  tuple< T0, T1, T2, T3, T4, T5 >
 Type that mimics std::tuple. More...
 
struct  tuple< T0, T1, T2, T3, T4, T5, T6 >
 Type that mimics std::tuple. More...
 
struct  tuple< T0, T1, T2, T3, T4, T5, T6, T7 >
 Type that mimics std::tuple. More...
 
struct  tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8 >
 Type that mimics std::tuple. More...
 
struct  tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 >
 Type that mimics std::tuple. More...
 
struct  tuple< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 >
 Type that mimics std::tuple. More...
 
struct  tuple_size
 
struct  tuple_size< smith::tuple< Types... > >
 
struct  tuple_element
 a struct used to determine the type at index I of a tuple More...
 
struct  tuple_element< I, tuple< Head, Tail... > >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
struct  tuple_element< 0, tuple< Head, Tail... > >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
struct  is_tuple
 Trait for checking if a type is a smith::tuple. More...
 
struct  is_tuple< smith::tuple< T... > >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
struct  is_tuple_of_tuples
 Trait for checking if a type if a smith::tuple containing only smith::tuple. More...
 
struct  is_tuple_of_tuples< smith::tuple< T... > >
 Trait for checking if a type if a smith::tuple containing only smith::tuple. More...
 
struct  is_tensor_of_dual_number
 class for checking if a type is a tensor of dual numbers or not More...
 
struct  is_tensor_of_dual_number< tensor< dual< T >, n... > >
 class for checking if a type is a tensor of dual numbers or not More...
 
struct  SolverStatus
 Status and diagnostics of nonlinear equation solvers. More...
 
struct  ScalarSolverOptions
 Settings for solve_scalar_equation. More...
 
struct  TimesteppingOptions
 A timestep and boundary condition enforcement method for a dynamic solver. More...
 
struct  AMGXOptions
 Stores the information required to configure a NVIDIA AMGX preconditioner. More...
 
struct  AMGFContactOptions
 Stores the configuration information for an AMGFContact preconditioner. More...
 
struct  LinearSolverOptions
 Parameters for an iterative linear solution scheme. More...
 
struct  NonlinearSolverOptions
 Nonlinear solution scheme parameters. More...
 
class  BasePhysics
 This is the abstract base class for a generic forward solver. More...
 
class  BoundaryCondition
 Boundary condition information bundle. More...
 
class  BoundaryConditionManager
 A container for the boundary condition information relating to a specific physics module. More...
 
class  Components
 A set to flag components of a vector field. More...
 
struct  TimeInfo
 struct storing time and timestep information More...
 
struct  Parameters
 a struct that is used in the physics modules to clarify which template arguments are user-controlled parameters (e.g. for design optimization) More...
 
class  Constraint
 Abstract constraint class. More...
 
struct  ContactOptions
 Stores the options for a contact pair. More...
 
class  ContactData
 This class stores all ContactInteractions for a problem, calls Tribol functions that act on all contact interactions, and agglomerates fields that exist over different ContactInteractions. More...
 
class  FunctionalObjective
 
class  FunctionalObjective< spatial_dim, Parameters< InputSpaces... >, std::integer_sequence< int, parameter_indices... > >
 FunctionalObjective object, implements to the ScalarFunctional interface using smith::ShapeAwareFunctional. More...
 
class  FunctionalWeakForm
 
class  FunctionalWeakForm< spatial_dim, OutputSpace, Parameters< InputSpaces... >, std::integer_sequence< int, input_indices... > >
 A nonlinear WeakForm class implemented using smith::Functional. More...
 
class  HeatTransfer
 An object containing the solver for a heat transfer PDE. More...
 
class  HeatTransfer< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
struct  HeatTransferInputOptions
 Stores all information held in the input file that is used to configure the solver. More...
 
class  HeatTransferWeakForm
 
class  HeatTransferWeakForm< order, dim, Parameters< InputSpaces... > >
 The weak form for heat transfer. More...
 
struct  HardeningInputOptions
 Contains function that defines the schema for hardening laws. More...
 
struct  LiquidCrystElastomerBrighenti
 Brighenti's liquid crystal elastomer model. More...
 
struct  LiquidCrystalElastomerBertoldi
 Bertoldi's liquid crystal elastomer model Paper: Li, S., Librandi, G., Yao, Y., Richard, A. J., Schneider‐Yamamura, A., Aizenberg, J., & Bertoldi, K. (2021). Controlling Liquid Crystal Orientations for Programmable Anisotropic Transformations in Cellular Microstructures. Advanced Materials, 33(42), 2105024. More...
 
struct  SolidMaterialInputOptions
 Contains function that defines the schema for solid mechanics materials. More...
 
struct  ThermalMaterialInputOptions
 Contains function that defines the schema for heat transfer materials. More...
 
class  Mesh
 Helper class for constructing a mesh consistent with Smith. More...
 
class  ScalarObjective
 Abstract residual class. More...
 
class  SolidMechanics
 
class  SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >
 The nonlinear solid solver class. More...
 
class  SolidMechanicsContact
 
class  SolidMechanicsContact< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >
 The nonlinear solid with contact solver class. More...
 
struct  SolidMechanicsInputOptions
 Stores all information held in the input file that is used to configure the solver. More...
 
class  SolidWeakForm
 
class  SolidWeakForm< order, dim, Parameters< InputSpaces... > >
 The weak form for solid mechanics. More...
 
class  FiniteElementDual
 Class for encapsulating the dual vector space of a finite element space (i.e. the space of linear forms as applied to a specific basis set) More...
 
class  FiniteElementState
 Class for encapsulating the critical MFEM components of a primal finite element field. More...
 
class  FiniteElementVector
 Class for encapsulating the data associated with a vector derived from a MFEM finite element space. Specifically, it contains the information needed for both primal finite element state fields and dual finite element vectors. More...
 
class  StateManager
 Manages the lifetimes of FEState objects such that restarts are abstracted from physics modules. More...
 
class  Thermomechanics
 The operator-split thermal-structural solver. More...
 
struct  ThermomechanicsInputOptions
 Stores all information held in the input file that is used to configure the thermal structural solver. More...
 
class  ThermomechanicsMonolithic
 
class  ThermomechanicsMonolithic< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >
 The monolithic thermal-structural solver with operator-split options. More...
 
class  WeakForm
 Abstract WeakForm class. More...
 

Typedefs

using FEFieldPtr = std::shared_ptr< FiniteElementState >
 typedef
 
using FEDualPtr = std::shared_ptr< FiniteElementDual >
 typedef
 
using FieldState = gretl::State< FEFieldPtr, FEDualPtr >
 typedef
 
using ReactionState = gretl::State< FEDualPtr, FEFieldPtr >
 typedef
 
using FieldVecState = gretl::State< std::vector< FEFieldPtr >, std::vector< FEDualPtr > >
 typedef
 
using DoubleState = gretl::State< double, double >
 typedef
 
using QuasiStaticFirstOrderTimeIntegrationRule = BackwardEulerFirstOrderTimeIntegrationRule
 
template<typename T , int dim, ExecutionSpace space>
using ExecArray = axom::Array< T, dim, detail::execution_to_memory_v< space > >
 Alias for an Array corresponding to a particular ExecutionSpace.
 
template<typename T , int dim = 1>
using CPUArray = ExecArray< T, dim, ExecutionSpace::CPU >
 Alias for an array on the CPU.
 
template<typename T , int dim = 1>
using GPUArray = ExecArray< T, dim, ExecutionSpace::CPU >
 Alias for an array on the GPU.
 
template<typename T , int dim = 1>
using UnifiedArray = ExecArray< T, dim, ExecutionSpace::CPU >
 Alias for an array in unified memory.
 
template<typename T , int dim, ExecutionSpace space>
using ExecArrayView = axom::ArrayView< T, dim, detail::execution_to_memory_v< space > >
 Alias for an ArrayView corresponding to a particular ExecutionSpace.
 
template<typename T , int dim = 1>
using CPUArrayView = ExecArrayView< T, dim, ExecutionSpace::CPU >
 Alias for an array view on the CPU.
 
using BlockOverride = std::pair< int, std::unique_ptr< const mfem::Operator > >
 Optional override for a diagonal block operator. More...
 
using vec2 = tensor< double, 2 >
 statically sized vector of 2 doubles
 
using vec3 = tensor< double, 3 >
 statically sized vector of 3 doubles
 
using mat2 = tensor< double, 2, 2 >
 statically sized 2x2 matrix of doubles
 
using mat3 = tensor< double, 3, 3 >
 statically sized 3x3 matrix of doubles
 
template<typename T , int n1, int n2 = 1>
using reduced_tensor = std::conditional_t<(n1==1 &&n2==1), double, std::conditional_t< n1==1, tensor< T, n2 >, std::conditional_t< n2==1, tensor< T, n1 >, tensor< T, n1, n2 > >> >
 Removes 1s from tensor dimensions For example, a tensor<T, 1, 10> is equivalent to a tensor<T, 10> More...
 
template<typename T1 , typename T2 >
using outer_product_t = typename detail::outer_prod< T1, T2 >::type
 a type function that returns the tensor type of an outer product of two tensors More...
 
template<int i, int n, typename T >
using one_hot_t = typename one_hot< i, n, T >::type
 a tuple type with n entries, all of which are of type smith::zero, except for the i^{th} entry, which is of type T More...
 
using FieldPtr = FiniteElementState *
 using
 
using DualFieldPtr = FiniteElementDual *
 using
 
using ConstFieldPtr = FiniteElementState const *
 using
 
using ConstDualFieldPtr = FiniteElementDual const *
 using
 
using var_hardening_t = std::variant< solid_mechanics::LinearHardening, solid_mechanics::PowerLawHardening, solid_mechanics::VoceHardening >
 Holds all possible isotropic hardening laws that can be utilized in our input file.
 
using var_solid_material_t = std::variant< solid_mechanics::NeoHookean, solid_mechanics::LinearIsotropic, solid_mechanics::J2SmallStrain< solid_mechanics::LinearHardening >, solid_mechanics::J2SmallStrain< solid_mechanics::PowerLawHardening >, solid_mechanics::J2SmallStrain< solid_mechanics::VoceHardening > >
 All possible solid mechanics materials that can be utilized in our input file.
 
using var_thermal_material_t = std::variant< heat_transfer::LinearIsotropicConductor, heat_transfer::LinearConductor< 2 >, heat_transfer::LinearConductor< 3 > >
 Holds all possible heat transfer materials that can be utilized in our Input Deck.
 
using GeneralCoefficient = variant< std::shared_ptr< mfem::Coefficient >, std::shared_ptr< mfem::VectorCoefficient > >
 A sum type for encapsulating either a scalar or vector coeffient.
 
using QuadratureField = double
 This is a placeholder for quadrature fields.
 
using QuadratureFieldPtr = double *
 This is a placeholder for quadrature field pointers.
 
using ConstQuadratureFieldPtr = const double *
 This is a placeholder for const quadrature field pointers.
 

Enumerations

enum class  ExecutionSpace { CPU , GPU , Dynamic }
 enum used for signalling whether or not to perform certain calculations on the CPU or GPU
 
enum class  BlockTriangularType { Lower , Upper , Symmetric }
 Selects the block triangular sweep used by BlockTriangularPreconditioner. More...
 
enum class  BlockSchurType { Diagonal , Lower , Upper , Full }
 Selects the block Schur preconditioner variant. More...
 
enum class  SchurApproxType { DiagInv , A22Only , Custom }
 Selects how the (1,1) Schur operator is approximated. More...
 
enum class  Family {
  QOI , H1 , HCURL , HDIV ,
  L2
}
 Element conformity. More...
 
enum class  TimestepMethod {
  QuasiStatic , BackwardEuler , SDIRK33 , ForwardEuler ,
  RK2 , RK3SSP , RK4 , GeneralizedAlpha ,
  ImplicitMidpoint , SDIRK23 , SDIRK34 , Newmark ,
  HHTAlpha , WBZAlpha , AverageAcceleration , LinearAcceleration ,
  CentralDifference , FoxGoodwin
}
 Timestep method of a solver. More...
 
enum class  DirichletEnforcementMethod { DirectControl , RateControl , FullControl }
 this enum describes which way to enforce the time-varying constraint u(t) == U(t) More...
 
enum class  LinearSolver {
  CG , GMRES , SuperLU , Strumpack ,
  PetscCG , PetscGMRES
}
 Linear solution method indicator. More...
 
enum class  NonlinearSolver {
  Newton , LBFGS , NewtonLineSearch , TrustRegion ,
  KINFullStep , KINBacktrackingLineSearch , KINPicard , PetscNewton ,
  PetscNewtonBacktracking , PetscNewtonCriticalPoint , PetscTrustRegion
}
 Nonlinear solver method indicator. More...
 
enum class  AMGXSolver {
  AMG , PCGF , CG , PCG ,
  PBICGSTAB , BICGSTAB , FGMRES , JACOBI_L1 ,
  GS , POLYNOMIAL , KPZ_POLYNOMIAL , BLOCK_JACOBI ,
  MULTICOLOR_GS , MULTICOLOR_DILU
}
 Solver types supported by AMGX. More...
 
enum class  PetscPCType {
  JACOBI , JACOBI_L1 , JACOBI_ROWSUM , JACOBI_ROWMAX ,
  PBJACOBI , BJACOBI , LU , ILU ,
  CHOLESKY , SVD , ASM , GASM ,
  GAMG , HMG , NONE
}
 Preconditioner types supported by PETSc. More...
 
enum class  Preconditioner {
  HypreJacobi , HypreL1Jacobi , HypreGaussSeidel , HypreAMG ,
  HypreILU , AMGX , Petsc , AMGFContact ,
  None
}
 The type of preconditioner to be used. More...
 
enum  SubSpaceOptions { NEVER , WHEN_INDEFINITE , WHEN_INDEFINITE_OR_BOUNDARY , ALWAYS }
 Enumerated options for when to use trust-region subspace solver.
 
enum class  Component : size_t { X = 0b001 , Y = 0b010 , Z = 0b100 , ALL = 0b111 }
 Type giving vector components meaningful names and restricting inputs to Components class to meaningful values.
 
enum class  ContactMethod { SingleMortar }
 Methodology for enforcing contact constraints (i.e. how you form the constraint equations) More...
 
enum class  ContactEnforcement { Penalty , LagrangeMultiplier }
 Describes how to enforce the contact constraint equations. More...
 
enum class  ContactType { TiedNormal , Frictionless }
 Mechanical constraint type on contact surfaces. More...
 
enum class  ContactJacobian { Approximate , Exact }
 Method for computing Jacobian of contact terms. More...
 
enum class  ElementType { H1 , HCURL , HDIV , L2 }
 The type of a finite element basis function. More...
 

Functions

void defineInputFileSchema (axom::inlet::Inlet &inlet)
 Define the input file structure for the driver code. More...
 
gretl::State< int > make_milestone (const std::vector< FieldState > &states)
 gretl-function to create a dummy-state which records all states and params of interest to the mechanics. This is used to inject additional adjoint loads and evaluate individual timestep sensitivities for the BasePhysics interface.
 
template<int dim, typename ShapeDispSpace , typename VectorSpace , typename... ParamSpaces>
auto buildSolidMechanics (std::shared_ptr< smith::Mesh > mesh, std::shared_ptr< DifferentiableSolver > d_solid_nonlinear_solver, smith::ImplicitNewmarkSecondOrderTimeIntegrationRule time_rule, size_t num_checkpoints, std::string physics_name, const std::vector< std::string > &param_names={})
 Helper function to generate the base-physics for solid mechanics. More...
 
double matrixNorm (std::unique_ptr< mfem::HypreParMatrix > &K)
 Utility to compute the matrix norm.
 
double skewMatrixNorm (std::unique_ptr< mfem::HypreParMatrix > &K)
 Utility to compute 0.5*norm(K-K.T)
 
void initializeSolver (mfem::Solver *mfem_solver, const smith::FiniteElementState &u)
 Initialize mfem solver if near-nullspace is needed.
 
std::shared_ptr< LinearDifferentiableSolverbuildDifferentiableLinearSolver (LinearSolverOptions linear_opts, const smith::Mesh &mesh)
 Create a differentiable linear solver. More...
 
std::shared_ptr< NonlinearDifferentiableSolverbuildDifferentiableNonlinearSolver (NonlinearSolverOptions nonlinear_opts, LinearSolverOptions linear_opts, const smith::Mesh &mesh)
 Create a differentiable nonlinear solver. More...
 
std::shared_ptr< NonlinearDifferentiableBlockSolverbuildDifferentiableNonlinearBlockSolver (NonlinearSolverOptions nonlinear_opts, LinearSolverOptions linear_opts, const smith::Mesh &mesh)
 Create a differentiable nonlinear block solver. More...
 
template<typename DispSpace , typename DensitySpace >
auto 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 > 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 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 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 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 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.
 
DoubleState evaluateObjective (const ScalarObjective &objective, const FieldState &shape_disp, const std::vector< FieldState > &inputs, const TimeInfo &time_info=TimeInfo(0.0, 1.0, 0))
 Evaluates a DoubleState using a provided ScalarObjective reference, and the input arguments to that objective. This operation is tracked on the gretl graph.
 
FieldState computeLumpedMass (const WeakForm *mass_residual_eval, const FieldState &shape_u, const FieldState &lumped_field, const FieldState &rho)
 gretl-function implementation to compute lumped mass vectors from shape_displacements FieldState and a density field FieldState. A lumped_field is also passed to communicate the intended dimension of the lumped mass. For example, as scalar lumped field will result in a single lumped mass per node, while a vector lumped field will give a nodal lumped field, where every component of the lumped vector per node has the full mass lumped value (the sum of all lumped masses will be dim * total_mass)
 
FieldState diagInverse (const FieldState &x)
 gretl-function implementation to compute invert the values for every entry in a FieldState.
 
FieldState evalResidual (const WeakForm *residual_eval, FieldState shape_disp, const std::vector< FieldState > &states, const std::vector< FieldState > &params, TimeInfo time_info, size_t inertial_index)
 gretl-function implementation which evaluates the residual force (which is minus the mechanical force) given shape displacement, states and params. The inertial index denotes which index in the state corresponds to the highest time derivative term (e.g., acceleration for solid mechanics).
 
FieldState componentWiseMult (const FieldState &x, const FieldState &y, const BoundaryConditionManager *bc_manager)
 gretl-function implementation which multiplies x and y component-wise to create a new FieldState. The bc_manager is used to zero the constrained dofs of the output Field.
 
FieldState negativeComponentWiseMult (const FieldState &x, const FieldState &y, const BoundaryConditionManager *bc_manager)
 gretl-function implementation which multiplies and then negates x and y component-wise to create a new FieldState. The bc_manager is used to zero the constrained dofs of the output Field. The intended use-case here is explicit dynamics, where the residual is the negative of the force, and the inverse of the mass is strictly positive. The negative component-wise multiplication of these gives the nodal accelerations.
 
FieldState square (const FieldState &state)
 gretl-function to square (x^2) every component of the Field
 
gretl::State< double > innerProduct (const FieldState &a, const FieldState &b)
 gretl-function to compute the inner product (vector l2-norm) of a and b
 
gretl::State< double > innerProduct (const ReactionState &a, const ReactionState &b)
 gretl-function to compute the inner product (vector l2-norm) of a and b
 
FieldState axpby (double a, const FieldState &x, double b, const FieldState &y)
 gretl-function to compute a*x + b*y
 
FieldState zeroCopy (const FieldState &x)
 gretl-function to make a deep-copy of a FieldState and initialize it to 0.
 
FieldState axpby (const gretl::State< double > &a, const FieldState &x, const gretl::State< double > &b, const FieldState &y)
 axpby using State<double> and FieldState
 
FieldState weighted_sum (const std::vector< double > &weights, const std::vector< FieldState > &weighted_fields, const std::vector< gretl::State< double >> &differentiable_weights, const std::vector< FieldState > &differentiably_weighted_fields, const std::vector< double > &differentiable_scale_factors)
 compute the differentiable weighted sum of fields, weighted by both double weights, and also gret::State<double> differentiable weights. The differentiable_scale_factors are applied to the differentiable weights to enable negation and scalar muliplication of weights.
 
FieldStateWeightedSum operator* (double a, const FieldState &b)
 multiply scalar by a FieldState to get a temporary FieldStateWeightedSum which can cast back to a FieldState
 
FieldStateWeightedSum operator* (const FieldState &b, double a)
 multiply scalar by a FieldState to get a temporary FieldStateWeightedSum which can cast back to a FieldState
 
FieldStateWeightedSum operator* (double a, const FieldStateWeightedSum &b)
 multiply scalar by a FieldStateWeightedSum to get a temporary FieldStateWeightedSum which can cast back to a FieldState
 
FieldStateWeightedSum operator* (const FieldStateWeightedSum &b, double a)
 multiply scalar by a FieldStateWeightedSum to get a temporary FieldStateWeightedSum which can cast back to a FieldState
 
FieldStateWeightedSum operator* (const gretl::State< double > &a, const FieldState &b)
 multiply scalar by a FieldState to get a temporary FieldStateWeightedSum which can cast back to a FieldState
 
FieldStateWeightedSum operator* (const FieldState &b, const gretl::State< double > &a)
 multiply scalar by a FieldState to get a temporary FieldStateWeightedSum which can cast back to a FieldState
 
FieldStateWeightedSum operator+ (const FieldState &x, const FieldState &y)
 add two FieldState
 
FieldStateWeightedSum operator- (const FieldState &x, const FieldState &y)
 subtract two FieldState
 
FieldStateWeightedSum operator+ (const FieldStateWeightedSum &ax, const FieldStateWeightedSum &by)
 add two FieldStateWeightedSum
 
FieldStateWeightedSum operator- (const FieldStateWeightedSum &ax, const FieldStateWeightedSum &by)
 subtract two FieldStateWeightedSum
 
FieldStateWeightedSum operator+ (const FieldStateWeightedSum &ax, const FieldState &y)
 add FieldStateWeightedSum and FieldState
 
FieldStateWeightedSum operator+ (const FieldState &y, const FieldStateWeightedSum &ax)
 add FieldStateWeightedSum and FieldState
 
FieldStateWeightedSum operator- (const FieldStateWeightedSum &ax, const FieldState &by)
 subtract FieldState from FieldStateWeightedSum
 
FieldStateWeightedSum operator- (const FieldState &ax, const FieldStateWeightedSum &by)
 subtract FieldStateWeightedSum from FieldState
 
FieldState createFieldState (gretl::DataStore &dataStore, const smith::FEFieldPtr &s)
 initialize on the gretl::DataStore a FieldState with values from s
 
template<typename function_space >
FieldState createFieldState (gretl::DataStore &dataStore, function_space space, const std::string &name, const std::string &mesh_tag)
 initialize on the gretl::DataStore a FieldState from a FiniteElementState of given space, name and mesh.
 
ReactionState createReactionState (gretl::DataStore &dataStore, const smith::FEDualPtr &s)
 initialize on the gretl::DataStore a ReactionState with values from s
 
template<typename function_space >
ReactionState createReactionState (gretl::DataStore &dataStore, function_space space, const std::string &name, const std::string &mesh_tag)
 initialize on the gretl::DataStore a ReactionState from a FiniteElementDual of given space, name and mesh.
 
FieldState weighted_average (const FieldState &a, const FieldState &b, double weight)
 gretl-function to compute the weighted average a * weight + b * (1-weight)
 
mfem::ParFiniteElementSpace & space (FieldState field)
 Get the space from the primal field of a field states.
 
std::vector< const mfem::ParFiniteElementSpace * > spaces (const std::vector< FieldState > &states, const std::vector< FieldState > &params={})
 Get the spaces from the primal fields of a vector of field states.
 
std::vector< FiniteElementState * > getFieldPointers (std::vector< FieldState > &states, std::vector< FieldState > params={})
 Get a vector of FieldPtr or DualFieldPtr from a vector of FieldState.
 
std::vector< const FiniteElementState * > getConstFieldPointers (const std::vector< FieldState > &states, const std::vector< FieldState > &params={})
 Get a vector of ConstFieldPtr or ConstDualFieldPtr from a vector of FieldState.
 
FieldState applyZeroBoundaryConditions (const FieldState &s, const BoundaryConditionManager *bc_manager)
 uses the constrained dofs on the bc_manager to zero the corresponding dofs in FieldState s.
 
template<int spatial_dim, typename LumpedFieldSpace , typename DensitySpace , typename... parameter_space>
auto createSolidMassWeakForm (const std::string &physics_name, std::shared_ptr< smith::Mesh > &mesh, const FiniteElementState &lumped_field, const FiniteElementState &density)
 creates a lumped mass weak form
 
void applyBoundaryConditions (double time, const smith::BoundaryConditionManager *bc_manager, smith::FEFieldPtr &primal_field, const smith::FEFieldPtr &bc_field_ptr)
 apply boundary conditions
 
FieldState nonlinearSolve (const WeakForm *residual_eval, const FieldState &shape_disp, const std::vector< FieldState > &states, const std::vector< FieldState > &params, const std::vector< double > &state_update_weights, size_t primal_solve_state_index, size_t dirichlet_state_index, const TimeInfo &time_info, const DifferentiableSolver *solver, const BoundaryConditionManager *bc_manager, const FieldState *bc_field=nullptr)
 Solve a nonlinear system of equations as defined by the weak form. More...
 
FieldState solve (const WeakForm &residual_eval, const FieldState &shape_disp, const std::vector< FieldState > &states, const std::vector< FieldState > &params, const TimeInfo &time_info, const DifferentiableSolver &solver, const DirichletBoundaryConditions &bcs, size_t unknown_state_index=0)
 Solve a nonlinear system of equations as defined by the weak form, assuming that the field indexed by unknown_index is the unknown field. More...
 
std::vector< FieldStateblock_solve (const std::vector< WeakForm * > &residual_evals, const std::vector< std::vector< size_t >> block_indices, const FieldState &shape_disp, const std::vector< std::vector< FieldState >> &states, const std::vector< std::vector< FieldState >> &params, const TimeInfo &time_info, const DifferentiableBlockSolver *solver, const std::vector< const BoundaryConditionManager * > &bc_managers)
 Solve a block nonlinear system of equations as defined by the vector of weak form. More...
 
auto createParaviewWriter (const smith::Mesh &mesh, const std::vector< FieldState > &states, std::string output_name)
 Creates a ParaviewWriter from a mesh, vector of FieldState, and the name of the output paraview file. File will be in directory filename/filename.pvd.
 
auto createParaviewWriter (const mfem::ParMesh &mesh, const std::vector< const FiniteElementState * > &states, std::string output_name)
 Creates a ParaviewWriter from an mfem::ParMesh, vector of FiniteElementState pointers, and the name of the output paraview file. File will be in directory filename/filename.pvd.
 
auto evaluateWeakForm (const std::shared_ptr< WeakForm > &weak_form, const TimeInfo &time_info, FieldState shape_disp, const std::vector< FieldState > &field_states, FieldState field_for_residual_space)
 gretl-function implementation which evaluates the residual force (which is minus the mechanical force) given shape displacement, states and params. The field_for_residual_space Field is only used to set the appropriate size (mfem::ParFiniteElementSpace) for the residual field so it can be returned as a ReactionState
 
TimeInfo create_time_info (DoubleState t, DoubleState dt, size_t cycle)
 creates a time info struct from gretl::State<double> More...
 
std::string about ()
 Returns a string about the configuration of Smith. More...
 
std::string gitSHA ()
 Returns a string for the Git SHA when the driver was built. More...
 
void printRunInfo ()
 Outputs basic run information to the screen. More...
 
std::string version (bool add_SHA=true)
 Returns a string for the version of Smith. More...
 
std::string compiler ()
 Returns a string for the current compiler name and version. More...
 
std::string buildType ()
 Returns a string for the current CMake build type (e.g. Debug, Release) More...
 
std::pair< int, int > getMPIInfo (MPI_Comm comm=MPI_COMM_WORLD)
 Get MPI Info. More...
 
template<typename T , int dim, axom::MemorySpace space>
auto view (axom::Array< T, dim, space > &arr)
 convenience function for creating a view of an axom::Array type
 
void finalizer ()
 Destroy MPI, signal handling, logging, profiling, hypre, sundials, petsc, and slepc. Note this should not be called by or exposed to users.
 
template<typename T >
std::string typeString (T &var)
 Return string of given parameter's type. More...
 
template<typename T >
void writeToFile (std::vector< T > v, std::string filename)
 write an array of values out to file, in a space-separated format More...
 
void writeToFile (mfem::Vector v, std::string filename)
 write an array of doubles out to file, in a space-separated format More...
 
void writeToFile (mfem::SparseMatrix A, std::string filename)
 write a sparse matrix out to file More...
 
std::ostream & operator<< (std::ostream &out, DoF dof)
 stream output for DoF
 
template<typename T >
void writeToFile (axom::Array< T, 2, smith::detail::host_memory_space > arr, std::string filename)
 write a 2D array of values out to file, in a space-separated format More...
 
template<typename T >
void writeToFile (axom::Array< T, 3, smith::detail::host_memory_space > arr, std::string filename)
 write a 3D array of values out to file, in a mathematica-compatible format More...
 
template<typename T , typename T0 , typename T1 >
constexpr T & get (variant< T0, T1 > &v)
 Returns the variant member of specified type. More...
 
template<typename T , typename T0 , typename T1 >
constexpr const T & get (const variant< T0, T1 > &v)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename Visitor , typename Variant >
constexpr decltype(auto) visit (Visitor visitor, Variant &&v)
 Applies a functor to the active variant element. More...
 
template<typename T , typename T0 , typename T1 >
bool holds_alternative (const variant< T0, T1 > &v)
 Checks whether a variant's active member is of a certain type. More...
 
template<typename T , typename T0 , typename T1 >
T * get_if (variant< T0, T1 > *v)
 Returns the member of requested type if it's active, otherwise nullptr. More...
 
template<typename T , typename T0 , typename T1 >
const T * get_if (const variant< T0, T1 > *v)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
mfem::Mesh buildMeshFromFile (const std::string &mesh_file)
 Constructs an MFEM mesh from a file. More...
 
void squish (mfem::Mesh &mesh)
 a transformation from the unit disk/sphere (in L1 norm) to a unit disk/sphere (in L2 norm) More...
 
mfem::Mesh buildDiskMesh (int approx_number_of_elements)
 Constructs a 2D MFEM mesh of a unit disk, centered at the origin. More...
 
mfem::Mesh buildBallMesh (int approx_number_of_elements)
 Constructs a 3D MFEM mesh of a unit ball, centered at the origin. More...
 
mfem::Mesh buildRectangleMesh (int elements_in_x, int elements_in_y, double size_x=1., double size_y=1.)
 Constructs a 2D MFEM mesh of a rectangle. More...
 
mfem::Mesh buildCuboidMesh (int elements_in_x, int elements_in_y, int elements_in_z, double size_x=1., double size_y=1., double size_z=1.)
 Constructs a 3D MFEM mesh of a cuboid. More...
 
mfem::Mesh buildCylinderMesh (int radial_refinement, int elements_lengthwise, double radius, double height)
 Constructs a 3D MFEM mesh of a cylinder. More...
 
mfem::Mesh buildRing (int radial_refinement, double inner_radius, double outer_radius, double total_angle, int sectors)
 Constructs a 2D MFEM mesh of a ring.
 
mfem::Mesh buildRingMesh (int radial_refinement, double inner_radius, double outer_radius, double total_angle=M_PI, int sectors=8)
 Constructs a 2D MFEM mesh of a ring. More...
 
mfem::Mesh buildHollowCylinderMesh (int radial_refinement, int elements_lengthwise, double inner_radius, double outer_radius, double height, double total_angle=M_PI, int sectors=8)
 Constructs a 3D MFEM mesh of a hollow cylinder. More...
 
mfem::Mesh build_hollow_quarter_cylinder (std::size_t radial_divisions, std::size_t angular_divisions, std::size_t vertical_divisions, double inner_radius, double outer_radius, double height)
 Constructs an MFEM mesh of a hollow cylinder restricted to the first orthant. More...
 
double matrixNorm (const mfem::HypreParMatrix &K)
 Utility to compute the matrix norm.
 
void printTrustRegionInfo (double realObjective, double modelObjective, size_t cgIters, double trSize, bool willAccept)
 trust region printing utility function
 
std::unique_ptr< mfem::HypreParMatrix > buildMonolithicMatrix (const mfem::BlockOperator &block_operator)
 Function for building a monolithic parallel Hypre matrix from a block system of smaller Hypre matrices. More...
 
std::unique_ptr< mfem::NewtonSolver > buildNonlinearSolver (NonlinearSolverOptions nonlinear_opts, const LinearSolverOptions &linear_opts, mfem::Solver &preconditioner, MPI_Comm comm=MPI_COMM_WORLD)
 Build a nonlinear solver using the nonlinear option struct. More...
 
std::pair< std::unique_ptr< mfem::Solver >, std::unique_ptr< mfem::Solver > > buildLinearSolverAndPreconditioner (LinearSolverOptions linear_opts={}, MPI_Comm comm=MPI_COMM_WORLD)
 Build the linear solver and its associated preconditioner given a linear options struct. More...
 
std::unique_ptr< mfem::Solver > buildPreconditioner (LinearSolverOptions linear_opts,[[maybe_unused]] MPI_Comm comm=MPI_COMM_WORLD)
 Build a preconditioner from the available options. More...
 
auto differentiate_wrt (const mfem::Vector &v)
 this function is intended to only be used in combination with smith::Functional::operator(), as a way for the user to express that it should both evaluate and differentiate w.r.t. a specific argument (only 1 argument at a time) More...
 
template<int d>
std::vector< tensor< double, d > > gather (const mfem::Vector &coordinates, mfem::Array< int > ids)
 gather vertex coordinates for a list of vertices More...
 
void findDomainDofsOnNeighborRanks (const smith::fes_t *fes, mfem::Array< int > &local_dof_ids)
 Get local dofs that are part of a domain, but are owned by a neighboring MPI rank. More...
 
Domain EntireDomain (const mesh_t &mesh)
 constructs a domain from all the elements in a mesh
 
Domain EntireBoundary (const mesh_t &mesh)
 constructs a domain from all the boundary elements in a mesh
 
Domain EntireInteriorBoundary (const mesh_t &mesh)
 constructs a domain from all the interior boundary elements in a mesh
 
template<int d>
Domain domain_of_interior_boundaries (const mesh_t &mesh, std::function< bool(std::vector< tensor< double, d >>, int)> predicate)
 constructs a domain from some subset of the interior boundary elements in a mesh
 
void zip (std::vector< int2 > &ab, const std::vector< int > &a, const std::vector< int > &b)
 combine a pair of arrays of ints into a single array of int2, see also: unzip()
 
void unzip (const std::vector< int2 > &ab, std::vector< int > &a, std::vector< int > &b)
 split an array of int2 into a pair of arrays of ints, see also: zip()
 
template<typename T >
std::vector< T > set_operation (SET_OPERATION op, const std::vector< T > &a, const std::vector< T > &b)
 return a std::vector that is the result of applying (a op b)
 
Domain set_operation (SET_OPERATION op, const Domain &a, const Domain &b)
 return a Domain that is the result of applying (a op b)
 
Domain operator| (const Domain &a, const Domain &b)
 create a new domain that is the union of a and b
 
Domain operator& (const Domain &a, const Domain &b)
 create a new domain that is the intersection of a and b
 
Domain operator- (const Domain &a, const Domain &b)
 create a new domain that is the set difference of a and b
 
template<int dim>
auto by_attr (int value)
 convenience predicate for creating domains by attribute
 
template<int dim>
auto by_attr (std::set< int > values)
 convenience predicate for creating domains by a set of attributes
 
std::array< uint32_t, mfem::Geometry::NUM_GEOMETRIES > geometry_counts (const Domain &domain)
 count the number of elements of each geometry in a domain More...
 
template<int dim>
tensor< double, dim > average (std::vector< tensor< double, dim >> &positions)
 convenience function for computing the arithmetic mean of some list of vectors
 
template<typename T >
 dual (double, T) -> dual< T >
 class template argument deduction guide for type dual. More...
 
template<typename gradient_type >
constexpr SMITH_HOST_DEVICE auto operator+ (dual< gradient_type > a, double b)
 addition of a dual number and a non-dual number
 
template<typename gradient_type >
constexpr SMITH_HOST_DEVICE auto operator+ (double a, dual< gradient_type > b)
 addition of a dual number and a non-dual number
 
template<typename gradient_type_a , typename gradient_type_b >
constexpr SMITH_HOST_DEVICE auto operator+ (dual< gradient_type_a > a, dual< gradient_type_b > b)
 addition of two dual numbers
 
template<typename gradient_type >
constexpr auto operator- (dual< gradient_type > x)
 unary negation of a dual number
 
template<typename gradient_type >
constexpr SMITH_HOST_DEVICE auto operator- (dual< gradient_type > a, double b)
 subtraction of a non-dual number from a dual number
 
template<typename gradient_type >
constexpr SMITH_HOST_DEVICE auto operator- (double a, dual< gradient_type > b)
 subtraction of a dual number from a non-dual number
 
template<typename gradient_type_a , typename gradient_type_b >
constexpr SMITH_HOST_DEVICE auto operator- (dual< gradient_type_a > a, dual< gradient_type_b > b)
 subtraction of two dual numbers
 
template<typename gradient_type >
constexpr SMITH_HOST_DEVICE auto operator* (const dual< gradient_type > &a, double b)
 multiplication of a dual number and a non-dual number
 
template<typename gradient_type >
constexpr SMITH_HOST_DEVICE auto operator* (double a, const dual< gradient_type > &b)
 multiplication of a dual number and a non-dual number
 
template<typename gradient_type_a , typename gradient_type_b >
constexpr SMITH_HOST_DEVICE auto operator* (dual< gradient_type_a > a, dual< gradient_type_b > b)
 multiplication of two dual numbers
 
template<typename gradient_type >
constexpr SMITH_HOST_DEVICE auto operator/ (const dual< gradient_type > &a, double b)
 division of a dual number by a non-dual number
 
template<typename gradient_type >
constexpr SMITH_HOST_DEVICE auto operator/ (double a, const dual< gradient_type > &b)
 division of a non-dual number by a dual number
 
template<typename gradient_type_a , typename gradient_type_b >
constexpr SMITH_HOST_DEVICE auto operator/ (dual< gradient_type_a > a, dual< gradient_type_b > b)
 division of two dual numbers
 
 binary_comparator_overload (<)
 implement operator< for dual numbers More...
 
 binary_comparator_overload (<=)
 implement operator<= for dual numbers
 
 binary_comparator_overload (>=)
 implement operator>= for dual numbers
 
template<typename gradient_type >
constexpr SMITH_HOST_DEVICE auto & operator+= (dual< gradient_type > &a, const dual< gradient_type > &b)
 compound assignment (+) for dual numbers
 
template<typename gradient_type >
constexpr SMITH_HOST_DEVICE auto & operator-= (dual< gradient_type > &a, const dual< gradient_type > &b)
 compound assignment (-) for dual numbers
 
template<typename gradient_type >
constexpr SMITH_HOST_DEVICE auto & operator+= (dual< gradient_type > &a, double b)
 compound assignment (+) for dual numbers with double righthand side
 
template<typename gradient_type >
constexpr SMITH_HOST_DEVICE auto & operator-= (dual< gradient_type > &a, double b)
 compound assignment (-) for dual numbers with double righthand side
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto abs (dual< gradient_type > x)
 Implementation of absolute value function for dual numbers. More...
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto max (dual< gradient_type > a, double b)
 Implementation of max for dual numbers. More...
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto max (double a, dual< gradient_type > b)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto max (dual< gradient_type > a, dual< gradient_type > b)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto min (dual< gradient_type > a, double b)
 Implementation of min for dual numbers. More...
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto min (double a, dual< gradient_type > b)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto min (dual< gradient_type > a, dual< gradient_type > b)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename S , typename T >
constexpr SMITH_HOST_DEVICE auto inner (const dual< S > &A, const dual< T > &B)
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto inner (double A, const dual< T > &B)
 
template<typename S >
constexpr SMITH_HOST_DEVICE auto inner (const dual< S > &A, double B)
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto sqrt (dual< gradient_type > x)
 implementation of square root for dual numbers
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto cos (dual< gradient_type > a)
 implementation of cosine for dual numbers
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto sin (dual< gradient_type > a)
 implementation of sine for dual numbers
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto atan (dual< gradient_type > a)
 implementation of atan for dual numbers
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto atan2 (dual< gradient_type > y, dual< gradient_type > x)
 implementation of atan2 for dual numbers
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto atan2 (double y, dual< gradient_type > x)
 implementation of atan2 for dual numbers
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto atan2 (dual< gradient_type > y, double x)
 implementation of atan2 for dual numbers
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto asin (dual< gradient_type > a)
 implementation of asin for dual numbers
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto acos (dual< gradient_type > a)
 implementation of acos for dual numbers
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto exp (dual< gradient_type > a)
 implementation of exponential function for dual numbers
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto log (dual< gradient_type > a)
 implementation of the natural logarithm function for dual numbers
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto log1p (dual< gradient_type > a)
 implementation of the natural logarithm of one plus the argument function for dual numbers
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto pow (dual< gradient_type > a, dual< gradient_type > b)
 implementation of a (dual) raised to the b (dual) power
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto pow (double a, dual< gradient_type > b)
 implementation of a (non-dual) raised to the b (dual) power
 
template<typename gradient_type >
SMITH_HOST_DEVICE auto pow (dual< gradient_type > a, double b)
 implementation of a (dual) raised to the b (non-dual) power
 
template<typename T , int... n>
auto & operator<< (std::ostream &out, dual< T > A)
 overload of operator<< for dual to work with std::cout and other std::ostreams
 
constexpr SMITH_HOST_DEVICE auto make_dual (double x)
 promote a value to a dual number of the appropriate type
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto get_value (const T &arg)
 return the "value" part from a given type. For non-dual types, this is just the identity function
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto get_value (dual< T > arg)
 return the "value" part from a dual number type
 
template<typename gradient_type >
constexpr SMITH_HOST_DEVICE auto get_gradient (dual< gradient_type > arg)
 return the "gradient" part from a dual number type
 
template<mfem::Geometry::Type g>
constexpr SMITH_HOST_DEVICE int elements_per_block (int q)
 this function returns information about how many elements should be processed by a single thread block in CUDA (note: the optimal values are hardware and problem specific, but these values are still significantly faster than naively allocating only 1 element / block) More...
 
template<Family f, typename T , int q, int dim>
SMITH_HOST_DEVICE void parent_to_physical (tensor< T, q > &qf_input, const tensor< double, dim, dim, q > &jacobians)
 transform information in the parent space (i.e. values and derivatives w.r.t {xi, eta, zeta}) into the physical space (i.e. values and derivatives w.r.t. {x, y, z}) More...
 
template<Family f, typename T , int q, int dim>
SMITH_HOST_DEVICE void physical_to_parent (tensor< T, q > &qf_output, const tensor< double, dim, dim, q > &jacobians)
 transform information in the physical space (i.e. sources and fluxes w.r.t {x, y, z}) back to the parent space (i.e. values and derivatives w.r.t. {xi, eta, zeta}). Note: this also multiplies by the outputs by the determinant of the quadrature point Jacobian. More...
 
template<typename... T>
constexpr uint32_t index_of_differentiation ()
 given a list of types, this function returns the index that corresponds to the type dual_vector. More...
 
void check_for_missing_nodal_gridfunc (const mfem::Mesh &mesh)
 function for verifying that the mesh has been fully initialized
 
void check_for_unsupported_elements (const mfem::Mesh &mesh)
 function for verifying that there are no unsupported element types in the mesh
 
template<typename function_space >
std::pair< std::unique_ptr< mfem::ParFiniteElementSpace >, std::unique_ptr< mfem::FiniteElementCollection > > generateParFiniteElementSpace (mfem::ParMesh *mesh)
 create an mfem::ParFiniteElementSpace from one of Smith's tag types: H1, Hcurl, L2 More...
 
void updateFaceNbrData (const mfem::ParFiniteElementSpace *const_trial_space, mfem::ParGridFunction &trial_pgf, mfem::Vector &trial_tdof_vals)
 helper function to locally cast away const on FE space so we can update face neighbor data with ExchangeFaceNbrData. This is ok because : 1) the original trial FE space is declared without const; 2) we constrained the non-constness locally; 3) the locally owned data associated with the trial function space is NOT altered and ONLY ghost data is updated.
 
void appendFaceNbrData (const mfem::ParFiniteElementSpace *trial_space, const mfem::ParGridFunction &trial_pgf, const int LSize, mfem::Vector &input_L)
 helper functional to reorder the ordering of FaceNbrData for L2 space to byVDIM and append this vector to the end of local dof vector, which will result in a vector in form [ — L — | — FND — ]
 
void rearrangeFaceNbrDofGlobalIndex (const mfem::ParFiniteElementSpace *trial_space, mfem::Array< HYPRE_BigInt > &face_nbr_glob_vdof_map)
 helper functional to reorder the face_nbr_glob_dof_map for L2 space to byVDIM
 
template<int Q, mfem::Geometry::Type geom, typename function_space >
void compute_geometric_factors (mfem::Vector &positions_q, mfem::Vector &jacobians_q, const mfem::Vector &positions_e, const std::vector< int > &elements)
 a kernel to compute the positions and jacobians at each quadrature point (mfem calls this "geometric factors") More...
 
constexpr int num_quadrature_points (mfem::Geometry::Type g, int Q)
 return the number of quadrature points in a Gauss-Legendre rule with parameter "Q" More...
 
constexpr int dimension_of (mfem::Geometry::Type g)
 Returns the dimension of an element geometry. More...
 
std::array< uint32_t, mfem::Geometry::NUM_GEOMETRIES > geometry_counts (const mfem::Mesh &mesh)
 count the number of elements of each geometry in a mesh More...
 
std::array< uint32_t, mfem::Geometry::NUM_GEOMETRIES > boundary_geometry_counts (const mfem::Mesh &mesh)
 count the number of boundary elements of each geometry in a mesh More...
 
template<mfem::Geometry::Type geom, int Q, typename test , typename... trials, typename lambda_type , typename qpt_data_type >
void generate_kernels (FunctionSignature< test(trials...)> s, Integral &integral, const lambda_type &qf, std::shared_ptr< QuadratureData< qpt_data_type > > qdata)
 function to generate kernels held by an Integral object of type "Domain", with a specific element type More...
 
template<typename s , int Q, int dim, typename lambda_type , typename qpt_data_type >
Integral MakeDomainIntegral (const Domain &domain, const lambda_type &qf, std::shared_ptr< QuadratureData< qpt_data_type > > qdata, std::vector< uint32_t > argument_indices)
 function to generate kernels held by an Integral object of type "Domain", for all element types More...
 
template<mfem::Geometry::Type geom, int Q, typename test , typename... trials, typename lambda_type >
void generate_bdr_kernels (FunctionSignature< test(trials...)> s, Integral &integral, const lambda_type &qf)
 function to generate kernels held by an Integral object of type "BoundaryDomain", with a specific element type More...
 
template<typename s , int Q, int dim, typename lambda_type >
Integral MakeBoundaryIntegral (const Domain &domain, const lambda_type &qf, std::vector< uint32_t > argument_indices)
 function to generate kernels held by an Integral object of type "Boundary", for all element types More...
 
template<mfem::Geometry::Type geom, int Q, typename test , typename... trials, typename lambda_type >
void generate_interior_face_kernels (FunctionSignature< test(trials...)> s, Integral &integral, const lambda_type &qf)
 function to generate kernels held by an Integral object of type "InteriorFaceDomain", with a specific element type More...
 
template<typename s , int Q, int dim, typename lambda_type >
Integral MakeInteriorFaceIntegral (const Domain &domain, const lambda_type &qf, std::vector< uint32_t > argument_indices)
 function to generate kernels held by an Integral object of type "Boundary", for all element types More...
 
template<int m>
constexpr SMITH_HOST_DEVICE isotropic_tensor< double, m, m > Identity ()
 return the identity matrix of the specified size More...
 
template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto operator* (S scale, isotropic_tensor< T, m, m > I)
 scalar multiplication More...
 
template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto operator* (isotropic_tensor< T, m, m > I, S scale)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto operator+ (isotropic_tensor< S, m, m > I1, isotropic_tensor< T, m, m > I2)
 addition of isotropic tensors More...
 
template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto operator- (isotropic_tensor< S, m, m > I1, isotropic_tensor< T, m, m > I2)
 difference of isotropic tensors More...
 
template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto operator+ (const isotropic_tensor< S, m, m > &I, const tensor< T, m, m > &A)
 sum of isotropic and (nonisotropic) tensor More...
 
template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto operator+ (const tensor< S, m, m > &A, const isotropic_tensor< T, m, m > &I)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto operator- (const isotropic_tensor< S, m, m > &I, const tensor< T, m, m > &A)
 difference of isotropic and (nonisotropic) tensor More...
 
template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto operator- (const tensor< S, m, m > &A, const isotropic_tensor< T, m, m > &I)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename S , typename T , int m, int... n>
constexpr SMITH_HOST_DEVICE auto dot (const isotropic_tensor< S, m, m > &I, const tensor< T, m, n... > &A)
 dot product between an isotropic and (nonisotropic) tensor More...
 
template<typename S , typename T , int m, int... n>
constexpr SMITH_HOST_DEVICE auto dot (const tensor< S, n... > &A, isotropic_tensor< T, m, m > I)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto double_dot (const isotropic_tensor< S, m, m > &I, const tensor< T, m, m > &A)
 double-dot product between an isotropic and (nonisotropic) tensor More...
 
template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto sym (const isotropic_tensor< T, m, m > &I)
 return the symmetric part of an isotropic tensor More...
 
template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto antisym (const isotropic_tensor< T, m, m > &)
 return the antisymmetric part of an isotropic tensor More...
 
template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto tr (const isotropic_tensor< T, m, m > &I)
 calculate the trace of an isotropic tensor More...
 
template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto transpose (const isotropic_tensor< T, m, m > &I)
 return the transpose of an isotropic tensor More...
 
template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto inv (const isotropic_tensor< T, m, m > &I)
 return the inverse of an isotropic tensor More...
 
template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto det (const isotropic_tensor< T, m, m > &I)
 compute the determinant of an isotropic tensor More...
 
template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto norm (const isotropic_tensor< T, m, m > &I)
 compute the Frobenius norm (sqrt(tr(dot(transpose(I), I)))) of an isotropic tensor More...
 
template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto squared_norm (const isotropic_tensor< T, m, m > &I)
 compute the squared Frobenius norm (tr(dot(transpose(I), I))) of an isotropic tensor More...
 
template<int m>
constexpr SMITH_HOST_DEVICE auto SymmetricIdentity ()
 a helper function for creating the rank-4 isotropic tensor defined by: d(sym(A)_{ij}) / d(A_{kl}) More...
 
template<int m>
constexpr SMITH_HOST_DEVICE auto AntisymmetricIdentity ()
 a helper function for creating the rank-4 isotropic tensor defined by: d(antisym(A)_{ij}) / d(A_{kl}) More...
 
template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto operator* (S scale, isotropic_tensor< T, m, m, m, m > I)
 scalar multiplication More...
 
template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto operator* (isotropic_tensor< S, m, m, m, m > I, T scale)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto operator+ (isotropic_tensor< S, m, m, m, m > I1, isotropic_tensor< T, m, m, m, m > I2)
 addition of isotropic tensors More...
 
template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto operator- (isotropic_tensor< S, m, m, m, m > I1, isotropic_tensor< T, m, m, m, m > I2)
 difference of isotropic tensors More...
 
template<typename S , typename T , int m, int... n>
constexpr SMITH_HOST_DEVICE auto double_dot (const isotropic_tensor< S, m, m, m, m > &I, const tensor< T, m, m, n... > &A)
 double-dot product between an isotropic and (nonisotropic) tensor More...
 
template<int n, typename T = double>
constexpr SMITH_HOST_DEVICE tensor< T, n > GaussLobattoNodes (T a=T(0), T b=T(1))
 The positions (in 1D space) of Gauss-Lobatto points. More...
 
template<int n, mfem::Geometry::Type geom>
constexpr SMITH_HOST_DEVICE auto GaussLegendreNodes ()
 The positions of Gauss-Legendre points for different geometries. More...
 
template<int n, mfem::Geometry::Type geom>
constexpr SMITH_HOST_DEVICE auto GaussLegendreWeights ()
 The weights associated with each Gauss-Legendre point. More...
 
constexpr SMITH_HOST_DEVICE int factorial (int n)
 compute n! More...
 
template<int n, typename T >
constexpr SMITH_HOST_DEVICE tensor< T, n > powers (T x)
 compute the first n powers of x More...
 
template<int n, typename S >
constexpr SMITH_HOST_DEVICE tensor< S, n > ChebyshevT (S x)
 Chebyshev polynomials of the first kind Satisfying: T_n(cos(t)) == cos(n*t) More...
 
template<int n, typename T >
SMITH_HOST_DEVICE tensor< T, n > ChebyshevU (T x)
 Chebyshev polynomials of the second kind Satisfying: sin(t) U_n(cos(t)) == sin((n+1)*t) More...
 
template<int n, typename T >
SMITH_HOST_DEVICE tensor< T, n > Legendre (T x)
 Legendre Polynomials, orthogonal on the domain (-1, 1) with unit weight function. More...
 
template<int n, typename T >
SMITH_HOST_DEVICE tensor< T, n > Bernstein (T s)
 Bernstein Polynomials on the domain [0, 1]. More...
 
template<int n, typename T >
constexpr SMITH_HOST_DEVICE tensor< T, n > GaussLobattoInterpolation ([[maybe_unused]] T x)
 Lagrange Interpolating polynomials for nodes at Gauss-Lobatto points on the interval [0, 1]. More...
 
template<int n, typename T >
constexpr SMITH_HOST_DEVICE tensor< T, n > GaussLobattoInterpolationDerivative ([[maybe_unused]] T x)
 Derivatives of the Lagrange Interpolating polynomials for nodes at Gauss-Lobatto points on the interval [0, 1]. More...
 
template<int n, typename T >
constexpr SMITH_HOST_DEVICE tensor< T, n > GaussLegendreInterpolation ([[maybe_unused]] T x)
 Lagrange Interpolating polynomials for nodes at Gauss-Legendre points on the interval [0, 1]. More...
 
template<int n, typename T >
constexpr SMITH_HOST_DEVICE tensor< T, n > GaussLegendreInterpolationDerivative ([[maybe_unused]] T x)
 Derivatives of the Lagrange Interpolating polynomials for nodes at Gauss-Legendre points on the interval [-1, 1]. More...
 
template<mfem::Geometry::Type g, int Q>
constexpr SMITH_HOST_DEVICE auto GaussQuadratureRule ()
 Returns the Gauss-Legendre quadrature rule for an element and order. More...
 
template<typename T , int n1>
 tensor (const T(&data)[n1]) -> tensor< T, n1 >
 class template argument deduction guide for type tensor. More...
 
template<typename T , int n1, int n2>
 tensor (const T(&data)[n1][n2]) -> tensor< T, n1, n2 >
 class template argument deduction guide for type tensor. More...
 
constexpr SMITH_HOST_DEVICE auto operator+ (zero, zero)
 the sum of two zeros is zero
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto operator+ (zero, T other)
 the sum of zero with something non-zero just returns the other value
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto operator+ (T other, zero)
 the sum of zero with something non-zero just returns the other value
 
constexpr SMITH_HOST_DEVICE auto operator- (zero)
 the unary negation of zero is zero
 
constexpr SMITH_HOST_DEVICE auto operator- (zero, zero)
 the difference of two zeros is zero
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto operator- (zero, T other)
 the difference of zero with something else is the unary negation of the other thing
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto operator- (T other, zero)
 the difference of something else with zero is the other thing itself
 
constexpr SMITH_HOST_DEVICE auto operator* (zero, zero)
 the product of two zeros is zero
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto operator* (zero, T)
 the product zero with something else is also zero
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto operator* (T, zero)
 the product zero with something else is also zero
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto operator/ (zero, T)
 zero divided by something is zero
 
template<typename T >
void operator/ (T, zero)
 Get a human-readable compiler error when you try to divide by zero.
 
constexpr SMITH_HOST_DEVICE auto operator+= (zero, zero)
 zero plus zero is zero
 
constexpr SMITH_HOST_DEVICE auto operator-= (zero, zero)
 zero minus zero is zero
 
template<int i>
SMITH_HOST_DEVICE zeroget (zero &x)
 let zero be accessed like a tuple
 
template<int i>
SMITH_HOST_DEVICE zero get (const zero &)
 let zero be accessed like a tuple
 
template<typename T >
constexpr SMITH_HOST_DEVICE zero dot (const T &, zero)
 the dot product of anything with zero is zero
 
template<typename T >
constexpr SMITH_HOST_DEVICE zero dot (zero, const T &)
 the dot product of anything with zero is zero
 
template<typename T , int m, int... n>
SMITH_HOST_DEVICE consteval int first_dim (const tensor< T, m, n... > &)
 return the size of the leftmost tensor dimension
 
template<typename T , int... n>
constexpr SMITH_HOST_DEVICE auto tensor_with_shape (std::integer_sequence< int, n... >)
 Creates a tensor given the dimensions in a std::integer_sequence. More...
 
template<typename lambda_type >
SMITH_SUPPRESS_NVCC_HOSTDEVICE_WARNING constexpr SMITH_HOST_DEVICE auto make_tensor (lambda_type f)
 Creates a tensor of requested dimension by subsequent calls to a functor Can be thought of as analogous to std::transform in that the set of possible indices for dimensions n are transformed into the values of the tensor by f. More...
 
template<int n1, typename lambda_type >
SMITH_SUPPRESS_NVCC_HOSTDEVICE_WARNING constexpr SMITH_HOST_DEVICE auto make_tensor (lambda_type f)
 Creates a tensor of requested dimension by subsequent calls to a functor. More...
 
template<int n1, int n2, typename lambda_type >
SMITH_SUPPRESS_NVCC_HOSTDEVICE_WARNING constexpr SMITH_HOST_DEVICE auto make_tensor (lambda_type f)
 Creates a tensor of requested dimension by subsequent calls to a functor. More...
 
template<int n1, int n2, int n3, typename lambda_type >
SMITH_SUPPRESS_NVCC_HOSTDEVICE_WARNING constexpr SMITH_HOST_DEVICE auto make_tensor (lambda_type f)
 Creates a tensor of requested dimension by subsequent calls to a functor. More...
 
template<int n1, int n2, int n3, int n4, typename lambda_type >
SMITH_SUPPRESS_NVCC_HOSTDEVICE_WARNING constexpr SMITH_HOST_DEVICE auto make_tensor (lambda_type f)
 Creates a tensor of requested dimension by subsequent calls to a functor. More...
 
template<typename S , typename T , int m, int... n>
constexpr SMITH_HOST_DEVICE auto operator+ (const tensor< S, m, n... > &A, const tensor< T, m, n... > &B)
 return the sum of two tensors More...
 
template<typename T , int m, int... n>
constexpr SMITH_HOST_DEVICE auto operator- (const tensor< T, m, n... > &A)
 return the unary negation of a tensor More...
 
template<typename S , typename T , int m, int... n>
constexpr SMITH_HOST_DEVICE auto operator- (const tensor< S, m, n... > &A, const tensor< T, m, n... > &B)
 return the difference of two tensors More...
 
template<typename S , typename T , int m, int... n>
constexpr SMITH_HOST_DEVICE auto & operator+= (tensor< S, m, n... > &A, const tensor< T, m, n... > &B)
 compound assignment (+) on tensors More...
 
template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto & operator+= (tensor< T, n, 1 > &A, const tensor< T, n > &B)
 compound assignment (+) on tensors More...
 
template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto & operator+= (tensor< T, 1, n > &A, const tensor< T, n > &B)
 compound assignment (+) on tensors More...
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto & operator+= (tensor< T, 1 > &A, const T &B)
 compound assignment (+) on tensors More...
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto & operator+= (tensor< T, 1, 1 > &A, const T &B)
 compound assignment (+) on tensors More...
 
template<typename T , int... n>
constexpr SMITH_HOST_DEVICE auto & operator+= (tensor< T, n... > &A, zero)
 compound assignment (+) between a tensor and zero (no-op) More...
 
template<typename S , typename T , int m, int... n>
constexpr SMITH_HOST_DEVICE auto & operator-= (tensor< S, m, n... > &A, const tensor< T, m, n... > &B)
 compound assignment (-) on tensors More...
 
template<typename T , int... n>
constexpr SMITH_HOST_DEVICE auto & operator-= (tensor< T, n... > &A, zero)
 compound assignment (-) between a tensor and zero (no-op) More...
 
template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto outer (double A, tensor< T, n > B)
 
template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto outer (const tensor< T, m > &A, double B)
 
template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto outer (zero, const tensor< T, n > &)
 
template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto outer (const tensor< T, n > &, zero)
 
template<typename S , typename T , int m, int n>
constexpr SMITH_HOST_DEVICE auto outer (const tensor< S, m > &A, const tensor< T, n > &B)
 
template<typename S , typename T , int m, int n>
constexpr SMITH_HOST_DEVICE auto inner (const tensor< S, m, n > &A, const tensor< T, m, n > &B)
 this function contracts over all indices of the two tensor arguments More...
 
template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto inner (const tensor< S, m > &A, const tensor< T, m > &B)
 
constexpr SMITH_HOST_DEVICE auto inner (double A, double B)
 
template<typename S , int m, int n>
constexpr SMITH_HOST_DEVICE auto inner (const tensor< S, m, n > &, zero)
 this function contracts over all indices of the two tensor arguments More...
 
template<typename S , int m>
constexpr SMITH_HOST_DEVICE auto inner (const tensor< S, m > &, zero)
 
constexpr SMITH_HOST_DEVICE auto inner (double, zero)
 
template<typename T , int m, int n>
constexpr SMITH_HOST_DEVICE auto inner (zero, const tensor< T, m, n > &)
 this function contracts over all indices of the two tensor arguments More...
 
template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto inner (zero, const tensor< T, m > &)
 
constexpr SMITH_HOST_DEVICE auto inner (zero, double)
 
template<typename S , typename T , int m, int n, int p>
constexpr SMITH_HOST_DEVICE auto dot (const tensor< S, m, n > &A, const tensor< T, n, p > &B)
 this function contracts over the "middle" index of the two tensor arguments More...
 
template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto dot (const tensor< T, m > &A, double B)
 
template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto dot (double B, const tensor< T, m > &A)
 
template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto dot (const tensor< S, m > &A, const tensor< T, m > &B)
 
template<typename S , typename T , int m, int n>
constexpr SMITH_HOST_DEVICE auto dot (const tensor< S, m > &A, const tensor< T, m, n > &B)
 
template<typename S , typename T , int m, int n, int p>
constexpr SMITH_HOST_DEVICE auto dot (const tensor< S, m > &A, const tensor< T, m, n, p > &B)
 
template<typename S , typename T , int m, int n, int p, int q>
constexpr SMITH_HOST_DEVICE auto dot (const tensor< S, m > &A, const tensor< T, m, n, p, q > &B)
 
template<typename S , typename T , int m, int n>
constexpr SMITH_HOST_DEVICE auto dot (const tensor< S, m, n > &A, const tensor< T, n > &B)
 
template<typename S , typename T , int m, int n, int p, int q, int r>
constexpr SMITH_HOST_DEVICE auto dot (const tensor< S, m, n > &A, const tensor< T, n, p, q, r > &B)
 
template<typename S , typename T , int m, int n, int p, int q>
constexpr SMITH_HOST_DEVICE auto dot (const tensor< S, m, n > &A, const tensor< T, n, p, q > &B)
 
template<typename S , typename T , int m, int n, int p>
constexpr SMITH_HOST_DEVICE auto dot (const tensor< S, m, n, p > &A, const tensor< T, p > &B)
 
template<typename S , typename T , typename U , int m, int n>
constexpr SMITH_HOST_DEVICE auto dot (const tensor< S, m > &u, const tensor< T, m, n > &A, const tensor< U, n > &v)
 
template<typename S , typename T , int m, int n, int p, int q>
constexpr SMITH_HOST_DEVICE auto dot (const tensor< S, m, n, p, q > &A, const tensor< T, q > &B)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T >
SMITH_HOST_DEVICE auto cross (const tensor< T, 3, 2 > &A)
 compute the cross product of the columns of A: A(:,1) x A(:,2)
 
template<typename T >
SMITH_HOST_DEVICE auto cross (const tensor< T, 2, 1 > &v)
 return the in-plane components of the cross product of {v[0], v[1], 0} x {0, 0, 1}
 
template<typename T >
SMITH_HOST_DEVICE auto cross (const tensor< T, 2 > &v)
 return the in-plane components of the cross product of {v[0], v[1], 0} x {0, 0, 1}
 
template<typename S , typename T >
SMITH_HOST_DEVICE auto cross (const tensor< S, 3 > &u, const tensor< T, 3 > &v)
 compute the (right handed) cross product of two 3-vectors
 
template<typename S , typename T , int m, int n, int p, int q>
constexpr SMITH_HOST_DEVICE auto double_dot (const tensor< S, m, n, p, q > &A, const tensor< T, p, q > &B)
 double dot product, contracting over the two "middle" indices More...
 
template<typename S , typename T , int m, int n, int p>
constexpr SMITH_HOST_DEVICE auto double_dot (const tensor< S, m, n, p > &A, const tensor< T, n, p > &B)
 
template<typename S , typename T , int m, int n>
constexpr auto double_dot (const tensor< S, m, n > &A, const tensor< T, m, n > &B)
 
template<typename S , typename T , int... m, int... n>
constexpr SMITH_HOST_DEVICE auto operator* (const tensor< S, m... > &A, const tensor< T, n... > &B)
 this is a shorthand for dot(A, B)
 
template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto squared_norm (const tensor< T, m > &A)
 Returns the squared Frobenius norm of the tensor. More...
 
template<typename T , int m, int n>
constexpr SMITH_HOST_DEVICE auto squared_norm (const tensor< T, m, n > &A)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T , int... n>
constexpr SMITH_HOST_DEVICE auto squared_norm (const tensor< T, n... > &A)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T , int... n>
SMITH_HOST_DEVICE auto norm (const tensor< T, n... > &A)
 Returns the Frobenius norm of the tensor. More...
 
constexpr SMITH_HOST_DEVICE auto norm (zero)
 overload of Frobenius norm for zero type
 
template<typename T , int... n>
SMITH_HOST_DEVICE auto normalize (const tensor< T, n... > &A)
 Normalizes the tensor Each element is divided by the Frobenius norm of the tensor,. More...
 
template<typename T >
SMITH_HOST_DEVICE tensor< T, 3, 3 > to_3x3 (const tensor< T, 2, 2 > &A)
 promotes a 2x2 matrix to a 3x3 matrix, by populating the upper left block, leaving zeroes in the third row / column More...
 
template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto tr (const tensor< T, n, n > &A)
 Returns the trace of a square matrix. More...
 
template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto sym (const tensor< T, n, n > &A)
 Returns the symmetric part of a square matrix. More...
 
template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto antisym (const tensor< T, n, n > &A)
 Returns the antisymmetric part of a square matrix. More...
 
template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto dev (const tensor< T, n, n > &A)
 Calculates the deviator of a matrix (rank-2 tensor) More...
 
template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto diagonal_matrix (const tensor< T, n, n > &A)
 Returns a square matrix (rank-2 tensor) containing the diagonal entries of the input square matrix with zeros in the off-diagonal positions. More...
 
template<typename T , int n>
constexpr SMITH_HOST_DEVICE tensor< T, n, n > diag (const tensor< T, n > &d)
 Returns a square diagonal matrix by specifying the diagonal entries. More...
 
template<typename T , int n>
constexpr SMITH_HOST_DEVICE tensor< T, n > diag (const tensor< T, n, n > &D)
 Returns an array containing the diagonal entries of a square matrix. More...
 
template<int dim>
constexpr SMITH_HOST_DEVICE tensor< double, dim, dim > DenseIdentity ()
 Obtains the identity matrix of the specified dimension. More...
 
template<typename T , int m, int n>
constexpr SMITH_HOST_DEVICE auto transpose (const tensor< T, m, n > &A)
 Returns the transpose of the matrix. More...
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto I2 (const tensor< T, 3, 3 > &A)
 Returns the second invariant of a 3x3 matrix. More...
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto det (const tensor< T, 2, 2 > &A)
 Returns the determinant of a matrix. More...
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto det (const tensor< T, 3, 3 > &A)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto detApIm1 (const tensor< T, 2, 2 > &A)
 computes det(A + I) - 1, where precision is not lost when the entries A_{ij} << 1 More...
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto detApIm1 (const tensor< T, 3, 3 > &A)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T , int dim>
auto matrix_sqrt (const tensor< T, dim, dim > &A)
 compute the matrix square root of a square, real-valued, symmetric matrix i.e. given A, find B such that A = dot(B, B) More...
 
template<int i1, int i2, typename S , int m, int... n, typename T , int p, int q>
SMITH_HOST_DEVICE auto contract (const tensor< S, m, n... > &A, const tensor< T, p, q > &B)
 a convenience function that computes a dot product between two tensor, but that allows the user to specify which indices should be summed over. For example: More...
 
template<int i1, int i2, typename T >
SMITH_HOST_DEVICE auto contract (const zero &, const T &)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T , int... n>
double relative_error (tensor< T, n... > A, tensor< T, n... > B)
 computes the relative error (in the frobenius norm) between two tensors of the same shape More...
 
template<int n>
SMITH_HOST_DEVICE bool is_symmetric (tensor< double, n, n > A, double tolerance=1.0e-8)
 Return whether a square rank 2 tensor is symmetric. More...
 
SMITH_HOST_DEVICE bool is_symmetric_and_positive_definite (tensor< double, 2, 2 > A)
 Return whether a matrix is symmetric and positive definite This check uses Sylvester's criterion, checking that each upper left subtensor has a determinant greater than zero. More...
 
SMITH_HOST_DEVICE bool is_symmetric_and_positive_definite (tensor< double, 3, 3 > A)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T , int n, int... m>
constexpr SMITH_HOST_DEVICE auto solve_lower_triangular (const tensor< T, n, n > &L, const tensor< T, n, m... > &b, const tensor< int, n > &P)
 Solves a lower triangular system Ly = b. More...
 
template<typename T , int n, int... m>
constexpr SMITH_HOST_DEVICE auto solve_lower_triangular (const tensor< T, n, n > &L, const tensor< T, n, m... > &b)
 
template<typename T , int n, int... m>
constexpr SMITH_HOST_DEVICE auto solve_upper_triangular (const tensor< T, n, n > &U, const tensor< T, n, m... > &y)
 Solves an upper triangular system Ux = y. More...
 
template<typename S , typename T , int n, int... m>
constexpr SMITH_HOST_DEVICE auto linear_solve (const LuFactorization< S, n > &lu_factors, const tensor< T, n, m... > &b)
 
template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto linear_solve (const LuFactorization< T, n > &, const zero)
 
constexpr SMITH_HOST_DEVICE tensor< double, 2, 2 > inv (const tensor< double, 2, 2 > &A)
 Inverts a matrix. More...
 
constexpr SMITH_HOST_DEVICE tensor< double, 3, 3 > inv (const tensor< double, 3, 3 > &A)
 
template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto inv (const tensor< T, n, n > &A)
 
template<typename T , int m, int... n>
auto & operator<< (std::ostream &out, const tensor< T, m, n... > &A)
 recursively serialize the entries in a tensor to an ostream. Output format uses braces and comma separators to mimic C syntax for multidimensional array initialization. More...
 
auto & operator<< (std::ostream &out, zero)
 Write a zero out to an output stream. More...
 
SMITH_HOST_DEVICE void print (double value)
 print a double using printf, so that it is suitable for use inside cuda kernels. (used in final recursion of printf(tensor<...>)) More...
 
template<int m, int... n>
SMITH_HOST_DEVICE void print (const tensor< double, m, n... > &A)
 print a tensor using printf, so that it is suitable for use inside cuda kernels. More...
 
template<int n>
constexpr SMITH_HOST_DEVICE auto chop (const tensor< double, n > &A)
 replace all entries in a tensor satisfying |x| < 1.0e-10 by literal zero More...
 
template<int m, int n>
constexpr SMITH_HOST_DEVICE auto chop (const tensor< double, m, n > &A)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
SMITH_HOST_DEVICE auto get_gradient (double)
 Retrieves the gradient component of a double (which is nothing) More...
 
template<int... n>
constexpr SMITH_HOST_DEVICE auto get_gradient (const tensor< double, n... > &)
 get the gradient of type tensor (note: since its stored type is not a dual number, the derivative term is identically zero) More...
 
constexpr SMITH_HOST_DEVICE auto chain_rule (const zero, const zero)
 evaluate the change (to first order) in a function, f, given a small change in the input argument, dx.
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto chain_rule (const zero, const T)
 
template<typename T >
constexpr SMITH_HOST_DEVICE auto chain_rule (const T, const zero)
 
constexpr SMITH_HOST_DEVICE auto chain_rule (const double df_dx, const double dx)
 
template<int... n>
constexpr SMITH_HOST_DEVICE auto chain_rule (const tensor< double, n... > &df_dx, const double dx)
 
template<int... n>
constexpr SMITH_HOST_DEVICE auto chain_rule (const tensor< double, n... > &df_dx, const tensor< double, n... > &dx)
 
template<int m, int... n>
constexpr SMITH_HOST_DEVICE auto chain_rule (const tensor< double, m, n... > &df_dx, const tensor< double, n... > &dx)
 
template<int m, int n, int... p>
SMITH_HOST_DEVICE auto chain_rule (const tensor< double, m, n, p... > &df_dx, const tensor< double, p... > &dx)
 
template<typename T , int... n>
constexpr SMITH_HOST_DEVICE int size (const tensor< T, n... > &)
 returns the total number of stored values in a tensor More...
 
constexpr SMITH_HOST_DEVICE int size (const double &)
 overload of size() for double, we say a double "stores" 1 value More...
 
constexpr SMITH_HOST_DEVICE int size (zero)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<int i, typename T , int... n>
constexpr SMITH_HOST_DEVICE int dimension (const tensor< T, n... > &)
 a function for querying the ith dimension of a tensor More...
 
template<typename T , int m, int... n>
constexpr SMITH_HOST_DEVICE int leading_dimension (tensor< T, m, n... >)
 a function for querying the first dimension of a tensor More...
 
template<typename T , int... n>
bool isnan (const tensor< T, n... > &A)
 returns true if any entry of a tensor is nan
 
bool isnan (const zero &)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename... T>
 tuple (T...) -> tuple< T... >
 Class template argument deduction rule for tuples. More...
 
template<typename... T>
SMITH_HOST_DEVICE tuple< T... > make_tuple (const T &... args)
 helper function for combining a list of values into a tuple More...
 
template<int i, typename... T>
constexpr SMITH_HOST_DEVICE auto & get (tuple< T... > &values)
 return a reference to the ith tuple entry More...
 
template<int i, typename... T>
constexpr SMITH_HOST_DEVICE const auto & get (const tuple< T... > &values)
 return a copy of the ith tuple entry More...
 
template<int i, typename... T>
constexpr SMITH_HOST_DEVICE auto type (const tuple< T... > &values)
 a function intended to be used for extracting the ith type from a tuple. More...
 
template<typename... S, typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto plus_helper (const tuple< S... > &x, const tuple< T... > &y, std::integer_sequence< int, i... >)
 A helper function for the + operator of tuples. More...
 
template<typename... S, typename... T>
constexpr SMITH_HOST_DEVICE auto operator+ (const tuple< S... > &x, const tuple< T... > &y)
 return a tuple of values defined by elementwise sum of x and y More...
 
template<typename... T, int... i>
constexpr SMITH_HOST_DEVICE void plus_equals_helper (tuple< T... > &x, const tuple< T... > &y, std::integer_sequence< int, i... >)
 A helper function for the += operator of tuples. More...
 
template<typename... T>
constexpr SMITH_HOST_DEVICE auto operator+= (tuple< T... > &x, const tuple< T... > &y)
 add values contained in y, to the tuple x More...
 
template<typename... T, int... i>
constexpr SMITH_HOST_DEVICE void minus_equals_helper (tuple< T... > &x, const tuple< T... > &y, std::integer_sequence< int, i... >)
 A helper function for the -= operator of tuples. More...
 
template<typename... T>
constexpr SMITH_HOST_DEVICE auto operator-= (tuple< T... > &x, const tuple< T... > &y)
 add values contained in y, to the tuple x More...
 
template<typename... S, typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto minus_helper (const tuple< S... > &x, const tuple< T... > &y, std::integer_sequence< int, i... >)
 A helper function for the - operator of tuples. More...
 
template<typename... S, typename... T>
constexpr SMITH_HOST_DEVICE auto operator- (const tuple< S... > &x, const tuple< T... > &y)
 return a tuple of values defined by elementwise difference of x and y More...
 
template<typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto unary_minus_helper (const tuple< T... > &x, std::integer_sequence< int, i... >)
 A helper function for the - operator of tuples. More...
 
template<typename... T>
constexpr SMITH_HOST_DEVICE auto operator- (const tuple< T... > &x)
 return a tuple of values defined by applying the unary minus operator to each element of x More...
 
template<typename... S, typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto div_helper (const tuple< S... > &x, const tuple< T... > &y, std::integer_sequence< int, i... >)
 A helper function for the / operator of tuples. More...
 
template<typename... S, typename... T>
constexpr SMITH_HOST_DEVICE auto operator/ (const tuple< S... > &x, const tuple< T... > &y)
 return a tuple of values defined by elementwise division of x by y More...
 
template<typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto div_helper (const double a, const tuple< T... > &x, std::integer_sequence< int, i... >)
 A helper function for the / operator of tuples. More...
 
template<typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto div_helper (const tuple< T... > &x, const double a, std::integer_sequence< int, i... >)
 A helper function for the / operator of tuples. More...
 
template<typename... T>
constexpr SMITH_HOST_DEVICE auto operator/ (const double a, const tuple< T... > &x)
 return a tuple of values defined by division of a by the elements of x More...
 
template<typename... T>
constexpr SMITH_HOST_DEVICE auto operator/ (const tuple< T... > &x, const double a)
 return a tuple of values defined by elementwise division of x by a More...
 
template<typename... S, typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto mult_helper (const tuple< S... > &x, const tuple< T... > &y, std::integer_sequence< int, i... >)
 A helper function for the * operator of tuples. More...
 
template<typename... S, typename... T>
constexpr SMITH_HOST_DEVICE auto operator* (const tuple< S... > &x, const tuple< T... > &y)
 return a tuple of values defined by elementwise multiplication of x and y More...
 
template<typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto mult_helper (const double a, const tuple< T... > &x, std::integer_sequence< int, i... >)
 A helper function for the * operator of tuples. More...
 
template<typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto mult_helper (const tuple< T... > &x, const double a, std::integer_sequence< int, i... >)
 A helper function for the * operator of tuples. More...
 
template<typename... T>
constexpr SMITH_HOST_DEVICE auto operator* (const double a, const tuple< T... > &x)
 multiply each component of x by the value a on the left More...
 
template<typename... T>
constexpr SMITH_HOST_DEVICE auto operator* (const tuple< T... > &x, const double a)
 multiply each component of x by the value a on the right More...
 
template<typename... T, std::size_t... i>
auto & print_helper (std::ostream &out, const smith::tuple< T... > &A, std::integer_sequence< size_t, i... >)
 helper used to implement printing a tuple of values More...
 
template<typename... T>
auto & operator<< (std::ostream &out, const smith::tuple< T... > &A)
 print a tuple of values More...
 
template<typename lambda , typename... T, int... i>
SMITH_HOST_DEVICE auto apply_helper (lambda f, tuple< T... > &args, std::integer_sequence< int, i... >)
 A helper to apply a lambda to a tuple. More...
 
template<typename lambda , typename... T>
SMITH_HOST_DEVICE auto apply (lambda f, tuple< T... > &args)
 a way of passing an n-tuple to a function that expects n separate arguments More...
 
template<typename lambda , typename... T, int... i>
SMITH_HOST_DEVICE auto apply_helper (lambda f, const tuple< T... > &args, std::integer_sequence< int, i... >)
 
template<typename lambda , typename... T>
SMITH_HOST_DEVICE auto apply (lambda f, const tuple< T... > &args)
 a way of passing an n-tuple to a function that expects n separate arguments More...
 
template<typename S , typename T , int m, int... n, typename = std::enable_if_t<std::is_arithmetic_v<S> || is_dual_number<S>::value>>
constexpr SMITH_HOST_DEVICE auto operator* (S scale, const tensor< T, m, n... > &A)
 multiply a tensor by a scalar value More...
 
template<typename S , typename T , int m, int... n, typename = std::enable_if_t<std::is_arithmetic_v<S> || is_dual_number<S>::value>>
constexpr SMITH_HOST_DEVICE auto operator* (const tensor< T, m, n... > &A, S scale)
 multiply a tensor by a scalar value More...
 
template<typename S , typename T , int m, int... n, typename = std::enable_if_t<std::is_arithmetic_v<S> || is_dual_number<S>::value>>
constexpr SMITH_HOST_DEVICE auto operator/ (S scale, const tensor< T, m, n... > &A)
 divide a scalar by each element in a tensor More...
 
template<typename S , typename T , int m, int... n, typename = std::enable_if_t<std::is_arithmetic_v<S> || is_dual_number<S>::value>>
constexpr SMITH_HOST_DEVICE auto operator/ (const tensor< T, m, n... > &A, S scale)
 divide a tensor by a scalar More...
 
template<int i, int N>
constexpr SMITH_HOST_DEVICE auto make_dual_helper (zero)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<int i, int N>
constexpr SMITH_HOST_DEVICE auto make_dual_helper (double arg)
 promote a double value to dual number with a one_hot_t< i, N, double > gradient type More...
 
template<int i, int N, typename T , int... n>
constexpr SMITH_HOST_DEVICE auto make_dual_helper (const tensor< T, n... > &arg)
 promote a tensor value to dual number with a one_hot_t< i, N, tensor > gradient type More...
 
template<typename T0 , typename T1 >
constexpr SMITH_HOST_DEVICE auto make_dual (const tuple< T0, T1 > &args)
 Promote a tuple of values to their corresponding dual types. More...
 
template<typename T0 , typename T1 , typename T2 >
constexpr SMITH_HOST_DEVICE auto make_dual (const tuple< T0, T1, T2 > &args)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<bool dualify, typename T >
SMITH_HOST_DEVICE auto promote_to_dual_when (const T &x)
 a function that optionally (decided at compile time) converts a value to its dual type More...
 
template<bool dualify, typename T , int n>
SMITH_HOST_DEVICE auto promote_each_to_dual_when (const tensor< T, n > &x)
 a function that optionally (decided at compile time) converts a list of values to their dual types More...
 
template<int n, typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto make_dual_helper (const smith::tuple< T... > &args, std::integer_sequence< int, i... >)
 layer of indirection required to implement make_dual_wrt
 
template<int n, typename... T>
constexpr auto make_dual_wrt (const smith::tuple< T... > &args)
 take a tuple of values, and promote the nth one to a one-hot dual number of the appropriate type More...
 
template<typename T1 , typename T2 , int n>
SMITH_HOST_DEVICE auto get_value (const tensor< tuple< T1, T2 >, n > &input)
 Extracts all of the values from a tensor of dual numbers. More...
 
template<typename... T>
SMITH_HOST_DEVICE auto get_value (const smith::tuple< T... > &tuple_of_values)
 Retrieves the value components of a set of (possibly dual) numbers. More...
 
template<typename... T>
SMITH_HOST_DEVICE auto get_gradient (dual< smith::tuple< T... >> arg)
 Retrieves the gradient components of a set of dual numbers. More...
 
template<typename... T, int... n>
SMITH_HOST_DEVICE auto get_gradient (const tensor< dual< smith::tuple< T... >>, n... > &arg)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename... T>
SMITH_HOST_DEVICE auto get_gradient (smith::tuple< T... > tuple_of_values)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<int... n>
constexpr SMITH_HOST_DEVICE auto make_dual (const tensor< double, n... > &A)
 Constructs a tensor of dual numbers from a tensor of values. More...
 
template<typename T , int n>
constexpr SMITH_HOST_DEVICE LuFactorization< T, n > factorize_lu (const tensor< T, n, n > &A)
 Compute LU factorization of a matrix with partial pivoting. More...
 
template<typename S , typename T , int n, int... m>
constexpr SMITH_HOST_DEVICE auto linear_solve (const tensor< S, n, n > &A, const tensor< T, n, m... > &b)
 Solves Ax = b for x using Gaussian elimination with partial pivoting. More...
 
template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto make_dual (const tensor< T, n > &x, const tensor< T, n > &dx)
 Create a tensor of dual numbers with specified seed.
 
template<typename T , int m, int n>
constexpr SMITH_HOST_DEVICE auto make_dual (const tensor< T, m, n > &x, const tensor< T, m, n > &dx)
 Create a tensor of dual numbers with specified seed.
 
template<typename gradient_type , int n>
constexpr SMITH_HOST_DEVICE auto inv (tensor< dual< gradient_type >, n, n > A)
 
template<typename T , int... n>
SMITH_HOST_DEVICE auto get_value (const tensor< dual< T >, n... > &arg)
 Retrieves a value tensor from a tensor of dual numbers. More...
 
template<int... n>
constexpr SMITH_HOST_DEVICE auto get_gradient (const tensor< dual< double >, n... > &arg)
 Retrieves a gradient tensor from a tensor of dual numbers. More...
 
template<int... n, int... m>
constexpr SMITH_HOST_DEVICE auto get_gradient (const tensor< dual< tensor< double, m... >>, n... > &arg)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename function , typename... ParamTypes>
auto solve_scalar_equation (const function &f, double x0, double lower_bound, double upper_bound, ScalarSolverOptions options, ParamTypes... params)
 Solves a nonlinear scalar-valued equation and gives derivatives of solution to parameters. More...
 
template<typename function , int n>
auto find_root (const function &f, tensor< double, n > x0)
 Finds a root of a vector-valued nonlinear function. More...
 
template<typename T , int size>
auto eigenvalues (const smith::tensor< T, size, size > &A)
 compute the eigenvalues of a symmetric matrix A More...
 
template<typename T >
int sgn (T val)
 Signum, returns sign of input. More...
 
template<typename T >
SMITH_HOST_DEVICE tensor< int, 3 > argsort (const tensor< T, 3 > &v)
 Find indices that would sort a 3-vector. More...
 
SMITH_HOST_DEVICE tuple< vec3, mat3eig_symm (const mat3 &A)
 
template<typename T , typename Function , typename EigvalSecantFunction >
auto symmetric_mat3_function (tensor< T, 3, 3 > A, const Function &f, const EigvalSecantFunction &g)
 Constructs an isotropic tensor-valued function of a symmetric 3x3 tensor from a scalar function. More...
 
template<typename Gradient , typename Function >
constexpr SMITH_HOST_DEVICE auto symmetric_mat3_function_with_derivative (tensor< dual< Gradient >, 3, 3 > A, tensor< double, 3, 3 > f_A, vec3 lambda, mat3 Q, const Function &g)
 Helper function for defining the derivative.
 
template<typename T >
auto log_symm (tensor< T, 3, 3 > A)
 Logarithm of a symmetric matrix. More...
 
template<typename T >
auto exp_symm (tensor< T, 3, 3 > A)
 Exponential of a symmetric matrix. More...
 
template<typename T >
auto sqrt_symm (tensor< T, 3, 3 > A)
 Square root of a symmetric matrix. More...
 
std::string linearName (const LinearSolver &s)
 Convert linear solver enums to their string names.
 
std::ostream & operator<< (std::ostream &os, LinearSolver s)
 output linear solver string representation to a stream
 
std::string nonlinearName (const NonlinearSolver &s)
 Convert nonlinear linear solver enums to their string names.
 
std::ostream & operator<< (std::ostream &os, NonlinearSolver s)
 output nonlinear solver string representation to a stream
 
std::string petscPCName (const PetscPCType &s)
 Convert Petsc preconditioner enums to their string names.
 
std::ostream & operator<< (std::ostream &os, PetscPCType s)
 output PETSc preconditioner string representation to a stream
 
std::string preconditionerName (Preconditioner p)
 Convert preconditioner enums to their string names.
 
std::ostream & operator<< (std::ostream &os, Preconditioner p)
 output preconditioner string representation to a stream
 
Components operator+ (Component i, Component j)
 Construct a Components object from the sum of individual vector components. More...
 
Components operator+ (Component i, Components c)
 Add an additional component to the set of flagged Components. More...
 
template<typename T >
auto getFieldPointers (std::vector< std::shared_ptr< T >> &states, std::vector< std::shared_ptr< T >> &params)
 Get a vector of FieldPtr or DualFieldPtr from a vector of shared_pointers to FiniteElementState or FiniteElementDual.
 
template<typename T >
auto getFieldPointers (std::vector< std::shared_ptr< T >> &states)
 Get a vector of FieldPtr or DualFieldPtr from a vector of shared_pointers to FiniteElementState or FiniteElementDual.
 
template<typename T >
auto getFieldPointers (std::vector< T > &states, std::vector< T > &params)
 Get a vector of FieldPtr or DualFieldPtr from a vector of FiniteElementState or FiniteElementDual.
 
template<typename T >
auto getFieldPointers (std::vector< T > &states)
 Get a vector of FieldPtr or DualFieldPtr from a vector of FiniteElementState or FiniteElementDual.
 
template<typename T >
auto getFieldPointers (std::shared_ptr< T > &state)
 Get a vector of FieldPtr or DualFieldPtr from a single shared_ptr<FiniteElementState> or shared_ptr<FiniteElementDual>
 
template<typename T >
auto getFieldPointers (T &state)
 Get a vector of FieldPtr or DualFieldPtr from a single FiniteElementState or FiniteElementDual.
 
template<typename T >
auto getConstFieldPointers (const std::vector< std::shared_ptr< T >> &states, const std::vector< std::shared_ptr< T >> &params={})
 Get a vector of ConstFieldPtr or ConstDualFieldPtr from a vector of shared_pointers to FiniteElementState or FiniteElementDual.
 
template<typename T >
auto getConstFieldPointers (const std::vector< T * > &states, const std::vector< T * > &params={})
 Get a vector of ConstFieldPtr or ConstDualFieldPtr from a vector of shared_pointers to FiniteElementState or FiniteElementDual.
 
template<typename T >
auto getConstFieldPointers (const std::vector< T > &states, const std::vector< T > &params={})
 Get a vector of ConstFieldPtr or ConstDualFieldPtr from a vector of FiniteElementState or FiniteElementDual.
 
template<typename T >
auto getConstFieldPointers (const std::shared_ptr< T > &state)
 Get a vector of ConstFieldPtr or ConstDualFieldPtr from a single shared_ptr<FiniteElementState> or shared_ptr<FiniteElementDual>
 
template<typename T >
auto getConstFieldPointers (const T &state)
 Get a vector of ConstFieldPtr or ConstDualFieldPtr from a single FiniteElementState or FiniteElementDual.
 
template<int dim, typename signature , int... n, typename func , typename... T>
FiniteElementState fit (func f, mfem::ParMesh &pmesh, const T &... solution_fields)
 determine field parameters to approximate the output of a user-provided q-function More...
 
std::vector< const mfem::ParFiniteElementSpace * > getSpaces (const std::vector< smith::FiniteElementState > &states)
 Helper function to construct vector of spaces from an existing vector of FiniteElementState. More...
 
template<typename MaterialType , typename StateType , typename... parameter_types>
auto uniaxial_stress_test (double t_max, size_t num_steps, const MaterialType material, const StateType initial_state, std::function< double(double)> epsilon_xx, const parameter_types... parameter_functions)
 Drive the material model thorugh a uniaxial tension experiment. More...
 
template<typename MaterialType , typename StateType , typename... parameter_types>
auto uniaxial_stress_test_rate_dependent (double t_max, size_t num_steps, const MaterialType material, const StateType initial_state, std::function< double(double)> epsilon_xx, const parameter_types... parameter_functions)
 Drive a rate-dependent material model thorugh a uniaxial tension experiment. More...
 
template<typename MaterialType , typename StateType , typename... functions>
auto single_quadrature_point_test (double t_max, size_t num_steps, const MaterialType material, const StateType initial_state, const functions... f)
 This function takes a material model (and associate state variables), subjects it to a time history of stimuli, described by functions ... f, and returns the outputs at each step. This is intended to be used for testing materials, to ensure their response is in agreement with known data (analytic or experimental). More...
 
template<int order, int dim, typename... ParameterSpaces>
auto create_solid_weak_form (const std::string &physics_name, std::shared_ptr< smith::Mesh > mesh, const std::vector< const smith::FiniteElementState * > &states, const std::vector< const smith::FiniteElementState * > &params)
 Utility function for creating a shared_ptr<SolidWeakForm<>> More...
 
double norm (const FiniteElementState &state, const double p=2)
 Find the Lp norm of a finite element state across all dofs. More...
 
double computeL2Error (const FiniteElementState &state, mfem::VectorCoefficient &exact_solution)
 Find the L2 norm of the error of a vector-valued finite element state with respect to an exact solution. More...
 
double computeL2Error (const FiniteElementState &state, mfem::Coefficient &exact_solution)
 Find the L2 norm of the error of a scalar-valued finite element state with respect to an exact solution. More...
 
bool is_scalar_valued (const GeneralCoefficient &coef)
 convenience function for querying the type stored in a GeneralCoefficient
 
bool is_vector_valued (const GeneralCoefficient &coef)
 convenience function for querying the type stored in a GeneralCoefficient
 
bool sameFiniteElementSpace (const mfem::FiniteElementSpace &left, const mfem::FiniteElementSpace &right)
 Check if two finite element spaces are the same. More...
 
double avg (const FiniteElementVector &fe_vector)
 Find the average value of a finite element vector across all dofs. More...
 
double max (const FiniteElementVector &fe_vector)
 Find the max value of a finite element vector across all dofs. More...
 
double min (const FiniteElementVector &fe_vector)
 Find the min value of a finite element vector across all dofs. More...
 
double innerProduct (const FiniteElementVector &vec1, const FiniteElementVector &vec2)
 Find the inner prodcut between two finite element vectors across all dofs. More...
 
void checkMesh (const mfem::ParMesh &pmesh, bool is_restart=false)
 Check that a mesh satisfies our required properties.
 

Variables

constexpr ExecutionSpace default_execution_space = ExecutionSpace::CPU
 The default execution space for Smith builds.
 
std::shared_ptr< QuadratureData< Nothing > > NoQData = ::std::make_shared<QuadratureData<Nothing>>()
 a single instance of a QuadratureData container of Nothings, since they are all interchangeable More...
 
std::shared_ptr< QuadratureData< Empty > > EmptyQData = ::std::make_shared<QuadratureData<Empty>>()
 a single instance of a QuadratureData container of Emptys, since they are all interchangeable
 
const ScalarSolverOptions default_solver_options {.xtol = 1e-8, .rtol = 0, .max_iter = 25}
 Default options for solve_scalar_equation.
 
std::map< std::string, LinearSolverlinearSolverMap
 string->value matching for optionally entering options as string in command line More...
 
std::map< std::string, NonlinearSolvernonlinearSolverMap
 string->value matching for optionally entering options as string in command line More...
 
std::map< std::string, PreconditionerpreconditionerMap
 string->value matching for optionally entering options as string in command line More...
 
constexpr int SHAPE_ORDER = 1
 Polynomial order used to discretize the shape displacement field.
 
constexpr H1< SHAPE_ORDER, 2 > SHAPE_DIM_2
 Function space for shape displacement on dimension 2 meshes.
 
constexpr H1< SHAPE_ORDER, 3 > SHAPE_DIM_3
 Function space for shape displacement on dimension 2 meshes.
 

Detailed Description

Accelerator functionality.

Typedef Documentation

◆ BlockOverride

using smith::BlockOverride = typedef std::pair<int, std::unique_ptr<const mfem::Operator> >

Optional override for a diagonal block operator.

The integer is the block index i and the operator replaces the Jacobian block A_ii (or, for 2x2 Schur systems, the block used to build/approximate the (1,1) Schur operator).

Ownership of the operator is transferred to the preconditioner.

Definition at line 18 of file block_preconditioner.hpp.

◆ one_hot_t

template<int i, int n, typename T >
using smith::one_hot_t = typedef typename one_hot<i, n, T>::type

a tuple type with n entries, all of which are of type smith::zero, except for the i^{th} entry, which is of type T

e.g. one_hot_t< 2, 4, T > == tuple<zero, zero, T, zero>

Definition at line 125 of file tuple_tensor_dual_functions.hpp.

◆ outer_product_t

template<typename T1 , typename T2 >
using smith::outer_product_t = typedef typename detail::outer_prod<T1, T2>::type

a type function that returns the tensor type of an outer product of two tensors

Template Parameters
T1the first argument to the outer product
T2the second argument to the outer product

Definition at line 1829 of file tensor.hpp.

◆ QuasiStaticFirstOrderTimeIntegrationRule

Alternative name for Backward Euler which makes sense when restricting what are typically second order odes, for example transient solid mechanics, to the quasi-static approximation. It happens that the implementation is identical to backward-Euler applied to first order systems as we want to be able to capture current velocity dependencies.

Definition at line 47 of file time_integration_rule.hpp.

◆ reduced_tensor

template<typename T , int n1, int n2 = 1>
using smith::reduced_tensor = typedef std::conditional_t< (n1 == 1 && n2 == 1), double, std::conditional_t<n1 == 1, tensor<T, n2>, std::conditional_t<n2 == 1, tensor<T, n1>, tensor<T, n1, n2> >> >

Removes 1s from tensor dimensions For example, a tensor<T, 1, 10> is equivalent to a tensor<T, 10>

Template Parameters
TThe scalar type of the tensor
n1The first dimension
n2The second dimension

Definition at line 277 of file tensor.hpp.

Enumeration Type Documentation

◆ AMGXSolver

enum smith::AMGXSolver
strong

Solver types supported by AMGX.

Enumerator
AMG 

GPU Algebraic Multigrid

PCGF 

GPU PCGF

CG 

GPU CG

PCG 

GPU PCG

PBICGSTAB 

GPU PBICGSTAB

BICGSTAB 

GPU BICGSTAB

FGMRES 

GPU FGMRES

JACOBI_L1 

GPU JACOBI_L1

GS 

GPU GS

POLYNOMIAL 

GPU POLYNOMIAL

KPZ_POLYNOMIAL 

GPU KPZ_POLYNOMIAL

BLOCK_JACOBI 

GPU BLOCK_JACOBI

MULTICOLOR_GS 

GPU MULTICOLOR_GS

MULTICOLOR_DILU 

GPU MULTICOLOR_DILU

Definition at line 217 of file solver_config.hpp.

◆ BlockSchurType

enum smith::BlockSchurType
strong

Selects the block Schur preconditioner variant.

Enumerator
Diagonal 

Block diagonal: apply $ A_{11}^{-1} $ and $ S^{-1} $ only.

Lower 

Lower factor form.

Upper 

Upper factor form.

Full 

Full factor form (lower, diagonal, upper).

Definition at line 173 of file block_preconditioner.hpp.

◆ BlockTriangularType

Selects the block triangular sweep used by BlockTriangularPreconditioner.

Enumerator
Lower 

Forward (lower triangular) sweep.

Upper 

Backward (upper triangular) sweep.

Symmetric 

Apply a symmetric combination of lower and upper sweeps.

Definition at line 84 of file block_preconditioner.hpp.

◆ ContactEnforcement

Describes how to enforce the contact constraint equations.

Enumerator
Penalty 

Equal penalty applied to all constrained dofs

LagrangeMultiplier 

Solve for exact pressures to satisfy constraints

Definition at line 28 of file contact_config.hpp.

◆ ContactJacobian

Method for computing Jacobian of contact terms.

Enumerator
Approximate 

Ignore higher order contributions to the Jacobian

Exact 

Compute exact Jacobian (needed for quadratic convergence with Newton)

Definition at line 46 of file contact_config.hpp.

◆ ContactMethod

enum smith::ContactMethod
strong

Methodology for enforcing contact constraints (i.e. how you form the constraint equations)

Enumerator
SingleMortar 

Puso and Laursen 2004

Definition at line 20 of file contact_config.hpp.

◆ ContactType

enum smith::ContactType
strong

Mechanical constraint type on contact surfaces.

Enumerator
TiedNormal 

Tied contact in the normal direction, no friction

Frictionless 

Enforce gap >= 0, pressure <= 0, gap * pressure = 0 in the normal direction

Definition at line 37 of file contact_config.hpp.

◆ DirichletEnforcementMethod

this enum describes which way to enforce the time-varying constraint u(t) == U(t)

Enumerator
DirectControl 

Satisfies u(t+dt) == U(t+dt)

This method imposes additional stability criteria for the case of second order differential equations

RateControl 

(default value) Satisfies dudt(t+dt) == dUdt(t+dt)

This method does not impose any additional stability criteria for the case of second order differential equations.

FullControl 

satisfies u(t+dt) == U(t+dt), dudt(t+dt) == dUdt(t+dt), (and d2udt2(t+dt) == d2Udt2(t+dt), for a second order ODE)

Empirically, this method tends to be the most accurate for small timesteps (by a constant factor), but is more expensive to evaluate

Definition at line 60 of file solver_config.hpp.

◆ ElementType

enum smith::ElementType
strong

The type of a finite element basis function.

Note
TODO This class is used instead of the Family class from functional due to incompatibilities with Vector expression templates and the dual number class.
Enumerator
H1 

Nodal scalar-valued basis functions.

HCURL 

Nedelec (continuous tangent) vector-valued basis functions.

HDIV 

Raviart-Thomas (continuous normal) vector-valued basis functions.

L2 

Discontinuous scalar-valued basis functions.

Definition at line 38 of file finite_element_vector.hpp.

◆ Family

enum smith::Family
strong

Element conformity.

QOI denotes a "quantity of interest", implying integration with the test function "1" H1 denotes a function space where values are continuous across element boundaries HCURL denotes a vector-valued function space where only the tangential component is continuous across element boundaries HDIV denotes a vector-valued function space where only the normal component is continuous across element boundaries L2 denotes a function space where values are discontinuous across element boundaries

Definition at line 180 of file finite_element.hpp.

◆ LinearSolver

enum smith::LinearSolver
strong

Linear solution method indicator.

Enumerator
CG 

Conjugate gradient

GMRES 

Generalized minimal residual method

SuperLU 

SuperLU MPI-enabled direct nodal solver

Strumpack 

Strumpack MPI-enabled direct frontal solver

PetscCG 

PETSc MPI-enabled conjugate gradient solver

PetscGMRES 

PETSc MPI-enabled generalize minimal residual solver

Definition at line 102 of file solver_config.hpp.

◆ NonlinearSolver

Nonlinear solver method indicator.

Enumerator
Newton 

MFEM-native Newton-Raphson

LBFGS 

MFEM-native Limited memory BFGS

NewtonLineSearch 

Custom solver using preconditioned earch direction with backtracking line search

TrustRegion 

Custom solver using a trust region solver

KINFullStep 

KINSOL Full Newton (Sundials must be enabled)

KINBacktrackingLineSearch 

KINSOL Newton with Backtracking Line Search (Sundials must be enabled)

KINPicard 

KINSOL Picard (Sundials must be enabled)

PetscNewton 

PETSc Full Newton

PetscNewtonBacktracking 

PETSc Newton with backtracking line search

PetscNewtonCriticalPoint 

PETSc Newton with critical point line search

PetscTrustRegion 

PETSc trust region solver

Definition at line 149 of file solver_config.hpp.

◆ PetscPCType

enum smith::PetscPCType
strong

Preconditioner types supported by PETSc.

Enumerator
JACOBI 

Jacobi with diagonal scaling

JACOBI_L1 

Jacobi with row-wise L1 norm scaling

JACOBI_ROWSUM 

Jacobi with row sum (no absolute value) scaling

JACOBI_ROWMAX 

Jacobi with L-infinity norm scaling

PBJACOBI 

Point-block Jacobi with LU factorization on sub-blocks

BJACOBI 

Block Jacobi with LU factorization on sub-blocks, set number of blocks with -pc_bjacobi_blocks

LU 

Direct solver based on LU factorization

ILU 

Incomplete LU factorization

CHOLESKY 

Cholesky factorization

SVD 

LAPACK xGESVD SVD decomposition, fully redundant (SLOW for MPI)

ASM 

Additive Schwarz method, each block is solved with its own KSP object, blocks cannot be shared between MPI processes. Set total number of blocks with -pc_asm_blocks N

GASM 

Additive Schwarz method, each block is solved with its own KSP object, blocks can be shared between MPI processes. Set total number of blocks with -pc_gasm_total_subdomains N

GAMG 

PETSc built-in AMG preconditioner

HMG 

Hierarchical AMG for multi-component PDE problems

NONE 

No preconditioner, or type set via -pc_type CLI flag

Definition at line 271 of file solver_config.hpp.

◆ Preconditioner

enum smith::Preconditioner
strong

The type of preconditioner to be used.

Enumerator
HypreJacobi 

Hypre-based Jacobi

HypreL1Jacobi 

Hypre-based L1-scaled Jacobi

HypreGaussSeidel 

Hypre-based Gauss-Seidel

HypreAMG 

Hypre's BoomerAMG algebraic multi-grid

HypreILU 

Hypre's Incomplete LU

AMGX 

NVIDIA's AMGX GPU-enabled algebraic multi-grid, GPU builds only

Petsc 

PETSc preconditioner,

AMGFContact 

MFEM-based AMG with filtering (AMGF), contact problems only

None 

No preconditioner used

Definition at line 336 of file solver_config.hpp.

◆ SchurApproxType

Selects how the (1,1) Schur operator is approximated.

Enumerator
DiagInv 

Use assembled \( S \approx A_{22} - A_{21} \\mathrm{diag}(A_{11})^{-1} A_{12} \).

A22Only 

Use \( S \approx A_{22} \).

Custom 

Use a custom operator provided via the overrides list for block index 1.

Definition at line 185 of file block_preconditioner.hpp.

◆ TimestepMethod

enum smith::TimestepMethod
strong

Timestep method of a solver.

Enumerator
QuasiStatic 

Quasistatic

BackwardEuler 

FirstOrderODE option

SDIRK33 

FirstOrderODE option

ForwardEuler 

FirstOrderODE option

RK2 

FirstOrderODE option

RK3SSP 

FirstOrderODE option

RK4 

FirstOrderODE option

GeneralizedAlpha 

FirstOrderODE option

ImplicitMidpoint 

FirstOrderODE option

SDIRK23 

FirstOrderODE option

SDIRK34 

FirstOrderODE option

Newmark 

SecondOrderODE option

HHTAlpha 

SecondOrderODE option

WBZAlpha 

SecondOrderODE option

AverageAcceleration 

SecondOrderODE option

LinearAcceleration 

SecondOrderODE option

CentralDifference 

SecondOrderODE option

FoxGoodwin 

SecondOrderODE option

Definition at line 25 of file solver_config.hpp.

Function Documentation

◆ about()

std::string smith::about ( )

Returns a string about the configuration of Smith.

Returns
string containing various configuration information about Smith

Definition at line 56 of file about.cpp.

◆ abs()

template<typename gradient_type >
SMITH_HOST_DEVICE auto smith::abs ( dual< gradient_type >  x)

Implementation of absolute value function for dual numbers.

Note
This is not differentiable at x = 0.0. At that point, the gradient is calculated as the gradient of x.

Definition at line 219 of file dual.hpp.

◆ antisym() [1/2]

template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::antisym ( const isotropic_tensor< T, m, m > &  )
constexpr

return the antisymmetric part of an isotropic tensor

Template Parameters
Tthe types stored in the isotropic tensor
mthe number of rows and columns in I
Returns
zero (isotropic matrices are symmetric, so the antisymmetric part is identically zero)

Definition at line 256 of file isotropic_tensor.hpp.

◆ antisym() [2/2]

template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto smith::antisym ( const tensor< T, n, n > &  A)
constexpr

Returns the antisymmetric part of a square matrix.

Parameters
[in]AThe matrix to obtain the antisymmetric part of
Returns
(1/2) * (A - A^T)

Definition at line 1181 of file tensor.hpp.

◆ AntisymmetricIdentity()

template<int m>
constexpr SMITH_HOST_DEVICE auto smith::AntisymmetricIdentity ( )
constexpr

a helper function for creating the rank-4 isotropic tensor defined by: d(antisym(A)_{ij}) / d(A_{kl})

Template Parameters
mthe dimension

Definition at line 394 of file isotropic_tensor.hpp.

◆ apply() [1/2]

template<typename lambda , typename... T>
SMITH_HOST_DEVICE auto smith::apply ( lambda  f,
const tuple< T... > &  args 
)

a way of passing an n-tuple to a function that expects n separate arguments

Template Parameters
lambdaa callable type
Tthe types of arguments to be passed in to f
Parameters
fthe callable object
argsa tuple of arguments

e.g. foo(bar, baz) is equivalent to apply(foo, smith::tuple(bar,baz));

Definition at line 803 of file tuple.hpp.

◆ apply() [2/2]

template<typename lambda , typename... T>
SMITH_HOST_DEVICE auto smith::apply ( lambda  f,
tuple< T... > &  args 
)

a way of passing an n-tuple to a function that expects n separate arguments

Template Parameters
lambdaa callable type
Tthe types of arguments to be passed in to f
Parameters
fthe callable object
argsa tuple of arguments

e.g. foo(bar, baz) is equivalent to apply(foo, smith::tuple(bar,baz));

Definition at line 779 of file tuple.hpp.

◆ apply_helper() [1/2]

template<typename lambda , typename... T, int... i>
SMITH_HOST_DEVICE auto smith::apply_helper ( lambda  f,
const tuple< T... > &  args,
std::integer_sequence< int, i... >   
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 788 of file tuple.hpp.

◆ apply_helper() [2/2]

template<typename lambda , typename... T, int... i>
SMITH_HOST_DEVICE auto smith::apply_helper ( lambda  f,
tuple< T... > &  args,
std::integer_sequence< int, i... >   
)

A helper to apply a lambda to a tuple.

Template Parameters
lambdaThe functor type
TThe tuple types
iThe integer sequence to i
Parameters
fThe functor to apply to the tuple
argsThe input tuple
Returns
The functor output

Definition at line 764 of file tuple.hpp.

◆ argsort()

template<typename T >
SMITH_HOST_DEVICE tensor<int, 3> smith::argsort ( const tensor< T, 3 > &  v)

Find indices that would sort a 3-vector.

Parameters
v3-vector to sort.
Returns
3-vector of indices that would sort v in ascending order.

Definition at line 783 of file tuple_tensor_dual_functions.hpp.

◆ avg()

double smith::avg ( const FiniteElementVector fe_vector)

Find the average value of a finite element vector across all dofs.

Parameters
fe_vectorThe state variable to compute the average of
Returns
The average value
Note
This acts on the actual scalar degree of freedom values, not the interpolated shape function values. This implies these may or may not be nodal averages depending on the choice of finite element basis.

Definition at line 117 of file finite_element_vector.cpp.

◆ Bernstein()

template<int n, typename T >
SMITH_HOST_DEVICE tensor<T, n> smith::Bernstein ( s)

Bernstein Polynomials on the domain [0, 1].

Template Parameters
nhow many entries to compute
Parameters
[in]swhere to evaluate the polynomials

Definition at line 467 of file polynomials.hpp.

◆ binary_comparator_overload()

smith::binary_comparator_overload ( )

implement operator< for dual numbers

implement operator> for dual numbers

implement operator== for dual numbers

◆ block_solve()

std::vector< FieldState > smith::block_solve ( const std::vector< WeakForm * > &  residual_evals,
const std::vector< std::vector< size_t >>  block_indices,
const FieldState shape_disp,
const std::vector< std::vector< FieldState >> &  states,
const std::vector< std::vector< FieldState >> &  params,
const TimeInfo time_info,
const DifferentiableBlockSolver solver,
const std::vector< const BoundaryConditionManager * > &  bc_managers 
)

Solve a block nonlinear system of equations as defined by the vector of weak form.

Parameters
residual_evalsVector of weak forms which define the equations to be solved
block_indicesMatrix of index arguments specifying where in each WeakForm the unknown fields are passed in. Example: for a 2 weak-form system, with weak-forms, r1, r2 r1(a,b,c) r2(b,d,e,a)
shape_dispThe mesh-morphed shape displacement
statesThe time varying states as inputs to the weak form
paramsThe fixed field parameters as inputs to the weak form
time_infoTimestep information (time, dt, cycle)
solverThe differentiable, potentially nonlinear, equation solver used to solve the system of equations
bc_managersHolds information about which degrees of freedom (DOFS)
Returns
Vector of field solutions satisfying the weak forms

Definition at line 270 of file nonlinear_solve.cpp.

◆ boundary_geometry_counts()

std::array<uint32_t, mfem::Geometry::NUM_GEOMETRIES> smith::boundary_geometry_counts ( const mfem::Mesh &  mesh)
inline

count the number of boundary elements of each geometry in a mesh

Parameters
meshthe mesh to count

Definition at line 89 of file geometry.hpp.

◆ build_hollow_quarter_cylinder()

mfem::Mesh smith::build_hollow_quarter_cylinder ( std::size_t  radial_divisions,
std::size_t  angular_divisions,
std::size_t  vertical_divisions,
double  inner_radius,
double  outer_radius,
double  height 
)

Constructs an MFEM mesh of a hollow cylinder restricted to the first orthant.

Parameters
radial_divisionsnumber of elements in the radial direction
angular_divisionsnumber of elements in the theta direction
vertical_divisionsnumber of elements in the z-direction
inner_radiusthe radius of the inner wall of the cylinder
outer_radiusthe radius of the outer wall of the cylinder
heightthe height of the top surface of the cylinder
Note
the cylinder's axis of symmetry is along the z-direction

Definition at line 370 of file mesh_utils.cpp.

◆ buildBallMesh()

mfem::Mesh smith::buildBallMesh ( int  approx_number_of_elements)

Constructs a 3D MFEM mesh of a unit ball, centered at the origin.

This routine creates a mesh by refining a coarse ball mesh until the number of elements is as close as possible to the user-specified number of elements

Parameters
[in]approx_number_of_elementsApproximate number of elements
Returns
The constructed mesh

Definition at line 113 of file mesh_utils.cpp.

◆ buildCuboidMesh()

mfem::Mesh smith::buildCuboidMesh ( int  elements_in_x,
int  elements_in_y,
int  elements_in_z,
double  size_x = 1.,
double  size_y = 1.,
double  size_z = 1. 
)

Constructs a 3D MFEM mesh of a cuboid.

Parameters
[in]elements_in_xthe number of elements in the x-direction
[in]elements_in_ythe number of elements in the y-direction
[in]elements_in_zthe number of elements in the z-direction
[in]size_xOverall size in the x-direction
[in]size_yOverall size in the y-direction
[in]size_zOverall size in the z-direction
Returns
The constructed serial mesh

Definition at line 155 of file mesh_utils.cpp.

◆ buildCylinderMesh()

mfem::Mesh smith::buildCylinderMesh ( int  radial_refinement,
int  elements_lengthwise,
double  radius,
double  height 
)

Constructs a 3D MFEM mesh of a cylinder.

Parameters
[in]radial_refinementthe number of times to apply uniform mesh refinement to the cross section
[in]elements_lengthwisethe number of elements in the z-direction
[in]radiusthe radius of the cylinder
[in]heightthe number of elements in the z-direction
Returns
The constructed mesh

Definition at line 162 of file mesh_utils.cpp.

◆ buildDifferentiableLinearSolver()

std::shared_ptr< LinearDifferentiableSolver > smith::buildDifferentiableLinearSolver ( LinearSolverOptions  linear_opts,
const smith::Mesh mesh 
)

Create a differentiable linear solver.

Parameters
linear_optslinear options struct
meshmesh

Definition at line 396 of file differentiable_solver.cpp.

◆ buildDifferentiableNonlinearBlockSolver()

std::shared_ptr< NonlinearDifferentiableBlockSolver > smith::buildDifferentiableNonlinearBlockSolver ( NonlinearSolverOptions  nonlinear_opts,
LinearSolverOptions  linear_opts,
const smith::Mesh mesh 
)

Create a differentiable nonlinear block solver.

Parameters
nonlinear_optsnonlinear options struct
linear_optslinear options struct
meshmesh

Definition at line 411 of file differentiable_solver.cpp.

◆ buildDifferentiableNonlinearSolver()

std::shared_ptr< NonlinearDifferentiableSolver > smith::buildDifferentiableNonlinearSolver ( NonlinearSolverOptions  nonlinear_opts,
LinearSolverOptions  linear_opts,
const smith::Mesh mesh 
)

Create a differentiable nonlinear solver.

Parameters
nonlinear_optsnonlinear options struct
linear_optslinear options struct
meshmesh

Definition at line 403 of file differentiable_solver.cpp.

◆ buildDiskMesh()

mfem::Mesh smith::buildDiskMesh ( int  approx_number_of_elements)

Constructs a 2D MFEM mesh of a unit disk, centered at the origin.

This routine creates a mesh by refining a coarse disk mesh until the number of elements is as close as possible to the user-specified number of elements

Parameters
[in]approx_number_of_elementsThe appoximate number of elements
Returns
The constructed mesh

Definition at line 80 of file mesh_utils.cpp.

◆ buildHollowCylinderMesh()

mfem::Mesh smith::buildHollowCylinderMesh ( int  radial_refinement,
int  elements_lengthwise,
double  inner_radius,
double  outer_radius,
double  height,
double  total_angle = M_PI,
int  sectors = 8 
)

Constructs a 3D MFEM mesh of a hollow cylinder.

Parameters
[in]radial_refinementthe number of times to apply uniform mesh refinement to the cross section
[in]elements_lengthwisethe number of elements in the z-direction
[in]inner_radiusinner radius the radius of the cylindrical shell
[in]outer_radiusouer radius the radius of the cylindrical shell
[in]heightthe number of elements in the z-direction
[in]total_anglethe angle in radians over which to generate the portion of an extruded cylinder
[in]sectorsthe number of starting sectors in the hollow cylinder
Returns
The constructed mesh

Definition at line 359 of file mesh_utils.cpp.

◆ buildLinearSolverAndPreconditioner()

std::pair< std::unique_ptr< mfem::Solver >, std::unique_ptr< mfem::Solver > > smith::buildLinearSolverAndPreconditioner ( LinearSolverOptions  linear_opts = {},
MPI_Comm  comm = MPI_COMM_WORLD 
)

Build the linear solver and its associated preconditioner given a linear options struct.

Parameters
linear_optsThe options to configure the linear solver and preconditioner
commThe MPI communicator for the supplied HypreParMatrix and HypreParVectors
Returns
A pair containing the constructed linear solver and preconditioner objects

Definition at line 1097 of file equation_solver.cpp.

◆ buildMeshFromFile()

mfem::Mesh smith::buildMeshFromFile ( const std::string &  mesh_file)

Constructs an MFEM mesh from a file.

This opens and reads an external mesh file and constructs a serial MFEM Mesh object.

Parameters
[in]mesh_fileThe mesh file to open
Returns
A serial mesh object

Definition at line 25 of file mesh_utils.cpp.

◆ buildMonolithicMatrix()

std::unique_ptr< mfem::HypreParMatrix > smith::buildMonolithicMatrix ( const mfem::BlockOperator &  block_operator)

Function for building a monolithic parallel Hypre matrix from a block system of smaller Hypre matrices.

Parameters
block_operatorThe block system of HypreParMatrices
Returns
The assembled monolithic HypreParMatrix
Precondition
block_operator must have assembled HypreParMatrices for its sub-blocks

Definition at line 941 of file equation_solver.cpp.

◆ buildNonlinearSolver()

std::unique_ptr< mfem::NewtonSolver > smith::buildNonlinearSolver ( NonlinearSolverOptions  nonlinear_opts,
const LinearSolverOptions linear_opts,
mfem::Solver &  preconditioner,
MPI_Comm  comm = MPI_COMM_WORLD 
)

Build a nonlinear solver using the nonlinear option struct.

Parameters
nonlinear_optsThe options to configure the nonlinear solution scheme
linear_optsThe options to configure the linear solution scheme
preconditionerA preconditioner to help with either linear or nonlinear solves
commThe MPI communicator for the supplied nonlinear operators and HypreParVectors
Returns
The constructed nonlinear solver

Definition at line 1026 of file equation_solver.cpp.

◆ buildPreconditioner()

std::unique_ptr< mfem::Solver > smith::buildPreconditioner ( LinearSolverOptions  linear_opts,
[[maybe_unused] ] MPI_Comm  comm = MPI_COMM_WORLD 
)

Build a preconditioner from the available options.

Parameters
linear_optsThe options to configure the linear solver and preconditioner
commThe communicator for the underlying operator and HypreParVectors
Returns
A constructed preconditioner based on the input option

Definition at line 1211 of file equation_solver.cpp.

◆ buildRectangleMesh()

mfem::Mesh smith::buildRectangleMesh ( int  elements_in_x,
int  elements_in_y,
double  size_x = 1.,
double  size_y = 1. 
)

Constructs a 2D MFEM mesh of a rectangle.

Parameters
[in]elements_in_xthe number of elements in the x-direction
[in]elements_in_ythe number of elements in the y-direction
[in]size_xOverall size in the x-direction
[in]size_yOverall size in the y-direction
Returns
The constructed serial mesh

Definition at line 150 of file mesh_utils.cpp.

◆ buildRingMesh()

mfem::Mesh smith::buildRingMesh ( int  radial_refinement,
double  inner_radius,
double  outer_radius,
double  total_angle = M_PI,
int  sectors = 8 
)

Constructs a 2D MFEM mesh of a ring.

Parameters
[in]radial_refinementthe number of times to apply uniform mesh refinement to the cross section
[in]inner_radiusinner radius the radius of the cylindrical shell
[in]outer_radiusouer radius the radius of the cylindrical shell
[in]total_anglethe angle in radians over which to generate the portion of an extruded cylinder
[in]sectorsthe number of starting sectors in the hollow cylinder
Returns
A unique_ptr containing the constructed mesh

Definition at line 353 of file mesh_utils.cpp.

◆ buildSolidMechanics()

template<int dim, typename ShapeDispSpace , typename VectorSpace , typename... ParamSpaces>
auto smith::buildSolidMechanics ( std::shared_ptr< smith::Mesh mesh,
std::shared_ptr< DifferentiableSolver d_solid_nonlinear_solver,
smith::ImplicitNewmarkSecondOrderTimeIntegrationRule  time_rule,
size_t  num_checkpoints,
std::string  physics_name,
const std::vector< std::string > &  param_names = {} 
)

Helper function to generate the base-physics for solid mechanics.

Template Parameters
ShapeDispSpaceSpace for shape displacement, must be H1<1, dim> in most cases
VectorSpaceSpace for displacement, velocity, acceleration field, typically H1<order, dim>
...ParamSpacesAdditional parameter spaces, either H1<param_order, param_dim> or L1<param_order, param_dim>
dimSpatial dimension
Parameters
meshsmith::Mesh
d_solid_nonlinear_solverAbstract differentiable solver
time_ruleTime integration rule for second order systems. Likely either quasi-static or implicit Newmark
num_checkpointsNumber of checkpointed states for gretl to store for reverse mode derivatives
physics_nameName of the physics/WeakForm
param_namesNames for the parameter fields with a one-to-one correspondence with the templated ParamSpaces
Returns
tuple of shared pointers to the: BasePhysics, WeakForm, and DirichetBoundaryConditions
Note
Only the BasePhysics needs to stay in scope. The others are returned to the user so they can define the WeakForm integrals, and to specify space and time varying boundary conditions

Definition at line 37 of file differentiable_solid_mechanics.hpp.

◆ buildType()

std::string smith::buildType ( )

Returns a string for the current CMake build type (e.g. Debug, Release)

Returns
string value of the build type

Definition at line 228 of file about.cpp.

◆ chain_rule() [1/7]

constexpr SMITH_HOST_DEVICE auto smith::chain_rule ( const double  df_dx,
const double  dx 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
for a scalar-valued function of a scalar, the chain rule is just multiplication

Definition at line 1877 of file tensor.hpp.

◆ chain_rule() [2/7]

template<typename T >
constexpr SMITH_HOST_DEVICE auto smith::chain_rule ( const  T,
const  zero 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
this overload implements a no-op for the case where the small change is indentically zero

Definition at line 1868 of file tensor.hpp.

◆ chain_rule() [3/7]

template<int m, int n, int... p>
SMITH_HOST_DEVICE auto smith::chain_rule ( const tensor< double, m, n, p... > &  df_dx,
const tensor< double, p... > &  dx 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
for a matrix-valued function of a tensor, the chain rule contracts over all indices of dx

Definition at line 1920 of file tensor.hpp.

◆ chain_rule() [4/7]

template<int m, int... n>
constexpr SMITH_HOST_DEVICE auto smith::chain_rule ( const tensor< double, m, n... > &  df_dx,
const tensor< double, n... > &  dx 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
for a vector-valued function of a tensor, the chain rule contracts over all indices of dx

Definition at line 1906 of file tensor.hpp.

◆ chain_rule() [5/7]

template<int... n>
constexpr SMITH_HOST_DEVICE auto smith::chain_rule ( const tensor< double, n... > &  df_dx,
const double  dx 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
for a tensor-valued function of a scalar, the chain rule is just scalar multiplication

Definition at line 1884 of file tensor.hpp.

◆ chain_rule() [6/7]

template<int... n>
constexpr SMITH_HOST_DEVICE auto smith::chain_rule ( const tensor< double, n... > &  df_dx,
const tensor< double, n... > &  dx 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
for a scalar-valued function of a tensor, the chain rule is the inner product

Definition at line 1894 of file tensor.hpp.

◆ chain_rule() [7/7]

template<typename T >
constexpr SMITH_HOST_DEVICE auto smith::chain_rule ( const  zero,
const  T 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
this overload implements a no-op for the case where the gradient w.r.t. an input argument is identically zero

Definition at line 1858 of file tensor.hpp.

◆ ChebyshevT()

template<int n, typename S >
constexpr SMITH_HOST_DEVICE tensor<S, n> smith::ChebyshevT ( x)
constexpr

Chebyshev polynomials of the first kind Satisfying: T_n(cos(t)) == cos(n*t)

Template Parameters
nhow many entries to compute
Parameters
[in]xwhere to evaluate the polynomials

Definition at line 407 of file polynomials.hpp.

◆ ChebyshevU()

template<int n, typename T >
SMITH_HOST_DEVICE tensor<T, n> smith::ChebyshevU ( x)

Chebyshev polynomials of the second kind Satisfying: sin(t) U_n(cos(t)) == sin((n+1)*t)

Template Parameters
nhow many entries to compute
Parameters
[in]xwhere to evaluate the polynomials

Definition at line 428 of file polynomials.hpp.

◆ chop()

template<int n>
constexpr SMITH_HOST_DEVICE auto smith::chop ( const tensor< double, n > &  A)
constexpr

replace all entries in a tensor satisfying |x| < 1.0e-10 by literal zero

Parameters
[in]AThe tensor to "chop"

Definition at line 1758 of file tensor.hpp.

◆ compiler()

std::string smith::compiler ( )

Returns a string for the current compiler name and version.

Returns
string value of the current compiler name and version

Definition at line 226 of file about.cpp.

◆ compute_geometric_factors()

template<int Q, mfem::Geometry::Type geom, typename function_space >
void smith::compute_geometric_factors ( mfem::Vector &  positions_q,
mfem::Vector &  jacobians_q,
const mfem::Vector &  positions_e,
const std::vector< int > &  elements 
)

a kernel to compute the positions and jacobians at each quadrature point (mfem calls this "geometric factors")

Template Parameters
Qa parameter controlling the number of quadrature points an element
function_spacethe polynomial order and kind of function space used to interpolate
geomthe element geometry
Parameters
positions_q(output) the positions for each quadrature point
jacobians_q(output) the jacobians for each quadrature point
positions_e(input) the "e-vector" of position data
elements(input) the list of element indices that are part of this domain

Definition at line 27 of file geometric_factors.cpp.

◆ computeL2Error() [1/2]

double smith::computeL2Error ( const FiniteElementState state,
mfem::Coefficient &  exact_solution 
)

Find the L2 norm of the error of a scalar-valued finite element state with respect to an exact solution.

Parameters
stateThe numerical solution
exact_solutionThe exact solution to measure error against
Returns
The L2 norm of the difference between state and exact_solution

Definition at line 122 of file finite_element_state.cpp.

◆ computeL2Error() [2/2]

double smith::computeL2Error ( const FiniteElementState state,
mfem::VectorCoefficient &  exact_solution 
)

Find the L2 norm of the error of a vector-valued finite element state with respect to an exact solution.

Parameters
stateThe numerical solution
exact_solutionThe exact solution to measure error against
Returns
The L2 norm of the difference between state and exact_solution

Definition at line 117 of file finite_element_state.cpp.

◆ contract()

template<int i1, int i2, typename S , int m, int... n, typename T , int p, int q>
SMITH_HOST_DEVICE auto smith::contract ( const tensor< S, m, n... > &  A,
const tensor< T, p, q > &  B 
)

a convenience function that computes a dot product between two tensor, but that allows the user to specify which indices should be summed over. For example:

tensor< double, 4, 4, 4 > A = ...;
tensor< double, 4, 4 > B = ...;
tensor< double, 4, 4, 4 > C = contract<1, 0>(A, B);
// sum over index 1 for A
// V
// C(i, j, k) = \sum_l A(i, l, j) * B(l, k)
// ^
// sum over index 0 for B
Template Parameters
i1the index of contraction for the left operand
i2the index of contraction for the right operand
Sthe datatype stored in the left operand
mleading dimension of the left operand
nthe trailing dimensions of the left operand
Tthe datatype stored in the right operand
pthe number of rows in the right operand
qthe number of columns in the right operand
Parameters
Athe left operand
Bthe right operand

Definition at line 1405 of file tensor.hpp.

◆ create_solid_weak_form()

template<int order, int dim, typename... ParameterSpaces>
auto smith::create_solid_weak_form ( const std::string &  physics_name,
std::shared_ptr< smith::Mesh mesh,
const std::vector< const smith::FiniteElementState * > &  states,
const std::vector< const smith::FiniteElementState * > &  params 
)

Utility function for creating a shared_ptr<SolidWeakForm<>>

Local enum to better document the expected indexing order to states

Definition at line 347 of file solid_weak_form.hpp.

◆ create_time_info()

TimeInfo smith::create_time_info ( DoubleState  t,
DoubleState  dt,
size_t  cycle 
)
inline

creates a time info struct from gretl::State<double>

Parameters
ttime
dttimestep
cycleiteration
Returns

Definition at line 50 of file state_advancer.hpp.

◆ defineInputFileSchema()

void smith::defineInputFileSchema ( axom::inlet::Inlet &  inlet)

Define the input file structure for the driver code.

Parameters
[in]inletThe inlet instance

Definition at line 43 of file smith.cpp.

◆ DenseIdentity()

template<int dim>
constexpr SMITH_HOST_DEVICE tensor<double, dim, dim> smith::DenseIdentity ( )
constexpr

Obtains the identity matrix of the specified dimension.

Returns
I_dim

Definition at line 1259 of file tensor.hpp.

◆ det() [1/2]

template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::det ( const isotropic_tensor< T, m, m > &  I)
constexpr

compute the determinant of an isotropic tensor

Template Parameters
Tthe types stored in the isotropic tensor
mthe number of rows and columns in I
Parameters
Ithe isotropic tensor to compute the determinant of

Definition at line 311 of file isotropic_tensor.hpp.

◆ det() [2/2]

template<typename T >
constexpr SMITH_HOST_DEVICE auto smith::det ( const tensor< T, 2, 2 > &  A)
constexpr

Returns the determinant of a matrix.

Parameters
[in]AThe matrix to obtain the determinant of

Definition at line 1302 of file tensor.hpp.

◆ detApIm1()

template<typename T >
constexpr SMITH_HOST_DEVICE auto smith::detApIm1 ( const tensor< T, 2, 2 > &  A)
constexpr

computes det(A + I) - 1, where precision is not lost when the entries A_{ij} << 1

detApIm1(A) = det(A + I) - 1 When the entries of A are small compared to unity, computing det(A + I) - 1 directly will suffer from catastrophic cancellation.

Parameters
AInput matrix
Returns
det(A + I) - 1, where I is the identity matrix

Definition at line 1326 of file tensor.hpp.

◆ dev()

template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto smith::dev ( const tensor< T, n, n > &  A)
constexpr

Calculates the deviator of a matrix (rank-2 tensor)

Parameters
[in]AThe matrix to calculate the deviator of In the context of stress tensors, the deviator is obtained by subtracting the mean stress (average of main diagonal elements) from each element on the main diagonal

Definition at line 1200 of file tensor.hpp.

◆ diag() [1/2]

template<typename T , int n>
constexpr SMITH_HOST_DEVICE tensor<T, n, n> smith::diag ( const tensor< T, n > &  d)
constexpr

Returns a square diagonal matrix by specifying the diagonal entries.

Parameters
[in]da list of diagonal entries

Definition at line 1231 of file tensor.hpp.

◆ diag() [2/2]

template<typename T , int n>
constexpr SMITH_HOST_DEVICE tensor<T, n> smith::diag ( const tensor< T, n, n > &  D)
constexpr

Returns an array containing the diagonal entries of a square matrix.

Parameters
[in]Dthe matrix to extract the diagonal entries from

Definition at line 1245 of file tensor.hpp.

◆ diagonal_matrix()

template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto smith::diagonal_matrix ( const tensor< T, n, n > &  A)
constexpr

Returns a square matrix (rank-2 tensor) containing the diagonal entries of the input square matrix with zeros in the off-diagonal positions.

Parameters
[in]AThe input square matrix This operation is used to compute a term in the constitutive response of a linear, cubic solid material

Definition at line 1217 of file tensor.hpp.

◆ differentiate_wrt()

auto smith::differentiate_wrt ( const mfem::Vector &  v)
inline

this function is intended to only be used in combination with smith::Functional::operator(), as a way for the user to express that it should both evaluate and differentiate w.r.t. a specific argument (only 1 argument at a time)

For example:

mfem::Vector arg0 = ...;
mfem::Vector arg1 = ...;
mfem::Vector just_the_value = my_functional(arg0, arg1);
auto [value, gradient_wrt_arg1] = my_functional(arg0, differentiate_wrt(arg1));
auto differentiate_wrt(const mfem::Vector &v)
this function is intended to only be used in combination with smith::Functional::operator(),...

Definition at line 41 of file differentiate_wrt.hpp.

◆ dimension()

template<int i, typename T , int... n>
constexpr SMITH_HOST_DEVICE int smith::dimension ( const tensor< T, n... > &  )
constexpr

a function for querying the ith dimension of a tensor

Template Parameters
iwhich dimension to query
Tthe datatype stored in the tensor
nthe tensor extents
Returns
the ith dimension

Definition at line 1962 of file tensor.hpp.

◆ dimension_of()

constexpr int smith::dimension_of ( mfem::Geometry::Type  g)
constexpr

Returns the dimension of an element geometry.

Parameters
[in]gThe Geometry to retrieve the dimension of

Definition at line 55 of file geometry.hpp.

◆ div_helper() [1/3]

template<typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto smith::div_helper ( const double  a,
const tuple< T... > &  x,
std::integer_sequence< int, i... >   
)
constexpr

A helper function for the / operator of tuples.

Template Parameters
Tthe types stored in the tuple y
iThe integer sequence to i
Parameters
xtuple of values
athe constant numerator
Returns
the returned tuple ratio

Definition at line 596 of file tuple.hpp.

◆ div_helper() [2/3]

template<typename... S, typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto smith::div_helper ( const tuple< S... > &  x,
const tuple< T... > &  y,
std::integer_sequence< int, i... >   
)
constexpr

A helper function for the / operator of tuples.

Template Parameters
Sthe types stored in the tuple x
Tthe types stored in the tuple y
iThe integer sequence to i
Parameters
xtuple of values
ytuple of values
Returns
the returned tuple ratio

Definition at line 566 of file tuple.hpp.

◆ div_helper() [3/3]

template<typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto smith::div_helper ( const tuple< T... > &  x,
const double  a,
std::integer_sequence< int, i... >   
)
constexpr

A helper function for the / operator of tuples.

Template Parameters
Tthe types stored in the tuple y
iThe integer sequence to i
Parameters
xtuple of values
athe constant denomenator
Returns
the returned tuple ratio

Definition at line 611 of file tuple.hpp.

◆ dot() [1/13]

template<typename S , typename T , int m, int... n>
constexpr SMITH_HOST_DEVICE auto smith::dot ( const isotropic_tensor< S, m, m > &  I,
const tensor< T, m, n... > &  A 
)
constexpr

dot product between an isotropic and (nonisotropic) tensor

Template Parameters
Sthe types stored in isotropic tensor
Tthe types stored in tensor
mthe number of rows and columns in I
nthe trailing dimensions of A
Parameters
Ithe left operand
Athe (full) right operand
Returns
a new tensor equal to the index notation expression: output(i,...) := I(i,j) * A(j,...)

Definition at line 203 of file isotropic_tensor.hpp.

◆ dot() [2/13]

template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::dot ( const tensor< S, m > &  A,
const tensor< T, m > &  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
vector . vector

Definition at line 806 of file tensor.hpp.

◆ dot() [3/13]

template<typename S , typename T , int m, int n>
constexpr SMITH_HOST_DEVICE auto smith::dot ( const tensor< S, m > &  A,
const tensor< T, m, n > &  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
vector . matrix

Definition at line 820 of file tensor.hpp.

◆ dot() [4/13]

template<typename S , typename T , int m, int n, int p>
constexpr SMITH_HOST_DEVICE auto smith::dot ( const tensor< S, m > &  A,
const tensor< T, m, n, p > &  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
vector . tensor3D

Definition at line 836 of file tensor.hpp.

◆ dot() [5/13]

template<typename S , typename T , int m, int n, int p, int q>
constexpr SMITH_HOST_DEVICE auto smith::dot ( const tensor< S, m > &  A,
const tensor< T, m, n, p, q > &  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
vector . tensor4D

this overload, and others of the form dot(vector, tensor), can be implemented more succinctly as a single variadic function, but for some reason gcc-11 (but not gcc-10 or gcc-12) seemed to break when compiling that compact implementation, so we're manually writing out some of the different dot product overloads in order to support that compiler and version

Definition at line 856 of file tensor.hpp.

◆ dot() [6/13]

template<typename S , typename T , typename U , int m, int n>
constexpr SMITH_HOST_DEVICE auto smith::dot ( const tensor< S, m > &  u,
const tensor< T, m, n > &  A,
const tensor< U, n > &  v 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
vector . matrix . vector

Definition at line 936 of file tensor.hpp.

◆ dot() [7/13]

template<typename S , typename T , int m, int n>
constexpr SMITH_HOST_DEVICE auto smith::dot ( const tensor< S, m, n > &  A,
const tensor< T, n > &  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
matrix . vector

Definition at line 870 of file tensor.hpp.

◆ dot() [8/13]

template<typename S , typename T , int m, int n, int p>
constexpr SMITH_HOST_DEVICE auto smith::dot ( const tensor< S, m, n > &  A,
const tensor< T, n, p > &  B 
)
constexpr

this function contracts over the "middle" index of the two tensor arguments

Template Parameters
Sthe underlying type of the tensor (lefthand) argument
Tthe underlying type of the tensor (righthand) argument
nintegers describing the tensor shape
Parameters
[in]AThe lefthand tensor
[in]BThe righthand tensor

Definition at line 768 of file tensor.hpp.

◆ dot() [9/13]

template<typename S , typename T , int m, int n, int p, int q>
constexpr SMITH_HOST_DEVICE auto smith::dot ( const tensor< S, m, n > &  A,
const tensor< T, n, p, q > &  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
matrix . tensor

Definition at line 902 of file tensor.hpp.

◆ dot() [10/13]

template<typename S , typename T , int m, int n, int p, int q, int r>
constexpr SMITH_HOST_DEVICE auto smith::dot ( const tensor< S, m, n > &  A,
const tensor< T, n, p, q, r > &  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
matrix . tensor

Definition at line 886 of file tensor.hpp.

◆ dot() [11/13]

template<typename S , typename T , int m, int n, int p>
constexpr SMITH_HOST_DEVICE auto smith::dot ( const tensor< S, m, n, p > &  A,
const tensor< T, p > &  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
3rd-order-tensor . vector

Definition at line 918 of file tensor.hpp.

◆ dot() [12/13]

template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::dot ( const tensor< T, m > &  A,
double  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
vector . scalar

Definition at line 786 of file tensor.hpp.

◆ dot() [13/13]

template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::dot ( double  B,
const tensor< T, m > &  A 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
scalar * vector

Definition at line 796 of file tensor.hpp.

◆ double_dot() [1/5]

template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::double_dot ( const isotropic_tensor< S, m, m > &  I,
const tensor< T, m, m > &  A 
)
constexpr

double-dot product between an isotropic and (nonisotropic) tensor

Template Parameters
Sthe types stored in isotropic tensor
Tthe types stored in tensor
mthe number of rows and columns in I, A
Parameters
Ithe left operand
Athe (full) right operand
Returns
a new tensor equal to the index notation expression: output := I(i,j) * A(i,j) \(\propto\) tr(A)

Definition at line 229 of file isotropic_tensor.hpp.

◆ double_dot() [2/5]

template<typename S , typename T , int m, int... n>
constexpr SMITH_HOST_DEVICE auto smith::double_dot ( const isotropic_tensor< S, m, m, m, m > &  I,
const tensor< T, m, m, n... > &  A 
)
constexpr

double-dot product between an isotropic and (nonisotropic) tensor

Template Parameters
Sthe types stored in isotropic tensor
Tthe types stored in tensor
mthe dimension of each extent of I
Parameters
Ithe left operand
Athe (full) right operand
Returns
a new tensor equal to the index notation expression: output(...) := I(i,j) * A(i,j,...)

Definition at line 466 of file isotropic_tensor.hpp.

◆ double_dot() [3/5]

template<typename S , typename T , int m, int n>
constexpr auto smith::double_dot ( const tensor< S, m, n > &  A,
const tensor< T, m, n > &  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
2nd-order-tensor : 2nd-order-tensor, like inner()

Definition at line 1044 of file tensor.hpp.

◆ double_dot() [4/5]

template<typename S , typename T , int m, int n, int p>
constexpr SMITH_HOST_DEVICE auto smith::double_dot ( const tensor< S, m, n, p > &  A,
const tensor< T, n, p > &  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
3rd-order-tensor : 2nd-order-tensor

Definition at line 1026 of file tensor.hpp.

◆ double_dot() [5/5]

template<typename S , typename T , int m, int n, int p, int q>
constexpr SMITH_HOST_DEVICE auto smith::double_dot ( const tensor< S, m, n, p, q > &  A,
const tensor< T, p, q > &  B 
)
constexpr

double dot product, contracting over the two "middle" indices

Template Parameters
Sthe underlying type of the tensor (lefthand) argument
Tthe underlying type of the tensor (righthand) argument
mfirst dimension of A
nsecond dimension of A
pthird dimension of A, first dimensions of B
qfourth dimension of A, second dimensions of B
Parameters
[in]AThe lefthand tensor
[in]BThe righthand tensor

Definition at line 1006 of file tensor.hpp.

◆ dual()

template<typename T >
smith::dual ( double  ,
 
) -> dual< T >

class template argument deduction guide for type dual.

Note
this lets users write
dual something{my_value, my_gradient};
dual(double, T) -> dual< T >
class template argument deduction guide for type dual.
instead of explicitly writing the template parameter
dual< decltype(my_gradient) > something{my_value, my_gradient};

◆ eig_symm()

SMITH_HOST_DEVICE tuple<vec3, mat3> smith::eig_symm ( const mat3 A)
inline

Eigendecomposition for a symmetric 3x3 matrix

Parameters
AMatrix for which the eigendecomposition will be computed. Must be symmetric, this is not checked.
Returns
tuple with the eigenvalues in the first element, and the matrix of eigenvectors (columnwise) in the second element.
Note
based on "A robust algorithm for finding the eigenvalues and eigenvectors of 3x3 symmetric matrices", by Scherzinger & Dohrmann

Definition at line 807 of file tuple_tensor_dual_functions.hpp.

◆ eigenvalues()

template<typename T , int size>
auto smith::eigenvalues ( const smith::tensor< T, size, size > &  A)

compute the eigenvalues of a symmetric matrix A

Template Parameters
Teither double or a smith::dual type
sizethe dimensions of the matrix
Parameters
Athe matrix
Returns
a vector of the eigenvalues of A (and their derivatives, if A contains dual numbers)

Definition at line 727 of file tuple_tensor_dual_functions.hpp.

◆ elements_per_block()

template<mfem::Geometry::Type g>
constexpr SMITH_HOST_DEVICE int smith::elements_per_block ( int  q)
constexpr

this function returns information about how many elements should be processed by a single thread block in CUDA (note: the optimal values are hardware and problem specific, but these values are still significantly faster than naively allocating only 1 element / block)

Template Parameters
gthe element geometry
Parameters
qthe number of quadrature points per dimension
Returns
how many elements each thread block should process

Definition at line 140 of file finite_element.hpp.

◆ exp_symm()

template<typename T >
auto smith::exp_symm ( tensor< T, 3, 3 >  A)

Exponential of a symmetric matrix.

Parameters
AMatrix to operate on. Must be symmetric. This is not checked.
Returns
Exponential mapping of A.

Definition at line 1033 of file tuple_tensor_dual_functions.hpp.

◆ factorial()

constexpr SMITH_HOST_DEVICE int smith::factorial ( int  n)
constexpr

compute n!

Parameters
[in]n

Definition at line 374 of file polynomials.hpp.

◆ factorize_lu()

template<typename T , int n>
constexpr SMITH_HOST_DEVICE LuFactorization<T, n> smith::factorize_lu ( const tensor< T, n, n > &  A)
constexpr

Compute LU factorization of a matrix with partial pivoting.

The convention followed is to place ones on the diagonal of the lower triangular factor.

Parameters
[in]AThe matrix to factorize
Returns
An LuFactorization object
See also
LuFactorization

Definition at line 364 of file tuple_tensor_dual_functions.hpp.

◆ find_root()

template<typename function , int n>
auto smith::find_root ( const function &  f,
tensor< double, n >  x0 
)

Finds a root of a vector-valued nonlinear function.

Uses Newton-Raphson iteration.

Template Parameters
functionType for the functor object
nVector dimension of the equation
Parameters
fA callable representing the function of which a root is sought. Must take an n-vector argument and return an n-vector
x0Initial guess for root. Must be an n-vector.
Returns
A root of f.

Definition at line 697 of file tuple_tensor_dual_functions.hpp.

◆ findDomainDofsOnNeighborRanks()

void smith::findDomainDofsOnNeighborRanks ( const smith::fes_t *  fes,
mfem::Array< int > &  local_dof_ids 
)

Get local dofs that are part of a domain, but are owned by a neighboring MPI rank.

This is necessary for situations like this: Mesh before parallel partition: 3 -----— 2 | /| | / | | / | | / | <– Edge we want in Domain | / | | / | | / | |/ | Node 0 -----— 1

Possible mesh after partition into two ranks:

RANK 0 RANK 1

3 -----— 2 2 o | / /| | / / | | / / | | / / | <– Edge we want in Domain | / / | | / / | | / / | |/ / | 0 * 0 o-----—* 1

*: locally owned node o: node owned by a neighbor rank

We create a domain containing the right vertical edge, and then ask for its local dofs. The dof list returned for Rank 1 will be correct, containing the local indices for nodes 1 and 2. However, the dof list on rank 0 will not be correct without parallel communication. It will see that it doesn't own the edge in question, so when it then goes to fetch the local dofs on the domain, it will be an empty list.

This function corrects for that, flagging the dofs we want on the domain on each rank (using the local_dof_ids list), and then exchanging this info with neighboring ranks, so that rank 0 will be told that its local dof for node 2 should be added to the list of dofs on the domain.

Before findDomainDofsOnNeighborRanks(): dof list on Rank 0: {} dof list on Rank 1: {1, 2}

After: dof list on Rank 0: {2} dof list on Rank 1: {1, 2}

Note: the sets will actually contain the ldof indices corresponding to the global (tdof) indices in the sets above.

This function operates on the local_dof_ids data in place.

Definition at line 436 of file domain.cpp.

◆ fit()

template<int dim, typename signature , int... n, typename func , typename... T>
FiniteElementState smith::fit ( func  f,
mfem::ParMesh &  pmesh,
const T &...  solution_fields 
)

determine field parameters to approximate the output of a user-provided q-function

Parameters
[in]fthe user-provided function to approximate
[in]pmeshthe region over which to approximate the function f
[in]solution_fields[optional] any auxiliary field quantities needed to evaluate f
Note
: mesh is passed by non-const ref because mfem mutates the mesh when creating ParGridFunctions

Definition at line 76 of file fit.hpp.

◆ gather()

template<int d>
std::vector<tensor<double, d> > smith::gather ( const mfem::Vector &  coordinates,
mfem::Array< int >  ids 
)

gather vertex coordinates for a list of vertices

Parameters
coordinatesmfem's 1D list of vertex coordinates
idsthe list of vertex indices to gather

Definition at line 47 of file domain.cpp.

◆ GaussLegendreInterpolation()

template<int n, typename T >
constexpr SMITH_HOST_DEVICE tensor<T, n> smith::GaussLegendreInterpolation ( [[maybe_unused] ] T  x)
constexpr

Lagrange Interpolating polynomials for nodes at Gauss-Legendre points on the interval [0, 1].

Do[xi = GaussianQuadratureWeights[n, 0, 1, 30][[All, 1]]; Print["if constexpr (n == " <> ToString[n] <> ") return " <> ToString[CForm /@ HornerForm /@ (InterpolatingPolynomial[Transpose[{xi, #}], x] & /@ IdentityMatrix[n])] <> ";"], {n, 1, 4} ]

note: the quadratic (n == 2) and cubic (n == 3) versions of this function only satisfied the kronecker delta property to an error of ~1.0e-13 and keeping more than 16 significant figures seems to help bring that error down to machine epsilon again.

Template Parameters
nhow many entries to compute
Parameters
[in]xwhere to evaluate the polynomials

Definition at line 558 of file polynomials.hpp.

◆ GaussLegendreInterpolationDerivative()

template<int n, typename T >
constexpr SMITH_HOST_DEVICE tensor<T, n> smith::GaussLegendreInterpolationDerivative ( [[maybe_unused] ] T  x)
constexpr

Derivatives of the Lagrange Interpolating polynomials for nodes at Gauss-Legendre points on the interval [-1, 1].

Mathematica/Wolfram Language code to generate more entries in the table: Do[xi = GaussianQuadratureWeights[n, 0, 1, 30][[All, 1]]; Print["if constexpr (n == " <> ToString[n] <> ") return " <> ToString[CForm /@ HornerForm /@ (D[InterpolatingPolynomial[Transpose[{xi, #}], x], x] & /@ IdentityMatrix[n])] <> ";"], {n, 1, 4} ]

Template Parameters
nhow many entries to compute
Parameters
[in]xwhere to evaluate the polynomials

Definition at line 595 of file polynomials.hpp.

◆ GaussLegendreNodes()

template<int n, mfem::Geometry::Type geom>
constexpr SMITH_HOST_DEVICE auto smith::GaussLegendreNodes ( )
constexpr

The positions of Gauss-Legendre points for different geometries.

Template Parameters
nThe number of points per dimension

Mathematica/Wolfram Language code to generate the 1D entries in the table: Do[Print["if constexpr (n == " <> ToString[n] <> ") return " <> ToString[GaussianQuadratureWeights[n, 0, 1, 17][[All, 1]]] <> ";"], {n, 1, 8}]

Definition at line 43 of file polynomials.hpp.

◆ GaussLegendreWeights()

template<int n, mfem::Geometry::Type geom>
constexpr SMITH_HOST_DEVICE auto smith::GaussLegendreWeights ( )
constexpr

The weights associated with each Gauss-Legendre point.

Template Parameters
nThe number of points

Mathematica/Wolfram Language code to generate more entries in the table: Do[Print["if constexpr (n == " <> ToString[n] <> ") return " <> ToString[GaussianQuadratureWeights[n, 0, 1, 17][[All, 2]]] <> ";"], {n, 1, 8}]

Definition at line 272 of file polynomials.hpp.

◆ GaussLobattoInterpolation()

template<int n, typename T >
constexpr SMITH_HOST_DEVICE tensor<T, n> smith::GaussLobattoInterpolation ( [[maybe_unused] ] T  x)
constexpr

Lagrange Interpolating polynomials for nodes at Gauss-Lobatto points on the interval [0, 1].

Template Parameters
nhow many entries to compute
Parameters
[in]xwhere to evaluate the polynomials

Definition at line 494 of file polynomials.hpp.

◆ GaussLobattoInterpolationDerivative()

template<int n, typename T >
constexpr SMITH_HOST_DEVICE tensor<T, n> smith::GaussLobattoInterpolationDerivative ( [[maybe_unused] ] T  x)
constexpr

Derivatives of the Lagrange Interpolating polynomials for nodes at Gauss-Lobatto points on the interval [0, 1].

Template Parameters
nhow many entries to compute
Parameters
[in]xwhere to evaluate the polynomials

Definition at line 521 of file polynomials.hpp.

◆ GaussLobattoNodes()

template<int n, typename T = double>
constexpr SMITH_HOST_DEVICE tensor<T, n> smith::GaussLobattoNodes ( a = T(0),
b = T(1) 
)
constexpr

The positions (in 1D space) of Gauss-Lobatto points.

Template Parameters
nThe number of points
Parameters
[in]aThe left endpoint of the interval
[in]bThe right endpoint of the interval

Definition at line 28 of file polynomials.hpp.

◆ GaussQuadratureRule()

template<mfem::Geometry::Type g, int Q>
constexpr SMITH_HOST_DEVICE auto smith::GaussQuadratureRule ( )
constexpr

Returns the Gauss-Legendre quadrature rule for an element and order.

Template Parameters
Theshape of the element to produce a quadrature rule for
Qthe number of quadrature points per dimension

Definition at line 45 of file quadrature.hpp.

◆ generate_bdr_kernels()

template<mfem::Geometry::Type geom, int Q, typename test , typename... trials, typename lambda_type >
void smith::generate_bdr_kernels ( FunctionSignature< test(trials...)>  s,
Integral integral,
const lambda_type &  qf 
)

function to generate kernels held by an Integral object of type "BoundaryDomain", with a specific element type

Template Parameters
geomthe element geometry
Qa parameter that controls the number of quadrature points
testthe kind of test functions used in the integral
trialsthe trial space(s) of the integral's inputs
lambda_typea callable object that implements the q-function concept
Parameters
san object used to pass around test/trial information
integralthe Integral object to initialize
qfthe quadrature function

Definition at line 290 of file integral.hpp.

◆ generate_interior_face_kernels()

template<mfem::Geometry::Type geom, int Q, typename test , typename... trials, typename lambda_type >
void smith::generate_interior_face_kernels ( FunctionSignature< test(trials...)>  s,
Integral integral,
const lambda_type &  qf 
)

function to generate kernels held by an Integral object of type "InteriorFaceDomain", with a specific element type

Template Parameters
geomthe element geometry
Qa parameter that controls the number of quadrature points
testthe kind of test functions used in the integral
trialsthe trial space(s) of the integral's inputs
lambda_typea callable object that implements the q-function concept
Parameters
san object used to pass around test/trial information
integralthe Integral object to initialize
qfthe quadrature function

Definition at line 376 of file integral.hpp.

◆ generate_kernels()

template<mfem::Geometry::Type geom, int Q, typename test , typename... trials, typename lambda_type , typename qpt_data_type >
void smith::generate_kernels ( FunctionSignature< test(trials...)>  s,
Integral integral,
const lambda_type &  qf,
std::shared_ptr< QuadratureData< qpt_data_type > >  qdata 
)

function to generate kernels held by an Integral object of type "Domain", with a specific element type

Template Parameters
geomthe element geometry
Qa parameter that controls the number of quadrature points
testthe kind of test functions used in the integral
trialsthe trial space(s) of the integral's inputs
lambda_typea callable object that implements the q-function concept
qpt_data_typeany quadrature point data needed by the material model
Parameters
san object used to pass around test/trial information
integralthe Integral object to initialize
qfthe quadrature function
qdatathe values of any quadrature point data for the material

Definition at line 202 of file integral.hpp.

◆ generateParFiniteElementSpace()

template<typename function_space >
std::pair<std::unique_ptr<mfem::ParFiniteElementSpace>, std::unique_ptr<mfem::FiniteElementCollection> > smith::generateParFiniteElementSpace ( mfem::ParMesh *  mesh)
inline

create an mfem::ParFiniteElementSpace from one of Smith's tag types: H1, Hcurl, L2

Template Parameters
function_spacea tag type containing the kind of function space and polynomial order
Parameters
meshthe mesh on which the space is defined
Returns
a pair containing the new finite element space and associated finite element collection

Definition at line 113 of file functional.hpp.

◆ geometry_counts() [1/2]

std::array<uint32_t, mfem::Geometry::NUM_GEOMETRIES> smith::geometry_counts ( const Domain domain)
inline

count the number of elements of each geometry in a domain

Parameters
domainthe domain to count

Definition at line 312 of file domain.hpp.

◆ geometry_counts() [2/2]

std::array<uint32_t, mfem::Geometry::NUM_GEOMETRIES> smith::geometry_counts ( const mfem::Mesh &  mesh)
inline

count the number of elements of each geometry in a mesh

Parameters
meshthe mesh to count

Definition at line 76 of file geometry.hpp.

◆ get() [1/3]

template<int i, typename... T>
constexpr SMITH_HOST_DEVICE const auto& smith::get ( const tuple< T... > &  values)
constexpr

return a copy of the ith tuple entry

Template Parameters
ithe tuple index to access
Tthe types stored in the tuple

Definition at line 327 of file tuple.hpp.

◆ get() [2/3]

template<int i, typename... T>
constexpr SMITH_HOST_DEVICE auto& smith::get ( tuple< T... > &  values)
constexpr

return a reference to the ith tuple entry

Template Parameters
ithe tuple index to access
Tthe types stored in the tuple

Definition at line 283 of file tuple.hpp.

◆ get() [3/3]

template<typename T , typename T0 , typename T1 >
constexpr T& smith::get ( variant< T0, T1 > &  v)
constexpr

Returns the variant member of specified type.

Returns the variant member at the provided index.

Template Parameters
TThe type of the element to retrieve
T0The first member type of the variant
T1The second member type of the variant
Parameters
[in]vThe variant to return the element of
See also
std::variant::get
Precondition
T must be either T0 or T1
Note
If T == T0 == T1, the element at index 0 will be returned

Definition at line 338 of file variant.hpp.

◆ get_gradient() [1/4]

template<int... n>
constexpr SMITH_HOST_DEVICE auto smith::get_gradient ( const tensor< double, n... > &  )
constexpr

get the gradient of type tensor (note: since its stored type is not a dual number, the derivative term is identically zero)

Returns
The sentinel,
See also
zero

Definition at line 1843 of file tensor.hpp.

◆ get_gradient() [2/4]

template<int... n>
constexpr SMITH_HOST_DEVICE auto smith::get_gradient ( const tensor< dual< double >, n... > &  arg)
constexpr

Retrieves a gradient tensor from a tensor of dual numbers.

Parameters
[in]argThe tensor of dual numbers

Definition at line 511 of file tuple_tensor_dual_functions.hpp.

◆ get_gradient() [3/4]

SMITH_HOST_DEVICE auto smith::get_gradient ( double  )
inline

Retrieves the gradient component of a double (which is nothing)

Returns
The sentinel,
See also
zero

Definition at line 1835 of file tensor.hpp.

◆ get_gradient() [4/4]

template<typename... T>
SMITH_HOST_DEVICE auto smith::get_gradient ( dual< smith::tuple< T... >>  arg)

Retrieves the gradient components of a set of dual numbers.

Parameters
[in]argThe set of numbers to retrieve gradients from

Definition at line 315 of file tuple_tensor_dual_functions.hpp.

◆ get_if()

template<typename T , typename T0 , typename T1 >
T* smith::get_if ( variant< T0, T1 > *  v)

Returns the member of requested type if it's active, otherwise nullptr.

Template Parameters
TThe type to check for
Parameters
[in]vThe variant to check/retrieve from
See also
std::get_if

Definition at line 398 of file variant.hpp.

◆ get_value() [1/3]

template<typename... T>
SMITH_HOST_DEVICE auto smith::get_value ( const smith::tuple< T... > &  tuple_of_values)

Retrieves the value components of a set of (possibly dual) numbers.

Parameters
[in]tuple_of_valuesThe tuple of numbers to retrieve values from
Precondition
The tuple must contain only scalars or tensors of dual numbers or doubles

Definition at line 304 of file tuple_tensor_dual_functions.hpp.

◆ get_value() [2/3]

template<typename T , int... n>
SMITH_HOST_DEVICE auto smith::get_value ( const tensor< dual< T >, n... > &  arg)

Retrieves a value tensor from a tensor of dual numbers.

Parameters
[in]argThe tensor of dual numbers

Definition at line 499 of file tuple_tensor_dual_functions.hpp.

◆ get_value() [3/3]

template<typename T1 , typename T2 , int n>
SMITH_HOST_DEVICE auto smith::get_value ( const tensor< tuple< T1, T2 >, n > &  input)

Extracts all of the values from a tensor of dual numbers.

Template Parameters
T1the first type of the tuple stored in the tensor
T2the second type of the tuple stored in the tensor
nthe number of entries in the input argument
Parameters
[in]inputThe tensor of dual numbers
Returns
the tensor of all of the values

Definition at line 289 of file tuple_tensor_dual_functions.hpp.

◆ getMPIInfo()

std::pair< int, int > smith::getMPIInfo ( MPI_Comm  comm = MPI_COMM_WORLD)

Get MPI Info.

Returns
std::pair<int, int> Pair containing the number of MPI processes and ranks

Definition at line 237 of file about.cpp.

◆ getSpaces()

std::vector<const mfem::ParFiniteElementSpace*> smith::getSpaces ( const std::vector< smith::FiniteElementState > &  states)
inline

Helper function to construct vector of spaces from an existing vector of FiniteElementState.

Parameters
statesvector of FiniteElementState

Definition at line 447 of file functional_weak_form.hpp.

◆ gitSHA()

std::string smith::gitSHA ( )

Returns a string for the Git SHA when the driver was built.

Note: This will not update unless you reconfigure CMake after a commit.

Returns
string value of the Git SHA if built in a Git repo, empty if not

Definition at line 192 of file about.cpp.

◆ holds_alternative()

template<typename T , typename T0 , typename T1 >
bool smith::holds_alternative ( const variant< T0, T1 > &  v)

Checks whether a variant's active member is of a certain type.

Template Parameters
TThe type to check for
Parameters
[in]vThe variant to check
See also
std::holds_alternative

Definition at line 381 of file variant.hpp.

◆ I2()

template<typename T >
constexpr SMITH_HOST_DEVICE auto smith::I2 ( const tensor< T, 3, 3 > &  A)
constexpr

Returns the second invariant of a 3x3 matrix.

Parameters
[in]AThe matrix

Definition at line 1291 of file tensor.hpp.

◆ Identity()

template<int m>
constexpr SMITH_HOST_DEVICE isotropic_tensor<double, m, m> smith::Identity ( )
constexpr

return the identity matrix of the specified size

Template Parameters
mthe number of rows and columns

Definition at line 61 of file isotropic_tensor.hpp.

◆ index_of_differentiation()

template<typename... T>
constexpr uint32_t smith::index_of_differentiation ( )
constexpr

given a list of types, this function returns the index that corresponds to the type dual_vector.

Template Parameters
Ta list of types, containing at most 1 differentiate_wrt_this

e.g.

static_assert(index_of_dual_vector < foo, bar, differentiate_wrt_this, baz, qux >() == 2);

Definition at line 59 of file functional.hpp.

◆ inner() [1/12]

template<typename S , typename T >
constexpr SMITH_HOST_DEVICE auto smith::inner ( const dual< S > &  A,
const dual< T > &  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
for zeroth-order tensors (scalars)

Definition at line 281 of file dual.hpp.

◆ inner() [2/12]

template<typename S >
constexpr SMITH_HOST_DEVICE auto smith::inner ( const dual< S > &  A,
double  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
for zeroth-order tensors (scalars)

Definition at line 301 of file dual.hpp.

◆ inner() [3/12]

template<typename S , int m>
constexpr SMITH_HOST_DEVICE auto smith::inner ( const tensor< S, m > &  ,
zero   
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
for first order tensors (vectors)

Definition at line 720 of file tensor.hpp.

◆ inner() [4/12]

template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::inner ( const tensor< S, m > &  A,
const tensor< T, m > &  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
for first order tensors (vectors)

Definition at line 688 of file tensor.hpp.

◆ inner() [5/12]

template<typename S , int m, int n>
constexpr SMITH_HOST_DEVICE auto smith::inner ( const tensor< S, m, n > &  ,
zero   
)
constexpr

this function contracts over all indices of the two tensor arguments

Template Parameters
Sthe underlying type of the tensor (lefthand) argument
mthe number of rows
nthe number of columns

Definition at line 710 of file tensor.hpp.

◆ inner() [6/12]

template<typename S , typename T , int m, int n>
constexpr SMITH_HOST_DEVICE auto smith::inner ( const tensor< S, m, n > &  A,
const tensor< T, m, n > &  B 
)
constexpr

this function contracts over all indices of the two tensor arguments

Template Parameters
Sthe underlying type of the tensor (lefthand) argument
Tthe underlying type of the tensor (righthand) argument
mthe number of rows
nthe number of columns
Parameters
[in]AThe lefthand tensor
[in]BThe righthand tensor

Definition at line 672 of file tensor.hpp.

◆ inner() [7/12]

template<typename T >
constexpr SMITH_HOST_DEVICE auto smith::inner ( double  A,
const dual< T > &  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
for zeroth-order tensors (scalars)

Definition at line 291 of file dual.hpp.

◆ inner() [8/12]

constexpr SMITH_HOST_DEVICE auto smith::inner ( double  A,
double  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
for zeroth-order tensors (scalars)

Definition at line 701 of file tensor.hpp.

◆ inner() [9/12]

constexpr SMITH_HOST_DEVICE auto smith::inner ( double  ,
zero   
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
for zeroth-order tensors (scalars)

Definition at line 729 of file tensor.hpp.

◆ inner() [10/12]

template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::inner ( zero  ,
const tensor< T, m > &   
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
for first order tensors (vectors)

Definition at line 748 of file tensor.hpp.

◆ inner() [11/12]

template<typename T , int m, int n>
constexpr SMITH_HOST_DEVICE auto smith::inner ( zero  ,
const tensor< T, m, n > &   
)
constexpr

this function contracts over all indices of the two tensor arguments

Template Parameters
Tthe underlying type of the tensor (righthand) argument
mthe number of rows
nthe number of columns

Definition at line 738 of file tensor.hpp.

◆ inner() [12/12]

constexpr SMITH_HOST_DEVICE auto smith::inner ( zero  ,
double   
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
for zeroth-order tensors (scalars)

Definition at line 757 of file tensor.hpp.

◆ innerProduct()

double smith::innerProduct ( const FiniteElementVector vec1,
const FiniteElementVector vec2 
)

Find the inner prodcut between two finite element vectors across all dofs.

Parameters
vec1The first vector
vec2The second vector
Returns
The inner prodcut between finite element vectors

Definition at line 144 of file finite_element_vector.cpp.

◆ inv() [1/5]

template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::inv ( const isotropic_tensor< T, m, m > &  I)
constexpr

return the inverse of an isotropic tensor

Template Parameters
Tthe types stored in the isotropic tensor
mthe number of rows and columns in I
Parameters
Ithe isotropic tensor to compute the inverse of
Returns
the inverse of I

Definition at line 298 of file isotropic_tensor.hpp.

◆ inv() [2/5]

constexpr SMITH_HOST_DEVICE tensor<double, 2, 2> smith::inv ( const tensor< double, 2, 2 > &  A)
constexpr

Inverts a matrix.

Parameters
[in]AThe matrix to invert
Note
Uses a shortcut for inverting a 2-by-2 matrix

Definition at line 1652 of file tensor.hpp.

◆ inv() [3/5]

constexpr SMITH_HOST_DEVICE tensor<double, 3, 3> smith::inv ( const tensor< double, 3, 3 > &  A)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Uses a shortcut for inverting a 3-by-3 matrix

Definition at line 1670 of file tensor.hpp.

◆ inv() [4/5]

template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto smith::inv ( const tensor< T, n, n > &  A)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
For N-by-N matrices with N > 3, requires Gaussian elimination with partial pivoting

Definition at line 1694 of file tensor.hpp.

◆ inv() [5/5]

template<typename gradient_type , int n>
constexpr SMITH_HOST_DEVICE auto smith::inv ( tensor< dual< gradient_type >, n, n >  A)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
when inverting a tensor of dual numbers, hardcode the analytic derivative of the inverse of a square matrix, rather than apply gauss elimination directly on the dual number types

TODO: compare performance of this hardcoded implementation to just using inv() directly

Definition at line 479 of file tuple_tensor_dual_functions.hpp.

◆ is_symmetric()

template<int n>
SMITH_HOST_DEVICE bool smith::is_symmetric ( tensor< double, n, n >  A,
double  tolerance = 1.0e-8 
)

Return whether a square rank 2 tensor is symmetric.

Template Parameters
nThe height of the tensor
Parameters
AThe square rank 2 tensor
toleranceThe tolerance to check for symmetry
Returns
Whether the square rank 2 tensor (matrix) is symmetric

Definition at line 1492 of file tensor.hpp.

◆ is_symmetric_and_positive_definite()

SMITH_HOST_DEVICE bool smith::is_symmetric_and_positive_definite ( tensor< double, 2, 2 >  A)
inline

Return whether a matrix is symmetric and positive definite This check uses Sylvester's criterion, checking that each upper left subtensor has a determinant greater than zero.

Parameters
AThe matrix to test for positive definiteness
Returns
Whether the matrix is positive definite

Definition at line 1512 of file tensor.hpp.

◆ leading_dimension()

template<typename T , int m, int... n>
constexpr SMITH_HOST_DEVICE int smith::leading_dimension ( tensor< T, m, n... >  )
constexpr

a function for querying the first dimension of a tensor

Template Parameters
Tthe datatype stored in the tensor
mthe first dimension of the tensor
nthe trailing dimensions of the tensor
Returns
m

Definition at line 1977 of file tensor.hpp.

◆ Legendre()

template<int n, typename T >
SMITH_HOST_DEVICE tensor<T, n> smith::Legendre ( x)

Legendre Polynomials, orthogonal on the domain (-1, 1) with unit weight function.

Template Parameters
nhow many entries to compute
Parameters
[in]xwhere to evaluate the polynomials

Definition at line 448 of file polynomials.hpp.

◆ linear_solve() [1/3]

template<typename S , typename T , int n, int... m>
constexpr SMITH_HOST_DEVICE auto smith::linear_solve ( const LuFactorization< S, n > &  lu_factors,
const tensor< T, n, m... > &  b 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
For use with a matrix that has already been factorized

Definition at line 1626 of file tensor.hpp.

◆ linear_solve() [2/3]

template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto smith::linear_solve ( const LuFactorization< T, n > &  ,
const  zero 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
Shortcut for case of zero rhs

Definition at line 1642 of file tensor.hpp.

◆ linear_solve() [3/3]

template<typename S , typename T , int n, int... m>
constexpr SMITH_HOST_DEVICE auto smith::linear_solve ( const tensor< S, n, n > &  A,
const tensor< T, n, m... > &  b 
)
constexpr

Solves Ax = b for x using Gaussian elimination with partial pivoting.

Parameters
[in]AThe coefficient matrix A
[in]bThe righthand side vector b
Returns
x The solution vector

Definition at line 425 of file tuple_tensor_dual_functions.hpp.

◆ log_symm()

template<typename T >
auto smith::log_symm ( tensor< T, 3, 3 >  A)

Logarithm of a symmetric matrix.

Parameters
AMatrix to operate on. Must be SPD. This is not checked.
Returns
The logarithmic mapping of A.

Definition at line 1013 of file tuple_tensor_dual_functions.hpp.

◆ make_dual() [1/2]

template<int... n>
constexpr SMITH_HOST_DEVICE auto smith::make_dual ( const tensor< double, n... > &  A)
constexpr

Constructs a tensor of dual numbers from a tensor of values.

Parameters
[in]AThe tensor of values
Note
a d-order tensor's gradient will be initialized to the (2*d)-order identity tensor

Definition at line 344 of file tuple_tensor_dual_functions.hpp.

◆ make_dual() [2/2]

template<typename T0 , typename T1 >
constexpr SMITH_HOST_DEVICE auto smith::make_dual ( const tuple< T0, T1 > &  args)
constexpr

Promote a tuple of values to their corresponding dual types.

Template Parameters
T0the first type of the tuple argument
T1the first type of the tuple argument
Parameters
argsthe values to be promoted

example:

dual < smith::tuple < double, zero > >
tensor < dual < smith::tuple < zero, tensor< double, 3 > >, 3 >
> dual_of_f = make_dual(f);
constexpr SMITH_HOST_DEVICE auto make_dual(double x)
promote a value to a dual number of the appropriate type
Definition: dual.hpp:441
This is a class that mimics most of std::tuple's interface, except that it is usable in CUDA kernels ...
Definition: tuple.hpp:28

Definition at line 188 of file tuple_tensor_dual_functions.hpp.

◆ make_dual_helper() [1/2]

template<int i, int N, typename T , int... n>
constexpr SMITH_HOST_DEVICE auto smith::make_dual_helper ( const tensor< T, n... > &  arg)
constexpr

promote a tensor value to dual number with a one_hot_t< i, N, tensor > gradient type

Template Parameters
ithe index where the non-smith::zero derivative term appears
Nhow many entries in the gradient type
Parameters
argthe value to be promoted

Definition at line 159 of file tuple_tensor_dual_functions.hpp.

◆ make_dual_helper() [2/2]

template<int i, int N>
constexpr SMITH_HOST_DEVICE auto smith::make_dual_helper ( double  arg)
constexpr

promote a double value to dual number with a one_hot_t< i, N, double > gradient type

Template Parameters
ithe index where the non-smith::zero derivative term appears
Nhow many entries in the gradient type
Parameters
argthe value to be promoted

Definition at line 142 of file tuple_tensor_dual_functions.hpp.

◆ make_dual_wrt()

template<int n, typename... T>
constexpr auto smith::make_dual_wrt ( const smith::tuple< T... > &  args)
constexpr

take a tuple of values, and promote the nth one to a one-hot dual number of the appropriate type

Template Parameters
nthe index of the tuple argument to be made into a dual number
Tthe types of the values in the tuple
Parameters
argsthe values to be promoted

Definition at line 274 of file tuple_tensor_dual_functions.hpp.

◆ make_tensor() [1/5]

template<typename lambda_type >
SMITH_SUPPRESS_NVCC_HOSTDEVICE_WARNING constexpr SMITH_HOST_DEVICE auto smith::make_tensor ( lambda_type  f)
constexpr

Creates a tensor of requested dimension by subsequent calls to a functor Can be thought of as analogous to std::transform in that the set of possible indices for dimensions n are transformed into the values of the tensor by f.

Template Parameters
lambda_typeThe type of the functor
Parameters
[in]fThe functor to generate the tensor values from
Note
the different cases of 0D, 1D, 2D, 3D, and 4D are implemented separately to work around a limitation in nvcc involving host device lambdas with auto parameters.

Definition at line 304 of file tensor.hpp.

◆ make_tensor() [2/5]

template<int n1, typename lambda_type >
SMITH_SUPPRESS_NVCC_HOSTDEVICE_WARNING constexpr SMITH_HOST_DEVICE auto smith::make_tensor ( lambda_type  f)
constexpr

Creates a tensor of requested dimension by subsequent calls to a functor.

Template Parameters
n1The dimension of the tensor
lambda_typeThe type of the functor
Parameters
[in]fThe functor to generate the tensor values from
Precondition
f must accept n1 arguments of type int
Note
the different cases of 0D, 1D, 2D, 3D, and 4D are implemented separately to work around a limitation in nvcc involving host device lambdas with auto parameters.

Definition at line 323 of file tensor.hpp.

◆ make_tensor() [3/5]

template<int n1, int n2, typename lambda_type >
SMITH_SUPPRESS_NVCC_HOSTDEVICE_WARNING constexpr SMITH_HOST_DEVICE auto smith::make_tensor ( lambda_type  f)
constexpr

Creates a tensor of requested dimension by subsequent calls to a functor.

Template Parameters
n1The first dimension of the tensor
n2The second dimension of the tensor
lambda_typeThe type of the functor
Parameters
[in]fThe functor to generate the tensor values from
Precondition
f must accept n1 x n2 arguments of type int
Note
the different cases of 0D, 1D, 2D, 3D, and 4D are implemented separately to work around a limitation in nvcc involving host device lambdas with auto parameters.

Definition at line 347 of file tensor.hpp.

◆ make_tensor() [4/5]

template<int n1, int n2, int n3, typename lambda_type >
SMITH_SUPPRESS_NVCC_HOSTDEVICE_WARNING constexpr SMITH_HOST_DEVICE auto smith::make_tensor ( lambda_type  f)
constexpr

Creates a tensor of requested dimension by subsequent calls to a functor.

Template Parameters
n1The first dimension of the tensor
n2The second dimension of the tensor
n3The third dimension of the tensor
lambda_typeThe type of the functor
Parameters
[in]fThe functor to generate the tensor values from
Precondition
f must accept n1 x n2 x n3 arguments of type int
Note
the different cases of 0D, 1D, 2D, 3D, and 4D are implemented separately to work around a limitation in nvcc involving host device lambdas with auto parameters.

Definition at line 374 of file tensor.hpp.

◆ make_tensor() [5/5]

template<int n1, int n2, int n3, int n4, typename lambda_type >
SMITH_SUPPRESS_NVCC_HOSTDEVICE_WARNING constexpr SMITH_HOST_DEVICE auto smith::make_tensor ( lambda_type  f)
constexpr

Creates a tensor of requested dimension by subsequent calls to a functor.

Template Parameters
n1The first dimension of the tensor
n2The second dimension of the tensor
n3The third dimension of the tensor
n4The fourth dimension of the tensor
lambda_typeThe type of the functor
Parameters
[in]fThe functor to generate the tensor values from
Precondition
f must accept n1 x n2 x n3 x n4 arguments of type int
Note
the different cases of 0D, 1D, 2D, 3D, and 4D are implemented separately to work around a limitation in nvcc involving host device lambdas with auto parameters.

Definition at line 404 of file tensor.hpp.

◆ make_tuple()

template<typename... T>
SMITH_HOST_DEVICE tuple<T...> smith::make_tuple ( const T &...  args)

helper function for combining a list of values into a tuple

Template Parameters
Ttypes of the values to be tuple-d
Parameters
argsthe actual values to be put into a tuple

Definition at line 266 of file tuple.hpp.

◆ MakeBoundaryIntegral()

template<typename s , int Q, int dim, typename lambda_type >
Integral smith::MakeBoundaryIntegral ( const Domain domain,
const lambda_type &  qf,
std::vector< uint32_t >  argument_indices 
)

function to generate kernels held by an Integral object of type "Boundary", for all element types

Template Parameters
sa function signature type containing test/trial space informationa type containing a function signature
Qa parameter that controls the number of quadrature points
dimthe dimension of the domain
lambda_typea callable object that implements the q-function concept
Parameters
domainthe domain of integration
qfthe quadrature function
argument_indicesthe indices of trial space arguments used in the Integral
Returns
Integral the initialized Integral object
Note
this function is not meant to be called by users

Definition at line 341 of file integral.hpp.

◆ MakeDomainIntegral()

template<typename s , int Q, int dim, typename lambda_type , typename qpt_data_type >
Integral smith::MakeDomainIntegral ( const Domain domain,
const lambda_type &  qf,
std::shared_ptr< QuadratureData< qpt_data_type > >  qdata,
std::vector< uint32_t >  argument_indices 
)

function to generate kernels held by an Integral object of type "Domain", for all element types

Template Parameters
sa function signature type containing test/trial space informationa type containing a function signature
Qa parameter that controls the number of quadrature points
dimthe dimension of the domain
lambda_typea callable object that implements the q-function concept
qpt_data_typeany quadrature point data needed by the material model
Parameters
domainthe domain of integration
qfthe quadrature function
qdatathe values of any quadrature point data for the material
argument_indicesthe indices of trial space arguments used in the Integral
Returns
Integral the initialized Integral object

Definition at line 253 of file integral.hpp.

◆ MakeInteriorFaceIntegral()

template<typename s , int Q, int dim, typename lambda_type >
Integral smith::MakeInteriorFaceIntegral ( const Domain domain,
const lambda_type &  qf,
std::vector< uint32_t >  argument_indices 
)

function to generate kernels held by an Integral object of type "Boundary", for all element types

Template Parameters
sa function signature type containing test/trial space informationa type containing a function signature
Qa parameter that controls the number of quadrature points
dimthe dimension of the domain
lambda_typea callable object that implements the q-function concept
Parameters
domainthe domain of integration
qfthe quadrature function
argument_indicesthe indices of trial space arguments used in the Integral
Returns
Integral the initialized Integral object
Note
this function is not meant to be called by users

Definition at line 427 of file integral.hpp.

◆ matrix_sqrt()

template<typename T , int dim>
auto smith::matrix_sqrt ( const tensor< T, dim, dim > &  A)

compute the matrix square root of a square, real-valued, symmetric matrix i.e. given A, find B such that A = dot(B, B)

Template Parameters
Tthe data type stored in each element of the matrix
Parameters
Athe matrix to compute the square root of
Returns
a square matrix, B, of the same type as A satisfying dot(B, B) == A

Definition at line 1366 of file tensor.hpp.

◆ max() [1/2]

double smith::max ( const FiniteElementVector fe_vector)

Find the max value of a finite element vector across all dofs.

Parameters
fe_vectorThe state variable to compute a max of
Returns
The max value
Note
This acts on the actual scalar degree of freedom values, not the interpolated shape function values. This implies these may or may not be nodal averages depending on the choice of finite element basis.

Definition at line 128 of file finite_element_vector.cpp.

◆ max() [2/2]

template<typename gradient_type >
SMITH_HOST_DEVICE auto smith::max ( dual< gradient_type >  a,
double  b 
)

Implementation of max for dual numbers.

Note
This is not differentiable at a == b. At that point, the gradient is calculated as the gradient of b.

Definition at line 229 of file dual.hpp.

◆ min() [1/2]

double smith::min ( const FiniteElementVector fe_vector)

Find the min value of a finite element vector across all dofs.

Parameters
fe_vectorThe state variable to compute a min of
Returns
The min value
Note
This acts on the actual scalar degree of freedom values, not the interpolated shape function values. This implies these may or may not be nodal averages depending on the choice of finite element basis.

Definition at line 136 of file finite_element_vector.cpp.

◆ min() [2/2]

template<typename gradient_type >
SMITH_HOST_DEVICE auto smith::min ( dual< gradient_type >  a,
double  b 
)

Implementation of min for dual numbers.

Note
This is not differentiable at a == b. At that point, the gradient is calculated as the gradient of b.

Definition at line 255 of file dual.hpp.

◆ minus_equals_helper()

template<typename... T, int... i>
constexpr SMITH_HOST_DEVICE void smith::minus_equals_helper ( tuple< T... > &  x,
const tuple< T... > &  y,
std::integer_sequence< int, i... >   
)
constexpr

A helper function for the -= operator of tuples.

Template Parameters
Tthe types stored in the tuples x and y
iinteger sequence used to index the tuples
Parameters
xtuple of values to be subracted from
ytuple of values to subtract from x

Definition at line 481 of file tuple.hpp.

◆ minus_helper()

template<typename... S, typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto smith::minus_helper ( const tuple< S... > &  x,
const tuple< T... > &  y,
std::integer_sequence< int, i... >   
)
constexpr

A helper function for the - operator of tuples.

Template Parameters
Sthe types stored in the tuple x
Tthe types stored in the tuple y
iThe integer sequence to i
Parameters
xtuple of values
ytuple of values
Returns
the returned tuple difference

Definition at line 510 of file tuple.hpp.

◆ mult_helper() [1/3]

template<typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto smith::mult_helper ( const double  a,
const tuple< T... > &  x,
std::integer_sequence< int, i... >   
)
constexpr

A helper function for the * operator of tuples.

Template Parameters
Tthe types stored in the tuple y
iThe integer sequence to i
Parameters
xtuple of values
aa constant multiplier
Returns
the returned tuple product

Definition at line 681 of file tuple.hpp.

◆ mult_helper() [2/3]

template<typename... S, typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto smith::mult_helper ( const tuple< S... > &  x,
const tuple< T... > &  y,
std::integer_sequence< int, i... >   
)
constexpr

A helper function for the * operator of tuples.

Template Parameters
Sthe types stored in the tuple x
Tthe types stored in the tuple y
iThe integer sequence to i
Parameters
xtuple of values
ytuple of values
Returns
the returned tuple product

Definition at line 651 of file tuple.hpp.

◆ mult_helper() [3/3]

template<typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto smith::mult_helper ( const tuple< T... > &  x,
const double  a,
std::integer_sequence< int, i... >   
)
constexpr

A helper function for the * operator of tuples.

Template Parameters
Tthe types stored in the tuple y
iThe integer sequence to i
Parameters
xtuple of values
aa constant multiplier
Returns
the returned tuple product

Definition at line 696 of file tuple.hpp.

◆ nonlinearSolve()

FieldState smith::nonlinearSolve ( const WeakForm residual_eval,
const FieldState shape_disp,
const std::vector< FieldState > &  states,
const std::vector< FieldState > &  params,
const std::vector< double > &  state_update_weights,
size_t  primal_solve_state_index,
size_t  dirichlet_state_index,
const TimeInfo time_info,
const DifferentiableSolver solver,
const BoundaryConditionManager bc_manager,
const FieldState bc_field = nullptr 
)

Solve a nonlinear system of equations as defined by the weak form.

Parameters
residual_evalThe weak form which defines the equations to be solved
shape_dispThe mesh-morphed shape displacement
statesThe time varying states as inputs to the weak form
paramsThe fixed field parameters as inputs to the weak form
state_update_weightsSpecifies how to blend the arguments of the weak form into a unique unknown. The primary unknown, p, is states[primal_solve_state_index]. However, other arguments to the weak form may also depend on this unknown. The state_update_weights specify how this is done. For a nonzero weight, the field argument i is assumed to change as states[i] + (p - p_initial) * state_update_weights[i].
primal_solve_state_indexIndex specifying which of the states is the primary unknown.
dirichlet_state_indexIndex specifying which field has the Dirichlet boundary conditions applied to it. Typically this will be the same as the primal_solve_state_index, but it can be different. An example is explicit dynamics, where the unknown is the acceleration, and the boundary conditions are often applied directly to the displacement field.
time_infoTimestep information (time, dt, cycle)
solverThe differentiable, potentially nonlinear, equation solver used to solve the system of equations
bc_managerHolds information about which degrees of freedom (DOFS)
bc_fieldA field which holds to desired values for the fixed degrees of freedom as specified by the bc_manager
Returns
The field solution to the weak form

Definition at line 48 of file nonlinear_solve.cpp.

◆ norm() [1/3]

double smith::norm ( const FiniteElementState state,
const double  p = 2 
)

Find the Lp norm of a finite element state across all dofs.

Parameters
stateThe state variable to compute a norm of
pThe order norm to compute
Returns
The Lp norm of the finite element state

Definition at line 104 of file finite_element_state.cpp.

◆ norm() [2/3]

template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::norm ( const isotropic_tensor< T, m, m > &  I)
constexpr

compute the Frobenius norm (sqrt(tr(dot(transpose(I), I)))) of an isotropic tensor

Template Parameters
Tthe types stored in the isotropic tensor
mthe number of rows and columns in I
Parameters
Ithe isotropic tensor to compute the norm of

Definition at line 324 of file isotropic_tensor.hpp.

◆ norm() [3/3]

template<typename T , int... n>
SMITH_HOST_DEVICE auto smith::norm ( const tensor< T, n... > &  A)

Returns the Frobenius norm of the tensor.

Parameters
[in]AThe tensor to obtain the norm from

Definition at line 1105 of file tensor.hpp.

◆ normalize()

template<typename T , int... n>
SMITH_HOST_DEVICE auto smith::normalize ( const tensor< T, n... > &  A)

Normalizes the tensor Each element is divided by the Frobenius norm of the tensor,.

See also
norm
Parameters
[in]AThe tensor to normalize

Definition at line 1122 of file tensor.hpp.

◆ num_quadrature_points()

constexpr int smith::num_quadrature_points ( mfem::Geometry::Type  g,
int  Q 
)
constexpr

return the number of quadrature points in a Gauss-Legendre rule with parameter "Q"

Template Parameters
gthe element geometry
Qthe number of quadrature points per dimension

Definition at line 31 of file geometry.hpp.

◆ operator*() [1/7]

template<typename... T>
constexpr SMITH_HOST_DEVICE auto smith::operator* ( const double  a,
const tuple< T... > &  x 
)
constexpr

multiply each component of x by the value a on the left

Template Parameters
Tthe types stored in the tuple
Parameters
aa scaling factor
xthe tuple object

Definition at line 708 of file tuple.hpp.

◆ operator*() [2/7]

template<typename S , typename T , int m, int... n, typename = std::enable_if_t<std::is_arithmetic_v<S> || is_dual_number<S>::value>>
constexpr SMITH_HOST_DEVICE auto smith::operator* ( const tensor< T, m, n... > &  A,
scale 
)
constexpr

multiply a tensor by a scalar value

Template Parameters
Sthe scalar value type. Must be arithmetic (e.g. float, double, int) or a dual number
Tthe underlying type of the tensor (righthand) argument
nintegers describing the tensor shape
Parameters
[in]AThe tensor to be scaled
[in]scaleThe scaling factor

Definition at line 58 of file tuple_tensor_dual_functions.hpp.

◆ operator*() [3/7]

template<typename... S, typename... T>
constexpr SMITH_HOST_DEVICE auto smith::operator* ( const tuple< S... > &  x,
const tuple< T... > &  y 
)
constexpr

return a tuple of values defined by elementwise multiplication of x and y

Template Parameters
Sthe types stored in the tuple x
Tthe types stored in the tuple y
Parameters
xa tuple of values
ya tuple of values

Definition at line 665 of file tuple.hpp.

◆ operator*() [4/7]

template<typename... T>
constexpr SMITH_HOST_DEVICE auto smith::operator* ( const tuple< T... > &  x,
const double  a 
)
constexpr

multiply each component of x by the value a on the right

Template Parameters
Tthe types stored in the tuple
Parameters
xthe tuple object
aa scaling factor

Definition at line 720 of file tuple.hpp.

◆ operator*() [5/7]

template<typename S , typename T , int m, int... n, typename = std::enable_if_t<std::is_arithmetic_v<S> || is_dual_number<S>::value>>
constexpr SMITH_HOST_DEVICE auto smith::operator* ( scale,
const tensor< T, m, n... > &  A 
)
constexpr

multiply a tensor by a scalar value

Template Parameters
Sthe scalar value type. Must be arithmetic (e.g. float, double, int) or a dual number
Tthe underlying type of the tensor (righthand) argument
nintegers describing the tensor shape
Parameters
[in]scaleThe scaling factor
[in]AThe tensor to be scaled

Definition at line 39 of file tuple_tensor_dual_functions.hpp.

◆ operator*() [6/7]

template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::operator* ( scale,
isotropic_tensor< T, m, m >  I 
)
constexpr

scalar multiplication

Template Parameters
Sthe type of the left operand, scale
Tthe type of the isotropic tensor
mthe number of rows and columns in the isotropic tensor
Parameters
scalethe value that multiplies each entry of I (from the left)
Ithe isotropic tensor being scaled
Returns
a new isotropic tensor equal to the product of scale * I

Definition at line 77 of file isotropic_tensor.hpp.

◆ operator*() [7/7]

template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::operator* ( scale,
isotropic_tensor< T, m, m, m, m >  I 
)
constexpr

scalar multiplication

Template Parameters
Sthe type of the left operand, scale
Tthe type of the isotropic tensor
mthe dimension of each rank-4 isotropic tensor
Parameters
scalethe value that multiplies each entry of I (from the left)
Ithe isotropic tensor being scaled
Returns
a new isotropic tensor equal to the product of scale * I

Definition at line 410 of file isotropic_tensor.hpp.

◆ operator+() [1/7]

Components smith::operator+ ( Component  i,
Component  j 
)
inline

Construct a Components object from the sum of individual vector components.

See docstring on function declaration.

Definition at line 56 of file components.hpp.

◆ operator+() [2/7]

Components smith::operator+ ( Component  i,
Components  c 
)
inline

Add an additional component to the set of flagged Components.

See docstring on function definition.

Definition at line 59 of file components.hpp.

◆ operator+() [3/7]

template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::operator+ ( const isotropic_tensor< S, m, m > &  I,
const tensor< T, m, m > &  A 
)
constexpr

sum of isotropic and (nonisotropic) tensor

Template Parameters
Sthe type of the left isotropic tensor
Tthe type of the right tensor
mthe number of rows and columns in each tensor
Parameters
Ithe left operand
Athe (full) right operand
Returns
a new tensor equal to the sum of I and A

Definition at line 132 of file isotropic_tensor.hpp.

◆ operator+() [4/7]

template<typename S , typename T , int m, int... n>
constexpr SMITH_HOST_DEVICE auto smith::operator+ ( const tensor< S, m, n... > &  A,
const tensor< T, m, n... > &  B 
)
constexpr

return the sum of two tensors

Template Parameters
Sthe underlying type of the lefthand argument
Tthe underlying type of the righthand argument
nintegers describing the tensor shape
Parameters
[in]AThe lefthand operand
[in]BThe righthand operand

Definition at line 429 of file tensor.hpp.

◆ operator+() [5/7]

template<typename... S, typename... T>
constexpr SMITH_HOST_DEVICE auto smith::operator+ ( const tuple< S... > &  x,
const tuple< T... > &  y 
)
constexpr

return a tuple of values defined by elementwise sum of x and y

Template Parameters
Sthe types stored in the tuple x
Tthe types stored in the tuple y
Parameters
xa tuple of values
ya tuple of values

Definition at line 439 of file tuple.hpp.

◆ operator+() [6/7]

template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::operator+ ( isotropic_tensor< S, m, m >  I1,
isotropic_tensor< T, m, m >  I2 
)
constexpr

addition of isotropic tensors

Template Parameters
Sthe type of the left isotropic tensor
Tthe type of the right isotropic tensor
mthe number of rows and columns in each isotropic tensor
Parameters
I1the left operand
I2the right operand
Returns
a new isotropic tensor equal to the sum of I1 and I2

Definition at line 100 of file isotropic_tensor.hpp.

◆ operator+() [7/7]

template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::operator+ ( isotropic_tensor< S, m, m, m, m >  I1,
isotropic_tensor< T, m, m, m, m >  I2 
)
constexpr

addition of isotropic tensors

Template Parameters
Sthe type of the left isotropic tensor
Tthe type of the right isotropic tensor
mthe dimension of each rank-4 isotropic tensor
Parameters
I1the left operand
I2the right operand
Returns
a new isotropic tensor equal to the sum of I1 and I2

Definition at line 433 of file isotropic_tensor.hpp.

◆ operator+=() [1/7]

template<typename S , typename T , int m, int... n>
constexpr SMITH_HOST_DEVICE auto& smith::operator+= ( tensor< S, m, n... > &  A,
const tensor< T, m, n... > &  B 
)
constexpr

compound assignment (+) on tensors

Template Parameters
Sthe underlying type of the tensor (lefthand) argument
Tthe underlying type of the tensor (righthand) argument
nintegers describing the tensor shape
Parameters
[in]AThe lefthand tensor
[in]BThe righthand tensor

Definition at line 481 of file tensor.hpp.

◆ operator+=() [2/7]

template<typename T >
constexpr SMITH_HOST_DEVICE auto& smith::operator+= ( tensor< T, 1 > &  A,
const T &  B 
)
constexpr

compound assignment (+) on tensors

Template Parameters
Tthe underlying type of the tensor argument
Parameters
[in]AThe lefthand tensor
[in]BThe righthand tensor

Definition at line 540 of file tensor.hpp.

◆ operator+=() [3/7]

template<typename T >
constexpr SMITH_HOST_DEVICE auto& smith::operator+= ( tensor< T, 1, 1 > &  A,
const T &  B 
)
constexpr

compound assignment (+) on tensors

Template Parameters
Tthe underlying type of the tensor argument
Parameters
[in]AThe lefthand tensor
[in]BThe righthand tensor

Definition at line 552 of file tensor.hpp.

◆ operator+=() [4/7]

template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto& smith::operator+= ( tensor< T, 1, n > &  A,
const tensor< T, n > &  B 
)
constexpr

compound assignment (+) on tensors

Template Parameters
Tthe underlying type of the tensor argument
Parameters
[in]AThe lefthand tensor
[in]BThe righthand tensor

Definition at line 525 of file tensor.hpp.

◆ operator+=() [5/7]

template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto& smith::operator+= ( tensor< T, n, 1 > &  A,
const tensor< T, n > &  B 
)
constexpr

compound assignment (+) on tensors

Template Parameters
Tthe underlying type of the tensor argument
Parameters
[in]AThe lefthand tensor
[in]BThe righthand tensor

Definition at line 510 of file tensor.hpp.

◆ operator+=() [6/7]

template<typename T , int... n>
constexpr SMITH_HOST_DEVICE auto& smith::operator+= ( tensor< T, n... > &  A,
zero   
)
constexpr

compound assignment (+) between a tensor and zero (no-op)

Template Parameters
Tthe underlying type of the tensor (righthand) argument
nintegers describing the tensor shape
Parameters
[in]AThe lefthand tensor

Definition at line 564 of file tensor.hpp.

◆ operator+=() [7/7]

template<typename... T>
constexpr SMITH_HOST_DEVICE auto smith::operator+= ( tuple< T... > &  x,
const tuple< T... > &  y 
)
constexpr

add values contained in y, to the tuple x

Template Parameters
Tthe types stored in the tuples x and y
Parameters
xa tuple of values
ya tuple of values

Definition at line 467 of file tuple.hpp.

◆ operator-() [1/7]

template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::operator- ( const isotropic_tensor< S, m, m > &  I,
const tensor< T, m, m > &  A 
)
constexpr

difference of isotropic and (nonisotropic) tensor

Template Parameters
Sthe type of the left isotropic tensor
Tthe type of the right tensor
mthe number of rows and columns in each tensor
Parameters
Ithe left operand
Athe (full) right operand
Returns
a new tensor equal to the difference of I and A

Definition at line 167 of file isotropic_tensor.hpp.

◆ operator-() [2/7]

template<typename S , typename T , int m, int... n>
constexpr SMITH_HOST_DEVICE auto smith::operator- ( const tensor< S, m, n... > &  A,
const tensor< T, m, n... > &  B 
)
constexpr

return the difference of two tensors

Template Parameters
Sthe underlying type of the lefthand argument
Tthe underlying type of the righthand argument
nintegers describing the tensor shape
Parameters
[in]AThe lefthand operand
[in]BThe righthand operand

Definition at line 463 of file tensor.hpp.

◆ operator-() [3/7]

template<typename T , int m, int... n>
constexpr SMITH_HOST_DEVICE auto smith::operator- ( const tensor< T, m, n... > &  A)
constexpr

return the unary negation of a tensor

Template Parameters
Tthe underlying type of the righthand argument
nintegers describing the tensor shape
Parameters
[in]AThe tensor to negate

Definition at line 445 of file tensor.hpp.

◆ operator-() [4/7]

template<typename... S, typename... T>
constexpr SMITH_HOST_DEVICE auto smith::operator- ( const tuple< S... > &  x,
const tuple< T... > &  y 
)
constexpr

return a tuple of values defined by elementwise difference of x and y

Template Parameters
Sthe types stored in the tuple x
Tthe types stored in the tuple y
Parameters
xa tuple of values
ya tuple of values

Definition at line 524 of file tuple.hpp.

◆ operator-() [5/7]

template<typename... T>
constexpr SMITH_HOST_DEVICE auto smith::operator- ( const tuple< T... > &  x)
constexpr

return a tuple of values defined by applying the unary minus operator to each element of x

Template Parameters
Tthe types stored in the tuple y
Parameters
xa tuple of values

Definition at line 550 of file tuple.hpp.

◆ operator-() [6/7]

template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::operator- ( isotropic_tensor< S, m, m >  I1,
isotropic_tensor< T, m, m >  I2 
)
constexpr

difference of isotropic tensors

Template Parameters
Sthe type of the left isotropic tensor
Tthe type of the right isotropic tensor
mthe number of rows and columns in each isotropic tensor
Parameters
I1the left operand
I2the right operand
Returns
a new isotropic tensor equal to the difference of I1 and I2

Definition at line 116 of file isotropic_tensor.hpp.

◆ operator-() [7/7]

template<typename S , typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::operator- ( isotropic_tensor< S, m, m, m, m >  I1,
isotropic_tensor< T, m, m, m, m >  I2 
)
constexpr

difference of isotropic tensors

Template Parameters
Sthe type of the left isotropic tensor
Tthe type of the right isotropic tensor
mthe dimension of each rank-4 isotropic tensor
Parameters
I1the left operand
I2the right operand
Returns
a new isotropic tensor equal to the difference of I1 and I2

Definition at line 449 of file isotropic_tensor.hpp.

◆ operator-=() [1/3]

template<typename S , typename T , int m, int... n>
constexpr SMITH_HOST_DEVICE auto& smith::operator-= ( tensor< S, m, n... > &  A,
const tensor< T, m, n... > &  B 
)
constexpr

compound assignment (-) on tensors

Template Parameters
Sthe underlying type of the tensor (lefthand) argument
Tthe underlying type of the tensor (righthand) argument
nintegers describing the tensor shape
Parameters
[in]AThe lefthand tensor
[in]BThe righthand tensor

Definition at line 578 of file tensor.hpp.

◆ operator-=() [2/3]

template<typename T , int... n>
constexpr SMITH_HOST_DEVICE auto& smith::operator-= ( tensor< T, n... > &  A,
zero   
)
constexpr

compound assignment (-) between a tensor and zero (no-op)

Template Parameters
Tthe underlying type of the tensor (righthand) argument
nintegers describing the tensor shape
Parameters
[in]AThe lefthand tensor

Definition at line 593 of file tensor.hpp.

◆ operator-=() [3/3]

template<typename... T>
constexpr SMITH_HOST_DEVICE auto smith::operator-= ( tuple< T... > &  x,
const tuple< T... > &  y 
)
constexpr

add values contained in y, to the tuple x

Template Parameters
Tthe types stored in the tuples x and y
Parameters
xa tuple of values
ya tuple of values

Definition at line 494 of file tuple.hpp.

◆ operator/() [1/5]

template<typename... T>
constexpr SMITH_HOST_DEVICE auto smith::operator/ ( const double  a,
const tuple< T... > &  x 
)
constexpr

return a tuple of values defined by division of a by the elements of x

Template Parameters
Tthe types stored in the tuple x
Parameters
athe numerator
xa tuple of denominator values

Definition at line 623 of file tuple.hpp.

◆ operator/() [2/5]

template<typename S , typename T , int m, int... n, typename = std::enable_if_t<std::is_arithmetic_v<S> || is_dual_number<S>::value>>
constexpr SMITH_HOST_DEVICE auto smith::operator/ ( const tensor< T, m, n... > &  A,
scale 
)
constexpr

divide a tensor by a scalar

Template Parameters
Sthe scalar value type. Must be arithmetic (e.g. float, double, int) or a dual number
Tthe underlying type of the tensor (righthand) argument
nintegers describing the tensor shape
Parameters
[in]AThe tensor of numerators
[in]scaleThe denominator

Definition at line 96 of file tuple_tensor_dual_functions.hpp.

◆ operator/() [3/5]

template<typename... S, typename... T>
constexpr SMITH_HOST_DEVICE auto smith::operator/ ( const tuple< S... > &  x,
const tuple< T... > &  y 
)
constexpr

return a tuple of values defined by elementwise division of x by y

Template Parameters
Sthe types stored in the tuple x
Tthe types stored in the tuple y
Parameters
xa tuple of values
ya tuple of values

Definition at line 580 of file tuple.hpp.

◆ operator/() [4/5]

template<typename... T>
constexpr SMITH_HOST_DEVICE auto smith::operator/ ( const tuple< T... > &  x,
const double  a 
)
constexpr

return a tuple of values defined by elementwise division of x by a

Template Parameters
Tthe types stored in the tuple y
Parameters
xa tuple of numerator values
aa denominator

Definition at line 635 of file tuple.hpp.

◆ operator/() [5/5]

template<typename S , typename T , int m, int... n, typename = std::enable_if_t<std::is_arithmetic_v<S> || is_dual_number<S>::value>>
constexpr SMITH_HOST_DEVICE auto smith::operator/ ( scale,
const tensor< T, m, n... > &  A 
)
constexpr

divide a scalar by each element in a tensor

Template Parameters
Sthe scalar value type. Must be arithmetic (e.g. float, double, int) or a dual number
Tthe underlying type of the tensor (righthand) argument
nintegers describing the tensor shape
Parameters
[in]scaleThe numerator
[in]AThe tensor of denominators

Definition at line 77 of file tuple_tensor_dual_functions.hpp.

◆ operator<<() [1/3]

template<typename... T>
auto& smith::operator<< ( std::ostream &  out,
const smith::tuple< T... > &  A 
)

print a tuple of values

Template Parameters
Tthe types stored in the tuple
Parameters
outthe ostream to write the output to
Athe tuple of values

Definition at line 748 of file tuple.hpp.

◆ operator<<() [2/3]

template<typename T , int m, int... n>
auto& smith::operator<< ( std::ostream &  out,
const tensor< T, m, n... > &  A 
)

recursively serialize the entries in a tensor to an ostream. Output format uses braces and comma separators to mimic C syntax for multidimensional array initialization.

Parameters
[in]outthe std::ostream to write to (e.g. std::cout or std::ofstream)
[in]AThe tensor to write out

Definition at line 1709 of file tensor.hpp.

◆ operator<<() [3/3]

auto& smith::operator<< ( std::ostream &  out,
zero   
)
inline

Write a zero out to an output stream.

Parameters
[in]outthe std::ostream to write to (e.g. std::cout or std::ofstream)

Definition at line 1724 of file tensor.hpp.

◆ outer() [1/5]

template<typename S , typename T , int m, int n>
constexpr SMITH_HOST_DEVICE auto smith::outer ( const tensor< S, m > &  A,
const tensor< T, n > &  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
this overload implements the case where both arguments are vectors

Definition at line 651 of file tensor.hpp.

◆ outer() [2/5]

template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::outer ( const tensor< T, m > &  A,
double  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
this overload implements the case where the left argument is a tensor, and the right argument is a scalar

Definition at line 617 of file tensor.hpp.

◆ outer() [3/5]

template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto smith::outer ( const tensor< T, n > &  ,
zero   
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
this overload implements the case where the left argument is a tensor, and the right argument is zero

Definition at line 641 of file tensor.hpp.

◆ outer() [4/5]

template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto smith::outer ( double  A,
tensor< T, n >  B 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
this overload implements the case where the left argument is a scalar, and the right argument is a tensor

Definition at line 603 of file tensor.hpp.

◆ outer() [5/5]

template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto smith::outer ( zero  ,
const tensor< T, n > &   
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
this overload implements the case where the left argument is zero, and the right argument is a tensor

Definition at line 631 of file tensor.hpp.

◆ parent_to_physical()

template<Family f, typename T , int q, int dim>
SMITH_HOST_DEVICE void smith::parent_to_physical ( tensor< T, q > &  qf_input,
const tensor< double, dim, dim, q > &  jacobians 
)

transform information in the parent space (i.e. values and derivatives w.r.t {xi, eta, zeta}) into the physical space (i.e. values and derivatives w.r.t. {x, y, z})

Template Parameters
fthe element family, used to determine which kind of transformation to apply
Tthe types of quantities to be transformed
qhow many values need to be transformed
dimthe spatial dimension
Parameters
qf_inputthe values to be transformed from parent to physical space
jacobiansthe jacobians of the isoparametric map from parent to physical space of each quadrature point

Definition at line 267 of file finite_element.hpp.

◆ physical_to_parent()

template<Family f, typename T , int q, int dim>
SMITH_HOST_DEVICE void smith::physical_to_parent ( tensor< T, q > &  qf_output,
const tensor< double, dim, dim, q > &  jacobians 
)

transform information in the physical space (i.e. sources and fluxes w.r.t {x, y, z}) back to the parent space (i.e. values and derivatives w.r.t. {xi, eta, zeta}). Note: this also multiplies by the outputs by the determinant of the quadrature point Jacobian.

Template Parameters
fthe element family, used to determine which kind of transformation to apply
Tthe types of quantities to be transformed
qhow many values need to be transformed
dimthe spatial dimension
Parameters
qf_outputthe values to be transformed from physical back to parent space
jacobiansthe jacobians of the isoparametric map from parent to physical space of each quadrature point

Definition at line 308 of file finite_element.hpp.

◆ plus_equals_helper()

template<typename... T, int... i>
constexpr SMITH_HOST_DEVICE void smith::plus_equals_helper ( tuple< T... > &  x,
const tuple< T... > &  y,
std::integer_sequence< int, i... >   
)
constexpr

A helper function for the += operator of tuples.

Template Parameters
Tthe types stored in the tuples x and y
iinteger sequence used to index the tuples
Parameters
xtuple of values to be incremented
ytuple of increment values

Definition at line 454 of file tuple.hpp.

◆ plus_helper()

template<typename... S, typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto smith::plus_helper ( const tuple< S... > &  x,
const tuple< T... > &  y,
std::integer_sequence< int, i... >   
)
constexpr

A helper function for the + operator of tuples.

Template Parameters
Sthe types stored in the tuple x
Tthe types stored in the tuple y
iThe integer sequence to i
Parameters
xtuple of values
ytuple of values
Returns
the returned tuple sum

Definition at line 425 of file tuple.hpp.

◆ powers()

template<int n, typename T >
constexpr SMITH_HOST_DEVICE tensor<T, n> smith::powers ( x)
constexpr

compute the first n powers of x

Template Parameters
nhow many powers to compute
Parameters
[in]xthe number to be raised to varying powers

Definition at line 389 of file polynomials.hpp.

◆ print() [1/2]

template<int m, int... n>
SMITH_HOST_DEVICE void smith::print ( const tensor< double, m, n... > &  A)

print a tensor using printf, so that it is suitable for use inside cuda kernels.

Parameters
[in]AThe tensor to write out

Definition at line 1742 of file tensor.hpp.

◆ print() [2/2]

SMITH_HOST_DEVICE void smith::print ( double  value)
inline

print a double using printf, so that it is suitable for use inside cuda kernels. (used in final recursion of printf(tensor<...>))

Parameters
[in]valueThe value to write out

Definition at line 1735 of file tensor.hpp.

◆ print_helper()

template<typename... T, std::size_t... i>
auto& smith::print_helper ( std::ostream &  out,
const smith::tuple< T... > &  A,
std::integer_sequence< size_t, i... >   
)

helper used to implement printing a tuple of values

Template Parameters
Tthe types stored in the tuple
ia list of indices used to acces each element of the tuple
Parameters
outthe ostream to write the output to
Athe tuple of values

Definition at line 733 of file tuple.hpp.

◆ printRunInfo()

void smith::printRunInfo ( )

Outputs basic run information to the screen.

Note: Command line options are handled in infrastructure/cli.cpp

Definition at line 194 of file about.cpp.

◆ promote_each_to_dual_when()

template<bool dualify, typename T , int n>
SMITH_HOST_DEVICE auto smith::promote_each_to_dual_when ( const tensor< T, n > &  x)

a function that optionally (decided at compile time) converts a list of values to their dual types

Template Parameters
dualifyspecify whether or not the input should be made into its dual type
Tthe type of the values passed in
nhow many values were passed in
Parameters
xthe values to be promoted

Definition at line 228 of file tuple_tensor_dual_functions.hpp.

◆ promote_to_dual_when()

template<bool dualify, typename T >
SMITH_HOST_DEVICE auto smith::promote_to_dual_when ( const T &  x)

a function that optionally (decided at compile time) converts a value to its dual type

Template Parameters
dualifyspecify whether or not the value should be made into its dual type
Tthe type of the value passed in
Parameters
xthe values to be promoted

Definition at line 209 of file tuple_tensor_dual_functions.hpp.

◆ relative_error()

template<typename T , int... n>
double smith::relative_error ( tensor< T, n... >  A,
tensor< T, n... >  B 
)

computes the relative error (in the frobenius norm) between two tensors of the same shape

Template Parameters
Tthe datatype stored in each tensor
nthe dimensions of each tensor
Parameters
Athe left argument
Bthe right argument
Returns
norm(A - B) / norm(A)

Definition at line 1478 of file tensor.hpp.

◆ sameFiniteElementSpace()

bool smith::sameFiniteElementSpace ( const mfem::FiniteElementSpace &  left,
const mfem::FiniteElementSpace &  right 
)

Check if two finite element spaces are the same.

Parameters
left
right
Returns
Bool which is true if the spaces are the same, otherwise false

Definition at line 25 of file finite_element_vector.cpp.

◆ sgn()

template<typename T >
int smith::sgn ( val)

Signum, returns sign of input.

Parameters
valInput value.
Returns
0 when input is negative, 0 when input is 0, 1 when input is positive.

Definition at line 769 of file tuple_tensor_dual_functions.hpp.

◆ single_quadrature_point_test()

template<typename MaterialType , typename StateType , typename... functions>
auto smith::single_quadrature_point_test ( double  t_max,
size_t  num_steps,
const MaterialType  material,
const StateType  initial_state,
const functions...  f 
)

This function takes a material model (and associate state variables), subjects it to a time history of stimuli, described by functions ... f, and returns the outputs at each step. This is intended to be used for testing materials, to ensure their response is in agreement with known data (analytic or experimental).

Template Parameters
MaterialTypethe type of the material model under test
StateTypethe associated state variables to be provided to the material
functionsa variadic list of callables
Parameters
t_maxthe final time value for
num_stepsthe number of timesteps to be
materialan instance of a material model under test
initial_statethe initial conditions for materials that exhibit hysteresis
fthe functions (e.g. std::function, lambdas, etc) that are used to generate the inputs to the material model at each timestep
Returns
a std::vector of tuples of the form: ( time, state(t), f(t) ... , output(t) ) evaluated at each step

Definition at line 124 of file material_verification_tools.hpp.

◆ size() [1/2]

constexpr SMITH_HOST_DEVICE int smith::size ( const double &  )
constexpr

overload of size() for double, we say a double "stores" 1 value

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 1948 of file tensor.hpp.

◆ size() [2/2]

template<typename T , int... n>
constexpr SMITH_HOST_DEVICE int smith::size ( const tensor< T, n... > &  )
constexpr

returns the total number of stored values in a tensor

Template Parameters
Tthe datatype stored in the tensor
nthe extents of each dimension
Returns
the total number of values stored in the tensor

Definition at line 1939 of file tensor.hpp.

◆ solve()

FieldState smith::solve ( const WeakForm residual_eval,
const FieldState shape_disp,
const std::vector< FieldState > &  states,
const std::vector< FieldState > &  params,
const TimeInfo time_info,
const DifferentiableSolver solver,
const DirichletBoundaryConditions bcs,
size_t  unknown_state_index = 0 
)

Solve a nonlinear system of equations as defined by the weak form, assuming that the field indexed by unknown_index is the unknown field.

Parameters
residual_evalThe weak form which defines the equations to be solved
shape_dispThe mesh-morphed shape displacement
statesThe time varying states as inputs to the weak form
paramsAll fixed fields pass to the weak form
time_infoTimestep information (time, dt, cycle)
solverThe differentiable, potentially nonlinear, equation solver used to solve the system of equations
bcsHolds information about which degrees of freedom (DOFS), and has the information about the time and space varying values for the boundary conditions
unknown_state_index
Returns
The field solution to the weak form

Definition at line 260 of file nonlinear_solve.cpp.

◆ solve_lower_triangular() [1/2]

template<typename T , int n, int... m>
constexpr SMITH_HOST_DEVICE auto smith::solve_lower_triangular ( const tensor< T, n, n > &  L,
const tensor< T, n, m... > &  b 
)
constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
For the case when no permutation of the rows is needed.

Definition at line 1587 of file tensor.hpp.

◆ solve_lower_triangular() [2/2]

template<typename T , int n, int... m>
constexpr SMITH_HOST_DEVICE auto smith::solve_lower_triangular ( const tensor< T, n, n > &  L,
const tensor< T, n, m... > &  b,
const tensor< int, n > &  P 
)
constexpr

Solves a lower triangular system Ly = b.

L must be lower triangular and normalized such that the diagonal entries are unity. This is not checked in the function, so failure to obey this will produce meaningless results.

Parameters
[in]LA lower triangular matrix
[in]bThe right hand side
[in]PA list of indices to index into b in a permuted fashion.
Returns
y the solution vector

Definition at line 1568 of file tensor.hpp.

◆ solve_scalar_equation()

template<typename function , typename... ParamTypes>
auto smith::solve_scalar_equation ( const function &  f,
double  x0,
double  lower_bound,
double  upper_bound,
ScalarSolverOptions  options,
ParamTypes...  params 
)

Solves a nonlinear scalar-valued equation and gives derivatives of solution to parameters.

Template Parameters
functionFunction object type for the nonlinear equation to solve
...ParamTypesTypes of the (optional) parameters to the nonlinear function
Parameters
fNonlinear function of which a root is sought. Must have the form $f(x, p_1, p_2, ...)$, where $x$ is the independent variable, and the $p_i$ are optional parameters (scalars or tensors of arbitrary order).
x0Initial guess of root. If x0 is outside the search interval, the initial guess will be changed to the midpoint of the search interval.
lower_boundLower bound of interval to search for root.
upper_boundUpper bound of interval to search for root.
optionsOptions controlling behavior of solver.
...paramsOptional parameters to the nonlinear function.
Returns
a tuple (x, status) where x is the root, and status is a SolverStatus object reporting the status of the solution procedure. If any of the parameters are dual number-valued, x will be dual containing the corresponding directional derivative of the root. Otherwise, x will be a double containing the root. For example, if one gives the function as $f(x, p)$, where $p$ is a dual<double> with p.gradient = 1, then the x.gradient will be $dx/dp$.

The solver uses Newton's method, safeguarded by bisection. If the Newton update would take the next iterate out of the search interval, or the absolute value of the residual is not decreasing fast enough, bisection will be used to compute the next iterate. The bounds of the search interval are updated automatically to maintain a bracket around the root. If the sign of the residual is the same at both lower_bound and upper_bound, the solver aborts.

Definition at line 576 of file tuple_tensor_dual_functions.hpp.

◆ solve_upper_triangular()

template<typename T , int n, int... m>
constexpr SMITH_HOST_DEVICE auto smith::solve_upper_triangular ( const tensor< T, n, n > &  U,
const tensor< T, n, m... > &  y 
)
constexpr

Solves an upper triangular system Ux = y.

U must be upper triangular. This is not checked, so failure to obey this will produce meaningless results.

Parameters
[in]UAn upper triangular matrix
[in]yThe right hand side
Returns
x the solution vector

Definition at line 1608 of file tensor.hpp.

◆ sqrt_symm()

template<typename T >
auto smith::sqrt_symm ( tensor< T, 3, 3 >  A)

Square root of a symmetric matrix.

Parameters
AMatrix to operate on. Must be SPD. This is not checked.
Returns
Matrix B such that B*B = A

Definition at line 1053 of file tuple_tensor_dual_functions.hpp.

◆ squared_norm() [1/2]

template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::squared_norm ( const isotropic_tensor< T, m, m > &  I)
constexpr

compute the squared Frobenius norm (tr(dot(transpose(I), I))) of an isotropic tensor

Template Parameters
Tthe types stored in the isotropic tensor
mthe number of rows and columns in I
Parameters
Ithe isotropic tensor to compute the squared norm of

Definition at line 337 of file isotropic_tensor.hpp.

◆ squared_norm() [2/2]

template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::squared_norm ( const tensor< T, m > &  A)
constexpr

Returns the squared Frobenius norm of the tensor.

Parameters
[in]AThe tensor to obtain the squared norm from

Definition at line 1069 of file tensor.hpp.

◆ squish()

void smith::squish ( mfem::Mesh &  mesh)

a transformation from the unit disk/sphere (in L1 norm) to a unit disk/sphere (in L2 norm)

Parameters
meshThe mesh to transform

Definition at line 56 of file mesh_utils.cpp.

◆ sym() [1/2]

template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::sym ( const isotropic_tensor< T, m, m > &  I)
constexpr

return the symmetric part of an isotropic tensor

Template Parameters
Tthe types stored in the isotropic tensor
mthe number of rows and columns in I
Parameters
Ithe isotropic tensor to symmetrize
Returns
a copy of I (isotropic matrices are already symmetric)

Definition at line 243 of file isotropic_tensor.hpp.

◆ sym() [2/2]

template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto smith::sym ( const tensor< T, n, n > &  A)
constexpr

Returns the symmetric part of a square matrix.

Parameters
[in]AThe matrix to obtain the symmetric part of
Returns
(1/2) * (A + A^T)

Definition at line 1164 of file tensor.hpp.

◆ symmetric_mat3_function()

template<typename T , typename Function , typename EigvalSecantFunction >
auto smith::symmetric_mat3_function ( tensor< T, 3, 3 >  A,
const Function &  f,
const EigvalSecantFunction &  g 
)

Constructs an isotropic tensor-valued function of a symmetric 3x3 tensor from a scalar function.

This allows one to use a scalar-valued function of a scalar to construct an isotropic tensor-valued function of a symmetric tensor. The scalar function is applied to the principal values of the matrix, and then rotated back into the external coordinate system with the eigenvector matrix.

If A = V diag(lambda_0, lambda_1, lambda_2) V^T, then f(A) = V diag(f(lambda_0), f(lambda_1), f(lambda_2)) V^T

The function g, which we call the eigenvalue secant function, is only used if the derivative of the function is sought by having a dual number input tensor A. It must compute | df/dx, if lam1 = lam2 g(lam1, lam2) = | | ( f(lam1) - f(lam2) ) / (lam1 - lam2), otherwise

Analytically, this is a continuous function. However, in floating point arithmetic the direct implementation will often suffer from catastrophic cancellation. The presence of the g argument gives you a way to write this function in a numerically stable way (and thus preserve accuracy in the derivative of the tensor function).

Template Parameters
TThe datatype stored in the tensor
FunctionType for the functor object representing the scalar function
EigvalSecantFunctionType for the functor object representing the secant eigenvalue function (see below)
Parameters
AThe matrix to apply the isotropic tensor function to.
fA scalar-valued function of a scalar. This is applied to the eigenvalues of A.
gThe eigenvalue secant function
Returns
The tensor f(A).

Definition at line 968 of file tuple_tensor_dual_functions.hpp.

◆ SymmetricIdentity()

template<int m>
constexpr SMITH_HOST_DEVICE auto smith::SymmetricIdentity ( )
constexpr

a helper function for creating the rank-4 isotropic tensor defined by: d(sym(A)_{ij}) / d(A_{kl})

Template Parameters
mthe dimension

Definition at line 383 of file isotropic_tensor.hpp.

◆ tensor() [1/2]

template<typename T , int n1>
smith::tensor ( const T(&)  data[n1]) -> tensor< T, n1 >

class template argument deduction guide for type tensor.

Note
this lets users write
tensor A = {{0.0, 1.0, 2.0}};
tensor(const T(&data)[n1]) -> tensor< T, n1 >
class template argument deduction guide for type tensor.
instead of explicitly writing the template parameters
tensor< double, 3 > A = {{1.0, 2.0, 3.0}};

◆ tensor() [2/2]

template<typename T , int n1, int n2>
smith::tensor ( const T(&)  data[n1][n2]) -> tensor< T, n1, n2 >

class template argument deduction guide for type tensor.

Note
this lets users write
tensor A = {{{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}, {7.0, 8.0, 9.0}}};
instead of explicitly writing the template parameters
tensor< double, 3, 3 > A = {{{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}, {7.0, 8.0, 9.0}}};

◆ tensor_with_shape()

template<typename T , int... n>
constexpr SMITH_HOST_DEVICE auto smith::tensor_with_shape ( std::integer_sequence< int, n... >  )
constexpr

Creates a tensor given the dimensions in a std::integer_sequence.

See also
std::integer_sequence
Template Parameters
nThe parameter pack of integer dimensions

Definition at line 287 of file tensor.hpp.

◆ to_3x3()

template<typename T >
SMITH_HOST_DEVICE tensor<T, 3, 3> smith::to_3x3 ( const tensor< T, 2, 2 > &  A)

promotes a 2x2 matrix to a 3x3 matrix, by populating the upper left block, leaving zeroes in the third row / column

Parameters
[in]Athe 2x2 matrix to be promoted to a 3x3 matrix

Definition at line 1133 of file tensor.hpp.

◆ tr() [1/2]

template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::tr ( const isotropic_tensor< T, m, m > &  I)
constexpr

calculate the trace of an isotropic tensor

Template Parameters
Tthe types stored in the isotropic tensor
mthe number of rows and columns in I
Parameters
Ithe isotropic tensor to compute the trace of
Returns
the sum of the diagonal entries of I

Definition at line 270 of file isotropic_tensor.hpp.

◆ tr() [2/2]

template<typename T , int n>
constexpr SMITH_HOST_DEVICE auto smith::tr ( const tensor< T, n, n > &  A)
constexpr

Returns the trace of a square matrix.

Parameters
[in]AThe matrix to compute the trace of
Returns
The sum of the elements on the main diagonal

Definition at line 1149 of file tensor.hpp.

◆ transpose() [1/2]

template<typename T , int m>
constexpr SMITH_HOST_DEVICE auto smith::transpose ( const isotropic_tensor< T, m, m > &  I)
constexpr

return the transpose of an isotropic tensor

Template Parameters
Tthe types stored in the isotropic tensor
mthe number of rows and columns in I
Parameters
Ithe isotropic tensor to compute the trace of
Returns
a copy of I (isotropic matrices are symmetric)

Definition at line 284 of file isotropic_tensor.hpp.

◆ transpose() [2/2]

template<typename T , int m, int n>
constexpr SMITH_HOST_DEVICE auto smith::transpose ( const tensor< T, m, n > &  A)
constexpr

Returns the transpose of the matrix.

Parameters
[in]AThe matrix to obtain the transpose of

Definition at line 1275 of file tensor.hpp.

◆ tuple()

template<typename... T>
smith::tuple ( T...  ) -> tuple< T... >

Class template argument deduction rule for tuples.

Template Parameters
TThe variadic template parameter for tuple types

◆ type()

template<int i, typename... T>
constexpr SMITH_HOST_DEVICE auto smith::type ( const tuple< T... > &  values)
constexpr

a function intended to be used for extracting the ith type from a tuple.

Note
type<i>(my_tuple) returns a value, whereas get<i>(my_tuple) returns a reference
Template Parameters
ithe index of the tuple to query
Tthe types stored in the tuple
Parameters
valuesthe tuple of values
Returns
a copy of the ith entry of the input

Definition at line 376 of file tuple.hpp.

◆ typeString()

template<typename T >
std::string smith::typeString ( T &  var)

Return string of given parameter's type.

Template Parameters
Tthe type to get a string name for
Parameters
[in]varthe variable to get the type of
Returns
string representation of the type

Definition at line 36 of file debug_print.hpp.

◆ unary_minus_helper()

template<typename... T, int... i>
constexpr SMITH_HOST_DEVICE auto smith::unary_minus_helper ( const tuple< T... > &  x,
std::integer_sequence< int, i... >   
)
constexpr

A helper function for the - operator of tuples.

Template Parameters
Tthe types stored in the tuple y
iThe integer sequence to i
Parameters
xtuple of values
Returns
the returned tuple difference

Definition at line 539 of file tuple.hpp.

◆ uniaxial_stress_test()

template<typename MaterialType , typename StateType , typename... parameter_types>
auto smith::uniaxial_stress_test ( double  t_max,
size_t  num_steps,
const MaterialType  material,
const StateType  initial_state,
std::function< double(double)>  epsilon_xx,
const parameter_types...  parameter_functions 
)

Drive the material model thorugh a uniaxial tension experiment.

Drives material model through specified axial displacement gradient history. The time elaspses from 0 up to t_max. Currently only implemented for isotropic materials (or orthotropic materials with the principal axes aligned with the coordinate directions).

Parameters
t_maxupper limit of the time interval.
num_stepsThe number of discrete time points at which the response is sampled (uniformly spaced). This is inclusive of the point at time zero.
materialThe material model to use
initial_stateThe state variable collection for this material, set to the desired initial condition.
epsilon_xxA function describing the desired axial displacement gradient as a function of time. (NB axial displacement gradient is equivalent to engineering strain).
parameter_functionsPack of functions that return each parameter as a function of time. Leave empty if the material has no parameters.

Definition at line 42 of file material_verification_tools.hpp.

◆ uniaxial_stress_test_rate_dependent()

template<typename MaterialType , typename StateType , typename... parameter_types>
auto smith::uniaxial_stress_test_rate_dependent ( double  t_max,
size_t  num_steps,
const MaterialType  material,
const StateType  initial_state,
std::function< double(double)>  epsilon_xx,
const parameter_types...  parameter_functions 
)

Drive a rate-dependent material model thorugh a uniaxial tension experiment.

Drives material model through specified axial displacement gradient history. The time elapses from 0 up to t_max. Currently only implemented for isotropic materials (or orthotropic materials with the principal axes aligned with the coordinate directions).

Definition at line 92 of file material_verification_tools.hpp.

◆ version()

std::string smith::version ( bool  add_SHA = true)

Returns a string for the version of Smith.

Parameters
[in]add_SHAboolean for whether to add the Git SHA to the version if available
Returns
string value of the version of Smith

Definition at line 214 of file about.cpp.

◆ visit()

template<typename Visitor , typename Variant >
constexpr decltype(auto) smith::visit ( Visitor  visitor,
Variant &&  v 
)
constexpr

Applies a functor to the active variant element.

Parameters
[in]visitorThe functor to apply
[in]vThe variant to apply the functor to
See also
std::visit

Definition at line 365 of file variant.hpp.

◆ writeToFile() [1/5]

template<typename T >
void smith::writeToFile ( axom::Array< T, 2, smith::detail::host_memory_space >  arr,
std::string  filename 
)

write a 2D array of values out to file, in a space-separated format

Template Parameters
Tthe type of each value in the array
Parameters
arrthe array to write to file
filenamethe name of the output file

Definition at line 113 of file debug_print.hpp.

◆ writeToFile() [2/5]

template<typename T >
void smith::writeToFile ( axom::Array< T, 3, smith::detail::host_memory_space >  arr,
std::string  filename 
)

write a 3D array of values out to file, in a mathematica-compatible format

Template Parameters
Tthe type of each value in the array
Parameters
arrthe array to write to file
filenamethe name of the output file

Definition at line 136 of file debug_print.hpp.

◆ writeToFile() [3/5]

void smith::writeToFile ( mfem::SparseMatrix  A,
std::string  filename 
)

write a sparse matrix out to file

Parameters
Athe matrix to write to file
filenamethe name of the output file

Definition at line 90 of file debug_print.hpp.

◆ writeToFile() [4/5]

void smith::writeToFile ( mfem::Vector  v,
std::string  filename 
)

write an array of doubles out to file, in a space-separated format

Parameters
vthe values to write to file
filenamethe name of the output file

Definition at line 76 of file debug_print.hpp.

◆ writeToFile() [5/5]

template<typename T >
void smith::writeToFile ( std::vector< T >  v,
std::string  filename 
)

write an array of values out to file, in a space-separated format

Template Parameters
Tthe type of each value in the array
Parameters
vthe values to write to file
filenamethe name of the output file

Definition at line 62 of file debug_print.hpp.

Variable Documentation

◆ linearSolverMap

std::map<std::string, LinearSolver> smith::linearSolverMap
inline
Initial value:
= {
{"CG", LinearSolver::CG}, {"GMRES", LinearSolver::GMRES},
{"SuperLU", LinearSolver::SuperLU}, {"Strumpack", LinearSolver::Strumpack},
{"PetscCG", LinearSolver::PetscCG}, {"PetscGMRES", LinearSolver::PetscGMRES},
}

string->value matching for optionally entering options as string in command line

Definition at line 138 of file solver_config.hpp.

◆ nonlinearSolverMap

std::map<std::string, NonlinearSolver> smith::nonlinearSolverMap
inline
Initial value:
= {
{"Newton", NonlinearSolver::Newton},
{"LBFGS", NonlinearSolver::LBFGS},
{"NewtonLineSearch", NonlinearSolver::NewtonLineSearch},
{"TrustRegion", NonlinearSolver::TrustRegion},
{"KINFullStep", NonlinearSolver::KINFullStep},
{"KINBacktrackingLineSearch", NonlinearSolver::KINBacktrackingLineSearch},
{"KINPicard", NonlinearSolver::KINPicard},
{"PetscNewton", NonlinearSolver::PetscNewton},
{"PetscNewtonBacktracking", NonlinearSolver::PetscNewtonBacktracking},
{"PetscNewtonCriticalPoint", NonlinearSolver::PetscNewtonCriticalPoint},
{"PetscTrustRegion", NonlinearSolver::PetscTrustRegion},
}

string->value matching for optionally entering options as string in command line

Definition at line 200 of file solver_config.hpp.

◆ NoQData

std::shared_ptr< QuadratureData< Nothing > > smith::NoQData = ::std::make_shared<QuadratureData<Nothing>>()

a single instance of a QuadratureData container of Nothings, since they are all interchangeable

these values exist to serve as default arguments for materials without material state

Definition at line 18 of file quadrature_data.cpp.

◆ preconditionerMap

std::map<std::string, Preconditioner> smith::preconditionerMap
inline
Initial value:
= {
{"HypreJacobi", Preconditioner::HypreJacobi},
{"HypreL1Jacobi", Preconditioner::HypreL1Jacobi},
{"HypreGaussSeidel", Preconditioner::HypreGaussSeidel},
{"HypreAMG", Preconditioner::HypreAMG},
{"HypreILU", Preconditioner::HypreILU},
{"AMGX", Preconditioner::AMGX},
{"Petsc", Preconditioner::Petsc},
{"AMGFContact", Preconditioner::AMGFContact},
{"None", Preconditioner::None},
}

string->value matching for optionally entering options as string in command line

Definition at line 381 of file solver_config.hpp.