builds again

This commit is contained in:
mattijs
2010-01-14 12:13:01 +00:00
parent be1b1ceefc
commit f847a7927e
238 changed files with 5493 additions and 4333 deletions

View File

@ -335,6 +335,7 @@ $(constraintPolyPatches)/empty/emptyPolyPatch.C
$(constraintPolyPatches)/symmetry/symmetryPolyPatch.C $(constraintPolyPatches)/symmetry/symmetryPolyPatch.C
$(constraintPolyPatches)/wedge/wedgePolyPatch.C $(constraintPolyPatches)/wedge/wedgePolyPatch.C
$(constraintPolyPatches)/cyclic/cyclicPolyPatch.C $(constraintPolyPatches)/cyclic/cyclicPolyPatch.C
$(constraintPolyPatches)/processorCyclic/processorCyclicPolyPatch.C
$(constraintPolyPatches)/processor/processorPolyPatch.C $(constraintPolyPatches)/processor/processorPolyPatch.C
derivedPolyPatches = $(polyPatches)/derived derivedPolyPatches = $(polyPatches)/derived
@ -446,6 +447,7 @@ $(constraintPointPatches)/symmetry/symmetryPointPatch.C
$(constraintPointPatches)/wedge/wedgePointPatch.C $(constraintPointPatches)/wedge/wedgePointPatch.C
$(constraintPointPatches)/cyclic/cyclicPointPatch.C $(constraintPointPatches)/cyclic/cyclicPointPatch.C
$(constraintPointPatches)/processor/processorPointPatch.C $(constraintPointPatches)/processor/processorPointPatch.C
$(constraintPointPatches)/processorCyclic/processorCyclicPointPatch.C
derivedPointPatches = $(pointPatches)/derived derivedPointPatches = $(pointPatches)/derived
$(derivedPointPatches)/coupled/coupledFacePointPatch.C $(derivedPointPatches)/coupled/coupledFacePointPatch.C
@ -501,6 +503,7 @@ $(constraintPointPatchFields)/symmetry/symmetryPointPatchFields.C
$(constraintPointPatchFields)/wedge/wedgePointPatchFields.C $(constraintPointPatchFields)/wedge/wedgePointPatchFields.C
$(constraintPointPatchFields)/cyclic/cyclicPointPatchFields.C $(constraintPointPatchFields)/cyclic/cyclicPointPatchFields.C
$(constraintPointPatchFields)/processor/processorPointPatchFields.C $(constraintPointPatchFields)/processor/processorPointPatchFields.C
$(constraintPointPatchFields)/processorCyclic/processorCyclicPointPatchFields.C
derivedPointPatchFields = $(pointPatchFields)/derived derivedPointPatchFields = $(pointPatchFields)/derived
$(derivedPointPatchFields)/slip/slipPointPatchFields.C $(derivedPointPatchFields)/slip/slipPointPatchFields.C

View File

@ -132,7 +132,7 @@ public:
inline label fcIndex(const label i) const; inline label fcIndex(const label i) const;
//- Return the reverse circular index, i.e. the previous index //- 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; inline label rcIndex(const label i) const;
//- Return the binary size in number of characters of the UList //- 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. // This can be used (with caution) when interfacing with C code.
inline T* data(); 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 // Check
@ -184,12 +196,6 @@ public:
// an out-of-range element returns false without any ill-effects // an out-of-range element returns false without any ill-effects
inline const T& operator[](const label) const; 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>& //- Allow cast to a const List<T>&
inline operator const Foam::List<T>&() const; inline operator const Foam::List<T>&() const;

View File

@ -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> template<class T>
inline T& Foam::UList<T>::last() inline T& Foam::UList<T>::last()
{ {

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "processorPointPatchField.H" #include "processorPointPatchField.H"
#include "transformField.H" //#include "transformField.H"
#include "processorPolyPatch.H" #include "processorPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -131,125 +131,7 @@ void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const
if (doTransform()) if (doTransform())
{ {
const processorPolyPatch& ppp = procPatch_.procPolyPatch(); procPatch_.procPolyPatch().transform(pnf);
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);
}
}
}
}
}
} }
addToInternalField(pField, pnf); addToInternalField(pField, pnf);

View File

@ -149,13 +149,13 @@ public:
} }
} }
//- Does the patch field perform the transfromation //- Does the patch field perform the transformation
virtual bool doTransform() const virtual bool doTransform() const
{ {
return return
!( !(
pTraits<Type>::rank == 0 pTraits<Type>::rank == 0
|| procPatch_.procPolyPatch().parallel() || procPatch_.procPolyPatch().doTransform()
); );
} }

View File

@ -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
// ************************************************************************* //

View File

@ -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
// ************************************************************************* //

View File

@ -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
// ************************************************************************* //

View File

@ -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
// ************************************************************************* //

View File

@ -36,6 +36,18 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::processorLduInterface::resizeBuf
(
List<char>& buf,
const label size
) const
{
if (buf.size() < size)
{
buf.setSize(size);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -61,6 +61,9 @@ class processorLduInterface
// Only sized and used when compressed or non-blocking comms used. // Only sized and used when compressed or non-blocking comms used.
mutable List<char> receiveBuf_; mutable List<char> receiveBuf_;
//- Resize the buffer if required
void resizeBuf(List<char>& buf, const label size) const;
public: public:
@ -89,17 +92,20 @@ public:
//- Return neigbour processor number //- Return neigbour processor number
virtual int neighbProcNo() const = 0; virtual int neighbProcNo() const = 0;
//- Set send buffer to sufficient size to hold List<Type>(nElems). //- Return face transformation tensor
// Returns reference to buffer (note:buffer.size() is number virtual const tensor& forwardT() const = 0;
// 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) // //- Set send buffer to sufficient size to hold List<Type>(nElems).
// Returns reference to buffer (note:buffer.size() is number // // Returns reference to buffer (note:buffer.size() is number
// of characters, not nElems) // // of characters, not nElems)
template<class Type> // template<class Type>
List<Type>& setReceiveBuf(const label nElems) const; // 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 // Transfer functions
@ -154,24 +160,24 @@ public:
) const; ) const;
//- Raw field send function of internal send buffer with data // //- Raw field send function of internal send buffer with data
// compression. // // compression.
template<class Type> // template<class Type>
void compressedBufferSend // void compressedBufferSend
( // (
const Pstream::commsTypes commsType // const Pstream::commsTypes commsType
) const; // ) const;
//
//- Raw field receive function of internal receive buffer with data // //- Raw field receive function of internal receive buffer with data
// compression. // // compression.
// Returns reference to buffer (note:buffer.size() is number // // Returns reference to buffer (note:buffer.size() is number
// of characters, not size) // // of characters, not size)
template<class Type> // template<class Type>
const List<Type>& compressedBufferReceive // const List<Type>& compressedBufferReceive
( // (
const Pstream::commsTypes commsType, // const Pstream::commsTypes commsType,
const label size // const label size
) const; // ) const;
}; };

View File

@ -30,47 +30,47 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> // template<class Type>
Foam::List<Type>& Foam::processorLduInterface::setSendBuf(const label nElems) // Foam::List<Type>& Foam::processorLduInterface::setSendBuf(const label nElems)
const // const
{ // {
if (!contiguous<Type>()) // if (!contiguous<Type>())
{ // {
FatalErrorIn("processorLduInterface::setSendBuf(const label) const") // FatalErrorIn("processorLduInterface::setSendBuf(const label) const")
<< "Cannot return the binary size of a list of " // << "Cannot return the binary size of a list of "
"non-primitive elements" // "non-primitive elements"
<< abort(FatalError); // << abort(FatalError);
} // }
//
label nBytes = nElems*sizeof(Type); // label nBytes = nElems*sizeof(Type);
sendBuf_.setSize(nBytes); // sendBuf_.setSize(nBytes);
//
return reinterpret_cast<List<Type>&>(sendBuf_); // return reinterpret_cast<List<Type>&>(sendBuf_);
} // }
//
//
template<class Type> // template<class Type>
Foam::List<Type>& Foam::processorLduInterface::setReceiveBuf // Foam::List<Type>& Foam::processorLduInterface::setReceiveBuf
( // (
const label nElems // const label nElems
) const // ) const
{ // {
if (!contiguous<Type>()) // if (!contiguous<Type>())
{ // {
FatalErrorIn("processorLduInterface::setReceiveBuf(const label) const") // FatalErrorIn("processorLduInterface::setReceiveBuf(const label) const")
<< "Cannot return the binary size of a list of " // << "Cannot return the binary size of a list of "
"non-primitive elements" // "non-primitive elements"
<< abort(FatalError); // << abort(FatalError);
} // }
//
label nBytes = nElems*sizeof(Type); // label nBytes = nElems*sizeof(Type);
//
//receiveBuf_.setSize(nBytes, '\0'); // necessary because of expanding // //receiveBuf_.setSize(nBytes, '\0'); // necessary because of expanding
// compression? // // compression?
receiveBuf_.setSize(nBytes); // receiveBuf_.setSize(nBytes);
//
return reinterpret_cast<List<Type>&>(receiveBuf_); // return reinterpret_cast<List<Type>&>(receiveBuf_);
} // }
template<class Type> template<class Type>
@ -92,17 +92,19 @@ void Foam::processorLduInterface::send
} }
else if (commsType == Pstream::nonBlocking) else if (commsType == Pstream::nonBlocking)
{ {
setReceiveBuf<Type>(f.size()); //setReceiveBuf<Type>(f.size());
resizeBuf(receiveBuf_, f.size()*sizeof(Type));
IPstream::read IPstream::read
( (
commsType, commsType,
neighbProcNo(), neighbProcNo(),
receiveBuf_.begin(), 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()); memcpy(sendBuf_.begin(), f.begin(), f.byteSize());
OPstream::write OPstream::write
@ -182,7 +184,8 @@ void Foam::processorLduInterface::compressedSend
const scalar *sArray = reinterpret_cast<const scalar*>(f.begin()); const scalar *sArray = reinterpret_cast<const scalar*>(f.begin());
const scalar *slast = &sArray[nm1]; const scalar *slast = &sArray[nm1];
setSendBuf<float>(nFloats); //setSendBuf<float>(nFloats);
resizeBuf(sendBuf_, nBytes);
float *fArray = reinterpret_cast<float*>(sendBuf_.begin()); float *fArray = reinterpret_cast<float*>(sendBuf_.begin());
for (register label i=0; i<nm1; i++) for (register label i=0; i<nm1; i++)
@ -204,7 +207,8 @@ void Foam::processorLduInterface::compressedSend
} }
else if (commsType == Pstream::nonBlocking) else if (commsType == Pstream::nonBlocking)
{ {
setReceiveBuf<float>(nFloats); //setReceiveBuf<float>(nFloats);
resizeBuf(receiveBuf_, nBytes);
IPstream::read IPstream::read
( (
@ -235,7 +239,6 @@ void Foam::processorLduInterface::compressedSend
} }
} }
template<class Type> template<class Type>
void Foam::processorLduInterface::compressedReceive void Foam::processorLduInterface::compressedReceive
( (
@ -249,17 +252,19 @@ void Foam::processorLduInterface::compressedReceive
label nm1 = (f.size() - 1)*nCmpts; label nm1 = (f.size() - 1)*nCmpts;
label nlast = sizeof(Type)/sizeof(float); label nlast = sizeof(Type)/sizeof(float);
label nFloats = nm1 + nlast; label nFloats = nm1 + nlast;
label nBytes = nFloats*sizeof(float);
if (commsType == Pstream::blocking || commsType == Pstream::scheduled) if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
{ {
setReceiveBuf<float>(nFloats); //setReceiveBuf<float>(nFloats);
resizeBuf(receiveBuf_, nBytes);
IPstream::read IPstream::read
( (
commsType, commsType,
neighbProcNo(), neighbProcNo(),
receiveBuf_.begin(), receiveBuf_.begin(),
receiveBuf_.size() nBytes
); );
} }
else if (commsType != Pstream::nonBlocking) else if (commsType != Pstream::nonBlocking)
@ -286,7 +291,6 @@ void Foam::processorLduInterface::compressedReceive
} }
} }
template<class Type> template<class Type>
Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
( (
@ -300,155 +304,155 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
} }
template<class Type> // template<class Type>
void Foam::processorLduInterface::compressedBufferSend // void Foam::processorLduInterface::compressedBufferSend
( // (
const Pstream::commsTypes commsType // const Pstream::commsTypes commsType
) const // ) const
{ // {
// Optionally inline compress sendBuf // // Optionally inline compress sendBuf
if // if
( // (
sizeof(scalar) > sizeof(float) // sizeof(scalar) > sizeof(float)
&& sendBuf_.size() // && sendBuf_.size()
&& Pstream::floatTransfer // && Pstream::floatTransfer
) // )
{ // {
const List<Type>& f = reinterpret_cast<const List<Type>&>(sendBuf_); // const List<Type>& f = reinterpret_cast<const List<Type>&>(sendBuf_);
label fSize = f.size()/sizeof(Type); // label fSize = f.size()/sizeof(Type);
//
// Inplace compress // // Inplace compress
static const label nCmpts = sizeof(Type)/sizeof(scalar); // static const label nCmpts = sizeof(Type)/sizeof(scalar);
label nm1 = (fSize - 1)*nCmpts; // label nm1 = (fSize - 1)*nCmpts;
label nlast = sizeof(Type)/sizeof(float); // label nlast = sizeof(Type)/sizeof(float);
label nFloats = nm1 + nlast; // label nFloats = nm1 + nlast;
//
const scalar *sArray = reinterpret_cast<const scalar*>(f.begin()); // const scalar *sArray = reinterpret_cast<const scalar*>(f.begin());
const scalar *slast = &sArray[nm1]; // const scalar *slast = &sArray[nm1];
float *fArray = reinterpret_cast<float*>(sendBuf_.begin()); // float *fArray = reinterpret_cast<float*>(sendBuf_.begin());
//
for (register label i=0; i<nm1; i++) // for (register label i=0; i<nm1; i++)
{ // {
fArray[i] = sArray[i] - slast[i%nCmpts]; // fArray[i] = sArray[i] - slast[i%nCmpts];
} // }
//
reinterpret_cast<Type&>(fArray[nm1]) = f[fSize - 1]; // reinterpret_cast<Type&>(fArray[nm1]) = f[fSize - 1];
//
// Trim // // Trim
setSendBuf<float>(nFloats); // setSendBuf<float>(nFloats);
} // }
//
// Send sendBuf // // Send sendBuf
if (commsType == Pstream::blocking || commsType == Pstream::scheduled) // if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
{ // {
OPstream::write // OPstream::write
( // (
commsType, // commsType,
neighbProcNo(), // neighbProcNo(),
sendBuf_.begin(), // sendBuf_.begin(),
sendBuf_.size() // sendBuf_.size()
); // );
} // }
else if (commsType == Pstream::nonBlocking) // else if (commsType == Pstream::nonBlocking)
{ // {
setReceiveBuf<char>(sendBuf_.size()); // setReceiveBuf<char>(sendBuf_.size());
//
IPstream::read // IPstream::read
( // (
commsType, // commsType,
neighbProcNo(), // neighbProcNo(),
receiveBuf_.begin(), // receiveBuf_.begin(),
receiveBuf_.size() // receiveBuf_.size()
); // );
//
OPstream::write // OPstream::write
( // (
commsType, // commsType,
neighbProcNo(), // neighbProcNo(),
sendBuf_.begin(), // sendBuf_.begin(),
sendBuf_.size() // sendBuf_.size()
); // );
} // }
else // else
{ // {
FatalErrorIn("processorLduInterface::compressedBufferSend") // FatalErrorIn("processorLduInterface::compressedBufferSend")
<< "Unsupported communications type " << commsType // << "Unsupported communications type " << commsType
<< exit(FatalError); // << exit(FatalError);
} // }
} // }
//
//
template<class Type> // template<class Type>
const Foam::List<Type>& Foam::processorLduInterface::compressedBufferReceive // const Foam::List<Type>& Foam::processorLduInterface::compressedBufferReceive
( // (
const Pstream::commsTypes commsType, // const Pstream::commsTypes commsType,
const label size // const label size
) const // ) const
{ // {
if (sizeof(scalar) > sizeof(float) && size && Pstream::floatTransfer) // if (sizeof(scalar) > sizeof(float) && size && Pstream::floatTransfer)
{ // {
static const label nCmpts = sizeof(Type)/sizeof(scalar); // static const label nCmpts = sizeof(Type)/sizeof(scalar);
label nm1 = (size - 1)*nCmpts; // label nm1 = (size - 1)*nCmpts;
label nlast = sizeof(Type)/sizeof(float); // label nlast = sizeof(Type)/sizeof(float);
label nFloats = nm1 + nlast; // label nFloats = nm1 + nlast;
//
if (commsType == Pstream::blocking || commsType == Pstream::scheduled) // if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
{ // {
setReceiveBuf<float>(nFloats); // setReceiveBuf<float>(nFloats);
//
IPstream::read // IPstream::read
( // (
commsType, // commsType,
neighbProcNo(), // neighbProcNo(),
receiveBuf_.begin(), // receiveBuf_.begin(),
receiveBuf_.size() // receiveBuf_.size()
); // );
} // }
else if (commsType != Pstream::nonBlocking) // else if (commsType != Pstream::nonBlocking)
{ // {
FatalErrorIn("processorLduInterface::compressedBufferReceive") // FatalErrorIn("processorLduInterface::compressedBufferReceive")
<< "Unsupported communications type " << commsType // << "Unsupported communications type " << commsType
<< exit(FatalError); // << exit(FatalError);
} // }
//
// Inline expand // // Inline expand
List<Type>& f = setReceiveBuf<Type>(size); // List<Type>& f = setReceiveBuf<Type>(size);
label fSize = f.size()/sizeof(Type); // label fSize = f.size()/sizeof(Type);
//
const float *fArray = // const float *fArray =
reinterpret_cast<const float*>(receiveBuf_.begin()); // reinterpret_cast<const float*>(receiveBuf_.begin());
f[fSize - 1] = reinterpret_cast<const Type&>(fArray[nm1]); // f[fSize - 1] = reinterpret_cast<const Type&>(fArray[nm1]);
scalar *sArray = reinterpret_cast<scalar*>(f.begin()); // scalar *sArray = reinterpret_cast<scalar*>(f.begin());
const scalar *slast = &sArray[nm1]; // const scalar *slast = &sArray[nm1];
//
for (register label i=0; i<nm1; i++) // for (register label i=0; i<nm1; i++)
{ // {
sArray[i] = fArray[i] + slast[i%nCmpts]; // sArray[i] = fArray[i] + slast[i%nCmpts];
} // }
} // }
else // else
{ // {
if (commsType == Pstream::blocking || commsType == Pstream::scheduled) // if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
{ // {
setReceiveBuf<Type>(size); // setReceiveBuf<Type>(size);
//
IPstream::read // IPstream::read
( // (
commsType, // commsType,
neighbProcNo(), // neighbProcNo(),
receiveBuf_.begin(), // receiveBuf_.begin(),
receiveBuf_.size() // receiveBuf_.size()
); // );
} // }
else if (commsType != Pstream::nonBlocking) // else if (commsType != Pstream::nonBlocking)
{ // {
FatalErrorIn("processorLduInterface::compressedBufferReceive") // FatalErrorIn("processorLduInterface::compressedBufferReceive")
<< "Unsupported communications type " << commsType // << "Unsupported communications type " << commsType
<< exit(FatalError); // << exit(FatalError);
} // }
} // }
return reinterpret_cast<List<Type>&>(receiveBuf_); // return reinterpret_cast<List<Type>&>(receiveBuf_);
} // }
// ************************************************************************* // // ************************************************************************* //

View File

@ -43,24 +43,17 @@ Foam::processorLduInterfaceField::~processorLduInterfaceField()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//void Foam::processorLduInterfaceField::transformCoupleField void Foam::processorLduInterfaceField::transformCoupleField
//( (
// scalarField& f, scalarField& f,
// const direction cmpt const direction cmpt
//) const ) const
//{ {
// if (doTransform()) if (doTransform())
// { {
// if (forwardT().size() == 1) f *= pow(diag(forwardT()).component(cmpt), rank());
// { }
// f *= pow(diag(forwardT()[0]).component(cmpt), rank()); }
// }
// else
// {
// f *= pow(diag(forwardT())().component(cmpt), rank());
// }
// }
//}
// ************************************************************************* // // ************************************************************************* //

View File

@ -79,22 +79,22 @@ public:
//- Return neigbour processor number //- Return neigbour processor number
virtual int neighbProcNo() const = 0; virtual int neighbProcNo() const = 0;
// //- Is the transform required //- Is the transform required
// virtual bool doTransform() const = 0; virtual bool doTransform() const = 0;
//
// //- Return face transformation tensor //- Return face transformation tensor
// virtual const tensorField& forwardT() const = 0; virtual const tensor& forwardT() const = 0;
//- Return rank of component for transform //- Return rank of component for transform
virtual int rank() const = 0; virtual int rank() const = 0;
// //- Transform given patch component field //- Transform given patch component field
// virtual void transformCoupleField void transformCoupleField
// ( (
// scalarField& f, scalarField& f,
// const direction cmpt const direction cmpt
// ) const = 0; ) const;
}; };

View File

@ -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 * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const boundBox& bb) Foam::Ostream& Foam::operator<<(Ostream& os, const boundBox& bb)

View File

@ -171,6 +171,8 @@ public:
return cmptAv(span()); return cmptAv(span());
} }
//- Return corner points in an order corresponding to a 'hex' cell
tmp<pointField> corners() const;
// Query // Query

View File

@ -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
// ************************************************************************* //

View File

@ -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
// ************************************************************************* //

View File

@ -747,20 +747,10 @@ void Foam::globalMeshData::updateMesh()
{ {
label patchI = processorPatches_[i]; label patchI = processorPatches_[i];
const processorPolyPatch& procPatch = if (isType<processorPolyPatch>(mesh_.boundaryMesh()[patchI]))
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
if (Pstream::myProcNo() > procPatch.neighbProcNo())
{
forAll(procPatch.patchIDs(), i)
{
if (procPatch.patchIDs()[i] == -1)
{ {
// Normal, unseparated processor patch. Remove duplicates. // Normal, unseparated processor patch. Remove duplicates.
label sz = procPatch.starts()[i+1]-procPatch.starts()[i]; nTotalFaces_ -= mesh_.boundaryMesh()[patchI].size();
nTotalFaces_ -= sz;
}
}
} }
} }
reduce(nTotalFaces_, sumOp<label>()); reduce(nTotalFaces_, sumOp<label>());

View File

@ -654,8 +654,6 @@ void Foam::polyMesh::resetPrimitives
const Xfer<labelList>& neighbour, const Xfer<labelList>& neighbour,
const labelList& patchSizes, const labelList& patchSizes,
const labelList& patchStarts, const labelList& patchStarts,
const labelListList& subPatches,
const labelListList& subPatchStarts,
const bool validBoundary const bool validBoundary
) )
{ {
@ -697,17 +695,6 @@ void Foam::polyMesh::resetPrimitives
patchI, patchI,
boundary_ 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 Xfer<labelList>& neighbour,\n"
" const labelList& patchSizes,\n" " const labelList& patchSizes,\n"
" const labelList& patchStarts\n" " const labelList& patchStarts\n"
" const labelListList& subPatches,\n"
" const labelListList& subPatchStarts,\n"
" const bool validBoundary\n" " const bool validBoundary\n"
")\n" ")\n"
) << "Face " << faceI << " contains vertex labels out of range: " ) << "Face " << faceI << " contains vertex labels out of range: "
@ -772,8 +757,6 @@ void Foam::polyMesh::resetPrimitives
" const Xfer<labelList>& neighbour,\n" " const Xfer<labelList>& neighbour,\n"
" const labelList& patchSizes,\n" " const labelList& patchSizes,\n"
" const labelList& patchStarts\n" " const labelList& patchStarts\n"
" const labelListList& subPatches,\n"
" const labelListList& subPatchStarts,\n"
" const bool validBoundary\n" " const bool validBoundary\n"
")\n" ")\n"
) << "no points or no cells in mesh" << endl; ) << "no points or no cells in mesh" << endl;

View File

@ -471,8 +471,6 @@ public:
//- Reset mesh primitive data. Assumes all patch info correct //- Reset mesh primitive data. Assumes all patch info correct
// (so does e.g. parallel communication). If not use // (so does e.g. parallel communication). If not use
// validBoundary=false // validBoundary=false
// (still assumes patchStarts[0] = nInternalFaces and last
// patch ends at nActiveFaces) and change patches with addPatches.
void resetPrimitives void resetPrimitives
( (
const Xfer<pointField>& points, const Xfer<pointField>& points,
@ -481,8 +479,6 @@ public:
const Xfer<labelList>& neighbour, const Xfer<labelList>& neighbour,
const labelList& patchSizes, const labelList& patchSizes,
const labelList& patchStarts, const labelList& patchStarts,
const labelListList& subPatches,
const labelListList& subPatchStarts,
const bool validBoundary = true const bool validBoundary = true
); );

View File

@ -112,21 +112,21 @@ void Foam::coupledPolyPatch::writeOBJ
} }
Foam::pointField Foam::coupledPolyPatch::calcFaceCentres //Foam::pointField Foam::coupledPolyPatch::calcFaceCentres
( //(
const UList<face>& faces, // const UList<face>& faces,
const pointField& points // const pointField& points
) //)
{ //{
pointField ctrs(faces.size()); // pointField ctrs(faces.size());
//
forAll(faces, faceI) // forAll(faces, faceI)
{ // {
ctrs[faceI] = faces[faceI].centre(points); // ctrs[faceI] = faces[faceI].centre(points);
} // }
//
return ctrs; // return ctrs;
} //}
Foam::pointField Foam::coupledPolyPatch::getAnchorPoints Foam::pointField Foam::coupledPolyPatch::getAnchorPoints

View File

@ -126,13 +126,6 @@ protected:
label& vertI label& vertI
); );
//- Calculate face centres
static pointField calcFaceCentres
(
const UList<face>&,
const pointField&
);
//- Get f[0] for all faces //- Get f[0] for all faces
static pointField getAnchorPoints static pointField getAnchorPoints
( (
@ -242,8 +235,9 @@ public:
return true; return true;
} }
//- Transform a patch-based field. //- Transform a patch-based field from other side to this side.
//!! TDB with macros? //!! TDB with macros?
virtual bool doTransform() const;
virtual void transform(scalarField& l) const = 0; virtual void transform(scalarField& l) const = 0;
virtual void transform(vectorField& l) const = 0; virtual void transform(vectorField& l) const = 0;
virtual void transform(sphericalTensorField& 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(symmTensorField& l) const = 0;
virtual void transform(tensorField& 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; virtual void transformPosition(pointField& l) const = 0;
// Low level geometric information // Low level geometric information
@ -272,14 +266,14 @@ public:
virtual const tensor& reverseT() const = 0; virtual const tensor& reverseT() const = 0;
//- Initialise the calculation of the patch geometry // //- Initialise the calculation of the patch geometry
virtual void initGeometry // virtual void initGeometry
( // (
const primitivePatch& referPatch, // const primitivePatch& referPatch,
UList<point>& nbrCtrs, // UList<point>& nbrCtrs,
UList<point>& nbrAreas, // UList<point>& nbrAreas,
UList<point>& nbrCc // UList<point>& nbrCc
) = 0; // ) = 0;
//- Calculate the patch geometry //- Calculate the patch geometry
virtual void calcGeometry virtual void calcGeometry

View File

@ -93,7 +93,7 @@ void Foam::cyclicPolyPatch::calcTransforms()
const cyclicPolyPatch& half0 = *this; const cyclicPolyPatch& half0 = *this;
pointField half0Ctrs(calcFaceCentres(half0, half0.points())); const pointField& half0Ctrs = half0.faceCentres();
if (debug) if (debug)
{ {
@ -118,7 +118,7 @@ void Foam::cyclicPolyPatch::calcTransforms()
const cyclicPolyPatch& half1 = neighbPatch(); const cyclicPolyPatch& half1 = neighbPatch();
pointField half1Ctrs(calcFaceCentres(half1, half1.points())); const pointField& half1Ctrs = half1.faceCentres();
// Dump halves // Dump halves
if (debug) if (debug)
@ -282,9 +282,9 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
) const ) const
{ {
// Get geometric data on both halves. // Get geometric data on both halves.
half0Ctrs = calcFaceCentres(pp0, pp0.points()); half0Ctrs = pp0.faceCentres();
anchors0 = getAnchorPoints(pp0, pp0.points()); anchors0 = getAnchorPoints(pp0, pp0.points());
half1Ctrs = calcFaceCentres(pp1, pp1.points()); half1Ctrs = pp1.faceCentres();
switch (transform_) switch (transform_)
{ {
@ -585,13 +585,14 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
) )
: :
coupledPolyPatch(pp, bm, index, mapAddressing, newStart), coupledPolyPatch(pp, bm, index, mapAddressing, newStart),
coupledPointsPtr_(NULL), neighbPatchName_(pp.neighbPatchName_),
coupledEdgesPtr_(NULL), neighbPatchID_(-1),
featureCos_(pp.featureCos_),
transform_(pp.transform_), transform_(pp.transform_),
rotationAxis_(pp.rotationAxis_), rotationAxis_(pp.rotationAxis_),
rotationCentre_(pp.rotationCentre_), 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()) if (!parallel())
{ {
Foam::transform(reverseT_, l); Foam::transform(forwardT_, l);
} }
else if (separated()) else if (separated())
{ {
l += separation_; l -= separation_;
} }
} }
@ -647,7 +648,7 @@ void Foam::cyclicPolyPatch::calcGeometry
const UList<point>& nbrCc const UList<point>& nbrCc
) )
{ {
polyPatch::calcGeometry(); //polyPatch::calcGeometry();
Pout<< "cyclicPolyPatch::calcGeometry : name:" << name() Pout<< "cyclicPolyPatch::calcGeometry : name:" << name()
<< " referred from:" << referPatch.size() << endl; << " referred from:" << referPatch.size() << endl;

View File

@ -48,8 +48,6 @@ SourceFiles
#define cyclicPolyPatch_H #define cyclicPolyPatch_H
#include "coupledPolyPatch.H" #include "coupledPolyPatch.H"
//#include "SubField.H"
//#include "FixedList.H"
#include "edgeList.H" #include "edgeList.H"
//#include "transform.H" //#include "transform.H"
#include "polyBoundaryMesh.H" #include "polyBoundaryMesh.H"
@ -373,16 +371,21 @@ public:
// calculation! // calculation!
const edgeList& coupledEdges() const; const edgeList& coupledEdges() const;
//- Transform a patch-based field on this side to a field on the //- Transform a patch-based field from other side to this side.
// other side.
template<class T> template<class T>
void transform(Field<T>& l) const void transform(Field<T>& l) const
{ {
if (!parallel()) if (!parallel())
{ {
transform(reverseT_, l); transform(forwardT_, l);
} }
} }
virtual bool doTransform() const
{
return !parallel();
}
virtual void transform(scalarField& l) const virtual void transform(scalarField& l) const
{ {
transform(l); transform(l);
@ -408,8 +411,7 @@ public:
transform(l); transform(l);
} }
//- Transform a patch-based position on this side to a position //- Transform a patch-based position from other side to this side
// the other side.
virtual void transformPosition(pointField& l) const; virtual void transformPosition(pointField& l) const;

View File

@ -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 Foam::processorPolyPatch::processorPolyPatch
@ -95,24 +55,18 @@ Foam::processorPolyPatch::processorPolyPatch
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const int myProcNo, const int myProcNo,
const int neighbProcNo, const int neighbProcNo
const labelList& patchIDs,
const labelList& starts
) )
: :
coupledPolyPatch(name, size, start, index, bm), coupledPolyPatch(name, size, start, index, bm),
myProcNo_(myProcNo), myProcNo_(myProcNo),
neighbProcNo_(neighbProcNo), neighbProcNo_(neighbProcNo),
patchIDs_(patchIDs),
starts_(starts),
neighbFaceCentres_(), neighbFaceCentres_(),
neighbFaceAreas_(), neighbFaceAreas_(),
neighbFaceCellCentres_() neighbFaceCellCentres_()
// neighbPointsPtr_(NULL), // neighbPointsPtr_(NULL),
// neighbEdgesPtr_(NULL) // neighbEdgesPtr_(NULL)
{ {}
checkSubPatches();
}
Foam::processorPolyPatch::processorPolyPatch Foam::processorPolyPatch::processorPolyPatch
@ -126,16 +80,12 @@ Foam::processorPolyPatch::processorPolyPatch
coupledPolyPatch(name, dict, index, bm), coupledPolyPatch(name, dict, index, bm),
myProcNo_(readLabel(dict.lookup("myProcNo"))), myProcNo_(readLabel(dict.lookup("myProcNo"))),
neighbProcNo_(readLabel(dict.lookup("neighbProcNo"))), neighbProcNo_(readLabel(dict.lookup("neighbProcNo"))),
patchIDs_(dict.lookup("patchIDs")),
starts_(dict.lookup("starts")),
neighbFaceCentres_(), neighbFaceCentres_(),
neighbFaceAreas_(), neighbFaceAreas_(),
neighbFaceCellCentres_() neighbFaceCellCentres_()
// neighbPointsPtr_(NULL), // neighbPointsPtr_(NULL),
// neighbEdgesPtr_(NULL) // neighbEdgesPtr_(NULL)
{ {}
checkSubPatches();
}
Foam::processorPolyPatch::processorPolyPatch Foam::processorPolyPatch::processorPolyPatch
@ -147,8 +97,6 @@ Foam::processorPolyPatch::processorPolyPatch
coupledPolyPatch(pp, bm), coupledPolyPatch(pp, bm),
myProcNo_(pp.myProcNo_), myProcNo_(pp.myProcNo_),
neighbProcNo_(pp.neighbProcNo_), neighbProcNo_(pp.neighbProcNo_),
patchIDs_(pp.patchIDs_),
starts_(pp.starts_),
neighbFaceCentres_(), neighbFaceCentres_(),
neighbFaceAreas_(), neighbFaceAreas_(),
neighbFaceCellCentres_() neighbFaceCellCentres_()
@ -163,24 +111,18 @@ Foam::processorPolyPatch::processorPolyPatch
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const label index, const label index,
const label newSize, const label newSize,
const label newStart, const label newStart
const labelList& patchIDs,
const labelList& starts
) )
: :
coupledPolyPatch(pp, bm, index, newSize, newStart), coupledPolyPatch(pp, bm, index, newSize, newStart),
myProcNo_(pp.myProcNo_), myProcNo_(pp.myProcNo_),
neighbProcNo_(pp.neighbProcNo_), neighbProcNo_(pp.neighbProcNo_),
patchIDs_(patchIDs),
starts_(starts),
neighbFaceCentres_(), neighbFaceCentres_(),
neighbFaceAreas_(), neighbFaceAreas_(),
neighbFaceCellCentres_() neighbFaceCellCentres_()
// neighbPointsPtr_(NULL), // neighbPointsPtr_(NULL),
// neighbEdgesPtr_(NULL) // neighbEdgesPtr_(NULL)
{ {}
checkSubPatches();
}
Foam::processorPolyPatch::processorPolyPatch Foam::processorPolyPatch::processorPolyPatch
@ -197,9 +139,9 @@ Foam::processorPolyPatch::processorPolyPatch
neighbProcNo_(pp.neighbProcNo_), neighbProcNo_(pp.neighbProcNo_),
neighbFaceCentres_(), neighbFaceCentres_(),
neighbFaceAreas_(), neighbFaceAreas_(),
neighbFaceCellCentres_(), neighbFaceCellCentres_()
neighbPointsPtr_(NULL), // neighbPointsPtr_(NULL),
neighbEdgesPtr_(NULL) // neighbEdgesPtr_(NULL)
{} {}
@ -207,90 +149,24 @@ Foam::processorPolyPatch::processorPolyPatch
Foam::processorPolyPatch::~processorPolyPatch() Foam::processorPolyPatch::~processorPolyPatch()
{ {
// deleteDemandDrivenData(neighbPointsPtr_); neighbPointsPtr_.clear();
// deleteDemandDrivenData(neighbEdgesPtr_); neighbEdgesPtr_.clear();
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * 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) void Foam::processorPolyPatch::initGeometry(PstreamBuffers& pBufs)
{ {
Pout<< "**processorPolyPatch::initGeometry()" << endl; Pout<< "**processorPolyPatch::initGeometry()" << endl;
if (Pstream::parRun()) 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); 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 " Pout<< "processorPolyPatch::calcGeometry() : received data for "
<< neighbFaceCentres_.size() << " faces." << endl; << neighbFaceCentres_.size() << " faces." << endl;
forAll(patchIDs_, i) calcGeometry
{
label patchI = patchIDs_[i];
if (patchI == -1)
{
// Anything needs doing for ex-internal faces?
}
else
{
coupledPolyPatch& pp = const_cast<coupledPolyPatch&>
( (
refCast<const coupledPolyPatch> *this,
( faceCentres(),
boundaryMesh()[patchI] faceAreas(),
) faceCellCentres()(),
neighbFaceCentres_,
neighbFaceAreas_,
neighbFaceCellCentres_
); );
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)
);
}
}
} }
Pout<< "**neighbFaceCentres_:" << neighbFaceCentres_ << endl; Pout<< "**neighbFaceCentres_:" << neighbFaceCentres_ << endl;
Pout<< "**neighbFaceAreas_:" << neighbFaceAreas_ << endl; Pout<< "**neighbFaceAreas_:" << neighbFaceAreas_ << endl;
@ -380,56 +231,46 @@ void Foam::processorPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
{ {
polyPatch::initUpdateMesh(pBufs); polyPatch::initUpdateMesh(pBufs);
// deleteDemandDrivenData(neighbPointsPtr_); if (Pstream::parRun())
// deleteDemandDrivenData(neighbEdgesPtr_); {
// // Express all points as patch face and index in face.
// if (Pstream::parRun()) labelList pointFace(nPoints());
// { labelList pointIndex(nPoints());
// // Express all points as patch face and index in face.
// labelList pointFace(nPoints()); for (label patchPointI = 0; patchPointI < nPoints(); patchPointI++)
// labelList pointIndex(nPoints()); {
// label faceI = pointFaces()[patchPointI][0];
// for (label patchPointI = 0; patchPointI < nPoints(); patchPointI++)
// { pointFace[patchPointI] = faceI;
// label faceI = pointFaces()[patchPointI][0];
// const face& f = localFaces()[faceI];
// pointFace[patchPointI] = faceI;
// pointIndex[patchPointI] = findIndex(f, patchPointI);
// 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());
// // Express all edges as patch face and index in face.
// labelList edgeFace(nEdges()); for (label patchEdgeI = 0; patchEdgeI < nEdges(); patchEdgeI++)
// labelList edgeIndex(nEdges()); {
// label faceI = edgeFaces()[patchEdgeI][0];
// for (label patchEdgeI = 0; patchEdgeI < nEdges(); patchEdgeI++)
// { edgeFace[patchEdgeI] = faceI;
// label faceI = edgeFaces()[patchEdgeI][0];
// const labelList& fEdges = faceEdges()[faceI];
// edgeFace[patchEdgeI] = faceI;
// edgeIndex[patchEdgeI] = findIndex(fEdges, patchEdgeI);
// const labelList& fEdges = faceEdges()[faceI]; }
//
// edgeIndex[patchEdgeI] = findIndex(fEdges, patchEdgeI); UOPstream toNeighbProc(neighbProcNo(), pBufs);
// }
// toNeighbProc
// OPstream toNeighbProc << pointFace
// ( << pointIndex
// Pstream::blocking, << edgeFace
// neighbProcNo(), << edgeIndex;
// 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;
// }
} }
@ -438,187 +279,126 @@ void Foam::processorPolyPatch::updateMesh(PstreamBuffers& pBufs)
// For completeness // For completeness
polyPatch::updateMesh(pBufs); polyPatch::updateMesh(pBufs);
// if (Pstream::parRun()) neighbPointsPtr_.clear();
// { neighbEdgesPtr_.clear();
// labelList nbrPointFace;
// labelList nbrPointIndex; if (Pstream::parRun())
// labelList nbrEdgeFace; {
// labelList nbrEdgeIndex; labelList nbrPointFace;
// labelList nbrPointIndex;
// { labelList nbrEdgeFace;
// // Note cannot predict exact size since opposite nPoints might labelList nbrEdgeIndex;
// // be different from one over here.
// IPstream fromNeighbProc(Pstream::blocking, neighbProcNo()); {
// // Note cannot predict exact size since opposite nPoints might
// fromNeighbProc // be different from one over here.
// >> nbrPointFace IPstream fromNeighbProc(Pstream::blocking, neighbProcNo());
// >> nbrPointIndex
// >> nbrEdgeFace fromNeighbProc
// >> nbrEdgeIndex; >> nbrPointFace
// } >> nbrPointIndex
// >> nbrEdgeFace
// // Convert neighbour faces and indices into face back into >> nbrEdgeIndex;
// // my edges and points. }
//
// // Convert points. // Convert neighbour faces and indices into face back into
// // ~~~~~~~~~~~~~~~ // my edges and points.
//
// neighbPointsPtr_ = new labelList(nPoints(), -1); // Convert points.
// labelList& neighbPoints = *neighbPointsPtr_; // ~~~~~~~~~~~~~~~
//
// forAll(nbrPointFace, nbrPointI) neighbPointsPtr_.reset(new labelList(nPoints(), -1));
// { labelList& neighbPoints = neighbPointsPtr_();
// // Find face and index in face on this side.
// const face& f = localFaces()[nbrPointFace[nbrPointI]]; forAll(nbrPointFace, nbrPointI)
// label index = (f.size() - nbrPointIndex[nbrPointI]) % f.size(); {
// label patchPointI = f[index]; // Find face and index in face on this side.
// const face& f = localFaces()[nbrPointFace[nbrPointI]];
// if (neighbPoints[patchPointI] == -1) label index = (f.size() - nbrPointIndex[nbrPointI]) % f.size();
// { label patchPointI = f[index];
// // First reference of point
// neighbPoints[patchPointI] = nbrPointI; if (neighbPoints[patchPointI] == -1)
// } {
// else if (neighbPoints[patchPointI] >= 0) // First reference of point
// { neighbPoints[patchPointI] = nbrPointI;
// // Point already visited. Mark as duplicate. }
// neighbPoints[patchPointI] = -2; 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) // Reset all duplicate entries to -1.
// { forAll(neighbPoints, patchPointI)
// neighbPoints[patchPointI] = -1; {
// } if (neighbPoints[patchPointI] == -2)
// } {
// neighbPoints[patchPointI] = -1;
// // Convert edges. }
// // ~~~~~~~~~~~~~~ }
//
// neighbEdgesPtr_ = new labelList(nEdges(), -1); // Convert edges.
// labelList& neighbEdges = *neighbEdgesPtr_; // ~~~~~~~~~~~~~~
//
// forAll(nbrEdgeFace, nbrEdgeI) neighbEdgesPtr_.reset(new labelList(nEdges(), -1));
// { labelList& neighbEdges = neighbEdgesPtr_();
// // Find face and index in face on this side.
// const labelList& f = faceEdges()[nbrEdgeFace[nbrEdgeI]]; forAll(nbrEdgeFace, nbrEdgeI)
// label index = (f.size() - nbrEdgeIndex[nbrEdgeI] - 1) % f.size(); {
// label patchEdgeI = f[index]; // Find face and index in face on this side.
// const labelList& f = faceEdges()[nbrEdgeFace[nbrEdgeI]];
// if (neighbEdges[patchEdgeI] == -1) label index = (f.size() - nbrEdgeIndex[nbrEdgeI] - 1) % f.size();
// { label patchEdgeI = f[index];
// // First reference of edge
// neighbEdges[patchEdgeI] = nbrEdgeI; if (neighbEdges[patchEdgeI] == -1)
// } {
// else if (neighbEdges[patchEdgeI] >= 0) // First reference of edge
// { neighbEdges[patchEdgeI] = nbrEdgeI;
// // Edge already visited. Mark as duplicate. }
// neighbEdges[patchEdgeI] = -2; 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) // Reset all duplicate entries to -1.
// { forAll(neighbEdges, patchEdgeI)
// neighbEdges[patchEdgeI] = -1; {
// } if (neighbEdges[patchEdgeI] == -2)
// } {
// neighbEdges[patchEdgeI] = -1;
// // Remove any addressing used for shared points/edges calculation }
// primitivePatch::clearOut(); }
// }
// Remove any addressing used for shared points/edges calculation
primitivePatch::clearOut();
}
}
const Foam::labelList& Foam::processorPolyPatch::neighbPoints() const
{
if (!neighbPointsPtr_.valid())
{
FatalErrorIn("processorPolyPatch::neighbPoints() const")
<< "No extended addressing calculated for patch " << name()
<< abort(FatalError);
}
return neighbPointsPtr_();
} }
//const Foam::labelList& Foam::processorPolyPatch::neighbPoints() const const Foam::labelList& Foam::processorPolyPatch::neighbEdges() 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 (!neighbEdgesPtr_.valid())
{ {
subMeshPointsPtr_.reset(new labelListList(patchIDs_.size())); FatalErrorIn("processorPolyPatch::neighbEdges() const")
labelListList& meshPoints = subMeshPointsPtr_(); << "No extended addressing calculated for patch " << name()
<< abort(FatalError);
forAll(patchIDs_, subI)
{
meshPoints[subI] = subPatch(subI)().meshPoints();
} }
} return neighbEdgesPtr_();
return subMeshPointsPtr_();
}
const Foam::labelListList& Foam::processorPolyPatch::reverseSubMeshPoints()
const
{
if (!reverseSubMeshPointsPtr_.valid())
{
reverseSubMeshPointsPtr_.reset(new labelListList(patchIDs_.size()));
labelListList& meshPoints = reverseSubMeshPointsPtr_();
forAll(patchIDs_, subI)
{
label subStart = starts()[subI];
label subSize = starts()[subI+1]-subStart;
faceList reverseFaces(subSize);
forAll(reverseFaces, i)
{
reverseFaces[i] = operator[](subStart+i).reverseFace();
}
meshPoints[subI] = primitivePatch
(
faceSubList
(
reverseFaces,
reverseFaces.size()
),
points()
).meshPoints();
}
}
return reverseSubMeshPointsPtr_();
}
Foam::label Foam::processorPolyPatch::whichSubPatch(const label facei) const
{
label index = findSortedIndex(starts_, facei);
if (index < 0 || index >= starts_.size())
{
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);
}
return patchIDs_[index];
} }
@ -645,7 +425,7 @@ void Foam::processorPolyPatch::initOrder
writeOBJ(nm, pp, pp.points()); writeOBJ(nm, pp, pp.points());
// Calculate my face centres // Calculate my face centres
pointField ctrs(calcFaceCentres(pp, pp.points())); const pointField& fc = pp.faceCentres();
OFstream localStr OFstream localStr
( (
@ -653,24 +433,22 @@ void Foam::processorPolyPatch::initOrder
/name() + "_localFaceCentres.obj" /name() + "_localFaceCentres.obj"
); );
Pout<< "processorPolyPatch::order : " Pout<< "processorPolyPatch::order : "
<< "Dumping " << ctrs.size() << "Dumping " << fc.size()
<< " local faceCentres to " << localStr.name() << endl; << " local faceCentres to " << localStr.name() << endl;
forAll(ctrs, faceI) forAll(fc, faceI)
{ {
writeOBJ(localStr, ctrs[faceI]); writeOBJ(localStr, fc[faceI]);
} }
} }
if (owner()) if (owner())
{ {
pointField ctrs(calcFaceCentres(pp, pp.points()));
pointField anchors(getAnchorPoints(pp, pp.points())); pointField anchors(getAnchorPoints(pp, pp.points()));
// Now send all info over to the neighbour // Now send all info over to the neighbour
UOPstream toNeighbour(neighbProcNo(), pBufs); UOPstream toNeighbour(neighbProcNo(), pBufs);
toNeighbour << ctrs << anchors; toNeighbour << pp.faceCentres() << anchors;
} }
} }
@ -722,11 +500,8 @@ bool Foam::processorPolyPatch::order
fromNeighbour >> masterCtrs >> masterAnchors; fromNeighbour >> masterCtrs >> masterAnchors;
} }
// Calculate my face centres
pointField ctrs(calcFaceCentres(pp, pp.points()));
// Calculate typical distance from face centre // 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()) if (debug || masterCtrs.size() != pp.size())
{ {
@ -764,7 +539,14 @@ bool Foam::processorPolyPatch::order
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// 1. Try existing ordering and transformation // 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) if (!matchedAll || debug)
{ {
@ -791,14 +573,14 @@ bool Foam::processorPolyPatch::order
label vertI = 0; label vertI = 0;
forAll(ctrs, faceI) forAll(pp.faceCentres(), faceI)
{ {
label masterFaceI = faceMap[faceI]; label masterFaceI = faceMap[faceI];
if (masterFaceI != -1) if (masterFaceI != -1)
{ {
const point& c0 = masterCtrs[masterFaceI]; const point& c0 = masterCtrs[masterFaceI];
const point& c1 = ctrs[faceI]; const point& c1 = pp.faceCentres()[faceI];
writeOBJ(ccStr, c0, c1, vertI); writeOBJ(ccStr, c0, c1, vertI);
} }
} }
@ -814,7 +596,7 @@ bool Foam::processorPolyPatch::order
<< "Cannot match vectors to faces on both sides of patch" << "Cannot match vectors to faces on both sides of patch"
<< endl << endl
<< " masterCtrs[0]:" << masterCtrs[0] << 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" << " Please check your topology changes or maybe you have"
<< " multiple separated (from cyclics) processor patches" << " multiple separated (from cyclics) processor patches"
<< endl << endl
@ -883,10 +665,6 @@ void Foam::processorPolyPatch::write(Ostream& os) const
<< token::END_STATEMENT << nl; << token::END_STATEMENT << nl;
os.writeKeyword("neighbProcNo") << neighbProcNo_ os.writeKeyword("neighbProcNo") << neighbProcNo_
<< token::END_STATEMENT << nl; << token::END_STATEMENT << nl;
os.writeKeyword("patchIDs") << patchIDs_
<< token::END_STATEMENT << nl;
os.writeKeyword("starts") << starts_
<< token::END_STATEMENT << nl;
} }

View File

@ -34,7 +34,6 @@ Description
SourceFiles SourceFiles
processorPolyPatch.C processorPolyPatch.C
processorPolyPatchMorph.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -63,14 +62,6 @@ class processorPolyPatch
int myProcNo_; int myProcNo_;
int neighbProcNo_; int neighbProcNo_;
// Per patch information
//- Originating patches
labelList patchIDs_;
//- Slice starts
labelList starts_;
//- Processor-neighbbour patch face centres //- Processor-neighbbour patch face centres
vectorField neighbFaceCentres_; vectorField neighbFaceCentres_;
@ -80,20 +71,13 @@ class processorPolyPatch
//- Processor-neighbbour patch neighbour cell centres //- Processor-neighbbour patch neighbour cell centres
vectorField neighbFaceCellCentres_; vectorField neighbFaceCellCentres_;
//- Corresponding mesh point per local point //- Corresponding neighbouring local point label for every local point
mutable autoPtr<labelListList> subMeshPointsPtr_; // (so localPoints()[i] == neighb.localPoints()[neighbPoints_[i]])
mutable autoPtr<labelList> neighbPointsPtr_;
//- Corresponding mesh point per local point on reverse patch //- Corresponding neighbouring local edge label for every local edge
mutable autoPtr<labelListList> reverseSubMeshPointsPtr_; // (so edges()[i] == neighb.edges()[neighbEdges_[i]])
mutable autoPtr<labelList> neighbEdgesPtr_;
// //- 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;
protected: protected:
@ -102,18 +86,18 @@ protected:
//- Initialise the calculation of the patch geometry //- Initialise the calculation of the patch geometry
void initGeometry(PstreamBuffers&); void initGeometry(PstreamBuffers&);
//- Initialise the calculation of the patch geometry with externally // //- Initialise the calculation of the patch geometry with externally
// provided geometry // // provided geometry
virtual void initGeometry // virtual void initGeometry
( // (
const primitivePatch& referPatch, // const primitivePatch& referPatch,
UList<point>&, // UList<point>&,
UList<point>&, // UList<point>&,
UList<point>& // UList<point>&
) // )
{ // {
notImplemented("processorPolyPatch::initGeometry(..)"); // notImplemented("processorPolyPatch::initGeometry(..)");
} // }
//- Calculate the patch geometry //- Calculate the patch geometry
void calcGeometry(PstreamBuffers&); void calcGeometry(PstreamBuffers&);
@ -164,9 +148,7 @@ public:
const label index, const label index,
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const int myProcNo, const int myProcNo,
const int neighbProcNo, const int neighbProcNo
const labelList& patchIDs,
const labelList& starts
); );
//- Construct from dictionary //- Construct from dictionary
@ -179,11 +161,7 @@ public:
); );
//- Construct as copy, resetting the boundary mesh //- Construct as copy, resetting the boundary mesh
processorPolyPatch processorPolyPatch(const processorPolyPatch&, const polyBoundaryMesh&);
(
const processorPolyPatch&,
const polyBoundaryMesh&
);
//- Construct as given the original patch and resetting the //- Construct as given the original patch and resetting the
// face list and boundary mesh information // face list and boundary mesh information
@ -193,9 +171,7 @@ public:
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const label index, const label index,
const label newSize, const label newSize,
const label newStart, const label newStart
const labelList& patchIDs,
const labelList& starts
); );
//- Construct given the original patch and a map //- Construct given the original patch and a map
@ -221,9 +197,7 @@ public:
const polyBoundaryMesh& bm, const polyBoundaryMesh& bm,
const label index, const label index,
const label newSize, const label newSize,
const label newStart, const label newStart
const labelList& patchIDs,
const labelList& starts
) const ) const
{ {
return autoPtr<polyPatch> return autoPtr<polyPatch>
@ -234,9 +208,7 @@ public:
bm, bm,
index, index,
newSize, newSize,
newStart, newStart
patchIDs,
starts
) )
); );
} }
@ -296,16 +268,6 @@ public:
return !owner(); return !owner();
} }
const labelList& patchIDs() const
{
return patchIDs_;
}
const labelList& starts() const
{
return starts_;
}
//- Return processor-neighbbour patch face centres //- Return processor-neighbbour patch face centres
const vectorField& neighbFaceCentres() const const vectorField& neighbFaceCentres() const
{ {
@ -324,37 +286,33 @@ public:
return neighbFaceCellCentres_; return neighbFaceCellCentres_;
} }
//- Transform a patch-based field //- Return neighbour point labels. WIP.
template<class T> const labelList& neighbPoints() const;
void transform(Field<T>& l) 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 virtual void transform(scalarField& l) const
{ {}
transform(l);
}
virtual void transform(vectorField& l) const virtual void transform(vectorField& l) const
{ {}
transform(l);
}
virtual void transform(sphericalTensorField& l) const virtual void transform(sphericalTensorField& l) const
{ {}
transform(l);
}
virtual void transform(diagTensorField& l) const virtual void transform(diagTensorField& l) const
{ {}
transform(l);
}
virtual void transform(symmTensorField& l) const virtual void transform(symmTensorField& l) const
{ {}
transform(l);
}
virtual void transform(tensorField& l) const virtual void transform(tensorField& l) const
{ {}
transform(l);
}
//- Transform a patch-based position //- Transform a patch-based position from other side to this side
virtual void transformPosition(pointField& l) const; virtual void transformPosition(pointField& l) const
{}
//- Are the planes separated. //- Are the planes separated.
virtual bool separated() const virtual bool separated() const
@ -373,24 +331,7 @@ public:
//- Are the cyclic planes parallel. //- Are the cyclic planes parallel.
virtual bool parallel() const virtual bool parallel() const
{ {
forAll(patchIDs_, i) notImplemented("processorPolyPatch::parallel()");
{
label patchI = patchIDs_[i];
if (patchI != -1)
{
if
(
!refCast<const coupledPolyPatch>
(
boundaryMesh()[patchI]
).parallel()
)
{
return false;
}
}
}
return true; return true;
} }
@ -408,104 +349,6 @@ public:
return tensor::zero; 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 //- Initialize ordering for primitivePatch. Does not
// refer to *this (except for name() and type() etc.) // refer to *this (except for name() and type() etc.)
virtual void initOrder(PstreamBuffers&, const primitivePatch&) const; virtual void initOrder(PstreamBuffers&, const primitivePatch&) const;
@ -535,12 +378,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "processorPolyPatchTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

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

View File

@ -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
// ************************************************************************* //

View File

@ -90,8 +90,8 @@ class polyPatch
// Private Member Functions // Private Member Functions
//- Calculate labels of mesh edges // //- Calculate labels of mesh edges
void calcMeshEdges() const; // void calcMeshEdges() const;
protected: protected:

View File

