mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: mapFields: add -subtract option to subtract whilst mapping
This commit is contained in:
@ -35,12 +35,13 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
void MapConsistentVolFields
|
void MapConsistentVolFields
|
||||||
(
|
(
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const meshToMesh& meshToMeshInterp,
|
const meshToMesh& meshToMeshInterp,
|
||||||
const meshToMesh::order& mapOrder
|
const meshToMesh::order& mapOrder,
|
||||||
|
const CombineOp& cop
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const fvMesh& meshSource = meshToMeshInterp.fromMesh();
|
const fvMesh& meshSource = meshToMeshInterp.fromMesh();
|
||||||
@ -84,7 +85,13 @@ void MapConsistentVolFields
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Interpolate field
|
// Interpolate field
|
||||||
meshToMeshInterp.interpolate(fieldTarget, fieldSource, mapOrder);
|
meshToMeshInterp.interpolate//<Type, eqOp<Type> >
|
||||||
|
(
|
||||||
|
fieldTarget,
|
||||||
|
fieldSource,
|
||||||
|
mapOrder,
|
||||||
|
cop
|
||||||
|
);
|
||||||
|
|
||||||
// Write field
|
// Write field
|
||||||
fieldTarget.write();
|
fieldTarget.write();
|
||||||
@ -97,7 +104,12 @@ void MapConsistentVolFields
|
|||||||
GeometricField<Type, fvPatchField, volMesh> fieldTarget
|
GeometricField<Type, fvPatchField, volMesh> fieldTarget
|
||||||
(
|
(
|
||||||
fieldTargetIOobject,
|
fieldTargetIOobject,
|
||||||
meshToMeshInterp.interpolate(fieldSource, mapOrder)
|
meshToMeshInterp.interpolate//<Type, eqOp<Type> >
|
||||||
|
(
|
||||||
|
fieldSource,
|
||||||
|
mapOrder,
|
||||||
|
cop
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Write field
|
// Write field
|
||||||
|
|||||||
263
applications/utilities/preProcessing/mapFields/MapMeshes.H
Normal file
263
applications/utilities/preProcessing/mapFields/MapMeshes.H
Normal file
@ -0,0 +1,263 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef MapMeshes_H
|
||||||
|
#define MapMeshes_H
|
||||||
|
|
||||||
|
#include "MapVolFields.H"
|
||||||
|
#include "MapConsistentVolFields.H"
|
||||||
|
#include "mapLagrangian.H"
|
||||||
|
#include "UnMapped.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
template<template<class> class CombineOp>
|
||||||
|
void MapConsistentMesh
|
||||||
|
(
|
||||||
|
const fvMesh& meshSource,
|
||||||
|
const fvMesh& meshTarget,
|
||||||
|
const meshToMesh::order& mapOrder
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Create the interpolation scheme
|
||||||
|
meshToMesh meshToMeshInterp(meshSource, meshTarget);
|
||||||
|
|
||||||
|
Info<< nl
|
||||||
|
<< "Consistently creating and mapping fields for time "
|
||||||
|
<< meshSource.time().timeName() << nl << endl;
|
||||||
|
|
||||||
|
{
|
||||||
|
// Search for list of objects for this time
|
||||||
|
IOobjectList objects(meshSource, meshSource.time().timeName());
|
||||||
|
|
||||||
|
// Map volFields
|
||||||
|
// ~~~~~~~~~~~~~
|
||||||
|
MapConsistentVolFields<scalar>
|
||||||
|
(
|
||||||
|
objects,
|
||||||
|
meshToMeshInterp,
|
||||||
|
mapOrder,
|
||||||
|
CombineOp<scalar>()
|
||||||
|
);
|
||||||
|
MapConsistentVolFields<vector>
|
||||||
|
(
|
||||||
|
objects,
|
||||||
|
meshToMeshInterp,
|
||||||
|
mapOrder,
|
||||||
|
CombineOp<vector>()
|
||||||
|
);
|
||||||
|
MapConsistentVolFields<sphericalTensor>
|
||||||
|
(
|
||||||
|
objects,
|
||||||
|
meshToMeshInterp,
|
||||||
|
mapOrder,
|
||||||
|
CombineOp<sphericalTensor>()
|
||||||
|
);
|
||||||
|
MapConsistentVolFields<symmTensor>
|
||||||
|
(
|
||||||
|
objects,
|
||||||
|
meshToMeshInterp,
|
||||||
|
mapOrder,
|
||||||
|
CombineOp<symmTensor>()
|
||||||
|
);
|
||||||
|
MapConsistentVolFields<tensor>
|
||||||
|
(
|
||||||
|
objects,
|
||||||
|
meshToMeshInterp,
|
||||||
|
mapOrder,
|
||||||
|
CombineOp<tensor>()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Search for list of target objects for this time
|
||||||
|
IOobjectList objects(meshTarget, meshTarget.time().timeName());
|
||||||
|
|
||||||
|
// Mark surfaceFields as unmapped
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
UnMapped<surfaceScalarField>(objects);
|
||||||
|
UnMapped<surfaceVectorField>(objects);
|
||||||
|
UnMapped<surfaceSphericalTensorField>(objects);
|
||||||
|
UnMapped<surfaceSymmTensorField>(objects);
|
||||||
|
UnMapped<surfaceTensorField>(objects);
|
||||||
|
|
||||||
|
// Mark pointFields as unmapped
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
UnMapped<pointScalarField>(objects);
|
||||||
|
UnMapped<pointVectorField>(objects);
|
||||||
|
UnMapped<pointSphericalTensorField>(objects);
|
||||||
|
UnMapped<pointSymmTensorField>(objects);
|
||||||
|
UnMapped<pointTensorField>(objects);
|
||||||
|
}
|
||||||
|
|
||||||
|
mapLagrangian(meshToMeshInterp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<template<class> class CombineOp>
|
||||||
|
void MapSubMesh
|
||||||
|
(
|
||||||
|
const fvMesh& meshSource,
|
||||||
|
const fvMesh& meshTarget,
|
||||||
|
const HashTable<word>& 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<scalar>
|
||||||
|
(
|
||||||
|
objects,
|
||||||
|
meshToMeshInterp,
|
||||||
|
mapOrder,
|
||||||
|
CombineOp<scalar>()
|
||||||
|
);
|
||||||
|
MapVolFields<vector>
|
||||||
|
(
|
||||||
|
objects,
|
||||||
|
meshToMeshInterp,
|
||||||
|
mapOrder,
|
||||||
|
CombineOp<vector>()
|
||||||
|
);
|
||||||
|
MapVolFields<sphericalTensor>
|
||||||
|
(
|
||||||
|
objects,
|
||||||
|
meshToMeshInterp,
|
||||||
|
mapOrder,
|
||||||
|
CombineOp<sphericalTensor>()
|
||||||
|
);
|
||||||
|
MapVolFields<symmTensor>
|
||||||
|
(
|
||||||
|
objects,
|
||||||
|
meshToMeshInterp,
|
||||||
|
mapOrder,
|
||||||
|
CombineOp<symmTensor>()
|
||||||
|
);
|
||||||
|
MapVolFields<tensor>
|
||||||
|
(
|
||||||
|
objects,
|
||||||
|
meshToMeshInterp,
|
||||||
|
mapOrder,
|
||||||
|
CombineOp<tensor>()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Search for list of target objects for this time
|
||||||
|
IOobjectList objects(meshTarget, meshTarget.time().timeName());
|
||||||
|
|
||||||
|
// Mark surfaceFields as unmapped
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
UnMapped<surfaceScalarField>(objects);
|
||||||
|
UnMapped<surfaceVectorField>(objects);
|
||||||
|
UnMapped<surfaceSphericalTensorField>(objects);
|
||||||
|
UnMapped<surfaceSymmTensorField>(objects);
|
||||||
|
UnMapped<surfaceTensorField>(objects);
|
||||||
|
|
||||||
|
// Mark pointFields as unmapped
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
UnMapped<pointScalarField>(objects);
|
||||||
|
UnMapped<pointVectorField>(objects);
|
||||||
|
UnMapped<pointSphericalTensorField>(objects);
|
||||||
|
UnMapped<pointSymmTensorField>(objects);
|
||||||
|
UnMapped<pointTensorField>(objects);
|
||||||
|
}
|
||||||
|
|
||||||
|
mapLagrangian(meshToMeshInterp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<template<class> class CombineOp>
|
||||||
|
void MapConsistentSubMesh
|
||||||
|
(
|
||||||
|
const fvMesh& meshSource,
|
||||||
|
const fvMesh& meshTarget,
|
||||||
|
const meshToMesh::order& mapOrder
|
||||||
|
)
|
||||||
|
{
|
||||||
|
HashTable<word> patchMap;
|
||||||
|
HashTable<label> cuttingPatchTable;
|
||||||
|
|
||||||
|
forAll(meshTarget.boundary(), patchi)
|
||||||
|
{
|
||||||
|
if (!isA<processorFvPatch>(meshTarget.boundary()[patchi]))
|
||||||
|
{
|
||||||
|
patchMap.insert
|
||||||
|
(
|
||||||
|
meshTarget.boundary()[patchi].name(),
|
||||||
|
meshTarget.boundary()[patchi].name()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cuttingPatchTable.insert
|
||||||
|
(
|
||||||
|
meshTarget.boundaryMesh()[patchi].name(),
|
||||||
|
-1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MapSubMesh<CombineOp>
|
||||||
|
(
|
||||||
|
meshSource,
|
||||||
|
meshTarget,
|
||||||
|
patchMap,
|
||||||
|
cuttingPatchTable.toc(),
|
||||||
|
mapOrder
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -35,12 +35,13 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
void MapVolFields
|
void MapVolFields
|
||||||
(
|
(
|
||||||
const IOobjectList& objects,
|
const IOobjectList& objects,
|
||||||
const meshToMesh& meshToMeshInterp,
|
const meshToMesh& meshToMeshInterp,
|
||||||
const meshToMesh::order& mapOrder
|
const meshToMesh::order& mapOrder,
|
||||||
|
const CombineOp& cop
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const fvMesh& meshSource = meshToMeshInterp.fromMesh();
|
const fvMesh& meshSource = meshToMeshInterp.fromMesh();
|
||||||
@ -84,7 +85,13 @@ void MapVolFields
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Interpolate field
|
// Interpolate field
|
||||||
meshToMeshInterp.interpolate(fieldTarget, fieldSource, mapOrder);
|
meshToMeshInterp.interpolate//<Type, eqOp<Type> >
|
||||||
|
(
|
||||||
|
fieldTarget,
|
||||||
|
fieldSource,
|
||||||
|
mapOrder,
|
||||||
|
cop
|
||||||
|
);
|
||||||
|
|
||||||
// Write field
|
// Write field
|
||||||
fieldTarget.write();
|
fieldTarget.write();
|
||||||
|
|||||||
@ -34,11 +34,8 @@ Description
|
|||||||
|
|
||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
#include "meshToMesh.H"
|
#include "meshToMesh.H"
|
||||||
#include "MapVolFields.H"
|
|
||||||
#include "MapConsistentVolFields.H"
|
|
||||||
#include "UnMapped.H"
|
|
||||||
#include "processorFvPatch.H"
|
#include "processorFvPatch.H"
|
||||||
#include "mapLagrangian.H"
|
#include "MapMeshes.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -46,56 +43,28 @@ void mapConsistentMesh
|
|||||||
(
|
(
|
||||||
const fvMesh& meshSource,
|
const fvMesh& meshSource,
|
||||||
const fvMesh& meshTarget,
|
const fvMesh& meshTarget,
|
||||||
const meshToMesh::order& mapOrder
|
const meshToMesh::order& mapOrder,
|
||||||
|
const bool subtract
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Create the interpolation scheme
|
if (subtract)
|
||||||
meshToMesh meshToMeshInterp(meshSource, meshTarget);
|
|
||||||
|
|
||||||
Info<< nl
|
|
||||||
<< "Consistently creating and mapping fields for time "
|
|
||||||
<< meshSource.time().timeName() << nl << endl;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
// Search for list of objects for this time
|
MapConsistentMesh<minusEqOp>
|
||||||
IOobjectList objects(meshSource, meshSource.time().timeName());
|
|
||||||
|
|
||||||
// Map volFields
|
|
||||||
// ~~~~~~~~~~~~~
|
|
||||||
MapConsistentVolFields<scalar>(objects, meshToMeshInterp, mapOrder);
|
|
||||||
MapConsistentVolFields<vector>(objects, meshToMeshInterp, mapOrder);
|
|
||||||
MapConsistentVolFields<sphericalTensor>
|
|
||||||
(
|
(
|
||||||
objects,
|
meshSource,
|
||||||
meshToMeshInterp,
|
meshTarget,
|
||||||
mapOrder
|
mapOrder
|
||||||
);
|
);
|
||||||
MapConsistentVolFields<symmTensor>(objects, meshToMeshInterp, mapOrder);
|
|
||||||
MapConsistentVolFields<tensor>(objects, meshToMeshInterp, mapOrder);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// Search for list of target objects for this time
|
MapConsistentMesh<eqOp>
|
||||||
IOobjectList objects(meshTarget, meshTarget.time().timeName());
|
(
|
||||||
|
meshSource,
|
||||||
// Mark surfaceFields as unmapped
|
meshTarget,
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
mapOrder
|
||||||
UnMapped<surfaceScalarField>(objects);
|
);
|
||||||
UnMapped<surfaceVectorField>(objects);
|
|
||||||
UnMapped<surfaceSphericalTensorField>(objects);
|
|
||||||
UnMapped<surfaceSymmTensorField>(objects);
|
|
||||||
UnMapped<surfaceTensorField>(objects);
|
|
||||||
|
|
||||||
// Mark pointFields as unmapped
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
UnMapped<pointScalarField>(objects);
|
|
||||||
UnMapped<pointVectorField>(objects);
|
|
||||||
UnMapped<pointSphericalTensorField>(objects);
|
|
||||||
UnMapped<pointSymmTensorField>(objects);
|
|
||||||
UnMapped<pointTensorField>(objects);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mapLagrangian(meshToMeshInterp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -105,57 +74,32 @@ void mapSubMesh
|
|||||||
const fvMesh& meshTarget,
|
const fvMesh& meshTarget,
|
||||||
const HashTable<word>& patchMap,
|
const HashTable<word>& patchMap,
|
||||||
const wordList& cuttingPatches,
|
const wordList& cuttingPatches,
|
||||||
const meshToMesh::order& mapOrder
|
const meshToMesh::order& mapOrder,
|
||||||
|
const bool subtract
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Create the interpolation scheme
|
if (subtract)
|
||||||
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
|
MapSubMesh<minusEqOp>
|
||||||
IOobjectList objects(meshSource, meshSource.time().timeName());
|
(
|
||||||
|
meshSource,
|
||||||
// Map volFields
|
meshTarget,
|
||||||
// ~~~~~~~~~~~~~
|
patchMap,
|
||||||
MapVolFields<scalar>(objects, meshToMeshInterp, mapOrder);
|
cuttingPatches,
|
||||||
MapVolFields<vector>(objects, meshToMeshInterp, mapOrder);
|
mapOrder
|
||||||
MapVolFields<sphericalTensor>(objects, meshToMeshInterp, mapOrder);
|
);
|
||||||
MapVolFields<symmTensor>(objects, meshToMeshInterp, mapOrder);
|
|
||||||
MapVolFields<tensor>(objects, meshToMeshInterp, mapOrder);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// Search for list of target objects for this time
|
MapSubMesh<eqOp>
|
||||||
IOobjectList objects(meshTarget, meshTarget.time().timeName());
|
(
|
||||||
|
meshSource,
|
||||||
// Mark surfaceFields as unmapped
|
meshTarget,
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
patchMap,
|
||||||
UnMapped<surfaceScalarField>(objects);
|
cuttingPatches,
|
||||||
UnMapped<surfaceVectorField>(objects);
|
mapOrder
|
||||||
UnMapped<surfaceSphericalTensorField>(objects);
|
);
|
||||||
UnMapped<surfaceSymmTensorField>(objects);
|
|
||||||
UnMapped<surfaceTensorField>(objects);
|
|
||||||
|
|
||||||
// Mark pointFields as unmapped
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
UnMapped<pointScalarField>(objects);
|
|
||||||
UnMapped<pointVectorField>(objects);
|
|
||||||
UnMapped<pointSphericalTensorField>(objects);
|
|
||||||
UnMapped<pointSymmTensorField>(objects);
|
|
||||||
UnMapped<pointTensorField>(objects);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mapLagrangian(meshToMeshInterp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -163,40 +107,28 @@ void mapConsistentSubMesh
|
|||||||
(
|
(
|
||||||
const fvMesh& meshSource,
|
const fvMesh& meshSource,
|
||||||
const fvMesh& meshTarget,
|
const fvMesh& meshTarget,
|
||||||
const meshToMesh::order& mapOrder
|
const meshToMesh::order& mapOrder,
|
||||||
|
const bool subtract
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
HashTable<word> patchMap;
|
if (subtract)
|
||||||
HashTable<label> cuttingPatchTable;
|
|
||||||
|
|
||||||
forAll(meshTarget.boundary(), patchi)
|
|
||||||
{
|
{
|
||||||
if (!isA<processorFvPatch>(meshTarget.boundary()[patchi]))
|
MapConsistentSubMesh<minusEqOp>
|
||||||
{
|
(
|
||||||
patchMap.insert
|
meshSource,
|
||||||
(
|
meshTarget,
|
||||||
meshTarget.boundary()[patchi].name(),
|
mapOrder
|
||||||
meshTarget.boundary()[patchi].name()
|
);
|
||||||
);
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
MapConsistentSubMesh<eqOp>
|
||||||
cuttingPatchTable.insert
|
(
|
||||||
(
|
meshSource,
|
||||||
meshTarget.boundaryMesh()[patchi].name(),
|
meshTarget,
|
||||||
-1
|
mapOrder
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mapSubMesh
|
|
||||||
(
|
|
||||||
meshSource,
|
|
||||||
meshTarget,
|
|
||||||
patchMap,
|
|
||||||
cuttingPatchTable.toc(),
|
|
||||||
mapOrder
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -288,6 +220,11 @@ int main(int argc, char *argv[])
|
|||||||
"word",
|
"word",
|
||||||
"specify the mapping method"
|
"specify the mapping method"
|
||||||
);
|
);
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"subtract",
|
||||||
|
"subtract mapped source from target"
|
||||||
|
);
|
||||||
|
|
||||||
argList args(argc, argv);
|
argList args(argc, argv);
|
||||||
|
|
||||||
@ -350,6 +287,13 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "Mapping method: " << mapMethod << endl;
|
Info<< "Mapping method: " << mapMethod << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool subtract = args.optionFound("subtract");
|
||||||
|
if (subtract)
|
||||||
|
{
|
||||||
|
Info<< "Subtracting mapped source field from target" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "createTimes.H"
|
#include "createTimes.H"
|
||||||
|
|
||||||
HashTable<word> patchMap;
|
HashTable<word> patchMap;
|
||||||
@ -431,7 +375,13 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (consistent)
|
if (consistent)
|
||||||
{
|
{
|
||||||
mapConsistentSubMesh(meshSource, meshTarget, mapOrder);
|
mapConsistentSubMesh
|
||||||
|
(
|
||||||
|
meshSource,
|
||||||
|
meshTarget,
|
||||||
|
mapOrder,
|
||||||
|
subtract
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -441,7 +391,8 @@ int main(int argc, char *argv[])
|
|||||||
meshTarget,
|
meshTarget,
|
||||||
patchMap,
|
patchMap,
|
||||||
cuttingPatches,
|
cuttingPatches,
|
||||||
mapOrder
|
mapOrder,
|
||||||
|
subtract
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -503,7 +454,13 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (consistent)
|
if (consistent)
|
||||||
{
|
{
|
||||||
mapConsistentSubMesh(meshSource, meshTarget, mapOrder);
|
mapConsistentSubMesh
|
||||||
|
(
|
||||||
|
meshSource,
|
||||||
|
meshTarget,
|
||||||
|
mapOrder,
|
||||||
|
subtract
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -513,7 +470,8 @@ int main(int argc, char *argv[])
|
|||||||
meshTarget,
|
meshTarget,
|
||||||
patchMap,
|
patchMap,
|
||||||
addProcessorPatches(meshTarget, cuttingPatches),
|
addProcessorPatches(meshTarget, cuttingPatches),
|
||||||
mapOrder
|
mapOrder,
|
||||||
|
subtract
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -629,7 +587,8 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
meshSource,
|
meshSource,
|
||||||
meshTarget,
|
meshTarget,
|
||||||
mapOrder
|
mapOrder,
|
||||||
|
subtract
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -640,7 +599,8 @@ int main(int argc, char *argv[])
|
|||||||
meshTarget,
|
meshTarget,
|
||||||
patchMap,
|
patchMap,
|
||||||
addProcessorPatches(meshTarget, cuttingPatches),
|
addProcessorPatches(meshTarget, cuttingPatches),
|
||||||
mapOrder
|
mapOrder,
|
||||||
|
subtract
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -679,7 +639,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (consistent)
|
if (consistent)
|
||||||
{
|
{
|
||||||
mapConsistentMesh(meshSource, meshTarget, mapOrder);
|
mapConsistentMesh(meshSource, meshTarget, mapOrder, subtract);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -689,7 +649,8 @@ int main(int argc, char *argv[])
|
|||||||
meshTarget,
|
meshTarget,
|
||||||
patchMap,
|
patchMap,
|
||||||
cuttingPatches,
|
cuttingPatches,
|
||||||
mapOrder
|
mapOrder,
|
||||||
|
subtract
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -219,84 +219,93 @@ public:
|
|||||||
// Interpolation
|
// Interpolation
|
||||||
|
|
||||||
//- Map field
|
//- Map field
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
void mapField
|
void mapField
|
||||||
(
|
(
|
||||||
Field<Type>&,
|
Field<Type>&,
|
||||||
const Field<Type>&,
|
const Field<Type>&,
|
||||||
const labelList& adr
|
const labelList& adr,
|
||||||
|
const CombineOp& cop
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Interpolate field using inverse-distance weights
|
//- Interpolate field using inverse-distance weights
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
void interpolateField
|
void interpolateField
|
||||||
(
|
(
|
||||||
Field<Type>&,
|
Field<Type>&,
|
||||||
const GeometricField<Type, fvPatchField, volMesh>&,
|
const GeometricField<Type, fvPatchField, volMesh>&,
|
||||||
const labelList& adr,
|
const labelList& adr,
|
||||||
const scalarListList& weights
|
const scalarListList& weights,
|
||||||
|
const CombineOp& cop
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Interpolate field using cell-point interpolation
|
//- Interpolate field using cell-point interpolation
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
void interpolateField
|
void interpolateField
|
||||||
(
|
(
|
||||||
Field<Type>&,
|
Field<Type>&,
|
||||||
const GeometricField<Type, fvPatchField, volMesh>&,
|
const GeometricField<Type, fvPatchField, volMesh>&,
|
||||||
const labelList& adr,
|
const labelList& adr,
|
||||||
const vectorField& centres
|
const vectorField& centres,
|
||||||
|
const CombineOp& cop
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
//- Interpolate internal volume field
|
//- Interpolate internal volume field
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
void interpolateInternalField
|
void interpolateInternalField
|
||||||
(
|
(
|
||||||
Field<Type>&,
|
Field<Type>&,
|
||||||
const GeometricField<Type, fvPatchField, volMesh>&,
|
const GeometricField<Type, fvPatchField, volMesh>&,
|
||||||
order=INTERPOLATE
|
order=INTERPOLATE,
|
||||||
|
const CombineOp& cop = eqOp<Type>()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
void interpolateInternalField
|
void interpolateInternalField
|
||||||
(
|
(
|
||||||
Field<Type>&,
|
Field<Type>&,
|
||||||
const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
|
const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
|
||||||
order=INTERPOLATE
|
order=INTERPOLATE,
|
||||||
|
const CombineOp& cop = eqOp<Type>()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
//- Interpolate volume field
|
//- Interpolate volume field
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
void interpolate
|
void interpolate
|
||||||
(
|
(
|
||||||
GeometricField<Type, fvPatchField, volMesh>&,
|
GeometricField<Type, fvPatchField, volMesh>&,
|
||||||
const GeometricField<Type, fvPatchField, volMesh>&,
|
const GeometricField<Type, fvPatchField, volMesh>&,
|
||||||
order=INTERPOLATE
|
order=INTERPOLATE,
|
||||||
|
const CombineOp& cop = eqOp<Type>()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
void interpolate
|
void interpolate
|
||||||
(
|
(
|
||||||
GeometricField<Type, fvPatchField, volMesh>&,
|
GeometricField<Type, fvPatchField, volMesh>&,
|
||||||
const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
|
const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
|
||||||
order=INTERPOLATE
|
order=INTERPOLATE,
|
||||||
|
const CombineOp& cop = eqOp<Type>()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
//- Interpolate volume field
|
//- Interpolate volume field
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
tmp<GeometricField<Type, fvPatchField, volMesh> > interpolate
|
tmp<GeometricField<Type, fvPatchField, volMesh> > interpolate
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>&,
|
const GeometricField<Type, fvPatchField, volMesh>&,
|
||||||
order=INTERPOLATE
|
order=INTERPOLATE,
|
||||||
|
const CombineOp& cop = eqOp<Type>()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
tmp<GeometricField<Type, fvPatchField, volMesh> > interpolate
|
tmp<GeometricField<Type, fvPatchField, volMesh> > interpolate
|
||||||
(
|
(
|
||||||
const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
|
const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
|
||||||
order=INTERPOLATE
|
order=INTERPOLATE,
|
||||||
|
const CombineOp& cop = eqOp<Type>()
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -31,12 +31,13 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
void Foam::meshToMesh::mapField
|
void Foam::meshToMesh::mapField
|
||||||
(
|
(
|
||||||
Field<Type>& toF,
|
Field<Type>& toF,
|
||||||
const Field<Type>& fromVf,
|
const Field<Type>& fromVf,
|
||||||
const labelList& adr
|
const labelList& adr,
|
||||||
|
const CombineOp& cop
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Direct mapping of nearest-cell values
|
// Direct mapping of nearest-cell values
|
||||||
@ -45,7 +46,7 @@ void Foam::meshToMesh::mapField
|
|||||||
{
|
{
|
||||||
if (adr[celli] != -1)
|
if (adr[celli] != -1)
|
||||||
{
|
{
|
||||||
toF[celli] = fromVf[adr[celli]];
|
cop(toF[celli], fromVf[adr[celli]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,13 +54,14 @@ void Foam::meshToMesh::mapField
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
void Foam::meshToMesh::interpolateField
|
void Foam::meshToMesh::interpolateField
|
||||||
(
|
(
|
||||||
Field<Type>& toF,
|
Field<Type>& toF,
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
|
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
|
||||||
const labelList& adr,
|
const labelList& adr,
|
||||||
const scalarListList& weights
|
const scalarListList& weights,
|
||||||
|
const CombineOp& cop
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Inverse distance weighted interpolation
|
// Inverse distance weighted interpolation
|
||||||
@ -74,24 +76,27 @@ void Foam::meshToMesh::interpolateField
|
|||||||
const labelList& neighbours = cc[adr[celli]];
|
const labelList& neighbours = cc[adr[celli]];
|
||||||
const scalarList& w = weights[celli];
|
const scalarList& w = weights[celli];
|
||||||
|
|
||||||
toF[celli] = fromVf[adr[celli]]*w[0];
|
Type f = fromVf[adr[celli]]*w[0];
|
||||||
|
|
||||||
for (label ni = 1; ni < w.size(); ni++)
|
for (label ni = 1; ni < w.size(); ni++)
|
||||||
{
|
{
|
||||||
toF[celli] += fromVf[neighbours[ni - 1]]*w[ni];
|
f += fromVf[neighbours[ni - 1]]*w[ni];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cop(toF[celli], f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
void Foam::meshToMesh::interpolateField
|
void Foam::meshToMesh::interpolateField
|
||||||
(
|
(
|
||||||
Field<Type>& toF,
|
Field<Type>& toF,
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
|
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
|
||||||
const labelList& adr,
|
const labelList& adr,
|
||||||
const vectorField& centres
|
const vectorField& centres,
|
||||||
|
const CombineOp& cop
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Cell-Point interpolation
|
// Cell-Point interpolation
|
||||||
@ -101,31 +106,36 @@ void Foam::meshToMesh::interpolateField
|
|||||||
{
|
{
|
||||||
if (adr[celli] != -1)
|
if (adr[celli] != -1)
|
||||||
{
|
{
|
||||||
toF[celli] = interpolator.interpolate
|
cop
|
||||||
(
|
(
|
||||||
centres[celli],
|
toF[celli],
|
||||||
adr[celli]
|
interpolator.interpolate
|
||||||
|
(
|
||||||
|
centres[celli],
|
||||||
|
adr[celli]
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
void Foam::meshToMesh::interpolateInternalField
|
void Foam::meshToMesh::interpolateInternalField
|
||||||
(
|
(
|
||||||
Field<Type>& toF,
|
Field<Type>& toF,
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
|
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
|
||||||
meshToMesh::order ord
|
meshToMesh::order ord,
|
||||||
|
const CombineOp& cop
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (fromVf.mesh() != fromMesh_)
|
if (fromVf.mesh() != fromMesh_)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"meshToMesh::interpolateInternalField(Field<Type>& toF, "
|
"meshToMesh::interpolateInternalField(Field<Type>&, "
|
||||||
"const GeometricField<Type, fvPatchField, volMesh>& fromVf, "
|
"const GeometricField<Type, fvPatchField, volMesh>&, "
|
||||||
"meshToMesh::order ord) const"
|
"meshToMesh::order, const CombineOp&) const"
|
||||||
) << "the argument field does not correspond to the right mesh. "
|
) << "the argument field does not correspond to the right mesh. "
|
||||||
<< "Field size: " << fromVf.size()
|
<< "Field size: " << fromVf.size()
|
||||||
<< " mesh size: " << fromMesh_.nCells()
|
<< " mesh size: " << fromMesh_.nCells()
|
||||||
@ -136,9 +146,9 @@ void Foam::meshToMesh::interpolateInternalField
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"meshToMesh::interpolateInternalField(Field<Type>& toF, "
|
"meshToMesh::interpolateInternalField(Field<Type>&, "
|
||||||
"const GeometricField<Type, fvPatchField, volMesh>& fromVf, "
|
"const GeometricField<Type, fvPatchField, volMesh>&, "
|
||||||
"meshToMesh::order ord) const"
|
"meshToMesh::order, const CombineOp&) const"
|
||||||
) << "the argument field does not correspond to the right mesh. "
|
) << "the argument field does not correspond to the right mesh. "
|
||||||
<< "Field size: " << toF.size()
|
<< "Field size: " << toF.size()
|
||||||
<< " mesh size: " << toMesh_.nCells()
|
<< " mesh size: " << toMesh_.nCells()
|
||||||
@ -148,7 +158,7 @@ void Foam::meshToMesh::interpolateInternalField
|
|||||||
switch(ord)
|
switch(ord)
|
||||||
{
|
{
|
||||||
case MAP:
|
case MAP:
|
||||||
mapField(toF, fromVf, cellAddressing_);
|
mapField(toF, fromVf, cellAddressing_, cop);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INTERPOLATE:
|
case INTERPOLATE:
|
||||||
@ -157,7 +167,8 @@ void Foam::meshToMesh::interpolateInternalField
|
|||||||
toF,
|
toF,
|
||||||
fromVf,
|
fromVf,
|
||||||
cellAddressing_,
|
cellAddressing_,
|
||||||
inverseDistanceWeights()
|
inverseDistanceWeights(),
|
||||||
|
cop
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -167,44 +178,47 @@ void Foam::meshToMesh::interpolateInternalField
|
|||||||
toF,
|
toF,
|
||||||
fromVf,
|
fromVf,
|
||||||
cellAddressing_,
|
cellAddressing_,
|
||||||
toMesh_.cellCentres()
|
toMesh_.cellCentres(),
|
||||||
|
cop
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"meshToMesh::interpolateInternalField(Field<Type>& toF, "
|
"meshToMesh::interpolateInternalField(Field<Type>&, "
|
||||||
"const GeometricField<Type, fvPatchField, volMesh>& fromVf, "
|
"const GeometricField<Type, fvPatchField, volMesh>&, "
|
||||||
"meshToMesh::order ord) const"
|
"meshToMesh::order, const CombineOp&) const"
|
||||||
) << "unknown interpolation scheme " << ord
|
) << "unknown interpolation scheme " << ord
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
void Foam::meshToMesh::interpolateInternalField
|
void Foam::meshToMesh::interpolateInternalField
|
||||||
(
|
(
|
||||||
Field<Type>& toF,
|
Field<Type>& toF,
|
||||||
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tfromVf,
|
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tfromVf,
|
||||||
meshToMesh::order ord
|
meshToMesh::order ord,
|
||||||
|
const CombineOp& cop
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
interpolateInternalField(toF, tfromVf(), ord);
|
interpolateInternalField(toF, tfromVf(), ord, cop);
|
||||||
tfromVf.clear();
|
tfromVf.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
void Foam::meshToMesh::interpolate
|
void Foam::meshToMesh::interpolate
|
||||||
(
|
(
|
||||||
GeometricField<Type, fvPatchField, volMesh>& toVf,
|
GeometricField<Type, fvPatchField, volMesh>& toVf,
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
|
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
|
||||||
meshToMesh::order ord
|
meshToMesh::order ord,
|
||||||
|
const CombineOp& cop
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
interpolateInternalField(toVf, fromVf, ord);
|
interpolateInternalField(toVf, fromVf, ord, cop);
|
||||||
|
|
||||||
forAll(toMesh_.boundaryMesh(), patchi)
|
forAll(toMesh_.boundaryMesh(), patchi)
|
||||||
{
|
{
|
||||||
@ -219,7 +233,8 @@ void Foam::meshToMesh::interpolate
|
|||||||
(
|
(
|
||||||
toVf.boundaryField()[patchi],
|
toVf.boundaryField()[patchi],
|
||||||
fromVf,
|
fromVf,
|
||||||
boundaryAddressing_[patchi]
|
boundaryAddressing_[patchi],
|
||||||
|
cop
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -229,7 +244,8 @@ void Foam::meshToMesh::interpolate
|
|||||||
toVf.boundaryField()[patchi],
|
toVf.boundaryField()[patchi],
|
||||||
fromVf,
|
fromVf,
|
||||||
boundaryAddressing_[patchi],
|
boundaryAddressing_[patchi],
|
||||||
toPatch.Cf()
|
toPatch.Cf(),
|
||||||
|
cop
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -239,7 +255,8 @@ void Foam::meshToMesh::interpolate
|
|||||||
toVf.boundaryField()[patchi],
|
toVf.boundaryField()[patchi],
|
||||||
fromVf,
|
fromVf,
|
||||||
boundaryAddressing_[patchi],
|
boundaryAddressing_[patchi],
|
||||||
toPatch.Cf()
|
toPatch.Cf(),
|
||||||
|
cop
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -247,9 +264,9 @@ void Foam::meshToMesh::interpolate
|
|||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"meshToMesh::interpolate("
|
"meshToMesh::interpolate("
|
||||||
"GeometricField<Type, fvPatchField, volMesh>& toVf, "
|
"GeometricField<Type, fvPatchField, volMesh>&, "
|
||||||
"const GeometricField<Type, fvPatchField, volMesh>& "
|
"const GeometricField<Type, fvPatchField, volMesh>&, "
|
||||||
"fromVf, meshToMesh::order ord) const"
|
"meshToMesh::order, const CombineOp&) const"
|
||||||
) << "unknown interpolation scheme " << ord
|
) << "unknown interpolation scheme " << ord
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
@ -286,37 +303,40 @@ void Foam::meshToMesh::interpolate
|
|||||||
[
|
[
|
||||||
fromMeshPatches_.find(patchMap_.find(toPatch.name())())()
|
fromMeshPatches_.find(patchMap_.find(toPatch.name())())()
|
||||||
],
|
],
|
||||||
boundaryAddressing_[patchi]
|
boundaryAddressing_[patchi],
|
||||||
|
cop
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
void Foam::meshToMesh::interpolate
|
void Foam::meshToMesh::interpolate
|
||||||
(
|
(
|
||||||
GeometricField<Type, fvPatchField, volMesh>& toVf,
|
GeometricField<Type, fvPatchField, volMesh>& toVf,
|
||||||
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tfromVf,
|
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tfromVf,
|
||||||
meshToMesh::order ord
|
meshToMesh::order ord,
|
||||||
|
const CombineOp& cop
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
interpolate(toVf, tfromVf(), ord);
|
interpolate(toVf, tfromVf(), ord, cop);
|
||||||
tfromVf.clear();
|
tfromVf.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
Foam::tmp< Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
|
Foam::tmp< Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
|
||||||
Foam::meshToMesh::interpolate
|
Foam::meshToMesh::interpolate
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
|
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
|
||||||
meshToMesh::order ord
|
meshToMesh::order ord,
|
||||||
|
const CombineOp& cop
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Create and map the internal-field values
|
// Create and map the internal-field values
|
||||||
Field<Type> internalField(toMesh_.nCells());
|
Field<Type> internalField(toMesh_.nCells());
|
||||||
interpolateInternalField(internalField, fromVf, ord);
|
interpolateInternalField(internalField, fromVf, ord, cop);
|
||||||
|
|
||||||
// check whether both meshes have got the same number
|
// check whether both meshes have got the same number
|
||||||
// of boundary patches
|
// of boundary patches
|
||||||
@ -325,8 +345,8 @@ Foam::meshToMesh::interpolate
|
|||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"meshToMesh::interpolate"
|
"meshToMesh::interpolate"
|
||||||
"(const GeometricField<Type, fvPatchField, volMesh>& fromVf,"
|
"(const GeometricField<Type, fvPatchField, volMesh>&,"
|
||||||
"meshToMesh::order ord) const"
|
"meshToMesh::order, const CombineOp&) const"
|
||||||
) << "Incompatible meshes: different number of boundaries, "
|
) << "Incompatible meshes: different number of boundaries, "
|
||||||
"only internal field may be interpolated"
|
"only internal field may be interpolated"
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
@ -381,16 +401,17 @@ Foam::meshToMesh::interpolate
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type, class CombineOp>
|
||||||
Foam::tmp< Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
|
Foam::tmp< Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
|
||||||
Foam::meshToMesh::interpolate
|
Foam::meshToMesh::interpolate
|
||||||
(
|
(
|
||||||
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tfromVf,
|
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tfromVf,
|
||||||
meshToMesh::order ord
|
meshToMesh::order ord,
|
||||||
|
const CombineOp& cop
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
tmp<GeometricField<Type, fvPatchField, volMesh> > tint =
|
tmp<GeometricField<Type, fvPatchField, volMesh> > tint =
|
||||||
interpolate(tfromVf(), ord);
|
interpolate(tfromVf(), ord, cop);
|
||||||
tfromVf.clear();
|
tfromVf.clear();
|
||||||
|
|
||||||
return tint;
|
return tint;
|
||||||
|
|||||||
Reference in New Issue
Block a user