writeCellGraph.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "writeCellGraph.H"
27 #include "volFields.H"
28 #include "graph.H"
29 #include "writeFile.H"
30 #include "OSspecific.H"
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 
39 void writeCellGraph
40 (
41  const volScalarField& vsf,
42  const word& graphFormat
43 )
44 {
46  (
47  vsf.time().path()
49  /"graphs"
50  /vsf.time().timeName()
51  );
52  mkDir(path);
53 
54  graph
55  (
56  vsf.name(),
57  "x",
58  vsf.name(),
59  vsf.mesh().C().primitiveField().component(vector::X),
60  vsf.primitiveField()
61  ).write(path/vsf.name(), graphFormat);
62 }
63 
64 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65 
66 } // End namespace Foam
67 
68 // ************************************************************************* //
const word & name() const
Return name.
Definition: IOobject.H:303
A class for handling file names.
Definition: fileName.H:79
word graphFormat
Definition: createFields.H:21
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
Generic GeometricField class.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:636
Class to create, store and output qgraph files.
Definition: graph.H:58
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
static const word outputPrefix
Directory prefix.
Definition: writeFile.H:72
A class for handling words, derived from string.
Definition: word.H:59
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
const Mesh & mesh() const
Return mesh.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
Definition: POSIX.C:290
void writeCellGraph(const volScalarField &vsf, const word &graphFormat)
const Time & time() const
Return time.
Definition: IOobject.C:318
fileName path() const
Return path.
Definition: TimePaths.H:139
Namespace for OpenFOAM.
fileName path(UMean.rootPath()/UMean.caseName()/functionObjects::writeFile::outputPrefix/"graphs"/UMean.instance())