Skip to content
Snippets Groups Projects
Commit 4bcb0d71 authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: Provide boundary field writeEntries method (issue #283)

- Write the individual contents, without a surrounding 'boundaryField'
  block. Similar to what dictionary::writeEntries() offers.
parent c836a017
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
...@@ -83,7 +83,7 @@ readField ...@@ -83,7 +83,7 @@ readField
// 2. Patch-groups. (using non-wild card entries of dictionaries) // 2. Patch-groups. (using non-wild card entries of dictionaries)
// (patchnames already matched above) // (patchnames already matched above)
// Note: in reverse order of entries in the dictionary (last // Note: in reverse order of entries in the dictionary (last
// patchGroups wins). This is so is consistent with dictionary wildcard // patchGroups wins). This is so it is consistent with dictionary wildcard
// behaviour // behaviour
if (dict.size()) if (dict.size())
{ {
...@@ -570,14 +570,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary:: ...@@ -570,14 +570,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary::
writeEntry(const word& keyword, Ostream& os) const writeEntry(const word& keyword, Ostream& os) const
{ {
os.beginBlock(keyword); os.beginBlock(keyword);
this->writeEntries(os);
forAll(*this, patchi)
{
os.beginBlock(this->operator[](patchi).patch().name());
os << this->operator[](patchi);
os.endBlock();
}
os.endBlock() << flush; os.endBlock() << flush;
// Check state of IOstream // Check state of IOstream
...@@ -589,6 +582,19 @@ writeEntry(const word& keyword, Ostream& os) const ...@@ -589,6 +582,19 @@ writeEntry(const word& keyword, Ostream& os) const
} }
template<class Type, template<class> class PatchField, class GeoMesh>
void Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary::
writeEntries(Ostream& os) const
{
forAll(*this, patchi)
{
os.beginBlock(this->operator[](patchi).patch().name());
os << this->operator[](patchi);
os.endBlock();
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
...@@ -218,6 +218,9 @@ public: ...@@ -218,6 +218,9 @@ public:
//- Write boundary field as dictionary entry //- Write boundary field as dictionary entry
void writeEntry(const word& keyword, Ostream& os) const; void writeEntry(const word& keyword, Ostream& os) const;
//- Write dictionary entries of the individual boundary fields.
void writeEntries(Ostream& os) const;
// Member operators // Member operators
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment