bool Foam::volFieldStreamReconstructor<Type>::decompose
(
    const parUnallocatedFvFieldReconstructor& reconstructor,
    const unallocatedFvMesh& baseMesh,
    const IOobject& baseIO,

    const unallocatedFvMesh& thisMesh,
    const IOobject& thisIO,
    const bool,
    Ostream& os
) const
{
    typedef GeometricField<Type, unallocatedFvPatchField, unallocatedVolMesh>
        GeoField;

    // Read base field
    Info<< "Reading " << baseIO.objectPath() << endl;
    const GeoField baseFld(baseIO, baseMesh);

    // Decompose
    tmp<GeoField> tfld(reconstructor.decomposeFvVolumeField(baseFld));

    // Stream
    Pout<< incrIndent;
    os << tfld();
    Pout<< decrIndent;

    return os.good();
}
bool Foam::IOobject::writeHeader(Ostream& os, const word& type) const
{
    if (!os.good())
    {
        Info<< "IOobject::writeHeader(Ostream&) : "
            << "no stream open for write" << nl
            << os.info() << endl;

        return false;
    }

    writeBanner(os)
        << "FoamFile\n{\n"
        << "    version     " << os.version() << ";\n"
        << "    format      " << os.format() << ";\n"
        << "    class       " << type << ";\n";

    if (note().size())
    {
        os  << "    note        " << note() << ";\n";
    }

    os  << "    location    " << instance()/local() << ";\n"
        << "    object      " << name() << ";\n"
        << "}" << nl;

    writeDivider(os) << endl;

    return true;
}
Exemple #3
0
bool Foam::UniformDimensionedField<Type>::writeData(Ostream& os) const
{
    os.writeKeyword("dimensions") << this->dimensions() << token::END_STATEMENT
        << nl;
    os.writeKeyword("value") << this->value() << token::END_STATEMENT
        << nl << nl;

    return (os.good());
}
bool Foam::constSolidThermo::writeData(Ostream& os) const
{
    bool ok = basicSolidThermo::writeData(os);
    os.writeKeyword("rho") << constRho_ << token::END_STATEMENT << nl;
    os.writeKeyword("Cp") << constCp_ << token::END_STATEMENT << nl;
    os.writeKeyword("K") << constK_ << token::END_STATEMENT << nl;
    os.writeKeyword("Hf") << constHf_ << token::END_STATEMENT << nl;
    os.writeKeyword("kappa") << constKappa_ << token::END_STATEMENT << nl;
    os.writeKeyword("sigmaS") << constSigmaS_ << token::END_STATEMENT << nl;
    os.writeKeyword("emissivity") << constEmissivity_ << token::END_STATEMENT
        << nl;
    return ok && os.good();
}
bool Foam::IOPosition<ParticleType>::writeData(Ostream& os) const
{
    os<< cloud_.size() << nl << token::BEGIN_LIST << nl;

    forAllConstIter(typename Cloud<ParticleType>, cloud_, iter)
    {
        os<< static_cast<const Particle<ParticleType>&>(iter()) << nl;
    }

    os<< token::END_LIST << endl;

    return os.good();
}
bool IOPatchToPatchInterpolation<FromPatch, ToPatch>::writeData
(
    Ostream& os
) const
{
    os << this->pointAddr() << nl;
    os << this->pointWeights() << nl;
    os << this->pointDistanceToIntersection() << nl;
    os << this->faceAddr() << nl;
    os << this->faceWeights() << nl;
    os << this->faceDistanceToIntersection() << nl;
    return os.good();
}
bool Foam::interpolateSolid::writeData(Ostream& os) const
{

    os.writeKeyword("TValues") << TValues_ << token::END_STATEMENT << nl;
    os.writeKeyword("rhoValues") << rhoValues_ << token::END_STATEMENT << nl;
    os.writeKeyword("cpValues") << cpValues_ << token::END_STATEMENT << nl;
    os.writeKeyword("HfValues") << HfValues_ << token::END_STATEMENT << nl;
    os.writeKeyword("emissivityValues") << emissivityValues_ << nl;
    os.writeKeyword("kappaValues") << kappaValues_ << nl;
    os.writeKeyword("sigmaSValues") << sigmaSValues_
        << token::END_STATEMENT << nl;

    return os.good();
}
bool Foam::passiveParticleStreamReconstructor::decompose
(
    const parUnallocatedFvFieldReconstructor& reconstructor,
    const unallocatedFvMesh& baseMesh,
    const IOobject& baseIO,

    const unallocatedFvMesh& thisMesh,
    const IOobject& thisIO,
    const bool,
    Ostream& os
) const
{
    Pout<< "*** LAGRANGIAN DEcomposing " << baseIO.objectPath() << endl;
    Pout<< "** LAGRANGIAN Decomposed " << baseIO.objectPath() << endl;
    return os.good();
}
bool JobInfo::write(Ostream& JobInfoFile) const
{
    if (writeJobInfo && Pstream::master())
    {
        if (JobInfoFile.good())
        {
            dictionary::write(JobInfoFile, false);
            return true;
        }
        else
        {
            return false;
        }
    }
    else
    {
        return true;
    }
}
bool Foam::IOPosition<ParticleType>::writeData(Ostream& os) const
{
    os<< cloud_.size() << nl << token::BEGIN_LIST << nl;

    forAllConstIter(typename Cloud<ParticleType>, cloud_, iter)
    {
        // Prevent writing additional fields
        static_cast<const Particle<ParticleType>&>(iter()).write
        (
            os,
            false
        );
        os  << nl;
    }

    os<< token::END_LIST << endl;

    return os.good();
}
Exemple #11
0
bool Foam::JobInfo::write(Ostream& os) const
{
    if (writeJobInfo && Pstream::master())
    {
        if (os.good())
        {
            dictionary::write(os, false);
            return true;
        }
        else
        {
            return false;
        }
    }
    else
    {
        return true;
    }
}
bool DimensionedField<Type, GeoMesh>::writeData
(
    Ostream& os,
    const word& fieldDictEntry
) const
{
    os.writeKeyword("dimensions") << dimensions() << token::END_STATEMENT
        << nl << nl;

    Field<Type>::writeEntry(fieldDictEntry, os);

    // Check state of Ostream
    os.check
    (
        "bool DimensionedField<Type, GeoMesh>::writeData"
        "(Ostream& os, const word& fieldDictEntry) const"
    );

    return (os.good());
}
Exemple #13
0
bool Foam::sixDOFqODE::writeData(Ostream& os) const
{
    os << *this;
    return os.good();
}
bool Foam::passiveParticleStreamReconstructor::reconstruct
(
    const IOobject& io,
    const bool,
    Ostream& os
) const
{
    // io.db()                   = Cloud<passiveParticle>
    // io.db().parent()          = polyMesh
    // io.db().parent().parent() = Time

    // Retrieve from polyMesh
    const uFieldReconstructor& reconstructor =
        uFieldReconstructor::New(io.db().parent());

    const PtrList<unallocatedFvMesh>& procMeshes = reconstructor.procMeshes();

    Info<< "Reconstructing " << io.objectPath() << endl;

    // Read field on proc meshes
    PtrList<cloud> procClouds(procMeshes.size());
    PtrList<unallocatedIOPosition> procFields(procMeshes.size());
    forAll(procFields, proci)
    {
        const unallocatedFvMesh& procMesh = procMeshes[proci];

        Pout<< incrIndent;

        // Construct empty cloud
        procClouds.set
        (
            proci,
            new cloud
            (
                procMesh.thisDb(),
                "kinematicCloud"
            )
        );

        procFields.set
        (
            proci,
            new unallocatedIOPosition
            (
                IOobject
                (
                    io.name(),
                    io.instance(),
                    io.local(),
                    procClouds[proci],
                    IOobject::MUST_READ,    //IOobject::READ_IF_PRESENT,
                    IOobject::NO_WRITE
                )
            )
        );

        Pout<< decrIndent;
    }

    unallocatedIOPosition particles
    (
        IOobject
        (
            io.name(),
            io.instance(),
            io.local(),
            io.db(),
            IOobject::NO_READ,
            IOobject::NO_WRITE,
            false
        )
    );

    const faceList* facesPtr = nullptr;
    if (isA<polyMesh>(io.db().parent()))
    {
        facesPtr = &dynamic_cast<const polyMesh&>(io.db().parent()).faces();
    }

    forAll(procFields, proci)
    {
        const unallocatedIOPosition& procCloud = procFields[proci];
        const labelList& cellMap = reconstructor.cellProcAddressing()[proci];
        const labelList& faceMap = reconstructor.faceProcAddressing()[proci];

        forAllConstIter(typename IDLList<basicParticle>, procCloud, iter)
        {
            const basicParticle& p = iter();

            const label mappedCell = cellMap[p.cell()];

            const label mapi = faceMap[p.tetFace()];

            label mappedTetFace = -1;
            label tetPti = p.tetPt();
            if (mapi == 0)
            {
                FatalErrorInFunction << "problem" << exit(FatalError);
            }
            else if (mapi > 0)
            {
                mappedTetFace = mapi - 1;
            }
            else
            {
                mappedTetFace = -mapi - 1;

                if (facesPtr)
                {
                    // Flipping face

                    const face& f = (*facesPtr)[mappedTetFace];
                    tetPti = f.size() - 1 - tetPti;
                }
            }

            particles.append
            (
                new basicParticle
                (
                    p,
                    mappedCell,
                    mappedTetFace,
                    tetPti
                )
            );
        }
    }
    particles.writeData(os);

    return os.good();
}
// writeData member function required by regIOobject
bool Foam::surfacePatchIOList::writeData(Ostream& os) const
{
    os  << *this;
    return os.good();
}
bool Foam::IOReferencer<Type>::writeData(Ostream& os) const
{
    // do nothing
    return os.good();
}
bool Foam::virtualMassModel::writeData(Ostream& os) const
{
    return os.good();
}
bool Foam::volFieldStreamReconstructor<Type>::reconstruct
(
    const IOobject& io,
    const bool,
    Ostream& os
) const
{
    typedef GeometricField<Type, unallocatedFvPatchField, unallocatedVolMesh>
        GeoField;

    // Retrieve from polyMesh
    const uFieldReconstructor& reconstructor =
        uFieldReconstructor::New(io.db());

    const PtrList<unallocatedFvMesh>& procMeshes = reconstructor.procMeshes();

    Info<< "Reconstructing " << io.objectPath() << endl;

    // Read field on proc meshes
    PtrList<GeoField> procFields(procMeshes.size());
    forAll(procFields, proci)
    {
        const unallocatedFvMesh& procMesh = procMeshes[proci];

        Pout<< incrIndent;
        procFields.set
        (
            proci,
            new GeoField
            (
                IOobject
                (
                    io.name(),
                    io.instance(),
                    io.local(),
                    procMesh.thisDb(),
                    IOobject::MUST_READ,
                    IOobject::NO_WRITE,
                    false
                ),
                procMesh
            )
        );
        Pout<< decrIndent;
    }

    // Fix filtering of empty nonuniform entries
    reconstructor.reconstructor().fixGenericNonuniform
    <
        GeoField,
        unallocatedGenericFvPatchField<Type>
    >(procFields);

    // Map local field onto baseMesh
    const unallocatedFvMesh& baseMesh = reconstructor.baseMesh();

    tmp<GeoField> tfld
    (
        reconstructor.reconstructor().reconstructFvVolumeField
        (
            IOobject
            (
                io.name(),
                io.instance(),
                io.local(),
                baseMesh.thisDb(),
                IOobject::NO_READ,
                IOobject::AUTO_WRITE,
                false
            ),
            procFields
        )
    );

    Pout<< incrIndent;
    os << tfld();
    Pout<< decrIndent;

    return os.good();
}