rawSurfaceWriter.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) 2011-2021 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 "rawSurfaceWriter.H"
27 #include "OFstream.H"
28 #include "OSspecific.H"
29 #include "primitivePatch.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36  defineTypeNameAndDebug(rawSurfaceWriter, 0);
37  addToRunTimeSelectionTable(surfaceWriter, rawSurfaceWriter, word);
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
42 
44 {}
45 
46 
47 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
48 
50 (
51  const fileName& outputDir,
52  const fileName& surfaceName,
53  const pointField& points,
54  const faceList& faces,
55  const wordList& fieldNames,
56  const bool writePointValues
57  #define FieldTypeValuesConstArg(Type, nullArg) \
58  , const UPtrList<const Field<Type>>& field##Type##Values
59  FOR_ALL_FIELD_TYPES(FieldTypeValuesConstArg)
60  #undef FieldTypeValuesConstArg
61 ) const
62 {
63  const primitivePatch patch(SubList<face>(faces, faces.size()), points);
64 
65  const coordSet set
66  (
67  false,
68  writePointValues ? "point" : "face",
69  writePointValues ? patch.points() : patch.faceCentres()
70  );
71 
72  rawSetWriter(writeFormat_, writeCompression_).write
73  (
74  outputDir,
75  surfaceName,
76  set,
77  fieldNames
78  #define FieldTypeValuesParameter(Type, nullArg) , field##Type##Values
81  );
82 }
83 
84 
85 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:79
const Field< PointType > & faceCentres() const
Return face centres for patch.
Write set in raw tabulated format.
Definition: rawSetWriter.H:48
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
#define FieldTypeValuesConstArg(Type, nullArg)
Macros for easy insertion into run-time selection tables.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
A list of faces which address into the list of points.
A List obtained as a section of another List.
Definition: SubList.H:53
Holds list of sampling positions.
Definition: coordSet.H:50
virtual ~rawSurfaceWriter()
Destructor.
virtual void write(const fileName &outputDir, const fileName &surfaceName, const pointField &points, const faceList &faces, const wordList &fieldNames, const bool writePointValues #define FieldTypeValuesConstArg(Type, nullArg)) const
Write fields for a single surface to file.
const Field< PointType > & points() const
Return reference to global points.
virtual void write(const fileName &outputDir, const fileName &setName, const coordSet &set, const wordList &valueSetNames #define TypeValueSetsConstArg(Type, nullArg)) const
Write a coordSet and associated data.
Definition: rawSetWriter.C:83
#define FieldTypeValuesParameter(Type, nullArg)
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: UPtrList.H:54
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
FOR_ALL_FIELD_TYPES(DefineFvWallInfoType)
rDeltaTY field()
Namespace for OpenFOAM.