本文整理汇总了C++中vectorField::component方法的典型用法代码示例。如果您正苦于以下问题:C++ vectorField::component方法的具体用法?C++ vectorField::component怎么用?C++ vectorField::component使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vectorField
的用法示例。
在下文中一共展示了vectorField::component方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: r
Foam::tmp<Foam::vectorField> Foam::sphericalCS::localToGlobal
(
const vectorField& local,
bool translate
) const
{
const scalarField r(local.component(vector::X));
const scalarField theta
(
local.component(vector::Y)
*(inDegrees_ ? constant::mathematical::pi/180.0 : 1.0)
);
const scalarField phi
(
local.component(vector::Z)
*(inDegrees_ ? constant::mathematical::pi/180.0 : 1.0)
);
vectorField lc(local.size());
lc.replace(vector::X, r*cos(theta)*sin(phi));
lc.replace(vector::Y, r*sin(theta)*sin(phi));
lc.replace(vector::Z, r*cos(phi));
return coordinateSystem::localToGlobal(lc, translate);
}
示例2: result
Foam::tmp<Foam::vectorField> Foam::waveSuperposition::velocity
(
const scalar t,
const vectorField& xyz
) const
{
vectorField result(xyz.size(), vector::zero);
forAll(waveModels_, wavei)
{
const vector2D d(cos(waveAngles_[wavei]), sin(waveAngles_[wavei]));
const vector2DField xz
(
zip
(
d & zip(xyz.component(0), xyz.component(1)),
tmp<scalarField>(xyz.component(2))
)
);
const vector2DField uw
(
waveModels_[wavei].velocity(t, xz)
);
result += zip
(
d.x()*uw.component(0),
d.y()*uw.component(0),
uw.component(1)
);
}
tmp<scalarField> s = scale(zip(xyz.component(0), xyz.component(1)));
return s*result;
}
示例3: nHat
Foam::tmp<Foam::Field<Type> >
Foam::basicSymmetryFvPatchField<Type>::snGradTransformDiag() const
{
const vectorField nHat(this->patch().nf());
vectorField diag(nHat.size());
diag.replace(vector::X, mag(nHat.component(vector::X)));
diag.replace(vector::Y, mag(nHat.component(vector::Y)));
diag.replace(vector::Z, mag(nHat.component(vector::Z)));
return transformFieldMask<Type>(pow<vector, pTraits<Type>::rank>(diag));
}
示例4: nHat
Foam::tmp<Foam::Field<Type> >
Foam::partialSlipFvPatchField<Type>::snGradTransformDiag() const
{
const vectorField nHat(this->patch().nf());
vectorField diag(nHat.size());
diag.replace(vector::X, mag(nHat.component(vector::X)));
diag.replace(vector::Y, mag(nHat.component(vector::Y)));
diag.replace(vector::Z, mag(nHat.component(vector::Z)));
return
valueFraction_*pTraits<Type>::one
+ (1.0 - valueFraction_)
*transformFieldMask<Type>(pow<vector, pTraits<Type>::rank>(diag));
}
示例5: lc
Foam::tmp<Foam::vectorField> Foam::parabolicCylindricalCS::localToGlobal
(
const vectorField& local,
bool translate
) const
{
if (min(local.component(vector::Y)) < 0.0)
{
FatalErrorIn
(
"parabolicCylindricalCS::localToGlobal"
"(const vectorField&, bool) const"
) << "parabolic cylindrical coordinates v < 0"
<< abort(FatalError);
}
vectorField lc(local.size());
lc.replace
(
vector::X,
0.5*
(
sqr(local.component(vector::X))
- sqr(local.component(vector::Y))
)
);
lc.replace
(
vector::Y,
local.component(vector::X) * local.component(vector::Y)
);
lc.replace
(
vector::Z,
local.component(vector::Z)
);
return coordinateSystem::localToGlobal(lc, translate);
}
示例6: lc
Foam::tmp<Foam::vectorField> Foam::toroidalCS::localToGlobal
(
const vectorField& local,
bool translate
) const
{
const scalarField r = local.component(vector::X);
const scalarField theta =
local.component(vector::Y)*mathematicalConstant::pi/180.0;
const scalarField phi =
local.component(vector::Z)*mathematicalConstant::pi/180.0;
const scalarField rprime = radius_ + r*sin(phi);
vectorField lc(local.size());
lc.replace(vector::X, rprime*cos(theta));
lc.replace(vector::Y, rprime*sin(theta));
lc.replace(vector::Z, r*cos(phi));
return coordinateSystem::localToGlobal(lc, translate);
}
示例7: mag
Foam::tmp<Foam::vectorField> Foam::sphericalCS::globalToLocal
(
const vectorField& global,
bool translate
) const
{
const vectorField lc = coordinateSystem::globalToLocal(global, translate);
const scalarField r = mag(lc);
tmp<vectorField> tresult(new vectorField(lc.size()));
vectorField& result = tresult();
result.replace
(
vector::X, r
);
result.replace
(
vector::Y,
atan2
(
lc.component(vector::Y),
lc.component(vector::X)
)*180.0/mathematicalConstant::pi
);
result.replace
(
vector::Z,
acos(lc.component(vector::Z)/(r + SMALL))*180.0/mathematicalConstant::pi
);
return tresult;
}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Core-OpenFOAM-1.5-dev,代码行数:36,代码来源:sphericalCS.C
示例8: gMin
void Foam::waveAbsorptionVelocity2DFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
// PHC //
Info << "3D_2D Absorption BC on patch " << this->patch().name() << endl;
// 3D Variables
const vector cMin = gMin(patch().patch().localPoints());
const vector cMax = gMax(patch().patch().localPoints());
const vector cSpan = cMax - cMin;
scalar dMin = 0.0;
scalar dSpan = 0.0;
const scalarField patchD = patchDirection( cSpan, &dMin, &dSpan );
// Variables & constants
const volScalarField& alpha =
db().lookupObject<volScalarField>(alphaName());
const volVectorField& U = db().lookupObject<volVectorField>("U");
const fvMesh& mesh = alpha.mesh();
const word& patchName = this->patch().name();
const label patchID = mesh.boundaryMesh().findPatchID(patchName);
const label nF = patch().faceCells().size();
const scalarField alphaCell =
alpha.boundaryField()[patchID].patchInternalField();
const vectorField UCell = U.boundaryField()[patchID].patchInternalField();
scalarField UzCell = UCell.component(2);
scalarField patchUc = Foam::scalarField(nF, 0.0); // Correction velocity
scalarField patchVc = Foam::scalarField(nF, 0.0); // Correction velocity
const scalarField patchHeight = patch().Cf().component(2)-cMin[2];
const scalar g = 9.81;
// Check for errors - Just the first time
if (!allCheck_)
{
// Check if the value of nPaddles is correct for the number of columns
if (nPaddles_ < 1)
{
FatalError
<< "Check nPaddles value."
<< exit(FatalError);
}
if ( nPaddles_ > 1 )
{
nPaddles_ = decreaseNPaddles( nPaddles_, patchD, dMin, dSpan );
reduce(nPaddles_, minOp<label>());
}
// Check nEdges
if ( nEdgeMin_ < 0 || nEdgeMax_ < 0 )
{
FatalError
<< "Check nEdgeMin/Max value."
<< exit(FatalError);
}
if ( nEdgeMin_ + nEdgeMax_ > nPaddles_ )
{
FatalError
<< "Check: nEdges > nPaddles."
<< exit(FatalError);
}
}
// Grouping part
labelList faceGroup = Foam::labelList(nF, 0);
scalarList dBreakPoints = Foam::scalarList(nPaddles_+1, dMin);
scalarList xGroup = Foam::scalarList(nPaddles_, 0.0);
scalarList yGroup = Foam::scalarList(nPaddles_, 0.0);
for (label i=0; i<nPaddles_; i++)
{
// Breakpoints, X & Y centre of the paddles
dBreakPoints[i+1] = dMin + dSpan/(nPaddles_)*(i+1);
xGroup[i] = cMin[0] + cSpan[0]/(2.0*nPaddles_) + cSpan[0]/(nPaddles_)*i;
yGroup[i] = cMin[1] + cSpan[1]/(2.0*nPaddles_) + cSpan[1]/(nPaddles_)*i;
}
forAll(patchD, patchCells)
{
for (label i=0; i<nPaddles_; i++)
{
if ( (patchD[patchCells]>=dBreakPoints[i]) &&
(patchD[patchCells]<dBreakPoints[i+1]) )
{
faceGroup[patchCells] = i+1; // Group of each face
continue;
}
}
}
//.........这里部分代码省略.........