@ -100,11 +100,14 @@ public:
class transform class transform
{ {
public: public:
//- Transform Field
template<class T> template<class T>
void operator()(const coupledPolyPatch& cpp, Field<T>& fld) const void operator()(const coupledPolyPatch& cpp, Field<T>& fld) const
{ {
cpp.transform(fld); cpp.transform(fld);
} }
//- Transform generic container
template<class T, template<class> class Container> template<class T, template<class> class Container>
void operator()(const coupledPolyPatch& cpp, Container<T>& map) void operator()(const coupledPolyPatch& cpp, Container<T>& map)
const const

View File

@ -114,43 +114,23 @@ void Foam::syncTools::syncPointMap
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(patches[patchI]); 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];
const labelList& subMeshPts =
procPatch.subMeshPoints()[subI];
Map<T>& subPatchInfo = patchInfo[subI];
subPatchInfo.resize(subMeshPts.size()/20);
forAll(subMeshPts, patchPointI)
{
label pointI = subMeshPts[patchPointI];
typename Map<T>::const_iterator iter = typename Map<T>::const_iterator iter =
pointValues.find(pointI); pointValues.find(meshPts[i]);
if (iter != pointValues.end()) if (iter != pointValues.end())
{ {
subPatchInfo.insert(patchPointI, iter()); patchInfo.insert(nbrPts[i], iter());
}
}
if (subPatchI != -1)
{
// Apply transform.
top
(
refCast<const coupledPolyPatch>
(
patches[subPatchI]
),
subPatchInfo
);
} }
} }
@ -173,38 +153,33 @@ void Foam::syncTools::syncPointMap
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(patches[patchI]); refCast<const processorPolyPatch>(patches[patchI]);
List<Map<T> > nbrPatchInfo; IPstream fromNb(Pstream::blocking, procPatch.neighbProcNo());
{ Map<T> nbrPatchInfo(fromNb);
IPstream fromNbr
// Transform
top(procPatch, nbrPatchInfo);
const labelList& meshPts = procPatch.meshPoints();
// Only update those values which come from neighbour
forAllConstIter
( (
Pstream::blocking, typename Map<T>,
procPatch.neighbProcNo() nbrPatchInfo,
); 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 combine
( (
pointValues, pointValues,
cop, cop,
meshPointI, meshPts[nbrIter.key()],
iter() nbrIter()
); );
} }
} }
} }
} }
}
// Do the cyclics. // Do the cyclics.
forAll(patches, patchI) forAll(patches, patchI)
@ -217,6 +192,7 @@ void Foam::syncTools::syncPointMap
if (cycPatch.owner()) if (cycPatch.owner())
{ {
// Owner does all. // Owner does all.
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch(); const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
const edgeList& coupledPoints = cycPatch.coupledPoints(); const edgeList& coupledPoints = cycPatch.coupledPoints();
const labelList& meshPtsA = cycPatch.meshPoints(); const labelList& meshPtsA = cycPatch.meshPoints();
@ -247,9 +223,9 @@ void Foam::syncTools::syncPointMap
} }
} }
// Transform // Transform to receiving side
top(cycPatch, half0Values); top(cycPatch, half1Values);
top(nbrPatch, half1Values); top(nbrPatch, half0Values);
forAll(coupledPoints, i) forAll(coupledPoints, i)
{ {
@ -365,7 +341,7 @@ void Foam::syncTools::syncPointMap
} }
else else
{ {
// Send to master // Slave: send to master
{ {
OPstream toMaster(Pstream::blocking, Pstream::masterNo()); OPstream toMaster(Pstream::blocking, Pstream::masterNo());
toMaster << sharedPointValues; toMaster << sharedPointValues;
@ -453,56 +429,27 @@ void Foam::syncTools::syncEdgeMap
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(patches[patchI]); 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]; const edge& e = edges[i];
label subStart = procPatch.starts()[subI]; const edge meshEdge(meshPts[e[0]], meshPts[e[1]]);
label subSize = procPatch.starts()[subI+1]-subStart;
primitivePatch subPatch
(
faceSubList
(
procPatch,
subSize,
subStart
),
procPatch.points()
);
const labelList& subMeshPts = subPatch.meshPoints();
const edgeList& subEdges = subPatch.edges();
EdgeMap<T>& subPatchInfo = patchInfo[subI];
subPatchInfo.resize(subEdges.size());
forAll(subEdges, i)
{
const edge& e = subEdges[i];
const edge meshEdge(subMeshPts[e[0]], subMeshPts[e[1]]);
typename EdgeMap<T>::const_iterator iter = typename EdgeMap<T>::const_iterator iter =
edgeValues.find(meshEdge); edgeValues.find(meshEdge);
if (iter != edgeValues.end()) if (iter != edgeValues.end())
{ {
subPatchInfo.insert(e, iter()); const edge nbrEdge(nbrPts[e[0]], nbrPts[e[1]]);
} patchInfo.insert(nbrEdge, iter());
}
if (subPatchI != -1)
{
// Apply transform.
top
(
refCast<const coupledPolyPatch>
(
patches[subPatchI]
),
subPatchInfo
);
} }
} }
@ -525,7 +472,7 @@ void Foam::syncTools::syncEdgeMap
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(patches[patchI]); refCast<const processorPolyPatch>(patches[patchI]);
List<EdgeMap<T> > nbrPatchInfo; EdgeMap<T> nbrPatchInfo;
{ {
IPstream fromNbr IPstream fromNbr
( (
@ -535,30 +482,34 @@ void Foam::syncTools::syncEdgeMap
fromNbr >> nbrPatchInfo; fromNbr >> nbrPatchInfo;
} }
forAll(procPatch.patchIDs(), subI) // Apply transform to convert to this side properties.
{ top(procPatch, nbrPatchInfo);
const labelList& subMeshPts =
procPatch.subMeshPoints()[subI];
const EdgeMap<T>& nbrSubInfo = nbrPatchInfo[subI];
forAllConstIter(typename EdgeMap<T>, nbrSubInfo, iter) // Only update those values which come from neighbour
const labelList& meshPts = procPatch.meshPoints();
forAllConstIter
(
typename EdgeMap<T>,
nbrPatchInfo,
nbrIter
)
{ {
const edge& e = iter.key(); const edge& e = nbrIter.key();
const edge meshEdge(subMeshPts[e[0]], subMeshPts[e[1]]); const edge meshEdge(meshPts[e[0]], meshPts[e[1]]);
combine combine
( (
edgeValues, edgeValues,
cop, cop,
meshEdge, // edge meshEdge, // edge
iter() // value nbrIter() // value
); );
} }
} }
} }
} }
}
// Swap cyclic info // Swap cyclic info
@ -616,9 +567,9 @@ void Foam::syncTools::syncEdgeMap
} }
} }
// Transform // Transform to this side
top(cycPatch, half0Values); top(cycPatch, half1Values);
top(nbrPatch, half1Values); top(nbrPatch, half0Values);
// Extract and combine information // Extract and combine information
@ -869,38 +820,16 @@ void Foam::syncTools::syncPointList
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(patches[patchI]); 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 const labelList& meshPts = procPatch.meshPoints();
List<List<T> > patchInfo(procPatch.patchIDs().size()); const labelList& nbrPts = procPatch.neighbPoints();
forAll(procPatch.patchIDs(), subI) forAll(nbrPts, pointI)
{ {
label subPatchI = procPatch.patchIDs()[subI]; label nbrPointI = nbrPts[pointI];
patchInfo[nbrPointI] = pointValues[meshPts[pointI]];
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)
);
}
} }
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo()); OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
@ -922,10 +851,8 @@ void Foam::syncTools::syncPointList
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(patches[patchI]); 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 IPstream fromNbr
( (
Pstream::blocking, Pstream::blocking,
@ -934,17 +861,15 @@ void Foam::syncTools::syncPointList
fromNbr >> nbrPatchInfo; fromNbr >> nbrPatchInfo;
} }
forAll(procPatch.patchIDs(), subI) // Transform to this side
{ top(procPatch, nbrPatchInfo);
const labelList& subMeshPts =
procPatch.reverseSubMeshPoints()[subI];
const List<T>& nbrSubInfo = nbrPatchInfo[subI];
forAll(subMeshPts, i) const labelList& meshPts = procPatch.meshPoints();
forAll(meshPts, pointI)
{ {
label meshPointI = subMeshPts[i]; label meshPointI = meshPts[pointI];
cop(pointValues[meshPointI], nbrSubInfo[i]); cop(pointValues[meshPointI], nbrPatchInfo[pointI]);
}
} }
} }
} }
@ -979,11 +904,11 @@ void Foam::syncTools::syncPointList
//SubField<T> slice0(half0Values, half0Values.size()); //SubField<T> slice0(half0Values, half0Values.size());
//SubField<T> slice1(half1Values, half1Values.size()); //SubField<T> slice1(half1Values, half1Values.size());
//top(cycPatch, reinterpret_cast<Field<T>&>(slice0)); //top(cycPatch, reinterpret_cast<Field<T>&>(slice1));
//top(nbrPatch, reinterpret_cast<Field<T>&>(slice1)); //top(nbrPatch, reinterpret_cast<Field<T>&>(slice0));
top(cycPatch, half0Values); top(cycPatch, half1Values);
top(nbrPatch, half1Values); top(nbrPatch, half0Values);
forAll(coupledPoints, i) forAll(coupledPoints, i)
{ {
@ -1001,7 +926,7 @@ void Foam::syncTools::syncPointList
if (pd.nGlobalPoints() > 0) if (pd.nGlobalPoints() > 0)
{ {
// Values on shared points. // Values on shared points.
List<T> sharedPts(pd.nGlobalPoints(), nullValue); Field<T> sharedPts(pd.nGlobalPoints(), nullValue);
forAll(pd.sharedPointLabels(), i) forAll(pd.sharedPointLabels(), i)
{ {
@ -1053,7 +978,7 @@ void Foam::syncTools::syncPointList
return; return;
} }
List<T> meshValues(mesh.nPoints(), nullValue); Field<T> meshValues(mesh.nPoints(), nullValue);
forAll(meshPoints, i) forAll(meshPoints, i)
{ {
@ -1120,56 +1045,17 @@ void Foam::syncTools::syncEdgeList
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(patches[patchI]); refCast<const processorPolyPatch>(patches[patchI]);
//TBD: optimisation for single subpatch. const labelList& meshEdges = procPatch.meshEdges();
const labelList& neighbEdges = procPatch.neighbEdges();
// Data per sub patch // Get region per patch edge in neighbouring edge numbers.
List<List<T> > patchInfo(procPatch.patchIDs().size()); Field<T> patchInfo(procPatch.nEdges(), nullValue);
forAll(procPatch.patchIDs(), subI) forAll(neighbEdges, edgeI)
{ {
label subPatchI = procPatch.patchIDs()[subI]; label nbrEdgeI = neighbEdges[edgeI];
label subStart = procPatch.starts()[subI];
label subSize = procPatch.starts()[subI+1]-subStart;
primitivePatch subPatch patchInfo[nbrEdgeI] = edgeValues[meshEdges[edgeI]];
(
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)
);
}
} }
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo()); OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
@ -1190,8 +1076,11 @@ void Foam::syncTools::syncEdgeList
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(patches[patchI]); refCast<const processorPolyPatch>(patches[patchI]);
// Receive from neighbour. const labelList& meshEdges = procPatch.meshEdges();
List<List<T> > nbrPatchInfo(procPatch.nEdges());
// Receive from neighbour. Is per patch edge the region of the
// neighbouring patch edge.
Field<T> nbrPatchInfo(procPatch.nEdges());
{ {
IPstream fromNeighb IPstream fromNeighb
@ -1202,41 +1091,13 @@ void Foam::syncTools::syncEdgeList
fromNeighb >> nbrPatchInfo; fromNeighb >> nbrPatchInfo;
} }
forAll(procPatch.patchIDs(), subI) // Transform to this side
{ top(procPatch, nbrPatchInfo);
label subStart = procPatch.starts()[subI];
label subSize = procPatch.starts()[subI+1]-subStart;
faceList reverseFaces(subSize); forAll(meshEdges, edgeI)
forAll(reverseFaces, i)
{ {
reverseFaces[i] = procPatch[subStart+i].reverseFace(); label meshEdgeI = meshEdges[edgeI];
} cop(edgeValues[meshEdgeI], nbrPatchInfo[edgeI]);
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]);
}
} }
} }
} }
@ -1270,11 +1131,11 @@ void Foam::syncTools::syncEdgeList
//SubField<T> slice0(half0Values, half0Values.size()); //SubField<T> slice0(half0Values, half0Values.size());
//SubField<T> slice1(half1Values, half1Values.size()); //SubField<T> slice1(half1Values, half1Values.size());
//top(cycPatch, reinterpret_cast<Field<T>&>(slice0)); //top(cycPatch, reinterpret_cast<Field<T>&>(slice1));
//top(nbrPatch, reinterpret_cast<Field<T>&>(slice1)); //top(nbrPatch, reinterpret_cast<Field<T>&>(slice0));
top(cycPatch, half0Values); top(cycPatch, half1Values);
top(nbrPatch, half1Values); top(nbrPatch, half0Values);
forAll(coupledEdges, i) forAll(coupledEdges, i)
{ {
@ -1296,7 +1157,7 @@ void Foam::syncTools::syncEdgeList
if (pd.nGlobalEdges() > 0) if (pd.nGlobalEdges() > 0)
{ {
// Values on shared edges. // Values on shared edges.
List<T> sharedPts(pd.nGlobalEdges(), nullValue); Field<T> sharedPts(pd.nGlobalEdges(), nullValue);
forAll(pd.sharedEdgeLabels(), i) forAll(pd.sharedEdgeLabels(), i)
{ {
@ -1383,7 +1244,12 @@ void Foam::syncTools::syncBoundaryFaceList
{ {
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo()); OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
toNbr << toNbr <<
SubList<T>(faceValues, procPatch.size(), patchStart); SubField<T>
(
faceValues,
procPatch.size(),
patchStart
);
} }
} }
} }
@ -1399,17 +1265,17 @@ void Foam::syncTools::syncBoundaryFaceList
&& patches[patchI].size() > 0 && patches[patchI].size() > 0
) )
{ {
const processorPolyPatch& ppp = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(patches[patchI]); refCast<const processorPolyPatch>(patches[patchI]);
List<T> nbrPatchInfo(ppp.size()); Field<T> nbrPatchInfo(procPatch.size());
if (contiguous<T>()) if (contiguous<T>())
{ {
IPstream::read IPstream::read
( (
Pstream::blocking, Pstream::blocking,
ppp.neighbProcNo(), procPatch.neighbProcNo(),
reinterpret_cast<char*>(nbrPatchInfo.begin()), reinterpret_cast<char*>(nbrPatchInfo.begin()),
nbrPatchInfo.byteSize() nbrPatchInfo.byteSize()
); );
@ -1419,33 +1285,14 @@ void Foam::syncTools::syncBoundaryFaceList
IPstream fromNeighb IPstream fromNeighb
( (
Pstream::blocking, Pstream::blocking,
ppp.neighbProcNo() procPatch.neighbProcNo()
); );
fromNeighb >> nbrPatchInfo; fromNeighb >> nbrPatchInfo;
} }
// Apply any transforms top(procPatch, nbrPatchInfo);
forAll(ppp.patchIDs(), i)
{
label subPatchI = ppp.patchIDs()[i];
label subStart = ppp.starts()[i];
label subSize = ppp.starts()[i+1]-subStart;
if (subPatchI != -1) label bFaceI = procPatch.start()-mesh.nInternalFaces();
{
SubField<T> slice(nbrPatchInfo, subStart, subSize);
top
(
refCast<const coupledPolyPatch>
(
patches[subPatchI]
),
reinterpret_cast<Field<T>&>(slice)
);
}
}
label bFaceI = ppp.start()-mesh.nInternalFaces();
forAll(nbrPatchInfo, i) forAll(nbrPatchInfo, i)
{ {
@ -1473,13 +1320,11 @@ void Foam::syncTools::syncBoundaryFaceList
label sz = cycPatch.size(); label sz = cycPatch.size();
// Transform (copy of) data on both sides // Transform (copy of) data on both sides
Field<T> ownVals(SubList<T>(faceValues, sz, ownStart)); Field<T> ownVals(SubField<T>(faceValues, sz, ownStart));
//SubField<T> ownSlice(ownVals, ownVals.size()); top(nbrPatch, ownVals);
top(cycPatch, ownVals);
Field<T> nbrVals(SubList<T>(faceValues, sz, nbrStart)); Field<T> nbrVals(SubField<T>(faceValues, sz, nbrStart));
//SubField<T> nbrSlice(nbrVals, nbrVals.size()); top(cycPatch, nbrVals);
top(nbrPatch, nbrVals);
label i0 = ownStart; label i0 = ownStart;
forAll(nbrVals, i) forAll(nbrVals, i)
@ -1526,10 +1371,6 @@ void Foam::syncTools::syncFaceList
return; 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()) if (Pstream::parRun())
{ {
// Send // Send
@ -1545,14 +1386,14 @@ void Foam::syncTools::syncFaceList
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(patches[patchI]); refCast<const processorPolyPatch>(patches[patchI]);
patchValues[patchI].setSize(procPatch.size()); List<unsigned int> patchInfo(procPatch.size());
forAll(procPatch, i) forAll(procPatch, i)
{ {
patchValues[patchI][i] = faceValues[procPatch.start()+i]; patchInfo[i] = faceValues[procPatch.start()+i];
} }
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo()); OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
toNbr << patchValues[patchI]; toNbr << patchInfo;
} }
} }
@ -1570,19 +1411,20 @@ void Foam::syncTools::syncFaceList
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(patches[patchI]); refCast<const processorPolyPatch>(patches[patchI]);
List<unsigned int> patchInfo(procPatch.size());
{ {
IPstream fromNbr IPstream fromNbr
( (
Pstream::blocking, Pstream::blocking,
procPatch.neighbProcNo() procPatch.neighbProcNo()
); );
fromNbr >> patchValues[patchI]; fromNbr >> patchInfo;
} }
// Combine (bitwise) // Combine (bitwise)
forAll(procPatch, i) forAll(procPatch, i)
{ {
unsigned int patchVal = patchValues[patchI][i]; unsigned int patchVal = patchInfo[i];
label meshFaceI = procPatch.start()+i; label meshFaceI = procPatch.start()+i;
unsigned int faceVal = faceValues[meshFaceI]; unsigned int faceVal = faceValues[meshFaceI];
cop(faceVal, patchVal); cop(faceVal, patchVal);
@ -1679,19 +1521,15 @@ void Foam::syncTools::syncPointList
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(patches[patchI]); 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();
const labelList& subMeshPts =
procPatch.subMeshPoints()[subI];
List<unsigned int>& subInfo = patchInfo[subI]; forAll(nbrPts, pointI)
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()); OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
@ -1713,7 +1551,7 @@ void Foam::syncTools::syncPointList
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(patches[patchI]); 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 // We do not know the number of points on the other side
// so cannot use Pstream::read. // so cannot use Pstream::read.
@ -1725,23 +1563,18 @@ void Foam::syncTools::syncPointList
fromNbr >> nbrPatchInfo; fromNbr >> nbrPatchInfo;
} }
forAll(procPatch.patchIDs(), subI) const labelList& meshPts = procPatch.meshPoints();
{
const labelList& subMeshPts =
procPatch.reverseSubMeshPoints()[subI];
const List<unsigned int>& nbrSubInfo = nbrPatchInfo[subI];
forAll(subMeshPts, i) forAll(meshPts, pointI)
{ {
label meshPointI = subMeshPts[i]; label meshPointI = meshPts[pointI];
unsigned int pointVal = pointValues[meshPointI]; unsigned int pointVal = pointValues[meshPointI];
cop(pointVal, nbrSubInfo[i]); cop(pointVal, nbrPatchInfo[pointI]);
pointValues[meshPointI] = pointVal; pointValues[meshPointI] = pointVal;
} }
} }
} }
} }
}
// Do the cyclics. // Do the cyclics.
forAll(patches, patchI) forAll(patches, patchI)
@ -1852,38 +1685,15 @@ void Foam::syncTools::syncEdgeList
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(patches[patchI]); 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 nbrEdgeI = neighbEdges[edgeI];
label subSize = procPatch.starts()[subI+1]-subStart; patchInfo[nbrEdgeI] = edgeValues[meshEdges[edgeI]];
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]];
}
} }
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo()); OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
@ -1906,7 +1716,7 @@ void Foam::syncTools::syncEdgeList
refCast<const processorPolyPatch>(patches[patchI]); refCast<const processorPolyPatch>(patches[patchI]);
// Receive from neighbour. // Receive from neighbour.
List<List<unsigned int> > nbrPatchInfo(procPatch.nEdges()); List<unsigned int> nbrPatchInfo(procPatch.nEdges());
{ {
IPstream fromNeighb IPstream fromNeighb
@ -1917,47 +1727,19 @@ void Foam::syncTools::syncEdgeList
fromNeighb >> nbrPatchInfo; fromNeighb >> nbrPatchInfo;
} }
forAll(procPatch.patchIDs(), subI) const labelList& meshEdges = procPatch.meshEdges();
{
label subStart = procPatch.starts()[subI];
label subSize = procPatch.starts()[subI+1]-subStart;
faceList reverseFaces(subSize); forAll(meshEdges, edgeI)
forAll(reverseFaces, i)
{ {
reverseFaces[i] = procPatch[subStart+i].reverseFace(); unsigned int patchVal = nbrPatchInfo[edgeI];
} label meshEdgeI = meshEdges[edgeI];
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]; unsigned int edgeVal = edgeValues[meshEdgeI];
cop(edgeVal, nbrSubInfo[i]); cop(edgeVal, patchVal);
edgeValues[meshEdgeI] = edgeVal; edgeValues[meshEdgeI] = edgeVal;
} }
} }
} }
} }
}
// Do the cyclics. // Do the cyclics.
forAll(patches, patchI) forAll(patches, patchI)

View File

@ -898,7 +898,7 @@ void Foam::parMetisDecomp::calcMetisDistributedCSR
} }
// Get the cell on the other side of coupled patches // 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) // Count number of faces (internal + coupled)

View File

@ -119,8 +119,7 @@ void Foam::attachDetach::attachInterface
-1, // patch for face -1, // patch for face
false, // remove from zone false, // remove from zone
faceZoneID_.index(), // zone for face faceZoneID_.index(), // zone for face
mfFlip[faceI], // face flip in zone mfFlip[faceI] // face flip in zone
-1 // subpatch
) )
); );
} }
@ -139,8 +138,7 @@ void Foam::attachDetach::attachInterface
-1, // patch for face -1, // patch for face
false, // remove from zone false, // remove from zone
faceZoneID_.index(), // zone for face faceZoneID_.index(), // zone for face
!mfFlip[faceI], // face flip in zone !mfFlip[faceI] // face flip in zone
-1 // subpatch
) )
); );
} }
@ -210,13 +208,10 @@ void Foam::attachDetach::attachInterface
]; ];
} }
labelPair patchIDs = polyTopoChange::whichPatch
( label patchID = mesh.boundaryMesh().whichPatch(curFaceID);
mesh.boundaryMesh(),
curFaceID
);
label neiCell; label neiCell;
if (patchIDs[0] == -1) if (patchID == -1)
{ {
neiCell = nei[curFaceID]; neiCell = nei[curFaceID];
} }
@ -225,6 +220,7 @@ void Foam::attachDetach::attachInterface
neiCell = -1; neiCell = -1;
} }
// Modify the face // Modify the face
ref.setAction ref.setAction
( (
@ -235,11 +231,10 @@ void Foam::attachDetach::attachInterface
own[curFaceID], // owner own[curFaceID], // owner
neiCell, // neighbour neiCell, // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face patchID, // patch for face
false, // remove from zone false, // remove from zone
modifiedFaceZone, // zone for face modifiedFaceZone, // zone for face
modifiedFaceZoneFlip, // face flip in zone modifiedFaceZoneFlip // face flip in zone
patchIDs[1]
) )
); );
} }

View File

@ -211,8 +211,7 @@ void Foam::attachDetach::detachInterface
masterPatchID_.index(), // patch for face masterPatchID_.index(), // patch for face
false, // remove from zone false, // remove from zone
faceZoneID_.index(), // zone for face faceZoneID_.index(), // zone for face
!mfFlip[faceI], // face flip in zone !mfFlip[faceI] // face flip in zone
-1 // sub patch
) )
); );
@ -231,8 +230,7 @@ void Foam::attachDetach::detachInterface
false, // flip flux false, // flip flux
slavePatchID_.index(), // patch to add the face to slavePatchID_.index(), // patch to add the face to
-1, // zone for face -1, // zone for face
false, // zone flip false // zone flip
-1 // sub patch
) )
); );
//{ //{
@ -260,8 +258,7 @@ void Foam::attachDetach::detachInterface
masterPatchID_.index(), // patch for face masterPatchID_.index(), // patch for face
false, // remove from zone false, // remove from zone
faceZoneID_.index(), // zone for face faceZoneID_.index(), // zone for face
mfFlip[faceI], // face flip in zone mfFlip[faceI] // face flip in zone
-1 // sub patch
) )
); );
@ -280,8 +277,7 @@ void Foam::attachDetach::detachInterface
true, // flip flux true, // flip flux
slavePatchID_.index(), // patch to add the face to slavePatchID_.index(), // patch to add the face to
-1, // zone for face -1, // zone for face
false, // face flip in zone false // face flip in zone
-1 // sub patch
) )
); );
//{ //{
@ -442,8 +438,7 @@ void Foam::attachDetach::detachInterface
-1, // patch for face -1, // patch for face
false, // remove from zone false, // remove from zone
-1, // zone for face -1, // zone for face
false, // face zone flip false // face zone flip
-1 // sub patch
) )
); );
// Pout << "modifying stick-out face. Internal Old face: " << oldFace << " new face: " << newFace << " own: " << own[curFaceID] << " nei: " << nei[curFaceID] << endl; // Pout << "modifying stick-out face. Internal Old face: " << oldFace << " new face: " << newFace << " own: " << own[curFaceID] << " nei: " << nei[curFaceID] << endl;
@ -462,8 +457,7 @@ void Foam::attachDetach::detachInterface
mesh.boundaryMesh().whichPatch(curFaceID), // patch mesh.boundaryMesh().whichPatch(curFaceID), // patch
false, // remove from zone false, // remove from zone
-1, // zone for face -1, // zone for face
false, // face zone flip false // face zone flip
-1 // sub patch
) )
); );
// Pout << "modifying stick-out face. Boundary Old face: " << oldFace << " new face: " << newFace << " own: " << own[curFaceID] << " patch: " << mesh.boundaryMesh().whichPatch(curFaceID) << endl; // Pout << "modifying stick-out face. Boundary Old face: " << oldFace << " new face: " << newFace << " own: " << own[curFaceID] << " patch: " << mesh.boundaryMesh().whichPatch(curFaceID) << endl;

View File

