Merge remote branch 'OpenCFD/master' into olesenm

Conflicts:
	src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C
This commit is contained in:
Mark Olesen
2010-05-31 11:50:56 +02:00
1421 changed files with 21173 additions and 9427 deletions

View File

@ -74,9 +74,13 @@ containers/LinkedLists/linkTypes/DLListBase/DLListBase.C
primitiveLists = primitives/Lists
$(primitiveLists)/boolList.C
$(primitiveLists)/labelIOList.C
$(primitiveLists)/labelListIOList.C
$(primitiveLists)/scalarList.C
$(primitiveLists)/scalarIOList.C
$(primitiveLists)/scalarListIOList.C
$(primitiveLists)/vectorList.C
$(primitiveLists)/vectorIOList.C
$(primitiveLists)/vectorListIOList.C
$(primitiveLists)/sphericalTensorList.C
$(primitiveLists)/symmTensorList.C
$(primitiveLists)/tensorList.C
@ -260,12 +264,14 @@ GAMGInterfaces = $(GAMG)/interfaces
$(GAMGInterfaces)/GAMGInterface/GAMGInterface.C
$(GAMGInterfaces)/GAMGInterface/GAMGInterfaceNew.C
$(GAMGInterfaces)/processorGAMGInterface/processorGAMGInterface.C
$(GAMGInterfaces)/processorCyclicGAMGInterface/processorCyclicGAMGInterface.C
$(GAMGInterfaces)/cyclicGAMGInterface/cyclicGAMGInterface.C
GAMGInterfaceFields = $(GAMG)/interfaceFields
$(GAMGInterfaceFields)/GAMGInterfaceField/GAMGInterfaceField.C
$(GAMGInterfaceFields)/GAMGInterfaceField/GAMGInterfaceFieldNew.C
$(GAMGInterfaceFields)/processorGAMGInterfaceField/processorGAMGInterfaceField.C
$(GAMGInterfaceFields)/processorCyclicGAMGInterfaceField/processorCyclicGAMGInterfaceField.C
$(GAMGInterfaceFields)/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C
GAMGAgglomerations = $(GAMG)/GAMGAgglomerations
@ -339,6 +345,8 @@ $(constraintPolyPatches)/empty/emptyPolyPatch.C
$(constraintPolyPatches)/symmetry/symmetryPolyPatch.C
$(constraintPolyPatches)/wedge/wedgePolyPatch.C
$(constraintPolyPatches)/cyclic/cyclicPolyPatch.C
$(constraintPolyPatches)/cyclicSlip/cyclicSlipPolyPatch.C
$(constraintPolyPatches)/processorCyclic/processorCyclicPolyPatch.C
$(constraintPolyPatches)/processor/processorPolyPatch.C
derivedPolyPatches = $(polyPatches)/derived
@ -449,7 +457,9 @@ $(constraintPointPatches)/empty/emptyPointPatch.C
$(constraintPointPatches)/symmetry/symmetryPointPatch.C
$(constraintPointPatches)/wedge/wedgePointPatch.C
$(constraintPointPatches)/cyclic/cyclicPointPatch.C
$(constraintPointPatches)/cyclicSlip/cyclicSlipPointPatch.C
$(constraintPointPatches)/processor/processorPointPatch.C
$(constraintPointPatches)/processorCyclic/processorCyclicPointPatch.C
derivedPointPatches = $(pointPatches)/derived
$(derivedPointPatches)/coupled/coupledFacePointPatch.C
@ -480,9 +490,12 @@ $(Fields)/symmTensorField/symmTensorField.C
$(Fields)/tensorField/tensorField.C
$(Fields)/complexFields/complexFields.C
$(Fields)/labelField/labelIOField.C
$(Fields)/labelField/labelIOField.
$(Fields)/labelField/labelFieldIOField.C
$(Fields)/scalarField/scalarIOField.C
$(Fields)/scalarField/scalarFieldIOField.C
$(Fields)/vectorField/vectorIOField.C
$(Fields)/vectorField/vectorFieldIOField.C
$(Fields)/vector2DField/vector2DIOField.C
$(Fields)/sphericalTensorField/sphericalTensorIOField.C
$(Fields)/diagTensorField/diagTensorIOField.C
@ -508,6 +521,7 @@ $(constraintPointPatchFields)/wedge/wedgePointPatchFields.C
$(constraintPointPatchFields)/cyclic/cyclicPointPatchFields.C
$(constraintPointPatchFields)/cyclicSlip/cyclicSlipPointPatchFields.C
$(constraintPointPatchFields)/processor/processorPointPatchFields.C
$(constraintPointPatchFields)/processorCyclic/processorCyclicPointPatchFields.C
derivedPointPatchFields = $(pointPatchFields)/derived
$(derivedPointPatchFields)/slip/slipPointPatchFields.C
@ -538,4 +552,6 @@ $(writers)/gnuplotGraph/gnuplotGraph.C
$(writers)/xmgrGraph/xmgrGraph.C
$(writers)/jplotGraph/jplotGraph.C
meshes/data/data.C
LIB = $(FOAM_LIBBIN)/libOpenFOAM

View File

@ -251,12 +251,13 @@ bool Foam::FaceCellWave<Type>::updateFace
template <class Type>
void Foam::FaceCellWave<Type>::checkCyclic(const polyPatch& patch) const
{
label cycOffset = patch.size()/2;
const cyclicPolyPatch& nbrPatch =
refCast<const cyclicPolyPatch>(patch).neighbPatch();
for (label patchFaceI = 0; patchFaceI < cycOffset; patchFaceI++)
forAll(patch, patchFaceI)
{
label i1 = patch.start() + patchFaceI;
label i2 = i1 + cycOffset;
label i2 = nbrPatch.start() + patchFaceI;
if (!allFaceInfo_[i1].sameGeometry(mesh_, allFaceInfo_[i2], geomTol_))
{
@ -334,8 +335,7 @@ void Foam::FaceCellWave<Type>::mergeFaceInfo
const polyPatch& patch,
const label nFaces,
const labelList& changedFaces,
const List<Type>& changedFacesInfo,
const bool
const List<Type>& changedFacesInfo
)
{
for (label changedFaceI = 0; changedFaceI < nFaces; changedFaceI++)
@ -599,8 +599,7 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
patch,
nReceiveFaces,
receiveFaces,
receiveFacesInfo,
procPatch.parallel()
receiveFacesInfo
);
}
}
@ -619,87 +618,42 @@ void Foam::FaceCellWave<Type>::handleCyclicPatches()
if (isA<cyclicPolyPatch>(patch))
{
label halfSize = patch.size()/2;
const cyclicPolyPatch& nbrPatch =
refCast<const cyclicPolyPatch>(patch).neighbPatch();
// Allocate buffers
label nSendFaces;
labelList sendFaces(halfSize);
List<Type> sendFacesInfo(halfSize);
label nReceiveFaces;
labelList receiveFaces(halfSize);
List<Type> receiveFacesInfo(halfSize);
labelList receiveFaces(patch.size());
List<Type> receiveFacesInfo(patch.size());
// Half1: Determine which faces changed. Use sendFaces for storage
nSendFaces = getChangedPatchFaces
(
patch,
0,
halfSize,
sendFaces,
sendFacesInfo
);
// Half2: Determine which faces changed. Use receiveFaces_ ,,
// Determine which faces changed
nReceiveFaces = getChangedPatchFaces
(
patch,
halfSize,
halfSize,
nbrPatch,
0,
nbrPatch.size(),
receiveFaces,
receiveFacesInfo
);
//Info<< "Half1:" << endl;
//writeFaces(nSendFaces, sendFaces, sendFacesInfo, Info);
//Info<< endl;
//
//Info<< "Half2:" << endl;
//writeFaces(nReceiveFaces, receiveFaces, receiveFacesInfo, Info);
//Info<< endl;
// Half1: Adapt wallInfo for leaving domain
// Adapt wallInfo for leaving domain
leaveDomain
(
patch,
nSendFaces,
sendFaces,
sendFacesInfo
);
// Half2: Adapt wallInfo for leaving domain
leaveDomain
(
patch,
nbrPatch,
nReceiveFaces,
receiveFaces,
receiveFacesInfo
);
// Half1: 'transfer' to other side by offsetting patchFaceI
offset(patch, halfSize, nSendFaces, sendFaces);
// Half2: 'transfer' to other side
offset(patch, -halfSize, nReceiveFaces, receiveFaces);
// Apply rotation for non-parallel planes
const cyclicPolyPatch& cycPatch =
refCast<const cyclicPolyPatch>(patch);
if (!cycPatch.parallel())
{
// sendFaces = received data from half1
// received data from other half
transform
(
cycPatch.forwardT(),
nSendFaces,
sendFacesInfo
);
// receiveFaces = received data from half2
transform
(
cycPatch.reverseT(),
nReceiveFaces,
receiveFacesInfo
);
@ -707,25 +661,15 @@ void Foam::FaceCellWave<Type>::handleCyclicPatches()
if (debug)
{
Pout<< " Cyclic patch " << patchI << ' ' << patch.name()
<< " Changed on first half : " << nSendFaces
<< " Changed on second half : " << nReceiveFaces
Pout<< " Cyclic patch " << patchI << ' ' << cycPatch.name()
<< " Changed : " << nReceiveFaces
<< endl;
}
// Half1: Adapt wallInfo for entering domain
enterDomain
(
patch,
nSendFaces,
sendFaces,
sendFacesInfo
);
// Half2: Adapt wallInfo for entering domain
enterDomain
(
patch,
cycPatch,
nReceiveFaces,
receiveFaces,
receiveFacesInfo
@ -734,25 +678,15 @@ void Foam::FaceCellWave<Type>::handleCyclicPatches()
// Merge into global storage
mergeFaceInfo
(
patch,
nSendFaces,
sendFaces,
sendFacesInfo,
cycPatch.parallel()
);
// Merge into global storage
mergeFaceInfo
(
patch,
cycPatch,
nReceiveFaces,
receiveFaces,
receiveFacesInfo,
cycPatch.parallel()
receiveFacesInfo
);
if (debug)
{
checkCyclic(patch);
checkCyclic(cycPatch);
}
}
}

View File

@ -192,8 +192,7 @@ class FaceCellWave
const polyPatch& patch,
const label nFaces,
const labelList&,
const List<Type>&,
const bool isParallel
const List<Type>&
);
//- Extract info for single patch only

View File

@ -33,25 +33,25 @@ Foam::NamedEnum<Enum, nEnum>::NamedEnum()
:
HashTable<int>(2*nEnum)
{
for (int enumI = 0; enumI < nEnum; ++enumI)
for (int i=0; i<nEnum; i++)
{
if (!names[enumI] || names[enumI][0] == '\0')
if (!names[i] || names[i][0] == '\0')
{
stringList goodNames(enumI);
stringList goodNames(i);
for (int i = 0; i < enumI; ++i)
for (int j = 0; j < i; j++)
{
goodNames[i] = names[i];
goodNames[j] = names[j];
}
FatalErrorIn("NamedEnum<Enum, nEnum>::NamedEnum()")
<< "Illegal enumeration name at position " << enumI << endl
<< "Illegal enumeration name at position " << i << endl
<< "after entries " << goodNames << ".\n"
<< "Possibly your NamedEnum<Enum, nEnum>::names array"
<< " is not of size " << nEnum << endl
<< abort(FatalError);
}
insert(names[enumI], enumI);
insert(names[i], i);
}
}
@ -61,7 +61,7 @@ Foam::NamedEnum<Enum, nEnum>::NamedEnum()
template<class Enum, int nEnum>
Enum Foam::NamedEnum<Enum, nEnum>::read(Istream& is) const
{
const word name(is);
word name(is);
HashTable<int>::const_iterator iter = find(name);
@ -71,7 +71,7 @@ Enum Foam::NamedEnum<Enum, nEnum>::read(Istream& is) const
(
"NamedEnum<Enum, nEnum>::read(Istream&) const", is
) << name << " is not in enumeration: "
<< sortedToc() << exit(FatalIOError);
<< toc() << exit(FatalIOError);
}
return Enum(iter());

View File

