ENH: Progagted oriented() flag through field mapping

This commit is contained in:
Andrew Heather
2017-04-24 13:05:19 +01:00
parent f71e4ff5cb
commit 8886e90870
5 changed files with 21 additions and 28 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -269,7 +269,7 @@ Foam::parFvFieldReconstructor::reconstructFvSurfaceField
} }
// Map all faces // Map all faces
Field<Type> internalField(flatFld, mapper); Field<Type> internalField(flatFld, mapper, fld.oriented()());
// Trim to internal faces (note: could also have special mapper) // Trim to internal faces (note: could also have special mapper)
internalField.setSize internalField.setSize

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -205,6 +205,8 @@ void Foam::fvMeshDistribute::mapExposedFaces
forAllIter(typename HashTable<fldType*>, flds, iter) forAllIter(typename HashTable<fldType*>, flds, iter)
{ {
fldType& fld = *iter(); fldType& fld = *iter();
const bool oriented = fld.oriented()();
typename fldType::Boundary& bfld = fld.boundaryFieldRef(); typename fldType::Boundary& bfld = fld.boundaryFieldRef();
const Field<T>& oldInternal = oldFlds[fieldI++]; const Field<T>& oldInternal = oldFlds[fieldI++];
@ -225,7 +227,7 @@ void Foam::fvMeshDistribute::mapExposedFaces
{ {
patchFld[i] = oldInternal[oldFaceI]; patchFld[i] = oldInternal[oldFaceI];
if (map.flipFaceFlux().found(faceI)) if (oriented && map.flipFaceFlux().found(faceI))
{ {
patchFld[i] = flipOp()(patchFld[i]); patchFld[i] = flipOp()(patchFld[i]);
} }

View File

@ -275,16 +275,14 @@ public:
const fvMesh& sMesh, const fvMesh& sMesh,
const labelList& patchMap, const labelList& patchMap,
const labelList& cellMap, const labelList& cellMap,
const labelList& faceMap, const labelList& faceMap
const bool negateIfFlipped = true
); );
template<class Type> template<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
interpolate interpolate
( (
const GeometricField<Type, fvsPatchField, surfaceMesh>&, const GeometricField<Type, fvsPatchField, surfaceMesh>&
const bool negateIfFlipped = true
) const; ) const;
//- Map point field //- Map point field

View File

@ -180,10 +180,11 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fvMeshSubset::interpolate
const fvMesh& sMesh, const fvMesh& sMesh,
const labelList& patchMap, const labelList& patchMap,
const labelList& cellMap, const labelList& cellMap,
const labelList& faceMap, const labelList& faceMap
const bool negateIfFlipped
) )
{ {
const bool negateIfFlipped = vf.oriented()();
// 1. Create the complete field with dummy patch fields // 1. Create the complete field with dummy patch fields
PtrList<fvsPatchField<Type>> patchFields(patchMap.size()); PtrList<fvsPatchField<Type>> patchFields(patchMap.size());
@ -342,8 +343,7 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fvMeshSubset::interpolate
template<class Type> template<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fvMeshSubset::interpolate tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fvMeshSubset::interpolate
( (
const GeometricField<Type, fvsPatchField, surfaceMesh>& sf, const GeometricField<Type, fvsPatchField, surfaceMesh>& sf
const bool negateIfFlipped
) const ) const
{ {
return interpolate return interpolate
@ -352,8 +352,7 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fvMeshSubset::interpolate
subMesh(), subMesh(),
patchMap(), patchMap(),
cellMap(), cellMap(),
faceMap(), faceMap()
negateIfFlipped
); );
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -26,6 +26,7 @@ License
#include "IOobject.H" #include "IOobject.H"
#include "dictionary.H" #include "dictionary.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "surfaceMesh.H"
#include "fvPatchFieldMapper.H" #include "fvPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -93,20 +94,15 @@ Foam::fvsPatchField<Type>::fvsPatchField
} }
else else
{ {
FatalIOErrorInFunction FatalIOErrorInFunction(dict)
( << "essential 'value' entry not provided"
dict
) << "essential value entry not provided"
<< exit(FatalIOError); << exit(FatalIOError);
} }
} }
template<class Type> template<class Type>
Foam::fvsPatchField<Type>::fvsPatchField Foam::fvsPatchField<Type>::fvsPatchField(const fvsPatchField<Type>& ptf)
(
const fvsPatchField<Type>& ptf
)
: :
Field<Type>(ptf), Field<Type>(ptf),
patch_(ptf.patch_), patch_(ptf.patch_),
@ -149,12 +145,10 @@ void Foam::fvsPatchField<Type>::check(const fvsPatchField<Type>& ptf) const
template<class Type> template<class Type>
void Foam::fvsPatchField<Type>::autoMap void Foam::fvsPatchField<Type>::autoMap(const fvPatchFieldMapper& m)
(
const fvPatchFieldMapper& m
)
{ {
Field<Type>::autoMap(m); const bool oriented = internalField_.oriented()();
Field<Type>::autoMap(m, oriented);
} }