OpenFOAM
v2406
The open source CFD toolbox
writeDimFields.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
InNamespace
14
Foam
15
16
Description
17
Read dimensioned fields from disk and write with ensightMesh
18
19
\*---------------------------------------------------------------------------*/
20
21
#ifndef ensight_writeDimFields_H
22
#define ensight_writeDimFields_H
23
24
#include "
writeVolFields.H
"
25
26
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
27
28
namespace
Foam
29
{
30
31
template
<
class
Type>
32
bool
writeDimField
33
(
34
ensightCase& ensCase,
35
const
ensightMesh
& ensMesh,
36
const
tmp
<
VolumeInternalField<Type>
>& tdf
37
)
38
{
39
if
(!tdf)
40
{
41
return
false
;
42
}
43
44
auto
tfield = makeZeroGradientField<Type>(tdf);
45
46
// Now a volField with zero-gradient boundaries
47
48
return
writeVolField<Type>
49
(
50
ensCase,
51
ensMesh,
52
tfield,
53
false
// No nearCellValue, we already have zero-gradient
54
);
55
}
56
57
58
template
<
class
Type>
59
label
writeDimFields
60
(
61
ensightCase& ensCase,
62
const
ensightMesh
& ensMesh,
63
const
IOobjectList
& objects
64
)
65
{
66
typedef
VolumeInternalField<Type>
FieldType;
67
68
const
auto
&
mesh
= refCast<const fvMesh>(ensMesh.
mesh
());
69
70
label
count
= 0;
71
72
for
(
const
IOobject
&
io
: objects.
csorted
<FieldType>())
73
{
74
if
75
(
76
writeDimField<Type>
77
(
78
ensCase,
79
ensMesh,
80
getField<FieldType>(
io
,
mesh
)
81
)
82
)
83
{
84
Info
<<
' '
<<
io
.
name
();
85
++
count
;
86
}
87
}
88
89
return
count
;
90
}
91
92
93
label
writeAllDimFields
94
(
95
ensightCase& ensCase,
96
const
ensightMesh
& ensMesh,
97
const
IOobjectList
& objects
98
)
99
{
100
#undef ensight_WRITE_FIELD
101
#define ensight_WRITE_FIELD(PrimitiveType) \
102
writeDimFields<PrimitiveType> \
103
( \
104
ensCase, \
105
ensMesh, \
106
objects \
107
)
108
109
label
count
= 0;
110
count
+=
ensight_WRITE_FIELD
(scalar);
111
count
+=
ensight_WRITE_FIELD
(
vector
);
112
count
+=
ensight_WRITE_FIELD
(
sphericalTensor
);
113
count
+=
ensight_WRITE_FIELD
(
symmTensor
);
114
count
+=
ensight_WRITE_FIELD
(
tensor
);
115
116
#undef ensight_WRITE_FIELD
117
return
count
;
118
}
119
120
}
// End namespace Foam
121
122
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123
124
#endif
125
126
// ************************************************************************* //
Foam::SymmTensor< scalar >
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
Foam::IOobject::name
const word & name() const noexcept
Return the object name.
Definition:
IOobjectI.H:195
Foam::writeDimField
bool writeDimField(ensightCase &ensCase, const ensightMesh &ensMesh, const tmp< VolumeInternalField< Type >> &tdf)
Definition:
writeDimFields.H:35
Foam::ensightMesh::mesh
const polyMesh & mesh() const noexcept
Reference to the underlying polyMesh.
Definition:
ensightMesh.H:191
Foam::SphericalTensor< scalar >
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
ensight_WRITE_FIELD
#define ensight_WRITE_FIELD(PrimitiveType)
writeVolFields.H
Foam::vector
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Foam::ensightMesh
Encapsulation of volume meshes for writing in ensight format. It manages cellZones, facesZone, patches.
Definition:
ensightMesh.H:78
Foam::writeDimFields
label writeDimFields(ensightCase &ensCase, const ensightMesh &ensMesh, const IOobjectList &objects)
Definition:
writeDimFields.H:62
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition:
polyMeshFieldsFwd.H:31
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
io
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
Foam::tmp
A class for managing temporary objects.
Definition:
HashPtrTable.H:50
Foam::tensor
Tensor of scalars, i.e. Tensor<scalar>.
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition:
IOobject.H:180
Foam::IOobjectList::csorted
UPtrList< const IOobject > csorted() const
The sorted list of IOobjects with headerClassName == Type::typeName.
Foam::writeAllDimFields
label writeAllDimFields(ensightCase &ensCase, const ensightMesh &ensMesh, const IOobjectList &objects)
Definition:
writeDimFields.H:96
Foam
Namespace for OpenFOAM.
Definition:
atmBoundaryLayer.C:26
applications
utilities
postProcessing
dataConversion
foamToEnsight
writeDimFields.H
Generated by
1.8.14