mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: surfMesh::setWriteOption to adjust the write option of all components
- otherwise difficult to avoid auto-write etc. - propagate similar changes to MeshedSurfaceAllocator, where is makes the most sense.
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -72,8 +72,32 @@ Foam::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::MeshedSurfaceIOAllocator::~MeshedSurfaceIOAllocator()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::MeshedSurfaceIOAllocator::setInstance(const fileName& inst)
|
||||||
|
{
|
||||||
|
points_.instance() = inst;
|
||||||
|
faces_.instance() = inst;
|
||||||
|
zones_.instance() = inst;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::MeshedSurfaceIOAllocator::setWriteOption(IOobject::writeOption w)
|
||||||
|
{
|
||||||
|
points_.writeOpt() = w;
|
||||||
|
faces_.writeOpt() = w;
|
||||||
|
zones_.writeOpt() = w;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::MeshedSurfaceIOAllocator::clear()
|
void Foam::MeshedSurfaceIOAllocator::clear()
|
||||||
{
|
{
|
||||||
points_.clear();
|
points_.clear();
|
||||||
@ -136,4 +160,20 @@ void Foam::MeshedSurfaceIOAllocator::reset
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::MeshedSurfaceIOAllocator::writeObject
|
||||||
|
(
|
||||||
|
IOstream::streamFormat fmt,
|
||||||
|
IOstream::versionNumber ver,
|
||||||
|
IOstream::compressionType cmp
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(
|
||||||
|
points_.writeObject(fmt, ver, cmp)
|
||||||
|
&& faces_.writeObject(fmt, ver, cmp)
|
||||||
|
&& zones_.writeObject(fmt, ver, cmp)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -106,8 +106,21 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~MeshedSurfaceIOAllocator();
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
// Database
|
||||||
|
|
||||||
|
//- Set the instance for mesh files
|
||||||
|
void setInstance(const fileName&);
|
||||||
|
|
||||||
|
//- Adjust the write option for all components
|
||||||
|
void setWriteOption(IOobject::writeOption);
|
||||||
|
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Non-const access to the points
|
//- Non-const access to the points
|
||||||
@ -177,6 +190,18 @@ public:
|
|||||||
const Xfer<faceList>& faces,
|
const Xfer<faceList>& faces,
|
||||||
const Xfer<surfZoneList>& zones
|
const Xfer<surfZoneList>& zones
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Writing
|
||||||
|
|
||||||
|
//- Write using given format, version and compression
|
||||||
|
virtual bool writeObject
|
||||||
|
(
|
||||||
|
IOstream::streamFormat,
|
||||||
|
IOstream::versionNumber,
|
||||||
|
IOstream::compressionType
|
||||||
|
) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -200,7 +200,14 @@ public:
|
|||||||
const fileName& facesInstance() const;
|
const fileName& facesInstance() const;
|
||||||
|
|
||||||
//- Set the instance for mesh files
|
//- Set the instance for mesh files
|
||||||
void setInstance(const fileName&);
|
void setInstance
|
||||||
|
(
|
||||||
|
const fileName&,
|
||||||
|
IOobject::writeOption = IOobject::AUTO_WRITE
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Adjust the write option for all components
|
||||||
|
void setWriteOption(IOobject::writeOption);
|
||||||
|
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
@ -322,6 +329,7 @@ public:
|
|||||||
|
|
||||||
//- Remove all files from mesh instance()
|
//- Remove all files from mesh instance()
|
||||||
void removeFiles() const;
|
void removeFiles() const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,7 +28,7 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::surfMesh::setInstance(const fileName& inst)
|
void Foam::surfMesh::setInstance(const fileName& inst, IOobject::writeOption w)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -36,15 +36,16 @@ void Foam::surfMesh::setInstance(const fileName& inst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
instance() = inst;
|
instance() = inst;
|
||||||
|
Allocator::setInstance(inst);
|
||||||
|
|
||||||
storedIOPoints().writeOpt() = IOobject::AUTO_WRITE;
|
setWriteOption(w);
|
||||||
storedIOPoints().instance() = inst;
|
}
|
||||||
|
|
||||||
storedIOFaces().writeOpt() = IOobject::AUTO_WRITE;
|
|
||||||
storedIOFaces().instance() = inst;
|
|
||||||
|
|
||||||
storedIOZones().writeOpt() = IOobject::AUTO_WRITE;
|
void Foam::surfMesh::setWriteOption(IOobject::writeOption w)
|
||||||
storedIOZones().instance() = inst;
|
{
|
||||||
|
writeOpt() = w;
|
||||||
|
Allocator::setWriteOption(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user