mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
builds again
This commit is contained in:
@ -335,6 +335,7 @@ $(constraintPolyPatches)/empty/emptyPolyPatch.C
|
||||
$(constraintPolyPatches)/symmetry/symmetryPolyPatch.C
|
||||
$(constraintPolyPatches)/wedge/wedgePolyPatch.C
|
||||
$(constraintPolyPatches)/cyclic/cyclicPolyPatch.C
|
||||
$(constraintPolyPatches)/processorCyclic/processorCyclicPolyPatch.C
|
||||
$(constraintPolyPatches)/processor/processorPolyPatch.C
|
||||
|
||||
derivedPolyPatches = $(polyPatches)/derived
|
||||
@ -446,6 +447,7 @@ $(constraintPointPatches)/symmetry/symmetryPointPatch.C
|
||||
$(constraintPointPatches)/wedge/wedgePointPatch.C
|
||||
$(constraintPointPatches)/cyclic/cyclicPointPatch.C
|
||||
$(constraintPointPatches)/processor/processorPointPatch.C
|
||||
$(constraintPointPatches)/processorCyclic/processorCyclicPointPatch.C
|
||||
|
||||
derivedPointPatches = $(pointPatches)/derived
|
||||
$(derivedPointPatches)/coupled/coupledFacePointPatch.C
|
||||
@ -501,6 +503,7 @@ $(constraintPointPatchFields)/symmetry/symmetryPointPatchFields.C
|
||||
$(constraintPointPatchFields)/wedge/wedgePointPatchFields.C
|
||||
$(constraintPointPatchFields)/cyclic/cyclicPointPatchFields.C
|
||||
$(constraintPointPatchFields)/processor/processorPointPatchFields.C
|
||||
$(constraintPointPatchFields)/processorCyclic/processorCyclicPointPatchFields.C
|
||||
|
||||
derivedPointPatchFields = $(pointPatchFields)/derived
|
||||
$(derivedPointPatchFields)/slip/slipPointPatchFields.C
|
||||
|
||||
@ -132,7 +132,7 @@ public:
|
||||
inline label fcIndex(const label i) const;
|
||||
|
||||
//- Return the reverse circular index, i.e. the previous index
|
||||
// which returns to the last at the begining of the list
|
||||
// which returns to the last at the beginning of the list
|
||||
inline label rcIndex(const label i) const;
|
||||
|
||||
//- Return the binary size in number of characters of the UList
|
||||
@ -151,6 +151,18 @@ public:
|
||||
// This can be used (with caution) when interfacing with C code.
|
||||
inline T* data();
|
||||
|
||||
//- Return the first element of the list.
|
||||
inline T& first();
|
||||
|
||||
//- Return first element of the list.
|
||||
inline const T& first() const;
|
||||
|
||||
//- Return the last element of the list.
|
||||
inline T& last();
|
||||
|
||||
//- Return the last element of the list.
|
||||
inline const T& last() const;
|
||||
|
||||
|
||||
// Check
|
||||
|
||||
@ -184,12 +196,6 @@ public:
|
||||
// an out-of-range element returns false without any ill-effects
|
||||
inline const T& operator[](const label) const;
|
||||
|
||||
//- Return last element of UList.
|
||||
inline T& last();
|
||||
|
||||
//- Return last element of UList.
|
||||
inline const T& last() const;
|
||||
|
||||
//- Allow cast to a const List<T>&
|
||||
inline operator const Foam::List<T>&() const;
|
||||
|
||||
|
||||
@ -114,6 +114,20 @@ inline void Foam::UList<T>::checkIndex(const label i) const
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline T& Foam::UList<T>::first()
|
||||
{
|
||||
return this->operator[](0);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline const T& Foam::UList<T>::first() const
|
||||
{
|
||||
return this->operator[](0);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline T& Foam::UList<T>::last()
|
||||
{
|
||||
|
||||
@ -25,7 +25,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "processorPointPatchField.H"
|
||||
#include "transformField.H"
|
||||
//#include "transformField.H"
|
||||
#include "processorPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -131,125 +131,7 @@ void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const
|
||||
|
||||
if (doTransform())
|
||||
{
|
||||
const processorPolyPatch& ppp = procPatch_.procPolyPatch();
|
||||
const labelList& nonGlobalPatchPoints =
|
||||
procPatch_.nonGlobalPatchPoints();
|
||||
|
||||
// Mark patch that transformed point:
|
||||
// -3 : global patch point so handled in different patch
|
||||
// -2 : nonGlobalPatchPoints, initial value
|
||||
// -1 : originating from internal face, no transform necessary
|
||||
// >=0 : originating from coupled patch
|
||||
labelList hasTransformed(ppp.nPoints(), -3);
|
||||
forAll(nonGlobalPatchPoints, i)
|
||||
{
|
||||
hasTransformed[nonGlobalPatchPoints[i]] = -2;
|
||||
}
|
||||
|
||||
forAll(ppp.patchIDs(), subI)
|
||||
{
|
||||
label patchI = ppp.patchIDs()[subI];
|
||||
|
||||
if (patchI == -1)
|
||||
{
|
||||
for
|
||||
(
|
||||
label faceI = ppp.starts()[subI];
|
||||
faceI < ppp.starts()[subI+1];
|
||||
faceI++
|
||||
)
|
||||
{
|
||||
const face& f = ppp.localFaces()[faceI];
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
label pointI = f[fp];
|
||||
|
||||
if (hasTransformed[pointI] == -3)
|
||||
{
|
||||
// special point, handled elsewhere
|
||||
}
|
||||
else if (hasTransformed[pointI] == -2)
|
||||
{
|
||||
// first visit. Just mark.
|
||||
hasTransformed[pointI] = patchI;
|
||||
}
|
||||
else if (hasTransformed[pointI] == patchI)
|
||||
{
|
||||
// already done
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"processorPointPatchField<Type>::"
|
||||
"swapAdd(Field<Type>& pField) const"
|
||||
) << "Point " << pointI
|
||||
<< " on patch " << ppp.name()
|
||||
<< " already transformed by patch "
|
||||
<< hasTransformed[pointI]
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if
|
||||
(
|
||||
!refCast<const coupledPolyPatch>
|
||||
(
|
||||
ppp.boundaryMesh()[patchI]
|
||||
).parallel()
|
||||
)
|
||||
{
|
||||
const tensor& T = refCast<const coupledPolyPatch>
|
||||
(
|
||||
ppp.boundaryMesh()[patchI]
|
||||
).forwardT();
|
||||
|
||||
for
|
||||
(
|
||||
label faceI = ppp.starts()[subI];
|
||||
faceI < ppp.starts()[subI+1];
|
||||
faceI++
|
||||
)
|
||||
{
|
||||
const face& f = ppp.localFaces()[faceI];
|
||||
|
||||
forAll(f, fp)
|
||||
{
|
||||
label pointI = f[fp];
|
||||
|
||||
if (hasTransformed[pointI] == -3)
|
||||
{
|
||||
// special point, handled elsewhere
|
||||
}
|
||||
else if (hasTransformed[pointI] == -2)
|
||||
{
|
||||
pnf[pointI] = transform(T, pnf[pointI]);
|
||||
|
||||
hasTransformed[pointI] = patchI;
|
||||
}
|
||||
else if (hasTransformed[pointI] == patchI)
|
||||
{
|
||||
// already done
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"processorPointPatchField<Type>::"
|
||||
"swapAdd(Field<Type>& pField) const"
|
||||
) << "Point " << pointI
|
||||
<< " on patch " << ppp.name()
|
||||
<< " subPatch " << patchI
|
||||
<< " already transformed by patch "
|
||||
<< hasTransformed[pointI]
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
procPatch_.procPolyPatch().transform(pnf);
|
||||
}
|
||||
|
||||
addToInternalField(pField, pnf);
|
||||
|
||||
@ -149,13 +149,13 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
//- Does the patch field perform the transfromation
|
||||
//- Does the patch field perform the transformation
|
||||
virtual bool doTransform() const
|
||||
{
|
||||
return
|
||||
!(
|
||||
pTraits<Type>::rank == 0
|
||||
|| procPatch_.procPolyPatch().parallel()
|
||||
|| procPatch_.procPolyPatch().doTransform()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,267 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "processorCyclicPointPatchField.H"
|
||||
#include "transformField.H"
|
||||
#include "processorPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
|
||||
(
|
||||
const pointPatch& p,
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
coupledPointPatchField<Type>(p, iF),
|
||||
procPatch_(refCast<const processorCyclicPointPatch>(p))
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
|
||||
(
|
||||
const pointPatch& p,
|
||||
const DimensionedField<Type, pointMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
coupledPointPatchField<Type>(p, iF, dict),
|
||||
procPatch_(refCast<const processorCyclicPointPatch>(p))
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
|
||||
(
|
||||
const processorCyclicPointPatchField<Type>& ptf,
|
||||
const pointPatch& p,
|
||||
const DimensionedField<Type, pointMesh>& iF,
|
||||
const pointPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
coupledPointPatchField<Type>(ptf, p, iF, mapper),
|
||||
procPatch_(refCast<const processorCyclicPointPatch>(ptf.patch()))
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
processorCyclicPointPatchField<Type>::processorCyclicPointPatchField
|
||||
(
|
||||
const processorCyclicPointPatchField<Type>& ptf,
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
)
|
||||
:
|
||||
coupledPointPatchField<Type>(ptf, iF),
|
||||
procPatch_(refCast<const processorCyclicPointPatch>(ptf.patch()))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
processorCyclicPointPatchField<Type>::~processorCyclicPointPatchField()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void processorCyclicPointPatchField<Type>::initSwapAdd(Field<Type>& pField)
|
||||
const
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Get internal field into my point order
|
||||
Field<Type> pf(this->patchInternalField(pField));
|
||||
|
||||
OPstream::write
|
||||
(
|
||||
Pstream::blocking,
|
||||
procPatch_.neighbProcNo(),
|
||||
reinterpret_cast<const char*>(pf.begin()),
|
||||
pf.byteSize()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void processorCyclicPointPatchField<Type>::swapAdd(Field<Type>& pField) const
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
Field<Type> pnf(this->size());
|
||||
|
||||
IPstream::read
|
||||
(
|
||||
Pstream::blocking,
|
||||
procPatch_.neighbProcNo(),
|
||||
reinterpret_cast<char*>(pnf.begin()),
|
||||
pnf.byteSize()
|
||||
);
|
||||
|
||||
if (doTransform())
|
||||
{
|
||||
procPatch_.procPolyPatch().transform(pnf);
|
||||
|
||||
//const processorPolyPatch& ppp = procPatch_.procPolyPatch();
|
||||
//const labelList& nonGlobalPatchPoints =
|
||||
// procPatch_.nonGlobalPatchPoints();
|
||||
//
|
||||
//// Mark patch that transformed point:
|
||||
//// -3 : global patch point so handled in different patch
|
||||
//// -2 : nonGlobalPatchPoints, initial value
|
||||
//// -1 : originating from internal face, no transform necessary
|
||||
//// >=0 : originating from coupled patch
|
||||
//labelList hasTransformed(ppp.nPoints(), -3);
|
||||
//forAll(nonGlobalPatchPoints, i)
|
||||
//{
|
||||
// hasTransformed[nonGlobalPatchPoints[i]] = -2;
|
||||
//}
|
||||
//
|
||||
//forAll(ppp.patchIDs(), subI)
|
||||
//{
|
||||
// label patchI = ppp.patchIDs()[subI];
|
||||
//
|
||||
// if (patchI == -1)
|
||||
// {
|
||||
// for
|
||||
// (
|
||||
// label faceI = ppp.starts()[subI];
|
||||
// faceI < ppp.starts()[subI+1];
|
||||
// faceI++
|
||||
// )
|
||||
// {
|
||||
// const face& f = ppp.localFaces()[faceI];
|
||||
//
|
||||
// forAll(f, fp)
|
||||
// {
|
||||
// label pointI = f[fp];
|
||||
//
|
||||
// if (hasTransformed[pointI] == -3)
|
||||
// {
|
||||
// // special point, handled elsewhere
|
||||
// }
|
||||
// else if (hasTransformed[pointI] == -2)
|
||||
// {
|
||||
// // first visit. Just mark.
|
||||
// hasTransformed[pointI] = patchI;
|
||||
// }
|
||||
// else if (hasTransformed[pointI] == patchI)
|
||||
// {
|
||||
// // already done
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// FatalErrorIn
|
||||
// (
|
||||
// "processorCyclicPointPatchField<Type>::"
|
||||
// "swapAdd(Field<Type>& pField) const"
|
||||
// ) << "Point " << pointI
|
||||
// << " on patch " << ppp.name()
|
||||
// << " already transformed by patch "
|
||||
// << hasTransformed[pointI]
|
||||
// << abort(FatalError);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else if
|
||||
// (
|
||||
// !refCast<const coupledPolyPatch>
|
||||
// (
|
||||
// ppp.boundaryMesh()[patchI]
|
||||
// ).parallel()
|
||||
// )
|
||||
// {
|
||||
// const tensor& T = refCast<const coupledPolyPatch>
|
||||
// (
|
||||
// ppp.boundaryMesh()[patchI]
|
||||
// ).forwardT();
|
||||
//
|
||||
// for
|
||||
// (
|
||||
// label faceI = ppp.starts()[subI];
|
||||
// faceI < ppp.starts()[subI+1];
|
||||
// faceI++
|
||||
// )
|
||||
// {
|
||||
// const face& f = ppp.localFaces()[faceI];
|
||||
//
|
||||
// forAll(f, fp)
|
||||
// {
|
||||
// label pointI = f[fp];
|
||||
//
|
||||
// if (hasTransformed[pointI] == -3)
|
||||
// {
|
||||
// // special point, handled elsewhere
|
||||
// }
|
||||
// else if (hasTransformed[pointI] == -2)
|
||||
// {
|
||||
// pnf[pointI] = transform(T, pnf[pointI]);
|
||||
//
|
||||
// hasTransformed[pointI] = patchI;
|
||||
// }
|
||||
// else if (hasTransformed[pointI] == patchI)
|
||||
// {
|
||||
// // already done
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// FatalErrorIn
|
||||
// (
|
||||
// "processorCyclicPointPatchField<Type>::"
|
||||
// "swapAdd(Field<Type>& pField) const"
|
||||
// ) << "Point " << pointI
|
||||
// << " on patch " << ppp.name()
|
||||
// << " subPatch " << patchI
|
||||
// << " already transformed by patch "
|
||||
// << hasTransformed[pointI]
|
||||
// << abort(FatalError);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
addToInternalField(pField, pnf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,194 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::processorCyclicPointPatchField
|
||||
|
||||
Description
|
||||
Foam::processorCyclicPointPatchField
|
||||
|
||||
SourceFiles
|
||||
processorCyclicPointPatchField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef processorCyclicPointPatchField_H
|
||||
#define processorCyclicPointPatchField_H
|
||||
|
||||
#include "coupledPointPatchField.H"
|
||||
#include "processorCyclicPointPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class processorCyclicPointPatchField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class processorCyclicPointPatchField
|
||||
:
|
||||
public coupledPointPatchField<Type>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Local reference to processor patch
|
||||
const processorCyclicPointPatch& procPatch_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName(processorCyclicPointPatch::typeName_());
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
processorCyclicPointPatchField
|
||||
(
|
||||
const pointPatch&,
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
processorCyclicPointPatchField
|
||||
(
|
||||
const pointPatch&,
|
||||
const DimensionedField<Type, pointMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given patchField<Type> onto a new patch
|
||||
processorCyclicPointPatchField
|
||||
(
|
||||
const processorCyclicPointPatchField<Type>&,
|
||||
const pointPatch&,
|
||||
const DimensionedField<Type, pointMesh>&,
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type> > clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type> >
|
||||
(
|
||||
new processorCyclicPointPatchField<Type>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
processorCyclicPointPatchField
|
||||
(
|
||||
const processorCyclicPointPatchField<Type>&,
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type> > clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type> >
|
||||
(
|
||||
new processorCyclicPointPatchField<Type>
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~processorCyclicPointPatchField();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return true if running parallel
|
||||
virtual bool coupled() const
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//- Does the patch field perform the transfromation
|
||||
virtual bool doTransform() const
|
||||
{
|
||||
return
|
||||
!(
|
||||
pTraits<Type>::rank == 0
|
||||
|| procPatch_.procPolyPatch().parallel()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Evaluate the patch field
|
||||
virtual void evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType=Pstream::blocking
|
||||
)
|
||||
{}
|
||||
|
||||
//- Initialise swap of patch point values
|
||||
virtual void initSwapAdd(Field<Type>&) const;
|
||||
|
||||
//- Complete swap of patch point values and add to local values
|
||||
virtual void swapAdd(Field<Type>&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "processorCyclicPointPatchField.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,44 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "processorCyclicPointPatchFields.H"
|
||||
#include "pointPatchFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
makePointPatchFields(processorCyclic);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,50 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef processorCyclicPointPatchFields_H
|
||||
#define processorCyclicPointPatchFields_H
|
||||
|
||||
#include "processorCyclicPointPatchField.H"
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePointPatchFieldTypedefs(processorCyclic);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -91,7 +91,7 @@ public:
|
||||
{
|
||||
return autoPtr<procLduInterface>(new procLduInterface(is));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Ostream operator
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const procLduMatrix& cldum)
|
||||
<< cldum.upper_
|
||||
<< cldum.lower_
|
||||
<< cldum.interfaces_;
|
||||
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ Class
|
||||
Description
|
||||
An abstract base class for implicitly-coupled interfaces
|
||||
e.g. processor and cyclic patches.
|
||||
|
||||
|
||||
SourceFiles
|
||||
lduInterface.C
|
||||
|
||||
|
||||
@ -36,6 +36,18 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::processorLduInterface::resizeBuf
|
||||
(
|
||||
List<char>& buf,
|
||||
const label size
|
||||
) const
|
||||
{
|
||||
if (buf.size() < size)
|
||||
{
|
||||
buf.setSize(size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -61,6 +61,9 @@ class processorLduInterface
|
||||
// Only sized and used when compressed or non-blocking comms used.
|
||||
mutable List<char> receiveBuf_;
|
||||
|
||||
//- Resize the buffer if required
|
||||
void resizeBuf(List<char>& buf, const label size) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -89,17 +92,20 @@ public:
|
||||
//- Return neigbour processor number
|
||||
virtual int neighbProcNo() const = 0;
|
||||
|
||||
//- Set send buffer to sufficient size to hold List<Type>(nElems).
|
||||
// Returns reference to buffer (note:buffer.size() is number
|
||||
// of characters, not nElems)
|
||||
template<class Type>
|
||||
List<Type>& setSendBuf(const label nElems) const;
|
||||
//- Return face transformation tensor
|
||||
virtual const tensor& forwardT() const = 0;
|
||||
|
||||
//- Set receive buffer to sufficient size to hold List<Type>(nElems)
|
||||
// Returns reference to buffer (note:buffer.size() is number
|
||||
// of characters, not nElems)
|
||||
template<class Type>
|
||||
List<Type>& setReceiveBuf(const label nElems) const;
|
||||
// //- Set send buffer to sufficient size to hold List<Type>(nElems).
|
||||
// // Returns reference to buffer (note:buffer.size() is number
|
||||
// // of characters, not nElems)
|
||||
// template<class Type>
|
||||
// List<Type>& setSendBuf(const label nElems) const;
|
||||
//
|
||||
// //- Set receive buffer to sufficient size to hold List<Type>(nElems)
|
||||
// // Returns reference to buffer (note:buffer.size() is number
|
||||
// // of characters, not nElems)
|
||||
// template<class Type>
|
||||
// List<Type>& setReceiveBuf(const label nElems) const;
|
||||
|
||||
|
||||
// Transfer functions
|
||||
@ -154,24 +160,24 @@ public:
|
||||
) const;
|
||||
|
||||
|
||||
//- Raw field send function of internal send buffer with data
|
||||
// compression.
|
||||
template<class Type>
|
||||
void compressedBufferSend
|
||||
(
|
||||
const Pstream::commsTypes commsType
|
||||
) const;
|
||||
|
||||
//- Raw field receive function of internal receive buffer with data
|
||||
// compression.
|
||||
// Returns reference to buffer (note:buffer.size() is number
|
||||
// of characters, not size)
|
||||
template<class Type>
|
||||
const List<Type>& compressedBufferReceive
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const label size
|
||||
) const;
|
||||
// //- Raw field send function of internal send buffer with data
|
||||
// // compression.
|
||||
// template<class Type>
|
||||
// void compressedBufferSend
|
||||
// (
|
||||
// const Pstream::commsTypes commsType
|
||||
// ) const;
|
||||
//
|
||||
// //- Raw field receive function of internal receive buffer with data
|
||||
// // compression.
|
||||
// // Returns reference to buffer (note:buffer.size() is number
|
||||
// // of characters, not size)
|
||||
// template<class Type>
|
||||
// const List<Type>& compressedBufferReceive
|
||||
// (
|
||||
// const Pstream::commsTypes commsType,
|
||||
// const label size
|
||||
// ) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -30,47 +30,47 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::List<Type>& Foam::processorLduInterface::setSendBuf(const label nElems)
|
||||
const
|
||||
{
|
||||
if (!contiguous<Type>())
|
||||
{
|
||||
FatalErrorIn("processorLduInterface::setSendBuf(const label) const")
|
||||
<< "Cannot return the binary size of a list of "
|
||||
"non-primitive elements"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
label nBytes = nElems*sizeof(Type);
|
||||
sendBuf_.setSize(nBytes);
|
||||
|
||||
return reinterpret_cast<List<Type>&>(sendBuf_);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::List<Type>& Foam::processorLduInterface::setReceiveBuf
|
||||
(
|
||||
const label nElems
|
||||
) const
|
||||
{
|
||||
if (!contiguous<Type>())
|
||||
{
|
||||
FatalErrorIn("processorLduInterface::setReceiveBuf(const label) const")
|
||||
<< "Cannot return the binary size of a list of "
|
||||
"non-primitive elements"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
label nBytes = nElems*sizeof(Type);
|
||||
|
||||
//receiveBuf_.setSize(nBytes, '\0'); // necessary because of expanding
|
||||
// compression?
|
||||
receiveBuf_.setSize(nBytes);
|
||||
|
||||
return reinterpret_cast<List<Type>&>(receiveBuf_);
|
||||
}
|
||||
// template<class Type>
|
||||
// Foam::List<Type>& Foam::processorLduInterface::setSendBuf(const label nElems)
|
||||
// const
|
||||
// {
|
||||
// if (!contiguous<Type>())
|
||||
// {
|
||||
// FatalErrorIn("processorLduInterface::setSendBuf(const label) const")
|
||||
// << "Cannot return the binary size of a list of "
|
||||
// "non-primitive elements"
|
||||
// << abort(FatalError);
|
||||
// }
|
||||
//
|
||||
// label nBytes = nElems*sizeof(Type);
|
||||
// sendBuf_.setSize(nBytes);
|
||||
//
|
||||
// return reinterpret_cast<List<Type>&>(sendBuf_);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// template<class Type>
|
||||
// Foam::List<Type>& Foam::processorLduInterface::setReceiveBuf
|
||||
// (
|
||||
// const label nElems
|
||||
// ) const
|
||||
// {
|
||||
// if (!contiguous<Type>())
|
||||
// {
|
||||
// FatalErrorIn("processorLduInterface::setReceiveBuf(const label) const")
|
||||
// << "Cannot return the binary size of a list of "
|
||||
// "non-primitive elements"
|
||||
// << abort(FatalError);
|
||||
// }
|
||||
//
|
||||
// label nBytes = nElems*sizeof(Type);
|
||||
//
|
||||
// //receiveBuf_.setSize(nBytes, '\0'); // necessary because of expanding
|
||||
// // compression?
|
||||
// receiveBuf_.setSize(nBytes);
|
||||
//
|
||||
// return reinterpret_cast<List<Type>&>(receiveBuf_);
|
||||
// }
|
||||
|
||||
|
||||
template<class Type>
|
||||
@ -92,17 +92,19 @@ void Foam::processorLduInterface::send
|
||||
}
|
||||
else if (commsType == Pstream::nonBlocking)
|
||||
{
|
||||
setReceiveBuf<Type>(f.size());
|
||||
//setReceiveBuf<Type>(f.size());
|
||||
resizeBuf(receiveBuf_, f.size()*sizeof(Type));
|
||||
|
||||
IPstream::read
|
||||
(
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
receiveBuf_.begin(),
|
||||
f.byteSize()
|
||||
receiveBuf_.size()
|
||||
);
|
||||
|
||||
setSendBuf<Type>(f.size());
|
||||
//setSendBuf<Type>(f.size());
|
||||
resizeBuf(sendBuf_, f.byteSize());
|
||||
memcpy(sendBuf_.begin(), f.begin(), f.byteSize());
|
||||
|
||||
OPstream::write
|
||||
@ -182,7 +184,8 @@ void Foam::processorLduInterface::compressedSend
|
||||
|
||||
const scalar *sArray = reinterpret_cast<const scalar*>(f.begin());
|
||||
const scalar *slast = &sArray[nm1];
|
||||
setSendBuf<float>(nFloats);
|
||||
//setSendBuf<float>(nFloats);
|
||||
resizeBuf(sendBuf_, nBytes);
|
||||
float *fArray = reinterpret_cast<float*>(sendBuf_.begin());
|
||||
|
||||
for (register label i=0; i<nm1; i++)
|
||||
@ -204,7 +207,8 @@ void Foam::processorLduInterface::compressedSend
|
||||
}
|
||||
else if (commsType == Pstream::nonBlocking)
|
||||
{
|
||||
setReceiveBuf<float>(nFloats);
|
||||
//setReceiveBuf<float>(nFloats);
|
||||
resizeBuf(receiveBuf_, nBytes);
|
||||
|
||||
IPstream::read
|
||||
(
|
||||
@ -235,7 +239,6 @@ void Foam::processorLduInterface::compressedSend
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::processorLduInterface::compressedReceive
|
||||
(
|
||||
@ -249,17 +252,19 @@ void Foam::processorLduInterface::compressedReceive
|
||||
label nm1 = (f.size() - 1)*nCmpts;
|
||||
label nlast = sizeof(Type)/sizeof(float);
|
||||
label nFloats = nm1 + nlast;
|
||||
label nBytes = nFloats*sizeof(float);
|
||||
|
||||
if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
|
||||
{
|
||||
setReceiveBuf<float>(nFloats);
|
||||
//setReceiveBuf<float>(nFloats);
|
||||
resizeBuf(receiveBuf_, nBytes);
|
||||
|
||||
IPstream::read
|
||||
(
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
receiveBuf_.begin(),
|
||||
receiveBuf_.size()
|
||||
nBytes
|
||||
);
|
||||
}
|
||||
else if (commsType != Pstream::nonBlocking)
|
||||
@ -286,7 +291,6 @@ void Foam::processorLduInterface::compressedReceive
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
|
||||
(
|
||||
@ -300,155 +304,155 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::processorLduInterface::compressedBufferSend
|
||||
(
|
||||
const Pstream::commsTypes commsType
|
||||
) const
|
||||
{
|
||||
// Optionally inline compress sendBuf
|
||||
if
|
||||
(
|
||||
sizeof(scalar) > sizeof(float)
|
||||
&& sendBuf_.size()
|
||||
&& Pstream::floatTransfer
|
||||
)
|
||||
{
|
||||
const List<Type>& f = reinterpret_cast<const List<Type>&>(sendBuf_);
|
||||
label fSize = f.size()/sizeof(Type);
|
||||
|
||||
// Inplace compress
|
||||
static const label nCmpts = sizeof(Type)/sizeof(scalar);
|
||||
label nm1 = (fSize - 1)*nCmpts;
|
||||
label nlast = sizeof(Type)/sizeof(float);
|
||||
label nFloats = nm1 + nlast;
|
||||
|
||||
const scalar *sArray = reinterpret_cast<const scalar*>(f.begin());
|
||||
const scalar *slast = &sArray[nm1];
|
||||
float *fArray = reinterpret_cast<float*>(sendBuf_.begin());
|
||||
|
||||
for (register label i=0; i<nm1; i++)
|
||||
{
|
||||
fArray[i] = sArray[i] - slast[i%nCmpts];
|
||||
}
|
||||
|
||||
reinterpret_cast<Type&>(fArray[nm1]) = f[fSize - 1];
|
||||
|
||||
// Trim
|
||||
setSendBuf<float>(nFloats);
|
||||
}
|
||||
|
||||
// Send sendBuf
|
||||
if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
|
||||
{
|
||||
OPstream::write
|
||||
(
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
sendBuf_.begin(),
|
||||
sendBuf_.size()
|
||||
);
|
||||
}
|
||||
else if (commsType == Pstream::nonBlocking)
|
||||
{
|
||||
setReceiveBuf<char>(sendBuf_.size());
|
||||
|
||||
IPstream::read
|
||||
(
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
receiveBuf_.begin(),
|
||||
receiveBuf_.size()
|
||||
);
|
||||
|
||||
OPstream::write
|
||||
(
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
sendBuf_.begin(),
|
||||
sendBuf_.size()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("processorLduInterface::compressedBufferSend")
|
||||
<< "Unsupported communications type " << commsType
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
const Foam::List<Type>& Foam::processorLduInterface::compressedBufferReceive
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const label size
|
||||
) const
|
||||
{
|
||||
if (sizeof(scalar) > sizeof(float) && size && Pstream::floatTransfer)
|
||||
{
|
||||
static const label nCmpts = sizeof(Type)/sizeof(scalar);
|
||||
label nm1 = (size - 1)*nCmpts;
|
||||
label nlast = sizeof(Type)/sizeof(float);
|
||||
label nFloats = nm1 + nlast;
|
||||
|
||||
if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
|
||||
{
|
||||
setReceiveBuf<float>(nFloats);
|
||||
|
||||
IPstream::read
|
||||
(
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
receiveBuf_.begin(),
|
||||
receiveBuf_.size()
|
||||
);
|
||||
}
|
||||
else if (commsType != Pstream::nonBlocking)
|
||||
{
|
||||
FatalErrorIn("processorLduInterface::compressedBufferReceive")
|
||||
<< "Unsupported communications type " << commsType
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Inline expand
|
||||
List<Type>& f = setReceiveBuf<Type>(size);
|
||||
label fSize = f.size()/sizeof(Type);
|
||||
|
||||
const float *fArray =
|
||||
reinterpret_cast<const float*>(receiveBuf_.begin());
|
||||
f[fSize - 1] = reinterpret_cast<const Type&>(fArray[nm1]);
|
||||
scalar *sArray = reinterpret_cast<scalar*>(f.begin());
|
||||
const scalar *slast = &sArray[nm1];
|
||||
|
||||
for (register label i=0; i<nm1; i++)
|
||||
{
|
||||
sArray[i] = fArray[i] + slast[i%nCmpts];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
|
||||
{
|
||||
setReceiveBuf<Type>(size);
|
||||
|
||||
IPstream::read
|
||||
(
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
receiveBuf_.begin(),
|
||||
receiveBuf_.size()
|
||||
);
|
||||
}
|
||||
else if (commsType != Pstream::nonBlocking)
|
||||
{
|
||||
FatalErrorIn("processorLduInterface::compressedBufferReceive")
|
||||
<< "Unsupported communications type " << commsType
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
return reinterpret_cast<List<Type>&>(receiveBuf_);
|
||||
}
|
||||
// template<class Type>
|
||||
// void Foam::processorLduInterface::compressedBufferSend
|
||||
// (
|
||||
// const Pstream::commsTypes commsType
|
||||
// ) const
|
||||
// {
|
||||
// // Optionally inline compress sendBuf
|
||||
// if
|
||||
// (
|
||||
// sizeof(scalar) > sizeof(float)
|
||||
// && sendBuf_.size()
|
||||
// && Pstream::floatTransfer
|
||||
// )
|
||||
// {
|
||||
// const List<Type>& f = reinterpret_cast<const List<Type>&>(sendBuf_);
|
||||
// label fSize = f.size()/sizeof(Type);
|
||||
//
|
||||
// // Inplace compress
|
||||
// static const label nCmpts = sizeof(Type)/sizeof(scalar);
|
||||
// label nm1 = (fSize - 1)*nCmpts;
|
||||
// label nlast = sizeof(Type)/sizeof(float);
|
||||
// label nFloats = nm1 + nlast;
|
||||
//
|
||||
// const scalar *sArray = reinterpret_cast<const scalar*>(f.begin());
|
||||
// const scalar *slast = &sArray[nm1];
|
||||
// float *fArray = reinterpret_cast<float*>(sendBuf_.begin());
|
||||
//
|
||||
// for (register label i=0; i<nm1; i++)
|
||||
// {
|
||||
// fArray[i] = sArray[i] - slast[i%nCmpts];
|
||||
// }
|
||||
//
|
||||
// reinterpret_cast<Type&>(fArray[nm1]) = f[fSize - 1];
|
||||
//
|
||||
// // Trim
|
||||
// setSendBuf<float>(nFloats);
|
||||
// }
|
||||
//
|
||||
// // Send sendBuf
|
||||
// if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
|
||||
// {
|
||||
// OPstream::write
|
||||
// (
|
||||
// commsType,
|
||||
// neighbProcNo(),
|
||||
// sendBuf_.begin(),
|
||||
// sendBuf_.size()
|
||||
// );
|
||||
// }
|
||||
// else if (commsType == Pstream::nonBlocking)
|
||||
// {
|
||||
// setReceiveBuf<char>(sendBuf_.size());
|
||||
//
|
||||
// IPstream::read
|
||||
// (
|
||||
// commsType,
|
||||
// neighbProcNo(),
|
||||
// receiveBuf_.begin(),
|
||||
// receiveBuf_.size()
|
||||
// );
|
||||
//
|
||||
// OPstream::write
|
||||
// (
|
||||
// commsType,
|
||||
// neighbProcNo(),
|
||||
// sendBuf_.begin(),
|
||||
// sendBuf_.size()
|
||||
// );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// FatalErrorIn("processorLduInterface::compressedBufferSend")
|
||||
// << "Unsupported communications type " << commsType
|
||||
// << exit(FatalError);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// template<class Type>
|
||||
// const Foam::List<Type>& Foam::processorLduInterface::compressedBufferReceive
|
||||
// (
|
||||
// const Pstream::commsTypes commsType,
|
||||
// const label size
|
||||
// ) const
|
||||
// {
|
||||
// if (sizeof(scalar) > sizeof(float) && size && Pstream::floatTransfer)
|
||||
// {
|
||||
// static const label nCmpts = sizeof(Type)/sizeof(scalar);
|
||||
// label nm1 = (size - 1)*nCmpts;
|
||||
// label nlast = sizeof(Type)/sizeof(float);
|
||||
// label nFloats = nm1 + nlast;
|
||||
//
|
||||
// if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
|
||||
// {
|
||||
// setReceiveBuf<float>(nFloats);
|
||||
//
|
||||
// IPstream::read
|
||||
// (
|
||||
// commsType,
|
||||
// neighbProcNo(),
|
||||
// receiveBuf_.begin(),
|
||||
// receiveBuf_.size()
|
||||
// );
|
||||
// }
|
||||
// else if (commsType != Pstream::nonBlocking)
|
||||
// {
|
||||
// FatalErrorIn("processorLduInterface::compressedBufferReceive")
|
||||
// << "Unsupported communications type " << commsType
|
||||
// << exit(FatalError);
|
||||
// }
|
||||
//
|
||||
// // Inline expand
|
||||
// List<Type>& f = setReceiveBuf<Type>(size);
|
||||
// label fSize = f.size()/sizeof(Type);
|
||||
//
|
||||
// const float *fArray =
|
||||
// reinterpret_cast<const float*>(receiveBuf_.begin());
|
||||
// f[fSize - 1] = reinterpret_cast<const Type&>(fArray[nm1]);
|
||||
// scalar *sArray = reinterpret_cast<scalar*>(f.begin());
|
||||
// const scalar *slast = &sArray[nm1];
|
||||
//
|
||||
// for (register label i=0; i<nm1; i++)
|
||||
// {
|
||||
// sArray[i] = fArray[i] + slast[i%nCmpts];
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
|
||||
// {
|
||||
// setReceiveBuf<Type>(size);
|
||||
//
|
||||
// IPstream::read
|
||||
// (
|
||||
// commsType,
|
||||
// neighbProcNo(),
|
||||
// receiveBuf_.begin(),
|
||||
// receiveBuf_.size()
|
||||
// );
|
||||
// }
|
||||
// else if (commsType != Pstream::nonBlocking)
|
||||
// {
|
||||
// FatalErrorIn("processorLduInterface::compressedBufferReceive")
|
||||
// << "Unsupported communications type " << commsType
|
||||
// << exit(FatalError);
|
||||
// }
|
||||
// }
|
||||
// return reinterpret_cast<List<Type>&>(receiveBuf_);
|
||||
// }
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -51,7 +51,7 @@ void Foam::cyclicLduInterfaceField::transformCoupleField
|
||||
{
|
||||
if (doTransform())
|
||||
{
|
||||
scalar forwardScale =
|
||||
scalar forwardScale =
|
||||
pow(diag(forwardT()).component(cmpt), rank());
|
||||
|
||||
pnf *= forwardScale;
|
||||
|
||||
@ -43,24 +43,17 @@ Foam::processorLduInterfaceField::~processorLduInterfaceField()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
//void Foam::processorLduInterfaceField::transformCoupleField
|
||||
//(
|
||||
// scalarField& f,
|
||||
// const direction cmpt
|
||||
//) const
|
||||
//{
|
||||
// if (doTransform())
|
||||
// {
|
||||
// if (forwardT().size() == 1)
|
||||
// {
|
||||
// f *= pow(diag(forwardT()[0]).component(cmpt), rank());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// f *= pow(diag(forwardT())().component(cmpt), rank());
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
void Foam::processorLduInterfaceField::transformCoupleField
|
||||
(
|
||||
scalarField& f,
|
||||
const direction cmpt
|
||||
) const
|
||||
{
|
||||
if (doTransform())
|
||||
{
|
||||
f *= pow(diag(forwardT()).component(cmpt), rank());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -79,22 +79,22 @@ public:
|
||||
//- Return neigbour processor number
|
||||
virtual int neighbProcNo() const = 0;
|
||||
|
||||
// //- Is the transform required
|
||||
// virtual bool doTransform() const = 0;
|
||||
//
|
||||
// //- Return face transformation tensor
|
||||
// virtual const tensorField& forwardT() const = 0;
|
||||
//- Is the transform required
|
||||
virtual bool doTransform() const = 0;
|
||||
|
||||
//- Return face transformation tensor
|
||||
virtual const tensor& forwardT() const = 0;
|
||||
|
||||
//- Return rank of component for transform
|
||||
virtual int rank() const = 0;
|
||||
|
||||
|
||||
// //- Transform given patch component field
|
||||
// virtual void transformCoupleField
|
||||
// (
|
||||
// scalarField& f,
|
||||
// const direction cmpt
|
||||
// ) const = 0;
|
||||
//- Transform given patch component field
|
||||
void transformCoupleField
|
||||
(
|
||||
scalarField& f,
|
||||
const direction cmpt
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -147,7 +147,7 @@ class GAMGSolver
|
||||
//- Calculate and return the scaling factor from Acf, coarseSource
|
||||
// and coarseField.
|
||||
// At the same time do a Jacobi iteration on the coarseField using
|
||||
// the Acf provided after the coarseField values are used for the
|
||||
// the Acf provided after the coarseField values are used for the
|
||||
// scaling factor.
|
||||
scalar scalingFactor
|
||||
(
|
||||
|
||||
@ -96,7 +96,7 @@ void Foam::GAMGSolver::agglomerateMatrix(const label fineLevelIndex)
|
||||
{
|
||||
if (fineInterfaces.set(inti))
|
||||
{
|
||||
const GAMGInterface& coarseInterface =
|
||||
const GAMGInterface& coarseInterface =
|
||||
refCast<const GAMGInterface>
|
||||
(
|
||||
agglomeration_.interfaceLevel(fineLevelIndex + 1)[inti]
|
||||
@ -182,7 +182,7 @@ void Foam::GAMGSolver::agglomerateMatrix(const label fineLevelIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
else // ... Otherwise it is symmetric so agglomerate just the upper
|
||||
else // ... Otherwise it is symmetric so agglomerate just the upper
|
||||
{
|
||||
// Get off-diagonal matrix coefficients
|
||||
const scalarField& fineUpper = fineMatrix.upper();
|
||||
|
||||
@ -110,6 +110,26 @@ Foam::boundBox::boundBox(Istream& is)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::pointField> Foam::boundBox::corners() const
|
||||
{
|
||||
tmp<pointField> tPts = tmp<pointField>(new pointField(8));
|
||||
pointField& pt = tPts();
|
||||
|
||||
pt[0] = min_; // min-x, min-y, min-z
|
||||
pt[1] = point(max_.x(), min_.y(), min_.z()); // max-x, min-y, min-z
|
||||
pt[2] = point(max_.x(), max_.y(), min_.z()); // max-x, max-y, min-z
|
||||
pt[3] = point(min_.x(), max_.y(), min_.z()); // min-x, max-y, min-z
|
||||
pt[4] = point(min_.x(), min_.y(), max_.z()); // min-x, min-y, max-z
|
||||
pt[5] = point(max_.x(), min_.y(), max_.z()); // max-x, min-y, max-z
|
||||
pt[6] = max_; // max-x, max-y, max-z
|
||||
pt[7] = point(min_.x(), max_.y(), max_.z()); // min-x, max-y, max-z
|
||||
|
||||
return tPts;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const boundBox& bb)
|
||||
|
||||
@ -171,6 +171,8 @@ public:
|
||||
return cmptAv(span());
|
||||
}
|
||||
|
||||
//- Return corner points in an order corresponding to a 'hex' cell
|
||||
tmp<pointField> corners() const;
|
||||
|
||||
// Query
|
||||
|
||||
|
||||
@ -99,7 +99,7 @@ Foam::label Foam::cell::opposingFaceLabel
|
||||
{
|
||||
// There has already been an opposite face.
|
||||
// Non-prismatic cell
|
||||
Info<< "Multiple faces not sharing vertex: "
|
||||
Info<< "Multiple faces not sharing vertex: "
|
||||
<< oppositeFaceLabel << " and "
|
||||
<< curFaceLabels[faceI] << endl;
|
||||
return -1;
|
||||
|
||||
@ -76,7 +76,7 @@ void Foam::cyclicPointPatch::calcGeometry(PstreamBuffers&)
|
||||
else
|
||||
{
|
||||
// Get reference to shared points
|
||||
const labelList& sharedPoints =
|
||||
const labelList& sharedPoints =
|
||||
boundaryMesh().globalPatch().meshPoints();
|
||||
|
||||
nonGlobalPatchPoints_.setSize(mp.size());
|
||||
|
||||
@ -73,11 +73,11 @@ class processorPointPatch
|
||||
//- Calculate the patch geometry
|
||||
virtual void calcGeometry(PstreamBuffers&);
|
||||
|
||||
//- Initialise the points on this patch which are should also be
|
||||
//- Initialise the points on this patch which are should also be
|
||||
// on a neighbouring patch but are not part of faces of that patch
|
||||
void initPatchPatchPoints(PstreamBuffers&);
|
||||
|
||||
//- Calculate the points on this patch which are should also be
|
||||
//- Calculate the points on this patch which are should also be
|
||||
// on a neighbouring patch but are not part of faces of that patch
|
||||
void calcPatchPatchPoints(PstreamBuffers&);
|
||||
|
||||
|
||||
@ -0,0 +1,399 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "processorCyclicPointPatch.H"
|
||||
#include "pointBoundaryMesh.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
//#include "pointMesh.H"
|
||||
//#include "globalPointPatch.H"
|
||||
//#include "faceList.H"
|
||||
//#include "primitiveFacePatch.H"
|
||||
//#include "emptyPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(processorCyclicPointPatch, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
facePointPatch,
|
||||
processorCyclicPointPatch,
|
||||
polyPatch
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
//void Foam::processorCyclicPointPatch::initGeometry(PstreamBuffers& pBufs)
|
||||
//{
|
||||
// // Algorithm:
|
||||
// // Depending on whether the patch is a master or a slave, get the primitive
|
||||
// // patch points and filter away the points from the global patch.
|
||||
//
|
||||
// if (isMaster())
|
||||
// {
|
||||
// meshPoints_ = procPolyPatch_.meshPoints();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // Slave side. Create the reversed patch and pick up its points
|
||||
// // so that the order is correct
|
||||
// const polyPatch& pp = patch();
|
||||
//
|
||||
// faceList masterFaces(pp.size());
|
||||
//
|
||||
// forAll (pp, faceI)
|
||||
// {
|
||||
// masterFaces[faceI] = pp[faceI].reverseFace();
|
||||
// }
|
||||
//
|
||||
// meshPoints_ = primitiveFacePatch
|
||||
// (
|
||||
// masterFaces,
|
||||
// pp.points()
|
||||
// ).meshPoints();
|
||||
// }
|
||||
//
|
||||
// if (Pstream::parRun())
|
||||
// {
|
||||
// initPatchPatchPoints(pBufs);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//
|
||||
//void Foam::processorCyclicPointPatch::calcGeometry(PstreamBuffers& pBufs)
|
||||
//{
|
||||
// if (Pstream::parRun())
|
||||
// {
|
||||
// calcPatchPatchPoints(pBufs);
|
||||
// }
|
||||
//
|
||||
// // If it is not runing parallel or there are no global points
|
||||
// // create a 1->1 map
|
||||
// if
|
||||
// (
|
||||
// !Pstream::parRun()
|
||||
// || !boundaryMesh().mesh().globalData().nGlobalPoints()
|
||||
// )
|
||||
// {
|
||||
// nonGlobalPatchPoints_.setSize(meshPoints_.size());
|
||||
// forAll(nonGlobalPatchPoints_, i)
|
||||
// {
|
||||
// nonGlobalPatchPoints_[i] = i;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // Get reference to shared points
|
||||
// const labelList& sharedPoints =
|
||||
// boundaryMesh().globalPatch().meshPoints();
|
||||
//
|
||||
// nonGlobalPatchPoints_.setSize(meshPoints_.size());
|
||||
//
|
||||
// label noFiltPoints = 0;
|
||||
//
|
||||
// forAll (meshPoints_, pointI)
|
||||
// {
|
||||
// label curP = meshPoints_[pointI];
|
||||
//
|
||||
// bool found = false;
|
||||
//
|
||||
// forAll (sharedPoints, sharedI)
|
||||
// {
|
||||
// if (sharedPoints[sharedI] == curP)
|
||||
// {
|
||||
// found = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (!found)
|
||||
// {
|
||||
// nonGlobalPatchPoints_[noFiltPoints] = pointI;
|
||||
// meshPoints_[noFiltPoints] = curP;
|
||||
// noFiltPoints++;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// nonGlobalPatchPoints_.setSize(noFiltPoints);
|
||||
// meshPoints_.setSize(noFiltPoints);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//
|
||||
//void processorCyclicPointPatch::initPatchPatchPoints(PstreamBuffers& pBufs)
|
||||
//{
|
||||
// if (debug)
|
||||
// {
|
||||
// Info<< "processorCyclicPointPatch::initPatchPatchPoints(PstreamBuffers&) : "
|
||||
// << "constructing patch-patch points"
|
||||
// << endl;
|
||||
// }
|
||||
//
|
||||
// const polyBoundaryMesh& bm = boundaryMesh().mesh()().boundaryMesh();
|
||||
//
|
||||
// // Get the mesh points for this patch corresponding to the faces
|
||||
// const labelList& ppmp = meshPoints();
|
||||
//
|
||||
// // Create a HashSet of the point labels for this patch
|
||||
// Map<label> patchPointSet(2*ppmp.size());
|
||||
//
|
||||
// forAll (ppmp, ppi)
|
||||
// {
|
||||
// patchPointSet.insert(ppmp[ppi], ppi);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // Create the lists of patch-patch points
|
||||
// labelListList patchPatchPoints(bm.size());
|
||||
//
|
||||
// // Create the lists of patch-patch point normals
|
||||
// List<List<vector> > patchPatchPointNormals(bm.size());
|
||||
//
|
||||
// // Loop over all patches looking for other patches that share points
|
||||
// forAll(bm, patchi)
|
||||
// {
|
||||
// if
|
||||
// (
|
||||
// patchi != index() // Ignore self-self
|
||||
// && !isA<emptyPolyPatch>(bm[patchi]) // Ignore empty
|
||||
// && !bm[patchi].coupled() // Ignore other couples
|
||||
// )
|
||||
// {
|
||||
// // Get the meshPoints for the other patch
|
||||
// const labelList& meshPoints = bm[patchi].meshPoints();
|
||||
//
|
||||
// // Get the normals for the other patch
|
||||
// const vectorField& normals = bm[patchi].pointNormals();
|
||||
//
|
||||
// label pppi = 0;
|
||||
// forAll(meshPoints, pointi)
|
||||
// {
|
||||
// label ppp = meshPoints[pointi];
|
||||
//
|
||||
// // Check to see if the point of the other patch is shared with
|
||||
// // this patch
|
||||
// Map<label>::iterator iter = patchPointSet.find(ppp);
|
||||
//
|
||||
// if (iter != patchPointSet.end())
|
||||
// {
|
||||
// // If it is shared initialise the patchPatchPoints for this
|
||||
// // patch
|
||||
// if (!patchPatchPoints[patchi].size())
|
||||
// {
|
||||
// patchPatchPoints[patchi].setSize(ppmp.size());
|
||||
// patchPatchPointNormals[patchi].setSize(ppmp.size());
|
||||
// }
|
||||
//
|
||||
// // and add the entry
|
||||
// patchPatchPoints[patchi][pppi] = iter();
|
||||
// patchPatchPointNormals[patchi][pppi] = normals[pointi];
|
||||
// pppi++;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Resise the list of shared points and normals for the patch
|
||||
// // being considerd
|
||||
// patchPatchPoints[patchi].setSize(pppi);
|
||||
// patchPatchPointNormals[patchi].setSize(pppi);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Send the patchPatchPoints to the neighbouring processor
|
||||
//
|
||||
// UOPstream toNeighbProc(neighbProcNo(), pBufs);
|
||||
//
|
||||
// toNeighbProc
|
||||
// << ppmp.size() // number of points for checking
|
||||
// << patchPatchPoints
|
||||
// << patchPatchPointNormals;
|
||||
//
|
||||
// if (debug)
|
||||
// {
|
||||
// Info<< "processorCyclicPointPatch::initPatchPatchPoints() : "
|
||||
// << "constructed patch-patch points"
|
||||
// << endl;
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//
|
||||
//void Foam::processorCyclicPointPatch::calcPatchPatchPoints(PstreamBuffers& pBufs)
|
||||
//{
|
||||
// // Get the patchPatchPoints from the neighbouring processor
|
||||
// UIPstream fromNeighbProc(neighbProcNo(), pBufs);
|
||||
//
|
||||
// label nbrNPoints(readLabel(fromNeighbProc));
|
||||
// labelListList patchPatchPoints(fromNeighbProc);
|
||||
// List<List<vector> > patchPatchPointNormals(fromNeighbProc);
|
||||
//
|
||||
// pointBoundaryMesh& pbm = const_cast<pointBoundaryMesh&>(boundaryMesh());
|
||||
// const labelList& ppmp = meshPoints();
|
||||
//
|
||||
// // Simple check for the very rare situation when not the same number
|
||||
// // of points on both sides. This can happen with decomposed cyclics.
|
||||
// // If on one side the cyclic shares a point with proc faces coming from
|
||||
// // internal faces it will have a different number of points from
|
||||
// // the situation where the cyclic and the 'normal' proc faces are fully
|
||||
// // separate.
|
||||
// if (nbrNPoints != ppmp.size())
|
||||
// {
|
||||
// WarningIn("processorCyclicPointPatch::calcPatchPatchPoints(PstreamBuffers&)")
|
||||
// << "Processor patch " << name()
|
||||
// << " has " << ppmp.size() << " points; coupled patch has "
|
||||
// << nbrNPoints << " points." << endl
|
||||
// << " (usually due to decomposed cyclics)."
|
||||
// << " This might give problems" << endl
|
||||
// << " when using point fields (interpolation, mesh motion)."
|
||||
// << endl;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// // Loop over the patches looking for other patches that share points
|
||||
// forAll(patchPatchPoints, patchi)
|
||||
// {
|
||||
// const labelList& patchPoints = patchPatchPoints[patchi];
|
||||
// const List<vector>& patchPointNormals = patchPatchPointNormals[patchi];
|
||||
//
|
||||
// // If there are potentially shared points for the patch being considered
|
||||
// if (patchPoints.size())
|
||||
// {
|
||||
// // Get the current meshPoints list for the patch
|
||||
// facePointPatch& fpp = refCast<facePointPatch>(pbm[patchi]);
|
||||
// const labelList& fmp = fpp.meshPoints();
|
||||
// labelList& mp = fpp.meshPoints_;
|
||||
//
|
||||
// const vectorField& fnormals = fpp.pointNormals();
|
||||
// vectorField& normals = fpp.pointNormals_;
|
||||
//
|
||||
// // Create a HashSet of the point labels for the patch
|
||||
// Map<label> patchPointSet(2*fmp.size());
|
||||
//
|
||||
// forAll (fmp, ppi)
|
||||
// {
|
||||
// patchPointSet.insert(fmp[ppi], ppi);
|
||||
// }
|
||||
//
|
||||
// label nPoints = mp.size();
|
||||
// label lpi = 0;
|
||||
// bool resized = false;
|
||||
//
|
||||
// // For each potentially shared point...
|
||||
// forAll(patchPoints, ppi)
|
||||
// {
|
||||
// // Check if it is not already in the patch,
|
||||
// // i.e. not part of a face of the patch
|
||||
// if (!patchPointSet.found(ppmp[patchPoints[ppi]]))
|
||||
// {
|
||||
// // If it isn't already in the patch check if the local
|
||||
// // meshPoints is already set and if not initialise the
|
||||
// // meshPoints_ and pointNormals_
|
||||
// if (!resized)
|
||||
// {
|
||||
// if (!mp.size() && fmp.size())
|
||||
// {
|
||||
// mp = fmp;
|
||||
// normals = fnormals;
|
||||
//
|
||||
// nPoints = mp.size();
|
||||
// }
|
||||
//
|
||||
// mp.setSize(nPoints + patchPoints.size());
|
||||
// loneMeshPoints_.setSize(patchPoints.size());
|
||||
// normals.setSize(nPoints + patchPoints.size());
|
||||
// resized = true;
|
||||
// }
|
||||
//
|
||||
// // Add the new point to the patch
|
||||
// mp[nPoints] = ppmp[patchPoints[ppi]];
|
||||
// loneMeshPoints_[lpi++] = ppmp[patchPoints[ppi]];
|
||||
// normals[nPoints++] = patchPointNormals[ppi];
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // If the lists have been resized points have been added.
|
||||
// // Shrink the lists to the current size.
|
||||
// if (resized)
|
||||
// {
|
||||
// mp.setSize(nPoints);
|
||||
// loneMeshPoints_.setSize(lpi);
|
||||
// normals.setSize(nPoints);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
//void processorCyclicPointPatch::initMovePoints(PstreamBuffers&, const pointField&)
|
||||
//{}
|
||||
//
|
||||
//
|
||||
//void processorCyclicPointPatch::movePoints(PstreamBuffers&, const pointField&)
|
||||
//{}
|
||||
//
|
||||
//
|
||||
//void processorCyclicPointPatch::initUpdateMesh(PstreamBuffers& pBufs)
|
||||
//{
|
||||
// facePointPatch::initUpdateMesh(pBufs);
|
||||
// processorCyclicPointPatch::initGeometry(pBufs);
|
||||
//}
|
||||
//
|
||||
//
|
||||
//void processorCyclicPointPatch::updateMesh(PstreamBuffers& pBufs)
|
||||
//{
|
||||
// facePointPatch::updateMesh(pBufs);
|
||||
// processorCyclicPointPatch::calcGeometry(pBufs);
|
||||
//}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
processorCyclicPointPatch::processorCyclicPointPatch
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const pointBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
processorPointPatch(patch, bm)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
processorCyclicPointPatch::~processorCyclicPointPatch()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,146 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::processorCyclicPointPatch
|
||||
|
||||
Description
|
||||
Processor patch boundary needs to be such that the ordering of
|
||||
points in the patch is the same on both sides.
|
||||
|
||||
Looking at the creation of the faces on both sides of the processor
|
||||
patch they need to be identical on both sides with the normals pointing
|
||||
in opposite directions. This is achieved by calling the reverseFace
|
||||
function in the decomposition. It is therefore possible to re-create
|
||||
the ordering of patch points on the slave side by reversing all the
|
||||
patch faces of the owner.
|
||||
|
||||
SourceFiles
|
||||
processorCyclicPointPatch.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef processorCyclicPointPatch_H
|
||||
#define processorCyclicPointPatch_H
|
||||
|
||||
#include "processorPointPatch.H"
|
||||
#include "processorCyclicPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class processorCyclicPointPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class processorCyclicPointPatch
|
||||
:
|
||||
public processorPointPatch
|
||||
{
|
||||
|
||||
//- Disallow default construct as copy
|
||||
processorCyclicPointPatch(const processorCyclicPointPatch&);
|
||||
|
||||
//- Disallow default assignment
|
||||
void operator=(const processorCyclicPointPatch&);
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName(processorCyclicPolyPatch::typeName_());
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
processorCyclicPointPatch
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const pointBoundaryMesh& bm
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~processorCyclicPointPatch();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// //- Return true if running parallel
|
||||
// virtual bool coupled() const
|
||||
// {
|
||||
// if (Pstream::parRun())
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //- Return processor number
|
||||
// int myProcNo() const
|
||||
// {
|
||||
// return procPolyPatch_.myProcNo();
|
||||
// }
|
||||
//
|
||||
// //- Return neigbour processor number
|
||||
// int neighbProcNo() const
|
||||
// {
|
||||
// return procPolyPatch_.neighbProcNo();
|
||||
// }
|
||||
//
|
||||
// //- Is this a master patch
|
||||
// bool isMaster() const
|
||||
// {
|
||||
// return myProcNo() < neighbProcNo();
|
||||
// }
|
||||
//
|
||||
// //- Is this a slave patch
|
||||
// bool isSlave() const
|
||||
// {
|
||||
// return !isMaster();
|
||||
// }
|
||||
//
|
||||
// //- Return the underlying processorPolyPatch
|
||||
// const processorPolyPatch& procPolyPatch() const
|
||||
// {
|
||||
// return procPolyPatch_;
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -747,20 +747,10 @@ void Foam::globalMeshData::updateMesh()
|
||||
{
|
||||
label patchI = processorPatches_[i];
|
||||
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
|
||||
|
||||
if (Pstream::myProcNo() > procPatch.neighbProcNo())
|
||||
if (isType<processorPolyPatch>(mesh_.boundaryMesh()[patchI]))
|
||||
{
|
||||
forAll(procPatch.patchIDs(), i)
|
||||
{
|
||||
if (procPatch.patchIDs()[i] == -1)
|
||||
{
|
||||
// Normal, unseparated processor patch. Remove duplicates.
|
||||
label sz = procPatch.starts()[i+1]-procPatch.starts()[i];
|
||||
nTotalFaces_ -= sz;
|
||||
}
|
||||
}
|
||||
// Normal, unseparated processor patch. Remove duplicates.
|
||||
nTotalFaces_ -= mesh_.boundaryMesh()[patchI].size();
|
||||
}
|
||||
}
|
||||
reduce(nTotalFaces_, sumOp<label>());
|
||||
|
||||
@ -654,8 +654,6 @@ void Foam::polyMesh::resetPrimitives
|
||||
const Xfer<labelList>& neighbour,
|
||||
const labelList& patchSizes,
|
||||
const labelList& patchStarts,
|
||||
const labelListList& subPatches,
|
||||
const labelListList& subPatchStarts,
|
||||
const bool validBoundary
|
||||
)
|
||||
{
|
||||
@ -697,17 +695,6 @@ void Foam::polyMesh::resetPrimitives
|
||||
patchI,
|
||||
boundary_
|
||||
);
|
||||
|
||||
if (isA<processorPolyPatch>(boundary_[patchI]))
|
||||
{
|
||||
// Set the sub-patch information
|
||||
processorPolyPatch& ppp = refCast<processorPolyPatch>
|
||||
(
|
||||
boundary_[patchI]
|
||||
);
|
||||
const_cast<labelList&>(ppp.patchIDs()) = subPatches[patchI];
|
||||
const_cast<labelList&>(ppp.starts()) = subPatchStarts[patchI];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -731,8 +718,6 @@ void Foam::polyMesh::resetPrimitives
|
||||
" const Xfer<labelList>& neighbour,\n"
|
||||
" const labelList& patchSizes,\n"
|
||||
" const labelList& patchStarts\n"
|
||||
" const labelListList& subPatches,\n"
|
||||
" const labelListList& subPatchStarts,\n"
|
||||
" const bool validBoundary\n"
|
||||
")\n"
|
||||
) << "Face " << faceI << " contains vertex labels out of range: "
|
||||
@ -772,8 +757,6 @@ void Foam::polyMesh::resetPrimitives
|
||||
" const Xfer<labelList>& neighbour,\n"
|
||||
" const labelList& patchSizes,\n"
|
||||
" const labelList& patchStarts\n"
|
||||
" const labelListList& subPatches,\n"
|
||||
" const labelListList& subPatchStarts,\n"
|
||||
" const bool validBoundary\n"
|
||||
")\n"
|
||||
) << "no points or no cells in mesh" << endl;
|
||||
|
||||
@ -471,8 +471,6 @@ public:
|
||||
//- Reset mesh primitive data. Assumes all patch info correct
|
||||
// (so does e.g. parallel communication). If not use
|
||||
// validBoundary=false
|
||||
// (still assumes patchStarts[0] = nInternalFaces and last
|
||||
// patch ends at nActiveFaces) and change patches with addPatches.
|
||||
void resetPrimitives
|
||||
(
|
||||
const Xfer<pointField>& points,
|
||||
@ -481,8 +479,6 @@ public:
|
||||
const Xfer<labelList>& neighbour,
|
||||
const labelList& patchSizes,
|
||||
const labelList& patchStarts,
|
||||
const labelListList& subPatches,
|
||||
const labelListList& subPatchStarts,
|
||||
const bool validBoundary = true
|
||||
);
|
||||
|
||||
|
||||
@ -112,21 +112,21 @@ void Foam::coupledPolyPatch::writeOBJ
|
||||
}
|
||||
|
||||
|
||||
Foam::pointField Foam::coupledPolyPatch::calcFaceCentres
|
||||
(
|
||||
const UList<face>& faces,
|
||||
const pointField& points
|
||||
)
|
||||
{
|
||||
pointField ctrs(faces.size());
|
||||
|
||||
forAll(faces, faceI)
|
||||
{
|
||||
ctrs[faceI] = faces[faceI].centre(points);
|
||||
}
|
||||
|
||||
return ctrs;
|
||||
}
|
||||
//Foam::pointField Foam::coupledPolyPatch::calcFaceCentres
|
||||
//(
|
||||
// const UList<face>& faces,
|
||||
// const pointField& points
|
||||
//)
|
||||
//{
|
||||
// pointField ctrs(faces.size());
|
||||
//
|
||||
// forAll(faces, faceI)
|
||||
// {
|
||||
// ctrs[faceI] = faces[faceI].centre(points);
|
||||
// }
|
||||
//
|
||||
// return ctrs;
|
||||
//}
|
||||
|
||||
|
||||
Foam::pointField Foam::coupledPolyPatch::getAnchorPoints
|
||||
|
||||
@ -126,13 +126,6 @@ protected:
|
||||
label& vertI
|
||||
);
|
||||
|
||||
//- Calculate face centres
|
||||
static pointField calcFaceCentres
|
||||
(
|
||||
const UList<face>&,
|
||||
const pointField&
|
||||
);
|
||||
|
||||
//- Get f[0] for all faces
|
||||
static pointField getAnchorPoints
|
||||
(
|
||||
@ -242,8 +235,9 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
//- Transform a patch-based field.
|
||||
//- Transform a patch-based field from other side to this side.
|
||||
//!! TDB with macros?
|
||||
virtual bool doTransform() const;
|
||||
virtual void transform(scalarField& l) const = 0;
|
||||
virtual void transform(vectorField& l) const = 0;
|
||||
virtual void transform(sphericalTensorField& l) const = 0;
|
||||
@ -251,7 +245,7 @@ public:
|
||||
virtual void transform(symmTensorField& l) const = 0;
|
||||
virtual void transform(tensorField& l) const = 0;
|
||||
|
||||
//- Transform a patch-based position
|
||||
//- Transform a patch-based position from other side to this side
|
||||
virtual void transformPosition(pointField& l) const = 0;
|
||||
|
||||
// Low level geometric information
|
||||
@ -272,14 +266,14 @@ public:
|
||||
virtual const tensor& reverseT() const = 0;
|
||||
|
||||
|
||||
//- Initialise the calculation of the patch geometry
|
||||
virtual void initGeometry
|
||||
(
|
||||
const primitivePatch& referPatch,
|
||||
UList<point>& nbrCtrs,
|
||||
UList<point>& nbrAreas,
|
||||
UList<point>& nbrCc
|
||||
) = 0;
|
||||
// //- Initialise the calculation of the patch geometry
|
||||
// virtual void initGeometry
|
||||
// (
|
||||
// const primitivePatch& referPatch,
|
||||
// UList<point>& nbrCtrs,
|
||||
// UList<point>& nbrAreas,
|
||||
// UList<point>& nbrCc
|
||||
// ) = 0;
|
||||
|
||||
//- Calculate the patch geometry
|
||||
virtual void calcGeometry
|
||||
|
||||
@ -93,7 +93,7 @@ void Foam::cyclicPolyPatch::calcTransforms()
|
||||
|
||||
const cyclicPolyPatch& half0 = *this;
|
||||
|
||||
pointField half0Ctrs(calcFaceCentres(half0, half0.points()));
|
||||
const pointField& half0Ctrs = half0.faceCentres();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -118,7 +118,7 @@ void Foam::cyclicPolyPatch::calcTransforms()
|
||||
|
||||
const cyclicPolyPatch& half1 = neighbPatch();
|
||||
|
||||
pointField half1Ctrs(calcFaceCentres(half1, half1.points()));
|
||||
const pointField& half1Ctrs = half1.faceCentres();
|
||||
|
||||
// Dump halves
|
||||
if (debug)
|
||||
@ -282,9 +282,9 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
|
||||
) const
|
||||
{
|
||||
// Get geometric data on both halves.
|
||||
half0Ctrs = calcFaceCentres(pp0, pp0.points());
|
||||
half0Ctrs = pp0.faceCentres();
|
||||
anchors0 = getAnchorPoints(pp0, pp0.points());
|
||||
half1Ctrs = calcFaceCentres(pp1, pp1.points());
|
||||
half1Ctrs = pp1.faceCentres();
|
||||
|
||||
switch (transform_)
|
||||
{
|
||||
@ -585,13 +585,14 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
|
||||
)
|
||||
:
|
||||
coupledPolyPatch(pp, bm, index, mapAddressing, newStart),
|
||||
coupledPointsPtr_(NULL),
|
||||
coupledEdgesPtr_(NULL),
|
||||
featureCos_(pp.featureCos_),
|
||||
neighbPatchName_(pp.neighbPatchName_),
|
||||
neighbPatchID_(-1),
|
||||
transform_(pp.transform_),
|
||||
rotationAxis_(pp.rotationAxis_),
|
||||
rotationCentre_(pp.rotationCentre_),
|
||||
separationVector_(pp.separationVector_)
|
||||
separationVector_(pp.separationVector_),
|
||||
coupledPointsPtr_(NULL),
|
||||
coupledEdgesPtr_(NULL)
|
||||
{}
|
||||
|
||||
|
||||
@ -611,11 +612,11 @@ void Foam::cyclicPolyPatch::transformPosition(pointField& l) const
|
||||
{
|
||||
if (!parallel())
|
||||
{
|
||||
Foam::transform(reverseT_, l);
|
||||
Foam::transform(forwardT_, l);
|
||||
}
|
||||
else if (separated())
|
||||
{
|
||||
l += separation_;
|
||||
l -= separation_;
|
||||
}
|
||||
}
|
||||
|
||||
@ -647,7 +648,7 @@ void Foam::cyclicPolyPatch::calcGeometry
|
||||
const UList<point>& nbrCc
|
||||
)
|
||||
{
|
||||
polyPatch::calcGeometry();
|
||||
//polyPatch::calcGeometry();
|
||||
|
||||
Pout<< "cyclicPolyPatch::calcGeometry : name:" << name()
|
||||
<< " referred from:" << referPatch.size() << endl;
|
||||
|
||||
@ -48,8 +48,6 @@ SourceFiles
|
||||
#define cyclicPolyPatch_H
|
||||
|
||||
#include "coupledPolyPatch.H"
|
||||
//#include "SubField.H"
|
||||
//#include "FixedList.H"
|
||||
#include "edgeList.H"
|
||||
//#include "transform.H"
|
||||
#include "polyBoundaryMesh.H"
|
||||
@ -373,16 +371,21 @@ public:
|
||||
// calculation!
|
||||
const edgeList& coupledEdges() const;
|
||||
|
||||
//- Transform a patch-based field on this side to a field on the
|
||||
// other side.
|
||||
//- Transform a patch-based field from other side to this side.
|
||||
template<class T>
|
||||
void transform(Field<T>& l) const
|
||||
{
|
||||
if (!parallel())
|
||||
{
|
||||
transform(reverseT_, l);
|
||||
transform(forwardT_, l);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual bool doTransform() const
|
||||
{
|
||||
return !parallel();
|
||||
}
|
||||
virtual void transform(scalarField& l) const
|
||||
{
|
||||
transform(l);
|
||||
@ -408,8 +411,7 @@ public:
|
||||
transform(l);
|
||||
}
|
||||
|
||||
//- Transform a patch-based position on this side to a position
|
||||
// the other side.
|
||||
//- Transform a patch-based position from other side to this side
|
||||
virtual void transformPosition(pointField& l) const;
|
||||
|
||||
|
||||
|
||||
@ -45,46 +45,6 @@ namespace Foam
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::processorPolyPatch::checkSubPatches() const
|
||||
{
|
||||
if (starts_.size() != patchIDs_.size()+1)
|
||||
{
|
||||
FatalErrorIn("processorPolyPatch::checkPatches() const")
|
||||
<< "starts should have one more element than patchIDs." << endl
|
||||
<< "starts:" << starts_ << " patchIDs:" << patchIDs_
|
||||
<< exit(FatalError);
|
||||
}
|
||||
if (starts_[0] != 0)
|
||||
{
|
||||
FatalErrorIn("processorPolyPatch::checkPatches() const")
|
||||
<< "starts[0] should be 0." << endl
|
||||
<< "starts:" << starts_ << " patchIDs:" << patchIDs_
|
||||
<< exit(FatalError);
|
||||
}
|
||||
if (starts_[starts_.size()-1] != size())
|
||||
{
|
||||
FatalErrorIn("processorPolyPatch::checkPatches() const")
|
||||
<< "Last element in starts should be the size." << endl
|
||||
<< "starts:" << starts_ << " size:" << size()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
// If there are any faces from internal they should be first.
|
||||
for (label i = 1; i < patchIDs_.size(); i++)
|
||||
{
|
||||
if (patchIDs_[i] == -1)
|
||||
{
|
||||
FatalErrorIn("processorPolyPatch::checkPatches() const")
|
||||
<< "Faces originating from internal faces (subPatch is -1)"
|
||||
<< " should always be first in the patch."
|
||||
<< " The current list of subpatches " << patchIDs_
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::processorPolyPatch::processorPolyPatch
|
||||
@ -95,24 +55,18 @@ Foam::processorPolyPatch::processorPolyPatch
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const int myProcNo,
|
||||
const int neighbProcNo,
|
||||
const labelList& patchIDs,
|
||||
const labelList& starts
|
||||
const int neighbProcNo
|
||||
)
|
||||
:
|
||||
coupledPolyPatch(name, size, start, index, bm),
|
||||
myProcNo_(myProcNo),
|
||||
neighbProcNo_(neighbProcNo),
|
||||
patchIDs_(patchIDs),
|
||||
starts_(starts),
|
||||
neighbFaceCentres_(),
|
||||
neighbFaceAreas_(),
|
||||
neighbFaceCellCentres_()
|
||||
// neighbPointsPtr_(NULL),
|
||||
// neighbEdgesPtr_(NULL)
|
||||
{
|
||||
checkSubPatches();
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
Foam::processorPolyPatch::processorPolyPatch
|
||||
@ -126,16 +80,12 @@ Foam::processorPolyPatch::processorPolyPatch
|
||||
coupledPolyPatch(name, dict, index, bm),
|
||||
myProcNo_(readLabel(dict.lookup("myProcNo"))),
|
||||
neighbProcNo_(readLabel(dict.lookup("neighbProcNo"))),
|
||||
patchIDs_(dict.lookup("patchIDs")),
|
||||
starts_(dict.lookup("starts")),
|
||||
neighbFaceCentres_(),
|
||||
neighbFaceAreas_(),
|
||||
neighbFaceCellCentres_()
|
||||
// neighbPointsPtr_(NULL),
|
||||
// neighbEdgesPtr_(NULL)
|
||||
{
|
||||
checkSubPatches();
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
Foam::processorPolyPatch::processorPolyPatch
|
||||
@ -147,8 +97,6 @@ Foam::processorPolyPatch::processorPolyPatch
|
||||
coupledPolyPatch(pp, bm),
|
||||
myProcNo_(pp.myProcNo_),
|
||||
neighbProcNo_(pp.neighbProcNo_),
|
||||
patchIDs_(pp.patchIDs_),
|
||||
starts_(pp.starts_),
|
||||
neighbFaceCentres_(),
|
||||
neighbFaceAreas_(),
|
||||
neighbFaceCellCentres_()
|
||||
@ -163,24 +111,18 @@ Foam::processorPolyPatch::processorPolyPatch
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const label newSize,
|
||||
const label newStart,
|
||||
const labelList& patchIDs,
|
||||
const labelList& starts
|
||||
const label newStart
|
||||
)
|
||||
:
|
||||
coupledPolyPatch(pp, bm, index, newSize, newStart),
|
||||
myProcNo_(pp.myProcNo_),
|
||||
neighbProcNo_(pp.neighbProcNo_),
|
||||
patchIDs_(patchIDs),
|
||||
starts_(starts),
|
||||
neighbFaceCentres_(),
|
||||
neighbFaceAreas_(),
|
||||
neighbFaceCellCentres_()
|
||||
// neighbPointsPtr_(NULL),
|
||||
// neighbEdgesPtr_(NULL)
|
||||
{
|
||||
checkSubPatches();
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
Foam::processorPolyPatch::processorPolyPatch
|
||||
@ -188,7 +130,7 @@ Foam::processorPolyPatch::processorPolyPatch
|
||||
const processorPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const unallocLabelList& mapAddressing,
|
||||
const unallocLabelList& mapAddressing,
|
||||
const label newStart
|
||||
)
|
||||
:
|
||||
@ -197,9 +139,9 @@ Foam::processorPolyPatch::processorPolyPatch
|
||||
neighbProcNo_(pp.neighbProcNo_),
|
||||
neighbFaceCentres_(),
|
||||
neighbFaceAreas_(),
|
||||
neighbFaceCellCentres_(),
|
||||
neighbPointsPtr_(NULL),
|
||||
neighbEdgesPtr_(NULL)
|
||||
neighbFaceCellCentres_()
|
||||
// neighbPointsPtr_(NULL),
|
||||
// neighbEdgesPtr_(NULL)
|
||||
{}
|
||||
|
||||
|
||||
@ -207,90 +149,24 @@ Foam::processorPolyPatch::processorPolyPatch
|
||||
|
||||
Foam::processorPolyPatch::~processorPolyPatch()
|
||||
{
|
||||
// deleteDemandDrivenData(neighbPointsPtr_);
|
||||
// deleteDemandDrivenData(neighbEdgesPtr_);
|
||||
neighbPointsPtr_.clear();
|
||||
neighbEdgesPtr_.clear();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::processorPolyPatch::transformPosition(pointField& l) const
|
||||
{
|
||||
if (l.size() != size())
|
||||
{
|
||||
FatalErrorIn("processorPolyPatch::transformPosition(pointField&) const")
|
||||
<< "Size of field " << l.size() << " differs from patch size "
|
||||
<< size() << abort(FatalError);
|
||||
}
|
||||
|
||||
forAll(patchIDs_, subI)
|
||||
{
|
||||
label patchI = patchIDs_[subI];
|
||||
|
||||
if (patchI != -1)
|
||||
{
|
||||
// Get field on patch
|
||||
SubField<point> subFld(subSlice(l, subI));
|
||||
|
||||
refCast<const coupledPolyPatch>
|
||||
(
|
||||
boundaryMesh()[patchI]
|
||||
).transformPosition(reinterpret_cast<pointField&>(subFld));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::processorPolyPatch::initGeometry(PstreamBuffers& pBufs)
|
||||
{
|
||||
Pout<< "**processorPolyPatch::initGeometry()" << endl;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
pointField fc(size());
|
||||
vectorField fa(size());
|
||||
pointField cc(size());
|
||||
|
||||
forAll(patchIDs_, i)
|
||||
{
|
||||
label patchI = patchIDs_[i];
|
||||
|
||||
autoPtr<primitivePatch> subPp = subPatch(i);
|
||||
|
||||
SubField<point> subFc(subSlice(fc, i));
|
||||
SubField<vector> subFa(subSlice(fa, i));
|
||||
SubField<point> subCc(subSlice(cc, i));
|
||||
|
||||
subFc.assign(subSlice(faceCentres(), i));
|
||||
subFa.assign(subSlice(faceAreas(), i));
|
||||
subCc.assign(subSlice(faceCellCentres()(), i));
|
||||
|
||||
if (patchI != -1)
|
||||
{
|
||||
coupledPolyPatch& pp = const_cast<coupledPolyPatch&>
|
||||
(
|
||||
refCast<const coupledPolyPatch>
|
||||
(
|
||||
boundaryMesh()[patchI]
|
||||
)
|
||||
);
|
||||
|
||||
Pout<< name() << " calling initGeometry on " << pp.name()
|
||||
<< endl;
|
||||
|
||||
pp.initGeometry(subPp, subFc, subFa, subCc);
|
||||
|
||||
Pout<< name() << " from patchI:" << patchI
|
||||
<< " calculated fc:" << subFc
|
||||
<< " fa:" << subFa << " subCC:" << subCc << endl;
|
||||
Pout<< name() << " fc:" << fc << endl;
|
||||
}
|
||||
}
|
||||
|
||||
Pout<< name() << " fc:" << fc << " fa:" << fa << " cc:" << cc << endl;
|
||||
|
||||
UOPstream toNeighbProc(neighbProcNo(), pBufs);
|
||||
|
||||
toNeighbProc << fc << fa << cc;
|
||||
toNeighbProc
|
||||
<< faceCentres()
|
||||
<< faceAreas()
|
||||
<< faceCellCentres();
|
||||
}
|
||||
}
|
||||
|
||||
@ -312,41 +188,16 @@ Pout<< "processorPolyPatch::calcGeometry() for " << name() << endl;
|
||||
Pout<< "processorPolyPatch::calcGeometry() : received data for "
|
||||
<< neighbFaceCentres_.size() << " faces." << endl;
|
||||
|
||||
forAll(patchIDs_, i)
|
||||
{
|
||||
label patchI = patchIDs_[i];
|
||||
|
||||
if (patchI == -1)
|
||||
{
|
||||
// Anything needs doing for ex-internal faces?
|
||||
}
|
||||
else
|
||||
{
|
||||
coupledPolyPatch& pp = const_cast<coupledPolyPatch&>
|
||||
(
|
||||
refCast<const coupledPolyPatch>
|
||||
(
|
||||
boundaryMesh()[patchI]
|
||||
)
|
||||
);
|
||||
|
||||
Pout<< "processorPolyPatch::calcGeometry() : referring to " << pp.name()
|
||||
<< " for faces size:" << starts_[i+1]-starts_[i]
|
||||
<< " start:" << starts_[i]
|
||||
<< endl;
|
||||
|
||||
pp.calcGeometry
|
||||
(
|
||||
subPatch(i),
|
||||
subSlice(faceCentres(), i),
|
||||
subSlice(faceAreas(), i),
|
||||
subSlice(faceCellCentres()(), i),
|
||||
subSlice(neighbFaceCentres_, i),
|
||||
subSlice(neighbFaceAreas_, i),
|
||||
subSlice(neighbFaceCellCentres_, i)
|
||||
);
|
||||
}
|
||||
}
|
||||
calcGeometry
|
||||
(
|
||||
*this,
|
||||
faceCentres(),
|
||||
faceAreas(),
|
||||
faceCellCentres()(),
|
||||
neighbFaceCentres_,
|
||||
neighbFaceAreas_,
|
||||
neighbFaceCellCentres_
|
||||
);
|
||||
}
|
||||
Pout<< "**neighbFaceCentres_:" << neighbFaceCentres_ << endl;
|
||||
Pout<< "**neighbFaceAreas_:" << neighbFaceAreas_ << endl;
|
||||
@ -380,56 +231,46 @@ void Foam::processorPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
|
||||
{
|
||||
polyPatch::initUpdateMesh(pBufs);
|
||||
|
||||
// deleteDemandDrivenData(neighbPointsPtr_);
|
||||
// deleteDemandDrivenData(neighbEdgesPtr_);
|
||||
//
|
||||
// if (Pstream::parRun())
|
||||
// {
|
||||
// // Express all points as patch face and index in face.
|
||||
// labelList pointFace(nPoints());
|
||||
// labelList pointIndex(nPoints());
|
||||
//
|
||||
// for (label patchPointI = 0; patchPointI < nPoints(); patchPointI++)
|
||||
// {
|
||||
// label faceI = pointFaces()[patchPointI][0];
|
||||
//
|
||||
// pointFace[patchPointI] = faceI;
|
||||
//
|
||||
// const face& f = localFaces()[faceI];
|
||||
//
|
||||
// pointIndex[patchPointI] = findIndex(f, patchPointI);
|
||||
// }
|
||||
//
|
||||
// // Express all edges as patch face and index in face.
|
||||
// labelList edgeFace(nEdges());
|
||||
// labelList edgeIndex(nEdges());
|
||||
//
|
||||
// for (label patchEdgeI = 0; patchEdgeI < nEdges(); patchEdgeI++)
|
||||
// {
|
||||
// label faceI = edgeFaces()[patchEdgeI][0];
|
||||
//
|
||||
// edgeFace[patchEdgeI] = faceI;
|
||||
//
|
||||
// const labelList& fEdges = faceEdges()[faceI];
|
||||
//
|
||||
// edgeIndex[patchEdgeI] = findIndex(fEdges, patchEdgeI);
|
||||
// }
|
||||
//
|
||||
// OPstream toNeighbProc
|
||||
// (
|
||||
// Pstream::blocking,
|
||||
// neighbProcNo(),
|
||||
// 8*sizeof(label) // four headers of labelList
|
||||
// + 2*nPoints()*sizeof(label) // two point-based labellists
|
||||
// + 2*nEdges()*sizeof(label) // two edge-based labelLists
|
||||
// );
|
||||
//
|
||||
// toNeighbProc
|
||||
// << pointFace
|
||||
// << pointIndex
|
||||
// << edgeFace
|
||||
// << edgeIndex;
|
||||
// }
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Express all points as patch face and index in face.
|
||||
labelList pointFace(nPoints());
|
||||
labelList pointIndex(nPoints());
|
||||
|
||||
for (label patchPointI = 0; patchPointI < nPoints(); patchPointI++)
|
||||
{
|
||||
label faceI = pointFaces()[patchPointI][0];
|
||||
|
||||
pointFace[patchPointI] = faceI;
|
||||
|
||||
const face& f = localFaces()[faceI];
|
||||
|
||||
pointIndex[patchPointI] = findIndex(f, patchPointI);
|
||||
}
|
||||
|
||||
// Express all edges as patch face and index in face.
|
||||
labelList edgeFace(nEdges());
|
||||
labelList edgeIndex(nEdges());
|
||||
|
||||
for (label patchEdgeI = 0; patchEdgeI < nEdges(); patchEdgeI++)
|
||||
{
|
||||
label faceI = edgeFaces()[patchEdgeI][0];
|
||||
|
||||
edgeFace[patchEdgeI] = faceI;
|
||||
|
||||
const labelList& fEdges = faceEdges()[faceI];
|
||||
|
||||
edgeIndex[patchEdgeI] = findIndex(fEdges, patchEdgeI);
|
||||
}
|
||||
|
||||
UOPstream toNeighbProc(neighbProcNo(), pBufs);
|
||||
|
||||
toNeighbProc
|
||||
<< pointFace
|
||||
<< pointIndex
|
||||
<< edgeFace
|
||||
<< edgeIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -438,187 +279,126 @@ void Foam::processorPolyPatch::updateMesh(PstreamBuffers& pBufs)
|
||||
// For completeness
|
||||
polyPatch::updateMesh(pBufs);
|
||||
|
||||
// if (Pstream::parRun())
|
||||
// {
|
||||
// labelList nbrPointFace;
|
||||
// labelList nbrPointIndex;
|
||||
// labelList nbrEdgeFace;
|
||||
// labelList nbrEdgeIndex;
|
||||
//
|
||||
// {
|
||||
// // Note cannot predict exact size since opposite nPoints might
|
||||
// // be different from one over here.
|
||||
// IPstream fromNeighbProc(Pstream::blocking, neighbProcNo());
|
||||
//
|
||||
// fromNeighbProc
|
||||
// >> nbrPointFace
|
||||
// >> nbrPointIndex
|
||||
// >> nbrEdgeFace
|
||||
// >> nbrEdgeIndex;
|
||||
// }
|
||||
//
|
||||
// // Convert neighbour faces and indices into face back into
|
||||
// // my edges and points.
|
||||
//
|
||||
// // Convert points.
|
||||
// // ~~~~~~~~~~~~~~~
|
||||
//
|
||||
// neighbPointsPtr_ = new labelList(nPoints(), -1);
|
||||
// labelList& neighbPoints = *neighbPointsPtr_;
|
||||
//
|
||||
// forAll(nbrPointFace, nbrPointI)
|
||||
// {
|
||||
// // Find face and index in face on this side.
|
||||
// const face& f = localFaces()[nbrPointFace[nbrPointI]];
|
||||
// label index = (f.size() - nbrPointIndex[nbrPointI]) % f.size();
|
||||
// label patchPointI = f[index];
|
||||
//
|
||||
// if (neighbPoints[patchPointI] == -1)
|
||||
// {
|
||||
// // First reference of point
|
||||
// neighbPoints[patchPointI] = nbrPointI;
|
||||
// }
|
||||
// else if (neighbPoints[patchPointI] >= 0)
|
||||
// {
|
||||
// // Point already visited. Mark as duplicate.
|
||||
// neighbPoints[patchPointI] = -2;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Reset all duplicate entries to -1.
|
||||
// forAll(neighbPoints, patchPointI)
|
||||
// {
|
||||
// if (neighbPoints[patchPointI] == -2)
|
||||
// {
|
||||
// neighbPoints[patchPointI] = -1;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Convert edges.
|
||||
// // ~~~~~~~~~~~~~~
|
||||
//
|
||||
// neighbEdgesPtr_ = new labelList(nEdges(), -1);
|
||||
// labelList& neighbEdges = *neighbEdgesPtr_;
|
||||
//
|
||||
// forAll(nbrEdgeFace, nbrEdgeI)
|
||||
// {
|
||||
// // Find face and index in face on this side.
|
||||
// const labelList& f = faceEdges()[nbrEdgeFace[nbrEdgeI]];
|
||||
// label index = (f.size() - nbrEdgeIndex[nbrEdgeI] - 1) % f.size();
|
||||
// label patchEdgeI = f[index];
|
||||
//
|
||||
// if (neighbEdges[patchEdgeI] == -1)
|
||||
// {
|
||||
// // First reference of edge
|
||||
// neighbEdges[patchEdgeI] = nbrEdgeI;
|
||||
// }
|
||||
// else if (neighbEdges[patchEdgeI] >= 0)
|
||||
// {
|
||||
// // Edge already visited. Mark as duplicate.
|
||||
// neighbEdges[patchEdgeI] = -2;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Reset all duplicate entries to -1.
|
||||
// forAll(neighbEdges, patchEdgeI)
|
||||
// {
|
||||
// if (neighbEdges[patchEdgeI] == -2)
|
||||
// {
|
||||
// neighbEdges[patchEdgeI] = -1;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Remove any addressing used for shared points/edges calculation
|
||||
// primitivePatch::clearOut();
|
||||
// }
|
||||
}
|
||||
neighbPointsPtr_.clear();
|
||||
neighbEdgesPtr_.clear();
|
||||
|
||||
|
||||
//const Foam::labelList& Foam::processorPolyPatch::neighbPoints() const
|
||||
//{
|
||||
// if (!neighbPointsPtr_)
|
||||
// {
|
||||
// FatalErrorIn("processorPolyPatch::neighbPoints() const")
|
||||
// << "No extended addressing calculated for patch " << name()
|
||||
// << abort(FatalError);
|
||||
// }
|
||||
// return *neighbPointsPtr_;
|
||||
//}
|
||||
//
|
||||
//
|
||||
//const Foam::labelList& Foam::processorPolyPatch::neighbEdges() const
|
||||
//{
|
||||
// if (!neighbEdgesPtr_)
|
||||
// {
|
||||
// FatalErrorIn("processorPolyPatch::neighbEdges() const")
|
||||
// << "No extended addressing calculated for patch " << name()
|
||||
// << abort(FatalError);
|
||||
// }
|
||||
// return *neighbEdgesPtr_;
|
||||
//}
|
||||
|
||||
|
||||
const Foam::labelListList& Foam::processorPolyPatch::subMeshPoints() const
|
||||
{
|
||||
if (!subMeshPointsPtr_.valid())
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
subMeshPointsPtr_.reset(new labelListList(patchIDs_.size()));
|
||||
labelListList& meshPoints = subMeshPointsPtr_();
|
||||
labelList nbrPointFace;
|
||||
labelList nbrPointIndex;
|
||||
labelList nbrEdgeFace;
|
||||
labelList nbrEdgeIndex;
|
||||
|
||||
forAll(patchIDs_, subI)
|
||||
{
|
||||
meshPoints[subI] = subPatch(subI)().meshPoints();
|
||||
// Note cannot predict exact size since opposite nPoints might
|
||||
// be different from one over here.
|
||||
IPstream fromNeighbProc(Pstream::blocking, neighbProcNo());
|
||||
|
||||
fromNeighbProc
|
||||
>> nbrPointFace
|
||||
>> nbrPointIndex
|
||||
>> nbrEdgeFace
|
||||
>> nbrEdgeIndex;
|
||||
}
|
||||
}
|
||||
return subMeshPointsPtr_();
|
||||
}
|
||||
|
||||
// Convert neighbour faces and indices into face back into
|
||||
// my edges and points.
|
||||
|
||||
const Foam::labelListList& Foam::processorPolyPatch::reverseSubMeshPoints()
|
||||
const
|
||||
{
|
||||
if (!reverseSubMeshPointsPtr_.valid())
|
||||
{
|
||||
reverseSubMeshPointsPtr_.reset(new labelListList(patchIDs_.size()));
|
||||
labelListList& meshPoints = reverseSubMeshPointsPtr_();
|
||||
// Convert points.
|
||||
// ~~~~~~~~~~~~~~~
|
||||
|
||||
forAll(patchIDs_, subI)
|
||||
neighbPointsPtr_.reset(new labelList(nPoints(), -1));
|
||||
labelList& neighbPoints = neighbPointsPtr_();
|
||||
|
||||
forAll(nbrPointFace, nbrPointI)
|
||||
{
|
||||
label subStart = starts()[subI];
|
||||
label subSize = starts()[subI+1]-subStart;
|
||||
// Find face and index in face on this side.
|
||||
const face& f = localFaces()[nbrPointFace[nbrPointI]];
|
||||
label index = (f.size() - nbrPointIndex[nbrPointI]) % f.size();
|
||||
label patchPointI = f[index];
|
||||
|
||||
faceList reverseFaces(subSize);
|
||||
forAll(reverseFaces, i)
|
||||
if (neighbPoints[patchPointI] == -1)
|
||||
{
|
||||
reverseFaces[i] = operator[](subStart+i).reverseFace();
|
||||
// First reference of point
|
||||
neighbPoints[patchPointI] = nbrPointI;
|
||||
}
|
||||
else if (neighbPoints[patchPointI] >= 0)
|
||||
{
|
||||
// Point already visited. Mark as duplicate.
|
||||
neighbPoints[patchPointI] = -2;
|
||||
}
|
||||
meshPoints[subI] = primitivePatch
|
||||
(
|
||||
faceSubList
|
||||
(
|
||||
reverseFaces,
|
||||
reverseFaces.size()
|
||||
),
|
||||
points()
|
||||
).meshPoints();
|
||||
}
|
||||
|
||||
// Reset all duplicate entries to -1.
|
||||
forAll(neighbPoints, patchPointI)
|
||||
{
|
||||
if (neighbPoints[patchPointI] == -2)
|
||||
{
|
||||
neighbPoints[patchPointI] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert edges.
|
||||
// ~~~~~~~~~~~~~~
|
||||
|
||||
neighbEdgesPtr_.reset(new labelList(nEdges(), -1));
|
||||
labelList& neighbEdges = neighbEdgesPtr_();
|
||||
|
||||
forAll(nbrEdgeFace, nbrEdgeI)
|
||||
{
|
||||
// Find face and index in face on this side.
|
||||
const labelList& f = faceEdges()[nbrEdgeFace[nbrEdgeI]];
|
||||
label index = (f.size() - nbrEdgeIndex[nbrEdgeI] - 1) % f.size();
|
||||
label patchEdgeI = f[index];
|
||||
|
||||
if (neighbEdges[patchEdgeI] == -1)
|
||||
{
|
||||
// First reference of edge
|
||||
neighbEdges[patchEdgeI] = nbrEdgeI;
|
||||
}
|
||||
else if (neighbEdges[patchEdgeI] >= 0)
|
||||
{
|
||||
// Edge already visited. Mark as duplicate.
|
||||
neighbEdges[patchEdgeI] = -2;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset all duplicate entries to -1.
|
||||
forAll(neighbEdges, patchEdgeI)
|
||||
{
|
||||
if (neighbEdges[patchEdgeI] == -2)
|
||||
{
|
||||
neighbEdges[patchEdgeI] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any addressing used for shared points/edges calculation
|
||||
primitivePatch::clearOut();
|
||||
}
|
||||
return reverseSubMeshPointsPtr_();
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::processorPolyPatch::whichSubPatch(const label facei) const
|
||||
const Foam::labelList& Foam::processorPolyPatch::neighbPoints() const
|
||||
{
|
||||
label index = findSortedIndex(starts_, facei);
|
||||
|
||||
if (index < 0 || index >= starts_.size())
|
||||
if (!neighbPointsPtr_.valid())
|
||||
{
|
||||
FatalErrorIn("processorPolyPatch::whichSubPatch(const label) const")
|
||||
<< "Illegal local face index " << facei << " for patch " << name()
|
||||
<< endl << "Face index should be between 0 and "
|
||||
<< starts_[starts_.size()-1]-1 << abort(FatalError);
|
||||
FatalErrorIn("processorPolyPatch::neighbPoints() const")
|
||||
<< "No extended addressing calculated for patch " << name()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
return patchIDs_[index];
|
||||
return neighbPointsPtr_();
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelList& Foam::processorPolyPatch::neighbEdges() const
|
||||
{
|
||||
if (!neighbEdgesPtr_.valid())
|
||||
{
|
||||
FatalErrorIn("processorPolyPatch::neighbEdges() const")
|
||||
<< "No extended addressing calculated for patch " << name()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
return neighbEdgesPtr_();
|
||||
}
|
||||
|
||||
|
||||
@ -645,7 +425,7 @@ void Foam::processorPolyPatch::initOrder
|
||||
writeOBJ(nm, pp, pp.points());
|
||||
|
||||
// Calculate my face centres
|
||||
pointField ctrs(calcFaceCentres(pp, pp.points()));
|
||||
const pointField& fc = pp.faceCentres();
|
||||
|
||||
OFstream localStr
|
||||
(
|
||||
@ -653,24 +433,22 @@ void Foam::processorPolyPatch::initOrder
|
||||
/name() + "_localFaceCentres.obj"
|
||||
);
|
||||
Pout<< "processorPolyPatch::order : "
|
||||
<< "Dumping " << ctrs.size()
|
||||
<< "Dumping " << fc.size()
|
||||
<< " local faceCentres to " << localStr.name() << endl;
|
||||
|
||||
forAll(ctrs, faceI)
|
||||
forAll(fc, faceI)
|
||||
{
|
||||
writeOBJ(localStr, ctrs[faceI]);
|
||||
writeOBJ(localStr, fc[faceI]);
|
||||
}
|
||||
}
|
||||
|
||||
if (owner())
|
||||
{
|
||||
pointField ctrs(calcFaceCentres(pp, pp.points()));
|
||||
|
||||
pointField anchors(getAnchorPoints(pp, pp.points()));
|
||||
|
||||
// Now send all info over to the neighbour
|
||||
UOPstream toNeighbour(neighbProcNo(), pBufs);
|
||||
toNeighbour << ctrs << anchors;
|
||||
toNeighbour << pp.faceCentres() << anchors;
|
||||
}
|
||||
}
|
||||
|
||||
@ -722,11 +500,8 @@ bool Foam::processorPolyPatch::order
|
||||
fromNeighbour >> masterCtrs >> masterAnchors;
|
||||
}
|
||||
|
||||
// Calculate my face centres
|
||||
pointField ctrs(calcFaceCentres(pp, pp.points()));
|
||||
|
||||
// Calculate typical distance from face centre
|
||||
scalarField tols(calcFaceTol(pp, pp.points(), ctrs));
|
||||
scalarField tols(calcFaceTol(pp, pp.points(), pp.faceCentres()));
|
||||
|
||||
if (debug || masterCtrs.size() != pp.size())
|
||||
{
|
||||
@ -764,7 +539,14 @@ bool Foam::processorPolyPatch::order
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// 1. Try existing ordering and transformation
|
||||
bool matchedAll = matchPoints(ctrs, masterCtrs, tols, true, faceMap);
|
||||
bool matchedAll = matchPoints
|
||||
(
|
||||
pp.faceCentres(),
|
||||
masterCtrs,
|
||||
tols,
|
||||
true,
|
||||
faceMap
|
||||
);
|
||||
|
||||
if (!matchedAll || debug)
|
||||
{
|
||||
@ -791,14 +573,14 @@ bool Foam::processorPolyPatch::order
|
||||
|
||||
label vertI = 0;
|
||||
|
||||
forAll(ctrs, faceI)
|
||||
forAll(pp.faceCentres(), faceI)
|
||||
{
|
||||
label masterFaceI = faceMap[faceI];
|
||||
|
||||
if (masterFaceI != -1)
|
||||
{
|
||||
const point& c0 = masterCtrs[masterFaceI];
|
||||
const point& c1 = ctrs[faceI];
|
||||
const point& c1 = pp.faceCentres()[faceI];
|
||||
writeOBJ(ccStr, c0, c1, vertI);
|
||||
}
|
||||
}
|
||||
@ -814,7 +596,7 @@ bool Foam::processorPolyPatch::order
|
||||
<< "Cannot match vectors to faces on both sides of patch"
|
||||
<< endl
|
||||
<< " masterCtrs[0]:" << masterCtrs[0] << endl
|
||||
<< " ctrs[0]:" << ctrs[0] << endl
|
||||
<< " ctrs[0]:" << pp.faceCentres()[0] << endl
|
||||
<< " Please check your topology changes or maybe you have"
|
||||
<< " multiple separated (from cyclics) processor patches"
|
||||
<< endl
|
||||
@ -883,10 +665,6 @@ void Foam::processorPolyPatch::write(Ostream& os) const
|
||||
<< token::END_STATEMENT << nl;
|
||||
os.writeKeyword("neighbProcNo") << neighbProcNo_
|
||||
<< token::END_STATEMENT << nl;
|
||||
os.writeKeyword("patchIDs") << patchIDs_
|
||||
<< token::END_STATEMENT << nl;
|
||||
os.writeKeyword("starts") << starts_
|
||||
<< token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -34,7 +34,6 @@ Description
|
||||
|
||||
SourceFiles
|
||||
processorPolyPatch.C
|
||||
processorPolyPatchMorph.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -63,14 +62,6 @@ class processorPolyPatch
|
||||
int myProcNo_;
|
||||
int neighbProcNo_;
|
||||
|
||||
// Per patch information
|
||||
|
||||
//- Originating patches
|
||||
labelList patchIDs_;
|
||||
|
||||
//- Slice starts
|
||||
labelList starts_;
|
||||
|
||||
//- Processor-neighbbour patch face centres
|
||||
vectorField neighbFaceCentres_;
|
||||
|
||||
@ -80,20 +71,13 @@ class processorPolyPatch
|
||||
//- Processor-neighbbour patch neighbour cell centres
|
||||
vectorField neighbFaceCellCentres_;
|
||||
|
||||
//- Corresponding mesh point per local point
|
||||
mutable autoPtr<labelListList> subMeshPointsPtr_;
|
||||
//- Corresponding neighbouring local point label for every local point
|
||||
// (so localPoints()[i] == neighb.localPoints()[neighbPoints_[i]])
|
||||
mutable autoPtr<labelList> neighbPointsPtr_;
|
||||
|
||||
//- Corresponding mesh point per local point on reverse patch
|
||||
mutable autoPtr<labelListList> reverseSubMeshPointsPtr_;
|
||||
|
||||
// //- Corresponding neighbouring local edge label for every local edge
|
||||
// // (so edges()[i] == neighb.edges()[neighbEdges_[i]])
|
||||
// mutable labelList* neighbEdgesPtr_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
void checkSubPatches() const;
|
||||
//- Corresponding neighbouring local edge label for every local edge
|
||||
// (so edges()[i] == neighb.edges()[neighbEdges_[i]])
|
||||
mutable autoPtr<labelList> neighbEdgesPtr_;
|
||||
|
||||
protected:
|
||||
|
||||
@ -102,18 +86,18 @@ protected:
|
||||
//- Initialise the calculation of the patch geometry
|
||||
void initGeometry(PstreamBuffers&);
|
||||
|
||||
//- Initialise the calculation of the patch geometry with externally
|
||||
// provided geometry
|
||||
virtual void initGeometry
|
||||
(
|
||||
const primitivePatch& referPatch,
|
||||
UList<point>&,
|
||||
UList<point>&,
|
||||
UList<point>&
|
||||
)
|
||||
{
|
||||
notImplemented("processorPolyPatch::initGeometry(..)");
|
||||
}
|
||||
// //- Initialise the calculation of the patch geometry with externally
|
||||
// // provided geometry
|
||||
// virtual void initGeometry
|
||||
// (
|
||||
// const primitivePatch& referPatch,
|
||||
// UList<point>&,
|
||||
// UList<point>&,
|
||||
// UList<point>&
|
||||
// )
|
||||
// {
|
||||
// notImplemented("processorPolyPatch::initGeometry(..)");
|
||||
// }
|
||||
|
||||
//- Calculate the patch geometry
|
||||
void calcGeometry(PstreamBuffers&);
|
||||
@ -164,9 +148,7 @@ public:
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const int myProcNo,
|
||||
const int neighbProcNo,
|
||||
const labelList& patchIDs,
|
||||
const labelList& starts
|
||||
const int neighbProcNo
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
@ -179,11 +161,7 @@ public:
|
||||
);
|
||||
|
||||
//- Construct as copy, resetting the boundary mesh
|
||||
processorPolyPatch
|
||||
(
|
||||
const processorPolyPatch&,
|
||||
const polyBoundaryMesh&
|
||||
);
|
||||
processorPolyPatch(const processorPolyPatch&, const polyBoundaryMesh&);
|
||||
|
||||
//- Construct as given the original patch and resetting the
|
||||
// face list and boundary mesh information
|
||||
@ -193,9 +171,7 @@ public:
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const label newSize,
|
||||
const label newStart,
|
||||
const labelList& patchIDs,
|
||||
const labelList& starts
|
||||
const label newStart
|
||||
);
|
||||
|
||||
//- Construct given the original patch and a map
|
||||
@ -221,9 +197,7 @@ public:
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const label newSize,
|
||||
const label newStart,
|
||||
const labelList& patchIDs,
|
||||
const labelList& starts
|
||||
const label newStart
|
||||
) const
|
||||
{
|
||||
return autoPtr<polyPatch>
|
||||
@ -234,9 +208,7 @@ public:
|
||||
bm,
|
||||
index,
|
||||
newSize,
|
||||
newStart,
|
||||
patchIDs,
|
||||
starts
|
||||
newStart
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -296,16 +268,6 @@ public:
|
||||
return !owner();
|
||||
}
|
||||
|
||||
const labelList& patchIDs() const
|
||||
{
|
||||
return patchIDs_;
|
||||
}
|
||||
|
||||
const labelList& starts() const
|
||||
{
|
||||
return starts_;
|
||||
}
|
||||
|
||||
//- Return processor-neighbbour patch face centres
|
||||
const vectorField& neighbFaceCentres() const
|
||||
{
|
||||
@ -324,37 +286,33 @@ public:
|
||||
return neighbFaceCellCentres_;
|
||||
}
|
||||
|
||||
//- Transform a patch-based field
|
||||
template<class T>
|
||||
void transform(Field<T>& l) const;
|
||||
//- Return neighbour point labels. WIP.
|
||||
const labelList& neighbPoints() const;
|
||||
|
||||
//- Return neighbour edge labels. WIP.
|
||||
const labelList& neighbEdges() const;
|
||||
|
||||
//- Transform a patch-based field from other side to this side.
|
||||
virtual bool doTransform() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual void transform(scalarField& l) const
|
||||
{
|
||||
transform(l);
|
||||
}
|
||||
{}
|
||||
virtual void transform(vectorField& l) const
|
||||
{
|
||||
transform(l);
|
||||
}
|
||||
{}
|
||||
virtual void transform(sphericalTensorField& l) const
|
||||
{
|
||||
transform(l);
|
||||
}
|
||||
{}
|
||||
virtual void transform(diagTensorField& l) const
|
||||
{
|
||||
transform(l);
|
||||
}
|
||||
{}
|
||||
virtual void transform(symmTensorField& l) const
|
||||
{
|
||||
transform(l);
|
||||
}
|
||||
{}
|
||||
virtual void transform(tensorField& l) const
|
||||
{
|
||||
transform(l);
|
||||
}
|
||||
{}
|
||||
|
||||
//- Transform a patch-based position
|
||||
virtual void transformPosition(pointField& l) const;
|
||||
//- Transform a patch-based position from other side to this side
|
||||
virtual void transformPosition(pointField& l) const
|
||||
{}
|
||||
|
||||
//- Are the planes separated.
|
||||
virtual bool separated() const
|
||||
@ -373,24 +331,7 @@ public:
|
||||
//- Are the cyclic planes parallel.
|
||||
virtual bool parallel() const
|
||||
{
|
||||
forAll(patchIDs_, i)
|
||||
{
|
||||
label patchI = patchIDs_[i];
|
||||
|
||||
if (patchI != -1)
|
||||
{
|
||||
if
|
||||
(
|
||||
!refCast<const coupledPolyPatch>
|
||||
(
|
||||
boundaryMesh()[patchI]
|
||||
).parallel()
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
notImplemented("processorPolyPatch::parallel()");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -408,104 +349,6 @@ public:
|
||||
return tensor::zero;
|
||||
}
|
||||
|
||||
//- Find sub patch for local face. -1 for internal faces or label of
|
||||
// cyclic patch.
|
||||
label whichSubPatch(const label facei) const;
|
||||
|
||||
//- Slice patch
|
||||
autoPtr<primitivePatch> subPatch(const label subI) const
|
||||
{
|
||||
const faceList& thisFaces = static_cast<const faceList&>(*this);
|
||||
|
||||
return autoPtr<primitivePatch>
|
||||
(
|
||||
new primitivePatch
|
||||
(
|
||||
faceSubList
|
||||
(
|
||||
thisFaces,
|
||||
this->starts_[subI+1]-this->starts_[subI],
|
||||
this->starts_[subI]
|
||||
),
|
||||
this->points()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Slice patchlist to subpatch
|
||||
template<class T>
|
||||
const typename List<T>::subList subSlice
|
||||
(
|
||||
const UList<T>& l,
|
||||
const label subI
|
||||
) const
|
||||
{
|
||||
return typename List<T>::subList
|
||||
(
|
||||
l,
|
||||
this->starts_[subI+1]-this->starts_[subI],
|
||||
this->starts_[subI]
|
||||
);
|
||||
}
|
||||
|
||||
//- Slice patchlist to subpatch
|
||||
template<class T>
|
||||
typename List<T>::subList subSlice
|
||||
(
|
||||
UList<T>& l,
|
||||
const label subI
|
||||
)
|
||||
{
|
||||
return typename List<T>::subList
|
||||
(
|
||||
l,
|
||||
this->starts_[subI+1]-this->starts_[subI],
|
||||
this->starts_[subI]
|
||||
);
|
||||
}
|
||||
|
||||
//- Slice patchField to subpatch
|
||||
template<class T>
|
||||
const typename Field<T>::subField subSlice
|
||||
(
|
||||
const Field<T>& l,
|
||||
const label subI
|
||||
) const
|
||||
{
|
||||
return typename Field<T>::subList
|
||||
(
|
||||
l,
|
||||
this->starts_[subI+1]-this->starts_[subI],
|
||||
this->starts_[subI]
|
||||
);
|
||||
}
|
||||
|
||||
//- Slice patchField to subpatch
|
||||
template<class T>
|
||||
typename Field<T>::subField subSlice
|
||||
(
|
||||
Field<T>& l,
|
||||
const label subI
|
||||
)
|
||||
{
|
||||
return typename Field<T>::subList
|
||||
(
|
||||
l,
|
||||
this->starts_[subI+1]-this->starts_[subI],
|
||||
this->starts_[subI]
|
||||
);
|
||||
}
|
||||
|
||||
// //- Return neighbour edge labels. This is for my local edge (-1 or) the
|
||||
// // corresponding local edge on the other side. See above for -1 cause.
|
||||
// const labelList& neighbEdges() const;
|
||||
|
||||
//- Mesh point labels per local point per sub patch.
|
||||
const labelListList& subMeshPoints() const;
|
||||
|
||||
//- Mesh point labels per local point on reversed faces per sub patch.
|
||||
const labelListList& reverseSubMeshPoints() const;
|
||||
|
||||
//- Initialize ordering for primitivePatch. Does not
|
||||
// refer to *this (except for name() and type() etc.)
|
||||
virtual void initOrder(PstreamBuffers&, const primitivePatch&) const;
|
||||
@ -535,12 +378,6 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "processorPolyPatchTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,227 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "processorCyclicPolyPatch.H"
|
||||
#include "SubField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//namespace Foam
|
||||
//{
|
||||
// defineTypeNameAndDebug(processorCyclicPolyPatch, 0);
|
||||
// addToRunTimeSelectionTable(polyPatch, processorCyclicPolyPatch, dictionary);
|
||||
//}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const label size,
|
||||
const label start,
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const int myProcNo,
|
||||
const int neighbProcNo,
|
||||
const word& referPatchName
|
||||
)
|
||||
:
|
||||
processorPolyPatch(name, size, start, index, bm, myProcNo, neighbProcNo),
|
||||
referPatchName_(referPatchName),
|
||||
referPatchID_(-1)
|
||||
{}
|
||||
|
||||
|
||||
Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
processorPolyPatch(name, dict, index, bm),
|
||||
referPatchName_(dict.lookup("referPatch")),
|
||||
referPatchID_(-1)
|
||||
{}
|
||||
|
||||
|
||||
Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
|
||||
(
|
||||
const processorCyclicPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
processorPolyPatch(pp, bm),
|
||||
referPatchName_(pp.referPatchName()),
|
||||
referPatchID_(-1)
|
||||
{}
|
||||
|
||||
|
||||
Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
|
||||
(
|
||||
const processorCyclicPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const label newSize,
|
||||
const label newStart,
|
||||
const word& referPatchName
|
||||
)
|
||||
:
|
||||
processorPolyPatch(pp, bm, index, newSize, newStart),
|
||||
referPatchName_(referPatchName),
|
||||
referPatchID_(-1)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::processorCyclicPolyPatch::~processorCyclicPolyPatch()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
void Foam::processorCyclicPolyPatch::initGeometry(PstreamBuffers& pBufs)
|
||||
{
|
||||
Pout<< "**processorCyclicPolyPatch::initGeometry()" << endl;
|
||||
|
||||
// Send over processorPolyPatch data
|
||||
processorPolyPatch::initGeometry(pBufs);
|
||||
}
|
||||
|
||||
|
||||
void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
||||
{
|
||||
Pout<< "processorCyclicPolyPatch::calcGeometry() for " << name() << endl;
|
||||
|
||||
// Receive and initialise processorPolyPatch data
|
||||
processorPolyPatch::calcGeometry(pBufs);
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
|
||||
// Where do we store the calculated transformation?
|
||||
// - on the processor patch?
|
||||
// - on the underlying cyclic patch?
|
||||
// - or do we not auto-calculate the transformation but
|
||||
// have option of reading it.
|
||||
|
||||
// Update underlying cyclic
|
||||
coupledPolyPatch& pp = const_cast<coupledPolyPatch&>(referPatch());
|
||||
|
||||
Pout<< "updating geometry on refered patch:" << pp.name() << endl;
|
||||
|
||||
pp.calcGeometry
|
||||
(
|
||||
pp,
|
||||
faceCentres(),
|
||||
faceAreas(),
|
||||
faceCellCentres(),
|
||||
neighbFaceCentres(),
|
||||
neighbFaceAreas(),
|
||||
neighbFaceCellCentres()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::processorCyclicPolyPatch::initMovePoints
|
||||
(
|
||||
PstreamBuffers& pBufs,
|
||||
const pointField& p
|
||||
)
|
||||
{
|
||||
// Recalculate geometry
|
||||
initGeometry(pBufs);
|
||||
}
|
||||
|
||||
|
||||
void Foam::processorCyclicPolyPatch::movePoints
|
||||
(
|
||||
PstreamBuffers& pBufs,
|
||||
const pointField&
|
||||
)
|
||||
{
|
||||
calcGeometry(pBufs);
|
||||
}
|
||||
|
||||
|
||||
void Foam::processorCyclicPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
|
||||
{
|
||||
processorPolyPatch::initUpdateMesh(pBufs);
|
||||
}
|
||||
|
||||
|
||||
void Foam::processorCyclicPolyPatch::updateMesh(PstreamBuffers& pBufs)
|
||||
{
|
||||
referPatchID_ = -1;
|
||||
processorPolyPatch::updateMesh(pBufs);
|
||||
}
|
||||
|
||||
|
||||
void Foam::processorCyclicPolyPatch::initOrder
|
||||
(
|
||||
PstreamBuffers& pBufs,
|
||||
const primitivePatch& pp
|
||||
) const
|
||||
{
|
||||
// For now use the same algorithm as processorPolyPatch
|
||||
processorPolyPatch::initOrder(pBufs, pp);
|
||||
}
|
||||
|
||||
|
||||
// Return new ordering. Ordering is -faceMap: for every face index
|
||||
// the new face -rotation:for every new face the clockwise shift
|
||||
// of the original face. Return false if nothing changes (faceMap
|
||||
// is identity, rotation is 0)
|
||||
bool Foam::processorCyclicPolyPatch::order
|
||||
(
|
||||
PstreamBuffers& pBufs,
|
||||
const primitivePatch& pp,
|
||||
labelList& faceMap,
|
||||
labelList& rotation
|
||||
) const
|
||||
{
|
||||
// For now use the same algorithm as processorPolyPatch
|
||||
return processorPolyPatch::order(pBufs, pp, faceMap, rotation);
|
||||
}
|
||||
|
||||
|
||||
void Foam::processorCyclicPolyPatch::write(Ostream& os) const
|
||||
{
|
||||
processorPolyPatch::write(os);
|
||||
os.writeKeyword("referPatch") << referPatchName_
|
||||
<< token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,339 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::processorCyclicPolyPatch
|
||||
|
||||
Description
|
||||
Neighbour processor patch.
|
||||
|
||||
Note: morph patch face ordering is geometric.
|
||||
|
||||
SourceFiles
|
||||
processorCyclicPolyPatch.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef processorCyclicPolyPatch_H
|
||||
#define processorCyclicPolyPatch_H
|
||||
|
||||
#include "processorPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class processorCyclicPolyPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class processorCyclicPolyPatch
|
||||
:
|
||||
public processorPolyPatch
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of originating patch
|
||||
const word referPatchName_;
|
||||
|
||||
//- Index of originating patch
|
||||
mutable label referPatchID_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member functions
|
||||
|
||||
//- Initialise the calculation of the patch geometry
|
||||
void initGeometry(PstreamBuffers&);
|
||||
|
||||
// //- Initialise the calculation of the patch geometry with externally
|
||||
// // provided geometry
|
||||
// virtual void initGeometry
|
||||
// (
|
||||
// const primitivePatch& referPatch,
|
||||
// UList<point>&,
|
||||
// UList<point>&,
|
||||
// UList<point>&
|
||||
// )
|
||||
// {
|
||||
// notImplemented("processorCyclicPolyPatch::initGeometry(..)");
|
||||
// }
|
||||
|
||||
//- Calculate the patch geometry
|
||||
void calcGeometry(PstreamBuffers&);
|
||||
|
||||
//- Calculate the patch geometry with externally
|
||||
// provided geometry
|
||||
virtual void calcGeometry
|
||||
(
|
||||
const primitivePatch& referPatch,
|
||||
const UList<point>& thisCtrs,
|
||||
const UList<point>& thisAreas,
|
||||
const UList<point>& thisCc,
|
||||
const UList<point>& nbrCtrs,
|
||||
const UList<point>& nbrAreas,
|
||||
const UList<point>& nbrCc
|
||||
)
|
||||
{
|
||||
notImplemented("processorCyclicPolyPatch::calcGeometry(..)");
|
||||
}
|
||||
|
||||
//- Initialise the patches for moving points
|
||||
void initMovePoints(PstreamBuffers&, const pointField&);
|
||||
|
||||
//- Correct patches after moving points
|
||||
void movePoints(PstreamBuffers&, const pointField&);
|
||||
|
||||
//- Initialise the update of the patch topology
|
||||
virtual void initUpdateMesh(PstreamBuffers&);
|
||||
|
||||
//- Update of the patch topology
|
||||
virtual void updateMesh(PstreamBuffers&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("processorCyclic");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
processorCyclicPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const label size,
|
||||
const label start,
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const int myProcNo,
|
||||
const int neighbProcNo,
|
||||
const word& referPatchName
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
processorCyclicPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const polyBoundaryMesh&
|
||||
);
|
||||
|
||||
//- Construct as copy, resetting the boundary mesh
|
||||
processorCyclicPolyPatch
|
||||
(
|
||||
const processorCyclicPolyPatch&,
|
||||
const polyBoundaryMesh&
|
||||
);
|
||||
|
||||
//- Construct as given the original patch and resetting the
|
||||
// face list and boundary mesh information
|
||||
processorCyclicPolyPatch
|
||||
(
|
||||
const processorCyclicPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const label newSize,
|
||||
const label newStart,
|
||||
const word& referPatchName
|
||||
);
|
||||
|
||||
//- Construct and return a clone, resetting the boundary mesh
|
||||
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
|
||||
{
|
||||
return autoPtr<polyPatch>(new processorCyclicPolyPatch(*this, bm));
|
||||
}
|
||||
|
||||
//- Construct and return a clone, resetting the face list
|
||||
// and boundary mesh
|
||||
virtual autoPtr<polyPatch> clone
|
||||
(
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const label newSize,
|
||||
const label newStart,
|
||||
const word& referPatchName
|
||||
) const
|
||||
{
|
||||
return autoPtr<polyPatch>
|
||||
(
|
||||
new processorCyclicPolyPatch
|
||||
(
|
||||
refCast<const processorCyclicPolyPatch>(*this),
|
||||
bm,
|
||||
index,
|
||||
newSize,
|
||||
newStart,
|
||||
referPatchName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~processorCyclicPolyPatch();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
const word& referPatchName() const
|
||||
{
|
||||
return referPatchName_;
|
||||
}
|
||||
|
||||
//- Referring patchID.
|
||||
label referPatchID() const
|
||||
{
|
||||
if (referPatchID_ == -1)
|
||||
{
|
||||
referPatchID_ = this->boundaryMesh().findPatchID
|
||||
(
|
||||
referPatchName_
|
||||
);
|
||||
if (referPatchID_ == -1)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"processorCyclicPolyPatch::referPatchID() const"
|
||||
) << "Illegal referPatch name " << referPatchName_
|
||||
<< endl << "Valid patch names are "
|
||||
<< this->boundaryMesh().names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
return referPatchID_;
|
||||
}
|
||||
|
||||
const coupledPolyPatch& referPatch() const
|
||||
{
|
||||
const polyPatch& pp = this->boundaryMesh()[referPatchID()];
|
||||
return refCast<const processorCyclicPolyPatch>(pp);
|
||||
}
|
||||
|
||||
//- Transform a patch-based field from other side to this side.
|
||||
virtual bool doTransform() const
|
||||
{
|
||||
return referPatch().doTransform();
|
||||
}
|
||||
virtual void transform(scalarField& l) const
|
||||
{
|
||||
referPatch().transform(l);
|
||||
}
|
||||
virtual void transform(vectorField& l) const
|
||||
{
|
||||
referPatch().transform(l);
|
||||
}
|
||||
virtual void transform(sphericalTensorField& l) const
|
||||
{
|
||||
referPatch().transform(l);
|
||||
}
|
||||
virtual void transform(diagTensorField& l) const
|
||||
{
|
||||
referPatch().transform(l);
|
||||
}
|
||||
virtual void transform(symmTensorField& l) const
|
||||
{
|
||||
referPatch().transform(l);
|
||||
}
|
||||
virtual void transform(tensorField& l) const
|
||||
{
|
||||
referPatch().transform(l);
|
||||
}
|
||||
|
||||
//- Transform a patch-based position from other side to this side
|
||||
virtual void transformPosition(pointField& l) const
|
||||
{
|
||||
referPatch().transform(l);
|
||||
}
|
||||
|
||||
//- Are the planes separated.
|
||||
virtual bool separated() const
|
||||
{
|
||||
return referPatch().separated();
|
||||
}
|
||||
|
||||
//- If the planes are separated the separation vector.
|
||||
virtual const vector& separation() const
|
||||
{
|
||||
return referPatch().separation();
|
||||
}
|
||||
|
||||
//- Are the cyclic planes parallel.
|
||||
virtual bool parallel() const
|
||||
{
|
||||
return referPatch().parallel();
|
||||
}
|
||||
|
||||
//- Return face transformation tensor.
|
||||
virtual const tensor& forwardT() const
|
||||
{
|
||||
return referPatch().forwardT();
|
||||
}
|
||||
|
||||
//- Return neighbour-cell transformation tensor.
|
||||
virtual const tensor& reverseT() const
|
||||
{
|
||||
return referPatch().reverseT();
|
||||
}
|
||||
|
||||
//- Initialize ordering for primitivePatch. Does not
|
||||
// refer to *this (except for name() and type() etc.)
|
||||
virtual void initOrder(PstreamBuffers&, const primitivePatch&) const;
|
||||
|
||||
//- Return new ordering for primitivePatch.
|
||||
// Ordering is -faceMap: for every face
|
||||
// index of the new face -rotation:for every new face the clockwise
|
||||
// shift of the original face. Return false if nothing changes
|
||||
// (faceMap is identity, rotation is 0), true otherwise.
|
||||
virtual bool order
|
||||
(
|
||||
PstreamBuffers&,
|
||||
const primitivePatch&,
|
||||
labelList& faceMap,
|
||||
labelList& rotation
|
||||
) const;
|
||||
|
||||
|
||||
//- Write the polyPatch data as a dictionary
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -90,8 +90,8 @@ class polyPatch
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Calculate labels of mesh edges
|
||||
void calcMeshEdges() const;
|
||||
// //- Calculate labels of mesh edges
|
||||
// void calcMeshEdges() const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@ -100,11 +100,14 @@ public:
|
||||
class transform
|
||||
{
|
||||
public:
|
||||
//- Transform Field
|
||||
template<class T>
|
||||
void operator()(const coupledPolyPatch& cpp, Field<T>& fld) const
|
||||
{
|
||||
cpp.transform(fld);
|
||||
}
|
||||
|
||||
//- Transform generic container
|
||||
template<class T, template<class> class Container>
|
||||
void operator()(const coupledPolyPatch& cpp, Container<T>& map)
|
||||
const
|
||||
|
||||
@ -114,43 +114,23 @@ void Foam::syncTools::syncPointMap
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
//TBD: optimisation for single subpatch.
|
||||
// Get data per patchPoint in neighbouring point numbers.
|
||||
|
||||
List<Map<T> > patchInfo(procPatch.patchIDs().size());
|
||||
const labelList& meshPts = procPatch.meshPoints();
|
||||
const labelList& nbrPts = procPatch.neighbPoints();
|
||||
|
||||
forAll(procPatch.patchIDs(), subI)
|
||||
// Extract local values. Create map from nbrPoint to value.
|
||||
// Note: how small initial size?
|
||||
Map<T> patchInfo(meshPts.size() / 20);
|
||||
|
||||
forAll(meshPts, i)
|
||||
{
|
||||
label subPatchI = procPatch.patchIDs()[subI];
|
||||
typename Map<T>::const_iterator iter =
|
||||
pointValues.find(meshPts[i]);
|
||||
|
||||
const labelList& subMeshPts =
|
||||
procPatch.subMeshPoints()[subI];
|
||||
|
||||
Map<T>& subPatchInfo = patchInfo[subI];
|
||||
subPatchInfo.resize(subMeshPts.size()/20);
|
||||
forAll(subMeshPts, patchPointI)
|
||||
if (iter != pointValues.end())
|
||||
{
|
||||
label pointI = subMeshPts[patchPointI];
|
||||
|
||||
typename Map<T>::const_iterator iter =
|
||||
pointValues.find(pointI);
|
||||
|
||||
if (iter != pointValues.end())
|
||||
{
|
||||
subPatchInfo.insert(patchPointI, iter());
|
||||
}
|
||||
}
|
||||
|
||||
if (subPatchI != -1)
|
||||
{
|
||||
// Apply transform.
|
||||
top
|
||||
(
|
||||
refCast<const coupledPolyPatch>
|
||||
(
|
||||
patches[subPatchI]
|
||||
),
|
||||
subPatchInfo
|
||||
);
|
||||
patchInfo.insert(nbrPts[i], iter());
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,34 +153,29 @@ void Foam::syncTools::syncPointMap
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
List<Map<T> > nbrPatchInfo;
|
||||
IPstream fromNb(Pstream::blocking, procPatch.neighbProcNo());
|
||||
Map<T> nbrPatchInfo(fromNb);
|
||||
|
||||
// Transform
|
||||
top(procPatch, nbrPatchInfo);
|
||||
|
||||
const labelList& meshPts = procPatch.meshPoints();
|
||||
|
||||
// Only update those values which come from neighbour
|
||||
forAllConstIter
|
||||
(
|
||||
typename Map<T>,
|
||||
nbrPatchInfo,
|
||||
nbrIter
|
||||
)
|
||||
{
|
||||
IPstream fromNbr
|
||||
combine
|
||||
(
|
||||
Pstream::blocking,
|
||||
procPatch.neighbProcNo()
|
||||
pointValues,
|
||||
cop,
|
||||
meshPts[nbrIter.key()],
|
||||
nbrIter()
|
||||
);
|
||||
fromNbr >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
forAll(procPatch.patchIDs(), subI)
|
||||
{
|
||||
const labelList& subMeshPts =
|
||||
procPatch.reverseSubMeshPoints()[subI];
|
||||
|
||||
const Map<T>& nbrSubInfo = nbrPatchInfo[subI];
|
||||
|
||||
forAllConstIter(typename Map<T>, nbrSubInfo, iter)
|
||||
{
|
||||
label meshPointI = subMeshPts[iter.key()];
|
||||
combine
|
||||
(
|
||||
pointValues,
|
||||
cop,
|
||||
meshPointI,
|
||||
iter()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -217,6 +192,7 @@ void Foam::syncTools::syncPointMap
|
||||
if (cycPatch.owner())
|
||||
{
|
||||
// Owner does all.
|
||||
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
const edgeList& coupledPoints = cycPatch.coupledPoints();
|
||||
const labelList& meshPtsA = cycPatch.meshPoints();
|
||||
@ -247,9 +223,9 @@ void Foam::syncTools::syncPointMap
|
||||
}
|
||||
}
|
||||
|
||||
// Transform
|
||||
top(cycPatch, half0Values);
|
||||
top(nbrPatch, half1Values);
|
||||
// Transform to receiving side
|
||||
top(cycPatch, half1Values);
|
||||
top(nbrPatch, half0Values);
|
||||
|
||||
forAll(coupledPoints, i)
|
||||
{
|
||||
@ -365,7 +341,7 @@ void Foam::syncTools::syncPointMap
|
||||
}
|
||||
else
|
||||
{
|
||||
// Send to master
|
||||
// Slave: send to master
|
||||
{
|
||||
OPstream toMaster(Pstream::blocking, Pstream::masterNo());
|
||||
toMaster << sharedPointValues;
|
||||
@ -453,56 +429,27 @@ void Foam::syncTools::syncEdgeMap
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
// Data per sub patch
|
||||
List<EdgeMap<T> > patchInfo(procPatch.patchIDs().size());
|
||||
|
||||
forAll(procPatch.patchIDs(), subI)
|
||||
// Get data per patch edge in neighbouring edge.
|
||||
|
||||
const edgeList& edges = procPatch.edges();
|
||||
const labelList& meshPts = procPatch.meshPoints();
|
||||
const labelList& nbrPts = procPatch.neighbPoints();
|
||||
|
||||
EdgeMap<T> patchInfo(edges.size() / 20);
|
||||
|
||||
forAll(edges, i)
|
||||
{
|
||||
label subPatchI = procPatch.patchIDs()[subI];
|
||||
label subStart = procPatch.starts()[subI];
|
||||
label subSize = procPatch.starts()[subI+1]-subStart;
|
||||
const edge& e = edges[i];
|
||||
const edge meshEdge(meshPts[e[0]], meshPts[e[1]]);
|
||||
|
||||
primitivePatch subPatch
|
||||
(
|
||||
faceSubList
|
||||
(
|
||||
procPatch,
|
||||
subSize,
|
||||
subStart
|
||||
),
|
||||
procPatch.points()
|
||||
);
|
||||
const labelList& subMeshPts = subPatch.meshPoints();
|
||||
const edgeList& subEdges = subPatch.edges();
|
||||
typename EdgeMap<T>::const_iterator iter =
|
||||
edgeValues.find(meshEdge);
|
||||
|
||||
EdgeMap<T>& subPatchInfo = patchInfo[subI];
|
||||
subPatchInfo.resize(subEdges.size());
|
||||
|
||||
forAll(subEdges, i)
|
||||
if (iter != edgeValues.end())
|
||||
{
|
||||
const edge& e = subEdges[i];
|
||||
const edge meshEdge(subMeshPts[e[0]], subMeshPts[e[1]]);
|
||||
|
||||
typename EdgeMap<T>::const_iterator iter =
|
||||
edgeValues.find(meshEdge);
|
||||
|
||||
if (iter != edgeValues.end())
|
||||
{
|
||||
subPatchInfo.insert(e, iter());
|
||||
}
|
||||
}
|
||||
|
||||
if (subPatchI != -1)
|
||||
{
|
||||
// Apply transform.
|
||||
top
|
||||
(
|
||||
refCast<const coupledPolyPatch>
|
||||
(
|
||||
patches[subPatchI]
|
||||
),
|
||||
subPatchInfo
|
||||
);
|
||||
const edge nbrEdge(nbrPts[e[0]], nbrPts[e[1]]);
|
||||
patchInfo.insert(nbrEdge, iter());
|
||||
}
|
||||
}
|
||||
|
||||
@ -525,7 +472,7 @@ void Foam::syncTools::syncEdgeMap
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
List<EdgeMap<T> > nbrPatchInfo;
|
||||
EdgeMap<T> nbrPatchInfo;
|
||||
{
|
||||
IPstream fromNbr
|
||||
(
|
||||
@ -535,26 +482,30 @@ void Foam::syncTools::syncEdgeMap
|
||||
fromNbr >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
forAll(procPatch.patchIDs(), subI)
|
||||
// Apply transform to convert to this side properties.
|
||||
top(procPatch, nbrPatchInfo);
|
||||
|
||||
|
||||
// Only update those values which come from neighbour
|
||||
const labelList& meshPts = procPatch.meshPoints();
|
||||
|
||||
forAllConstIter
|
||||
(
|
||||
typename EdgeMap<T>,
|
||||
nbrPatchInfo,
|
||||
nbrIter
|
||||
)
|
||||
{
|
||||
const labelList& subMeshPts =
|
||||
procPatch.subMeshPoints()[subI];
|
||||
const edge& e = nbrIter.key();
|
||||
const edge meshEdge(meshPts[e[0]], meshPts[e[1]]);
|
||||
|
||||
const EdgeMap<T>& nbrSubInfo = nbrPatchInfo[subI];
|
||||
|
||||
forAllConstIter(typename EdgeMap<T>, nbrSubInfo, iter)
|
||||
{
|
||||
const edge& e = iter.key();
|
||||
const edge meshEdge(subMeshPts[e[0]], subMeshPts[e[1]]);
|
||||
|
||||
combine
|
||||
(
|
||||
edgeValues,
|
||||
cop,
|
||||
meshEdge, // edge
|
||||
iter() // value
|
||||
);
|
||||
}
|
||||
combine
|
||||
(
|
||||
edgeValues,
|
||||
cop,
|
||||
meshEdge, // edge
|
||||
nbrIter() // value
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -616,9 +567,9 @@ void Foam::syncTools::syncEdgeMap
|
||||
}
|
||||
}
|
||||
|
||||
// Transform
|
||||
top(cycPatch, half0Values);
|
||||
top(nbrPatch, half1Values);
|
||||
// Transform to this side
|
||||
top(cycPatch, half1Values);
|
||||
top(nbrPatch, half0Values);
|
||||
|
||||
|
||||
// Extract and combine information
|
||||
@ -869,38 +820,16 @@ void Foam::syncTools::syncPointList
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
//TBD: optimisation for single subpatch.
|
||||
// Get data per patchPoint in neighbouring point numbers.
|
||||
Field<T> patchInfo(procPatch.nPoints());
|
||||
|
||||
// Data per sub patch
|
||||
List<List<T> > patchInfo(procPatch.patchIDs().size());
|
||||
const labelList& meshPts = procPatch.meshPoints();
|
||||
const labelList& nbrPts = procPatch.neighbPoints();
|
||||
|
||||
forAll(procPatch.patchIDs(), subI)
|
||||
forAll(nbrPts, pointI)
|
||||
{
|
||||
label subPatchI = procPatch.patchIDs()[subI];
|
||||
|
||||
const labelList& subMeshPts =
|
||||
procPatch.subMeshPoints()[subI];
|
||||
|
||||
List<T>& subPatchInfo = patchInfo[subI];
|
||||
subPatchInfo.setSize(subMeshPts.size());
|
||||
forAll(subPatchInfo, i)
|
||||
{
|
||||
subPatchInfo[i] = pointValues[subMeshPts[i]];
|
||||
}
|
||||
|
||||
if (subPatchI != -1)
|
||||
{
|
||||
// Apply transform.
|
||||
SubField<T> slice(subPatchInfo, subPatchInfo.size());
|
||||
top
|
||||
(
|
||||
refCast<const coupledPolyPatch>
|
||||
(
|
||||
patches[subPatchI]
|
||||
),
|
||||
reinterpret_cast<Field<T>&>(slice)
|
||||
);
|
||||
}
|
||||
label nbrPointI = nbrPts[pointI];
|
||||
patchInfo[nbrPointI] = pointValues[meshPts[pointI]];
|
||||
}
|
||||
|
||||
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
|
||||
@ -922,10 +851,8 @@ void Foam::syncTools::syncPointList
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
List<List<T> > nbrPatchInfo;
|
||||
Field<T> nbrPatchInfo(procPatch.nPoints());
|
||||
{
|
||||
// We do not know the number of points on the other side
|
||||
// so cannot use Pstream::read.
|
||||
IPstream fromNbr
|
||||
(
|
||||
Pstream::blocking,
|
||||
@ -934,17 +861,15 @@ void Foam::syncTools::syncPointList
|
||||
fromNbr >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
forAll(procPatch.patchIDs(), subI)
|
||||
{
|
||||
const labelList& subMeshPts =
|
||||
procPatch.reverseSubMeshPoints()[subI];
|
||||
const List<T>& nbrSubInfo = nbrPatchInfo[subI];
|
||||
// Transform to this side
|
||||
top(procPatch, nbrPatchInfo);
|
||||
|
||||
forAll(subMeshPts, i)
|
||||
{
|
||||
label meshPointI = subMeshPts[i];
|
||||
cop(pointValues[meshPointI], nbrSubInfo[i]);
|
||||
}
|
||||
const labelList& meshPts = procPatch.meshPoints();
|
||||
|
||||
forAll(meshPts, pointI)
|
||||
{
|
||||
label meshPointI = meshPts[pointI];
|
||||
cop(pointValues[meshPointI], nbrPatchInfo[pointI]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -979,11 +904,11 @@ void Foam::syncTools::syncPointList
|
||||
|
||||
//SubField<T> slice0(half0Values, half0Values.size());
|
||||
//SubField<T> slice1(half1Values, half1Values.size());
|
||||
//top(cycPatch, reinterpret_cast<Field<T>&>(slice0));
|
||||
//top(nbrPatch, reinterpret_cast<Field<T>&>(slice1));
|
||||
//top(cycPatch, reinterpret_cast<Field<T>&>(slice1));
|
||||
//top(nbrPatch, reinterpret_cast<Field<T>&>(slice0));
|
||||
|
||||
top(cycPatch, half0Values);
|
||||
top(nbrPatch, half1Values);
|
||||
top(cycPatch, half1Values);
|
||||
top(nbrPatch, half0Values);
|
||||
|
||||
forAll(coupledPoints, i)
|
||||
{
|
||||
@ -1001,7 +926,7 @@ void Foam::syncTools::syncPointList
|
||||
if (pd.nGlobalPoints() > 0)
|
||||
{
|
||||
// Values on shared points.
|
||||
List<T> sharedPts(pd.nGlobalPoints(), nullValue);
|
||||
Field<T> sharedPts(pd.nGlobalPoints(), nullValue);
|
||||
|
||||
forAll(pd.sharedPointLabels(), i)
|
||||
{
|
||||
@ -1053,7 +978,7 @@ void Foam::syncTools::syncPointList
|
||||
return;
|
||||
}
|
||||
|
||||
List<T> meshValues(mesh.nPoints(), nullValue);
|
||||
Field<T> meshValues(mesh.nPoints(), nullValue);
|
||||
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
@ -1120,56 +1045,17 @@ void Foam::syncTools::syncEdgeList
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
//TBD: optimisation for single subpatch.
|
||||
const labelList& meshEdges = procPatch.meshEdges();
|
||||
const labelList& neighbEdges = procPatch.neighbEdges();
|
||||
|
||||
// Data per sub patch
|
||||
List<List<T> > patchInfo(procPatch.patchIDs().size());
|
||||
// Get region per patch edge in neighbouring edge numbers.
|
||||
Field<T> patchInfo(procPatch.nEdges(), nullValue);
|
||||
|
||||
forAll(procPatch.patchIDs(), subI)
|
||||
forAll(neighbEdges, edgeI)
|
||||
{
|
||||
label subPatchI = procPatch.patchIDs()[subI];
|
||||
label subStart = procPatch.starts()[subI];
|
||||
label subSize = procPatch.starts()[subI+1]-subStart;
|
||||
label nbrEdgeI = neighbEdges[edgeI];
|
||||
|
||||
primitivePatch subPatch
|
||||
(
|
||||
faceSubList
|
||||
(
|
||||
procPatch,
|
||||
subSize,
|
||||
subStart
|
||||
),
|
||||
procPatch.points()
|
||||
);
|
||||
labelList subMeshEdges
|
||||
(
|
||||
subPatch.meshEdges
|
||||
(
|
||||
mesh.edges(),
|
||||
mesh.pointEdges()
|
||||
)
|
||||
);
|
||||
|
||||
List<T>& subPatchInfo = patchInfo[subI];
|
||||
subPatchInfo.setSize(subMeshEdges.size());
|
||||
forAll(subPatchInfo, i)
|
||||
{
|
||||
subPatchInfo[i] = edgeValues[subMeshEdges[i]];
|
||||
}
|
||||
|
||||
if (subPatchI != -1)
|
||||
{
|
||||
// Apply transform.
|
||||
SubField<T> slice(subPatchInfo, subPatchInfo.size());
|
||||
top
|
||||
(
|
||||
refCast<const coupledPolyPatch>
|
||||
(
|
||||
patches[subPatchI]
|
||||
),
|
||||
reinterpret_cast<Field<T>&>(slice)
|
||||
);
|
||||
}
|
||||
patchInfo[nbrEdgeI] = edgeValues[meshEdges[edgeI]];
|
||||
}
|
||||
|
||||
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
|
||||
@ -1190,8 +1076,11 @@ void Foam::syncTools::syncEdgeList
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
// Receive from neighbour.
|
||||
List<List<T> > nbrPatchInfo(procPatch.nEdges());
|
||||
const labelList& meshEdges = procPatch.meshEdges();
|
||||
|
||||
// Receive from neighbour. Is per patch edge the region of the
|
||||
// neighbouring patch edge.
|
||||
Field<T> nbrPatchInfo(procPatch.nEdges());
|
||||
|
||||
{
|
||||
IPstream fromNeighb
|
||||
@ -1202,41 +1091,13 @@ void Foam::syncTools::syncEdgeList
|
||||
fromNeighb >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
forAll(procPatch.patchIDs(), subI)
|
||||
// Transform to this side
|
||||
top(procPatch, nbrPatchInfo);
|
||||
|
||||
forAll(meshEdges, edgeI)
|
||||
{
|
||||
label subStart = procPatch.starts()[subI];
|
||||
label subSize = procPatch.starts()[subI+1]-subStart;
|
||||
|
||||
faceList reverseFaces(subSize);
|
||||
forAll(reverseFaces, i)
|
||||
{
|
||||
reverseFaces[i] = procPatch[subStart+i].reverseFace();
|
||||
}
|
||||
primitivePatch subPatch
|
||||
(
|
||||
faceSubList
|
||||
(
|
||||
reverseFaces,
|
||||
reverseFaces.size()
|
||||
),
|
||||
procPatch.points()
|
||||
);
|
||||
labelList subMeshEdges
|
||||
(
|
||||
subPatch.meshEdges
|
||||
(
|
||||
mesh.edges(),
|
||||
mesh.pointEdges()
|
||||
)
|
||||
);
|
||||
|
||||
const List<T>& nbrSubInfo = nbrPatchInfo[subI];
|
||||
|
||||
forAll(subMeshEdges, i)
|
||||
{
|
||||
label meshEdgeI = subMeshEdges[i];
|
||||
cop(edgeValues[meshEdgeI], nbrSubInfo[i]);
|
||||
}
|
||||
label meshEdgeI = meshEdges[edgeI];
|
||||
cop(edgeValues[meshEdgeI], nbrPatchInfo[edgeI]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1270,11 +1131,11 @@ void Foam::syncTools::syncEdgeList
|
||||
|
||||
//SubField<T> slice0(half0Values, half0Values.size());
|
||||
//SubField<T> slice1(half1Values, half1Values.size());
|
||||
//top(cycPatch, reinterpret_cast<Field<T>&>(slice0));
|
||||
//top(nbrPatch, reinterpret_cast<Field<T>&>(slice1));
|
||||
//top(cycPatch, reinterpret_cast<Field<T>&>(slice1));
|
||||
//top(nbrPatch, reinterpret_cast<Field<T>&>(slice0));
|
||||
|
||||
top(cycPatch, half0Values);
|
||||
top(nbrPatch, half1Values);
|
||||
top(cycPatch, half1Values);
|
||||
top(nbrPatch, half0Values);
|
||||
|
||||
forAll(coupledEdges, i)
|
||||
{
|
||||
@ -1296,7 +1157,7 @@ void Foam::syncTools::syncEdgeList
|
||||
if (pd.nGlobalEdges() > 0)
|
||||
{
|
||||
// Values on shared edges.
|
||||
List<T> sharedPts(pd.nGlobalEdges(), nullValue);
|
||||
Field<T> sharedPts(pd.nGlobalEdges(), nullValue);
|
||||
|
||||
forAll(pd.sharedEdgeLabels(), i)
|
||||
{
|
||||
@ -1382,8 +1243,13 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
else
|
||||
{
|
||||
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
|
||||
toNbr <<
|
||||
SubList<T>(faceValues, procPatch.size(), patchStart);
|
||||
toNbr <<
|
||||
SubField<T>
|
||||
(
|
||||
faceValues,
|
||||
procPatch.size(),
|
||||
patchStart
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1399,17 +1265,17 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
&& patches[patchI].size() > 0
|
||||
)
|
||||
{
|
||||
const processorPolyPatch& ppp =
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
List<T> nbrPatchInfo(ppp.size());
|
||||
Field<T> nbrPatchInfo(procPatch.size());
|
||||
|
||||
if (contiguous<T>())
|
||||
{
|
||||
IPstream::read
|
||||
(
|
||||
Pstream::blocking,
|
||||
ppp.neighbProcNo(),
|
||||
procPatch.neighbProcNo(),
|
||||
reinterpret_cast<char*>(nbrPatchInfo.begin()),
|
||||
nbrPatchInfo.byteSize()
|
||||
);
|
||||
@ -1419,33 +1285,14 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
IPstream fromNeighb
|
||||
(
|
||||
Pstream::blocking,
|
||||
ppp.neighbProcNo()
|
||||
procPatch.neighbProcNo()
|
||||
);
|
||||
fromNeighb >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
// Apply any transforms
|
||||
forAll(ppp.patchIDs(), i)
|
||||
{
|
||||
label subPatchI = ppp.patchIDs()[i];
|
||||
label subStart = ppp.starts()[i];
|
||||
label subSize = ppp.starts()[i+1]-subStart;
|
||||
top(procPatch, nbrPatchInfo);
|
||||
|
||||
if (subPatchI != -1)
|
||||
{
|
||||
SubField<T> slice(nbrPatchInfo, subStart, subSize);
|
||||
top
|
||||
(
|
||||
refCast<const coupledPolyPatch>
|
||||
(
|
||||
patches[subPatchI]
|
||||
),
|
||||
reinterpret_cast<Field<T>&>(slice)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
label bFaceI = ppp.start()-mesh.nInternalFaces();
|
||||
label bFaceI = procPatch.start()-mesh.nInternalFaces();
|
||||
|
||||
forAll(nbrPatchInfo, i)
|
||||
{
|
||||
@ -1473,13 +1320,11 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
label sz = cycPatch.size();
|
||||
|
||||
// Transform (copy of) data on both sides
|
||||
Field<T> ownVals(SubList<T>(faceValues, sz, ownStart));
|
||||
//SubField<T> ownSlice(ownVals, ownVals.size());
|
||||
top(cycPatch, ownVals);
|
||||
Field<T> ownVals(SubField<T>(faceValues, sz, ownStart));
|
||||
top(nbrPatch, ownVals);
|
||||
|
||||
Field<T> nbrVals(SubList<T>(faceValues, sz, nbrStart));
|
||||
//SubField<T> nbrSlice(nbrVals, nbrVals.size());
|
||||
top(nbrPatch, nbrVals);
|
||||
Field<T> nbrVals(SubField<T>(faceValues, sz, nbrStart));
|
||||
top(cycPatch, nbrVals);
|
||||
|
||||
label i0 = ownStart;
|
||||
forAll(nbrVals, i)
|
||||
@ -1526,10 +1371,6 @@ void Foam::syncTools::syncFaceList
|
||||
return;
|
||||
}
|
||||
|
||||
// Patch data (proc patches only) for ease of sending/receiving.
|
||||
// Note:should just send slice of packedList itself.
|
||||
List<List<unsigned int> > patchValues(patches.size());
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Send
|
||||
@ -1545,14 +1386,14 @@ void Foam::syncTools::syncFaceList
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
patchValues[patchI].setSize(procPatch.size());
|
||||
List<unsigned int> patchInfo(procPatch.size());
|
||||
forAll(procPatch, i)
|
||||
{
|
||||
patchValues[patchI][i] = faceValues[procPatch.start()+i];
|
||||
patchInfo[i] = faceValues[procPatch.start()+i];
|
||||
}
|
||||
|
||||
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
|
||||
toNbr << patchValues[patchI];
|
||||
toNbr << patchInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1570,19 +1411,20 @@ void Foam::syncTools::syncFaceList
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
List<unsigned int> patchInfo(procPatch.size());
|
||||
{
|
||||
IPstream fromNbr
|
||||
(
|
||||
Pstream::blocking,
|
||||
procPatch.neighbProcNo()
|
||||
);
|
||||
fromNbr >> patchValues[patchI];
|
||||
fromNbr >> patchInfo;
|
||||
}
|
||||
|
||||
// Combine (bitwise)
|
||||
forAll(procPatch, i)
|
||||
{
|
||||
unsigned int patchVal = patchValues[patchI][i];
|
||||
unsigned int patchVal = patchInfo[i];
|
||||
label meshFaceI = procPatch.start()+i;
|
||||
unsigned int faceVal = faceValues[meshFaceI];
|
||||
cop(faceVal, patchVal);
|
||||
@ -1679,19 +1521,15 @@ void Foam::syncTools::syncPointList
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
List<List<unsigned int> > patchInfo(procPatch.patchIDs().size());
|
||||
List<unsigned int> patchInfo(procPatch.nPoints());
|
||||
|
||||
forAll(procPatch.patchIDs(), subI)
|
||||
const labelList& meshPts = procPatch.meshPoints();
|
||||
const labelList& nbrPts = procPatch.neighbPoints();
|
||||
|
||||
forAll(nbrPts, pointI)
|
||||
{
|
||||
const labelList& subMeshPts =
|
||||
procPatch.subMeshPoints()[subI];
|
||||
|
||||
List<unsigned int>& subInfo = patchInfo[subI];
|
||||
subInfo.setSize(subMeshPts.size());
|
||||
forAll(subInfo, i)
|
||||
{
|
||||
subInfo[i] = pointValues[subMeshPts[i]];
|
||||
}
|
||||
label nbrPointI = nbrPts[pointI];
|
||||
patchInfo[nbrPointI] = pointValues[meshPts[pointI]];
|
||||
}
|
||||
|
||||
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
|
||||
@ -1713,7 +1551,7 @@ void Foam::syncTools::syncPointList
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
List<List<unsigned int> > nbrPatchInfo(procPatch.nPoints());
|
||||
List<unsigned int> nbrPatchInfo(procPatch.nPoints());
|
||||
{
|
||||
// We do not know the number of points on the other side
|
||||
// so cannot use Pstream::read.
|
||||
@ -1725,19 +1563,14 @@ void Foam::syncTools::syncPointList
|
||||
fromNbr >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
forAll(procPatch.patchIDs(), subI)
|
||||
{
|
||||
const labelList& subMeshPts =
|
||||
procPatch.reverseSubMeshPoints()[subI];
|
||||
const List<unsigned int>& nbrSubInfo = nbrPatchInfo[subI];
|
||||
const labelList& meshPts = procPatch.meshPoints();
|
||||
|
||||
forAll(subMeshPts, i)
|
||||
{
|
||||
label meshPointI = subMeshPts[i];
|
||||
unsigned int pointVal = pointValues[meshPointI];
|
||||
cop(pointVal, nbrSubInfo[i]);
|
||||
pointValues[meshPointI] = pointVal;
|
||||
}
|
||||
forAll(meshPts, pointI)
|
||||
{
|
||||
label meshPointI = meshPts[pointI];
|
||||
unsigned int pointVal = pointValues[meshPointI];
|
||||
cop(pointVal, nbrPatchInfo[pointI]);
|
||||
pointValues[meshPointI] = pointVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1852,38 +1685,15 @@ void Foam::syncTools::syncEdgeList
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
List<List<unsigned int> > patchInfo(procPatch.patchIDs().size());
|
||||
List<unsigned int> patchInfo(procPatch.nEdges());
|
||||
|
||||
forAll(procPatch.patchIDs(), subI)
|
||||
const labelList& meshEdges = procPatch.meshEdges();
|
||||
const labelList& neighbEdges = procPatch.neighbEdges();
|
||||
|
||||
forAll(neighbEdges, edgeI)
|
||||
{
|
||||
label subStart = procPatch.starts()[subI];
|
||||
label subSize = procPatch.starts()[subI+1]-subStart;
|
||||
|
||||
primitivePatch subPatch
|
||||
(
|
||||
faceSubList
|
||||
(
|
||||
procPatch,
|
||||
subSize,
|
||||
subStart
|
||||
),
|
||||
procPatch.points()
|
||||
);
|
||||
labelList subMeshEdges
|
||||
(
|
||||
subPatch.meshEdges
|
||||
(
|
||||
mesh.edges(),
|
||||
mesh.pointEdges()
|
||||
)
|
||||
);
|
||||
|
||||
List<unsigned int>& subPatchInfo = patchInfo[subI];
|
||||
subPatchInfo.setSize(subMeshEdges.size());
|
||||
forAll(subPatchInfo, i)
|
||||
{
|
||||
subPatchInfo[i] = edgeValues[subMeshEdges[i]];
|
||||
}
|
||||
label nbrEdgeI = neighbEdges[edgeI];
|
||||
patchInfo[nbrEdgeI] = edgeValues[meshEdges[edgeI]];
|
||||
}
|
||||
|
||||
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
|
||||
@ -1906,7 +1716,7 @@ void Foam::syncTools::syncEdgeList
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
// Receive from neighbour.
|
||||
List<List<unsigned int> > nbrPatchInfo(procPatch.nEdges());
|
||||
List<unsigned int> nbrPatchInfo(procPatch.nEdges());
|
||||
|
||||
{
|
||||
IPstream fromNeighb
|
||||
@ -1917,43 +1727,15 @@ void Foam::syncTools::syncEdgeList
|
||||
fromNeighb >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
forAll(procPatch.patchIDs(), subI)
|
||||
const labelList& meshEdges = procPatch.meshEdges();
|
||||
|
||||
forAll(meshEdges, edgeI)
|
||||
{
|
||||
label subStart = procPatch.starts()[subI];
|
||||
label subSize = procPatch.starts()[subI+1]-subStart;
|
||||
|
||||
faceList reverseFaces(subSize);
|
||||
forAll(reverseFaces, i)
|
||||
{
|
||||
reverseFaces[i] = procPatch[subStart+i].reverseFace();
|
||||
}
|
||||
primitivePatch subPatch
|
||||
(
|
||||
faceSubList
|
||||
(
|
||||
reverseFaces,
|
||||
reverseFaces.size()
|
||||
),
|
||||
procPatch.points()
|
||||
);
|
||||
labelList subMeshEdges
|
||||
(
|
||||
subPatch.meshEdges
|
||||
(
|
||||
mesh.edges(),
|
||||
mesh.pointEdges()
|
||||
)
|
||||
);
|
||||
|
||||
const List<unsigned int>& nbrSubInfo = nbrPatchInfo[subI];
|
||||
|
||||
forAll(subMeshEdges, i)
|
||||
{
|
||||
label meshEdgeI = subMeshEdges[i];
|
||||
unsigned int edgeVal = edgeValues[meshEdgeI];
|
||||
cop(edgeVal, nbrSubInfo[i]);
|
||||
edgeValues[meshEdgeI] = edgeVal;
|
||||
}
|
||||
unsigned int patchVal = nbrPatchInfo[edgeI];
|
||||
label meshEdgeI = meshEdges[edgeI];
|
||||
unsigned int edgeVal = edgeValues[meshEdgeI];
|
||||
cop(edgeVal, patchVal);
|
||||
edgeValues[meshEdgeI] = edgeVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -898,7 +898,7 @@ void Foam::parMetisDecomp::calcMetisDistributedCSR
|
||||
}
|
||||
|
||||
// Get the cell on the other side of coupled patches
|
||||
syncTools::swapBoundaryFaceList(mesh, globalNeighbour, false);
|
||||
syncTools::swapBoundaryFaceList(mesh, globalNeighbour);
|
||||
|
||||
|
||||
// Count number of faces (internal + coupled)
|
||||
|
||||
@ -119,8 +119,7 @@ void Foam::attachDetach::attachInterface
|
||||
-1, // patch for face
|
||||
false, // remove from zone
|
||||
faceZoneID_.index(), // zone for face
|
||||
mfFlip[faceI], // face flip in zone
|
||||
-1 // subpatch
|
||||
mfFlip[faceI] // face flip in zone
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -139,8 +138,7 @@ void Foam::attachDetach::attachInterface
|
||||
-1, // patch for face
|
||||
false, // remove from zone
|
||||
faceZoneID_.index(), // zone for face
|
||||
!mfFlip[faceI], // face flip in zone
|
||||
-1 // subpatch
|
||||
!mfFlip[faceI] // face flip in zone
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -210,13 +208,10 @@ void Foam::attachDetach::attachInterface
|
||||
];
|
||||
}
|
||||
|
||||
labelPair patchIDs = polyTopoChange::whichPatch
|
||||
(
|
||||
mesh.boundaryMesh(),
|
||||
curFaceID
|
||||
);
|
||||
|
||||
label patchID = mesh.boundaryMesh().whichPatch(curFaceID);
|
||||
label neiCell;
|
||||
if (patchIDs[0] == -1)
|
||||
if (patchID == -1)
|
||||
{
|
||||
neiCell = nei[curFaceID];
|
||||
}
|
||||
@ -225,6 +220,7 @@ void Foam::attachDetach::attachInterface
|
||||
neiCell = -1;
|
||||
}
|
||||
|
||||
|
||||
// Modify the face
|
||||
ref.setAction
|
||||
(
|
||||
@ -235,11 +231,10 @@ void Foam::attachDetach::attachInterface
|
||||
own[curFaceID], // owner
|
||||
neiCell, // neighbour
|
||||
false, // face flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
false, // remove from zone
|
||||
modifiedFaceZone, // zone for face
|
||||
modifiedFaceZoneFlip, // face flip in zone
|
||||
patchIDs[1]
|
||||
modifiedFaceZoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -265,7 +260,7 @@ void Foam::attachDetach::modifyMotionPoints
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "void attachDetach::modifyMotionPoints("
|
||||
Pout<< "void attachDetach::modifyMotionPoints("
|
||||
<< "pointField& motionPoints) const "
|
||||
<< " for object " << name() << " : "
|
||||
<< "Adjusting motion points." << endl;
|
||||
|
||||
@ -47,7 +47,7 @@ void Foam::attachDetach::detachInterface
|
||||
// into the slave patch
|
||||
// 3. Create a point renumbering list, giving a new point index for original
|
||||
// points in the face patch
|
||||
// 4. Grab all faces in cells on the master side and renumber them
|
||||
// 4. Grab all faces in cells on the master side and renumber them
|
||||
// using the point renumbering list. Exclude the ones that belong to
|
||||
// the master face zone
|
||||
//
|
||||
@ -211,8 +211,7 @@ void Foam::attachDetach::detachInterface
|
||||
masterPatchID_.index(), // patch for face
|
||||
false, // remove from zone
|
||||
faceZoneID_.index(), // zone for face
|
||||
!mfFlip[faceI], // face flip in zone
|
||||
-1 // sub patch
|
||||
!mfFlip[faceI] // face flip in zone
|
||||
)
|
||||
);
|
||||
|
||||
@ -231,8 +230,7 @@ void Foam::attachDetach::detachInterface
|
||||
false, // flip flux
|
||||
slavePatchID_.index(), // patch to add the face to
|
||||
-1, // zone for face
|
||||
false, // zone flip
|
||||
-1 // sub patch
|
||||
false // zone flip
|
||||
)
|
||||
);
|
||||
//{
|
||||
@ -260,8 +258,7 @@ void Foam::attachDetach::detachInterface
|
||||
masterPatchID_.index(), // patch for face
|
||||
false, // remove from zone
|
||||
faceZoneID_.index(), // zone for face
|
||||
mfFlip[faceI], // face flip in zone
|
||||
-1 // sub patch
|
||||
mfFlip[faceI] // face flip in zone
|
||||
)
|
||||
);
|
||||
|
||||
@ -280,8 +277,7 @@ void Foam::attachDetach::detachInterface
|
||||
true, // flip flux
|
||||
slavePatchID_.index(), // patch to add the face to
|
||||
-1, // zone for face
|
||||
false, // face flip in zone
|
||||
-1 // sub patch
|
||||
false // face flip in zone
|
||||
)
|
||||
);
|
||||
//{
|
||||
@ -442,8 +438,7 @@ void Foam::attachDetach::detachInterface
|
||||
-1, // patch for face
|
||||
false, // remove from zone
|
||||
-1, // zone for face
|
||||
false, // face zone flip
|
||||
-1 // sub patch
|
||||
false // face zone flip
|
||||
)
|
||||
);
|
||||
// Pout << "modifying stick-out face. Internal Old face: " << oldFace << " new face: " << newFace << " own: " << own[curFaceID] << " nei: " << nei[curFaceID] << endl;
|
||||
@ -462,12 +457,11 @@ void Foam::attachDetach::detachInterface
|
||||
mesh.boundaryMesh().whichPatch(curFaceID), // patch
|
||||
false, // remove from zone
|
||||
-1, // zone for face
|
||||
false, // face zone flip
|
||||
-1 // sub patch
|
||||
false // face zone flip
|
||||
)
|
||||
);
|
||||
);
|
||||
// Pout << "modifying stick-out face. Boundary Old face: " << oldFace << " new face: " << newFace << " own: " << own[curFaceID] << " patch: " << mesh.boundaryMesh().whichPatch(curFaceID) << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -390,7 +390,7 @@ void Foam::boundaryMesh::markZone
|
||||
// Zones on all edges.
|
||||
labelList edgeZone(mesh().nEdges(), -1);
|
||||
|
||||
while(1)
|
||||
while (true)
|
||||
{
|
||||
changedEdges = faceToEdge
|
||||
(
|
||||
|
||||
@ -85,7 +85,7 @@ public:
|
||||
|
||||
//- Construct as copy, resetting the index
|
||||
boundaryPatch(const boundaryPatch&, const label index);
|
||||
|
||||
|
||||
//- Clone
|
||||
autoPtr<boundaryPatch> clone() const;
|
||||
|
||||
|
||||
@ -147,7 +147,7 @@ void Foam::fvMeshAdder::MapVolField
|
||||
if (newPatchI != -1)
|
||||
{
|
||||
labelList newToOld
|
||||
(
|
||||
(
|
||||
calcPatchMap
|
||||
(
|
||||
oldPatchStarts[patchI],
|
||||
@ -209,7 +209,7 @@ void Foam::fvMeshAdder::MapVolField
|
||||
|
||||
// From new patch faces to patch faces on added mesh.
|
||||
labelList newToAdded
|
||||
(
|
||||
(
|
||||
calcPatchMap
|
||||
(
|
||||
oldPatch.start(),
|
||||
@ -242,7 +242,7 @@ void Foam::fvMeshAdder::MapVolField
|
||||
// From new patch faces to patch faces on added mesh. This
|
||||
// time keep unmapped elements -1.
|
||||
labelList newToAdded
|
||||
(
|
||||
(
|
||||
calcPatchMap
|
||||
(
|
||||
oldPatch.start(),
|
||||
@ -299,7 +299,7 @@ void Foam::fvMeshAdder::MapVolFields
|
||||
// It is necessary to enforce that all old-time fields are stored
|
||||
// before the mapping is performed. Otherwise, if the
|
||||
// old-time-level field is mapped before the field itself, sizes
|
||||
// will not match.
|
||||
// will not match.
|
||||
|
||||
for
|
||||
(
|
||||
@ -462,7 +462,7 @@ void Foam::fvMeshAdder::MapSurfaceField
|
||||
if (newPatchI != -1)
|
||||
{
|
||||
labelList newToOld
|
||||
(
|
||||
(
|
||||
calcPatchMap
|
||||
(
|
||||
oldPatchStarts[patchI],
|
||||
@ -524,7 +524,7 @@ void Foam::fvMeshAdder::MapSurfaceField
|
||||
|
||||
// From new patch faces to patch faces on added mesh.
|
||||
labelList newToAdded
|
||||
(
|
||||
(
|
||||
calcPatchMap
|
||||
(
|
||||
oldPatch.start(),
|
||||
@ -557,7 +557,7 @@ void Foam::fvMeshAdder::MapSurfaceField
|
||||
// From new patch faces to patch faces on added mesh. This
|
||||
// time keep unmapped elements -1.
|
||||
labelList newToAdded
|
||||
(
|
||||
(
|
||||
calcPatchMap
|
||||
(
|
||||
oldPatch.start(),
|
||||
@ -613,7 +613,7 @@ void Foam::fvMeshAdder::MapSurfaceFields
|
||||
// It is necessary to enforce that all old-time fields are stored
|
||||
// before the mapping is performed. Otherwise, if the
|
||||
// old-time-level field is mapped before the field itself, sizes
|
||||
// will not match.
|
||||
// will not match.
|
||||
|
||||
for
|
||||
(
|
||||
|
||||
@ -448,13 +448,12 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::deleteProcPatches
|
||||
// Repatch the mesh.
|
||||
Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::repatch
|
||||
(
|
||||
const labelList& newPatchID, // per boundary face -1 or new patchID
|
||||
const labelList& newSubPatchID, // ,, -1 or new subpatchID
|
||||
const labelList& newPatchID, // per boundary face -1 or new patchID
|
||||
labelListList& constructFaceMap
|
||||
)
|
||||
{
|
||||
polyTopoChange meshMod(mesh_);
|
||||
|
||||
|
||||
forAll(newPatchID, bFaceI)
|
||||
{
|
||||
if (newPatchID[bFaceI] != -1)
|
||||
@ -482,8 +481,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::repatch
|
||||
newPatchID[bFaceI], // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face flip in zone
|
||||
newSubPatchID
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -627,8 +625,7 @@ void Foam::fvMeshDistribute::getNeighbourData
|
||||
const labelList& distribution,
|
||||
labelList& sourceFace,
|
||||
labelList& sourceProc,
|
||||
labelList& sourceNewProc,
|
||||
labelList& sourceSubPatch
|
||||
labelList& sourceNewProc
|
||||
) const
|
||||
{
|
||||
label nBnd = mesh_.nFaces() - mesh_.nInternalFaces();
|
||||
@ -736,18 +733,15 @@ void Foam::fvMeshDistribute::subsetBoundaryData
|
||||
const labelList& sourceFace,
|
||||
const labelList& sourceProc,
|
||||
const labelList& sourceNewProc,
|
||||
const labelList& sourceSubPatch,
|
||||
|
||||
labelList& subFace,
|
||||
labelList& subProc,
|
||||
labelList& subNewProc,
|
||||
labelList& subSubPatch
|
||||
labelList& subNewProc
|
||||
)
|
||||
{
|
||||
subFace.setSize(mesh.nFaces() - mesh.nInternalFaces());
|
||||
subProc.setSize(mesh.nFaces() - mesh.nInternalFaces());
|
||||
subNewProc.setSize(mesh.nFaces() - mesh.nInternalFaces());
|
||||
subSubPatch.setSize(mesh.nFaces() - mesh.nInternalFaces());
|
||||
|
||||
forAll(subFace, newBFaceI)
|
||||
{
|
||||
@ -760,7 +754,6 @@ void Foam::fvMeshDistribute::subsetBoundaryData
|
||||
{
|
||||
subFace[newBFaceI] = oldFaceI;
|
||||
subProc[newBFaceI] = Pstream::myProcNo();
|
||||
subSubPatch[newBFaceI] = -1;
|
||||
|
||||
label oldOwn = oldFaceOwner[oldFaceI];
|
||||
label oldNei = oldFaceNeighbour[oldFaceI];
|
||||
@ -784,7 +777,6 @@ void Foam::fvMeshDistribute::subsetBoundaryData
|
||||
subFace[newBFaceI] = sourceFace[oldBFaceI];
|
||||
subProc[newBFaceI] = sourceProc[oldBFaceI];
|
||||
subNewProc[newBFaceI] = sourceNewProc[oldBFaceI];
|
||||
subSubPatch[newBFaceI] = sourceSubPatch[oldBFaceI];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -944,7 +936,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::doRemoveCells
|
||||
void Foam::fvMeshDistribute::addProcPatches
|
||||
(
|
||||
const labelList& neighbourNewProc, // processor that neighbour is on
|
||||
labelList& procPatchID
|
||||
labelList& procPatchID
|
||||
)
|
||||
{
|
||||
// Now use the neighbourFace/Proc to repatch the mesh. These two lists
|
||||
@ -1065,7 +1057,6 @@ void Foam::fvMeshDistribute::sendMesh
|
||||
const labelList& sourceFace,
|
||||
const labelList& sourceProc,
|
||||
const labelList& sourceNewProc,
|
||||
const labelList& sourceSubPatch,
|
||||
UOPstream& toDomain
|
||||
)
|
||||
{
|
||||
@ -1201,8 +1192,6 @@ void Foam::fvMeshDistribute::sendMesh
|
||||
|
||||
<< sourceFace
|
||||
<< sourceProc
|
||||
<< sourceNewProc
|
||||
<< sourceSubPatch
|
||||
<< sourceNewProc;
|
||||
|
||||
|
||||
@ -1225,7 +1214,6 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshDistribute::receiveMesh
|
||||
labelList& domainSourceFace,
|
||||
labelList& domainSourceProc,
|
||||
labelList& domainSourceNewProc,
|
||||
labelList& domainSourceSubPatch,
|
||||
UIPstream& fromNbr
|
||||
)
|
||||
{
|
||||
@ -1243,13 +1231,12 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshDistribute::receiveMesh
|
||||
fromNbr
|
||||
>> domainSourceFace
|
||||
>> domainSourceProc
|
||||
>> domainSourceNewProc
|
||||
>> domainSourceSubPatch;
|
||||
>> domainSourceNewProc;
|
||||
|
||||
// Construct fvMesh
|
||||
autoPtr<fvMesh> domainMeshPtr
|
||||
(
|
||||
new fvMesh
|
||||
new fvMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -1464,24 +1451,14 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
// sourceProc = -1
|
||||
// sourceNewProc = -1
|
||||
// sourceFace = patchID
|
||||
// sourceSubPatch = -1
|
||||
// coupled boundary:
|
||||
// sourceProc = proc
|
||||
// sourceNewProc = distribution[cell on proc]
|
||||
// sourceFace = face
|
||||
// sourceSubPatch = sub patch (only if processor face)
|
||||
labelList sourceFace;
|
||||
labelList sourceProc;
|
||||
labelList sourceNewProc;
|
||||
labelList sourceSubPatch;
|
||||
getNeighbourData
|
||||
(
|
||||
distribution,
|
||||
sourceFace,
|
||||
sourceProc,
|
||||
sourceNewProc,
|
||||
sourceSubPatch
|
||||
);
|
||||
getNeighbourData(distribution, sourceFace, sourceProc, sourceNewProc);
|
||||
|
||||
|
||||
// Remove meshPhi. Since this would otherwise disappear anyway
|
||||
@ -1554,7 +1531,6 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
inplaceReorder(bFaceMap, sourceFace);
|
||||
inplaceReorder(bFaceMap, sourceProc);
|
||||
inplaceReorder(bFaceMap, sourceNewProc);
|
||||
inplaceReorder(bFaceMap, sourceSubPatch);
|
||||
}
|
||||
|
||||
|
||||
@ -1658,7 +1634,6 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
labelList procSourceFace;
|
||||
labelList procSourceProc;
|
||||
labelList procSourceNewProc;
|
||||
labelList procSourceSubPatch;
|
||||
|
||||
subsetBoundaryData
|
||||
(
|
||||
@ -1674,12 +1649,10 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
sourceFace,
|
||||
sourceProc,
|
||||
sourceNewProc,
|
||||
sourceSubPatch,
|
||||
|
||||
procSourceFace,
|
||||
procSourceProc,
|
||||
procSourceNewProc,
|
||||
procSourceSubPatch
|
||||
procSourceNewProc
|
||||
);
|
||||
|
||||
|
||||
@ -1697,7 +1670,6 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
procSourceFace,
|
||||
procSourceProc,
|
||||
procSourceNewProc,
|
||||
procSourceSubPatch,
|
||||
str
|
||||
);
|
||||
sendFields<volScalarField>(recvProc, volScalars, subsetter, str);
|
||||
@ -1733,7 +1705,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
str
|
||||
);
|
||||
sendFields<surfaceSphericalTensorField>
|
||||
(
|
||||
(
|
||||
recvProc,
|
||||
surfSphereTensors,
|
||||
subsetter,
|
||||
@ -1801,7 +1773,6 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
labelList domainSourceFace;
|
||||
labelList domainSourceProc;
|
||||
labelList domainSourceNewProc;
|
||||
labelList domainSourceSubPatch;
|
||||
|
||||
subsetBoundaryData
|
||||
(
|
||||
@ -1817,18 +1788,15 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
sourceFace,
|
||||
sourceProc,
|
||||
sourceNewProc,
|
||||
sourceSubPatch,
|
||||
|
||||
domainSourceFace,
|
||||
domainSourceProc,
|
||||
domainSourceNewProc,
|
||||
domainSourceSubPatch
|
||||
domainSourceNewProc
|
||||
);
|
||||
|
||||
sourceFace.transfer(domainSourceFace);
|
||||
sourceProc.transfer(domainSourceProc);
|
||||
sourceNewProc.transfer(domainSourceNewProc);
|
||||
sourceSubPatch.transfer(domainSourceSubPatch);
|
||||
}
|
||||
|
||||
|
||||
@ -1882,8 +1850,8 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
labelList domainSourceFace;
|
||||
labelList domainSourceProc;
|
||||
labelList domainSourceNewProc;
|
||||
labelList domainSourceSubPatch;
|
||||
|
||||
autoPtr<fvMesh> domainMeshPtr;
|
||||
PtrList<volScalarField> vsf;
|
||||
PtrList<volVectorField> vvf;
|
||||
PtrList<volSphericalTensorField> vsptf;
|
||||
@ -1908,7 +1876,6 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
domainSourceFace,
|
||||
domainSourceProc,
|
||||
domainSourceNewProc,
|
||||
domainSourceSubPatch
|
||||
str
|
||||
);
|
||||
fvMesh& domainMesh = domainMeshPtr();
|
||||
@ -2079,7 +2046,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
// Update mesh data: sourceFace,sourceProc for added
|
||||
// mesh.
|
||||
|
||||
sourceFace =
|
||||
sourceFace =
|
||||
mapBoundaryData
|
||||
(
|
||||
mesh_,
|
||||
@ -2088,7 +2055,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
domainMesh.nInternalFaces(),
|
||||
domainSourceFace
|
||||
);
|
||||
sourceProc =
|
||||
sourceProc =
|
||||
mapBoundaryData
|
||||
(
|
||||
mesh_,
|
||||
@ -2097,7 +2064,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
domainMesh.nInternalFaces(),
|
||||
domainSourceProc
|
||||
);
|
||||
sourceNewProc =
|
||||
sourceNewProc =
|
||||
mapBoundaryData
|
||||
(
|
||||
mesh_,
|
||||
|
||||
@ -54,7 +54,6 @@ SourceFiles
|
||||
#define fvMeshDistribute_H
|
||||
|
||||
#include "Field.H"
|
||||
#include "uLabel.H"
|
||||
#include "fvMeshSubset.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -289,7 +289,7 @@ void Foam::fvMeshDistribute::initPatchFields
|
||||
// }
|
||||
|
||||
// volVectorField {U {internalField ..; boundaryField ..;}}
|
||||
//
|
||||
//
|
||||
template<class GeoField>
|
||||
void Foam::fvMeshDistribute::sendFields
|
||||
(
|
||||
|
||||
@ -167,11 +167,11 @@ void Foam::layerAdditionRemoval::addCellLayer
|
||||
(
|
||||
polyAddCell
|
||||
(
|
||||
-1, // master point
|
||||
-1, // master edge
|
||||
mf[faceI], // master face
|
||||
-1, // master cell
|
||||
-1 // zone for cell
|
||||
-1, // master point
|
||||
-1, // master edge
|
||||
mf[faceI], // master face
|
||||
-1, // master cell
|
||||
-1 // zone for cell
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -216,17 +216,16 @@ void Foam::layerAdditionRemoval::addCellLayer
|
||||
(
|
||||
polyAddFace
|
||||
(
|
||||
newFace, // face
|
||||
mc[faceI], // owner
|
||||
addedCells[faceI], // neighbour
|
||||
-1, // master point
|
||||
-1, // master edge
|
||||
mf[faceI], // master face for addition
|
||||
flipFaceFlux, // flux flip
|
||||
-1, // patch for face
|
||||
-1, // zone for face
|
||||
false, // face zone flip
|
||||
-1 // sub patch for face
|
||||
newFace, // face
|
||||
mc[faceI], // owner
|
||||
addedCells[faceI], // neighbour
|
||||
-1, // master point
|
||||
-1, // master edge
|
||||
mf[faceI], // master face for addition
|
||||
flipFaceFlux, // flux flip
|
||||
-1, // patch for face
|
||||
-1, // zone for face
|
||||
false // face zone flip
|
||||
)
|
||||
);
|
||||
|
||||
@ -241,15 +240,6 @@ void Foam::layerAdditionRemoval::addCellLayer
|
||||
{
|
||||
const label curfaceID = mf[faceI];
|
||||
|
||||
labelPair patchIDs
|
||||
(
|
||||
polyTopoChange::whichPatch
|
||||
(
|
||||
mesh.boundaryMesh(),
|
||||
curfaceID
|
||||
)
|
||||
);
|
||||
|
||||
// If the face is internal, modify its owner to be the newly
|
||||
// created cell. No flip is necessary
|
||||
if (!mesh.isInternalFace(curfaceID))
|
||||
@ -258,16 +248,15 @@ void Foam::layerAdditionRemoval::addCellLayer
|
||||
(
|
||||
polyModifyFace
|
||||
(
|
||||
faces[curfaceID], // modified face
|
||||
curfaceID, // label of face being modified
|
||||
addedCells[faceI], // owner
|
||||
-1, // neighbour
|
||||
false, // face flip
|
||||
patchIDs[0], // patch for face
|
||||
false, // remove from zone
|
||||
faceZoneID_.index(), // zone for face
|
||||
mfFlip[faceI], // face flip in zone
|
||||
patchIDs[1] // subpatch id
|
||||
faces[curfaceID], // modified face
|
||||
curfaceID, // label of face being modified
|
||||
addedCells[faceI], // owner
|
||||
-1, // neighbour
|
||||
false, // face flip
|
||||
mesh.boundaryMesh().whichPatch(curfaceID),// patch for face
|
||||
false, // remove from zone
|
||||
faceZoneID_.index(), // zone for face
|
||||
mfFlip[faceI] // face flip in zone
|
||||
)
|
||||
);
|
||||
// Pout << "Modifying a boundary face. Face: " << curfaceID << " flip: " << mfFlip[faceI] << endl;
|
||||
@ -282,16 +271,15 @@ void Foam::layerAdditionRemoval::addCellLayer
|
||||
(
|
||||
polyModifyFace
|
||||
(
|
||||
faces[curfaceID], // modified face
|
||||
curfaceID, // label of face being modified
|
||||
own[curfaceID], // owner
|
||||
addedCells[faceI], // neighbour
|
||||
false, // face flip
|
||||
patchIDs[0], // patch for face
|
||||
false, // remove from zone
|
||||
faceZoneID_.index(), // zone for face
|
||||
mfFlip[faceI], // face flip in zone
|
||||
patchIDs[1] // subpatch id
|
||||
faces[curfaceID], // modified face
|
||||
curfaceID, // label of face being modified
|
||||
own[curfaceID], // owner
|
||||
addedCells[faceI], // neighbour
|
||||
false, // face flip
|
||||
mesh.boundaryMesh().whichPatch(curfaceID),// patch for face
|
||||
false, // remove from zone
|
||||
faceZoneID_.index(), // zone for face
|
||||
mfFlip[faceI] // face flip in zone
|
||||
)
|
||||
);
|
||||
|
||||
@ -305,15 +293,14 @@ void Foam::layerAdditionRemoval::addCellLayer
|
||||
polyModifyFace
|
||||
(
|
||||
faces[curfaceID].reverseFace(), // modified face
|
||||
curfaceID, // label of face being modified
|
||||
curfaceID, // label of face being modified
|
||||
nei[curfaceID], // owner
|
||||
addedCells[faceI], // neighbour
|
||||
true, // face flip
|
||||
patchIDs[0], // patch for face
|
||||
mesh.boundaryMesh().whichPatch(curfaceID), // patch for face
|
||||
false, // remove from zone
|
||||
faceZoneID_.index(), // zone for face
|
||||
!mfFlip[faceI], // face flip in zone
|
||||
patchIDs[1] // subpatch id
|
||||
!mfFlip[faceI] // face flip in zone
|
||||
)
|
||||
);
|
||||
// Pout << "modify face, with flip " << curfaceID << " own: " << own[curfaceID] << " nei: " << addedCells[faceI] << endl;
|
||||
@ -345,17 +332,16 @@ void Foam::layerAdditionRemoval::addCellLayer
|
||||
(
|
||||
polyAddFace
|
||||
(
|
||||
newFace, // face
|
||||
addedCells[edgeFaces[curEdgeID][0]], // owner
|
||||
addedCells[edgeFaces[curEdgeID][1]], // neighbour
|
||||
-1, // master point
|
||||
meshEdges[curEdgeID], // master edge
|
||||
-1, // master face
|
||||
false, // flip flux
|
||||
-1, // patch for face
|
||||
-1, // zone for face
|
||||
false, // face zone flip
|
||||
-1 // subpatch id
|
||||
newFace, // face
|
||||
addedCells[edgeFaces[curEdgeID][0]], // owner
|
||||
addedCells[edgeFaces[curEdgeID][1]], // neighbour
|
||||
-1, // master point
|
||||
meshEdges[curEdgeID], // master edge
|
||||
-1, // master face
|
||||
false, // flip flux
|
||||
-1, // patch for face
|
||||
-1, // zone for face
|
||||
false // face zone flip
|
||||
)
|
||||
);
|
||||
|
||||
@ -393,7 +379,7 @@ void Foam::layerAdditionRemoval::addCellLayer
|
||||
// Determine the patch for insertion
|
||||
const labelList& curFaces = meshEdgeFaces[meshEdges[curEdgeID]];
|
||||
|
||||
labelPair patchIDs(-1, -1);
|
||||
label patchID = -1;
|
||||
label zoneID = -1;
|
||||
|
||||
forAll (curFaces, faceI)
|
||||
@ -406,11 +392,7 @@ void Foam::layerAdditionRemoval::addCellLayer
|
||||
if (zoneMesh.whichZone(cf) != faceZoneID_.index())
|
||||
{
|
||||
// Found the face in a boundary patch which is not in zone
|
||||
patchIDs = polyTopoChange::whichPatch
|
||||
(
|
||||
mesh.boundaryMesh(),
|
||||
cf
|
||||
);
|
||||
patchID = mesh.boundaryMesh().whichPatch(cf);
|
||||
zoneID = mesh.faceZones().whichZone(cf);
|
||||
|
||||
break;
|
||||
@ -418,7 +400,7 @@ void Foam::layerAdditionRemoval::addCellLayer
|
||||
}
|
||||
}
|
||||
|
||||
if (patchIDs[0] < 0)
|
||||
if (patchID < 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
@ -433,17 +415,16 @@ void Foam::layerAdditionRemoval::addCellLayer
|
||||
(
|
||||
polyAddFace
|
||||
(
|
||||
newFace, // face
|
||||
addedCells[edgeFaces[curEdgeID][0]], // owner
|
||||
-1, // neighbour
|
||||
-1, // master point
|
||||
meshEdges[curEdgeID], // master edge
|
||||
-1, // master face
|
||||
false, // flip flux
|
||||
patchIDs[0], // patch for face
|
||||
zoneID, // zone
|
||||
false, // zone face flip
|
||||
patchIDs[1] // subpatch id
|
||||
newFace, // face
|
||||
addedCells[edgeFaces[curEdgeID][0]], // owner
|
||||
-1, // neighbour
|
||||
-1, // master point
|
||||
meshEdges[curEdgeID], // master edge
|
||||
-1, // master face
|
||||
false, // flip flux
|
||||
patchID, // patch for face
|
||||
zoneID, // zone
|
||||
false // zone face flip
|
||||
)
|
||||
);
|
||||
// Pout << "add boundary face: " << newFace << " into patch " << patchID << " own: " << addedCells[edgeFaces[curEdgeID][0]] << endl;
|
||||
@ -553,20 +534,13 @@ void Foam::layerAdditionRemoval::addCellLayer
|
||||
-1, // patch for face
|
||||
false, // remove from zone
|
||||
modifiedFaceZone, // zone for face
|
||||
modifiedFaceZoneFlip, // face flip in zone
|
||||
-1 // subpatch ID
|
||||
modifiedFaceZoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
// Pout << "modifying stick-out face. Internal Old face: " << oldFace << " new face: " << newFace << " own: " << own[curFaceID] << " nei: " << nei[curFaceID] << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
labelPair patchIDs = polyTopoChange::whichPatch
|
||||
(
|
||||
mesh.boundaryMesh(),
|
||||
curFaceID
|
||||
);
|
||||
|
||||
ref.setAction
|
||||
(
|
||||
polyModifyFace
|
||||
@ -576,11 +550,10 @@ void Foam::layerAdditionRemoval::addCellLayer
|
||||
own[curFaceID], // owner
|
||||
-1, // neighbour
|
||||
false, // face flip
|
||||
patchIDs[0], // patch for face
|
||||
mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
|
||||
false, // remove from zone
|
||||
modifiedFaceZone, // zone for face
|
||||
modifiedFaceZoneFlip, // face flip in zone
|
||||
patchIDs[1] // subpatch
|
||||
modifiedFaceZoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
// Pout << "modifying stick-out face. Boundary Old face: " << oldFace << " new face: " << newFace << " own: " << own[curFaceID] << " patch: " << mesh.boundaryMesh().whichPatch(curFaceID) << endl;
|
||||
|
||||
@ -235,9 +235,9 @@ void Foam::layerAdditionRemoval::removeCellLayer
|
||||
mesh.faceZones()[modifiedFaceZone].whichFace(curFaceID)
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
label newNei;
|
||||
|
||||
|
||||
if (curFaceID < mesh.nInternalFaces())
|
||||
{
|
||||
newNei = nei[curFaceID];
|
||||
@ -247,12 +247,6 @@ void Foam::layerAdditionRemoval::removeCellLayer
|
||||
newNei = -1;
|
||||
}
|
||||
|
||||
labelPair patchIDs = polyTopoChange::whichPatch
|
||||
(
|
||||
mesh.boundaryMesh(),
|
||||
curFaceID
|
||||
);
|
||||
|
||||
// Modify the face
|
||||
ref.setAction
|
||||
(
|
||||
@ -263,11 +257,10 @@ void Foam::layerAdditionRemoval::removeCellLayer
|
||||
own[curFaceID], // owner
|
||||
newNei, // neighbour
|
||||
false, // face flip
|
||||
patchIDs[0], // patch for face
|
||||
mesh.boundaryMesh().whichPatch(curFaceID),// patch for face
|
||||
false, // remove from zone
|
||||
modifiedFaceZone, // zone for face
|
||||
modifiedFaceZoneFlip, // face flip in zone
|
||||
patchIDs[1] // subpatch
|
||||
modifiedFaceZoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -303,14 +296,12 @@ void Foam::layerAdditionRemoval::removeCellLayer
|
||||
label newOwner = -1;
|
||||
label newNeighbour = -1;
|
||||
bool flipFace = false;
|
||||
labelPair newPatchIDs(-1, -1);
|
||||
//label newPatchID = -1;
|
||||
//label newSubPatchID = -1;
|
||||
label newPatchID = -1;
|
||||
label newZoneID = -1;
|
||||
|
||||
// Is any of the faces a boundary face? If so, grab the patch
|
||||
// A boundary-to-boundary collapse is checked for in validCollapse()
|
||||
// and cannot happen here.
|
||||
// and cannot happen here.
|
||||
|
||||
if (!mesh.isInternalFace(mf[faceI]))
|
||||
{
|
||||
@ -318,11 +309,7 @@ void Foam::layerAdditionRemoval::removeCellLayer
|
||||
newOwner = slaveSideCell;
|
||||
newNeighbour = -1;
|
||||
flipFace = false;
|
||||
newPatchIDs = polyTopoChange::whichPatch
|
||||
(
|
||||
mesh.boundaryMesh(),
|
||||
mf[faceI]
|
||||
);
|
||||
newPatchID = mesh.boundaryMesh().whichPatch(mf[faceI]);
|
||||
newZoneID = mesh.faceZones().whichZone(mf[faceI]);
|
||||
}
|
||||
else if (!mesh.isInternalFace(ftc[faceI]))
|
||||
@ -341,11 +328,7 @@ void Foam::layerAdditionRemoval::removeCellLayer
|
||||
flipFace = true;
|
||||
}
|
||||
|
||||
newPatchIDs = polyTopoChange::whichPatch
|
||||
(
|
||||
mesh.boundaryMesh(),
|
||||
ftc[faceI]
|
||||
);
|
||||
newPatchID = mesh.boundaryMesh().whichPatch(ftc[faceI]);
|
||||
|
||||
// The zone of the master face is preserved
|
||||
newZoneID = mesh.faceZones().whichZone(mf[faceI]);
|
||||
@ -366,7 +349,7 @@ void Foam::layerAdditionRemoval::removeCellLayer
|
||||
flipFace = true;
|
||||
}
|
||||
|
||||
newPatchIDs = labelPair(-1, -1);
|
||||
newPatchID = -1;
|
||||
|
||||
// The zone of the master face is preserved
|
||||
newZoneID = mesh.faceZones().whichZone(mf[faceI]);
|
||||
@ -396,16 +379,15 @@ void Foam::layerAdditionRemoval::removeCellLayer
|
||||
(
|
||||
polyModifyFace
|
||||
(
|
||||
newFace, // modified face
|
||||
mf[faceI], // label of face being modified
|
||||
newOwner, // owner
|
||||
newNeighbour, // neighbour
|
||||
flipFace, // flip
|
||||
newPatchIDs[0], // patch for face
|
||||
false, // remove from zone
|
||||
newZoneID, // new zone
|
||||
zoneFlip, // face flip in zone
|
||||
newPatchIDs[1] // subpatch for face
|
||||
newFace, // modified face
|
||||
mf[faceI], // label of face being modified
|
||||
newOwner, // owner
|
||||
newNeighbour, // neighbour
|
||||
flipFace, // flip
|
||||
newPatchID, // patch for face
|
||||
false, // remove from zone
|
||||
newZoneID, // new zone
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ bool Foam::layerAdditionRemoval::setLayerPairing() const
|
||||
// This is also the most complex part of the topological change.
|
||||
// Therefore it will be calculated here and stored as temporary
|
||||
// data until the actual topological change, after which it will
|
||||
// be cleared.
|
||||
// be cleared.
|
||||
|
||||
// Algorithm for point collapse
|
||||
// 1) Go through the master cell layer and for every face of
|
||||
@ -212,7 +212,7 @@ void Foam::layerAdditionRemoval::modifyMotionPoints
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "void layerAdditionRemoval::modifyMotionPoints("
|
||||
Pout<< "void layerAdditionRemoval::modifyMotionPoints("
|
||||
<< "pointField& motionPoints) const for object "
|
||||
<< name() << " : ";
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ Description
|
||||
- cellAnchorPoints : per cell the vertices on one side which are
|
||||
considered the anchor points.
|
||||
|
||||
AnchorPoints: connected loops have to be oriented in the same way to
|
||||
AnchorPoints: connected loops have to be oriented in the same way to
|
||||
be able to grow new internal faces out of the same bottom faces.
|
||||
(limitation of the mapping procedure). The loop is cellLoop is oriented
|
||||
such that the normal of it points towards the anchorPoints.
|
||||
@ -435,7 +435,7 @@ class cellCuts
|
||||
|
||||
//- Set orientation of loops
|
||||
void orientPlanesAndLoops();
|
||||
|
||||
|
||||
//- top level driver: adressing calculation and loop detection
|
||||
void calcLoopsAndAddressing(const labelList& cutCells);
|
||||
|
||||
@ -592,7 +592,7 @@ public:
|
||||
//- Returns coordinates of points on loop for given cell.
|
||||
// Uses cellLoops_ and edgeWeight_
|
||||
pointField loopPoints(const label cellI) const;
|
||||
|
||||
|
||||
//- Invert anchor point selection.
|
||||
labelList nonAnchorPoints
|
||||
(
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cellLooper.H"
|
||||
|
||||
@ -173,7 +173,7 @@ public:
|
||||
// Cut along circumference is expressed as cellVertCut,
|
||||
// cellEdgeToWeight. Returns true if succesfull. Still might not
|
||||
// be compatible with existing cuts but this should be handled by
|
||||
// caller).
|
||||
// caller).
|
||||
virtual bool cut
|
||||
(
|
||||
const vector& refDir,
|
||||
|
||||
@ -170,7 +170,7 @@ Foam::label Foam::directionInfo::edgeToFaceIndex
|
||||
{
|
||||
// Both not in face.
|
||||
// e is on opposite face. Determine corresponding edge on this face:
|
||||
// - determine two faces using edge (one is the opposite face,
|
||||
// - determine two faces using edge (one is the opposite face,
|
||||
// one is 'side' face
|
||||
// - walk on both these faces to opposite edge
|
||||
// - check if this opposite edge is on faceI
|
||||
@ -264,7 +264,7 @@ bool Foam::directionInfo::updateCell
|
||||
const edge& e = mesh.edges()[edgeI];
|
||||
|
||||
// Find face connected to face through edgeI and on same cell.
|
||||
label faceI =
|
||||
label faceI =
|
||||
meshTools::otherFace
|
||||
(
|
||||
mesh,
|
||||
@ -304,7 +304,7 @@ bool Foam::directionInfo::updateCell
|
||||
n_ = neighbourInfo.n();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Update this face with neighbouring cell information
|
||||
@ -351,7 +351,7 @@ bool Foam::directionInfo::updateFace
|
||||
n_ = neighbourInfo.n();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Merge this with information on same face
|
||||
@ -376,7 +376,7 @@ bool Foam::directionInfo::updateFace
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
@ -41,7 +41,7 @@ Description
|
||||
processors whereas f[0] should correspond to f[0] on other side)
|
||||
|
||||
The rule is that if the label is set (-1 or higher) it is used
|
||||
(topological information only), otherwise the vector is used. This makes
|
||||
(topological information only), otherwise the vector is used. This makes
|
||||
sure that we use topological information as much as possible and so a
|
||||
hex mesh is cut purely topologically. All other shapes are cut
|
||||
geometrically.
|
||||
@ -84,7 +84,7 @@ class directionInfo
|
||||
// Local n axis
|
||||
vector n_;
|
||||
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- edge uses two labels
|
||||
|
||||
@ -93,7 +93,7 @@ inline void Foam::directionInfo::leaveDomain
|
||||
|
||||
// index_ is offset in face on other side. So reverse it here.
|
||||
// (Note: f[0] on other domain is connected to f[0] in this domain,
|
||||
// f[1] ,, f[size-1] ,,
|
||||
// f[1] ,, f[size-1] ,,
|
||||
// etc.)
|
||||
inline void Foam::directionInfo::enterDomain
|
||||
(
|
||||
|
||||
@ -181,7 +181,7 @@ Foam::vectorField Foam::directions::propagateDirection
|
||||
changedFacesInfo[patchFaceI] =
|
||||
directionInfo
|
||||
(
|
||||
faceIndex,
|
||||
faceIndex,
|
||||
cutDir
|
||||
);
|
||||
}
|
||||
@ -404,7 +404,7 @@ Foam::directions::directions
|
||||
|
||||
if (wantTan1 || wantTan2)
|
||||
{
|
||||
tan1Dirs =
|
||||
tan1Dirs =
|
||||
propagateDirection
|
||||
(
|
||||
mesh,
|
||||
|
||||
@ -30,7 +30,7 @@ Description
|
||||
or one set of directions per cell.
|
||||
|
||||
Used in splitting cells.
|
||||
Either all cells have similar refinement direction ('global') or
|
||||
Either all cells have similar refinement direction ('global') or
|
||||
direction is dependent on local cell geometry. Controlled by dictionary.
|
||||
|
||||
SourceFiles
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "edgeVertex.H"
|
||||
|
||||
@ -118,7 +118,7 @@ public:
|
||||
<< (mesh.nPoints() + mesh.nEdges() - 1)
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
return eVert >= mesh.nPoints();
|
||||
}
|
||||
bool isEdge(const label eVert) const
|
||||
@ -154,7 +154,7 @@ public:
|
||||
"edgeVertex::getVertex(const primitiveMesh&, const label)"
|
||||
) << "EdgeVertex " << eVert << " not a vertex"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
return eVert;
|
||||
}
|
||||
label getVertex(const label eVert) const
|
||||
@ -210,7 +210,7 @@ public:
|
||||
return coord(mesh_, cut, weight);
|
||||
}
|
||||
|
||||
//- Find mesh edge (or -1) between two cuts.
|
||||
//- Find mesh edge (or -1) between two cuts.
|
||||
static label cutPairToEdge
|
||||
(
|
||||
const primitiveMesh&,
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "boundaryCutter.H"
|
||||
@ -39,12 +37,7 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(boundaryCutter, 0);
|
||||
|
||||
}
|
||||
defineTypeNameAndDebug(Foam::boundaryCutter, 0);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Static Functions * * * * * * * * * * * //
|
||||
@ -55,12 +48,17 @@ defineTypeNameAndDebug(boundaryCutter, 0);
|
||||
void Foam::boundaryCutter::getFaceInfo
|
||||
(
|
||||
const label faceI,
|
||||
labelPair& patchIDs,
|
||||
label& patchID,
|
||||
label& zoneID,
|
||||
label& zoneFlip
|
||||
) const
|
||||
{
|
||||
patchIDs = polyTopoChange::whichPatch(mesh_.boundaryMesh(), faceI);
|
||||
patchID = -1;
|
||||
|
||||
if (!mesh_.isInternalFace(faceI))
|
||||
{
|
||||
patchID = mesh_.boundaryMesh().whichPatch(faceI);
|
||||
}
|
||||
|
||||
zoneID = mesh_.faceZones().whichZone(faceI);
|
||||
|
||||
@ -150,28 +148,26 @@ void Foam::boundaryCutter::addFace
|
||||
) const
|
||||
{
|
||||
// Information about old face
|
||||
label zoneID, zoneFlip;
|
||||
labelPair patchIDs;
|
||||
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
|
||||
label patchID, zoneID, zoneFlip;
|
||||
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
|
||||
label own = mesh_.faceOwner()[faceI];
|
||||
label masterPoint = mesh_.faces()[faceI][0];
|
||||
|
||||
|
||||
if (!modifiedFace)
|
||||
{
|
||||
meshMod.setAction
|
||||
(
|
||||
polyModifyFace
|
||||
(
|
||||
newFace, // face
|
||||
newFace, // face
|
||||
faceI,
|
||||
own, // owner
|
||||
-1, // neighbour
|
||||
false, // flux flip
|
||||
patchIDs[0], // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face zone flip
|
||||
patchIDs[1] // subPatch ID
|
||||
own, // owner
|
||||
-1, // neighbour
|
||||
false, // flux flip
|
||||
patchID, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip // face zone flip
|
||||
)
|
||||
);
|
||||
|
||||
@ -190,10 +186,9 @@ void Foam::boundaryCutter::addFace
|
||||
-1, // master edge
|
||||
-1, // master face for addition
|
||||
false, // flux flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face zone flip
|
||||
patchIDs[1]
|
||||
zoneFlip // face zone flip
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -201,7 +196,7 @@ void Foam::boundaryCutter::addFace
|
||||
|
||||
|
||||
|
||||
// Splits a face using the cut edges and modified points
|
||||
// Splits a face using the cut edges and modified points
|
||||
bool Foam::boundaryCutter::splitFace
|
||||
(
|
||||
const label faceI,
|
||||
@ -271,6 +266,10 @@ bool Foam::boundaryCutter::splitFace
|
||||
// - walk to next cut. Make face
|
||||
// - loop until face done.
|
||||
|
||||
// Information about old face
|
||||
label patchID, zoneID, zoneFlip;
|
||||
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
|
||||
|
||||
// Get face with new points on cut edges for ease of looping
|
||||
face extendedFace(addEdgeCutsToFace(faceI, edgeToAddedPoints));
|
||||
|
||||
@ -565,9 +564,8 @@ void Foam::boundaryCutter::setRefinement
|
||||
label addedPointI = iter();
|
||||
|
||||
// Information about old face
|
||||
labelPair patchIDs;
|
||||
label zoneID, zoneFlip;
|
||||
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
|
||||
label patchID, zoneID, zoneFlip;
|
||||
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
|
||||
label own = mesh_.faceOwner()[faceI];
|
||||
label masterPoint = mesh_.faces()[faceI][0];
|
||||
|
||||
@ -595,11 +593,10 @@ void Foam::boundaryCutter::setRefinement
|
||||
own, // owner
|
||||
-1, // neighbour
|
||||
false, // flux flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face zone flip
|
||||
patchIDs[1]
|
||||
zoneFlip // face zone flip
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -617,10 +614,9 @@ void Foam::boundaryCutter::setRefinement
|
||||
-1, // master edge
|
||||
-1, // master face for addition
|
||||
false, // flux flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face zone flip
|
||||
patchIDs[1]
|
||||
zoneFlip // face zone flip
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -651,9 +647,8 @@ void Foam::boundaryCutter::setRefinement
|
||||
face newFace(addEdgeCutsToFace(faceI, edgeToAddedPoints));
|
||||
|
||||
// Information about old face
|
||||
labelPair patchIDs;
|
||||
label zoneID, zoneFlip;
|
||||
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
|
||||
label patchID, zoneID, zoneFlip;
|
||||
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
|
||||
label own = mesh_.faceOwner()[faceI];
|
||||
label masterPoint = mesh_.faces()[faceI][0];
|
||||
|
||||
@ -701,11 +696,10 @@ void Foam::boundaryCutter::setRefinement
|
||||
own, // owner
|
||||
-1, // neighbour
|
||||
false, // flux flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face zone flip
|
||||
patchIDs[1]
|
||||
zoneFlip // face zone flip
|
||||
)
|
||||
);
|
||||
|
||||
@ -736,10 +730,9 @@ void Foam::boundaryCutter::setRefinement
|
||||
-1, // master edge
|
||||
-1, // master face for addition
|
||||
false, // flux flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face zone flip
|
||||
patchIDs[1]
|
||||
zoneFlip // face zone flip
|
||||
)
|
||||
);
|
||||
|
||||
@ -755,7 +748,7 @@ void Foam::boundaryCutter::setRefinement
|
||||
|
||||
const labelList& eFaces = mesh_.edgeFaces()[edgeI];
|
||||
|
||||
forAll(eFaces, i)
|
||||
forAll(eFaces, i)
|
||||
{
|
||||
label faceI = eFaces[i];
|
||||
|
||||
@ -781,7 +774,7 @@ void Foam::boundaryCutter::setRefinement
|
||||
|
||||
const labelList& eFaces = mesh_.edgeFaces()[edgeI];
|
||||
|
||||
forAll(eFaces, i)
|
||||
forAll(eFaces, i)
|
||||
{
|
||||
label faceI = eFaces[i];
|
||||
|
||||
@ -799,9 +792,8 @@ void Foam::boundaryCutter::setRefinement
|
||||
nei = mesh_.faceNeighbour()[faceI];
|
||||
}
|
||||
|
||||
labelPair patchIDs;
|
||||
label zoneID, zoneFlip;
|
||||
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
|
||||
label patchID, zoneID, zoneFlip;
|
||||
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
|
||||
|
||||
meshMod.setAction
|
||||
(
|
||||
@ -812,11 +804,10 @@ void Foam::boundaryCutter::setRefinement
|
||||
own, // owner
|
||||
nei, // neighbour
|
||||
false, // face flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face flip in zone
|
||||
patchIDs[1]
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ class boundaryCutter
|
||||
void getFaceInfo
|
||||
(
|
||||
const label faceI,
|
||||
labelPair& patchID,
|
||||
label& patchID,
|
||||
label& zoneID,
|
||||
label& zoneFlip
|
||||
) const;
|
||||
|
||||
@ -183,7 +183,7 @@ void Foam::meshCutAndRemove::faceCells
|
||||
const label faceI,
|
||||
label& own,
|
||||
label& nei,
|
||||
labelPair& patchIDs
|
||||
label& patchID
|
||||
) const
|
||||
{
|
||||
const labelListList& anchorPts = cuts.cellAnchorPoints();
|
||||
@ -211,12 +211,12 @@ void Foam::meshCutAndRemove::faceCells
|
||||
}
|
||||
}
|
||||
|
||||
patchIDs = polyTopoChange::whichPatch(mesh().boundaryMesh(), faceI);
|
||||
patchID = mesh().boundaryMesh().whichPatch(faceI);
|
||||
|
||||
if (patchIDs[0] == -1 && (own == -1 || nei == -1))
|
||||
if (patchID == -1 && (own == -1 || nei == -1))
|
||||
{
|
||||
// Face was internal but becomes external
|
||||
patchIDs[0] = exposedPatchI;
|
||||
patchID = exposedPatchI;
|
||||
}
|
||||
}
|
||||
|
||||
@ -250,7 +250,7 @@ void Foam::meshCutAndRemove::addFace
|
||||
const face& newFace,
|
||||
const label own,
|
||||
const label nei,
|
||||
const labelPair& patchIDs
|
||||
const label patchID
|
||||
)
|
||||
{
|
||||
label zoneID;
|
||||
@ -266,7 +266,7 @@ void Foam::meshCutAndRemove::addFace
|
||||
Pout<< "Adding face " << newFace
|
||||
<< " with new owner:" << own
|
||||
<< " with new neighbour:" << nei
|
||||
<< " patchIDs:" << patchIDs
|
||||
<< " patchID:" << patchID
|
||||
<< " anchor:" << masterPointI
|
||||
<< " zoneID:" << zoneID
|
||||
<< " zoneFlip:" << zoneFlip
|
||||
@ -284,10 +284,9 @@ void Foam::meshCutAndRemove::addFace
|
||||
-1, // master edge
|
||||
-1, // master face for addition
|
||||
false, // flux flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face zone flip
|
||||
patchIDs[1]
|
||||
zoneFlip // face zone flip
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -299,7 +298,7 @@ void Foam::meshCutAndRemove::addFace
|
||||
Pout<< "Adding (reversed) face " << newFace.reverseFace()
|
||||
<< " with new owner:" << nei
|
||||
<< " with new neighbour:" << own
|
||||
<< " patchIDs:" << patchIDs
|
||||
<< " patchID:" << patchID
|
||||
<< " anchor:" << masterPointI
|
||||
<< " zoneID:" << zoneID
|
||||
<< " zoneFlip:" << zoneFlip
|
||||
@ -317,10 +316,9 @@ void Foam::meshCutAndRemove::addFace
|
||||
-1, // master edge
|
||||
-1, // master face for addition
|
||||
false, // flux flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face zone flip
|
||||
patchIDs[1]
|
||||
zoneFlip // face zone flip
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -335,7 +333,7 @@ void Foam::meshCutAndRemove::modFace
|
||||
const face& newFace,
|
||||
const label own,
|
||||
const label nei,
|
||||
const labelPair& patchIDs
|
||||
const label patchID
|
||||
)
|
||||
{
|
||||
label zoneID;
|
||||
@ -360,7 +358,7 @@ void Foam::meshCutAndRemove::modFace
|
||||
<< " new vertices:" << newFace
|
||||
<< " new owner:" << own
|
||||
<< " new neighbour:" << nei
|
||||
<< " new patch:" << patchIDs[0]
|
||||
<< " new patch:" << patchID
|
||||
<< " new zoneID:" << zoneID
|
||||
<< " new zoneFlip:" << zoneFlip
|
||||
<< endl;
|
||||
@ -377,11 +375,10 @@ void Foam::meshCutAndRemove::modFace
|
||||
own, // owner
|
||||
nei, // neighbour
|
||||
false, // face flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face flip in zone
|
||||
patchIDs[1] // subPatch
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -396,11 +393,10 @@ void Foam::meshCutAndRemove::modFace
|
||||
nei, // owner
|
||||
own, // neighbour
|
||||
false, // face flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face flip in zone
|
||||
patchIDs[1] // subPatch
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -846,8 +842,7 @@ void Foam::meshCutAndRemove::setRefinement
|
||||
false, // flux flip
|
||||
cutPatch[cellI], // patch for face
|
||||
-1, // zone for face
|
||||
false, // face zone flip
|
||||
-1 //? TBD
|
||||
false // face zone flip
|
||||
)
|
||||
);
|
||||
|
||||
@ -1069,11 +1064,11 @@ void Foam::meshCutAndRemove::setRefinement
|
||||
|
||||
// If faces were internal but now become external set a patch.
|
||||
// If they were external already keep the patch.
|
||||
labelPair patchIDs = polyTopoChange::whichPatch(patches, faceI);
|
||||
label patchID = patches.whichPatch(faceI);
|
||||
|
||||
if (patchIDs[0] == -1)
|
||||
if (patchID == -1)
|
||||
{
|
||||
patchIDs[0] = exposedPatchI;
|
||||
patchID = exposedPatchI;
|
||||
}
|
||||
|
||||
|
||||
@ -1087,7 +1082,7 @@ void Foam::meshCutAndRemove::setRefinement
|
||||
if (f0Nei != -1)
|
||||
{
|
||||
// f0 becomes external face (note:modFace will reverse face)
|
||||
modFace(meshMod, faceI, f0, f0Own, f0Nei, patchIDs);
|
||||
modFace(meshMod, faceI, f0, f0Own, f0Nei, patchID);
|
||||
modifiedFaceI = true;
|
||||
}
|
||||
}
|
||||
@ -1096,13 +1091,13 @@ void Foam::meshCutAndRemove::setRefinement
|
||||
if (f0Nei == -1)
|
||||
{
|
||||
// f0 becomes external face
|
||||
modFace(meshMod, faceI, f0, f0Own, f0Nei, patchIDs);
|
||||
modFace(meshMod, faceI, f0, f0Own, f0Nei, patchID);
|
||||
modifiedFaceI = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// f0 stays internal face.
|
||||
modFace(meshMod, faceI, f0, f0Own, f0Nei, labelPair(-1, -1));
|
||||
modFace(meshMod, faceI, f0, f0Own, f0Nei, -1);
|
||||
modifiedFaceI = true;
|
||||
}
|
||||
}
|
||||
@ -1121,12 +1116,12 @@ void Foam::meshCutAndRemove::setRefinement
|
||||
// f1 becomes external face (note:modFace will reverse face)
|
||||
if (!modifiedFaceI)
|
||||
{
|
||||
modFace(meshMod, faceI, f1, f1Own, f1Nei, patchIDs);
|
||||
modFace(meshMod, faceI, f1, f1Own, f1Nei, patchID);
|
||||
modifiedFaceI = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
label masterPointI = findPatchFacePoint(f1, patchIDs[0]);
|
||||
label masterPointI = findPatchFacePoint(f1, patchID);
|
||||
|
||||
addFace
|
||||
(
|
||||
@ -1136,7 +1131,7 @@ void Foam::meshCutAndRemove::setRefinement
|
||||
f1, // vertices of face
|
||||
f1Own,
|
||||
f1Nei,
|
||||
patchIDs // patch for new face
|
||||
patchID // patch for new face
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1148,12 +1143,12 @@ void Foam::meshCutAndRemove::setRefinement
|
||||
// f1 becomes external face
|
||||
if (!modifiedFaceI)
|
||||
{
|
||||
modFace(meshMod, faceI, f1, f1Own, f1Nei, patchIDs);
|
||||
modFace(meshMod, faceI, f1, f1Own, f1Nei, patchID);
|
||||
modifiedFaceI = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
label masterPointI = findPatchFacePoint(f1, patchIDs[0]);
|
||||
label masterPointI = findPatchFacePoint(f1, patchID);
|
||||
|
||||
addFace
|
||||
(
|
||||
@ -1163,7 +1158,7 @@ void Foam::meshCutAndRemove::setRefinement
|
||||
f1,
|
||||
f1Own,
|
||||
f1Nei,
|
||||
patchIDs
|
||||
patchID
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1172,31 +1167,14 @@ void Foam::meshCutAndRemove::setRefinement
|
||||
// f1 is internal face.
|
||||
if (!modifiedFaceI)
|
||||
{
|
||||
modFace
|
||||
(
|
||||
meshMod,
|
||||
faceI,
|
||||
f1,
|
||||
f1Own,
|
||||
f1Nei,
|
||||
labelPair(-1, -1)
|
||||
);
|
||||
modFace(meshMod, faceI, f1, f1Own, f1Nei, -1);
|
||||
modifiedFaceI = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
label masterPointI = findPatchFacePoint(f1, -1);
|
||||
|
||||
addFace
|
||||
(
|
||||
meshMod,
|
||||
faceI,
|
||||
masterPointI,
|
||||
f1,
|
||||
f1Own,
|
||||
f1Nei,
|
||||
labelPair(-1, -1)
|
||||
);
|
||||
addFace(meshMod, faceI, masterPointI, f1, f1Own, f1Nei, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1239,9 +1217,8 @@ void Foam::meshCutAndRemove::setRefinement
|
||||
// borders by edge a cell which has been split.
|
||||
|
||||
// Get (new or original) owner and neighbour of faceI
|
||||
label own, nei;
|
||||
labelPair patchIDs;
|
||||
faceCells(cuts, exposedPatchI, faceI, own, nei, patchIDs);
|
||||
label own, nei, patchID;
|
||||
faceCells(cuts, exposedPatchI, faceI, own, nei, patchID);
|
||||
|
||||
|
||||
if (own == -1 && nei == -1)
|
||||
@ -1272,7 +1249,7 @@ void Foam::meshCutAndRemove::setRefinement
|
||||
newFace,
|
||||
own,
|
||||
nei,
|
||||
patchIDs
|
||||
patchID
|
||||
);
|
||||
}
|
||||
|
||||
@ -1296,9 +1273,8 @@ void Foam::meshCutAndRemove::setRefinement
|
||||
if (!faceUptodate[faceI])
|
||||
{
|
||||
// Get (new or original) owner and neighbour of faceI
|
||||
labelPair patchIDs;
|
||||
label own, nei;
|
||||
faceCells(cuts, exposedPatchI, faceI, own, nei, patchIDs);
|
||||
label own, nei, patchID;
|
||||
faceCells(cuts, exposedPatchI, faceI, own, nei, patchID);
|
||||
|
||||
if (own == -1 && nei == -1)
|
||||
{
|
||||
@ -1311,7 +1287,7 @@ void Foam::meshCutAndRemove::setRefinement
|
||||
}
|
||||
else
|
||||
{
|
||||
modFace(meshMod, faceI, faces[faceI], own, nei, patchIDs);
|
||||
modFace(meshMod, faceI, faces[faceI], own, nei, patchID);
|
||||
}
|
||||
|
||||
faceUptodate[faceI] = true;
|
||||
|
||||
@ -27,7 +27,7 @@ Class
|
||||
|
||||
Description
|
||||
like meshCutter but also removes non-anchor side of cell.
|
||||
|
||||
|
||||
SourceFiles
|
||||
meshCutAndRemove.C
|
||||
|
||||
@ -106,7 +106,7 @@ class meshCutAndRemove
|
||||
const label faceI,
|
||||
label& own,
|
||||
label& nei,
|
||||
labelPair& patchIDs
|
||||
label& patchID
|
||||
) const;
|
||||
|
||||
//- Get zone information for face.
|
||||
@ -126,10 +126,10 @@ class meshCutAndRemove
|
||||
const face& newFace,
|
||||
const label owner,
|
||||
const label neighbour,
|
||||
const labelPair& patchIDs
|
||||
const label patchID
|
||||
);
|
||||
|
||||
//- Modifies existing faceI for either new owner/neighbour or
|
||||
//- Modifies existing faceI for either new owner/neighbour or
|
||||
// new face points. Checks if anything changed and flips face
|
||||
// if owner>neighbour
|
||||
void modFace
|
||||
@ -139,7 +139,7 @@ class meshCutAndRemove
|
||||
const face& newFace,
|
||||
const label owner,
|
||||
const label neighbour,
|
||||
const labelPair& patchIDs
|
||||
const label patchID
|
||||
);
|
||||
|
||||
// Copies face starting from startFp. Jumps cuts. Marks visited
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "meshCutter.H"
|
||||
@ -177,12 +175,17 @@ void Foam::meshCutter::faceCells
|
||||
void Foam::meshCutter::getFaceInfo
|
||||
(
|
||||
const label faceI,
|
||||
labelPair& patchIDs,
|
||||
label& patchID,
|
||||
label& zoneID,
|
||||
label& zoneFlip
|
||||
) const
|
||||
{
|
||||
patchIDs = polyTopoChange::whichPatch(mesh().boundaryMesh(), faceI);
|
||||
patchID = -1;
|
||||
|
||||
if (!mesh().isInternalFace(faceI))
|
||||
{
|
||||
patchID = mesh().boundaryMesh().whichPatch(faceI);
|
||||
}
|
||||
|
||||
zoneID = mesh().faceZones().whichZone(faceI);
|
||||
|
||||
@ -207,9 +210,9 @@ void Foam::meshCutter::addFace
|
||||
const label nei
|
||||
)
|
||||
{
|
||||
labelPair patchIDs;
|
||||
label zoneID, zoneFlip;
|
||||
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
|
||||
label patchID, zoneID, zoneFlip;
|
||||
|
||||
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
|
||||
|
||||
if ((nei == -1) || (own < nei))
|
||||
{
|
||||
@ -219,7 +222,7 @@ void Foam::meshCutter::addFace
|
||||
Pout<< "Adding face " << newFace
|
||||
<< " with new owner:" << own
|
||||
<< " with new neighbour:" << nei
|
||||
<< " patchIDs:" << patchIDs
|
||||
<< " patchID:" << patchID
|
||||
<< " zoneID:" << zoneID
|
||||
<< " zoneFlip:" << zoneFlip
|
||||
<< endl;
|
||||
@ -236,10 +239,9 @@ void Foam::meshCutter::addFace
|
||||
-1, // master edge
|
||||
faceI, // master face for addition
|
||||
false, // flux flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face zone flip
|
||||
patchIDs[1] // subPatch
|
||||
zoneFlip // face zone flip
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -251,7 +253,7 @@ void Foam::meshCutter::addFace
|
||||
Pout<< "Adding (reversed) face " << newFace.reverseFace()
|
||||
<< " with new owner:" << nei
|
||||
<< " with new neighbour:" << own
|
||||
<< " patchIDs:" << patchIDs
|
||||
<< " patchID:" << patchID
|
||||
<< " zoneID:" << zoneID
|
||||
<< " zoneFlip:" << zoneFlip
|
||||
<< endl;
|
||||
@ -268,10 +270,9 @@ void Foam::meshCutter::addFace
|
||||
-1, // master edge
|
||||
faceI, // master face for addition
|
||||
false, // flux flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face zone flip
|
||||
patchIDs[1] // subPatch
|
||||
zoneFlip // face zone flip
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -288,9 +289,9 @@ void Foam::meshCutter::modFace
|
||||
const label nei
|
||||
)
|
||||
{
|
||||
labelPair patchIDs;
|
||||
label zoneID, zoneFlip;
|
||||
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
|
||||
label patchID, zoneID, zoneFlip;
|
||||
|
||||
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
|
||||
|
||||
if
|
||||
(
|
||||
@ -325,11 +326,10 @@ void Foam::meshCutter::modFace
|
||||
own, // owner
|
||||
nei, // neighbour
|
||||
false, // face flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face flip in zone
|
||||
patchIDs[1] // subPatch
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -344,11 +344,10 @@ void Foam::meshCutter::modFace
|
||||
nei, // owner
|
||||
own, // neighbour
|
||||
false, // face flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face flip in zone
|
||||
patchIDs[1] // subPatch
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -694,8 +693,7 @@ void Foam::meshCutter::setRefinement
|
||||
false, // flux flip
|
||||
-1, // patch for face
|
||||
-1, // zone for face
|
||||
false, // face zone flip
|
||||
-1 // subpatch
|
||||
false // face zone flip
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -185,7 +185,7 @@ class meshCutter
|
||||
void getFaceInfo
|
||||
(
|
||||
const label faceI,
|
||||
labelPair& patchIDs,
|
||||
label& patchID,
|
||||
label& zoneID,
|
||||
label& zoneFlip
|
||||
) const;
|
||||
|
||||
@ -305,7 +305,7 @@ void Foam::multiDirRefinement::refineHex8
|
||||
hexCellSet.insert(hexCells[i], 1);
|
||||
}
|
||||
|
||||
// Increment count
|
||||
// Increment count
|
||||
forAll(consistentCells, i)
|
||||
{
|
||||
label cellI = consistentCells[i];
|
||||
@ -495,7 +495,7 @@ void Foam::multiDirRefinement::refineFromDict
|
||||
cellWalker.reset(new hexCellLooper(mesh));
|
||||
}
|
||||
|
||||
// Construct undoable refinement topology modifier.
|
||||
// Construct undoable refinement topology modifier.
|
||||
//Note: undoability switched off.
|
||||
// Might want to reconsider if needs to be possible. But then can always
|
||||
// use other constructor.
|
||||
|
||||
@ -92,7 +92,7 @@ class multiDirRefinement
|
||||
//- Given map from original to added cell set the refineCell for
|
||||
// the added cells to be equal to the one on the original cells.
|
||||
static void addCells(const Map<label>&, List<refineCell>&);
|
||||
|
||||
|
||||
//- Given map from original to added cell set the vectorField for
|
||||
// the added cells to be equal to the one on the original cells.
|
||||
static void update(const Map<label>&, vectorField&);
|
||||
|
||||
@ -117,7 +117,7 @@ Foam::Map<Foam::label> Foam::refinementIterator::setRefinement
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "refinementIterator : exiting iteration since no valid"
|
||||
<< " loops found for " << currentRefCells.size()
|
||||
<< " loops found for " << currentRefCells.size()
|
||||
<< " cells" << endl;
|
||||
|
||||
|
||||
@ -146,7 +146,7 @@ Foam::Map<Foam::label> Foam::refinementIterator::setRefinement
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
fileName cutsFile("cuts_" + runTime.timeName() + ".obj");
|
||||
|
||||
@ -27,7 +27,7 @@ Class
|
||||
|
||||
Description
|
||||
Utility class to do iterating meshCutter until all requests satisfied.
|
||||
|
||||
|
||||
Needed since cell cutting can only cut cell once in one go so if
|
||||
refinement pattern is not compatible on a cell by cell basis it will
|
||||
refuse to cut.
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "refineCell.H"
|
||||
@ -31,7 +29,6 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Null
|
||||
Foam::refineCell::refineCell()
|
||||
:
|
||||
cellNo_(-1),
|
||||
@ -39,7 +36,6 @@ Foam::refineCell::refineCell()
|
||||
{}
|
||||
|
||||
|
||||
// from components
|
||||
Foam::refineCell::refineCell(const label cellI, const vector& direction)
|
||||
:
|
||||
cellNo_(cellI),
|
||||
@ -61,7 +57,6 @@ Foam::refineCell::refineCell(const label cellI, const vector& direction)
|
||||
}
|
||||
|
||||
|
||||
// from Istream
|
||||
Foam::refineCell::refineCell(Istream& is)
|
||||
:
|
||||
cellNo_(readLabel(is)),
|
||||
|
||||
@ -52,7 +52,7 @@ inline bool Foam::wallNormalInfo::update(const wallNormalInfo& w2)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -172,7 +172,7 @@ inline bool Foam::wallNormalInfo::updateFace
|
||||
)
|
||||
{
|
||||
return update(neighbourWallInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
@ -135,7 +135,7 @@ void Foam::motionSmoother::makePatchPatchAddressing()
|
||||
|
||||
forAll(bm, patchi)
|
||||
{
|
||||
if(!isA<emptyPolyPatch>(bm[patchi]))
|
||||
if (!isA<emptyPolyPatch>(bm[patchi]))
|
||||
{
|
||||
nPatchPatchPoints += bm[patchi].boundaryPoints().size();
|
||||
}
|
||||
@ -153,7 +153,7 @@ void Foam::motionSmoother::makePatchPatchAddressing()
|
||||
|
||||
forAll(bm, patchi)
|
||||
{
|
||||
if(!isA<emptyPolyPatch>(bm[patchi]))
|
||||
if (!isA<emptyPolyPatch>(bm[patchi]))
|
||||
{
|
||||
const labelList& bp = bm[patchi].boundaryPoints();
|
||||
const labelList& meshPoints = bm[patchi].meshPoints();
|
||||
@ -1175,7 +1175,7 @@ void Foam::motionSmoother::updateMesh()
|
||||
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
isInternalPoint_.set(meshPoints[i], 0);
|
||||
isInternalPoint_.unset(meshPoints[i]);
|
||||
}
|
||||
|
||||
// Calculate master edge addressing
|
||||
|
||||
@ -179,7 +179,7 @@ class motionSmoother
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Average value (not positions!) of connected points.
|
||||
//- Average of connected points.
|
||||
template <class Type>
|
||||
tmp<GeometricField<Type, pointPatchField, pointMesh> > avg
|
||||
(
|
||||
|
||||
@ -51,7 +51,7 @@ void Foam::motionSmoother::checkConstraints
|
||||
|
||||
forAll(bm, patchi)
|
||||
{
|
||||
if(!isA<emptyPolyPatch>(bm[patchi]))
|
||||
if (!isA<emptyPolyPatch>(bm[patchi]))
|
||||
{
|
||||
nPatchPatchPoints += bm[patchi].boundaryPoints().size();
|
||||
}
|
||||
@ -81,7 +81,7 @@ void Foam::motionSmoother::checkConstraints
|
||||
|
||||
forAll(bm, patchi)
|
||||
{
|
||||
if(!isA<emptyPolyPatch>(bm[patchi]))
|
||||
if (!isA<emptyPolyPatch>(bm[patchi]))
|
||||
{
|
||||
const labelList& bp = bm[patchi].boundaryPoints();
|
||||
const labelList& meshPoints = bm[patchi].meshPoints();
|
||||
@ -93,7 +93,7 @@ void Foam::motionSmoother::checkConstraints
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Forward evaluation
|
||||
|
||||
@ -106,7 +106,7 @@ void Foam::motionSmoother::checkConstraints
|
||||
|
||||
forAll(bm, patchi)
|
||||
{
|
||||
if(!isA<emptyPolyPatch>(bm[patchi]))
|
||||
if (!isA<emptyPolyPatch>(bm[patchi]))
|
||||
{
|
||||
const labelList& bp = bm[patchi].boundaryPoints();
|
||||
const labelList& meshPoints = bm[patchi].meshPoints();
|
||||
@ -229,6 +229,7 @@ Foam::motionSmoother::avg
|
||||
scalar(0) // null value
|
||||
);
|
||||
|
||||
|
||||
// Average
|
||||
// ~~~~~~~
|
||||
|
||||
@ -242,7 +243,7 @@ Foam::motionSmoother::avg
|
||||
else
|
||||
{
|
||||
res[pointI] /= sumWeight[pointI];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
res.correctBoundaryConditions();
|
||||
|
||||
@ -1276,7 +1276,7 @@ bool Foam::polyMeshGeometry::checkFaceAngles
|
||||
faceNormal /= mag(faceNormal) + VSMALL;
|
||||
|
||||
// Get edge from f[0] to f[size-1];
|
||||
vector ePrev(p[f[0]] - p[f[f.size()-1]]);
|
||||
vector ePrev(p[f.first()] - p[f.last()]);
|
||||
scalar magEPrev = mag(ePrev);
|
||||
ePrev /= magEPrev + VSMALL;
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New(const polyMesh& mesh)
|
||||
|
||||
word solverTypeName(msData);
|
||||
|
||||
Info << "Selecting motion solver: " << solverTypeName << endl;
|
||||
Info<< "Selecting motion solver: " << solverTypeName << endl;
|
||||
|
||||
dlLibraryTable::open
|
||||
(
|
||||
|
||||
@ -104,7 +104,7 @@ public:
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
//- Return reference to mesh
|
||||
const polyMesh& mesh() const
|
||||
{
|
||||
|
||||
@ -170,7 +170,7 @@ void Foam::perfectInterface::setRefinement
|
||||
// Some aliases
|
||||
const edgeList& edges0 = pp0.edges();
|
||||
const pointField& pts0 = pp0.localPoints();
|
||||
const pointField& pts1 = pp1.localPoints();
|
||||
const pointField& pts1 = pp1.localPoints();
|
||||
const labelList& meshPts0 = pp0.meshPoints();
|
||||
const labelList& meshPts1 = pp1.meshPoints();
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*---------------------------------------------------------------------------* \
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
@ -1790,7 +1790,7 @@ void Foam::faceCoupleInfo::subDivisionMatch
|
||||
|
||||
cutPointI = cutEdges[cutEdgeI].otherVertex(cutPointI);
|
||||
|
||||
} while(cutPointI != cutPoint1);
|
||||
} while (cutPointI != cutPoint1);
|
||||
}
|
||||
|
||||
if (debug)
|
||||
|
||||
@ -46,7 +46,7 @@ Description
|
||||
|
||||
@verbatim
|
||||
e.g. master:
|
||||
|
||||
|
||||
+--+
|
||||
| |
|
||||
| |
|
||||
@ -398,7 +398,7 @@ public:
|
||||
|
||||
//- Construct from meshes and subset of mesh faces
|
||||
// (i.e. indirectPrimitivePatch addressing)
|
||||
// All faces in patch are considered matched (but don't have to be
|
||||
// All faces in patch are considered matched (but don't have to be
|
||||
// ordered)
|
||||
// perfectMatch : each point/edge/face has corresponding point on other
|
||||
// side
|
||||
|
||||
@ -86,8 +86,6 @@ class polyAddFace
|
||||
//- Face zone flip
|
||||
bool zoneFlip_;
|
||||
|
||||
//- Sub patch ID (for proc patches)
|
||||
label subPatchID_;
|
||||
|
||||
public:
|
||||
|
||||
@ -111,8 +109,7 @@ public:
|
||||
flipFaceFlux_(false),
|
||||
patchID_(-1),
|
||||
zoneID_(-1),
|
||||
zoneFlip_(false),
|
||||
subPatchID_(-1)
|
||||
zoneFlip_(false)
|
||||
{}
|
||||
|
||||
|
||||
@ -128,8 +125,7 @@ public:
|
||||
const bool flipFaceFlux,
|
||||
const label patchID,
|
||||
const label zoneID,
|
||||
const bool zoneFlip,
|
||||
const label subPatchID
|
||||
const bool zoneFlip
|
||||
)
|
||||
:
|
||||
face_(f),
|
||||
@ -141,8 +137,7 @@ public:
|
||||
flipFaceFlux_(flipFaceFlux),
|
||||
patchID_(patchID),
|
||||
zoneID_(zoneID),
|
||||
zoneFlip_(zoneFlip),
|
||||
subPatchID_(subPatchID)
|
||||
zoneFlip_(zoneFlip)
|
||||
{
|
||||
if (face_.size() < 3)
|
||||
{
|
||||
@ -159,8 +154,7 @@ public:
|
||||
" const bool flipFaceFlux,\n"
|
||||
" const label patchID,\n"
|
||||
" const label zoneID,\n"
|
||||
" const bool zoneFlip,\n"
|
||||
" const label subPatchID\n"
|
||||
" const bool zoneFlip\n"
|
||||
")"
|
||||
) << "Invalid face: less than 3 points. "
|
||||
<< "This is not allowed.\n"
|
||||
@ -189,8 +183,7 @@ public:
|
||||
" const bool flipFaceFlux,\n"
|
||||
" const label patchID,\n"
|
||||
" const label zoneID,\n"
|
||||
" const bool zoneFlip,\n"
|
||||
" const label subPatchID\n"
|
||||
" const bool zoneFlip\n"
|
||||
")"
|
||||
) << "Face contains invalid vertex ID: " << face_ << ". "
|
||||
<< "This is not allowed.\n"
|
||||
@ -219,8 +212,7 @@ public:
|
||||
" const bool flipFaceFlux,\n"
|
||||
" const label patchID,\n"
|
||||
" const label zoneID,\n"
|
||||
" const bool zoneFlip,\n"
|
||||
" const label subPatchID\n"
|
||||
" const bool zoneFlip\n"
|
||||
")"
|
||||
) << "Face owner and neighbour are identical. "
|
||||
<< "This is not allowed.\n"
|
||||
@ -249,8 +241,7 @@ public:
|
||||
" const bool flipFaceFlux,\n"
|
||||
" const label patchID,\n"
|
||||
" const label zoneID,\n"
|
||||
" const bool zoneFlip,\n"
|
||||
" const label subPatchID\n"
|
||||
" const bool zoneFlip\n"
|
||||
")"
|
||||
) << "Patch face has got a neighbour. Patch ID: " << patchID
|
||||
<< ". This is not allowed.\n"
|
||||
@ -278,9 +269,7 @@ public:
|
||||
" const label masterFaceID,\n"
|
||||
" const bool flipFaceFlux,\n"
|
||||
" const label patchID,\n"
|
||||
" const label zoneID,\n"
|
||||
" const bool zoneFlip,\n"
|
||||
" const label subPatchID\n"
|
||||
" const label zoneID"
|
||||
")"
|
||||
) << "Face has no owner and is not in a zone. "
|
||||
<< "This is not allowed.\n"
|
||||
@ -310,9 +299,7 @@ public:
|
||||
" const bool flipFaceFlux,\n"
|
||||
" const label patchID,\n"
|
||||
" const label zoneID,\n"
|
||||
" const bool zoneFlip,\n"
|
||||
" const label subPatchID\n"
|
||||
")"
|
||||
" const bool zoneFlip\n"
|
||||
")"
|
||||
) << "Specified zone flip for a face that does not "
|
||||
<< "belong to zone. This is not allowed.\n"
|
||||
@ -439,13 +426,6 @@ public:
|
||||
{
|
||||
return zoneFlip_;
|
||||
}
|
||||
|
||||
//- Boundary sub patch ID
|
||||
label subPatchID() const
|
||||
{
|
||||
return subPatchID_;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -263,7 +263,7 @@ Foam::labelPair Foam::addPatchCellLayer::getEdgeString
|
||||
// - which hasn't been handled yet
|
||||
// - with same neighbour
|
||||
// - that needs extrusion
|
||||
while(true)
|
||||
while (true)
|
||||
{
|
||||
label prevFp = fEdges.rcIndex(startFp);
|
||||
|
||||
@ -287,7 +287,7 @@ Foam::labelPair Foam::addPatchCellLayer::getEdgeString
|
||||
|
||||
// Search forward for end of string
|
||||
endFp = startFp;
|
||||
while(true)
|
||||
while (true)
|
||||
{
|
||||
label nextFp = fEdges.fcIndex(endFp);
|
||||
|
||||
@ -1276,7 +1276,7 @@ void Foam::addPatchCellLayer::setRefinement
|
||||
doneEdge[fEdges[fp]] = true;
|
||||
fp = f.fcIndex(fp);
|
||||
}
|
||||
stringedVerts[stringedVerts.size()-1] = f[fp];
|
||||
stringedVerts.last() = f[fp];
|
||||
|
||||
|
||||
// Now stringedVerts contains the vertices in order of face f.
|
||||
@ -1294,7 +1294,7 @@ void Foam::addPatchCellLayer::setRefinement
|
||||
|
||||
for (label i = 0; i < numEdgeSideFaces; i++)
|
||||
{
|
||||
label vEnd = stringedVerts[stringedVerts.size()-1];
|
||||
label vEnd = stringedVerts.last();
|
||||
label vStart = stringedVerts[0];
|
||||
|
||||
// calculate number of points making up a face
|
||||
@ -1306,7 +1306,7 @@ void Foam::addPatchCellLayer::setRefinement
|
||||
// faces with more layers.
|
||||
if (addedPoints_[vEnd].size())
|
||||
{
|
||||
newFp +=
|
||||
newFp +=
|
||||
addedPoints_[vEnd].size() - numEdgeSideFaces;
|
||||
}
|
||||
if (addedPoints_[vStart].size())
|
||||
|
||||
@ -193,7 +193,7 @@ class addPatchCellLayer
|
||||
label addSideFace
|
||||
(
|
||||
const indirectPrimitivePatch&,
|
||||
const List<labelPair>& patchIDs,
|
||||
const labelList& patchID,
|
||||
const labelListList& addedCells,
|
||||
const face& newFace,
|
||||
const label ownFaceI,
|
||||
|
||||
@ -62,7 +62,7 @@ bool Foam::combineFaces::convexFace
|
||||
n /= mag(n);
|
||||
|
||||
// Get edge from f[0] to f[size-1];
|
||||
vector ePrev(points[f[0]] - points[f[f.size()-1]]);
|
||||
vector ePrev(points[f.first()] - points[f.last()]);
|
||||
scalar magEPrev = mag(ePrev);
|
||||
ePrev /= magEPrev + VSMALL;
|
||||
|
||||
@ -658,11 +658,7 @@ void Foam::combineFaces::setRefinement
|
||||
zoneFlip = fZone.flipMap()[fZone.whichFace(masterFaceI)];
|
||||
}
|
||||
|
||||
labelPair patchIDs = polyTopoChange::whichPatch
|
||||
(
|
||||
mesh_.boundaryMesh(),
|
||||
masterFaceI
|
||||
);
|
||||
label patchI = mesh_.boundaryMesh().whichPatch(masterFaceI);
|
||||
|
||||
meshMod.setAction
|
||||
(
|
||||
@ -673,11 +669,10 @@ void Foam::combineFaces::setRefinement
|
||||
mesh_.faceOwner()[masterFaceI], // owner
|
||||
-1, // neighbour
|
||||
false, // face flip
|
||||
patchIDs[0], // patch for face
|
||||
patchI, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face flip in zone
|
||||
patchIDs[1]
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
|
||||
@ -961,13 +956,9 @@ void Foam::combineFaces::setUnrefinement
|
||||
const faceZone& fZone = mesh_.faceZones()[zoneID];
|
||||
zoneFlip = fZone.flipMap()[fZone.whichFace(masterFaceI)];
|
||||
}
|
||||
labelPair patchIDs = polyTopoChange::whichPatch
|
||||
(
|
||||
mesh_.boundaryMesh(),
|
||||
masterFaceI
|
||||
);
|
||||
label patchI = mesh_.boundaryMesh().whichPatch(masterFaceI);
|
||||
|
||||
if (mesh_.boundaryMesh()[patchIDs[0]].coupled())
|
||||
if (mesh_.boundaryMesh()[patchI].coupled())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
@ -975,7 +966,7 @@ void Foam::combineFaces::setUnrefinement
|
||||
"(const labelList&, polyTopoChange&"
|
||||
", Map<label>&, Map<label>&, Map<label>&)"
|
||||
) << "Master face " << masterFaceI << " is on coupled patch "
|
||||
<< mesh_.boundaryMesh()[patchIDs[0]].name()
|
||||
<< mesh_.boundaryMesh()[patchI].name()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
@ -992,11 +983,10 @@ void Foam::combineFaces::setUnrefinement
|
||||
own, // owner
|
||||
-1, // neighbour
|
||||
false, // face flip
|
||||
patchIDs[0], // patch for face
|
||||
patchI, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face flip in zone
|
||||
patchIDs[1] // subPatchID
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
|
||||
@ -1010,17 +1000,16 @@ void Foam::combineFaces::setUnrefinement
|
||||
(
|
||||
polyAddFace
|
||||
(
|
||||
faces[i], // vertices
|
||||
own, // owner,
|
||||
-1, // neighbour,
|
||||
-1, // masterPointID,
|
||||
-1, // masterEdgeID,
|
||||
masterFaceI, // masterFaceID,
|
||||
false, // flipFaceFlux,
|
||||
patchIDs[0], // patchID,
|
||||
zoneID, // zoneID,
|
||||
zoneFlip, // zoneFlip
|
||||
patchIDs[1] // subPatchID
|
||||
faces[i], // vertices
|
||||
own, // owner,
|
||||
-1, // neighbour,
|
||||
-1, // masterPointID,
|
||||
-1, // masterEdgeID,
|
||||
masterFaceI, // masterFaceID,
|
||||
false, // flipFaceFlux,
|
||||
patchI, // patchID,
|
||||
zoneID, // zoneID,
|
||||
zoneFlip // zoneFlip
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -154,36 +154,34 @@ void Foam::duplicatePoints::setRefinement
|
||||
const faceZone& fZone = mesh_.faceZones()[zoneID];
|
||||
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
|
||||
}
|
||||
labelPair patchIDs = polyTopoChange::whichPatch(patches, faceI);
|
||||
|
||||
|
||||
if (mesh_.isInternalFace(faceI))
|
||||
{
|
||||
meshMod.modifyFace
|
||||
(
|
||||
newFace, // modified face
|
||||
faceI, // label of face being modified
|
||||
mesh_.faceOwner()[faceI], // owner
|
||||
newFace, // modified face
|
||||
faceI, // label of face being modified
|
||||
mesh_.faceOwner()[faceI], // owner
|
||||
mesh_.faceNeighbour()[faceI], // neighbour
|
||||
false, // face flip
|
||||
-1, // patch for face
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face flip in zone
|
||||
-1 // subPatch
|
||||
false, // face flip
|
||||
-1, // patch for face
|
||||
zoneID, // zone for face
|
||||
zoneFlip // face flip in zone
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
meshMod.modifyFace
|
||||
(
|
||||
newFace, // modified face
|
||||
faceI, // label of face being modified
|
||||
mesh_.faceOwner()[faceI], // owner
|
||||
-1, // neighbour
|
||||
false, // face flip
|
||||
patchIDs[0], // patch for face
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face flip in zone
|
||||
patchIDs[1]
|
||||
newFace, // modified face
|
||||
faceI, // label of face being modified
|
||||
mesh_.faceOwner()[faceI], // owner
|
||||
-1, // neighbour
|
||||
false, // face flip
|
||||
patches.whichPatch(faceI), // patch for face
|
||||
zoneID, // zone for face
|
||||
zoneFlip // face flip in zone
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -353,7 +353,7 @@ bool Foam::edgeCollapser::collapseEdge(const label edgeI, const label master)
|
||||
// Use the smaller region number for the whole network.
|
||||
label minRegion = min(pointRegion0, pointRegion1);
|
||||
label maxRegion = max(pointRegion0, pointRegion1);
|
||||
|
||||
|
||||
// Use minRegion as region for combined net, free maxRegion.
|
||||
pointRegionMaster_[minRegion] = master;
|
||||
pointRegionMaster_[maxRegion] = -1;
|
||||
@ -456,7 +456,7 @@ bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod)
|
||||
{
|
||||
break;
|
||||
}
|
||||
} while(true);
|
||||
} while (true);
|
||||
|
||||
|
||||
// Keep track of faces that have been done already.
|
||||
@ -510,7 +510,7 @@ bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Remove points.
|
||||
forAll(pointRegion_, pointI)
|
||||
@ -526,7 +526,7 @@ bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod)
|
||||
|
||||
const polyBoundaryMesh& boundaryMesh = mesh_.boundaryMesh();
|
||||
const faceZoneMesh& faceZones = mesh_.faceZones();
|
||||
|
||||
|
||||
|
||||
// Renumber faces that use points
|
||||
forAll(pointRegion_, pointI)
|
||||
@ -558,16 +558,16 @@ bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod)
|
||||
// Get current connectivity
|
||||
label own = faceOwner[faceI];
|
||||
label nei = -1;
|
||||
labelPair patchIDs = polyTopoChange::whichPatch
|
||||
(
|
||||
boundaryMesh,
|
||||
faceI
|
||||
);
|
||||
label patchID = -1;
|
||||
|
||||
if (mesh_.isInternalFace(faceI))
|
||||
{
|
||||
nei = faceNeighbour[faceI];
|
||||
}
|
||||
else
|
||||
{
|
||||
patchID = boundaryMesh.whichPatch(faceI);
|
||||
}
|
||||
|
||||
meshMod.modifyFace
|
||||
(
|
||||
@ -576,10 +576,9 @@ bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod)
|
||||
own, // owner
|
||||
nei, // neighbour
|
||||
false, // flipFaceFlux
|
||||
patchIDs[0], // patch
|
||||
patchID, // patch
|
||||
zoneID,
|
||||
zoneFlip,
|
||||
patchIDs[1] // subpatch for face
|
||||
zoneFlip
|
||||
);
|
||||
meshChanged = true;
|
||||
}
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "faceCollapser.H"
|
||||
@ -156,16 +154,16 @@ void Foam::faceCollapser::filterFace
|
||||
{
|
||||
label nei = -1;
|
||||
|
||||
labelPair patchIDs = polyTopoChange::whichPatch
|
||||
(
|
||||
mesh_.boundaryMesh(),
|
||||
faceI
|
||||
);
|
||||
label patchI = -1;
|
||||
|
||||
if (mesh_.isInternalFace(faceI))
|
||||
{
|
||||
nei = mesh_.faceNeighbour()[faceI];
|
||||
}
|
||||
else
|
||||
{
|
||||
patchI = mesh_.boundaryMesh().whichPatch(faceI);
|
||||
}
|
||||
|
||||
// Get current zone info
|
||||
label zoneID = mesh_.faceZones().whichZone(faceI);
|
||||
@ -188,11 +186,10 @@ void Foam::faceCollapser::filterFace
|
||||
mesh_.faceOwner()[faceI], // owner
|
||||
nei, // neighbour
|
||||
false, // face flip
|
||||
patchIDs[0], // patch for face
|
||||
patchI, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face flip in zone
|
||||
patchIDs[1]
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -97,12 +97,17 @@ void Foam::hexRef8::reorder
|
||||
void Foam::hexRef8::getFaceInfo
|
||||
(
|
||||
const label faceI,
|
||||
labelPair& patchIDs,
|
||||
label& patchID,
|
||||
label& zoneID,
|
||||
label& zoneFlip
|
||||
) const
|
||||
{
|
||||
patchIDs = polyTopoChange::whichPatch(mesh_.boundaryMesh(), faceI);
|
||||
patchID = -1;
|
||||
|
||||
if (!mesh_.isInternalFace(faceI))
|
||||
{
|
||||
patchID = mesh_.boundaryMesh().whichPatch(faceI);
|
||||
}
|
||||
|
||||
zoneID = mesh_.faceZones().whichZone(faceI);
|
||||
|
||||
@ -127,9 +132,9 @@ Foam::label Foam::hexRef8::addFace
|
||||
const label nei
|
||||
) const
|
||||
{
|
||||
labelPair patchIDs;
|
||||
label zoneID, zoneFlip;
|
||||
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
|
||||
label patchID, zoneID, zoneFlip;
|
||||
|
||||
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
|
||||
|
||||
label newFaceI = -1;
|
||||
|
||||
@ -147,10 +152,9 @@ Foam::label Foam::hexRef8::addFace
|
||||
-1, // master edge
|
||||
faceI, // master face for addition
|
||||
false, // flux flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face zone flip
|
||||
patchIDs[1] // subPatch
|
||||
zoneFlip // face zone flip
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -168,10 +172,9 @@ Foam::label Foam::hexRef8::addFace
|
||||
-1, // master edge
|
||||
faceI, // master face for addition
|
||||
false, // flux flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face zone flip
|
||||
patchIDs[1] // subPatch
|
||||
zoneFlip // face zone flip
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -210,8 +213,7 @@ Foam::label Foam::hexRef8::addInternalFace
|
||||
false, // flux flip
|
||||
-1, // patch for face
|
||||
-1, // zone for face
|
||||
false, // face zone flip
|
||||
-1 // subPatch
|
||||
false // face zone flip
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -239,8 +241,7 @@ Foam::label Foam::hexRef8::addInternalFace
|
||||
false, // flux flip
|
||||
-1, // patch for face
|
||||
-1, // zone for face
|
||||
false, // face zone flip
|
||||
-1 // subPatch
|
||||
false // face zone flip
|
||||
)
|
||||
);
|
||||
|
||||
@ -275,8 +276,7 @@ Foam::label Foam::hexRef8::addInternalFace
|
||||
// false, // flux flip
|
||||
// -1, // patch for face
|
||||
// -1, // zone for face
|
||||
// false, // face zone flip
|
||||
// -1 // subPatch
|
||||
// false // face zone flip
|
||||
// )
|
||||
//);
|
||||
}
|
||||
@ -293,9 +293,9 @@ void Foam::hexRef8::modFace
|
||||
const label nei
|
||||
) const
|
||||
{
|
||||
labelPair patchIDs;
|
||||
label zoneID, zoneFlip;
|
||||
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
|
||||
label patchID, zoneID, zoneFlip;
|
||||
|
||||
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
|
||||
|
||||
if
|
||||
(
|
||||
@ -318,11 +318,10 @@ void Foam::hexRef8::modFace
|
||||
own, // owner
|
||||
nei, // neighbour
|
||||
false, // face flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face flip in zone
|
||||
patchIDs[1] // subPatch
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -337,11 +336,10 @@ void Foam::hexRef8::modFace
|
||||
nei, // owner
|
||||
own, // neighbour
|
||||
false, // face flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face flip in zone
|
||||
patchIDs[1] // subPatch
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -1585,11 +1583,11 @@ Foam::label Foam::hexRef8::faceConsistentRefinement
|
||||
{
|
||||
if (maxSet)
|
||||
{
|
||||
refineCell.set(nei, 1);
|
||||
refineCell.set(nei);
|
||||
}
|
||||
else
|
||||
{
|
||||
refineCell.set(own, 0);
|
||||
refineCell.unset(own);
|
||||
}
|
||||
nChanged++;
|
||||
}
|
||||
@ -1597,11 +1595,11 @@ Foam::label Foam::hexRef8::faceConsistentRefinement
|
||||
{
|
||||
if (maxSet)
|
||||
{
|
||||
refineCell.set(own, 1);
|
||||
refineCell.set(own);
|
||||
}
|
||||
else
|
||||
{
|
||||
refineCell.set(nei, 0);
|
||||
refineCell.unset(nei);
|
||||
}
|
||||
nChanged++;
|
||||
}
|
||||
@ -1632,7 +1630,7 @@ Foam::label Foam::hexRef8::faceConsistentRefinement
|
||||
{
|
||||
if (!maxSet)
|
||||
{
|
||||
refineCell.set(own, 0);
|
||||
refineCell.unset(own);
|
||||
nChanged++;
|
||||
}
|
||||
}
|
||||
@ -1640,7 +1638,7 @@ Foam::label Foam::hexRef8::faceConsistentRefinement
|
||||
{
|
||||
if (maxSet)
|
||||
{
|
||||
refineCell.set(own, 1);
|
||||
refineCell.set(own);
|
||||
nChanged++;
|
||||
}
|
||||
}
|
||||
@ -1659,7 +1657,7 @@ void Foam::hexRef8::checkWantedRefinementLevels
|
||||
PackedBoolList refineCell(mesh_.nCells());
|
||||
forAll(cellsToRefine, i)
|
||||
{
|
||||
refineCell.set(cellsToRefine[i], 1);
|
||||
refineCell.set(cellsToRefine[i]);
|
||||
}
|
||||
|
||||
for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++)
|
||||
@ -2044,7 +2042,7 @@ Foam::labelList Foam::hexRef8::consistentRefinement
|
||||
PackedBoolList refineCell(mesh_.nCells());
|
||||
forAll(cellsToRefine, i)
|
||||
{
|
||||
refineCell.set(cellsToRefine[i], 1);
|
||||
refineCell.set(cellsToRefine[i]);
|
||||
}
|
||||
|
||||
while (true)
|
||||
@ -2072,7 +2070,7 @@ Foam::labelList Foam::hexRef8::consistentRefinement
|
||||
|
||||
forAll(refineCell, cellI)
|
||||
{
|
||||
if (refineCell.get(cellI) == 1)
|
||||
if (refineCell.get(cellI))
|
||||
{
|
||||
nRefined++;
|
||||
}
|
||||
@ -2083,7 +2081,7 @@ Foam::labelList Foam::hexRef8::consistentRefinement
|
||||
|
||||
forAll(refineCell, cellI)
|
||||
{
|
||||
if (refineCell.get(cellI) == 1)
|
||||
if (refineCell.get(cellI))
|
||||
{
|
||||
newCellsToRefine[nRefined++] = cellI;
|
||||
}
|
||||
@ -2223,7 +2221,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement
|
||||
faceCount
|
||||
)
|
||||
);
|
||||
allFaceInfo[faceI] = seedFacesInfo[seedFacesInfo.size()-1];
|
||||
allFaceInfo[faceI] = seedFacesInfo.last();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2239,7 +2237,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement
|
||||
faceCount
|
||||
)
|
||||
);
|
||||
allFaceInfo[faceI] = seedFacesInfo[seedFacesInfo.size()-1];
|
||||
allFaceInfo[faceI] = seedFacesInfo.last();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2320,7 +2318,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement
|
||||
allCellInfo
|
||||
);
|
||||
|
||||
while(true)
|
||||
while (true)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
@ -2895,7 +2893,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2
|
||||
|
||||
if (wanted > cellLevel_[cellI]+1)
|
||||
{
|
||||
refineCell.set(cellI, 1);
|
||||
refineCell.set(cellI);
|
||||
}
|
||||
}
|
||||
faceConsistentRefinement(true, refineCell);
|
||||
@ -2924,7 +2922,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2
|
||||
|
||||
forAll(refineCell, cellI)
|
||||
{
|
||||
if (refineCell.get(cellI) == 1)
|
||||
if (refineCell.get(cellI))
|
||||
{
|
||||
nRefined++;
|
||||
}
|
||||
@ -2935,7 +2933,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2
|
||||
|
||||
forAll(refineCell, cellI)
|
||||
{
|
||||
if (refineCell.get(cellI) == 1)
|
||||
if (refineCell.get(cellI))
|
||||
{
|
||||
newCellsToRefine[nRefined++] = cellI;
|
||||
}
|
||||
@ -2968,7 +2966,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2
|
||||
PackedBoolList refineCell(mesh_.nCells());
|
||||
forAll(newCellsToRefine, i)
|
||||
{
|
||||
refineCell.set(newCellsToRefine[i], 1);
|
||||
refineCell.set(newCellsToRefine[i]);
|
||||
}
|
||||
const PackedBoolList savedRefineCell(refineCell);
|
||||
|
||||
@ -2981,7 +2979,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2
|
||||
);
|
||||
forAll(refineCell, cellI)
|
||||
{
|
||||
if (refineCell.get(cellI) == 1)
|
||||
if (refineCell.get(cellI))
|
||||
{
|
||||
cellsOut2.insert(cellI);
|
||||
}
|
||||
@ -2996,11 +2994,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2
|
||||
{
|
||||
forAll(refineCell, cellI)
|
||||
{
|
||||
if
|
||||
(
|
||||
refineCell.get(cellI) == 1
|
||||
&& savedRefineCell.get(cellI) == 0
|
||||
)
|
||||
if (refineCell.get(cellI) && !savedRefineCell.get(cellI))
|
||||
{
|
||||
dumpCell(cellI);
|
||||
FatalErrorIn
|
||||
@ -3602,7 +3596,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
|
||||
|
||||
forAll(cFaces, i)
|
||||
{
|
||||
affectedFace.set(cFaces[i], 1);
|
||||
affectedFace.set(cFaces[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3611,7 +3605,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
|
||||
{
|
||||
if (faceMidPoint[faceI] >= 0)
|
||||
{
|
||||
affectedFace.set(faceI, 1);
|
||||
affectedFace.set(faceI);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3623,7 +3617,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
|
||||
|
||||
forAll(eFaces, i)
|
||||
{
|
||||
affectedFace.set(eFaces[i], 1);
|
||||
affectedFace.set(eFaces[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3640,7 +3634,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
|
||||
|
||||
forAll(faceMidPoint, faceI)
|
||||
{
|
||||
if (faceMidPoint[faceI] >= 0 && affectedFace.get(faceI) == 1)
|
||||
if (faceMidPoint[faceI] >= 0 && affectedFace.get(faceI))
|
||||
{
|
||||
// Face needs to be split and hasn't yet been done in some way
|
||||
// (affectedFace - is impossible since this is first change but
|
||||
@ -3761,7 +3755,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
|
||||
}
|
||||
|
||||
// Mark face as having been handled
|
||||
affectedFace.set(faceI, 0);
|
||||
affectedFace.unset(faceI);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3791,7 +3785,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
|
||||
{
|
||||
label faceI = eFaces[i];
|
||||
|
||||
if (faceMidPoint[faceI] < 0 && affectedFace.get(faceI) == 1)
|
||||
if (faceMidPoint[faceI] < 0 && affectedFace.get(faceI))
|
||||
{
|
||||
// Unsplit face. Add edge splits to face.
|
||||
|
||||
@ -3872,7 +3866,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
|
||||
modFace(meshMod, faceI, newFace, own, nei);
|
||||
|
||||
// Mark face as having been handled
|
||||
affectedFace.set(faceI, 0);
|
||||
affectedFace.unset(faceI);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3891,7 +3885,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
|
||||
|
||||
forAll(affectedFace, faceI)
|
||||
{
|
||||
if (affectedFace.get(faceI) == 1)
|
||||
if (affectedFace.get(faceI))
|
||||
{
|
||||
const face& f = mesh_.faces()[faceI];
|
||||
|
||||
@ -3914,7 +3908,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
|
||||
modFace(meshMod, faceI, f, own, nei);
|
||||
|
||||
// Mark face as having been handled
|
||||
affectedFace.set(faceI, 0);
|
||||
affectedFace.unset(faceI);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5096,7 +5090,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
|
||||
{
|
||||
label pointI = pointsToUnrefine[i];
|
||||
|
||||
unrefinePoint.set(pointI, 1);
|
||||
unrefinePoint.set(pointI);
|
||||
}
|
||||
|
||||
|
||||
@ -5109,13 +5103,13 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
|
||||
|
||||
forAll(unrefinePoint, pointI)
|
||||
{
|
||||
if (unrefinePoint.get(pointI) == 1)
|
||||
if (unrefinePoint.get(pointI))
|
||||
{
|
||||
const labelList& pCells = mesh_.pointCells(pointI);
|
||||
|
||||
forAll(pCells, j)
|
||||
{
|
||||
unrefineCell.set(pCells[j], 1);
|
||||
unrefineCell.set(pCells[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5143,17 +5137,24 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
|
||||
|
||||
if (maxSet)
|
||||
{
|
||||
unrefineCell.set(nei, 1);
|
||||
unrefineCell.set(nei);
|
||||
}
|
||||
else
|
||||
{
|
||||
// could also combine with unset:
|
||||
// if (!unrefineCell.unset(own))
|
||||
// {
|
||||
// FatalErrorIn("hexRef8::consistentUnrefinement(..)")
|
||||
// << "problem cell already unset"
|
||||
// << abort(FatalError);
|
||||
// }
|
||||
if (unrefineCell.get(own) == 0)
|
||||
{
|
||||
FatalErrorIn("hexRef8::consistentUnrefinement(..)")
|
||||
<< "problem" << abort(FatalError);
|
||||
}
|
||||
|
||||
unrefineCell.set(own, 0);
|
||||
unrefineCell.unset(own);
|
||||
}
|
||||
nChanged++;
|
||||
}
|
||||
@ -5161,7 +5162,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
|
||||
{
|
||||
if (maxSet)
|
||||
{
|
||||
unrefineCell.set(own, 1);
|
||||
unrefineCell.set(own);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -5171,7 +5172,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
|
||||
<< "problem" << abort(FatalError);
|
||||
}
|
||||
|
||||
unrefineCell.set(nei, 0);
|
||||
unrefineCell.unset(nei);
|
||||
}
|
||||
nChanged++;
|
||||
}
|
||||
@ -5207,7 +5208,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
|
||||
<< "problem" << abort(FatalError);
|
||||
}
|
||||
|
||||
unrefineCell.set(own, 0);
|
||||
unrefineCell.unset(own);
|
||||
nChanged++;
|
||||
}
|
||||
}
|
||||
@ -5221,7 +5222,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
|
||||
<< "problem" << abort(FatalError);
|
||||
}
|
||||
|
||||
unrefineCell.set(own, 1);
|
||||
unrefineCell.set(own);
|
||||
nChanged++;
|
||||
}
|
||||
}
|
||||
@ -5249,15 +5250,15 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
|
||||
// Knock out any point whose cell neighbour cannot be unrefined.
|
||||
forAll(unrefinePoint, pointI)
|
||||
{
|
||||
if (unrefinePoint.get(pointI) == 1)
|
||||
if (unrefinePoint.get(pointI))
|
||||
{
|
||||
const labelList& pCells = mesh_.pointCells(pointI);
|
||||
|
||||
forAll(pCells, j)
|
||||
{
|
||||
if (unrefineCell.get(pCells[j]) == 0)
|
||||
if (!unrefineCell.get(pCells[j]))
|
||||
{
|
||||
unrefinePoint.set(pointI, 0);
|
||||
unrefinePoint.unset(pointI);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -5271,7 +5272,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
|
||||
|
||||
forAll(unrefinePoint, pointI)
|
||||
{
|
||||
if (unrefinePoint.get(pointI) == 1)
|
||||
if (unrefinePoint.get(pointI))
|
||||
{
|
||||
nSet++;
|
||||
}
|
||||
@ -5282,7 +5283,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
|
||||
|
||||
forAll(unrefinePoint, pointI)
|
||||
{
|
||||
if (unrefinePoint.get(pointI) == 1)
|
||||
if (unrefinePoint.get(pointI))
|
||||
{
|
||||
newPointsToUnrefine[nSet++] = pointI;
|
||||
}
|
||||
@ -5320,8 +5321,7 @@ void Foam::hexRef8::setUnrefinement
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"hexRef8::setUnrefinement"
|
||||
"(const labelList&, polyTopoChange&)"
|
||||
"hexRef8::setUnrefinement(const labelList&, polyTopoChange&)"
|
||||
) << "Illegal cell level " << cellLevel_[cellI]
|
||||
<< " for cell " << cellI
|
||||
<< abort(FatalError);
|
||||
|
||||
@ -105,7 +105,7 @@ class hexRef8
|
||||
void getFaceInfo
|
||||
(
|
||||
const label faceI,
|
||||
labelPair& patchIDs,
|
||||
label& patchID,
|
||||
label& zoneID,
|
||||
label& zoneFlip
|
||||
) const;
|
||||
|
||||
@ -61,7 +61,6 @@ public:
|
||||
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// Are two lists identical either in forward or in reverse order.
|
||||
|
||||
@ -53,7 +53,7 @@ class polyModifyFace
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Face
|
||||
//- Face
|
||||
face face_;
|
||||
|
||||
//- Master face ID
|
||||
@ -80,9 +80,6 @@ class polyModifyFace
|
||||
//- Face zone flip
|
||||
bool zoneFlip_;
|
||||
|
||||
//- Sub patch ID (for proc patches)
|
||||
label subPatchID_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -105,8 +102,7 @@ public:
|
||||
patchID_(-1),
|
||||
removeFromZone_(false),
|
||||
zoneID_(-1),
|
||||
zoneFlip_(false),
|
||||
subPatchID_(-1)
|
||||
zoneFlip_(false)
|
||||
{}
|
||||
|
||||
//- Construct from components
|
||||
@ -120,8 +116,7 @@ public:
|
||||
const label patchID,
|
||||
const bool removeFromZone,
|
||||
const label zoneID,
|
||||
const bool zoneFlip,
|
||||
const label subPatchID
|
||||
const bool zoneFlip
|
||||
)
|
||||
:
|
||||
face_(f),
|
||||
@ -132,8 +127,7 @@ public:
|
||||
patchID_(patchID),
|
||||
removeFromZone_(removeFromZone),
|
||||
zoneID_(zoneID),
|
||||
zoneFlip_(zoneFlip),
|
||||
subPatchID_(subPatchID)
|
||||
zoneFlip_(zoneFlip)
|
||||
{
|
||||
if (face_.size() < 3)
|
||||
{
|
||||
@ -149,8 +143,7 @@ public:
|
||||
" const label patchID,\n"
|
||||
" const bool removeFromZone,\n"
|
||||
" const label zoneID,\n"
|
||||
" const bool zoneFlip,\n"
|
||||
" const label subPatchID\n"
|
||||
" const bool zoneFlip\n"
|
||||
")"
|
||||
) << "Invalid face: less than 3 points. This is not allowed\n"
|
||||
<< "Face: " << face_
|
||||
@ -174,8 +167,7 @@ public:
|
||||
" const label patchID,\n"
|
||||
" const bool removeFromZone,\n"
|
||||
" const label zoneID,\n"
|
||||
" const bool zoneFlip,\n"
|
||||
" const label subPatchID\n"
|
||||
" const bool zoneFlip\n"
|
||||
")"
|
||||
) << "Face contains invalid vertex ID: " << face_ << ". "
|
||||
<< "This is not allowed.\n"
|
||||
@ -199,8 +191,7 @@ public:
|
||||
" const label patchID,\n"
|
||||
" const bool removeFromZone,\n"
|
||||
" const label zoneID,\n"
|
||||
" const bool zoneFlip,\n"
|
||||
" const label subPatchID\n"
|
||||
" const bool zoneFlip\n"
|
||||
")"
|
||||
) << "Face owner and neighbour are identical. "
|
||||
<< "This is not allowed.\n"
|
||||
@ -225,8 +216,7 @@ public:
|
||||
" const label patchID,\n"
|
||||
" const bool removeFromZone,\n"
|
||||
" const label zoneID,\n"
|
||||
" const bool zoneFlip,\n"
|
||||
" const label subPatchID\n"
|
||||
" const bool zoneFlip\n"
|
||||
")"
|
||||
) << "Patch face has got a neighbour "
|
||||
<< "This is not allowed.\n"
|
||||
@ -252,8 +242,7 @@ public:
|
||||
" const label patchID,\n"
|
||||
" const bool removeFromZone,\n"
|
||||
" const label zoneID,\n"
|
||||
" const bool zoneFlip,\n"
|
||||
" const label subPatchID\n"
|
||||
" const bool zoneFlip\n"
|
||||
")"
|
||||
) << "Specified zone flip for a face that does not "
|
||||
<< "belong to zone. This is not allowed.\n"
|
||||
@ -263,32 +252,6 @@ public:
|
||||
<< " neighbour:" << neighbour_
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (patchID < 0 && subPatchID_ >= 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"polyModifyFace::polyModifyFace\n"
|
||||
"(\n"
|
||||
" const face& f,\n"
|
||||
" const label faceID,\n"
|
||||
" const label owner,\n"
|
||||
" const label neighbour,\n"
|
||||
" const bool flipFaceFlux,\n"
|
||||
" const label patchID,\n"
|
||||
" const bool removeFromZone,\n"
|
||||
" const label zoneID,\n"
|
||||
" const bool zoneFlip,\n"
|
||||
" const label subPatchID\n"
|
||||
")"
|
||||
) << "Specified subPatchID on an internal face (patchID < 0"
|
||||
<< ". This is not allowed.\n"
|
||||
<< "Face: " << face_
|
||||
<< " faceID:" << faceID_
|
||||
<< " owner:" << owner_
|
||||
<< " neighbour:" << neighbour_
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
//- Construct and return a clone
|
||||
@ -372,12 +335,6 @@ public:
|
||||
{
|
||||
return zoneFlip_;
|
||||
}
|
||||
|
||||
//- Boundary sub patch ID
|
||||
label subPatchID() const
|
||||
{
|
||||
return subPatchID_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1828,43 +1828,6 @@ Foam::face Foam::polyTopoChange::rotateFace
|
||||
}
|
||||
|
||||
|
||||
bool Foam::polyTopoChange::orderAndMerge
|
||||
(
|
||||
const polyPatch& pp,
|
||||
const primitivePatch& faces,
|
||||
const label start,
|
||||
|
||||
labelList& oldToNew,
|
||||
labelList& rotation
|
||||
) const
|
||||
{
|
||||
labelList patchFaceMap(faces.size(), -1);
|
||||
labelList patchFaceRotation(faces.size(), 0);
|
||||
|
||||
bool changed = pp.order
|
||||
(
|
||||
faces,
|
||||
patchFaceMap,
|
||||
patchFaceRotation
|
||||
);
|
||||
|
||||
if (changed)
|
||||
{
|
||||
// Merge patch face reordering into mesh face reordering table
|
||||
forAll(patchFaceMap, patchFaceI)
|
||||
{
|
||||
oldToNew[patchFaceI + start] = start + patchFaceMap[patchFaceI];
|
||||
}
|
||||
|
||||
forAll(patchFaceRotation, patchFaceI)
|
||||
{
|
||||
rotation[patchFaceI + start] = patchFaceRotation[patchFaceI];
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
void Foam::polyTopoChange::reorderCoupledFaces
|
||||
(
|
||||
const bool syncParallel,
|
||||
@ -2244,6 +2207,7 @@ void Foam::polyTopoChange::addMesh
|
||||
// Extend
|
||||
points_.setCapacity(points_.size() + points.size());
|
||||
pointMap_.setCapacity(pointMap_.size() + points.size());
|
||||
reversePointMap_.setCapacity(reversePointMap_.size() + points.size());
|
||||
pointZone_.resize(pointZone_.size() + points.size()/100);
|
||||
|
||||
// Precalc offset zones
|
||||
@ -2283,6 +2247,7 @@ void Foam::polyTopoChange::addMesh
|
||||
label nAllCells = mesh.nCells();
|
||||
|
||||
cellMap_.setCapacity(cellMap_.size() + nAllCells);
|
||||
reverseCellMap_.setCapacity(reverseCellMap_.size() + nAllCells);
|
||||
cellFromPoint_.resize(cellFromPoint_.size() + nAllCells/100);
|
||||
cellFromEdge_.resize(cellFromEdge_.size() + nAllCells/100);
|
||||
cellFromFace_.resize(cellFromFace_.size() + nAllCells/100);
|
||||
@ -2347,6 +2312,7 @@ void Foam::polyTopoChange::addMesh
|
||||
faceOwner_.setCapacity(faceOwner_.size() + nAllFaces);
|
||||
faceNeighbour_.setCapacity(faceNeighbour_.size() + nAllFaces);
|
||||
faceMap_.setCapacity(faceMap_.size() + nAllFaces);
|
||||
reverseFaceMap_.setCapacity(reverseFaceMap_.size() + nAllFaces);
|
||||
faceFromPoint_.resize(faceFromPoint_.size() + nAllFaces/100);
|
||||
faceFromEdge_.resize(faceFromEdge_.size() + nAllFaces/100);
|
||||
flipFaceFlux_.setCapacity(faces_.size() + nAllFaces);
|
||||
@ -2431,6 +2397,39 @@ void Foam::polyTopoChange::addMesh
|
||||
}
|
||||
|
||||
|
||||
void Foam::polyTopoChange::setCapacity
|
||||
(
|
||||
const label nPoints,
|
||||
const label nFaces,
|
||||
const label nCells
|
||||
)
|
||||
{
|
||||
points_.setCapacity(nPoints);
|
||||
pointMap_.setCapacity(nPoints);
|
||||
reversePointMap_.setCapacity(nPoints);
|
||||
pointZone_.resize(pointZone_.size() + nPoints/100);
|
||||
|
||||
faces_.setCapacity(nFaces);
|
||||
region_.setCapacity(nFaces);
|
||||
faceOwner_.setCapacity(nFaces);
|
||||
faceNeighbour_.setCapacity(nFaces);
|
||||
faceMap_.setCapacity(nFaces);
|
||||
reverseFaceMap_.setCapacity(nFaces);
|
||||
faceFromPoint_.resize(faceFromPoint_.size() + nFaces/100);
|
||||
faceFromEdge_.resize(faceFromEdge_.size() + nFaces/100);
|
||||
flipFaceFlux_.setCapacity(nFaces);
|
||||
faceZone_.resize(faceZone_.size() + nFaces/100);
|
||||
faceZoneFlip_.setCapacity(nFaces);
|
||||
|
||||
cellMap_.setCapacity(nCells);
|
||||
reverseCellMap_.setCapacity(nCells);
|
||||
cellFromPoint_.resize(cellFromPoint_.size() + nCells/100);
|
||||
cellFromEdge_.resize(cellFromEdge_.size() + nCells/100);
|
||||
cellFromFace_.resize(cellFromFace_.size() + nCells/100);
|
||||
cellZone_.setCapacity(nCells);
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::polyTopoChange::setAction(const topoAction& action)
|
||||
{
|
||||
if (isType<polyAddPoint>(action))
|
||||
|
||||
@ -50,8 +50,9 @@ Description
|
||||
To see if point is equal to above value we don't use == (which might give
|
||||
problems with roundoff error) but instead compare the individual component
|
||||
with >.
|
||||
- coupled patches: the reorderCoupledFaces routine reorders coupled patch
|
||||
faces and uses the cyclicPolyPatch,processorPolyPatch functionality.
|
||||
- coupled patches: the reorderCoupledFaces routine (borrowed from
|
||||
the couplePatches utility) reorders coupled patch faces and
|
||||
uses the cyclicPolyPatch,processorPolyPatch functionality.
|
||||
|
||||
SourceFiles
|
||||
polyTopoChange.C
|
||||
@ -471,6 +472,15 @@ public:
|
||||
const labelList& cellZoneMap
|
||||
);
|
||||
|
||||
//- Explicitly pre-size the dynamic storage for expected mesh
|
||||
// size for if construct-without-mesh
|
||||
void setCapacity
|
||||
(
|
||||
const label nPoints,
|
||||
const label nFaces,
|
||||
const label nCells
|
||||
);
|
||||
|
||||
//- Move all points. Incompatible with other topology changes.
|
||||
void movePoints(const pointField& newPoints);
|
||||
|
||||
|
||||
@ -22,8 +22,6 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "polyTopoChange.H"
|
||||
|
||||
@ -223,7 +223,7 @@ inline bool Foam::refinementData::updateFace
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
@ -241,7 +241,7 @@ inline bool Foam::refinementDistanceData::updateFace
|
||||
const point& pos = mesh.faceCentres()[thisFaceI];
|
||||
|
||||
return update(pos, neighbourInfo, tol);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user