diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.C b/src/sampling/sampledSet/sampledSets/sampledSets.C index 8d3bfc29d3..2304ec5048 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSets.C +++ b/src/sampling/sampledSet/sampledSets/sampledSets.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -231,28 +231,43 @@ void Foam::sampledSets::write() void Foam::sampledSets::read(const dictionary& dict) { dict_ = dict; - dict_.lookup("fields") >> fieldSelection_; - clearFieldGroups(); - dict.lookup("interpolationScheme") >> interpolationScheme_; - dict.lookup("setFormat") >> writeFormat_; + bool setsFound = dict_.found("sets"); + if (setsFound) + { + dict_.lookup("fields") >> fieldSelection_; + clearFieldGroups(); - PtrList newList - ( - dict_.lookup("sets"), - sampledSet::iNew(mesh_, searchEngine_) - ); - transfer(newList); - combineSampledSets(masterSampledSets_, indexSets_); + dict.lookup("interpolationScheme") >> interpolationScheme_; + dict.lookup("setFormat") >> writeFormat_; + + PtrList newList + ( + dict_.lookup("sets"), + sampledSet::iNew(mesh_, searchEngine_) + ); + transfer(newList); + 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) { Pout<< "sample fields:" << fieldSelection_ << nl << "sample sets:" << nl << "(" << nl; - forAll(*this, si) + forAll(*this, setI) { - Pout<< " " << operator[](si) << endl; + Pout<< " " << operator[](setI) << endl; } Pout<< ")" << endl; } @@ -261,19 +276,23 @@ void Foam::sampledSets::read(const dictionary& dict) void Foam::sampledSets::correct() { - // reset interpolation - pointMesh::Delete(mesh_); - volPointInterpolation::Delete(mesh_); + bool setsFound = dict_.found("sets"); + if (setsFound) + { + // reset interpolation + pointMesh::Delete(mesh_); + volPointInterpolation::Delete(mesh_); - searchEngine_.correct(); + searchEngine_.correct(); - PtrList newList - ( - dict_.lookup("sets"), - sampledSet::iNew(mesh_, searchEngine_) - ); - transfer(newList); - combineSampledSets(masterSampledSets_, indexSets_); + PtrList newList + ( + dict_.lookup("sets"), + sampledSet::iNew(mesh_, searchEngine_) + ); + transfer(newList); + combineSampledSets(masterSampledSets_, indexSets_); + } } diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C index 581b7e206b..b3e2fc7394 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C @@ -216,34 +216,49 @@ void Foam::sampledSurfaces::write() void Foam::sampledSurfaces::read(const dictionary& dict) { - dict.lookup("fields") >> fieldSelection_; - clearFieldGroups(); + bool surfacesFound = dict.found("surfaces"); - dict.lookup("interpolationScheme") >> interpolationScheme_; - const word writeType(dict.lookup("surfaceFormat")); - - // define the surface formatter - // optionally defined extra controls for the output formats - formatter_ = surfaceWriter::New - ( - writeType, - dict.subOrEmptyDict("formatOptions").subOrEmptyDict(writeType) - ); - - PtrList newList - ( - dict.lookup("surfaces"), - sampledSurface::iNew(mesh_) - ); - transfer(newList); - - if (Pstream::parRun()) + if (surfacesFound) { - mergeList_.setSize(size()); - } + dict.lookup("fields") >> fieldSelection_; + clearFieldGroups(); - // ensure all surfaces and merge information are expired - expire(); + dict.lookup("interpolationScheme") >> interpolationScheme_; + const word writeType(dict.lookup("surfaceFormat")); + + // define the surface formatter + // optionally defined extra controls for the output formats + formatter_ = surfaceWriter::New + ( + writeType, + dict.subOrEmptyDict("formatOptions").subOrEmptyDict(writeType) + ); + + PtrList newList + ( + dict.lookup("surfaces"), + sampledSurface::iNew(mesh_) + ); + transfer(newList); + + if (Pstream::parRun()) + { + mergeList_.setSize(size()); + } + + // ensure all surfaces and merge information are expired + expire(); + + if (this->size()) + { + Info<< "Reading surface description:" << nl; + forAll(*this, surfI) + { + Info<< " " << operator[](surfI).name() << nl; + } + Info<< endl; + } + } if (Pstream::master() && debug) {