blockMeshOBJ.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) 2020-2021 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
12
13Description
14 OBJ output of blockMesh topology blocks
15
16\*---------------------------------------------------------------------------*/
17
18{
19 refPtr<polyMesh> topoMeshPtr(blocks.topology(true));
20 const polyMesh& topoMesh = topoMeshPtr();
21
22 // Write mesh as edges
23 {
24 OFstream os(runTime.path()/"blockTopology.obj");
25
26 Info<< "Writing block structure in obj format: "
27 << os.name().name() << endl;
28
29 for (const point& p : topoMesh.points())
30 {
31 os << "v " << p.x() << ' ' << p.y() << ' ' << p.z() << nl;
32 }
33
34 for (const edge& e : topoMesh.edges())
35 {
36 os << "l " << e.start() + 1 << ' ' << e.end() + 1 << nl;
37 }
38 }
39
40 // Write centres of blocks
41 {
42 OFstream os(runTime.path()/"blockCentres.obj");
43
44 Info<< "Writing block centres in obj format: "
45 << os.name().name() << endl;
46
47 for (const point& p : topoMesh.cellCentres())
48 {
49 os << "v " << p.x() << ' ' << p.y() << ' ' << p.z() << nl;
50 }
51 }
52}
53
54
55// ************************************************************************* //
const polyMesh & topoMesh
Definition: blockMeshOBJ.H:29
refPtr< polyMesh > topoMeshPtr(blocks.topology(true))
volScalarField & p
engineTime & runTime
OBJstream os(runTime.globalPath()/outputName)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
volScalarField & e
Definition: createFields.H:11