NimbleSM
NimbleSM is a solid mechanics simulation code for dynamic systems
Loading...
Searching...
No Matches
nimble_kokkos::Block Class Reference

#include <nimble_kokkos_block.h>

Inheritance diagram for nimble_kokkos::Block:
nimble::BlockBase

Public Member Functions

 Block ()
 
 ~Block () override
 
void Initialize (std::string const &model_material_parameters, int num_elements, MaterialFactory &factory)
 
void InstantiateMaterialModel (int num_material_points, MaterialFactory &factory)
 
void InstantiateElement () override
 
std::shared_ptr< nimble::ElementGetHostElement ()
 
nimble::ElementGetDeviceElement ()
 
std::shared_ptr< nimble::MaterialGetHostMaterialModel ()
 
nimble::MaterialGetDeviceMaterialModel ()
 
DeviceElementConnectivityViewGetDeviceElementConnectivityView ()
 
std::shared_ptr< nimble::NGPLAMEData > GetNGPLAMEData ()
 
- Public Member Functions inherited from nimble::BlockBase
 BlockBase ()=default
 
virtual ~BlockBase ()=default
 
double GetDensity () const
 
double GetBulkModulus () const
 
double GetShearModulus () const
 
std::shared_ptr< MaterialGetMaterialPointer () const
 
std::shared_ptr< ElementGetElementPointer () const
 
virtual double ComputeCriticalTimeStep (const nimble::Viewify< 2 > &node_reference_coordinates, const nimble::Viewify< 2 > &node_displacements, int num_elem, const int *elem_conn) const
 
template<typename MatT>
void ComputeTangentStiffnessMatrix (int num_global_unknowns, const double *const reference_coordinates, const double *const displacement, int num_elem, const int *const elem_conn, const int *const global_node_ids, MatT &tangent_stiffness) const
 

Additional Inherited Members

- Protected Attributes inherited from nimble::BlockBase
std::string model_material_parameters_ = "none"
 
std::shared_ptr< Elementelement_ = nullptr
 
std::shared_ptr< Materialmaterial_ = nullptr
 

Constructor & Destructor Documentation

◆ Block()

nimble_kokkos::Block::Block ( )
inline
75 : BlockBase(), elem_conn_d("element_connectivity_d", 0), element_device_(nullptr), material_device_(nullptr)
76 {
77 }
BlockBase()=default

◆ ~Block()

nimble_kokkos::Block::~Block ( )
inlineoverride
80 {
81 /* Kokkos::parallel_for(1, KOKKOS_LAMBDA(int) { */
82 /* element_device_->~Element(); */
83 /* }); */
84 if (element_device_ != nullptr) { Kokkos::kokkos_free(element_device_); }
85 if (material_device_ != nullptr) { Kokkos::kokkos_free(material_device_); }
86 }

Member Function Documentation

◆ GetDeviceElement()

nimble::Element * nimble_kokkos::Block::GetDeviceElement ( )
inline
105 {
106 return element_device_;
107 }

◆ GetDeviceElementConnectivityView()

DeviceElementConnectivityView & nimble_kokkos::Block::GetDeviceElementConnectivityView ( )
inline
123 {
124 return elem_conn_d;
125 }

◆ GetDeviceMaterialModel()

nimble::Material * nimble_kokkos::Block::GetDeviceMaterialModel ( )
inline
117 {
118 return material_device_;
119 }

◆ GetHostElement()

std::shared_ptr< nimble::Element > nimble_kokkos::Block::GetHostElement ( )
inline
99 {
100 return element_;
101 }
std::shared_ptr< Element > element_
Definition nimble_block_base.h:117

◆ GetHostMaterialModel()

std::shared_ptr< nimble::Material > nimble_kokkos::Block::GetHostMaterialModel ( )
inline
111 {
112 return material_;
113 }
std::shared_ptr< Material > material_
Definition nimble_block_base.h:118

◆ GetNGPLAMEData()

std::shared_ptr< nimble::NGPLAMEData > nimble_kokkos::Block::GetNGPLAMEData ( )
inline
129 {
130 return ngp_lame_data_;
131 }

◆ Initialize()

void nimble_kokkos::Block::Initialize ( std::string const & model_material_parameters,
int num_elements,
MaterialFactory & factory )
51{
52 model_material_parameters_ = model_material_parameters;
54 int num_material_points = num_elements * element_->NumIntegrationPointsPerElement();
55 InstantiateMaterialModel(num_material_points, factory);
56}
std::string model_material_parameters_
Definition nimble_block_base.h:116
void InstantiateElement() override
Definition nimble_kokkos_block.cc:68
void InstantiateMaterialModel(int num_material_points, MaterialFactory &factory)
Definition nimble_kokkos_block.cc:59

◆ InstantiateElement()

void nimble_kokkos::Block::InstantiateElement ( )
overridevirtual

Implements nimble::BlockBase.

69{
70 // instantiate the element on the host (eventually we won't need this)
71 element_ = std::make_shared<nimble::HexElement>();
72
73 // instantiate the element on the device
74 element_device_ = static_cast<nimble::Element*>(Kokkos::kokkos_malloc<>("Element", sizeof(nimble::HexElement)));
75 nimble::Element* pointer_that_lives_on_the_stack = element_device_;
76 Kokkos::parallel_for(
77 1, KOKKOS_LAMBDA(int) { new (pointer_that_lives_on_the_stack) nimble::HexElement(); });
78}

◆ InstantiateMaterialModel()

void nimble_kokkos::Block::InstantiateMaterialModel ( int num_material_points,
MaterialFactory & factory )
60{
61 factory.parse_and_create(model_material_parameters_, num_material_points);
62 material_ = factory.get_material_host();
63 material_device_ = factory.get_material_device();
64 ngp_lame_data_ = factory.get_ngp_lame_data();
65}

The documentation for this class was generated from the following files: