diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index fcb43aeef4..640df13e7e 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -335,6 +335,7 @@ $(constraintPolyPatches)/empty/emptyPolyPatch.C $(constraintPolyPatches)/symmetry/symmetryPolyPatch.C $(constraintPolyPatches)/wedge/wedgePolyPatch.C $(constraintPolyPatches)/cyclic/cyclicPolyPatch.C +$(constraintPolyPatches)/processorCyclic/processorCyclicPolyPatch.C $(constraintPolyPatches)/processor/processorPolyPatch.C derivedPolyPatches = $(polyPatches)/derived @@ -446,6 +447,7 @@ $(constraintPointPatches)/symmetry/symmetryPointPatch.C $(constraintPointPatches)/wedge/wedgePointPatch.C $(constraintPointPatches)/cyclic/cyclicPointPatch.C $(constraintPointPatches)/processor/processorPointPatch.C +$(constraintPointPatches)/processorCyclic/processorCyclicPointPatch.C derivedPointPatches = $(pointPatches)/derived $(derivedPointPatches)/coupled/coupledFacePointPatch.C @@ -501,6 +503,7 @@ $(constraintPointPatchFields)/symmetry/symmetryPointPatchFields.C $(constraintPointPatchFields)/wedge/wedgePointPatchFields.C $(constraintPointPatchFields)/cyclic/cyclicPointPatchFields.C $(constraintPointPatchFields)/processor/processorPointPatchFields.C +$(constraintPointPatchFields)/processorCyclic/processorCyclicPointPatchFields.C derivedPointPatchFields = $(pointPatchFields)/derived $(derivedPointPatchFields)/slip/slipPointPatchFields.C diff --git a/src/OpenFOAM/containers/Lists/UList/UList.H b/src/OpenFOAM/containers/Lists/UList/UList.H index b829c99ea5..b9332d04c2 100644 --- a/src/OpenFOAM/containers/Lists/UList/UList.H +++ b/src/OpenFOAM/containers/Lists/UList/UList.H @@ -132,7 +132,7 @@ public: inline label fcIndex(const label i) const; //- Return the reverse circular index, i.e. the previous index - // which returns to the last at the begining of the list + // which returns to the last at the beginning of the list inline label rcIndex(const label i) const; //- Return the binary size in number of characters of the UList @@ -151,6 +151,18 @@ public: // This can be used (with caution) when interfacing with C code. inline T* data(); + //- Return the first element of the list. + inline T& first(); + + //- Return first element of the list. + inline const T& first() const; + + //- Return the last element of the list. + inline T& last(); + + //- Return the last element of the list. + inline const T& last() const; + // Check @@ -184,12 +196,6 @@ public: // an out-of-range element returns false without any ill-effects inline const T& operator[](const label) const; - //- Return last element of UList. - inline T& last(); - - //- Return last element of UList. - inline const T& last() const; - //- Allow cast to a const List& inline operator const Foam::List&() const; diff --git a/src/OpenFOAM/containers/Lists/UList/UListI.H b/src/OpenFOAM/containers/Lists/UList/UListI.H index aa7d396f10..fb68f29ee8 100644 --- a/src/OpenFOAM/containers/Lists/UList/UListI.H +++ b/src/OpenFOAM/containers/Lists/UList/UListI.H @@ -114,6 +114,20 @@ inline void Foam::UList::checkIndex(const label i) const } +template +inline T& Foam::UList::first() +{ + return this->operator[](0); +} + + +template +inline const T& Foam::UList::first() const +{ + return this->operator[](0); +} + + template inline T& Foam::UList::last() { diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C index b1e9623490..4a822d9de0 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "processorPointPatchField.H" -#include "transformField.H" +//#include "transformField.H" #include "processorPolyPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -131,125 +131,7 @@ void processorPointPatchField::swapAdd(Field& pField) const if (doTransform()) { - const processorPolyPatch& ppp = procPatch_.procPolyPatch(); - const labelList& nonGlobalPatchPoints = - procPatch_.nonGlobalPatchPoints(); - - // Mark patch that transformed point: - // -3 : global patch point so handled in different patch - // -2 : nonGlobalPatchPoints, initial value - // -1 : originating from internal face, no transform necessary - // >=0 : originating from coupled patch - labelList hasTransformed(ppp.nPoints(), -3); - forAll(nonGlobalPatchPoints, i) - { - hasTransformed[nonGlobalPatchPoints[i]] = -2; - } - - forAll(ppp.patchIDs(), subI) - { - label patchI = ppp.patchIDs()[subI]; - - if (patchI == -1) - { - for - ( - label faceI = ppp.starts()[subI]; - faceI < ppp.starts()[subI+1]; - faceI++ - ) - { - const face& f = ppp.localFaces()[faceI]; - - forAll(f, fp) - { - label pointI = f[fp]; - - if (hasTransformed[pointI] == -3) - { - // special point, handled elsewhere - } - else if (hasTransformed[pointI] == -2) - { - // first visit. Just mark. - hasTransformed[pointI] = patchI; - } - else if (hasTransformed[pointI] == patchI) - { - // already done - } - else - { - FatalErrorIn - ( - "processorPointPatchField::" - "swapAdd(Field& pField) const" - ) << "Point " << pointI - << " on patch " << ppp.name() - << " already transformed by patch " - << hasTransformed[pointI] - << abort(FatalError); - } - } - } - } - else if - ( - !refCast - ( - ppp.boundaryMesh()[patchI] - ).parallel() - ) - { - const tensor& T = refCast - ( - 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::" - "swapAdd(Field& pField) const" - ) << "Point " << pointI - << " on patch " << ppp.name() - << " subPatch " << patchI - << " already transformed by patch " - << hasTransformed[pointI] - << abort(FatalError); - } - } - } - } - } + procPatch_.procPolyPatch().transform(pnf); } addToInternalField(pField, pnf); diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H index 750f5a9fb3..c59e585ed5 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H @@ -149,13 +149,13 @@ public: } } - //- Does the patch field perform the transfromation + //- Does the patch field perform the transformation virtual bool doTransform() const { return !( pTraits::rank == 0 - || procPatch_.procPolyPatch().parallel() + || procPatch_.procPolyPatch().doTransform() ); } diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C new file mode 100644 index 0000000000..67839a23cc --- /dev/null +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.C @@ -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 +processorCyclicPointPatchField::processorCyclicPointPatchField +( + const pointPatch& p, + const DimensionedField& iF +) +: + coupledPointPatchField(p, iF), + procPatch_(refCast(p)) +{} + + +template +processorCyclicPointPatchField::processorCyclicPointPatchField +( + const pointPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + coupledPointPatchField(p, iF, dict), + procPatch_(refCast(p)) +{} + + +template +processorCyclicPointPatchField::processorCyclicPointPatchField +( + const processorCyclicPointPatchField& ptf, + const pointPatch& p, + const DimensionedField& iF, + const pointPatchFieldMapper& mapper +) +: + coupledPointPatchField(ptf, p, iF, mapper), + procPatch_(refCast(ptf.patch())) +{} + + +template +processorCyclicPointPatchField::processorCyclicPointPatchField +( + const processorCyclicPointPatchField& ptf, + const DimensionedField& iF +) +: + coupledPointPatchField(ptf, iF), + procPatch_(refCast(ptf.patch())) +{} + + +// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // + +template +processorCyclicPointPatchField::~processorCyclicPointPatchField() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void processorCyclicPointPatchField::initSwapAdd(Field& pField) +const +{ + if (Pstream::parRun()) + { + // Get internal field into my point order + Field pf(this->patchInternalField(pField)); + + OPstream::write + ( + Pstream::blocking, + procPatch_.neighbProcNo(), + reinterpret_cast(pf.begin()), + pf.byteSize() + ); + } +} + + +template +void processorCyclicPointPatchField::swapAdd(Field& pField) const +{ + if (Pstream::parRun()) + { + Field pnf(this->size()); + + IPstream::read + ( + Pstream::blocking, + procPatch_.neighbProcNo(), + reinterpret_cast(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::" + // "swapAdd(Field& pField) const" + // ) << "Point " << pointI + // << " on patch " << ppp.name() + // << " already transformed by patch " + // << hasTransformed[pointI] + // << abort(FatalError); + // } + // } + // } + // } + // else if + // ( + // !refCast + // ( + // ppp.boundaryMesh()[patchI] + // ).parallel() + // ) + // { + // const tensor& T = refCast + // ( + // 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::" + // "swapAdd(Field& pField) const" + // ) << "Point " << pointI + // << " on patch " << ppp.name() + // << " subPatch " << patchI + // << " already transformed by patch " + // << hasTransformed[pointI] + // << abort(FatalError); + // } + // } + // } + // } + //} + } + + addToInternalField(pField, pnf); + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.H new file mode 100644 index 0000000000..d0ece8d33a --- /dev/null +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchField.H @@ -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 processorCyclicPointPatchField +: + public coupledPointPatchField +{ + // 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& + ); + + //- Construct from patch, internal field and dictionary + processorCyclicPointPatchField + ( + const pointPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given patchField onto a new patch + processorCyclicPointPatchField + ( + const processorCyclicPointPatchField&, + const pointPatch&, + const DimensionedField&, + const pointPatchFieldMapper& + ); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new processorCyclicPointPatchField + ( + *this + ) + ); + } + + //- Construct as copy setting internal field reference + processorCyclicPointPatchField + ( + const processorCyclicPointPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual autoPtr > clone + ( + const DimensionedField& iF + ) const + { + return autoPtr > + ( + new processorCyclicPointPatchField + ( + *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::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&) const; + + //- Complete swap of patch point values and add to local values + virtual void swapAdd(Field&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "processorCyclicPointPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchFields.C b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchFields.C new file mode 100644 index 0000000000..5708849d87 --- /dev/null +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchFields.C @@ -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 + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchFields.H b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchFields.H new file mode 100644 index 0000000000..697cf9adff --- /dev/null +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processorCyclic/processorCyclicPointPatchFields.H @@ -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 + +// ************************************************************************* // diff --git a/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.H b/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.H index 8be581fb52..97013c52de 100644 --- a/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.H +++ b/src/OpenFOAM/matrices/LUscalarMatrix/procLduInterface.H @@ -91,7 +91,7 @@ public: { return autoPtr(new procLduInterface(is)); } - + // Ostream operator diff --git a/src/OpenFOAM/matrices/LUscalarMatrix/procLduMatrix.C b/src/OpenFOAM/matrices/LUscalarMatrix/procLduMatrix.C index 4f76c4bfcd..097d41fd89 100644 --- a/src/OpenFOAM/matrices/LUscalarMatrix/procLduMatrix.C +++ b/src/OpenFOAM/matrices/LUscalarMatrix/procLduMatrix.C @@ -97,7 +97,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const procLduMatrix& cldum) << cldum.upper_ << cldum.lower_ << cldum.interfaces_; - + return os; } diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.H index 4d07f28334..a7075d47e5 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.H @@ -28,7 +28,7 @@ Class Description An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches. - + SourceFiles lduInterface.C diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.C index c6310aaf07..46373627ac 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.C @@ -36,6 +36,18 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +void Foam::processorLduInterface::resizeBuf +( + List& buf, + const label size +) const +{ + if (buf.size() < size) + { + buf.setSize(size); + } +} + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.H index de54787e02..ed40c9ccd8 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.H @@ -61,6 +61,9 @@ class processorLduInterface // Only sized and used when compressed or non-blocking comms used. mutable List receiveBuf_; + //- Resize the buffer if required + void resizeBuf(List& buf, const label size) const; + public: @@ -89,17 +92,20 @@ public: //- Return neigbour processor number virtual int neighbProcNo() const = 0; - //- Set send buffer to sufficient size to hold List(nElems). - // Returns reference to buffer (note:buffer.size() is number - // of characters, not nElems) - template - List& setSendBuf(const label nElems) const; + //- Return face transformation tensor + virtual const tensor& forwardT() const = 0; - //- Set receive buffer to sufficient size to hold List(nElems) - // Returns reference to buffer (note:buffer.size() is number - // of characters, not nElems) - template - List& setReceiveBuf(const label nElems) const; +// //- Set send buffer to sufficient size to hold List(nElems). +// // Returns reference to buffer (note:buffer.size() is number +// // of characters, not nElems) +// template +// List& setSendBuf(const label nElems) const; +// +// //- Set receive buffer to sufficient size to hold List(nElems) +// // Returns reference to buffer (note:buffer.size() is number +// // of characters, not nElems) +// template +// List& setReceiveBuf(const label nElems) const; // Transfer functions @@ -154,24 +160,24 @@ public: ) const; - //- Raw field send function of internal send buffer with data - // compression. - template - void compressedBufferSend - ( - const Pstream::commsTypes commsType - ) const; - - //- Raw field receive function of internal receive buffer with data - // compression. - // Returns reference to buffer (note:buffer.size() is number - // of characters, not size) - template - const List& compressedBufferReceive - ( - const Pstream::commsTypes commsType, - const label size - ) const; +// //- Raw field send function of internal send buffer with data +// // compression. +// template +// void compressedBufferSend +// ( +// const Pstream::commsTypes commsType +// ) const; +// +// //- Raw field receive function of internal receive buffer with data +// // compression. +// // Returns reference to buffer (note:buffer.size() is number +// // of characters, not size) +// template +// const List& compressedBufferReceive +// ( +// const Pstream::commsTypes commsType, +// const label size +// ) const; }; diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C index b114d6d014..98ca57342c 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterfaceTemplates.C @@ -30,47 +30,47 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -Foam::List& Foam::processorLduInterface::setSendBuf(const label nElems) -const -{ - if (!contiguous()) - { - FatalErrorIn("processorLduInterface::setSendBuf(const label) const") - << "Cannot return the binary size of a list of " - "non-primitive elements" - << abort(FatalError); - } - - label nBytes = nElems*sizeof(Type); - sendBuf_.setSize(nBytes); - - return reinterpret_cast&>(sendBuf_); -} - - -template -Foam::List& Foam::processorLduInterface::setReceiveBuf -( - const label nElems -) const -{ - if (!contiguous()) - { - FatalErrorIn("processorLduInterface::setReceiveBuf(const label) const") - << "Cannot return the binary size of a list of " - "non-primitive elements" - << abort(FatalError); - } - - label nBytes = nElems*sizeof(Type); - - //receiveBuf_.setSize(nBytes, '\0'); // necessary because of expanding - // compression? - receiveBuf_.setSize(nBytes); - - return reinterpret_cast&>(receiveBuf_); -} +// template +// Foam::List& Foam::processorLduInterface::setSendBuf(const label nElems) +// const +// { +// if (!contiguous()) +// { +// FatalErrorIn("processorLduInterface::setSendBuf(const label) const") +// << "Cannot return the binary size of a list of " +// "non-primitive elements" +// << abort(FatalError); +// } +// +// label nBytes = nElems*sizeof(Type); +// sendBuf_.setSize(nBytes); +// +// return reinterpret_cast&>(sendBuf_); +// } +// +// +// template +// Foam::List& Foam::processorLduInterface::setReceiveBuf +// ( +// const label nElems +// ) const +// { +// if (!contiguous()) +// { +// FatalErrorIn("processorLduInterface::setReceiveBuf(const label) const") +// << "Cannot return the binary size of a list of " +// "non-primitive elements" +// << abort(FatalError); +// } +// +// label nBytes = nElems*sizeof(Type); +// +// //receiveBuf_.setSize(nBytes, '\0'); // necessary because of expanding +// // compression? +// receiveBuf_.setSize(nBytes); +// +// return reinterpret_cast&>(receiveBuf_); +// } template @@ -92,17 +92,19 @@ void Foam::processorLduInterface::send } else if (commsType == Pstream::nonBlocking) { - setReceiveBuf(f.size()); + //setReceiveBuf(f.size()); + resizeBuf(receiveBuf_, f.size()*sizeof(Type)); IPstream::read ( commsType, neighbProcNo(), receiveBuf_.begin(), - f.byteSize() + receiveBuf_.size() ); - setSendBuf(f.size()); + //setSendBuf(f.size()); + resizeBuf(sendBuf_, f.byteSize()); memcpy(sendBuf_.begin(), f.begin(), f.byteSize()); OPstream::write @@ -182,7 +184,8 @@ void Foam::processorLduInterface::compressedSend const scalar *sArray = reinterpret_cast(f.begin()); const scalar *slast = &sArray[nm1]; - setSendBuf(nFloats); + //setSendBuf(nFloats); + resizeBuf(sendBuf_, nBytes); float *fArray = reinterpret_cast(sendBuf_.begin()); for (register label i=0; i(nFloats); + //setReceiveBuf(nFloats); + resizeBuf(receiveBuf_, nBytes); IPstream::read ( @@ -235,7 +239,6 @@ void Foam::processorLduInterface::compressedSend } } - template void Foam::processorLduInterface::compressedReceive ( @@ -249,17 +252,19 @@ void Foam::processorLduInterface::compressedReceive label nm1 = (f.size() - 1)*nCmpts; label nlast = sizeof(Type)/sizeof(float); label nFloats = nm1 + nlast; + label nBytes = nFloats*sizeof(float); if (commsType == Pstream::blocking || commsType == Pstream::scheduled) { - setReceiveBuf(nFloats); + //setReceiveBuf(nFloats); + resizeBuf(receiveBuf_, nBytes); IPstream::read ( commsType, neighbProcNo(), receiveBuf_.begin(), - receiveBuf_.size() + nBytes ); } else if (commsType != Pstream::nonBlocking) @@ -286,7 +291,6 @@ void Foam::processorLduInterface::compressedReceive } } - template Foam::tmp > Foam::processorLduInterface::compressedReceive ( @@ -300,155 +304,155 @@ Foam::tmp > Foam::processorLduInterface::compressedReceive } -template -void Foam::processorLduInterface::compressedBufferSend -( - const Pstream::commsTypes commsType -) const -{ - // Optionally inline compress sendBuf - if - ( - sizeof(scalar) > sizeof(float) - && sendBuf_.size() - && Pstream::floatTransfer - ) - { - const List& f = reinterpret_cast&>(sendBuf_); - label fSize = f.size()/sizeof(Type); - - // Inplace compress - static const label nCmpts = sizeof(Type)/sizeof(scalar); - label nm1 = (fSize - 1)*nCmpts; - label nlast = sizeof(Type)/sizeof(float); - label nFloats = nm1 + nlast; - - const scalar *sArray = reinterpret_cast(f.begin()); - const scalar *slast = &sArray[nm1]; - float *fArray = reinterpret_cast(sendBuf_.begin()); - - for (register label i=0; i(fArray[nm1]) = f[fSize - 1]; - - // Trim - setSendBuf(nFloats); - } - - // Send sendBuf - if (commsType == Pstream::blocking || commsType == Pstream::scheduled) - { - OPstream::write - ( - commsType, - neighbProcNo(), - sendBuf_.begin(), - sendBuf_.size() - ); - } - else if (commsType == Pstream::nonBlocking) - { - setReceiveBuf(sendBuf_.size()); - - IPstream::read - ( - commsType, - neighbProcNo(), - receiveBuf_.begin(), - receiveBuf_.size() - ); - - OPstream::write - ( - commsType, - neighbProcNo(), - sendBuf_.begin(), - sendBuf_.size() - ); - } - else - { - FatalErrorIn("processorLduInterface::compressedBufferSend") - << "Unsupported communications type " << commsType - << exit(FatalError); - } -} - - -template -const Foam::List& Foam::processorLduInterface::compressedBufferReceive -( - const Pstream::commsTypes commsType, - const label size -) const -{ - if (sizeof(scalar) > sizeof(float) && size && Pstream::floatTransfer) - { - static const label nCmpts = sizeof(Type)/sizeof(scalar); - label nm1 = (size - 1)*nCmpts; - label nlast = sizeof(Type)/sizeof(float); - label nFloats = nm1 + nlast; - - if (commsType == Pstream::blocking || commsType == Pstream::scheduled) - { - setReceiveBuf(nFloats); - - IPstream::read - ( - commsType, - neighbProcNo(), - receiveBuf_.begin(), - receiveBuf_.size() - ); - } - else if (commsType != Pstream::nonBlocking) - { - FatalErrorIn("processorLduInterface::compressedBufferReceive") - << "Unsupported communications type " << commsType - << exit(FatalError); - } - - // Inline expand - List& f = setReceiveBuf(size); - label fSize = f.size()/sizeof(Type); - - const float *fArray = - reinterpret_cast(receiveBuf_.begin()); - f[fSize - 1] = reinterpret_cast(fArray[nm1]); - scalar *sArray = reinterpret_cast(f.begin()); - const scalar *slast = &sArray[nm1]; - - for (register label i=0; i(size); - - IPstream::read - ( - commsType, - neighbProcNo(), - receiveBuf_.begin(), - receiveBuf_.size() - ); - } - else if (commsType != Pstream::nonBlocking) - { - FatalErrorIn("processorLduInterface::compressedBufferReceive") - << "Unsupported communications type " << commsType - << exit(FatalError); - } - } - return reinterpret_cast&>(receiveBuf_); -} +// template +// void Foam::processorLduInterface::compressedBufferSend +// ( +// const Pstream::commsTypes commsType +// ) const +// { +// // Optionally inline compress sendBuf +// if +// ( +// sizeof(scalar) > sizeof(float) +// && sendBuf_.size() +// && Pstream::floatTransfer +// ) +// { +// const List& f = reinterpret_cast&>(sendBuf_); +// label fSize = f.size()/sizeof(Type); +// +// // Inplace compress +// static const label nCmpts = sizeof(Type)/sizeof(scalar); +// label nm1 = (fSize - 1)*nCmpts; +// label nlast = sizeof(Type)/sizeof(float); +// label nFloats = nm1 + nlast; +// +// const scalar *sArray = reinterpret_cast(f.begin()); +// const scalar *slast = &sArray[nm1]; +// float *fArray = reinterpret_cast(sendBuf_.begin()); +// +// for (register label i=0; i(fArray[nm1]) = f[fSize - 1]; +// +// // Trim +// setSendBuf(nFloats); +// } +// +// // Send sendBuf +// if (commsType == Pstream::blocking || commsType == Pstream::scheduled) +// { +// OPstream::write +// ( +// commsType, +// neighbProcNo(), +// sendBuf_.begin(), +// sendBuf_.size() +// ); +// } +// else if (commsType == Pstream::nonBlocking) +// { +// setReceiveBuf(sendBuf_.size()); +// +// IPstream::read +// ( +// commsType, +// neighbProcNo(), +// receiveBuf_.begin(), +// receiveBuf_.size() +// ); +// +// OPstream::write +// ( +// commsType, +// neighbProcNo(), +// sendBuf_.begin(), +// sendBuf_.size() +// ); +// } +// else +// { +// FatalErrorIn("processorLduInterface::compressedBufferSend") +// << "Unsupported communications type " << commsType +// << exit(FatalError); +// } +// } +// +// +// template +// const Foam::List& Foam::processorLduInterface::compressedBufferReceive +// ( +// const Pstream::commsTypes commsType, +// const label size +// ) const +// { +// if (sizeof(scalar) > sizeof(float) && size && Pstream::floatTransfer) +// { +// static const label nCmpts = sizeof(Type)/sizeof(scalar); +// label nm1 = (size - 1)*nCmpts; +// label nlast = sizeof(Type)/sizeof(float); +// label nFloats = nm1 + nlast; +// +// if (commsType == Pstream::blocking || commsType == Pstream::scheduled) +// { +// setReceiveBuf(nFloats); +// +// IPstream::read +// ( +// commsType, +// neighbProcNo(), +// receiveBuf_.begin(), +// receiveBuf_.size() +// ); +// } +// else if (commsType != Pstream::nonBlocking) +// { +// FatalErrorIn("processorLduInterface::compressedBufferReceive") +// << "Unsupported communications type " << commsType +// << exit(FatalError); +// } +// +// // Inline expand +// List& f = setReceiveBuf(size); +// label fSize = f.size()/sizeof(Type); +// +// const float *fArray = +// reinterpret_cast(receiveBuf_.begin()); +// f[fSize - 1] = reinterpret_cast(fArray[nm1]); +// scalar *sArray = reinterpret_cast(f.begin()); +// const scalar *slast = &sArray[nm1]; +// +// for (register label i=0; i(size); +// +// IPstream::read +// ( +// commsType, +// neighbProcNo(), +// receiveBuf_.begin(), +// receiveBuf_.size() +// ); +// } +// else if (commsType != Pstream::nonBlocking) +// { +// FatalErrorIn("processorLduInterface::compressedBufferReceive") +// << "Unsupported communications type " << commsType +// << exit(FatalError); +// } +// } +// return reinterpret_cast&>(receiveBuf_); +// } // ************************************************************************* // diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.C index e872f2cc59..53d86db023 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.C @@ -51,7 +51,7 @@ void Foam::cyclicLduInterfaceField::transformCoupleField { if (doTransform()) { - scalar forwardScale = + scalar forwardScale = pow(diag(forwardT()).component(cmpt), rank()); pnf *= forwardScale; diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.C index 3109aac9cb..05e8691f2e 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.C @@ -43,24 +43,17 @@ Foam::processorLduInterfaceField::~processorLduInterfaceField() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -//void Foam::processorLduInterfaceField::transformCoupleField -//( -// scalarField& f, -// const direction cmpt -//) const -//{ -// if (doTransform()) -// { -// if (forwardT().size() == 1) -// { -// f *= pow(diag(forwardT()[0]).component(cmpt), rank()); -// } -// else -// { -// f *= pow(diag(forwardT())().component(cmpt), rank()); -// } -// } -//} +void Foam::processorLduInterfaceField::transformCoupleField +( + scalarField& f, + const direction cmpt +) const +{ + if (doTransform()) + { + f *= pow(diag(forwardT()).component(cmpt), rank()); + } +} // ************************************************************************* // diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H index 59be5d1c2b..fd0b02f060 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.H @@ -79,22 +79,22 @@ public: //- Return neigbour processor number virtual int neighbProcNo() const = 0; -// //- Is the transform required -// virtual bool doTransform() const = 0; -// -// //- Return face transformation tensor -// virtual const tensorField& forwardT() const = 0; + //- Is the transform required + virtual bool doTransform() const = 0; + + //- Return face transformation tensor + virtual const tensor& forwardT() const = 0; //- Return rank of component for transform virtual int rank() const = 0; -// //- Transform given patch component field -// virtual void transformCoupleField -// ( -// scalarField& f, -// const direction cmpt -// ) const = 0; + //- Transform given patch component field + void transformCoupleField + ( + scalarField& f, + const direction cmpt + ) const; }; diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H index cc46f7931b..4570b7dd09 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolver.H @@ -147,7 +147,7 @@ class GAMGSolver //- Calculate and return the scaling factor from Acf, coarseSource // and coarseField. // At the same time do a Jacobi iteration on the coarseField using - // the Acf provided after the coarseField values are used for the + // the Acf provided after the coarseField values are used for the // scaling factor. scalar scalingFactor ( diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverAgglomerateMatrix.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverAgglomerateMatrix.C index 7641d2c937..6d7a6bfb97 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverAgglomerateMatrix.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGSolverAgglomerateMatrix.C @@ -96,7 +96,7 @@ void Foam::GAMGSolver::agglomerateMatrix(const label fineLevelIndex) { if (fineInterfaces.set(inti)) { - const GAMGInterface& coarseInterface = + const GAMGInterface& coarseInterface = refCast ( agglomeration_.interfaceLevel(fineLevelIndex + 1)[inti] @@ -182,7 +182,7 @@ void Foam::GAMGSolver::agglomerateMatrix(const label fineLevelIndex) } } } - else // ... Otherwise it is symmetric so agglomerate just the upper + else // ... Otherwise it is symmetric so agglomerate just the upper { // Get off-diagonal matrix coefficients const scalarField& fineUpper = fineMatrix.upper(); diff --git a/src/OpenFOAM/meshes/boundBox/boundBox.C b/src/OpenFOAM/meshes/boundBox/boundBox.C index 15de6f2cf7..eb8ec29866 100644 --- a/src/OpenFOAM/meshes/boundBox/boundBox.C +++ b/src/OpenFOAM/meshes/boundBox/boundBox.C @@ -110,6 +110,26 @@ Foam::boundBox::boundBox(Istream& is) } +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::tmp Foam::boundBox::corners() const +{ + tmp tPts = tmp(new pointField(8)); + pointField& pt = tPts(); + + pt[0] = min_; // min-x, min-y, min-z + pt[1] = point(max_.x(), min_.y(), min_.z()); // max-x, min-y, min-z + pt[2] = point(max_.x(), max_.y(), min_.z()); // max-x, max-y, min-z + pt[3] = point(min_.x(), max_.y(), min_.z()); // min-x, max-y, min-z + pt[4] = point(min_.x(), min_.y(), max_.z()); // min-x, min-y, max-z + pt[5] = point(max_.x(), min_.y(), max_.z()); // max-x, min-y, max-z + pt[6] = max_; // max-x, max-y, max-z + pt[7] = point(min_.x(), max_.y(), max_.z()); // min-x, max-y, max-z + + return tPts; +} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // Foam::Ostream& Foam::operator<<(Ostream& os, const boundBox& bb) diff --git a/src/OpenFOAM/meshes/boundBox/boundBox.H b/src/OpenFOAM/meshes/boundBox/boundBox.H index 38b852ef66..29cfa1fe29 100644 --- a/src/OpenFOAM/meshes/boundBox/boundBox.H +++ b/src/OpenFOAM/meshes/boundBox/boundBox.H @@ -171,6 +171,8 @@ public: return cmptAv(span()); } + //- Return corner points in an order corresponding to a 'hex' cell + tmp corners() const; // Query diff --git a/src/OpenFOAM/meshes/meshShapes/cell/oppositeCellFace.C b/src/OpenFOAM/meshes/meshShapes/cell/oppositeCellFace.C index a103772bb0..ed9c7057cc 100644 --- a/src/OpenFOAM/meshes/meshShapes/cell/oppositeCellFace.C +++ b/src/OpenFOAM/meshes/meshShapes/cell/oppositeCellFace.C @@ -99,7 +99,7 @@ Foam::label Foam::cell::opposingFaceLabel { // There has already been an opposite face. // Non-prismatic cell - Info<< "Multiple faces not sharing vertex: " + Info<< "Multiple faces not sharing vertex: " << oppositeFaceLabel << " and " << curFaceLabels[faceI] << endl; return -1; diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.C index 6f65c70764..4a88831532 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.C +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.C @@ -76,7 +76,7 @@ void Foam::cyclicPointPatch::calcGeometry(PstreamBuffers&) else { // Get reference to shared points - const labelList& sharedPoints = + const labelList& sharedPoints = boundaryMesh().globalPatch().meshPoints(); nonGlobalPatchPoints_.setSize(mp.size()); diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H index 373416ac0a..df7b8d96a3 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H @@ -73,11 +73,11 @@ class processorPointPatch //- Calculate the patch geometry virtual void calcGeometry(PstreamBuffers&); - //- Initialise the points on this patch which are should also be + //- Initialise the points on this patch which are should also be // on a neighbouring patch but are not part of faces of that patch void initPatchPatchPoints(PstreamBuffers&); - //- Calculate the points on this patch which are should also be + //- Calculate the points on this patch which are should also be // on a neighbouring patch but are not part of faces of that patch void calcPatchPatchPoints(PstreamBuffers&); diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processorCyclic/processorCyclicPointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processorCyclic/processorCyclicPointPatch.C new file mode 100644 index 0000000000..684580aaf6 --- /dev/null +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processorCyclic/processorCyclicPointPatch.C @@ -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