From af1320992037b48372d753fdb22e9eb81e448b8f Mon Sep 17 00:00:00 2001 From: mark <mark@opencfd> Date: Fri, 23 Sep 2016 14:53:01 +0200 Subject: [PATCH] STYLE: add OpenFOAM version to ensight geom file description. - More informative than a horizonal line, can help when debugging. STYLE: remove unused write field methods from ensightParts --- src/conversion/ensight/file/ensightGeoFile.C | 14 +++- src/conversion/ensight/part/ensightPart.H | 21 ------ src/conversion/ensight/part/ensightPartIO.C | 72 -------------------- src/conversion/ensight/part/ensightParts.C | 53 -------------- src/conversion/ensight/part/ensightParts.H | 25 ------- 5 files changed, 13 insertions(+), 172 deletions(-) diff --git a/src/conversion/ensight/file/ensightGeoFile.C b/src/conversion/ensight/file/ensightGeoFile.C index c52aa79356a..0119087e70f 100644 --- a/src/conversion/ensight/file/ensightGeoFile.C +++ b/src/conversion/ensight/file/ensightGeoFile.C @@ -24,14 +24,26 @@ License \*---------------------------------------------------------------------------*/ #include "ensightGeoFile.H" +#include "foamVersion.H" + +// Macros to stringify macro contents. +#define STRINGIFY(content) #content +#define STRING_QUOTE(input) STRINGIFY(input) + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::ensightGeoFile::initialize() { + #ifdef OPENFOAM_PLUS + string desc2("Written by OpenFOAM+ " STRING_QUOTE(OPENFOAM_PLUS)); + #else + string desc2("Written by OpenFOAM-" + string(Foam::FOAMversion)); + #endif + writeBinaryHeader(); write("Ensight Geometry File"); newline(); // description line 1 - write("====================="); newline(); // description line 2 + write(desc2); newline(); // description line 2 write("node id assign"); newline(); write("element id assign"); newline(); } diff --git a/src/conversion/ensight/part/ensightPart.H b/src/conversion/ensight/part/ensightPart.H index feb6d371baf..f48d626ae42 100644 --- a/src/conversion/ensight/part/ensightPart.H +++ b/src/conversion/ensight/part/ensightPart.H @@ -303,27 +303,6 @@ public: //- Helper: write geometry given the pointField void writeGeometry(ensightGeoFile&, const pointField&) const; - //- Write scalar field - // optionally write data per node - void writeScalarField - ( - ensightFile&, - const List<scalar>& field, - const bool perNode = false - ) const; - - //- Write vector field components - // optionally write data per node - void writeVectorField - ( - ensightFile&, - const List<scalar>& field0, - const List<scalar>& field1, - const List<scalar>& field2, - const bool perNode = false - ) const; - - //- Write generalized field components // optionally write data per node template<class Type> diff --git a/src/conversion/ensight/part/ensightPartIO.C b/src/conversion/ensight/part/ensightPartIO.C index 1457ff46c36..4e21d6dd62b 100644 --- a/src/conversion/ensight/part/ensightPartIO.C +++ b/src/conversion/ensight/part/ensightPartIO.C @@ -213,78 +213,6 @@ void Foam::ensightPart::writeGeometry } -void Foam::ensightPart::writeScalarField -( - ensightFile& os, - const List<scalar>& field, - const bool perNode -) const -{ - if (size() && field.size() && (os.allowUndef() || isFieldDefined(field))) - { - writeHeader(os); - - if (perNode) - { - os.writeKeyword("coordinates"); - writeFieldList(os, field, labelUList::null()); - } - else - { - forAll(elementTypes(), elemI) - { - const labelUList& idList = elemLists_[elemI]; - - if (idList.size()) - { - os.writeKeyword(elementTypes()[elemI]); - writeFieldList(os, field, idList); - } - } - } - } -} - - -void Foam::ensightPart::writeVectorField -( - ensightFile& os, - const List<scalar>& field0, - const List<scalar>& field1, - const List<scalar>& field2, - const bool perNode -) const -{ - if (size() && field0.size() && (os.allowUndef() || isFieldDefined(field0))) - { - writeHeader(os); - - if (perNode) - { - os.writeKeyword("coordinates"); - writeFieldList(os, field0, labelUList::null()); - writeFieldList(os, field1, labelUList::null()); - writeFieldList(os, field2, labelUList::null()); - } - else - { - forAll(elementTypes(), elemI) - { - const labelUList& idList = elemLists_[elemI]; - - if (idList.size()) - { - os.writeKeyword(elementTypes()[elemI]); - writeFieldList(os, field0, idList); - writeFieldList(os, field1, idList); - writeFieldList(os, field2, idList); - } - } - } - } -} - - // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Foam::Ostream& Foam::operator<< diff --git a/src/conversion/ensight/part/ensightParts.C b/src/conversion/ensight/part/ensightParts.C index a7675bf4839..1ad47296642 100644 --- a/src/conversion/ensight/part/ensightParts.C +++ b/src/conversion/ensight/part/ensightParts.C @@ -225,59 +225,6 @@ void Foam::ensightParts::writeData(Ostream& os) const } -void Foam::ensightParts::writeScalarField -( - ensightFile& os, - const List<scalar>& field, - const bool useFaceData, - const bool perNode -) const -{ - forAll(partsList_, partI) - { - if - ( - useFaceData - ? partsList_[partI].isFaceData() - : partsList_[partI].isCellData() - ) - { - partsList_[partI].writeScalarField(os, field, perNode); - } - } -} - - -void Foam::ensightParts::writeVectorField -( - ensightFile& os, - const List<scalar>& field0, - const List<scalar>& field1, - const List<scalar>& field2, - const bool useFaceData, - const bool perNode -) const -{ - forAll(partsList_, partI) - { - if - ( - useFaceData - ? partsList_[partI].isFaceData() - : partsList_[partI].isCellData() - ) - { - partsList_[partI].writeVectorField - ( - os, - field0, field1, field2, - perNode - ); - } - } -} - - // * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * // Foam::ensightGeoFile& Foam::operator<< diff --git a/src/conversion/ensight/part/ensightParts.H b/src/conversion/ensight/part/ensightParts.H index 68c18774bab..76712b9447b 100644 --- a/src/conversion/ensight/part/ensightParts.H +++ b/src/conversion/ensight/part/ensightParts.H @@ -108,31 +108,6 @@ public: //- Write the lists void writeData(Ostream&) const; - //- Write (volume) scalar field - // optionally write data for face parts - // optionally write data per node - void writeScalarField - ( - ensightFile&, - const List<scalar>& field, - const bool useFaceData = false, - const bool perNode = false - ) const; - - //- Write (volume) vector field components - // optionally write data for face parts - // optionally write data per node - void writeVectorField - ( - ensightFile&, - const List<scalar>& field0, - const List<scalar>& field1, - const List<scalar>& field2, - const bool useFaceData = false, - const bool perNode = false - ) const; - - //- Write generalized volume field components template<class Type> void writeField -- GitLab