Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs 2011-11-14 15:16:31 +00:00
commit 0efe54b50b
5 changed files with 302 additions and 180 deletions

View File

@ -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;
} }
} }

View File

@ -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,

View File

@ -290,173 +290,38 @@ public:
void clearOut(); void clearOut();
// Access
//- What to sample //- What to sample
const sampleMode& mode() const inline const sampleMode& mode() const;
{
return mode_;
}
//- Region to sample //- Region to sample
const word& sampleRegion() const inline const word& sampleRegion() const;
{
return sampleRegion_;
}
//- Patch (only if NEARESTPATCHFACE) //- Patch (only if NEARESTPATCHFACE)
const word& samplePatch() const inline const word& samplePatch() const;
{
return samplePatch_;
}
//- Offset vector (from patch faces to destination mesh objects) //- Offset vector (from patch faces to destination mesh objects)
const vector& offset() const inline const vector& offset() 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 vectorField& offsets() const;
{
return offsets_;
}
//- Wrapper around map/interpolate data distribution
template<class Type>
void distribute(List<Type>& lst) const
{
switch (mode_)
{
case NEARESTPATCHFACEAMI:
{
lst = AMI().interpolateToSource(Field<Type>(lst.xfer()));
break;
}
default:
{
map().distribute(lst);
}
}
}
//- Wrapper around map/interpolate data distribution with supplied op
template<class Type, class BinaryOp>
void 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
);
}
}
}
//- Wrapper around map/interpolate data distribution
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);
}
}
}
//- Wrapper around map/interpolate data distribution with supplied op
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
);
}
}
}
//- Cached sampleRegion != mesh.name()
inline bool sameRegion() const;
//- Return reference to the parallel distribution map //- Return reference to the parallel distribution map
const mapDistribute& map() const inline const mapDistribute& map() const;
{
if (mapPtr_.empty())
{
calcMapping();
}
return mapPtr_();
}
//- Return reference to the AMI interpolator //- Return reference to the AMI interpolator
const AMIPatchToPatchInterpolation& AMI(bool forceUpdate = false) const inline const AMIPatchToPatchInterpolation& AMI
{ (
if (forceUpdate || AMIPtr_.empty()) const bool forceUpdate = false
{ ) const;
calcAMI();
}
return AMIPtr_();
}
//- Return a pointer to the AMI projection surface //- Return a pointer to the AMI projection surface
const autoPtr<Foam::searchableSurface>& surfPtr() const; const autoPtr<Foam::searchableSurface>& surfPtr() const;
//- Cached sampleRegion != mesh.name()
bool sameRegion() const
{
return sameRegion_;
}
//- Get the region mesh //- Get the region mesh
const polyMesh& sampleMesh() const; const polyMesh& sampleMesh() const;
@ -466,6 +331,28 @@ public:
//- Get the sample points //- Get the sample points
tmp<pointField> samplePoints() const; tmp<pointField> samplePoints() const;
// Distribute
//- Wrapper around map/interpolate data distribution
template<class Type>
void distribute(List<Type>& lst) const;
//- Wrapper around map/interpolate data distribution with operation
template<class Type, class BinaryOp>
void distribute(List<Type>& lst, const BinaryOp& bop) const;
//- Wrapper around map/interpolate data distribution
template<class Type>
void reverseDistribute(List<Type>& lst) const;
//- Wrapper around map/interpolate data distribution with operation
template<class Type, class BinaryOp>
void reverseDistribute(List<Type>& lst, const BinaryOp& bop) const;
// I/O
//- Write as a dictionary //- Write as a dictionary
virtual void write(Ostream&) const; virtual void write(Ostream&) const;
}; };
@ -477,6 +364,16 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "mappedPatchBaseI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "mappedPatchBaseTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -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_();
}
// ************************************************************************* //

View File

@ -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
);
}
}
}
// ************************************************************************* //