mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: handle some miscellaneous mixed input types (#1378)
This commit is contained in:
committed by
Andrew Heather
parent
39834d8f45
commit
b86f9944d7
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -61,6 +61,21 @@ Foam::DTRMParticle::DTRMParticle
|
||||
{
|
||||
is >> p0_ >> p1_ >> I0_ >> I_ >> dA_ >> transmissiveId_;
|
||||
}
|
||||
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
|
||||
{
|
||||
// Non-native label or scalar size
|
||||
|
||||
is.beginRawRead();
|
||||
|
||||
readRawScalar(is, p0_.data(), vector::nComponents);
|
||||
readRawScalar(is, p1_.data(), vector::nComponents);
|
||||
readRawScalar(is, &I0_);
|
||||
readRawScalar(is, &I_);
|
||||
readRawScalar(is, &dA_);
|
||||
readRawLabel(is, &transmissiveId_);
|
||||
|
||||
is.endRawRead();
|
||||
}
|
||||
else
|
||||
{
|
||||
is.read(reinterpret_cast<char*>(&p0_), sizeofFields_);
|
||||
|
||||
@ -227,6 +227,10 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO (2019-08-06):
|
||||
// cannot properly handle mixed-precision reading
|
||||
// owning to bool and Point type.
|
||||
|
||||
is.read
|
||||
(
|
||||
reinterpret_cast<char*>(&pHit),
|
||||
|
||||
@ -231,6 +231,16 @@ Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::directionInfo& wDist)
|
||||
{
|
||||
is >> wDist.index_ >> wDist.n_;
|
||||
}
|
||||
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
|
||||
{
|
||||
// Non-native label or scalar size
|
||||
is.beginRawRead();
|
||||
|
||||
readRawLabel(is, &wDist.index_);
|
||||
readRawScalar(is, wDist.n_.data(), vector::nComponents);
|
||||
|
||||
is.endRawRead();
|
||||
}
|
||||
else
|
||||
{
|
||||
is.read
|
||||
|
||||
@ -59,6 +59,15 @@ Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::wallNormalInfo& wDist)
|
||||
{
|
||||
is >> wDist.normal_;
|
||||
}
|
||||
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
|
||||
{
|
||||
// Non-native label or scalar size
|
||||
is.beginRawRead();
|
||||
|
||||
readRawScalar(is, wDist.normal_.data(), vector::nComponents);
|
||||
|
||||
is.endRawRead();
|
||||
}
|
||||
else
|
||||
{
|
||||
is.read
|
||||
|
||||
@ -79,6 +79,17 @@ Foam::findCellParticle::findCellParticle
|
||||
{
|
||||
is >> start_ >> end_ >> data_;
|
||||
}
|
||||
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
|
||||
{
|
||||
// Non-native label or scalar size
|
||||
is.beginRawRead();
|
||||
|
||||
readRawScalar(is, start_.data(), vector::nComponents);
|
||||
readRawScalar(is, end_.data(), vector::nComponents);
|
||||
readRawLabel(is, &data_);
|
||||
|
||||
is.endRawRead();
|
||||
}
|
||||
else
|
||||
{
|
||||
is.read
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
@ -418,7 +418,6 @@ Foam::wallBoundedParticle::wallBoundedParticle
|
||||
const label diagEdge
|
||||
)
|
||||
:
|
||||
// particle(mesh, barycentric(1, 0, 0, 0), celli, tetFacei, tetPti),
|
||||
particle(mesh, position, celli, tetFacei, tetPti, false),
|
||||
localPosition_(position),
|
||||
meshEdgeStart_(meshEdgeStart),
|
||||
@ -442,6 +441,18 @@ Foam::wallBoundedParticle::wallBoundedParticle
|
||||
{
|
||||
is >> localPosition_ >> meshEdgeStart_ >> diagEdge_;
|
||||
}
|
||||
if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
|
||||
{
|
||||
// Non-native label or scalar size
|
||||
|
||||
is.beginRawRead();
|
||||
|
||||
readRawScalar(is, localPosition_.data(), vector::nComponents);
|
||||
readRawLabel(is, &meshEdgeStart_);
|
||||
readRawLabel(is, &diagEdge_);
|
||||
|
||||
is.endRawRead();
|
||||
}
|
||||
else
|
||||
{
|
||||
is.read(reinterpret_cast<char*>(&localPosition_), sizeofFields_);
|
||||
|
||||
@ -99,6 +99,20 @@ Foam::trackedParticle::trackedParticle
|
||||
{
|
||||
is >> start_ >> end_ >> level_ >> i_ >> j_ >> k_;
|
||||
}
|
||||
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
|
||||
{
|
||||
// Non-native label or scalar size
|
||||
is.beginRawRead();
|
||||
|
||||
readRawScalar(is, start_.data(), vector::nComponents);
|
||||
readRawScalar(is, end_.data(), vector::nComponents);
|
||||
readRawLabel(is, &level_);
|
||||
readRawLabel(is, &i_);
|
||||
readRawLabel(is, &j_);
|
||||
readRawLabel(is, &k_);
|
||||
|
||||
is.endRawRead();
|
||||
}
|
||||
else
|
||||
{
|
||||
is.read
|
||||
|
||||
Reference in New Issue
Block a user