本文整理汇总了C++中polyMesh::boundaryMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ polyMesh::boundaryMesh方法的具体用法?C++ polyMesh::boundaryMesh怎么用?C++ polyMesh::boundaryMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类polyMesh
的用法示例。
在下文中一共展示了polyMesh::boundaryMesh方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exit
Foam::patchInjectionBase::patchInjectionBase
(
const polyMesh& mesh,
const word& patchName
)
:
patchName_(patchName),
patchId_(mesh.boundaryMesh().findPatchID(patchName_)),
patchArea_(0.0),
patchNormal_(),
cellOwners_(),
triFace_(),
triToFace_(),
triCumulativeMagSf_(),
sumTriMagSf_(Pstream::nProcs() + 1, 0.0)
{
if (patchId_ < 0)
{
FatalErrorInFunction
<< "Requested patch " << patchName_ << " not found" << nl
<< "Available patches are: " << mesh.boundaryMesh().names() << nl
<< exit(FatalError);
}
updateMesh(mesh);
}
示例2: sampledSurface
Foam::sampledIsoSurface::sampledIsoSurface
(
const word& name,
const polyMesh& mesh,
const dictionary& dict
)
:
sampledSurface(name, mesh, dict),
isoField_(dict.lookup("isoField")),
isoVal_(readScalar(dict.lookup("isoValue"))),
mergeTol_(dict.lookupOrDefault("mergeTol", 1e-6)),
regularise_(dict.lookupOrDefault("regularise", true)),
average_(dict.lookupOrDefault("average", false)),
zoneID_(dict.lookupOrDefault("zone", word::null), mesh.cellZones()),
exposedPatchName_(word::null),
surfPtr_(NULL),
facesPtr_(NULL),
prevTimeIndex_(-1),
storedVolFieldPtr_(NULL),
volFieldPtr_(NULL),
storedPointFieldPtr_(NULL),
pointFieldPtr_(NULL)
{
if (!sampledSurface::interpolate())
{
FatalIOErrorIn
(
"sampledIsoSurface::sampledIsoSurface"
"(const word&, const polyMesh&, const dictionary&)",
dict
) << "Non-interpolated iso surface not supported since triangles"
<< " span across cells." << exit(FatalIOError);
}
if (zoneID_.index() != -1)
{
dict.lookup("exposedPatchName") >> exposedPatchName_;
if (mesh.boundaryMesh().findPatchID(exposedPatchName_) == -1)
{
FatalIOErrorIn
(
"sampledIsoSurface::sampledIsoSurface"
"(const word&, const polyMesh&, const dictionary&)",
dict
) << "Cannot find patch " << exposedPatchName_
<< " in which to put exposed faces." << endl
<< "Valid patches are " << mesh.boundaryMesh().names()
<< exit(FatalIOError);
}
if (debug && zoneID_.index() != -1)
{
Info<< "Restricting to cellZone " << zoneID_.name()
<< " with exposed internal faces into patch "
<< exposedPatchName_ << endl;
}
}
示例3: word
// Construct from dictionary
Foam::thoboisValve::thoboisValve
(
const word& name,
const polyMesh& mesh,
const dictionary& dict
)
:
name_(name),
mesh_(mesh),
engineDB_(refCast<const engineTime>(mesh_.time())),
csPtr_
(
coordinateSystem::New
(
"coordinateSystem",
dict.subDict("coordinateSystem")
)
),
bottomPatch_(dict.lookup("bottomPatch"), mesh.boundaryMesh()),
poppetPatch_(dict.lookup("poppetPatch"), mesh.boundaryMesh()),
sidePatch_(dict.lookup("sidePatch"), mesh.boundaryMesh()),
stemPatch_(dict.lookup("stemPatch"), mesh.boundaryMesh()),
detachInCylinderPatch_
(
dict.lookup("detachInCylinderPatch"),
mesh.boundaryMesh()
),
detachInPortPatch_
(
dict.lookup("detachInPortPatch"),
mesh.boundaryMesh()
),
detachFacesName_(dict.lookup("detachFaces")),
liftProfile_
(
"theta",
"lift",
name_,
IFstream
(
mesh.time().path()/mesh.time().constant()/
word(dict.lookup("liftProfileFile"))
)()
),
liftProfileStart_(min(liftProfile_.x())),
liftProfileEnd_(max(liftProfile_.x())),
minLift_(readScalar(dict.lookup("minLift"))),
diameter_(readScalar(dict.lookup("diameter"))),
staticPointsName_(dict.lookup("staticPoints")),
movingPointsName_(dict.lookup("movingPoints")),
movingInternalPointsName_(dict.lookup("movingInternalPoints")),
staticCellsName_(dict.lookup("staticCells")),
movingCellsName_(dict.lookup("movingCells"))
{}
示例4: findPatchID
label findPatchID(const polyMesh& mesh, const word& name)
{
label patchI = mesh.boundaryMesh().findPatchID(name);
if (patchI == -1)
{
FatalErrorIn("findPatchID(const polyMesh&, const word&)")
<< "Cannot find patch " << name << endl
<< "Valid patches are " << mesh.boundaryMesh().names()
<< exit(FatalError);
}
return patchI;
}
示例5: addPatch
// Adds empty patch if not yet there. Returns patchID.
label addPatch(polyMesh& mesh, const word& patchName)
{
label patchi = mesh.boundaryMesh().findPatchID(patchName);
if (patchi == -1)
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
List<polyPatch*> newPatches(patches.size() + 1);
patchi = 0;
// Copy all old patches
forAll(patches, i)
{
const polyPatch& pp = patches[i];
newPatches[patchi] =
pp.clone
(
patches,
patchi,
pp.size(),
pp.start()
).ptr();
patchi++;
}
// Add zero-sized patch
newPatches[patchi] =
new polyPatch
(
patchName,
0,
mesh.nFaces(),
patchi,
patches,
polyPatch::typeName
);
mesh.removeBoundary();
mesh.addPatches(newPatches);
Pout<< "Created patch " << patchName << " at " << patchi << endl;
}
else
{
示例6:
Foam::engineVerticalValve::engineVerticalValve
(
const word& name,
const polyMesh& mesh,
const autoPtr<coordinateSystem>& valveCS,
const word& bottomPatchName,
const word& poppetPatchName,
const word& stemPatchName,
const word& curtainInPortPatchName,
const word& curtainInCylinderPatchName,
const word& detachInCylinderPatchName,
const word& detachInPortPatchName,
const labelList& detachFaces,
const graph& liftProfile,
const scalar minLift,
const scalar minTopLayer,
const scalar maxTopLayer,
const scalar minBottomLayer,
const scalar maxBottomLayer,
const scalar diameter,
const word& valveHeadPatchName,
const scalar topLayerOffset,
const scalar topLayerTol,
const scalar bottomLayerOffset,
const scalar bottomLayerTol,
const scalar detachDistance,
const scalar detachTol,
const scalar deformationLift
)
:
engineValve
(
name,
mesh,
valveCS,
bottomPatchName,
poppetPatchName,
stemPatchName,
curtainInPortPatchName,
curtainInCylinderPatchName,
detachInCylinderPatchName,
detachInPortPatchName,
detachFaces,
liftProfile,
minLift,
minTopLayer,
maxTopLayer,
minBottomLayer,
maxBottomLayer,
diameter
),
valveHeadPatch_(valveHeadPatchName, mesh.boundaryMesh()),
topLayerOffset_(topLayerOffset),
topLayerTol_(topLayerTol),
bottomLayerOffset_(bottomLayerOffset),
bottomLayerTol_(bottomLayerTol),
detachDistance_(detachDistance),
detachTol_(detachTol),
deformationLift_(deformationLift)
{}
示例7:
Foam::pointMesh::pointMesh
(
const polyMesh& pMesh,
bool alwaysConstructGlobalPatch
)
:
MeshObject<polyMesh, pointMesh>(pMesh),
GeoMesh<polyMesh>(pMesh),
boundary_(*this, pMesh.boundaryMesh())
{
// Add the globalPointPatch if there are global points
if
(
alwaysConstructGlobalPatch
|| GeoMesh<polyMesh>::mesh_.globalData().nGlobalPoints()
)
{
boundary_.setSize(boundary_.size() + 1);
boundary_.set
(
boundary_.size() - 1,
new globalPointPatch
(
boundary_,
boundary_.size() - 1
)
);
}
// Calculate the geometry for the patches (transformation tensors etc.)
boundary_.calcGeometry();
}
示例8: calcPatchSizes
//- (optionally destructively) construct from components
Foam::mapDistributePolyMesh::mapDistributePolyMesh
(
const polyMesh& mesh,
const label nOldPoints,
const label nOldFaces,
const label nOldCells,
labelList& oldPatchStarts,
labelList& oldPatchNMeshPoints,
labelListList& subPointMap,
labelListList& subFaceMap,
labelListList& subCellMap,
labelListList& subPatchMap,
labelListList& constructPointMap,
labelListList& constructFaceMap,
labelListList& constructCellMap,
labelListList& constructPatchMap,
const bool reUse // clone or reuse
)
:
mesh_(mesh),
nOldPoints_(nOldPoints),
nOldFaces_(nOldFaces),
nOldCells_(nOldCells),
oldPatchSizes_(oldPatchStarts.size()),
oldPatchStarts_(oldPatchStarts, reUse),
oldPatchNMeshPoints_(oldPatchNMeshPoints, reUse),
pointMap_(mesh.nPoints(), subPointMap, constructPointMap, reUse),
faceMap_(mesh.nFaces(), subFaceMap, constructFaceMap, reUse),
cellMap_(mesh.nCells(), subCellMap, constructCellMap, reUse),
patchMap_(mesh.boundaryMesh().size(), subPatchMap, constructPatchMap, reUse)
{
calcPatchSizes();
}
示例9: patchIDs
Foam::labelList Foam::structuredDecomp::decompose
(
const polyMesh& mesh,
const pointField& cc,
const scalarField& cWeights
)
{
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
const labelHashSet patchIDs(pbm.patchSet(patches_));
label nFaces = 0;
forAllConstIter(labelHashSet, patchIDs, iter)
{
nFaces += pbm[iter.key()].size();
}
// Extract a submesh.
labelHashSet patchCells(2*nFaces);
forAllConstIter(labelHashSet, patchIDs, iter)
{
const labelUList& fc = pbm[iter.key()].faceCells();
forAll(fc, i)
{
patchCells.insert(fc[i]);
}
}
示例10: forAll
Foam::extendedFaceToCellStencil::extendedFaceToCellStencil(const polyMesh& mesh)
:
mesh_(mesh)
{
// Check for transformation - not supported.
const polyBoundaryMesh& patches = mesh.boundaryMesh();
forAll(patches, patchI)
{
if (isA<coupledPolyPatch>(patches[patchI]))
{
const coupledPolyPatch& cpp =
refCast<const coupledPolyPatch>(patches[patchI]);
if (!cpp.parallel() || cpp.separated())
{
FatalErrorIn
(
"extendedFaceToCellStencil::extendedFaceToCellStencil"
"(const polyMesh&)"
) << "Coupled patches with transformations not supported."
<< endl
<< "Problematic patch " << cpp.name() << exit(FatalError);
}
}
}
}
示例11: patchIDs
Foam::labelList Foam::structuredRenumber::renumber
(
const polyMesh& mesh,
const pointField& points
) const
{
if (points.size() != mesh.nCells())
{
FatalErrorInFunction
<< "Number of points " << points.size()
<< " should equal the number of cells " << mesh.nCells()
<< exit(FatalError);
}
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
const labelHashSet patchIDs(pbm.patchSet(patches_));
label nFaces = 0;
forAllConstIter(labelHashSet, patchIDs, iter)
{
nFaces += pbm[iter.key()].size();
}
// Extract a submesh.
labelHashSet patchCells(2*nFaces);
forAllConstIter(labelHashSet, patchIDs, iter)
{
const labelUList& fc = pbm[iter.key()].faceCells();
forAll(fc, i)
{
patchCells.insert(fc[i]);
}
}
示例12: cellPointWeight
Foam::cellPointWeightWallModified::cellPointWeightWallModified
(
const polyMesh& mesh,
const vector& position,
const label celli,
const label facei
)
:
cellPointWeight(mesh, position, celli, facei)
{
// findTetrahedron or findTriangle will already have been called
// by the cellPointWeight constructor
if (facei >= 0)
{
const polyBoundaryMesh& bm = mesh.boundaryMesh();
label patchi = bm.whichPatch(facei);
if (patchi != -1)
{
if (isA<wallPolyPatch>(bm[patchi]))
{
// Apply cell centre value wall faces
weights_[0] = 1.0;
weights_[1] = 0.0;
weights_[2] = 0.0;
weights_[3] = 0.0;
}
}
}
}
示例13: sampledPatch
Foam::sampledPatchInternalField::sampledPatchInternalField
(
const word& name,
const polyMesh& mesh,
const dictionary& dict
)
:
sampledPatch(name, mesh, dict),
mappers_(patchIDs().size())
{
const scalar distance = readScalar(dict.lookup("distance"));
forAll(patchIDs(), i)
{
label patchI = patchIDs()[i];
mappers_.set
(
i,
new directMappedPatchBase
(
mesh.boundaryMesh()[patchI],
mesh.name(), // sampleRegion
directMappedPatchBase::NEARESTCELL, // sampleMode
word::null, // samplePatch
-distance // sample inside my domain
)
);
}
示例14: triToFace
void Foam::patchInjectionBase::updateMesh(const polyMesh& mesh)
{
// Set/cache the injector cells
const polyPatch& patch = mesh.boundaryMesh()[patchId_];
const pointField& points = patch.points();
cellOwners_ = patch.faceCells();
// Triangulate the patch faces and create addressing
DynamicList<label> triToFace(2*patch.size());
DynamicList<scalar> triMagSf(2*patch.size());
DynamicList<face> triFace(2*patch.size());
DynamicList<face> tris(5);
// Set zero value at the start of the tri area list
triMagSf.append(0.0);
forAll(patch, facei)
{
const face& f = patch[facei];
tris.clear();
f.triangles(points, tris);
forAll(tris, i)
{
triToFace.append(facei);
triFace.append(tris[i]);
triMagSf.append(tris[i].mag(points));
}
}
示例15: abort
void Foam::syncTools::swapBoundaryCellPositions
(
const polyMesh& mesh,
const UList<point>& cellData,
List<point>& neighbourCellData
)
{
if (cellData.size() != mesh.nCells())
{
FatalErrorInFunction
<< "Number of cell values " << cellData.size()
<< " is not equal to the number of cells in the mesh "
<< mesh.nCells() << abort(FatalError);
}
const polyBoundaryMesh& patches = mesh.boundaryMesh();
label nBnd = mesh.nFaces()-mesh.nInternalFaces();
neighbourCellData.setSize(nBnd);
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
const labelUList& faceCells = pp.faceCells();
forAll(faceCells, i)
{
label bFaceI = pp.start()+i-mesh.nInternalFaces();
neighbourCellData[bFaceI] = cellData[faceCells[i]];
}
}