manipulateFvSolutionFvSchemesFunctionObject::manipulateFvSolutionFvSchemesFunctionObject ( const word &name, const Time& t, const dictionary& dict ) : simpleFunctionObject(name,t,dict), fvSolution_( #ifdef FOAM_FVMESH_NOT_CHILD_OF_FVSCHEMES_SOLUTION const_cast<surfaceInterpolation&>( dynamic_cast<const surfaceInterpolation&>( obr() ) ).solutionDict() #else const_cast<fvSolution&>( dynamic_cast<const fvSolution&>( obr() ) ) #endif ), fvSchemes_( #ifdef FOAM_FVMESH_NOT_CHILD_OF_FVSCHEMES_SOLUTION const_cast<surfaceInterpolation&>( dynamic_cast<const surfaceInterpolation&>( obr() ) ).schemesDict() #else const_cast<fvSchemes&>( dynamic_cast<const fvSchemes&>( obr() ) ) #endif ), fvSolutionBackup_( fvSolution_ ), fvSchemesBackup_( fvSchemes_ ) { #ifdef FOAM_SOLUTION_HAS_NO_READ_WITH_DICT FatalErrorIn("manipulateFvSolutionFvSchemesFunctionObject::manipulateFvSolutionFvSchemesFunctionObject") << "This Foam-version does not have the facilities to overwrite fvSolution in memory." << endl << exit(FatalError); #endif #ifdef FOAM_SCHEMES_HAS_NO_READ_WITH_DICT FatalErrorIn("manipulateFvSolutionFvSchemesFunctionObject::manipulateFvSolutionFvSchemesFunctionObject") << "This Foam-version does not have the facilities to overwrite fvSchemes in memory." << endl << exit(FatalError); #endif }
void manipulateFvSolutionFvSchemesFunctionObject::writeSimple() { if(this->manipulateFvSolution(obr().time())) { rereadFvSolution(); } if(this->manipulateFvSchemes(obr().time())) { rereadFvSchemes(); } }
bool manipulateFvSolutionFvSchemesFunctionObject::start() { simpleFunctionObject::start(); if(this->manipulateFvSolution(obr().time())) { rereadFvSolution(); } if(this->manipulateFvSchemes(obr().time())) { rereadFvSchemes(); } return true; }
autoPtr<incompressible::turbulenceModel> loadIncompressibleTurbulenceModelFunctionObject::initModel() { return incompressible::turbulenceModel::New( obr().lookupObject<volVectorField>( dict_.lookup("UName") ), obr().lookupObject<surfaceScalarField>( dict_.lookup("phiName") ), const_cast<transportModel &>( obr().lookupObject<transportModel>( dict_.lookup("transportModel") ) ) ); }
void Foam::fieldValues::cellSource::initialise(const dictionary& dict) { setCellZoneCells(); Info<< type() << " " << name_ << ":" << nl << " total cells = " << nCells_ << nl << " total volume = " << gSum(filterField(mesh().V())) << nl << endl; if (operation_ == opWeightedAverage) { dict.lookup("weightField") >> weightFieldName_; if ( obr().foundObject<volScalarField>(weightFieldName_) ) { Info<< " weight field = " << weightFieldName_; } else { FatalErrorIn("cellSource::initialise()") << type() << " " << name_ << ": " << sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl << " Weight field " << weightFieldName_ << " must be a " << volScalarField::typeName << nl << exit(FatalError); } }
void listMeshDataFunctionObject::write() { Info << "Content of mesh data " << obr().name() << endl; dumpData(); }
void listRegisteredObjectsFunctionObject::writeSimple() { Info << "Content of object registry " << obr().name() << endl; dumpObr(); }
void listRegisteredObjectsFunctionObject::dumpObr() { wordList toc(obr().toc()); sort(toc); const string nameConst("Name"); unsigned int maxNameLen(nameConst.size()); const string typeConst("Type"); unsigned int maxTypeLen(typeConst.size()); const string autoWriteConst("Autowrite"); forAll(toc,i) { const regIOobject &o=*(obr()[toc[i]]); if(o.name().size()>maxNameLen) { maxNameLen=o.name().size(); } if(o.headerClassName().size()>maxTypeLen) { maxTypeLen=o.headerClassName().size(); } } Info().width(maxNameLen); Info << nameConst.c_str() << " "; Info().width(maxTypeLen); Info << typeConst.c_str() << " " << autoWriteConst.c_str() << endl; for(unsigned int i=0;i<maxNameLen;i++) Info << "="; Info << " "; for(unsigned int i=0;i<maxTypeLen;i++) Info << "="; Info << " "; for(unsigned int i=0;i<autoWriteConst.size();i++) Info << "="; Info << endl; forAll(toc,i) { const regIOobject &o=*(obr()[toc[i]]); Info().width(maxNameLen); Info << o.name().c_str() << " "; Info().width(maxTypeLen); Info << o.headerClassName().c_str() << " "; if(o.writeOpt()==IOobject::AUTO_WRITE) { Info << "Yes"; } else { Info << "No"; } Info << endl; } Info << endl; }
bool listMeshDataFunctionObject::start() { Info << "Content of mesh data " << obr().name() << " at start" << endl; dumpData(); return true; }
bool EvolveCloudFunctionObject<CloudType>::execute() { cloud_->evolve(); if(obr().time().outputTime()) { Info << "Writing cloud " << cloud_->name() << endl; cloud_->write(); } return true; }
bool EvolveSolidParticleCloudFunctionObject::start() { cloud().set( new solidParticleCloud( // dynamicCast<const fvMesh &>( dynamic_cast<const fvMesh &>( obr() ), cloudName() ) ); return true; }
/** * @brief Compute the sum of values and the sum of squared values of a patch with dimensions * 2*xWindow+1 by 2*yWindow+1 and centered in point p, using the integral image and integral * image of squared pixel values. * @param[in] p The center of the patch we want to calculate the sum and sum of squared values. * @param[in] s The integral image * @param[in] ss The integral image of squared values. * @param[out] sum The sum of pixels inside the patch. * @param[out] ssum The sum of squared values inside the patch. * @param [in] xWindow The distance from the central pixel of the patch to the border in x * direction. * @param [in] yWindow The distance from the central pixel of the patch to the border in y * direction. * @note Default value for xWindow, yWindow is 1. in this case the patch is 3x3. * @note integral images are very useful to sum values of patches in constant time independent * of their size. For more information refer to the cv::Integral function OpenCV page. */ void patchSumSum2(const cv::Point2i p, const cv::Mat &sum, const cv::Mat &ssum, float &s, float &ss, const int xWindow=1, const int yWindow=1) { cv::Point2i otl(p.x-xWindow, p.y-yWindow); //outer top right cv::Point2i otr(p.x+xWindow+1, p.y-yWindow); //outer bottom left cv::Point2i obl(p.x-xWindow, p.y+yWindow+1); //outer bottom right cv::Point2i obr(p.x+xWindow+1, p.y+yWindow+1); // sum and squared sum for right window s = (float)(sum.at<int>(otl) - sum.at<int>(otr) - sum.at<int>(obl) + sum.at<int>(obr)); ss = (float)(ssum.at<double>(otl) - ssum.at<double>(otr) - ssum.at<double>(obl) + ssum.at<double>(obr)); }
bool EvolveCloudFunctionObject<solidParticleCloud>::execute(bool forceWrite) { Info << "Moving solidParticeCloud:" << cloud_->name() << " with " << cloud_->size() << " particles" << endl; cloud_->move(g()); Info << tab << cloud_->size() << " particles after moving" << endl; if( obr().time().outputTime() || forceWrite ) { Info << "Writing cloud " << cloud_->name() << endl; cloud_->write(); } return true; }
bool Foam::fileFormats::VTKsurfaceFormat<Face>::read ( const fileName& filename ) { const bool mustTriangulate = this->isTri(); this->clear(); IFstream is(filename); if (!is.good()) { FatalErrorInFunction << "Cannot read file " << filename << exit(FatalError); } // assume that the groups are not intermixed bool sorted = true; // Construct dummy time so we have something to create an objectRegistry // from Time dummyTime ( "dummyRoot", "dummyCase", "system", "constant", false // enableFunctionObjects ); // Make dummy object registry objectRegistry obr ( IOobject ( "dummy", dummyTime, IOobject::NO_READ, IOobject::NO_WRITE, false ) ); // Read all vtkUnstructuredReader reader(obr, is); const faceList& faces = reader.faces(); // Assume all faces in zone0 unless a region field is present labelList zones(faces.size(), 0); if (reader.cellData().foundObject<scalarIOField>("region")) { const scalarIOField& region = reader.cellData().lookupObject<scalarIOField> ( "region" ); forAll(region, i) { zones[i] = label(region[i]); } }
void listMeshDataFunctionObject::dumpData() { const data &theData=dynamicCast<const fvMesh&>(obr()); Info << theData << endl; }