status_t PathMatcher :: PutPathString(const String & path, const ConstQueryFilterRef & filter) { TCHECKPOINT; if (path.HasChars()) { StringMatcherQueue * newQ = GetStringMatcherQueuePool()->ObtainObject(); if (newQ) { StringMatcherQueueRef qRef(newQ); StringMatcherRef::ItemPool * smPool = GetStringMatcherPool(); String temp; int32 lastSlashPos = -1; int32 slashPos = 0; while(slashPos >= 0) { slashPos = path.IndexOf('/', lastSlashPos+1); temp = path.Substring(lastSlashPos+1, (slashPos >= 0) ? slashPos : (int32)path.Length()); StringMatcherRef smRef; if (strcmp(temp(), "*")) { smRef.SetRef(smPool->ObtainObject()); if ((smRef() == NULL)||(smRef()->SetPattern(temp()) != B_NO_ERROR)) return B_ERROR; } if (newQ->GetStringMatchers().AddTail(smRef) != B_NO_ERROR) return B_ERROR; lastSlashPos = slashPos; } if (_entries.Put(path, PathMatcherEntry(qRef, filter)) == B_NO_ERROR) { if (filter()) _numFilters++; return B_NO_ERROR; } } } return B_ERROR; }
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) { bool writeResults = !args.optionFound("noWrite"); IOobject Theader ( "T", runTime.timeName(), mesh, IOobject::MUST_READ ); IOobject qheader ( "q", runTime.timeName(), mesh, IOobject::MUST_READ ); IOdictionary transportProperties ( IOobject ( "transportProperties", runTime.constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); dimensionedScalar Cpa ( transportProperties.lookup("Cpa") ); dimensionedScalar Cpv ( transportProperties.lookup("Cpv") ); dimensionedScalar lambda ( transportProperties.lookup("lambda") ); // Fluid density dimensionedScalar rho ( transportProperties.lookup("rho") ); dimensionedScalar TRef ( transportProperties.lookup("TRef") ); dimensionedScalar qRef ( transportProperties.lookup("qRef") ); if (qheader.headerOk() && Theader.headerOk()) { Info<< " Reading q" << endl; volScalarField q(qheader, mesh); Info<< " Reading T" << endl; volScalarField T(Theader, mesh); // specific enthalpy of dry air hda - ASHRAE 1.8 volScalarField hda("hda", rho*Cpa*T-rho*Cpa*TRef); // specific enthalpy of dry vapor volScalarField hdv("hdv", rho*q*(lambda + Cpv*T) - rho*qRef*(lambda + Cpv*TRef)); // specific enthalpy for moist air hmoist - ASHRAE 1.8 volScalarField hmoist("hmoist", hda + hdv); if (writeResults) { hda.write(); hdv.write(); hmoist.write(); } else { Info<< " Min hda : " << min(hda).value() << " [J/m3]" << "\n Max hda : "<< max(hda).value() << " [J/m3]" << endl; Info<< " Min hdv : " << min(hdv).value() << " [J/m3]" << "\n Max hdv : "<< max(hdv).value() << " [J/m3]" << endl; Info<< " Min hmoist : " << min(hmoist).value() << " [J/m3]" << "\n Max hmoist : "<< max(hmoist).value() << " [J/m3]" << endl; } // print results // // surfaceScalarField hdaBoundary = // fvc::interpolate(hda); // // const surfaceScalarField::GeometricBoundaryField& patchhda = // hdaBoundary.boundaryField(); // // const surfaceScalarField::GeometricBoundaryField& patchCondHeatFlux = // // condHeatFluxNormal.boundaryField(); // // const surfaceScalarField::GeometricBoundaryField& patchTurbHeatFlux = // // turbHeatFluxNormal.boundaryField(); // // const surfaceScalarField::GeometricBoundaryField& patchTotHeatFlux = // // totHeatFluxNormal.boundaryField(); // // Info<< "\nHeat at the boundaries " << endl; // forAll(patchhda, patchi) // { // if ( (!isA<emptyFvPatch>(mesh.boundary()[patchi])) && // (mesh.boundary()[patchi].size() > 0) ) // { // Info<< " " // << mesh.boundary()[patchi].name() // << "\n Total area [m2] : " // << gSum(mesh.magSf().boundaryField()[patchi]) // << "\n Integral Energy [J] : " // << gSum // ( // mesh.magSf().boundaryField()[patchi] // *patchhda[patchi] // ) // << nl << endl; // } // } // Info << endl; } else { Info<< " No q or No T" << endl; } Info<< "\nEnd\n" << endl; }