Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
enum class writeChecksFormatType
{
none,
dictionary,
JSON
};
const Enum<writeChecksFormatType> writeChecksFormatTypeNames
{
{ writeChecksFormatType::none, "none" },
{ writeChecksFormatType::dictionary, "dictionary" },
{ writeChecksFormatType::JSON, "JSON" },
};
writeChecksFormatType writeChecksFormat(writeChecksFormatType::none);
auto writeMeshChecks = [](const fvMesh& mesh, const writeChecksFormatType fmt)
{
if (Pstream::master())
{
switch (fmt)
{
case writeChecksFormatType::dictionary:
{
OFstream os(mesh.time().globalPath()/"checkMesh.dict");
IOdictionary data
(
IOobject
(
mesh.time().globalPath()/"checkMesh.dict",
mesh,
IOobject::NO_READ
)
);
data.writeHeader(os);
mesh.data().meshDict().write(os, false);
IOobject::writeEndDivider(os);
Info<< "Writing mesh data to " << data.objectPath()
<< nl << endl;
break;
}
case writeChecksFormatType::JSON:
{
OFstream os(mesh.time().globalPath()/"checkMesh.json");
Info<< "Writing mesh data to " << os.name() << nl << endl;
JSONformatter json(os);
json.writeDict(mesh.data().meshDict());
break;
}
default:
{
// Do nothing
}
}
}
};