本文整理汇总了C++中polyPatch::name方法的典型用法代码示例。如果您正苦于以下问题:C++ polyPatch::name方法的具体用法?C++ polyPatch::name怎么用?C++ polyPatch::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类polyPatch
的用法示例。
在下文中一共展示了polyPatch::name方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetName
void vtkFoamInterface<Type>::addPatch
(
const polyPatch& p,
vtkUnstructuredGrid *vtkPatch
)
{
if (debug)
{
Info<< "Adding patch " << p.name() << endl;
}
SetName(vtkPatch, p.name().c_str());
if (debug)
{
Info<< "converting points" << endl;
}
const Foam::pointField& points = p.localPoints();
// Convert Foam mesh vertices to VTK
vtkPoints *vtkpoints = vtkPoints::New();
vtkpoints->Allocate(points.size());
forAll(points, i)
{
vtkFoamInsertNextPoint(vtkpoints, points[i]);
}
示例2: forAllConstIter
Foam::label Foam::coupleGroupIdentifier::findOtherPatchID
(
const polyPatch& thisPatch,
word& otherRegion
) const
{
const polyBoundaryMesh& pbm = thisPatch.boundaryMesh();
const polyMesh& thisMesh = pbm.mesh();
const Time& runTime = thisMesh.time();
// Loop over all regions to find other patch in coupleGroup
HashTable<const polyMesh*> meshSet = runTime.lookupClass<polyMesh>();
label otherPatchID = -1;
forAllConstIter(HashTable<const polyMesh*>, meshSet, iter)
{
const polyMesh& mesh = *iter();
label patchID = findOtherPatchID(mesh, thisPatch);
if (patchID != -1)
{
if (otherPatchID != -1)
{
FatalErrorInFunction
<< "Couple patchGroup " << name()
<< " should be present on only two patches"
<< " in any of the meshes in " << meshSet.sortedToc()
<< endl
<< " It seems to be present on patch "
<< thisPatch.name()
<< " in region " << thisMesh.name()
<< ", on patch " << otherPatchID
<< " in region " << otherRegion
<< " and on patch " << patchID
<< " in region " << mesh.name()
<< exit(FatalError);
}
otherPatchID = patchID;
otherRegion = mesh.name();
}
}
if (otherPatchID == -1)
{
FatalErrorInFunction
<< "Couple patchGroup " << name()
<< " not found in any of the other meshes " << meshSet.sortedToc()
<< " on patch " << thisPatch.name()
<< " region " << thisMesh.name()
<< exit(FatalError);
}
return otherPatchID;
}
示例3: 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;
}
示例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: if
Foam::ensightPartFaces::ensightPartFaces
(
label partNumber,
const polyMesh& pMesh,
const polyPatch& pPatch
)
:
ensightPart(partNumber, pPatch.name(), pMesh)
{
isCellData_ = false;
offset_ = pPatch.start();
size_ = pPatch.size();
// count the shapes
label nTri = 0;
label nQuad = 0;
label nPoly = 0;
forAll (pPatch, patchfaceI)
{
const face& f = pMesh.faces()[patchfaceI + offset_];
if (f.size() == 3)
{
nTri++;
}
else if (f.size() == 4)
{
nQuad++;
}
else
{
nPoly++;
}
}
// we can avoid double looping, but at the cost of allocation
labelList triCells(nTri);
labelList quadCells(nQuad);
labelList polygonCells(nPoly);
nTri = 0;
nQuad = 0;
nPoly = 0;
// classify the shapes
forAll(pPatch, patchfaceI)
{
const face& f = pMesh.faces()[patchfaceI + offset_];
if (f.size() == 3)
{
triCells[nTri++] = patchfaceI;
}
else if (f.size() == 4)
{
quadCells[nQuad++] = patchfaceI;
}
else
{
polygonCells[nPoly++] = patchfaceI;
}
}
// MUST match with elementTypes
elemLists_.setSize(elementTypes().size());
elemLists_[tria3Elements].transfer( triCells );
elemLists_[quad4Elements].transfer( quadCells );
elemLists_[nsidedElements].transfer( polygonCells );
}