/home/runner/work/kynema/kynema/kynema/src/interfaces/host_state.hpp Source File

Kynema API: /home/runner/work/kynema/kynema/kynema/src/interfaces/host_state.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
host_state.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "state/state.hpp"
4
5namespace kynema::interfaces {
6
21template <typename DeviceType>
22struct HostState {
23 template <typename ValueType>
24 using HostView = typename Kokkos::View<ValueType, DeviceType>::HostMirror;
25
28
31
34
37
40
42 explicit HostState(const State<DeviceType>& state)
43 : x(Kokkos::create_mirror_view(Kokkos::WithoutInitializing, state.x)),
44 q(Kokkos::create_mirror_view(Kokkos::WithoutInitializing, state.q)),
45 v(Kokkos::create_mirror_view(Kokkos::WithoutInitializing, state.v)),
46 vd(Kokkos::create_mirror_view(Kokkos::WithoutInitializing, state.vd)),
47 f(Kokkos::create_mirror_view(Kokkos::WithoutInitializing, state.f)) {}
48
50 void CopyFromState(const State<DeviceType>& state) const {
51 Kokkos::deep_copy(this->x, state.x);
52 Kokkos::deep_copy(this->q, state.q);
53 Kokkos::deep_copy(this->v, state.v);
54 Kokkos::deep_copy(this->vd, state.vd);
55 }
56};
57
58} // namespace kynema::interfaces
Definition blade_interface.cpp:9
Container for storing the complete system state of the simulation at a given time increment.
Definition state.hpp:18
View< double *[6]> v
Definition state.hpp:34
View< double *[7]> x
Definition state.hpp:30
View< double *[7]> q
Definition state.hpp:33
View< double *[6]> vd
Definition state.hpp:35
Host-side mirror of the simulation state for a given time increment.
Definition host_state.hpp:22
HostView< double *[6]> f
Host local copy of external forces.
Definition host_state.hpp:39
HostView< double *[7]> x
Host local copy of current position.
Definition host_state.hpp:27
typename Kokkos::View< ValueType, DeviceType >::HostMirror HostView
Definition host_state.hpp:24
HostView< double *[6]> vd
Host local copy of current acceleration.
Definition host_state.hpp:36
void CopyFromState(const State< DeviceType > &state) const
Copy state data to host state.
Definition host_state.hpp:50
HostView< double *[6]> v
Host local copy of current velocity.
Definition host_state.hpp:33
HostState(const State< DeviceType > &state)
Construct host state from state.
Definition host_state.hpp:42
HostView< double *[7]> q
Host local copy of current displacement.
Definition host_state.hpp:30