Commit f847a792 authored by mattijs's avatar mattijs
Browse files

builds again

parent be1b1cee
......@@ -335,6 +335,7 @@ $(constraintPolyPatches)/empty/emptyPolyPatch.C
$(constraintPolyPatches)/symmetry/symmetryPolyPatch.C
$(constraintPolyPatches)/wedge/wedgePolyPatch.C
$(constraintPolyPatches)/cyclic/cyclicPolyPatch.C
$(constraintPolyPatches)/processorCyclic/processorCyclicPolyPatch.C
$(constraintPolyPatches)/processor/processorPolyPatch.C
derivedPolyPatches = $(polyPatches)/derived
......@@ -446,6 +447,7 @@ $(constraintPointPatches)/symmetry/symmetryPointPatch.C
$(constraintPointPatches)/wedge/wedgePointPatch.C
$(constraintPointPatches)/cyclic/cyclicPointPatch.C
$(constraintPointPatches)/processor/processorPointPatch.C
$(constraintPointPatches)/processorCyclic/processorCyclicPointPatch.C
derivedPointPatches = $(pointPatches)/derived
$(derivedPointPatches)/coupled/coupledFacePointPatch.C
......@@ -501,6 +503,7 @@ $(constraintPointPatchFields)/symmetry/symmetryPointPatchFields.C
$(constraintPointPatchFields)/wedge/wedgePointPatchFields.C
$(constraintPointPatchFields)/cyclic/cyclicPointPatchFields.C
$(constraintPointPatchFields)/processor/processorPointPatchFields.C
$(constraintPointPatchFields)/processorCyclic/processorCyclicPointPatchFields.C
derivedPointPatchFields = $(pointPatchFields)/derived
$(derivedPointPatchFields)/slip/slipPointPatchFields.C
......
......@@ -132,7 +132,7 @@ public:
inline label fcIndex(const label i) const;
//- Return the reverse circular index, i.e. the previous index
// which returns to the last at the begining of the list
// which returns to the last at the beginning of the list
inline label rcIndex(const label i) const;
//- Return the binary size in number of characters of the UList
......@@ -151,6 +151,18 @@ public:
// This can be used (with caution) when interfacing with C code.
inline T* data();
//- Return the first element of the list.
inline T& first();
//- Return first element of the list.
inline const T& first() const;
//- Return the last element of the list.
inline T& last();
//- Return the last element of the list.
inline const T& last() const;
// Check
......@@ -184,12 +196,6 @@ public:
// an out-of-range element returns false without any ill-effects
inline const T& operator[](const label) const;
//- Return last element of UList.
inline T& last();
//- Return last element of UList.
inline const T& last() const;
//- Allow cast to a const List<T>&
inline operator const Foam::List<T>&() const;
......
......@@ -114,6 +114,20 @@ inline void Foam::UList<T>::checkIndex(const label i) const
}
template<class T>
inline T& Foam::UList<T>::first()
{
return this->operator[](0);
}
template<class T>
inline const T& Foam::UList<T>::first() const
{
return this->operator[](0);
}
template<class T>
inline T& Foam::UList<T>::last()
{
......
......@@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "processorPointPatchField.H"
#include "transformField.H"
//#include "transformField.H"
#include "processorPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -131,125 +131,7 @@ void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const
if (doTransform())
{
const processorPolyPatch& ppp = procPatch_.procPolyPatch();
const labelList& nonGlobalPatchPoints =
procPatch_.nonGlobalPatchPoints();
// Mark patch that transformed point:
// -3 : global patch point so handled in different patch
// -2 : nonGlobalPatchPoints, initial value
// -1 : originating from internal face, no transform necessary
// >=0 : originating from coupled patch
labelList hasTransformed(ppp.nPoints(), -3);
forAll(nonGlobalPatchPoints, i)
{
hasTransformed[nonGlobalPatchPoints[i]] = -2;
}
forAll(ppp.patchIDs(), subI)
{
label patchI = ppp.patchIDs()[subI];
if (patchI == -1)
{
for
(
label faceI = ppp.starts()[subI];
faceI < ppp.starts()[subI+1];
faceI++
)
{
const face& f = ppp.localFaces()[faceI];
forAll(f, fp)
{
label pointI = f[fp];
if (hasTransformed[pointI] == -3)
{
// special point, handled elsewhere
}
else if (hasTransformed[pointI] == -2)
{
// first visit. Just mark.
hasTransformed[pointI] = patchI;
}
else if (hasTransformed[pointI] == patchI)
{
// already done
}
else
{
FatalErrorIn
(
"processorPointPatchField<Type>::"
"swapAdd(Field<Type>& pField) const"
) << "Point " << pointI
<< " on patch " << ppp.name()
<< " already transformed by patch "
<< hasTransformed[pointI]
<< abort(FatalError);
}
}
}
}
else if
(
!refCast<const coupledPolyPatch>
(
ppp.boundaryMesh()[patchI]
).parallel()
)
{
const tensor& T = refCast<const coupledPolyPatch>
(
ppp.boundaryMesh()[patchI]
).forwardT();
for
(
label faceI = ppp.starts()[subI];
faceI < ppp.starts()[subI+1];
faceI++
)
{
const face& f = ppp.localFaces()[faceI];
forAll(f, fp)
{
label pointI = f[fp];
if (hasTransformed[pointI] == -3)
{
// special point, handled elsewhere
}
else if (hasTransformed[pointI] == -2)
{
pnf[pointI] = transform(T, pnf[pointI]);
hasTransformed[pointI] = patchI;
}
else if (hasTransformed[pointI] == patchI)
{
// already done
}
else
{
FatalErrorIn
(
"processorPointPatchField<Type>::"
"swapAdd(Field<Type>& pField) const"
) << "Point " << pointI
<< " on patch " << ppp.name()
<< " subPatch " << patchI
<< " already transformed by patch "
<< hasTransformed[pointI]
<< abort(FatalError);
}
}
}
}
}
procPatch_.procPolyPatch().transform(pnf);
}
addToInternalField(pField, pnf);
......
......@@ -149,13 +149,13 @@ public:
}
}
//- Does the patch field perform the transfromation
//- Does the patch field perform the transformation
virtual bool doTransform() const
{
return
!(
pTraits<Type>::rank == 0
|| procPatch_.procPolyPatch().parallel()
|| procPatch_.procPolyPatch().doTransform()
);
}
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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>