@ -390,7 +390,7 @@ void Foam::boundaryMesh::markZone
// Zones on all edges. // Zones on all edges.
labelList edgeZone(mesh().nEdges(), -1); labelList edgeZone(mesh().nEdges(), -1);
while(1) while (true)
{ {
changedEdges = faceToEdge changedEdges = faceToEdge
( (

View File

@ -449,7 +449,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::deleteProcPatches
Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::repatch Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::repatch
( (
const labelList& newPatchID, // per boundary face -1 or new patchID const labelList& newPatchID, // per boundary face -1 or new patchID
const labelList& newSubPatchID, // ,, -1 or new subpatchID
labelListList& constructFaceMap labelListList& constructFaceMap
) )
{ {
@ -482,8 +481,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::repatch
newPatchID[bFaceI], // patch for face newPatchID[bFaceI], // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
newSubPatchID
) )
); );
} }
@ -627,8 +625,7 @@ void Foam::fvMeshDistribute::getNeighbourData
const labelList& distribution, const labelList& distribution,
labelList& sourceFace, labelList& sourceFace,
labelList& sourceProc, labelList& sourceProc,
labelList& sourceNewProc, labelList& sourceNewProc
labelList& sourceSubPatch
) const ) const
{ {
label nBnd = mesh_.nFaces() - mesh_.nInternalFaces(); label nBnd = mesh_.nFaces() - mesh_.nInternalFaces();
@ -736,18 +733,15 @@ void Foam::fvMeshDistribute::subsetBoundaryData
const labelList& sourceFace, const labelList& sourceFace,
const labelList& sourceProc, const labelList& sourceProc,
const labelList& sourceNewProc, const labelList& sourceNewProc,
const labelList& sourceSubPatch,
labelList& subFace, labelList& subFace,
labelList& subProc, labelList& subProc,
labelList& subNewProc, labelList& subNewProc
labelList& subSubPatch
) )
{ {
subFace.setSize(mesh.nFaces() - mesh.nInternalFaces()); subFace.setSize(mesh.nFaces() - mesh.nInternalFaces());
subProc.setSize(mesh.nFaces() - mesh.nInternalFaces()); subProc.setSize(mesh.nFaces() - mesh.nInternalFaces());
subNewProc.setSize(mesh.nFaces() - mesh.nInternalFaces()); subNewProc.setSize(mesh.nFaces() - mesh.nInternalFaces());
subSubPatch.setSize(mesh.nFaces() - mesh.nInternalFaces());
forAll(subFace, newBFaceI) forAll(subFace, newBFaceI)
{ {
@ -760,7 +754,6 @@ void Foam::fvMeshDistribute::subsetBoundaryData
{ {
subFace[newBFaceI] = oldFaceI; subFace[newBFaceI] = oldFaceI;
subProc[newBFaceI] = Pstream::myProcNo(); subProc[newBFaceI] = Pstream::myProcNo();
subSubPatch[newBFaceI] = -1;
label oldOwn = oldFaceOwner[oldFaceI]; label oldOwn = oldFaceOwner[oldFaceI];
label oldNei = oldFaceNeighbour[oldFaceI]; label oldNei = oldFaceNeighbour[oldFaceI];
@ -784,7 +777,6 @@ void Foam::fvMeshDistribute::subsetBoundaryData
subFace[newBFaceI] = sourceFace[oldBFaceI]; subFace[newBFaceI] = sourceFace[oldBFaceI];
subProc[newBFaceI] = sourceProc[oldBFaceI]; subProc[newBFaceI] = sourceProc[oldBFaceI];
subNewProc[newBFaceI] = sourceNewProc[oldBFaceI]; subNewProc[newBFaceI] = sourceNewProc[oldBFaceI];
subSubPatch[newBFaceI] = sourceSubPatch[oldBFaceI];
} }
} }
} }
@ -1065,7 +1057,6 @@ void Foam::fvMeshDistribute::sendMesh
const labelList& sourceFace, const labelList& sourceFace,
const labelList& sourceProc, const labelList& sourceProc,
const labelList& sourceNewProc, const labelList& sourceNewProc,
const labelList& sourceSubPatch,
UOPstream& toDomain UOPstream& toDomain
) )
{ {
@ -1201,8 +1192,6 @@ void Foam::fvMeshDistribute::sendMesh
<< sourceFace << sourceFace
<< sourceProc << sourceProc
<< sourceNewProc
<< sourceSubPatch
<< sourceNewProc; << sourceNewProc;
@ -1225,7 +1214,6 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshDistribute::receiveMesh
labelList& domainSourceFace, labelList& domainSourceFace,
labelList& domainSourceProc, labelList& domainSourceProc,
labelList& domainSourceNewProc, labelList& domainSourceNewProc,
labelList& domainSourceSubPatch,
UIPstream& fromNbr UIPstream& fromNbr
) )
{ {
@ -1243,8 +1231,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshDistribute::receiveMesh
fromNbr fromNbr
>> domainSourceFace >> domainSourceFace
>> domainSourceProc >> domainSourceProc
>> domainSourceNewProc >> domainSourceNewProc;
>> domainSourceSubPatch;
// Construct fvMesh // Construct fvMesh
autoPtr<fvMesh> domainMeshPtr autoPtr<fvMesh> domainMeshPtr
@ -1464,24 +1451,14 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
// sourceProc = -1 // sourceProc = -1
// sourceNewProc = -1 // sourceNewProc = -1
// sourceFace = patchID // sourceFace = patchID
// sourceSubPatch = -1
// coupled boundary: // coupled boundary:
// sourceProc = proc // sourceProc = proc
// sourceNewProc = distribution[cell on proc] // sourceNewProc = distribution[cell on proc]
// sourceFace = face // sourceFace = face
// sourceSubPatch = sub patch (only if processor face)
labelList sourceFace; labelList sourceFace;
labelList sourceProc; labelList sourceProc;
labelList sourceNewProc; labelList sourceNewProc;
labelList sourceSubPatch; getNeighbourData(distribution, sourceFace, sourceProc, sourceNewProc);
getNeighbourData
(
distribution,
sourceFace,
sourceProc,
sourceNewProc,
sourceSubPatch
);
// Remove meshPhi. Since this would otherwise disappear anyway // Remove meshPhi. Since this would otherwise disappear anyway
@ -1554,7 +1531,6 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
inplaceReorder(bFaceMap, sourceFace); inplaceReorder(bFaceMap, sourceFace);
inplaceReorder(bFaceMap, sourceProc); inplaceReorder(bFaceMap, sourceProc);
inplaceReorder(bFaceMap, sourceNewProc); inplaceReorder(bFaceMap, sourceNewProc);
inplaceReorder(bFaceMap, sourceSubPatch);
} }
@ -1658,7 +1634,6 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
labelList procSourceFace; labelList procSourceFace;
labelList procSourceProc; labelList procSourceProc;
labelList procSourceNewProc; labelList procSourceNewProc;
labelList procSourceSubPatch;
subsetBoundaryData subsetBoundaryData
( (
@ -1674,12 +1649,10 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
sourceFace, sourceFace,
sourceProc, sourceProc,
sourceNewProc, sourceNewProc,
sourceSubPatch,
procSourceFace, procSourceFace,
procSourceProc, procSourceProc,
procSourceNewProc, procSourceNewProc
procSourceSubPatch
); );
@ -1697,7 +1670,6 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
procSourceFace, procSourceFace,
procSourceProc, procSourceProc,
procSourceNewProc, procSourceNewProc,
procSourceSubPatch,
str str
); );
sendFields<volScalarField>(recvProc, volScalars, subsetter, str); sendFields<volScalarField>(recvProc, volScalars, subsetter, str);
@ -1801,7 +1773,6 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
labelList domainSourceFace; labelList domainSourceFace;
labelList domainSourceProc; labelList domainSourceProc;
labelList domainSourceNewProc; labelList domainSourceNewProc;
labelList domainSourceSubPatch;
subsetBoundaryData subsetBoundaryData
( (
@ -1817,18 +1788,15 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
sourceFace, sourceFace,
sourceProc, sourceProc,
sourceNewProc, sourceNewProc,
sourceSubPatch,
domainSourceFace, domainSourceFace,
domainSourceProc, domainSourceProc,
domainSourceNewProc, domainSourceNewProc
domainSourceSubPatch
); );
sourceFace.transfer(domainSourceFace); sourceFace.transfer(domainSourceFace);
sourceProc.transfer(domainSourceProc); sourceProc.transfer(domainSourceProc);
sourceNewProc.transfer(domainSourceNewProc); sourceNewProc.transfer(domainSourceNewProc);
sourceSubPatch.transfer(domainSourceSubPatch);
} }
@ -1882,8 +1850,8 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
labelList domainSourceFace; labelList domainSourceFace;
labelList domainSourceProc; labelList domainSourceProc;
labelList domainSourceNewProc; labelList domainSourceNewProc;
labelList domainSourceSubPatch;
autoPtr<fvMesh> domainMeshPtr;
PtrList<volScalarField> vsf; PtrList<volScalarField> vsf;
PtrList<volVectorField> vvf; PtrList<volVectorField> vvf;
PtrList<volSphericalTensorField> vsptf; PtrList<volSphericalTensorField> vsptf;
@ -1908,7 +1876,6 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
domainSourceFace, domainSourceFace,
domainSourceProc, domainSourceProc,
domainSourceNewProc, domainSourceNewProc,
domainSourceSubPatch
str str
); );
fvMesh& domainMesh = domainMeshPtr(); fvMesh& domainMesh = domainMeshPtr();

View File

@ -54,7 +54,6 @@ SourceFiles
#define fvMeshDistribute_H #define fvMeshDistribute_H
#include "Field.H" #include "Field.H"
#include "uLabel.H"
#include "fvMeshSubset.H" #include "fvMeshSubset.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -225,8 +225,7 @@ void Foam::layerAdditionRemoval::addCellLayer
flipFaceFlux, // flux flip flipFaceFlux, // flux flip
-1, // patch for face -1, // patch for face
-1, // zone for face -1, // zone for face
false, // face zone flip false // face zone flip
-1 // sub patch for face
) )
); );
@ -241,15 +240,6 @@ void Foam::layerAdditionRemoval::addCellLayer
{ {
const label curfaceID = mf[faceI]; const label curfaceID = mf[faceI];
labelPair patchIDs
(
polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
curfaceID
)
);
// If the face is internal, modify its owner to be the newly // If the face is internal, modify its owner to be the newly
// created cell. No flip is necessary // created cell. No flip is necessary
if (!mesh.isInternalFace(curfaceID)) if (!mesh.isInternalFace(curfaceID))
@ -263,11 +253,10 @@ void Foam::layerAdditionRemoval::addCellLayer
addedCells[faceI], // owner addedCells[faceI], // owner
-1, // neighbour -1, // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face mesh.boundaryMesh().whichPatch(curfaceID),// patch for face
false, // remove from zone false, // remove from zone
faceZoneID_.index(), // zone for face faceZoneID_.index(), // zone for face
mfFlip[faceI], // face flip in zone mfFlip[faceI] // face flip in zone
patchIDs[1] // subpatch id
) )
); );
// Pout << "Modifying a boundary face. Face: " << curfaceID << " flip: " << mfFlip[faceI] << endl; // Pout << "Modifying a boundary face. Face: " << curfaceID << " flip: " << mfFlip[faceI] << endl;
@ -287,11 +276,10 @@ void Foam::layerAdditionRemoval::addCellLayer
own[curfaceID], // owner own[curfaceID], // owner
addedCells[faceI], // neighbour addedCells[faceI], // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face mesh.boundaryMesh().whichPatch(curfaceID),// patch for face
false, // remove from zone false, // remove from zone
faceZoneID_.index(), // zone for face faceZoneID_.index(), // zone for face
mfFlip[faceI], // face flip in zone mfFlip[faceI] // face flip in zone
patchIDs[1] // subpatch id
) )
); );
@ -309,11 +297,10 @@ void Foam::layerAdditionRemoval::addCellLayer
nei[curfaceID], // owner nei[curfaceID], // owner
addedCells[faceI], // neighbour addedCells[faceI], // neighbour
true, // face flip true, // face flip
patchIDs[0], // patch for face mesh.boundaryMesh().whichPatch(curfaceID), // patch for face
false, // remove from zone false, // remove from zone
faceZoneID_.index(), // zone for face faceZoneID_.index(), // zone for face
!mfFlip[faceI], // face flip in zone !mfFlip[faceI] // face flip in zone
patchIDs[1] // subpatch id
) )
); );
// Pout << "modify face, with flip " << curfaceID << " own: " << own[curfaceID] << " nei: " << addedCells[faceI] << endl; // Pout << "modify face, with flip " << curfaceID << " own: " << own[curfaceID] << " nei: " << addedCells[faceI] << endl;
@ -354,8 +341,7 @@ void Foam::layerAdditionRemoval::addCellLayer
false, // flip flux false, // flip flux
-1, // patch for face -1, // patch for face
-1, // zone for face -1, // zone for face
false, // face zone flip false // face zone flip
-1 // subpatch id
) )
); );
@ -393,7 +379,7 @@ void Foam::layerAdditionRemoval::addCellLayer
// Determine the patch for insertion // Determine the patch for insertion
const labelList& curFaces = meshEdgeFaces[meshEdges[curEdgeID]]; const labelList& curFaces = meshEdgeFaces[meshEdges[curEdgeID]];
labelPair patchIDs(-1, -1); label patchID = -1;
label zoneID = -1; label zoneID = -1;
forAll (curFaces, faceI) forAll (curFaces, faceI)
@ -406,11 +392,7 @@ void Foam::layerAdditionRemoval::addCellLayer
if (zoneMesh.whichZone(cf) != faceZoneID_.index()) if (zoneMesh.whichZone(cf) != faceZoneID_.index())
{ {
// Found the face in a boundary patch which is not in zone // Found the face in a boundary patch which is not in zone
patchIDs = polyTopoChange::whichPatch patchID = mesh.boundaryMesh().whichPatch(cf);
(
mesh.boundaryMesh(),
cf
);
zoneID = mesh.faceZones().whichZone(cf); zoneID = mesh.faceZones().whichZone(cf);
break; break;
@ -418,7 +400,7 @@ void Foam::layerAdditionRemoval::addCellLayer
} }
} }
if (patchIDs[0] < 0) if (patchID < 0)
{ {
FatalErrorIn FatalErrorIn
( (
@ -440,10 +422,9 @@ void Foam::layerAdditionRemoval::addCellLayer
meshEdges[curEdgeID], // master edge meshEdges[curEdgeID], // master edge
-1, // master face -1, // master face
false, // flip flux false, // flip flux
patchIDs[0], // patch for face patchID, // patch for face
zoneID, // zone zoneID, // zone
false, // zone face flip false // zone face flip
patchIDs[1] // subpatch id
) )
); );
// Pout << "add boundary face: " << newFace << " into patch " << patchID << " own: " << addedCells[edgeFaces[curEdgeID][0]] << endl; // 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 -1, // patch for face
false, // remove from zone false, // remove from zone
modifiedFaceZone, // zone for face modifiedFaceZone, // zone for face
modifiedFaceZoneFlip, // face flip in zone modifiedFaceZoneFlip // face flip in zone
-1 // subpatch ID
) )
); );
// Pout << "modifying stick-out face. Internal Old face: " << oldFace << " new face: " << newFace << " own: " << own[curFaceID] << " nei: " << nei[curFaceID] << endl; // Pout << "modifying stick-out face. Internal Old face: " << oldFace << " new face: " << newFace << " own: " << own[curFaceID] << " nei: " << nei[curFaceID] << endl;
} }
else else
{ {
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
curFaceID
);
ref.setAction ref.setAction
( (
polyModifyFace polyModifyFace
@ -576,11 +550,10 @@ void Foam::layerAdditionRemoval::addCellLayer
own[curFaceID], // owner own[curFaceID], // owner
-1, // neighbour -1, // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
false, // remove from zone false, // remove from zone
modifiedFaceZone, // zone for face modifiedFaceZone, // zone for face
modifiedFaceZoneFlip, // face flip in zone modifiedFaceZoneFlip // face flip in zone
patchIDs[1] // subpatch
) )
); );
// Pout << "modifying stick-out face. Boundary Old face: " << oldFace << " new face: " << newFace << " own: " << own[curFaceID] << " patch: " << mesh.boundaryMesh().whichPatch(curFaceID) << endl; // Pout << "modifying stick-out face. Boundary Old face: " << oldFace << " new face: " << newFace << " own: " << own[curFaceID] << " patch: " << mesh.boundaryMesh().whichPatch(curFaceID) << endl;

View File

@ -247,12 +247,6 @@ void Foam::layerAdditionRemoval::removeCellLayer
newNei = -1; newNei = -1;
} }
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
curFaceID
);
// Modify the face // Modify the face
ref.setAction ref.setAction
( (
@ -263,11 +257,10 @@ void Foam::layerAdditionRemoval::removeCellLayer
own[curFaceID], // owner own[curFaceID], // owner
newNei, // neighbour newNei, // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face mesh.boundaryMesh().whichPatch(curFaceID),// patch for face
false, // remove from zone false, // remove from zone
modifiedFaceZone, // zone for face modifiedFaceZone, // zone for face
modifiedFaceZoneFlip, // face flip in zone modifiedFaceZoneFlip // face flip in zone
patchIDs[1] // subpatch
) )
); );
} }
@ -303,9 +296,7 @@ void Foam::layerAdditionRemoval::removeCellLayer
label newOwner = -1; label newOwner = -1;
label newNeighbour = -1; label newNeighbour = -1;
bool flipFace = false; bool flipFace = false;
labelPair newPatchIDs(-1, -1); label newPatchID = -1;
//label newPatchID = -1;
//label newSubPatchID = -1;
label newZoneID = -1; label newZoneID = -1;
// Is any of the faces a boundary face? If so, grab the patch // Is any of the faces a boundary face? If so, grab the patch
@ -318,11 +309,7 @@ void Foam::layerAdditionRemoval::removeCellLayer
newOwner = slaveSideCell; newOwner = slaveSideCell;
newNeighbour = -1; newNeighbour = -1;
flipFace = false; flipFace = false;
newPatchIDs = polyTopoChange::whichPatch newPatchID = mesh.boundaryMesh().whichPatch(mf[faceI]);
(
mesh.boundaryMesh(),
mf[faceI]
);
newZoneID = mesh.faceZones().whichZone(mf[faceI]); newZoneID = mesh.faceZones().whichZone(mf[faceI]);
} }
else if (!mesh.isInternalFace(ftc[faceI])) else if (!mesh.isInternalFace(ftc[faceI]))
@ -341,11 +328,7 @@ void Foam::layerAdditionRemoval::removeCellLayer
flipFace = true; flipFace = true;
} }
newPatchIDs = polyTopoChange::whichPatch newPatchID = mesh.boundaryMesh().whichPatch(ftc[faceI]);
(
mesh.boundaryMesh(),
ftc[faceI]
);
// The zone of the master face is preserved // The zone of the master face is preserved
newZoneID = mesh.faceZones().whichZone(mf[faceI]); newZoneID = mesh.faceZones().whichZone(mf[faceI]);
@ -366,7 +349,7 @@ void Foam::layerAdditionRemoval::removeCellLayer
flipFace = true; flipFace = true;
} }
newPatchIDs = labelPair(-1, -1); newPatchID = -1;
// The zone of the master face is preserved // The zone of the master face is preserved
newZoneID = mesh.faceZones().whichZone(mf[faceI]); newZoneID = mesh.faceZones().whichZone(mf[faceI]);
@ -401,11 +384,10 @@ void Foam::layerAdditionRemoval::removeCellLayer
newOwner, // owner newOwner, // owner
newNeighbour, // neighbour newNeighbour, // neighbour
flipFace, // flip flipFace, // flip
newPatchIDs[0], // patch for face newPatchID, // patch for face
false, // remove from zone false, // remove from zone
newZoneID, // new zone newZoneID, // new zone
zoneFlip, // face flip in zone zoneFlip // face flip in zone
newPatchIDs[1] // subpatch for face
) )
); );
} }

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "cellLooper.H" #include "cellLooper.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "edgeVertex.H" #include "edgeVertex.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "boundaryCutter.H" #include "boundaryCutter.H"
@ -39,12 +37,7 @@ Description
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam defineTypeNameAndDebug(Foam::boundaryCutter, 0);
{
defineTypeNameAndDebug(boundaryCutter, 0);
}
// * * * * * * * * * * * * * Private Static Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Static Functions * * * * * * * * * * * //
@ -55,12 +48,17 @@ defineTypeNameAndDebug(boundaryCutter, 0);
void Foam::boundaryCutter::getFaceInfo void Foam::boundaryCutter::getFaceInfo
( (
const label faceI, const label faceI,
labelPair& patchIDs, label& patchID,
label& zoneID, label& zoneID,
label& zoneFlip label& zoneFlip
) const ) const
{ {
patchIDs = polyTopoChange::whichPatch(mesh_.boundaryMesh(), faceI); patchID = -1;
if (!mesh_.isInternalFace(faceI))
{
patchID = mesh_.boundaryMesh().whichPatch(faceI);
}
zoneID = mesh_.faceZones().whichZone(faceI); zoneID = mesh_.faceZones().whichZone(faceI);
@ -150,9 +148,8 @@ void Foam::boundaryCutter::addFace
) const ) const
{ {
// Information about old face // Information about old face
label zoneID, zoneFlip; label patchID, zoneID, zoneFlip;
labelPair patchIDs; getFaceInfo(faceI, patchID, zoneID, zoneFlip);
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
label own = mesh_.faceOwner()[faceI]; label own = mesh_.faceOwner()[faceI];
label masterPoint = mesh_.faces()[faceI][0]; label masterPoint = mesh_.faces()[faceI][0];
@ -167,11 +164,10 @@ void Foam::boundaryCutter::addFace
own, // owner own, // owner
-1, // neighbour -1, // neighbour
false, // flux flip false, // flux flip
patchIDs[0], // patch for face patchID, // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face zone flip zoneFlip // face zone flip
patchIDs[1] // subPatch ID
) )
); );
@ -190,10 +186,9 @@ void Foam::boundaryCutter::addFace
-1, // master edge -1, // master edge
-1, // master face for addition -1, // master face for addition
false, // flux flip false, // flux flip
patchIDs[0], // patch for face patchID, // patch for face
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face zone flip zoneFlip // face zone flip
patchIDs[1]
) )
); );
} }
@ -271,6 +266,10 @@ bool Foam::boundaryCutter::splitFace
// - walk to next cut. Make face // - walk to next cut. Make face
// - loop until face done. // - 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 // Get face with new points on cut edges for ease of looping
face extendedFace(addEdgeCutsToFace(faceI, edgeToAddedPoints)); face extendedFace(addEdgeCutsToFace(faceI, edgeToAddedPoints));
@ -565,9 +564,8 @@ void Foam::boundaryCutter::setRefinement
label addedPointI = iter(); label addedPointI = iter();
// Information about old face // Information about old face
labelPair patchIDs; label patchID, zoneID, zoneFlip;
label zoneID, zoneFlip; getFaceInfo(faceI, patchID, zoneID, zoneFlip);
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
label own = mesh_.faceOwner()[faceI]; label own = mesh_.faceOwner()[faceI];
label masterPoint = mesh_.faces()[faceI][0]; label masterPoint = mesh_.faces()[faceI][0];
@ -595,11 +593,10 @@ void Foam::boundaryCutter::setRefinement
own, // owner own, // owner
-1, // neighbour -1, // neighbour
false, // flux flip false, // flux flip
patchIDs[0], // patch for face patchID, // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face zone flip zoneFlip // face zone flip
patchIDs[1]
) )
); );
} }
@ -617,10 +614,9 @@ void Foam::boundaryCutter::setRefinement
-1, // master edge -1, // master edge
-1, // master face for addition -1, // master face for addition
false, // flux flip false, // flux flip
patchIDs[0], // patch for face patchID, // patch for face
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face zone flip zoneFlip // face zone flip
patchIDs[1]
) )
); );
} }
@ -651,9 +647,8 @@ void Foam::boundaryCutter::setRefinement
face newFace(addEdgeCutsToFace(faceI, edgeToAddedPoints)); face newFace(addEdgeCutsToFace(faceI, edgeToAddedPoints));
// Information about old face // Information about old face
labelPair patchIDs; label patchID, zoneID, zoneFlip;
label zoneID, zoneFlip; getFaceInfo(faceI, patchID, zoneID, zoneFlip);
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
label own = mesh_.faceOwner()[faceI]; label own = mesh_.faceOwner()[faceI];
label masterPoint = mesh_.faces()[faceI][0]; label masterPoint = mesh_.faces()[faceI][0];
@ -701,11 +696,10 @@ void Foam::boundaryCutter::setRefinement
own, // owner own, // owner
-1, // neighbour -1, // neighbour
false, // flux flip false, // flux flip
patchIDs[0], // patch for face patchID, // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face zone flip zoneFlip // face zone flip
patchIDs[1]
) )
); );
@ -736,10 +730,9 @@ void Foam::boundaryCutter::setRefinement
-1, // master edge -1, // master edge
-1, // master face for addition -1, // master face for addition
false, // flux flip false, // flux flip
patchIDs[0], // patch for face patchID, // patch for face
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face zone flip zoneFlip // face zone flip
patchIDs[1]
) )
); );
@ -799,9 +792,8 @@ void Foam::boundaryCutter::setRefinement
nei = mesh_.faceNeighbour()[faceI]; nei = mesh_.faceNeighbour()[faceI];
} }
labelPair patchIDs; label patchID, zoneID, zoneFlip;
label zoneID, zoneFlip; getFaceInfo(faceI, patchID, zoneID, zoneFlip);
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
meshMod.setAction meshMod.setAction
( (
@ -812,11 +804,10 @@ void Foam::boundaryCutter::setRefinement
own, // owner own, // owner
nei, // neighbour nei, // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face patchID, // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
patchIDs[1]
) )
); );

View File

@ -84,7 +84,7 @@ class boundaryCutter
void getFaceInfo void getFaceInfo
( (
const label faceI, const label faceI,
labelPair& patchID, label& patchID,
label& zoneID, label& zoneID,
label& zoneFlip label& zoneFlip
) const; ) const;

View File

@ -183,7 +183,7 @@ void Foam::meshCutAndRemove::faceCells
const label faceI, const label faceI,
label& own, label& own,
label& nei, label& nei,
labelPair& patchIDs label& patchID
) const ) const
{ {
const labelListList& anchorPts = cuts.cellAnchorPoints(); 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 // Face was internal but becomes external
patchIDs[0] = exposedPatchI; patchID = exposedPatchI;
} }
} }
@ -250,7 +250,7 @@ void Foam::meshCutAndRemove::addFace
const face& newFace, const face& newFace,
const label own, const label own,
const label nei, const label nei,
const labelPair& patchIDs const label patchID
) )
{ {
label zoneID; label zoneID;
@ -266,7 +266,7 @@ void Foam::meshCutAndRemove::addFace
Pout<< "Adding face " << newFace Pout<< "Adding face " << newFace
<< " with new owner:" << own << " with new owner:" << own
<< " with new neighbour:" << nei << " with new neighbour:" << nei
<< " patchIDs:" << patchIDs << " patchID:" << patchID
<< " anchor:" << masterPointI << " anchor:" << masterPointI
<< " zoneID:" << zoneID << " zoneID:" << zoneID
<< " zoneFlip:" << zoneFlip << " zoneFlip:" << zoneFlip
@ -284,10 +284,9 @@ void Foam::meshCutAndRemove::addFace
-1, // master edge -1, // master edge
-1, // master face for addition -1, // master face for addition
false, // flux flip false, // flux flip
patchIDs[0], // patch for face patchID, // patch for face
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face zone flip zoneFlip // face zone flip
patchIDs[1]
) )
); );
} }
@ -299,7 +298,7 @@ void Foam::meshCutAndRemove::addFace
Pout<< "Adding (reversed) face " << newFace.reverseFace() Pout<< "Adding (reversed) face " << newFace.reverseFace()
<< " with new owner:" << nei << " with new owner:" << nei
<< " with new neighbour:" << own << " with new neighbour:" << own
<< " patchIDs:" << patchIDs << " patchID:" << patchID
<< " anchor:" << masterPointI << " anchor:" << masterPointI
<< " zoneID:" << zoneID << " zoneID:" << zoneID
<< " zoneFlip:" << zoneFlip << " zoneFlip:" << zoneFlip
@ -317,10 +316,9 @@ void Foam::meshCutAndRemove::addFace
-1, // master edge -1, // master edge
-1, // master face for addition -1, // master face for addition
false, // flux flip false, // flux flip
patchIDs[0], // patch for face patchID, // patch for face
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face zone flip zoneFlip // face zone flip
patchIDs[1]
) )
); );
} }
@ -335,7 +333,7 @@ void Foam::meshCutAndRemove::modFace
const face& newFace, const face& newFace,
const label own, const label own,
const label nei, const label nei,
const labelPair& patchIDs const label patchID
) )
{ {
label zoneID; label zoneID;
@ -360,7 +358,7 @@ void Foam::meshCutAndRemove::modFace
<< " new vertices:" << newFace << " new vertices:" << newFace
<< " new owner:" << own << " new owner:" << own
<< " new neighbour:" << nei << " new neighbour:" << nei
<< " new patch:" << patchIDs[0] << " new patch:" << patchID
<< " new zoneID:" << zoneID << " new zoneID:" << zoneID
<< " new zoneFlip:" << zoneFlip << " new zoneFlip:" << zoneFlip
<< endl; << endl;
@ -377,11 +375,10 @@ void Foam::meshCutAndRemove::modFace
own, // owner own, // owner
nei, // neighbour nei, // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face patchID, // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
patchIDs[1] // subPatch
) )
); );
} }
@ -396,11 +393,10 @@ void Foam::meshCutAndRemove::modFace
nei, // owner nei, // owner
own, // neighbour own, // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face patchID, // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
patchIDs[1] // subPatch
) )
); );
} }
@ -846,8 +842,7 @@ void Foam::meshCutAndRemove::setRefinement
false, // flux flip false, // flux flip
cutPatch[cellI], // patch for face cutPatch[cellI], // patch for face
-1, // zone for face -1, // zone for face
false, // face zone flip false // face zone flip
-1 //? TBD
) )
); );
@ -1069,11 +1064,11 @@ void Foam::meshCutAndRemove::setRefinement
// If faces were internal but now become external set a patch. // If faces were internal but now become external set a patch.
// If they were external already keep the 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) if (f0Nei != -1)
{ {
// f0 becomes external face (note:modFace will reverse face) // 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; modifiedFaceI = true;
} }
} }
@ -1096,13 +1091,13 @@ void Foam::meshCutAndRemove::setRefinement
if (f0Nei == -1) if (f0Nei == -1)
{ {
// f0 becomes external face // f0 becomes external face
modFace(meshMod, faceI, f0, f0Own, f0Nei, patchIDs); modFace(meshMod, faceI, f0, f0Own, f0Nei, patchID);
modifiedFaceI = true; modifiedFaceI = true;
} }
else else
{ {
// f0 stays internal face. // f0 stays internal face.
modFace(meshMod, faceI, f0, f0Own, f0Nei, labelPair(-1, -1)); modFace(meshMod, faceI, f0, f0Own, f0Nei, -1);
modifiedFaceI = true; modifiedFaceI = true;
} }
} }
@ -1121,12 +1116,12 @@ void Foam::meshCutAndRemove::setRefinement
// f1 becomes external face (note:modFace will reverse face) // f1 becomes external face (note:modFace will reverse face)
if (!modifiedFaceI) if (!modifiedFaceI)
{ {
modFace(meshMod, faceI, f1, f1Own, f1Nei, patchIDs); modFace(meshMod, faceI, f1, f1Own, f1Nei, patchID);
modifiedFaceI = true; modifiedFaceI = true;
} }
else else
{ {
label masterPointI = findPatchFacePoint(f1, patchIDs[0]); label masterPointI = findPatchFacePoint(f1, patchID);
addFace addFace
( (
@ -1136,7 +1131,7 @@ void Foam::meshCutAndRemove::setRefinement
f1, // vertices of face f1, // vertices of face
f1Own, f1Own,
f1Nei, f1Nei,
patchIDs // patch for new face patchID // patch for new face
); );
} }
} }
@ -1148,12 +1143,12 @@ void Foam::meshCutAndRemove::setRefinement
// f1 becomes external face // f1 becomes external face
if (!modifiedFaceI) if (!modifiedFaceI)
{ {
modFace(meshMod, faceI, f1, f1Own, f1Nei, patchIDs); modFace(meshMod, faceI, f1, f1Own, f1Nei, patchID);
modifiedFaceI = true; modifiedFaceI = true;
} }
else else
{ {
label masterPointI = findPatchFacePoint(f1, patchIDs[0]); label masterPointI = findPatchFacePoint(f1, patchID);
addFace addFace
( (
@ -1163,7 +1158,7 @@ void Foam::meshCutAndRemove::setRefinement
f1, f1,
f1Own, f1Own,
f1Nei, f1Nei,
patchIDs patchID
); );
} }
} }
@ -1172,31 +1167,14 @@ void Foam::meshCutAndRemove::setRefinement
// f1 is internal face. // f1 is internal face.
if (!modifiedFaceI) if (!modifiedFaceI)
{ {
modFace modFace(meshMod, faceI, f1, f1Own, f1Nei, -1);
(
meshMod,
faceI,
f1,
f1Own,
f1Nei,
labelPair(-1, -1)
);
modifiedFaceI = true; modifiedFaceI = true;
} }
else else
{ {
label masterPointI = findPatchFacePoint(f1, -1); label masterPointI = findPatchFacePoint(f1, -1);
addFace addFace(meshMod, faceI, masterPointI, f1, f1Own, f1Nei, -1);
(
meshMod,
faceI,
masterPointI,
f1,
f1Own,
f1Nei,
labelPair(-1, -1)
);
} }
} }
} }
@ -1239,9 +1217,8 @@ void Foam::meshCutAndRemove::setRefinement
// borders by edge a cell which has been split. // borders by edge a cell which has been split.
// Get (new or original) owner and neighbour of faceI // Get (new or original) owner and neighbour of faceI
label own, nei; label own, nei, patchID;
labelPair patchIDs; faceCells(cuts, exposedPatchI, faceI, own, nei, patchID);
faceCells(cuts, exposedPatchI, faceI, own, nei, patchIDs);
if (own == -1 && nei == -1) if (own == -1 && nei == -1)
@ -1272,7 +1249,7 @@ void Foam::meshCutAndRemove::setRefinement
newFace, newFace,
own, own,
nei, nei,
patchIDs patchID
); );
} }
@ -1296,9 +1273,8 @@ void Foam::meshCutAndRemove::setRefinement
if (!faceUptodate[faceI]) if (!faceUptodate[faceI])
{ {
// Get (new or original) owner and neighbour of faceI // Get (new or original) owner and neighbour of faceI
labelPair patchIDs; label own, nei, patchID;
label own, nei; faceCells(cuts, exposedPatchI, faceI, own, nei, patchID);
faceCells(cuts, exposedPatchI, faceI, own, nei, patchIDs);
if (own == -1 && nei == -1) if (own == -1 && nei == -1)
{ {
@ -1311,7 +1287,7 @@ void Foam::meshCutAndRemove::setRefinement
} }
else else
{ {
modFace(meshMod, faceI, faces[faceI], own, nei, patchIDs); modFace(meshMod, faceI, faces[faceI], own, nei, patchID);
} }
faceUptodate[faceI] = true; faceUptodate[faceI] = true;

View File

@ -106,7 +106,7 @@ class meshCutAndRemove
const label faceI, const label faceI,
label& own, label& own,
label& nei, label& nei,
labelPair& patchIDs label& patchID
) const; ) const;
//- Get zone information for face. //- Get zone information for face.
@ -126,7 +126,7 @@ class meshCutAndRemove
const face& newFace, const face& newFace,
const label owner, const label owner,
const label neighbour, 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
@ -139,7 +139,7 @@ class meshCutAndRemove
const face& newFace, const face& newFace,
const label owner, const label owner,
const label neighbour, const label neighbour,
const labelPair& patchIDs const label patchID
); );
// Copies face starting from startFp. Jumps cuts. Marks visited // Copies face starting from startFp. Jumps cuts. Marks visited

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "meshCutter.H" #include "meshCutter.H"
@ -177,12 +175,17 @@ void Foam::meshCutter::faceCells
void Foam::meshCutter::getFaceInfo void Foam::meshCutter::getFaceInfo
( (
const label faceI, const label faceI,
labelPair& patchIDs, label& patchID,
label& zoneID, label& zoneID,
label& zoneFlip label& zoneFlip
) const ) const
{ {
patchIDs = polyTopoChange::whichPatch(mesh().boundaryMesh(), faceI); patchID = -1;
if (!mesh().isInternalFace(faceI))
{
patchID = mesh().boundaryMesh().whichPatch(faceI);
}
zoneID = mesh().faceZones().whichZone(faceI); zoneID = mesh().faceZones().whichZone(faceI);
@ -207,9 +210,9 @@ void Foam::meshCutter::addFace
const label nei const label nei
) )
{ {
labelPair patchIDs; label patchID, zoneID, zoneFlip;
label zoneID, zoneFlip;
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip); getFaceInfo(faceI, patchID, zoneID, zoneFlip);
if ((nei == -1) || (own < nei)) if ((nei == -1) || (own < nei))
{ {
@ -219,7 +222,7 @@ void Foam::meshCutter::addFace
Pout<< "Adding face " << newFace Pout<< "Adding face " << newFace
<< " with new owner:" << own << " with new owner:" << own
<< " with new neighbour:" << nei << " with new neighbour:" << nei
<< " patchIDs:" << patchIDs << " patchID:" << patchID
<< " zoneID:" << zoneID << " zoneID:" << zoneID
<< " zoneFlip:" << zoneFlip << " zoneFlip:" << zoneFlip
<< endl; << endl;
@ -236,10 +239,9 @@ void Foam::meshCutter::addFace
-1, // master edge -1, // master edge
faceI, // master face for addition faceI, // master face for addition
false, // flux flip false, // flux flip
patchIDs[0], // patch for face patchID, // patch for face
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face zone flip zoneFlip // face zone flip
patchIDs[1] // subPatch
) )
); );
} }
@ -251,7 +253,7 @@ void Foam::meshCutter::addFace
Pout<< "Adding (reversed) face " << newFace.reverseFace() Pout<< "Adding (reversed) face " << newFace.reverseFace()
<< " with new owner:" << nei << " with new owner:" << nei
<< " with new neighbour:" << own << " with new neighbour:" << own
<< " patchIDs:" << patchIDs << " patchID:" << patchID
<< " zoneID:" << zoneID << " zoneID:" << zoneID
<< " zoneFlip:" << zoneFlip << " zoneFlip:" << zoneFlip
<< endl; << endl;
@ -268,10 +270,9 @@ void Foam::meshCutter::addFace
-1, // master edge -1, // master edge
faceI, // master face for addition faceI, // master face for addition
false, // flux flip false, // flux flip
patchIDs[0], // patch for face patchID, // patch for face
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face zone flip zoneFlip // face zone flip
patchIDs[1] // subPatch
) )
); );
} }
@ -288,9 +289,9 @@ void Foam::meshCutter::modFace
const label nei const label nei
) )
{ {
labelPair patchIDs; label patchID, zoneID, zoneFlip;
label zoneID, zoneFlip;
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip); getFaceInfo(faceI, patchID, zoneID, zoneFlip);
if if
( (
@ -325,11 +326,10 @@ void Foam::meshCutter::modFace
own, // owner own, // owner
nei, // neighbour nei, // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face patchID, // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
patchIDs[1] // subPatch
) )
); );
} }
@ -344,11 +344,10 @@ void Foam::meshCutter::modFace
nei, // owner nei, // owner
own, // neighbour own, // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face patchID, // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
patchIDs[1] // subPatch
) )
); );
} }
@ -694,8 +693,7 @@ void Foam::meshCutter::setRefinement
false, // flux flip false, // flux flip
-1, // patch for face -1, // patch for face
-1, // zone for face -1, // zone for face
false, // face zone flip false // face zone flip
-1 // subpatch
) )
); );

