/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2015-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- 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 "mappedPatchBase.H" #include "addToRunTimeSelectionTable.H" #include "ListListOps.H" #include "meshSearchMeshObject.H" #include "meshTools.H" #include "OFstream.H" #include "Random.H" #include "treeDataFace.H" #include "treeDataPoint.H" #include "indexedOctree.H" #include "polyMesh.H" #include "polyPatch.H" #include "Time.H" #include "mapDistribute.H" #include "SubField.H" #include "triPointRef.H" #include "syncTools.H" #include "treeDataCell.H" #include "DynamicField.H" #include "faceAreaWeightAMI.H" #include "OTstream.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { defineTypeNameAndDebug(mappedPatchBase, 0); } const Foam::Enum < Foam::mappedPatchBase::sampleMode > Foam::mappedPatchBase::sampleModeNames_ ({ { sampleMode::NEARESTCELL, "nearestCell" }, { sampleMode::NEARESTPATCHFACE, "nearestPatchFace" }, { sampleMode::NEARESTPATCHFACEAMI, "nearestPatchFaceAMI" }, { sampleMode::NEARESTPATCHPOINT, "nearestPatchPoint" }, { sampleMode::NEARESTFACE, "nearestFace" }, { sampleMode::NEARESTONLYCELL, "nearestOnlyCell" }, }); const Foam::Enum < Foam::mappedPatchBase::offsetMode > Foam::mappedPatchBase::offsetModeNames_ ({ { offsetMode::UNIFORM, "uniform" }, { offsetMode::NONUNIFORM, "nonuniform" }, { offsetMode::NORMAL, "normal" }, }); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // Foam::autoPtr Foam::mappedPatchBase::readDatabase ( const dictionary& dict ) { autoPtr dbNamePtr_; if (dict.found("sampleDatabase")) { const bool useDb = dict.get("sampleDatabase"); if (useDb) { dbNamePtr_.set ( new fileName ( dict.lookupOrDefault ( "sampleDatabasePath", fileName::null ) ) ); } } else if (dict.found("sampleDatabasePath")) { dbNamePtr_.set(new fileName(dict.get("sampleDatabasePath"))); } return dbNamePtr_; } Foam::label Foam::mappedPatchBase::communicator ( const word& sampleWorld ) { // Start off with local world label comm = UPstream::worldComm; if (!sampleWorld.empty() && Pstream::parRun()) { if (!UPstream::allWorlds().found(sampleWorld)) { FatalErrorInFunction << "Cannot find sampleWorld " << sampleWorld << " in set of worlds " << UPstream::allWorlds() << exit(FatalError); } const labelList& worldIDs = UPstream::worldIDs(); DynamicList