36 template<
class ParcelType>
41 template<
class ParcelType>
44 sizeof(KinematicParcel<ParcelType>)
45 - offsetof(KinematicParcel<ParcelType>, active_)
51 template<
class ParcelType>
75 if (is.
format() == IOstream::ASCII)
97 readRawScalar(is, &nParticle_);
98 readRawScalar(is, &d_);
99 readRawScalar(is, &dTarget_);
100 readRawScalar(is, U_.data(), vector::nComponents);
101 readRawScalar(is, &rho_);
102 readRawScalar(is, &age_);
103 readRawScalar(is, &tTurb_);
104 readRawScalar(is, UTurb_.data(), vector::nComponents);
105 readRawScalar(is, UCorrect_.data(), vector::nComponents);
111 is.
read(
reinterpret_cast<char*
>(&active_), sizeofFields);
119 template<
class ParcelType>
120 template<
class CloudType>
123 const bool valid =
c.size();
129 c.fieldIOobject(
"active", IOobject::MUST_READ),
132 c.checkFieldIOobject(
c, active);
136 c.fieldIOobject(
"typeId", IOobject::MUST_READ),
139 c.checkFieldIOobject(
c, typeId);
143 c.fieldIOobject(
"nParticle", IOobject::MUST_READ),
146 c.checkFieldIOobject(
c, nParticle);
150 c.fieldIOobject(
"d", IOobject::MUST_READ),
153 c.checkFieldIOobject(
c, d);
157 c.fieldIOobject(
"dTarget", IOobject::MUST_READ),
160 c.checkFieldIOobject(
c, dTarget);
164 c.fieldIOobject(
"U", IOobject::MUST_READ),
167 c.checkFieldIOobject(
c,
U);
171 c.fieldIOobject(
"rho", IOobject::MUST_READ),
174 c.checkFieldIOobject(
c,
rho);
178 c.fieldIOobject(
"age", IOobject::MUST_READ),
181 c.checkFieldIOobject(
c, age);
185 c.fieldIOobject(
"tTurb", IOobject::MUST_READ),
188 c.checkFieldIOobject(
c, tTurb);
192 c.fieldIOobject(
"UTurb", IOobject::MUST_READ),
195 c.checkFieldIOobject(
c, UTurb);
199 c.fieldIOobject(
"UCorrect", IOobject::MUST_READ),
202 c.checkFieldIOobject(
c, UCorrect);
208 p.active_ = active[i];
209 p.typeId_ = typeId[i];
210 p.nParticle_ = nParticle[i];
212 p.dTarget_ = dTarget[i];
218 p.UCorrect_ = UCorrect[i];
225 template<
class ParcelType>
226 template<
class CloudType>
231 const label np =
c.size();
232 const bool valid = np;
234 IOField<label> active(
c.fieldIOobject(
"active", IOobject::NO_READ), np);
235 IOField<label> typeId(
c.fieldIOobject(
"typeId", IOobject::NO_READ), np);
238 c.fieldIOobject(
"nParticle", IOobject::NO_READ),
248 IOField<vector> UCorrect(
c.fieldIOobject(
"UCorrect", IOobject::NO_READ), np);
254 active[i] =
p.active();
255 typeId[i] =
p.typeId();
256 nParticle[i] =
p.nParticle();
258 dTarget[i] =
p.dTarget();
262 tTurb[i] =
p.tTurb();
263 UTurb[i] =
p.UTurb();
264 UCorrect[i] =
p.UCorrect();
271 nParticle.write(valid);
273 dTarget.write(valid);
279 UCorrect.write(valid);
283 template<
class ParcelType>
292 ParcelType::writeProperties(
os, filters, delim, namesOnly);
295 #define writeProp(Name, Value) \
296 ParcelType::writeProperty(os, Name, Value, namesOnly, delim, filters)
314 template<
class ParcelType>
315 template<
class CloudType>
322 ParcelType::readObjects(
c, obr);
324 if (!
c.size())
return;
326 const auto& active = cloud::lookupIOField<label>(
"active", obr);
327 const auto& typeId = cloud::lookupIOField<label>(
"typeId", obr);
328 const auto& nParticle = cloud::lookupIOField<scalar>(
"nParticle", obr);
329 const auto& d = cloud::lookupIOField<scalar>(
"d", obr);
330 const auto& dTarget = cloud::lookupIOField<scalar>(
"dTarget", obr);
331 const auto&
U = cloud::lookupIOField<vector>(
"U", obr);
332 const auto&
rho = cloud::lookupIOField<scalar>(
"rho", obr);
333 const auto& age = cloud::lookupIOField<scalar>(
"age", obr);
334 const auto& tTurb = cloud::lookupIOField<scalar>(
"tTurb", obr);
335 const auto& UTurb = cloud::lookupIOField<vector>(
"UTurb", obr);
336 const auto& UCorrect = cloud::lookupIOField<vector>(
"UCorrect", obr);
342 p.active_ = active[i];
343 p.typeId_ = typeId[i];
344 p.nParticle_ = nParticle[i];
346 p.dTarget_ = dTarget[i];
352 p.UCorrect_ = UCorrect[i];
359 template<
class ParcelType>
360 template<
class CloudType>
367 ParcelType::writeObjects(
c, obr);
369 const label np =
c.size();
371 auto& active = cloud::createIOField<label>(
"active", np, obr);
372 auto& typeId = cloud::createIOField<label>(
"typeId", np, obr);
373 auto& nParticle = cloud::createIOField<scalar>(
"nParticle", np, obr);
374 auto& d = cloud::createIOField<scalar>(
"d", np, obr);
375 auto& dTarget = cloud::createIOField<scalar>(
"dTarget", np, obr);
376 auto&
U = cloud::createIOField<vector>(
"U", np, obr);
377 auto&
rho = cloud::createIOField<scalar>(
"rho", np, obr);
378 auto& age = cloud::createIOField<scalar>(
"age", np, obr);
379 auto& tTurb = cloud::createIOField<scalar>(
"tTurb", np, obr);
380 auto&& UTurb = cloud::createIOField<vector>(
"UTurb", np, obr);
381 auto&& UCorrect = cloud::createIOField<vector>(
"UCorrect", np, obr);
387 active[i] =
p.active();
388 typeId[i] =
p.typeId();
389 nParticle[i] =
p.nParticle();
391 dTarget[i] =
p.dTarget();
395 tTurb[i] =
p.tTurb();
396 UTurb[i] =
p.UTurb();
397 UCorrect[i] =
p.UCorrect();
406 template<
class ParcelType>
413 if (
os.format() == IOstream::ASCII)
415 os << static_cast<const ParcelType&>(
p)
416 << token::SPACE <<
bool(
p.active())
417 << token::SPACE <<
p.typeId()
418 << token::SPACE <<
p.nParticle()
419 << token::SPACE <<
p.d()
420 << token::SPACE <<
p.dTarget()
421 << token::SPACE <<
p.U()
422 << token::SPACE <<
p.rho()
423 << token::SPACE <<
p.age()
424 << token::SPACE <<
p.tTurb()
425 << token::SPACE <<
p.UTurb()
426 << token::SPACE <<
p.UCorrect();
430 os << static_cast<const ParcelType&>(
p);
433 reinterpret_cast<const char*
>(&
p.active_),
434 KinematicParcel<ParcelType>::sizeofFields