36 template<
class ParcelType>
41 template<
class ParcelType>
44 sizeof(KinematicParcel<ParcelType>)
45 - offsetof(KinematicParcel<ParcelType>, active_)
51 template<
class ParcelType>
74 if (is.
format() == IOstream::ASCII)
95 readRawScalar(is, &nParticle_);
96 readRawScalar(is, &d_);
97 readRawScalar(is, &dTarget_);
98 readRawScalar(is, U_.data(), vector::nComponents);
99 readRawScalar(is, &rho_);
100 readRawScalar(is, &age_);
101 readRawScalar(is, &tTurb_);
102 readRawScalar(is, UTurb_.data(), vector::nComponents);
108 is.
read(
reinterpret_cast<char*
>(&active_), sizeofFields);
116 template<
class ParcelType>
117 template<
class CloudType>
120 const bool valid =
c.size();
126 c.fieldIOobject(
"active", IOobject::MUST_READ),
129 c.checkFieldIOobject(
c, active);
133 c.fieldIOobject(
"typeId", IOobject::MUST_READ),
136 c.checkFieldIOobject(
c, typeId);
140 c.fieldIOobject(
"nParticle", IOobject::MUST_READ),
143 c.checkFieldIOobject(
c, nParticle);
147 c.fieldIOobject(
"d", IOobject::MUST_READ),
150 c.checkFieldIOobject(
c, d);
154 c.fieldIOobject(
"dTarget", IOobject::MUST_READ),
157 c.checkFieldIOobject(
c, dTarget);
161 c.fieldIOobject(
"U", IOobject::MUST_READ),
164 c.checkFieldIOobject(
c,
U);
168 c.fieldIOobject(
"rho", IOobject::MUST_READ),
171 c.checkFieldIOobject(
c,
rho);
175 c.fieldIOobject(
"age", IOobject::MUST_READ),
178 c.checkFieldIOobject(
c, age);
182 c.fieldIOobject(
"tTurb", IOobject::MUST_READ),
185 c.checkFieldIOobject(
c, tTurb);
189 c.fieldIOobject(
"UTurb", IOobject::MUST_READ),
192 c.checkFieldIOobject(
c, UTurb);
198 p.active_ = active[i];
199 p.typeId_ = typeId[i];
200 p.nParticle_ = nParticle[i];
202 p.dTarget_ = dTarget[i];
214 template<
class ParcelType>
215 template<
class CloudType>
220 const label np =
c.size();
221 const bool valid = np;
223 IOField<label> active(
c.fieldIOobject(
"active", IOobject::NO_READ), np);
224 IOField<label> typeId(
c.fieldIOobject(
"typeId", IOobject::NO_READ), np);
227 c.fieldIOobject(
"nParticle", IOobject::NO_READ),
242 active[i] =
p.active();
243 typeId[i] =
p.typeId();
244 nParticle[i] =
p.nParticle();
246 dTarget[i] =
p.dTarget();
250 tTurb[i] =
p.tTurb();
251 UTurb[i] =
p.UTurb();
258 nParticle.write(valid);
260 dTarget.write(valid);
269 template<
class ParcelType>
278 ParcelType::writeProperties(os, filters, delim, namesOnly);
281 #define writeProp(Name, Value) \
282 ParcelType::writeProperty(os, Name, Value, namesOnly, delim, filters)
299 template<
class ParcelType>
300 template<
class CloudType>
307 ParcelType::readObjects(
c, obr);
309 if (!
c.size())
return;
311 const auto& active = cloud::lookupIOField<label>(
"active", obr);
312 const auto& typeId = cloud::lookupIOField<label>(
"typeId", obr);
313 const auto& nParticle = cloud::lookupIOField<scalar>(
"nParticle", obr);
314 const auto& d = cloud::lookupIOField<scalar>(
"d", obr);
315 const auto& dTarget = cloud::lookupIOField<scalar>(
"dTarget", obr);
316 const auto&
U = cloud::lookupIOField<vector>(
"U", obr);
317 const auto&
rho = cloud::lookupIOField<scalar>(
"rho", obr);
318 const auto& age = cloud::lookupIOField<scalar>(
"age", obr);
319 const auto& tTurb = cloud::lookupIOField<scalar>(
"tTurb", obr);
320 const auto& UTurb = cloud::lookupIOField<vector>(
"UTurb", obr);
326 p.active_ = active[i];
327 p.typeId_ = typeId[i];
328 p.nParticle_ = nParticle[i];
330 p.dTarget_ = dTarget[i];
342 template<
class ParcelType>
343 template<
class CloudType>
350 ParcelType::writeObjects(
c, obr);
352 const label np =
c.size();
354 auto& active = cloud::createIOField<label>(
"active", np, obr);
355 auto& typeId = cloud::createIOField<label>(
"typeId", np, obr);
356 auto& nParticle = cloud::createIOField<scalar>(
"nParticle", np, obr);
357 auto& d = cloud::createIOField<scalar>(
"d", np, obr);
358 auto& dTarget = cloud::createIOField<scalar>(
"dTarget", np, obr);
359 auto&
U = cloud::createIOField<vector>(
"U", np, obr);
360 auto&
rho = cloud::createIOField<scalar>(
"rho", np, obr);
361 auto& age = cloud::createIOField<scalar>(
"age", np, obr);
362 auto& tTurb = cloud::createIOField<scalar>(
"tTurb", np, obr);
363 auto&& UTurb = cloud::createIOField<vector>(
"UTurb", np, obr);
369 active[i] =
p.active();
370 typeId[i] =
p.typeId();
371 nParticle[i] =
p.nParticle();
373 dTarget[i] =
p.dTarget();
377 tTurb[i] =
p.tTurb();
378 UTurb[i] =
p.UTurb();
387 template<
class ParcelType>
394 if (os.format() == IOstream::ASCII)
396 os << static_cast<const ParcelType&>(
p)
397 << token::SPACE <<
bool(
p.active())
398 << token::SPACE <<
p.typeId()
399 << token::SPACE <<
p.nParticle()
400 << token::SPACE <<
p.d()
401 << token::SPACE <<
p.dTarget()
402 << token::SPACE <<
p.U()
403 << token::SPACE <<
p.rho()
404 << token::SPACE <<
p.age()
405 << token::SPACE <<
p.tTurb()
406 << token::SPACE <<
p.UTurb();
410 os << static_cast<const ParcelType&>(
p);
413 reinterpret_cast<const char*
>(&
p.active_),
414 KinematicParcel<ParcelType>::sizeofFields