fireToFoam.C
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) 2016-2021 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Application
27 fireToFoam
28
29Group
30 grpMeshConversionUtilities
31
32Description
33 Convert AVL/FIRE polyhedral mesh to OpenFOAM format
34
35Usage
36 \b fireToFoam [OPTION] firePolyMesh
37
38 Options:
39
40 - \par -ascii
41 Write in ASCII format instead of binary
42
43 - \par -check
44 Perform edge checking
45
46 - \par -scale <factor>
47 Specify an alternative geometry scaling factor.
48 The default is \b 1 (no scaling).
49
50\*---------------------------------------------------------------------------*/
51
52#include "argList.H"
53#include "Time.H"
54#include "FIREMeshReader.H"
55#include "checkFireEdges.H"
56
57using namespace Foam;
58
59// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60
61int main(int argc, char *argv[])
62{
63 argList::addNote
64 (
65 "Convert AVL/FIRE polyhedral mesh to OpenFOAM format"
66 );
67
68 argList::noParallel();
69 argList::addArgument("firePolyMesh", "The input FIRE mesh");
70 argList::addBoolOption
71 (
72 "ascii",
73 "Write in ASCII format instead of binary"
74 );
75 argList::addBoolOption
76 (
77 "check",
78 "Perform edge checking as well"
79 );
80 argList::addOption
81 (
82 "scale",
83 "scale",
84 "Geometry scaling factor - default is 1 (no scaling)"
85 );
86
87
88 argList args(argc, argv);
90
91
92 // Binary output, unless otherwise specified
94 (
95 args.found("ascii")
96 ? IOstreamOption::ASCII
97 : IOstreamOption::BINARY
98 );
99
100 // increase the precision of the points data
101 IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
102
103
105 (
106 args.get<fileName>(1),
107 // Default no scaling
108 args.getOrDefault<scalar>("scale", 1)
109 );
110
111
112 autoPtr<polyMesh> mesh = reader.mesh(runTime);
113 reader.writeMesh(mesh(), format);
114
115
116 if (args.found("check"))
117 {
119 }
120
121 Info<< "\nEnd\n" << endl;
122 return 0;
123}
124
125// ************************************************************************* //
Y[inertIndex] max(0.0)
Checks the mesh for edge connectivity as expected by the AVL/FIRE on-the-fly calculations....
streamFormat
Data format (ascii | binary)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
Extract command arguments and options from the supplied argc and argv parameters.
Definition: argList.H:124
T get(const label index) const
Get a value from the argument at index.
Definition: argListI.H:278
const fileName & rootPath() const noexcept
Return root path.
Definition: argListI.H:63
bool found(const word &optName) const
Return true if the named option is found.
Definition: argListI.H:178
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
Definition: argListI.H:307
const fileName & caseName() const noexcept
Return case name (parallel run) or global case (serial run)
Definition: argListI.H:69
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
Read AVL/FIRE fpma, fpmb files.
A class for handling file names.
Definition: fileName.H:76
dynamicFvMesh & mesh
engineTime & runTime
Namespace for OpenFOAM.
label checkFireEdges(const faceList &faces, const labelListList &pointFaces, const UList< point > &points=UList< point >::null())
check edge connectivity
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
word format(conversionProperties.get< word >("format"))
Foam::argList args(argc, argv)