View File

@ -185,7 +185,7 @@ class meshCutter
void getFaceInfo void getFaceInfo
( (
const label faceI, const label faceI,
labelPair& patchIDs, label& patchID,
label& zoneID, label& zoneID,
label& zoneFlip label& zoneFlip
) const; ) const;

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "refineCell.H" #include "refineCell.H"
@ -31,7 +29,6 @@ Description
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null
Foam::refineCell::refineCell() Foam::refineCell::refineCell()
: :
cellNo_(-1), cellNo_(-1),
@ -39,7 +36,6 @@ Foam::refineCell::refineCell()
{} {}
// from components
Foam::refineCell::refineCell(const label cellI, const vector& direction) Foam::refineCell::refineCell(const label cellI, const vector& direction)
: :
cellNo_(cellI), cellNo_(cellI),
@ -61,7 +57,6 @@ Foam::refineCell::refineCell(const label cellI, const vector& direction)
} }
// from Istream
Foam::refineCell::refineCell(Istream& is) Foam::refineCell::refineCell(Istream& is)
: :
cellNo_(readLabel(is)), cellNo_(readLabel(is)),

View File

@ -1175,7 +1175,7 @@ void Foam::motionSmoother::updateMesh()
forAll(meshPoints, i) forAll(meshPoints, i)
{ {
isInternalPoint_.set(meshPoints[i], 0); isInternalPoint_.unset(meshPoints[i]);
} }
// Calculate master edge addressing // Calculate master edge addressing

View File

@ -179,7 +179,7 @@ class motionSmoother
// Private Member Functions // Private Member Functions
//- Average value (not positions!) of connected points. //- Average of connected points.
template <class Type> template <class Type>
tmp<GeometricField<Type, pointPatchField, pointMesh> > avg tmp<GeometricField<Type, pointPatchField, pointMesh> > avg
( (

View File

@ -229,6 +229,7 @@ Foam::motionSmoother::avg
scalar(0) // null value scalar(0) // null value
); );
// Average // Average
// ~~~~~~~ // ~~~~~~~

View File

@ -1276,7 +1276,7 @@ bool Foam::polyMeshGeometry::checkFaceAngles
faceNormal /= mag(faceNormal) + VSMALL; faceNormal /= mag(faceNormal) + VSMALL;
// Get edge from f[0] to f[size-1]; // 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); scalar magEPrev = mag(ePrev);
ePrev /= magEPrev + VSMALL; ePrev /= magEPrev + VSMALL;

View File

@ -86,8 +86,6 @@ class polyAddFace
//- Face zone flip //- Face zone flip
bool zoneFlip_; bool zoneFlip_;
//- Sub patch ID (for proc patches)
label subPatchID_;
public: public:
@ -111,8 +109,7 @@ public:
flipFaceFlux_(false), flipFaceFlux_(false),
patchID_(-1), patchID_(-1),
zoneID_(-1), zoneID_(-1),
zoneFlip_(false), zoneFlip_(false)
subPatchID_(-1)
{} {}
@ -128,8 +125,7 @@ public:
const bool flipFaceFlux, const bool flipFaceFlux,
const label patchID, const label patchID,
const label zoneID, const label zoneID,
const bool zoneFlip, const bool zoneFlip
const label subPatchID
) )
: :
face_(f), face_(f),
@ -141,8 +137,7 @@ public:
flipFaceFlux_(flipFaceFlux), flipFaceFlux_(flipFaceFlux),
patchID_(patchID), patchID_(patchID),
zoneID_(zoneID), zoneID_(zoneID),
zoneFlip_(zoneFlip), zoneFlip_(zoneFlip)
subPatchID_(subPatchID)
{ {
if (face_.size() < 3) if (face_.size() < 3)
{ {
@ -159,8 +154,7 @@ public:
" const bool flipFaceFlux,\n" " const bool flipFaceFlux,\n"
" const label patchID,\n" " const label patchID,\n"
" const label zoneID,\n" " const label zoneID,\n"
" const bool zoneFlip,\n" " const bool zoneFlip\n"
" const label subPatchID\n"
")" ")"
) << "Invalid face: less than 3 points. " ) << "Invalid face: less than 3 points. "
<< "This is not allowed.\n" << "This is not allowed.\n"
@ -189,8 +183,7 @@ public:
" const bool flipFaceFlux,\n" " const bool flipFaceFlux,\n"
" const label patchID,\n" " const label patchID,\n"
" const label zoneID,\n" " const label zoneID,\n"
" const bool zoneFlip,\n" " const bool zoneFlip\n"
" const label subPatchID\n"
")" ")"
) << "Face contains invalid vertex ID: " << face_ << ". " ) << "Face contains invalid vertex ID: " << face_ << ". "
<< "This is not allowed.\n" << "This is not allowed.\n"
@ -219,8 +212,7 @@ public:
" const bool flipFaceFlux,\n" " const bool flipFaceFlux,\n"
" const label patchID,\n" " const label patchID,\n"
" const label zoneID,\n" " const label zoneID,\n"
" const bool zoneFlip,\n" " const bool zoneFlip\n"
" const label subPatchID\n"
")" ")"
) << "Face owner and neighbour are identical. " ) << "Face owner and neighbour are identical. "
<< "This is not allowed.\n" << "This is not allowed.\n"
@ -249,8 +241,7 @@ public:
" const bool flipFaceFlux,\n" " const bool flipFaceFlux,\n"
" const label patchID,\n" " const label patchID,\n"
" const label zoneID,\n" " const label zoneID,\n"
" const bool zoneFlip,\n" " const bool zoneFlip\n"
" const label subPatchID\n"
")" ")"
) << "Patch face has got a neighbour. Patch ID: " << patchID ) << "Patch face has got a neighbour. Patch ID: " << patchID
<< ". This is not allowed.\n" << ". This is not allowed.\n"
@ -278,9 +269,7 @@ public:
" const label masterFaceID,\n" " const label masterFaceID,\n"
" const bool flipFaceFlux,\n" " const bool flipFaceFlux,\n"
" const label patchID,\n" " const label patchID,\n"
" const label zoneID,\n" " const label zoneID"
" const bool zoneFlip,\n"
" const label subPatchID\n"
")" ")"
) << "Face has no owner and is not in a zone. " ) << "Face has no owner and is not in a zone. "
<< "This is not allowed.\n" << "This is not allowed.\n"
@ -310,9 +299,7 @@ public:
" const bool flipFaceFlux,\n" " const bool flipFaceFlux,\n"
" const label patchID,\n" " const label patchID,\n"
" const label zoneID,\n" " const label zoneID,\n"
" const bool zoneFlip,\n" " const bool zoneFlip\n"
" const label subPatchID\n"
")"
")" ")"
) << "Specified zone flip for a face that does not " ) << "Specified zone flip for a face that does not "
<< "belong to zone. This is not allowed.\n" << "belong to zone. This is not allowed.\n"
@ -439,13 +426,6 @@ public:
{ {
return zoneFlip_; return zoneFlip_;
} }
//- Boundary sub patch ID
label subPatchID() const
{
return subPatchID_;
}
}; };

View File

@ -1276,7 +1276,7 @@ void Foam::addPatchCellLayer::setRefinement
doneEdge[fEdges[fp]] = true; doneEdge[fEdges[fp]] = true;
fp = f.fcIndex(fp); fp = f.fcIndex(fp);
} }
stringedVerts[stringedVerts.size()-1] = f[fp]; stringedVerts.last() = f[fp];
// Now stringedVerts contains the vertices in order of face f. // 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++) for (label i = 0; i < numEdgeSideFaces; i++)
{ {
label vEnd = stringedVerts[stringedVerts.size()-1]; label vEnd = stringedVerts.last();
label vStart = stringedVerts[0]; label vStart = stringedVerts[0];
// calculate number of points making up a face // calculate number of points making up a face

View File

@ -193,7 +193,7 @@ class addPatchCellLayer
label addSideFace label addSideFace
( (
const indirectPrimitivePatch&, const indirectPrimitivePatch&,
const List<labelPair>& patchIDs, const labelList& patchID,
const labelListList& addedCells, const labelListList& addedCells,
const face& newFace, const face& newFace,
const label ownFaceI, const label ownFaceI,

View File

@ -62,7 +62,7 @@ bool Foam::combineFaces::convexFace
n /= mag(n); n /= mag(n);
// Get edge from f[0] to f[size-1]; // 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); scalar magEPrev = mag(ePrev);
ePrev /= magEPrev + VSMALL; ePrev /= magEPrev + VSMALL;
@ -658,11 +658,7 @@ void Foam::combineFaces::setRefinement
zoneFlip = fZone.flipMap()[fZone.whichFace(masterFaceI)]; zoneFlip = fZone.flipMap()[fZone.whichFace(masterFaceI)];
} }
labelPair patchIDs = polyTopoChange::whichPatch label patchI = mesh_.boundaryMesh().whichPatch(masterFaceI);
(
mesh_.boundaryMesh(),
masterFaceI
);
meshMod.setAction meshMod.setAction
( (
@ -673,11 +669,10 @@ void Foam::combineFaces::setRefinement
mesh_.faceOwner()[masterFaceI], // owner mesh_.faceOwner()[masterFaceI], // owner
-1, // neighbour -1, // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face patchI, // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
patchIDs[1]
) )
); );
@ -961,13 +956,9 @@ void Foam::combineFaces::setUnrefinement
const faceZone& fZone = mesh_.faceZones()[zoneID]; const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(masterFaceI)]; zoneFlip = fZone.flipMap()[fZone.whichFace(masterFaceI)];
} }
labelPair patchIDs = polyTopoChange::whichPatch label patchI = mesh_.boundaryMesh().whichPatch(masterFaceI);
(
mesh_.boundaryMesh(),
masterFaceI
);
if (mesh_.boundaryMesh()[patchIDs[0]].coupled()) if (mesh_.boundaryMesh()[patchI].coupled())
{ {
FatalErrorIn FatalErrorIn
( (
@ -975,7 +966,7 @@ void Foam::combineFaces::setUnrefinement
"(const labelList&, polyTopoChange&" "(const labelList&, polyTopoChange&"
", Map<label>&, Map<label>&, Map<label>&)" ", Map<label>&, Map<label>&, Map<label>&)"
) << "Master face " << masterFaceI << " is on coupled patch " ) << "Master face " << masterFaceI << " is on coupled patch "
<< mesh_.boundaryMesh()[patchIDs[0]].name() << mesh_.boundaryMesh()[patchI].name()
<< abort(FatalError); << abort(FatalError);
} }
@ -992,11 +983,10 @@ void Foam::combineFaces::setUnrefinement
own, // owner own, // owner
-1, // neighbour -1, // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face patchI, // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
patchIDs[1] // subPatchID
) )
); );
@ -1017,10 +1007,9 @@ void Foam::combineFaces::setUnrefinement
-1, // masterEdgeID, -1, // masterEdgeID,
masterFaceI, // masterFaceID, masterFaceI, // masterFaceID,
false, // flipFaceFlux, false, // flipFaceFlux,
patchIDs[0], // patchID, patchI, // patchID,
zoneID, // zoneID, zoneID, // zoneID,
zoneFlip, // zoneFlip zoneFlip // zoneFlip
patchIDs[1] // subPatchID
) )
); );
} }

View File

@ -154,7 +154,7 @@ void Foam::duplicatePoints::setRefinement
const faceZone& fZone = mesh_.faceZones()[zoneID]; const faceZone& fZone = mesh_.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)]; zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
} }
labelPair patchIDs = polyTopoChange::whichPatch(patches, faceI);
if (mesh_.isInternalFace(faceI)) if (mesh_.isInternalFace(faceI))
{ {
@ -167,8 +167,7 @@ void Foam::duplicatePoints::setRefinement
false, // face flip false, // face flip
-1, // patch for face -1, // patch for face
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
-1 // subPatch
); );
} }
else else
@ -180,10 +179,9 @@ void Foam::duplicatePoints::setRefinement
mesh_.faceOwner()[faceI], // owner mesh_.faceOwner()[faceI], // owner
-1, // neighbour -1, // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face patches.whichPatch(faceI), // patch for face
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
patchIDs[1]
); );
} }
} }

View File

@ -558,16 +558,16 @@ bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod)
// Get current connectivity // Get current connectivity
label own = faceOwner[faceI]; label own = faceOwner[faceI];
label nei = -1; label nei = -1;
labelPair patchIDs = polyTopoChange::whichPatch label patchID = -1;
(
boundaryMesh,
faceI
);
if (mesh_.isInternalFace(faceI)) if (mesh_.isInternalFace(faceI))
{ {
nei = faceNeighbour[faceI]; nei = faceNeighbour[faceI];
} }
else
{
patchID = boundaryMesh.whichPatch(faceI);
}
meshMod.modifyFace meshMod.modifyFace
( (
@ -576,10 +576,9 @@ bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod)
own, // owner own, // owner
nei, // neighbour nei, // neighbour
false, // flipFaceFlux false, // flipFaceFlux
patchIDs[0], // patch patchID, // patch
zoneID, zoneID,
zoneFlip, zoneFlip
patchIDs[1] // subpatch for face
); );
meshChanged = true; meshChanged = true;
} }

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "faceCollapser.H" #include "faceCollapser.H"
@ -156,16 +154,16 @@ void Foam::faceCollapser::filterFace
{ {
label nei = -1; label nei = -1;
labelPair patchIDs = polyTopoChange::whichPatch label patchI = -1;
(
mesh_.boundaryMesh(),
faceI
);
if (mesh_.isInternalFace(faceI)) if (mesh_.isInternalFace(faceI))
{ {
nei = mesh_.faceNeighbour()[faceI]; nei = mesh_.faceNeighbour()[faceI];
} }
else
{
patchI = mesh_.boundaryMesh().whichPatch(faceI);
}
// Get current zone info // Get current zone info
label zoneID = mesh_.faceZones().whichZone(faceI); label zoneID = mesh_.faceZones().whichZone(faceI);
@ -188,11 +186,10 @@ void Foam::faceCollapser::filterFace
mesh_.faceOwner()[faceI], // owner mesh_.faceOwner()[faceI], // owner
nei, // neighbour nei, // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face patchI, // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
patchIDs[1]
) )
); );
} }

View File

