//- Construct from Time and timeDict timeFluxData::timeFluxData ( Time& t, const dictionary& timeDict ) : time_(t), writeInterval_(readScalar(t.controlDict().lookup("writeInterval"))), writeIntSteps_(label(writeInterval_/t.deltaT().value() + 0.5)), mdTime_(1, readScalar(time_.controlDict().lookup("deltaT"))), averagingTime_(readLabel(timeDict.lookup("nAverages"))), controlTime_(readLabel(timeDict.lookup("nControls"))), writeTime_(writeIntSteps_, writeInterval_), nAvTimeSteps_("nAvTimeSteps_", dimless, 0.0), nControlSteps_(0.0), totalNAvSteps_(0), totalNContSteps_(0), totalNWrSteps_(0), controlTimeIndex_(0), averagingTimeIndex_(0) // controlTimes_(), // averagingTimes_() { setInitialData(); }
Foam::Function1Types::CSV<Type>::CSV ( const word& entryName, const dictionary& dict ) : TableBase<Type>(entryName, dict), nHeaderLine_(readLabel(dict.lookup("nHeaderLine"))), refColumn_(readLabel(dict.lookup("refColumn"))), componentColumns_(dict.lookup("componentColumns")), separator_(dict.lookupOrDefault<string>("separator", string(","))[0]), mergeSeparators_(readBool(dict.lookup("mergeSeparators"))), fName_(dict.lookup("file")) { if (componentColumns_.size() != pTraits<Type>::nComponents) { FatalErrorInFunction << componentColumns_ << " does not have the expected length of " << pTraits<Type>::nComponents << endl << exit(FatalError); } read(); TableBase<Type>::check(); }
Foam::polyPatch::polyPatch ( const word& name, const dictionary& dict, const label index, const polyBoundaryMesh& bm, const word& patchType ) : patchIdentifier(name, dict, index), primitivePatch ( faceSubList ( bm.mesh().faces(), readLabel(dict.lookup("nFaces")), readLabel(dict.lookup("startFace")) ), bm.mesh().points() ), start_(readLabel(dict.lookup("startFace"))), boundaryMesh_(bm), faceCellsPtr_(NULL), mePtr_(NULL) { if ( patchType != word::null && constraintType(patchType) && findIndex(inGroups(), patchType) == -1 ) { inGroups().append(patchType); } }
Foam::refinementParameters::refinementParameters(const dictionary& dict) : maxGlobalCells_(readLabel(dict.lookup("maxGlobalCells"))), maxLocalCells_(readLabel(dict.lookup("maxLocalCells"))), minRefineCells_(readLabel(dict.lookup("minRefinementCells"))), nBufferLayers_(readLabel(dict.lookup("nCellsBetweenLevels"))), keepPoints_(pointField(1, dict.lookup("locationInMesh"))), allowFreeStandingZoneFaces_ ( dict.lookupOrDefault<Switch> ( "allowFreeStandingZoneFaces", true ) ), maxLoadUnbalance_(dict.lookupOrDefault<scalar>("maxLoadUnbalance",0)) { scalar featAngle(readScalar(dict.lookup("resolveFeatureAngle"))); if (featAngle < 0 || featAngle > 180) { curvature_ = -GREAT; } else { curvature_ = Foam::cos(featAngle*mathematicalConstant::pi/180.0); } }
Foam::IOerror::IOerror(const dictionary& errDict) : error(errDict), ioFileName_(errDict.lookup("ioFileName")), ioStartLineNumber_(readLabel(errDict.lookup("ioStartLineNumber"))), ioEndLineNumber_(readLabel(errDict.lookup("ioEndLineNumber"))) {}
Foam::CSV<Type>::CSV ( const word& entryName, const dictionary& dict, const word& ext ) : DataEntry<Type>(entryName), TableBase<Type>(entryName, dict.subDict(type() + ext)), coeffs_(dict.subDict(type() + ext)), nHeaderLine_(readLabel(coeffs_.lookup("nHeaderLine"))), refColumn_(readLabel(coeffs_.lookup("refColumn"))), componentColumns_(coeffs_.lookup("componentColumns")), separator_(coeffs_.lookupOrDefault<string>("separator", string(","))[0]), mergeSeparators_(readBool(coeffs_.lookup("mergeSeparators"))), fName_(coeffs_.lookup("fileName")) { if (componentColumns_.size() != pTraits<Type>::nComponents) { FatalErrorIn("Foam::CSV<Type>::CSV(const word&, Istream&)") << componentColumns_ << " does not have the expected length of " << pTraits<Type>::nComponents << endl << exit(FatalError); } read(); TableBase<Type>::check(); }
// Construct from Istream Foam::surfacePatch::surfacePatch(Istream& is, const label index) : geometricSurfacePatch(is, index), size_(0), start_(0) { size_ = readLabel(is); start_ = readLabel(is); }
Foam::procLduInterface::procLduInterface(Istream& is) : faceCells_(is), coeffs_(is), myProcNo_(readLabel(is)), neighbProcNo_(readLabel(is)), tag_(readLabel(is)), comm_(readLabel(is)) {}
// Construct from components Foam::multiHoleInjector::multiHoleInjector ( const Foam::Time& t, const Foam::dictionary& dict ) : injectorType(t, dict), propsDict_(dict.subDict(typeName + "Props")), centerPosition_(propsDict_.lookup("position")), xyAngle_(readScalar(propsDict_.lookup("xyAngle"))), zAngle_(readScalar(propsDict_.lookup("zAngle"))), nHoles_(readLabel(propsDict_.lookup("nHoles"))), umbrellaAngle_(readScalar(propsDict_.lookup("umbrellaAngle"))), nozzleTipDiameter_(readScalar(propsDict_.lookup("nozzleTipDiameter"))), angleSpacing_(propsDict_.lookup("angleSpacing")), d_(readScalar(propsDict_.lookup("diameter"))), Cd_(readScalar(propsDict_.lookup("Cd"))), mass_(readScalar(propsDict_.lookup("mass"))), nParcels_(readLabel(propsDict_.lookup("nParcels"))), X_(propsDict_.lookup("X")), massFlowRateProfile_(propsDict_.lookup("massFlowRateProfile")), velocityProfile_(massFlowRateProfile_), injectionPressureProfile_(massFlowRateProfile_), CdProfile_(massFlowRateProfile_), TProfile_(propsDict_.lookup("temperatureProfile")), averageParcelMass_(nHoles_*mass_/nParcels_), direction_(nHoles_), position_(nHoles_), pressureIndependentVelocity_(true), tangentialInjectionVector1_(nHoles_), tangentialInjectionVector2_(nHoles_) { // check if time entries for soi and eoi match if (mag(massFlowRateProfile_[0][0]-TProfile_[0][0]) > SMALL) { FatalError << "multiHoleInjector::multiHoleInjector(const time& t, const dictionary dict) " << endl << " start-times do not match for TemperatureProfile and massFlowRateProfile." << abort(FatalError); } if (mag(massFlowRateProfile_[massFlowRateProfile_.size()-1][0]-TProfile_[TProfile_.size()-1][0]) > SMALL) { FatalError << "multiHoleInjector::multiHoleInjector(const time& t, const dictionary dict) " << endl << " end-times do not match for TemperatureProfile and massFlowRateProfile." << abort(FatalError); } // convert CA to real time forAll(massFlowRateProfile_, i) { massFlowRateProfile_[i][0] = t.userTimeToTime(massFlowRateProfile_[i][0]); velocityProfile_[i][0] = massFlowRateProfile_[i][0]; injectionPressureProfile_[i][0] = massFlowRateProfile_[i][0]; }
void timeFluxData::setTimeData(const dictionary& timeDict) { const label nAverages(readLabel(timeDict.lookup("nAverages"))); const label nControls(readLabel(timeDict.lookup("nControls"))); averagingTime_.nSteps() = nAverages; controlTime_.nSteps() = nControls; setInitialData(); }
// Construct from dictionary Foam::surfacePatch::surfacePatch ( const word& name, const dictionary& dict, const label index ) : geometricSurfacePatch(name, dict, index), size_(readLabel(dict.lookup("nFaces"))), start_(readLabel(dict.lookup("startFace"))) {}
// Construct from components engineSearchIB::engineSearchIB ( const dictionary& dict, cfdemCloud& sm ) : engineSearch(dict.subDict(typeName + "Props"),sm), propsDict_(dict.subDict(typeName + "Props")), zSplit_(readLabel(propsDict_.lookup("zSplit"))), xySplit_(readLabel(propsDict_.lookup("xySplit"))) {}
Foam::boundaryPatch::boundaryPatch ( const word& name, const dictionary& dict, const label index ) : patchIdentifier(name, dict, index), size_(readLabel(dict.lookup("nFaces"))), start_(readLabel(dict.lookup("startFace"))) {}
Foam::surfZone::surfZone ( const word& name, const dictionary& dict, const label index ) : surfZoneIdentifier(name, dict, index), size_(readLabel(dict.lookup("nFaces"))), start_(readLabel(dict.lookup("startFace"))) {}
Foam::PairCollisionRecord<Type>::PairCollisionRecord(Istream& is) : origProcOfOther_(readLabel(is)), origIdOfOther_(readLabel(is)), data_(is) { // Check state of Istream is.check ( "Foam::PairCollisionRecord<Type>::PairCollisionRecord(Foam::Istream&)" ); }
Foam::BlockIterativeSolver<Type>::BlockIterativeSolver ( const word& fieldName, const BlockLduMatrix<Type>& matrix, const dictionary& dict ) : BlockLduSolver<Type>(fieldName, matrix, dict), tolerance_(readScalar(this->dict().lookup("tolerance"))), relTolerance_(readScalar(this->dict().lookup("relTol"))), minIter_(readLabel(this->dict().lookup("minIter"))), maxIter_(readLabel(this->dict().lookup("maxIter"))) {}
Foam::ParticleTracks<CloudType>::ParticleTracks ( const dictionary& dict, CloudType& owner ) : CloudFunctionObject<CloudType>(dict, owner, typeName), trackInterval_(readLabel(this->coeffDict().lookup("trackInterval"))), maxSamples_(readLabel(this->coeffDict().lookup("maxSamples"))), resetOnWrite_(this->coeffDict().lookup("resetOnWrite")), faceHitCounter_(), cloudPtr_(NULL) {}
pointField quadrilateralDistribution::evaluate() { // Read needed material label N0( readLabel(pointDict_.lookup("N0")) ); label N1( readLabel(pointDict_.lookup("N1")) ); point xs0( pointDict_.lookup("linestart0") ); point xe0( pointDict_.lookup("lineend0") ); point xe1( pointDict_.lookup("lineend1") ); scalar stretch0( pointDict_.lookupOrDefault<scalar>("stretch0", 1.0) ); scalar stretch1( pointDict_.lookupOrDefault<scalar>("stretch1", 1.0) ); // Define the return field pointField res(N0*N1, xs0); // Compute the scaling factor scalar factor0(0.0); scalar factor1(0.0); for (int i=1; i < N0; i++) { factor0 += Foam::pow( stretch0, static_cast<scalar>(i) ); } for (int i=1; i < N1; i++) { factor1 += Foam::pow( stretch1, static_cast<scalar>(i) ); } point dx0( (xe0 - xs0)/factor0 ); point dx1( (xe1 - xs0)/factor1 ); // Compute points for (int j=0; j < N1; j++) { if (j != 0) { res[j*N0] = res[(j - 1)*N0] + Foam::pow( stretch1, static_cast<scalar>(j))*dx1; } for (int i=1; i < N0; i++) { res[i + j*N0] = res[i - 1 + j*N0] + Foam::pow( stretch0, static_cast<scalar>(i) )*dx0; } } return res; }
void timeData::setTimeData(const dictionary& timeDict) { const label nSamples(readLabel(timeDict.lookup("nSamples"))); const label nAverages(readLabel(timeDict.lookup("nAverages"))); // const label nCalcProp(readLabel(timeDict.lookup("nCalcProp"))); const label nControls(readLabel(timeDict.lookup("nControls"))); samplingTime_.nSteps() = nSamples; averagingTime_.nSteps() = nAverages; // calcPropTime_.nSteps() = nCalcProp; controlTime_.nSteps() = nControls; setInitialData(); }
// Construct from dictionary Foam::refinementParameters::refinementParameters ( const dictionary& dict, const label dummy ) : maxGlobalCells_(readLabel(dict.lookup("cellLimit"))), maxLocalCells_(readLabel(dict.lookup("procCellLimit"))), minRefineCells_(readLabel(dict.lookup("minimumRefine"))), curvature_(readScalar(dict.lookup("curvature"))), nBufferLayers_(readLabel(dict.lookup("nBufferLayers"))), keepPoints_(dict.lookup("keepPoints")), allowFreeStandingZoneFaces_(dict.lookup("allowFreeStandingZoneFaces")), maxLoadUnbalance_(dict.lookupOrDefault<scalar>("maxLoadUnbalance",0)) {}
Foam::processorPolyPatch::processorPolyPatch ( const word& name, const dictionary& dict, const label index, const polyBoundaryMesh& bm ) : coupledPolyPatch(name, dict, index, bm), myProcNo_(readLabel(dict.lookup("myProcNo"))), neighbProcNo_(readLabel(dict.lookup("neighbProcNo"))), neighbFaceCentres_(), neighbFaceAreas_(), neighbFaceCellCentres_() {}
Foam::activeBaffleVelocityFvPatchVectorField:: activeBaffleVelocityFvPatchVectorField ( const fvPatch& p, const DimensionedField<vector, volMesh>& iF, const dictionary& dict ) : fixedValueFvPatchVectorField(p, iF), pName_("p"), cyclicPatchName_(dict.lookup("cyclicPatch")), cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)), orientation_(readLabel(dict.lookup("orientation"))), initWallSf_(p.Sf()), initCyclicSf_(p.boundaryMesh()[cyclicPatchLabel_].Sf()), openFraction_(readScalar(dict.lookup("openFraction"))), openingTime_(readScalar(dict.lookup("openingTime"))), maxOpenFractionDelta_(readScalar(dict.lookup("maxOpenFractionDelta"))), curTimeIndex_(-1) { fvPatchVectorField::operator=(vector::zero); if (dict.found("p")) { dict.lookup("p") >> pName_; }
Foam::fileControl::fileControl ( const Time& runTime, const word& name, const dictionary& controlFunctionDict, const conformationSurfaces& geometryToConformTo, const scalar& defaultCellSize ) : cellSizeAndAlignmentControl ( runTime, name, controlFunctionDict, geometryToConformTo, defaultCellSize ), pointsFile_(controlFunctionDict.lookup("pointsFile")), sizesFile_(controlFunctionDict.lookup("sizesFile")), alignmentsFile_(controlFunctionDict.lookup("alignmentsFile")), maxPriority_(readLabel(controlFunctionDict.lookup("priority"))) { Info<< indent << "Loading " << name << " from file:" << nl << indent << " priority : " << maxPriority_ << nl << indent << " points : " << pointsFile_ << nl << indent << " sizes : " << sizesFile_ << nl << indent << " alignments : " << alignmentsFile_ << endl; }
/** * @brief Reads an object from `reader`. An object is a valid JSON structure. * @param reader The JSONReader. * @return The object. */ static Dictionary *readObject(JSONReader *reader) { MutableDictionary *object = $(alloc(MutableDictionary), init); while (true) { String *key = readLabel(reader); if (key == NULL) { const int b = readByteUntil(reader, "}"); assert(b == '}'); break; } const int b = readByteUntil(reader, ":"); assert(b == ':'); ident obj = readElement(reader); assert(obj); $(object, setObjectForKey, obj, key); release(key); release(obj); } return (Dictionary *) object; }
Foam::dummyAgglomeration::dummyAgglomeration ( const lduMesh& mesh, const dictionary& controlDict ) : GAMGAgglomeration(mesh, controlDict), nLevels_(readLabel(controlDict.lookup("nLevels"))) { const label nCoarseCells = mesh.lduAddr().size(); for ( label nCreatedLevels = 0; nCreatedLevels < nLevels_; nCreatedLevels++ ) { nCells_[nCreatedLevels] = nCoarseCells; restrictAddressing_.set ( nCreatedLevels, new labelField(identity(nCoarseCells)) ); agglomerateLduAddressing(nCreatedLevels); } // Shrink the storage of the levels to those created compactLevels(nLevels_); }
// Construct from components Foam::definedInjector::definedInjector ( const Time& t, const dictionary& dict ) : injectorType(t, dict), propsDict_(dict.subDict(typeName + "Props")), position_(propsDict_.lookup("position")), direction_(propsDict_.lookup("direction")), d_(readScalar(propsDict_.lookup("diameter"))), mass_(readScalar(propsDict_.lookup("mass"))), T_(readScalar(propsDict_.lookup("temperature"))), nParcels_(readLabel(propsDict_.lookup("nParcels"))), X_(propsDict_.lookup("X")), massFlowRateProfile_(propsDict_.lookup("massFlowRateProfile")), velocityProfile_(propsDict_.lookup("velocityProfile")), injectionPressureProfile_(massFlowRateProfile_), CdProfile_(massFlowRateProfile_), averageParcelMass_(mass_/nParcels_), pressureIndependentVelocity_(true) { // convert CA to real time - mass flow rate profile forAll(massFlowRateProfile_, i) { massFlowRateProfile_[i][0] = t.userTimeToTime(massFlowRateProfile_[i][0]); // dummy injectionPressureProfile_[i][0] = massFlowRateProfile_[i][0]; injectionPressureProfile_[i][1] = 0.0; CdProfile_[i][0] = massFlowRateProfile_[i][0]; CdProfile_[i][1] = 1.0; }
Foam::dummyControlDict::dummyControlDict(const fileName& mcdFile) { this->set("deltaT", 1); this->set("writeFrequency", 1); IFstream mcdStream(mcdFile); if (!mcdStream.good()) { FatalErrorIn("dummyControlDict::dummyControlDict") << "Cannot find the multiControlDict file " << mcdFile << "." << abort(FatalError); } dictionary mcdDict(mcdStream); if (mcdDict.subDict("multiSolverControl").found("timeFormat")) { word tf(mcdDict.subDict("multiSolverControl").lookup("timeFormat")); this->set("timeFormat", tf); } if (mcdDict.subDict("multiSolverControl").found("timePrecision")) { label tp ( readLabel ( mcdDict.subDict("multiSolverControl").lookup("timePrecision") ) ); this->set("timePrecision", tp); } }
Foam::swirlInjector::swirlInjector ( const Foam::Time& t, const Foam::dictionary& dict ) : injectorType(t, dict), propsDict_(dict.subDict(typeName + "Props")), position_(propsDict_.lookup("position")), direction_(propsDict_.lookup("direction")), d_(readScalar(propsDict_.lookup("diameter"))), mass_(readScalar(propsDict_.lookup("mass"))), injectionPressure_(readScalar(propsDict_.lookup("injectionPressure"))), T_(readScalar(propsDict_.lookup("temperature"))), nParcels_(readLabel(propsDict_.lookup("nParcels"))), X_(propsDict_.lookup("X")), massFlowRateProfile_(propsDict_.lookup("massFlowRateProfile")), injectionPressureProfile_(propsDict_.lookup("injectionPressureProfile")), velocityProfile_(massFlowRateProfile_), CdProfile_(massFlowRateProfile_), TProfile_(massFlowRateProfile_), averageParcelMass_(mass_/nParcels_), pressureIndependentVelocity_(false) { // convert CA to real time forAll(massFlowRateProfile_, i) { massFlowRateProfile_[i][0] = t.userTimeToTime(massFlowRateProfile_[i][0]); }
Foam::KinematicParcel<ParcelType>::KinematicParcel ( const Cloud<ParcelType>& cloud, Istream& is, bool readFields ) : Particle<ParcelType>(cloud, is, readFields), typeId_(0), nParticle_(0.0), d_(0.0), U_(vector::zero), rho_(0.0), tTurb_(0.0), UTurb_(vector::zero), rhoc_(0.0), Uc_(vector::zero), muc_(0.0) { if (readFields) { if (is.format() == IOstream::ASCII) { typeId_ = readLabel(is); nParticle_ = readScalar(is); d_ = readScalar(is); is >> U_; rho_ = readScalar(is); tTurb_ = readScalar(is); is >> UTurb_; } else {
Type swakDataEntry<Type>::integrate(const scalar x1,const scalar x2) const { CommonValueExpressionDriver &theDriver=const_cast<swakDataEntry<Type> &>( *this ).driver(); theDriver.clearVariables(); label intervalls=readLabel(data_->lookup("integrationIntervalls")); scalar dx=(x2-x1)/intervalls; scalar x=x1; theDriver.addUniformVariable( independentVariableName_, x ); Type valOld=theDriver.evaluateUniform<Type>(expression_); Type result=pTraits<Type>::zero; while((x+SMALL)<x2) { x+=dx; theDriver.addUniformVariable( independentVariableName_, x ); Type valNew=theDriver.evaluateUniform<Type>(expression_); result+=0.5*(valOld+valNew)*dx; valOld=valNew; } // Info << "Integrate " << expression_ << " from " << x1 << " to " // << x2 << " -> " << result << endl; return result; }