本文整理汇总了C++中patch函数的典型用法代码示例。如果您正苦于以下问题:C++ patch函数的具体用法?C++ patch怎么用?C++ patch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了patch函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateStatistic
void DynamicGroupUpdateCallback::operator()( osg::Node* node, osg::NodeVisitor* nv )
{
//сформировать массив данных о видимых патчах
m_VisiblePatchArray.Update();
//обновить коэффициенты из файла
// UpdateKof();
//обновить статистику
UpdateStatistic();
osg::ref_ptr< osg::Group > group = dynamic_cast< osg::Group* >( node );
if ( group )
{
//вернуть ссылку на массив видимых патчей
const std::vector< dataPatch > &data_vis = m_VisiblePatchArray.GetVisibleArray();
if ( !data_vis.empty() )
{
//FindMax();
//std::cout << data_vis.size() << "-" << FindMax() << " ";
//очистить всех детей
group->removeChildren( 0 , group->getNumChildren() );
//перебрать все видимые узлы
for( int i = 0 ; i < data_vis.size() ; ++i )
{
//сформировать геометрию
//GeometryPatch patch( data_vis[ i ].m_iX ,
// data_vis[ i ].m_iY , 65 ,
// data_vis[ i ].m_iSize );
osg::ref_ptr< osg::Geode > geode = new osg::Geode;
if ( data_vis[ i ].m_iSize == 1024 )
{
GeometryTexturePatch1 patch( data_vis[ i ].m_iX ,
data_vis[ i ].m_iY , 66 ,
data_vis[ i ].m_iSize , m_ImageIndex.get()
, 2 , -64 ); //1 -32
geode->addDrawable( patch.GetGeometry().get() );
}
else
if ( data_vis[ i ].m_iSize == 512 )
{
GeometryTexturePatch patch( data_vis[ i ].m_iX ,
data_vis[ i ].m_iY , 65 ,
data_vis[ i ].m_iSize , m_ImageIndex.get()
, 1 , 30 );
geode->addDrawable( patch.GetGeometry().get() );
}
else
if ( data_vis[ i ].m_iSize == 2048 )
{
GeometryTexturePatch2 patch( data_vis[ i ].m_iX ,
data_vis[ i ].m_iY , 68 ,
data_vis[ i ].m_iSize , m_ImageIndex.get()
, 2 , -64 );
geode->addDrawable( patch.GetGeometry().get() );
}
else
if ( data_vis[ i ].m_iSize == 4096 )
{
GeometryTexturePatch4 patch( data_vis[ i ].m_iX ,
data_vis[ i ].m_iY , 64 + 8,
data_vis[ i ].m_iSize , m_ImageIndex.get()
, 2 , -128 );
geode->addDrawable( patch.GetGeometry().get() );
}
else
if ( data_vis[ i ].m_iSize == 8192 )
{
GeometryTexturePatch8 patch( data_vis[ i ].m_iX ,
data_vis[ i ].m_iY , 64 + 16,
data_vis[ i ].m_iSize , m_ImageIndex.get()
, 2 , -128 );
geode->addDrawable( patch.GetGeometry().get() );
}
else
if ( data_vis[ i ].m_iSize == 16384 )
{
GeometryTexturePatch16 patch( data_vis[ i ].m_iX ,
data_vis[ i ].m_iY , 64 + 32,
data_vis[ i ].m_iSize , m_ImageIndex.get()
, 2 , -128 );
geode->addDrawable( patch.GetGeometry().get() );
}
else
if ( data_vis[ i ].m_iSize == 32768 )
{
GeometryTexturePatch32 patch( data_vis[ i ].m_iX ,
data_vis[ i ].m_iY , 64 + 64,
//.........这里部分代码省略.........
示例2: patch
ofxPDSPStereoFader& ofxPDSPStereoFader::operator=(const ofxPDSPStereoFader & other){
patch();
return *this;
}
示例3: ofxPDSPStereoFader
ofxPDSPStereoFader::ofxPDSPStereoFader(const ofxPDSPStereoFader & other) : ofxPDSPStereoFader(){
patch();
}
示例4: patch
void Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
const label patchi = patch().index();
// retrieve the film region from the database
const regionModels::regionModel& region =
db().time().lookupObject<regionModels::regionModel>
(
"surfaceFilmProperties"
);
const regionModels::surfaceFilmModels::kinematicSingleLayer& film =
dynamic_cast
<
const regionModels::surfaceFilmModels::kinematicSingleLayer&
>(region);
// calculate the vector tangential to the patch
// note: normal pointing into the domain
const vectorField n(-patch().nf());
// TODO: currently re-evaluating the entire gTan field to return this patch
const scalarField gTan(film.gTan()().boundaryField()[patchi] & n);
if (patch().size() && (max(mag(gTan)) < SMALL))
{
WarningInFunction
<< "is designed to operate on patches inclined with respect to "
<< "gravity"
<< endl;
}
const volVectorField& nHat = film.nHat();
const vectorField nHatp(nHat.boundaryField()[patchi].patchInternalField());
vectorField nTan(nHatp ^ n);
nTan /= mag(nTan) + ROOTVSMALL;
// calculate distance in patch tangential direction
const vectorField& Cf = patch().Cf();
scalarField d(nTan & Cf);
// calculate the wavy film height
const scalar t = db().time().timeOutputValue();
const scalar GMean = GammaMean_->value(t);
const scalar a = a_->value(t);
const scalar omega = omega_->value(t);
const scalarField G(GMean + a*sin(omega*constant::mathematical::twoPi*d));
const volScalarField& mu = film.mu();
const scalarField mup(mu.boundaryField()[patchi].patchInternalField());
const volScalarField& rho = film.rho();
const scalarField rhop(rho.boundaryField()[patchi].patchInternalField());
const scalarField Re(max(G, scalar(0.0))/mup);
operator==(n*pow(gTan*mup/(3.0*rhop), 0.333)*pow(Re, 0.666));
fixedValueFvPatchVectorField::updateCoeffs();
}
示例5: swit2
void
swit2(C1 *q, int nc, int32 def, Node *n)
{
C1 *r;
int i;
int32 v;
Prog *sp;
if(nc >= 3) {
i = (q+nc-1)->val - (q+0)->val;
if(i > 0 && i < nc*2)
goto direct;
}
if(nc < 5) {
for(i=0; i<nc; i++) {
if(debug['W'])
print("case = %.8ux\n", q->val);
gopcode(OEQ, nodconst(q->val), n, Z);
patch(p, q->label);
q++;
}
gbranch(OGOTO);
patch(p, def);
return;
}
i = nc / 2;
r = q+i;
if(debug['W'])
print("case > %.8ux\n", r->val);
gopcode(OGT, nodconst(r->val), n, Z);
sp = p;
gopcode(OEQ, nodconst(r->val), n, Z); /* just gen the B.EQ */
patch(p, r->label);
swit2(q, i, def, n);
if(debug['W'])
print("case < %.8ux\n", r->val);
patch(sp, pc);
swit2(r+1, nc-i-1, def, n);
return;
direct:
v = q->val;
if(v != 0)
gopcode(OSUB, nodconst(v), Z, n);
gopcode(OCASE, nodconst((q+nc-1)->val - v), n, Z);
patch(p, def);
for(i=0; i<nc; i++) {
if(debug['W'])
print("case = %.8ux\n", q->val);
while(q->val != v) {
nextpc();
p->as = ABCASE;
patch(p, def);
v++;
}
nextpc();
p->as = ABCASE;
patch(p, q->label);
q++;
v++;
}
gbranch(OGOTO); /* so that regopt() won't be confused */
patch(p, def);
}
示例6: patch
void UGen::patch( AudioOutput & output )
{
patch( output.mSummer );
setSampleRate( output.sampleRate() );
setAudioChannelCount( output.getFormat().getChannels() );
}
示例7: TNbr
void CFDHAMfluidMoistureCoupledMixedFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
// Since we're inside initEvaluate/evaluate there might be processor
// comms underway. Change the tag we use.
int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag+1;
// Get the coupling information from the mappedPatchBase
const mappedPatchBase& mpp =
refCast<const mappedPatchBase>(patch().patch());
const polyMesh& nbrMesh = mpp.sampleMesh();
const label samplePatchI = mpp.samplePolyPatch().index();
const fvPatch& nbrPatch =
refCast<const fvMesh>(nbrMesh).boundary()[samplePatchI];
// scalarField Tc(patchInternalField());
scalarField& Tp = *this;
/* const mixedFvPatchScalarField& //CFDHAMfluidMoistureCoupledMixedFvPatchScalarField&
nbrField = refCast
<const mixedFvPatchScalarField>
(
nbrPatch.lookupPatchField<volScalarField, scalar>(wnbrName_)
); */
const mixedFvPatchScalarField& //CFDHAMfluidMoistureCoupledMixedFvPatchScalarField&
nbrTField = refCast
<const mixedFvPatchScalarField>
(
nbrPatch.lookupPatchField<volScalarField, scalar>(TnbrName_)
);
const mixedFvPatchScalarField& //CFDHAMfluidMoistureCoupledMixedFvPatchScalarField&
nbrpcField = refCast
<const mixedFvPatchScalarField>
(
nbrPatch.lookupPatchField<volScalarField, scalar>("pc")
);
// Swap to obtain full local values of neighbour internal field
// scalarField wcNbr(nbrField.patchInternalField());
// mpp.distribute(wcNbr);
scalarField TNbr(nbrTField.patchInternalField());
mpp.distribute(TNbr);
scalarField pcNbr(nbrpcField.patchInternalField());
mpp.distribute(pcNbr);
scalarField p(Tp.size(), 0.0);
p = patch().lookupPatchField<volScalarField, scalar>("p");
scalarField rhoair(Tp.size(), 0.0);
rhoair = patch().lookupPatchField<volScalarField, scalar>("rho");
scalar rhol=1.0e3; scalar Rv=8.31451*1000/(18.01534);
scalarField pvsat_s = exp(6.58094e1-7.06627e3/TNbr-5.976*log(TNbr));
scalarField pv_s = pvsat_s*exp((pcNbr)/(rhol*Rv*TNbr));
valueFraction() = 1.0;//KDeltaNbr/(KDeltaNbr + KDelta);
refValue() = 0.62198*pv_s/p;//pv_s/pvsat_s;
refGrad() = 0.0;//(Qr + QrNbr + Qs + QsNbr)/(kappa(Tp));
mixedFvPatchScalarField::updateCoeffs();
/* if (debug)
{
scalar Q = gSum(kappa(Tp)*patch().magSf()*snGrad());
Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':'
<< this->dimensionedInternalField().name() << " <- "
<< nbrMesh.name() << ':'
<< nbrPatch.name() << ':'
<< this->dimensionedInternalField().name() << " :"
<< " heat transfer rate:" << Q
<< " walltemperature "
<< " min:" << gMin(Tp)
<< " max:" << gMax(Tp)
<< " avg:" << gAverage(Tp)
<< endl;
} */
// Restore tag
UPstream::msgType() = oldTag;
}
示例8: encode_contact
int
encode_contact (struct sip_msg *msg, char *encoding_prefix,char *public_ip)
{
contact_body_t *cb;
contact_t *c;
str* uri;
str newUri;
int res;
char separator;
/*
* I have a list of contacts in contact->parsed which is of type contact_body_t
* inside i have a contact->parsed->contact which is the head of the list of contacts
* inside it is a
* str uri;
* struct contact *next;
* I just have to visit each uri and encode each uri according to a scheme
*/
if ((msg->contact == NULL)&&((parse_headers(msg,HDR_CONTACT_F,0) == -1) ||
(msg->contact == NULL) ))
{
LOG(L_ERR,"ERROR: encode_contact: no Contact header present\n");
return -1;
}
separator = DEFAULT_SEPARATOR[0];
if (contact_flds_separator != NULL)
if (strlen(contact_flds_separator)>=1)
separator = contact_flds_separator[0];
if (msg->contact->parsed == NULL) parse_contact (msg->contact);
if (msg->contact->parsed != NULL)
{
cb = (contact_body_t *) msg->contact->parsed;
c = cb->contacts;
/* we visit each contact */
if (c != NULL)
{
uri = &c->uri;
res = encode_uri(msg, uri, encoding_prefix, public_ip,
separator, &newUri);
if (res != 0)
{
LOG (L_ERR,"ERROR: encode_contact: Failed encoding contact.Code %d\n", res);
return res;
}
else
if (patch (msg, uri->s, uri->len, newUri.s, newUri.len) < 0)
{
LOG (L_ERR,"ERROR: encode_contact: lumping failed in mangling port \n");
return -2;
}
/* encoding next contacts too?*/
#ifdef ENCODE_ALL_CONTACTS
while (c->next != NULL)
{
c = c->next;
uri = &c->uri;
res = encode_uri (msg, uri, encoding_prefix, public_ip,
separator, &newUri);
if (res != 0)
{
LOG(L_ERR,"ERROR: encode_contact: Failed encode_uri.Code %d\n",res);
#ifdef STRICT_CHECK
return res;
#endif
}
else
if (patch (msg, uri->s, uri->len, newUri.s, newUri.len)< 0)
{
LOG (L_ERR,"ERROR: encode_contact: lumping failed in mangling port \n");
return -3;
}
} /* while */
#endif /* ENCODE_ALL_CONTACTS */
} /* if c != NULL */
} /* end if */
else /* after parsing still NULL */
{
LOG(L_ERR,"ERROR: encode_contact: Unable to parse Contact header\n");
#ifdef EXTRA_DEBUG
printf("ERROR: encode_contact: Unable to parse Contact header\n");
#endif
return -4;
}
#ifdef EXTRA_DEBUG
fprintf (stdout,"---END--------ENCODE CONTACT-----------------\n");
#endif
return 1;
}
示例9: patch
void Foam::totalPressureFvPatchScalarField::updateCoeffs
(
const scalarField& p0p,
const vectorField& Up
)
{
if (updated())
{
return;
}
const fvsPatchField<scalar>& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
if (psiName_ == "none" && rhoName_ == "none")
{
operator==(p0p - 0.5*(1.0 - pos(phip))*magSqr(Up));
}
else if (rhoName_ == "none")
{
const fvPatchField<scalar>& psip =
patch().lookupPatchField<volScalarField, scalar>(psiName_);
if (gamma_ > 1.0)
{
scalar gM1ByG = (gamma_ - 1.0)/gamma_;
operator==
(
p0p
/pow
(
(1.0 + 0.5*psip*gM1ByG*(1.0 - pos(phip))*magSqr(Up)),
1.0/gM1ByG
)
);
}
else
{
operator==(p0p/(1.0 + 0.5*psip*(1.0 - pos(phip))*magSqr(Up)));
}
}
else if (psiName_ == "none")
{
const fvPatchField<scalar>& rho =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
operator==(p0p - 0.5*rho*(1.0 - pos(phip))*magSqr(Up));
}
else
{
FatalErrorIn
(
"totalPressureFvPatchScalarField::updateCoeffs()"
) << " rho or psi set inconsistently, rho = " << rhoName_
<< ", psi = " << psiName_ << ".\n"
<< " Set either rho or psi or neither depending on the "
"definition of total pressure." << nl
<< " Set the unused variable(s) to 'none'.\n"
<< " on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalError);
}
fixedValueFvPatchScalarField::updateCoeffs();
}
示例10: db
tmp<scalarField>
alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::calcAlphat
(
const scalarField& prevAlphat
) const
{
// Lookup the fluid model
const phaseSystem& fluid =
db().lookupObject<phaseSystem>("phaseProperties");
const phaseModel& phase
(
fluid.phases()[internalField().group()]
);
const label patchi = patch().index();
// Retrieve turbulence properties from model
const phaseCompressibleTurbulenceModel& turbModel =
db().lookupObject<phaseCompressibleTurbulenceModel>
(
IOobject::groupName(turbulenceModel::propertiesName, phase.name())
);
const scalar Cmu25 = pow025(Cmu_);
const scalarField& y = turbModel.y()[patchi];
const tmp<scalarField> tmuw = turbModel.mu(patchi);
const scalarField& muw = tmuw();
const tmp<scalarField> talphaw = phase.thermo().alpha(patchi);
const scalarField& alphaw = talphaw();
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const fvPatchScalarField& kw = k.boundaryField()[patchi];
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
const scalarField magGradUw(mag(Uw.snGrad()));
const fvPatchScalarField& rhow = turbModel.rho().boundaryField()[patchi];
const fvPatchScalarField& hew =
phase.thermo().he().boundaryField()[patchi];
const fvPatchScalarField& Tw =
phase.thermo().T().boundaryField()[patchi];
scalarField Tp(Tw.patchInternalField());
// Heat flux [W/m2] - lagging alphatw
const scalarField qDot
(
(prevAlphat + alphaw)*hew.snGrad()
);
scalarField uTau(Cmu25*sqrt(kw));
scalarField yPlus(uTau*y/(muw/rhow));
scalarField Pr(muw/alphaw);
// Molecular-to-turbulent Prandtl number ratio
scalarField Prat(Pr/Prt_);
// Thermal sublayer thickness
scalarField P(this->Psmooth(Prat));
scalarField yPlusTherm(this->yPlusTherm(P, Prat));
tmp<scalarField> talphatConv(new scalarField(this->size()));
scalarField& alphatConv = talphatConv.ref();
// Populate boundary values
forAll(alphatConv, facei)
{
// Evaluate new effective thermal diffusivity
scalar alphaEff = 0.0;
if (yPlus[facei] < yPlusTherm[facei])
{
scalar A = qDot[facei]*rhow[facei]*uTau[facei]*y[facei];
scalar B = qDot[facei]*Pr[facei]*yPlus[facei];
scalar C = Pr[facei]*0.5*rhow[facei]*uTau[facei]*sqr(magUp[facei]);
alphaEff = A/(B + C + vSmall);
}
else
{
scalar A = qDot[facei]*rhow[facei]*uTau[facei]*y[facei];
scalar B =
qDot[facei]*Prt_*(1.0/kappa_*log(E_*yPlus[facei]) + P[facei]);
scalar magUc =
uTau[facei]/kappa_*log(E_*yPlusTherm[facei]) - mag(Uw[facei]);
scalar C =
0.5*rhow[facei]*uTau[facei]
*(Prt_*sqr(magUp[facei]) + (Pr[facei] - Prt_)*sqr(magUc));
alphaEff = A/(B + C + vSmall);
}
//.........这里部分代码省略.........
开发者ID:OpenFOAM,项目名称:OpenFOAM-dev,代码行数:101,代码来源:alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField.C
示例11: decode_contact_header
int
decode_contact_header (struct sip_msg *msg,char *unused1,char *unused2)
{
contact_body_t *cb;
contact_t *c;
str* uri;
str newUri;
char separator;
int res;
if ((msg->contact == NULL)&&((parse_headers(msg,HDR_CONTACT_F,0) == -1) ||
(msg->contact== NULL) ))
{
LOG(L_ERR,"ERROR: decode_contact_header: no Contact header present\n");
return -1;
}
separator = DEFAULT_SEPARATOR[0];
if (contact_flds_separator != NULL)
if (strlen(contact_flds_separator)>=1)
separator = contact_flds_separator[0];
if (msg->contact->parsed == NULL) parse_contact (msg->contact);
if (msg->contact->parsed != NULL)
{
cb = (contact_body_t *) msg->contact->parsed;
c = cb->contacts;
// we visit each contact
if (c != NULL)
{
uri = &c->uri;
res = decode_uri (uri, separator, &newUri, 0);
if (res != 0)
{
LOG (L_ERR,"ERROR: decode_contact_header:Failed decoding contact.Code %d\n", res);
#ifdef STRICT_CHECK
return res;
#endif
}
else
if (patch (msg, uri->s, uri->len, newUri.s, newUri.len) < 0)
{
LOG (L_ERR,"ERROR: decode_contact:lumping failed in mangling port \n");
return -2;
}
#ifdef DECODE_ALL_CONTACTS
while (c->next != NULL)
{
c = c->next;
uri = &c->uri;
res = decode_uri (uri, separator, &newUri, 0);
if (res != 0)
{
LOG (L_ERR,"ERROR: decode_contact: Failed decoding contact.Code %d\n",res);
#ifdef STRICT_CHECK
return res;
#endif
}
else
if (patch (msg, uri->s, uri->len, newUri.s, newUri.len) < 0)
{
LOG (L_ERR,"ERROR: decode_contact:lumping failed in mangling port \n");
return -3;
}
} // end while
#endif
} // if c!= NULL
} // end if
else // after parsing still NULL
{
LOG(L_ERR,"ERROR: decode_contact: Unable to parse Contact header\n");
return -4;
}
return 1;
}
示例12: updateCoeffs
void Foam::uniformTotalPressureFvPatchScalarField::updateCoeffs()
{
updateCoeffs(patch().lookupPatchField<volVectorField, vector>(UName_));
}
示例13: abort
void Foam::processorTetPolyPatchFaceDecomp::calcMeshPoints() const
{
if (meshPointsPtr_)
{
FatalErrorIn
(
"void processorTetPolyPatchFaceDecomp::calcMeshPoints() const"
) << "meshPointsPtr_ already allocated"
<< abort(FatalError);
}
// Algorithm:
// Depending on whether the patch is a master or a slave, get the primitive
// patch points and filter away the points from the global patch.
labelList mp(0);
if (isMaster())
{
mp = procPolyPatch_.meshPoints();
}
else
{
// Slave side. Create the reversed patch and pick up its points
// so that the order is correct
const polyPatch& pp = patch();
faceList masterFaces(pp.size());
forAll (pp, faceI)
{
masterFaces[faceI] = pp[faceI].reverseFace();
}
mp = primitiveFacePatch
(
masterFaces,
pp.points()
).meshPoints();
}
// Get reference to shared processor points
const labelList& sharedPoints =
boundaryMesh().globalPatch().meshPoints();
// Filter the shared points out of the list
meshPointsPtr_ = new labelList(mp.size() + procPolyPatch_.size());
labelList& filtPoints = *meshPointsPtr_;
label noFiltPoints = 0;
forAll (mp, pointI)
{
label curP = mp[pointI];
bool found = false;
forAll (sharedPoints, sharedI)
{
if (sharedPoints[sharedI] == curP)
{
found = true;
break;
}
}
if (!found)
{
filtPoints[noFiltPoints] = curP;
noFiltPoints++;
}
}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Core-OpenFOAM-1.5-dev,代码行数:71,代码来源:calcProcessorTetPolyPatchFaceDecompPointAddr.C
示例14: boundaryMesh
found = true;
break;
}
}
if (!found)
{
filtPoints[noFiltPoints] = curP;
noFiltPoints++;
}
}
// insert faces using the offset
// These cannot be shared
const label faceOffset = boundaryMesh().mesh().faceOffset();
const label polyPatchStart = patch().start() + faceOffset;
const label polyPatchStartPlusSize = polyPatchStart + patch().size();
for (label i = polyPatchStart; i < polyPatchStartPlusSize; i++)
{
filtPoints[noFiltPoints] = i;
noFiltPoints++;
}
filtPoints.setSize(noFiltPoints);
}
// ************************************************************************* //
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Core-OpenFOAM-1.5-dev,代码行数:30,代码来源:calcProcessorTetPolyPatchFaceDecompPointAddr.C
示例15: patch
int HttpClient::patch(const char* aURLPath, const char* aContentType, const char* aBody)
{
return patch(aURLPath, aContentType, strlen(aBody), (const byte*)aBody);
}