Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
commit
0efe54b50b
@ -1,22 +1,23 @@
|
|||||||
{
|
{
|
||||||
if (mesh.changing())
|
if (mesh.changing())
|
||||||
{
|
{
|
||||||
forAll(U.boundaryField(), patchi)
|
forAll(U.boundaryField(), patchI)
|
||||||
{
|
{
|
||||||
if (U.boundaryField()[patchi].fixesValue())
|
if (U.boundaryField()[patchI].fixesValue())
|
||||||
{
|
{
|
||||||
U.boundaryField()[patchi].initEvaluate();
|
U.boundaryField()[patchI].initEvaluate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(U.boundaryField(), patchi)
|
forAll(U.boundaryField(), patchI)
|
||||||
{
|
{
|
||||||
if (U.boundaryField()[patchi].fixesValue())
|
if (U.boundaryField()[patchI].fixesValue())
|
||||||
{
|
{
|
||||||
U.boundaryField()[patchi].evaluate();
|
U.boundaryField()[patchI].evaluate();
|
||||||
|
|
||||||
phi.boundaryField()[patchi] =
|
phi.boundaryField()[patchI] =
|
||||||
U.boundaryField()[patchi] & mesh.Sf().boundaryField()[patchi];
|
U.boundaryField()[patchI]
|
||||||
|
& mesh.Sf().boundaryField()[patchI];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -27,11 +28,11 @@
|
|||||||
zeroGradientFvPatchScalarField::typeName
|
zeroGradientFvPatchScalarField::typeName
|
||||||
);
|
);
|
||||||
|
|
||||||
forAll(p.boundaryField(), i)
|
forAll(p.boundaryField(), patchI)
|
||||||
{
|
{
|
||||||
if (p.boundaryField()[i].fixesValue())
|
if (p.boundaryField()[patchI].fixesValue())
|
||||||
{
|
{
|
||||||
pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
|
pcorrTypes[patchI] = fixedValueFvPatchScalarField::typeName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ void Foam::ParticleErosion<CloudType>::preEvolve()
|
|||||||
this->owner().name() + "Q",
|
this->owner().name() + "Q",
|
||||||
mesh.time().timeName(),
|
mesh.time().timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::READ_IF_PRESENT,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
mesh,
|
mesh,
|
||||||
|
@ -290,184 +290,71 @@ public:
|
|||||||
|
|
||||||
void clearOut();
|
void clearOut();
|
||||||
|
|
||||||
//- What to sample
|
// Access
|
||||||
const sampleMode& mode() const
|
|
||||||
{
|
|
||||||
return mode_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Region to sample
|
//- What to sample
|
||||||
const word& sampleRegion() const
|
inline const sampleMode& mode() const;
|
||||||
{
|
|
||||||
return sampleRegion_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Patch (only if NEARESTPATCHFACE)
|
//- Region to sample
|
||||||
const word& samplePatch() const
|
inline const word& sampleRegion() const;
|
||||||
{
|
|
||||||
return samplePatch_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Offset vector (from patch faces to destination mesh objects)
|
//- Patch (only if NEARESTPATCHFACE)
|
||||||
const vector& offset() const
|
inline const word& samplePatch() const;
|
||||||
{
|
|
||||||
return offset_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Offset vector (from patch faces to destination mesh objects)
|
//- Offset vector (from patch faces to destination mesh objects)
|
||||||
const vectorField& offsets() const
|
inline const vector& offset() const;
|
||||||
{
|
|
||||||
return offsets_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Wrapper around map/interpolate data distribution
|
//- Offset vector (from patch faces to destination mesh objects)
|
||||||
template<class Type>
|
inline const vectorField& offsets() const;
|
||||||
void distribute(List<Type>& lst) const
|
|
||||||
{
|
//- Cached sampleRegion != mesh.name()
|
||||||
switch (mode_)
|
inline bool sameRegion() const;
|
||||||
{
|
|
||||||
case NEARESTPATCHFACEAMI:
|
//- Return reference to the parallel distribution map
|
||||||
{
|
inline const mapDistribute& map() const;
|
||||||
lst = AMI().interpolateToSource(Field<Type>(lst.xfer()));
|
|
||||||
break;
|
//- Return reference to the AMI interpolator
|
||||||
}
|
inline const AMIPatchToPatchInterpolation& AMI
|
||||||
default:
|
(
|
||||||
{
|
const bool forceUpdate = false
|
||||||
map().distribute(lst);
|
) const;
|
||||||
}
|
|
||||||
}
|
//- Return a pointer to the AMI projection surface
|
||||||
}
|
const autoPtr<Foam::searchableSurface>& surfPtr() const;
|
||||||
|
|
||||||
|
//- Get the region mesh
|
||||||
|
const polyMesh& sampleMesh() const;
|
||||||
|
|
||||||
|
//- Get the patch on the region
|
||||||
|
const polyPatch& samplePolyPatch() const;
|
||||||
|
|
||||||
|
//- Get the sample points
|
||||||
|
tmp<pointField> samplePoints() const;
|
||||||
|
|
||||||
|
|
||||||
//- Wrapper around map/interpolate data distribution with supplied op
|
// Distribute
|
||||||
template<class Type, class BinaryOp>
|
|
||||||
void distribute(List<Type>& lst, const BinaryOp& bop) const
|
//- Wrapper around map/interpolate data distribution
|
||||||
{
|
template<class Type>
|
||||||
switch (mode_)
|
void distribute(List<Type>& lst) const;
|
||||||
{
|
|
||||||
case NEARESTPATCHFACEAMI:
|
//- Wrapper around map/interpolate data distribution with operation
|
||||||
{
|
template<class Type, class BinaryOp>
|
||||||
lst = AMI().interpolateToSource
|
void distribute(List<Type>& lst, const BinaryOp& bop) const;
|
||||||
(
|
|
||||||
Field<Type>(lst.xfer()),
|
//- Wrapper around map/interpolate data distribution
|
||||||
bop
|
template<class Type>
|
||||||
);
|
void reverseDistribute(List<Type>& lst) const;
|
||||||
break;
|
|
||||||
}
|
//- Wrapper around map/interpolate data distribution with operation
|
||||||
default:
|
template<class Type, class BinaryOp>
|
||||||
{
|
void reverseDistribute(List<Type>& lst, const BinaryOp& bop) const;
|
||||||
map().distribute
|
|
||||||
(
|
|
||||||
Pstream::defaultCommsType,
|
|
||||||
map().schedule(),
|
|
||||||
map().constructSize(),
|
|
||||||
map().subMap(),
|
|
||||||
map().constructMap(),
|
|
||||||
lst,
|
|
||||||
bop,
|
|
||||||
pTraits<Type>::zero
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//- Wrapper around map/interpolate data distribution
|
// I/O
|
||||||
template<class Type>
|
|
||||||
void reverseDistribute(List<Type>& lst) const
|
|
||||||
{
|
|
||||||
switch (mode_)
|
|
||||||
{
|
|
||||||
case NEARESTPATCHFACEAMI:
|
|
||||||
{
|
|
||||||
lst = AMI().interpolateToTarget(Field<Type>(lst.xfer()));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
label cSize = patch_.size();
|
|
||||||
map().reverseDistribute(cSize, lst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//- Write as a dictionary
|
||||||
//- Wrapper around map/interpolate data distribution with supplied op
|
virtual void write(Ostream&) const;
|
||||||
template<class Type, class BinaryOp>
|
|
||||||
void reverseDistribute(List<Type>& lst, const BinaryOp& bop) const
|
|
||||||
{
|
|
||||||
switch (mode_)
|
|
||||||
{
|
|
||||||
case NEARESTPATCHFACEAMI:
|
|
||||||
{
|
|
||||||
lst = AMI().interpolateToTarget
|
|
||||||
(
|
|
||||||
Field<Type>(lst.xfer()),
|
|
||||||
bop
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
label cSize = patch_.size();
|
|
||||||
map().distribute
|
|
||||||
(
|
|
||||||
Pstream::defaultCommsType,
|
|
||||||
map().schedule(),
|
|
||||||
cSize,
|
|
||||||
map().constructMap(),
|
|
||||||
map().subMap(),
|
|
||||||
lst,
|
|
||||||
bop,
|
|
||||||
pTraits<Type>::zero
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//- Return reference to the parallel distribution map
|
|
||||||
const mapDistribute& map() const
|
|
||||||
{
|
|
||||||
if (mapPtr_.empty())
|
|
||||||
{
|
|
||||||
calcMapping();
|
|
||||||
}
|
|
||||||
|
|
||||||
return mapPtr_();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return reference to the AMI interpolator
|
|
||||||
const AMIPatchToPatchInterpolation& AMI(bool forceUpdate = false) const
|
|
||||||
{
|
|
||||||
if (forceUpdate || AMIPtr_.empty())
|
|
||||||
{
|
|
||||||
calcAMI();
|
|
||||||
}
|
|
||||||
|
|
||||||
return AMIPtr_();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return a pointer to the AMI projection surface
|
|
||||||
const autoPtr<Foam::searchableSurface>& surfPtr() const;
|
|
||||||
|
|
||||||
//- Cached sampleRegion != mesh.name()
|
|
||||||
bool sameRegion() const
|
|
||||||
{
|
|
||||||
return sameRegion_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Get the region mesh
|
|
||||||
const polyMesh& sampleMesh() const;
|
|
||||||
|
|
||||||
//- Get the patch on the region
|
|
||||||
const polyPatch& samplePolyPatch() const;
|
|
||||||
|
|
||||||
//- Get the sample points
|
|
||||||
tmp<pointField> samplePoints() const;
|
|
||||||
|
|
||||||
//- Write as a dictionary
|
|
||||||
virtual void write(Ostream&) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -477,6 +364,16 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "mappedPatchBaseI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
#include "mappedPatchBaseTemplates.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
@ -0,0 +1,88 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
inline const Foam::mappedPatchBase::sampleMode&
|
||||||
|
Foam::mappedPatchBase::mode() const
|
||||||
|
{
|
||||||
|
return mode_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::word& Foam::mappedPatchBase::sampleRegion() const
|
||||||
|
{
|
||||||
|
return sampleRegion_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::word& Foam::mappedPatchBase::samplePatch() const
|
||||||
|
{
|
||||||
|
return samplePatch_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::vector& Foam::mappedPatchBase::offset() const
|
||||||
|
{
|
||||||
|
return offset_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::vectorField& Foam::mappedPatchBase::offsets() const
|
||||||
|
{
|
||||||
|
return offsets_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool Foam::mappedPatchBase::sameRegion() const
|
||||||
|
{
|
||||||
|
return sameRegion_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::mapDistribute& Foam::mappedPatchBase::map() const
|
||||||
|
{
|
||||||
|
if (mapPtr_.empty())
|
||||||
|
{
|
||||||
|
calcMapping();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mapPtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::AMIPatchToPatchInterpolation& Foam::mappedPatchBase::AMI
|
||||||
|
(
|
||||||
|
bool forceUpdate
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (forceUpdate || AMIPtr_.empty())
|
||||||
|
{
|
||||||
|
calcAMI();
|
||||||
|
}
|
||||||
|
|
||||||
|
return AMIPtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,136 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::mappedPatchBase::distribute(List<Type>& lst) const
|
||||||
|
{
|
||||||
|
switch (mode_)
|
||||||
|
{
|
||||||
|
case NEARESTPATCHFACEAMI:
|
||||||
|
{
|
||||||
|
lst = AMI().interpolateToSource(Field<Type>(lst.xfer()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
map().distribute(lst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type, class BinaryOp>
|
||||||
|
void Foam::mappedPatchBase::distribute
|
||||||
|
(
|
||||||
|
List<Type>& lst,
|
||||||
|
const BinaryOp& bop
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
switch (mode_)
|
||||||
|
{
|
||||||
|
case NEARESTPATCHFACEAMI:
|
||||||
|
{
|
||||||
|
lst = AMI().interpolateToSource
|
||||||
|
(
|
||||||
|
Field<Type>(lst.xfer()),
|
||||||
|
bop
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
map().distribute
|
||||||
|
(
|
||||||
|
Pstream::defaultCommsType,
|
||||||
|
map().schedule(),
|
||||||
|
map().constructSize(),
|
||||||
|
map().subMap(),
|
||||||
|
map().constructMap(),
|
||||||
|
lst,
|
||||||
|
bop,
|
||||||
|
pTraits<Type>::zero
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::mappedPatchBase::reverseDistribute(List<Type>& lst) const
|
||||||
|
{
|
||||||
|
switch (mode_)
|
||||||
|
{
|
||||||
|
case NEARESTPATCHFACEAMI:
|
||||||
|
{
|
||||||
|
lst = AMI().interpolateToTarget(Field<Type>(lst.xfer()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
label cSize = patch_.size();
|
||||||
|
map().reverseDistribute(cSize, lst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type, class BinaryOp>
|
||||||
|
void Foam::mappedPatchBase::reverseDistribute
|
||||||
|
(
|
||||||
|
List<Type>& lst,
|
||||||
|
const BinaryOp& bop
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
switch (mode_)
|
||||||
|
{
|
||||||
|
case NEARESTPATCHFACEAMI:
|
||||||
|
{
|
||||||
|
lst = AMI().interpolateToTarget
|
||||||
|
(
|
||||||
|
Field<Type>(lst.xfer()),
|
||||||
|
bop
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
label cSize = patch_.size();
|
||||||
|
map().distribute
|
||||||
|
(
|
||||||
|
Pstream::defaultCommsType,
|
||||||
|
map().schedule(),
|
||||||
|
cSize,
|
||||||
|
map().constructMap(),
|
||||||
|
map().subMap(),
|
||||||
|
lst,
|
||||||
|
bop,
|
||||||
|
pTraits<Type>::zero
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
Loading…
Reference in New Issue
Block a user