mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add ensight writeBox method (eg, for simple 'placeholder' geometry)
- related to issue #3095. Some type of geometry is required when loading "measured" ensight data. ENH: emit a fallback geometry-box for foamToEnsight - eg, with "foamToEnsight -no-internal -no-boundary" and lagrangian
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -449,6 +449,19 @@ void Foam::ensightMesh::write
|
|||||||
{
|
{
|
||||||
faceZoneParts_[id].write(os, mesh_, parallel);
|
faceZoneParts_[id].write(os, mesh_, parallel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No geometry parts written?
|
||||||
|
// - with lagrangian-only output the VTK EnsightReader still
|
||||||
|
// needs a volume geometry, and ensight usually does too
|
||||||
|
if
|
||||||
|
(
|
||||||
|
cellZoneParts_.empty()
|
||||||
|
&& boundaryParts_.empty()
|
||||||
|
&& faceZoneParts_.empty()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ensightCells::writeBox(os, mesh_.bounds());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -216,18 +216,22 @@ public:
|
|||||||
|
|
||||||
// Output
|
// Output
|
||||||
|
|
||||||
//- Write geometry to file. Normally in parallel
|
//- Write geometry to file (normally in parallel).
|
||||||
|
// If all geometry is disabled, it will simply writes the mesh
|
||||||
|
// bounding box (to ensure that the geometry file is non-empty)
|
||||||
void write
|
void write
|
||||||
(
|
(
|
||||||
ensightGeoFile& os,
|
ensightGeoFile& os,
|
||||||
bool parallel = Pstream::parRun()
|
bool parallel = UPstream::parRun()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Write geometry to file. Normally in parallel
|
//- Write geometry to file (normally in parallel).
|
||||||
|
// If all geometry is disabled, it will simply writes the mesh
|
||||||
|
// bounding box (to ensure that the geometry file is non-empty)
|
||||||
inline void write
|
inline void write
|
||||||
(
|
(
|
||||||
autoPtr<ensightGeoFile>& os,
|
autoPtr<ensightGeoFile>& os,
|
||||||
bool parallel = Pstream::parRun()
|
bool parallel = UPstream::parRun()
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -46,6 +46,7 @@ namespace Foam
|
|||||||
|
|
||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
class bitSet;
|
class bitSet;
|
||||||
|
class boundBox;
|
||||||
class polyMesh;
|
class polyMesh;
|
||||||
template<class T> class InfoProxy;
|
template<class T> class InfoProxy;
|
||||||
|
|
||||||
@ -279,6 +280,16 @@ public:
|
|||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
bool parallel
|
bool parallel
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Write bounding box geometry.
|
||||||
|
//- All parameters are only relevant on master
|
||||||
|
static void writeBox
|
||||||
|
(
|
||||||
|
ensightGeoFile& os,
|
||||||
|
const boundBox& bb,
|
||||||
|
const label partIndex = 0,
|
||||||
|
const word& partName = "geometry-box"
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2024 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,7 +28,9 @@ License
|
|||||||
#include "ensightCells.H"
|
#include "ensightCells.H"
|
||||||
#include "ensightOutput.H"
|
#include "ensightOutput.H"
|
||||||
#include "InfoProxy.H"
|
#include "InfoProxy.H"
|
||||||
|
#include "boundBox.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
|
#include "cellModel.H"
|
||||||
#include "globalIndex.H"
|
#include "globalIndex.H"
|
||||||
#include "globalMeshData.H"
|
#include "globalMeshData.H"
|
||||||
#include "manifoldCellsMeshObject.H"
|
#include "manifoldCellsMeshObject.H"
|
||||||
@ -330,6 +332,44 @@ void Foam::ensightCells::write
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::ensightCells::writeBox
|
||||||
|
(
|
||||||
|
ensightGeoFile& os,
|
||||||
|
const boundBox& bb,
|
||||||
|
const label partIndex,
|
||||||
|
const word& partName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
pointField points;
|
||||||
|
cellShapeList shapes;
|
||||||
|
|
||||||
|
if (UPstream::master())
|
||||||
|
{
|
||||||
|
points = bb.hexCorners();
|
||||||
|
shapes.emplace_back(cellModel::HEX, identity(8));
|
||||||
|
}
|
||||||
|
|
||||||
|
ensightOutput::Detail::writeCoordinates
|
||||||
|
(
|
||||||
|
os,
|
||||||
|
partIndex,
|
||||||
|
partName,
|
||||||
|
8, // nPoints (global)
|
||||||
|
points,
|
||||||
|
false // serial only! (parallel=false)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (UPstream::master())
|
||||||
|
{
|
||||||
|
os.writeKeyword(ensightCells::key(ensightCells::elemType::HEXA8));
|
||||||
|
os.write(shapes.size()); // one cell (global)
|
||||||
|
os.newline();
|
||||||
|
|
||||||
|
ensightOutput::writeCellShapes(os, shapes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|||||||
@ -148,14 +148,14 @@ public:
|
|||||||
void write
|
void write
|
||||||
(
|
(
|
||||||
ensightGeoFile& os,
|
ensightGeoFile& os,
|
||||||
bool parallel = Pstream::parRun()
|
bool parallel = UPstream::parRun()
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Write geometry to file. Normally in parallel
|
//- Write geometry to file. Normally in parallel
|
||||||
inline void write
|
inline void write
|
||||||
(
|
(
|
||||||
autoPtr<ensightGeoFile>& os,
|
autoPtr<ensightGeoFile>& os,
|
||||||
bool parallel = Pstream::parRun()
|
bool parallel = UPstream::parRun()
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user