diff --git a/applications/utilities/preProcessing/mapFields/Make/options b/applications/utilities/preProcessing/mapFields/Make/options index 7bd964094e..b4ed87bf74 100644 --- a/applications/utilities/preProcessing/mapFields/Make/options +++ b/applications/utilities/preProcessing/mapFields/Make/options @@ -1,4 +1,5 @@ EXE_INC = \ + -DFULLDEBUG -g -O0 \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ diff --git a/applications/utilities/preProcessing/mapFields/MapConsistentVolFields.H b/applications/utilities/preProcessing/mapFields/MapConsistentVolFields.H deleted file mode 100644 index 9015c473a2..0000000000 --- a/applications/utilities/preProcessing/mapFields/MapConsistentVolFields.H +++ /dev/null @@ -1,130 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 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 . - -\*---------------------------------------------------------------------------*/ - -#ifndef MapConsistentVolFields_H -#define MapConsistentVolFields_H - -#include "GeometricField.H" -#include "meshToMesh.H" -#include "IOobjectList.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -template -void MapConsistentVolFields -( - const IOobjectList& objects, - const meshToMesh& meshToMeshInterp, - const meshToMesh::order& mapOrder, - const CombineOp& cop -) -{ - const fvMesh& meshSource = meshToMeshInterp.fromMesh(); - const fvMesh& meshTarget = meshToMeshInterp.toMesh(); - - word fieldClassName - ( - GeometricField::typeName - ); - - IOobjectList fields = objects.lookupClass(fieldClassName); - - forAllIter(IOobjectList, fields, fieldIter) - { - Info<< " interpolating " << fieldIter()->name() - << endl; - - // Read field - GeometricField fieldSource - ( - *fieldIter(), - meshSource - ); - - IOobject fieldTargetIOobject - ( - fieldIter()->name(), - meshTarget.time().timeName(), - meshTarget, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ); - - if (fieldTargetIOobject.headerOk()) - { - // Read fieldTarget - GeometricField fieldTarget - ( - fieldTargetIOobject, - meshTarget - ); - - // Interpolate field - meshToMeshInterp.interpolate// > - ( - fieldTarget, - fieldSource, - mapOrder, - cop - ); - - // Write field - fieldTarget.write(); - } - else - { - fieldTargetIOobject.readOpt() = IOobject::NO_READ; - - // Interpolate field - GeometricField fieldTarget - ( - fieldTargetIOobject, - meshToMeshInterp.interpolate// > - ( - fieldSource, - mapOrder, - cop - ) - ); - - // Write field - fieldTarget.write(); - } - } -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/preProcessing/mapFields/MapLagrangianFields.H b/applications/utilities/preProcessing/mapFields/MapLagrangianFields.H index 19a8e74f41..07d8d8335b 100644 --- a/applications/utilities/preProcessing/mapFields/MapLagrangianFields.H +++ b/applications/utilities/preProcessing/mapFields/MapLagrangianFields.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,19 +51,18 @@ void MapLagrangianFields ( const string& cloudName, const IOobjectList& objects, - const meshToMesh& meshToMeshInterp, + const polyMesh& meshTarget, const labelList& addParticles ) { - const fvMesh& meshTarget = meshToMeshInterp.toMesh(); - { IOobjectList fields = objects.lookupClass(IOField::typeName); forAllIter(IOobjectList, fields, fieldIter) { - Info<< " mapping lagrangian field " - << fieldIter()->name() << endl; + const word& fieldName = fieldIter()->name(); + + Info<< " mapping lagrangian field " << fieldName << endl; // Read field (does not need mesh) IOField fieldSource(*fieldIter()); @@ -73,7 +72,7 @@ void MapLagrangianFields ( IOobject ( - fieldIter()->name(), + fieldName, meshTarget.time().timeName(), cloud::prefix/cloudName, meshTarget, @@ -100,8 +99,9 @@ void MapLagrangianFields forAllIter(IOobjectList, fieldFields, fieldIter) { - Info<< " mapping lagrangian fieldField " - << fieldIter()->name() << endl; + const word& fieldName = fieldIter()->name(); + + Info<< " mapping lagrangian fieldField " << fieldName << endl; // Read field (does not need mesh) IOField > fieldSource(*fieldIter()); @@ -112,7 +112,7 @@ void MapLagrangianFields ( IOobject ( - fieldIter()->name(), + fieldName, meshTarget.time().timeName(), cloud::prefix/cloudName, meshTarget, diff --git a/applications/utilities/preProcessing/mapFields/MapMeshes.H b/applications/utilities/preProcessing/mapFields/MapMeshes.H index e497eb0ccd..e75819f289 100644 --- a/applications/utilities/preProcessing/mapFields/MapMeshes.H +++ b/applications/utilities/preProcessing/mapFields/MapMeshes.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,9 +27,9 @@ License #define MapMeshes_H #include "MapVolFields.H" -#include "MapConsistentVolFields.H" #include "mapLagrangian.H" #include "UnMapped.H" +#include "pointMesh.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -37,155 +37,62 @@ namespace Foam { template class CombineOp> -void MapConsistentMesh +void MapMesh ( - const fvMesh& meshSource, - const fvMesh& meshTarget, - const meshToMesh::order& mapOrder + const meshToMesh& interp, + const HashSet& selectedFields, + const bool noLagrangian ) { - // Create the interpolation scheme - meshToMesh meshToMeshInterp(meshSource, meshTarget); - - Info<< nl - << "Consistently creating and mapping fields for time " - << meshSource.time().timeName() << nl << endl; - { + const polyMesh& meshSource = interp.srcRegion(); + // Search for list of objects for this time IOobjectList objects(meshSource, meshSource.time().timeName()); - // Map volFields - // ~~~~~~~~~~~~~ - MapConsistentVolFields - ( - objects, - meshToMeshInterp, - mapOrder, - CombineOp() - ); - MapConsistentVolFields - ( - objects, - meshToMeshInterp, - mapOrder, - CombineOp() - ); - MapConsistentVolFields - ( - objects, - meshToMeshInterp, - mapOrder, - CombineOp() - ); - MapConsistentVolFields - ( - objects, - meshToMeshInterp, - mapOrder, - CombineOp() - ); - MapConsistentVolFields - ( - objects, - meshToMeshInterp, - mapOrder, - CombineOp() - ); - } - - { - // Search for list of target objects for this time - IOobjectList objects(meshTarget, meshTarget.time().timeName()); - - // Mark surfaceFields as unmapped - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - UnMapped(objects); - UnMapped(objects); - UnMapped(objects); - UnMapped(objects); - UnMapped(objects); - - // Mark pointFields as unmapped - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - UnMapped(objects); - UnMapped(objects); - UnMapped(objects); - UnMapped(objects); - UnMapped(objects); - } - - mapLagrangian(meshToMeshInterp); -} - - -template class CombineOp> -void MapSubMesh -( - const fvMesh& meshSource, - const fvMesh& meshTarget, - const HashTable& patchMap, - const wordList& cuttingPatches, - const meshToMesh::order& mapOrder -) -{ - // Create the interpolation scheme - meshToMesh meshToMeshInterp - ( - meshSource, - meshTarget, - patchMap, - cuttingPatches - ); - - Info<< nl - << "Mapping fields for time " << meshSource.time().timeName() - << nl << endl; - - { - // Search for list of source objects for this time - IOobjectList objects(meshSource, meshSource.time().timeName()); - // Map volFields // ~~~~~~~~~~~~~ MapVolFields ( objects, - meshToMeshInterp, - mapOrder, + selectedFields, + interp, CombineOp() ); + MapVolFields ( objects, - meshToMeshInterp, - mapOrder, + selectedFields, + interp, CombineOp() ); MapVolFields ( objects, - meshToMeshInterp, - mapOrder, + selectedFields, + interp, CombineOp() ); MapVolFields ( objects, - meshToMeshInterp, - mapOrder, + selectedFields, + interp, CombineOp() ); MapVolFields ( objects, - meshToMeshInterp, - mapOrder, + selectedFields, + interp, CombineOp() ); } { + const polyMesh& meshTarget = interp.tgtRegion(); + // Search for list of target objects for this time IOobjectList objects(meshTarget, meshTarget.time().timeName()); @@ -206,49 +113,10 @@ void MapSubMesh UnMapped(objects); } - mapLagrangian(meshToMeshInterp); -} - - -template class CombineOp> -void MapConsistentSubMesh -( - const fvMesh& meshSource, - const fvMesh& meshTarget, - const meshToMesh::order& mapOrder -) -{ - HashTable patchMap; - HashTable