Tissue Forge C++ 0.2.1
Interactive, particle-based physics, chemistry and biology modeling and simulation environment
Loading...
Searching...
No Matches
tfParticle_cuda.h
1/*******************************************************************************
2 * This file is part of mdcore.
3 * Copyright (c) 2022-2024 T.J. Sego
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published
7 * by the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 ******************************************************************************/
19
20#ifndef _MDCORE_SOURCE_TFPARTICLE_CUDA_H_
21#define _MDCORE_SOURCE_TFPARTICLE_CUDA_H_
22
23#include <tfParticle.h>
24
25#include <cuda_runtime.h>
26
27
28namespace TissueForge::cuda {
29
30
31 // A wrap of Particle
32 struct Particle {
33 float4 x;
34 // v[0], v[1], v[2], radius
35 float4 v;
36
37 // id, typeId, clusterId, flags
38 int4 w;
39
40 __host__ __device__
41 Particle() :
42 w{-1, -1, -1, PARTICLE_NONE}
43 {}
44
45 __host__ __device__
46 Particle(TissueForge::Particle *p) :
47 x{p->x[0], p->x[1], p->x[2], p->x[3]},
48 v{p->v[0], p->v[1], p->v[2], p->radius},
49 w{p->id, p->typeId, p->clusterId, p->flags}
50 {}
51
52 __host__
53 Particle(TissueForge::Particle *p, int nr_states) :
54 x{p->x[0], p->x[1], p->x[2], p->x[3]},
55 v{p->v[0], p->v[1], p->v[2], p->radius},
56 w{p->id, p->typeId, p->clusterId, p->flags}
57 {}
58 };
59
60};
61
62#endif // _MDCORE_SOURCE_TFPARTICLE_CUDA_H_
Tissue Forge GPU acceleration on CUDA-supporting devices.
Definition tfAngleConfig.h:26
Definition tfParticle.h:101
int id
Definition tfParticle.h:182
int16_t typeId
Definition tfParticle.h:185
int32_t clusterId
Definition tfParticle.h:188
FPTYPE radius
Definition tfParticle.h:164
uint16_t flags
Definition tfParticle.h:191