OpenFOAM
v2406
The open source CFD toolbox
writeAreaFields.H
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration |
5
\\ / A nd | www.openfoam.com
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
Copyright (C) 2018-2023 OpenCFD Ltd.
9
-------------------------------------------------------------------------------
10
License
11
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
12
13
Description
14
Code chunk for reading finite-area fields from disk
15
and write with vtk::uindirectPatchGeoFieldsWriter
16
17
\*---------------------------------------------------------------------------*/
18
19
#ifndef FoamToVTK_writeAreaFields_H
20
#define FoamToVTK_writeAreaFields_H
21
22
#include "
readFields.H
"
23
#include "
foamVtkIndPatchGeoFieldsWriter.H
"
24
25
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
26
27
namespace
Foam
28
{
29
30
// Writer type for finite-area mesh + fields
31
typedef
vtk::uindirectPatchGeoFieldsWriter
vtkWriterType_areaMesh
;
32
33
template
<
class
GeoField>
34
label
writeAreaFields
35
(
36
vtkWriterType_areaMesh
&
writer
,
37
const
typename
GeoField::Mesh&
mesh
,
38
const
IOobjectList
& objects,
39
const
bool
syncPar
40
)
41
{
42
label
count
= 0;
43
44
for
(
const
word
& fieldName : objects.
sortedNames
<GeoField>())
45
{
46
tmp<GeoField>
tfield =
47
getField<GeoField>(
mesh
, objects, fieldName, syncPar);
48
49
if
(tfield)
50
{
51
writer
.
write
(tfield());
52
53
tfield.
clear
();
54
++
count
;
55
}
56
}
57
58
return
count
;
59
}
60
61
62
label
writeAllAreaFields
63
(
64
vtkWriterType_areaMesh
&
writer
,
65
const
faMesh
&
mesh
,
66
const
IOobjectList
& objects,
67
const
bool
syncPar
68
)
69
{
70
#undef foamToVtk_WRITE_FIELD
71
#define foamToVtk_WRITE_FIELD(FieldType) \
72
writeAreaFields<FieldType> \
73
( \
74
writer, \
75
mesh, \
76
objects, \
77
syncPar \
78
)
79
80
label
count
= 0;
81
count
+=
foamToVtk_WRITE_FIELD
(
areaScalarField
);
82
count
+=
foamToVtk_WRITE_FIELD
(
areaVectorField
);
83
count
+=
foamToVtk_WRITE_FIELD
(
areaSphericalTensorField
);
84
count
+=
foamToVtk_WRITE_FIELD
(
areaSymmTensorField
);
85
count
+=
foamToVtk_WRITE_FIELD
(
areaTensorField
);
86
87
#undef foamToVtk_WRITE_FIELD
88
return
count
;
89
}
90
91
92
}
// End namespace Foam
93
94
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95
96
#endif
97
98
// ************************************************************************* //
Foam::faMesh
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition:
faMesh.H:133
Foam::vtk::uindirectPatchGeoFieldsWriter
GenericPatchGeoFieldsWriter< uindirectPrimitivePatch > uindirectPatchGeoFieldsWriter
Write uindirectPrimitivePatch faces/points as a vtp file or a legacy vtk file with support for geomet...
Definition:
foamVtkIndPatchGeoFieldsWriter.H:63
Foam::writeAreaFields
label writeAreaFields(ensightCase &ensCase, const ensightFaMesh &ensMesh, const IOobjectList &objects)
Definition:
writeAreaFields.H:65
Foam::IOobjectList
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable, so the various sorted methods should be used if traversing in parallel.
Definition:
IOobjectList.H:55
writer
vtk::lineWriter writer(edgeCentres, edgeList::null(), fileName(aMesh.time().globalPath()/"finiteArea-edgesCentres"))
foamToVtk_WRITE_FIELD
#define foamToVtk_WRITE_FIELD(FieldType)
Foam::IOobjectList::sortedNames
wordList sortedNames() const
The sorted names of the IOobjects.
Definition:
IOobjectList.C:250
readFields.H
Helper routines for reading a field or fields, optionally with a mesh subset (using fvMeshSubsetProxy...
Foam::GeometricField< scalar, faPatchField, areaMesh >
Foam::vtk::polyWriter::write
void write(const word &fieldName, const UList< Type > &field)
Write primitive field of CellData (Poly or Line) or PointData values.
Definition:
foamVtkPolyWriterTemplates.C:65
Foam::writeAllAreaFields
label writeAllAreaFields(ensightCase &ensCase, const ensightFaMesh &ensMesh, const IOobjectList &objects)
Definition:
writeAreaFields.H:99
Foam::vtk::GenericPatchGeoFieldsWriter
A Foam::vtk::GenericPatchWriter with support for geometric fields.
Definition:
foamVtkGenericPatchGeoFieldsWriter.H:53
Foam::BitOps::count
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
Definition:
BitOps.H:73
mesh
dynamicFvMesh & mesh
Definition:
createDynamicFvMesh.H:6
Foam::word
A class for handling words, derived from Foam::string.
Definition:
word.H:63
Foam::tmp::clear
void clear() const noexcept
If object pointer points to valid object: delete object and set pointer to nullptr.
Definition:
tmpI.H:289
Foam::tmp
A class for managing temporary objects.
Definition:
HashPtrTable.H:50
foamVtkIndPatchGeoFieldsWriter.H
Foam::vtkWriterType_areaMesh
vtk::uindirectPatchGeoFieldsWriter vtkWriterType_areaMesh
Definition:
writeAreaFields.H:33
Foam
Namespace for OpenFOAM.
Definition:
atmBoundaryLayer.C:26
applications
utilities
postProcessing
dataConversion
foamToVTK
writeAreaFields.H
Generated by
1.8.14