mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: consistent output format for coupled geometry description (issue #278)
- In the corner case with few faces or points, the normal List I/O results in a compact list representation. This is less than desirable for external programs with simple line-based parsers. - Write exactly the following *Faces* // Patch: <word-Region> <word-Patch> <int-nFaces> ( <int-faceSize>(<int> .. <int>) ... ) *Points* // Patch: <word-Region> <word-Patch> <int-nPoints> ( (<float-x> <float-y> <float-z>) ... ) STYLE: only use serial form of createExternalCoupledPatchGeometry in tutorial - less confusing for the user, who wonders why it is being done twice.
This commit is contained in:
@ -69,6 +69,36 @@ const Foam::NamedEnum
|
|||||||
> Foam::externalCoupledFunctionObject::stateEndNames_;
|
> Foam::externalCoupledFunctionObject::stateEndNames_;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
//! \cond fileScope
|
||||||
|
//- Write list content with size, bracket, content, bracket one-per-line.
|
||||||
|
// This makes for consistent for parsing, regardless of the list length.
|
||||||
|
template <class T>
|
||||||
|
static void writeList(Ostream& os, const string& header, const UList<T>& L)
|
||||||
|
{
|
||||||
|
// Header string
|
||||||
|
os << header.c_str() << nl;
|
||||||
|
|
||||||
|
// Write size and start delimiter
|
||||||
|
os << L.size() << nl
|
||||||
|
<< token::BEGIN_LIST;
|
||||||
|
|
||||||
|
// Write contents
|
||||||
|
forAll(L, i)
|
||||||
|
{
|
||||||
|
os << nl << L[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write end delimiter
|
||||||
|
os << nl << token::END_LIST << nl << endl;
|
||||||
|
}
|
||||||
|
//! \endcond
|
||||||
|
|
||||||
|
}
|
||||||
|
// namespace Foam
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::fileName Foam::externalCoupledFunctionObject::baseDir() const
|
Foam::fileName Foam::externalCoupledFunctionObject::baseDir() const
|
||||||
@ -515,13 +545,8 @@ void Foam::externalCoupledFunctionObject::writeGeometry
|
|||||||
const string entryHeader =
|
const string entryHeader =
|
||||||
patchKey + ' ' + mesh.name() + ' ' + p.name();
|
patchKey + ' ' + mesh.name() + ' ' + p.name();
|
||||||
|
|
||||||
// Write points
|
writeList(osPointsPtr(), entryHeader, allPoints);
|
||||||
osPointsPtr()
|
writeList(osFacesPtr(), entryHeader, allFaces);
|
||||||
<< entryHeader.c_str() << nl << allPoints << nl << endl;
|
|
||||||
|
|
||||||
// Write faces
|
|
||||||
osFacesPtr()
|
|
||||||
<< entryHeader.c_str() << nl << allFaces << nl << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -545,7 +570,7 @@ Foam::word Foam::externalCoupledFunctionObject::compositeName
|
|||||||
{
|
{
|
||||||
// For compatibility with single region cases suppress single
|
// For compatibility with single region cases suppress single
|
||||||
// region name
|
// region name
|
||||||
return word("");
|
return word::null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -15,11 +15,11 @@ cd ${0%/*} || exit 1 # Run from this directory
|
|||||||
# Decompose
|
# Decompose
|
||||||
runApplication decomposePar -allRegions
|
runApplication decomposePar -allRegions
|
||||||
|
|
||||||
# Verify parallel operation of createExternalCoupledPatchGeometry
|
## Can verify parallel operation of createExternalCoupledPatchGeometry
|
||||||
\rm -f log.createExternalCoupledPatchGeometry
|
# \rm -f log.createExternalCoupledPatchGeometry
|
||||||
runParallel createExternalCoupledPatchGeometry \
|
# runParallel createExternalCoupledPatchGeometry \
|
||||||
-regions '(topAir heater)' coupleGroup \
|
# -regions '(topAir heater)' coupleGroup \
|
||||||
-commsDir $PWD/comms
|
# -commsDir $PWD/comms
|
||||||
|
|
||||||
# Run OpenFOAM
|
# Run OpenFOAM
|
||||||
runParallel $(getApplication) &
|
runParallel $(getApplication) &
|
||||||
|
|||||||
Reference in New Issue
Block a user