Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
henry
2009-11-24 11:00:58 +00:00
44 changed files with 759 additions and 428 deletions

View File

@ -45,7 +45,7 @@ Description
so cannot have any cells in any other zone. so cannot have any cells in any other zone.
- useCellZonesOnly does not do a walk and uses the cellZones only. Use - useCellZonesOnly does not do a walk and uses the cellZones only. Use
this if you don't mind having disconnected domains in a single region. this if you don't mind having disconnected domains in a single region.
This option requires all cells to be in one (and one only) region. This option requires all cells to be in one (and one only) cellZone.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

View File

@ -206,6 +206,21 @@ done
cmd="" cmd=""
if [ .$WM_MPLIB = .OPENMPI ]; then if [ .$WM_MPLIB = .OPENMPI ]; then
cmd="mpirun -app $PWD/mpirun.schema </dev/null" cmd="mpirun -app $PWD/mpirun.schema </dev/null"
elif [ .$WM_MPLIB = .MPICH ]; then
cmd="mpiexec"
for ((proc=0; proc<$nProcs; proc++))
do
read procCmd
procXtermCmdFile="$PWD/processor${proc}Xterm.sh"
echo "#!/bin/sh" > $procXtermCmdFile
echo "$procCmd" >> $procXtermCmdFile
chmod +x $procXtermCmdFile
if [ $proc -ne 0 ]; then
cmd="${cmd} :"
fi
cmd="${cmd} -n 1 ${procXtermCmdFile}"
done < $PWD/mpirun.schema
fi fi
echo "Constructed $PWD/mpirun.schema file." echo "Constructed $PWD/mpirun.schema file."

View File

@ -184,6 +184,12 @@ public:
// an out-of-range element returns false without any ill-effects // an out-of-range element returns false without any ill-effects
inline const T& operator[](const label) const; inline const T& operator[](const label) const;
//- Return last element of UList.
inline T& last();
//- Return last element of UList.
inline const T& last() const;
//- Allow cast to a const List<T>& //- Allow cast to a const List<T>&
inline operator const Foam::List<T>&() const; inline operator const Foam::List<T>&() const;

View File

@ -114,6 +114,20 @@ inline void Foam::UList<T>::checkIndex(const label i) const
} }
template<class T>
inline T& Foam::UList<T>::last()
{
return this->operator[](this->size()-1);
}
template<class T>
inline const T& Foam::UList<T>::last() const
{
return this->operator[](this->size()-1);
}
template<class T> template<class T>
inline const T* Foam::UList<T>::cdata() const inline const T* Foam::UList<T>::cdata() const
{ {

View File

@ -82,9 +82,6 @@ void Foam::PstreamBuffers::finishedSends(labelListList& sizes, const bool block)
if (commsType_ == UPstream::nonBlocking) if (commsType_ == UPstream::nonBlocking)
{ {
labelListList sizes;
labelListList send,recv;
Pstream::exchange<DynamicList<char>, char> Pstream::exchange<DynamicList<char>, char>
( (
sendBuf_, sendBuf_,
@ -96,20 +93,30 @@ void Foam::PstreamBuffers::finishedSends(labelListList& sizes, const bool block)
} }
else else
{ {
sizes.setSize(UPstream::nProcs()); FatalErrorIn
labelList& nsTransPs = sizes[UPstream::myProcNo()]; (
nsTransPs.setSize(UPstream::nProcs()); "PstreamBuffers::finishedSends(labelListList&, const bool)"
) << "Obtaining sizes not supported in "
<< UPstream::commsTypeNames[commsType_] << endl
<< " since transfers already in progress. Use non-blocking instead."
<< exit(FatalError);
forAll(sendBuf_, procI) // Note: possible only if using different tag from write started
{ // by ~UOPstream. Needs some work.
nsTransPs[procI] = sendBuf_[procI].size(); //sizes.setSize(UPstream::nProcs());
} //labelList& nsTransPs = sizes[UPstream::myProcNo()];
//nsTransPs.setSize(UPstream::nProcs());
// Send sizes across. //
int oldTag = UPstream::msgType(); //forAll(sendBuf_, procI)
UPstream::msgType() = tag_; //{
combineReduce(sizes, UPstream::listEq()); // nsTransPs[procI] = sendBuf_[procI].size();
UPstream::msgType() = oldTag; //}
//
//// Send sizes across.
//int oldTag = UPstream::msgType();
//UPstream::msgType() = tag_;
//combineReduce(sizes, UPstream::listEq());
//UPstream::msgType() = oldTag;
} }
} }

View File

@ -138,7 +138,8 @@ public:
void finishedSends(const bool block = true); void finishedSends(const bool block = true);
//- Mark all sends as having been done. Same as above but also returns //- Mark all sends as having been done. Same as above but also returns
// sizes (bytes) transferred. // sizes (bytes) transferred. Note:currently only valid for
// non-blocking.
void finishedSends(labelListList& sizes, const bool block = true); void finishedSends(labelListList& sizes, const bool block = true);
}; };

View File