@ -0,0 +1,289 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "IOFieldField.H"
#include "labelList.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class T, class BaseType>
void Foam::IOFieldField<T, BaseType>::readFromStream()
{
Istream& is = readStream(word::null);
if (headerClassName() == IOField<T>::typeName)
{
is >> static_cast<Field<T>&>(*this);
close();
}
else if (headerClassName() == typeName)
{
is >> *this;
close();
}
else
{
FatalIOErrorIn
(
"IOFieldField<T, BaseType>::readFromStream()",
is
) << "unexpected class name " << headerClassName()
<< " expected " << typeName << " or " << IOField<T>::typeName
<< endl
<< " while reading object " << name()
<< exit(FatalIOError);
}
}
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template<class T, class BaseType>
Foam::IOFieldField<T, BaseType>::IOFieldField(const IOobject& io)
:
regIOobject(io)
{
if
(
io.readOpt() == IOobject::MUST_READ
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readFromStream();
}
}
template<class T, class BaseType>
Foam::IOFieldField<T, BaseType>::IOFieldField
(
const IOobject& io,
const label size
)
:
regIOobject(io)
{
if
(
io.readOpt() == IOobject::MUST_READ
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readFromStream();
}
else
{
Field<T>::setSize(size);
}
}
template<class T, class BaseType>
Foam::IOFieldField<T, BaseType>::IOFieldField
(
const IOobject& io,
const Field<T>& list
)
:
regIOobject(io)
{
if
(
io.readOpt() == IOobject::MUST_READ
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readFromStream();
}
else
{
Field<T>::operator=(list);
}
}
template<class T, class BaseType>
Foam::IOFieldField<T, BaseType>::IOFieldField
(
const IOobject& io,
const Xfer<Field<T> >& list
)
:
regIOobject(io)
{
Field<T>::transfer(list());
if
(
io.readOpt() == IOobject::MUST_READ
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readFromStream();
}
}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class T, class BaseType>
Foam::IOFieldField<T, BaseType>::~IOFieldField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T, class BaseType>
bool Foam::IOFieldField<T, BaseType>::writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp
) const
{
if (fmt == IOstream::ASCII)
{
// Change type to be non-compact format type
const word oldTypeName = typeName;
const_cast<word&>(typeName) = IOField<T>::typeName;
bool good = regIOobject::writeObject(fmt, ver, cmp);
// Change type back
const_cast<word&>(typeName) = oldTypeName;
return good;
}
else
{
return regIOobject::writeObject(fmt, ver, cmp);
}
}
template<class T, class BaseType>
bool Foam::IOFieldField<T, BaseType>::writeData(Ostream& os) const
{
return (os << *this).good();
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class T, class BaseType>
void Foam::IOFieldField<T, BaseType>::operator=
(
const IOFieldField<T, BaseType>& rhs
)
{
Field<T>::operator=(rhs);
}
template<class T, class BaseType>
void Foam::IOFieldField<T, BaseType>::operator=(const Field<T>& rhs)
{
Field<T>::operator=(rhs);
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class T, class BaseType>
Foam::Istream& Foam::operator>>
(
Foam::Istream& is,
Foam::IOFieldField<T, BaseType>& L
)
{
// Read compact
const labelList start(is);
const Field<BaseType> elems(is);
// Convert
L.setSize(start.size()-1);
forAll(L, i)
{
T& subField = L[i];
label index = start[i];
subField.setSize(start[i+1] - index);
forAll(subField, j)
{
subField[j] = elems[index++];
}
}
return is;
}
template<class T, class BaseType>
Foam::Ostream& Foam::operator<<
(
Foam::Ostream& os,
const Foam::IOFieldField<T, BaseType>& L
)
{
// Keep ascii writing same.
if (os.format() == IOstream::ASCII)
{
os << static_cast<const Field<T>&>(L);
}
else
{
// Convert to compact format
labelList start(L.size()+1);
start[0] = 0;
for (label i = 1; i < start.size(); i++)
{
start[i] = start[i-1]+L[i-1].size();
}
Field<BaseType> elems(start[start.size()-1]);
label elemI = 0;
forAll(L, i)
{
const T& subField = L[i];
forAll(subField, j)
{
elems[elemI++] = subField[j];
}
}
os << start << elems;
}
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,155 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::IOFieldField
Description
A Field of objects of type \<T\> with automated input and output.
SourceFiles
IOFieldField.C
\*---------------------------------------------------------------------------*/
#ifndef IOFieldField_H
#define IOFieldField_H
#include "IOField.H"
#include "regIOobject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class Istream;
class Ostream;
// Forward declaration of friend functions and operators
template<class T, class BaseType> class IOFieldField;
template<class T, class BaseType> Istream& operator>>
(
Istream&,
IOFieldField<T, BaseType>&
);
template<class T, class BaseType> Ostream& operator<<
(
Ostream&,
const IOFieldField<T, BaseType>&
);
/*---------------------------------------------------------------------------*\
Class IOFieldField Declaration
\*---------------------------------------------------------------------------*/
template<class T, class BaseType>
class IOFieldField
:
public regIOobject,
public Field<T>
{
// Private Member Functions
//- Read according to header type
void readFromStream();
public:
//- Runtime type information
TypeName("FieldField");
// Constructors
//- Construct from IOobject
IOFieldField(const IOobject&);
//- Construct from IOobject and size of IOFieldField
IOFieldField(const IOobject&, const label);
//- Construct from IOobject and a Field
IOFieldField(const IOobject&, const Field<T>&);
//- Construct by transferring the Field contents
IOFieldField(const IOobject&, const Xfer<Field<T> >&);
// Destructor
virtual ~IOFieldField();
// Member functions
virtual bool writeObject
(
IOstream::streamFormat,
IOstream::versionNumber,
IOstream::compressionType
) const;
virtual bool writeData(Ostream&) const;
// Member operators
void operator=(const IOFieldField<T, BaseType>&);
void operator=(const Field<T>&);
// IOstream operators
//- Read Field from Istream, discarding contents of existing Field.
friend Istream& operator>> <T, BaseType>
(
Istream&,
IOFieldField<T, BaseType>&
);
// Write Field to Ostream.
friend Ostream& operator<< <T, BaseType>
(
Ostream&,
const IOFieldField<T, BaseType>&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "IOFieldField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,285 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "IOListList.H"
#include "labelList.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class T, class BaseType>
void Foam::IOListList<T, BaseType>::readFromStream()
{
Istream& is = readStream(word::null);
if (headerClassName() == IOList<T>::typeName)
{
is >> static_cast<List<T>&>(*this);
close();
}
else if (headerClassName() == typeName)
{
is >> *this;
close();
}
else
{
FatalIOErrorIn
(
"IOListList<T, BaseType>::readFromStream()",
is
) << "unexpected class name " << headerClassName()
<< " expected " << typeName << " or " << IOList<T>::typeName
<< endl
<< " while reading object " << name()
<< exit(FatalIOError);
}
}
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template<class T, class BaseType>
Foam::IOListList<T, BaseType>::IOListList(const IOobject& io)
:
regIOobject(io)
{
if
(
io.readOpt() == IOobject::MUST_READ
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readFromStream();
}
}
template<class T, class BaseType>
Foam::IOListList<T, BaseType>::IOListList(const IOobject& io, const label size)
:
regIOobject(io)
{
if
(
io.readOpt() == IOobject::MUST_READ
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readFromStream();
}
else
{
List<T>::setSize(size);
}
}
template<class T, class BaseType>
Foam::IOListList<T, BaseType>::IOListList
(
const IOobject& io,
const List<T>& list
)
:
regIOobject(io)
{
if
(
io.readOpt() == IOobject::MUST_READ
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readFromStream();
}
else
{
List<T>::operator=(list);
}
}
template<class T, class BaseType>
Foam::IOListList<T, BaseType>::IOListList
(
const IOobject& io,
const Xfer<List<T> >& list
)
:
regIOobject(io)
{
List<T>::transfer(list());
if
(
io.readOpt() == IOobject::MUST_READ
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readFromStream();
}
}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class T, class BaseType>
Foam::IOListList<T, BaseType>::~IOListList()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T, class BaseType>
bool Foam::IOListList<T, BaseType>::writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp
) const
{
if (fmt == IOstream::ASCII)
{
// Change type to be non-compact format type
const word oldTypeName = typeName;
const_cast<word&>(typeName) = IOList<T>::typeName;
bool good = regIOobject::writeObject(fmt, ver, cmp);
// Change type back
const_cast<word&>(typeName) = oldTypeName;
return good;
}
else
{
return regIOobject::writeObject(fmt, ver, cmp);
}
}
template<class T, class BaseType>
bool Foam::IOListList<T, BaseType>::writeData(Ostream& os) const
{
return (os << *this).good();
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class T, class BaseType>
void Foam::IOListList<T, BaseType>::operator=
(
const IOListList<T, BaseType>& rhs
)
{
List<T>::operator=(rhs);
}
template<class T, class BaseType>
void Foam::IOListList<T, BaseType>::operator=(const List<T>& rhs)
{
List<T>::operator=(rhs);
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class T, class BaseType>
Foam::Istream& Foam::operator>>
(
Foam::Istream& is,
Foam::IOListList<T, BaseType>& L
)
{
// Read compact
const labelList start(is);
const List<BaseType> elems(is);
// Convert
L.setSize(start.size()-1);
forAll(L, i)
{
T& subList = L[i];
label index = start[i];
subList.setSize(start[i+1] - index);
forAll(subList, j)
{
subList[j] = elems[index++];
}
}
return is;
}
template<class T, class BaseType>
Foam::Ostream& Foam::operator<<
(
Foam::Ostream& os,
const Foam::IOListList<T, BaseType>& L
)
{
// Keep ascii writing same.
if (os.format() == IOstream::ASCII)
{
os << static_cast<const List<T>&>(L);
}
else
{
// Convert to compact format
labelList start(L.size()+1);
start[0] = 0;
for (label i = 1; i < start.size(); i++)
{
start[i] = start[i-1]+L[i-1].size();
}
List<BaseType> elems(start[start.size()-1]);
label elemI = 0;
forAll(L, i)
{
const T& subList = L[i];
forAll(subList, j)
{
elems[elemI++] = subList[j];
}
}
os << start << elems;
}
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,155 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::IOListList
Description
A List of objects of type \<T\> with automated input and output.
SourceFiles
IOListList.C
\*---------------------------------------------------------------------------*/
#ifndef IOListList_H
#define IOListList_H
#include "IOList.H"
#include "regIOobject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class Istream;
class Ostream;
// Forward declaration of friend functions and operators
template<class T, class BaseType> class IOListList;
template<class T, class BaseType> Istream& operator>>
(
Istream&,
IOListList<T, BaseType>&
);
template<class T, class BaseType> Ostream& operator<<
(
Ostream&,
const IOListList<T, BaseType>&
);
/*---------------------------------------------------------------------------*\
Class IOListList Declaration
\*---------------------------------------------------------------------------*/
template<class T, class BaseType>
class IOListList
:
public regIOobject,
public List<T>
{
// Private Member Functions
//- Read according to header type
void readFromStream();
public:
//- Runtime type information
TypeName("ListList");
// Constructors
//- Construct from IOobject
IOListList(const IOobject&);
//- Construct from IOobject and size of IOListList
IOListList(const IOobject&, const label);
//- Construct from IOobject and a List
IOListList(const IOobject&, const List<T>&);
//- Construct by transferring the List contents
IOListList(const IOobject&, const Xfer<List<T> >&);
// Destructor
virtual ~IOListList();
// Member functions
virtual bool writeObject
(
IOstream::streamFormat,
IOstream::versionNumber,
IOstream::compressionType
) const;
virtual bool writeData(Ostream&) const;
// Member operators
void operator=(const IOListList<T, BaseType>&);
void operator=(const List<T>&);
// IOstream operators
//- Read List from Istream, discarding contents of existing List.
friend Istream& operator>> <T, BaseType>
(
Istream&,
IOListList<T, BaseType>&
);
// Write List to Ostream.
friend Ostream& operator<< <T, BaseType>
(
Ostream&,
const IOListList<T, BaseType>&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "IOListList.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -552,9 +552,8 @@ bool Foam::Time::end() const
}
bool Foam::Time::stopAt(const stopAtControls sa) const
void Foam::Time::stopAt(const stopAtControls sa) const
{
const bool changed = (stopAt_ != sa);
stopAt_ = sa;
// adjust endTime
@ -566,7 +565,6 @@ bool Foam::Time::stopAt(const stopAtControls sa) const
{
endTime_ = GREAT;
}
return changed;
}

View File

@ -406,8 +406,7 @@ public:
//- Adjust the current stopAtControl. Note that this value
// only persists until the next time the dictionary is read.
// Return true if the stopAtControl changed.
virtual bool stopAt(const stopAtControls) const;
virtual void stopAt(const stopAtControls) const;
//- Reset the time and time-index to those of the given time
virtual void setTime(const Time&);

View File

@ -191,14 +191,10 @@ public:
Istream&
);
//- Construct top-level dictionary from Istream,
// reading entries until EOF
//- Construct top-level dictionary from Istream, reading entries
// until EOF
dictionary(Istream&);
//- Construct top-level dictionary from Istream,
// reading entries until EOF, optionally keeping the header
dictionary(Istream&, const bool keepHeader);
//- Construct as copy given the parent dictionary
dictionary(const dictionary& parentDict, const dictionary&);
@ -445,9 +441,6 @@ public:
//- Read dictionary from Istream
bool read(Istream&);
//- Read dictionary from Istream, optionally keeping the header
bool read(Istream&, const bool keepHeader);
// Write

View File

@ -28,6 +28,68 @@ License
#include "inputModeEntry.H"
#include "regExp.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::dictionary::read(Istream& is)
{
if (!is.good())
{
FatalIOErrorIn("dictionary::read(Istream&, const word&)", is)
<< "Istream not OK for reading dictionary "
<< exit(FatalIOError);
return false;
}
token currToken(is);
if (currToken != token::BEGIN_BLOCK)
{
is.putBack(currToken);
}
while (!is.eof() && entry::New(*this, is))
{}
// Remove the FoamFile header entry if it exists
remove("FoamFile");
if (is.bad())
{
Info<< "dictionary::read(Istream&, const word&) : "
<< "Istream not OK after reading dictionary " << name()
<< endl;
return false;
}
return true;
}
bool Foam::dictionary::substituteKeyword(const word& keyword)
{
word varName = keyword(1, keyword.size()-1);
// lookup the variable name in the given dictionary
const entry* ePtr = lookupEntryPtr(varName, true, true);
// if defined insert its entries into this dictionary
if (ePtr != NULL)
{
const dictionary& addDict = ePtr->dict();
forAllConstIter(IDLList<entry>, addDict, iter)
{
add(iter());
}
return true;
}
return false;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::dictionary::dictionary
@ -56,97 +118,12 @@ Foam::dictionary::dictionary(Istream& is)
}
Foam::dictionary::dictionary(Istream& is, const bool keepHeader)
:
dictionaryName(is.name()),
parent_(dictionary::null)
{
// Reset input mode as this is a "top-level" dictionary
functionEntries::inputModeEntry::clear();
read(is, keepHeader);
}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::dictionary> Foam::dictionary::New(Istream& is)
{
return autoPtr<dictionary>(new dictionary(is));
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::dictionary::read(Istream& is, const bool keepHeader)
{
if (!is.good())
{
FatalIOErrorIn("dictionary::read(Istream&, const bool)", is)
<< "Istream not OK for reading dictionary "
<< exit(FatalIOError);
return false;
}
token currToken(is);
if (currToken != token::BEGIN_BLOCK)
{
is.putBack(currToken);
}
while (!is.eof() && entry::New(*this, is))
{}
// normally remove the FoamFile header entry if it exists
if (!keepHeader)
{
remove("FoamFile");
}
if (is.bad())
{
Info<< "dictionary::read(Istream&, bool) : "
<< "Istream not OK after reading dictionary " << name()
<< endl;
return false;
}
return true;
}
bool Foam::dictionary::read(Istream& is)
{
return this->read(is, false);
}
bool Foam::dictionary::substituteKeyword(const word& keyword)
{
word varName = keyword(1, keyword.size()-1);
// lookup the variable name in the given dictionary
const entry* ePtr = lookupEntryPtr(varName, true, true);
// if defined insert its entries into this dictionary
if (ePtr != NULL)
{
const dictionary& addDict = ePtr->dict();
forAllConstIter(IDLList<entry>, addDict, iter)
{
add(iter());
}
return true;
}
return false;
}
// * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, dictionary& dict)
@ -168,7 +145,7 @@ void Foam::dictionary::write(Ostream& os, bool subDict) const
{
if (subDict)
{
os << nl << indent << token::BEGIN_BLOCK << incrIndent << nl;
os << nl << indent << token::BEGIN_BLOCK << incrIndent << nl;
}
forAllConstIter(IDLList<entry>, *this, iter)
@ -176,12 +153,12 @@ void Foam::dictionary::write(Ostream& os, bool subDict) const
const entry& e = *iter;
// Write entry
os << e;
os << e;
// Add extra new line between entries for "top-level" dictionaries
if (!subDict && parent() == dictionary::null && e != *last())
{
os << nl;
os << nl;
}
// Check stream before going to next entry.
@ -196,7 +173,7 @@ void Foam::dictionary::write(Ostream& os, bool subDict) const
if (subDict)
{
os << decrIndent << indent << token::END_BLOCK << endl;
os << decrIndent << indent << token::END_BLOCK << endl;
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -68,25 +68,17 @@ Foam::outputFilterOutputControl::~outputFilterOutputControl()
void Foam::outputFilterOutputControl::read(const dictionary& dict)
{
if (dict.found("outputControl"))
{
outputControl_ = outputControlNames_.read(dict.lookup("outputControl"));
}
else
{
outputControl_ = ocTimeStep;
}
outputControl_ = outputControlNames_.read(dict.lookup("outputControl"));
switch (outputControl_)
{
case ocTimeStep:
{
outputInterval_ = dict.lookupOrDefault<label>("outputInterval", 0);
break;
dict.lookup("outputInterval") >> outputInterval_;
}
default:
{
break;
// do nothing
}
}
}
@ -112,12 +104,10 @@ bool Foam::outputFilterOutputControl::output() const
}
default:
{
// this error should not actually be possible
FatalErrorIn("bool Foam::outputFilterOutputControl::output()")
<< "Undefined output control: "
<< "Unknown output control: "
<< outputControlNames_[outputControl_] << nl
<< abort(FatalError);
break;
}
}

View File

@ -25,8 +25,6 @@ Class
Foam::outputFilterOutputControl
Description
An output control for function objects.
The default is time-step execution at every interval.
SourceFiles
outputFilterOutputControl.C
@ -53,11 +51,10 @@ class outputFilterOutputControl
{
public:
//- The output control options
enum outputControls
{
ocTimeStep, /*!< execution is coupled to the time-step */
ocOutputTime /*!< execution is coupled to the output-time */
ocTimeStep,
ocOutputTime
};
@ -74,7 +71,7 @@ private:
//- Type of output
outputControls outputControl_;
//- The execution interval (in time steps) when using @c timeStep mode,
//- The execution interval (in time steps) when using TIMESTEP mode
// a value <= 1 means execute at every time step
label outputInterval_;

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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
labelField with IO.
\*---------------------------------------------------------------------------*/
#include "labelFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebugWithName
(
labelFieldIOField,
"labelFieldField",
0
);
defineTemplateTypeNameAndDebugWithName
(
labelIOFieldField,
"labelCompactFieldField",
0
);
}
// ************************************************************************* //

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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::labelFieldIOField
Description
labelFieldField with IO.
\*---------------------------------------------------------------------------*/
#ifndef labelFieldIOField_H
#define labelFieldIOField_H
#include "labelField.H"
#include "IOField.H"
#include "IOFieldField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOField<labelField> labelFieldIOField;
typedef IOFieldField<labelField, label> labelIOFieldField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
scalarField with IO.
\*---------------------------------------------------------------------------*/
#include "scalarFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebugWithName
(
scalarFieldIOField,
"scalarFieldField",
0
);
defineTemplateTypeNameAndDebugWithName
(
scalarIOFieldField,
"scalarCompactFieldField",
0
);
}
// ************************************************************************* //

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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::scalarFieldIOField
Description
scalarFieldField with IO.
\*---------------------------------------------------------------------------*/
#ifndef scalarFieldIOField_H
#define scalarFieldIOField_H
#include "scalarField.H"
#include "IOField.H"
#include "IOFieldField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOField<scalarField> scalarFieldIOField;
typedef IOFieldField<scalarField, scalar> scalarIOFieldField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
vectorField with IO.
\*---------------------------------------------------------------------------*/
#include "vectorFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebugWithName
(
vectorFieldIOField,
"vectorFieldField",
0
);
defineTemplateTypeNameAndDebugWithName
(
vectorIOFieldField,
"vectorCompactFieldField",
0
);
}
// ************************************************************************* //

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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::vectorFieldIOField
Description
vectorFieldField with IO.
\*---------------------------------------------------------------------------*/
#ifndef vectorFieldIOField_H
#define vectorFieldIOField_H
#include "vectorField.H"
#include "IOField.H"
#include "IOFieldField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOField<vectorField> vectorFieldIOField;
typedef IOFieldField<vectorField, vector> vectorIOFieldField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -26,6 +26,7 @@ License
#include "emptyPolyPatch.H"
#include "commSchedule.H"
#include "globalMeshData.H"
#include "cyclicPolyPatch.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -251,6 +252,29 @@ GeometricBoundaryField
{
if (bmesh_[patchi].type() != emptyPolyPatch::typeName)
{
if
(
bmesh_[patchi].type() == cyclicPolyPatch::typeName
&& !dict.found(bmesh_[patchi].name())
)
{
FatalIOErrorIn
(
"GeometricField<Type, PatchField, GeoMesh>::\n"
"GeometricBoundaryField::GeometricBoundaryField\n"
"(\n"
" const BoundaryMesh&,\n"
" const DimensionedField<Type, GeoMesh>&,\n"
" const dictionary&\n"
")",
dict
) << "Cannot find patchField entry for cyclic "
<< bmesh_[patchi].name() << endl
<< "Is your field uptodate with split cyclics?" << endl
<< "Run foamUpgradeCyclics to convert mesh and fields"
<< " to split cyclics." << exit(FatalIOError);
}
set
(
patchi,
@ -322,7 +346,11 @@ evaluate()
}
// Block for any outstanding requests
if (Pstream::defaultCommsType == Pstream::nonBlocking)
if
(
Pstream::parRun()
&& Pstream::defaultCommsType == Pstream::nonBlocking
)
{
Pstream::waitRequests();
}

View File

@ -27,6 +27,7 @@ License
#include "Time.H"
#include "demandDrivenData.H"
#include "dictionary.H"
#include "data.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -918,6 +919,15 @@ bool Foam::GeometricField<Type, PatchField, GeoMesh>::needReference() const
template<class Type, template<class> class PatchField, class GeoMesh>
void Foam::GeometricField<Type, PatchField, GeoMesh>::relax(const scalar alpha)
{
if (debug)
{
InfoIn
(
"GeometricField<Type, PatchField, GeoMesh>::relax"
"(const scalar alpha)"
) << "Relaxing" << endl << this->info() << " by " << alpha << endl;
}
operator==(prevIter() + alpha*(*this - prevIter()));
}
@ -925,16 +935,33 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::relax(const scalar alpha)
template<class Type, template<class> class PatchField, class GeoMesh>
void Foam::GeometricField<Type, PatchField, GeoMesh>::relax()
{
scalar alpha = 0;
word name = this->name();
if (this->mesh().relax(this->name()))
if (this->mesh().data::lookupOrDefault<bool>("finalIteration", false))
{
alpha = this->mesh().relaxationFactor(this->name());
name += "Final";
}
if (alpha > 0)
if (this->mesh().relax(name))
{
relax(alpha);
relax(this->mesh().relaxationFactor(name));
}
}
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::word Foam::GeometricField<Type, PatchField, GeoMesh>::select
(
bool final
) const
{
if (final)
{
return this->name() + "Final";
}
else
{
return this->name();
}
}

View File

@ -476,6 +476,11 @@ public:
// alpha is read from controlDict
void relax();
//- Select the final iteration parameters if `final' is true
// by returning the field name + "Final"
// otherwise the standard parameters by returning the field name
word select(bool final) const;
// Member function *this operators

View File

@ -25,6 +25,8 @@ License
#include "cyclicPointPatchField.H"
#include "Swap.H"
#include "transformField.H"
#include "pointFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -127,28 +129,57 @@ void cyclicPointPatchField<Type>::swapAddSeparated
Field<Type>& pField
) const
{
Field<Type> pf(this->patchInternalField(pField));
// Get neighbouring pointPatch
const cyclicPointPatch& nbrPatch = cyclicPatch_.neighbPatch();
const edgeList& pairs = cyclicPatch_.transformPairs();
if (doTransform())
if (cyclicPatch_.cyclicPatch().owner())
{
forAll(pairs, pairi)
{
Type tmp = pf[pairs[pairi][0]];
pf[pairs[pairi][0]] = transform(forwardT()[0], pf[pairs[pairi][1]]);
pf[pairs[pairi][1]] = transform(reverseT()[0], tmp);
}
}
else
{
forAll(pairs, pairi)
{
Swap(pf[pairs[pairi][0]], pf[pairs[pairi][1]]);
}
}
// We inplace modify pField. To prevent the other side (which gets
// evaluated at a later date) using already changed values we do
// all swaps on the side that gets evaluated first.
addToInternalField(pField, pf, cyclicPatch_.separatedPoints());
// Get neighbouring pointPatchField
const GeometricField<Type, pointPatchField, pointMesh>& fld =
refCast<const GeometricField<Type, pointPatchField, pointMesh> >
(
this->dimensionedInternalField()
);
const cyclicPointPatchField<Type>& nbr =
refCast<const cyclicPointPatchField<Type> >
(
fld.boundaryField()[nbrPatch.index()]
);
Field<Type> pf(this->patchInternalField(pField));
Field<Type> nbrPf(nbr.patchInternalField(pField));
const edgeList& pairs = cyclicPatch_.transformPairs();
if (doTransform())
{
// Transform both sides.
forAll(pairs, pairi)
{
label pointi = pairs[pairi][0];
label nbrPointi = pairs[pairi][1];
Type tmp = pf[pointi];
pf[pointi] = transform(forwardT()[0], nbrPf[nbrPointi]);
nbrPf[nbrPointi] = transform(reverseT()[0], tmp);
}
}
else
{
forAll(pairs, pairi)
{
Swap(pf[pairs[pairi][0]], nbrPf[pairs[pairi][1]]);
}
}
addToInternalField(pField, pf);
nbr.addToInternalField(pField, nbrPf);
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include "cyclicSlipPointPatchField.H"
#include "pointConstraint.H"
#include "transformField.H"
#include "symmTransformField.H"
@ -104,17 +103,6 @@ void cyclicSlipPointPatchField<Type>::evaluate(const Pstream::commsTypes)
}
template<class Type>
void cyclicSlipPointPatchField<Type>::applyConstraint
(
const label pointi,
pointConstraint& pc
) const
{
pc.applyConstraint(this->patch().pointNormals()[pointi]);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,7 @@ Class
Foam::cyclicSlipPointPatchField
Description
Specialisation of cyclic that constrains to the patch
Cyclic + slip constraints
SourceFiles
cyclicSlipPointPatchField.C
@ -36,6 +36,7 @@ SourceFiles
#define cyclicSlipPointPatchField_H
#include "cyclicPointPatchField.H"
#include "cyclicSlipPointPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,7 +56,7 @@ class cyclicSlipPointPatchField
public:
//- Runtime type information
TypeName("cyclicSlip");
TypeName(cyclicSlipPointPatch::typeName_());
// Constructors
@ -121,18 +122,13 @@ public:
// Member functions
//- Update the patch field
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::blocking
);
// Evaluation functions
//- Accumulate the effect of constraint direction of this patch
virtual void applyConstraint
(
const label pointi,
pointConstraint&
) const;
//- Evaluate the patch field
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::blocking
);
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "processorPointPatchField.H"
#include "transformField.H"
//#include "transformField.H"
#include "processorPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -102,26 +102,27 @@ void processorPointPatchField<Type>::initSwapAddSeparated
)
const
{
if (Pstream::parRun())
{
// Get internal field into correct order for opposite side
Field<Type> pf
(
this->patchInternalField
(
pField,
procPatch_.reverseMeshPoints()
)
);
OPstream::write
(
commsType,
procPatch_.neighbProcNo(),
reinterpret_cast<const char*>(pf.begin()),
pf.byteSize()
);
}
// if (Pstream::parRun())
// {
// // Get internal field into correct order for opposite side
// Field<Type> pf
// (
// this->patchInternalField
// (
// pField,
// procPatch_.reverseMeshPoints()
// )
// );
//
// OPstream::write
// (
// commsType,
// procPatch_.neighbProcNo(),
// reinterpret_cast<const char*>(pf.begin()),
// pf.byteSize(),
// procPatch_.tag()
// );
// }
}
@ -132,44 +133,29 @@ void processorPointPatchField<Type>::swapAddSeparated
Field<Type>& pField
) const
{
if (Pstream::parRun())
{
Field<Type> pnf(this->size());
IPstream::read
(
commsType,
procPatch_.neighbProcNo(),
reinterpret_cast<char*>(pnf.begin()),
pnf.byteSize()
);
if (doTransform())
{
const processorPolyPatch& ppp = procPatch_.procPolyPatch();
const tensorField& forwardT = ppp.forwardT();
if (forwardT.size() == 1)
{
transform(pnf, forwardT[0], pnf);
}
else
{
const labelListList& pointFaces = ppp.pointFaces();
forAll(pointFaces, pfi)
{
pnf[pfi] = transform
(
forwardT[pointFaces[pfi][0]],
pnf[pfi]
);
}
}
}
addToInternalField(pField, pnf, procPatch_.separatedPoints());
}
// if (Pstream::parRun())
// {
// Field<Type> pnf(this->size());
//
// IPstream::read
// (
// commsType,
// procPatch_.neighbProcNo(),
// reinterpret_cast<char*>(pnf.begin()),
// pnf.byteSize(),
// procPatch_.tag()
// );
//
// if (doTransform())
// {
// const processorPolyPatch& ppp = procPatch_.procPolyPatch();
// const tensor& forwardT = ppp.forwardT();
//
// transform(pnf, forwardT, pnf);
// }
//
// addToInternalField(pField, pnf, procPatch_.separatedPoints());
// }
}

View File

@ -147,7 +147,7 @@ public:
}
}
//- Does the patch field perform the transfromation
//- Does the patch field perform the transformation
virtual bool doTransform() const
{
return

View File

@ -0,0 +1,167 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#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>::initSwapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>& pField
) const
{
if (Pstream::parRun())
{
// Get internal field into correct order for opposite side
Field<Type> pf
(
this->patchInternalField
(
pField,
procPatch_.reverseMeshPoints()
)
);
OPstream::write
(
commsType,
procPatch_.neighbProcNo(),
reinterpret_cast<const char*>(pf.begin()),
pf.byteSize(),
procPatch_.tag()
);
}
}
template<class Type>
void processorCyclicPointPatchField<Type>::swapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>& pField
) const
{
if (Pstream::parRun())
{
Field<Type> pnf(this->size());
IPstream::read
(
commsType,
procPatch_.neighbProcNo(),
reinterpret_cast<char*>(pnf.begin()),
pnf.byteSize(),
procPatch_.tag()
);
if (doTransform())
{
const processorCyclicPolyPatch& ppp =
procPatch_.procCyclicPolyPatch();
const tensor& forwardT = ppp.forwardT()[0];
transform(pnf, forwardT, pnf);
}
// All points are separated
addToInternalField(pField, pnf);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,201 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
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 non-collocated patch point values
virtual void initSwapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>&
) const;
//- Complete swap of patch point values and add to local values
virtual void swapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "processorCyclicPointPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "processorCyclicPointPatchFields.H"
#include "pointPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePointPatchFields(processorCyclic);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef processorCyclicPointPatchFields_H
#define processorCyclicPointPatchFields_H
#include "processorCyclicPointPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(processorCyclic);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -141,15 +141,7 @@ tmp<Field<Type1> > pointPatchField<Type>::patchInternalField
<< abort(FatalError);
}
tmp<Field<Type1> > tvalues(new Field<Type1>(meshPoints.size()));
Field<Type1>& values = tvalues();
forAll(meshPoints, pointI)
{
values[pointI] = iF[meshPoints[pointI]];
}
return tvalues;
return tmp<Field<Type1> >(new Field<Type1>(iF, meshPoints));
}

