makeGraph.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) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
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 
26 Global
27  makeGraph
28 
29 Description
30  Write a graph file for a field given the data point locations field,
31  the field of interest and the name of the field to be used for the
32  graph file name.
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #include "makeGraph.H"
37 #include "volFields.H"
38 #include "fvMesh.H"
39 #include "graph.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 void Foam::makeGraph
44 (
45  const scalarField& x,
46  const volScalarField& vsf,
47  const word& graphFormat
48 )
49 {
50  makeGraph(x, vsf, vsf.name(), graphFormat);
51 }
52 
53 
54 void Foam::makeGraph
55 (
56  const scalarField& x,
57  const volScalarField& vsf,
58  const word& name,
59  const word& graphFormat
60 )
61 {
62  fileName path(vsf.rootPath()/vsf.caseName()/"graphs"/vsf.instance());
63  mkDir(path);
64 
65  makeGraph
66  (
67  x,
68  vsf.primitiveField(),
69  name,
70  path,
71  graphFormat
72  );
73 }
74 
75 
76 void Foam::makeGraph
77 (
78  const scalarField& x,
79  const scalarField& sf,
80  const word& name,
81  const fileName& path,
82  const word& graphFormat
83 )
84 {
85  graph
86  (
87  name,
88  "x",
89  name,
90  x,
91  sf
92  ).write(path/name, graphFormat);
93 }
94 
95 
96 // ************************************************************************* //
void makeGraph(const scalarField &x, const volScalarField &vsf, const word &graphFormat)
Definition: makeGraph.C:35
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:195
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:81
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Definition: POSIX.C:614
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
A class for handling words, derived from Foam::string.
Definition: word.H:63
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())