@ -50,43 +50,42 @@ void Pstream::exchange
const bool block const bool block
) )
{ {
if (UPstream::parRun()) if (!contiguous<T>())
{ {
if (!contiguous<T>()) FatalErrorIn
{ (
FatalErrorIn "Pstream::exchange(..)"
( ) << "Continuous data only." << Foam::abort(FatalError);
"Pstream::exchange(..)" }
) << "Continuous data only." << Foam::abort(FatalError);
}
if (sendBufs.size() != UPstream::nProcs()) if (sendBufs.size() != UPstream::nProcs())
{ {
FatalErrorIn FatalErrorIn
( (
"Pstream::exchange(..)" "Pstream::exchange(..)"
) << "Size of list:" << sendBufs.size() ) << "Size of list:" << sendBufs.size()
<< " does not equal the number of processors:" << " does not equal the number of processors:"
<< UPstream::nProcs() << UPstream::nProcs()
<< Foam::abort(FatalError); << Foam::abort(FatalError);
} }
sizes.setSize(UPstream::nProcs()); sizes.setSize(UPstream::nProcs());
labelList& nsTransPs = sizes[UPstream::myProcNo()]; labelList& nsTransPs = sizes[UPstream::myProcNo()];
nsTransPs.setSize(UPstream::nProcs()); nsTransPs.setSize(UPstream::nProcs());
forAll(sendBufs, procI) forAll(sendBufs, procI)
{ {
nsTransPs[procI] = sendBufs[procI].size(); nsTransPs[procI] = sendBufs[procI].size();
} }
// Send sizes across.
int oldTag = UPstream::msgType();
UPstream::msgType() = tag;
combineReduce(sizes, UPstream::listEq());
UPstream::msgType() = oldTag;
// Send sizes across.
int oldTag = UPstream::msgType();
UPstream::msgType() = tag;
combineReduce(sizes, UPstream::listEq());
UPstream::msgType() = oldTag;
if (Pstream::parRun())
{
// Set up receives // Set up receives
// ~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~

View File

@ -37,8 +37,43 @@ void Foam::OutputFilterFunctionObject<OutputFilter>::readDict()
dict_.readIfPresent("region", regionName_); dict_.readIfPresent("region", regionName_);
dict_.readIfPresent("dictionary", dictName_); dict_.readIfPresent("dictionary", dictName_);
dict_.readIfPresent("enabled", enabled_); dict_.readIfPresent("enabled", enabled_);
dict_.readIfPresent("storeFilter", storeFilter_);
} }
template<class OutputFilter>
void Foam::OutputFilterFunctionObject<OutputFilter>::allocateFilter()
{
if (dictName_.size())
{
ptr_.reset
(
new IOOutputFilter<OutputFilter>
(
name(),
time_.lookupObject<objectRegistry>(regionName_),
dictName_
)
);
}
else
{
ptr_.reset
(
new OutputFilter
(
name(),
time_.lookupObject<objectRegistry>(regionName_),
dict_
)
);
}
}
template<class OutputFilter>
void Foam::OutputFilterFunctionObject<OutputFilter>::destroyFilter()
{
ptr_.reset();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -56,6 +91,7 @@ Foam::OutputFilterFunctionObject<OutputFilter>::OutputFilterFunctionObject
regionName_(polyMesh::defaultRegion), regionName_(polyMesh::defaultRegion),
dictName_(), dictName_(),
enabled_(true), enabled_(true),
storeFilter_(true),
outputControl_(t, dict) outputControl_(t, dict)
{ {
readDict(); readDict();
@ -83,32 +119,9 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::start()
{ {
readDict(); readDict();
if (enabled_) if (enabled_&&storeFilter_)
{ {
if (dictName_.size()) allocateFilter();
{
ptr_.reset
(
new IOOutputFilter<OutputFilter>
(
name(),
time_.lookupObject<objectRegistry>(regionName_),
dictName_
)
);
}
else
{
ptr_.reset
(
new OutputFilter
(
name(),
time_.lookupObject<objectRegistry>(regionName_),
dict_
)
);
}
} }
return true; return true;
@ -120,12 +133,22 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::execute()
{ {
if (enabled_) if (enabled_)
{ {
if (!storeFilter_)
{
allocateFilter();
}
ptr_->execute(); ptr_->execute();
if (enabled_ && outputControl_.output()) if (enabled_ && outputControl_.output())
{ {
ptr_->write(); ptr_->write();
} }
if (!storeFilter_)
{
destroyFilter();
}
} }
return true; return true;
@ -137,12 +160,22 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::end()
{ {
if (enabled_) if (enabled_)
{ {
if (!storeFilter_)
{
allocateFilter();
}
ptr_->end(); ptr_->end();
if (enabled_ && outputControl_.output()) if (enabled_ && outputControl_.output())
{ {
ptr_->write(); ptr_->write();
} }
if (!storeFilter_)
{
destroyFilter();
}
} }
return true; return true;

View File

@ -78,6 +78,10 @@ class OutputFilterFunctionObject
//- Switch for the execution of the functionObject //- Switch for the execution of the functionObject
bool enabled_; bool enabled_;
//- Switch to store filter in between writes or use on-the-fly
// construction
bool storeFilter_;
//- Output controls //- Output controls
outputFilterOutputControl outputControl_; outputFilterOutputControl outputControl_;
@ -89,6 +93,12 @@ class OutputFilterFunctionObject
//- Read relevant dictionary entries //- Read relevant dictionary entries
void readDict(); void readDict();
//- Creates most of the data associated with this object.
void allocateFilter();
//- Destroys most of the data associated with this object.
void destroyFilter();
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
OutputFilterFunctionObject(const OutputFilterFunctionObject&); OutputFilterFunctionObject(const OutputFilterFunctionObject&);

View File

@ -28,6 +28,9 @@ License
#include "polyBoundaryMesh.H" #include "polyBoundaryMesh.H"
#include "facePointPatch.H" #include "facePointPatch.H"
#include "globalPointPatch.H" #include "globalPointPatch.H"
#include "PstreamBuffers.H"
#include "lduSchedule.H"
#include "globalMeshData.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -58,14 +61,46 @@ Foam::pointBoundaryMesh::pointBoundaryMesh
void Foam::pointBoundaryMesh::calcGeometry() void Foam::pointBoundaryMesh::calcGeometry()
{ {
forAll(*this, patchi) PstreamBuffers pBufs(Pstream::defaultCommsType);
{
operator[](patchi).initGeometry();
}
forAll(*this, patchi) if
(
Pstream::defaultCommsType == Pstream::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking
)
{ {
operator[](patchi).calcGeometry(); forAll(*this, patchi)
{
operator[](patchi).initGeometry(pBufs);
}
pBufs.finishedSends();
forAll(*this, patchi)
{
operator[](patchi).calcGeometry(pBufs);
}
}
else if (Pstream::defaultCommsType == Pstream::scheduled)
{
const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
// Dummy.
pBufs.finishedSends();
forAll(patchSchedule, patchEvali)
{
label patchi = patchSchedule[patchEvali].patch;
if (patchSchedule[patchEvali].init)
{
operator[](patchi).initGeometry(pBufs);
}
else
{
operator[](patchi).calcGeometry(pBufs);
}
}
} }
} }
@ -97,32 +132,92 @@ Foam::pointBoundaryMesh::globalPatch() const
void Foam::pointBoundaryMesh::movePoints(const pointField& p) void Foam::pointBoundaryMesh::movePoints(const pointField& p)
{ {
pointPatchList& patches = *this; PstreamBuffers pBufs(Pstream::defaultCommsType);
forAll(patches, patchi) if
(
Pstream::defaultCommsType == Pstream::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking
)
{ {
patches[patchi].initMovePoints(p); forAll(*this, patchi)
{
operator[](patchi).initMovePoints(pBufs, p);
}
pBufs.finishedSends();
forAll(*this, patchi)
{
operator[](patchi).movePoints(pBufs, p);
}
} }
else if (Pstream::defaultCommsType == Pstream::scheduled)
forAll(patches, patchi)
{ {
patches[patchi].movePoints(p); const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
// Dummy.
pBufs.finishedSends();
forAll(patchSchedule, patchEvali)
{
label patchi = patchSchedule[patchEvali].patch;
if (patchSchedule[patchEvali].init)
{
operator[](patchi).initMovePoints(pBufs, p);
}
else
{
operator[](patchi).movePoints(pBufs, p);
}
}
} }
} }
void Foam::pointBoundaryMesh::updateMesh() void Foam::pointBoundaryMesh::updateMesh()
{ {
pointPatchList& patches = *this; PstreamBuffers pBufs(Pstream::defaultCommsType);
forAll(patches, patchi) if
(
Pstream::defaultCommsType == Pstream::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking
)
{ {
patches[patchi].initUpdateMesh(); forAll(*this, patchi)
{
operator[](patchi).initUpdateMesh(pBufs);
}
pBufs.finishedSends();
forAll(*this, patchi)
{
operator[](patchi).updateMesh(pBufs);
}
} }
else if (Pstream::defaultCommsType == Pstream::scheduled)
forAll(patches, patchi)
{ {
patches[patchi].updateMesh(); const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
// Dummy.
pBufs.finishedSends();
forAll(patchSchedule, patchEvali)
{
label patchi = patchSchedule[patchEvali].patch;
if (patchSchedule[patchEvali].init)
{
operator[](patchi).initUpdateMesh(pBufs);
}
else
{
operator[](patchi).updateMesh(pBufs);
}
}
} }
} }

View File

@ -66,22 +66,22 @@ protected:
// Protected Member Functions // Protected Member Functions
//- Initialise the calculation of the patch geometry //- Initialise the calculation of the patch geometry
virtual void initGeometry() = 0; virtual void initGeometry(PstreamBuffers&) = 0;
//- Calculate the patch geometry //- Calculate the patch geometry
virtual void calcGeometry() = 0; virtual void calcGeometry(PstreamBuffers&) = 0;
//- Initialise the patches for moving points //- Initialise the patches for moving points
virtual void initMovePoints(const pointField&) = 0; virtual void initMovePoints(PstreamBuffers&, const pointField&) = 0;
//- Correct patches after moving points //- Correct patches after moving points
virtual void movePoints(const pointField&) = 0; virtual void movePoints(PstreamBuffers&, const pointField&) = 0;
//- Initialise the update of the patch topology //- Initialise the update of the patch topology
virtual void initUpdateMesh() = 0; virtual void initUpdateMesh(PstreamBuffers&) = 0;
//- Update of the patch topology //- Update of the patch topology
virtual void updateMesh() = 0; virtual void updateMesh(PstreamBuffers&) = 0;
public: public:

View File

@ -50,13 +50,13 @@ addToRunTimeSelectionTable
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::cyclicPointPatch::initGeometry() void Foam::cyclicPointPatch::initGeometry(PstreamBuffers&)
{ {
transformPairs_.setSize(0); transformPairs_.setSize(0);
} }
void Foam::cyclicPointPatch::calcGeometry() void Foam::cyclicPointPatch::calcGeometry(PstreamBuffers&)
{ {
const edgeList& cp = cyclicPolyPatch_.coupledPoints(); const edgeList& cp = cyclicPolyPatch_.coupledPoints();
const labelList& mp = cyclicPolyPatch_.meshPoints(); const labelList& mp = cyclicPolyPatch_.meshPoints();
@ -128,16 +128,20 @@ void Foam::cyclicPointPatch::calcGeometry()
} }
else if (pointMap[cp[i][0]] == -1 && pointMap[cp[i][1]] != -1) else if (pointMap[cp[i][0]] == -1 && pointMap[cp[i][1]] != -1)
{ {
FatalErrorIn("cyclicPointPatch::calcGeometry() const") FatalErrorIn
<< "Point " << cp[i][0] << "of point-pair " << i (
"cyclicPointPatch::calcGeometry(PstreamBuffers&) const"
) << "Point " << cp[i][0] << "of point-pair " << i
<< " is a global point but the other point " << " is a global point but the other point "
<< cp[i][1] << " is not" << cp[i][1] << " is not"
<< exit(FatalError); << exit(FatalError);
} }
else if (pointMap[cp[i][0]] != -1 && pointMap[cp[i][1]] == -1) else if (pointMap[cp[i][0]] != -1 && pointMap[cp[i][1]] == -1)
{ {
FatalErrorIn("cyclicPointPatch::calcGeometry() const") FatalErrorIn
<< "Point " << cp[i][1] << "of point-pair " << i (
"cyclicPointPatch::calcGeometry(PstreamBuffers&) const"
) << "Point " << cp[i][1] << "of point-pair " << i
<< " is a global point but the other point " << " is a global point but the other point "
<< cp[i][0] << " is not" << cp[i][0] << " is not"
<< exit(FatalError); << exit(FatalError);
@ -149,25 +153,25 @@ void Foam::cyclicPointPatch::calcGeometry()
} }
void cyclicPointPatch::initMovePoints(const pointField&) void cyclicPointPatch::initMovePoints(PstreamBuffers&, const pointField&)
{} {}
void cyclicPointPatch::movePoints(const pointField&) void cyclicPointPatch::movePoints(PstreamBuffers&, const pointField&)
{} {}
void cyclicPointPatch::initUpdateMesh() void cyclicPointPatch::initUpdateMesh(PstreamBuffers& pBufs)
{ {
facePointPatch::initUpdateMesh(); facePointPatch::initUpdateMesh(pBufs);
cyclicPointPatch::initGeometry(); cyclicPointPatch::initGeometry(pBufs);
} }
void cyclicPointPatch::updateMesh() void cyclicPointPatch::updateMesh(PstreamBuffers& pBufs)
{ {
facePointPatch::updateMesh(); facePointPatch::updateMesh(pBufs);
cyclicPointPatch::calcGeometry(); cyclicPointPatch::calcGeometry(pBufs);
} }

View File

@ -74,22 +74,22 @@ class cyclicPointPatch
edgeList transformPairs_; edgeList transformPairs_;
//- Initialise the calculation of the patch geometry //- Initialise the calculation of the patch geometry
virtual void initGeometry(); virtual void initGeometry(PstreamBuffers&);
//- Calculate the patch geometry //- Calculate the patch geometry
virtual void calcGeometry(); virtual void calcGeometry(PstreamBuffers&);
//- Initialise the patches for moving points //- Initialise the patches for moving points
virtual void initMovePoints(const pointField&); virtual void initMovePoints(PstreamBuffers&, const pointField&);
//- Correct patches after moving points //- Correct patches after moving points
virtual void movePoints(const pointField&); virtual void movePoints(PstreamBuffers&, const pointField&);
//- Initialise the update of the patch topology //- Initialise the update of the patch topology
virtual void initUpdateMesh(); virtual void initUpdateMesh(PstreamBuffers&);
//- Update of the patch topology //- Update of the patch topology
virtual void updateMesh(); virtual void updateMesh(PstreamBuffers&);
public: public:

View File

@ -52,7 +52,7 @@ addToRunTimeSelectionTable
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::processorPointPatch::initGeometry() void Foam::processorPointPatch::initGeometry(PstreamBuffers& pBufs)
{ {
// Algorithm: // Algorithm:
// Depending on whether the patch is a master or a slave, get the primitive // Depending on whether the patch is a master or a slave, get the primitive
@ -84,16 +84,16 @@ void Foam::processorPointPatch::initGeometry()
if (Pstream::parRun()) if (Pstream::parRun())
{ {
initPatchPatchPoints(); initPatchPatchPoints(pBufs);
} }
} }
void Foam::processorPointPatch::calcGeometry() void Foam::processorPointPatch::calcGeometry(PstreamBuffers& pBufs)
{ {
if (Pstream::parRun()) if (Pstream::parRun())
{ {
calcPatchPatchPoints(); calcPatchPatchPoints(pBufs);
} }
// If it is not runing parallel or there are no global points // If it is not runing parallel or there are no global points
@ -149,11 +149,11 @@ void Foam::processorPointPatch::calcGeometry()
} }
void processorPointPatch::initPatchPatchPoints() void processorPointPatch::initPatchPatchPoints(PstreamBuffers& pBufs)
{ {
if (debug) if (debug)
{ {
Info<< "processorPointPatch::calcPatchPatchPoints() : " Info<< "processorPointPatch::initPatchPatchPoints(PstreamBuffers&) : "
<< "constructing patch-patch points" << "constructing patch-patch points"
<< endl; << endl;
} }
@ -229,7 +229,7 @@ void processorPointPatch::initPatchPatchPoints()
// Send the patchPatchPoints to the neighbouring processor // Send the patchPatchPoints to the neighbouring processor
OPstream toNeighbProc(Pstream::blocking, neighbProcNo()); UOPstream toNeighbProc(neighbProcNo(), pBufs);
toNeighbProc toNeighbProc
<< ppmp.size() // number of points for checking << ppmp.size() // number of points for checking
@ -238,17 +238,17 @@ void processorPointPatch::initPatchPatchPoints()
if (debug) if (debug)
{ {
Info<< "processorPointPatch::calcPatchPatchPoints() : " Info<< "processorPointPatch::initPatchPatchPoints() : "
<< "constructed patch-patch points" << "constructed patch-patch points"
<< endl; << endl;
} }
} }
void Foam::processorPointPatch::calcPatchPatchPoints() void Foam::processorPointPatch::calcPatchPatchPoints(PstreamBuffers& pBufs)
{ {
// Get the patchPatchPoints from the neighbouring processor // Get the patchPatchPoints from the neighbouring processor
IPstream fromNeighbProc(Pstream::blocking, neighbProcNo()); UIPstream fromNeighbProc(neighbProcNo(), pBufs);
label nbrNPoints(readLabel(fromNeighbProc)); label nbrNPoints(readLabel(fromNeighbProc));
labelListList patchPatchPoints(fromNeighbProc); labelListList patchPatchPoints(fromNeighbProc);
@ -265,7 +265,7 @@ void Foam::processorPointPatch::calcPatchPatchPoints()
// separate. // separate.
if (nbrNPoints != ppmp.size()) if (nbrNPoints != ppmp.size())
{ {
WarningIn("processorPointPatch::calcPatchPatchPoints()") WarningIn("processorPointPatch::calcPatchPatchPoints(PstreamBuffers&)")
<< "Processor patch " << name() << "Processor patch " << name()
<< " has " << ppmp.size() << " points; coupled patch has " << " has " << ppmp.size() << " points; coupled patch has "
<< nbrNPoints << " points." << endl << nbrNPoints << " points." << endl
@ -352,25 +352,25 @@ void Foam::processorPointPatch::calcPatchPatchPoints()
} }
void processorPointPatch::initMovePoints(const pointField&) void processorPointPatch::initMovePoints(PstreamBuffers&, const pointField&)
{} {}
void processorPointPatch::movePoints(const pointField&) void processorPointPatch::movePoints(PstreamBuffers&, const pointField&)
{} {}
void processorPointPatch::initUpdateMesh() void processorPointPatch::initUpdateMesh(PstreamBuffers& pBufs)
{ {
facePointPatch::initUpdateMesh(); facePointPatch::initUpdateMesh(pBufs);
processorPointPatch::initGeometry(); processorPointPatch::initGeometry(pBufs);
} }
void processorPointPatch::updateMesh() void processorPointPatch::updateMesh(PstreamBuffers& pBufs)
{ {
facePointPatch::updateMesh(); facePointPatch::updateMesh(pBufs);
processorPointPatch::calcGeometry(); processorPointPatch::calcGeometry(pBufs);
} }

View File

@ -68,30 +68,30 @@ class processorPointPatch
// Private Member Functions // Private Member Functions
//- Initialise the calculation of the patch geometry //- Initialise the calculation of the patch geometry
virtual void initGeometry(); virtual void initGeometry(PstreamBuffers&);
//- Calculate the patch geometry //- Calculate the patch geometry
virtual void calcGeometry(); virtual void calcGeometry(PstreamBuffers&);
//- Initialise the points on this patch which are should also be //- Initialise the points on this patch which are should also be
// on a neighbouring patch but are not part of faces of that patch // on a neighbouring patch but are not part of faces of that patch
void initPatchPatchPoints(); void initPatchPatchPoints(PstreamBuffers&);
//- Calculate the points on this patch which are should also be //- Calculate the points on this patch which are should also be
// on a neighbouring patch but are not part of faces of that patch // on a neighbouring patch but are not part of faces of that patch
void calcPatchPatchPoints(); void calcPatchPatchPoints(PstreamBuffers&);
//- Initialise the patches for moving points //- Initialise the patches for moving points
virtual void initMovePoints(const pointField&); virtual void initMovePoints(PstreamBuffers&, const pointField&);
//- Correct patches after moving points //- Correct patches after moving points
virtual void movePoints(const pointField&); virtual void movePoints(PstreamBuffers&, const pointField&);
//- Initialise the update of the patch topology //- Initialise the update of the patch topology
virtual void initUpdateMesh(); virtual void initUpdateMesh(PstreamBuffers&);
//- Update of the patch topology //- Update of the patch topology
virtual void updateMesh(); virtual void updateMesh(PstreamBuffers&);
//- Disallow default construct as copy //- Disallow default construct as copy

View File

@ -86,7 +86,7 @@ protected:
// Construction of demand-driven data // Construction of demand-driven data
//- Calculate mesh points //- Calculate mesh points
virtual void calcGeometry() = 0; virtual void calcGeometry(PstreamBuffers&) = 0;
public: public:

View File

@ -67,27 +67,27 @@ class globalPointPatch
// Protected Member Functions // Protected Member Functions
//- Initialise the calculation of the patch geometry //- Initialise the calculation of the patch geometry
virtual void initGeometry() virtual void initGeometry(PstreamBuffers&)
{} {}
//- Calculate the patch geometry //- Calculate the patch geometry
virtual void calcGeometry() virtual void calcGeometry(PstreamBuffers&)
{} {}
//- Initialise the patches for moving points //- Initialise the patches for moving points
virtual void initMovePoints(const pointField&) virtual void initMovePoints(PstreamBuffers&, const pointField&)
{} {}
//- Correct patches after moving points //- Correct patches after moving points
virtual void movePoints(const pointField&) virtual void movePoints(PstreamBuffers&, const pointField&)
{} {}
//- Initialise the update of the patch topology //- Initialise the update of the patch topology
virtual void initUpdateMesh() virtual void initUpdateMesh(PstreamBuffers&)
{} {}
//- Update of the patch topology //- Update of the patch topology
virtual void updateMesh() virtual void updateMesh(PstreamBuffers&)
{} {}

View File

@ -51,7 +51,7 @@ addToRunTimeSelectionTable
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void facePointPatch::initGeometry() void facePointPatch::initGeometry(PstreamBuffers&)
{ {
meshPoints_.setSize(0); meshPoints_.setSize(0);
localPoints_.setSize(0); localPoints_.setSize(0);
@ -59,25 +59,25 @@ void facePointPatch::initGeometry()
} }
void facePointPatch::calcGeometry() void facePointPatch::calcGeometry(PstreamBuffers&)
{} {}
void facePointPatch::initMovePoints(const pointField&) void facePointPatch::initMovePoints(PstreamBuffers&, const pointField&)
{} {}
void facePointPatch::movePoints(const pointField&) void facePointPatch::movePoints(PstreamBuffers&, const pointField&)
{} {}
void facePointPatch::initUpdateMesh() void facePointPatch::initUpdateMesh(PstreamBuffers& pBufs)
{ {
facePointPatch::initGeometry(); facePointPatch::initGeometry(pBufs);
} }
void facePointPatch::updateMesh() void facePointPatch::updateMesh(PstreamBuffers&)
{} {}

View File

@ -76,22 +76,22 @@ protected:
// Protected Member Functions // Protected Member Functions
//- Initialise the calculation of the patch geometry //- Initialise the calculation of the patch geometry
virtual void initGeometry(); virtual void initGeometry(PstreamBuffers&);
//- Calculate the patch geometry //- Calculate the patch geometry
virtual void calcGeometry(); virtual void calcGeometry(PstreamBuffers&);
//- Initialise the patches for moving points //- Initialise the patches for moving points
virtual void initMovePoints(const pointField&); virtual void initMovePoints(PstreamBuffers&, const pointField&);
//- Correct patches after moving points //- Correct patches after moving points
virtual void movePoints(const pointField&); virtual void movePoints(PstreamBuffers&, const pointField&);
//- Initialise the update of the patch topology //- Initialise the update of the patch topology
virtual void initUpdateMesh(); virtual void initUpdateMesh(PstreamBuffers&);
//- Update of the patch topology //- Update of the patch topology
virtual void updateMesh(); virtual void updateMesh(PstreamBuffers&);
private: private:

View File

@ -49,6 +49,7 @@ namespace Foam
class pointBoundaryMesh; class pointBoundaryMesh;
class pointConstraint; class pointConstraint;
class PstreamBuffers;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class pointPatch Declaration Class pointPatch Declaration
@ -79,27 +80,27 @@ protected:
friend class pointBoundaryMesh; friend class pointBoundaryMesh;
//- Initialise the calculation of the patch geometry //- Initialise the calculation of the patch geometry
virtual void initGeometry() virtual void initGeometry(PstreamBuffers&)
{} {}
//- Calculate the patch geometry //- Calculate the patch geometry
virtual void calcGeometry() virtual void calcGeometry(PstreamBuffers&)
{} {}
//- Initialise the patches for moving points //- Initialise the patches for moving points
virtual void initMovePoints(const pointField&) virtual void initMovePoints(PstreamBuffers&, const pointField&)
{} {}
//- Correct patches after moving points //- Correct patches after moving points
virtual void movePoints(const pointField&) virtual void movePoints(PstreamBuffers&, const pointField&)
{} {}
//- Initialise the update of the patch topology //- Initialise the update of the patch topology
virtual void initUpdateMesh() virtual void initUpdateMesh(PstreamBuffers&)
{} {}
//- Update of the patch topology //- Update of the patch topology
virtual void updateMesh() virtual void updateMesh(PstreamBuffers&)
{} {}

View File

@ -29,6 +29,9 @@ License
#include "primitiveMesh.H" #include "primitiveMesh.H"
#include "processorPolyPatch.H" #include "processorPolyPatch.H"
#include "stringListOps.H" #include "stringListOps.H"
#include "PstreamBuffers.H"
#include "lduSchedule.H"
#include "globalMeshData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -144,14 +147,46 @@ void Foam::polyBoundaryMesh::clearAddressing()
void Foam::polyBoundaryMesh::calcGeometry() void Foam::polyBoundaryMesh::calcGeometry()
{ {
forAll(*this, patchi) PstreamBuffers pBufs(Pstream::defaultCommsType);
{
operator[](patchi).initGeometry();
}
forAll(*this, patchi) if
(
Pstream::defaultCommsType == Pstream::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking
)
{ {
operator[](patchi).calcGeometry(); forAll(*this, patchi)
{
operator[](patchi).initGeometry(pBufs);
}
pBufs.finishedSends();
forAll(*this, patchi)
{
operator[](patchi).calcGeometry(pBufs);
}
}
else if (Pstream::defaultCommsType == Pstream::scheduled)
{
const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
// Dummy.
pBufs.finishedSends();
forAll(patchSchedule, patchEvali)
{
label patchi = patchSchedule[patchEvali].patch;
if (patchSchedule[patchEvali].init)
{
operator[](patchi).initGeometry(pBufs);
}
else
{
operator[](patchi).calcGeometry(pBufs);
}
}
} }
} }
@ -573,16 +608,46 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const
void Foam::polyBoundaryMesh::movePoints(const pointField& p) void Foam::polyBoundaryMesh::movePoints(const pointField& p)
{ {
polyPatchList& patches = *this; PstreamBuffers pBufs(Pstream::defaultCommsType);
forAll(patches, patchi) if
(
Pstream::defaultCommsType == Pstream::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking
)
{ {
patches[patchi].initMovePoints(p); forAll(*this, patchi)
{
operator[](patchi).initMovePoints(pBufs, p);
}
pBufs.finishedSends();
forAll(*this, patchi)
{
operator[](patchi).movePoints(pBufs, p);
}
} }
else if (Pstream::defaultCommsType == Pstream::scheduled)
forAll(patches, patchi)
{ {
patches[patchi].movePoints(p); const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
// Dummy.
pBufs.finishedSends();
forAll(patchSchedule, patchEvali)
{
label patchi = patchSchedule[patchEvali].patch;
if (patchSchedule[patchEvali].init)
{
operator[](patchi).initMovePoints(pBufs, p);
}
else
{
operator[](patchi).movePoints(pBufs, p);
}
}
} }
} }
@ -591,16 +656,46 @@ void Foam::polyBoundaryMesh::updateMesh()
{ {
deleteDemandDrivenData(neighbourEdgesPtr_); deleteDemandDrivenData(neighbourEdgesPtr_);
polyPatchList& patches = *this; PstreamBuffers pBufs(Pstream::defaultCommsType);
forAll(patches, patchi) if
(
Pstream::defaultCommsType == Pstream::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking
)
{ {
patches[patchi].initUpdateMesh(); forAll(*this, patchi)
{
operator[](patchi).initUpdateMesh(pBufs);
}
pBufs.finishedSends();
forAll(*this, patchi)
{
operator[](patchi).updateMesh(pBufs);
}
} }
else if (Pstream::defaultCommsType == Pstream::scheduled)
forAll(patches, patchi)
{ {
patches[patchi].updateMesh(); const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
// Dummy.
pBufs.finishedSends();
forAll(patchSchedule, patchEvali)
{
label patchi = patchSchedule[patchEvali].patch;
if (patchSchedule[patchEvali].init)
{
operator[](patchi).initUpdateMesh(pBufs);
}
else
{
operator[](patchi).updateMesh(pBufs);
}
}
} }
} }

View File

@ -50,8 +50,6 @@ class polyMesh;
// Forward declaration of friend functions and operators // Forward declaration of friend functions and operators
class polyBoundaryMesh;
Ostream& operator<<(Ostream&, const polyBoundaryMesh&); Ostream& operator<<(Ostream&, const polyBoundaryMesh&);

View File

@ -90,22 +90,22 @@ protected:
) const; ) const;
//- Initialise the calculation of the patch geometry //- Initialise the calculation of the patch geometry
virtual void initGeometry() = 0; virtual void initGeometry(PstreamBuffers&) = 0;
//- Calculate the patch geometry //- Calculate the patch geometry
virtual void calcGeometry() = 0; virtual void calcGeometry(PstreamBuffers&) = 0;
//- Initialise the patches for moving points //- Initialise the patches for moving points
virtual void initMovePoints(const pointField&) = 0; virtual void initMovePoints(PstreamBuffers&, const pointField&) = 0;
//- Correct patches after moving points //- Correct patches after moving points
virtual void movePoints(const pointField&) = 0; virtual void movePoints(PstreamBuffers&, const pointField&) = 0;
//- Initialise the update of the patch topology //- Initialise the update of the patch topology
virtual void initUpdateMesh() = 0; virtual void initUpdateMesh(PstreamBuffers&) = 0;
//- Update of the patch topology //- Update of the patch topology
virtual void updateMesh() = 0; virtual void updateMesh(PstreamBuffers&) = 0;
//- Write point in OBJ format //- Write point in OBJ format
@ -283,7 +283,11 @@ public:
//- Initialize ordering for primitivePatch. Does not //- Initialize ordering for primitivePatch. Does not
// refer to *this (except for name() and type() etc.) // refer to *this (except for name() and type() etc.)
virtual void initOrder(const primitivePatch&) const = 0; virtual void initOrder
(
PstreamBuffers&,
const primitivePatch&
) const = 0;
//- Return new ordering for primitivePatch. //- Return new ordering for primitivePatch.
// Ordering is -faceMap: for every face // Ordering is -faceMap: for every face
@ -292,6 +296,7 @@ public:
// (faceMap is identity, rotation is 0), true otherwise. // (faceMap is identity, rotation is 0), true otherwise.
virtual bool order virtual bool order
( (
PstreamBuffers&,
const primitivePatch&, const primitivePatch&,
labelList& faceMap, labelList& faceMap,
labelList& rotation labelList& rotation

View File

@ -516,7 +516,8 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
// if (debug) // if (debug)
// { // {
// Pout<< "cyclicPolyPatch::getCentresAndAnchors :" // Pout<< "cyclicPolyPatch::getCentresAndAnchors :"
// << "Specified translation : " << separationVector_ << endl; // << "Specified translation : " << separationVector_
// << endl;
// } // }
// //
// half0Ctrs += separationVector_; // half0Ctrs += separationVector_;
@ -858,36 +859,44 @@ Foam::cyclicPolyPatch::~cyclicPolyPatch()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cyclicPolyPatch::initGeometry() void Foam::cyclicPolyPatch::initGeometry(PstreamBuffers& pBufs)
{ {
polyPatch::initGeometry(); polyPatch::initGeometry(pBufs);
} }
void Foam::cyclicPolyPatch::calcGeometry() void Foam::cyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{ {
polyPatch::calcGeometry(); polyPatch::calcGeometry(pBufs);
calcTransforms(); calcTransforms();
} }
void Foam::cyclicPolyPatch::initMovePoints(const pointField& p) void Foam::cyclicPolyPatch::initMovePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{ {
polyPatch::initMovePoints(p); polyPatch::initMovePoints(pBufs, p);
} }
void Foam::cyclicPolyPatch::movePoints(const pointField& p) void Foam::cyclicPolyPatch::movePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{ {
polyPatch::movePoints(p); polyPatch::movePoints(pBufs, p);
calcTransforms(); calcTransforms();
} }
void Foam::cyclicPolyPatch::initUpdateMesh() void Foam::cyclicPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
{ {
polyPatch::initUpdateMesh(); polyPatch::initUpdateMesh(pBufs);
} }
void Foam::cyclicPolyPatch::updateMesh() void Foam::cyclicPolyPatch::updateMesh(PstreamBuffers& pBufs)
{ {
polyPatch::updateMesh(); polyPatch::updateMesh(pBufs);
deleteDemandDrivenData(coupledPointsPtr_); deleteDemandDrivenData(coupledPointsPtr_);
deleteDemandDrivenData(coupledEdgesPtr_); deleteDemandDrivenData(coupledEdgesPtr_);
} }
@ -1105,7 +1114,11 @@ const Foam::edgeList& Foam::cyclicPolyPatch::coupledEdges() const
} }
void Foam::cyclicPolyPatch::initOrder(const primitivePatch& pp) const void Foam::cyclicPolyPatch::initOrder
(
PstreamBuffers&,
const primitivePatch& pp
) const
{} {}
@ -1115,6 +1128,7 @@ void Foam::cyclicPolyPatch::initOrder(const primitivePatch& pp) const
// is identity, rotation is 0) // is identity, rotation is 0)
bool Foam::cyclicPolyPatch::order bool Foam::cyclicPolyPatch::order
( (
PstreamBuffers& pBufs,
const primitivePatch& pp, const primitivePatch& pp,
labelList& faceMap, labelList& faceMap,
labelList& rotation labelList& rotation
@ -1300,7 +1314,8 @@ bool Foam::cyclicPolyPatch::order
<< endl; << endl;
// Recalculate untransformed face centres // Recalculate untransformed face centres
//pointField rawHalf0Ctrs = calcFaceCentres(half0Faces, pp.points()); //pointField rawHalf0Ctrs =
// calcFaceCentres(half0Faces, pp.points());
label vertI = 0; label vertI = 0;
forAll(half1Ctrs, i) forAll(half1Ctrs, i)
@ -1413,7 +1428,8 @@ bool Foam::cyclicPolyPatch::order
<< endl; << endl;
// Recalculate untransformed face centres // Recalculate untransformed face centres
//pointField rawHalf0Ctrs = calcFaceCentres(half0Faces, pp.points()); //pointField rawHalf0Ctrs =
// calcFaceCentres(half0Faces, pp.points());
label vertI = 0; label vertI = 0;
forAll(half1Ctrs, i) forAll(half1Ctrs, i)
@ -1499,7 +1515,8 @@ bool Foam::cyclicPolyPatch::order
<< endl; << endl;
// Recalculate untransformed face centres // Recalculate untransformed face centres
//pointField rawHalf0Ctrs = calcFaceCentres(half0Faces, pp.points()); //pointField rawHalf0Ctrs =
// calcFaceCentres(half0Faces, pp.points());
label vertI = 0; label vertI = 0;
forAll(half1Ctrs, i) forAll(half1Ctrs, i)

View File

@ -176,22 +176,22 @@ protected:
// Protected Member functions // Protected Member functions
//- Initialise the calculation of the patch geometry //- Initialise the calculation of the patch geometry
virtual void initGeometry(); virtual void initGeometry(PstreamBuffers&);
//- Calculate the patch geometry //- Calculate the patch geometry
virtual void calcGeometry(); virtual void calcGeometry(PstreamBuffers&);
//- Initialise the patches for moving points //- Initialise the patches for moving points
virtual void initMovePoints(const pointField&); virtual void initMovePoints(PstreamBuffers&, const pointField&);
//- Correct patches after moving points //- Correct patches after moving points
virtual void movePoints(const pointField&); virtual void movePoints(PstreamBuffers&, const pointField&);
//- Initialise the update of the patch topology //- Initialise the update of the patch topology
virtual void initUpdateMesh(); virtual void initUpdateMesh(PstreamBuffers&);
//- Update of the patch topology //- Update of the patch topology
virtual void updateMesh(); virtual void updateMesh(PstreamBuffers&);
public: public:
@ -391,7 +391,7 @@ public:
//- Initialize ordering for primitivePatch. Does not //- Initialize ordering for primitivePatch. Does not
// refer to *this (except for name() and type() etc.) // refer to *this (except for name() and type() etc.)
virtual void initOrder(const primitivePatch&) const; virtual void initOrder(PstreamBuffers&, const primitivePatch&) const;
//- Return new ordering for primitivePatch. //- Return new ordering for primitivePatch.
// Ordering is -faceMap: for every face // Ordering is -faceMap: for every face
@ -400,6 +400,7 @@ public:
// (faceMap is identity, rotation is 0), true otherwise. // (faceMap is identity, rotation is 0), true otherwise.
virtual bool order virtual bool order
( (
PstreamBuffers&,
const primitivePatch&, const primitivePatch&,
labelList& faceMap, labelList& faceMap,
labelList& rotation labelList& rotation

View File

@ -34,6 +34,7 @@ License
#include "polyMesh.H" #include "polyMesh.H"
#include "Time.H" #include "Time.H"
#include "transformList.H" #include "transformList.H"
#include "PstreamBuffers.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -155,16 +156,11 @@ Foam::processorPolyPatch::~processorPolyPatch()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::processorPolyPatch::initGeometry() void Foam::processorPolyPatch::initGeometry(PstreamBuffers& pBufs)
{ {
if (Pstream::parRun()) if (Pstream::parRun())
{ {
OPstream toNeighbProc UOPstream toNeighbProc(neighbProcNo(), pBufs);
(
Pstream::blocking,
neighbProcNo(),
3*(sizeof(label) + size()*sizeof(vector) + sizeof(scalar))
);
toNeighbProc toNeighbProc
<< faceCentres() << faceCentres()
@ -174,17 +170,13 @@ void Foam::processorPolyPatch::initGeometry()
} }
void Foam::processorPolyPatch::calcGeometry() void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{ {
if (Pstream::parRun()) if (Pstream::parRun())
{ {
{ {
IPstream fromNeighbProc UIPstream fromNeighbProc(neighbProcNo(), pBufs);
(
Pstream::blocking,
neighbProcNo(),
3*(sizeof(label) + size()*sizeof(vector) + sizeof(scalar))
);
fromNeighbProc fromNeighbProc
>> neighbFaceCentres_ >> neighbFaceCentres_
>> neighbFaceAreas_ >> neighbFaceAreas_
@ -251,22 +243,30 @@ void Foam::processorPolyPatch::calcGeometry()
} }
void Foam::processorPolyPatch::initMovePoints(const pointField& p) void Foam::processorPolyPatch::initMovePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{ {
polyPatch::movePoints(p); polyPatch::movePoints(pBufs, p);
processorPolyPatch::initGeometry(); processorPolyPatch::initGeometry(pBufs);
} }
void Foam::processorPolyPatch::movePoints(const pointField&) void Foam::processorPolyPatch::movePoints
(
PstreamBuffers& pBufs,
const pointField&
)
{ {
processorPolyPatch::calcGeometry(); processorPolyPatch::calcGeometry(pBufs);
} }
void Foam::processorPolyPatch::initUpdateMesh() void Foam::processorPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
{ {
polyPatch::initUpdateMesh(); polyPatch::initUpdateMesh(pBufs);
deleteDemandDrivenData(neighbPointsPtr_); deleteDemandDrivenData(neighbPointsPtr_);
deleteDemandDrivenData(neighbEdgesPtr_); deleteDemandDrivenData(neighbEdgesPtr_);
@ -303,14 +303,7 @@ void Foam::processorPolyPatch::initUpdateMesh()
edgeIndex[patchEdgeI] = findIndex(fEdges, patchEdgeI); edgeIndex[patchEdgeI] = findIndex(fEdges, patchEdgeI);
} }
OPstream toNeighbProc UOPstream toNeighbProc(neighbProcNo(), pBufs);
(
Pstream::blocking,
neighbProcNo(),
8*sizeof(label) // four headers of labelList
+ 2*nPoints()*sizeof(label) // two point-based labellists
+ 2*nEdges()*sizeof(label) // two edge-based labelLists
);
toNeighbProc toNeighbProc
<< pointFace << pointFace
@ -321,10 +314,10 @@ void Foam::processorPolyPatch::initUpdateMesh()
} }
void Foam::processorPolyPatch::updateMesh() void Foam::processorPolyPatch::updateMesh(PstreamBuffers& pBufs)
{ {
// For completeness // For completeness
polyPatch::updateMesh(); polyPatch::updateMesh(pBufs);
if (Pstream::parRun()) if (Pstream::parRun())
{ {
@ -336,7 +329,7 @@ void Foam::processorPolyPatch::updateMesh()
{ {
// Note cannot predict exact size since opposite nPoints might // Note cannot predict exact size since opposite nPoints might
// be different from one over here. // be different from one over here.
IPstream fromNeighbProc(Pstream::blocking, neighbProcNo()); UIPstream fromNeighbProc(neighbProcNo(), pBufs);
fromNeighbProc fromNeighbProc
>> nbrPointFace >> nbrPointFace
@ -446,7 +439,11 @@ const Foam::labelList& Foam::processorPolyPatch::neighbEdges() const
} }
void Foam::processorPolyPatch::initOrder(const primitivePatch& pp) const void Foam::processorPolyPatch::initOrder
(
PstreamBuffers& pBufs,
const primitivePatch& pp
) const
{ {
if (!Pstream::parRun()) if (!Pstream::parRun())
{ {
@ -491,7 +488,7 @@ void Foam::processorPolyPatch::initOrder(const primitivePatch& pp) const
pointField anchors(getAnchorPoints(pp, pp.points())); pointField anchors(getAnchorPoints(pp, pp.points()));
// Now send all info over to the neighbour // Now send all info over to the neighbour
OPstream toNeighbour(Pstream::blocking, neighbProcNo()); UOPstream toNeighbour(neighbProcNo(), pBufs);
toNeighbour << ctrs << anchors; toNeighbour << ctrs << anchors;
} }
} }
@ -503,6 +500,7 @@ void Foam::processorPolyPatch::initOrder(const primitivePatch& pp) const
// is identity, rotation is 0) // is identity, rotation is 0)
bool Foam::processorPolyPatch::order bool Foam::processorPolyPatch::order
( (
PstreamBuffers& pBufs,
const primitivePatch& pp, const primitivePatch& pp,
labelList& faceMap, labelList& faceMap,
labelList& rotation labelList& rotation
@ -539,7 +537,7 @@ bool Foam::processorPolyPatch::order
// Receive data from neighbour // Receive data from neighbour
{ {
IPstream fromNeighbour(Pstream::blocking, neighbProcNo()); UIPstream fromNeighbour(neighbProcNo(), pBufs);
fromNeighbour >> masterCtrs >> masterAnchors; fromNeighbour >> masterCtrs >> masterAnchors;
} }

View File

@ -28,11 +28,9 @@ Class
Description Description
Neighbour processor patch. Neighbour processor patch.
Note: morph patch face ordering comes geometric or topological. Note: morph patch face ordering tries to do a geometric ordering.
Geometric: no cyclics allowed (assumes faces coincident) (assumes faces coincident) Hence will have problems when cyclics
Topological: needs unmodified faces on both sides to correspond. Also are present.
needs at least one per connected patch area (so all patch faces can be
visited from an unmodified face)
SourceFiles SourceFiles
processorPolyPatch.C processorPolyPatch.C
@ -97,22 +95,22 @@ protected:
// Protected Member functions // Protected Member functions
//- Initialise the calculation of the patch geometry //- Initialise the calculation of the patch geometry
void initGeometry(); void initGeometry(PstreamBuffers&);
//- Calculate the patch geometry //- Calculate the patch geometry
void calcGeometry(); void calcGeometry(PstreamBuffers&);
//- Initialise the patches for moving points //- Initialise the patches for moving points
void initMovePoints(const pointField&); void initMovePoints(PstreamBuffers&, const pointField&);
//- Correct patches after moving points //- Correct patches after moving points
void movePoints(const pointField&); void movePoints(PstreamBuffers&, const pointField&);
//- Initialise the update of the patch topology //- Initialise the update of the patch topology
virtual void initUpdateMesh(); virtual void initUpdateMesh(PstreamBuffers&);
//- Update of the patch topology //- Update of the patch topology
virtual void updateMesh(); virtual void updateMesh(PstreamBuffers&);
public: public:
@ -283,7 +281,7 @@ public:
//- Initialize ordering for primitivePatch. Does not //- Initialize ordering for primitivePatch. Does not
// refer to *this (except for name() and type() etc.) // refer to *this (except for name() and type() etc.)
virtual void initOrder(const primitivePatch&) const; virtual void initOrder(PstreamBuffers&, const primitivePatch&) const;
//- Return new ordering for primitivePatch. //- Return new ordering for primitivePatch.
// Ordering is -faceMap: for every face // Ordering is -faceMap: for every face
@ -292,6 +290,7 @@ public:
// (faceMap is identity, rotation is 0), true otherwise. // (faceMap is identity, rotation is 0), true otherwise.
virtual bool order virtual bool order
( (
PstreamBuffers&,
const primitivePatch&, const primitivePatch&,
labelList& faceMap, labelList& faceMap,
labelList& rotation labelList& rotation

View File

@ -55,12 +55,12 @@ namespace Foam
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::polyPatch::movePoints(const pointField& p) void Foam::polyPatch::movePoints(PstreamBuffers&, const pointField& p)
{ {
primitivePatch::movePoints(p); primitivePatch::movePoints(p);
} }
void Foam::polyPatch::updateMesh() void Foam::polyPatch::updateMesh(PstreamBuffers&)
{ {
clearAddressing(); clearAddressing();
} }
@ -334,12 +334,13 @@ void Foam::polyPatch::write(Ostream& os) const
} }
void Foam::polyPatch::initOrder(const primitivePatch&) const void Foam::polyPatch::initOrder(PstreamBuffers&, const primitivePatch&) const
{} {}
bool Foam::polyPatch::order bool Foam::polyPatch::order
( (
PstreamBuffers&,
const primitivePatch&, const primitivePatch&,
labelList& faceMap, labelList& faceMap,
labelList& rotation labelList& rotation

View File

@ -56,6 +56,7 @@ namespace Foam
class polyBoundaryMesh; class polyBoundaryMesh;
class polyPatch; class polyPatch;
class PstreamBuffers;
Ostream& operator<<(Ostream&, const polyPatch&); Ostream& operator<<(Ostream&, const polyPatch&);
@ -101,26 +102,26 @@ protected:
friend class polyBoundaryMesh; friend class polyBoundaryMesh;
//- Initialise the calculation of the patch geometry //- Initialise the calculation of the patch geometry
virtual void initGeometry() virtual void initGeometry(PstreamBuffers&)
{} {}
//- Calculate the patch geometry //- Calculate the patch geometry
virtual void calcGeometry() virtual void calcGeometry(PstreamBuffers&)
{} {}
//- Initialise the patches for moving points //- Initialise the patches for moving points
virtual void initMovePoints(const pointField&) virtual void initMovePoints(PstreamBuffers&, const pointField&)
{} {}
//- Correct patches after moving points //- Correct patches after moving points
virtual void movePoints(const pointField& p); virtual void movePoints(PstreamBuffers&, const pointField& p);
//- Initialise the update of the patch topology //- Initialise the update of the patch topology
virtual void initUpdateMesh() virtual void initUpdateMesh(PstreamBuffers&)
{} {}
//- Update of the patch topology //- Update of the patch topology
virtual void updateMesh(); virtual void updateMesh(PstreamBuffers&);
public: public:
@ -358,7 +359,7 @@ public:
//- Initialize ordering for primitivePatch. Does not //- Initialize ordering for primitivePatch. Does not
// refer to *this (except for name() and type() etc.) // refer to *this (except for name() and type() etc.)
virtual void initOrder(const primitivePatch&) const; virtual void initOrder(PstreamBuffers&, const primitivePatch&) const;
//- Return new ordering for primitivePatch. //- Return new ordering for primitivePatch.
// Ordering is -faceMap: for every face // Ordering is -faceMap: for every face
@ -367,6 +368,7 @@ public:
// (faceMap is identity, rotation is 0), true otherwise. // (faceMap is identity, rotation is 0), true otherwise.
virtual bool order virtual bool order
( (
PstreamBuffers&,
const primitivePatch&, const primitivePatch&,
labelList& faceMap, labelList& faceMap,
labelList& rotation labelList& rotation

View File

@ -1844,6 +1844,8 @@ void Foam::polyTopoChange::reorderCoupledFaces
// Rotation on new faces. // Rotation on new faces.
labelList rotation(faces_.size(), 0); labelList rotation(faces_.size(), 0);
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send ordering // Send ordering
forAll(boundary, patchI) forAll(boundary, patchI)
{ {
@ -1851,6 +1853,7 @@ void Foam::polyTopoChange::reorderCoupledFaces
{ {
boundary[patchI].initOrder boundary[patchI].initOrder
( (
pBufs,
primitivePatch primitivePatch
( (
SubList<face> SubList<face>
@ -1865,6 +1868,8 @@ void Foam::polyTopoChange::reorderCoupledFaces
} }
} }
pBufs.finishedSends();
// Receive and calculate ordering // Receive and calculate ordering
bool anyChanged = false; bool anyChanged = false;
@ -1878,6 +1883,7 @@ void Foam::polyTopoChange::reorderCoupledFaces
bool changed = boundary[patchI].order bool changed = boundary[patchI].order
( (
pBufs,
primitivePatch primitivePatch
( (
SubList<face> SubList<face>

View File

@ -100,7 +100,7 @@ angularOscillatingDisplacementPointPatchVectorField
angle0_(ptf.angle0_), angle0_(ptf.angle0_),
amplitude_(ptf.amplitude_), amplitude_(ptf.amplitude_),
omega_(ptf.omega_), omega_(ptf.omega_),
p0_(ptf.p0_) p0_(ptf.p0_, mapper)
{} {}

View File

@ -91,7 +91,7 @@ oscillatingVelocityPointPatchVectorField
fixedValuePointPatchField<vector>(ptf, p, iF, mapper), fixedValuePointPatchField<vector>(ptf, p, iF, mapper),
amplitude_(ptf.amplitude_), amplitude_(ptf.amplitude_),
omega_(ptf.omega_), omega_(ptf.omega_),
p0_(ptf.p0_) p0_(ptf.p0_, mapper)
{} {}

View File

@ -93,7 +93,7 @@ sixDoFRigidBodyDisplacementPointPatchVectorField
: :
fixedValuePointPatchField<vector>(ptf, p, iF, mapper), fixedValuePointPatchField<vector>(ptf, p, iF, mapper),
motion_(ptf.motion_), motion_(ptf.motion_),
p0_(ptf.p0_), p0_(ptf.p0_, mapper),
rhoInf_(ptf.rhoInf_) rhoInf_(ptf.rhoInf_)
{} {}

View File

@ -105,20 +105,15 @@ void Foam::Cloud<ParticleType>::move(TrackingData& td)
const globalMeshData& pData = polyMesh_.globalData(); const globalMeshData& pData = polyMesh_.globalData();
const labelList& processorPatches = pData.processorPatches(); const labelList& processorPatches = pData.processorPatches();
const labelList& processorPatchIndices = pData.processorPatchIndices(); const labelList& processorPatchIndices = pData.processorPatchIndices();
const labelList& processorPatchNeighbours =
pData.processorPatchNeighbours();
// Initialise the setpFraction moved for the particles // Initialise the stepFraction moved for the particles
forAllIter(typename Cloud<ParticleType>, *this, pIter) forAllIter(typename Cloud<ParticleType>, *this, pIter)
{ {
pIter().stepFraction() = 0; pIter().stepFraction() = 0;
} }
// Assume there will be particles to transfer
bool transfered = true;
// While there are particles to transfer // While there are particles to transfer
while (transfered) while (true)
{ {
// List of lists of particles to be transfered for all the processor // List of lists of particles to be transfered for all the processor
// patches // patches
@ -158,104 +153,93 @@ void Foam::Cloud<ParticleType>::move(TrackingData& td)
} }
} }
if (Pstream::parRun()) if (!Pstream::parRun())
{ {
// List of the numbers of particles to be transfered across the break;
// processor patches }
labelList nsTransPs(transferList.size());
forAll(transferList, i)
// Allocate transfer buffers
PstreamBuffers pBufs(Pstream::nonBlocking);
// Stream into send buffers
forAll(transferList, i)
{
if (transferList[i].size())
{ {
nsTransPs[i] = transferList[i].size(); UOPstream particleStream
} (
// List of the numbers of particles to be transfered across the
// processor patches for all the processors
labelListList allNTrans(Pstream::nProcs());
allNTrans[Pstream::myProcNo()] = nsTransPs;
combineReduce(allNTrans, UPstream::listEq());
transfered = false;
forAll(allNTrans, i)
{
forAll(allNTrans[i], j)
{
if (allNTrans[i][j])
{
transfered = true;
break;
}
}
}
if (!transfered)
{
break;
}
forAll(transferList, i)
{
if (transferList[i].size())
{
OPstream particleStream
(
Pstream::blocking,
refCast<const processorPolyPatch>
(
pMesh().boundaryMesh()[processorPatches[i]]
).neighbProcNo()
);
particleStream << transferList[i];
}
}
forAll(processorPatches, i)
{
label patchi = processorPatches[i];
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch> refCast<const processorPolyPatch>
(pMesh().boundaryMesh()[patchi]); (
pMesh().boundaryMesh()[processorPatches[i]]
).neighbProcNo(),
pBufs
);
label neighbProci = particleStream << transferList[i];
procPatch.neighbProcNo() - Pstream::masterNo(); }
}
label neighbProcPatchi = processorPatchNeighbours[patchi]; // Set up transfers when in non-blocking mode. Returns sizes (in bytes)
// to be sent/received.
labelListList allNTrans(Pstream::nProcs());
pBufs.finishedSends(allNTrans);
label nRecPs = allNTrans[neighbProci][neighbProcPatchi]; bool transfered = false;
if (nRecPs) forAll(allNTrans, i)
{
forAll(allNTrans[i], j)
{
if (allNTrans[i][j])
{ {
IPstream particleStream transfered = true;
( break;
Pstream::blocking,
procPatch.neighbProcNo()
);
IDLList<ParticleType> newParticles
(
particleStream,
typename ParticleType::iNew(*this)
);
forAllIter
(
typename Cloud<ParticleType>,
newParticles,
newpIter
)
{
ParticleType& newp = newpIter();
newp.correctAfterParallelTransfer(patchi, td);
addParticle(newParticles.remove(&newp));
}
} }
} }
} }
else
if (!transfered)
{ {
transfered = false; break;
}
// Retrieve from receive buffers
forAll(processorPatches, i)
{
label patchi = processorPatches[i];
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>
(pMesh().boundaryMesh()[patchi]);
label neighbProci = procPatch.neighbProcNo();
label nRecPs = allNTrans[neighbProci][Pstream::myProcNo()];
if (nRecPs)
{
UIPstream particleStream(neighbProci, pBufs);
IDLList<ParticleType> newParticles
(
particleStream,
typename ParticleType::iNew(*this)
);
forAllIter
(
typename Cloud<ParticleType>,
newParticles,
newpIter
)
{
ParticleType& newp = newpIter();
newp.correctAfterParallelTransfer(patchi, td);
addParticle(newParticles.remove(&newp));
}
}
} }
} }
} }

View File

@ -2411,6 +2411,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
} }
syncTools::swapBoundaryFaceList(mesh_, neiCellZone, false); syncTools::swapBoundaryFaceList(mesh_, neiCellZone, false);
// Get per face whether is it master (of a coupled set of faces)
PackedBoolList isMasterFace(syncTools::getMasterFaces(mesh_));
// Set owner as no-flip // Set owner as no-flip
forAll(patches, patchI) forAll(patches, patchI)
{ {
@ -2428,14 +2431,27 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
label neiZone = neiCellZone[faceI-mesh_.nInternalFaces()]; label neiZone = neiCellZone[faceI-mesh_.nInternalFaces()];
bool flip; bool flip;
if (ownZone == max(ownZone, neiZone))
label maxZone = max(ownZone, neiZone);
if (maxZone == -1)
{ {
flip = false; flip = false;
} }
else else if (ownZone == neiZone)
{
// Can only happen for coupled boundaries. Keep master
// face unflipped.
flip = !isMasterFace[faceI];
}
else if (neiZone == maxZone)
{ {
flip = true; flip = true;
} }
else
{
flip = false;
}
meshMod.setAction meshMod.setAction
( (

View File

@ -145,44 +145,49 @@ Foam::directMappedPolyPatch::~directMappedPolyPatch()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//- Initialise the calculation of the patch geometry //- Initialise the calculation of the patch geometry
void Foam::directMappedPolyPatch::initGeometry() void Foam::directMappedPolyPatch::initGeometry(PstreamBuffers& pBufs)
{ {
polyPatch::initGeometry(); polyPatch::initGeometry(pBufs);
directMappedPatchBase::clearOut();
} }
//- Calculate the patch geometry //- Calculate the patch geometry
void Foam::directMappedPolyPatch::calcGeometry() void Foam::directMappedPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{ {
polyPatch::calcGeometry(); polyPatch::calcGeometry(pBufs);
directMappedPatchBase::clearOut(); directMappedPatchBase::clearOut();
} }
//- Initialise the patches for moving points //- Initialise the patches for moving points
void Foam::directMappedPolyPatch::initMovePoints(const pointField& p) void Foam::directMappedPolyPatch::initMovePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{ {
polyPatch::initMovePoints(p); polyPatch::initMovePoints(pBufs, p);
directMappedPatchBase::clearOut();
} }
//- Correct patches after moving points //- Correct patches after moving points
void Foam::directMappedPolyPatch::movePoints(const pointField& p) void Foam::directMappedPolyPatch::movePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{ {
polyPatch::movePoints(p); polyPatch::movePoints(pBufs, p);
directMappedPatchBase::clearOut(); directMappedPatchBase::clearOut();
} }
//- Initialise the update of the patch topology //- Initialise the update of the patch topology
void Foam::directMappedPolyPatch::initUpdateMesh() void Foam::directMappedPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
{ {
polyPatch::initUpdateMesh(); polyPatch::initUpdateMesh(pBufs);
directMappedPatchBase::clearOut();
} }
//- Update of the patch topology //- Update of the patch topology
void Foam::directMappedPolyPatch::updateMesh() void Foam::directMappedPolyPatch::updateMesh(PstreamBuffers& pBufs)
{ {
polyPatch::updateMesh(); polyPatch::updateMesh(pBufs);
directMappedPatchBase::clearOut(); directMappedPatchBase::clearOut();
} }

View File

@ -65,22 +65,22 @@ class directMappedPolyPatch
protected: protected:
//- Initialise the calculation of the patch geometry //- Initialise the calculation of the patch geometry
virtual void initGeometry(); virtual void initGeometry(PstreamBuffers&);
//- Calculate the patch geometry //- Calculate the patch geometry
virtual void calcGeometry(); virtual void calcGeometry(PstreamBuffers&);
//- Initialise the patches for moving points //- Initialise the patches for moving points
virtual void initMovePoints(const pointField&); virtual void initMovePoints(PstreamBuffers&, const pointField&);
//- Correct patches after moving points //- Correct patches after moving points
virtual void movePoints(const pointField&); virtual void movePoints(PstreamBuffers&, const pointField&);
//- Initialise the update of the patch topology //- Initialise the update of the patch topology
virtual void initUpdateMesh(); virtual void initUpdateMesh(PstreamBuffers&);
//- Update of the patch topology //- Update of the patch topology
virtual void updateMesh(); virtual void updateMesh(PstreamBuffers&);
public: public:

View File

@ -150,44 +150,49 @@ Foam::directMappedWallPolyPatch::~directMappedWallPolyPatch()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//- Initialise the calculation of the patch geometry //- Initialise the calculation of the patch geometry
void Foam::directMappedWallPolyPatch::initGeometry() void Foam::directMappedWallPolyPatch::initGeometry(PstreamBuffers& pBufs)
{ {
wallPolyPatch::initGeometry(); wallPolyPatch::initGeometry(pBufs);
directMappedPatchBase::clearOut();
} }
//- Calculate the patch geometry //- Calculate the patch geometry
void Foam::directMappedWallPolyPatch::calcGeometry() void Foam::directMappedWallPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{ {
wallPolyPatch::calcGeometry(); wallPolyPatch::calcGeometry(pBufs);
directMappedPatchBase::clearOut(); directMappedPatchBase::clearOut();
} }
//- Initialise the patches for moving points //- Initialise the patches for moving points
void Foam::directMappedWallPolyPatch::initMovePoints(const pointField& p) void Foam::directMappedWallPolyPatch::initMovePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{ {
wallPolyPatch::initMovePoints(p); wallPolyPatch::initMovePoints(pBufs, p);
directMappedPatchBase::clearOut();
} }
//- Correct patches after moving points //- Correct patches after moving points
void Foam::directMappedWallPolyPatch::movePoints(const pointField& p) void Foam::directMappedWallPolyPatch::movePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{ {
wallPolyPatch::movePoints(p); wallPolyPatch::movePoints(pBufs, p);
directMappedPatchBase::clearOut(); directMappedPatchBase::clearOut();
} }
//- Initialise the update of the patch topology //- Initialise the update of the patch topology
void Foam::directMappedWallPolyPatch::initUpdateMesh() void Foam::directMappedWallPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
{ {
wallPolyPatch::initUpdateMesh(); wallPolyPatch::initUpdateMesh(pBufs);
directMappedPatchBase::clearOut();
} }
//- Update of the patch topology //- Update of the patch topology
void Foam::directMappedWallPolyPatch::updateMesh() void Foam::directMappedWallPolyPatch::updateMesh(PstreamBuffers& pBufs)
{ {
wallPolyPatch::updateMesh(); wallPolyPatch::updateMesh(pBufs);
directMappedPatchBase::clearOut(); directMappedPatchBase::clearOut();
} }

View File

@ -65,22 +65,22 @@ class directMappedWallPolyPatch
protected: protected:
//- Initialise the calculation of the patch geometry //- Initialise the calculation of the patch geometry
virtual void initGeometry(); virtual void initGeometry(PstreamBuffers&);
//- Calculate the patch geometry //- Calculate the patch geometry
virtual void calcGeometry(); virtual void calcGeometry(PstreamBuffers&);
//- Initialise the patches for moving points //- Initialise the patches for moving points
virtual void initMovePoints(const pointField&); virtual void initMovePoints(PstreamBuffers&, const pointField&);
//- Correct patches after moving points //- Correct patches after moving points
virtual void movePoints(const pointField&); virtual void movePoints(PstreamBuffers&, const pointField&);
//- Initialise the update of the patch topology //- Initialise the update of the patch topology
virtual void initUpdateMesh(); virtual void initUpdateMesh(PstreamBuffers&);
//- Update of the patch topology //- Update of the patch topology
virtual void updateMesh(); virtual void updateMesh(PstreamBuffers&);
public: public:

View File

@ -258,6 +258,7 @@ bool Foam::cuttingPlane::walkCell
void Foam::cuttingPlane::walkCellCuts void Foam::cuttingPlane::walkCellCuts
( (
const primitiveMesh& mesh, const primitiveMesh& mesh,
const bool triangulate,
const UList<label>& edgePoint const UList<label>& edgePoint
) )
{ {
@ -293,7 +294,7 @@ void Foam::cuttingPlane::walkCellCuts
// Check for the unexpected ... // Check for the unexpected ...
if (startEdgeI == -1) if (startEdgeI == -1)
{ {
FatalErrorIn("Foam::cuttingPlane::walkCellCuts") FatalErrorIn("Foam::cuttingPlane::walkCellCuts(..)")
<< "Cannot find cut edge for cut cell " << cellI << "Cannot find cut edge for cut cell " << cellI
<< abort(FatalError); << abort(FatalError);
} }
@ -318,10 +319,18 @@ void Foam::cuttingPlane::walkCellCuts
f = f.reverseFace(); f = f.reverseFace();
} }
// the cut faces are usually quite ugly, so always triangulate // the cut faces are usually quite ugly, so optionally triangulate
label nTri = f.triangles(cutPoints, dynCutFaces); if (triangulate)
while (nTri--)
{ {
label nTri = f.triangles(cutPoints, dynCutFaces);
while (nTri--)
{
dynCutCells.append(cellI);
}
}
else
{
dynCutFaces.append(f);
dynCutCells.append(cellI); dynCutCells.append(cellI);
} }
} }
@ -346,12 +355,13 @@ Foam::cuttingPlane::cuttingPlane
( (
const plane& pln, const plane& pln,
const primitiveMesh& mesh, const primitiveMesh& mesh,
const bool triangulate,
const UList<label>& cellIdLabels const UList<label>& cellIdLabels
) )
: :
plane(pln) plane(pln)
{ {
reCut(mesh, cellIdLabels); reCut(mesh, triangulate, cellIdLabels);
} }
@ -362,6 +372,7 @@ Foam::cuttingPlane::cuttingPlane
void Foam::cuttingPlane::reCut void Foam::cuttingPlane::reCut
( (
const primitiveMesh& mesh, const primitiveMesh& mesh,
const bool triangulate,
const UList<label>& cellIdLabels const UList<label>& cellIdLabels
) )
{ {
@ -379,7 +390,7 @@ void Foam::cuttingPlane::reCut
intersectEdges(mesh, dotProducts, edgePoint); intersectEdges(mesh, dotProducts, edgePoint);
// Do topological walk around cell to find closed loop. // Do topological walk around cell to find closed loop.
walkCellCuts(mesh, edgePoint); walkCellCuts(mesh, triangulate, edgePoint);
} }

View File

@ -105,6 +105,7 @@ class cuttingPlane
void walkCellCuts void walkCellCuts
( (
const primitiveMesh& mesh, const primitiveMesh& mesh,
const bool triangulate,
const UList<label>& edgePoint const UList<label>& edgePoint
); );
@ -122,6 +123,7 @@ protected:
void reCut void reCut
( (
const primitiveMesh&, const primitiveMesh&,
const bool triangulate,
const UList<label>& cellIdLabels = UList<label>::null() const UList<label>& cellIdLabels = UList<label>::null()
); );
@ -138,6 +140,7 @@ public:
( (
const plane&, const plane&,
const primitiveMesh&, const primitiveMesh&,
const bool triangulate,
const UList<label>& cellIdLabels = UList<label>::null() const UList<label>& cellIdLabels = UList<label>::null()
); );

View File

@ -150,11 +150,11 @@ bool Foam::sampledPlane::update()
if (zoneId < 0) if (zoneId < 0)
{ {
reCut(mesh()); reCut(mesh(), true); // always triangulate. Note:Make option?
} }
else else
{ {
reCut(mesh(), mesh().cellZones()[zoneId]); reCut(mesh(), true, mesh().cellZones()[zoneId]);
} }
if (debug) if (debug)

View File

@ -97,7 +97,7 @@ class turbulentTemperatureCoupledBaffleFvPatchScalarField
public: public:
//- Runtime type information //- Runtime type information
TypeName("turbulentTemperatureCoupledBaffle"); TypeName("compressible::turbulentTemperatureCoupledBaffle");
// Constructors // Constructors

View File

@ -34,7 +34,7 @@ hierarchicalCoeffs
metisCoeffs metisCoeffs
{ {
processorWeights ( 1 1 1 1 ); //processorWeights ( 1 1 1 1 );
} }
manualCoeffs manualCoeffs