/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ #include "basicSource.H" #include "fvMesh.H" #include "fvMatrices.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { defineTypeNameAndDebug(basicSource, 0); defineRunTimeSelectionTable(basicSource, dictionary); template<> const char* NamedEnum < basicSource::selectionModeType, 5 >::names[] = { "points", "cellSet", "cellZone", "mapRegion", "all" }; const NamedEnum basicSource::selectionModeTypeNames_; } // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // bool Foam::basicSource::alwaysApply() const { return false; } void Foam::basicSource::setSelection(const dictionary& dict) { switch (selectionMode_) { case smPoints: { dict.lookup("points") >> points_; break; } case smCellSet: { dict.lookup("cellSet") >> cellSetName_; break; } case smCellZone: { dict.lookup("cellZone") >> cellSetName_; break; } case smMapRegion: { dict_.lookup("secondarySourceName") >> secondarySourceName_; dict_.lookup("mapRegionName") >> mapRegionName_; master_ = readBool(dict_.lookup("master")); break; } case smAll: { break; } default: { FatalErrorIn ( "basicSource::setSelection(const dictionary&)" ) << "Unknown selectionMode " << selectionModeTypeNames_[selectionMode_] << ". Valid selectionMode types are" << selectionModeTypeNames_ << exit(FatalError); } } } void Foam::basicSource::setCellSet() { Info<< incrIndent << indent << "Source: " << name_ << endl; switch (selectionMode_) { case smPoints: { Info<< indent << "- selecting cells using points" << endl; labelHashSet selectedCells; forAll(points_, i) { label cellI = mesh_.findCell(points_[i]); if (cellI >= 0) { selectedCells.insert(cellI); } label globalCellI = returnReduce(cellI, maxOp