STYLE: enumerate Nastran PLOADs in NASCore

This commit is contained in:
Mark Olesen
2019-01-17 03:10:31 +01:00
parent c44814c100
commit 361257d9f4
5 changed files with 30 additions and 24 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -42,6 +42,17 @@ Foam::fileFormats::NASCore::fieldFormatNames
});
const Foam::Enum
<
Foam::fileFormats::NASCore::loadFormat
>
Foam::fileFormats::NASCore::loadFormatNames
({
{ loadFormat::PLOAD2, "PLOAD2" },
{ loadFormat::PLOAD4, "PLOAD4" },
});
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
Foam::scalar Foam::fileFormats::NASCore::readNasScalar(const std::string& str)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -69,6 +69,16 @@ public:
//- Selection names for the NASTRAN file field formats
static const Enum<fieldFormat> fieldFormatNames;
//- Output load format
enum loadFormat
{
PLOAD2,
PLOAD4
};
//- Selection names for the NASTRAN file field formats
static const Enum<loadFormat> loadFormatNames;
// Constructors

View File

@ -37,17 +37,6 @@ namespace Foam
addToRunTimeSelectionTable(surfaceWriter, nastranSurfaceWriter, wordDict);
}
const Foam::Enum
<
Foam::nastranSurfaceWriter::loadFormat
>
Foam::nastranSurfaceWriter::loadFormatNames_
({
{ loadFormat::PLOAD2, "PLOAD2" },
{ loadFormat::PLOAD4, "PLOAD4" },
});
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Field writing implementation
@ -356,7 +345,7 @@ Foam::nastranSurfaceWriter::nastranSurfaceWriter(const dictionary& options)
fieldMap_.insert
(
item.first(),
loadFormatNames_[item.second()]
fileFormats::NASCore::loadFormatNames[item.second()]
);
}
}

View File

@ -110,19 +110,13 @@ public:
using fieldFormat = Foam::fileFormats::NASCore::fieldFormat;
//- Output load format
enum loadFormat
{
PLOAD2,
PLOAD4
};
using loadFormat = Foam::fileFormats::NASCore::loadFormat;
private:
// Private data
static const Enum<loadFormat> loadFormatNames_;
//- Field format (width and separator)
fieldFormat writeFormat_;

View File

@ -89,7 +89,8 @@ Foam::Ostream& Foam::nastranSurfaceWriter::writeFaceValue
Type scaledValue = scale_*value;
// Write keyword
writeKeyword(os, loadFormatNames_[format]) << separator_;
writeKeyword(os, fileFormats::NASCore::loadFormatNames[format])
<< separator_;
// Write load set ID
os.setf(std::ios_base::right);
@ -107,8 +108,9 @@ Foam::Ostream& Foam::nastranSurfaceWriter::writeFaceValue
else
{
WarningInFunction
<< loadFormatNames_[format] << " requires scalar values "
<< "and cannot be used for higher rank values"
<< fileFormats::NASCore::loadFormatNames[format]
<< " requires scalar values"
<< " - it cannot be used for higher rank values"
<< endl;
writeValue(os, scalar(0)) << separator_;