@ -97,12 +97,17 @@ void Foam::hexRef8::reorder
void Foam::hexRef8::getFaceInfo void Foam::hexRef8::getFaceInfo
( (
const label faceI, const label faceI,
labelPair& patchIDs, label& patchID,
label& zoneID, label& zoneID,
label& zoneFlip label& zoneFlip
) const ) const
{ {
patchIDs = polyTopoChange::whichPatch(mesh_.boundaryMesh(), faceI); patchID = -1;
if (!mesh_.isInternalFace(faceI))
{
patchID = mesh_.boundaryMesh().whichPatch(faceI);
}
zoneID = mesh_.faceZones().whichZone(faceI); zoneID = mesh_.faceZones().whichZone(faceI);
@ -127,9 +132,9 @@ Foam::label Foam::hexRef8::addFace
const label nei const label nei
) const ) const
{ {
labelPair patchIDs; label patchID, zoneID, zoneFlip;
label zoneID, zoneFlip;
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip); getFaceInfo(faceI, patchID, zoneID, zoneFlip);
label newFaceI = -1; label newFaceI = -1;
@ -147,10 +152,9 @@ Foam::label Foam::hexRef8::addFace
-1, // master edge -1, // master edge
faceI, // master face for addition faceI, // master face for addition
false, // flux flip false, // flux flip
patchIDs[0], // patch for face patchID, // patch for face
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face zone flip zoneFlip // face zone flip
patchIDs[1] // subPatch
) )
); );
} }
@ -168,10 +172,9 @@ Foam::label Foam::hexRef8::addFace
-1, // master edge -1, // master edge
faceI, // master face for addition faceI, // master face for addition
false, // flux flip false, // flux flip
patchIDs[0], // patch for face patchID, // patch for face
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face zone flip zoneFlip // face zone flip
patchIDs[1] // subPatch
) )
); );
} }
@ -210,8 +213,7 @@ Foam::label Foam::hexRef8::addInternalFace
false, // flux flip false, // flux flip
-1, // patch for face -1, // patch for face
-1, // zone for face -1, // zone for face
false, // face zone flip false // face zone flip
-1 // subPatch
) )
); );
} }
@ -239,8 +241,7 @@ Foam::label Foam::hexRef8::addInternalFace
false, // flux flip false, // flux flip
-1, // patch for face -1, // patch for face
-1, // zone for face -1, // zone for face
false, // face zone flip false // face zone flip
-1 // subPatch
) )
); );
@ -275,8 +276,7 @@ Foam::label Foam::hexRef8::addInternalFace
// false, // flux flip // false, // flux flip
// -1, // patch for face // -1, // patch for face
// -1, // zone for face // -1, // zone for face
// false, // face zone flip // false // face zone flip
// -1 // subPatch
// ) // )
//); //);
} }
@ -293,9 +293,9 @@ void Foam::hexRef8::modFace
const label nei const label nei
) const ) const
{ {
labelPair patchIDs; label patchID, zoneID, zoneFlip;
label zoneID, zoneFlip;
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip); getFaceInfo(faceI, patchID, zoneID, zoneFlip);
if if
( (
@ -318,11 +318,10 @@ void Foam::hexRef8::modFace
own, // owner own, // owner
nei, // neighbour nei, // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face patchID, // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
patchIDs[1] // subPatch
) )
); );
} }
@ -337,11 +336,10 @@ void Foam::hexRef8::modFace
nei, // owner nei, // owner
own, // neighbour own, // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face patchID, // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
patchIDs[1] // subPatch
) )
); );
} }
@ -1585,11 +1583,11 @@ Foam::label Foam::hexRef8::faceConsistentRefinement
{ {
if (maxSet) if (maxSet)
{ {
refineCell.set(nei, 1); refineCell.set(nei);
} }
else else
{ {
refineCell.set(own, 0); refineCell.unset(own);
} }
nChanged++; nChanged++;
} }
@ -1597,11 +1595,11 @@ Foam::label Foam::hexRef8::faceConsistentRefinement
{ {
if (maxSet) if (maxSet)
{ {
refineCell.set(own, 1); refineCell.set(own);
} }
else else
{ {
refineCell.set(nei, 0); refineCell.unset(nei);
} }
nChanged++; nChanged++;
} }
@ -1632,7 +1630,7 @@ Foam::label Foam::hexRef8::faceConsistentRefinement
{ {
if (!maxSet) if (!maxSet)
{ {
refineCell.set(own, 0); refineCell.unset(own);
nChanged++; nChanged++;
} }
} }
@ -1640,7 +1638,7 @@ Foam::label Foam::hexRef8::faceConsistentRefinement
{ {
if (maxSet) if (maxSet)
{ {
refineCell.set(own, 1); refineCell.set(own);
nChanged++; nChanged++;
} }
} }
@ -1659,7 +1657,7 @@ void Foam::hexRef8::checkWantedRefinementLevels
PackedBoolList refineCell(mesh_.nCells()); PackedBoolList refineCell(mesh_.nCells());
forAll(cellsToRefine, i) forAll(cellsToRefine, i)
{ {
refineCell.set(cellsToRefine[i], 1); refineCell.set(cellsToRefine[i]);
} }
for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++) for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++)
@ -2044,7 +2042,7 @@ Foam::labelList Foam::hexRef8::consistentRefinement
PackedBoolList refineCell(mesh_.nCells()); PackedBoolList refineCell(mesh_.nCells());
forAll(cellsToRefine, i) forAll(cellsToRefine, i)
{ {
refineCell.set(cellsToRefine[i], 1); refineCell.set(cellsToRefine[i]);
} }
while (true) while (true)
@ -2072,7 +2070,7 @@ Foam::labelList Foam::hexRef8::consistentRefinement
forAll(refineCell, cellI) forAll(refineCell, cellI)
{ {
if (refineCell.get(cellI) == 1) if (refineCell.get(cellI))
{ {
nRefined++; nRefined++;
} }
@ -2083,7 +2081,7 @@ Foam::labelList Foam::hexRef8::consistentRefinement
forAll(refineCell, cellI) forAll(refineCell, cellI)
{ {
if (refineCell.get(cellI) == 1) if (refineCell.get(cellI))
{ {
newCellsToRefine[nRefined++] = cellI; newCellsToRefine[nRefined++] = cellI;
} }
@ -2223,7 +2221,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement
faceCount faceCount
) )
); );
allFaceInfo[faceI] = seedFacesInfo[seedFacesInfo.size()-1]; allFaceInfo[faceI] = seedFacesInfo.last();
} }
else else
{ {
@ -2239,7 +2237,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement
faceCount faceCount
) )
); );
allFaceInfo[faceI] = seedFacesInfo[seedFacesInfo.size()-1]; allFaceInfo[faceI] = seedFacesInfo.last();
} }
} }
@ -2895,7 +2893,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2
if (wanted > cellLevel_[cellI]+1) if (wanted > cellLevel_[cellI]+1)
{ {
refineCell.set(cellI, 1); refineCell.set(cellI);
} }
} }
faceConsistentRefinement(true, refineCell); faceConsistentRefinement(true, refineCell);
@ -2924,7 +2922,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2
forAll(refineCell, cellI) forAll(refineCell, cellI)
{ {
if (refineCell.get(cellI) == 1) if (refineCell.get(cellI))
{ {
nRefined++; nRefined++;
} }
@ -2935,7 +2933,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2
forAll(refineCell, cellI) forAll(refineCell, cellI)
{ {
if (refineCell.get(cellI) == 1) if (refineCell.get(cellI))
{ {
newCellsToRefine[nRefined++] = cellI; newCellsToRefine[nRefined++] = cellI;
} }
@ -2968,7 +2966,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2
PackedBoolList refineCell(mesh_.nCells()); PackedBoolList refineCell(mesh_.nCells());
forAll(newCellsToRefine, i) forAll(newCellsToRefine, i)
{ {
refineCell.set(newCellsToRefine[i], 1); refineCell.set(newCellsToRefine[i]);
} }
const PackedBoolList savedRefineCell(refineCell); const PackedBoolList savedRefineCell(refineCell);
@ -2981,7 +2979,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2
); );
forAll(refineCell, cellI) forAll(refineCell, cellI)
{ {
if (refineCell.get(cellI) == 1) if (refineCell.get(cellI))
{ {
cellsOut2.insert(cellI); cellsOut2.insert(cellI);
} }
@ -2996,11 +2994,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2
{ {
forAll(refineCell, cellI) forAll(refineCell, cellI)
{ {
if if (refineCell.get(cellI) && !savedRefineCell.get(cellI))
(
refineCell.get(cellI) == 1
&& savedRefineCell.get(cellI) == 0
)
{ {
dumpCell(cellI); dumpCell(cellI);
FatalErrorIn FatalErrorIn
@ -3602,7 +3596,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
forAll(cFaces, i) 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) if (faceMidPoint[faceI] >= 0)
{ {
affectedFace.set(faceI, 1); affectedFace.set(faceI);
} }
} }
@ -3623,7 +3617,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
forAll(eFaces, i) forAll(eFaces, i)
{ {
affectedFace.set(eFaces[i], 1); affectedFace.set(eFaces[i]);
} }
} }
} }
@ -3640,7 +3634,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
forAll(faceMidPoint, faceI) 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 // Face needs to be split and hasn't yet been done in some way
// (affectedFace - is impossible since this is first change but // (affectedFace - is impossible since this is first change but
@ -3761,7 +3755,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
} }
// Mark face as having been handled // 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]; 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. // Unsplit face. Add edge splits to face.
@ -3872,7 +3866,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
modFace(meshMod, faceI, newFace, own, nei); modFace(meshMod, faceI, newFace, own, nei);
// Mark face as having been handled // 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) forAll(affectedFace, faceI)
{ {
if (affectedFace.get(faceI) == 1) if (affectedFace.get(faceI))
{ {
const face& f = mesh_.faces()[faceI]; const face& f = mesh_.faces()[faceI];
@ -3914,7 +3908,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
modFace(meshMod, faceI, f, own, nei); modFace(meshMod, faceI, f, own, nei);
// Mark face as having been handled // 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]; label pointI = pointsToUnrefine[i];
unrefinePoint.set(pointI, 1); unrefinePoint.set(pointI);
} }
@ -5109,13 +5103,13 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
forAll(unrefinePoint, pointI) forAll(unrefinePoint, pointI)
{ {
if (unrefinePoint.get(pointI) == 1) if (unrefinePoint.get(pointI))
{ {
const labelList& pCells = mesh_.pointCells(pointI); const labelList& pCells = mesh_.pointCells(pointI);
forAll(pCells, j) forAll(pCells, j)
{ {
unrefineCell.set(pCells[j], 1); unrefineCell.set(pCells[j]);
} }
} }
} }
@ -5143,17 +5137,24 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
if (maxSet) if (maxSet)
{ {
unrefineCell.set(nei, 1); unrefineCell.set(nei);
} }
else else
{ {
// could also combine with unset:
// if (!unrefineCell.unset(own))
// {
// FatalErrorIn("hexRef8::consistentUnrefinement(..)")
// << "problem cell already unset"
// << abort(FatalError);
// }
if (unrefineCell.get(own) == 0) if (unrefineCell.get(own) == 0)
{ {
FatalErrorIn("hexRef8::consistentUnrefinement(..)") FatalErrorIn("hexRef8::consistentUnrefinement(..)")
<< "problem" << abort(FatalError); << "problem" << abort(FatalError);
} }
unrefineCell.set(own, 0); unrefineCell.unset(own);
} }
nChanged++; nChanged++;
} }
@ -5161,7 +5162,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
{ {
if (maxSet) if (maxSet)
{ {
unrefineCell.set(own, 1); unrefineCell.set(own);
} }
else else
{ {
@ -5171,7 +5172,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
<< "problem" << abort(FatalError); << "problem" << abort(FatalError);
} }
unrefineCell.set(nei, 0); unrefineCell.unset(nei);
} }
nChanged++; nChanged++;
} }
@ -5207,7 +5208,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
<< "problem" << abort(FatalError); << "problem" << abort(FatalError);
} }
unrefineCell.set(own, 0); unrefineCell.unset(own);
nChanged++; nChanged++;
} }
} }
@ -5221,7 +5222,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
<< "problem" << abort(FatalError); << "problem" << abort(FatalError);
} }
unrefineCell.set(own, 1); unrefineCell.set(own);
nChanged++; nChanged++;
} }
} }
@ -5249,15 +5250,15 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
// Knock out any point whose cell neighbour cannot be unrefined. // Knock out any point whose cell neighbour cannot be unrefined.
forAll(unrefinePoint, pointI) forAll(unrefinePoint, pointI)
{ {
if (unrefinePoint.get(pointI) == 1) if (unrefinePoint.get(pointI))
{ {
const labelList& pCells = mesh_.pointCells(pointI); const labelList& pCells = mesh_.pointCells(pointI);
forAll(pCells, j) forAll(pCells, j)
{ {
if (unrefineCell.get(pCells[j]) == 0) if (!unrefineCell.get(pCells[j]))
{ {
unrefinePoint.set(pointI, 0); unrefinePoint.unset(pointI);
break; break;
} }
} }
@ -5271,7 +5272,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
forAll(unrefinePoint, pointI) forAll(unrefinePoint, pointI)
{ {
if (unrefinePoint.get(pointI) == 1) if (unrefinePoint.get(pointI))
{ {
nSet++; nSet++;
} }
@ -5282,7 +5283,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
forAll(unrefinePoint, pointI) forAll(unrefinePoint, pointI)
{ {
if (unrefinePoint.get(pointI) == 1) if (unrefinePoint.get(pointI))
{ {
newPointsToUnrefine[nSet++] = pointI; newPointsToUnrefine[nSet++] = pointI;
} }
@ -5320,8 +5321,7 @@ void Foam::hexRef8::setUnrefinement
{ {
FatalErrorIn FatalErrorIn
( (
"hexRef8::setUnrefinement" "hexRef8::setUnrefinement(const labelList&, polyTopoChange&)"
"(const labelList&, polyTopoChange&)"
) << "Illegal cell level " << cellLevel_[cellI] ) << "Illegal cell level " << cellLevel_[cellI]
<< " for cell " << cellI << " for cell " << cellI
<< abort(FatalError); << abort(FatalError);

View File

@ -105,7 +105,7 @@ class hexRef8
void getFaceInfo void getFaceInfo
( (
const label faceI, const label faceI,
labelPair& patchIDs, label& patchID,
label& zoneID, label& zoneID,
label& zoneFlip label& zoneFlip
) const; ) const;

View File

@ -61,7 +61,6 @@ public:
} }
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Are two lists identical either in forward or in reverse order. // Are two lists identical either in forward or in reverse order.

View File

@ -80,9 +80,6 @@ class polyModifyFace
//- Face zone flip //- Face zone flip
bool zoneFlip_; bool zoneFlip_;
//- Sub patch ID (for proc patches)
label subPatchID_;
public: public:
@ -105,8 +102,7 @@ public:
patchID_(-1), patchID_(-1),
removeFromZone_(false), removeFromZone_(false),
zoneID_(-1), zoneID_(-1),
zoneFlip_(false), zoneFlip_(false)
subPatchID_(-1)
{} {}
//- Construct from components //- Construct from components
@ -120,8 +116,7 @@ public:
const label patchID, const label patchID,
const bool removeFromZone, const bool removeFromZone,
const label zoneID, const label zoneID,
const bool zoneFlip, const bool zoneFlip
const label subPatchID
) )
: :
face_(f), face_(f),
@ -132,8 +127,7 @@ public:
patchID_(patchID), patchID_(patchID),
removeFromZone_(removeFromZone), removeFromZone_(removeFromZone),
zoneID_(zoneID), zoneID_(zoneID),
zoneFlip_(zoneFlip), zoneFlip_(zoneFlip)
subPatchID_(subPatchID)
{ {
if (face_.size() < 3) if (face_.size() < 3)
{ {
@ -149,8 +143,7 @@ public:
" const label patchID,\n" " const label patchID,\n"
" const bool removeFromZone,\n" " const bool removeFromZone,\n"
" const label zoneID,\n" " const label zoneID,\n"
" const bool zoneFlip,\n" " const bool zoneFlip\n"
" const label subPatchID\n"
")" ")"
) << "Invalid face: less than 3 points. This is not allowed\n" ) << "Invalid face: less than 3 points. This is not allowed\n"
<< "Face: " << face_ << "Face: " << face_
@ -174,8 +167,7 @@ public:
" const label patchID,\n" " const label patchID,\n"
" const bool removeFromZone,\n" " const bool removeFromZone,\n"
" const label zoneID,\n" " const label zoneID,\n"
" const bool zoneFlip,\n" " const bool zoneFlip\n"
" const label subPatchID\n"
")" ")"
) << "Face contains invalid vertex ID: " << face_ << ". " ) << "Face contains invalid vertex ID: " << face_ << ". "
<< "This is not allowed.\n" << "This is not allowed.\n"
@ -199,8 +191,7 @@ public:
" const label patchID,\n" " const label patchID,\n"
" const bool removeFromZone,\n" " const bool removeFromZone,\n"
" const label zoneID,\n" " const label zoneID,\n"
" const bool zoneFlip,\n" " const bool zoneFlip\n"
" const label subPatchID\n"
")" ")"
) << "Face owner and neighbour are identical. " ) << "Face owner and neighbour are identical. "
<< "This is not allowed.\n" << "This is not allowed.\n"
@ -225,8 +216,7 @@ public:
" const label patchID,\n" " const label patchID,\n"
" const bool removeFromZone,\n" " const bool removeFromZone,\n"
" const label zoneID,\n" " const label zoneID,\n"
" const bool zoneFlip,\n" " const bool zoneFlip\n"
" const label subPatchID\n"
")" ")"
) << "Patch face has got a neighbour " ) << "Patch face has got a neighbour "
<< "This is not allowed.\n" << "This is not allowed.\n"
@ -252,8 +242,7 @@ public:
" const label patchID,\n" " const label patchID,\n"
" const bool removeFromZone,\n" " const bool removeFromZone,\n"
" const label zoneID,\n" " const label zoneID,\n"
" const bool zoneFlip,\n" " const bool zoneFlip\n"
" const label subPatchID\n"
")" ")"
) << "Specified zone flip for a face that does not " ) << "Specified zone flip for a face that does not "
<< "belong to zone. This is not allowed.\n" << "belong to zone. This is not allowed.\n"
@ -263,32 +252,6 @@ public:
<< " neighbour:" << neighbour_ << " neighbour:" << neighbour_
<< abort(FatalError); << 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 //- Construct and return a clone
@ -372,12 +335,6 @@ public:
{ {
return zoneFlip_; return zoneFlip_;
} }
//- Boundary sub patch ID
label subPatchID() const
{
return subPatchID_;
}
}; };

View File

@ -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 void Foam::polyTopoChange::reorderCoupledFaces
( (
const bool syncParallel, const bool syncParallel,
@ -2244,6 +2207,7 @@ void Foam::polyTopoChange::addMesh
// Extend // Extend
points_.setCapacity(points_.size() + points.size()); points_.setCapacity(points_.size() + points.size());
pointMap_.setCapacity(pointMap_.size() + points.size()); pointMap_.setCapacity(pointMap_.size() + points.size());
reversePointMap_.setCapacity(reversePointMap_.size() + points.size());
pointZone_.resize(pointZone_.size() + points.size()/100); pointZone_.resize(pointZone_.size() + points.size()/100);
// Precalc offset zones // Precalc offset zones
@ -2283,6 +2247,7 @@ void Foam::polyTopoChange::addMesh
label nAllCells = mesh.nCells(); label nAllCells = mesh.nCells();
cellMap_.setCapacity(cellMap_.size() + nAllCells); cellMap_.setCapacity(cellMap_.size() + nAllCells);
reverseCellMap_.setCapacity(reverseCellMap_.size() + nAllCells);
cellFromPoint_.resize(cellFromPoint_.size() + nAllCells/100); cellFromPoint_.resize(cellFromPoint_.size() + nAllCells/100);
cellFromEdge_.resize(cellFromEdge_.size() + nAllCells/100); cellFromEdge_.resize(cellFromEdge_.size() + nAllCells/100);
cellFromFace_.resize(cellFromFace_.size() + nAllCells/100); cellFromFace_.resize(cellFromFace_.size() + nAllCells/100);
@ -2347,6 +2312,7 @@ void Foam::polyTopoChange::addMesh
faceOwner_.setCapacity(faceOwner_.size() + nAllFaces); faceOwner_.setCapacity(faceOwner_.size() + nAllFaces);
faceNeighbour_.setCapacity(faceNeighbour_.size() + nAllFaces); faceNeighbour_.setCapacity(faceNeighbour_.size() + nAllFaces);
faceMap_.setCapacity(faceMap_.size() + nAllFaces); faceMap_.setCapacity(faceMap_.size() + nAllFaces);
reverseFaceMap_.setCapacity(reverseFaceMap_.size() + nAllFaces);
faceFromPoint_.resize(faceFromPoint_.size() + nAllFaces/100); faceFromPoint_.resize(faceFromPoint_.size() + nAllFaces/100);
faceFromEdge_.resize(faceFromEdge_.size() + nAllFaces/100); faceFromEdge_.resize(faceFromEdge_.size() + nAllFaces/100);
flipFaceFlux_.setCapacity(faces_.size() + nAllFaces); 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) Foam::label Foam::polyTopoChange::setAction(const topoAction& action)
{ {
if (isType<polyAddPoint>(action)) if (isType<polyAddPoint>(action))

View File

@ -50,8 +50,9 @@ Description
To see if point is equal to above value we don't use == (which might give 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 problems with roundoff error) but instead compare the individual component
with >. with >.
- coupled patches: the reorderCoupledFaces routine reorders coupled patch - coupled patches: the reorderCoupledFaces routine (borrowed from
faces and uses the cyclicPolyPatch,processorPolyPatch functionality. the couplePatches utility) reorders coupled patch faces and
uses the cyclicPolyPatch,processorPolyPatch functionality.
SourceFiles SourceFiles
polyTopoChange.C polyTopoChange.C
@ -471,6 +472,15 @@ public:
const labelList& cellZoneMap 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. //- Move all points. Incompatible with other topology changes.
void movePoints(const pointField& newPoints); void movePoints(const pointField& newPoints);

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "polyTopoChange.H" #include "polyTopoChange.H"

View File

@ -745,7 +745,7 @@ Pout<< "refinementHistory::distribute :"
newSplitCells.append(splitCells_[index]); newSplitCells.append(splitCells_[index]);
Pout<< "Added oldCell " << index Pout<< "Added oldCell " << index
<< " info " << newSplitCells[newSplitCells.size()-1] << " info " << newSplitCells.last()
<< " at position " << newSplitCells.size()-1 << " at position " << newSplitCells.size()-1
<< endl; << endl;
} }

View File

@ -342,8 +342,7 @@ void Foam::removeCells::setRefinement
newPatchID[faceI], // patch for face newPatchID[faceI], // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
-1
) )
); );
} }
@ -389,8 +388,7 @@ void Foam::removeCells::setRefinement
newPatchID[faceI], // patch for face newPatchID[faceI], // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
-1
) )
); );
} }
@ -433,8 +431,7 @@ void Foam::removeCells::setRefinement
newPatchID[faceI], // patch for face newPatchID[faceI], // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
-1
) )
); );
} }

View File

@ -330,9 +330,9 @@ void Foam::removeFaces::mergeFaces
own = cellRegionMaster[cellRegion[own]]; own = cellRegionMaster[cellRegion[own]];
} }
labelPair patchIDs; label patchID, zoneID, zoneFlip;
label zoneID, zoneFlip;
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip); getFaceInfo(faceI, patchID, zoneID, zoneFlip);
label nei = -1; label nei = -1;
@ -390,7 +390,7 @@ void Foam::removeFaces::mergeFaces
own, // owner own, // owner
nei, // neighbour nei, // neighbour
false, // face flip false, // face flip
patchIDs, // patch info for face patchID, // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip, // face flip in zone
@ -416,12 +416,18 @@ void Foam::removeFaces::mergeFaces
void Foam::removeFaces::getFaceInfo void Foam::removeFaces::getFaceInfo
( (
const label faceI, const label faceI,
labelPair& patchIDs,
label& patchID,
label& zoneID, label& zoneID,
label& zoneFlip label& zoneFlip
) const ) const
{ {
patchIDs = polyTopoChange::whichPatch(mesh_.boundaryMesh(), faceI); patchID = -1;
if (!mesh_.isInternalFace(faceI))
{
patchID = mesh_.boundaryMesh().whichPatch(faceI);
}
zoneID = mesh_.faceZones().whichZone(faceI); zoneID = mesh_.faceZones().whichZone(faceI);
@ -473,7 +479,7 @@ void Foam::removeFaces::modFace
const label own, const label own,
const label nei, const label nei,
const bool flipFaceFlux, const bool flipFaceFlux,
const labelPair& newPatchIDs, const label newPatchID,
const bool removeFromZone, const bool removeFromZone,
const label zoneID, const label zoneID,
const bool zoneFlip, const bool zoneFlip,
@ -491,7 +497,7 @@ void Foam::removeFaces::modFace
// << " own:" << own // << " own:" << own
// << " nei:" << nei // << " nei:" << nei
// << " flipFaceFlux:" << flipFaceFlux // << " flipFaceFlux:" << flipFaceFlux
// << " newPatchIDs:" << newPatchIDs // << " newPatchID:" << newPatchID
// << " removeFromZone:" << removeFromZone // << " removeFromZone:" << removeFromZone
// << " zoneID:" << zoneID // << " zoneID:" << zoneID
// << " zoneFlip:" << zoneFlip // << " zoneFlip:" << zoneFlip
@ -507,11 +513,10 @@ void Foam::removeFaces::modFace
own, // owner own, // owner
nei, // neighbour nei, // neighbour
flipFaceFlux, // face flip flipFaceFlux, // face flip
newPatchIDs[0], // patch for face newPatchID, // patch for face
removeFromZone, // remove from zone removeFromZone, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
newPatchIDs[1]
) )
); );
} }
@ -525,7 +530,7 @@ void Foam::removeFaces::modFace
// << " own:" << nei // << " own:" << nei
// << " nei:" << own // << " nei:" << own
// << " flipFaceFlux:" << flipFaceFlux // << " flipFaceFlux:" << flipFaceFlux
// << " newPatchIDs:" << newPatchIDs // << " newPatchID:" << newPatchID
// << " removeFromZone:" << removeFromZone // << " removeFromZone:" << removeFromZone
// << " zoneID:" << zoneID // << " zoneID:" << zoneID
// << " zoneFlip:" << zoneFlip // << " zoneFlip:" << zoneFlip
@ -541,11 +546,10 @@ void Foam::removeFaces::modFace
nei, // owner nei, // owner
own, // neighbour own, // neighbour
flipFaceFlux, // face flip flipFaceFlux, // face flip
newPatchIDs[0], // patch for face newPatchID, // patch for face
removeFromZone, // remove from zone removeFromZone, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
newPatchIDs[1]
) )
); );
} }
@ -1461,9 +1465,9 @@ void Foam::removeFaces::setRefinement
own = cellRegionMaster[cellRegion[own]]; own = cellRegionMaster[cellRegion[own]];
} }
labelPair patchIDs; label patchID, zoneID, zoneFlip;
label zoneID, zoneFlip;
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip); getFaceInfo(faceI, patchID, zoneID, zoneFlip);
label nei = -1; label nei = -1;
@ -1494,7 +1498,7 @@ void Foam::removeFaces::setRefinement
own, // owner own, // owner
nei, // neighbour nei, // neighbour
false, // face flip false, // face flip
patchIDs, // patchinfo for face patchID, // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip, // face flip in zone

View File

@ -44,7 +44,6 @@ SourceFiles
#include "Map.H" #include "Map.H"
#include "boolList.H" #include "boolList.H"
#include "indirectPrimitivePatch.H" #include "indirectPrimitivePatch.H"
#include "labelPair.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -132,7 +131,7 @@ class removeFaces
void getFaceInfo void getFaceInfo
( (
const label faceI, const label faceI,
labelPair& patchIDs, label& patchID,
label& zoneID, label& zoneID,
label& zoneFlip label& zoneFlip
) const; ) const;
@ -148,7 +147,7 @@ class removeFaces
const label own, const label own,
const label nei, const label nei,
const bool flipFaceFlux, const bool flipFaceFlux,
const labelPair& newPatchIDs, const label newPatchID,
const bool removeFromZone, const bool removeFromZone,
const label zoneID, const label zoneID,
const bool zoneFlip, const bool zoneFlip,

View File

@ -106,11 +106,7 @@ void Foam::removePoints::modifyFace
) const ) const
{ {
// Get other face data. // Get other face data.
labelPair patchIDs = polyTopoChange::whichPatch label patchI = -1;
(
mesh_.boundaryMesh(),
faceI
);
label owner = mesh_.faceOwner()[faceI]; label owner = mesh_.faceOwner()[faceI];
label neighbour = -1; label neighbour = -1;
@ -118,6 +114,10 @@ void Foam::removePoints::modifyFace
{ {
neighbour = mesh_.faceNeighbour()[faceI]; neighbour = mesh_.faceNeighbour()[faceI];
} }
else
{
patchI = mesh_.boundaryMesh().whichPatch(faceI);
}
label zoneID = mesh_.faceZones().whichZone(faceI); label zoneID = mesh_.faceZones().whichZone(faceI);
@ -139,11 +139,10 @@ void Foam::removePoints::modifyFace
owner, // owner owner, // owner
neighbour, // neighbour neighbour, // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face patchI, // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
patchIDs[1]
) )
); );
} }

View File

@ -132,8 +132,7 @@ void Foam::repatchPolyTopoChanger::changePatchID
patchID, // patch ID patchID, // patch ID
false, // remove from zone false, // remove from zone
zoneID, // zone ID zoneID, // zone ID
zoneFlip, // zone flip zoneFlip // zone flip
-1 //? subPatch TBD.
) )
); );
} }
@ -165,12 +164,6 @@ void Foam::repatchPolyTopoChanger::setFaceZone
} }
} }
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh_.boundaryMesh(),
faceID
);
meshMod().setAction meshMod().setAction
( (
polyModifyFace polyModifyFace
@ -180,11 +173,10 @@ void Foam::repatchPolyTopoChanger::setFaceZone
mesh_.faceOwner()[faceID], // owner mesh_.faceOwner()[faceID], // owner
mesh_.faceNeighbour()[faceID], // neighbour mesh_.faceNeighbour()[faceID], // neighbour
false, // flip flux false, // flip flux
patchIDs[0], // patch ID mesh_.boundaryMesh().whichPatch(faceID), // patch ID
true, // remove from zone true, // remove from zone
zoneID, // zone ID zoneID, // zone ID
zoneFlip, // zone flip zoneFlip // zone flip
patchIDs[1]
) )
); );
} }
@ -231,11 +223,7 @@ void Foam::repatchPolyTopoChanger::changeAnchorPoint
<< abort(FatalError); << abort(FatalError);
} }
labelPair patchIDs = polyTopoChange::whichPatch label patchID = mesh_.boundaryMesh().whichPatch(faceID);
(
mesh_.boundaryMesh(),
faceID
);
const label zoneID = mesh_.faceZones().whichZone(faceID); const label zoneID = mesh_.faceZones().whichZone(faceID);
@ -260,11 +248,10 @@ void Foam::repatchPolyTopoChanger::changeAnchorPoint
mesh_.faceOwner()[faceID], // owner mesh_.faceOwner()[faceID], // owner
-1, // neighbour -1, // neighbour
false, // flip flux false, // flip flux
patchIDs[0], // patch ID patchID, // patch ID
false, // remove from zone false, // remove from zone
zoneID, // zone ID zoneID, // zone ID
zoneFlip, // zone flip zoneFlip // zone flip
patchIDs[1]
) )
); );
} }
@ -296,11 +283,10 @@ void Foam::repatchPolyTopoChanger::changeAnchorPoint
mesh_.faceOwner()[faceID], // owner mesh_.faceOwner()[faceID], // owner
-1, // neighbour -1, // neighbour
false, // flip flux false, // flip flux
patchIDs[0], // patch ID patchID, // patch ID
false, // remove from zone false, // remove from zone
zoneID, // zone ID zoneID, // zone ID
zoneFlip, // zone flip zoneFlip // zone flip
patchIDs[1]
) )
); );
} }

View File

@ -831,8 +831,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
-1, // patch ID -1, // patch ID
false, // remove from zone false, // remove from zone
masterFaceZoneID_.index(), // zone ID masterFaceZoneID_.index(), // zone ID
masterPatchFlip[curMaster], // zone flip masterPatchFlip[curMaster] // zone flip
-1 // subPatch ID
) )
); );
// Pout << "modifying master face. Old master: " << masterPatch[curMaster] << " new face: " << curCutFace.reverseFace() << " own: " << masterFc[curMaster] << " nei: " << slaveFc[curSlave] << endl; // Pout << "modifying master face. Old master: " << masterPatch[curMaster] << " new face: " << curCutFace.reverseFace() << " own: " << masterFc[curMaster] << " nei: " << slaveFc[curSlave] << endl;
@ -853,8 +852,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
-1, // patch ID -1, // patch ID
false, // remove from zone false, // remove from zone
masterFaceZoneID_.index(), // zone ID masterFaceZoneID_.index(), // zone ID
!masterPatchFlip[curMaster], // zone flip !masterPatchFlip[curMaster] // zone flip
-1 // subPatch ID
) )
); );
} }
@ -877,8 +875,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
masterPatchID_.index(), // patch ID masterPatchID_.index(), // patch ID
false, // remove from zone false, // remove from zone
masterFaceZoneID_.index(), // zone ID masterFaceZoneID_.index(), // zone ID
masterPatchFlip[curMaster], // zone flip masterPatchFlip[curMaster] // zone flip
-1 // subPatchID - TBD
) )
); );
} }
@ -925,8 +922,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
-1, // patch ID -1, // patch ID
false, // remove from zone false, // remove from zone
slaveFaceZoneID_.index(), // zone ID slaveFaceZoneID_.index(), // zone ID
!slavePatchFlip[curMaster], // zone flip !slavePatchFlip[curMaster] // zone flip
-1 // subPatch ID
) )
); );
} }
@ -947,8 +943,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
-1, // patch ID -1, // patch ID
false, // remove from zone false, // remove from zone
slaveFaceZoneID_.index(), // zone ID slaveFaceZoneID_.index(), // zone ID
slavePatchFlip[curSlave], // zone flip slavePatchFlip[curSlave] // zone flip
-1 // subPatch ID
) )
); );
} }
@ -971,8 +966,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
slavePatchID_.index(), // patch ID slavePatchID_.index(), // patch ID
false, // remove from zone false, // remove from zone
slaveFaceZoneID_.index(), // zone ID slaveFaceZoneID_.index(), // zone ID
slavePatchFlip[curSlave], // zone flip slavePatchFlip[curSlave] // zone flip
-1 // subPatchID - TBD
) )
); );
} }
@ -1018,8 +1012,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
false, // flux flip false, // flux flip
-1, // patch ID -1, // patch ID
cutFaceZoneID_.index(), // zone ID cutFaceZoneID_.index(), // zone ID
false, // zone flip false // zone flip
-1 // subPatch ID
) )
); );
} }
@ -1039,8 +1032,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
true, // flux flip true, // flux flip
-1, // patch ID -1, // patch ID
cutFaceZoneID_.index(), // zone ID cutFaceZoneID_.index(), // zone ID
true, // zone flip true // zone flip
-1 // subPatch ID
) )
); );
} }
@ -1065,8 +1057,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
false, // flux flip false, // flux flip
masterPatchID_.index(), // patch ID masterPatchID_.index(), // patch ID
cutFaceZoneID_.index(), // zone ID cutFaceZoneID_.index(), // zone ID
false, // zone flip false // zone flip
-1 // subPatchID - TBD
) )
); );
} }
@ -1091,8 +1082,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
false, // flux flip false, // flux flip
slavePatchID_.index(), // patch ID slavePatchID_.index(), // patch ID
cutFaceZoneID_.index(), // zone ID cutFaceZoneID_.index(), // zone ID
false, // zone flip false // zone flip
-1 // subPatchID - TBD
) )
); );
@ -1137,8 +1127,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
// -1, // patch ID // -1, // patch ID
// false, // remove from zone // false, // remove from zone
// masterFaceZoneID_.index(), // zone ID // masterFaceZoneID_.index(), // zone ID
// false, // zone flip // false // zone flip
// -1 // subPatch ID
// ) // )
//); //);
@ -1169,8 +1158,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
// -1, // patch ID // -1, // patch ID
// false, // remove from zone // false, // remove from zone
// slaveFaceZoneID_.index(), // zone ID // slaveFaceZoneID_.index(), // zone ID
// false, // zone flip // false // zone flip
// -1 // subPatch ID
// ) // )
//); //);
@ -1428,12 +1416,6 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
//Pout << "Modifying master stick-out face " << curFaceID //Pout << "Modifying master stick-out face " << curFaceID
// << " old face: " << oldFace << " new face: " << newFace << endl; // << " old face: " << oldFace << " new face: " << newFace << endl;
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
curFaceID
);
// Modify the face // Modify the face
if (mesh.isInternalFace(curFaceID)) if (mesh.isInternalFace(curFaceID))
{ {
@ -1449,8 +1431,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
-1, // patch for face -1, // patch for face
false, // remove from zone false, // remove from zone
modifiedFaceZone, // zone for face modifiedFaceZone, // zone for face
modifiedFaceZoneFlip, // face flip in zone modifiedFaceZoneFlip // face flip in zone
patchIDs[1] // subPatch ID
) )
); );
} }
@ -1468,8 +1449,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
mesh.boundaryMesh().whichPatch(curFaceID), // patch for face mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
false, // remove from zone false, // remove from zone
modifiedFaceZone, // zone for face modifiedFaceZone, // zone for face
modifiedFaceZoneFlip, // face flip in zone modifiedFaceZoneFlip // face flip in zone
patchIDs[1] // subPatch ID
) )
); );
} }
@ -1741,11 +1721,6 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
newFace.transfer(newFaceLabels); newFace.transfer(newFaceLabels);
// Pout << "Modifying slave stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl; // Pout << "Modifying slave stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
curFaceID
);
// Modify the face // Modify the face
if (mesh.isInternalFace(curFaceID)) if (mesh.isInternalFace(curFaceID))
@ -1762,8 +1737,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
-1, // patch for face -1, // patch for face
false, // remove from zone false, // remove from zone
modifiedFaceZone, // zone for face modifiedFaceZone, // zone for face
modifiedFaceZoneFlip, // face flip in zone modifiedFaceZoneFlip // face flip in zone
patchIDs[1] // subPatch ID
) )
); );
} }
@ -1781,8 +1755,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
mesh.boundaryMesh().whichPatch(curFaceID), // patch for face mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
false, // remove from zone false, // remove from zone
modifiedFaceZone, // zone for face modifiedFaceZone, // zone for face
modifiedFaceZoneFlip, // face flip in zone modifiedFaceZoneFlip // face flip in zone
patchIDs[1] // subPatch ID
) )
); );
} }

