X3DsurfaceFormatCore.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  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "X3DsurfaceFormatCore.H"
30 #include "Ostream.H"
31 
32 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
33 
35 (
36  Ostream& os
37 )
38 {
39  os <<
40  "<?xml version='1.0' encoding='UTF-8'?>\n"
41  "<!DOCTYPE X3D PUBLIC \"ISO//Web3D//DTD X3D 3.0//EN\" "
42  "\"http://www.web3d.org/specifications/x3d-3.0.dtd\">\n"
43  "<X3D\n"
44  " version='3.0'\n"
45  " profile='Immersive'\n"
46  " xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance'\n"
47  " xsd:noNamespaceSchemaLocation="
48  "'http://www.web3d.org/specifications/x3d-3.0.xsd'\n"
49  " >\n";
50 }
51 
52 
54 (
55  Ostream& os
56 )
57 {
58  os <<
59  "</X3D>\n";
60 }
61 
62 
64 (
65  Ostream& os
66 )
67 {
68  os <<
69  "<Group>\n"
70  " <Shape>\n";
71 }
72 
73 
75 (
76  Ostream& os
77 )
78 {
79  os <<
80  " </Shape>\n"
81  " </Group>\n";
82 }
83 
84 
86 (
87  Ostream& os
88 )
89 {
90  os <<
91  " <Appearance>\n"
92  " <Material"
93  " ambientIntensity='0'"
94  " diffuseColor='1 1 1'" // Default: '0.8 0.8 0.8'
95  // Default: " emissiveColor='0 0 0'"
96  // Default: " specularColor='0 0 0'"
97  " shininess='0.8'" // Default: 0.2
98  " transparency='0'"
99  " />\n" // Material
100  " </Appearance>\n";
101 }
102 
103 
105 (
106  Ostream& os,
107  const UList<point>& pts
108 )
109 {
110  os <<
111  " <Coordinate point='\n";
112 
113  for (const point& p : pts)
114  {
115  os << p.x() << ' ' << p.y() << ' ' << p.z() << ',' << nl;
116  }
117 
118  os <<
119  "' />\n";
120 }
121 
122 
123 // ************************************************************************* //
Foam::fileFormats::X3DsurfaceFormatCore::writePoints
static void writePoints(Ostream &os, const UList< point > &pts)
Write points (Coordinate)
Definition: X3DsurfaceFormatCore.C:105
Foam::fileFormats::X3DsurfaceFormatCore::writeAppearance
static void writeAppearance(Ostream &os)
Write appearance node.
Definition: X3DsurfaceFormatCore.C:86
p
volScalarField & p
Definition: createFieldRefs.H:8
X3DsurfaceFormatCore.H
os
OBJstream os(runTime.globalPath()/outputName)
Foam::fileFormats::X3DsurfaceFormatCore::writeHeader
static void writeHeader(Ostream &os)
Write file header.
Definition: X3DsurfaceFormatCore.C:35
Ostream.H
Foam::fileFormats::X3DsurfaceFormatCore::endGroup
static void endGroup(Ostream &os)
End Group/Shape node.
Definition: X3DsurfaceFormatCore.C:75
Foam::nl
constexpr char nl
Definition: Ostream.H:404
Foam::Vector< scalar >
Foam::fileFormats::X3DsurfaceFormatCore::writeFooter
static void writeFooter(Ostream &os)
Write file header.
Definition: X3DsurfaceFormatCore.C:54
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:103
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::fileFormats::X3DsurfaceFormatCore::beginGroup
static void beginGroup(Ostream &os)
Begin Group/Shape node.
Definition: X3DsurfaceFormatCore.C:64