mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: foamToVTK improvements for (-no-internal, -no-boundary)
- skip loading of fields with -no-internal, -no-boundary - suppress reporting fields with -no-internal, -no-boundary - cache loaded volume field for reuse with point interpolation. Trade off some memory overhead against reading twice. NOTE: this issue will not be evident with foamToEnsight since there it only handles cell data *or* point data (not both), so a field is only ever loaded/processed once.
This commit is contained in:
@ -8,20 +8,7 @@
|
|||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Code chunk for converting finite-area - included by foamToVTK.
|
Code chunk for converting finite-area - included by foamToVTK.
|
||||||
|
|||||||
@ -8,20 +8,7 @@
|
|||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Code chunk for post-processing conversion of cloud(s) to VTK PolyData
|
Code chunk for post-processing conversion of cloud(s) to VTK PolyData
|
||||||
|
|||||||
@ -5,23 +5,10 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Code chunk for converting volume fields on processor boundaries,
|
Code chunk for converting volume fields on processor boundaries,
|
||||||
@ -145,7 +132,8 @@ Description
|
|||||||
patchWriters,
|
patchWriters,
|
||||||
meshProxy,
|
meshProxy,
|
||||||
objects,
|
objects,
|
||||||
true // syncPar
|
true, // syncPar
|
||||||
|
nullptr // no field cache (object registry)
|
||||||
);
|
);
|
||||||
|
|
||||||
// End CellData is implicit
|
// End CellData is implicit
|
||||||
|
|||||||
@ -8,20 +8,7 @@
|
|||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Code chunk for post-processing surface fields to VTK PolyData
|
Code chunk for post-processing surface fields to VTK PolyData
|
||||||
|
|||||||
@ -8,20 +8,7 @@
|
|||||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Code chunk for converting face and point sets - included by foamToVTK.
|
Code chunk for converting face and point sets - included by foamToVTK.
|
||||||
|
|||||||
@ -5,23 +5,10 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Code chunk for converting volume and dimensioned fields
|
Code chunk for converting volume and dimensioned fields
|
||||||
@ -56,8 +43,14 @@ Description
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
reportFields::volume(Info, objects);
|
if (doInternal || doBoundary)
|
||||||
reportFields::internal(Info, objects);
|
{
|
||||||
|
reportFields::volume(Info, objects);
|
||||||
|
}
|
||||||
|
if (doInternal)
|
||||||
|
{
|
||||||
|
reportFields::internal(Info, objects);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Setup for the vtm writer.
|
// Setup for the vtm writer.
|
||||||
@ -269,6 +262,26 @@ Description
|
|||||||
patchInterps.resize(nPatchInterps);
|
patchInterps.resize(nPatchInterps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// With point-interpolation, cache fields to avoid multiple re-reading
|
||||||
|
std::unique_ptr<objectRegistry> cacheFieldsPtr;
|
||||||
|
|
||||||
|
if (doPointValues && (nVolFields || nDimFields))
|
||||||
|
{
|
||||||
|
cacheFieldsPtr.reset
|
||||||
|
(
|
||||||
|
new objectRegistry
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"foamToVTK::volume",
|
||||||
|
runTime.timeName(),
|
||||||
|
runTime,
|
||||||
|
IOobject::NO_REGISTER
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// CellData
|
// CellData
|
||||||
{
|
{
|
||||||
@ -314,7 +327,8 @@ Description
|
|||||||
patchWriters,
|
patchWriters,
|
||||||
meshProxy,
|
meshProxy,
|
||||||
objects,
|
objects,
|
||||||
true // syncPar
|
true, // syncPar
|
||||||
|
cacheFieldsPtr.get()
|
||||||
);
|
);
|
||||||
|
|
||||||
writeAllDimFields
|
writeAllDimFields
|
||||||
@ -322,7 +336,8 @@ Description
|
|||||||
internalWriter,
|
internalWriter,
|
||||||
meshProxy,
|
meshProxy,
|
||||||
objects,
|
objects,
|
||||||
true // syncPar
|
true, // syncPar
|
||||||
|
cacheFieldsPtr.get()
|
||||||
);
|
);
|
||||||
|
|
||||||
// End CellData is implicit
|
// End CellData is implicit
|
||||||
@ -373,7 +388,8 @@ Description
|
|||||||
patchWriters, patchInterps,
|
patchWriters, patchInterps,
|
||||||
meshProxy,
|
meshProxy,
|
||||||
objects,
|
objects,
|
||||||
true // syncPar
|
true, // syncPar
|
||||||
|
cacheFieldsPtr.get()
|
||||||
);
|
);
|
||||||
|
|
||||||
writeAllDimFields
|
writeAllDimFields
|
||||||
@ -381,7 +397,8 @@ Description
|
|||||||
internalWriter, pInterp,
|
internalWriter, pInterp,
|
||||||
meshProxy,
|
meshProxy,
|
||||||
objects,
|
objects,
|
||||||
true // syncPar
|
true, // syncPar
|
||||||
|
cacheFieldsPtr.get()
|
||||||
);
|
);
|
||||||
|
|
||||||
writeAllPointFields
|
writeAllPointFields
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -49,14 +49,47 @@ Foam::tmp<GeoField> Foam::getField
|
|||||||
(
|
(
|
||||||
const IOobject* io,
|
const IOobject* io,
|
||||||
const fvMeshSubsetProxy& proxy,
|
const fvMeshSubsetProxy& proxy,
|
||||||
const bool syncPar
|
const bool syncPar,
|
||||||
|
objectRegistry* cache
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return
|
tmp<GeoField> tfield;
|
||||||
proxy.interpolate
|
|
||||||
|
if (io)
|
||||||
|
{
|
||||||
|
const word& fieldName = io->name();
|
||||||
|
|
||||||
|
if (cache)
|
||||||
|
{
|
||||||
|
// Get reference from cache if possible
|
||||||
|
tfield.cref(cache->cfindObject<GeoField>(fieldName));
|
||||||
|
|
||||||
|
if (tfield)
|
||||||
|
{
|
||||||
|
return tfield;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tfield = proxy.interpolate
|
||||||
(
|
(
|
||||||
getField<GeoField>(io, proxy.baseMesh(), syncPar)
|
getField<GeoField>(io, proxy.baseMesh(), syncPar)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (tfield && cache)
|
||||||
|
{
|
||||||
|
// Move field to the cache
|
||||||
|
IOobject newIO(tfield(), *cache);
|
||||||
|
newIO.readOpt(IOobject::NO_READ);
|
||||||
|
newIO.writeOpt(IOobject::NO_WRITE);
|
||||||
|
|
||||||
|
tfield.ref().checkOut(); // Paranoid
|
||||||
|
cache->store(new GeoField(newIO, tfield));
|
||||||
|
|
||||||
|
tfield.cref(cache->cfindObject<GeoField>(fieldName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tfield;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -71,7 +104,12 @@ Foam::tmp<GeoField> Foam::getField
|
|||||||
{
|
{
|
||||||
// Can do something with syncPar on failure ...
|
// Can do something with syncPar on failure ...
|
||||||
|
|
||||||
return getField<GeoField>(objects.findObject(fieldName), mesh, syncPar);
|
return getField<GeoField>
|
||||||
|
(
|
||||||
|
objects.findObject(fieldName),
|
||||||
|
mesh,
|
||||||
|
syncPar
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -81,12 +119,19 @@ Foam::tmp<GeoField> Foam::getField
|
|||||||
const fvMeshSubsetProxy& proxy,
|
const fvMeshSubsetProxy& proxy,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const bool syncPar
|
const bool syncPar,
|
||||||
|
objectRegistry* cache
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Can do something with syncPar on failure ...
|
// Can do something with syncPar on failure ...
|
||||||
|
|
||||||
return getField<GeoField>(objects.findObject(fieldName), proxy, syncPar);
|
return getField<GeoField>
|
||||||
|
(
|
||||||
|
objects.findObject(fieldName),
|
||||||
|
proxy,
|
||||||
|
syncPar,
|
||||||
|
cache
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -35,10 +35,11 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef Foam_readFields_H
|
#ifndef FoamToVTK_readFields_H
|
||||||
#define Foam_readFields_H
|
#define FoamToVTK_readFields_H
|
||||||
|
|
||||||
#include "fvMeshSubsetProxy.H"
|
#include "fvMeshSubsetProxy.H"
|
||||||
|
#include "objectRegistry.H"
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
#include "PtrList.H"
|
#include "PtrList.H"
|
||||||
|
|
||||||
@ -63,7 +64,8 @@ tmp<GeoField> getField
|
|||||||
(
|
(
|
||||||
const IOobject* io,
|
const IOobject* io,
|
||||||
const fvMeshSubsetProxy& proxy,
|
const fvMeshSubsetProxy& proxy,
|
||||||
const bool syncPar
|
const bool syncPar,
|
||||||
|
objectRegistry* cache = nullptr
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -78,14 +80,17 @@ tmp<GeoField> getField
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Get the named field from the objects and subset it, or return nullptr
|
//- Return the named field from the optional cache (if found),
|
||||||
|
//- or get it from the objects and subset it (add to cache).
|
||||||
|
//- Return nullptr if nothing worked.
|
||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
tmp<GeoField> getField
|
tmp<GeoField> getField
|
||||||
(
|
(
|
||||||
const fvMeshSubsetProxy& proxy,
|
const fvMeshSubsetProxy& proxy,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
const bool syncPar
|
const bool syncPar,
|
||||||
|
objectRegistry* cache = nullptr
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,38 +5,19 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
InNamespace
|
|
||||||
Foam
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Read finite-area fields from disk
|
Code chunk for reading finite-area fields from disk
|
||||||
and write with vtk::uindirectPatchGeoFieldsWriter
|
and write with vtk::uindirectPatchGeoFieldsWriter
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
writeAreaFields.H
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef writeAreaFields_H
|
#ifndef FoamToVTK_writeAreaFields_H
|
||||||
#define writeAreaFields_H
|
#define FoamToVTK_writeAreaFields_H
|
||||||
|
|
||||||
#include "readFields.H"
|
#include "readFields.H"
|
||||||
#include "foamVtkIndPatchGeoFieldsWriter.H"
|
#include "foamVtkIndPatchGeoFieldsWriter.H"
|
||||||
@ -49,25 +30,6 @@ namespace Foam
|
|||||||
// Writer type for finite-area mesh + fields
|
// Writer type for finite-area mesh + fields
|
||||||
typedef vtk::uindirectPatchGeoFieldsWriter vtkWriterType_areaMesh;
|
typedef vtk::uindirectPatchGeoFieldsWriter vtkWriterType_areaMesh;
|
||||||
|
|
||||||
template<class GeoField>
|
|
||||||
bool writeAreaField
|
|
||||||
(
|
|
||||||
vtkWriterType_areaMesh& writer,
|
|
||||||
const tmp<GeoField>& tfield
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (tfield)
|
|
||||||
{
|
|
||||||
writer.write(tfield());
|
|
||||||
tfield.clear();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
label writeAreaFields
|
label writeAreaFields
|
||||||
(
|
(
|
||||||
@ -81,15 +43,14 @@ label writeAreaFields
|
|||||||
|
|
||||||
for (const word& fieldName : objects.sortedNames<GeoField>())
|
for (const word& fieldName : objects.sortedNames<GeoField>())
|
||||||
{
|
{
|
||||||
if
|
tmp<GeoField> tfield =
|
||||||
(
|
getField<GeoField>(mesh, objects, fieldName, syncPar);
|
||||||
writeAreaField<GeoField>
|
|
||||||
(
|
if (tfield)
|
||||||
writer,
|
|
||||||
getField<GeoField>(mesh, objects, fieldName, syncPar)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
|
writer.write(tfield());
|
||||||
|
|
||||||
|
tfield.clear();
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,38 +5,19 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
InNamespace
|
|
||||||
Foam
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Read dimensioned fields from disk
|
Code chunk for reading dimensioned fields from disk
|
||||||
and write with vtk::internalWriter
|
and write with vtk::internalWriter
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
writeDimFields.H
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef writeDimFields_H
|
#ifndef FoamToVTK_writeDimFields_H
|
||||||
#define writeDimFields_H
|
#define FoamToVTK_writeDimFields_H
|
||||||
|
|
||||||
#include "readFields.H"
|
#include "readFields.H"
|
||||||
#include "foamVtkInternalWriter.H"
|
#include "foamVtkInternalWriter.H"
|
||||||
@ -46,77 +27,31 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
template<class GeoField>
|
|
||||||
bool writeDimField
|
|
||||||
(
|
|
||||||
autoPtr<vtk::internalWriter>& internalWriter,
|
|
||||||
const tmp<GeoField>& tfield
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!tfield)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto& field = tfield();
|
|
||||||
|
|
||||||
if (internalWriter)
|
|
||||||
{
|
|
||||||
internalWriter->write(field);
|
|
||||||
}
|
|
||||||
|
|
||||||
tfield.clear();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class GeoField>
|
|
||||||
bool writeDimField
|
|
||||||
(
|
|
||||||
autoPtr<vtk::internalWriter>& internalWriter,
|
|
||||||
const autoPtr<volPointInterpolation>& pInterp,
|
|
||||||
const tmp<GeoField>& tfield
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!tfield)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto& field = tfield();
|
|
||||||
|
|
||||||
if (internalWriter && pInterp)
|
|
||||||
{
|
|
||||||
internalWriter->write(field, *pInterp);
|
|
||||||
}
|
|
||||||
|
|
||||||
tfield.clear();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
label writeDimFields
|
label writeDimFields
|
||||||
(
|
(
|
||||||
autoPtr<vtk::internalWriter>& internalWriter,
|
autoPtr<vtk::internalWriter>& internalWriter,
|
||||||
const fvMeshSubsetProxy& proxy,
|
const fvMeshSubsetProxy& proxy,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const bool syncPar
|
const bool syncPar,
|
||||||
|
objectRegistry* cache
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Sanity test
|
||||||
|
if (!internalWriter) return 0;
|
||||||
|
|
||||||
label count = 0;
|
label count = 0;
|
||||||
|
|
||||||
for (const word& fieldName : objects.sortedNames<GeoField>())
|
for (const word& fieldName : objects.sortedNames<GeoField>())
|
||||||
{
|
{
|
||||||
if
|
tmp<GeoField> tfield =
|
||||||
(
|
getField<GeoField>(proxy, objects, fieldName, syncPar, cache);
|
||||||
writeDimField<GeoField>
|
|
||||||
(
|
if (tfield)
|
||||||
internalWriter,
|
|
||||||
getField<GeoField>(proxy, objects, fieldName, syncPar)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
|
internalWriter->write(tfield());
|
||||||
|
|
||||||
|
tfield.clear();
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,22 +68,25 @@ label writeDimFields
|
|||||||
|
|
||||||
const fvMeshSubsetProxy& proxy,
|
const fvMeshSubsetProxy& proxy,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const bool syncPar
|
const bool syncPar,
|
||||||
|
objectRegistry* cache
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Sanity test
|
||||||
|
if (!internalWriter || !pInterp) return 0;
|
||||||
|
|
||||||
label count = 0;
|
label count = 0;
|
||||||
|
|
||||||
for (const word& fieldName : objects.sortedNames<GeoField>())
|
for (const word& fieldName : objects.sortedNames<GeoField>())
|
||||||
{
|
{
|
||||||
if
|
tmp<GeoField> tfield =
|
||||||
(
|
getField<GeoField>(proxy, objects, fieldName, syncPar, cache);
|
||||||
writeDimField<GeoField>
|
|
||||||
(
|
if (tfield)
|
||||||
internalWriter, pInterp,
|
|
||||||
getField<GeoField>(proxy, objects, fieldName, syncPar)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
|
internalWriter->write(tfield(), *pInterp);
|
||||||
|
|
||||||
|
tfield.clear();
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,9 +101,13 @@ label writeAllDimFields
|
|||||||
|
|
||||||
const fvMeshSubsetProxy& proxy,
|
const fvMeshSubsetProxy& proxy,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const bool syncPar
|
const bool syncPar,
|
||||||
|
objectRegistry* cache
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Sanity test
|
||||||
|
if (!internalWriter) return 0;
|
||||||
|
|
||||||
#undef foamToVtk_WRITE_FIELD
|
#undef foamToVtk_WRITE_FIELD
|
||||||
#define foamToVtk_WRITE_FIELD(FieldType) \
|
#define foamToVtk_WRITE_FIELD(FieldType) \
|
||||||
writeDimFields<FieldType> \
|
writeDimFields<FieldType> \
|
||||||
@ -173,7 +115,8 @@ label writeAllDimFields
|
|||||||
internalWriter, \
|
internalWriter, \
|
||||||
proxy, \
|
proxy, \
|
||||||
objects, \
|
objects, \
|
||||||
syncPar \
|
syncPar, \
|
||||||
|
cache \
|
||||||
)
|
)
|
||||||
|
|
||||||
label count = 0;
|
label count = 0;
|
||||||
@ -195,9 +138,13 @@ label writeAllDimFields
|
|||||||
|
|
||||||
const fvMeshSubsetProxy& proxy,
|
const fvMeshSubsetProxy& proxy,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const bool syncPar
|
const bool syncPar,
|
||||||
|
objectRegistry* cache
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Sanity test
|
||||||
|
if (!internalWriter || !pInterp) return 0;
|
||||||
|
|
||||||
#undef foamToVtk_WRITE_FIELD
|
#undef foamToVtk_WRITE_FIELD
|
||||||
#define foamToVtk_WRITE_FIELD(FieldType) \
|
#define foamToVtk_WRITE_FIELD(FieldType) \
|
||||||
writeDimFields<FieldType> \
|
writeDimFields<FieldType> \
|
||||||
@ -205,7 +152,8 @@ label writeAllDimFields
|
|||||||
internalWriter, pInterp, \
|
internalWriter, pInterp, \
|
||||||
proxy, \
|
proxy, \
|
||||||
objects, \
|
objects, \
|
||||||
syncPar \
|
syncPar, \
|
||||||
|
cache \
|
||||||
)
|
)
|
||||||
|
|
||||||
label count = 0;
|
label count = 0;
|
||||||
|
|||||||
@ -5,38 +5,19 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
InNamespace
|
|
||||||
Foam
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Read point fields from disk
|
Code chunk for reading point fields from disk
|
||||||
and write with vtk::internalWriter and vtk::patchWriter
|
and write with vtk::internalWriter and vtk::patchWriter
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
writePointFields.H
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef writePointFields_H
|
#ifndef FoamToVTK_writePointFields_H
|
||||||
#define writePointFields_H
|
#define FoamToVTK_writePointFields_H
|
||||||
|
|
||||||
#include "readFields.H"
|
#include "readFields.H"
|
||||||
#include "foamVtkInternalWriter.H"
|
#include "foamVtkInternalWriter.H"
|
||||||
@ -57,6 +38,9 @@ bool writePointField
|
|||||||
const fvMeshSubsetProxy& proxy
|
const fvMeshSubsetProxy& proxy
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Sanity test
|
||||||
|
if (!internalWriter && patchWriters.empty()) return false;
|
||||||
|
|
||||||
if (!tfield)
|
if (!tfield)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -113,6 +97,9 @@ label writePointFields
|
|||||||
const bool syncPar
|
const bool syncPar
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Sanity test
|
||||||
|
if (!internalWriter && patchWriters.empty()) return 0;
|
||||||
|
|
||||||
label count = 0;
|
label count = 0;
|
||||||
|
|
||||||
for (const word& fieldName : objects.sortedNames<GeoField>())
|
for (const word& fieldName : objects.sortedNames<GeoField>())
|
||||||
@ -146,6 +133,9 @@ label writeAllPointFields
|
|||||||
const bool syncPar
|
const bool syncPar
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Sanity test
|
||||||
|
if (!internalWriter && patchWriters.empty()) return 0;
|
||||||
|
|
||||||
const pointMesh& ptMesh = pointMesh::New(proxy.baseMesh());
|
const pointMesh& ptMesh = pointMesh::New(proxy.baseMesh());
|
||||||
|
|
||||||
#undef foamToVtk_WRITE_FIELD
|
#undef foamToVtk_WRITE_FIELD
|
||||||
|
|||||||
@ -8,30 +8,11 @@
|
|||||||
Copyright (C) 2021 OpenCFD Ltd.
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
InNamespace
|
|
||||||
Foam
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Write surface fields from volume mesh
|
Write surface fields from volume mesh
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
writeSurfaceFields.H
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef writeSurfaceFields_H
|
#ifndef writeSurfaceFields_H
|
||||||
|
|||||||
@ -5,38 +5,19 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
InNamespace
|
|
||||||
Foam
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Read volume fields from disk
|
Code chunk for reading volume fields from disk
|
||||||
and write with vtk::internalWriter and vtk::patchWriter
|
and write with vtk::internalWriter and vtk::patchWriter
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
writeVolFields.H
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef writeVolFields_H
|
#ifndef FoamToVTK_writeVolFields_H
|
||||||
#define writeVolFields_H
|
#define FoamToVTK_writeVolFields_H
|
||||||
|
|
||||||
#include "readFields.H"
|
#include "readFields.H"
|
||||||
#include "foamVtkInternalWriter.H"
|
#include "foamVtkInternalWriter.H"
|
||||||
@ -47,79 +28,6 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
template<class GeoField>
|
|
||||||
bool writeVolField
|
|
||||||
(
|
|
||||||
autoPtr<vtk::internalWriter>& internalWriter,
|
|
||||||
UPtrList<vtk::patchWriter>& patchWriters,
|
|
||||||
const tmp<GeoField>& tfield
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!tfield)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto& field = tfield();
|
|
||||||
|
|
||||||
// Internal
|
|
||||||
if (internalWriter)
|
|
||||||
{
|
|
||||||
internalWriter->write(field);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Boundary
|
|
||||||
for (vtk::patchWriter& writer : patchWriters)
|
|
||||||
{
|
|
||||||
writer.write(field);
|
|
||||||
}
|
|
||||||
|
|
||||||
tfield.clear();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class GeoField>
|
|
||||||
bool writeVolField
|
|
||||||
(
|
|
||||||
autoPtr<vtk::internalWriter>& internalWriter,
|
|
||||||
const autoPtr<volPointInterpolation>& pInterp,
|
|
||||||
|
|
||||||
UPtrList<vtk::patchWriter>& patchWriters,
|
|
||||||
const UPtrList<PrimitivePatchInterpolation<primitivePatch>>& patchInterps,
|
|
||||||
|
|
||||||
const tmp<GeoField>& tfield
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!tfield)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto& field = tfield();
|
|
||||||
|
|
||||||
// Internal
|
|
||||||
if (internalWriter && pInterp)
|
|
||||||
{
|
|
||||||
internalWriter->write(field, *pInterp);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Boundary
|
|
||||||
label writeri = 0;
|
|
||||||
for (vtk::patchWriter& writer : patchWriters)
|
|
||||||
{
|
|
||||||
if (writeri < patchInterps.size() && patchInterps.set(writeri))
|
|
||||||
{
|
|
||||||
writer.write(field, patchInterps[writeri]);
|
|
||||||
}
|
|
||||||
++writeri;
|
|
||||||
}
|
|
||||||
|
|
||||||
tfield.clear();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class GeoField>
|
template<class GeoField>
|
||||||
label writeVolFields
|
label writeVolFields
|
||||||
(
|
(
|
||||||
@ -127,23 +35,35 @@ label writeVolFields
|
|||||||
UPtrList<vtk::patchWriter>& patchWriters,
|
UPtrList<vtk::patchWriter>& patchWriters,
|
||||||
const fvMeshSubsetProxy& proxy,
|
const fvMeshSubsetProxy& proxy,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const bool syncPar
|
const bool syncPar,
|
||||||
|
objectRegistry* cache
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Sanity test
|
||||||
|
if (!internalWriter && patchWriters.empty()) return 0;
|
||||||
|
|
||||||
label count = 0;
|
label count = 0;
|
||||||
|
|
||||||
for (const word& fieldName : objects.sortedNames<GeoField>())
|
for (const word& fieldName : objects.sortedNames<GeoField>())
|
||||||
{
|
{
|
||||||
if
|
tmp<GeoField> tfield =
|
||||||
(
|
getField<GeoField>(proxy, objects, fieldName, syncPar, cache);
|
||||||
writeVolField<GeoField>
|
|
||||||
(
|
if (tfield)
|
||||||
internalWriter,
|
|
||||||
patchWriters,
|
|
||||||
getField<GeoField>(proxy, objects, fieldName, syncPar)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
|
// Internal
|
||||||
|
if (internalWriter)
|
||||||
|
{
|
||||||
|
internalWriter->write(tfield());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Boundary
|
||||||
|
for (vtk::patchWriter& writer : patchWriters)
|
||||||
|
{
|
||||||
|
writer.write(tfield());
|
||||||
|
}
|
||||||
|
|
||||||
|
tfield.clear();
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,23 +83,47 @@ label writeVolFields
|
|||||||
|
|
||||||
const fvMeshSubsetProxy& proxy,
|
const fvMeshSubsetProxy& proxy,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const bool syncPar
|
const bool syncPar,
|
||||||
|
objectRegistry* cache
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Sanity test
|
||||||
|
if
|
||||||
|
(
|
||||||
|
(!internalWriter || !pInterp)
|
||||||
|
&& (patchWriters.empty() || patchInterps.empty())
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
label count = 0;
|
label count = 0;
|
||||||
|
|
||||||
for (const word& fieldName : objects.sortedNames<GeoField>())
|
for (const word& fieldName : objects.sortedNames<GeoField>())
|
||||||
{
|
{
|
||||||
if
|
tmp<GeoField> tfield =
|
||||||
(
|
getField<GeoField>(proxy, objects, fieldName, syncPar, cache);
|
||||||
writeVolField<GeoField>
|
|
||||||
(
|
if (tfield)
|
||||||
internalWriter, pInterp,
|
|
||||||
patchWriters, patchInterps,
|
|
||||||
getField<GeoField>(proxy, objects, fieldName, syncPar)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
|
// Internal
|
||||||
|
if (internalWriter && pInterp)
|
||||||
|
{
|
||||||
|
internalWriter->write(tfield(), *pInterp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Boundary
|
||||||
|
label writeri = 0;
|
||||||
|
for (vtk::patchWriter& writer : patchWriters)
|
||||||
|
{
|
||||||
|
if (writeri < patchInterps.size() && patchInterps.set(writeri))
|
||||||
|
{
|
||||||
|
writer.write(tfield(), patchInterps[writeri]);
|
||||||
|
}
|
||||||
|
++writeri;
|
||||||
|
}
|
||||||
|
|
||||||
|
tfield.clear();
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -195,9 +139,13 @@ label writeAllVolFields
|
|||||||
|
|
||||||
const fvMeshSubsetProxy& proxy,
|
const fvMeshSubsetProxy& proxy,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const bool syncPar
|
const bool syncPar,
|
||||||
|
objectRegistry* cache
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Sanity test
|
||||||
|
if (!internalWriter && patchWriters.empty()) return 0;
|
||||||
|
|
||||||
#undef foamToVtk_WRITE_FIELD
|
#undef foamToVtk_WRITE_FIELD
|
||||||
#define foamToVtk_WRITE_FIELD(FieldType) \
|
#define foamToVtk_WRITE_FIELD(FieldType) \
|
||||||
writeVolFields<FieldType> \
|
writeVolFields<FieldType> \
|
||||||
@ -206,7 +154,8 @@ label writeAllVolFields
|
|||||||
patchWriters, \
|
patchWriters, \
|
||||||
proxy, \
|
proxy, \
|
||||||
objects, \
|
objects, \
|
||||||
syncPar \
|
syncPar, \
|
||||||
|
cache \
|
||||||
)
|
)
|
||||||
|
|
||||||
label count = 0;
|
label count = 0;
|
||||||
@ -231,7 +180,8 @@ label writeAllVolFields
|
|||||||
|
|
||||||
const fvMeshSubsetProxy& proxy,
|
const fvMeshSubsetProxy& proxy,
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const bool syncPar
|
const bool syncPar,
|
||||||
|
objectRegistry* cache
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#undef foamToVtk_WRITE_FIELD
|
#undef foamToVtk_WRITE_FIELD
|
||||||
@ -242,7 +192,8 @@ label writeAllVolFields
|
|||||||
patchWriters, patchInterps, \
|
patchWriters, patchInterps, \
|
||||||
proxy, \
|
proxy, \
|
||||||
objects, \
|
objects, \
|
||||||
syncPar \
|
syncPar, \
|
||||||
|
cache \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user