Newer
Older
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
-------------------------------------------------------------------------------
Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "ensightCase.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::ensightCase::options::options(IOstream::streamFormat format)
:
format_(format),
overwrite_(false),
nodeValues_(false),
separateCloud_(false),
width_(0),
mask_(),
printf_()
width(8); // Fill mask and setup printf-format
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::IOstream::streamFormat Foam::ensightCase::options::format() const
{
return format_;
}
const Foam::word& Foam::ensightCase::options::mask() const
{
return mask_;
}
Foam::word Foam::ensightCase::options::padded(const label i) const
{
// As per word::printf(), but with fixed length
::snprintf(buf, 32, printf_.c_str(), static_cast<int>(i));
// No stripping required
return word(buf, false);
}
Foam::label Foam::ensightCase::options::width() const
{
return width_;
}
void Foam::ensightCase::options::width(const label n)
{
// Enforce min/max sanity limits
if (n < 1 || n > 31)
{
return;
}
// Set mask accordingly
// Appropriate printf format
printf_ = "%0" + std::to_string(n) + "d";
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
}
bool Foam::ensightCase::options::overwrite() const
{
return overwrite_;
}
void Foam::ensightCase::options::overwrite(bool b)
{
overwrite_ = b;
}
bool Foam::ensightCase::options::nodeValues() const
{
return nodeValues_;
}
void Foam::ensightCase::options::nodeValues(bool b)
{
nodeValues_ = b;
}
bool Foam::ensightCase::options::separateCloud() const
{
return separateCloud_;
}
void Foam::ensightCase::options::separateCloud(bool b)
{
separateCloud_ = b;
}
// ************************************************************************* //