OpenFOAM
v2512
The open source CFD toolbox
Loading...
Searching...
No Matches
writeMeshChecks.H
Go to the documentation of this file.
1
enum class
writeChecksFormatType
2
{
3
none
,
4
dictionary
,
5
JSON
6
};
7
const
Enum<writeChecksFormatType>
writeChecksFormatTypeNames
8
{
9
{
writeChecksFormatType::none
,
"none"
},
10
{
writeChecksFormatType::dictionary
,
"dictionary"
},
11
{
writeChecksFormatType::JSON
,
"json"
},
12
};
13
14
writeChecksFormatType
writeChecksFormat
(
writeChecksFormatType::none
);
15
16
auto
writeMeshChecks
= [&](
const
fvMesh&
mesh
,
const
writeChecksFormatType
fmt)
17
{
18
// Early exit if 'none' option is set
19
if
(fmt ==
writeChecksFormatType::none
)
20
{
21
return
;
22
}
23
24
if
(UPstream::master())
25
{
26
fileName
path
(
mesh
.time().globalPath()/
"checkMesh"
);
27
if
(
mesh
.name() != polyMesh::defaultRegion)
28
{
29
path
+=
"_"
+
mesh
.name();
30
}
31
32
OFstream
os
(
path
.ext(
writeChecksFormatTypeNames
[fmt]));
33
34
Info<<
"Writing mesh data to "
<<
os
.name() << nl << endl;
35
36
switch
(fmt)
37
{
38
case
writeChecksFormatType::dictionary
:
39
{
40
IOdictionary data
41
(
42
IOobject
43
(
44
os
.name(),
45
mesh
,
46
IOobject::NO_READ
47
)
48
);
49
50
data.writeHeader(
os
);
51
52
mesh
.data().meshDict().write(
os
,
false
);
53
54
IOobject::writeEndDivider(
os
);
55
56
break
;
57
}
58
case
writeChecksFormatType::JSON
:
59
{
60
JSONformatter json(
os
);
61
json.writeDict(
mesh
.data().meshDict());
62
63
break
;
64
}
65
default
:
66
{
67
// Do nothing
68
}
69
}
70
}
71
};
path
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
mesh
dynamicFvMesh & mesh
Definition
createDynamicFvMesh.H:6
os
OBJstream os(runTime.globalPath()/outputName)
writeChecksFormatType
writeChecksFormatType
Definition
writeMeshChecks.H:2
writeChecksFormatType::JSON
@ JSON
Definition
writeMeshChecks.H:5
writeChecksFormatType::none
@ none
Definition
writeMeshChecks.H:3
writeChecksFormatType::dictionary
@ dictionary
Definition
writeMeshChecks.H:4
writeMeshChecks
auto writeMeshChecks
Definition
writeMeshChecks.H:16
writeChecksFormat
writeChecksFormatType writeChecksFormat(writeChecksFormatType::none)
writeChecksFormatTypeNames
const Enum< writeChecksFormatType > writeChecksFormatTypeNames
Definition
writeMeshChecks.H:8
applications
utilities
mesh
manipulation
checkMesh
writeMeshChecks.H
Generated by
1.16.1