mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add vtk::writeIdentity() and optional repeat value for vtk::write()
- An identity is often useful when generating connectivity and offset information. - The optional repeat value for vtk::write() allows it to also be used as a fill method.
This commit is contained in:
committed by
Andrew Heather
parent
10a03ceba2
commit
4380349f45
@ -711,12 +711,7 @@ bool Foam::vtk::internalWriter::writeProcIDs()
|
|||||||
// Per-processor ids
|
// Per-processor ids
|
||||||
for (label proci=0; proci < Pstream::nProcs(); ++proci)
|
for (label proci=0; proci < Pstream::nProcs(); ++proci)
|
||||||
{
|
{
|
||||||
label len = procMaps.localSize(proci);
|
vtk::write(format(), proci, procMaps.localSize(proci));
|
||||||
|
|
||||||
while (len--)
|
|
||||||
{
|
|
||||||
format().write(proci);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
format().flush();
|
format().flush();
|
||||||
|
|||||||
@ -587,13 +587,7 @@ void Foam::vtk::patchWriter::writePatchIDs()
|
|||||||
{
|
{
|
||||||
for (const label patchId : patchIDs_)
|
for (const label patchId : patchIDs_)
|
||||||
{
|
{
|
||||||
label count = patches[patchId].size();
|
vtk::write(format(), patchId, patches[patchId].size());
|
||||||
const label val = patchId;
|
|
||||||
|
|
||||||
while (count--)
|
|
||||||
{
|
|
||||||
format().write(val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,16 +609,13 @@ void Foam::vtk::patchWriter::writePatchIDs()
|
|||||||
|
|
||||||
fromSlave >> recv;
|
fromSlave >> recv;
|
||||||
|
|
||||||
for (label i=0; i < recv.size(); ++i)
|
// Receive as [size, id] pairs
|
||||||
|
for (label i=0; i < recv.size(); i += 2)
|
||||||
{
|
{
|
||||||
label count = recv[i];
|
const label len = recv[i];
|
||||||
++i;
|
const label val = recv[i+1];
|
||||||
const label val = recv[i];
|
|
||||||
|
|
||||||
while (count--)
|
vtk::write(format(), val, len);
|
||||||
{
|
|
||||||
format().write(val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -722,12 +713,7 @@ bool Foam::vtk::patchWriter::writeProcIDs()
|
|||||||
// Per-processor ids
|
// Per-processor ids
|
||||||
for (label proci=0; proci < Pstream::nProcs(); ++proci)
|
for (label proci=0; proci < Pstream::nProcs(); ++proci)
|
||||||
{
|
{
|
||||||
label len = procSizes.localSize(proci);
|
vtk::write(format(), proci, procSizes.localSize(proci));
|
||||||
|
|
||||||
while (len--)
|
|
||||||
{
|
|
||||||
format().write(proci);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
good = true;
|
good = true;
|
||||||
@ -735,14 +721,7 @@ bool Foam::vtk::patchWriter::writeProcIDs()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const label proci = Pstream::myProcNo();
|
vtk::write(format(), Pstream::myProcNo(), nLocalFaces_);
|
||||||
|
|
||||||
label len = nLocalFaces_;
|
|
||||||
|
|
||||||
while (len--)
|
|
||||||
{
|
|
||||||
format().write(proci);
|
|
||||||
}
|
|
||||||
|
|
||||||
good = true;
|
good = true;
|
||||||
}
|
}
|
||||||
@ -811,16 +790,11 @@ bool Foam::vtk::patchWriter::writeNeighIDs()
|
|||||||
{
|
{
|
||||||
for (const label patchId : patchIDs_)
|
for (const label patchId : patchIDs_)
|
||||||
{
|
{
|
||||||
label count = patches[patchId].size();
|
|
||||||
|
|
||||||
const auto* pp = isA<processorPolyPatch>(patches[patchId]);
|
const auto* pp = isA<processorPolyPatch>(patches[patchId]);
|
||||||
|
|
||||||
const label val = (pp ? pp->neighbProcNo() : -1);
|
const label val = (pp ? pp->neighbProcNo() : -1);
|
||||||
|
|
||||||
while (count--)
|
vtk::write(format(), val, patches[patchId].size());
|
||||||
{
|
|
||||||
format().write(val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
good = true;
|
good = true;
|
||||||
@ -844,16 +818,13 @@ bool Foam::vtk::patchWriter::writeNeighIDs()
|
|||||||
|
|
||||||
fromSlave >> recv;
|
fromSlave >> recv;
|
||||||
|
|
||||||
for (label i=0; i < recv.size(); ++i)
|
// Receive as [size, id] pairs
|
||||||
|
for (label i=0; i < recv.size(); i += 2)
|
||||||
{
|
{
|
||||||
label count = recv[i];
|
const label len = recv[i];
|
||||||
++i;
|
const label val = recv[i+1];
|
||||||
const label val = recv[i];
|
|
||||||
|
|
||||||
while (count--)
|
vtk::write(format(), val, len);
|
||||||
{
|
|
||||||
format().write(val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,10 +81,7 @@ void Foam::vtk::fileWriter::writeUniform
|
|||||||
|
|
||||||
if (format_)
|
if (format_)
|
||||||
{
|
{
|
||||||
for (label i=0; i < nValues; ++i)
|
vtk::write(format(), val, nValues);
|
||||||
{
|
|
||||||
vtk::write(format(), val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format_)
|
if (format_)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -89,6 +89,22 @@ Foam::vtk::newFormatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::vtk::writeIdentity
|
||||||
|
(
|
||||||
|
vtk::formatter& fmt,
|
||||||
|
const label len,
|
||||||
|
label start
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// No nComponents for label, so use fmt.write() directly
|
||||||
|
for (label i=0; i < len; ++i)
|
||||||
|
{
|
||||||
|
fmt.write(start);
|
||||||
|
++start;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::vtk::writeList
|
void Foam::vtk::writeList
|
||||||
(
|
(
|
||||||
vtk::formatter& fmt,
|
vtk::formatter& fmt,
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -84,48 +84,32 @@ namespace vtk
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Write a list of uint8_t values.
|
//- Write an identity list of labels.
|
||||||
// The output does not include the payload size.
|
// The output does not include the payload size.
|
||||||
void writeList
|
void writeIdentity(vtk::formatter& fmt, const label len, label start=0);
|
||||||
(
|
|
||||||
vtk::formatter& fmt,
|
|
||||||
const UList<uint8_t>& values
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Write a list of uint8_t values.
|
//- Write a list of uint8_t values.
|
||||||
// The output does not include the payload size.
|
// The output does not include the payload size.
|
||||||
void writeListParallel
|
void writeList(vtk::formatter& fmt, const UList<uint8_t>& values);
|
||||||
(
|
|
||||||
vtk::formatter& fmt,
|
|
||||||
const UList<uint8_t>& values
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Write a value component-wise.
|
//- Write a list of uint8_t values.
|
||||||
|
// The output does not include the payload size.
|
||||||
|
void writeListParallel(vtk::formatter& fmt, const UList<uint8_t>& values);
|
||||||
|
|
||||||
|
//- Component-wise write of a value (N times)
|
||||||
template<class Type>
|
template<class Type>
|
||||||
inline void write
|
inline void write(vtk::formatter& fmt, const Type& val, const label n=1);
|
||||||
(
|
|
||||||
vtk::formatter& fmt,
|
|
||||||
const Type& val
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Write a list of values.
|
//- Write a list of values.
|
||||||
// The output does not include the payload size.
|
// The output does not include the payload size.
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void writeList
|
void writeList(vtk::formatter& fmt, const UList<Type>& values);
|
||||||
(
|
|
||||||
vtk::formatter& fmt,
|
|
||||||
const UList<Type>& values
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Write a list of values.
|
//- Write a list of values.
|
||||||
// The output does not include the payload size.
|
// The output does not include the payload size.
|
||||||
template<class Type, unsigned N>
|
template<class Type, unsigned N>
|
||||||
void writeList
|
void writeList(vtk::formatter& fmt, const FixedList<Type, N>& values);
|
||||||
(
|
|
||||||
vtk::formatter& fmt,
|
|
||||||
const FixedList<Type, N>& values
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Write a list of values via indirect addressing.
|
//- Write a list of values via indirect addressing.
|
||||||
@ -327,22 +311,6 @@ namespace legacy
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
//- Template specialization for symmTensor ordering
|
|
||||||
template<>
|
|
||||||
inline void write(vtk::formatter& fmt, const symmTensor& val)
|
|
||||||
{
|
|
||||||
// symmTensor ( XX, XY, XZ, YY, YZ, ZZ )
|
|
||||||
// VTK order ( XX, YY, ZZ, XY, YZ, XZ ) -> (0, 3, 5, 1, 4, 2)
|
|
||||||
|
|
||||||
fmt.write(component(val, 0)); // XX
|
|
||||||
fmt.write(component(val, 3)); // YY
|
|
||||||
fmt.write(component(val, 5)); // ZZ
|
|
||||||
fmt.write(component(val, 1)); // XY
|
|
||||||
fmt.write(component(val, 4)); // YZ
|
|
||||||
fmt.write(component(val, 2)); // XZ
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} // End namespace vtk
|
} // End namespace vtk
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -32,26 +32,53 @@ namespace vtk
|
|||||||
|
|
||||||
//- Template specialization for label
|
//- Template specialization for label
|
||||||
template<>
|
template<>
|
||||||
inline void write<label>(vtk::formatter& fmt, const label& val)
|
inline void write<label>(vtk::formatter& fmt, const label& val, const label n)
|
||||||
|
{
|
||||||
|
for (label i=0; i < n; ++i)
|
||||||
{
|
{
|
||||||
fmt.write(val);
|
fmt.write(val);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Template specialization for float
|
//- Template specialization for float
|
||||||
template<>
|
template<>
|
||||||
inline void write<float>(vtk::formatter& fmt, const float& val)
|
inline void write<float>(vtk::formatter& fmt, const float& val, const label n)
|
||||||
|
{
|
||||||
|
for (label i=0; i < n; ++i)
|
||||||
{
|
{
|
||||||
fmt.write(val);
|
fmt.write(val);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Template specialization for double
|
//- Template specialization for double
|
||||||
template<>
|
template<>
|
||||||
inline void write<double>(vtk::formatter& fmt, const double& val)
|
inline void write<double>(vtk::formatter& fmt, const double& val, const label n)
|
||||||
|
{
|
||||||
|
for (label i=0; i < n; ++i)
|
||||||
{
|
{
|
||||||
fmt.write(val);
|
fmt.write(val);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Template specialization for symmTensor ordering
|
||||||
|
// VTK order is (XX, YY, ZZ, XY, YZ, XZ)
|
||||||
|
template<>
|
||||||
|
inline void write(vtk::formatter& fmt, const symmTensor& val, const label n)
|
||||||
|
{
|
||||||
|
for (label i=0; i < n; ++i)
|
||||||
|
{
|
||||||
|
fmt.write(component(val, symmTensor::XX));
|
||||||
|
fmt.write(component(val, symmTensor::YY));
|
||||||
|
fmt.write(component(val, symmTensor::ZZ));
|
||||||
|
fmt.write(component(val, symmTensor::XY));
|
||||||
|
fmt.write(component(val, symmTensor::YZ));
|
||||||
|
fmt.write(component(val, symmTensor::XZ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // End namespace vtk
|
} // End namespace vtk
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -32,15 +32,20 @@ template<class Type>
|
|||||||
inline void Foam::vtk::write
|
inline void Foam::vtk::write
|
||||||
(
|
(
|
||||||
vtk::formatter& fmt,
|
vtk::formatter& fmt,
|
||||||
const Type& val
|
const Type& val,
|
||||||
|
const label n
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const direction nCmpt = pTraits<Type>::nComponents;
|
const direction nCmpt = pTraits<Type>::nComponents;
|
||||||
|
|
||||||
|
for (label i=0; i < n; ++i)
|
||||||
|
{
|
||||||
for (direction cmpt=0; cmpt < nCmpt; ++cmpt)
|
for (direction cmpt=0; cmpt < nCmpt; ++cmpt)
|
||||||
{
|
{
|
||||||
fmt.write(component(val, cmpt));
|
fmt.write(component(val, cmpt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -69,10 +69,8 @@ void Foam::functionObjects::vtkCloud::writeVerts
|
|||||||
format().beginDataArray<label>(vtk::dataArrayAttr::CONNECTIVITY);
|
format().beginDataArray<label>(vtk::dataArrayAttr::CONNECTIVITY);
|
||||||
format().writeSize(payLoad);
|
format().writeSize(payLoad);
|
||||||
|
|
||||||
for (label i=0; i < nTotParcels; ++i)
|
vtk::writeIdentity(format(), nTotParcels);
|
||||||
{
|
|
||||||
format().write(i);
|
|
||||||
}
|
|
||||||
format().flush();
|
format().flush();
|
||||||
format().endDataArray();
|
format().endDataArray();
|
||||||
}
|
}
|
||||||
@ -85,10 +83,8 @@ void Foam::functionObjects::vtkCloud::writeVerts
|
|||||||
format().beginDataArray<label>(vtk::dataArrayAttr::OFFSETS);
|
format().beginDataArray<label>(vtk::dataArrayAttr::OFFSETS);
|
||||||
format().writeSize(payLoad);
|
format().writeSize(payLoad);
|
||||||
|
|
||||||
for (label i=0; i < nTotParcels; ++i)
|
vtk::writeIdentity(format(), nTotParcels, 1);
|
||||||
{
|
|
||||||
format().write(i+1);
|
|
||||||
}
|
|
||||||
format().flush();
|
format().flush();
|
||||||
format().endDataArray();
|
format().endDataArray();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,9 +43,9 @@ Foam::pointField Foam::vtk::lagrangianWriter::positions() const
|
|||||||
|
|
||||||
auto outIter = pts.begin();
|
auto outIter = pts.begin();
|
||||||
|
|
||||||
forAllConstIters(parcels, iter)
|
for (const auto& p : parcels)
|
||||||
{
|
{
|
||||||
*outIter = iter().position();
|
*outIter = p.position();
|
||||||
++outIter;
|
++outIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,10 +74,8 @@ void Foam::vtk::lagrangianWriter::writeVerts()
|
|||||||
format().beginDataArray<label>(vtk::dataArrayAttr::CONNECTIVITY);
|
format().beginDataArray<label>(vtk::dataArrayAttr::CONNECTIVITY);
|
||||||
format().writeSize(payLoad);
|
format().writeSize(payLoad);
|
||||||
|
|
||||||
for (label i=0; i < nVerts; ++i)
|
vtk::writeIdentity(format(), nVerts);
|
||||||
{
|
|
||||||
format().write(i);
|
|
||||||
}
|
|
||||||
format().flush();
|
format().flush();
|
||||||
format().endDataArray();
|
format().endDataArray();
|
||||||
}
|
}
|
||||||
@ -90,10 +88,8 @@ void Foam::vtk::lagrangianWriter::writeVerts()
|
|||||||
format().beginDataArray<label>(vtk::dataArrayAttr::OFFSETS);
|
format().beginDataArray<label>(vtk::dataArrayAttr::OFFSETS);
|
||||||
format().writeSize(payLoad);
|
format().writeSize(payLoad);
|
||||||
|
|
||||||
for (label i=0; i < nVerts; ++i)
|
vtk::writeIdentity(format(), nVerts, 1);
|
||||||
{
|
|
||||||
format().write(i+1);
|
|
||||||
}
|
|
||||||
format().flush();
|
format().flush();
|
||||||
format().endDataArray();
|
format().endDataArray();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -100,10 +100,8 @@ void Foam::lumpedPointMovement::writeForcesAndMomentsVTP
|
|||||||
format().beginDataArray<label>(vtk::dataArrayAttr::CONNECTIVITY);
|
format().beginDataArray<label>(vtk::dataArrayAttr::CONNECTIVITY);
|
||||||
format().writeSize(payLoad);
|
format().writeSize(payLoad);
|
||||||
|
|
||||||
for (label i=0; i<nPoints; ++i)
|
vtk::writeIdentity(format(), nPoints);
|
||||||
{
|
|
||||||
format().write(i);
|
|
||||||
}
|
|
||||||
format().flush();
|
format().flush();
|
||||||
|
|
||||||
format().endDataArray();
|
format().endDataArray();
|
||||||
@ -119,10 +117,8 @@ void Foam::lumpedPointMovement::writeForcesAndMomentsVTP
|
|||||||
format().beginDataArray<label>(vtk::dataArrayAttr::OFFSETS);
|
format().beginDataArray<label>(vtk::dataArrayAttr::OFFSETS);
|
||||||
format().writeSize(payLoad);
|
format().writeSize(payLoad);
|
||||||
|
|
||||||
for (label i=0; i<nPoints; ++i)
|
vtk::writeIdentity(format(), nPoints, 1);
|
||||||
{
|
|
||||||
format().write(i+1);
|
|
||||||
}
|
|
||||||
format().flush();
|
format().flush();
|
||||||
|
|
||||||
format().endDataArray();
|
format().endDataArray();
|
||||||
@ -284,10 +280,8 @@ void Foam::lumpedPointMovement::writeZonesVTP
|
|||||||
format().beginDataArray<label>("zoneId");
|
format().beginDataArray<label>("zoneId");
|
||||||
format().writeSize(payLoad);
|
format().writeSize(payLoad);
|
||||||
|
|
||||||
forAll(pp, facei)
|
vtk::write(format(), zoneI, pp.size());
|
||||||
{
|
|
||||||
format().write(zoneI);
|
|
||||||
}
|
|
||||||
format().flush();
|
format().flush();
|
||||||
|
|
||||||
format().endDataArray();
|
format().endDataArray();
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "lumpedPointState.H"
|
#include "lumpedPointState.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
|
#include "sliceRange.H"
|
||||||
#include "axesRotation.H"
|
#include "axesRotation.H"
|
||||||
#include "coordinateSystem.H"
|
#include "coordinateSystem.H"
|
||||||
#include "foamVtkOutput.H"
|
#include "foamVtkOutput.H"
|
||||||
@ -106,10 +107,8 @@ void Foam::lumpedPointState::writeVTP
|
|||||||
format().beginDataArray<label>(vtk::dataArrayAttr::CONNECTIVITY);
|
format().beginDataArray<label>(vtk::dataArrayAttr::CONNECTIVITY);
|
||||||
format().writeSize(payLoad);
|
format().writeSize(payLoad);
|
||||||
|
|
||||||
forAll(points_, i)
|
vtk::writeIdentity(format(), points_.size());
|
||||||
{
|
|
||||||
format().write(i);
|
|
||||||
}
|
|
||||||
format().flush();
|
format().flush();
|
||||||
|
|
||||||
format().endDataArray();
|
format().endDataArray();
|
||||||
@ -125,10 +124,8 @@ void Foam::lumpedPointState::writeVTP
|
|||||||
format().beginDataArray<label>(vtk::dataArrayAttr::OFFSETS);
|
format().beginDataArray<label>(vtk::dataArrayAttr::OFFSETS);
|
||||||
format().writeSize(payLoad);
|
format().writeSize(payLoad);
|
||||||
|
|
||||||
forAll(points_, i)
|
vtk::writeIdentity(format(), points_.size(), 1);
|
||||||
{
|
|
||||||
format().write(i+1);
|
|
||||||
}
|
|
||||||
format().flush();
|
format().flush();
|
||||||
|
|
||||||
format().endDataArray();
|
format().endDataArray();
|
||||||
@ -150,10 +147,8 @@ void Foam::lumpedPointState::writeVTP
|
|||||||
format().beginDataArray<label>(vtk::dataArrayAttr::CONNECTIVITY);
|
format().beginDataArray<label>(vtk::dataArrayAttr::CONNECTIVITY);
|
||||||
format().writeSize(payLoad);
|
format().writeSize(payLoad);
|
||||||
|
|
||||||
forAll(points_, i)
|
vtk::writeIdentity(format(), points_.size());
|
||||||
{
|
|
||||||
format().write(i);
|
|
||||||
}
|
|
||||||
format().flush();
|
format().flush();
|
||||||
|
|
||||||
format().endDataArray();
|
format().endDataArray();
|
||||||
@ -256,10 +251,8 @@ void Foam::lumpedPointState::writeVTP
|
|||||||
format().beginDataArray<label>(vtk::dataArrayAttr::CONNECTIVITY);
|
format().beginDataArray<label>(vtk::dataArrayAttr::CONNECTIVITY);
|
||||||
format().writeSize(payLoad);
|
format().writeSize(payLoad);
|
||||||
|
|
||||||
for (label i=0; i < 4*nPolys; ++i)
|
vtk::writeIdentity(format(), 4*nPolys);
|
||||||
{
|
|
||||||
format().write(i);
|
|
||||||
}
|
|
||||||
format().flush();
|
format().flush();
|
||||||
|
|
||||||
format().endDataArray();
|
format().endDataArray();
|
||||||
@ -275,9 +268,8 @@ void Foam::lumpedPointState::writeVTP
|
|||||||
format().beginDataArray<label>(vtk::dataArrayAttr::OFFSETS);
|
format().beginDataArray<label>(vtk::dataArrayAttr::OFFSETS);
|
||||||
format().writeSize(payLoad);
|
format().writeSize(payLoad);
|
||||||
|
|
||||||
for (label i=0; i < nPolys; ++i)
|
for (const label off : sliceRange(4, nPolys, 4))
|
||||||
{
|
{
|
||||||
const label off = 4 * (i+1);
|
|
||||||
format().write(off);
|
format().write(off);
|
||||||
}
|
}
|
||||||
format().flush();
|
format().flush();
|
||||||
@ -297,10 +289,8 @@ void Foam::lumpedPointState::writeVTP
|
|||||||
format().beginDataArray<label>("zoneId");
|
format().beginDataArray<label>("zoneId");
|
||||||
format().writeSize(payLoad);
|
format().writeSize(payLoad);
|
||||||
|
|
||||||
for (label i=0; i < nPolys; ++i)
|
vtk::writeIdentity(format(), nPolys);
|
||||||
{
|
|
||||||
format().write(i);
|
|
||||||
}
|
|
||||||
format().flush();
|
format().flush();
|
||||||
|
|
||||||
format().endDataArray();
|
format().endDataArray();
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -86,7 +86,7 @@ void Foam::fileFormats::VTKsurfaceFormatCore::writeCellData
|
|||||||
|
|
||||||
// Number of faces covered by the zones
|
// Number of faces covered by the zones
|
||||||
label nFaces = 0;
|
label nFaces = 0;
|
||||||
for (const auto& z : zones)
|
for (const surfZone& z : zones)
|
||||||
{
|
{
|
||||||
nFaces += z.size();
|
nFaces += z.size();
|
||||||
}
|
}
|
||||||
@ -95,12 +95,9 @@ void Foam::fileFormats::VTKsurfaceFormatCore::writeCellData
|
|||||||
vtk::legacy::intField<1>(format, "region", nFaces); // 1 component
|
vtk::legacy::intField<1>(format, "region", nFaces); // 1 component
|
||||||
|
|
||||||
label zoneId = 0;
|
label zoneId = 0;
|
||||||
for (const surfZone& zone : zones)
|
for (const surfZone& z : zones)
|
||||||
{
|
{
|
||||||
forAll(zone, i)
|
vtk::write(format, zoneId, z.size());
|
||||||
{
|
|
||||||
format.write(zoneId);
|
|
||||||
}
|
|
||||||
++zoneId;
|
++zoneId;
|
||||||
}
|
}
|
||||||
format.flush();
|
format.flush();
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -121,7 +121,7 @@ void Foam::fileFormats::VTPsurfaceFormatCore::writeCellData
|
|||||||
|
|
||||||
// Number of faces covered by the zones
|
// Number of faces covered by the zones
|
||||||
label nFaces = 0;
|
label nFaces = 0;
|
||||||
for (const auto& z : zones)
|
for (const surfZone& z : zones)
|
||||||
{
|
{
|
||||||
nFaces += z.size();
|
nFaces += z.size();
|
||||||
}
|
}
|
||||||
@ -133,12 +133,9 @@ void Foam::fileFormats::VTPsurfaceFormatCore::writeCellData
|
|||||||
format.writeSize(payLoad);
|
format.writeSize(payLoad);
|
||||||
|
|
||||||
label zoneId = 0;
|
label zoneId = 0;
|
||||||
for (const surfZone& zone : zones)
|
for (const surfZone& z : zones)
|
||||||
{
|
{
|
||||||
forAll(zone, i)
|
vtk::write(format, zoneId, z.size());
|
||||||
{
|
|
||||||
format.write(zoneId);
|
|
||||||
}
|
|
||||||
++zoneId;
|
++zoneId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user