ENH: handle some miscellaneous mixed input types (#1378)

This commit is contained in:
Mark Olesen
2019-08-06 16:57:29 +02:00
committed by Andrew Heather
parent 39834d8f45
commit b86f9944d7
7 changed files with 77 additions and 3 deletions

View File

@ -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

View File

@ -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_);