Smith  0.1
Smith is an implicit thermal structural mechanics simulation code.
make_time_info_material.hpp
1 // Copyright (c) Lawrence Livermore National Security, LLC and
2 // other Smith Project Developers. See the top-level LICENSE file for
3 // details.
4 //
5 // SPDX-License-Identifier: (BSD-3-Clause)
6 
7 #pragma once
8 
9 #include <utility>
10 
11 #include "smith/physics/common.hpp"
13 
14 namespace smith {
15 
17 template <typename Material>
20  using State = typename Material::State;
21 
22  Material material;
23  double density;
24 
26  template <typename StateType, typename GradUType, typename GradVType, typename... Args>
27  SMITH_HOST_DEVICE auto operator()(const TimeInfo& /*t_info*/, StateType&& state, GradUType&& grad_u,
28  const GradVType& /*grad_v*/, Args&&... args) const
29  {
30  return material(std::forward<StateType>(state), std::forward<GradUType>(grad_u), std::forward<Args>(args)...);
31  }
32 };
33 
35 template <typename Material>
37 {
38  const double density = mat.density;
39  return TimeInfoMaterial<Material>{std::move(mat), density};
40 }
41 
42 } // namespace smith
This file contains the interface used for initializing/terminating any hardware accelerator-related f...
#define SMITH_HOST_DEVICE
Macro that evaluates to __host__ __device__ when compiling with nvcc or amdclang and does nothing on ...
Definition: accelerator.hpp:37
A file defining some enums and structs that are used by the different physics modules.
Accelerator functionality.
Definition: smith.cpp:36
TimeInfoMaterial< Material > makeTimeInfoMaterial(Material mat)
Create a TimeInfoMaterial adapter for a material with signature material(state, grad_u,...
Adapter that lets a material without time information satisfy the TimeInfo material interface.
SMITH_HOST_DEVICE auto operator()(const TimeInfo &, StateType &&state, GradUType &&grad_u, const GradVType &, Args &&... args) const
Evaluate the wrapped material, ignoring TimeInfo and velocity gradient.
Material material
Wrapped material.
double density
Density forwarded for solid mechanics inertial terms.
typename Material::State State
State type forwarded from the wrapped material.
struct storing time and timestep information
Definition: common.hpp:18