View File

@ -32,8 +32,7 @@ Description
#ifndef parRun_H
#define parRun_H
#include "OPstream.H"
#include "IPstream.H"
#include "Pstream.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -27,6 +27,7 @@ License
#include "lduMatrix.H"
#include "procLduMatrix.H"
#include "procLduInterface.H"
#include "cyclicLduInterface.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -160,19 +161,27 @@ void Foam::LUscalarMatrix::convert
{
const lduInterface& interface = interfaces[inti].interface();
const label* __restrict__ ulPtr = interface.faceCells().begin();
const scalar* __restrict__ upperLowerPtr =
interfaceCoeffs[inti].begin();
// Assume any interfaces are cyclic ones
register label inFaces = interface.faceCells().size()/2;
const label* __restrict__ lPtr = interface.faceCells().begin();
const cyclicLduInterface& cycInterface =
refCast<const cyclicLduInterface>(interface);
label nbrInt = cycInterface.neighbPatchID();
const label* __restrict__ uPtr =
interfaces[nbrInt].interface().faceCells().begin();
const scalar* __restrict__ nbrUpperLowerPtr =
interfaceCoeffs[nbrInt].begin();
register label inFaces = interface.faceCells().size();
for (register label face=0; face<inFaces; face++)
{
label uCell = ulPtr[face];
label lCell = ulPtr[face + inFaces];
label uCell = lPtr[face];
label lCell = uPtr[face];
operator[](uCell)[lCell] -= upperLowerPtr[face + inFaces];
operator[](lCell)[uCell] -= upperLowerPtr[face];
operator[](uCell)[lCell] -= nbrUpperLowerPtr[face];
}
}
}

View File

@ -65,6 +65,14 @@ public:
// Access
//- Return neighbour
virtual label neighbPatchID() const = 0;
virtual bool owner() const = 0;
//- Return processor number
virtual const cyclicLduInterface& neighbPatch() const = 0;
//- Return face transformation tensor
virtual const tensorField& forwardT() const = 0;

View File

@ -96,21 +96,6 @@ public:
const unallocLabelList& internalData
) const = 0;
//- Initialise interface data transfer
virtual void initTransfer
(
const Pstream::commsTypes commsType,
const unallocLabelList& interfaceData
) const
{}
//- Transfer and return neighbour field
virtual tmp<labelField> transfer
(
const Pstream::commsTypes commsType,
const unallocLabelList& interfaceData
) const = 0;
//- Initialise transfer of internal field adjacent to the interface
virtual void initInternalFieldTransfer
(

View File

@ -93,6 +93,8 @@ public:
//- Return face transformation tensor
virtual const tensorField& forwardT() const = 0;
//- Return message tag used for sending
virtual int tag() const = 0;
// Transfer functions

View File

@ -43,7 +43,8 @@ void Foam::processorLduInterface::send
commsType,
neighbProcNo(),
reinterpret_cast<const char*>(f.begin()),
f.byteSize()
f.byteSize(),
tag()
);
}
else if (commsType == Pstream::nonBlocking)
@ -55,7 +56,8 @@ void Foam::processorLduInterface::send
commsType,
neighbProcNo(),
receiveBuf_.begin(),
receiveBuf_.size()
receiveBuf_.size(),
tag()
);
resizeBuf(sendBuf_, f.byteSize());
@ -66,7 +68,8 @@ void Foam::processorLduInterface::send
commsType,
neighbProcNo(),
sendBuf_.begin(),
f.byteSize()
f.byteSize(),
tag()
);
}
else
@ -92,7 +95,8 @@ void Foam::processorLduInterface::receive
commsType,
neighbProcNo(),
reinterpret_cast<char*>(f.begin()),
f.byteSize()
f.byteSize(),
tag()
);
}
else if (commsType == Pstream::nonBlocking)
@ -155,7 +159,8 @@ void Foam::processorLduInterface::compressedSend
commsType,
neighbProcNo(),
sendBuf_.begin(),
nBytes
nBytes,
tag()
);
}
else if (commsType == Pstream::nonBlocking)
@ -167,7 +172,8 @@ void Foam::processorLduInterface::compressedSend
commsType,
neighbProcNo(),
receiveBuf_.begin(),
receiveBuf_.size()
receiveBuf_.size(),
tag()
);
OPstream::write
@ -175,7 +181,8 @@ void Foam::processorLduInterface::compressedSend
commsType,
neighbProcNo(),
sendBuf_.begin(),
nBytes
nBytes,
tag()
);
}
else
@ -215,7 +222,8 @@ void Foam::processorLduInterface::compressedReceive
commsType,
neighbProcNo(),
receiveBuf_.begin(),
nBytes
nBytes,
tag()
);
}
else if (commsType != Pstream::nonBlocking)

View File

@ -47,19 +47,10 @@ void Foam::cyclicLduInterfaceField::transformCoupleField
{
if (doTransform())
{
label sizeby2 = pnf.size()/2;
scalar forwardScale =
pow(diag(forwardT()[0]).component(cmpt), rank());
scalar reverseScale =
pow(diag(reverseT()[0]).component(cmpt), rank());
for (label facei=0; facei<sizeby2; facei++)
{
pnf[facei] *= forwardScale;
pnf[facei + sizeby2] *= reverseScale;
}
pnf *= forwardScale;
}
}

View File

@ -111,10 +111,13 @@ void Foam::lduMatrix::updateMatrixInterfaces
)
{
// Block until all sends/receives have been finished
if (Pstream::defaultCommsType == Pstream::nonBlocking)
if
(
Pstream::parRun()
&& Pstream::defaultCommsType == Pstream::nonBlocking
)
{
IPstream::waitRequests();
OPstream::waitRequests();
UPstream::waitRequests();
}
forAll(interfaces, interfaceI)

View File

@ -229,12 +229,17 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
{
fineInterfaces[inti].initInternalFieldTransfer
(
Pstream::blocking,
Pstream::nonBlocking,
restrictMap
);
}
}
if (Pstream::parRun())
{
Pstream::waitRequests();
}
// Add the coarse level
forAll(fineInterfaces, inti)
{
@ -245,11 +250,13 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
inti,
GAMGInterface::New
(
inti,
coarseInterfaces,
fineInterfaces[inti],
fineInterfaces[inti].interfaceInternalField(restrictMap),
fineInterfaces[inti].internalFieldTransfer
(
Pstream::blocking,
Pstream::nonBlocking,
restrictMap
)
).ptr()

View File

@ -80,20 +80,16 @@ void Foam::cyclicGAMGInterfaceField::updateInterfaceMatrix
const Pstream::commsTypes
) const
{
scalarField pnf(size());
label sizeby2 = size()/2;
const unallocLabelList& faceCells = cyclicInterface_.faceCells();
for (label facei=0; facei<sizeby2; facei++)
{
pnf[facei] = psiInternal[faceCells[facei + sizeby2]];
pnf[facei + sizeby2] = psiInternal[faceCells[facei]];
}
// Get neighbouring field
scalarField pnf
(
cyclicInterface_.neighbPatch().interfaceInternalField(psiInternal)
);
transformCoupleField(pnf, cmpt);
const unallocLabelList& faceCells = cyclicInterface_.faceCells();
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];

View File

