general update

This commit is contained in:
andy
2008-09-12 12:48:13 +01:00
parent e60638fd4f
commit f83fa73134
2 changed files with 70 additions and 20 deletions

View File

@ -26,7 +26,7 @@ License
#include "directMappedFixedValueFvPatchField.H" #include "directMappedFixedValueFvPatchField.H"
#include "directMappedFvPatch.H" #include "directMappedFvPatch.H"
#include "fvBoundaryMesh.H" #include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -164,6 +164,38 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
Field<Type> newValues(this->size()); Field<Type> newValues(this->size());
Field<Type> sendValues(this->size());
switch(mpp.mode())
{
case directMappedPolyPatch::NEARESTCELL:
{
sendValues = this->internalField();
break;
}
case directMappedPolyPatch::NEARESTPATCHFACE:
{
const label patchID =
this->patch().patch().boundaryMesh().findPatchID
(
mpp.samplePatch()
);
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const word& fieldName = this->dimensionedInternalField().name();
const fieldType& sendField =
this->db().objectRegistry::lookupObject<fieldType>(fieldName);
sendValues = sendField.boundaryField()[patchID];
break;
}
default:
{
FatalErrorIn
(
"directMappedFixedValueFvPatchField<Type>::updateCoeffs()"
)<< "patch can only be used in NEARESTCELL or NEARESTPATCHFACE "
<< "mode" << nl << abort(FatalError);
}
}
forAll(schedule, i) forAll(schedule, i)
{ {
@ -174,11 +206,7 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
if (Pstream::myProcNo() == sendProc) if (Pstream::myProcNo() == sendProc)
{ {
OPstream toProc(Pstream::blocking, recvProc); OPstream toProc(Pstream::blocking, recvProc);
toProc<< IndirectList<Type> toProc<< IndirectList<Type>(sendValues, sendLabels[recvProc])();
(
this->internalField(),
sendLabels[recvProc]
)();
} }
else else
{ {
@ -201,11 +229,7 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
// Do data from myself // Do data from myself
{ {
IndirectList<Type> fromFld IndirectList<Type> fromFld(sendValues, sendLabels[Pstream::myProcNo()]);
(
this->internalField(),
sendLabels[Pstream::myProcNo()]
);
// Destination faces // Destination faces
const labelList& faceLabels = receiveFaceLabels[Pstream::myProcNo()]; const labelList& faceLabels = receiveFaceLabels[Pstream::myProcNo()];

View File

@ -271,7 +271,19 @@ public:
// Member functions // Member functions
//- Offset vector (from patch faces to internal cells) //- What to sample
const sampleMode& mode() const
{
return mode_;
}
//- Patch (only if NEARESTBOUNDARY)
const word& samplePatch() const
{
return samplePatch_;
}
//- Offset vector (from patch faces to destination mesh objects)
const vector& offset() const const vector& offset() const
{ {
return offset_; return offset_;
@ -289,25 +301,39 @@ public:
//- Cells/faces to sample per processor //- Cells/faces to sample per processor
const labelListList& sendLabels() const const labelListList& sendLabels() const
{
if (debug)
{ {
Pout<< "Asking for sendLabels." << endl; Pout<< "Asking for sendLabels." << endl;
}
if (!sendLabelsPtr_.valid()) if (!sendLabelsPtr_.valid())
{
if (debug)
{ {
Pout<< "Calculating mapping." << endl; Pout<< "Calculating mapping." << endl;
calcMapping(); calcMapping();
} }
}
return sendLabelsPtr_(); return sendLabelsPtr_();
} }
//- Patch faces to receive per processor //- Patch faces to receive per processor
const labelListList& receiveFaceLabels() const const labelListList& receiveFaceLabels() const
{
if (debug)
{ {
Pout<< "Asking for receiveFaceLabels." << endl; Pout<< "Asking for receiveFaceLabels." << endl;
}
if (!receiveFaceLabelsPtr_.valid()) if (!receiveFaceLabelsPtr_.valid())
{
if (debug)
{ {
Pout<< "Calculating mapping." << endl; Pout<< "Calculating mapping." << endl;
calcMapping(); calcMapping();
} }
}
return receiveFaceLabelsPtr_(); return receiveFaceLabelsPtr_();
} }