View File

@ -105,8 +105,7 @@ void Foam::slidingInterface::decoupleInterface
masterPatchID_.index(), // patch ID masterPatchID_.index(), // patch ID
false, // remove from zone false, // remove from zone
masterFaceZoneID_.index(), // zone ID masterFaceZoneID_.index(), // zone ID
false, // zone flip. Face corrected false // zone flip. Face corrected
-1 //?TBD subPatch
) )
); );
// Pout << "Modifying master patch face no " << masterPatchAddr[faceI] << " face: " << faces[masterPatchAddr[faceI]] << " old owner: " << own[masterPatchAddr[faceI]] << " new owner: " << masterFc[faceI] << endl; // Pout << "Modifying master patch face no " << masterPatchAddr[faceI] << " face: " << faces[masterPatchAddr[faceI]] << " old owner: " << own[masterPatchAddr[faceI]] << " new owner: " << masterFc[faceI] << endl;
@ -164,8 +163,7 @@ void Foam::slidingInterface::decoupleInterface
slavePatchID_.index(), // patch ID slavePatchID_.index(), // patch ID
false, // remove from zone false, // remove from zone
slaveFaceZoneID_.index(), // zone ID slaveFaceZoneID_.index(), // zone ID
false, // zone flip. Face corrected false // zone flip. Face corrected
-1 //?TBD subPatch
) )
); );
} }
@ -233,12 +231,6 @@ void Foam::slidingInterface::decoupleInterface
// Pout << "Modifying master stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl; // Pout << "Modifying master stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
curFaceID
);
// Modify the face // Modify the face
ref.setAction ref.setAction
( (
@ -249,11 +241,10 @@ void Foam::slidingInterface::decoupleInterface
own[curFaceID], // owner own[curFaceID], // owner
nei[curFaceID], // neighbour nei[curFaceID], // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
false, // remove from zone false, // remove from zone
modifiedFaceZone, // zone for face modifiedFaceZone, // zone for face
modifiedFaceZoneFlip, // face flip in zone modifiedFaceZoneFlip // face flip in zone
patchIDs[1]
) )
); );
} }
@ -363,12 +354,6 @@ void Foam::slidingInterface::decoupleInterface
// Pout << "Modifying slave stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl; // Pout << "Modifying slave stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
labelPair patchIDs = polyTopoChange::whichPatch
(
mesh.boundaryMesh(),
curFaceID
);
// Modify the face // Modify the face
ref.setAction ref.setAction
( (
@ -379,11 +364,10 @@ void Foam::slidingInterface::decoupleInterface
own[curFaceID], // owner own[curFaceID], // owner
nei[curFaceID], // neighbour nei[curFaceID], // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
false, // remove from zone false, // remove from zone
modifiedFaceZone, // zone for face modifiedFaceZone, // zone for face
modifiedFaceZoneFlip, // face flip in zone modifiedFaceZoneFlip // face flip in zone
patchIDs[1]
) )
); );
} }

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "enrichedPatch.H" #include "enrichedPatch.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "enrichedPatch.H" #include "enrichedPatch.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "enrichedPatch.H" #include "enrichedPatch.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "enrichedPatch.H" #include "enrichedPatch.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "enrichedPatch.H" #include "enrichedPatch.H"

View File

@ -29,6 +29,7 @@ License
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "fvMatrices.H" #include "fvMatrices.H"
#include "syncTools.H"
#include "faceSet.H" #include "faceSet.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "SRFModel.H" #include "SRFModel.H"

View File

@ -42,7 +42,7 @@ Description
Darcy-Forchheimer (@e d and @e f parameters) Darcy-Forchheimer (@e d and @e f parameters)
@f[ @f[
S = - (\mu \, d \, U + \frac{\rho |U|}{2} \, f) U S = - (\mu \, d + \frac{\rho |U|}{2} \, f) U
@f] @f]

View File

@ -110,105 +110,105 @@ coupledFvPatchField<Type>::coupledFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Referred patch functionality // // Referred patch functionality
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
template<class Type> // template<class Type>
void coupledFvPatchField<Type>::patchInternalField // void coupledFvPatchField<Type>::patchInternalField
( // (
Field<Type>& exchangeBuf, // Field<Type>& exchangeBuf,
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start // const label start
) const // ) const
{ // {
if (start+size > referringPatch.size()) // if (start+size > referringPatch.size())
{ // {
FatalErrorIn("coupledFvPatchField<Type>::patchInternalField(..)") // FatalErrorIn("coupledFvPatchField<Type>::patchInternalField(..)")
<< "patch size:" << referringPatch.size() // << "patch size:" << referringPatch.size()
<< " start:" << start << " size:" << size // << " start:" << start << " size:" << size
<< abort(FatalError); // << abort(FatalError);
} // }
//
const unallocLabelList& faceCells = referringPatch.faceCells(); // const unallocLabelList& faceCells = referringPatch.faceCells();
//
exchangeBuf.setSize(this->size()); // exchangeBuf.setSize(this->size());
//
label facei = start; // label facei = start;
forAll(exchangeBuf, i) // forAll(exchangeBuf, i)
{ // {
exchangeBuf[i] = this->internalField()[faceCells[facei++]]; // exchangeBuf[i] = this->internalField()[faceCells[facei++]];
} // }
} // }
//
//
template<class Type> // template<class Type>
tmp<Field<Type> > coupledFvPatchField<Type>::valueInternalCoeffs // tmp<Field<Type> > coupledFvPatchField<Type>::valueInternalCoeffs
( // (
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start, // const label start,
const tmp<scalarField>& w // const tmp<scalarField>& w
) const // ) const
{ // {
// ? check what is passed in! // // ? check what is passed in!
if (w().size() != size) // if (w().size() != size)
{ // {
FatalErrorIn("coupledFvPatchField<Type>::valueInternalCoeffs(..)") // FatalErrorIn("coupledFvPatchField<Type>::valueInternalCoeffs(..)")
<< "Call with correct slice size." << abort(FatalError); // << "Call with correct slice size." << abort(FatalError);
} // }
return Type(pTraits<Type>::one)*w; // return Type(pTraits<Type>::one)*w;
} // }
//
//
template<class Type> // template<class Type>
tmp<Field<Type> > coupledFvPatchField<Type>::valueBoundaryCoeffs // tmp<Field<Type> > coupledFvPatchField<Type>::valueBoundaryCoeffs
( // (
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start, // const label start,
const tmp<scalarField>& w // const tmp<scalarField>& w
) const // ) const
{ // {
// ? check what is passed in! // // ? check what is passed in!
if (w().size() != size) // if (w().size() != size)
{ // {
FatalErrorIn("coupledFvPatchField<Type>::valueBoundaryCoeffs(..)") // FatalErrorIn("coupledFvPatchField<Type>::valueBoundaryCoeffs(..)")
<< "Call with correct slice size." << abort(FatalError); // << "Call with correct slice size." << abort(FatalError);
} // }
return Type(pTraits<Type>::one)*(1.0 - w); // return Type(pTraits<Type>::one)*(1.0 - w);
} // }
//
//
template<class Type> // template<class Type>
tmp<Field<Type> > coupledFvPatchField<Type>::gradientInternalCoeffs // tmp<Field<Type> > coupledFvPatchField<Type>::gradientInternalCoeffs
( // (
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start // const label start
) const // ) const
{ // {
SubField<scalar> subDc(referringPatch.deltaCoeffs(), size, start); // SubField<scalar> subDc(referringPatch.deltaCoeffs(), size, start);
//
return -Type(pTraits<Type>::one)*subDc; // return -Type(pTraits<Type>::one)*subDc;
} // }
//
//
template<class Type> // template<class Type>
tmp<Field<Type> > coupledFvPatchField<Type>::gradientBoundaryCoeffs // tmp<Field<Type> > coupledFvPatchField<Type>::gradientBoundaryCoeffs
( // (
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start // const label start
) const // ) const
{ // {
return -this->gradientInternalCoeffs // return -this->gradientInternalCoeffs
( // (
referringPatch, // referringPatch,
size, // size,
start // start
); // );
} // }
// Local patch functionality // Local patch functionality
@ -218,10 +218,7 @@ template<class Type>
tmp<Field<Type> > coupledFvPatchField<Type>::snGrad() const tmp<Field<Type> > coupledFvPatchField<Type>::snGrad() const
{ {
return return
( (this->patchNeighbourField() - this->patchInternalField())
this->patchNeighbourField()
- this->fvPatchField<Type>::patchInternalField()
)
*this->patch().deltaCoeffs(); *this->patch().deltaCoeffs();
} }
@ -246,14 +243,8 @@ void coupledFvPatchField<Type>::evaluate(const Pstream::commsTypes)
Field<Type>::operator= Field<Type>::operator=
( (
( this->patch().weights()*this->patchInternalField()
this->patch().weights() + (1.0 - this->patch().weights())*this->patchNeighbourField()
* this->fvPatchField<Type>::patchInternalField()
)
+ (
(1.0 - this->patch().weights())
* this->patchNeighbourField()
)
); );
fvPatchField<Type>::evaluate(); fvPatchField<Type>::evaluate();

View File

@ -121,122 +121,122 @@ public:
// Member functions // Member functions
//
// Referred-patch functionality. Get called with a slice (size, start) // // Referred-patch functionality. Get called with a slice (size, start)
// of a patch that supplies fields and geometry/topology. // // of a patch that supplies fields and geometry/topology.
//
// Evaluation functions // // Evaluation functions
//
//- Return internal field next to patch as patch field // //- Return internal field next to patch as patch field
virtual void patchInternalField // virtual void patchInternalField
( // (
Field<Type>& exchangeBuf, // Field<Type>& exchangeBuf,
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start // const label start
) const; // ) const;
//
//- Get patch-normal gradient // //- Get patch-normal gradient
virtual void snGrad // virtual void snGrad
( // (
Field<Type>& exchangeBuf, // Field<Type>& exchangeBuf,
const Field<Type>& subFld, // const Field<Type>& subFld,
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start // const label start
) const = 0; // ) const = 0;
//
//- Initialise the evaluation of the patch field. // //- Initialise the evaluation of the patch field.
virtual void initEvaluate // virtual void initEvaluate
( // (
Field<Type>& exchangeBuf, // Field<Type>& exchangeBuf,
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start // const label start
) const = 0; // ) const = 0;
//
//- Evaluate the patch field. // //- Evaluate the patch field.
virtual void evaluate // virtual void evaluate
( // (
Field<Type>& exchangeBuf, // Field<Type>& exchangeBuf,
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start // const label start
) const = 0; // ) const = 0;
//
//- Return the matrix diagonal coefficients corresponding to the // //- Return the matrix diagonal coefficients corresponding to the
// evaluation of the value of this patchField with given weights // // evaluation of the value of this patchField with given weights
virtual tmp<Field<Type> > valueInternalCoeffs // virtual tmp<Field<Type> > valueInternalCoeffs
( // (
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start, // const label start,
const tmp<scalarField>& // const tmp<scalarField>&
) const; // ) const;
//
//- Return the matrix source coefficients corresponding to the // //- Return the matrix source coefficients corresponding to the
// evaluation of the value of this patchField with given weights // // evaluation of the value of this patchField with given weights
virtual tmp<Field<Type> > valueBoundaryCoeffs // virtual tmp<Field<Type> > valueBoundaryCoeffs
( // (
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start, // const label start,
const tmp<scalarField>& // const tmp<scalarField>&
) const; // ) const;
//
//- Return the matrix diagonal coefficients corresponding to the // //- Return the matrix diagonal coefficients corresponding to the
// evaluation of the gradient of this patchField // // evaluation of the gradient of this patchField
virtual tmp<Field<Type> > gradientInternalCoeffs // virtual tmp<Field<Type> > gradientInternalCoeffs
( // (
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start // const label start
) const; // ) const;
//
//- Return the matrix source coefficients corresponding to the // //- Return the matrix source coefficients corresponding to the
// evaluation of the gradient of this patchField // // evaluation of the gradient of this patchField
virtual tmp<Field<Type> > gradientBoundaryCoeffs // virtual tmp<Field<Type> > gradientBoundaryCoeffs
( // (
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start // const label start
) const; // ) const;
//
//
// Coupled interface functionality // // Coupled interface functionality
//
//- Initialise neighbour matrix update // //- Initialise neighbour matrix update
virtual void initInterfaceMatrixUpdate // virtual void initInterfaceMatrixUpdate
( // (
const scalarField& psiInternal, // const scalarField& psiInternal,
scalarField& result, // scalarField& result,
const lduMatrix& m, // const lduMatrix& m,
const scalarField& coeffs, // const scalarField& coeffs,
const direction cmpt, // const direction cmpt,
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start, // const label start,
scalarField& exchangeBuf // scalarField& exchangeBuf
) const = 0; // ) const = 0;
//
//- Update result field based on interface functionality // //- Update result field based on interface functionality
virtual void updateInterfaceMatrix // virtual void updateInterfaceMatrix
( // (
const scalarField& psiInternal, // const scalarField& psiInternal,
scalarField& result, // scalarField& result,
const lduMatrix&, // const lduMatrix&,
const scalarField& coeffs, // const scalarField& coeffs,
const direction, // const direction,
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start, // const label start,
scalarField& exchangeBuf // scalarField& exchangeBuf
) const = 0; // ) const = 0;
//
//- Write // //- Write
//?virtual void write(Ostream&) const; // //?virtual void write(Ostream&) const;
//XXXX ////XXXX
//
// Access // Access

View File

@ -55,7 +55,7 @@ slicedFvPatchField<Type>::slicedFvPatchField
const DimensionedField<Type, volMesh>& iF const DimensionedField<Type, volMesh>& iF
) )
: :
fvPatchField<Type>(p, iF) fvPatchField<Type>(p, iF, Field<Type>())
{} {}

View File

@ -143,200 +143,200 @@ cyclicFvPatchField<Type>::cyclicFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Referred patch functionality // // Referred patch functionality
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
template<class Type> // template<class Type>
void cyclicFvPatchField<Type>::snGrad // void cyclicFvPatchField<Type>::snGrad
( // (
Field<Type>& exchangeBuf, // Field<Type>& exchangeBuf,
const Field<Type>& subFld, // const Field<Type>& subFld,
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start // const label start
) const // ) const
{
if (subFld.size() != size)
{
FatalErrorIn("cyclicFvPatchField<Type>::snGrad(..)")
<< "Call with correct slice size." << abort(FatalError);
}
// Slice delta coeffs
SubField<scalar> subDc(referringPatch.deltaCoeffs(), size, start);
// Get internal field
tmp<Field<Type> > patchFld(new Field<Type>(size));
this->patchInternalField(patchFld(), referringPatch, size, start);
exchangeBuf = subDc * (subFld - patchFld);
}
template<class Type>
void cyclicFvPatchField<Type>::initEvaluate
(
Field<Type>& exchangeBuf,
const coupledFvPatch& referringPatch,
const label size,
const label start
) const
{
//? What about updateCoeffs? What if patch holds face-wise additional
// information? Where is it stored? Who updates it?
// if (!this->updated())
// { // {
// this->updateCoeffs(); // if (subFld.size() != size)
// }
if (exchangeBuf.size() != size)
{
FatalErrorIn("cyclicFvPatchField<Type>::initEvaluate(..)")
<< "Call with correct slice size." << abort(FatalError);
}
// Get sender side. Equivalent to (1-w)*patchNeighbourField() in non-remote
// version (so includes the transformation!).
//Pout<< "initEvaluate name:" << cyclicPatch_.name()
// << " size:" << size << " start:" << start
// << " referringPatch.weights():" << referringPatch.weights() << endl;
const SubField<scalar> subWeights
(
referringPatch.weights(),
size,
start
);
tmp<Field<Type> > patchFld(new Field<Type>(size));
this->patchInternalField(patchFld(), referringPatch, size, start);
//Pout<< "initEvaluate name:" << cyclicPatch_.name()
// << " patchFld:" << patchFld()
// << " subWeights:" << subWeights << endl;
if (doTransform())
{
//Pout<< "initEvaluate name:" << cyclicPatch_.name()
// << " reverseT:" << reverseT() << endl;
tmp<Field<Type> > tfld =
(1.0-subWeights)
* transform(reverseT(), patchFld);
forAll(tfld(), i)
{
exchangeBuf[i] = tfld()[i];
}
//Pout<< "initEvaluate name:" << cyclicPatch_.name()
// << " exchangeBuf:" << exchangeBuf << endl;
}
else
{
//Pout<< "initEvaluate name:" << cyclicPatch_.name()
// << " no transform" << endl;
tmp<Field<Type> > tfld = (1.0-subWeights)*patchFld;
forAll(tfld(), i)
{
exchangeBuf[i] = tfld()[i];
}
//Pout<< "initEvaluate name:" << cyclicPatch_.name()
// << " exchangeBuf:" << exchangeBuf << endl;
}
}
template<class Type>
void cyclicFvPatchField<Type>::evaluate
(
Field<Type>& exchangeBuf,
const coupledFvPatch& referringPatch,
const label size,
const label start
) const
{
// if (!this->updated())
// { // {
// this->updateCoeffs(); // FatalErrorIn("cyclicFvPatchField<Type>::snGrad(..)")
// << "Call with correct slice size." << abort(FatalError);
// }
//
// // Slice delta coeffs
// SubField<scalar> subDc(referringPatch.deltaCoeffs(), size, start);
//
// // Get internal field
// tmp<Field<Type> > patchFld(new Field<Type>(size));
// this->patchInternalField(patchFld(), referringPatch, size, start);
//
// exchangeBuf = subDc * (subFld - patchFld);
// }
//
//
// template<class Type>
// void cyclicFvPatchField<Type>::initEvaluate
// (
// Field<Type>& exchangeBuf,
// const coupledFvPatch& referringPatch,
// const label size,
// const label start
// ) const
// {
// //? What about updateCoeffs? What if patch holds face-wise additional
// // information? Where is it stored? Who updates it?
// // if (!this->updated())
// // {
// // this->updateCoeffs();
// // }
//
// if (exchangeBuf.size() != size)
// {
// FatalErrorIn("cyclicFvPatchField<Type>::initEvaluate(..)")
// << "Call with correct slice size." << abort(FatalError);
// }
//
// // Get sender side. Equivalent to (1-w)*patchNeighbourField() in non-remote
// // version (so includes the transformation!).
//
// //Pout<< "initEvaluate name:" << cyclicPatch_.name()
// // << " size:" << size << " start:" << start
// // << " referringPatch.weights():" << referringPatch.weights() << endl;
//
// const SubField<scalar> subWeights
// (
// referringPatch.weights(),
// size,
// start
// );
//
// tmp<Field<Type> > patchFld(new Field<Type>(size));
// this->patchInternalField(patchFld(), referringPatch, size, start);
//
// //Pout<< "initEvaluate name:" << cyclicPatch_.name()
// // << " patchFld:" << patchFld()
// // << " subWeights:" << subWeights << endl;
//
// if (doTransform())
// {
// //Pout<< "initEvaluate name:" << cyclicPatch_.name()
// // << " reverseT:" << reverseT() << endl;
// tmp<Field<Type> > tfld =
// (1.0-subWeights)
// * transform(reverseT(), patchFld);
//
// forAll(tfld(), i)
// {
// exchangeBuf[i] = tfld()[i];
// }
// //Pout<< "initEvaluate name:" << cyclicPatch_.name()
// // << " exchangeBuf:" << exchangeBuf << endl;
// }
// else
// {
// //Pout<< "initEvaluate name:" << cyclicPatch_.name()
// // << " no transform" << endl;
// tmp<Field<Type> > tfld = (1.0-subWeights)*patchFld;
//
// forAll(tfld(), i)
// {
// exchangeBuf[i] = tfld()[i];
// }
// //Pout<< "initEvaluate name:" << cyclicPatch_.name()
// // << " exchangeBuf:" << exchangeBuf << endl;
// }
// }
//
//
// template<class Type>
// void cyclicFvPatchField<Type>::evaluate
// (
// Field<Type>& exchangeBuf,
// const coupledFvPatch& referringPatch,
// const label size,
// const label start
// ) const
// {
// // if (!this->updated())
// // {
// // this->updateCoeffs();
// // }
//
// if (exchangeBuf.size() != size)
// {
// FatalErrorIn("cyclicFvPatchField<Type>::evaluate(..)")
// << "Call with correct slice size." << abort(FatalError);
// }
//
// const SubField<scalar> subWeights
// (
// referringPatch.weights(),
// size,
// start
// );
//
// tmp<Field<Type> > patchFld(new Field<Type>(size));
// this->patchInternalField(patchFld(), referringPatch, size, start);
//
// exchangeBuf += subWeights * patchFld;
//
// //?? fvPatchField<Type>::evaluate();
// }
//
//
// template<class Type>
// void cyclicFvPatchField<Type>::initInterfaceMatrixUpdate
// (
// const scalarField& psiInternal,
// scalarField& result,
// const lduMatrix&,
// const scalarField& coeffs,
// const direction,
// const coupledFvPatch& referringPatch,
// const label size,
// const label start,
// scalarField& exchangeBuf
// ) const
// {
// const unallocLabelList& faceCells = referringPatch.faceCells();
//
// label facei = start;
//
// forAll(exchangeBuf, elemI)
// {
// exchangeBuf[elemI] = psiInternal[faceCells[facei++]];
// }
// }
//
//
// template<class Type>
// void cyclicFvPatchField<Type>::updateInterfaceMatrix
// (
// const scalarField& psiInternal,
// scalarField& result,
// const lduMatrix&,
// const scalarField& coeffs,
// const direction cmpt,
// const coupledFvPatch& referringPatch,
// const label size,
// const label start,
// scalarField& exchangeBuf
// ) const
// {
// // Transform according to the transformation tensor
// transformCoupleField(exchangeBuf, cmpt);
//
// // Multiply the field by coefficients and add into the result
//
// const unallocLabelList& faceCells = referringPatch.faceCells();
//
// label facei = start;
//
// forAll(exchangeBuf, elemI)
// {
// result[faceCells[facei]] -= coeffs[facei]*exchangeBuf[elemI];
// facei++;
// }
// } // }
if (exchangeBuf.size() != size)
{
FatalErrorIn("cyclicFvPatchField<Type>::evaluate(..)")
<< "Call with correct slice size." << abort(FatalError);
}
const SubField<scalar> subWeights
(
referringPatch.weights(),
size,
start
);
tmp<Field<Type> > patchFld(new Field<Type>(size));
this->patchInternalField(patchFld(), referringPatch, size, start);
exchangeBuf += subWeights * patchFld;
//?? fvPatchField<Type>::evaluate();
}
template<class Type>
void cyclicFvPatchField<Type>::initInterfaceMatrixUpdate
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix&,
const scalarField& coeffs,
const direction,
const coupledFvPatch& referringPatch,
const label size,
const label start,
scalarField& exchangeBuf
) const
{
const unallocLabelList& faceCells = referringPatch.faceCells();
label facei = start;
forAll(exchangeBuf, elemI)
{
exchangeBuf[elemI] = psiInternal[faceCells[facei++]];
}
}
template<class Type>
void cyclicFvPatchField<Type>::updateInterfaceMatrix
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix&,
const scalarField& coeffs,
const direction cmpt,
const coupledFvPatch& referringPatch,
const label size,
const label start,
scalarField& exchangeBuf
) const
{
// Transform according to the transformation tensor
transformCoupleField(exchangeBuf, cmpt);
// Multiply the field by coefficients and add into the result
const unallocLabelList& faceCells = referringPatch.faceCells();
label facei = start;
forAll(exchangeBuf, elemI)
{
result[faceCells[facei]] -= coeffs[facei]*exchangeBuf[elemI];
facei++;
}
}
// Local patch functionality // Local patch functionality

View File

@ -151,64 +151,64 @@ public:
// Evaluation functions // Evaluation functions
// Referred-patch functionality. Get called with a slice (size, start) // // Referred-patch functionality. Get called with a slice (size, start)
// of a patch that supplies fields and geometry/topology. // // of a patch that supplies fields and geometry/topology.
//
//- Get patch-normal gradient // //- Get patch-normal gradient
virtual void snGrad // virtual void snGrad
( // (
Field<Type>& exchangeBuf, // Field<Type>& exchangeBuf,
const Field<Type>& subFld, // const Field<Type>& subFld,
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start // const label start
) const; // ) const;
//
//- Initialise the evaluation of the patch field. // //- Initialise the evaluation of the patch field.
virtual void initEvaluate // virtual void initEvaluate
( // (
Field<Type>& exchangeBuf, // Field<Type>& exchangeBuf,
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start // const label start
) const; // ) const;
//
//- Evaluate the patch field. // //- Evaluate the patch field.
virtual void evaluate // virtual void evaluate
( // (
Field<Type>& exchangeBuf, // Field<Type>& exchangeBuf,
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start // const label start
) const; // ) const;
//
//- Initialise neighbour matrix update // //- Initialise neighbour matrix update
virtual void initInterfaceMatrixUpdate // virtual void initInterfaceMatrixUpdate
( // (
const scalarField& psiInternal, // const scalarField& psiInternal,
scalarField& result, // scalarField& result,
const lduMatrix& m, // const lduMatrix& m,
const scalarField& coeffs, // const scalarField& coeffs,
const direction cmpt, // const direction cmpt,
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start, // const label start,
scalarField& exchangeBuf // scalarField& exchangeBuf
) const; // ) const;
//
//- Update result field based on interface functionality // //- Update result field based on interface functionality
virtual void updateInterfaceMatrix // virtual void updateInterfaceMatrix
( // (
const scalarField& psiInternal, // const scalarField& psiInternal,
scalarField& result, // scalarField& result,
const lduMatrix&, // const lduMatrix&,
const scalarField& coeffs, // const scalarField& coeffs,
const direction, // const direction,
const coupledFvPatch& referringPatch, // const coupledFvPatch& referringPatch,
const label size, // const label size,
const label start, // const label start,
scalarField& exchangeBuf // scalarField& exchangeBuf
) const; // ) const;
//- Return neighbour coupled given internal cell data //- Return neighbour coupled given internal cell data

View File