@ -0,0 +1,107 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "processorCyclicGAMGInterfaceField.H"
#include "addToRunTimeSelectionTable.H"
#include "lduMatrix.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(processorCyclicGAMGInterfaceField, 0);
addToRunTimeSelectionTable
(
GAMGInterfaceField,
processorCyclicGAMGInterfaceField,
lduInterface
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::processorCyclicGAMGInterfaceField::processorCyclicGAMGInterfaceField
(
const GAMGInterface& GAMGCp,
const lduInterfaceField& fineInterface
)
:
processorGAMGInterfaceField(GAMGCp, fineInterface)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::processorCyclicGAMGInterfaceField::~processorCyclicGAMGInterfaceField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//void Foam::processorCyclicGAMGInterfaceField::initInterfaceMatrixUpdate
//(
// const scalarField& psiInternal,
// scalarField&,
// const lduMatrix&,
// const scalarField&,
// const direction,
// const Pstream::commsTypes commsType
//) const
//{
// procInterface_.compressedSend
// (
// commsType,
// procInterface_.interfaceInternalField(psiInternal)()
// );
//}
//
//
//void Foam::processorCyclicGAMGInterfaceField::updateInterfaceMatrix
//(
// const scalarField&,
// scalarField& result,
// const lduMatrix&,
// const scalarField& coeffs,
// const direction cmpt,
// const Pstream::commsTypes commsType
//) const
//{
// scalarField pnf
// (
// procInterface_.compressedReceive<scalar>(commsType, coeffs.size())
// );
// transformCoupleField(pnf, cmpt);
//
// const unallocLabelList& faceCells = procInterface_.faceCells();
//
// forAll(faceCells, elemI)
// {
// result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
// }
//}
// ************************************************************************* //

View File

@ -0,0 +1,173 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::processorCyclicGAMGInterfaceField
Description
GAMG agglomerated processor interface field.
SourceFiles
processorCyclicGAMGInterfaceField.C
\*---------------------------------------------------------------------------*/
#ifndef processorCyclicGAMGInterfaceField_H
#define processorCyclicGAMGInterfaceField_H
#include "processorGAMGInterfaceField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class processorCyclicGAMGInterfaceField Declaration
\*---------------------------------------------------------------------------*/
class processorCyclicGAMGInterfaceField
:
public processorGAMGInterfaceField
{
// Private data
// //- Local reference cast into the processor interface
// const processorCyclicGAMGInterface& procInterface_;
//
// //- Is the transform required
// bool doTransform_;
//
// //- Rank of component for transformation
// int rank_;
//
// Private Member Functions
//- Disallow default bitwise copy construct
processorCyclicGAMGInterfaceField(const processorCyclicGAMGInterfaceField&);
//- Disallow default bitwise assignment
void operator=(const processorCyclicGAMGInterfaceField&);
public:
//- Runtime type information
TypeName("processorCyclic");
// Constructors
//- Construct from GAMG interface and fine level interface field
processorCyclicGAMGInterfaceField
(
const GAMGInterface& GAMGCp,
const lduInterfaceField& fineInterface
);
// Destructor
virtual ~processorCyclicGAMGInterfaceField();
// Member Functions
// // Access
//
// //- Return size
// label size() const
// {
// return procInterface_.size();
// }
//
//
// // Interface matrix update
//
// //- 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&,
// const scalarField& coeffs,
// const direction cmpt,
// const Pstream::commsTypes commsType
// ) const;
//
//
// //- Processor interface functions
//
// //- Return processor number
// virtual int myProcNo() const
// {
// return procInterface_.myProcNo();
// }
//
// //- Return neigbour processor number
// virtual int neighbProcNo() const
// {
// return procInterface_.neighbProcNo();
// }
//
// //- Does the interface field perform the transfromation
// virtual bool doTransform() const
// {
// return doTransform_;
// }
//
// //- Return face transformation tensor
// virtual const tensorField& forwardT() const
// {
// return procInterface_.forwardT();
// }
//
// //- Return rank of component for transform
// virtual int rank() const
// {
// return rank_;
// }
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -36,8 +36,8 @@ SourceFiles
#ifndef GAMGInterface_H
#define GAMGInterface_H
#include "lduInterface.H"
#include "autoPtr.H"
#include "lduInterfacePtrsList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -57,6 +57,12 @@ protected:
// Protected data
//- My index in coarseInterfaces
const label index_;
//- All interfaces
const lduInterfacePtrsList& coarseInterfaces_;
//- Face-cell addressing
labelField faceCells_;
@ -89,11 +95,15 @@ public:
GAMGInterface,
lduInterface,
(
const label index,
const lduInterfacePtrsList& coarseInterfaces,
const lduInterface& fineInterface,
const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing
),
(
index,
coarseInterfaces,
fineInterface,
localRestrictAddressing,
neighbourRestrictAddressing
@ -107,6 +117,8 @@ public:
// the fine interface
static autoPtr<GAMGInterface> New
(
const label index,
const lduInterfacePtrsList& coarseInterfaces,
const lduInterface& fineInterface,
const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing
@ -119,10 +131,15 @@ public:
// local and neighbour restrict addressing
GAMGInterface
(
const label index,
const lduInterfacePtrsList& coarseInterfaces,
const lduInterface&,
const labelField&,
const labelField&
)
:
index_(index),
coarseInterfaces_(coarseInterfaces)
{}
@ -136,6 +153,16 @@ public:
return faceCells_.size();
}
virtual label index() const
{
return index_;
}
virtual const lduInterfacePtrsList& coarseInterfaces() const
{
return coarseInterfaces_;
}
//- Return faceCell addressing
virtual const unallocLabelList& faceCells() const
{

View File

@ -31,6 +31,8 @@ License
Foam::autoPtr<Foam::GAMGInterface> Foam::GAMGInterface::New
(
const label index,
const lduInterfacePtrsList& coarseInterfaces,
const lduInterface& fineInterface,
const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing
@ -59,6 +61,8 @@ Foam::autoPtr<Foam::GAMGInterface> Foam::GAMGInterface::New
(
cstrIter()
(
index,
coarseInterfaces,
fineInterface,
localRestrictAddressing,
neighbourRestrictAddressing

View File

@ -25,6 +25,7 @@ License
#include "cyclicGAMGInterface.H"
#include "addToRunTimeSelectionTable.H"
#include "Map.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -44,6 +45,8 @@ namespace Foam
Foam::cyclicGAMGInterface::cyclicGAMGInterface
(
const label index,
const lduInterfacePtrsList& coarseInterfaces,
const lduInterface& fineInterface,
const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing
@ -51,6 +54,8 @@ Foam::cyclicGAMGInterface::cyclicGAMGInterface
:
GAMGInterface
(
index,
coarseInterfaces,
fineInterface,
localRestrictAddressing,
neighbourRestrictAddressing
@ -58,33 +63,45 @@ Foam::cyclicGAMGInterface::cyclicGAMGInterface
fineCyclicInterface_(refCast<const cyclicLduInterface>(fineInterface))
{
// Make a lookup table of entries for owner/neighbour
HashTable<SLList<label>, label, Hash<label> > neighboursTable
Map<SLList<label> > neighboursTable
(
localRestrictAddressing.size()
);
// Table of face-sets to be agglomerated
HashTable<SLList<SLList<label> >, label, Hash<label> > faceFaceTable
Map<SLList<SLList<label> > > faceFaceTable
(
localRestrictAddressing.size()
);
label nCoarseFaces = 0;
label sizeBy2 = localRestrictAddressing.size()/2;
for (label ffi=0; ffi<sizeBy2; ffi++)
forAll (localRestrictAddressing, ffi)
{
label curMaster = localRestrictAddressing[ffi];
label curSlave = localRestrictAddressing[ffi + sizeBy2];
label curMaster = -1;
label curSlave = -1;
// Do switching on master/slave indexes based on the owner/neighbour of
// the processor index such that both sides get the same answer.
if (owner())
{
// Master side
curMaster = localRestrictAddressing[ffi];
curSlave = neighbourRestrictAddressing[ffi];
}
else
{
// Slave side
curMaster = neighbourRestrictAddressing[ffi];
curSlave = localRestrictAddressing[ffi];
}
// Look for the master cell. If it has already got a face,
// add the coefficient to the face. If not, create a new
// face.
// add the coefficient to the face. If not, create a new face.
if (neighboursTable.found(curMaster))
{
// Check all current neighbours to see if the current
// slave already exists. If so, add the coefficient.
// Check all current neighbours to see if the current slave already
// exists and if so, add the fine face to the agglomeration.
SLList<label>& curNbrs = neighboursTable.find(curMaster)();
@ -135,69 +152,86 @@ Foam::cyclicGAMGInterface::cyclicGAMGInterface
} // end for all fine faces
faceCells_.setSize(2*nCoarseFaces, -1);
faceRestrictAddressing_.setSize(localRestrictAddressing.size(), -1);
faceCells_.setSize(nCoarseFaces, -1);
faceRestrictAddressing_.setSize(localRestrictAddressing.size());
labelList contents = neighboursTable.toc();
// Reset face counter for re-use
nCoarseFaces = 0;
// On master side, the owner addressing is stored in table of contents
forAll(contents, masterI)
if (owner())
{
SLList<label>& curNbrs = neighboursTable.find(contents[masterI])();
SLList<SLList<label> >& curFaceFaces =
faceFaceTable.find(contents[masterI])();
SLList<label>::iterator nbrsIter = curNbrs.begin();
SLList<SLList<label> >::iterator faceFacesIter = curFaceFaces.begin();
for
(
;
nbrsIter != curNbrs.end(), faceFacesIter != curFaceFaces.end();
++nbrsIter, ++faceFacesIter
)
// On master side, the owner addressing is stored in table of contents
forAll (contents, masterI)
{
faceCells_[nCoarseFaces] = contents[masterI];
SLList<label>& curNbrs = neighboursTable.find(contents[masterI])();
forAllConstIter(SLList<label>, faceFacesIter(), facesIter)
SLList<SLList<label> >& curFaceFaces =
faceFaceTable.find(contents[masterI])();
SLList<label>::iterator nbrsIter = curNbrs.begin();
SLList<SLList<label> >::iterator faceFacesIter = curFaceFaces.begin();
for
(
;
nbrsIter != curNbrs.end(), faceFacesIter != curFaceFaces.end();
++nbrsIter, ++faceFacesIter
)
{
faceRestrictAddressing_[facesIter()] = nCoarseFaces;
}
faceCells_[nCoarseFaces] = contents[masterI];
nCoarseFaces++;
for
(
SLList<label>::iterator facesIter = faceFacesIter().begin();
facesIter != faceFacesIter().end();
++facesIter
)
{
faceRestrictAddressing_[facesIter()] = nCoarseFaces;
}
nCoarseFaces++;
}
}
}
// On slave side, the owner addressing is stored in linked lists
forAll(contents, masterI)
else
{
SLList<label>& curNbrs = neighboursTable.find(contents[masterI])();
SLList<SLList<label> >& curFaceFaces =
faceFaceTable.find(contents[masterI])();
SLList<label>::iterator nbrsIter = curNbrs.begin();
SLList<SLList<label> >::iterator faceFacesIter = curFaceFaces.begin();
for
(
;
nbrsIter != curNbrs.end(), faceFacesIter != curFaceFaces.end();
++nbrsIter, ++faceFacesIter
)
// On slave side, the owner addressing is stored in linked lists
forAll (contents, masterI)
{
faceCells_[nCoarseFaces] = nbrsIter();
SLList<label>& curNbrs = neighboursTable.find(contents[masterI])();
forAllConstIter(SLList<label>, faceFacesIter(), facesIter)
SLList<SLList<label> >& curFaceFaces =
faceFaceTable.find(contents[masterI])();
SLList<label>::iterator nbrsIter = curNbrs.begin();
SLList<SLList<label> >::iterator faceFacesIter = curFaceFaces.begin();
for
(
;
nbrsIter != curNbrs.end(), faceFacesIter != curFaceFaces.end();
++nbrsIter, ++faceFacesIter
)
{
faceRestrictAddressing_[facesIter() + sizeBy2] = nCoarseFaces;
}
faceCells_[nCoarseFaces] = nbrsIter();
nCoarseFaces++;
for
(
SLList<label>::iterator facesIter = faceFacesIter().begin();
facesIter != faceFacesIter().end();
++facesIter
)
{
faceRestrictAddressing_[facesIter()] = nCoarseFaces;
}
nCoarseFaces++;
}
}
}
}
@ -211,42 +245,24 @@ Foam::cyclicGAMGInterface::~cyclicGAMGInterface()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::labelField> Foam::cyclicGAMGInterface::transfer
(
const Pstream::commsTypes,
const unallocLabelList& interfaceData
) const
{
tmp<labelField> tpnf(new labelField(size()));
labelField& pnf = tpnf();
label sizeby2 = size()/2;
for (label facei=0; facei<sizeby2; facei++)
{
pnf[facei] = interfaceData[facei + sizeby2];
pnf[facei + sizeby2] = interfaceData[facei];
}
return tpnf;
}
Foam::tmp<Foam::labelField> Foam::cyclicGAMGInterface::internalFieldTransfer
(
const Pstream::commsTypes,
const unallocLabelList& iF
) const
{
const cyclicGAMGInterface& nbr = dynamic_cast<const cyclicGAMGInterface&>
(
neighbPatch()
);
const unallocLabelList& nbrFaceCells = nbr.faceCells();
tmp<labelField> tpnf(new labelField(size()));
labelField& pnf = tpnf();
label sizeby2 = size()/2;
for (label facei=0; facei<sizeby2; facei++)
forAll(pnf, facei)
{
pnf[facei] = iF[faceCells_[facei + sizeby2]];
pnf[facei + sizeby2] = iF[faceCells_[facei]];
pnf[facei] = iF[nbrFaceCells[facei]];
}
return tpnf;

View File

@ -80,6 +80,8 @@ public:
// local and neighbour restrict addressing
cyclicGAMGInterface
(
const label index,
const lduInterfacePtrsList& coarseInterfaces,
const lduInterface& fineInterface,
const labelField& restrictAddressing,
const labelField& neighbourRestrictAddressing
@ -94,13 +96,6 @@ public:
// Interface transfer functions
//- Transfer and return neighbour field
virtual tmp<labelField> transfer
(
const Pstream::commsTypes commsType,
const unallocLabelList& interfaceData
) const;
//- Transfer and return internal field adjacent to the interface
virtual tmp<labelField> internalFieldTransfer
(
@ -111,6 +106,25 @@ public:
//- Cyclic interface functions
//- Return neigbour processor number
virtual label neighbPatchID() const
{
return fineCyclicInterface_.neighbPatchID();
}
virtual bool owner() const
{
return fineCyclicInterface_.owner();
}
virtual const cyclicGAMGInterface& neighbPatch() const
{
return dynamic_cast<const cyclicGAMGInterface&>
(
coarseInterfaces_[neighbPatchID()]
);
}
//- Return face transformation tensor
virtual const tensorField& forwardT() const
{

View File

@ -0,0 +1,72 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "processorCyclicGAMGInterface.H"
#include "addToRunTimeSelectionTable.H"
#include "Map.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(processorCyclicGAMGInterface, 0);
addToRunTimeSelectionTable
(
GAMGInterface,
processorCyclicGAMGInterface,
lduInterface
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::processorCyclicGAMGInterface::processorCyclicGAMGInterface
(
const label index,
const lduInterfacePtrsList& coarseInterfaces,
const lduInterface& fineInterface,
const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing
)
:
processorGAMGInterface
(
index,
coarseInterfaces,
fineInterface,
localRestrictAddressing,
neighbourRestrictAddressing
)
{}
// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
Foam::processorCyclicGAMGInterface::~processorCyclicGAMGInterface()
{}
// ************************************************************************* //

View File

@ -0,0 +1,97 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::processorCyclicGAMGInterface
Description
GAMG agglomerated processor interface.
SourceFiles
processorCyclicGAMGInterface.C
processorCyclicGAMGInterfaceTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef processorCyclicGAMGInterface_H
#define processorCyclicGAMGInterface_H
#include "processorGAMGInterface.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class processorCyclicGAMGInterface Declaration
\*---------------------------------------------------------------------------*/
class processorCyclicGAMGInterface
:
public processorGAMGInterface
{
// Private Member Functions
//- Disallow default bitwise copy construct
processorCyclicGAMGInterface(const processorCyclicGAMGInterface&);
//- Disallow default bitwise assignment
void operator=(const processorCyclicGAMGInterface&);
public:
//- Runtime type information
TypeName("processorCyclic");
// Constructors
//- Construct from fine-level interface,
// local and neighbour restrict addressing
processorCyclicGAMGInterface
(
const label index,
const lduInterfacePtrsList& coarseInterfaces,
const lduInterface& fineInterface,
const labelField& restrictAddressing,
const labelField& neighbourRestrictAddressing
);
// Destructor
virtual ~processorCyclicGAMGInterface();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -25,6 +25,7 @@ License
#include "processorGAMGInterface.H"
#include "addToRunTimeSelectionTable.H"
#include "Map.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -44,6 +45,8 @@ namespace Foam
Foam::processorGAMGInterface::processorGAMGInterface
(
const label index,
const lduInterfacePtrsList& coarseInterfaces,
const lduInterface& fineInterface,
const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing
@ -51,6 +54,8 @@ Foam::processorGAMGInterface::processorGAMGInterface
:
GAMGInterface
(
index,
coarseInterfaces,
fineInterface,
localRestrictAddressing,
neighbourRestrictAddressing
@ -58,13 +63,13 @@ Foam::processorGAMGInterface::processorGAMGInterface
fineProcInterface_(refCast<const processorLduInterface>(fineInterface))
{
// Make a lookup table of entries for owner/neighbour
HashTable<SLList<label>, label, Hash<label> > neighboursTable
Map<SLList<label> > neighboursTable
(
localRestrictAddressing.size()
);
// Table of face-sets to be agglomerated
HashTable<SLList<SLList<label> >, label, Hash<label> > faceFaceTable
Map<SLList<SLList<label> > > faceFaceTable
(
localRestrictAddressing.size()
);
@ -233,26 +238,6 @@ Foam::processorGAMGInterface::~processorGAMGInterface()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::processorGAMGInterface::initTransfer
(
const Pstream::commsTypes commsType,
const unallocLabelList& interfaceData
) const
{
send(commsType, interfaceData);
}
Foam::tmp<Foam::labelField> Foam::processorGAMGInterface::transfer
(
const Pstream::commsTypes commsType,
const unallocLabelList& interfaceData
) const
{
return receive<label>(commsType, this->size());
}
void Foam::processorGAMGInterface::initInternalFieldTransfer
(
const Pstream::commsTypes commsType,

View File

@ -80,6 +80,8 @@ public:
// local and neighbour restrict addressing
processorGAMGInterface
(
const label index,
const lduInterfacePtrsList& coarseInterfaces,
const lduInterface& fineInterface,
const labelField& restrictAddressing,
const labelField& neighbourRestrictAddressing
@ -94,20 +96,6 @@ public:
// Interface transfer functions
//- Initialise interface data transfer
virtual void initTransfer
(
const Pstream::commsTypes commsType,
const unallocLabelList& interfaceData
) const;
//- Transfer and return neighbour field
virtual tmp<labelField> transfer
(
const Pstream::commsTypes commsType,
const unallocLabelList& interfaceData
) const;
//- Initialise neighbour field transfer
virtual void initInternalFieldTransfer
(
@ -142,6 +130,12 @@ public:
{
return fineProcInterface_.forwardT();
}
//- Return message tag used for sending
virtual int tag() const
{
return fineProcInterface_.tag();
}
};

View File

@ -23,23 +23,23 @@ License
\*---------------------------------------------------------------------------*/
#include "fvData.H"
#include "data.H"
#include "Time.H"
#include "lduMatrix.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
int Foam::fvData::debug(Foam::debug::debugSwitch("fvData", false));
int Foam::data::debug(Foam::debug::debugSwitch("data", false));
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fvData::fvData(const objectRegistry& obr)
Foam::data::data(const objectRegistry& obr)
:
IOdictionary
(
IOobject
(
"fvData",
"data",
obr.time().system(),
obr,
IOobject::NO_READ,
@ -53,13 +53,13 @@ Foam::fvData::fvData(const objectRegistry& obr)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::dictionary& Foam::fvData::solverPerformanceDict() const
const Foam::dictionary& Foam::data::solverPerformanceDict() const
{
return subDict("solverPerformance");
}
void Foam::fvData::setSolverPerformance
void Foam::data::setSolverPerformance
(
const word& name,
const lduMatrix::solverPerformance& sp

View File

@ -22,20 +22,21 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::fvData
Foam::data
Description
Database for finite volume solution data, solver performance and
other reduced data. fvMesh is derived from fvData so that all fields have
access to the fvData from the mesh reference they hold.
Database for solution data, solver performance and other reduced data.
fvMesh is derived from data so that all fields have access to the data from
the mesh reference they hold.
SourceFiles
fvData.C
data.C
\*---------------------------------------------------------------------------*/
#ifndef fvData_H
#define fvData_H
#ifndef data_H
#define data_H
#include "IOdictionary.H"
#include "lduMatrix.H"
@ -46,20 +47,20 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fvData Declaration
Class data Declaration
\*---------------------------------------------------------------------------*/
class fvData
class data
:
public IOdictionary
{
// Private Member Functions
//- Disallow default bitwise copy construct
fvData(const fvData&);
data(const data&);
//- Disallow default bitwise assignment
void operator=(const fvData&);
void operator=(const data&);
public:
@ -71,7 +72,7 @@ public:
// Constructors
//- Construct for objectRegistry
fvData(const objectRegistry& obr);
data(const objectRegistry& obr);
// Member Functions

View File

@ -51,28 +51,7 @@ void Foam::cyclicPointPatch::initGeometry(PstreamBuffers&)
void Foam::cyclicPointPatch::calcGeometry(PstreamBuffers&)
{
const edgeList& cp = cyclicPolyPatch_.coupledPoints();
const labelList& mp = cyclicPolyPatch_.meshPoints();
DynamicList<label> separated;
forAll(cp, i)
{
const edge& coupledSet = cp[i];
// Assume all points are separated.
separated.append(coupledSet[0]);
separated.append(coupledSet[1]);
}
separatedPoints_.transfer(separated);
if (debug)
{
Pout<< "cyclic:" << cyclicPolyPatch_.name()
<< " separated:" << separatedPoints_.size()
<< " out of points:" << mp.size() << endl;
}
}
{}
void Foam::cyclicPointPatch::initMovePoints(PstreamBuffers&, const pointField&)
@ -124,10 +103,4 @@ const Foam::edgeList& Foam::cyclicPointPatch::transformPairs() const
}
const Foam::labelList& Foam::cyclicPointPatch::separatedPoints() const
{
return separatedPoints_;
}
// ************************************************************************* //

View File

@ -37,6 +37,7 @@ SourceFiles
#include "coupledFacePointPatch.H"
#include "cyclicPolyPatch.H"
#include "pointBoundaryMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,8 +57,6 @@ class cyclicPointPatch
//- Local reference cast into the cyclic patch
const cyclicPolyPatch& cyclicPolyPatch_;
//- List of local points that are not collocated
mutable labelList separatedPoints_;
// Private Member Functions
@ -125,6 +124,14 @@ public:
return cyclicPolyPatch_;
}
//- Return neighbour point patch
const cyclicPointPatch& neighbPatch() const
{
label patchI = cyclicPolyPatch_.neighbPatchID();
const pointPatch& pp = this->boundaryMesh()[patchI];
return refCast<const cyclicPointPatch>(pp);
}
//- Are the cyclic planes parallel
bool parallel() const
{
@ -147,11 +154,10 @@ public:
// Access functions for demand driven data
//- Return the set of pairs of points that require transformation
// and/or mapping
// and/or mapping. First index is on this patch, second on the
// neighbour patch.
virtual const edgeList& transformPairs() const;
//- List of separated coupled points
virtual const labelList& separatedPoints() const;
};

View File

@ -0,0 +1,74 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "cyclicSlipPointPatch.H"
#include "pointConstraint.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTypeNameAndDebug(cyclicSlipPointPatch, 0);
// Add the patch constructor functions to the hash tables
addToRunTimeSelectionTable
(
facePointPatch,
cyclicSlipPointPatch,
polyPatch
);
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const vectorField& cyclicSlipPointPatch::pointNormals() const
{
// Use underlying patch normals
return refCast<const facePointPatch>
(
*this
).facePointPatch::pointNormals();
}
void cyclicSlipPointPatch::applyConstraint
(
const label pointi,
pointConstraint& pc
) const
{
pc.applyConstraint(pointNormals()[pointi]);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,102 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::cyclicSlipPointPatch
Description
Cyclic patch with slip constraint
SourceFiles
cyclicSlipPointPatch.C
\*---------------------------------------------------------------------------*/
#ifndef cyclicSlipPointPatch_H
#define cyclicSlipPointPatch_H
#include "cyclicPointPatch.H"
#include "cyclicSlipPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cyclicSlipPointPatch Declaration
\*---------------------------------------------------------------------------*/
class cyclicSlipPointPatch
:
public cyclicPointPatch
{
public:
//- Runtime type information
TypeName(cyclicSlipPolyPatch::typeName_());
// Constructors
//- Construct from components
cyclicSlipPointPatch
(
const polyPatch& patch,
const pointBoundaryMesh& bm
)
:
cyclicPointPatch(patch, bm)
{}
// Destructor
virtual ~cyclicSlipPointPatch()
{}
// Member Functions
//- Return point unit normals.
virtual const vectorField& pointNormals() const;
//- Accumulate the effect of constraint direction of this patch
virtual void applyConstraint
(
const label pointi,
pointConstraint&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -73,51 +73,7 @@ void Foam::processorPointPatch::initGeometry(PstreamBuffers& pBufs)
void Foam::processorPointPatch::calcGeometry(PstreamBuffers& pBufs)
{
if (Pstream::parRun())
{
const boolList& collocated = procPolyPatch_.collocated();
if (collocated.size() == 0)
{
separatedPoints_.setSize(0);
}
else if (collocated.size() == 1)
{
// Uniformly
if (collocated[0])
{
separatedPoints_.setSize(0);
}
else
{
separatedPoints_ = identity(size());
}
}
else
{
// Per face collocated or not.
const labelListList& pointFaces = procPolyPatch_.pointFaces();
DynamicList<label> separated;
forAll(pointFaces, pfi)
{
if (!collocated[pointFaces[pfi][0]])
{
separated.append(pfi);
}
}
separatedPoints_.transfer(separated);
}
}
if (debug)
{
Pout<< "processor:" << name()
<< " separated:" << separatedPoints_.size()
<< " out of points:" << size() << endl;
}
}
{}
void Foam::processorPointPatch::initMovePoints
@ -173,10 +129,4 @@ const Foam::labelList& Foam::processorPointPatch::reverseMeshPoints() const
}
const Foam::labelList& Foam::processorPointPatch::separatedPoints() const
{
return separatedPoints_;
}
// ************************************************************************* //

View File

@ -65,7 +65,6 @@ class processorPointPatch
mutable labelList reverseMeshPoints_;
mutable labelList separatedPoints_;
// Private Member Functions
@ -129,6 +128,12 @@ public:
}
}
//- Return message tag to use for communication
virtual int tag() const
{
return procPolyPatch_.tag();
}
//- Return the constraint type this pointPatch implements.
virtual const word& constraintType() const
{
@ -168,9 +173,6 @@ public:
//- Return mesh points in the correct order for the receiving side
const labelList& reverseMeshPoints() const;
//- List of separated coupled points
virtual const labelList& separatedPoints() const;
};

View File

@ -0,0 +1,399 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#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),
procCycPolyPatch_(refCast<const processorCyclicPolyPatch>(patch))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
processorCyclicPointPatch::~processorCyclicPointPatch()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,155 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
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
{
// Private data
const processorCyclicPolyPatch& procCycPolyPatch_;
//- 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 message tag to use for communication
virtual int tag() const
{
return procCycPolyPatch_.tag();
}
// //- 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 processorCyclicPolyPatch
const processorCyclicPolyPatch& procCyclicPolyPatch() const
{
return procCycPolyPatch_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -108,8 +108,6 @@ public:
return true;
}
//- List of separated coupled points
virtual const labelList& separatedPoints() const = 0;
};

View File

@ -77,34 +77,38 @@ void Foam::globalMeshData::initProcAddr()
if (Pstream::parRun())
{
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send indices of my processor patches to my neighbours
forAll(processorPatches_, i)
{
label patchi = processorPatches_[i];
OPstream toNeighbour
UOPstream toNeighbour
(
Pstream::blocking,
refCast<const processorPolyPatch>
(
mesh_.boundaryMesh()[patchi]
).neighbProcNo()
).neighbProcNo(),
pBufs
);
toNeighbour << processorPatchIndices_[patchi];
}
pBufs.finishedSends();
forAll(processorPatches_, i)
{
label patchi = processorPatches_[i];
IPstream fromNeighbour
UIPstream fromNeighbour
(
Pstream::blocking,
refCast<const processorPolyPatch>
(
mesh_.boundaryMesh()[patchi]
).neighbProcNo()
).neighbProcNo(),
pBufs
);
fromNeighbour >> processorPatchNeighbours_[patchi];
@ -2000,24 +2004,10 @@ void Foam::globalMeshData::updateMesh()
{
label patchI = processorPatches_[i];
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
if (Pstream::myProcNo() > procPatch.neighbProcNo())
if (isType<processorPolyPatch>(mesh_.boundaryMesh()[patchI]))
{
// Uncount my faces. Handle cyclics separately.
if (procPatch.separated())
{
const vectorField& separationDist = procPatch.separation();
nTotalFaces_ -= countCoincidentFaces(tolDim, separationDist);
}
else
{
// Normal, unseparated processor patch. Remove duplicates.
nTotalFaces_ -= procPatch.size();
}
// Normal, unseparated processor patch. Remove duplicates.
nTotalFaces_ -= mesh_.boundaryMesh()[patchI].size();
}
}
reduce(nTotalFaces_, sumOp<label>());
@ -2060,6 +2050,8 @@ void Foam::globalMeshData::updateMesh()
pointStatus.set(meshPointI, SHARED);
}
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send patch local points
forAll(processorPatches_, i)
{
@ -2068,11 +2060,13 @@ void Foam::globalMeshData::updateMesh()
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
OPstream toNeighbour(Pstream::blocking, procPatch.neighbProcNo());
UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs);
toNeighbour << procPatch.localPoints();
}
pBufs.finishedSends();
// Receive patch local points and uncount if coincident (and not shared)
forAll(processorPatches_, i)
{
@ -2081,7 +2075,7 @@ void Foam::globalMeshData::updateMesh()
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
IPstream fromNeighbour(Pstream::blocking, procPatch.neighbProcNo());
UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
pointField nbrPoints(fromNeighbour);

View File

@ -25,6 +25,7 @@ License
#include "globalPoints.H"
#include "processorPolyPatch.H"
#include "processorCyclicPolyPatch.H"
#include "cyclicPolyPatch.H"
#include "polyMesh.H"
@ -40,45 +41,6 @@ const Foam::label Foam::globalPoints::fromCollocated = labelMax/2;
// Routines to handle global indices
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Foam::PackedBoolList Foam::globalPoints::collocatedPoints
(
const coupledPolyPatch& pp
)
{
// Initialise to false
PackedBoolList isCollocated(pp.nPoints());
const boolList& collocated = pp.collocated();
if (collocated.size() == 0)
{
isCollocated = 1;
}
else if (collocated.size() == 1)
{
// Uniform.
if (collocated[0])
{
isCollocated = 1;
}
}
else
{
// Per face collocated or not.
const labelListList& pointFaces = pp.pointFaces();
forAll(pointFaces, pfi)
{
if (collocated[pointFaces[pfi][0]])
{
isCollocated[pfi] = 1;
}
}
}
return isCollocated;
}
Foam::label Foam::globalPoints::toGlobal
(
const label localPointI,
@ -369,16 +331,9 @@ void Foam::globalPoints::initOwnPoints
|| isA<cyclicPolyPatch>(pp)
)
{
// Find points with transforms
PackedBoolList isCollocatedPoint
(
collocatedPoints
(
refCast<const coupledPolyPatch>(pp)
)
);
// Assume all processor points are collocated and all
// processorCyclic and cyclic are separated.
bool isCollocatedPoint = isType<processorPolyPatch>(pp);
const labelList& meshPoints = pp.meshPoints();
@ -396,7 +351,7 @@ void Foam::globalPoints::initOwnPoints
labelList knownInfo
(
1,
toGlobal(localPointI, isCollocatedPoint[patchPointI])
toGlobal(localPointI, isCollocatedPoint)
);
// Update addressing from point to index in procPoints
@ -425,11 +380,7 @@ void Foam::globalPoints::initOwnPoints
labelList knownInfo
(
1,
toGlobal
(
localPointI,
isCollocatedPoint[boundaryPoints[i]]
)
toGlobal(localPointI, isCollocatedPoint)
);
// Update addressing from point to index in procPoints
@ -461,20 +412,21 @@ void Foam::globalPoints::sendPatchPoints
{
const polyPatch& pp = patches[patchI];
if (Pstream::parRun() && isA<processorPolyPatch>(pp))
if
(
Pstream::parRun()
&& (
isType<processorPolyPatch>(pp)
|| (mergeSeparated && isA<processorCyclicPolyPatch>(pp))
)
)
{
// processor cyclics are considered separated, pure processor
// always collocated.
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(pp);
PackedBoolList isCollocatedPoint
(
collocatedPoints
(
procPatch
)
);
// Information to send:
// patch face
DynamicList<label> patchFaces(pp.nPoints());
@ -492,34 +444,31 @@ void Foam::globalPoints::sendPatchPoints
forAll(meshPoints, patchPointI)
{
if (mergeSeparated || isCollocatedPoint[patchPointI])
label meshPointI = meshPoints[patchPointI];
label localPointI = meshToLocalPoint
(
meshToPatchPoint,
meshPointI
);
if (changedPoints.found(localPointI))
{
label meshPointI = meshPoints[patchPointI];
label localPointI = meshToLocalPoint
label index = meshToProcPoint_[localPointI];
const labelList& knownInfo = procPoints_[index];
// Add my information about localPointI to the
// send buffers
addToSend
(
meshToPatchPoint,
meshPointI
pp,
patchPointI,
knownInfo,
patchFaces,
indexInFace,
allInfo
);
if (changedPoints.found(localPointI))
{
label index = meshToProcPoint_[localPointI];
const labelList& knownInfo = procPoints_[index];
// Add my information about localPointI to the
// send buffers
addToSend
(
pp,
patchPointI,
knownInfo,
patchFaces,
indexInFace,
allInfo
);
}
}
}
@ -560,18 +509,20 @@ void Foam::globalPoints::receivePatchPoints
{
const polyPatch& pp = patches[patchI];
if (Pstream::parRun() && isA<processorPolyPatch>(pp))
if
(
Pstream::parRun()
&& (
isType<processorPolyPatch>(pp)
|| (mergeSeparated && isA<processorCyclicPolyPatch>(pp))
)
)
{
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(pp);
PackedBoolList isCollocatedPoint
(
collocatedPoints
(
procPatch
)
);
// Processor patch is always collocated, processorCyclic is not.
bool isCollocatedPoint = isType<processorPolyPatch>(pp);
labelList patchFaces;
labelList indexInFace;
@ -605,21 +556,13 @@ void Foam::globalPoints::receivePatchPoints
meshPointI
);
if
(
storeInfo
(
nbrInfo[i],
localPointI,
isCollocatedPoint[pp.meshPointMap()[meshPointI]]
)
)
if (storeInfo(nbrInfo[i], localPointI, isCollocatedPoint))
{
changedPoints.insert(localPointI);
}
}
}
else if (isA<cyclicPolyPatch>(pp))
else if (mergeSeparated && isA<cyclicPolyPatch>(pp))
{
// Handle cyclics: send lower half to upper half and vice versa.
// Or since they both are in memory just do it point by point.
@ -627,80 +570,49 @@ void Foam::globalPoints::receivePatchPoints
const cyclicPolyPatch& cycPatch =
refCast<const cyclicPolyPatch>(pp);
PackedBoolList isCollocatedPoint
(
collocatedPoints
(
cycPatch
)
);
const labelList& meshPoints = pp.meshPoints();
const labelList coupledMeshPoints(reverseMeshPoints(cycPatch));
//const edgeList& connections = cycPatch.coupledPoints();
const edgeList connections(coupledPoints(cycPatch));
forAll(connections, i)
forAll(meshPoints, i)
{
const edge& e = connections[i];
label meshPointA = meshPoints[i];
label meshPointB = coupledMeshPoints[i];
if (mergeSeparated || isCollocatedPoint[e[0]])
label localA = meshToLocalPoint
(
meshToPatchPoint,
meshPointA
);
label localB = meshToLocalPoint
(
meshToPatchPoint,
meshPointB
);
// Do we have information on pointA?
Map<label>::iterator procPointA =
meshToProcPoint_.find(localA);
if (procPointA != meshToProcPoint_.end())
{
label meshPointA = meshPoints[e[0]];
label meshPointB = meshPoints[e[1]];
label localA = meshToLocalPoint
(
meshToPatchPoint,
meshPointA
);
label localB = meshToLocalPoint
(
meshToPatchPoint,
meshPointB
);
// Do we have information on pointA?
Map<label>::iterator procPointA =
meshToProcPoint_.find(localA);
if (procPointA != meshToProcPoint_.end())
// Store A info onto pointB
if (storeInfo(procPoints_[procPointA()], localB, false))
{
// Store A info onto pointB
if
(
storeInfo
(
procPoints_[procPointA()],
localB,
isCollocatedPoint[e[1]]
)
)
{
changedPoints.insert(localB);
}
changedPoints.insert(localB);
}
}
// Same for info on pointB
Map<label>::iterator procPointB =
meshToProcPoint_.find(localB);
// Same for info on pointB
Map<label>::iterator procPointB =
meshToProcPoint_.find(localB);
if (procPointB != meshToProcPoint_.end())
if (procPointB != meshToProcPoint_.end())
{
// Store B info onto pointA
if (storeInfo(procPoints_[procPointB()], localA, false))
{
// Store B info onto pointA
if
(
storeInfo
(
procPoints_[procPointB()],
localA,
isCollocatedPoint[e[0]]
)
)
{
changedPoints.insert(localA);
}
changedPoints.insert(localA);
}
}
}
@ -970,7 +882,14 @@ void Foam::globalPoints::sendSharedPoints
{
const polyPatch& pp = patches[patchI];
if (Pstream::parRun() && isA<processorPolyPatch>(pp))
if
(
Pstream::parRun()
&& (
isType<processorPolyPatch>(pp)
|| (mergeSeparated && isA<processorCyclicPolyPatch>(pp))
)
)
{
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(pp);
@ -1057,7 +976,14 @@ void Foam::globalPoints::receiveSharedPoints
{
const polyPatch& pp = patches[patchI];
if (Pstream::parRun() && isA<processorPolyPatch>(pp))
if
(
Pstream::parRun()
&& (
isType<processorPolyPatch>(pp)
|| (mergeSeparated && isA<processorCyclicPolyPatch>(pp))
)
)
{
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(pp);
@ -1128,19 +1054,11 @@ void Foam::globalPoints::receiveSharedPoints
}
}
}
else if (isA<cyclicPolyPatch>(pp))
else if (mergeSeparated && isA<cyclicPolyPatch>(pp))
{
const cyclicPolyPatch& cycPatch =
refCast<const cyclicPolyPatch>(pp);
PackedBoolList isCollocatedPoint
(
collocatedPoints
(
cycPatch
)
);
// Build map from mesh or patch point to sharedPoint.
Map<label> localToSharedPoint(sharedPointAddr_.size());
forAll(sharedPointLabels_, i)
@ -1156,80 +1074,76 @@ void Foam::globalPoints::receiveSharedPoints
}
// Sync all info.
//const edgeList& connections = cycPatch.coupledPoints();
const edgeList connections(coupledPoints(cycPatch));
forAll(connections, i)
const labelList& meshPoints = cycPatch.meshPoints();
const labelList coupledMeshPoints(reverseMeshPoints(cycPatch));
forAll(meshPoints, i)
{
const edge& e = connections[i];
label meshPointA = meshPoints[i];
label meshPointB = coupledMeshPoints[i];
if (mergeSeparated || isCollocatedPoint[e[0]])
label localA = meshToLocalPoint
(
meshToPatchPoint,
meshPointA
);
label localB = meshToLocalPoint
(
meshToPatchPoint,
meshPointB
);
// Do we already have shared point for pointA?
Map<label>::iterator fndA = localToSharedPoint.find(localA);
Map<label>::iterator fndB = localToSharedPoint.find(localB);
if (fndA != localToSharedPoint.end())
{
label meshPointA = pp.meshPoints()[e[0]];
label meshPointB = pp.meshPoints()[e[1]];
label localA = meshToLocalPoint
(
meshToPatchPoint,
meshPointA
);
label localB = meshToLocalPoint
(
meshToPatchPoint,
meshPointB
);
// Do we already have shared point for pointA?
Map<label>::iterator fndA = localToSharedPoint.find(localA);
Map<label>::iterator fndB = localToSharedPoint.find(localB);
if (fndA != localToSharedPoint.end())
if (fndB != localToSharedPoint.end())
{
if (fndB != localToSharedPoint.end())
if (fndA() != fndB())
{
if (fndA() != fndB())
{
FatalErrorIn
(
"globalPoints::receiveSharedPoints(..)"
) << "On patch " << pp.name()
<< " connected points " << meshPointA
<< ' ' << mesh_.points()[meshPointA]
<< " and " << meshPointB
<< ' ' << mesh_.points()[meshPointB]
<< " are mapped to different shared"
<< " points: "
<< fndA() << " and " << fndB()
<< abort(FatalError);
}
}
else
{
// No shared point yet for B.
label sharedPointI = fndA();
// Store shared point for pointB
label sharedI = meshToShared[localB];
sharedPointAddr_[sharedI] = sharedPointI;
sharedPointLabels_[sharedI] = localB;
changedIndices.append(sharedI);
FatalErrorIn
(
"globalPoints::receiveSharedPoints(..)"
) << "On patch " << pp.name()
<< " connected points " << meshPointA
<< ' ' << mesh_.points()[meshPointA]
<< " and " << meshPointB
<< ' ' << mesh_.points()[meshPointB]
<< " are mapped to different shared"
<< " points: "
<< fndA() << " and " << fndB()
<< abort(FatalError);
}
}
else
{
// No shared point yet for A.
if (fndB != localToSharedPoint.end())
{
label sharedPointI = fndB();
// No shared point yet for B.
label sharedPointI = fndA();
// Store shared point for pointA
label sharedI = meshToShared[localA];
// Store shared point for pointB
label sharedI = meshToShared[localB];
sharedPointAddr_[sharedI] = sharedPointI;
sharedPointLabels_[sharedI] = localA;
changedIndices.append(sharedI);
}
sharedPointAddr_[sharedI] = sharedPointI;
sharedPointLabels_[sharedI] = localB;
changedIndices.append(sharedI);
}
}
else
{
// No shared point yet for A.
if (fndB != localToSharedPoint.end())
{
label sharedPointI = fndB();
// Store shared point for pointA
label sharedI = meshToShared[localA];
sharedPointAddr_[sharedI] = sharedPointI;
sharedPointLabels_[sharedI] = localA;
changedIndices.append(sharedI);
}
}
}
@ -1241,51 +1155,25 @@ void Foam::globalPoints::receiveSharedPoints
}
Foam::edgeList Foam::globalPoints::coupledPoints(const cyclicPolyPatch& pp)
Foam::labelList Foam::globalPoints::reverseMeshPoints
(
const cyclicPolyPatch& pp
)
{
// Look at cyclic patch as two halves, A and B.
// Now all we know is that relative face index in halfA is same
// as coupled face in halfB and also that the 0th vertex
// corresponds.
const cyclicPolyPatch& nbrPatch = pp.neighbPatch();
// From halfA point to halfB or -1.
labelList coupledPoint(pp.nPoints(), -1);
faceList masterFaces(nbrPatch.size());
for (label patchFaceA = 0; patchFaceA < pp.size()/2; patchFaceA++)
forAll (nbrPatch, faceI)
{
const face& fA = pp.localFaces()[patchFaceA];
forAll(fA, indexA)
{
label patchPointA = fA[indexA];
if (coupledPoint[patchPointA] == -1)
{
const face& fB = pp.localFaces()[patchFaceA + pp.size()/2];
label indexB = (fB.size() - indexA) % fB.size();
coupledPoint[patchPointA] = fB[indexB];
}
}
masterFaces[faceI] = nbrPatch[faceI].reverseFace();
}
edgeList connected(pp.nPoints());
// Extract coupled points.
label connectedI = 0;
forAll(coupledPoint, i)
{
if (coupledPoint[i] != -1)
{
connected[connectedI++] = edge(i, coupledPoint[i]);
}
}
connected.setSize(connectedI);
return connected;
return primitiveFacePatch
(
masterFaces,
nbrPatch.points()
).meshPoints();
}

View File

@ -158,10 +158,6 @@ class globalPoints
// Private Member Functions
//- Return per point collocated status
static PackedBoolList collocatedPoints(const coupledPolyPatch&);
// Wrappers around global point numbering to add collocated bit
//- Convert into globalIndices and add collocated bit
@ -300,9 +296,8 @@ class globalPoints
DynamicList<label>&
);
//- Should move into cyclicPolyPatch ordering problem
// keeps on giving problems.
static edgeList coupledPoints(const cyclicPolyPatch&);
//- Return mesh points of other side in same order as my meshPoints.
static labelList reverseMeshPoints(const cyclicPolyPatch&);
//- Do all calculations.
void calculateSharedPoints

View File

@ -74,7 +74,7 @@ Foam::List<Foam::labelPair> Foam::mapDistribute::schedule
slave++
)
{
IPstream fromSlave(Pstream::blocking, slave);
IPstream fromSlave(Pstream::scheduled, slave);
List<labelPair> nbrData(fromSlave);
forAll(nbrData, i)
@ -95,18 +95,18 @@ Foam::List<Foam::labelPair> Foam::mapDistribute::schedule
slave++
)
{
OPstream toSlave(Pstream::blocking, slave);
OPstream toSlave(Pstream::scheduled, slave);
toSlave << allComms;
}
}
else
{
{
OPstream toMaster(Pstream::blocking, Pstream::masterNo());
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster << allComms;
}
{
IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
fromMaster >> allComms;
}
}
@ -595,6 +595,7 @@ void Foam::mapDistribute::compact(const boolList& elemIsUsed)
// Send elemIsUsed field to neighbour. Use nonblocking code from
// mapDistribute but in reverse order.
if (Pstream::parRun())
{
List<boolList> sendFields(Pstream::nProcs());

View File

@ -41,6 +41,30 @@ void Foam::mapDistribute::distribute
List<T>& field
)
{
if (!Pstream::parRun())
{
// Do only me to me.
const labelList& mySubMap = subMap[Pstream::myProcNo()];
List<T> subField(mySubMap.size());
forAll(mySubMap, i)
{
subField[i] = field[mySubMap[i]];
}
// Receive sub field from myself (subField)
const labelList& map = constructMap[Pstream::myProcNo()];
field.setSize(constructSize);
forAll(map, i)
{
field[map[i]] = subField[i];
}
return;
}
if (commsType == Pstream::blocking)
{
// Since buffered sending can reuse the field to collect the
@ -406,6 +430,30 @@ void Foam::mapDistribute::distribute
const T& nullValue
)
{
if (!Pstream::parRun())
{
// Do only me to me.
const labelList& mySubMap = subMap[Pstream::myProcNo()];
List<T> subField(mySubMap.size());
forAll(mySubMap, i)
{
subField[i] = field[mySubMap[i]];
}
// Receive sub field from myself (subField)
const labelList& map = constructMap[Pstream::myProcNo()];
field.setSize(constructSize);
forAll(map, i)
{
field[map[i]] = subField[i];
}
return;
}
if (commsType == Pstream::blocking)
{
// Since buffered sending can reuse the field to collect the

View File

@ -717,6 +717,7 @@ void Foam::polyMesh::resetPrimitives
" const Xfer<labelList>& neighbour,\n"
" const labelList& patchSizes,\n"
" const labelList& patchStarts\n"
" const bool validBoundary\n"
")\n"
) << "Face " << faceI << " contains vertex labels out of range: "
<< curFace << " Max point index = " << points_.size()
@ -759,9 +760,9 @@ void Foam::polyMesh::resetPrimitives
" const Xfer<labelList>& neighbour,\n"
" const labelList& patchSizes,\n"
" const labelList& patchStarts\n"
" const bool validBoundary\n"
")\n"
)
<< "no points or no cells in mesh" << endl;
) << "no points or no cells in mesh" << endl;
}
}
}

View File

@ -193,6 +193,19 @@ private:
const label patchID
) const;
void setTopology
(
const cellShapeList& cellsAsShapes,
const faceListList& boundaryFaces,
const wordList& boundaryPatchNames,
labelList& patchSizes,
labelList& patchStarts,
label& defaultPatchStart,
label& nFaces,
cellList& cells
);
public:
@ -255,6 +268,20 @@ public:
const bool syncPar = true
);
//- Construct from cell shapes with patch information in dictionary
// format.
polyMesh
(
const IOobject& io,
const Xfer<pointField>& points,
const cellShapeList& shapes,
const faceListList& boundaryFaces,
const PtrList<dictionary>& boundaryDicts,
const word& defaultBoundaryPatchName,
const word& defaultBoundaryPatchType,
const bool syncPar = true
);
//- Destructor
virtual ~polyMesh();
@ -442,8 +469,6 @@ public:
//- Reset mesh primitive data. Assumes all patch info correct
// (so does e.g. parallel communication). If not use
// validBoundary=false
// (still assumes patchStarts[0] = nInternalFaces and last
// patch ends at nActiveFaces) and change patches with addPatches.
void resetPrimitives
(
const Xfer<pointField>& points,

View File

@ -132,6 +132,291 @@ Foam::labelList Foam::polyMesh::facePatchFaceCells
}
//- Set faces_, calculate cells and patchStarts.
void Foam::polyMesh::setTopology
(
const cellShapeList& cellsAsShapes,
const faceListList& boundaryFaces,
const wordList& boundaryPatchNames,
labelList& patchSizes,
labelList& patchStarts,
label& defaultPatchStart,
label& nFaces,
cellList& cells
)
{
// Calculate the faces of all cells
// Initialise maximum possible numer of mesh faces to 0
label maxFaces = 0;
// Set up a list of face shapes for each cell
faceListList cellsFaceShapes(cellsAsShapes.size());
cells.setSize(cellsAsShapes.size());
forAll(cellsFaceShapes, cellI)
{
cellsFaceShapes[cellI] = cellsAsShapes[cellI].faces();
cells[cellI].setSize(cellsFaceShapes[cellI].size());
// Initialise cells to -1 to flag undefined faces
static_cast<labelList&>(cells[cellI]) = -1;
// Count maximum possible numer of mesh faces
maxFaces += cellsFaceShapes[cellI].size();
}
// Set size of faces array to maximum possible number of mesh faces
faces_.setSize(maxFaces);
// Initialise number of faces to 0
nFaces = 0;
// set reference to point-cell addressing
labelListList PointCells = cellShapePointCells(cellsAsShapes);
bool found = false;
forAll(cells, cellI)
{
// Note:
// Insertion cannot be done in one go as the faces need to be
// added into the list in the increasing order of neighbour
// cells. Therefore, all neighbours will be detected first
// and then added in the correct order.
const faceList& curFaces = cellsFaceShapes[cellI];
// Record the neighbour cell
labelList neiCells(curFaces.size(), -1);
// Record the face of neighbour cell
labelList faceOfNeiCell(curFaces.size(), -1);
label nNeighbours = 0;
// For all faces ...
forAll(curFaces, faceI)
{
// Skip faces that have already been matched
if (cells[cellI][faceI] >= 0) continue;
found = false;
const face& curFace = curFaces[faceI];
// Get the list of labels
const labelList& curPoints = curFace;
// For all points
forAll(curPoints, pointI)
{
// dGget the list of cells sharing this point
const labelList& curNeighbours =
PointCells[curPoints[pointI]];
// For all neighbours
forAll(curNeighbours, neiI)
{
label curNei = curNeighbours[neiI];
// Reject neighbours with the lower label
if (curNei > cellI)
{
// Get the list of search faces
const faceList& searchFaces = cellsFaceShapes[curNei];
forAll(searchFaces, neiFaceI)
{
if (searchFaces[neiFaceI] == curFace)
{
// Match!!
found = true;
// Record the neighbour cell and face
neiCells[faceI] = curNei;
faceOfNeiCell[faceI] = neiFaceI;
nNeighbours++;
break;
}
}
if (found) break;
}
if (found) break;
}
if (found) break;
} // End of current points
} // End of current faces
// Add the faces in the increasing order of neighbours
for (label neiSearch = 0; neiSearch < nNeighbours; neiSearch++)
{
// Find the lowest neighbour which is still valid
label nextNei = -1;
label minNei = cells.size();
forAll(neiCells, ncI)
{
if (neiCells[ncI] > -1 && neiCells[ncI] < minNei)
{
nextNei = ncI;
minNei = neiCells[ncI];
}
}
if (nextNei > -1)
{
// Add the face to the list of faces
faces_[nFaces] = curFaces[nextNei];
// Set cell-face and cell-neighbour-face to current face label
cells[cellI][nextNei] = nFaces;
cells[neiCells[nextNei]][faceOfNeiCell[nextNei]] = nFaces;
// Stop the neighbour from being used again
neiCells[nextNei] = -1;
// Increment number of faces counter
nFaces++;
}
else
{
FatalErrorIn
(
"polyMesh::setTopology\n"
"(\n"
" const cellShapeList& cellsAsShapes,\n"
" const faceListList& boundaryFaces,\n"
" const wordList& boundaryPatchNames,\n"
" labelList& patchSizes,\n"
" labelList& patchStarts,\n"
" label& defaultPatchStart,\n"
" label& nFaces,\n"
" cellList& cells\n"
")"
) << "Error in internal face insertion"
<< abort(FatalError);
}
}
}
// Do boundary faces
patchSizes.setSize(boundaryFaces.size(), -1);
patchStarts.setSize(boundaryFaces.size(), -1);
forAll(boundaryFaces, patchI)
{
const faceList& patchFaces = boundaryFaces[patchI];
labelList curPatchFaceCells =
facePatchFaceCells
(
patchFaces,
PointCells,
cellsFaceShapes,
patchI
);
// Grab the start label
label curPatchStart = nFaces;
forAll(patchFaces, faceI)
{
const face& curFace = patchFaces[faceI];
const label cellInside = curPatchFaceCells[faceI];
faces_[nFaces] = curFace;
// get faces of the cell inside
const faceList& facesOfCellInside = cellsFaceShapes[cellInside];
bool found = false;
forAll(facesOfCellInside, cellFaceI)
{
if (facesOfCellInside[cellFaceI] == curFace)
{
if (cells[cellInside][cellFaceI] >= 0)
{
FatalErrorIn
(
"polyMesh::setTopology\n"
"(\n"
" const cellShapeList& cellsAsShapes,\n"
" const faceListList& boundaryFaces,\n"
" const wordList& boundaryPatchNames,\n"
" labelList& patchSizes,\n"
" labelList& patchStarts,\n"
" label& defaultPatchStart,\n"
" label& nFaces,\n"
" cellList& cells\n"
")"
) << "Trying to specify a boundary face " << curFace
<< " on the face on cell " << cellInside
<< " which is either an internal face or already "
<< "belongs to some other patch. This is face "
<< faceI << " of patch "
<< patchI << " named "
<< boundaryPatchNames[patchI] << "."
<< abort(FatalError);
}
found = true;
cells[cellInside][cellFaceI] = nFaces;
break;
}
}
if (!found)
{
FatalErrorIn("polyMesh::polyMesh(... construct from shapes...)")
<< "face " << faceI << " of patch " << patchI
<< " does not seem to belong to cell " << cellInside
<< " which, according to the addressing, "
<< "should be next to it."
<< abort(FatalError);
}
// increment the counter of faces
nFaces++;
}
patchSizes[patchI] = nFaces - curPatchStart;
patchStarts[patchI] = curPatchStart;
}
// Grab "non-existing" faces and put them into a default patch
defaultPatchStart = nFaces;
forAll(cells, cellI)
{
labelList& curCellFaces = cells[cellI];
forAll(curCellFaces, faceI)
{
if (curCellFaces[faceI] == -1) // "non-existent" face
{
curCellFaces[faceI] = nFaces;
faces_[nFaces] = cellsFaceShapes[cellI][faceI];
nFaces++;
}
}
}
// Reset the size of the face list
faces_.setSize(nFaces);
return ;
}
Foam::polyMesh::polyMesh
(
const IOobject& io,
@ -273,271 +558,23 @@ Foam::polyMesh::polyMesh
// Remove all of the old mesh files if they exist
removeFiles(instance());
// Calculate the faces of all cells
// Initialise maximum possible numer of mesh faces to 0
label maxFaces = 0;
// Set up a list of face shapes for each cell
faceListList cellsFaceShapes(cellsAsShapes.size());
cellList cells(cellsAsShapes.size());
forAll(cellsFaceShapes, cellI)
{
cellsFaceShapes[cellI] = cellsAsShapes[cellI].faces();
cells[cellI].setSize(cellsFaceShapes[cellI].size());
// Initialise cells to -1 to flag undefined faces
static_cast<labelList&>(cells[cellI]) = -1;
// Count maximum possible numer of mesh faces
maxFaces += cellsFaceShapes[cellI].size();
}
// Set size of faces array to maximum possible number of mesh faces
faces_.setSize(maxFaces);
// Initialise number of faces to 0
label nFaces = 0;
// set reference to point-cell addressing
labelListList PointCells = cellShapePointCells(cellsAsShapes);
bool found = false;
forAll(cells, cellI)
{
// Note:
// Insertion cannot be done in one go as the faces need to be
// added into the list in the increasing order of neighbour
// cells. Therefore, all neighbours will be detected first
// and then added in the correct order.
const faceList& curFaces = cellsFaceShapes[cellI];
// Record the neighbour cell
labelList neiCells(curFaces.size(), -1);
// Record the face of neighbour cell
labelList faceOfNeiCell(curFaces.size(), -1);
label nNeighbours = 0;
// For all faces ...
forAll(curFaces, faceI)
{
// Skip faces that have already been matched
if (cells[cellI][faceI] >= 0) continue;
found = false;
const face& curFace = curFaces[faceI];
// Get the list of labels
const labelList& curPoints = curFace;
// For all points
forAll(curPoints, pointI)
{
// dGget the list of cells sharing this point
const labelList& curNeighbours =
PointCells[curPoints[pointI]];
// For all neighbours
forAll(curNeighbours, neiI)
{
label curNei = curNeighbours[neiI];
// Reject neighbours with the lower label
if (curNei > cellI)
{
// Get the list of search faces
const faceList& searchFaces = cellsFaceShapes[curNei];
forAll(searchFaces, neiFaceI)
{
if (searchFaces[neiFaceI] == curFace)
{
// Match!!
found = true;
// Record the neighbour cell and face
neiCells[faceI] = curNei;
faceOfNeiCell[faceI] = neiFaceI;
nNeighbours++;
break;
}
}
if (found) break;
}
if (found) break;
}
if (found) break;
} // End of current points
} // End of current faces
// Add the faces in the increasing order of neighbours
for (label neiSearch = 0; neiSearch < nNeighbours; neiSearch++)
{
// Find the lowest neighbour which is still valid
label nextNei = -1;
label minNei = cells.size();
forAll(neiCells, ncI)
{
if (neiCells[ncI] > -1 && neiCells[ncI] < minNei)
{
nextNei = ncI;
minNei = neiCells[ncI];
}
}
if (nextNei > -1)
{
// Add the face to the list of faces
faces_[nFaces] = curFaces[nextNei];
// Set cell-face and cell-neighbour-face to current face label
cells[cellI][nextNei] = nFaces;
cells[neiCells[nextNei]][faceOfNeiCell[nextNei]] = nFaces;
// Stop the neighbour from being used again
neiCells[nextNei] = -1;
// Increment number of faces counter
nFaces++;
}
else
{
FatalErrorIn
(
"polyMesh::polyMesh\n"
"(\n"
" const IOobject&,\n"
" const Xfer<pointField>&,\n"
" const cellShapeList& cellsAsShapes,\n"
" const faceListList& boundaryFaces,\n"
" const wordList& boundaryPatchTypes,\n"
" const wordList& boundaryPatchNames,\n"
" const word& defaultBoundaryPatchType\n"
")"
) << "Error in internal face insertion"
<< abort(FatalError);
}
}
}
// Do boundary faces
labelList patchSizes(boundaryFaces.size(), -1);
labelList patchStarts(boundaryFaces.size(), -1);
forAll(boundaryFaces, patchI)
{
const faceList& patchFaces = boundaryFaces[patchI];
labelList curPatchFaceCells =
facePatchFaceCells
(
patchFaces,
PointCells,
cellsFaceShapes,
patchI
);
// Grab the start label
label curPatchStart = nFaces;
forAll(patchFaces, faceI)
{
const face& curFace = patchFaces[faceI];
const label cellInside = curPatchFaceCells[faceI];
faces_[nFaces] = curFace;
// get faces of the cell inside
const faceList& facesOfCellInside = cellsFaceShapes[cellInside];
bool found = false;
forAll(facesOfCellInside, cellFaceI)
{
if (facesOfCellInside[cellFaceI] == curFace)
{
if (cells[cellInside][cellFaceI] >= 0)
{
FatalErrorIn
(
"polyMesh::polyMesh\n"
"(\n"
" const IOobject&,\n"
" const Xfer<pointField>&,\n"
" const cellShapeList& cellsAsShapes,\n"
" const faceListList& boundaryFaces,\n"
" const wordList& boundaryPatchTypes,\n"
" const wordList& boundaryPatchNames,\n"
" const word& defaultBoundaryPatchType\n"
")"
) << "Trying to specify a boundary face " << curFace
<< " on the face on cell " << cellInside
<< " which is either an internal face or already "
<< "belongs to some other patch. This is face "
<< faceI << " of patch "
<< patchI << " named "
<< boundaryPatchNames[patchI] << "."
<< abort(FatalError);
}
found = true;
cells[cellInside][cellFaceI] = nFaces;
break;
}
}
if (!found)
{
FatalErrorIn("polyMesh::polyMesh(... construct from shapes...)")
<< "face " << faceI << " of patch " << patchI
<< " does not seem to belong to cell " << cellInside
<< " which, according to the addressing, "
<< "should be next to it."
<< abort(FatalError);
}
// increment the counter of faces
nFaces++;
}
patchSizes[patchI] = nFaces - curPatchStart;
patchStarts[patchI] = curPatchStart;
}
// Grab "non-existing" faces and put them into a default patch
label defaultPatchStart = nFaces;
forAll(cells, cellI)
{
labelList& curCellFaces = cells[cellI];
forAll(curCellFaces, faceI)
{
if (curCellFaces[faceI] == -1) // "non-existent" face
{
curCellFaces[faceI] = nFaces;
faces_[nFaces] = cellsFaceShapes[cellI][faceI];
nFaces++;
}
}
}
// Reset the size of the face list
faces_.setSize(nFaces);
// Calculate faces and cells
labelList patchSizes;
labelList patchStarts;
label defaultPatchStart;
label nFaces;
cellList cells;
setTopology
(
cellsAsShapes,
boundaryFaces,
boundaryPatchNames,
patchSizes,
patchStarts,
defaultPatchStart,
nFaces,
cells
);
// Warning: Patches can only be added once the face list is
// completed, as they hold a subList of the face list
@ -654,4 +691,275 @@ Foam::polyMesh::polyMesh
}
Foam::polyMesh::polyMesh
(
const IOobject& io,
const Xfer<pointField>& points,
const cellShapeList& cellsAsShapes,
const faceListList& boundaryFaces,
const PtrList<dictionary>& boundaryDicts,
const word& defaultBoundaryPatchName,
const word& defaultBoundaryPatchType,
const bool syncPar
)
:
objectRegistry(io),
primitiveMesh(),
points_
(
IOobject
(
"points",
instance(),
meshSubDir,
*this,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
points
),
faces_
(
IOobject
(
"faces",
instance(),
meshSubDir,
*this,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
0
),
owner_
(
IOobject
(
"owner",
instance(),
meshSubDir,
*this,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
0
),
neighbour_
(
IOobject
(
"neighbour",
instance(),
meshSubDir,
*this,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
0
),
clearedPrimitives_(false),
boundary_
(
IOobject
(
"boundary",
instance(),
meshSubDir,
*this,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
*this,
boundaryFaces.size() + 1 // add room for a default patch
),
bounds_(points_, syncPar),
geometricD_(Vector<label>::zero),
solutionD_(Vector<label>::zero),
pointZones_
(
IOobject
(
"pointZones",
instance(),
meshSubDir,
*this,
IOobject::NO_READ,
IOobject::NO_WRITE
),
*this,
0
),
faceZones_
(
IOobject
(
"faceZones",
instance(),
meshSubDir,
*this,
IOobject::NO_READ,
IOobject::NO_WRITE
),
*this,
0
),
cellZones_
(
IOobject
(
"cellZones",
instance(),
meshSubDir,
*this,
IOobject::NO_READ,
IOobject::NO_WRITE
),
*this,
0
),
globalMeshDataPtr_(NULL),
moving_(false),
curMotionTimeIndex_(time().timeIndex()),
oldPointsPtr_(NULL)
{
if (debug)
{
Info<<"Constructing polyMesh from cell and boundary shapes." << endl;
}
// Remove all of the old mesh files if they exist
removeFiles(instance());
wordList boundaryPatchNames(boundaryDicts.size());
forAll(boundaryDicts, patchI)
{
boundaryDicts[patchI].lookup("name") >> boundaryPatchNames[patchI];
}
// Calculate faces and cells
labelList patchSizes;
labelList patchStarts;
label defaultPatchStart;
label nFaces;
cellList cells;
setTopology
(
cellsAsShapes,
boundaryFaces,
boundaryPatchNames,
patchSizes,
patchStarts,
defaultPatchStart,
nFaces,
cells
);
// Warning: Patches can only be added once the face list is
// completed, as they hold a subList of the face list
forAll (boundaryFaces, patchI)
{
dictionary patchDict(boundaryDicts[patchI]);
patchDict.set("nFaces", patchSizes[patchI]);
patchDict.set("startFace", patchStarts[patchI]);
// add the patch to the list
boundary_.set
(
patchI,
polyPatch::New
(
boundaryPatchNames[patchI],
patchDict,
patchI,
boundary_
)
);
}
label nAllPatches = boundaryFaces.size();
if (nFaces > defaultPatchStart)
{
WarningIn("polyMesh::polyMesh(... construct from shapes...)")
<< "Found " << nFaces - defaultPatchStart
<< " undefined faces in mesh; adding to default patch." << endl;
// Check if there already exists a defaultFaces patch as last patch
// and reuse it.
label patchI = findIndex(boundaryPatchNames, defaultBoundaryPatchName);
if (patchI != -1)
{
if (patchI != boundaryFaces.size()-1 || boundary_[patchI].size())
{
FatalErrorIn("polyMesh::polyMesh(... construct from shapes...)")
<< "Default patch " << boundary_[patchI].name()
<< " already has faces in it or is not"
<< " last in list of patches." << exit(FatalError);
}
WarningIn("polyMesh::polyMesh(... construct from shapes...)")
<< "Reusing existing patch " << patchI
<< " for undefined faces." << endl;
boundary_.set
(
patchI,
polyPatch::New
(
boundary_[patchI].type(),
boundary_[patchI].name(),
nFaces - defaultPatchStart,
defaultPatchStart,
patchI,
boundary_
)
);
}
else
{
boundary_.set
(
nAllPatches,
polyPatch::New
(
defaultBoundaryPatchType,
defaultBoundaryPatchName,
nFaces - defaultPatchStart,
defaultPatchStart,
boundary_.size() - 1,
boundary_
)
);
nAllPatches++;
}
}
// Reset the size of the boundary
boundary_.setSize(nAllPatches);
// Set the primitive mesh
initMesh(cells);
if (syncPar)
{
// Calculate topology for the patches (processor-processor comms etc.)
boundary_.updateMesh();
// Calculate the geometry for the patches (transformation tensors etc.)
boundary_.calcGeometry();
}
if (debug)
{
if (checkMesh())
{
Info << "Mesh OK" << endl;
}
}
}
// ************************************************************************* //

View File

@ -111,23 +111,6 @@ void Foam::coupledPolyPatch::writeOBJ
}
Foam::pointField Foam::coupledPolyPatch::calcFaceCentres
(
const UList<face>& faces,
const pointField& points
)
{
pointField ctrs(faces.size());
forAll(faces, faceI)
{
ctrs[faceI] = faces[faceI].centre(points);
}
return ctrs;
}
Foam::pointField Foam::coupledPolyPatch::getAnchorPoints
(
const UList<face>& faces,
@ -145,43 +128,6 @@ Foam::pointField Foam::coupledPolyPatch::getAnchorPoints
}
bool Foam::coupledPolyPatch::inPatch
(
const labelList& oldToNew,
const label oldFaceI
) const
{
label faceI = oldToNew[oldFaceI];
return faceI >= start() && faceI < start()+size();
}
Foam::label Foam::coupledPolyPatch::whichPatch
(
const labelList& patchStarts,
const label faceI
)
{
forAll(patchStarts, patchI)
{
if (patchStarts[patchI] <= faceI)
{
if (patchI == patchStarts.size()-1)
{
return patchI;
}
else if (patchStarts[patchI+1] > faceI)
{
return patchI;
}
}
}
return -1;
}
Foam::scalarField Foam::coupledPolyPatch::calcFaceTol
(
const UList<face>& faces,
@ -266,7 +212,8 @@ void Foam::coupledPolyPatch::calcTransformTensors
Pout<< "coupledPolyPatch::calcTransformTensors : " << name() << endl
<< " (half)size:" << Cf.size() << nl
<< " absTol:" << absTol << nl
//<< " smallDist:" << smallDist << nl
<< " smallDist min:" << min(smallDist) << nl
<< " smallDist max:" << max(smallDist) << nl
<< " sum(mag(nf & nr)):" << sum(mag(nf & nr)) << endl;
}
@ -278,7 +225,7 @@ void Foam::coupledPolyPatch::calcTransformTensors
// Then the overall error of summing the normals is sqrt(size())*absTol
// - separation calculation: pass in from the outside an allowable error.
if (size() == 0)
if (Cf.size() == 0)
{
// Dummy geometry.
separation_.setSize(0);

View File

@ -38,6 +38,7 @@ SourceFiles
#define coupledPolyPatch_H
#include "polyPatch.H"
#include "diagTensorField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -133,13 +134,6 @@ protected:
label& vertI
);
//- Calculate face centres
static pointField calcFaceCentres
(
const UList<face>&,
const pointField&
);
//- Get f[0] for all faces
static pointField getAnchorPoints
(
@ -147,21 +141,6 @@ protected:
const pointField&
);
//- Is face (in old face labels) in current patch?
bool inPatch
(
const labelList& oldToNew,
const label oldFaceI
) const;
//- Given list of starts of patches and a face label determine
// the patch.
static label whichPatch
(
const labelList& patchStarts,
const label faceI
);
//- Calculate typical tolerance per face. Is currently max distance
// from face centre to any of the face vertices.
static scalarField calcFaceTol
@ -248,45 +227,67 @@ public:
return true;
}
//- Does this side own the patch ?
virtual bool owner() const = 0;
//- Are the coupled planes separated
bool separated() const
//- Does the coupled side own the patch ?
virtual bool neighbour() const
{
return !owner();
}
//- Transform a patch-based position from other side to this side
virtual void transformPosition(pointField& l) const = 0;
//- Are the planes separated.
virtual bool separated() const
{
return separation_.size();
}
//- Return the offset (distance) vector from one side of the couple
// to the other
const vectorField& separation() const
//- If the planes are separated the separation vector.
virtual const vectorField& separation() const
{
return separation_;
}
//- Are the cyclic planes parallel
bool parallel() const
//- Are the cyclic planes parallel.
virtual bool parallel() const
{
return forwardT_.empty();
}
//- Return face transformation tensor
const tensorField& forwardT() const
//- Return face transformation tensor.
virtual const tensorField& forwardT() const
{
return forwardT_;
}
//- Return neighbour-cell transformation tensor
const tensorField& reverseT() const
//- Return neighbour-cell transformation tensor.
virtual const tensorField& reverseT() const
{
return reverseT_;
}
//- Are faces collocated. Either size 0,1 or length of patch
const boolList& collocated() const
virtual const boolList& collocated() const
{
return collocated_;
}
//- Calculate the patch 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
) = 0;
//- Initialize ordering for primitivePatch. Does not
// refer to *this (except for name() and type() etc.)
virtual void initOrder

View File

@ -29,11 +29,10 @@ Description
Note: morph patch face ordering uses geometric matching so with the
following restrictions:
-halves should be flat planes.
-coupled patches should be flat planes.
-no rotation in patch plane
Uses a featureCos to find the two halves (or should be fully
disconnected). Uses coupledPolyPatch::calcFaceTol to calculate
Uses coupledPolyPatch::calcFaceTol to calculate
tolerance per face which might need tweaking.
Switch on 'cyclicPolyPatch' debug flag to write .obj files to show
@ -48,10 +47,9 @@ SourceFiles
#define cyclicPolyPatch_H
#include "coupledPolyPatch.H"
#include "SubField.H"
#include "FixedList.H"
#include "edgeList.H"
#include "transform.H"
#include "polyBoundaryMesh.H"
#include "diagTensorField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -82,18 +80,11 @@ private:
// Private data
//- List of edges formed from connected points. e[0] is the point on
// the first half of the patch, e[1] the corresponding point on the
// second half.
mutable edgeList* coupledPointsPtr_;
//- Name of other half
const word neighbPatchName_;
//- List of connected edges. e[0] is the edge on the first half of the
// patch, e[1] the corresponding edge on the second half.
mutable edgeList* coupledEdgesPtr_;
//- Morph:angle between normals of neighbouring faces.
// Used to split cyclic into halves.
scalar featureCos_;
//- Index of other half
mutable label neighbPatchID_;
//- Type of transformation - rotational or translational
transformType transform_;
@ -112,60 +103,50 @@ private:
vector separationVector_;
//- List of edges formed from connected points. e[0] is the point on
// the first half of the patch, e[1] the corresponding point on the
// second half.
mutable edgeList* coupledPointsPtr_;
//- List of connected edges. e[0] is the edge on the first half of the
// patch, e[1] the corresponding edge on the second half.
mutable edgeList* coupledEdgesPtr_;
//- Temporary storage of owner side patch during ordering.
mutable autoPtr<primitivePatch> ownerPatchPtr_;
// Private Member Functions
//- Find amongst selected faces the one with the largest area
static label findMaxArea(const pointField&, const faceList&);
void calcTransforms
(
const primitivePatch& half0,
const UList<point>& half0Ctrs,
const UList<point>& half0Areas,
const UList<point>& half1Ctrs,
const UList<point>& half1Areas
);
// Face ordering
//- Find the two parts of the faces of pp using feature edges.
// Returns true if successfull.
bool getGeometricHalves
(
const primitivePatch&,
labelList&,
labelList&
) const;
//- Calculate geometric factors of the two halves.
void getCentresAndAnchors
(
const primitivePatch&,
const faceList& half0Faces,
const faceList& half1Faces,
const primitivePatch& pp0,
const primitivePatch& pp1,
pointField& ppPoints,
pointField& half0Ctrs,
pointField& half1Ctrs,
pointField& anchors0,
scalarField& tols
) const;
//- Given matched faces matches the anchor point. Sets faceMap,
// rotation. Returns true if all matched.
bool matchAnchors
(
const bool report,
const primitivePatch&,
const labelList&,
const pointField&,
const labelList&,
const faceList&,
const labelList&,
const scalarField&,
labelList& faceMap,
labelList& rotation
) const;
//- For rotational cases, try to find a unique face on each side
// of the cyclic.
label getConsistentRotationFace
(
const pointField& faceCentres
) const;
label getConsistentRotationFace(const pointField&) const;
protected:
@ -178,9 +159,30 @@ protected:
//- Initialise the calculation of the patch geometry
virtual void initGeometry(PstreamBuffers&);
//- Initialise the calculation of the patch geometry
virtual void initGeometry
(
const primitivePatch& referPatch,
UList<point>& nbrCtrs,
UList<point>& nbrAreas,
UList<point>& nbrCc
);
//- Calculate the patch geometry
virtual void calcGeometry(PstreamBuffers&);
//- Calculate the patch 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
);
//- Initialise the patches for moving points
virtual void initMovePoints(PstreamBuffers&, const pointField&);
@ -231,7 +233,8 @@ public:
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
const label newStart,
const word& neighbPatchName
);
//- Construct given the original patch and a map
@ -262,7 +265,15 @@ public:
{
return autoPtr<polyPatch>
(
new cyclicPolyPatch(*this, bm, index, newSize, newStart)
new cyclicPolyPatch
(
*this,
bm,
index,
newSize,
newStart,
neighbPatchName_
)
);
}
@ -289,103 +300,107 @@ public:
// Member Functions
//- Return connected points (in patch local point indexing). Demand
// driven calculation. Does primitivePatch::clearOut after calculation!
const word& neighbPatchName() const
{
return neighbPatchName_;
}
//- Neighbour patchID.
virtual label neighbPatchID() const
{
if (neighbPatchID_ == -1)
{
neighbPatchID_ = this->boundaryMesh().findPatchID
(
neighbPatchName_
);
if (neighbPatchID_ == -1)
{
FatalErrorIn("cyclicPolyPatch::neighbPatchID() const")
<< "Illegal neighbourPatch name " << neighbPatchName_
<< endl << "Valid patch names are "
<< this->boundaryMesh().names()
<< exit(FatalError);
}
}
return neighbPatchID_;
}
virtual bool owner() const
{
return index() < neighbPatchID();
}
virtual bool neighbour() const
{
return !owner();
}
const cyclicPolyPatch& neighbPatch() const
{
const polyPatch& pp = this->boundaryMesh()[neighbPatchID()];
return refCast<const cyclicPolyPatch>(pp);
}
//- Return connected points (from patch local to neighbour patch local)
// Demand driven calculation. Does primitivePatch::clearOut after
// calculation!
const edgeList& coupledPoints() const;
//- Return connected edges (in patch local edge indexing). Demand
// driven calculation. Does primitivePatch::clearOut after calculation!
//- Return connected edges (from patch local to neighbour patch local).
// Demand driven calculation. Does primitivePatch::clearOut after
// calculation!
const edgeList& coupledEdges() const;
//- Transform a patch-based position from other side to this side
virtual void transformPosition(pointField& l) const;
// Transformation
vector separation(const label facei) const
{
if (facei < size()/2)
{
return coupledPolyPatch::separation()[0];
}
else
{
return -coupledPolyPatch::separation()[0];
}
}
label transformGlobalFace(const label facei) const
{
label offset = facei-start();
label neighbStart = neighbPatch().start();
const tensor& transformT(const label facei) const
if (offset >= 0 && offset < size())
{
if (facei < size()/2)
{
return reverseT()[0];
}
else
{
return forwardT()[0];
}
return neighbStart+offset;
}
template<class T>
T transform(const T& t, const label facei) const
else
{
if (parallel())
{
return t;
}
else
{
return Foam::transform(transformT(facei), t);
}
FatalErrorIn
(
"cyclicPolyPatch::transformGlobalFace(const label) const"
) << "Face " << facei << " not in patch " << name()
<< exit(FatalError);
return -1;
}
}
label transformLocalFace(const label facei) const
{
if (facei < size()/2)
{
return facei + size()/2;
}
else
{
return facei - size()/2;
}
}
//- Type of transform
transformType transform() const
{
return transform_;
}
label transformGlobalFace(const label facei) const
{
if (facei - start() < size()/2)
{
return facei + size()/2;
}
else
{
return facei - size()/2;
}
}
//- Axis of rotation for rotational cyclics
const vector& rotationAxis() const
{
return rotationAxis_;
}
//- Type of transform
transformType transform() const
{
return transform_;
}
//- Axis of rotation for rotational cyclics
const vector& rotationAxis() const
{
return rotationAxis_;
}
//- point on axis of rotation for rotational cyclics
const point& rotationCentre() const
{
return rotationCentre_;
}
//- Translation vector for translational cyclics
const vector& separationVector() const
{
return separationVector_;
}
//- point on axis of rotation for rotational cyclics
const point& rotationCentre() const
{
return rotationCentre_;
}
//- Translation vector for translational cyclics
const vector& separationVector() const
{
return separationVector_;
}
//- Initialize ordering for primitivePatch. Does not

View File

@ -0,0 +1,40 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "cyclicSlipPolyPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(cyclicSlipPolyPatch, 0);
addToRunTimeSelectionTable(polyPatch, cyclicSlipPolyPatch, word);
addToRunTimeSelectionTable(polyPatch, cyclicSlipPolyPatch, dictionary);
}
// ************************************************************************* //

View File

@ -0,0 +1,199 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::cyclicSlipPolyPatch
Description
Copy of cyclicSlip - used to be able to instantiate cyclicSlip pointPatch
which is cyclicSlip with slip constraints
SourceFiles
cyclicSlipPolyPatch.C
\*---------------------------------------------------------------------------*/
#ifndef cyclicSlipPolyPatch_H
#define cyclicSlipPolyPatch_H
#include "cyclicPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cyclicSlipPolyPatch Declaration
\*---------------------------------------------------------------------------*/
class cyclicSlipPolyPatch
:
public cyclicPolyPatch
{
public:
//- Runtime type information
TypeName("cyclicSlip");
// Constructors
//- Construct from components
cyclicSlipPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm
)
:
cyclicPolyPatch(name, size, start, index, bm)
{}
//- Construct from dictionary
cyclicSlipPolyPatch
(
const word& name,
const dictionary& dict,
const label index,
const polyBoundaryMesh& bm
)
:
cyclicPolyPatch(name, dict, index, bm)
{}
//- Construct as copy, resetting the boundary mesh
cyclicSlipPolyPatch
(
const cyclicSlipPolyPatch& pp,
const polyBoundaryMesh& bm
)
:
cyclicPolyPatch(pp, bm)
{}
//- Construct given the original patch and resetting the
// face list and boundary mesh information
cyclicSlipPolyPatch
(
const cyclicSlipPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart,
const word& neighbPatchName
)
:
cyclicPolyPatch(pp, bm, index, newSize, newStart, neighbPatchName)
{}
//- Construct given the original patch and a map
cyclicSlipPolyPatch
(
const cyclicPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
cyclicPolyPatch(pp, bm, index, mapAddressing, newStart)
{}
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{
return autoPtr<polyPatch>(new cyclicSlipPolyPatch(*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
{
return autoPtr<polyPatch>
(
new cyclicSlipPolyPatch
(
*this,
bm,
index,
newSize,
newStart,
neighbPatchName()
)
);
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new cyclicSlipPolyPatch
(
*this,
bm,
index,
mapAddressing,
newStart
)
);
}
// Destructor
virtual ~cyclicSlipPolyPatch()
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -62,9 +62,9 @@ Foam::processorPolyPatch::processorPolyPatch
neighbProcNo_(neighbProcNo),
neighbFaceCentres_(),
neighbFaceAreas_(),
neighbFaceCellCentres_(),
neighbPointsPtr_(NULL),
neighbEdgesPtr_(NULL)
neighbFaceCellCentres_()
// neighbPointsPtr_(NULL),
// neighbEdgesPtr_(NULL)
{}
@ -81,9 +81,9 @@ Foam::processorPolyPatch::processorPolyPatch
neighbProcNo_(readLabel(dict.lookup("neighbProcNo"))),
neighbFaceCentres_(),
neighbFaceAreas_(),
neighbFaceCellCentres_(),
neighbPointsPtr_(NULL),
neighbEdgesPtr_(NULL)
neighbFaceCellCentres_()
// neighbPointsPtr_(NULL),
// neighbEdgesPtr_(NULL)
{}
@ -98,9 +98,9 @@ Foam::processorPolyPatch::processorPolyPatch
neighbProcNo_(pp.neighbProcNo_),
neighbFaceCentres_(),
neighbFaceAreas_(),
neighbFaceCellCentres_(),
neighbPointsPtr_(NULL),
neighbEdgesPtr_(NULL)
neighbFaceCellCentres_()
// neighbPointsPtr_(NULL),
// neighbEdgesPtr_(NULL)
{}
@ -118,9 +118,9 @@ Foam::processorPolyPatch::processorPolyPatch
neighbProcNo_(pp.neighbProcNo_),
neighbFaceCentres_(),
neighbFaceAreas_(),
neighbFaceCellCentres_(),
neighbPointsPtr_(NULL),
neighbEdgesPtr_(NULL)
neighbFaceCellCentres_()
// neighbPointsPtr_(NULL),
// neighbEdgesPtr_(NULL)
{}
@ -129,7 +129,7 @@ Foam::processorPolyPatch::processorPolyPatch
const processorPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const unallocLabelList& mapAddressing,
const label newStart
)
:
@ -138,9 +138,9 @@ Foam::processorPolyPatch::processorPolyPatch
neighbProcNo_(pp.neighbProcNo_),
neighbFaceCentres_(),
neighbFaceAreas_(),
neighbFaceCellCentres_(),
neighbPointsPtr_(NULL),
neighbEdgesPtr_(NULL)
neighbFaceCellCentres_()
// neighbPointsPtr_(NULL),
// neighbEdgesPtr_(NULL)
{}
@ -148,8 +148,8 @@ Foam::processorPolyPatch::processorPolyPatch
Foam::processorPolyPatch::~processorPolyPatch()
{
deleteDemandDrivenData(neighbPointsPtr_);
deleteDemandDrivenData(neighbEdgesPtr_);
neighbPointsPtr_.clear();
neighbEdgesPtr_.clear();
}
@ -157,6 +157,7 @@ Foam::processorPolyPatch::~processorPolyPatch()
void Foam::processorPolyPatch::initGeometry(PstreamBuffers& pBufs)
{
//Pout<< "**processorPolyPatch::initGeometry()" << endl;
if (Pstream::parRun())
{
UOPstream toNeighbProc(neighbProcNo(), pBufs);
@ -171,6 +172,7 @@ void Foam::processorPolyPatch::initGeometry(PstreamBuffers& pBufs)
void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{
//Pout<< "processorPolyPatch::calcGeometry() for " << name() << endl;
if (Pstream::parRun())
{
{
@ -182,6 +184,9 @@ void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs)
>> neighbFaceCellCentres_;
}
//Pout<< "processorPolyPatch::calcGeometry() : received data for "
// << neighbFaceCentres_.size() << " faces." << endl;
// My normals
vectorField faceNormals(size());
@ -247,6 +252,9 @@ void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs)
nbrFaceNormals,
calcFaceTol(*this, points(), faceCentres())
);
//Pout<< "**neighbFaceCentres_:" << neighbFaceCentres_ << endl;
//Pout<< "**neighbFaceAreas_:" << neighbFaceAreas_ << endl;
//Pout<< "**neighbFaceCellCentres_:" << neighbFaceCellCentres_ << endl;
}
}
@ -276,9 +284,6 @@ void Foam::processorPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
{
polyPatch::initUpdateMesh(pBufs);
deleteDemandDrivenData(neighbPointsPtr_);
deleteDemandDrivenData(neighbEdgesPtr_);
if (Pstream::parRun())
{
// Express all points as patch face and index in face.
@ -327,6 +332,9 @@ void Foam::processorPolyPatch::updateMesh(PstreamBuffers& pBufs)
// For completeness
polyPatch::updateMesh(pBufs);
neighbPointsPtr_.clear();
neighbEdgesPtr_.clear();
if (Pstream::parRun())
{
labelList nbrPointFace;
@ -352,8 +360,8 @@ void Foam::processorPolyPatch::updateMesh(PstreamBuffers& pBufs)
// Convert points.
// ~~~~~~~~~~~~~~~
neighbPointsPtr_ = new labelList(nPoints(), -1);
labelList& neighbPoints = *neighbPointsPtr_;
neighbPointsPtr_.reset(new labelList(nPoints(), -1));
labelList& neighbPoints = neighbPointsPtr_();
forAll(nbrPointFace, nbrPointI)
{
@ -386,8 +394,8 @@ void Foam::processorPolyPatch::updateMesh(PstreamBuffers& pBufs)
// Convert edges.
// ~~~~~~~~~~~~~~
neighbEdgesPtr_ = new labelList(nEdges(), -1);
labelList& neighbEdges = *neighbEdgesPtr_;
neighbEdgesPtr_.reset(new labelList(nEdges(), -1));
labelList& neighbEdges = neighbEdgesPtr_();
forAll(nbrEdgeFace, nbrEdgeI)
{
@ -425,25 +433,25 @@ void Foam::processorPolyPatch::updateMesh(PstreamBuffers& pBufs)
const Foam::labelList& Foam::processorPolyPatch::neighbPoints() const
{
if (!neighbPointsPtr_)
if (!neighbPointsPtr_.valid())
{
FatalErrorIn("processorPolyPatch::neighbPoints() const")
<< "No extended addressing calculated for patch " << name()
<< abort(FatalError);
}
return *neighbPointsPtr_;
return neighbPointsPtr_();
}
const Foam::labelList& Foam::processorPolyPatch::neighbEdges() const
{
if (!neighbEdgesPtr_)
if (!neighbEdgesPtr_.valid())
{
FatalErrorIn("processorPolyPatch::neighbEdges() const")
<< "No extended addressing calculated for patch " << name()
<< abort(FatalError);
}
return *neighbEdgesPtr_;
return neighbEdgesPtr_();
}
@ -470,7 +478,7 @@ void Foam::processorPolyPatch::initOrder
writeOBJ(nm, pp, pp.points());
// Calculate my face centres
pointField ctrs(calcFaceCentres(pp, pp.points()));
const pointField& fc = pp.faceCentres();
OFstream localStr
(
@ -478,26 +486,22 @@ void Foam::processorPolyPatch::initOrder
/name() + "_localFaceCentres.obj"
);
Pout<< "processorPolyPatch::order : "
<< "Dumping " << ctrs.size()
<< "Dumping " << fc.size()
<< " local faceCentres to " << localStr.name() << endl;
forAll(ctrs, faceI)
forAll(fc, faceI)
{
writeOBJ(localStr, ctrs[faceI]);
writeOBJ(localStr, fc[faceI]);
}
}
const bool isMaster = Pstream::myProcNo() < neighbProcNo();
if (isMaster)
if (owner())
{
pointField ctrs(calcFaceCentres(pp, pp.points()));
pointField anchors(getAnchorPoints(pp, pp.points()));
// Now send all info over to the neighbour
UOPstream toNeighbour(neighbProcNo(), pBufs);
toNeighbour << ctrs << anchors;
toNeighbour << pp.faceCentres() << anchors;
}
}
@ -514,6 +518,8 @@ bool Foam::processorPolyPatch::order
labelList& rotation
) const
{
// Note: we only get the faces that originate from internal faces.
if (!Pstream::parRun())
{
return false;
@ -525,9 +531,7 @@ bool Foam::processorPolyPatch::order
rotation.setSize(pp.size());
rotation = 0;
const bool isMaster = Pstream::myProcNo() < neighbProcNo();
if (isMaster)
if (owner())
{
// Do nothing (i.e. identical mapping, zero rotation).
// See comment at top.
@ -549,11 +553,8 @@ bool Foam::processorPolyPatch::order
fromNeighbour >> masterCtrs >> masterAnchors;
}
// Calculate my face centres
pointField ctrs(calcFaceCentres(pp, pp.points()));
// Calculate typical distance from face centre
scalarField tols(calcFaceTol(pp, pp.points(), ctrs));
scalarField tols(calcFaceTol(pp, pp.points(), pp.faceCentres()));
if (debug || masterCtrs.size() != pp.size())
{
@ -591,84 +592,14 @@ bool Foam::processorPolyPatch::order
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// 1. Try existing ordering and transformation
bool matchedAll = false;
if
bool matchedAll = matchPoints
(
separated()
&& (separation().size() == 1 || separation().size() == pp.size())
)
{
vectorField transformedCtrs;
const vectorField& v = separation();
if (v.size() == 1)
{
transformedCtrs = masterCtrs-v[0];
}
else
{
transformedCtrs = masterCtrs-v;
}
matchedAll = matchPoints
(
ctrs,
transformedCtrs,
tols,
true,
faceMap
);
if (matchedAll)
{
// Use transformed centers from now on
masterCtrs = transformedCtrs;
// Transform anchors
if (v.size() == 1)
{
masterAnchors -= v[0];
}
else
{
masterAnchors -= v;
}
}
}
else if
(
!parallel()
&& (forwardT().size() == 1 || forwardT().size() == pp.size())
)
{
vectorField transformedCtrs = masterCtrs;
transformList(forwardT(), transformedCtrs);
matchedAll = matchPoints
(
ctrs,
transformedCtrs,
tols,
true,
faceMap
);
if (matchedAll)
{
// Use transformed centers from now on
masterCtrs = transformedCtrs;
// Transform anchors
transformList(forwardT(), masterAnchors);
}
}
// 2. Try zero separation automatic matching
if (!matchedAll)
{
matchedAll = matchPoints(ctrs, masterCtrs, tols, true, faceMap);
}
pp.faceCentres(),
masterCtrs,
tols,
true,
faceMap
);
if (!matchedAll || debug)
{
@ -695,14 +626,14 @@ bool Foam::processorPolyPatch::order
label vertI = 0;
forAll(ctrs, faceI)
forAll(pp.faceCentres(), faceI)
{
label masterFaceI = faceMap[faceI];
if (masterFaceI != -1)
{
const point& c0 = masterCtrs[masterFaceI];
const point& c1 = ctrs[faceI];
const point& c1 = pp.faceCentres()[faceI];
writeOBJ(ccStr, c0, c1, vertI);
}
}
@ -718,7 +649,7 @@ bool Foam::processorPolyPatch::order
<< "Cannot match vectors to faces on both sides of patch"
<< endl
<< " masterCtrs[0]:" << masterCtrs[0] << endl
<< " ctrs[0]:" << ctrs[0] << endl
<< " ctrs[0]:" << pp.faceCentres()[0] << endl
<< " Please check your topology changes or maybe you have"
<< " multiple separated (from cyclics) processor patches"
<< endl

View File

@ -40,6 +40,8 @@ SourceFiles
#define processorPolyPatch_H
#include "coupledPolyPatch.H"
#include "polyBoundaryMesh.H"
#include "faceListFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -70,23 +72,11 @@ class processorPolyPatch
//- Corresponding neighbouring local point label for every local point
// (so localPoints()[i] == neighb.localPoints()[neighbPoints_[i]])
mutable labelList* neighbPointsPtr_;
mutable autoPtr<labelList> neighbPointsPtr_;
//- Corresponding neighbouring local edge label for every local edge
// (so edges()[i] == neighb.edges()[neighbEdges_[i]])
mutable labelList* neighbEdgesPtr_;
// Private static data
//- Whether to use geometric or topological matching
static bool geometricMatch_;
//- Relative tolerance (for geometric matching only). Is factor of
// maximum edge length per face.
static scalar matchTol_;
mutable autoPtr<labelList> neighbEdgesPtr_;
protected:
@ -98,6 +88,22 @@ protected:
//- 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("processorPolyPatch::calcGeometry(..)");
}
//- Initialise the patches for moving points
void initMovePoints(PstreamBuffers&, const pointField&);
@ -236,7 +242,7 @@ public:
}
//- Does the processor own the patch ?
bool owner() const
virtual bool owner() const
{
return (myProcNo_ < neighbProcNo_);
}
@ -265,16 +271,21 @@ public:
return neighbFaceCellCentres_;
}
//- Return neighbour point labels. This is for my local point (-1 or)
// the corresponding local point on the other side. It is -1 if
// there are multiple corresponding points on this or the other side
// (can happen for cyclics being converted into proc patches)
//- Return neighbour point labels. WIP.
const labelList& neighbPoints() const;
//- 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.
//- Return neighbour edge labels. WIP.
const labelList& neighbEdges() const;
//- Return message tag to use for communication
virtual int tag() const
{
return Pstream::msgType();
}
//- Transform a patch-based position from other side to this side
virtual void transformPosition(pointField& l) const
{}
//- Initialize ordering for primitivePatch. Does not
// refer to *this (except for name() and type() etc.)

View File

@ -0,0 +1,263 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "processorCyclicPolyPatch.H"
#include "addToRunTimeSelectionTable.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),
tag_
(
Pstream::nProcs()*max(myProcNo, neighbProcNo)
+ min(myProcNo, neighbProcNo)
),
referPatchName_(referPatchName),
referPatchID_(-1)
{
if (debug)
{
Pout<< "processorCyclicPolyPatch " << name << " uses tag " << tag_
<< endl;
}
}
Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
(
const word& name,
const dictionary& dict,
const label index,
const polyBoundaryMesh& bm
)
:
processorPolyPatch(name, dict, index, bm),
tag_
(
Pstream::nProcs()*max(myProcNo(), neighbProcNo())
+ min(myProcNo(), neighbProcNo())
),
referPatchName_(dict.lookup("referPatch")),
referPatchID_(-1)
{
if (debug)
{
Pout<< "processorCyclicPolyPatch " << name << " uses tag " << tag_
<< endl;
}
}
Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
(
const processorCyclicPolyPatch& pp,
const polyBoundaryMesh& bm
)
:
processorPolyPatch(pp, bm),
tag_(pp.tag_),
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),
tag_(pp.tag_),
referPatchName_(referPatchName),
referPatchID_(-1)
{}
Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
(
const processorCyclicPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
processorPolyPatch(pp, bm, index, mapAddressing, newStart),
tag_(pp.tag_),
referPatchName_(pp.referPatchName()),
referPatchID_(-1)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::processorCyclicPolyPatch::~processorCyclicPolyPatch()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::processorCyclicPolyPatch::initGeometry(PstreamBuffers& pBufs)
{
// Send over processorPolyPatch data
processorPolyPatch::initGeometry(pBufs);
}
void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{
// 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
(
*this,
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,393 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
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
//- Message tag to use for communication
const int tag_;
//- 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 given the original patch and a map
processorCyclicPolyPatch
(
const processorCyclicPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- 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
(
*this,
bm,
index,
newSize,
newStart,
referPatchName
)
);
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new processorCyclicPolyPatch
(
*this,
bm,
index,
mapAddressing,
newStart
)
);
}
// 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 coupledPolyPatch>(pp);
}
//- Return message tag to use for communication
virtual int tag() const
{
return tag_;
}
//- Does this side own the patch ?
virtual bool owner() const
{
return referPatch().owner();
}
// //- 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().transformPosition(l);
}
//- Are the planes separated.
virtual bool separated() const
{
return referPatch().separated();
}
//- If the planes are separated the separation vector.
virtual const vectorField& separation() const
{
return referPatch().separation();
}
//- Are the cyclic planes parallel.
virtual bool parallel() const
{
return referPatch().parallel();
}
//- Return face transformation tensor.
virtual const tensorField& forwardT() const
{
return referPatch().forwardT();
}
//- Return neighbour-cell transformation tensor.
virtual const tensorField& reverseT() const
{
return referPatch().reverseT();
}
//- Are faces collocated. Either size 0,1 or length of patch
virtual const boolList& collocated() const
{
return referPatch().collocated();
}
//- 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

@ -87,12 +87,6 @@ class polyPatch
mutable labelList* mePtr_;
// Private Member Functions
//- Calculate labels of mesh edges
void calcMeshEdges() const;
protected:
// Protected Member Functions

View File

@ -0,0 +1,120 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
InClass
Foam::dummyTransform
Description
Dummy transform to be used with syncTools.
\*---------------------------------------------------------------------------*/
#ifndef dummyTransform_H
#define dummyTransform_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class dummyTransform Declaration
\*---------------------------------------------------------------------------*/
class dummyTransform
{
public:
template<class T>
void operator()(const coupledPolyPatch& cpp, Field<T>& fld) const
{}
template<class T, template<class> class Container>
void operator()(const coupledPolyPatch& cpp, Container<T>& map) const
{}
};
template<class T>
class pTraits<List<T> >
:
public List<T>
{
public:
typedef label cmptType;
pTraits(Istream& is)
:
List<T>(is)
{}
};
template<class T>
class pTraits<UList<T> >
:
public UList<T>
{
public:
typedef label cmptType;
pTraits(Istream& is)
:
UList<T>(is)
{}
};
template<class T>
class pTraits<Field<T> >
:
public Field<T>
{
public:
typedef label cmptType;
pTraits(Istream& is)
:
Field<T>(is)
{}
};
template<>
class pTraits<face>
:
public face
{
public:
typedef label cmptType;
pTraits(Istream& is)
:
face(is)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -28,6 +28,77 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
Field<label>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
Map<label>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<label>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
Field<scalar>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
Map<scalar>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<scalar>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
Field<bool>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
Map<bool>&
) const
{}
template<>
void Foam::syncTools::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<bool>&
) const
{}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Does anyone have couples? Since meshes might have 0 cells and 0 proc
// boundaries need to reduce this info.
bool Foam::syncTools::hasCouples(const polyBoundaryMesh& patches)
@ -46,31 +117,6 @@ bool Foam::syncTools::hasCouples(const polyBoundaryMesh& patches)
}
void Foam::syncTools::checkTransform
(
const coupledPolyPatch& pp,
const bool applySeparation
)
{
if (!pp.parallel() && pp.forwardT().size() > 1)
{
FatalErrorIn("syncTools::checkTransform(const coupledPolyPatch&)")
<< "Non-uniform transformation not supported for point or edge"
<< " fields." << endl
<< "Patch:" << pp.name()
<< abort(FatalError);
}
if (applySeparation && pp.separated() && pp.separation().size() > 1)
{
FatalErrorIn("syncTools::checkTransform(const coupledPolyPatch&)")
<< "Non-uniform separation vector not supported for point or edge"
<< " fields." << endl
<< "Patch:" << pp.name()
<< abort(FatalError);
}
}
// Determines for every point whether it is coupled and if so sets only one.
Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh)
{
@ -154,36 +200,16 @@ Foam::PackedBoolList Foam::syncTools::getMasterFaces(const polyMesh& mesh)
{
if (patches[patchI].coupled())
{
if (Pstream::parRun() && isA<processorPolyPatch>(patches[patchI]))
{
const processorPolyPatch& pp =
refCast<const processorPolyPatch>(patches[patchI]);
const coupledPolyPatch& pp =
refCast<const coupledPolyPatch>(patches[patchI]);
if (!pp.owner())
{
forAll(pp, i)
{
isMasterFace.unset(pp.start()+i);
}
}
}
else if (isA<cyclicPolyPatch>(patches[patchI]))
if (!pp.owner())
{
const cyclicPolyPatch& pp =
refCast<const cyclicPolyPatch>(patches[patchI]);
for (label i = pp.size()/2; i < pp.size(); i++)
forAll(pp, i)
{
isMasterFace.unset(pp.start()+i);
}
}
else
{
FatalErrorIn("syncTools::getMasterFaces(const polyMesh&)")
<< "Cannot handle coupled patch " << patches[patchI].name()
<< " of type " << patches[patchI].type()
<< abort(FatalError);
}
}
}
@ -191,100 +217,4 @@ Foam::PackedBoolList Foam::syncTools::getMasterFaces(const polyMesh& mesh)
}
template <>
void Foam::syncTools::separateList
(
const vectorField& separation,
UList<vector>& field
)
{
if (separation.size() == 1)
{
// Single value for all.
forAll(field, i)
{
field[i] += separation[0];
}
}
else if (separation.size() == field.size())
{
forAll(field, i)
{
field[i] += separation[i];
}
}
else
{
FatalErrorIn
(
"syncTools::separateList(const vectorField&, UList<vector>&)"
) << "Sizes of field and transformation not equal. field:"
<< field.size() << " transformation:" << separation.size()
<< abort(FatalError);
}
}
template <>
void Foam::syncTools::separateList
(
const vectorField& separation,
Map<vector>& field
)
{
if (separation.size() == 1)
{
// Single value for all.
forAllIter(Map<vector>, field, iter)
{
iter() += separation[0];
}
}
else if (separation.size() == field.size())
{
forAllIter(Map<vector>, field, iter)
{
iter() += separation[iter.key()];
}
}
else
{
FatalErrorIn
(
"syncTools::separateList(const vectorField&, Map<vector>&)"
) << "Sizes of field and transformation not equal. field:"
<< field.size() << " transformation:" << separation.size()
<< abort(FatalError);
}
}
template <>
void Foam::syncTools::separateList
(
const vectorField& separation,
EdgeMap<vector>& field
)
{
if (separation.size() == 1)
{
// Single value for all.
forAllIter(EdgeMap<vector>, field, iter)
{
iter() += separation[0];
}
}
else
{
FatalErrorIn
(
"syncTools::separateList(const vectorField&, EdgeMap<vector>&)"
) << "Multiple separation vectors not supported. field:"
<< field.size() << " transformation:" << separation.size()
<< abort(FatalError);
}
}
// ************************************************************************* //

View File

@ -50,10 +50,12 @@ SourceFiles
#include "UList.H"
#include "Pstream.H"
#include "transformList.H"
#include "Map.H"
#include "EdgeMap.H"
#include "PackedBoolList.H"
#include "polyMesh.H"
#include "coupledPolyPatch.H"
#include "transformList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -61,8 +63,6 @@ namespace Foam
{
class polyBoundaryMesh;
class polyMesh;
class coupledPolyPatch;
/*---------------------------------------------------------------------------*\
Class syncTools Declaration
@ -75,20 +75,6 @@ class syncTools
//- Check whether uses couples.
static bool hasCouples(const polyBoundaryMesh&);
//- Check for single transformation tensor only.
static void checkTransform(const coupledPolyPatch&, const bool);
//- Apply separation to list. Either single vector or one vector
// per element.
template <class T>
static void separateList(const vectorField&, UList<T>&);
template <class T>
static void separateList(const vectorField&, Map<T>&);
template <class T>
static void separateList(const vectorField&, EdgeMap<T>&);
//- Combine value with existing value in map.
template <class T, class CombineOp>
static void combine
@ -112,117 +98,384 @@ class syncTools
public:
// Static data members
// Public classes
//- Synchronize values on all mesh points.
// Applies rotation and optionally separation for parallel cyclics
template <class T, class CombineOp>
static void syncPointList
(
const polyMesh&,
UList<T>&,
const CombineOp& cop,
const T& nullValue,
const bool applySeparation
);
class transform
{
public:
//- Transform patch-based field
template<class T>
void operator()(const coupledPolyPatch& cpp, Field<T>& fld) const
{
if (!cpp.parallel())
{
transformList(cpp.forwardT(), fld);
}
}
//- Synchronize values on selected mesh points.
// Applies rotation and optionally separation for parallel cyclics
template <class T, class CombineOp>
static void syncPointList
(
const polyMesh&,
const labelList& meshPoints,
UList<T>&,
const CombineOp& bop,
const T& nullValue,
const bool applySeparation
);
//- Transform sparse field
template<class T, template<class> class Container>
void operator()(const coupledPolyPatch& cpp, Container<T>& map)
const
{
if (!cpp.parallel())
{
transformList(cpp.forwardT(), map);
}
}
};
//- Synchronize values on all mesh edges.
// Applies rotation and optionally separation for parallel cyclics
template <class T, class CombineOp>
static void syncEdgeList
(
const polyMesh&,
UList<T>&,
const CombineOp& cop,
const T& nullValue,
const bool applySeparation
);
class transformPosition
{
public:
void operator()(const coupledPolyPatch& cpp, pointField& fld) const
{
cpp.transformPosition(fld);
}
template<template<class> class Container>
void operator()(const coupledPolyPatch& cpp, Container<point>& map)
const
{
Field<point> fld(map.size());
label i = 0;
forAllConstIter(typename Container<point>, map, iter)
{
fld[i++] = iter();
}
cpp.transformPosition(fld);
i = 0;
forAllIter(typename Container<point>, map, iter)
{
iter() = fld[i++];
}
}
};
//- Synchronize values on boundary faces only.
// Optionally applies rotation tensor for non-parallel cyclics
// (but not separation!)
template <class T, class CombineOp>
static void syncBoundaryFaceList
(
const polyMesh&,
UList<T>&,
const CombineOp& cop,
const bool applySeparation
);
//- Synchronize values on all mesh faces.
// Optionally applies rotation tensor for non-parallel cyclics
// (but not separation!)
template <class T, class CombineOp>
static void syncFaceList
(
const polyMesh&,
UList<T>&,
const CombineOp& cop,
const bool applySeparation
);
//- Swap coupled face values.
// Applies rotation and optionally separation for parallel cyclics
template <class T>
static void swapBoundaryFaceList
(
const polyMesh&,
UList<T>&,
const bool applySeparation
);
//- Swap coupled face values.
// Applies rotation and optionally separation for parallel cyclics
template <class T>
static void swapFaceList
(
const polyMesh&,
UList<T>&,
const bool applySeparation
);
// Sparse versions
// Basic routines with user-supplied transformation. Preferably
// use specialisations below.
//- Synchronize values on selected points.
// Applies rotation and optionally separation for parallel
// cyclics.
template <class T, class CombineOp>
template <class T, class CombineOp, class TransformOp>
static void syncPointMap
(
const polyMesh&,
Map<T>& pointValues,
const CombineOp& cop,
const bool applySeparation
const TransformOp& top
);
//- Synchronize values on selected edges. Edges are represented
// by the two vertices that make it up so global edges never get
// constructed.
// Applies rotation and optionally separation for parallel
// cyclics.
template <class T, class CombineOp>
//- Synchronize values on selected edges.
template <class T, class CombineOp, class TransformOp>
static void syncEdgeMap
(
const polyMesh&,
EdgeMap<T>& edgeValues,
const CombineOp& cop,
const bool applySeparation
const TransformOp& top
);
//- Synchronize values on all mesh points.
template <class T, class CombineOp, class TransformOp>
static void syncPointList
(
const polyMesh&,
UList<T>&,
const CombineOp& cop,
const T& nullValue,
const TransformOp& top
);
//- Synchronize values on selected mesh points.
template <class T, class CombineOp, class TransformOp>
static void syncPointList
(
const polyMesh&,
const labelList& meshPoints,
UList<T>&,
const CombineOp& cop,
const T& nullValue,
const TransformOp& top
);
//- Synchronize values on all mesh edges.
template <class T, class CombineOp, class TransformOp>
static void syncEdgeList
(
const polyMesh&,
UList<T>&,
const CombineOp& cop,
const T& nullValue,
const TransformOp& top
);
//- Synchronize values on boundary faces only.
template <class T, class CombineOp, class TransformOp>
static void syncBoundaryFaceList
(
const polyMesh&,
UList<T>&,
const CombineOp& cop,
const TransformOp& top
);
// Synchronise point-wise data
//- Synchronize values on all mesh points.
template <class T, class CombineOp>
static void syncPointList
(
const polyMesh& mesh,
UList<T>& l,
const CombineOp& cop,
const T& nullValue
)
{
syncPointList(mesh, l, cop, nullValue, transform());
}
//- Synchronize locations on all mesh points.
template <class CombineOp>
static void syncPointPositions
(
const polyMesh& mesh,
UList<point>& l,
const CombineOp& cop,
const point& nullValue
)
{
syncPointList(mesh, l, cop, nullValue, transformPosition());
}
//- Synchronize values on selected mesh points.
template <class T, class CombineOp>
static void syncPointList
(
const polyMesh& mesh,
const labelList& meshPoints,
UList<T>& l,
const CombineOp& cop,
const T& nullValue
)
{
syncPointList
(
mesh,
meshPoints,
l,
cop,
nullValue,
transform()
);
}
//- Synchronize locations on selected mesh points.
template <class CombineOp>
static void syncPointPositions
(
const polyMesh& mesh,
const labelList& meshPoints,
UList<point>& l,
const CombineOp& cop,
const point& nullValue
)
{
syncPointList
(
mesh,
meshPoints,
l,
cop,
nullValue,
transformPosition()
);
}
// Synchronise edge-wise data
//- Synchronize values on all mesh edges.
template <class T, class CombineOp>
static void syncEdgeList
(
const polyMesh& mesh,
UList<T>& l,
const CombineOp& cop,
const T& nullValue
)
{
syncEdgeList(mesh, l, cop, nullValue, transform());
}
//- Synchronize values on all mesh edges.
template <class CombineOp>
static void syncEdgePositions
(
const polyMesh& mesh,
UList<point>& l,
const CombineOp& cop,
const point& nullValue
)
{
syncEdgeList(mesh, l, cop, nullValue, transformPosition());
}
// Synchronise face-wise data
//- Synchronize values on boundary faces only.
template <class T, class CombineOp>
static void syncBoundaryFaceList
(
const polyMesh& mesh,
UList<T>& l,
const CombineOp& cop
)
{
syncBoundaryFaceList(mesh, l, cop, transform());
}
//- Synchronize locations on boundary faces only.
template <class CombineOp>
static void syncBoundaryFacePositions
(
const polyMesh& mesh,
UList<point>& l,
const CombineOp& cop
)
{
syncBoundaryFaceList(mesh, l, cop, transformPosition());
}
//- Synchronize values on all mesh faces.
template <class T, class CombineOp>
static void syncFaceList
(
const polyMesh& mesh,
UList<T>& l,
const CombineOp& cop
)
{
SubList<T> bndValues
(
l,
mesh.nFaces()-mesh.nInternalFaces(),
mesh.nInternalFaces()
);
syncBoundaryFaceList(mesh, bndValues, cop, transform());
}
//- Synchronize locations on all mesh faces.
template <class CombineOp>
static void syncFacePositions
(
const polyMesh& mesh,
UList<point>& l,
const CombineOp& cop
)
{
SubList<point> bndValues
(
l,
mesh.nFaces()-mesh.nInternalFaces(),
mesh.nInternalFaces()
);
syncBoundaryFaceList(mesh, bndValues, cop, transformPosition());
}
//- Swap coupled boundary face values.
template <class T>
static void swapBoundaryFaceList
(
const polyMesh& mesh,
UList<T>& l
)
{
syncBoundaryFaceList(mesh, l, eqOp<T>(), transform());
}
//- Swap coupled positions.
template <class T>
static void swapBoundaryFacePositions
(
const polyMesh& mesh,
UList<T>& l
)
{
syncBoundaryFaceList(mesh, l, eqOp<T>(), transformPosition());
}
//- Swap coupled face values.
template <class T>
static void swapFaceList
(
const polyMesh& mesh,
UList<T>& l
)
{
SubList<T> bndValues
(
l,
mesh.nFaces()-mesh.nInternalFaces(),
mesh.nInternalFaces()
);
syncBoundaryFaceList(mesh, bndValues, eqOp<T>(), transform());
}
// Sparse versions
//- Synchronize values on selected points.
template <class T, class CombineOp>
static void syncPointMap
(
const polyMesh& mesh,
Map<T>& l,
const CombineOp& cop
)
{
syncPointMap(mesh, l, cop, transform());
}
//- Synchronize locations on selected points.
template <class CombineOp>
static void syncPointPositions
(
const polyMesh& mesh,
Map<point>& l,
const CombineOp& cop
)
{
syncPointMap(mesh, l, cop, transformPosition());
}
//- Synchronize values on selected edges. Edges are represented
// by the two vertices that make it up so global edges never get
// constructed.
template <class T, class CombineOp>
static void syncEdgeMap
(
const polyMesh& mesh,
EdgeMap<T>& l,
const CombineOp& cop
)
{
syncEdgeMap(mesh, l, cop, transform());
}
//- Synchronize locations on selected edges.
template <class T, class CombineOp>
static void syncEdgePositions
(
const polyMesh& mesh,
EdgeMap<T>& l,
const CombineOp& cop
)
{
syncEdgeMap(mesh, l, cop, transformPosition());
}
// PackedList versions
template <unsigned nBits, class CombineOp>
@ -273,13 +526,62 @@ public:
template<>
void syncTools::separateList(const vectorField&, UList<vector>&);
void syncTools::transform::operator()
(
const coupledPolyPatch&,
Field<label>&
) const;
template<>
void syncTools::transform::operator()
(
const coupledPolyPatch&,
Map<label>&
) const;
template<>
void syncTools::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<label>&
) const;
template<>
void syncTools::separateList(const vectorField&, Map<vector>&);
void syncTools::transform::operator()
(
const coupledPolyPatch&,
Field<scalar>&
) const;
template<>
void syncTools::transform::operator()
(
const coupledPolyPatch&,
Map<scalar>&
) const;
template<>
void syncTools::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<scalar>&
) const;
template<>
void syncTools::separateList(const vectorField&, EdgeMap<vector>&);
void syncTools::transform::operator()
(
const coupledPolyPatch& cpp,
Field<bool>& fld
) const;
template<>
void syncTools::transform::operator()
(
const coupledPolyPatch&,
Map<bool>&
) const;
template<>
void syncTools::transform::operator()
(
const coupledPolyPatch&,
EdgeMap<bool>&
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

File diff suppressed because it is too large Load Diff

View File

@ -463,9 +463,9 @@ bool Foam::faceZone::checkParallelSync(const bool report) const
}
}
boolList myZoneFace(neiZoneFace);
syncTools::swapBoundaryFaceList(mesh, neiZoneFace, false);
syncTools::swapBoundaryFaceList(mesh, neiZoneFace);
boolList myZoneFlip(neiZoneFlip);
syncTools::swapBoundaryFaceList(mesh, neiZoneFlip, false);
syncTools::swapBoundaryFaceList(mesh, neiZoneFlip);
forAll(*this, i)
{

View File

@ -37,7 +37,6 @@ namespace Foam
addCompoundToRunTimeSelectionTable(List<label>, labelList);
defineTemplateTypeNameAndDebugWithName(labelIOList, "labelList", 0);
defineTemplateTypeNameAndDebugWithName(labelListIOList, "labelListList", 0);
}
// ************************************************************************* //

View File

@ -32,7 +32,7 @@ Description
#ifndef labelIOList_H
#define labelIOList_H
#include "labelList.H"
#include "label.H"
#include "IOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -40,7 +40,6 @@ Description
namespace Foam
{
typedef IOList<label> labelIOList;
typedef IOList<labelList> labelListIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,47 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Declaration of IOList and IOListList ClassNames for IOListLists that
do not have .C files.
\*---------------------------------------------------------------------------*/
#include "labelListIOList.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebugWithName(labelListIOList, "labelListList", 0);
defineTemplateTypeNameAndDebugWithName
(
labelIOListList,
"labelCompactListList",
0
);
}
// ************************************************************************* //

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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::labelListIOList
Description
Label container classes
\*---------------------------------------------------------------------------*/
#ifndef labelListIOList_H
#define labelListIOList_H
#include "labelList.H"
#include "IOList.H"
#include "IOListList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOList<labelList> labelListIOList;
typedef IOListList<labelList, label> labelIOListList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -34,12 +34,6 @@ Description
namespace Foam
{
defineTemplateTypeNameAndDebugWithName(scalarIOList, "scalarList", 0);
defineTemplateTypeNameAndDebugWithName
(
scalarListIOList,
"scalarListList",
0
);
}
// ************************************************************************* //

View File

@ -32,7 +32,7 @@ Description
#ifndef scalarIOList_H
#define scalarIOList_H
#include "scalarList.H"
#include "scalar.H"
#include "IOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -40,7 +40,6 @@ Description
namespace Foam
{
typedef IOList<scalar> scalarIOList;
typedef IOList<scalarList> scalarListIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Declaration of IOList and IOListList ClassNames for IOListLists that
do not have .C files.
\*---------------------------------------------------------------------------*/
#include "scalarListIOList.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebugWithName
(
scalarListIOList,
"scalarListList",
0
);
defineTemplateTypeNameAndDebugWithName
(
scalarIOListList,
"scalarCompactListList",
0
);
}
// ************************************************************************* //

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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::scalarListIOList
Description
Scalar container classes
\*---------------------------------------------------------------------------*/
#ifndef scalarListIOList_H
#define scalarListIOList_H
#include "scalarList.H"
#include "IOList.H"
#include "IOListList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOList<scalarList> scalarListIOList;
typedef IOListList<scalarList, scalar> scalarIOListList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,39 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Declaration of vector IOList containers
\*---------------------------------------------------------------------------*/
#include "vectorIOList.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebugWithName(vectorIOList, "vectorList", 0);
}
// ************************************************************************* //

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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::vectorIOList
Description
Vector container classes
\*---------------------------------------------------------------------------*/
#ifndef vectorIOList_H
#define vectorIOList_H
#include "vector.H"
#include "IOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOList<vector> vectorIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

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