ENH: Only read set and surface sampling fields if specified

This commit is contained in:
andy
2011-03-17 10:33:16 +00:00
parent a9109f3e30
commit 8f351e2776
2 changed files with 84 additions and 50 deletions

View File

@ -2,7 +2,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) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -231,6 +231,10 @@ void Foam::sampledSets::write()
void Foam::sampledSets::read(const dictionary& dict) void Foam::sampledSets::read(const dictionary& dict)
{ {
dict_ = dict; dict_ = dict;
bool setsFound = dict_.found("sets");
if (setsFound)
{
dict_.lookup("fields") >> fieldSelection_; dict_.lookup("fields") >> fieldSelection_;
clearFieldGroups(); clearFieldGroups();
@ -245,14 +249,25 @@ void Foam::sampledSets::read(const dictionary& dict)
transfer(newList); transfer(newList);
combineSampledSets(masterSampledSets_, indexSets_); combineSampledSets(masterSampledSets_, indexSets_);
if (this->size())
{
Info<< "Reading set description:" << nl;
forAll(*this, setI)
{
Info<< " " << operator[](setI).name() << nl;
}
Info<< endl;
}
}
if (Pstream::master() && debug) if (Pstream::master() && debug)
{ {
Pout<< "sample fields:" << fieldSelection_ << nl Pout<< "sample fields:" << fieldSelection_ << nl
<< "sample sets:" << nl << "(" << nl; << "sample sets:" << nl << "(" << nl;
forAll(*this, si) forAll(*this, setI)
{ {
Pout<< " " << operator[](si) << endl; Pout<< " " << operator[](setI) << endl;
} }
Pout<< ")" << endl; Pout<< ")" << endl;
} }
@ -261,6 +276,9 @@ void Foam::sampledSets::read(const dictionary& dict)
void Foam::sampledSets::correct() void Foam::sampledSets::correct()
{ {
bool setsFound = dict_.found("sets");
if (setsFound)
{
// reset interpolation // reset interpolation
pointMesh::Delete(mesh_); pointMesh::Delete(mesh_);
volPointInterpolation::Delete(mesh_); volPointInterpolation::Delete(mesh_);
@ -274,6 +292,7 @@ void Foam::sampledSets::correct()
); );
transfer(newList); transfer(newList);
combineSampledSets(masterSampledSets_, indexSets_); combineSampledSets(masterSampledSets_, indexSets_);
}
} }

View File

@ -216,6 +216,10 @@ void Foam::sampledSurfaces::write()
void Foam::sampledSurfaces::read(const dictionary& dict) void Foam::sampledSurfaces::read(const dictionary& dict)
{ {
bool surfacesFound = dict.found("surfaces");
if (surfacesFound)
{
dict.lookup("fields") >> fieldSelection_; dict.lookup("fields") >> fieldSelection_;
clearFieldGroups(); clearFieldGroups();
@ -245,6 +249,17 @@ void Foam::sampledSurfaces::read(const dictionary& dict)
// ensure all surfaces and merge information are expired // ensure all surfaces and merge information are expired
expire(); expire();
if (this->size())
{
Info<< "Reading surface description:" << nl;
forAll(*this, surfI)
{
Info<< " " << operator[](surfI).name() << nl;
}
Info<< endl;
}
}
if (Pstream::master() && debug) if (Pstream::master() && debug)
{ {
Pout<< "sample fields:" << fieldSelection_ << nl Pout<< "sample fields:" << fieldSelection_ << nl