void Foam::fv::matrixChangeBeforeFvOption::setResidual(
    const fvMatrix<T>& matrix,
    autoPtr<GeometricField<T,fvPatchField,volMesh> >& val
) {
    Info << this->name() << " setting residual for "
        << matrix.psi().name() << " to " << this->fieldName() << endl;

    if(!val.valid()) {
        val.set(
            new GeometricField<T,fvPatchField,volMesh>(
                IOobject(
                    this->fieldName(),
                    matrix.psi().mesh().time().timeName(),
                    matrix.psi().mesh(),
                    IOobject::NO_READ,
                    IOobject::AUTO_WRITE
                ),
                matrix.psi().mesh(),
                dimensioned<T>(
                    "no",
                    matrix.dimensions()/dimVolume,
                    pTraits<T>::zero
                )
            )
        );
    }
    val()=this->calcResiduum(matrix);
}
コード例 #2
0
ファイル: CloudRepository.C プロジェクト: aliozel/swak4Foam
void CloudRepository::addCloud(
    autoPtr<cloud> c
) {
    const word &name=c->name();

    if(updateableClouds_.found(name)) {
        FatalErrorIn("CloudRepository::addCloud")
            << "There is already a cloud " << name
                << " in the updateable clouds. I guess there is a mistake"
                << endl
                << exit(FatalError);
    }

    if(clouds_.found(name)) {
        WarningIn("CloudRepository::addCloud")
            << "Repository of clouds already has an entry "
                << name <<". Overwriting. Expect strange behaviour"
                << endl;
        clouds_.set(
            name,
            c.ptr()
        );
    } else {
        clouds_.insert(
            name,
            c.ptr()
        );
    }
}
コード例 #3
0
ファイル: CloudRepository.C プロジェクト: aliozel/swak4Foam
void CloudRepository::addUpdateableCloud(
    autoPtr<ReaderParticleCloud> c
) {
    const word &name=c->name();

    if(clouds_.found(name)) {
        FatalErrorIn("CloudRepository::addCloud")
            << "There is already a cloud " << name
                << " in the non-updateable clouds. I guess there is a mistake"
                << endl
                << exit(FatalError);
    }

    if(updateableClouds_.found(name)) {
        FatalErrorIn("CloudRepository::addCloud")
            << "Repository of updateable clouds already has an entry "
                << name << ". This can't be right"
                << endl
                << exit(FatalError);
    } else {
        updateableClouds_.insert(
            name,
            c.ptr()
        );
    }
}
コード例 #4
0
void Foam::expressionField::storeField(
    const T &data,
    autoPtr<T> &store
)
{
    if(store.empty()) {
        store.reset(
            new T(
                IOobject(
                    name_,
                    obr_.time().timeName(),
                    obr_,
                    IOobject::NO_READ,
                    autowrite_ ? IOobject::AUTO_WRITE : IOobject::NO_WRITE
                ),
                data
            )
        );
    } else {
        store()==data;
    }
}
コード例 #5
0
ファイル: myAutoPtr-4.C プロジェクト: wan-group/of_tutorial
// transfer p1 as autoPtr
void test1(autoPtr<myLib> p1)
{
	// display name
	Info << nl << "name: " << p1->name() << endl;
}