本文整理汇总了C++中polyMesh::time方法的典型用法代码示例。如果您正苦于以下问题:C++ polyMesh::time方法的具体用法?C++ polyMesh::time怎么用?C++ polyMesh::time使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类polyMesh
的用法示例。
在下文中一共展示了polyMesh::time方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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"))
{}
示例2: createDummyFvMeshFiles
void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
{
// Create dummy system/fv*
{
IOobject io
(
"fvSchemes",
mesh.time().system(),
regionName,
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
);
Info<< "Testing:" << io.objectPath() << endl;
if (!io.headerOk())
{
Info<< "Writing dummy " << regionName/io.name() << endl;
dictionary dummyDict;
dictionary divDict;
dummyDict.add("divSchemes", divDict);
dictionary gradDict;
dummyDict.add("gradSchemes", gradDict);
dictionary laplDict;
dummyDict.add("laplacianSchemes", laplDict);
IOdictionary(io, dummyDict).regIOobject::write();
}
}
{
IOobject io
(
"fvSolution",
mesh.time().system(),
regionName,
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
);
if (!io.headerOk())
{
Info<< "Writing dummy " << regionName/io.name() << endl;
dictionary dummyDict;
IOdictionary(io, dummyDict).regIOobject::write();
}
}
}
示例3: fvMotionSolver
Foam::displacementFvMotionSolver::displacementFvMotionSolver
(
const polyMesh& mesh,
Istream&
)
:
fvMotionSolver(mesh),
points0_
(
pointIOField
(
IOobject
(
"points",
mesh.time().constant(),
polyMesh::meshSubDir,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
)
)
{
if (points0_.size() != mesh.nPoints())
{
FatalErrorIn
(
"displacementFvMotionSolver::displacementFvMotionSolver\n"
"(\n"
" const polyMesh&,\n"
" Istream&\n"
")"
) << "Number of points in mesh " << mesh.nPoints()
<< " differs from number of points " << points0_.size()
<< " read from file "
<<
IOobject
(
"points",
mesh.time().constant(),
polyMesh::meshSubDir,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
).filePath()
<< exit(FatalError);
}
}
示例4: getMergeDistance
// Check writing tolerance before doing any serious work
scalar getMergeDistance(const polyMesh& mesh, const scalar mergeTol)
{
const boundBox& meshBb = mesh.bounds();
scalar mergeDist = mergeTol * meshBb.mag();
scalar writeTol = std::pow
(
scalar(10.0),
-scalar(IOstream::defaultPrecision())
);
Info<< nl
<< "Overall mesh bounding box : " << meshBb << nl
<< "Relative tolerance : " << mergeTol << nl
<< "Absolute matching distance : " << mergeDist << nl
<< endl;
if (mesh.time().writeFormat() == IOstream::ASCII && mergeTol < writeTol)
{
FatalErrorIn("getMergeDistance(const polyMesh&, const scalar)")
<< "Your current settings specify ASCII writing with "
<< IOstream::defaultPrecision() << " digits precision." << endl
<< "Your merging tolerance (" << mergeTol << ") is finer than this."
<< endl
<< "Please change your writeFormat to binary"
<< " or increase the writePrecision" << endl
<< "or adjust the merge tolerance (-mergeTol)."
<< exit(FatalError);
}
return mergeDist;
}
示例5: displacementMotionSolver
Foam::displacementSBRStressFvMotionSolver::displacementSBRStressFvMotionSolver
(
const polyMesh& mesh,
const IOdictionary& dict
)
:
displacementMotionSolver(mesh, dict, dict.lookup("solver")),
fvMotionSolver(mesh),
cellDisplacement_
(
IOobject
(
"cellDisplacement",
mesh.time().timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
fvMesh_,
dimensionedVector
(
"cellDisplacement",
pointDisplacement().dimensions(),
Zero
),
cellMotionBoundaryTypes<vector>(pointDisplacement().boundaryField())
),
diffusivityPtr_
(
motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity"))
)
{}
示例6: setFaces
// Write set to VTK readable files
void writeVTK
(
const polyMesh& mesh,
const topoSet& currentSet,
const fileName& vtkName
)
{
if (isA<faceSet>(currentSet))
{
// Faces of set with OpenFOAM faceID as value
faceList setFaces(currentSet.size());
labelList faceValues(currentSet.size());
label setFaceI = 0;
forAllConstIter(topoSet, currentSet, iter)
{
setFaces[setFaceI] = mesh.faces()[iter.key()];
faceValues[setFaceI] = iter.key();
setFaceI++;
}
primitiveFacePatch fp(setFaces, mesh.points());
writePatch
(
true,
currentSet.name(),
fp,
"faceID",
faceValues,
mesh.time().path()/vtkName
);
}
示例7: sampledSurface
Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
(
const word& name,
const polyMesh& mesh,
const dictionary& dict
)
:
sampledSurface(name, mesh, dict),
surface_
(
IOobject
(
dict.lookup("surface"),
mesh.time().constant(), // instance
"triSurface", // local
mesh, // registry
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
),
needsUpdate_(true),
cellLabels_(0),
pointToFace_(0)
{}
示例8: velocityMotionSolver
Foam::velocityLaplacianFvMotionSolver::velocityLaplacianFvMotionSolver
(
const polyMesh& mesh,
const IOdictionary& dict
)
:
velocityMotionSolver(mesh, dict, typeName),
fvMotionSolverCore(mesh),
cellMotionU_
(
IOobject
(
"cellMotionU",
mesh.time().timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
fvMesh_,
dimensionedVector
(
"cellMotionU",
pointMotionU_.dimensions(),
Zero
),
cellMotionBoundaryTypes<vector>(pointMotionU_.boundaryField())
),
diffusivityPtr_
(
motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity"))
)
{}
示例9: fvMotionSolver
Foam::displacementSBRStressFvMotionSolver::displacementSBRStressFvMotionSolver
(
const polyMesh& mesh,
Istream& msData
)
:
fvMotionSolver(mesh),
points0_
(
pointIOField
(
IOobject
(
"points",
time().constant(),
polyMesh::meshSubDir,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
),
pointDisplacement_
(
IOobject
(
"pointDisplacement",
fvMesh_.time().timeName(),
fvMesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
pointMesh_
),
cellDisplacement_
(
IOobject
(
"cellDisplacement",
mesh.time().timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
fvMesh_,
dimensionedVector
(
"cellDisplacement",
pointDisplacement_.dimensions(),
vector::zero
),
cellMotionBoundaryTypes<vector>(pointDisplacement_.boundaryField())
),
diffusivityPtr_
(
motionDiffusivity::New(*this, lookup("diffusivity"))
)
{}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Core-OpenFOAM-1.5-dev,代码行数:58,代码来源:displacementSBRStressFvMotionSolver.C
示例10: decomp
Foam::labelList Foam::ptscotchDecomp::decompose
(
const polyMesh& mesh,
const pointField& points,
const scalarField& pointWeights
)
{
if (points.size() != mesh.nCells())
{
FatalErrorIn
(
"ptscotchDecomp::decompose(const pointField&, const scalarField&)"
)
<< "Can use this decomposition method only for the whole mesh"
<< endl
<< "and supply one coordinate (cellCentre) for every cell." << endl
<< "The number of coordinates " << points.size() << endl
<< "The number of cells in the mesh " << mesh.nCells()
<< exit(FatalError);
}
// // For running sequential ...
// if (Pstream::nProcs() <= 1)
// {
// return scotchDecomp(decompositionDict_, mesh_)
// .decompose(points, pointWeights);
// }
// Make Metis CSR (Compressed Storage Format) storage
// adjncy : contains neighbours (= edges in graph)
// xadj(celli) : start of information in adjncy for celli
CompactListList<label> cellCells;
calcCellCells(mesh, identity(mesh.nCells()), mesh.nCells(), cellCells);
// Decompose using default weights
List<int> finalDecomp;
decomposeZeroDomains
(
mesh.time().path()/mesh.name(),
cellCells.m(),
cellCells.offsets(),
pointWeights,
finalDecomp
);
// Copy back to labelList
labelList decomp(finalDecomp.size());
forAll(decomp, i)
{
decomp[i] = finalDecomp[i];
}
return decomp;
}
示例11: solverTypeName
Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New(const polyMesh& mesh)
{
IOdictionary solverDict
(
IOobject
(
"dynamicMeshDict",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
Istream& msData = solverDict.lookup("solver");
word solverTypeName(msData);
Info << "Selecting motion solver: " << solverTypeName << endl;
dlLibraryTable::open
(
solverDict,
"motionSolverLibs",
dictionaryConstructorTablePtr_
);
if (!dictionaryConstructorTablePtr_)
{
FatalErrorIn
(
"motionSolver::New(const polyMesh& mesh)"
) << "solver table is empty"
<< exit(FatalError);
}
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(solverTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"motionSolver::New(const polyMesh& mesh)"
) << "Unknown solver type " << solverTypeName
<< endl << endl
<< "Valid solver types are: " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<motionSolver>(cstrIter()(mesh, msData));
}
示例12: fineDistribution
Foam::labelList Foam::ptscotchDecomp::decompose
(
const polyMesh& mesh,
const labelList& agglom,
const pointField& agglomPoints,
const scalarField& pointWeights
)
{
if (agglom.size() != mesh.nCells())
{
FatalErrorIn
(
"ptscotchDecomp::decompose(const labelList&, const pointField&)"
) << "Size of cell-to-coarse map " << agglom.size()
<< " differs from number of cells in mesh " << mesh.nCells()
<< exit(FatalError);
}
// // For running sequential ...
// if (Pstream::nProcs() <= 1)
// {
// return scotchDecomp(decompositionDict_, mesh)
// .decompose(agglom, agglomPoints, pointWeights);
// }
// Make Metis CSR (Compressed Storage Format) storage
// adjncy : contains neighbours (= edges in graph)
// xadj(celli) : start of information in adjncy for celli
CompactListList<label> cellCells;
calcCellCells(mesh, agglom, agglomPoints.size(), cellCells);
// Decompose using weights
List<int> finalDecomp;
decomposeZeroDomains
(
mesh.time().path()/mesh.name(),
cellCells.m(),
cellCells.offsets(),
pointWeights,
finalDecomp
);
// Rework back into decomposition for original mesh
labelList fineDistribution(agglom.size());
forAll(fineDistribution, i)
{
fineDistribution[i] = finalDecomp[agglom[i]];
}
return fineDistribution;
}
示例13: forAll
Foam::tmp<Foam::IOField<Type>> Foam::reconstructLagrangianField
(
const word& cloudName,
const polyMesh& mesh,
const PtrList<fvMesh>& meshes,
const word& fieldName
)
{
// Construct empty field on mesh
tmp<IOField<Type>> tfield
(
new IOField<Type>
(
IOobject
(
fieldName,
mesh.time().timeName(),
cloud::prefix/cloudName,
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
Field<Type>(0)
)
);
Field<Type>& field = tfield.ref();
forAll(meshes, i)
{
// Check object on local mesh
IOobject localIOobject
(
fieldName,
meshes[i].time().timeName(),
cloud::prefix/cloudName,
meshes[i],
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (localIOobject.headerOk())
{
IOField<Type> fieldi(localIOobject);
label offset = field.size();
field.setSize(offset + fieldi.size());
forAll(fieldi, j)
{
field[offset + j] = fieldi[j];
}
}
示例14: motionProperties
// Construct from mesh
Foam::edgeStats::edgeStats(const polyMesh& mesh)
:
mesh_(mesh),
normalDir_(3)
{
IOobject motionObj
(
"motionProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
);
if (motionObj.headerOk())
{
Info<< "Reading " << mesh.time().constant() / "motionProperties"
<< endl << endl;
IOdictionary motionProperties(motionObj);
Switch twoDMotion(motionProperties.lookup("twoDMotion"));
if (twoDMotion)
{
Info<< "Correcting for 2D motion" << endl << endl;
autoPtr<twoDPointCorrector> correct2DPtr
(
new twoDPointCorrector(mesh)
);
normalDir_ = getNormalDir(&correct2DPtr());
}
}
}
示例15:
// Construct from components
Foam::enginePiston::enginePiston
(
const polyMesh& mesh,
const word& pistonPatchName,
const autoPtr<coordinateSystem>& pistonCS,
const scalar minLayer,
const scalar maxLayer
)
:
mesh_(mesh),
engineDB_(refCast<const engineTime>(mesh.time())),
patchID_(pistonPatchName, mesh.boundaryMesh()),
csPtr_(pistonCS),
minLayer_(minLayer),
maxLayer_(maxLayer)
{}