qjh888 |
November 10, 2016 19:05 |
Get runtime information in overlapGgi class
Hi Foamers,
I want to get the runtime information in the overlapGgiPolyPatchTemplates.C, and the code is showing as below:
Code:
overlapGgiPolyPatchTemplates.C
#include "overlapGgiPolyPatch.H"
#include "RodriguesRotation.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::Field<Type> >
Foam::overlapGgiPolyPatch::expandData(const Field<Type>& pf) const
{
// Check and expand the field from patch size to zone size
if (pf.size() != size())
{
FatalErrorIn
(
"tmp<Field<Type> > overlapGgiPolyPatch::expandData"
"("
" const Field<Type>& pf"
") const"
) << "Incorrect patch field size. Field size: "
<< pf.size() << " patch size: " << size()
<< abort(FatalError);
}
const label ncp = nCopies(); // How many copies will compose a full revolution
const scalar myAngle = 360.0/scalar(ncp); // pitch angle
tmp<Field<Type> > texpandField // initialize a tmeperary expandField
(
new Field<Type>(ncp*zone().size(), pTraits<Type>::zero)
);
Field<Type>& expandField = texpandField();
label nFaces = 0;
for (label copyI = 0; copyI < ncp; copyI++)
{
// Calculate transform
const tensor curRotation =
RodriguesRotation(rotationAxis_, copyI*myAngle);
forAll (pf, faceI)
{
expandField[nFaces] = transform(curRotation, pf[faceI]);
nFaces++;
}
}
Info << "expandField = " << expandField << nl << endl;
if (!localParallel())
{
reduce(expandField, sumOp<Field<Type> >());
}
return texpandField;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::Field<Type> >
Foam::overlapGgiPolyPatch::interpolate(const Field<Type>& pf) const
{
Info << "runtime ====!!!!!!" << this->db().time().value() << nl << endl;
// Get the runtime information here
// Check and expand the field from patch size to zone size
if (pf.size() != shadow().size())
{
FatalErrorIn
(
"tmp<Field<Type> > ggiPolyPatch::interpolate"
"("
" const Field<Type>& pf"
") const"
) << "Incorrect slave patch field size. Field size: "
<< pf.size() << " patch size: " << shadow().size()
<< abort(FatalError);
}
// Expand data
tmp<Field<Type> > expanddata = shadow().expandData(pf);
tmp<Field<Type> > tresult(new Field<Type>());
Field<Type>& result = tresult();
if (master())
{
// Expand slave data
result = patchToPatch().slaveToMaster(expanddata); //patchToPatch() is defined in
}
else
{
// Expand master data
result = patchToPatch().masterToSlave(expanddata);
}
// Truncate to size
result.setSize(size());
return tresult;
}
template<class Type>
Foam::tmp<Foam::Field<Type> >
Foam::overlapGgiPolyPatch::interpolate(const tmp<Field<Type> >& tpf) const
{
tmp<Field<Type> > tint = interpolate(tpf());
tpf.clear();
return tint;
}
May I ask how could I get access to the runtime at the position showed by red?
And Also could you please tell me the function of the code marked in blue?
Thanks very much,
Janry
|