Commit 094336ad authored by Mark OLESEN's avatar Mark OLESEN Committed by Andrew Heather
Browse files

ENH: add mixed reading for lagrangian types (#1378)

parent ffbb0710
......@@ -61,6 +61,18 @@ Foam::DSMCParcel<ParcelType>::DSMCParcel
{
is >> U_ >> Ei_ >> typeId_;
}
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
{
// Non-native label or scalar size
is.beginRawRead();
readRawScalar(is, U_.data(), vector::nComponents);
readRawScalar(is, &Ei_);
readRawLabel(is, &typeId_);
is.endRawRead();
}
else
{
is.read(reinterpret_cast<char*>(&U_), sizeofFields);
......
......@@ -69,9 +69,21 @@ Foam::injectedParticle::injectedParticle
{
is >> tag_ >> soi_ >> d_ >> U_;
}
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
{
// Non-native label or scalar size
is.beginRawRead();
readRawLabel(is, &tag_);
readRawScalar(is, &soi_);
readRawScalar(is, &d_);
readRawScalar(is, U_.data(), vector::nComponents);
is.endRawRead();
}
else
{
is.read(reinterpret_cast<char*>(&soi_), sizeofFields);
is.read(reinterpret_cast<char*>(&tag_), sizeofFields);
}
}
......
......@@ -73,6 +73,27 @@ Foam::particle::particle
is >> facei_ >> stepFraction_ >> origProc_ >> origId_;
}
}
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
{
// Non-native label or scalar size
is.beginRawRead();
readRawScalar(is, coordinates_.data(), barycentric::nComponents);
readRawLabel(is, &celli_);
readRawLabel(is, &tetFacei_);
readRawLabel(is, &tetPti_);
if (readFields)
{
readRawLabel(is, &facei_);
readRawScalar(is, &stepFraction_);
readRawLabel(is, &origProc_);
readRawLabel(is, &origId_);
}
is.endRawRead();
}
else
{
if (readFields)
......@@ -103,6 +124,27 @@ Foam::particle::particle
>> p.origId;
}
}
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
{
// Non-native label or scalar size
is.beginRawRead();
readRawScalar(is, p.position.data(), vector::nComponents);
readRawLabel(is, &p.celli);
if (readFields)
{
readRawLabel(is, &p.facei);
readRawScalar(is, &p.stepFraction);
readRawLabel(is, &p.tetFacei);
readRawLabel(is, &p.tetPti);
readRawLabel(is, &p.origProc);
readRawLabel(is, &p.origId);
}
is.endRawRead();
}
else
{
if (readFields)
......
......@@ -68,6 +68,18 @@ Foam::CollidingParcel<ParcelType>::CollidingParcel
is >> angularMomentum_;
is >> torque_;
}
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
{
// Non-native label or scalar size
is.beginRawRead();
readRawScalar(is, f_.data(), vector::nComponents);
readRawScalar(is, angularMomentum_.data(), vector::nComponents);
readRawScalar(is, torque_.data(), vector::nComponents);
is.endRawRead();
}
else
{
is.read(reinterpret_cast<char*>(&f_), sizeofFields);
......
......@@ -83,6 +83,25 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
>> tTurb_
>> UTurb_;
}
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
{
// Non-native label or scalar size
is.beginRawRead();
readRawLabel(is, &active_);
readRawLabel(is, &typeId_);
readRawScalar(is, &nParticle_);
readRawScalar(is, &d_);
readRawScalar(is, &dTarget_);
readRawScalar(is, U_.data(), vector::nComponents);
readRawScalar(is, &rho_);
readRawScalar(is, &age_);
readRawScalar(is, &tTurb_);
readRawScalar(is, UTurb_.data(), vector::nComponents);
is.endRawRead();
}
else
{
is.read(reinterpret_cast<char*>(&active_), sizeofFields);
......
......@@ -63,6 +63,16 @@ Foam::MPPICParcel<ParcelType>::MPPICParcel
{
is >> UCorrect_;
}
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
{
// Non-native label or scalar size
is.beginRawRead();
readRawScalar(is, UCorrect_.data(), vector::nComponents);
is.endRawRead();
}
else
{
is.read(reinterpret_cast<char*>(&UCorrect_), sizeofFields);
......
......@@ -63,14 +63,25 @@ Foam::ReactingParcel<ParcelType>::ReactingParcel
if (is.format() == IOstream::ASCII)
{
is >> mass0_ >> Ymix;
is >> mass0_;
}
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
{
// Non-native label or scalar size
is.beginRawRead();
readRawScalar(is, &mass0_);
is.endRawRead();
}
else
{
is.read(reinterpret_cast<char*>(&mass0_), sizeofFields);
is >> Ymix;
}
is >> Ymix;
Y_.transfer(Ymix);
}
......
......@@ -64,6 +64,17 @@ Foam::ThermoParcel<ParcelType>::ThermoParcel
{
is >> T_ >> Cp_;
}
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
{
// Non-native label or scalar size
is.beginRawRead();
readRawScalar(is, &T_);
readRawScalar(is, &Cp_);
is.endRawRead();
}
else
{
is.read(reinterpret_cast<char*>(&T_), sizeofFields);
......
......@@ -58,8 +58,8 @@ Foam::molecule::molecule
rf_(Zero),
special_(0),
id_(0),
siteForces_(0),
sitePositions_(0)
siteForces_(),
sitePositions_()
{
if (readFields)
{
......@@ -74,15 +74,33 @@ Foam::molecule::molecule
>> potentialEnergy_
>> rf_
>> special_
>> id_
>> siteForces_
>> sitePositions_;
>> id_;
}
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
{
// Non-native label or scalar size
is.beginRawRead();
readRawScalar(is, Q_.data(), tensor::nComponents);
readRawScalar(is, v_.data(), vector::nComponents);
readRawScalar(is, a_.data(), vector::nComponents);
readRawScalar(is, pi_.data(), vector::nComponents);
readRawScalar(is, tau_.data(), vector::nComponents);
readRawScalar(is, specialPosition_.data(), vector::nComponents);
readRawScalar(is, &potentialEnergy_);
readRawScalar(is, rf_.data(), tensor::nComponents);
readRawLabel(is, &special_);
readRawLabel(is, &id_);
is.endRawRead();
}
else
{
is.read(reinterpret_cast<char*>(&Q_), sizeofFields);
is >> siteForces_ >> sitePositions_;
}
is >> siteForces_ >> sitePositions_;
}
is.check(FUNCTION_NAME);
......
......@@ -54,6 +54,17 @@ Foam::solidParticle::solidParticle
{
is >> d_ >> U_;
}
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
{
// Non-native label or scalar size
is.beginRawRead();
readRawScalar(is, &d_);
readRawScalar(is, U_.data(), vector::nComponents);
is.endRawRead();
}
else
{
is.read(reinterpret_cast<char*>(&d_), sizeofFields);
......
......@@ -86,6 +86,28 @@ Foam::SprayParcel<ParcelType>::SprayParcel
>> tMom_
>> user_;
}
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
{
// Non-native label or scalar size
is.beginRawRead();
readRawScalar(is, &d0_);
readRawScalar(is, position0_.data(), vector::nComponents);
readRawScalar(is, &sigma_);
readRawScalar(is, &mu_);
readRawScalar(is, &liquidCore_);
readRawScalar(is, &KHindex_);
readRawScalar(is, &y_);
readRawScalar(is, &yDot_);
readRawScalar(is, &tc_);
readRawScalar(is, &ms_);
readRawScalar(is, &injector_);
readRawScalar(is, &tMom_);
readRawScalar(is, &user_);
is.endRawRead();
}
else
{
is.read(reinterpret_cast<char*>(&d0_), sizeofFields);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment