hemocell
Loading...
Searching...
No Matches
hemoCellParticle.h
Go to the documentation of this file.
1/*
2This file is part of the HemoCell library
3
4HemoCell is developed and maintained by the Computational Science Lab
5in the University of Amsterdam. Any questions or remarks regarding this library
6can be sent to: info@hemocell.eu
7
8When using the HemoCell library in scientific work please cite the
9corresponding paper: https://doi.org/10.3389/fphys.2017.00563
10
11The HemoCell library is free software: you can redistribute it and/or
12modify it under the terms of the GNU Affero General Public License as
13published by the Free Software Foundation, either version 3 of the
14License, or (at your option) any later version.
15
16The library is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU Affero General Public License for more details.
20
21You should have received a copy of the GNU Affero General Public License
22along with this program. If not, see <http://www.gnu.org/licenses/>.
23*/
24#ifndef SURFACE_PARTICLE_3D_H
25#define SURFACE_PARTICLE_3D_H
26namespace hemo {
27 class HemoCellParticle;
28}
29#include "helper/array.h"
30#include "core/cell.hh"
31
32#include <cstdint>
33
34#ifndef PARTICLE_ID
35#define PARTICLE_ID 0
36#endif
37
38namespace hemo {
39
41public:
42
43 //VARIABLES
44 //Store variables in struct for fast serialization
50#if HEMOCELL_MATERIAL_INTEGRATION == 2
51 hemo::Array<T,3> vPrevious;
52#endif
54
55 uint16_t vertexId;
56 unsigned int restime;
57
58 unsigned char celltype;
59
60#ifdef SOLIDIFY_MECHANICS
61 bool solidify;
62#endif
63 };
64
66
69 #ifdef INTERIOR_VISCOSITY
70 hemo::Array<T,3> normalDirection;
71 //Is vector, optimize with hemo::Array possible
72 std::vector<hemo::Array<plint, 3>> kernelCoordinates;
73 #endif
74
75 std::vector<plb::Cell<T,DESCRIPTOR>*> kernelLocations;
76 std::vector<T> kernelWeights;
77
81 hemo::Array<T,3> *force_area = &sv.force; //Default to pointing to force, if output is desired, it can be stored seperately
84
85
86public:
89 sv = copy.sv;
91 tag = copy.tag;
94 #ifdef INTERIOR_VISCOSITY
95 normalDirection = copy.normalDirection;
96 kernelCoordinates = copy.kernelCoordinates;
97 #endif
98
99 if (!(&copy.sv.force == copy.force_volume)) {
102 force_link = copy.force_link;
103 force_area = copy.force_area;
104 force_visc = copy.force_visc;
106 }
107 }
108
109 HemoCellParticle (hemo::Array<T,3> position_, plint cellId_, plint vertexId_,pluint celltype_) {
110 sv.v = {0.,0.,0.};
111 sv.position = position_;
112 sv.force = {0.,0.,0.};
113 sv.force_repulsion = {0.,0.,0.};
114 sv.cellId = cellId_;
115 sv.vertexId = vertexId_;
116 sv.celltype=celltype_;
117 sv.restime= 0.0;
118#ifdef SOLIDIFY_MECHANICS
119 sv.solidify = false;
120#endif
121 force_total = {0.,0.,0.};
122#ifdef INTERIOR_VISCOSITY
123 normalDirection = {0.,0.,0.};
124#endif
125 tag = -1;
126
127 if (vertexId_ > UINT16_MAX) {
128 std::cerr << "(HemoCellParticle) Trying to add more vertexes to a single cell than UINT16_MAX, consider converting vertexid to a long int" << std::endl;
129 exit(1);
130 }
131 }
132
134 sv = sv_;
135 force_total = {0.,0.,0.};
136 tag = -1;
137 }
138
140 sv = copy.sv;
143 #ifdef INTERIOR_VISCOSITY
144 normalDirection = copy.normalDirection;
145 kernelCoordinates = copy.kernelCoordinates;
146 #endif
147
148 if (&copy.sv.force == copy.force_volume) {
155 } else {
158 force_link = copy.force_link;
159 force_area = copy.force_area;
160 force_visc = copy.force_visc;
162 }
163
164 tag = copy.tag;
165 sv.cellId = copy.sv.cellId;
166 sv.restime = copy.sv.restime;
167 sv.vertexId = copy.sv.vertexId;
168 sv.celltype = copy.sv.celltype;
169
170 return *this;
171 }
172
174 HemoCellParticle* sparticle = new HemoCellParticle(*this);
175 return sparticle;
176 }
177
186
188 void advance() {
189
190 /* scheme:
191 * 1: Euler
192 * 2: Adams-Bashforth
193 */
194 #if HEMOCELL_MATERIAL_INTEGRATION == 1
195 sv.position += sv.v;
196
197 #elif HEMOCELL_MATERIAL_INTEGRATION == 2
198 hemo::Array<T,3> dxyz = (1.5*v - 0.5*vPrevious);
199 position += dxyz;
200 vPrevious = v; // Store velocity
201 #endif
202 //v = {0.0,0.0,0.0};
203 }
204
205 inline int getId() const {return PARTICLE_ID;}
206 inline plint getTag() { return tag; } //TODO remove for direct access
207 inline void setTag(plint tag_) { tag = tag_; }
208
209};
210
211}
212#endif // SURFACE_PARTICLE_3D_H
213
Definition hemoCellParticle.h:40
hemo::Array< T, 3 > * force_link
Definition hemoCellParticle.h:80
hemo::Array< T, 3 > * force_area
Definition hemoCellParticle.h:81
hemo::Array< T, 3 > * force_bending
Definition hemoCellParticle.h:79
void advance()
Implements Euler integration with velocity alone.
Definition hemoCellParticle.h:188
std::vector< T > kernelWeights
Definition hemoCellParticle.h:76
HemoCellParticle(hemo::Array< T, 3 > position_, plint cellId_, plint vertexId_, pluint celltype_)
Definition hemoCellParticle.h:109
int getId() const
Definition hemoCellParticle.h:205
plint tag
Definition hemoCellParticle.h:68
serializeValues_t sv
Definition hemoCellParticle.h:65
void setTag(plint tag_)
Definition hemoCellParticle.h:207
HemoCellParticle & operator=(const HemoCellParticle &copy)
Definition hemoCellParticle.h:139
plint getTag()
Definition hemoCellParticle.h:206
HemoCellParticle(const serializeValues_t &sv_)
Definition hemoCellParticle.h:133
~HemoCellParticle()
Definition hemoCellParticle.h:87
hemo::Array< T, 3 > * force_visc
Definition hemoCellParticle.h:82
hemo::Array< T, 3 > force_total
Definition hemoCellParticle.h:67
HemoCellParticle(const HemoCellParticle &copy)
Definition hemoCellParticle.h:88
void repoint_force_vectors()
Definition hemoCellParticle.h:178
hemo::Array< T, 3 > * force_inner_link
Definition hemoCellParticle.h:83
hemo::Array< T, 3 > * force_volume
Definition hemoCellParticle.h:78
HemoCellParticle * clone() const
Definition hemoCellParticle.h:173
std::vector< plb::Cell< T, DESCRIPTOR > * > kernelLocations
Definition hemoCellParticle.h:75
long int plint
Definition constant_defaults.h:127
long unsigned int pluint
Definition constant_defaults.h:130
#define PARTICLE_ID
Definition hemoCellParticle.h:35
Definition config.cpp:34
Definition array.h:39
Definition hemoCellParticle.h:45
hemo::Array< T, 3 > v
Definition hemoCellParticle.h:46
hemo::Array< T, 3 > position
Definition hemoCellParticle.h:47
unsigned char celltype
Definition hemoCellParticle.h:58
hemo::Array< T, 3 > force
Definition hemoCellParticle.h:48
hemo::Array< T, 3 > force_repulsion
Definition hemoCellParticle.h:49
unsigned int restime
Definition hemoCellParticle.h:56
uint16_t vertexId
Definition hemoCellParticle.h:55
plint cellId
Definition hemoCellParticle.h:53