@ -28,41 +28,12 @@ License
#include "processorFvPatch.H" #include "processorFvPatch.H"
#include "demandDrivenData.H" #include "demandDrivenData.H"
#include "transformField.H" #include "transformField.H"
#include "diagTensorField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
const coupledFvPatchField<Type>& processorFvPatchField<Type>::patchField
(
const label patchID
) const
{
//const GeometricField<Type, fvPatchField, volMesh>& field =
//this->db().objectRegistry::
//lookupObject<GeometricField<Type, fvPatchField, volMesh> >
//(
// this->dimensionedInternalField().name()
//);
const GeometricField<Type, fvPatchField, volMesh>& field =
static_cast
<
const GeometricField<Type, fvPatchField, volMesh>&
>(this->dimensionedInternalField());
return refCast<const coupledFvPatchField<Type> >
(
field.boundaryField()[patchID]
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type> template<class Type>
@ -204,52 +175,7 @@ void processorFvPatchField<Type>::initEvaluate
{ {
if (Pstream::parRun()) if (Pstream::parRun())
{ {
const processorPolyPatch& pp = procPatch_.procPolyPatch(); procPatch_.compressedSend(commsType, this->patchInternalField()());
// Get reference to proc patch built-in buffer
List<Type>& sendBuf = procPatch_.setSendBuf<Type>(this->size());
forAll(pp.patchIDs(), i)
{
SubField<Type> subSendFld(pp.subSlice(sendBuf, i));
Field<Type>& subFld = static_cast<Field<Type>&>
(
static_cast<UList<Type>&>(subSendFld)
);
label patchI = pp.patchIDs()[i];
//Pout<< "initEvaluate on "
// << this->dimensionedInternalField().name()
// << " patch:" << pp.name()
// << " subSize:" << (pp.starts()[i+1]-pp.starts()[i])
// << " subStart:" << pp.starts()[i]
// << " subPatch:" << patchI << endl;
if (patchI == -1)
{
// Assign internal field
this->patchInternalField
(
subFld,
procPatch_,
subSendFld.size(),
pp.starts()[i]
);
}
else
{
// Assign evaluation of referred patch
patchField(patchI).initEvaluate
(
subFld,
procPatch_,
subSendFld.size(),
pp.starts()[i]
);
}
}
procPatch_.compressedBufferSend<Type>(commsType);
} }
} }
@ -264,39 +190,9 @@ void processorFvPatchField<Type>::evaluate
{ {
procPatch_.compressedReceive<Type>(commsType, *this); procPatch_.compressedReceive<Type>(commsType, *this);
const processorPolyPatch& pp = procPatch_.procPolyPatch(); if (doTransform())
forAll(pp.patchIDs(), i)
{ {
label patchI = pp.patchIDs()[i]; transform(*this, procPatch_.forwardT(), *this);
//Pout<< "evaluate on " << this->dimensionedInternalField().name()
// << " patch:" << pp.name()
// << " subSize:" << (pp.starts()[i+1]-pp.starts()[i])
// << " subStart:" << pp.starts()[i]
// << " subPatch:" << patchI << endl;
if (patchI == -1)
{
// No evaluation needed.
}
else
{
SubField<Type> subRecvFld(pp.subSlice(*this, i));
Field<Type>& subFld = static_cast<Field<Type>&>
(
static_cast<UList<Type>&>(subRecvFld)
);
patchField(patchI).evaluate
(
subFld,
procPatch_,
subRecvFld.size(),
pp.starts()[i]
);
}
} }
} }
} }
@ -305,58 +201,7 @@ void processorFvPatchField<Type>::evaluate
template<class Type> template<class Type>
tmp<Field<Type> > processorFvPatchField<Type>::snGrad() const tmp<Field<Type> > processorFvPatchField<Type>::snGrad() const
{ {
tmp<Field<Type> > tpnf(new Field<Type>(this->size())); return this->patch().deltaCoeffs()*(*this - this->patchInternalField());
Field<Type>& pnf = tpnf();
const processorPolyPatch& pp = procPatch_.procPolyPatch();
forAll(pp.patchIDs(), i)
{
label patchI = pp.patchIDs()[i];
label subStart = pp.starts()[i];
label subSize = pp.starts()[i+1] - pp.starts()[i];
const SubField<Type> subThis(pp.subSlice(*this, i));
SubField<Type> subPnf(pp.subSlice(pnf, i));
Field<Type>& subFld = static_cast<Field<Type>&>
(
static_cast<UList<Type>&>(subPnf)
);
//Pout<< "snGrad on " << this->dimensionedInternalField().name()
// << " patch:" << pp.name()
// << " subSize:" << (pp.starts()[i+1]-pp.starts()[i])
// << " subStart:" << pp.starts()[i]
// << " subPatch:" << patchI << endl;
if (patchI == -1)
{
// Slice delta coeffs
const SubField<scalar> subDc
(
pp.subSlice(procPatch_.deltaCoeffs(), i)
);
tmp<Field<Type> > subInt(new Field<Type>(subSize));
this->patchInternalField(subInt(), procPatch_, subSize, subStart);
subFld = (subDc*(subThis-subInt))();
}
else
{
patchField(patchI).snGrad
(
subFld,
subThis,
procPatch_,
subSize,
subStart
);
}
}
return tpnf;
} }
@ -364,179 +209,49 @@ template<class Type>
void processorFvPatchField<Type>::initInterfaceMatrixUpdate void processorFvPatchField<Type>::initInterfaceMatrixUpdate
( (
const scalarField& psiInternal, const scalarField& psiInternal,
scalarField& result, scalarField&,
const lduMatrix& m, const lduMatrix&,
const scalarField& coeffs, const scalarField&,
const direction cmpt, const direction,
const Pstream::commsTypes commsType const Pstream::commsTypes commsType
) const ) const
{ {
// Get reference to proc patch built-in buffer procPatch_.compressedSend
List<scalar>& sendFld = procPatch_.setSendBuf<scalar>(this->size());
const processorPolyPatch& pp = procPatch_.procPolyPatch();
forAll(pp.patchIDs(), i)
{
label subStart = pp.starts()[i];
label subSize = pp.starts()[i+1] - pp.starts()[i];
SubField<scalar> subSendFld(sendFld, subSize, subStart);
Field<scalar>& subFld = static_cast<Field<scalar>&>
( (
static_cast<UList<scalar>&>(subSendFld) commsType,
this->patch().patchInternalField(psiInternal)()
); );
label patchI = pp.patchIDs()[i];
//Pout<< "initInterfaceMatrixUpdate on "
// << this->dimensionedInternalField().name()
// << " patch:" << pp.name()
// << " subSize:" << (pp.starts()[i+1]-pp.starts()[i])
// << " subStart:" << pp.starts()[i]
// << " subPatch:" << patchI << endl;
if (patchI == -1)
{
const unallocLabelList& faceCells = pp.faceCells();
label facei = subStart;
forAll(subFld, i)
{
subFld[i] = psiInternal[faceCells[facei++]];
}
}
else
{
patchField(patchI).initInterfaceMatrixUpdate
(
psiInternal,
result,
m,
coeffs,
cmpt,
procPatch_,
subSize,
subStart,
subFld
);
}
}
procPatch_.compressedBufferSend<scalar>(commsType);
} }
template<class Type> template<class Type>
void processorFvPatchField<Type>::updateInterfaceMatrix void processorFvPatchField<Type>::updateInterfaceMatrix
( (
const scalarField& psiInternal, const scalarField&,
scalarField& result, scalarField& result,
const lduMatrix& m, const lduMatrix&,
const scalarField& coeffs, const scalarField& coeffs,
const direction cmpt, const direction cmpt,
const Pstream::commsTypes commsType const Pstream::commsTypes commsType
) const ) const
{ {
const List<scalar>& recvFld = procPatch_.compressedBufferReceive<scalar> scalarField pnf
( (
commsType, procPatch_.compressedReceive<scalar>(commsType, this->size())()
this->size()
); );
const processorPolyPatch& pp = procPatch_.procPolyPatch(); // Transform according to the transformation tensor
transformCoupleField(pnf, cmpt);
forAll(pp.patchIDs(), i) // Multiply the field by coefficients and add into the result
const unallocLabelList& faceCells = this->patch().faceCells();
forAll(faceCells, elemI)
{ {
label subStart = pp.starts()[i]; result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
label subSize = pp.starts()[i+1] - pp.starts()[i];
SubField<scalar> subRecvFld(recvFld, subSize, subStart);
Field<scalar>& subFld = static_cast<Field<scalar>&>
(
static_cast<UList<scalar>&>(subRecvFld)
);
label patchI = pp.patchIDs()[i];
//Pout<< "updateInterfaceMatrix on "
// << this->dimensionedInternalField().name()
// << " patch:" << pp.name()
// << " subSize:" << (pp.starts()[i+1]-pp.starts()[i])
// << " subStart:" << pp.starts()[i]
// << " subPatch:" << patchI << endl;
if (patchI == -1)
{
const unallocLabelList& faceCells = pp.faceCells();
label facei = subStart;
forAll(subFld, elemI)
{
result[faceCells[facei]] -= coeffs[facei]*subFld[elemI];
facei++;
} }
} }
else
{
patchField(patchI).updateInterfaceMatrix
(
psiInternal,
result,
m,
coeffs,
cmpt,
procPatch_,
subSize,
subStart,
subFld
);
}
}
}
//template<class Type>
//void Foam::processorFvPatchField<Type>::transformCoupleField
//(
// scalarField& f,
// const direction cmpt
//) const
//{
// if (pTraits<Type>::rank > 0)
// {
// const processorPolyPatch& pp = procPatch_.procPolyPatch();
//
// forAll(pp.patchIDs(), i)
// {
// label patchI = pp.patchIDs()[i];
//
// if (patchI == -1)
// {
// // ? anything needs to be transformed?
// }
// else
// {
// const coupledPolyPatch& cpp =
// refCast<const coupledPolyPatch>(pp.boundaryMesh()[patchI]);
//
// if (!cpp.parallel())
// {
// const tensor& T = cpp.forwardT();
//
// SubField<scalar> subFld(pp.subSlice(f, i));
// const scalarField& fld =
// static_cast<const scalarField&>(subFld);
//
// const_cast<scalarField&>(fld) *=
// pow(diag(T).component(cmpt), rank());
// }
// }
// }
// }
//}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -60,10 +60,7 @@ class processorFvPatchField
//- Local reference cast into the processor patch //- Local reference cast into the processor patch
const processorFvPatch& procPatch_; const processorFvPatch& procPatch_;
// Private Member Functions
//- Get other patchfield
const coupledFvPatchField<Type>& patchField(const label patchID) const;
public: public:
//- Runtime type information //- Runtime type information
@ -209,100 +206,23 @@ public:
return procPatch_.neighbProcNo(); return procPatch_.neighbProcNo();
} }
//- Does the patch field perform the transfromation
virtual bool doTransform() const
{
return !(procPatch_.parallel() || pTraits<Type>::rank == 0);
}
//- Return face transformation tensor
virtual const tensor& forwardT() const
{
return procPatch_.forwardT();
}
//- Return rank of component for transform //- Return rank of component for transform
virtual int rank() const virtual int rank() const
{ {
return pTraits<Type>::rank; return pTraits<Type>::rank;
} }
// //- Transform given patch component field
// void transformCoupleField
// (
// scalarField& f,
// const direction cmpt
// ) const;
// Referred-patch functionality. Get called with a slice (size, start)
// of a patch that supplies fields and geometry/topology.
//- Get patch-normal gradient
virtual void snGrad
(
Field<Type>& exchangeBuf,
const Field<Type>& subFld,
const coupledFvPatch& referringPatch,
const label size,
const label start
) const
{
notImplemented("processorFvPatchField::snGrad(..)");
}
//- Initialise the evaluation of the patch field.
virtual void initEvaluate
(
Field<Type>& exchangeBuf,
const coupledFvPatch& referringPatch,
const label size,
const label start
) const
{
notImplemented("processorFvPatchField::initEvaluate(..)");
}
//- Evaluate the patch field.
virtual void evaluate
(
Field<Type>& exchangeBuf,
const coupledFvPatch& referringPatch,
const label size,
const label start
) const
{
notImplemented("processorFvPatchField::evaluate(..)");
}
//- Initialise neighbour matrix update
virtual void initInterfaceMatrixUpdate
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix& m,
const scalarField& coeffs,
const direction cmpt,
const coupledFvPatch& referringPatch,
const label size,
const label start,
scalarField& exchangeBuf
) const
{
notImplemented
(
"processorFvPatchField::initInterfaceMatrixUpdate(..)"
);
}
//- Update result field based on interface functionality
virtual void updateInterfaceMatrix
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix&,
const scalarField& coeffs,
const direction,
const coupledFvPatch& referringPatch,
const label size,
const label start,
scalarField& exchangeBuf
) const
{
notImplemented
(
"processorFvPatchField::updateInterfaceMatrix(..)"
);
}
}; };

View File

@ -0,0 +1,546 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "processorFvPatchField.H"
#include "processorFvPatch.H"
#include "demandDrivenData.H"
#include "transformField.H"
#include "diagTensorField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
const coupledFvPatchField<Type>& processorFvPatchField<Type>::patchField
(
const label patchID
) const
{
//const GeometricField<Type, fvPatchField, volMesh>& field =
//this->db().objectRegistry::
//lookupObject<GeometricField<Type, fvPatchField, volMesh> >
//(
// this->dimensionedInternalField().name()
//);
const GeometricField<Type, fvPatchField, volMesh>& field =
static_cast
<
const GeometricField<Type, fvPatchField, volMesh>&
>(this->dimensionedInternalField());
return refCast<const coupledFvPatchField<Type> >
(
field.boundaryField()[patchID]
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
coupledFvPatchField<Type>(p, iF),
procPatch_(refCast<const processorFvPatch>(p))
{}
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const Field<Type>& f
)
:
coupledFvPatchField<Type>(p, iF, f),
procPatch_(refCast<const processorFvPatch>(p))
{}
// Construct by mapping given processorFvPatchField<Type>
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
(
const processorFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
coupledFvPatchField<Type>(ptf, p, iF, mapper),
procPatch_(refCast<const processorFvPatch>(p))
{
if (!isType<processorFvPatch>(this->patch()))
{
FatalErrorIn
(
"processorFvPatchField<Type>::processorFvPatchField\n"
"(\n"
" const processorFvPatchField<Type>& ptf,\n"
" const fvPatch& p,\n"
" const DimensionedField<Type, volMesh>& iF,\n"
" const fvPatchFieldMapper& mapper\n"
")\n"
) << "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError);
}
}
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
coupledFvPatchField<Type>(p, iF, dict),
procPatch_(refCast<const processorFvPatch>(p))
{
if (!isType<processorFvPatch>(p))
{
FatalIOErrorIn
(
"processorFvPatchField<Type>::processorFvPatchField\n"
"(\n"
" const fvPatch& p,\n"
" const Field<Type>& field,\n"
" const dictionary& dict\n"
")\n",
dict
) << "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError);
}
}
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
(
const processorFvPatchField<Type>& ptf
)
:
processorLduInterfaceField(),
coupledFvPatchField<Type>(ptf),
procPatch_(refCast<const processorFvPatch>(ptf.patch()))
{}
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
(
const processorFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
coupledFvPatchField<Type>(ptf, iF),
procPatch_(refCast<const processorFvPatch>(ptf.patch()))
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Type>
processorFvPatchField<Type>::~processorFvPatchField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
tmp<Field<Type> > processorFvPatchField<Type>::patchNeighbourField() const
{
return *this;
}
template<class Type>
void processorFvPatchField<Type>::initEvaluate
(
const Pstream::commsTypes commsType
)
{
if (Pstream::parRun())
{
const processorPolyPatch& pp = procPatch_.procPolyPatch();
// Get reference to proc patch built-in buffer
List<Type>& sendBuf = procPatch_.setSendBuf<Type>(this->size());
forAll(pp.patchIDs(), i)
{
SubField<Type> subSendFld(pp.subSlice(sendBuf, i));
Field<Type>& subFld = static_cast<Field<Type>&>
(
static_cast<UList<Type>&>(subSendFld)
);
label patchI = pp.patchIDs()[i];
//Pout<< "initEvaluate on "
// << this->dimensionedInternalField().name()
// << " patch:" << pp.name()
// << " subSize:" << (pp.starts()[i+1]-pp.starts()[i])
// << " subStart:" << pp.starts()[i]
// << " subPatch:" << patchI << endl;
if (patchI == -1)
{
// Assign internal field
this->patchInternalField
(
subFld,
procPatch_,
subSendFld.size(),
pp.starts()[i]
);
}
else
{
// Assign evaluation of referred patch
patchField(patchI).initEvaluate
(
subFld,
procPatch_,
subSendFld.size(),
pp.starts()[i]
);
}
}
procPatch_.compressedBufferSend<Type>(commsType);
}
}
template<class Type>
void processorFvPatchField<Type>::evaluate
(
const Pstream::commsTypes commsType
)
{
if (Pstream::parRun())
{
procPatch_.compressedReceive<Type>(commsType, *this);
const processorPolyPatch& pp = procPatch_.procPolyPatch();
forAll(pp.patchIDs(), i)
{
label patchI = pp.patchIDs()[i];
//Pout<< "evaluate on " << this->dimensionedInternalField().name()
// << " patch:" << pp.name()
// << " subSize:" << (pp.starts()[i+1]-pp.starts()[i])
// << " subStart:" << pp.starts()[i]
// << " subPatch:" << patchI << endl;
if (patchI == -1)
{
// No evaluation needed.
}
else
{
SubField<Type> subRecvFld(pp.subSlice(*this, i));
Field<Type>& subFld = static_cast<Field<Type>&>
(
static_cast<UList<Type>&>(subRecvFld)
);
patchField(patchI).evaluate
(
subFld,
procPatch_,
subRecvFld.size(),
pp.starts()[i]
);
}
}
}
}
template<class Type>
tmp<Field<Type> > processorFvPatchField<Type>::snGrad() const
{
tmp<Field<Type> > tpnf(new Field<Type>(this->size()));
Field<Type>& pnf = tpnf();
const processorPolyPatch& pp = procPatch_.procPolyPatch();
forAll(pp.patchIDs(), i)
{
label patchI = pp.patchIDs()[i];
label subStart = pp.starts()[i];
label subSize = pp.starts()[i+1] - pp.starts()[i];
const SubField<Type> subThis(pp.subSlice(*this, i));
SubField<Type> subPnf(pp.subSlice(pnf, i));
Field<Type>& subFld = static_cast<Field<Type>&>
(
static_cast<UList<Type>&>(subPnf)
);
//Pout<< "snGrad on " << this->dimensionedInternalField().name()
// << " patch:" << pp.name()
// << " subSize:" << (pp.starts()[i+1]-pp.starts()[i])
// << " subStart:" << pp.starts()[i]
// << " subPatch:" << patchI << endl;
if (patchI == -1)
{
// Slice delta coeffs
const SubField<scalar> subDc
(
pp.subSlice(procPatch_.deltaCoeffs(), i)
);
tmp<Field<Type> > subInt(new Field<Type>(subSize));
this->patchInternalField(subInt(), procPatch_, subSize, subStart);
subFld = (subDc*(subThis-subInt))();
}
else
{
patchField(patchI).snGrad
(
subFld,
subThis,
procPatch_,
subSize,
subStart
);
}
}
return tpnf;
}
template<class Type>
void processorFvPatchField<Type>::initInterfaceMatrixUpdate
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix& m,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes commsType
) const
{
// Get reference to proc patch built-in buffer
List<scalar>& sendFld = procPatch_.setSendBuf<scalar>(this->size());
const processorPolyPatch& pp = procPatch_.procPolyPatch();
forAll(pp.patchIDs(), i)
{
label subStart = pp.starts()[i];
label subSize = pp.starts()[i+1] - pp.starts()[i];
SubField<scalar> subSendFld(sendFld, subSize, subStart);
Field<scalar>& subFld = static_cast<Field<scalar>&>
(
static_cast<UList<scalar>&>(subSendFld)
);
label patchI = pp.patchIDs()[i];
//Pout<< "initInterfaceMatrixUpdate on "
// << this->dimensionedInternalField().name()
// << " patch:" << pp.name()
// << " subSize:" << (pp.starts()[i+1]-pp.starts()[i])
// << " subStart:" << pp.starts()[i]
// << " subPatch:" << patchI << endl;
if (patchI == -1)
{
const unallocLabelList& faceCells = pp.faceCells();
label facei = subStart;
forAll(subFld, i)
{
subFld[i] = psiInternal[faceCells[facei++]];
}
}
else
{
patchField(patchI).initInterfaceMatrixUpdate
(
psiInternal,
result,
m,
coeffs,
cmpt,
procPatch_,
subSize,
subStart,
subFld
);
}
}
procPatch_.compressedBufferSend<scalar>(commsType);
}
template<class Type>
void processorFvPatchField<Type>::updateInterfaceMatrix
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix& m,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes commsType
) const
{
const List<scalar>& recvFld = procPatch_.compressedBufferReceive<scalar>
(
commsType,
this->size()
);
const processorPolyPatch& pp = procPatch_.procPolyPatch();
forAll(pp.patchIDs(), i)
{
label subStart = pp.starts()[i];
label subSize = pp.starts()[i+1] - pp.starts()[i];
SubField<scalar> subRecvFld(recvFld, subSize, subStart);
Field<scalar>& subFld = static_cast<Field<scalar>&>
(
static_cast<UList<scalar>&>(subRecvFld)
);
label patchI = pp.patchIDs()[i];
//Pout<< "updateInterfaceMatrix on "
// << this->dimensionedInternalField().name()
// << " patch:" << pp.name()
// << " subSize:" << (pp.starts()[i+1]-pp.starts()[i])
// << " subStart:" << pp.starts()[i]
// << " subPatch:" << patchI << endl;
if (patchI == -1)
{
const unallocLabelList& faceCells = pp.faceCells();
label facei = subStart;
forAll(subFld, elemI)
{
result[faceCells[facei]] -= coeffs[facei]*subFld[elemI];
facei++;
}
}
else
{
patchField(patchI).updateInterfaceMatrix
(
psiInternal,
result,
m,
coeffs,
cmpt,
procPatch_,
subSize,
subStart,
subFld
);
}
}
}
//template<class Type>
//void Foam::processorFvPatchField<Type>::transformCoupleField
//(
// scalarField& f,
// const direction cmpt
//) const
//{
// if (pTraits<Type>::rank > 0)
// {
// const processorPolyPatch& pp = procPatch_.procPolyPatch();
//
// forAll(pp.patchIDs(), i)
// {
// label patchI = pp.patchIDs()[i];
//
// if (patchI == -1)
// {
// // ? anything needs to be transformed?
// }
// else
// {
// const coupledPolyPatch& cpp =
// refCast<const coupledPolyPatch>(pp.boundaryMesh()[patchI]);
//
// if (!cpp.parallel())
// {
// const tensor& T = cpp.forwardT();
//
// SubField<scalar> subFld(pp.subSlice(f, i));
// const scalarField& fld =
// static_cast<const scalarField&>(subFld);
//
// const_cast<scalarField&>(fld) *=
// pow(diag(T).component(cmpt), rank());
// }
// }
// }
// }
//}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,323 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::processorFvPatchField
Description
Foam::processorFvPatchField
SourceFiles
processorFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef processorFvPatchField_H
#define processorFvPatchField_H
#include "coupledFvPatchField.H"
#include "processorLduInterfaceField.H"
#include "processorFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class processorFvPatch Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class processorFvPatchField
:
public processorLduInterfaceField,
public coupledFvPatchField<Type>
{
// Private data
//- Local reference cast into the processor patch
const processorFvPatch& procPatch_;
// Private Member Functions
//- Get other patchfield
const coupledFvPatchField<Type>& patchField(const label patchID) const;
public:
//- Runtime type information
TypeName(processorFvPatch::typeName_());
// Constructors
//- Construct from patch and internal field
processorFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch and internal field and patch field
processorFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const Field<Type>&
);
//- Construct from patch, internal field and dictionary
processorFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given processorFvPatchField onto a new patch
processorFvPatchField
(
const processorFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
processorFvPatchField(const processorFvPatchField<Type>&);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new processorFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
processorFvPatchField
(
const processorFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type> > clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type> >
(
new processorFvPatchField<Type>(*this, iF)
);
}
// Destructor
~processorFvPatchField();
// Member functions
// Access
//- Return true if running parallel
virtual bool coupled() const
{
if (Pstream::parRun())
{
return true;
}
else
{
return false;
}
}
//- Return neighbour field given internal field
tmp<Field<Type> > patchNeighbourField() const;
// Evaluation functions
//- Initialise the evaluation of the patch field
virtual void initEvaluate(const Pstream::commsTypes commsType);
//- Evaluate the patch field
virtual void evaluate(const Pstream::commsTypes commsType);
//- Return patch-normal gradient
virtual tmp<Field<Type> > snGrad() const;
//- Initialise neighbour matrix update
virtual void initInterfaceMatrixUpdate
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix& m,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes commsType
) const;
//- Update result field based on interface functionality
virtual void updateInterfaceMatrix
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix& m,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes commsType
) const;
//- Processor coupled interface functions
//- Return processor number
virtual int myProcNo() const
{
return procPatch_.myProcNo();
}
//- Return neigbour processor number
virtual int neighbProcNo() const
{
return procPatch_.neighbProcNo();
}
//- Return rank of component for transform
virtual int rank() const
{
return pTraits<Type>::rank;
}
// //- Transform given patch component field
// void transformCoupleField
// (
// scalarField& f,
// const direction cmpt
// ) const;
// Referred-patch functionality. Get called with a slice (size, start)
// of a patch that supplies fields and geometry/topology.
//- Get patch-normal gradient
virtual void snGrad
(
Field<Type>& exchangeBuf,
const Field<Type>& subFld,
const coupledFvPatch& referringPatch,
const label size,
const label start
) const
{
notImplemented("processorFvPatchField::snGrad(..)");
}
//- Initialise the evaluation of the patch field.
virtual void initEvaluate
(
Field<Type>& exchangeBuf,
const coupledFvPatch& referringPatch,
const label size,
const label start
) const
{
notImplemented("processorFvPatchField::initEvaluate(..)");
}
//- Evaluate the patch field.
virtual void evaluate
(
Field<Type>& exchangeBuf,
const coupledFvPatch& referringPatch,
const label size,
const label start
) const
{
notImplemented("processorFvPatchField::evaluate(..)");
}
//- Initialise neighbour matrix update
virtual void initInterfaceMatrixUpdate
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix& m,
const scalarField& coeffs,
const direction cmpt,
const coupledFvPatch& referringPatch,
const label size,
const label start,
scalarField& exchangeBuf
) const
{
notImplemented
(
"processorFvPatchField::initInterfaceMatrixUpdate(..)"
);
}
//- Update result field based on interface functionality
virtual void updateInterfaceMatrix
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix&,
const scalarField& coeffs,
const direction,
const coupledFvPatch& referringPatch,
const label size,
const label start,
scalarField& exchangeBuf
) const
{
notImplemented
(
"processorFvPatchField::updateInterfaceMatrix(..)"
);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "processorFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,45 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "processorFvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(processor);
//makePatchTypeField(fvPatchScalarField, processorFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -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 processorFvPatchFields_H
#define processorFvPatchFields_H
#include "processorFvPatchScalarField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(processor)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 processorFvPatchFieldsFwd_H
#define processorFvPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class processorFvPatchField;
makePatchTypeFieldTypedefs(processor)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,72 +24,61 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "spline.H" #include "processorFvPatchScalarField.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::scalar Foam::spline::B(const scalar tau) namespace Foam
{ {
if (tau <= -2.0 || tau >= 2.0)
{
return 0.0;
}
else if (tau <= -1.0)
{
return pow((2.0 + tau), 3.0)/6.0;
}
else if (tau <= 0.0)
{
return (4.0 - 6.0*tau*tau - 3.0*tau*tau*tau)/6.0;
}
else if (tau <= 1.0)
{
return (4.0 - 6.0*tau*tau + 3.0*tau*tau*tau)/6.0;
}
else if (tau <= 2.0)
{
return pow((2.0 - tau), 3.0)/6.0;
}
else
{
FatalErrorIn("spline::B(const scalar)")
<< "Programming error???, "
<< "tau = " << tau
<< abort(FatalError);
}
return 0.0;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::spline::spline(const pointField& knotPoints)
:
knots_(knotPoints)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::vector Foam::spline::position(const scalar mu) const template<>
void processorFvPatchField<scalar>::initInterfaceMatrixUpdate
(
const scalarField& psiInternal,
scalarField&,
const lduMatrix&,
const scalarField&,
const direction,
const Pstream::commsTypes commsType
) const
{ {
vector loc(vector::zero); procPatch_.compressedSend
(
for (register label i=0; i < knots_.size(); i++) commsType,
{ patch().patchInternalField(psiInternal)()
loc += B((knots_.size() - 1)*mu - i)*knots_[i]; );
}
return loc;
} }
Foam::scalar Foam::spline::length() const template<>
void processorFvPatchField<scalar>::updateInterfaceMatrix
(
const scalarField&,
scalarField& result,
const lduMatrix&,
const scalarField& coeffs,
const direction,
const Pstream::commsTypes commsType
) const
{ {
notImplemented("spline::length() const"); scalarField pnf
return 1.0; (
procPatch_.compressedReceive<scalar>(commsType, this->size())()
);
const unallocLabelList& faceCells = patch().faceCells();
forAll(faceCells, facei)
{
result[faceCells[facei]] -= coeffs[facei]*pnf[facei];
}
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -22,85 +22,49 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::spline
Description
Define a basic spline on nKnots knots.
The spline does not go anywhere near these knots
(will act as a base type for various splines that will have real uses)
SourceFiles
spline.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef spline_H #ifndef processorFvPatchScalarField_H
#define spline_H #define processorFvPatchScalarField_H
#include "pointField.H" #include "processorFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
/*---------------------------------------------------------------------------*\ // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Class spline Declaration
\*---------------------------------------------------------------------------*/
class spline template<>
{ void processorFvPatchField<scalar>::initInterfaceMatrixUpdate
// Private data (
const scalarField&,
//- The knots defining the spline scalarField&,
pointField knots_; const lduMatrix&,
const scalarField&,
// Private Member Functions const direction,
const Pstream::commsTypes commsType
//- Blending function for constructing spline ) const;
static scalar B(const scalar);
//- Disallow default bitwise copy construct
spline(const spline&);
//- Disallow default bitwise assignment
void operator=(const spline&);
public: template<>
void processorFvPatchField<scalar>::updateInterfaceMatrix
// Constructors (
const scalarField&,
//- Construct from components scalarField& result,
spline(const pointField&); const lduMatrix&,
const scalarField& coeffs,
const direction,
// Member Functions const Pstream::commsTypes commsType
) const;
// Access
//- Return the number of knots in the spline
label nKnots() const
{
return knots_.size();
}
//- Return the position of a point on the curve given by
// the parameter 0 <= lambda <= 1
vector position(const scalar) const;
//- Return the length of the spline curve
scalar length() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "AverageIOField.H" #include "AverageIOField.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "gaussConvectionScheme.H" #include "gaussConvectionScheme.H"

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "multivariateGaussConvectionScheme.H" #include "multivariateGaussConvectionScheme.H"

Some files were not shown because too many files have changed in this diff Show More