本文整理汇总了C++中polyPatch::index方法的典型用法代码示例。如果您正苦于以下问题:C++ polyPatch::index方法的具体用法?C++ polyPatch::index怎么用?C++ polyPatch::index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类polyPatch
的用法示例。
在下文中一共展示了polyPatch::index方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: forAll
Foam::label Foam::mergePolyMesh::patchIndex(const polyPatch& p)
{
// Find the patch name on the list. If the patch is already there
// and patch types match, return index
const word& pType = p.type();
const word& pName = p.name();
bool nameFound = false;
forAll (patchNames_, patchI)
{
if (patchNames_[patchI] == pName)
{
if (patchTypes_[patchI] == pType)
{
// Found name and types match
return patchI;
}
else
{
// Found the name, but type is different
nameFound = true;
}
}
}
// Patch not found. Append to the list
patchTypes_.append(pType);
if (nameFound)
{
// Duplicate name is not allowed. Create a composite name from the
// patch name and case name
const word& caseName = p.boundaryMesh().mesh().time().caseName();
patchNames_.append(pName + "_" + caseName);
Info<< "label patchIndex(const polyPatch& p) : "
<< "Patch " << p.index() << " named "
<< pName << " in mesh " << caseName
<< " already exists, but patch types "
<< " do not match.\nCreating a composite name as "
<< patchNames_[patchNames_.size() - 1] << endl;
}
else
{
patchNames_.append(pName);
}
return patchNames_.size() - 1;
}
示例2: mag
void Foam::KinematicCloud<CloudType>::patchData
(
const parcelType& p,
const polyPatch& pp,
const scalar trackFraction,
const tetIndices& tetIs,
vector& nw,
vector& Up
) const
{
label patchi = pp.index();
label patchFacei = pp.whichFace(p.face());
vector n = tetIs.faceTri(mesh_).normal();
n /= mag(n);
vector U = U_.boundaryField()[patchi][patchFacei];
// Unless the face is rotating, the required normal is n;
nw = n;
if (!mesh_.moving())
{
// Only wall patches may have a non-zero wall velocity from
// the velocity field when the mesh is not moving.
if (isA<wallPolyPatch>(pp))
{
Up = U;
}
else
{
Up = Zero;
}
}
else
{
vector U00 = U_.oldTime().boundaryField()[patchi][patchFacei];
vector n00 = tetIs.oldFaceTri(mesh_).normal();
// Difference in normal over timestep
vector dn = Zero;
if (mag(n00) > SMALL)
{
// If the old normal is zero (for example in layer
// addition) then use the current normal, meaning that the
// motion can only be translational, and dn remains zero,
// otherwise, calculate dn:
n00 /= mag(n00);
dn = n - n00;
}
// Total fraction through the timestep of the motion,
// including stepFraction before the current tracking step
// and the current trackFraction
// i.e.
// let s = stepFraction, t = trackFraction
// Motion of x in time:
// |-----------------|---------|---------|
// x00 x0 xi x
//
// where xi is the correct value of x at the required
// tracking instant.
//
// x0 = x00 + s*(x - x00) = s*x + (1 - s)*x00
//
// i.e. the motion covered by previous tracking portions
// within this timestep, and
//
// xi = x0 + t*(x - x0)
// = t*x + (1 - t)*x0
// = t*x + (1 - t)*(s*x + (1 - s)*x00)
// = (s + t - s*t)*x + (1 - (s + t - s*t))*x00
//
// let m = (s + t - s*t)
//
// xi = m*x + (1 - m)*x00 = x00 + m*(x - x00);
//
// In the same form as before.
scalar m =
p.stepFraction()
+ trackFraction
- (p.stepFraction()*trackFraction);
// When the mesh is moving, the velocity field on wall patches
// will contain the velocity associated with the motion of the
// mesh, in which case it is interpolated in time using m.
// For other patches the face velocity will need to be
// reconstructed from the face centre motion.
const vector& Cf = mesh_.faceCentres()[p.face()];
vector Cf00 = mesh_.faces()[p.face()].centre(mesh_.oldPoints());
if (isA<wallPolyPatch>(pp))
//.........这里部分代码省略.........
示例3: patch
bool Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::interfaceOwner
(
const polyMesh& nbrRegion,
const polyPatch& nbrPatch
) const
{
const fvMesh& myRegion = patch().boundaryMesh().mesh();
if (nbrRegion.name() == myRegion.name())
{
return patch().index() < nbrPatch.index();
}
else
{
const regionProperties& props =
myRegion.objectRegistry::parent().lookupObject<regionProperties>
(
"regionProperties"
);
label myIndex = findIndex(props.fluidRegionNames(), myRegion.name());
if (myIndex == -1)
{
label i = findIndex(props.solidRegionNames(), myRegion.name());
if (i == -1)
{
FatalErrorIn
(
"turbulentTemperatureCoupledBaffleFvPatchScalarField"
"::interfaceOwner(const polyMesh&"
", const polyPatch&)const"
) << "Cannot find region " << myRegion.name()
<< " neither in fluids " << props.fluidRegionNames()
<< " nor in solids " << props.solidRegionNames()
<< exit(FatalError);
}
myIndex = props.fluidRegionNames().size() + i;
}
label nbrIndex = findIndex
(
props.fluidRegionNames(),
nbrRegion.name()
);
if (nbrIndex == -1)
{
label i = findIndex(props.solidRegionNames(), nbrRegion.name());
if (i == -1)
{
FatalErrorIn
(
"coupleManager::interfaceOwner"
"(const polyMesh&, const polyPatch&) const"
) << "Cannot find region " << nbrRegion.name()
<< " neither in fluids " << props.fluidRegionNames()
<< " nor in solids " << props.solidRegionNames()
<< exit(FatalError);
}
nbrIndex = props.fluidRegionNames().size() + i;
}
return myIndex < nbrIndex;
}
}
开发者ID:frankl000,项目名称:OpenFOAM-1.7.x,代码行数:65,代码来源:turbulentTemperatureCoupledBaffleFvPatchScalarField.C
示例4: exit
Foam::label Foam::coupleGroupIdentifier::findOtherPatchID
(
const polyMesh& mesh,
const polyPatch& thisPatch
) const
{
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
if (!valid())
{
FatalErrorIn
(
"coupleGroupIdentifier::findOtherPatchID(const polyPatch&) const"
) << "Invalid coupleGroup patch group"
<< " on patch " << thisPatch.name()
<< " in region " << pbm.mesh().name()
<< exit(FatalError);
}
HashTable<labelList, word>::const_iterator fnd =
pbm.groupPatchIDs().find(name());
if (fnd == pbm.groupPatchIDs().end())
{
if (&mesh == &thisPatch.boundaryMesh().mesh())
{
// thisPatch should be in patchGroup
FatalErrorIn
(
"coupleGroupIdentifier::findOtherPatchID"
"(const polyMesh&, const polyPatch&) const"
) << "Patch " << thisPatch.name()
<< " should be in patchGroup " << name()
<< " in region " << pbm.mesh().name()
<< exit(FatalError);
}
return -1;
}
// Mesh has patch group
const labelList& patchIDs = fnd();
if (&mesh == &thisPatch.boundaryMesh().mesh())
{
if (patchIDs.size() > 2 || patchIDs.size() == 0)
{
FatalErrorIn
(
"coupleGroupIdentifier::findOtherPatchID"
"(const polyMesh&, const polyPatch&) const"
) << "Couple patchGroup " << name()
<< " with contents " << patchIDs
<< " not of size < 2"
<< " on patch " << thisPatch.name()
<< " region " << thisPatch.boundaryMesh().mesh().name()
<< exit(FatalError);
return -1;
}
label index = findIndex(patchIDs, thisPatch.index());
if (index == -1)
{
FatalErrorIn
(
"coupleGroupIdentifier::findOtherPatchID"
"(const polyMesh&, const polyPatch&) const"
) << "Couple patchGroup " << name()
<< " with contents " << patchIDs
<< " does not contain patch " << thisPatch.name()
<< " in region " << pbm.mesh().name()
<< exit(FatalError);
return -1;
}
if (patchIDs.size() == 2)
{
// Return the other patch
return patchIDs[1-index];
}
else // size == 1
{
return -1;
}
}
else
{
if (patchIDs.size() != 1)
{
FatalErrorIn
(
"coupleGroupIdentifier::findOtherPatchID"
"(const polyMesh&, const polyPatch&) const"
) << "Couple patchGroup " << name()
<< " with contents " << patchIDs
<< " in region " << mesh.name()
//.........这里部分代码省略.........
示例5: switch
bool Foam::LocalInteraction<CloudType>::correct
(
typename CloudType::parcelType& p,
const polyPatch& pp,
bool& keepParticle,
const scalar trackFraction,
const tetIndices& tetIs
)
{
label patchI = patchData_.applyToPatch(pp.index());
if (patchI >= 0)
{
vector& U = p.U();
bool& active = p.active();
typename PatchInteractionModel<CloudType>::interactionType it =
this->wordToInteractionType
(
patchData_[patchI].interactionTypeName()
);
switch (it)
{
case PatchInteractionModel<CloudType>::itEscape:
{
scalar dm = p.mass()*p.nParticle();
keepParticle = false;
active = false;
U = vector::zero;
nEscape_[patchI]++;
massEscape_[patchI] += dm;
if (writeFields_)
{
label pI = pp.index();
label fI = pp.whichFace(p.face());
massEscape().boundaryField()[pI][fI] += dm;
}
break;
}
case PatchInteractionModel<CloudType>::itStick:
{
scalar dm = p.mass()*p.nParticle();
keepParticle = true;
active = false;
U = vector::zero;
nStick_[patchI]++;
massStick_[patchI] += dm;
if (writeFields_)
{
label pI = pp.index();
label fI = pp.whichFace(p.face());
massStick().boundaryField()[pI][fI] += dm;
}
break;
}
case PatchInteractionModel<CloudType>::itRebound:
{
keepParticle = true;
active = true;
vector nw;
vector Up;
this->owner().patchData(p, pp, trackFraction, tetIs, nw, Up);
// Calculate motion relative to patch velocity
U -= Up;
scalar Un = U & nw;
vector Ut = U - Un*nw;
if (Un > 0)
{
U -= (1.0 + patchData_[patchI].e())*Un*nw;
}
U -= patchData_[patchI].mu()*Ut;
// Return velocity to global space
U += Up;
break;
}
default:
{
FatalErrorIn
(
"bool LocalInteraction<CloudType>::correct"
"("
"typename CloudType::parcelType&, "
"const polyPatch&, "
"bool&, "
"const scalar, "
"const tetIndices&"
") const"
) << "Unknown interaction type "
<< patchData_[patchI].interactionTypeName()
//.........这里部分代码省略.........